[{"data":1,"prerenderedAt":777},["ShallowReactive",2],{"navigation_docs":3,"-package":48,"-package-surround":772},[4,8,12,16,20,24,28,32,36,40,44],{"title":5,"path":6,"stem":7},"CLI","\u002Fcli","1.cli",{"title":9,"path":10,"stem":11},"Nuxt","\u002Fnuxt","2.nuxt",{"title":13,"path":14,"stem":15},"Vue","\u002Fvue","3.vue",{"title":17,"path":18,"stem":19},"Vite","\u002Fvite","4.vite",{"title":21,"path":22,"stem":23},"Nitro","\u002Fnitro","5.nitro",{"title":25,"path":26,"stem":27},"TypeScript","\u002Ftypescript","6.typescript",{"title":29,"path":30,"stem":31},"shadcn","\u002Fshadcn","7.shadcn",{"title":33,"path":34,"stem":35},"Package","\u002Fpackage","8.package",{"title":37,"path":38,"stem":39},"Extending Doctor","\u002Fextending","9.extending",{"title":41,"path":42,"stem":43},"MCP","\u002Fmcp","9.mcp",{"title":45,"path":46,"stem":47},"Pinia","\u002Fpinia","9.pinia",{"id":49,"title":33,"body":50,"description":761,"extension":762,"links":763,"meta":768,"navigation":205,"path":34,"seo":770,"stem":35,"__hash__":771},"docs\u002F8.package.md",{"type":51,"value":52,"toc":753},"minimark",[53,57,60,92,103,151,158,161,284,287,292,325,328,332,341,348,367,374,377,381,395,435,471,487,498,645,649,667,673,680,717,749],[54,55,56],"p",{},"The Package Rule Pack analyzes existing files exposed by a package manifest, the manifests of a workspace, and its pnpm lockfile. It is opt-in and works with JavaScript and TypeScript libraries, including framework modules.",[54,58,59],{},"Build the library first, then run:",[61,62,67],"pre",{"className":63,"code":64,"language":65,"meta":66,"style":66},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm vite-doctor . --extends auto,package\u002Frecommended\n","bash","",[68,69,70],"code",{"__ignoreMap":66},[71,72,75,79,83,86,89],"span",{"class":73,"line":74},"line",1,[71,76,78],{"class":77},"sBMFI","pnpm",[71,80,82],{"class":81},"sfazB"," vite-doctor",[71,84,85],{"class":81}," .",[71,87,88],{"class":81}," --extends",[71,90,91],{"class":81}," auto,package\u002Frecommended\n",[54,93,94,95,98,99,102],{},"From a workspace root, Doctor analyzes the root package and every workspace package declared by ",[68,96,97],{},"pnpm-workspace.yaml"," or the ",[68,100,101],{},"workspaces"," field, each against its own manifest. Run against a single library directory to limit the report to that package, or against a staged package directory when publishing transforms the manifest or output.",[54,104,105,106,109,110,109,113,109,116,109,119,109,122,109,125,128,129,132,133,136,137,109,139,109,141,143,144,146,147,150],{},"Doctor follows ",[68,107,108],{},"exports",", ",[68,111,112],{},"main",[68,114,115],{},"module",[68,117,118],{},"browser",[68,120,121],{},"bin",[68,123,124],{},"types",[68,126,127],{},"typings",", and ",[68,130,131],{},"typesVersions",", then follows literal imports through local files. Declaration files beside JavaScript entrypoints are included. JSDoc ",[68,134,135],{},"import()"," types in JavaScript count as declaration references only when no published declaration covers that entrypoint, through ",[68,138,124],{},[68,140,127],{},[68,142,131],{},", an export ",[68,145,124],{}," condition, or a sibling ",[68,148,149],{},".d.ts",", because TypeScript reads the declaration instead. Source files and unrelated output are not scanned by these rules unless an entrypoint references them.",[54,152,153,154,157],{},"Doctor does not execute build scripts, import package code, install dependencies, or edit the manifest. A declared dependency range is accepted without checking its installed version. Private packages are skipped. Package analysis uses the manifest and files on disk, so rebuild before relying on its findings. It does not validate tarball inclusion, conditional export precedence, or computed import specifiers. Missing referenced output makes the report incomplete. JSON and agent reports include the missing paths under ",[68,155,156],{},"evidenceGaps",". Custom loader wrappers and external browser replacements are not analyzed.",[54,159,160],{},"You can select the preset in trusted host configuration too:",[61,162,166],{"className":163,"code":164,"language":165,"meta":66,"style":66},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { doctor } from \"vite-doctor\";\n\nexport default {\n  plugins: [doctor({ extends: [\"auto\", \"package\u002Frecommended\"] })],\n};\n","ts",[68,167,168,200,207,219,278],{"__ignoreMap":66},[71,169,170,174,178,182,185,188,191,194,197],{"class":73,"line":74},[71,171,173],{"class":172},"s7zQu","import",[71,175,177],{"class":176},"sMK4o"," {",[71,179,181],{"class":180},"sTEyZ"," doctor",[71,183,184],{"class":176}," }",[71,186,187],{"class":172}," from",[71,189,190],{"class":176}," \"",[71,192,193],{"class":81},"vite-doctor",[71,195,196],{"class":176},"\"",[71,198,199],{"class":176},";\n",[71,201,203],{"class":73,"line":202},2,[71,204,206],{"emptyLinePlaceholder":205},true,"\n",[71,208,210,213,216],{"class":73,"line":209},3,[71,211,212],{"class":172},"export",[71,214,215],{"class":172}," default",[71,217,218],{"class":176}," {\n",[71,220,222,226,229,232,236,239,242,245,247,249,251,254,256,259,261,264,266,269,272,275],{"class":73,"line":221},4,[71,223,225],{"class":224},"swJcz","  plugins",[71,227,228],{"class":176},":",[71,230,231],{"class":180}," [",[71,233,235],{"class":234},"s2Zo4","doctor",[71,237,238],{"class":180},"(",[71,240,241],{"class":176},"{",[71,243,244],{"class":224}," extends",[71,246,228],{"class":176},[71,248,231],{"class":180},[71,250,196],{"class":176},[71,252,253],{"class":81},"auto",[71,255,196],{"class":176},[71,257,258],{"class":176},",",[71,260,190],{"class":176},[71,262,263],{"class":81},"package\u002Frecommended",[71,265,196],{"class":176},[71,267,268],{"class":180},"] ",[71,270,271],{"class":176},"}",[71,273,274],{"class":180},")]",[71,276,277],{"class":176},",\n",[71,279,281],{"class":73,"line":280},5,[71,282,283],{"class":176},"};\n",[54,285,286],{},"Use a standalone Doctor Run after building when the Plugin Surface runs before output has been written.",[288,289,291],"h2",{"id":290},"phantom-dependencies","Phantom dependencies",[54,293,294,297,298,301,302,305,306,109,309,312,313,316,317,320,321,324],{},[68,295,296],{},"package\u002Fno-phantom-dependencies"," reports ",[68,299,300],{},"PKG0001"," for an external JavaScript reference and ",[68,303,304],{},"PKG0002"," for an external type reference. Consumer declarations in ",[68,307,308],{},"dependencies",[68,310,311],{},"peerDependencies",", or ",[68,314,315],{},"optionalDependencies"," satisfy the rule. ",[68,318,319],{},"devDependencies"," do not. A declared ",[68,322,323],{},"@types"," provider can satisfy a type reference.",[54,326,327],{},"Choose dependencies when the library owns the package, and peers when the host must provide it. Doctor suggests that choice without rewriting the manifest or guessing a supported version range. Guarded imports still need a declaration, usually an optional peer.",[288,329,331],{"id":330},"required-optional-peers","Required optional peers",[54,333,334,297,337,340],{},[68,335,336],{},"package\u002Fno-required-optional-peer",[68,338,339],{},"PKG0003"," when a peer marked optional is loaded unconditionally from a default entrypoint. Static imports, re-exports, top-level CommonJS loads, and direct top-level awaited imports are followed through required local chunks.",[54,342,343,344,347],{},"Dedicated integration subpaths that the default entrypoint does not load are allowed. Declarations, guarded loads, deferred loads, and shadowed ",[68,345,346],{},"require"," calls are skipped. This is a conservative rule, not a proof that every optional integration handles missing peers correctly.",[54,349,350,352,353,355,356,359,360,363,364,366],{},[68,351,339],{}," also checks every ",[68,354,108],{}," subpath for packages that a dependency's subpath needs but does not install. When a subpath loads another package's subpath unconditionally, such as ",[68,357,358],{},"nitro\u002Fkv",", Doctor reads that installed package's manifest and output and follows the subpath to the packages it loads unconditionally. A package that installing the dependency does not install, because it is an optional peer, only a devDependency, or undeclared there, such as ",[68,361,362],{},"unstorage"," for ",[68,365,358],{},", is reported when the library does not declare it either. A library that declares it as an optional peer gets the same treatment as its own optional peers: only its default entrypoint is reported. A dependency's own default entrypoint is that package's concern and is not followed.",[54,368,369,370,373],{},"Each diagnostic names the export subpath and the import chain from its entry file to the optional package, one ",[68,371,372],{},"file:line \"specifier\""," per hop.",[54,375,376],{},"Make the peer required when every consumer needs it. Otherwise isolate the integration behind a deferred load that handles absence or a dedicated subpath.",[288,378,380],{"id":379},"singleton-packages","Singleton packages",[54,382,383,384,387,388,390,391,394],{},"These rules and ",[68,385,386],{},"package\u002Fno-unforwarded-peer"," read manifests, ",[68,389,97],{}," and ",[68,392,393],{},"pnpm-lock.yaml",", not built output, so they need no build or install.",[54,396,397,398,109,401,109,404,109,407,109,410,109,413,109,416,109,419,109,422,109,425,109,428,128,431,434],{},"Some packages must load once per app: ",[68,399,400],{},"vue",[68,402,403],{},"vue-router",[68,405,406],{},"pinia",[68,408,409],{},"nuxt",[68,411,412],{},"nitro",[68,414,415],{},"h3",[68,417,418],{},"vite",[68,420,421],{},"react",[68,423,424],{},"react-dom",[68,426,427],{},"drizzle-orm",[68,429,430],{},"graphql",[68,432,433],{},"yjs",". A second copy splits their state or fails their identity checks, so injections, stores and app context go missing, and h3 errors or Drizzle tables from one copy are rejected by the other.",[54,436,437,297,440,443,444,390,446,449,450,452,453,455,456,459,460,462,463,466,467,470],{},[68,438,439],{},"package\u002Fno-pinned-singleton",[68,441,442],{},"PKG0005"," for an exact version of a singleton in ",[68,445,311],{},[68,447,448],{},"PKG0006"," for one in ",[68,451,308],{}," or ",[68,454,315],{}," of a published workspace package. It resolves ",[68,457,458],{},"catalog:"," through ",[68,461,97],{}," and treats ",[68,464,465],{},"workspace:*"," as the exact version pnpm publishes. Declare the peer as a range that accepts the app's copy, such as ",[68,468,469],{},"^3.5.44",", and take singletons from the app as peers instead of dependencies.",[54,472,473,297,476,479,480,482,483,486],{},[68,474,475],{},"package\u002Fno-duplicate-singleton",[68,477,478],{},"PKG0008"," when ",[68,481,393],{}," resolves two versions of the same major of a singleton in one install: a workspace package with its dependencies and development dependencies, plus what its linked workspace dependencies publish. Each duplicate is reported once, at the ",[68,484,485],{},"package.json"," entry where it enters the workspace, with the lockfile path to each version. Copies of one version that differ only by pnpm's peer suffix, and different majors, are not reported. Only pnpm lockfile version 9 is read; other package managers' lockfiles are not.",[54,488,489,490,493,494,497],{},"Add packages to both rules with the ",[68,491,492],{},"singletons"," option. ",[68,495,496],{},"@scope\u002F*"," matches a whole scope:",[61,499,504],{"className":500,"code":501,"filename":502,"language":503,"meta":66,"style":66},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"rules\": {\n    \"package\u002Fno-pinned-singleton\": [\"warn\", { \"singletons\": [\"comark\", \"@ai-sdk\u002F*\"] }],\n    \"package\u002Fno-duplicate-singleton\": [\"warn\", { \"singletons\": [\"comark\", \"@ai-sdk\u002F*\"] }]\n  }\n}\n","doctor.config.json","json",[68,505,506,511,526,583,634,639],{"__ignoreMap":66},[71,507,508],{"class":73,"line":74},[71,509,510],{"class":176},"{\n",[71,512,513,516,520,522,524],{"class":73,"line":202},[71,514,515],{"class":176},"  \"",[71,517,519],{"class":518},"spNyl","rules",[71,521,196],{"class":176},[71,523,228],{"class":176},[71,525,218],{"class":176},[71,527,528,531,533,535,537,539,541,544,546,548,550,552,555,557,559,561,563,566,568,570,572,575,577,580],{"class":73,"line":209},[71,529,530],{"class":176},"    \"",[71,532,439],{"class":77},[71,534,196],{"class":176},[71,536,228],{"class":176},[71,538,231],{"class":176},[71,540,196],{"class":176},[71,542,543],{"class":81},"warn",[71,545,196],{"class":176},[71,547,258],{"class":176},[71,549,177],{"class":176},[71,551,190],{"class":176},[71,553,492],{"class":554},"sbssI",[71,556,196],{"class":176},[71,558,228],{"class":176},[71,560,231],{"class":176},[71,562,196],{"class":176},[71,564,565],{"class":81},"comark",[71,567,196],{"class":176},[71,569,258],{"class":176},[71,571,190],{"class":176},[71,573,574],{"class":81},"@ai-sdk\u002F*",[71,576,196],{"class":176},[71,578,579],{"class":176},"]",[71,581,582],{"class":176}," }],\n",[71,584,585,587,589,591,593,595,597,599,601,603,605,607,609,611,613,615,617,619,621,623,625,627,629,631],{"class":73,"line":221},[71,586,530],{"class":176},[71,588,475],{"class":77},[71,590,196],{"class":176},[71,592,228],{"class":176},[71,594,231],{"class":176},[71,596,196],{"class":176},[71,598,543],{"class":81},[71,600,196],{"class":176},[71,602,258],{"class":176},[71,604,177],{"class":176},[71,606,190],{"class":176},[71,608,492],{"class":554},[71,610,196],{"class":176},[71,612,228],{"class":176},[71,614,231],{"class":176},[71,616,196],{"class":176},[71,618,565],{"class":81},[71,620,196],{"class":176},[71,622,258],{"class":176},[71,624,190],{"class":176},[71,626,574],{"class":81},[71,628,196],{"class":176},[71,630,579],{"class":176},[71,632,633],{"class":176}," }]\n",[71,635,636],{"class":73,"line":280},[71,637,638],{"class":176},"  }\n",[71,640,642],{"class":73,"line":641},6,[71,643,644],{"class":176},"}\n",[288,646,648],{"id":647},"forwarded-workspace-peers","Forwarded workspace peers",[54,650,651,297,653,656,657,109,659,312,661,663,664,666],{},[68,652,386],{},[68,654,655],{},"PKG0007"," when a published workspace package depends on another workspace package and does not declare that package's required peers. Peers are resolved from the packages above the one that declares them, so an app that installs only the dependent package gets no peer under strict peers, or a copy it does not share. Declarations in ",[68,658,308],{},[68,660,315],{},[68,662,311],{}," satisfy the rule; ",[68,665,319],{}," do not. Optional peers are skipped.",[54,668,669,670,672],{},"Add the peer to the dependent package's ",[68,671,311],{}," with the same specifier. If it never loads the code that needs the peer, declare an optional peer instead.",[288,674,676,677,679],{"id":675},"optional-import-outside-a-try","Optional ",[68,678,135],{}," outside a try",[54,681,682,297,685,688,689,691,692,695,696,699,700,703,704,707,708,710,711,713,714,716],{},[68,683,684],{},"package\u002Foptional-peer-import-in-try",[68,686,687],{},"PKG0004"," when JavaScript reachable from an export calls ",[68,690,135],{}," with the literal name of an optional peer or optional dependency, and neither a direct ",[68,693,694],{},"await import()"," in a ",[68,697,698],{},"try"," body in the same function nor a ",[68,701,702],{},".catch()"," or two-argument ",[68,705,706],{},".then()"," on the ",[68,709,135],{}," handles a missing package. esbuild, and Wrangler and Netlify builds through it, fails a consumer's build on such an ",[68,712,135],{}," when the package is not installed, even if the code never runs. A ",[68,715,698],{}," in a caller, or a loader callback passed to a helper that catches, does not count.",[54,718,719,720,722,723,109,726,109,728,312,730,733,734,109,736,312,739,742,743,452,745,748],{},"An export that already loads the package unconditionally is dedicated to it, so its ",[68,721,135],{}," calls are skipped. Computed specifiers are skipped too, because bundlers leave them for run time. So is build tooling that Node loads directly: exports with a path segment such as ",[68,724,725],{},"cli",[68,727,418],{},[68,729,409],{},[68,731,732],{},"test",", exports that load a build tool such as ",[68,735,418],{},[68,737,738],{},"@nuxt\u002Fkit",[68,740,741],{},"vitest"," unconditionally, and packages named ",[68,744,725],{},[68,746,747],{},"*-cli",".",[750,751,752],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":66,"searchDepth":202,"depth":202,"links":754},[755,756,757,758,759],{"id":290,"depth":202,"text":291},{"id":330,"depth":202,"text":331},{"id":379,"depth":202,"text":380},{"id":647,"depth":202,"text":648},{"id":675,"depth":202,"text":760},"Optional import() outside a try","Diagnose dependency contracts in a library's built output, its manifest, and the lockfile.","md",[764],{"label":765,"icon":766,"to":767},"Package rules","i-lucide-list-checks","\u002Fpackage\u002Frules",{"icon":769},"i-lucide-package",{"title":33,"description":761},"P3B2gT33boU8rqF3vwL8b_woTdDEdt264zhniwn0OzM",[773,775],{"title":29,"path":30,"stem":31,"description":774,"children":-1},"Diagnose design-system classes and styles with the Shadcn Rule Pack.",{"title":37,"path":38,"stem":39,"description":776,"children":-1},"Write custom Rules, ship them with a Vite plugin or Nuxt module, and test them.",1795268780665]