@stll/oxlint-config 1.6.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/cloud-setup-cli.mjs +1 -1
  3. package/dist/consumer-compat-cli.cjs.map +1 -1
  4. package/dist/consumer-compat-cli.mjs.map +1 -1
  5. package/dist/consumer-node-support.mjs +1 -1
  6. package/dist/dependabot.d.cts +10 -0
  7. package/dist/dependabot.d.mts +10 -0
  8. package/dist/engine-support-cli.cjs.map +1 -1
  9. package/dist/engine-support-cli.mjs.map +1 -1
  10. package/dist/git-tracked-output.cjs.map +1 -1
  11. package/dist/git-tracked-output.mjs.map +1 -1
  12. package/dist/publish-artifact-syntax.cjs.map +1 -1
  13. package/dist/publish-artifact-syntax.mjs.map +1 -1
  14. package/dist/publish-build-target-vite-dts-helper2.cjs.map +1 -1
  15. package/dist/publish-build-target-vite-dts-helper2.mjs.map +1 -1
  16. package/dist/publish-contract-cli.cjs.map +1 -1
  17. package/dist/publish-contract-cli.mjs.map +1 -1
  18. package/dist/quarantine-policy2.cjs.map +1 -1
  19. package/dist/quarantine-policy2.mjs.map +1 -1
  20. package/dist/toolchain-changed.cjs +1 -3
  21. package/dist/toolchain-changed.cjs.map +1 -1
  22. package/dist/toolchain-changed.mjs +2 -4
  23. package/dist/toolchain-changed.mjs.map +1 -1
  24. package/dist/toolchain-dependabot.cjs.map +1 -1
  25. package/dist/toolchain-dependabot.mjs +1 -1
  26. package/dist/toolchain-dependabot.mjs.map +1 -1
  27. package/dist/toolchain-guard.cjs +11 -4
  28. package/dist/toolchain-guard.cjs.map +1 -1
  29. package/dist/toolchain-guard.mjs +12 -5
  30. package/dist/toolchain-guard.mjs.map +1 -1
  31. package/dist/toolchain-inputs.cjs +99 -9
  32. package/dist/toolchain-inputs.cjs.map +1 -1
  33. package/dist/toolchain-inputs.mjs +88 -10
  34. package/dist/toolchain-inputs.mjs.map +1 -1
  35. package/dist/toolchain-schema.cjs +179 -1
  36. package/dist/toolchain-schema.cjs.map +1 -1
  37. package/dist/toolchain-schema.mjs +167 -3
  38. package/dist/toolchain-schema.mjs.map +1 -1
  39. package/dist/typecheck-parity.cjs.map +1 -1
  40. package/dist/typecheck-parity.mjs.map +1 -1
  41. package/dist/wasi-loader-normalizer-cli.cjs.map +1 -1
  42. package/dist/wasi-loader-normalizer-cli.mjs.map +1 -1
  43. package/package.json +2 -4
  44. package/toolchain.json +54 -12
@@ -1 +1 @@
1
- {"version":3,"file":"publish-build-target-vite-dts-helper2.cjs","names":["record","path","createHash","lstatSync","readdirSync","readFileSync","realpathSync","require","createRequire","path","readFileSync","compilerPackages"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.0.3\",\n \"unplugin-dts\": \"1.0.3\",\n} as const;\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst staticEntries = (value: unknown): [string, unknown][] => {\n if (\n !record(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n )\n throw new Error(\"Declaration plugin options must be plain static records\");\n return Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\n \"Declaration plugin options cannot contain accessors or symbols\",\n );\n return [key, descriptor.value];\n });\n};\n\nconst relativePattern = (value: unknown): string => {\n if (\n typeof value !== \"string\" ||\n value.trim() === \"\" ||\n path.posix.isAbsolute(value) ||\n /^[A-Za-z]:/.test(value) ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin paths must stay within the package\");\n return value;\n};\nconst patterns = (value: unknown) => {\n if (typeof value === \"string\") return relativePattern(value);\n if (!Array.isArray(value) || value.length === 0)\n throw new Error(\"Declaration plugin include/exclude must be static paths\");\n return Object.freeze(value.map(relativePattern));\n};\n\n/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */\nexport type ReviewedViteDtsOptions = {\n include?: string | readonly string[];\n exclude?: string | readonly string[];\n entryRoot?: string;\n pathsToAliases?: boolean;\n compilerOptions?: Readonly<{ declarationMap: false }>;\n strictOutput?: true;\n declarationOnly?: false;\n};\nexport const reviewedViteDtsOptions = (value: unknown = {}) => {\n const result: ReviewedViteDtsOptions = {};\n for (const [key, entry] of staticEntries(value)) {\n switch (key) {\n case \"include\":\n case \"exclude\":\n result[key] = patterns(entry);\n break;\n case \"entryRoot\":\n result.entryRoot = relativePattern(entry);\n break;\n case \"pathsToAliases\":\n if (typeof entry !== \"boolean\")\n throw new Error(\"pathsToAliases must be a static boolean\");\n result.pathsToAliases = entry;\n break;\n case \"compilerOptions\": {\n const entries = staticEntries(entry);\n if (\n entries.length !== 1 ||\n entries.at(0)?.[0] !== \"declarationMap\" ||\n entries.at(0)?.[1] !== false\n )\n throw new Error(\n \"Only compilerOptions.declarationMap=false is reviewed\",\n );\n result.compilerOptions = Object.freeze({ declarationMap: false });\n break;\n }\n case \"strictOutput\":\n if (entry !== true)\n throw new Error(\"Declaration output containment cannot be disabled\");\n result.strictOutput = true;\n break;\n case \"declarationOnly\":\n if (entry !== false)\n throw new Error(\n \"Declaration plugin cannot remove JavaScript outputs\",\n );\n result.declarationOnly = false;\n break;\n default:\n throw new Error(`Unreviewed declaration plugin option: ${key}`);\n }\n }\n return Object.freeze(result);\n};\n\nexport type DeclarationOutputSnapshot = Readonly<Record<string, string>>;\nconst hash = (value: string | Uint8Array) =>\n createHash(\"sha256\").update(value).digest(\"hex\");\nexport const declarationPath = (file: string) =>\n /\\.d\\.(?:ts|mts|cts)(?:\\.map)?$/.test(file);\nconst safeOutputPath = (file: string) => {\n if (\n file === \"\" ||\n path.posix.isAbsolute(file) ||\n /^[A-Za-z]:/.test(file) ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n file.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin emitted an unsafe output path\");\n};\n\n/** Capture bytes now; later mutations cannot alter this frozen snapshot. */\nexport const snapshotDeclarationDirectory = (\n directory: string,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n if (lstatSync(directory, { throwIfNoEntry: false }) === undefined)\n return Object.freeze(result);\n const visit = (current: string) => {\n const stat = lstatSync(current);\n if (stat.isSymbolicLink())\n throw new Error(\"Declaration output cannot contain symlinks\");\n if (stat.isDirectory()) {\n for (const entry of readdirSync(current))\n visit(path.join(current, entry));\n return;\n }\n if (!stat.isFile())\n throw new Error(\"Declaration output must contain regular files\");\n Object.defineProperty(\n result,\n path.relative(directory, current).split(path.sep).join(\"/\"),\n { value: hash(readFileSync(current)), enumerable: true },\n );\n };\n visit(directory);\n return Object.freeze(result);\n};\n\nexport const snapshotDeclarationBundle = (\n bundle: unknown,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n for (const [file, entry] of staticEntries(bundle)) {\n safeOutputPath(file);\n if (\n !record(entry) ||\n entry[\"fileName\"] !== file ||\n ![\"asset\", \"chunk\"].includes(String(entry[\"type\"]))\n )\n throw new Error(\"Invalid declaration bundle entry\");\n if (declarationPath(file) && entry[\"type\"] !== \"asset\")\n throw new Error(\"Declarations must be emitted as assets\");\n const type = entry[\"type\"];\n const bytes = type === \"chunk\" ? entry[\"code\"] : entry[\"source\"];\n if (typeof bytes !== \"string\" && !(bytes instanceof Uint8Array))\n throw new Error(\"Declaration bundle output must contain text or bytes\");\n Object.defineProperty(result, file, {\n value: `${String(type)}:${hash(bytes)}`,\n enumerable: true,\n });\n }\n return Object.freeze(result);\n};\n\ntype DeclarationOutputOptions = {\n before: DeclarationOutputSnapshot;\n after: DeclarationOutputSnapshot;\n};\n/** This plugin may only add or change declaration files; every existing non-declaration is immutable. */\nexport const assertDeclarationOnlyOutput = ({\n before,\n after,\n}: DeclarationOutputOptions) => {\n for (const file of new Set([...Object.keys(before), ...Object.keys(after)])) {\n safeOutputPath(file);\n if (!declarationPath(file) && before[file] !== after[file])\n throw new Error(\n `Declaration plugin changed non-declaration output: ${file}`,\n );\n }\n};\n\nconst passiveContextMethods = new Set([\n \"warn\",\n \"error\",\n \"info\",\n \"debug\",\n \"addWatchFile\",\n \"getWatchFiles\",\n \"parse\",\n \"resolve\",\n \"getModuleInfo\",\n \"getModuleIds\",\n \"getFileName\",\n]);\nconst contextData = (value: unknown): unknown => {\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\", \"undefined\"].includes(typeof value)\n )\n return value;\n if (Array.isArray(value)) return Object.freeze(value.map(contextData));\n const snapshot = {};\n Object.setPrototypeOf(snapshot, null);\n for (const [key, entry] of staticEntries(value))\n Object.defineProperty(snapshot, key, {\n value: contextData(entry),\n enumerable: true,\n });\n return Object.freeze(snapshot);\n};\nconst declarationAssetName = (value: unknown) => {\n if (typeof value !== \"string\")\n throw new Error(\"Declaration plugin requires an explicit asset fileName\");\n safeOutputPath(value);\n if (!declarationPath(value))\n throw new Error(\n `Declaration plugin emitted non-declaration asset: ${value}`,\n );\n return value;\n};\n\n/** One build owns all emitter references, including assets materialized after the producer hook. */\nexport const createDeclarationEmissionLedger = () => {\n const references = new Map<\n string,\n { fileName: string; getFileName: () => unknown }\n >();\n const wrapContext = (host: unknown) => {\n const receiver = record(host) ? host : {};\n const hostMethod = (name: string) => {\n const method: unknown = receiver[name];\n if (typeof method !== \"function\")\n throw new Error(`Declaration plugin host method unavailable: ${name}`);\n return (...args: unknown[]): unknown =>\n Reflect.apply(method, receiver, args);\n };\n const methods = new Map<string, (...args: unknown[]) => unknown>();\n methods.set(\"emitFile\", (asset: unknown) => {\n const entries = staticEntries(asset);\n if (!record(asset) || asset[\"type\"] !== \"asset\")\n throw new Error(\"Declaration plugin may only emit assets\");\n const fileName = declarationAssetName(asset[\"fileName\"]);\n for (const [, value] of entries)\n if (typeof value === \"function\")\n throw new Error(\"Declaration plugin asset metadata must be static\");\n const source = asset[\"source\"];\n if (\n source !== undefined &&\n typeof source !== \"string\" &&\n !(source instanceof Uint8Array)\n )\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n const getFileName = hostMethod(\"getFileName\");\n const emitted: Record<string, unknown> = {};\n for (const [key, value] of entries) {\n const copied =\n value instanceof Uint8Array\n ? new Uint8Array(value)\n : contextData(value);\n Object.defineProperty(emitted, key, {\n value: copied,\n enumerable: true,\n });\n }\n const reference = hostMethod(\"emitFile\")(emitted);\n if (typeof reference !== \"string\" || references.has(reference))\n throw new Error(\n \"Declaration plugin emitted an invalid asset reference\",\n );\n references.set(reference, {\n fileName,\n getFileName: () => getFileName(reference),\n });\n return reference;\n });\n methods.set(\"setAssetSource\", (reference: unknown, source: unknown) => {\n if (typeof reference !== \"string\" || !references.has(reference))\n throw new Error(\n \"Declaration plugin cannot update a foreign asset reference\",\n );\n if (typeof source !== \"string\" && !(source instanceof Uint8Array))\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n return hostMethod(\"setAssetSource\")(reference, source);\n });\n const surrogate: Record<string, unknown> = {};\n Object.setPrototypeOf(surrogate, null);\n return new Proxy(surrogate, {\n get: (_target, key) => {\n if (typeof key !== \"string\")\n throw new Error(\"Declaration plugin context symbols are unsupported\");\n const method = methods.get(key);\n if (method !== undefined) return method;\n if (passiveContextMethods.has(key)) {\n const forwarded = hostMethod(key);\n methods.set(key, forwarded);\n return forwarded;\n }\n const value: unknown = receiver[key];\n if (key === \"meta\") return contextData(value);\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof value)\n )\n return value;\n throw new Error(\n `Declaration plugin context capability is unsupported: ${key}`,\n );\n },\n set: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n defineProperty: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n setPrototypeOf: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n });\n };\n const audit = () => {\n for (const [reference, emission] of references) {\n const resolved = declarationAssetName(emission.getFileName());\n if (resolved !== emission.fileName)\n throw new Error(\n `Declaration plugin asset reference changed filename: ${reference}`,\n );\n }\n };\n return { wrapContext, audit };\n};\nexport type DeclarationEmissionLedger = ReturnType<\n typeof createDeclarationEmissionLedger\n>;\n\ntype GuardDeclarationHookOptions = {\n hook: unknown;\n hookName: string;\n outputDirectories: readonly string[];\n ledger?: DeclarationEmissionLedger;\n};\n/** Substitute a closed producer context while guarding the actual hook invocation. */\nexport const guardDeclarationHook = ({\n hook,\n hookName,\n outputDirectories,\n ledger = createDeclarationEmissionLedger(),\n}: GuardDeclarationHookOptions) => {\n if (typeof hook !== \"function\")\n throw new Error(\"Invalid reviewed declaration hook\");\n const producer = hook;\n async function guarded(this: unknown, ...args: unknown[]) {\n const beforeDirectories = outputDirectories.map(\n snapshotDeclarationDirectory,\n );\n const bundle = [\"generateBundle\", \"writeBundle\"].includes(hookName)\n ? args.at(1)\n : undefined;\n const beforeBundle =\n bundle === undefined ? undefined : snapshotDeclarationBundle(bundle);\n const result: unknown = await Reflect.apply(\n producer,\n ledger.wrapContext(this),\n args,\n );\n if (result !== undefined)\n throw new Error(\n `Declaration plugin hook ${hookName} returned a dynamic build change`,\n );\n if (beforeBundle !== undefined)\n assertDeclarationOnlyOutput({\n before: beforeBundle,\n after: snapshotDeclarationBundle(bundle),\n });\n for (const [index, directory] of outputDirectories.entries()) {\n const before = beforeDirectories.at(index);\n if (before === undefined)\n throw new Error(\"Missing declaration output snapshot\");\n assertDeclarationOnlyOutput({\n before,\n after: snapshotDeclarationDirectory(directory),\n });\n }\n if ([\"generateBundle\", \"writeBundle\"].includes(hookName)) ledger.audit();\n return result;\n }\n return guarded;\n};\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\n\nimport { compilerPackages } from \"./compiler-packages\";\nimport {\n createDeclarationEmissionLedger,\n guardDeclarationHook,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n type ReviewedViteDtsOptions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: plugin[name],\n hookName: name,\n outputDirectories,\n ledger,\n });\n const configResolved = hook(\"configResolved\");\n return {\n name: \"stll:declaration-only-dts\",\n apply: \"build\",\n enforce: \"pre\",\n config: hook(\"config\"),\n async configResolved(config) {\n if (\n realpathSync(config.root) !== root ||\n config.build.write === false ||\n config.build.watch\n )\n throw new Error(\n \"Declaration-only adapter requires a package-local production build\",\n );\n const output = path.resolve(root, config.build.outDir);\n const relative = path.relative(root, output);\n if (\n relative === \"\" ||\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n )\n throw new Error(\n \"Declaration output directory must stay within the package\",\n );\n // Check existing ancestor paths before the declaration plugin can write.\n let ancestor = output;\n while (ancestor !== root) {\n try {\n const resolved = realpathSync(ancestor);\n const within = path.relative(root, resolved);\n if (\n within === \"..\" ||\n within.startsWith(`..${path.sep}`) ||\n path.isAbsolute(within)\n )\n throw new Error(\"Declaration output directory leaves the package\");\n break;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"ENOENT\") throw error;\n ancestor = path.dirname(ancestor);\n }\n }\n outputDirectories.push(output);\n await configResolved.call(this, config);\n },\n buildStart: hook(\"buildStart\"),\n transform: hook(\"transform\"),\n watchChange: hook(\"watchChange\"),\n generateBundle: {\n order: \"post\",\n async handler(outputOptions, bundle, isWrite) {\n await hook(\"generateBundle\").call(this, outputOptions, bundle, isWrite);\n ledger.audit();\n },\n },\n writeBundle: {\n order: \"post\",\n async handler(outputOptions, bundle) {\n await hook(\"writeBundle\").call(this, outputOptions, bundle);\n ledger.audit();\n },\n },\n };\n};\n"],"mappings":";;;;;;;;AAIA,MAAa,0BAA0B;CACrC,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,iBAAiB,UAAwC;CAC7D,IACE,CAACA,SAAO,KAAK,KACb,CAAC,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,eAAe,KAAK,CAAC,GAE/D,MAAM,IAAI,MAAM,yDAAyD;CAC3E,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,QAAQ;EACzC,MAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;EAC7D,IAAI,OAAO,QAAQ,YAAY,CAAC,cAAc,EAAE,WAAW,aACzD,MAAM,IAAI,MACR,gEACF;EACF,OAAO,CAAC,KAAK,WAAW,KAAK;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Eb,MAAM,IAAI,MACR,oEACF;GACF,MAAM,SAASG,UAAAA,QAAK,QAAQ,MAAM,OAAO,MAAM,MAAM;GACrD,MAAM,WAAWA,UAAAA,QAAK,SAAS,MAAM,MAAM;GAC3C,IACE,aAAa,MACb,aAAa,QACb,SAAS,WAAW,KAAKA,UAAAA,QAAK,KAAK,KACnCA,UAAAA,QAAK,WAAW,QAAQ,GAExB,MAAM,IAAI,MACR,2DACF;GAEF,IAAI,WAAW;GACf,OAAO,aAAa,MAClB,IAAI;IACF,MAAM,YAAA,GAAWH,QAAAA,aAAAA,CAAa,QAAQ;IACtC,MAAM,SAASG,UAAAA,QAAK,SAAS,MAAM,QAAQ;IAC3C,IACE,WAAW,QACX,OAAO,WAAW,KAAKA,UAAAA,QAAK,KAAK,KACjCA,UAAAA,QAAK,WAAW,MAAM,GAEtB,MAAM,IAAI,MAAM,iDAAiD;IACnE;GACF,SAAS,OAAO;IACd,IAAI,CAAC,OAAO,KAAK,KAAK,MAAM,YAAY,UAAU,MAAM;IACxD,WAAWA,UAAAA,QAAK,QAAQ,QAAQ;GAClC;GAEF,kBAAkB,KAAK,MAAM;GAC7B,MAAM,eAAe,KAAK,MAAM,MAAM;EACxC;EACA,YAAY,KAAK,YAAY;EAC7B,WAAW,KAAK,WAAW;EAC3B,aAAa,KAAK,aAAa;EAC/B,gBAAgB;GACd,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ,SAAS;IAC5C,MAAM,KAAK,gBAAgB,CAAC,CAAC,KAAK,MAAM,eAAe,QAAQ,OAAO;IACtE,OAAO,MAAM;GACf;EACF;EACA,aAAa;GACX,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ;IACnC,MAAM,KAAK,aAAa,CAAC,CAAC,KAAK,MAAM,eAAe,MAAM;IAC1D,OAAO,MAAM;GACf;EACF;CACF;AACF"}
1
+ {"version":3,"file":"publish-build-target-vite-dts-helper2.cjs","names":["record","path","createHash","lstatSync","readdirSync","readFileSync","realpathSync","require","createRequire","path","readFileSync","compilerPackages"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.0.3\",\n \"unplugin-dts\": \"1.0.3\",\n} as const;\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst staticEntries = (value: unknown): [string, unknown][] => {\n if (\n !record(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n )\n throw new Error(\"Declaration plugin options must be plain static records\");\n return Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\n \"Declaration plugin options cannot contain accessors or symbols\",\n );\n return [key, descriptor.value];\n });\n};\n\nconst relativePattern = (value: unknown): string => {\n if (\n typeof value !== \"string\" ||\n value.trim() === \"\" ||\n path.posix.isAbsolute(value) ||\n /^[A-Za-z]:/.test(value) ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin paths must stay within the package\");\n return value;\n};\nconst patterns = (value: unknown) => {\n if (typeof value === \"string\") return relativePattern(value);\n if (!Array.isArray(value) || value.length === 0)\n throw new Error(\"Declaration plugin include/exclude must be static paths\");\n return Object.freeze(value.map(relativePattern));\n};\n\n/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */\nexport type ReviewedViteDtsOptions = {\n include?: string | readonly string[];\n exclude?: string | readonly string[];\n entryRoot?: string;\n pathsToAliases?: boolean;\n compilerOptions?: Readonly<{ declarationMap: false }>;\n strictOutput?: true;\n declarationOnly?: false;\n};\nexport const reviewedViteDtsOptions = (value: unknown = {}) => {\n const result: ReviewedViteDtsOptions = {};\n for (const [key, entry] of staticEntries(value)) {\n switch (key) {\n case \"include\":\n case \"exclude\":\n result[key] = patterns(entry);\n break;\n case \"entryRoot\":\n result.entryRoot = relativePattern(entry);\n break;\n case \"pathsToAliases\":\n if (typeof entry !== \"boolean\")\n throw new Error(\"pathsToAliases must be a static boolean\");\n result.pathsToAliases = entry;\n break;\n case \"compilerOptions\": {\n const entries = staticEntries(entry);\n if (\n entries.length !== 1 ||\n entries.at(0)?.[0] !== \"declarationMap\" ||\n entries.at(0)?.[1] !== false\n )\n throw new Error(\n \"Only compilerOptions.declarationMap=false is reviewed\",\n );\n result.compilerOptions = Object.freeze({ declarationMap: false });\n break;\n }\n case \"strictOutput\":\n if (entry !== true)\n throw new Error(\"Declaration output containment cannot be disabled\");\n result.strictOutput = true;\n break;\n case \"declarationOnly\":\n if (entry !== false)\n throw new Error(\n \"Declaration plugin cannot remove JavaScript outputs\",\n );\n result.declarationOnly = false;\n break;\n default:\n throw new Error(`Unreviewed declaration plugin option: ${key}`);\n }\n }\n return Object.freeze(result);\n};\n\nexport type DeclarationOutputSnapshot = Readonly<Record<string, string>>;\nconst hash = (value: string | Uint8Array) =>\n createHash(\"sha256\").update(value).digest(\"hex\");\nexport const declarationPath = (file: string) =>\n /\\.d\\.(?:ts|mts|cts)(?:\\.map)?$/.test(file);\nconst safeOutputPath = (file: string) => {\n if (\n file === \"\" ||\n path.posix.isAbsolute(file) ||\n /^[A-Za-z]:/.test(file) ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n file.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin emitted an unsafe output path\");\n};\n\n/** Capture bytes now; later mutations cannot alter this frozen snapshot. */\nexport const snapshotDeclarationDirectory = (\n directory: string,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n if (lstatSync(directory, { throwIfNoEntry: false }) === undefined)\n return Object.freeze(result);\n const visit = (current: string) => {\n const stat = lstatSync(current);\n if (stat.isSymbolicLink())\n throw new Error(\"Declaration output cannot contain symlinks\");\n if (stat.isDirectory()) {\n for (const entry of readdirSync(current))\n visit(path.join(current, entry));\n return;\n }\n if (!stat.isFile())\n throw new Error(\"Declaration output must contain regular files\");\n Object.defineProperty(\n result,\n path.relative(directory, current).split(path.sep).join(\"/\"),\n { value: hash(readFileSync(current)), enumerable: true },\n );\n };\n visit(directory);\n return Object.freeze(result);\n};\n\nexport const snapshotDeclarationBundle = (\n bundle: unknown,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n for (const [file, entry] of staticEntries(bundle)) {\n safeOutputPath(file);\n if (\n !record(entry) ||\n entry[\"fileName\"] !== file ||\n ![\"asset\", \"chunk\"].includes(String(entry[\"type\"]))\n )\n throw new Error(\"Invalid declaration bundle entry\");\n if (declarationPath(file) && entry[\"type\"] !== \"asset\")\n throw new Error(\"Declarations must be emitted as assets\");\n const type = entry[\"type\"];\n const bytes = type === \"chunk\" ? entry[\"code\"] : entry[\"source\"];\n if (typeof bytes !== \"string\" && !(bytes instanceof Uint8Array))\n throw new Error(\"Declaration bundle output must contain text or bytes\");\n Object.defineProperty(result, file, {\n value: `${String(type)}:${hash(bytes)}`,\n enumerable: true,\n });\n }\n return Object.freeze(result);\n};\n\ntype DeclarationOutputOptions = {\n before: DeclarationOutputSnapshot;\n after: DeclarationOutputSnapshot;\n};\n/** This plugin may only add or change declaration files; every existing non-declaration is immutable. */\nexport const assertDeclarationOnlyOutput = ({\n before,\n after,\n}: DeclarationOutputOptions) => {\n for (const file of new Set([...Object.keys(before), ...Object.keys(after)])) {\n safeOutputPath(file);\n if (!declarationPath(file) && before[file] !== after[file])\n throw new Error(\n `Declaration plugin changed non-declaration output: ${file}`,\n );\n }\n};\n\nconst passiveContextMethods = new Set([\n \"warn\",\n \"error\",\n \"info\",\n \"debug\",\n \"addWatchFile\",\n \"getWatchFiles\",\n \"parse\",\n \"resolve\",\n \"getModuleInfo\",\n \"getModuleIds\",\n \"getFileName\",\n]);\nconst contextData = (value: unknown): unknown => {\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\", \"undefined\"].includes(typeof value)\n )\n return value;\n if (Array.isArray(value)) return Object.freeze(value.map(contextData));\n const snapshot = {};\n Object.setPrototypeOf(snapshot, null);\n for (const [key, entry] of staticEntries(value))\n Object.defineProperty(snapshot, key, {\n value: contextData(entry),\n enumerable: true,\n });\n return Object.freeze(snapshot);\n};\nconst declarationAssetName = (value: unknown) => {\n if (typeof value !== \"string\")\n throw new Error(\"Declaration plugin requires an explicit asset fileName\");\n safeOutputPath(value);\n if (!declarationPath(value))\n throw new Error(\n `Declaration plugin emitted non-declaration asset: ${value}`,\n );\n return value;\n};\n\n/** One build owns all emitter references, including assets materialized after the producer hook. */\nexport const createDeclarationEmissionLedger = () => {\n const references = new Map<\n string,\n { fileName: string; getFileName: () => unknown }\n >();\n const wrapContext = (host: unknown) => {\n const receiver = record(host) ? host : {};\n const hostMethod = (name: string) => {\n const method: unknown = receiver[name];\n if (typeof method !== \"function\")\n throw new Error(`Declaration plugin host method unavailable: ${name}`);\n return (...args: unknown[]): unknown =>\n Reflect.apply(method, receiver, args);\n };\n const methods = new Map<string, (...args: unknown[]) => unknown>();\n methods.set(\"emitFile\", (asset: unknown) => {\n const entries = staticEntries(asset);\n if (!record(asset) || asset[\"type\"] !== \"asset\")\n throw new Error(\"Declaration plugin may only emit assets\");\n const fileName = declarationAssetName(asset[\"fileName\"]);\n for (const [, value] of entries)\n if (typeof value === \"function\")\n throw new Error(\"Declaration plugin asset metadata must be static\");\n const source = asset[\"source\"];\n if (\n source !== undefined &&\n typeof source !== \"string\" &&\n !(source instanceof Uint8Array)\n )\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n const getFileName = hostMethod(\"getFileName\");\n const emitted: Record<string, unknown> = {};\n for (const [key, value] of entries) {\n const copied =\n value instanceof Uint8Array\n ? new Uint8Array(value)\n : contextData(value);\n Object.defineProperty(emitted, key, {\n value: copied,\n enumerable: true,\n });\n }\n const reference = hostMethod(\"emitFile\")(emitted);\n if (typeof reference !== \"string\" || references.has(reference))\n throw new Error(\n \"Declaration plugin emitted an invalid asset reference\",\n );\n references.set(reference, {\n fileName,\n getFileName: () => getFileName(reference),\n });\n return reference;\n });\n methods.set(\"setAssetSource\", (reference: unknown, source: unknown) => {\n if (typeof reference !== \"string\" || !references.has(reference))\n throw new Error(\n \"Declaration plugin cannot update a foreign asset reference\",\n );\n if (typeof source !== \"string\" && !(source instanceof Uint8Array))\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n return hostMethod(\"setAssetSource\")(reference, source);\n });\n const surrogate: Record<string, unknown> = {};\n Object.setPrototypeOf(surrogate, null);\n return new Proxy(surrogate, {\n get: (_target, key) => {\n if (typeof key !== \"string\")\n throw new Error(\"Declaration plugin context symbols are unsupported\");\n const method = methods.get(key);\n if (method !== undefined) return method;\n if (passiveContextMethods.has(key)) {\n const forwarded = hostMethod(key);\n methods.set(key, forwarded);\n return forwarded;\n }\n const value: unknown = receiver[key];\n if (key === \"meta\") return contextData(value);\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof value)\n )\n return value;\n throw new Error(\n `Declaration plugin context capability is unsupported: ${key}`,\n );\n },\n set: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n defineProperty: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n setPrototypeOf: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n });\n };\n const audit = () => {\n for (const [reference, emission] of references) {\n const resolved = declarationAssetName(emission.getFileName());\n if (resolved !== emission.fileName)\n throw new Error(\n `Declaration plugin asset reference changed filename: ${reference}`,\n );\n }\n };\n return { wrapContext, audit };\n};\nexport type DeclarationEmissionLedger = ReturnType<\n typeof createDeclarationEmissionLedger\n>;\n\ntype GuardDeclarationHookOptions = {\n hook: unknown;\n hookName: string;\n outputDirectories: readonly string[];\n ledger?: DeclarationEmissionLedger;\n};\n/** Substitute a closed producer context while guarding the actual hook invocation. */\nexport const guardDeclarationHook = ({\n hook,\n hookName,\n outputDirectories,\n ledger = createDeclarationEmissionLedger(),\n}: GuardDeclarationHookOptions) => {\n if (typeof hook !== \"function\")\n throw new Error(\"Invalid reviewed declaration hook\");\n const producer = hook;\n async function guarded(this: unknown, ...args: unknown[]) {\n const beforeDirectories = outputDirectories.map(\n snapshotDeclarationDirectory,\n );\n const bundle = [\"generateBundle\", \"writeBundle\"].includes(hookName)\n ? args.at(1)\n : undefined;\n const beforeBundle =\n bundle === undefined ? undefined : snapshotDeclarationBundle(bundle);\n const result: unknown = await Reflect.apply(\n producer,\n ledger.wrapContext(this),\n args,\n );\n if (result !== undefined)\n throw new Error(\n `Declaration plugin hook ${hookName} returned a dynamic build change`,\n );\n if (beforeBundle !== undefined)\n assertDeclarationOnlyOutput({\n before: beforeBundle,\n after: snapshotDeclarationBundle(bundle),\n });\n for (const [index, directory] of outputDirectories.entries()) {\n const before = beforeDirectories.at(index);\n if (before === undefined)\n throw new Error(\"Missing declaration output snapshot\");\n assertDeclarationOnlyOutput({\n before,\n after: snapshotDeclarationDirectory(directory),\n });\n }\n if ([\"generateBundle\", \"writeBundle\"].includes(hookName)) ledger.audit();\n return result;\n }\n return guarded;\n};\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\n\nimport { compilerPackages } from \"./compiler-packages\";\nimport {\n createDeclarationEmissionLedger,\n guardDeclarationHook,\n type ReviewedViteDtsOptions,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: plugin[name],\n hookName: name,\n outputDirectories,\n ledger,\n });\n const configResolved = hook(\"configResolved\");\n return {\n name: \"stll:declaration-only-dts\",\n apply: \"build\",\n enforce: \"pre\",\n config: hook(\"config\"),\n async configResolved(config) {\n if (\n realpathSync(config.root) !== root ||\n config.build.write === false ||\n config.build.watch\n )\n throw new Error(\n \"Declaration-only adapter requires a package-local production build\",\n );\n const output = path.resolve(root, config.build.outDir);\n const relative = path.relative(root, output);\n if (\n relative === \"\" ||\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n )\n throw new Error(\n \"Declaration output directory must stay within the package\",\n );\n // Check existing ancestor paths before the declaration plugin can write.\n let ancestor = output;\n while (ancestor !== root) {\n try {\n const resolved = realpathSync(ancestor);\n const within = path.relative(root, resolved);\n if (\n within === \"..\" ||\n within.startsWith(`..${path.sep}`) ||\n path.isAbsolute(within)\n )\n throw new Error(\"Declaration output directory leaves the package\");\n break;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"ENOENT\") throw error;\n ancestor = path.dirname(ancestor);\n }\n }\n outputDirectories.push(output);\n await configResolved.call(this, config);\n },\n buildStart: hook(\"buildStart\"),\n transform: hook(\"transform\"),\n watchChange: hook(\"watchChange\"),\n generateBundle: {\n order: \"post\",\n async handler(outputOptions, bundle, isWrite) {\n await hook(\"generateBundle\").call(this, outputOptions, bundle, isWrite);\n ledger.audit();\n },\n },\n writeBundle: {\n order: \"post\",\n async handler(outputOptions, bundle) {\n await hook(\"writeBundle\").call(this, outputOptions, bundle);\n ledger.audit();\n },\n },\n };\n};\n"],"mappings":";;;;;;;;AAIA,MAAa,0BAA0B;CACrC,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,iBAAiB,UAAwC;CAC7D,IACE,CAACA,SAAO,KAAK,KACb,CAAC,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,eAAe,KAAK,CAAC,GAE/D,MAAM,IAAI,MAAM,yDAAyD;CAC3E,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,QAAQ;EACzC,MAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;EAC7D,IAAI,OAAO,QAAQ,YAAY,CAAC,cAAc,EAAE,WAAW,aACzD,MAAM,IAAI,MACR,gEACF;EACF,OAAO,CAAC,KAAK,WAAW,KAAK;CAC/B,CAAC;AACH;AAEA,MAAM,mBAAmB,UAA2B;CAClD,IACE,OAAO,UAAU,YACjB,MAAM,KAAK,MAAM,MACjBC,UAAAA,QAAK,MAAM,WAAW,KAAK,KAC3B,aAAa,KAAK,KAAK,KACvB,MAAM,SAAS,IAAI,KACnB,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,IAAI,GAE9B,MAAM,IAAI,MAAM,uDAAuD;CACzE,OAAO;AACT;AACA,MAAM,YAAY,UAAmB;CACnC,IAAI,OAAO,UAAU,UAAU,OAAO,gBAAgB,KAAK;CAC3D,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAC5C,MAA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;IAC3C,IACE,WAAW,QACX,OAAO,WAAW,KAAKA,UAAAA,QAAK,KAAK,KACjCA,UAAAA,QAAK,WAAW,MAAM,GAEtB,MAAM,IAAI,MAAM,iDAAiD;IACnE;GACF,SAAS,OAAO;IACd,IAAI,CAAC,OAAO,KAAK,KAAK,MAAM,YAAY,UAAU,MAAM;IACxD,WAAWA,UAAAA,QAAK,QAAQ,QAAQ;GAClC;GAEF,kBAAkB,KAAK,MAAM;GAC7B,MAAM,eAAe,KAAK,MAAM,MAAM;EACxC;EACA,YAAY,KAAK,YAAY;EAC7B,WAAW,KAAK,WAAW;EAC3B,aAAa,KAAK,aAAa;EAC/B,gBAAgB;GACd,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ,SAAS;IAC5C,MAAM,KAAK,gBAAgB,CAAC,CAAC,KAAK,MAAM,eAAe,QAAQ,OAAO;IACtE,OAAO,MAAM;GACf;EACF;EACA,aAAa;GACX,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ;IACnC,MAAM,KAAK,aAAa,CAAC,CAAC,KAAK,MAAM,eAAe,MAAM;IAC1D,OAAO,MAAM;GACf;EACF;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"publish-build-target-vite-dts-helper2.mjs","names":["record"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.0.3\",\n \"unplugin-dts\": \"1.0.3\",\n} as const;\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst staticEntries = (value: unknown): [string, unknown][] => {\n if (\n !record(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n )\n throw new Error(\"Declaration plugin options must be plain static records\");\n return Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\n \"Declaration plugin options cannot contain accessors or symbols\",\n );\n return [key, descriptor.value];\n });\n};\n\nconst relativePattern = (value: unknown): string => {\n if (\n typeof value !== \"string\" ||\n value.trim() === \"\" ||\n path.posix.isAbsolute(value) ||\n /^[A-Za-z]:/.test(value) ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin paths must stay within the package\");\n return value;\n};\nconst patterns = (value: unknown) => {\n if (typeof value === \"string\") return relativePattern(value);\n if (!Array.isArray(value) || value.length === 0)\n throw new Error(\"Declaration plugin include/exclude must be static paths\");\n return Object.freeze(value.map(relativePattern));\n};\n\n/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */\nexport type ReviewedViteDtsOptions = {\n include?: string | readonly string[];\n exclude?: string | readonly string[];\n entryRoot?: string;\n pathsToAliases?: boolean;\n compilerOptions?: Readonly<{ declarationMap: false }>;\n strictOutput?: true;\n declarationOnly?: false;\n};\nexport const reviewedViteDtsOptions = (value: unknown = {}) => {\n const result: ReviewedViteDtsOptions = {};\n for (const [key, entry] of staticEntries(value)) {\n switch (key) {\n case \"include\":\n case \"exclude\":\n result[key] = patterns(entry);\n break;\n case \"entryRoot\":\n result.entryRoot = relativePattern(entry);\n break;\n case \"pathsToAliases\":\n if (typeof entry !== \"boolean\")\n throw new Error(\"pathsToAliases must be a static boolean\");\n result.pathsToAliases = entry;\n break;\n case \"compilerOptions\": {\n const entries = staticEntries(entry);\n if (\n entries.length !== 1 ||\n entries.at(0)?.[0] !== \"declarationMap\" ||\n entries.at(0)?.[1] !== false\n )\n throw new Error(\n \"Only compilerOptions.declarationMap=false is reviewed\",\n );\n result.compilerOptions = Object.freeze({ declarationMap: false });\n break;\n }\n case \"strictOutput\":\n if (entry !== true)\n throw new Error(\"Declaration output containment cannot be disabled\");\n result.strictOutput = true;\n break;\n case \"declarationOnly\":\n if (entry !== false)\n throw new Error(\n \"Declaration plugin cannot remove JavaScript outputs\",\n );\n result.declarationOnly = false;\n break;\n default:\n throw new Error(`Unreviewed declaration plugin option: ${key}`);\n }\n }\n return Object.freeze(result);\n};\n\nexport type DeclarationOutputSnapshot = Readonly<Record<string, string>>;\nconst hash = (value: string | Uint8Array) =>\n createHash(\"sha256\").update(value).digest(\"hex\");\nexport const declarationPath = (file: string) =>\n /\\.d\\.(?:ts|mts|cts)(?:\\.map)?$/.test(file);\nconst safeOutputPath = (file: string) => {\n if (\n file === \"\" ||\n path.posix.isAbsolute(file) ||\n /^[A-Za-z]:/.test(file) ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n file.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin emitted an unsafe output path\");\n};\n\n/** Capture bytes now; later mutations cannot alter this frozen snapshot. */\nexport const snapshotDeclarationDirectory = (\n directory: string,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n if (lstatSync(directory, { throwIfNoEntry: false }) === undefined)\n return Object.freeze(result);\n const visit = (current: string) => {\n const stat = lstatSync(current);\n if (stat.isSymbolicLink())\n throw new Error(\"Declaration output cannot contain symlinks\");\n if (stat.isDirectory()) {\n for (const entry of readdirSync(current))\n visit(path.join(current, entry));\n return;\n }\n if (!stat.isFile())\n throw new Error(\"Declaration output must contain regular files\");\n Object.defineProperty(\n result,\n path.relative(directory, current).split(path.sep).join(\"/\"),\n { value: hash(readFileSync(current)), enumerable: true },\n );\n };\n visit(directory);\n return Object.freeze(result);\n};\n\nexport const snapshotDeclarationBundle = (\n bundle: unknown,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n for (const [file, entry] of staticEntries(bundle)) {\n safeOutputPath(file);\n if (\n !record(entry) ||\n entry[\"fileName\"] !== file ||\n ![\"asset\", \"chunk\"].includes(String(entry[\"type\"]))\n )\n throw new Error(\"Invalid declaration bundle entry\");\n if (declarationPath(file) && entry[\"type\"] !== \"asset\")\n throw new Error(\"Declarations must be emitted as assets\");\n const type = entry[\"type\"];\n const bytes = type === \"chunk\" ? entry[\"code\"] : entry[\"source\"];\n if (typeof bytes !== \"string\" && !(bytes instanceof Uint8Array))\n throw new Error(\"Declaration bundle output must contain text or bytes\");\n Object.defineProperty(result, file, {\n value: `${String(type)}:${hash(bytes)}`,\n enumerable: true,\n });\n }\n return Object.freeze(result);\n};\n\ntype DeclarationOutputOptions = {\n before: DeclarationOutputSnapshot;\n after: DeclarationOutputSnapshot;\n};\n/** This plugin may only add or change declaration files; every existing non-declaration is immutable. */\nexport const assertDeclarationOnlyOutput = ({\n before,\n after,\n}: DeclarationOutputOptions) => {\n for (const file of new Set([...Object.keys(before), ...Object.keys(after)])) {\n safeOutputPath(file);\n if (!declarationPath(file) && before[file] !== after[file])\n throw new Error(\n `Declaration plugin changed non-declaration output: ${file}`,\n );\n }\n};\n\nconst passiveContextMethods = new Set([\n \"warn\",\n \"error\",\n \"info\",\n \"debug\",\n \"addWatchFile\",\n \"getWatchFiles\",\n \"parse\",\n \"resolve\",\n \"getModuleInfo\",\n \"getModuleIds\",\n \"getFileName\",\n]);\nconst contextData = (value: unknown): unknown => {\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\", \"undefined\"].includes(typeof value)\n )\n return value;\n if (Array.isArray(value)) return Object.freeze(value.map(contextData));\n const snapshot = {};\n Object.setPrototypeOf(snapshot, null);\n for (const [key, entry] of staticEntries(value))\n Object.defineProperty(snapshot, key, {\n value: contextData(entry),\n enumerable: true,\n });\n return Object.freeze(snapshot);\n};\nconst declarationAssetName = (value: unknown) => {\n if (typeof value !== \"string\")\n throw new Error(\"Declaration plugin requires an explicit asset fileName\");\n safeOutputPath(value);\n if (!declarationPath(value))\n throw new Error(\n `Declaration plugin emitted non-declaration asset: ${value}`,\n );\n return value;\n};\n\n/** One build owns all emitter references, including assets materialized after the producer hook. */\nexport const createDeclarationEmissionLedger = () => {\n const references = new Map<\n string,\n { fileName: string; getFileName: () => unknown }\n >();\n const wrapContext = (host: unknown) => {\n const receiver = record(host) ? host : {};\n const hostMethod = (name: string) => {\n const method: unknown = receiver[name];\n if (typeof method !== \"function\")\n throw new Error(`Declaration plugin host method unavailable: ${name}`);\n return (...args: unknown[]): unknown =>\n Reflect.apply(method, receiver, args);\n };\n const methods = new Map<string, (...args: unknown[]) => unknown>();\n methods.set(\"emitFile\", (asset: unknown) => {\n const entries = staticEntries(asset);\n if (!record(asset) || asset[\"type\"] !== \"asset\")\n throw new Error(\"Declaration plugin may only emit assets\");\n const fileName = declarationAssetName(asset[\"fileName\"]);\n for (const [, value] of entries)\n if (typeof value === \"function\")\n throw new Error(\"Declaration plugin asset metadata must be static\");\n const source = asset[\"source\"];\n if (\n source !== undefined &&\n typeof source !== \"string\" &&\n !(source instanceof Uint8Array)\n )\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n const getFileName = hostMethod(\"getFileName\");\n const emitted: Record<string, unknown> = {};\n for (const [key, value] of entries) {\n const copied =\n value instanceof Uint8Array\n ? new Uint8Array(value)\n : contextData(value);\n Object.defineProperty(emitted, key, {\n value: copied,\n enumerable: true,\n });\n }\n const reference = hostMethod(\"emitFile\")(emitted);\n if (typeof reference !== \"string\" || references.has(reference))\n throw new Error(\n \"Declaration plugin emitted an invalid asset reference\",\n );\n references.set(reference, {\n fileName,\n getFileName: () => getFileName(reference),\n });\n return reference;\n });\n methods.set(\"setAssetSource\", (reference: unknown, source: unknown) => {\n if (typeof reference !== \"string\" || !references.has(reference))\n throw new Error(\n \"Declaration plugin cannot update a foreign asset reference\",\n );\n if (typeof source !== \"string\" && !(source instanceof Uint8Array))\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n return hostMethod(\"setAssetSource\")(reference, source);\n });\n const surrogate: Record<string, unknown> = {};\n Object.setPrototypeOf(surrogate, null);\n return new Proxy(surrogate, {\n get: (_target, key) => {\n if (typeof key !== \"string\")\n throw new Error(\"Declaration plugin context symbols are unsupported\");\n const method = methods.get(key);\n if (method !== undefined) return method;\n if (passiveContextMethods.has(key)) {\n const forwarded = hostMethod(key);\n methods.set(key, forwarded);\n return forwarded;\n }\n const value: unknown = receiver[key];\n if (key === \"meta\") return contextData(value);\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof value)\n )\n return value;\n throw new Error(\n `Declaration plugin context capability is unsupported: ${key}`,\n );\n },\n set: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n defineProperty: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n setPrototypeOf: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n });\n };\n const audit = () => {\n for (const [reference, emission] of references) {\n const resolved = declarationAssetName(emission.getFileName());\n if (resolved !== emission.fileName)\n throw new Error(\n `Declaration plugin asset reference changed filename: ${reference}`,\n );\n }\n };\n return { wrapContext, audit };\n};\nexport type DeclarationEmissionLedger = ReturnType<\n typeof createDeclarationEmissionLedger\n>;\n\ntype GuardDeclarationHookOptions = {\n hook: unknown;\n hookName: string;\n outputDirectories: readonly string[];\n ledger?: DeclarationEmissionLedger;\n};\n/** Substitute a closed producer context while guarding the actual hook invocation. */\nexport const guardDeclarationHook = ({\n hook,\n hookName,\n outputDirectories,\n ledger = createDeclarationEmissionLedger(),\n}: GuardDeclarationHookOptions) => {\n if (typeof hook !== \"function\")\n throw new Error(\"Invalid reviewed declaration hook\");\n const producer = hook;\n async function guarded(this: unknown, ...args: unknown[]) {\n const beforeDirectories = outputDirectories.map(\n snapshotDeclarationDirectory,\n );\n const bundle = [\"generateBundle\", \"writeBundle\"].includes(hookName)\n ? args.at(1)\n : undefined;\n const beforeBundle =\n bundle === undefined ? undefined : snapshotDeclarationBundle(bundle);\n const result: unknown = await Reflect.apply(\n producer,\n ledger.wrapContext(this),\n args,\n );\n if (result !== undefined)\n throw new Error(\n `Declaration plugin hook ${hookName} returned a dynamic build change`,\n );\n if (beforeBundle !== undefined)\n assertDeclarationOnlyOutput({\n before: beforeBundle,\n after: snapshotDeclarationBundle(bundle),\n });\n for (const [index, directory] of outputDirectories.entries()) {\n const before = beforeDirectories.at(index);\n if (before === undefined)\n throw new Error(\"Missing declaration output snapshot\");\n assertDeclarationOnlyOutput({\n before,\n after: snapshotDeclarationDirectory(directory),\n });\n }\n if ([\"generateBundle\", \"writeBundle\"].includes(hookName)) ledger.audit();\n return result;\n }\n return guarded;\n};\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\n\nimport { compilerPackages } from \"./compiler-packages\";\nimport {\n createDeclarationEmissionLedger,\n guardDeclarationHook,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n type ReviewedViteDtsOptions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: plugin[name],\n hookName: name,\n outputDirectories,\n ledger,\n });\n const configResolved = hook(\"configResolved\");\n return {\n name: \"stll:declaration-only-dts\",\n apply: \"build\",\n enforce: \"pre\",\n config: hook(\"config\"),\n async configResolved(config) {\n if (\n realpathSync(config.root) !== root ||\n config.build.write === false ||\n config.build.watch\n )\n throw new Error(\n \"Declaration-only adapter requires a package-local production build\",\n );\n const output = path.resolve(root, config.build.outDir);\n const relative = path.relative(root, output);\n if (\n relative === \"\" ||\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n )\n throw new Error(\n \"Declaration output directory must stay within the package\",\n );\n // Check existing ancestor paths before the declaration plugin can write.\n let ancestor = output;\n while (ancestor !== root) {\n try {\n const resolved = realpathSync(ancestor);\n const within = path.relative(root, resolved);\n if (\n within === \"..\" ||\n within.startsWith(`..${path.sep}`) ||\n path.isAbsolute(within)\n )\n throw new Error(\"Declaration output directory leaves the package\");\n break;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"ENOENT\") throw error;\n ancestor = path.dirname(ancestor);\n }\n }\n outputDirectories.push(output);\n await configResolved.call(this, config);\n },\n buildStart: hook(\"buildStart\"),\n transform: hook(\"transform\"),\n watchChange: hook(\"watchChange\"),\n generateBundle: {\n order: \"post\",\n async handler(outputOptions, bundle, isWrite) {\n await hook(\"generateBundle\").call(this, outputOptions, bundle, isWrite);\n ledger.audit();\n },\n },\n writeBundle: {\n order: \"post\",\n async handler(outputOptions, bundle) {\n await hook(\"writeBundle\").call(this, outputOptions, bundle);\n ledger.audit();\n },\n },\n };\n};\n"],"mappings":";;;;;;AAIA,MAAa,0BAA0B;CACrC,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,iBAAiB,UAAwC;CAC7D,IACE,CAACA,SAAO,KA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,OAEb,MAAM,IAAI,MACR,oEACF;GACF,MAAM,SAAS,KAAK,QAAQ,MAAM,OAAO,MAAM,MAAM;GACrD,MAAM,WAAW,KAAK,SAAS,MAAM,MAAM;GAC3C,IACE,aAAa,MACb,aAAa,QACb,SAAS,WAAW,KAAK,KAAK,KAAK,KACnC,KAAK,WAAW,QAAQ,GAExB,MAAM,IAAI,MACR,2DACF;GAEF,IAAI,WAAW;GACf,OAAO,aAAa,MAClB,IAAI;IACF,MAAM,WAAW,aAAa,QAAQ;IACtC,MAAM,SAAS,KAAK,SAAS,MAAM,QAAQ;IAC3C,IACE,WAAW,QACX,OAAO,WAAW,KAAK,KAAK,KAAK,KACjC,KAAK,WAAW,MAAM,GAEtB,MAAM,IAAI,MAAM,iDAAiD;IACnE;GACF,SAAS,OAAO;IACd,IAAI,CAAC,OAAO,KAAK,KAAK,MAAM,YAAY,UAAU,MAAM;IACxD,WAAW,KAAK,QAAQ,QAAQ;GAClC;GAEF,kBAAkB,KAAK,MAAM;GAC7B,MAAM,eAAe,KAAK,MAAM,MAAM;EACxC;EACA,YAAY,KAAK,YAAY;EAC7B,WAAW,KAAK,WAAW;EAC3B,aAAa,KAAK,aAAa;EAC/B,gBAAgB;GACd,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ,SAAS;IAC5C,MAAM,KAAK,gBAAgB,CAAC,CAAC,KAAK,MAAM,eAAe,QAAQ,OAAO;IACtE,OAAO,MAAM;GACf;EACF;EACA,aAAa;GACX,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ;IACnC,MAAM,KAAK,aAAa,CAAC,CAAC,KAAK,MAAM,eAAe,MAAM;IAC1D,OAAO,MAAM;GACf;EACF;CACF;AACF"}
1
+ {"version":3,"file":"publish-build-target-vite-dts-helper2.mjs","names":["record"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.0.3\",\n \"unplugin-dts\": \"1.0.3\",\n} as const;\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst staticEntries = (value: unknown): [string, unknown][] => {\n if (\n !record(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n )\n throw new Error(\"Declaration plugin options must be plain static records\");\n return Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\n \"Declaration plugin options cannot contain accessors or symbols\",\n );\n return [key, descriptor.value];\n });\n};\n\nconst relativePattern = (value: unknown): string => {\n if (\n typeof value !== \"string\" ||\n value.trim() === \"\" ||\n path.posix.isAbsolute(value) ||\n /^[A-Za-z]:/.test(value) ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin paths must stay within the package\");\n return value;\n};\nconst patterns = (value: unknown) => {\n if (typeof value === \"string\") return relativePattern(value);\n if (!Array.isArray(value) || value.length === 0)\n throw new Error(\"Declaration plugin include/exclude must be static paths\");\n return Object.freeze(value.map(relativePattern));\n};\n\n/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */\nexport type ReviewedViteDtsOptions = {\n include?: string | readonly string[];\n exclude?: string | readonly string[];\n entryRoot?: string;\n pathsToAliases?: boolean;\n compilerOptions?: Readonly<{ declarationMap: false }>;\n strictOutput?: true;\n declarationOnly?: false;\n};\nexport const reviewedViteDtsOptions = (value: unknown = {}) => {\n const result: ReviewedViteDtsOptions = {};\n for (const [key, entry] of staticEntries(value)) {\n switch (key) {\n case \"include\":\n case \"exclude\":\n result[key] = patterns(entry);\n break;\n case \"entryRoot\":\n result.entryRoot = relativePattern(entry);\n break;\n case \"pathsToAliases\":\n if (typeof entry !== \"boolean\")\n throw new Error(\"pathsToAliases must be a static boolean\");\n result.pathsToAliases = entry;\n break;\n case \"compilerOptions\": {\n const entries = staticEntries(entry);\n if (\n entries.length !== 1 ||\n entries.at(0)?.[0] !== \"declarationMap\" ||\n entries.at(0)?.[1] !== false\n )\n throw new Error(\n \"Only compilerOptions.declarationMap=false is reviewed\",\n );\n result.compilerOptions = Object.freeze({ declarationMap: false });\n break;\n }\n case \"strictOutput\":\n if (entry !== true)\n throw new Error(\"Declaration output containment cannot be disabled\");\n result.strictOutput = true;\n break;\n case \"declarationOnly\":\n if (entry !== false)\n throw new Error(\n \"Declaration plugin cannot remove JavaScript outputs\",\n );\n result.declarationOnly = false;\n break;\n default:\n throw new Error(`Unreviewed declaration plugin option: ${key}`);\n }\n }\n return Object.freeze(result);\n};\n\nexport type DeclarationOutputSnapshot = Readonly<Record<string, string>>;\nconst hash = (value: string | Uint8Array) =>\n createHash(\"sha256\").update(value).digest(\"hex\");\nexport const declarationPath = (file: string) =>\n /\\.d\\.(?:ts|mts|cts)(?:\\.map)?$/.test(file);\nconst safeOutputPath = (file: string) => {\n if (\n file === \"\" ||\n path.posix.isAbsolute(file) ||\n /^[A-Za-z]:/.test(file) ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n file.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin emitted an unsafe output path\");\n};\n\n/** Capture bytes now; later mutations cannot alter this frozen snapshot. */\nexport const snapshotDeclarationDirectory = (\n directory: string,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n if (lstatSync(directory, { throwIfNoEntry: false }) === undefined)\n return Object.freeze(result);\n const visit = (current: string) => {\n const stat = lstatSync(current);\n if (stat.isSymbolicLink())\n throw new Error(\"Declaration output cannot contain symlinks\");\n if (stat.isDirectory()) {\n for (const entry of readdirSync(current))\n visit(path.join(current, entry));\n return;\n }\n if (!stat.isFile())\n throw new Error(\"Declaration output must contain regular files\");\n Object.defineProperty(\n result,\n path.relative(directory, current).split(path.sep).join(\"/\"),\n { value: hash(readFileSync(current)), enumerable: true },\n );\n };\n visit(directory);\n return Object.freeze(result);\n};\n\nexport const snapshotDeclarationBundle = (\n bundle: unknown,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n for (const [file, entry] of staticEntries(bundle)) {\n safeOutputPath(file);\n if (\n !record(entry) ||\n entry[\"fileName\"] !== file ||\n ![\"asset\", \"chunk\"].includes(String(entry[\"type\"]))\n )\n throw new Error(\"Invalid declaration bundle entry\");\n if (declarationPath(file) && entry[\"type\"] !== \"asset\")\n throw new Error(\"Declarations must be emitted as assets\");\n const type = entry[\"type\"];\n const bytes = type === \"chunk\" ? entry[\"code\"] : entry[\"source\"];\n if (typeof bytes !== \"string\" && !(bytes instanceof Uint8Array))\n throw new Error(\"Declaration bundle output must contain text or bytes\");\n Object.defineProperty(result, file, {\n value: `${String(type)}:${hash(bytes)}`,\n enumerable: true,\n });\n }\n return Object.freeze(result);\n};\n\ntype DeclarationOutputOptions = {\n before: DeclarationOutputSnapshot;\n after: DeclarationOutputSnapshot;\n};\n/** This plugin may only add or change declaration files; every existing non-declaration is immutable. */\nexport const assertDeclarationOnlyOutput = ({\n before,\n after,\n}: DeclarationOutputOptions) => {\n for (const file of new Set([...Object.keys(before), ...Object.keys(after)])) {\n safeOutputPath(file);\n if (!declarationPath(file) && before[file] !== after[file])\n throw new Error(\n `Declaration plugin changed non-declaration output: ${file}`,\n );\n }\n};\n\nconst passiveContextMethods = new Set([\n \"warn\",\n \"error\",\n \"info\",\n \"debug\",\n \"addWatchFile\",\n \"getWatchFiles\",\n \"parse\",\n \"resolve\",\n \"getModuleInfo\",\n \"getModuleIds\",\n \"getFileName\",\n]);\nconst contextData = (value: unknown): unknown => {\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\", \"undefined\"].includes(typeof value)\n )\n return value;\n if (Array.isArray(value)) return Object.freeze(value.map(contextData));\n const snapshot = {};\n Object.setPrototypeOf(snapshot, null);\n for (const [key, entry] of staticEntries(value))\n Object.defineProperty(snapshot, key, {\n value: contextData(entry),\n enumerable: true,\n });\n return Object.freeze(snapshot);\n};\nconst declarationAssetName = (value: unknown) => {\n if (typeof value !== \"string\")\n throw new Error(\"Declaration plugin requires an explicit asset fileName\");\n safeOutputPath(value);\n if (!declarationPath(value))\n throw new Error(\n `Declaration plugin emitted non-declaration asset: ${value}`,\n );\n return value;\n};\n\n/** One build owns all emitter references, including assets materialized after the producer hook. */\nexport const createDeclarationEmissionLedger = () => {\n const references = new Map<\n string,\n { fileName: string; getFileName: () => unknown }\n >();\n const wrapContext = (host: unknown) => {\n const receiver = record(host) ? host : {};\n const hostMethod = (name: string) => {\n const method: unknown = receiver[name];\n if (typeof method !== \"function\")\n throw new Error(`Declaration plugin host method unavailable: ${name}`);\n return (...args: unknown[]): unknown =>\n Reflect.apply(method, receiver, args);\n };\n const methods = new Map<string, (...args: unknown[]) => unknown>();\n methods.set(\"emitFile\", (asset: unknown) => {\n const entries = staticEntries(asset);\n if (!record(asset) || asset[\"type\"] !== \"asset\")\n throw new Error(\"Declaration plugin may only emit assets\");\n const fileName = declarationAssetName(asset[\"fileName\"]);\n for (const [, value] of entries)\n if (typeof value === \"function\")\n throw new Error(\"Declaration plugin asset metadata must be static\");\n const source = asset[\"source\"];\n if (\n source !== undefined &&\n typeof source !== \"string\" &&\n !(source instanceof Uint8Array)\n )\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n const getFileName = hostMethod(\"getFileName\");\n const emitted: Record<string, unknown> = {};\n for (const [key, value] of entries) {\n const copied =\n value instanceof Uint8Array\n ? new Uint8Array(value)\n : contextData(value);\n Object.defineProperty(emitted, key, {\n value: copied,\n enumerable: true,\n });\n }\n const reference = hostMethod(\"emitFile\")(emitted);\n if (typeof reference !== \"string\" || references.has(reference))\n throw new Error(\n \"Declaration plugin emitted an invalid asset reference\",\n );\n references.set(reference, {\n fileName,\n getFileName: () => getFileName(reference),\n });\n return reference;\n });\n methods.set(\"setAssetSource\", (reference: unknown, source: unknown) => {\n if (typeof reference !== \"string\" || !references.has(reference))\n throw new Error(\n \"Declaration plugin cannot update a foreign asset reference\",\n );\n if (typeof source !== \"string\" && !(source instanceof Uint8Array))\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n return hostMethod(\"setAssetSource\")(reference, source);\n });\n const surrogate: Record<string, unknown> = {};\n Object.setPrototypeOf(surrogate, null);\n return new Proxy(surrogate, {\n get: (_target, key) => {\n if (typeof key !== \"string\")\n throw new Error(\"Declaration plugin context symbols are unsupported\");\n const method = methods.get(key);\n if (method !== undefined) return method;\n if (passiveContextMethods.has(key)) {\n const forwarded = hostMethod(key);\n methods.set(key, forwarded);\n return forwarded;\n }\n const value: unknown = receiver[key];\n if (key === \"meta\") return contextData(value);\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof value)\n )\n return value;\n throw new Error(\n `Declaration plugin context capability is unsupported: ${key}`,\n );\n },\n set: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n defineProperty: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n setPrototypeOf: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n });\n };\n const audit = () => {\n for (const [reference, emission] of references) {\n const resolved = declarationAssetName(emission.getFileName());\n if (resolved !== emission.fileName)\n throw new Error(\n `Declaration plugin asset reference changed filename: ${reference}`,\n );\n }\n };\n return { wrapContext, audit };\n};\nexport type DeclarationEmissionLedger = ReturnType<\n typeof createDeclarationEmissionLedger\n>;\n\ntype GuardDeclarationHookOptions = {\n hook: unknown;\n hookName: string;\n outputDirectories: readonly string[];\n ledger?: DeclarationEmissionLedger;\n};\n/** Substitute a closed producer context while guarding the actual hook invocation. */\nexport const guardDeclarationHook = ({\n hook,\n hookName,\n outputDirectories,\n ledger = createDeclarationEmissionLedger(),\n}: GuardDeclarationHookOptions) => {\n if (typeof hook !== \"function\")\n throw new Error(\"Invalid reviewed declaration hook\");\n const producer = hook;\n async function guarded(this: unknown, ...args: unknown[]) {\n const beforeDirectories = outputDirectories.map(\n snapshotDeclarationDirectory,\n );\n const bundle = [\"generateBundle\", \"writeBundle\"].includes(hookName)\n ? args.at(1)\n : undefined;\n const beforeBundle =\n bundle === undefined ? undefined : snapshotDeclarationBundle(bundle);\n const result: unknown = await Reflect.apply(\n producer,\n ledger.wrapContext(this),\n args,\n );\n if (result !== undefined)\n throw new Error(\n `Declaration plugin hook ${hookName} returned a dynamic build change`,\n );\n if (beforeBundle !== undefined)\n assertDeclarationOnlyOutput({\n before: beforeBundle,\n after: snapshotDeclarationBundle(bundle),\n });\n for (const [index, directory] of outputDirectories.entries()) {\n const before = beforeDirectories.at(index);\n if (before === undefined)\n throw new Error(\"Missing declaration output snapshot\");\n assertDeclarationOnlyOutput({\n before,\n after: snapshotDeclarationDirectory(directory),\n });\n }\n if ([\"generateBundle\", \"writeBundle\"].includes(hookName)) ledger.audit();\n return result;\n }\n return guarded;\n};\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\n\nimport { compilerPackages } from \"./compiler-packages\";\nimport {\n createDeclarationEmissionLedger,\n guardDeclarationHook,\n type ReviewedViteDtsOptions,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: plugin[name],\n hookName: name,\n outputDirectories,\n ledger,\n });\n const configResolved = hook(\"configResolved\");\n return {\n name: \"stll:declaration-only-dts\",\n apply: \"build\",\n enforce: \"pre\",\n config: hook(\"config\"),\n async configResolved(config) {\n if (\n realpathSync(config.root) !== root ||\n config.build.write === false ||\n config.build.watch\n )\n throw new Error(\n \"Declaration-only adapter requires a package-local production build\",\n );\n const output = path.resolve(root, config.build.outDir);\n const relative = path.relative(root, output);\n if (\n relative === \"\" ||\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n )\n throw new Error(\n \"Declaration output directory must stay within the package\",\n );\n // Check existing ancestor paths before the declaration plugin can write.\n let ancestor = output;\n while (ancestor !== root) {\n try {\n const resolved = realpathSync(ancestor);\n const within = path.relative(root, resolved);\n if (\n within === \"..\" ||\n within.startsWith(`..${path.sep}`) ||\n path.isAbsolute(within)\n )\n throw new Error(\"Declaration output directory leaves the package\");\n break;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"ENOENT\") throw error;\n ancestor = path.dirname(ancestor);\n }\n }\n outputDirectories.push(output);\n await configResolved.call(this, config);\n },\n buildStart: hook(\"buildStart\"),\n transform: hook(\"transform\"),\n watchChange: hook(\"watchChange\"),\n generateBundle: {\n order: \"post\",\n async handler(outputOptions, bundle, isWrite) {\n await hook(\"generateBundle\").call(this, outputOptions, bundle, isWrite);\n ledger.audit();\n },\n },\n writeBundle: {\n order: \"post\",\n async handler(outputOptions, bundle) {\n await hook(\"writeBundle\").call(this, outputOptions, bundle);\n ledger.audit();\n },\n },\n };\n};\n"],"mappings":";;;;;;AAIA,MAAa,0BAA0B;CACrC,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,iBAAiB,UAAwC;CAC7D,IACE,CAACA,SAAO,KAAK,KACb,CAAC,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,eAAe,KAAK,CAAC,GAE/D,MAAM,IAAI,MAAM,yDAAyD;CAC3E,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,QAAQ;EACzC,MAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;EAC7D,IAAI,OAAO,QAAQ,YAAY,CAAC,cAAc,EAAE,WAAW,aACzD,MAAM,IAAI,MACR,gEACF;EACF,OAAO,CAAC,KAAK,WAAW,KAAK;CAC/B,CAAC;AACH;AAEA,MAAM,mBAAmB,UAA2B;CAClD,IACE,OAAO,UAAU,YACjB,MAAM,KAAK,MAAM,MACjB,KAAK,MAAM,WAAW,KAAK,KAC3B,aAAa,KAAK,KAAK,KACvB,MAAM,SAAS,IAAI,KACnB,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,IAAI,GAE9B,MAAM,IAAI,MAAM,uDAAuD;CACzE,OAAO;AACT;AACA,MAAM,YAAY,UAAmB;CACnC,IAAI,OAAO,UAAU,UAAU,OAAO,gBAAgB,KAAK;CAC3D,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAC5C,MAAM,IAAI,MAAM,yDAAyD;CAC3E,OAAO,OAAO,OAAO,MAAM,IAAI,eAAe,CAAC;AACjD;AAYA,MAAa,0BAA0B,QAAiB,CAAC,MAAM;CAC7D,MAAM,SAAiC,CAAC;CACxC,KAAK,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