@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-contract-cli.cjs","names":["record","realpathSync","require","createRequire","path","readFileSync","existsSync","pathToFileURL","execFileSync","record","parse","transformSync","reviewedViteDtsOptions","realpathSync","require","createRequire","path","readFileSync","pathToFileURL","declarationOnlyDts","resolveManifestContract","readFileSync","path","existsSync","require","createRequire","mkdtempSync","tmpdir","spawnSync","pathToFileURL","parseToolchainPolicy","readFileSync","readGitTrackedOutput","path","githubAutomationFileKind","discoverConsumerManifests","resolveConsumerReleasePack","resolveManifestContract","checkPublishContract","readPackedSyntaxFiles","consumerRecord"],"sources":["../src/publish-build-target-nuxt.ts","../src/publish-build-target-vite.ts","../src/publish-build-target.ts","../src/publish-contract-cli.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync, readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { PublishTarget } from \"./publish-contract\";\n\nconst supportedVersions = {\n \"@nuxt/module-builder\": \"1.0.3\",\n unbuild: \"3.6.1\",\n mkdist: \"2.4.1\",\n} as const;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** Only the reviewed builder and branded target hook may introduce executable build behavior. */\nexport const assertNuxtOutputOptions = (options: unknown) => {\n const visit = (value: unknown) => {\n if (typeof value === \"function\")\n throw new Error(\n \"Unreviewed Nuxt output transform requires a supported target resolver\",\n );\n if (Array.isArray(value)) {\n for (const item of value) visit(item);\n return;\n }\n if (typeof value !== \"object\" || value === null) return;\n if (value instanceof RegExp) return;\n const prototype: unknown = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null)\n throw new Error(\"Unsupported Nuxt output option prototype\");\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\"Unsupported Nuxt output option property\");\n const entry: unknown = descriptor.value;\n if (\n key === \"plugins\" &&\n entry !== undefined &&\n (!Array.isArray(entry) || entry.length > 0)\n )\n throw new Error(\n \"Unreviewed Nuxt output plugins require a supported target resolver\",\n );\n visit(entry);\n }\n };\n visit(options);\n};\n\n/** Read actual normalized entry targets, including mkdist's separate transform. */\nexport const resolvedNuxtTarget = (options: unknown): PublishTarget => {\n assertNuxtOutputOptions(options);\n if (\n !record(options) ||\n !Array.isArray(options[\"entries\"]) ||\n options[\"entries\"].length === 0\n )\n throw new Error(\"Nuxt must resolve at least one JavaScript entry\");\n const emitted = new Set<string>();\n for (const entry of options[\"entries\"]) {\n if (!record(entry)) throw new Error(\"Invalid resolved Nuxt entry\");\n let transform: unknown;\n switch (entry[\"builder\"]) {\n case \"rollup\":\n if (!record(options[\"rollup\"]))\n throw new Error(\"Invalid Nuxt module options\");\n transform = options[\"rollup\"][\"esbuild\"];\n break;\n case \"mkdist\":\n transform = entry[\"esbuild\"];\n break;\n default:\n throw new Error(\"Unsupported Nuxt JavaScript entry builder\");\n }\n if (transform !== undefined && !record(transform))\n throw new Error(\"Invalid Nuxt JavaScript transform options\");\n const target = record(transform) ? transform[\"target\"] : undefined;\n if (target === undefined) {\n emitted.add(\"esnext\");\n continue;\n }\n const targets = typeof target === \"string\" ? [target] : target;\n if (!Array.isArray(targets) || targets.length === 0)\n throw new Error(\"Unsupported resolved Nuxt JavaScript target\");\n for (const item of targets) {\n if (typeof item !== \"string\" || item.length === 0)\n throw new Error(\"Unsupported resolved Nuxt JavaScript target\");\n emitted.add(item);\n }\n }\n return { type: \"javascript\", targets: [...emitted].sort() };\n};\n\n// Run in a separate process: the loader only redirects the constructor's unbuild import.\nconst captureProgram = String.raw`\nimport { register } from 'node:module';\nconst payload = JSON.parse(process.argv[1]);\nregister(payload.loader, import.meta.url);\nconst jitiModule = await import(payload.jiti);\nconst createJiti = jitiModule.createJiti || jitiModule.default;\nconst jiti = createJiti(payload.directory);\nconst config = await jiti.import('./build.config', {try: true, default: true}) || {};\nconst record = value => typeof value === 'object' && value !== null && !Array.isArray(value);\nif (!record(config) || Object.keys(config).some(key => key !== 'hooks')) throw new Error('Nuxt build configuration only supports the declared target hook');\nglobalThis.__stllNuxtTargetHelper = undefined;\nglobalThis.__stllNuxtTargetData = undefined;\nif (config.hooks !== undefined) {\n if (!record(config.hooks) || Object.keys(config.hooks).length !== 1 || !('build:before' in config.hooks)) throw new Error('Nuxt build configuration only supports the declared target hook');\n if (!payload.helper) throw new Error('Nuxt target helper must be installed at the same tooling version');\n const helper = await jiti.import(payload.helper, {default: false});\n const targets = helper.nuxtModuleTargetTargets(config.hooks['build:before']);\n if (!targets) throw new Error('Nuxt build configuration requires immutable nuxtModuleTarget data');\n config.hooks['build:before'] = helper.nuxtModuleTarget(targets);\n globalThis.__stllNuxtTargetHelper = helper;\n globalThis.__stllNuxtTargetData = targets;\n}\nglobalThis.__stllNuxtAbort = new Error('Nuxt target captured');\nglobalThis.__stllNuxtCapture = undefined;\nconst tool = await import(payload.tool);\ntry {\n await tool.build.run({args: {cwd: payload.directory, rootDir: '.', outDir: 'dist', sourcemap: false, stub: false}});\n throw new Error('Nuxt build did not reach the configuration boundary');\n} catch (error) {\n if (error !== globalThis.__stllNuxtAbort) throw error;\n}\nconsole.log('__STLL_NUXT_TARGET__' + JSON.stringify(globalThis.__stllNuxtCapture));\n`;\n\nconst captureShim = (unbuild: string) => `\nimport {build as actualBuild} from ${JSON.stringify(unbuild)};\nexport const build = (root, stub, input) => {\n const expectedHooks = {...input.hooks};\n const helper = globalThis.__stllNuxtTargetHelper;\n if (helper) expectedHooks['build:before'] = helper.nuxtModuleTarget(globalThis.__stllNuxtTargetData);\n const prepare = context => {\n const helper = globalThis.__stllNuxtTargetHelper;\n const loadedHooks = context.options.hooks;\n if (!loadedHooks || typeof loadedHooks !== 'object' || Array.isArray(loadedHooks)) throw new Error('Nuxt target configuration changed during loading');\n const expectedKeys = Reflect.ownKeys(expectedHooks);\n const loadedKeys = Reflect.ownKeys(loadedHooks);\n if (loadedKeys.length !== expectedKeys.length || loadedKeys.some(key => !expectedKeys.includes(key))) throw new Error('Nuxt target configuration changed during loading');\n for (const key of loadedKeys) {\n const descriptor = Object.getOwnPropertyDescriptor(loadedHooks, key);\n if (!descriptor || !('value' in descriptor)) throw new Error('Nuxt target configuration changed during loading');\n if (key === 'build:before' && helper) continue;\n if (descriptor.value !== expectedHooks[key]) throw new Error('Nuxt target configuration changed during loading');\n }\n const declared = loadedHooks['build:before'];\n if (helper) {\n const targets = helper.nuxtModuleTargetTargets(declared);\n if (!targets || JSON.stringify(targets) !== JSON.stringify(globalThis.__stllNuxtTargetData)) throw new Error('Nuxt target configuration changed during loading');\n if (typeof context.hooks.removeHook !== 'function') throw new Error('Unsupported Nuxt hook registration interface');\n // unbuild registers config hooks before build:prepare; remove that exact callback.\n context.hooks.removeHook('build:before', declared);\n const canonical = helper.nuxtModuleTarget(targets);\n context.options.hooks['build:before'] = canonical;\n context.hooks.hook('build:before', canonical);\n }\n // unbuild 3.6.1 normalizes entries before build:before, then cleans output.\n // Append after all registered config hooks so the target helper runs first.\n context.hooks.hook('build:before', final => {\n // The reviewed constructor owns its later hooks; user config accepts only nuxtModuleTarget.\n // Validate executable output options before projecting away functions for the capture.\n (${assertNuxtOutputOptions.toString()})({entries: final.options.entries, rollup: final.options.rollup});\n globalThis.__stllNuxtCapture = {\n entries: final.options.entries.map(entry => ({builder: entry.builder, esbuild: entry.esbuild})),\n rollup: {esbuild: final.options.rollup.esbuild}\n };\n throw globalThis.__stllNuxtAbort;\n });\n };\n expectedHooks['build:prepare'] = prepare;\n return actualBuild(root, stub, {...input, hooks: {...input.hooks, 'build:prepare': prepare}});\n};\n`;\n\nexport const resolveNuxtPublishTarget = (directory: string): PublishTarget => {\n const canonicalDirectory = realpathSync(directory);\n const require = createRequire(path.join(canonicalDirectory, \"package.json\"));\n const manifest: unknown = JSON.parse(\n readFileSync(path.join(canonicalDirectory, \"package.json\"), \"utf8\"),\n );\n if (\n !record(manifest) ||\n manifest[\"build\"] !== undefined ||\n manifest[\"unbuild\"] !== undefined ||\n (record(manifest[\"publishConfig\"]) &&\n (manifest[\"publishConfig\"][\"build\"] !== undefined ||\n manifest[\"publishConfig\"][\"unbuild\"] !== undefined))\n )\n throw new Error(\n \"Nuxt manifest build overrides require a supported target resolver\",\n );\n const configs = [\"ts\", \"mts\", \"cts\", \"js\", \"mjs\", \"cjs\", \"json\"].filter(\n (extension) =>\n existsSync(path.join(canonicalDirectory, `build.config.${extension}`)),\n );\n if (configs.length > 1)\n throw new Error(\"Nuxt supports exactly one build configuration\");\n const tool = realpathSync(require.resolve(\"@nuxt/module-builder\"));\n const toolRequire = createRequire(tool);\n const unbuild = realpathSync(toolRequire.resolve(\"unbuild\"));\n const unbuildRequire = createRequire(unbuild);\n for (const [name, version] of Object.entries(supportedVersions)) {\n let entry: string;\n switch (name) {\n case \"@nuxt/module-builder\":\n entry = tool;\n break;\n case \"unbuild\":\n entry = unbuild;\n break;\n case \"mkdist\":\n entry = realpathSync(unbuildRequire.resolve(\"mkdist\"));\n break;\n default:\n throw new Error(`Unsupported Nuxt build tool ${name}`);\n }\n const metadata: unknown = JSON.parse(\n readFileSync(\n path.resolve(path.dirname(entry), \"../package.json\"),\n \"utf8\",\n ),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(\n `Publish target resolver supports ${name} ${version}; review the adapter before changing build tools`,\n );\n }\n let helper: string | undefined;\n if (configs.length > 0) {\n const helperEntry = realpathSync(\n require.resolve(\"@stll/oxlint-config/build-target\"),\n );\n const metadata: unknown = JSON.parse(\n readFileSync(\n path.resolve(path.dirname(helperEntry), \"../package.json\"),\n \"utf8\",\n ),\n );\n const ownMetadata: unknown = JSON.parse(\n readFileSync(new URL(\"../package.json\", import.meta.url), \"utf8\"),\n );\n if (\n !record(metadata) ||\n !record(ownMetadata) ||\n metadata[\"version\"] !== ownMetadata[\"version\"]\n )\n throw new Error(\n \"Nuxt target helper must use the same tooling version as the resolver\",\n );\n helper = pathToFileURL(helperEntry).href;\n }\n const shim = `data:text/javascript,${encodeURIComponent(captureShim(pathToFileURL(unbuild).href))}`;\n const loader = `\nimport {realpathSync} from 'node:fs';\nimport path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nexport const resolve=(specifier,context,next)=>{\n if(specifier!=='unbuild')return next(specifier,context);\n if(!context.parentURL||!context.parentURL.startsWith('file:')||path.dirname(realpathSync(fileURLToPath(context.parentURL)))!==${JSON.stringify(path.dirname(tool))})throw new Error('Unexpected Nuxt unbuild import parent');\n return {url:${JSON.stringify(shim)},shortCircuit:true};\n};`;\n const output = execFileSync(\n process.versions.bun ? \"node\" : process.execPath,\n [\n \"--input-type=module\",\n \"-e\",\n captureProgram,\n JSON.stringify({\n directory: canonicalDirectory,\n tool: pathToFileURL(tool).href,\n unbuild: pathToFileURL(unbuild).href,\n jiti: pathToFileURL(realpathSync(unbuildRequire.resolve(\"jiti\"))).href,\n helper,\n loader: `data:text/javascript,${encodeURIComponent(loader)}`,\n }),\n ],\n {\n cwd: canonicalDirectory,\n encoding: \"utf8\",\n timeout: 30_000,\n maxBuffer: 1024 * 1024,\n env: { ...process.env, JITI_FS_CACHE: \"0\", JITI_MODULE_CACHE: \"1\" },\n },\n );\n const captures = output\n .split(\"\\n\")\n .filter((line) => line.startsWith(\"__STLL_NUXT_TARGET__\"));\n const capture = captures.at(0);\n if (captures.length !== 1 || capture === undefined)\n throw new Error(\n \"Nuxt did not return exactly one resolved build configuration\",\n );\n return resolvedNuxtTarget(\n JSON.parse(capture.slice(\"__STLL_NUXT_TARGET__\".length)),\n );\n};\n","import { parse } from \"acorn\";\nimport { transformSync } from \"esbuild\";\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { reviewedViteDtsOptions } from \"./publish-build-target-vite-dts\";\nimport { declarationOnlyDts } from \"./publish-build-target-vite-dts-helper\";\nimport type { PublishTarget } from \"./publish-contract\";\n\nconst supportedViteVersion = \"8.1.5\";\nconst declarationHelperImport = \"@stll/oxlint-config/declaration-only-dts\";\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\ntype WalkAstOptions = {\n value: unknown;\n visit: (\n node: Record<string, unknown>,\n parent: Record<string, unknown> | undefined,\n ) => void;\n parent?: Record<string, unknown>;\n};\nconst walkAst = ({ value, visit, parent }: WalkAstOptions) => {\n if (Array.isArray(value)) {\n for (const entry of value)\n walkAst({\n value: entry,\n visit,\n ...(parent === undefined ? {} : { parent }),\n });\n return;\n }\n if (!record(value)) return;\n visit(value, parent);\n for (const entry of Object.values(value))\n if (typeof entry === \"object\" && entry !== null)\n walkAst({ value: entry, visit, parent: value });\n};\nconst astName = (value: unknown) =>\n record(value) && value[\"type\"] === \"Identifier\" ? value[\"name\"] : undefined;\nconst astLiteral = (value: unknown): unknown => {\n if (!record(value))\n throw new Error(\"Declaration helper options must be literal\");\n if (\n value[\"type\"] === \"Literal\" &&\n (typeof value[\"value\"] === \"string\" || typeof value[\"value\"] === \"boolean\")\n )\n return value[\"value\"];\n if (value[\"type\"] === \"ArrayExpression\" && Array.isArray(value[\"elements\"]))\n return value[\"elements\"].map(astLiteral);\n if (\n value[\"type\"] === \"ObjectExpression\" &&\n Array.isArray(value[\"properties\"])\n ) {\n const entries: [string, unknown][] = [];\n for (const property of value[\"properties\"]) {\n if (\n !record(property) ||\n property[\"type\"] !== \"Property\" ||\n property[\"kind\"] !== \"init\" ||\n property[\"computed\"] === true ||\n property[\"method\"] === true ||\n property[\"shorthand\"] === true\n )\n throw new Error(\n \"Declaration helper options must be plain literal properties\",\n );\n const key =\n astName(property[\"key\"]) ??\n (record(property[\"key\"]) ? property[\"key\"][\"value\"] : undefined);\n if (\n typeof key !== \"string\" ||\n entries.some(([previous]) => previous === key)\n )\n throw new Error(\"Invalid declaration helper option key\");\n entries.push([key, astLiteral(property[\"value\"])]);\n }\n return Object.fromEntries(entries);\n }\n throw new Error(\"Declaration helper options must be literal\");\n};\ntype ReviewedDtsConfigurationOptions = {\n source: string;\n directory: string;\n loader: \"ts\" | \"js\";\n};\n/** Prove the helper owns the directly declared plugin; closure brands alone are insufficient. */\nexport const reviewedDtsConfiguration = ({\n source,\n directory,\n loader,\n}: ReviewedDtsConfigurationOptions) => {\n const ast: unknown = parse(\n transformSync(source, { loader, format: \"esm\", target: \"esnext\" }).code,\n { ecmaVersion: \"latest\", sourceType: \"module\" },\n );\n if (!record(ast) || !Array.isArray(ast[\"body\"]))\n throw new Error(\"Invalid Vite configuration AST\");\n const bindings = new Set<string>();\n const defineConfigBindings = new Set<string>();\n const initializers = new Map<unknown, unknown>();\n let exported: unknown;\n for (const statement of ast[\"body\"]) {\n if (!record(statement)) continue;\n if (\n statement[\"type\"] === \"ImportDeclaration\" &&\n record(statement[\"source\"])\n ) {\n const imported = statement[\"source\"][\"value\"];\n if (\n typeof imported === \"string\" &&\n /^(?:vite-plugin-dts|unplugin-dts)(?:\\/|$)/.test(imported)\n )\n throw new Error(\n \"Raw declaration emitters cannot accompany the reviewed helper\",\n );\n if (Array.isArray(statement[\"specifiers\"]))\n for (const specifier of statement[\"specifiers\"]) {\n if (!record(specifier)) continue;\n const local = astName(specifier[\"local\"]);\n const name = astName(specifier[\"imported\"]);\n if (imported === declarationHelperImport) {\n if (\n specifier[\"type\"] !== \"ImportSpecifier\" ||\n name !== \"declarationOnlyDts\" ||\n typeof local !== \"string\"\n )\n throw new Error(\"Use the named declarationOnlyDts helper import\");\n bindings.add(local);\n }\n if (\n imported === \"vite\" &&\n name === \"defineConfig\" &&\n typeof local === \"string\"\n )\n defineConfigBindings.add(local);\n }\n }\n if (\n statement[\"type\"] === \"VariableDeclaration\" &&\n Array.isArray(statement[\"declarations\"])\n )\n for (const declaration of statement[\"declarations\"])\n if (record(declaration))\n initializers.set(astName(declaration[\"id\"]), declaration[\"init\"]);\n if (statement[\"type\"] === \"ExportDefaultDeclaration\")\n exported = statement[\"declaration\"];\n if (\n statement[\"type\"] === \"ExportNamedDeclaration\" &&\n Array.isArray(statement[\"specifiers\"])\n )\n for (const specifier of statement[\"specifiers\"])\n if (record(specifier) && astName(specifier[\"exported\"]) === \"default\")\n exported = specifier[\"local\"];\n }\n if (bindings.size !== 1)\n throw new Error(\n \"Vite declaration plugins require one statically imported helper\",\n );\n if (record(exported) && exported[\"type\"] === \"Identifier\")\n exported = initializers.get(astName(exported));\n if (\n record(exported) &&\n exported[\"type\"] === \"CallExpression\" &&\n defineConfigBindings.has(String(astName(exported[\"callee\"]))) &&\n Array.isArray(exported[\"arguments\"]) &&\n exported[\"arguments\"].length === 1\n )\n exported = exported[\"arguments\"].at(0);\n if (\n !record(exported) ||\n exported[\"type\"] !== \"ObjectExpression\" ||\n !Array.isArray(exported[\"properties\"])\n )\n throw new Error(\n \"Declaration helper requires a directly exported static Vite configuration\",\n );\n const pluginProperties = exported[\"properties\"].filter(\n (property) =>\n record(property) &&\n (astName(property[\"key\"]) === \"plugins\" ||\n (record(property[\"key\"]) && property[\"key\"][\"value\"] === \"plugins\")),\n );\n const property = pluginProperties.at(0);\n if (\n pluginProperties.length !== 1 ||\n !record(property) ||\n property[\"computed\"] === true ||\n property[\"kind\"] !== \"init\" ||\n !record(property[\"value\"]) ||\n property[\"value\"][\"type\"] !== \"ArrayExpression\" ||\n !Array.isArray(property[\"value\"][\"elements\"])\n )\n throw new Error(\"Declaration helper requires a literal plugins array\");\n const calls = property[\"value\"][\"elements\"]\n .map((element) =>\n record(element) && element[\"type\"] === \"AwaitExpression\"\n ? element[\"argument\"]\n : element,\n )\n .filter(\n (element) =>\n record(element) &&\n element[\"type\"] === \"CallExpression\" &&\n bindings.has(String(astName(element[\"callee\"]))),\n );\n const call = calls.at(0);\n if (\n calls.length !== 1 ||\n !record(call) ||\n !Array.isArray(call[\"arguments\"]) ||\n call[\"arguments\"].length !== 1\n )\n throw new Error(\"Declare exactly one direct declaration helper call\");\n walkAst({\n value: ast,\n visit: (node, parent) => {\n if (node[\"type\"] === \"ImportDeclaration\") return;\n const name = astName(node);\n if (typeof name !== \"string\" || !bindings.has(name)) return;\n if (parent?.[\"type\"] === \"ImportSpecifier\") return;\n if (parent !== call || call[\"callee\"] !== node)\n throw new Error(\n \"Declaration helper binding cannot be aliased or invoked indirectly\",\n );\n },\n });\n const argument = call[\"arguments\"].at(0);\n if (\n !record(argument) ||\n argument[\"type\"] !== \"ObjectExpression\" ||\n !Array.isArray(argument[\"properties\"])\n )\n throw new Error(\"Declaration helper options must be a literal object\");\n const directoryProperties = argument[\"properties\"].filter(\n (entry) => record(entry) && astName(entry[\"key\"]) === \"directory\",\n );\n const directoryProperty = directoryProperties.at(0);\n if (\n directoryProperties.length !== 1 ||\n !record(directoryProperty) ||\n directoryProperty[\"computed\"] === true ||\n directoryProperty[\"kind\"] !== \"init\"\n )\n throw new Error(\"Declaration helper requires its package directory\");\n const value = directoryProperty[\"value\"];\n const meta = record(value) ? value[\"object\"] : undefined;\n const importDirectory =\n record(value) &&\n value[\"type\"] === \"MemberExpression\" &&\n value[\"computed\"] === false &&\n astName(value[\"property\"]) === \"dirname\" &&\n record(meta) &&\n meta[\"type\"] === \"MetaProperty\" &&\n astName(meta[\"meta\"]) === \"import\" &&\n astName(meta[\"property\"]) === \"meta\";\n const exactDirectory =\n record(value) &&\n value[\"type\"] === \"Literal\" &&\n value[\"value\"] === directory;\n if (!importDirectory && !exactDirectory)\n throw new Error(\n \"Declaration helper directory must be import.meta.dirname or the exact package directory\",\n );\n return reviewedViteDtsOptions(\n astLiteral({\n ...argument,\n properties: argument[\"properties\"].filter(\n (entry) => entry !== directoryProperty,\n ),\n }),\n );\n};\n\nconst ownEntries = (value: object): [string, unknown][] =>\n 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(\"Unsupported Vite hook property\");\n return [key, descriptor.value];\n });\nconst metadataSource = (value: unknown): string => {\n if (value instanceof RegExp)\n return JSON.stringify([\"regexp\", value.source, value.flags]);\n if (Array.isArray(value))\n return JSON.stringify([\"array\", value.map(metadataSource)]);\n if (record(value)) {\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n )\n throw new Error(\"Unsupported Vite hook metadata\");\n return JSON.stringify([\n \"object\",\n ownEntries(value)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([key, item]) => [key, metadataSource(item)]),\n ]);\n }\n if (value === undefined) return \"undefined\";\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\" ||\n (typeof value === \"number\" && Number.isFinite(value))\n )\n return JSON.stringify(value);\n throw new Error(\"Unsupported Vite hook metadata\");\n};\nconst hookSource = (value: unknown) => {\n if (typeof value === \"function\")\n return JSON.stringify([\n \"function\",\n Function.prototype.toString.call(value),\n ]);\n if (!record(value)) throw new Error(\"Unsupported Vite build hook\");\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n )\n throw new Error(\"Unsupported Vite hook metadata\");\n const entries = ownEntries(value);\n const handler = entries.find(([key]) => key === \"handler\")?.[1];\n if (typeof handler !== \"function\")\n throw new Error(\"Unsupported Vite build hook\");\n const metadata = entries.filter(([key]) => key !== \"handler\");\n if (\n metadata.some(([key]) => ![\"order\", \"sequential\", \"filter\"].includes(key))\n )\n throw new Error(\"Unsupported Vite hook metadata\");\n return JSON.stringify([\n \"object\",\n Function.prototype.toString.call(handler),\n metadataSource(Object.fromEntries(metadata)),\n ]);\n};\nconst pluginEntries = (plugin: object) => {\n const entries = new Map<string, unknown>();\n let current = plugin;\n while (current !== Object.prototype) {\n for (const [key, value] of ownEntries(current)) {\n if (current !== plugin && key === \"constructor\") continue;\n if (!entries.has(key)) entries.set(key, value);\n }\n const prototype: unknown = Object.getPrototypeOf(current);\n if (prototype === null) break;\n if (!record(prototype))\n throw new Error(\"Unsupported Vite plugin prototype\");\n current = prototype;\n }\n return entries;\n};\nconst plugins = (config: unknown): unknown[] => {\n if (\n !record(config) ||\n !record(config[\"build\"]) ||\n !record(config[\"environments\"])\n )\n throw new Error(\"Invalid Vite plugin configuration\");\n const environment =\n config[\"environments\"][\n config[\"build\"][\"ssr\"] === true ||\n (typeof config[\"build\"][\"ssr\"] === \"string\" &&\n config[\"build\"][\"ssr\"] !== \"\")\n ? \"ssr\"\n : \"client\"\n ];\n if (\n !record(environment) ||\n !Array.isArray(environment[\"plugins\"]) ||\n !Array.isArray(config[\"plugins\"])\n )\n throw new Error(\"Missing resolved Vite environment plugins\");\n const options = config[\"build\"][\"rolldownOptions\"];\n const extra = record(options) ? options[\"plugins\"] : undefined;\n if (extra !== undefined && !Array.isArray(extra))\n throw new Error(\n \"Dynamic Vite rolldown plugins require a supported target resolver\",\n );\n return [\n ...config[\"plugins\"],\n ...environment[\"plugins\"],\n ...(extra ?? []),\n ].flat(Infinity);\n};\n\ntype ReviewedVitePluginsOptions = {\n resolved: readonly unknown[];\n reviewed: readonly unknown[];\n};\ntype ReviewedVueOptions = { plugin: unknown; reviewed: unknown };\n/** Vue hook closures may only capture the reviewed factory's default options. */\nexport const assertReviewedVueOptions = ({\n plugin,\n reviewed,\n}: ReviewedVueOptions) => {\n const fail = () =>\n new Error(\"Custom Vue plugin options require a supported target resolver\");\n if (\n !record(plugin) ||\n !record(reviewed) ||\n !record(plugin[\"api\"]) ||\n !record(reviewed[\"api\"])\n )\n throw fail();\n const api = plugin[\"api\"];\n const defaults = reviewed[\"api\"];\n const options = api[\"options\"];\n const defaultOptions = defaults[\"options\"];\n if (!record(options) || !record(defaultOptions)) throw fail();\n if (\n Object.getPrototypeOf(options) !== Object.prototype &&\n Object.getPrototypeOf(options) !== null\n )\n throw fail();\n if (\n metadataSource(api[\"include\"]) !== metadataSource(defaults[\"include\"]) ||\n api[\"exclude\"] !== undefined\n )\n throw fail();\n const lifecycleFields = new Set([\n \"isProduction\",\n \"sourceMap\",\n \"cssDevSourcemap\",\n \"devToolsEnabled\",\n ]);\n for (const [key, value] of ownEntries(options)) {\n if (key === \"root\") {\n if (typeof value !== \"string\") throw fail();\n continue;\n }\n if (lifecycleFields.has(key)) {\n if (typeof value !== \"boolean\") throw fail();\n continue;\n }\n if (key === \"compiler\") {\n if (value !== null && value !== undefined) throw fail();\n continue;\n }\n if (\n !Object.hasOwn(defaultOptions, key) ||\n metadataSource(value) !== metadataSource(defaultOptions[key])\n )\n throw fail();\n }\n for (const [key] of ownEntries(defaultOptions)) {\n if (!Object.hasOwn(options, key) && key !== \"compiler\") throw fail();\n }\n};\nconst vitePluginMetadata = new Set([\n \"enforce\",\n \"_options\",\n \"perEnvironmentStartEndDuringDev\",\n \"perEnvironmentWatchChangeDuringDev\",\n]);\nconst nativeCallbackFields = new Map([\n [\"builtin:vite-resolve\", \"resolveSubpathImports\"],\n [\"builtin:vite-dynamic-import-vars\", \"resolver\"],\n [\"builtin:vite-reporter\", \"logInfo\"],\n]);\nconst nativeOptionsSource = (name: string, value: unknown) => {\n if (!record(value)) return metadataSource(value);\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n )\n throw new Error(\"Unsupported Vite native options\");\n return JSON.stringify(\n ownEntries(value)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([key, item]) => {\n if (\n key === nativeCallbackFields.get(name) &&\n typeof item === \"function\"\n )\n return [\n key,\n \"reviewed-callback\",\n Function.prototype.toString.call(item),\n ];\n return [key, \"metadata\", metadataSource(item)];\n }),\n );\n};\nconst pluginSources = (plugin: object) => {\n const entries = pluginEntries(plugin);\n for (const key of [...vitePluginMetadata, \"apply\"])\n if (!entries.has(key)) entries.set(key, undefined);\n const sources = new Map<string, string>();\n for (const [key, value] of entries) {\n if (key === \"name\" || key === \"api\") continue;\n if (key === \"_options\") {\n const name = entries.get(\"name\");\n if (typeof name !== \"string\") throw new Error(\"Invalid Vite plugin name\");\n sources.set(key, `native:${nativeOptionsSource(name, value)}`);\n continue;\n }\n if (\n vitePluginMetadata.has(key) ||\n (key === \"apply\" && typeof value !== \"function\")\n )\n sources.set(key, `metadata:${metadataSource(value)}`);\n else if (value === undefined) sources.set(key, \"absent-hook\");\n else sources.set(key, `hook:${hookSource(value)}`);\n }\n return sources;\n};\n\n/** Reviewed tool versions own the plugin name, hook name and implementation together. */\nexport const assertReviewedVitePlugins = ({\n resolved,\n reviewed,\n}: ReviewedVitePluginsOptions) => {\n const identities = new Map<string, Map<string, Set<string>>>();\n for (const plugin of reviewed) {\n if (!record(plugin) || typeof plugin[\"name\"] !== \"string\")\n throw new Error(\"Invalid reviewed Vite plugin\");\n const name = plugin[\"name\"];\n const hooks = identities.get(name) ?? new Map<string, Set<string>>();\n identities.set(name, hooks);\n for (const [key, source] of pluginSources(plugin)) {\n const sources = hooks.get(key) ?? new Set<string>();\n sources.add(source);\n hooks.set(key, sources);\n }\n }\n for (const plugin of resolved) {\n if (plugin === undefined || plugin === null || plugin === false) continue;\n if (!record(plugin) || typeof plugin[\"name\"] !== \"string\")\n throw new Error(\n \"Dynamic Vite plugins require a supported target resolver\",\n );\n const name = plugin[\"name\"];\n const hooks = identities.get(name);\n if (hooks === undefined)\n throw new Error(\n `Unreviewed Vite plugin ${name} requires a supported target resolver`,\n );\n for (const [key, source] of pluginSources(plugin)) {\n if (!hooks.get(key)?.has(source))\n throw new Error(\n `Unreviewed Vite hook ${name}:${key} requires a supported target resolver`,\n );\n }\n }\n const pipelineIdentity = (plugin: unknown) => {\n if (!record(plugin) || typeof plugin[\"name\"] !== \"string\")\n throw new Error(\"Invalid reviewed Vite pipeline entry\");\n return JSON.stringify([\n plugin[\"name\"],\n [...pluginSources(plugin)].sort(([a], [b]) => a.localeCompare(b)),\n ]);\n };\n const actualPipeline = resolved.filter(\n (plugin) => plugin !== undefined && plugin !== null && plugin !== false,\n );\n if (\n actualPipeline.length !== reviewed.length ||\n reviewed.some(\n (plugin, index) =>\n pipelineIdentity(plugin) !== pipelineIdentity(actualPipeline[index]),\n )\n )\n throw new Error(\n \"Vite plugin pipeline must match the complete reviewed order\",\n );\n};\n\n/** Vite 8 spreads transform overrides after its resolved build target. */\nexport const resolvedViteTarget = (config: unknown): PublishTarget => {\n if (!record(config) || !record(config[\"build\"]))\n throw new Error(\"Invalid resolved Vite build configuration\");\n if (config[\"builder\"] !== undefined)\n throw new Error(\"Custom Vite builders require a supported target resolver\");\n const build = config[\"build\"];\n const options = build[\"rolldownOptions\"];\n if (options !== undefined && !record(options))\n throw new Error(\"Vite rolldownOptions must be an object\");\n const output = record(options) ? options[\"output\"] : undefined;\n if (output !== undefined) {\n const outputs = Array.isArray(output) ? output : [output];\n for (const entry of outputs) {\n if (!record(entry)) throw new Error(\"Unsupported Vite output options\");\n for (const key of [\"banner\", \"footer\", \"intro\", \"outro\"]) {\n if (entry[key] !== undefined && entry[key] !== \"\")\n throw new Error(\n \"Vite output addons require a supported target resolver\",\n );\n }\n const outputPlugins = entry[\"plugins\"];\n if (\n outputPlugins !== undefined &&\n (!Array.isArray(outputPlugins) || outputPlugins.length > 0)\n )\n throw new Error(\n \"Vite output plugins require a supported target resolver\",\n );\n }\n }\n const transform = record(options) ? options[\"transform\"] : undefined;\n if (transform !== undefined && !record(transform))\n throw new Error(\"Vite transform overrides must be an object\");\n let target = build[\"target\"] === false ? undefined : build[\"target\"];\n if (record(transform) && \"target\" in transform) target = transform[\"target\"];\n if (target === undefined) return { type: \"javascript\", targets: [\"esnext\"] };\n const targets = typeof target === \"string\" ? [target] : target;\n if (!Array.isArray(targets) || targets.length === 0)\n throw new Error(\"Unsupported resolved Vite JavaScript target\");\n const emitted = new Set<string>();\n for (const item of targets) {\n if (typeof item !== \"string\" || item.length === 0)\n throw new Error(\"Unsupported resolved Vite JavaScript target\");\n emitted.add(item);\n }\n return { type: \"javascript\", targets: [...emitted].sort() };\n};\n\n/** Only static build settings needed by the installed tool's canonical profile cross this boundary. */\nexport const reviewedViteBuild = (build: unknown) => {\n if (!record(build)) throw new Error(\"Invalid Vite build configuration\");\n const properties = new Map(ownEntries(build));\n const result: Record<string, unknown> = {};\n for (const key of [\n \"target\",\n \"sourcemap\",\n \"minify\",\n \"ssr\",\n \"cssCodeSplit\",\n \"assetsInlineLimit\",\n \"assetsDir\",\n \"reportCompressedSize\",\n \"chunkSizeWarningLimit\",\n \"modulePreload\",\n ]) {\n const value = properties.get(key);\n metadataSource(value);\n result[key] = value;\n }\n const library = properties.get(\"lib\");\n if (record(library)) {\n if (\n Object.getPrototypeOf(library) !== Object.prototype &&\n Object.getPrototypeOf(library) !== null\n )\n throw new Error(\"Unsupported Vite library configuration\");\n const libraryProperties = new Map(ownEntries(library));\n const fields: Record<string, unknown> = {};\n for (const key of [\"entry\", \"formats\", \"name\"]) {\n const value = libraryProperties.get(key);\n metadataSource(value);\n fields[key] = value;\n }\n result[\"lib\"] = fields;\n } else if (library === undefined || library === false)\n result[\"lib\"] = library;\n else throw new Error(\"Unsupported Vite library configuration\");\n return result;\n};\n\nexport const resolveVitePublishTarget = async (\n directory: string,\n): Promise<PublishTarget> => {\n const canonicalDirectory = realpathSync(directory);\n const require = createRequire(path.join(canonicalDirectory, \"package.json\"));\n const metadata: unknown = JSON.parse(\n readFileSync(require.resolve(\"vite/package.json\"), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== supportedViteVersion)\n throw new Error(\n `Publish target resolver supports Vite ${supportedViteVersion}; review the adapter before changing build tools`,\n );\n const tool: unknown = await import(\n pathToFileURL(realpathSync(require.resolve(\"vite\"))).href\n );\n if (!record(tool) || typeof tool[\"resolveConfig\"] !== \"function\")\n throw new Error(\n \"Installed Vite does not expose its configuration resolver\",\n );\n // Match the legacy CLI builder's patch before configResolved hooks run.\n const patchConfig = (resolved: unknown) => {\n if (\n !record(resolved) ||\n !record(resolved[\"build\"]) ||\n !record(resolved[\"environments\"])\n )\n throw new Error(\"Invalid Vite environment configuration\");\n if (resolved[\"builder\"] !== undefined)\n throw new Error(\n \"Custom Vite builders require a supported target resolver\",\n );\n const environment =\n resolved[\"environments\"][\n resolved[\"build\"][\"ssr\"] === true ||\n (typeof resolved[\"build\"][\"ssr\"] === \"string\" &&\n resolved[\"build\"][\"ssr\"] !== \"\")\n ? \"ssr\"\n : \"client\"\n ];\n if (!record(environment) || !record(environment[\"build\"]))\n throw new Error(\"Missing resolved Vite build environment\");\n resolved[\"build\"] = { ...environment[\"build\"] };\n };\n const config: unknown = await tool[\"resolveConfig\"](\n { root: canonicalDirectory },\n \"build\",\n \"production\",\n \"production\",\n false,\n patchConfig,\n );\n if (!record(config) || !record(config[\"build\"]))\n throw new Error(\"Invalid Vite build configuration\");\n const resolvedPlugins = plugins(config);\n const canonicalVuePlugins: unknown[] = [];\n if (\n resolvedPlugins.some(\n (plugin) => record(plugin) && plugin[\"name\"] === \"vite:vue\",\n )\n ) {\n const vueMetadata: unknown = JSON.parse(\n readFileSync(require.resolve(\"@vitejs/plugin-vue/package.json\"), \"utf8\"),\n );\n if (!record(vueMetadata) || vueMetadata[\"version\"] !== \"6.0.8\")\n throw new Error(\n \"Publish target resolver supports @vitejs/plugin-vue 6.0.8; review the adapter before changing build tools\",\n );\n const vue: unknown = await import(\n pathToFileURL(realpathSync(require.resolve(\"@vitejs/plugin-vue\"))).href\n );\n if (!record(vue) || typeof vue[\"default\"] !== \"function\")\n throw new Error(\"Invalid installed Vue plugin factory\");\n const plugin: unknown = vue[\"default\"]();\n if (!record(plugin)) throw new Error(\"Invalid installed Vue plugin\");\n for (const resolved of resolvedPlugins) {\n if (record(resolved) && resolved[\"name\"] === \"vite:vue\")\n assertReviewedVueOptions({ plugin: resolved, reviewed: plugin });\n }\n canonicalVuePlugins.push(plugin);\n }\n if (\n resolvedPlugins.some(\n (plugin) =>\n record(plugin) && plugin[\"name\"] === \"stll:declaration-only-dts\",\n )\n ) {\n const configFile = config[\"configFile\"];\n if (\n typeof configFile !== \"string\" ||\n path.dirname(realpathSync(configFile)) !== canonicalDirectory\n )\n throw new Error(\n \"Declaration helper requires a package-local Vite config file\",\n );\n const options = reviewedDtsConfiguration({\n source: readFileSync(configFile, \"utf8\"),\n directory: canonicalDirectory,\n loader: /\\.[cm]?ts$/.test(configFile) ? \"ts\" : \"js\",\n });\n canonicalVuePlugins.push(\n declarationOnlyDts({ directory: canonicalDirectory, ...options }),\n );\n }\n const canonicalBuild = reviewedViteBuild(config[\"build\"]);\n const canonical: unknown = await tool[\"resolveConfig\"](\n {\n root: canonicalDirectory,\n configFile: false,\n plugins: canonicalVuePlugins,\n build: canonicalBuild,\n },\n \"build\",\n \"production\",\n \"production\",\n false,\n patchConfig,\n );\n if (\n !record(canonical) ||\n !record(canonical[\"build\"]) ||\n hookSource(config[\"build\"][\"createEnvironment\"]) !==\n hookSource(canonical[\"build\"][\"createEnvironment\"])\n )\n throw new Error(\n \"Custom Vite createEnvironment requires a supported target resolver\",\n );\n const reviewedPlugins = plugins(canonical);\n assertReviewedVitePlugins({\n resolved: resolvedPlugins,\n reviewed: reviewedPlugins,\n });\n return resolvedViteTarget(config);\n};\n","import { spawnSync } from \"node:child_process\";\nimport { existsSync, mkdtempSync, readFileSync, rmSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { resolveNuxtPublishTarget } from \"./publish-build-target-nuxt\";\nimport { resolveVitePublishTarget } from \"./publish-build-target-vite\";\nimport {\n resolveManifestContract,\n type PublishPacker,\n type PublishTarget,\n} from \"./publish-contract\";\n\nconst supportedTsdownVersion = \"0.22.9\";\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst targets = (value: unknown): string[] => {\n if (value === undefined) return [\"esnext\"];\n if (typeof value === \"string\") {\n const identifier = value.trim();\n if (identifier === \"\" || identifier.includes(\",\"))\n throw new Error(\n \"Resolved JavaScript target identifiers must be nonempty and contain no commas\",\n );\n return [identifier];\n }\n if (\n Array.isArray(value) &&\n value.length > 0 &&\n Array.from(value).every((item: unknown) => typeof item === \"string\")\n )\n return value.flatMap((item: string) => targets(item));\n throw new Error(\n \"Build tool returned an unsupported resolved JavaScript target\",\n );\n};\n\n/** Only hooks completed by configuration resolution may run before target capture. */\nexport const assertTsdownBuildExtensions = (options: unknown) => {\n const isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n const entries = (value: object): [string, unknown][] => {\n const prototype: unknown = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null)\n throw new Error(\n \"Unreviewed build option prototype requires a supported target resolver\",\n );\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 \"Unreviewed build option property requires a supported target resolver\",\n );\n return [key, descriptor.value];\n });\n };\n const plugins = (value: unknown, phase: \"configuration\" | \"output\") => {\n if (value === undefined || value === null || value === false) return;\n if (Array.isArray(value)) {\n for (const plugin of value) plugins(plugin, phase);\n return;\n }\n if (!isRecord(value))\n throw new Error(\"Dynamic plugins require a supported target resolver\");\n for (const [key, item] of entries(value)) {\n if (item === undefined) continue;\n if (key === \"name\" && typeof item === \"string\") continue;\n if (\n phase === \"configuration\" &&\n [\"tsdownConfig\", \"tsdownConfigResolved\"].includes(key) &&\n typeof item === \"function\"\n )\n continue;\n throw new Error(\n \"Unreviewed plugin hooks require a supported target resolver\",\n );\n }\n };\n const output = (value: unknown) => {\n if (value === undefined) return;\n if (!isRecord(value))\n throw new Error(\n \"Dynamic output options require a supported target resolver\",\n );\n for (const [key, item] of entries(value)) {\n if (key === \"plugins\") plugins(item, \"output\");\n if (\n [\"banner\", \"footer\", \"intro\", \"outro\"].includes(key) &&\n item !== undefined &&\n item !== \"\"\n )\n throw new Error(\"Output addons require a supported target resolver\");\n }\n };\n if (!isRecord(options)) throw new Error(\"Invalid build configuration\");\n const properties = new Map(entries(options));\n if (properties.get(\"hooks\") !== undefined)\n throw new Error(\"Build hooks require a supported target resolver\");\n plugins(properties.get(\"plugins\"), \"configuration\");\n output(properties.get(\"outputOptions\"));\n for (const key of [\"banner\", \"footer\"]) {\n const addon = properties.get(key);\n if (addon !== undefined && addon !== \"\")\n throw new Error(\"Output addons require a supported target resolver\");\n }\n const input = properties.get(\"inputOptions\");\n if (input !== undefined) {\n if (!isRecord(input))\n throw new Error(\n \"Dynamic tsdown inputOptions require a supported target resolver\",\n );\n plugins(new Map(entries(input)).get(\"plugins\"), \"output\");\n }\n};\n\n/** Extract the final target after supported format and low-level overrides. */\nexport const resolvedTsdownTarget = (configs: unknown): PublishTarget => {\n if (!Array.isArray(configs) || configs.length === 0)\n throw new Error(\"tsdown must resolve at least one build configuration\");\n const emitted = new Set<string>();\n let javascript = false;\n for (const config of configs) {\n if (!record(config))\n throw new Error(\"Invalid resolved tsdown configuration\");\n assertTsdownBuildExtensions(config);\n if (record(config[\"dts\"]) && config[\"dts\"][\"emitDtsOnly\"] === true)\n continue;\n javascript = true;\n const input = config[\"inputOptions\"];\n if (input !== undefined && !record(input))\n throw new Error(\n \"Dynamic tsdown inputOptions require a supported target resolver\",\n );\n const transform = record(input) ? input[\"transform\"] : undefined;\n if (transform !== undefined && !record(transform))\n throw new Error(\"tsdown transform overrides must be an object\");\n const target =\n record(transform) && transform[\"target\"] != null\n ? transform[\"target\"]\n : config[\"target\"];\n for (const item of targets(target)) emitted.add(item);\n }\n return javascript\n ? { type: \"javascript\", targets: [...emitted].sort() }\n : { type: \"types-only\" };\n};\n\nconst exportPaths = (value: unknown): string[] => {\n if (typeof value === \"string\") return [value];\n if (value === null || value === undefined) return [];\n if (Array.isArray(value))\n return value.flatMap((item: unknown) => exportPaths(item));\n if (record(value)) return Object.values(value).flatMap(exportPaths);\n throw new Error(\"Invalid package export declaration\");\n};\n\nconst publishBuildScript = \"build\";\nexport const publishBuildLifecycleScripts = [\n `pre${publishBuildScript}`,\n `post${publishBuildScript}`,\n] as const;\nconst assertPublishBuildLifecycle = (manifest: Record<string, unknown>) => {\n const scripts = manifest[\"scripts\"];\n if (!record(scripts)) return;\n for (const script of publishBuildLifecycleScripts) {\n if (Object.hasOwn(scripts, script))\n throw new Error(\n `Publish target resolver does not support lifecycle script ${script}`,\n );\n }\n};\n\n/** JSON and declaration-only packages have no emitted JavaScript target. */\nexport const assetOnlyTarget = (\n manifest: unknown,\n packer: PublishPacker,\n): PublishTarget | undefined => {\n if (!record(manifest)) throw new Error(\"Package manifest must be an object\");\n assertPublishBuildLifecycle(manifest);\n if (record(manifest[\"scripts\"]) && manifest[\"scripts\"][\"build\"] !== undefined)\n return undefined;\n const published = resolveManifestContract({\n manifest,\n packer,\n target: { type: \"types-only\" },\n });\n const paths = (\n [\"exports\", \"main\", \"module\", \"types\", \"typings\", \"bin\"] as const\n ).flatMap((key) => exportPaths(published.entryPoints[key]));\n if (\n paths.length === 0 ||\n paths.some((item) => !/(?:\\.json|\\.d\\.(?:ts|mts|cts))$/.test(item))\n )\n return undefined;\n return { type: \"types-only\" };\n};\n\n/** Supported build commands have no shell composition or runtime relocation. */\nexport const supportedPublishBuildCommand = (build: string) => {\n const command = build.replace(/[ \\t]+/g, \" \").replace(/^ | $/g, \"\");\n switch (command) {\n case \"tsdown\":\n return \"tsdown\";\n case \"vite build\":\n return \"vite\";\n case \"nuxt-module-build build\":\n return \"nuxt-module-build\";\n }\n throw new Error(\n \"Publish target resolver requires an exact single invocation: tsdown, vite build, or nuxt-module-build build; shell composition, launchers, filters and CLI overrides are unsupported\",\n );\n};\n\nexport const resolvePublishBuildTarget = async (\n directory: string,\n packer: PublishPacker,\n): Promise<PublishTarget> => {\n const manifest: unknown = JSON.parse(\n readFileSync(path.join(directory, \"package.json\"), \"utf8\"),\n );\n const assets = assetOnlyTarget(manifest, packer);\n if (assets !== undefined) return assets;\n if (\n !record(manifest) ||\n !record(manifest[\"scripts\"]) ||\n typeof manifest[\"scripts\"][\"build\"] !== \"string\"\n )\n throw new Error(\n \"A JavaScript package needs an explicitly supported build command\",\n );\n const compiler = supportedPublishBuildCommand(manifest[\"scripts\"][\"build\"]);\n switch (compiler) {\n case \"vite\":\n return await resolveVitePublishTarget(directory);\n case \"nuxt-module-build\":\n return resolveNuxtPublishTarget(directory);\n case \"tsdown\":\n break;\n }\n const configFiles = [\"ts\", \"mts\", \"cts\", \"js\", \"mjs\", \"cjs\", \"json\"]\n .map((extension) => path.join(directory, `tsdown.config.${extension}`))\n .filter(existsSync);\n if (configFiles.length !== 1)\n throw new Error(\n \"Publish target resolver requires exactly one tsdown configuration\",\n );\n const configFile = configFiles.at(0);\n if (configFile === undefined) throw new Error(\"Missing tsdown configuration\");\n const require = createRequire(path.join(directory, \"package.json\"));\n const metadata: unknown = JSON.parse(\n readFileSync(require.resolve(\"tsdown/package.json\"), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== supportedTsdownVersion)\n throw new Error(\n `Publish target resolver supports tsdown ${supportedTsdownVersion}; review the adapter before changing build tools`,\n );\n const loaderRequire = createRequire(import.meta.url);\n // Register tsx in the isolated Node process before any config imports. The\n // global registration avoids namespaced CJS imports rewriting builtin URLs.\n // The caller's Node executable owns config parsing and resolution, even when\n // the guard itself runs under Bun. Only final target data crosses the boundary.\n const scratch = mkdtempSync(path.join(tmpdir(), \"stll-publish-target-\"));\n try {\n const resultFile = path.join(scratch, \"targets.json\");\n const result = spawnSync(\n process.versions.bun ? \"node\" : process.execPath,\n [\n \"--import\",\n pathToFileURL(loaderRequire.resolve(\"tsx\")).href,\n \"--input-type=module\",\n \"--eval\",\n tsdownConfigProcess,\n JSON.stringify({\n directory,\n configFile,\n toolUrl: pathToFileURL(require.resolve(\"tsdown\")).href,\n resultFile,\n }),\n ],\n {\n cwd: directory,\n encoding: \"utf8\",\n timeout: 30_000,\n maxBuffer: 1024 * 1024,\n },\n );\n if (result.error) throw result.error;\n if (result.status !== 0)\n throw new Error(\n `Node tsdown configuration resolver failed: ${result.stderr.trim()}`,\n );\n const resolved: unknown = JSON.parse(readFileSync(resultFile, \"utf8\"));\n return resolvedTsdownTarget(resolved);\n } finally {\n rmSync(scratch, { recursive: true, force: true });\n }\n};\n\n// This is JavaScript executed by Node at the published engine floor. Keep config\n// functions inside the child so JSON cannot silently discard target overrides.\nconst tsdownConfigProcess = `\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { pathToFileURL } from 'node:url';\nconst { directory, configFile, toolUrl, resultFile } = JSON.parse(process.argv[1]);\nconst record = value => typeof value === 'object' && value !== null && !Array.isArray(value);\nconst tool = await import(toolUrl);\nif (typeof tool.resolveUserConfig !== 'function')\n throw new Error('Installed tsdown does not expose its configuration resolver');\nif (tool.globalLogger) tool.globalLogger.level = 'silent';\nconst loaded = configFile.endsWith('.json')\n ? { default: JSON.parse(readFileSync(configFile, 'utf8')) }\n : await import(pathToFileURL(configFile).href);\nif (!record(loaded)) throw new Error('Invalid tsdown module');\nconst exported = loaded.default;\nif (typeof exported === 'function')\n throw new Error('Dynamic root tsdown configurations require a supported target resolver');\nconst configs = Array.isArray(exported) ? exported : [exported];\nconst resolved = [];\nconst assertTsdownBuildExtensions = ${assertTsdownBuildExtensions.toString()};\nfor (const config of configs) {\n if (!record(config)) throw new Error('tsdown configurations must be objects');\n assertTsdownBuildExtensions(config);\n if (config.cwd !== undefined || config.workspace !== undefined || config.fromVite !== undefined)\n throw new Error('Relocated or inherited build configurations require a supported target resolver');\n const output = await tool.resolveUserConfig(\n { ...config, cwd: directory, logLevel: 'silent' }, { cwd: directory }, new Set(),\n );\n if (!Array.isArray(output)) throw new Error('Invalid tsdown resolved configuration');\n for (const entry of output) {\n if (!record(entry)) throw new Error('Invalid resolved tsdown configuration');\n assertTsdownBuildExtensions(entry);\n const input = entry.inputOptions;\n if (input !== undefined && !record(input))\n throw new Error('Dynamic tsdown inputOptions require a supported target resolver');\n const transform = record(input) ? input.transform : undefined;\n if (transform !== undefined && !record(transform))\n throw new Error('tsdown transform overrides must be an object');\n const target = record(transform) && transform.target != null ? transform.target : entry.target;\n const nonemptyIdentifiers = value => typeof value === 'string' && value.trim() !== '' && !value.includes(',');\n if (target !== undefined && !nonemptyIdentifiers(target) &&\n !(Array.isArray(target) && target.length > 0 && Array.from(target).every(nonemptyIdentifiers)))\n throw new Error('Build tool returned an unsupported resolved JavaScript target');\n resolved.push({ target, dts: { emitDtsOnly: record(entry.dts) && entry.dts.emitDtsOnly === true } });\n }\n}\nwriteFileSync(resultFile, JSON.stringify(resolved));\n`;\n","#!/usr/bin/env node\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport {\n assertConsumerPublishableManifest,\n discoverConsumerManifests,\n consumerRecord,\n} from \"./consumer-compat-config\";\nimport { resolveConsumerReleasePack } from \"./consumer-release-pack\";\nimport { readGitTrackedOutput } from \"./git-tracked-output\";\nimport { readPackedSyntaxFiles } from \"./publish-artifact-syntax\";\nimport { resolvePublishBuildTarget } from \"./publish-build-target\";\nimport {\n checkPublishContract,\n resolveManifestContract,\n type PublishPacker,\n type PublishTarget,\n} from \"./publish-contract\";\nimport { githubAutomationFileKind } from \"./toolchain-inputs\";\nimport { parseToolchainPolicy } from \"./toolchain-schema\";\n\ntype Mode =\n | { type: \"help\" }\n | { type: \"check\" }\n | { type: \"write\" }\n | { type: \"artifact\"; archive: string };\n\nconst parseMode = (args: string[]): Mode => {\n if (args.length === 0) return { type: \"check\" };\n if (args.length === 1 && args.at(0) === \"--help\") return { type: \"help\" };\n if (args.length === 1 && args.at(0) === \"--write\") return { type: \"write\" };\n const archive = args.at(1);\n if (\n args.length === 2 &&\n args.at(0) === \"--artifact\" &&\n archive !== undefined &&\n archive !== \"\" &&\n !archive.startsWith(\"--\")\n )\n return { type: \"artifact\", archive };\n throw new Error(\n \"Expected no arguments, --write, or --artifact <archive.tgz>; artifact checking cannot be combined with --write\",\n );\n};\n\ntype PublicContext = {\n file: string;\n target: PublishTarget;\n packer: PublishPacker;\n contract: unknown;\n};\n\nconst root = process.cwd();\nconst main = async () => {\n const mode = parseMode(process.argv.slice(2));\n if (mode.type === \"help\") {\n process.stdout.write(\n \"Usage: stll-publish-contract [--write | --artifact <archive.tgz>]\\n\",\n );\n } else {\n const write = mode.type === \"write\";\n const contexts = new Map<string, PublicContext>();\n const policy = parseToolchainPolicy(\n JSON.parse(\n readFileSync(new URL(\"../toolchain.json\", import.meta.url), \"utf8\"),\n ),\n );\n const consumer = {\n node: policy.consumerNode,\n typescript: policy.consumerTypescript,\n };\n const tracked = readGitTrackedOutput(root, \"paths\").split(\"\\0\");\n const files: Record<string, string> = {};\n for (const file of tracked) {\n if (\n file\n .split(\"/\")\n .some((part) => part === \"node_modules\" || part === \".git\") ||\n (![\"package.json\", \"pnpm-workspace.yaml\"].includes(\n path.posix.basename(file),\n ) &&\n githubAutomationFileKind(file) !== \"workflow\")\n )\n continue;\n files[file] = readFileSync(path.join(root, file), \"utf8\");\n }\n const manifests = discoverConsumerManifests(files);\n const names = new Set<string>();\n for (const manifest of manifests.values()) {\n const name = manifest[\"name\"];\n if (typeof name !== \"string\" || name === \"\") continue;\n if (names.has(name))\n throw new Error(`duplicate workspace package: ${name}`);\n names.add(name);\n }\n let checked = 0;\n for (const [relative, manifest] of [...manifests].sort(([left], [right]) =>\n left.localeCompare(right),\n )) {\n const file = path.posix.join(relative, \"package.json\");\n if (manifest[\"private\"] === true) continue;\n if (relative.split(\"/\").includes(\"vendor\"))\n throw new Error(\n `Published workspace packages under vendor directories are not supported by publish-contract: ${file}; move the package to a supported workspace directory`,\n );\n assertConsumerPublishableManifest({ manifest, directory: relative });\n checked++;\n const directory = path.dirname(path.join(root, file));\n const contractFile = path.join(directory, \"publish-contract.json\");\n const packer = resolveConsumerReleasePack(files).manager;\n const target = await resolvePublishBuildTarget(directory, packer);\n const current = resolveManifestContract({ manifest, target, packer });\n const committed: unknown = write\n ? current\n : JSON.parse(readFileSync(contractFile, \"utf8\"));\n const diagnostics = checkPublishContract({\n packer,\n manifest,\n target,\n contract: committed,\n policy: consumer,\n });\n for (const diagnostic of diagnostics)\n process.stderr.write(\n `${file}:1: [publish-contract] ${diagnostic.message}\\n`,\n );\n if (diagnostics.length > 0) {\n process.exitCode = 1;\n continue;\n }\n const name = manifest[\"name\"];\n if (typeof name !== \"string\")\n throw new Error(`Missing public package name: ${file}`);\n contexts.set(name, { file, target, packer, contract: committed });\n if (write)\n writeFileSync(contractFile, `${JSON.stringify(current, null, 2)}\\n`);\n }\n if (checked === 0) throw new Error(\"No published workspace packages found\");\n if (mode.type !== \"artifact\" || process.exitCode === 1) return;\n const packed = await readPackedSyntaxFiles(\n path.resolve(root, mode.archive),\n );\n const packedText = packed.get(\"package/package.json\");\n if (packedText === undefined)\n throw new Error(\"Artifact has no package/package.json\");\n const packedManifest: unknown = JSON.parse(packedText);\n if (\n !consumerRecord(packedManifest) ||\n typeof packedManifest[\"name\"] !== \"string\" ||\n packedManifest[\"private\"] === true\n )\n throw new Error(\n \"Artifact must identify a declared public workspace package\",\n );\n const name = packedManifest[\"name\"];\n const context = contexts.get(name);\n if (context === undefined)\n throw new Error(\n `Artifact package is not a declared public workspace package: ${name}`,\n );\n assertConsumerPublishableManifest({\n manifest: packedManifest,\n directory: mode.archive,\n });\n const diagnostics = checkPublishContract({\n manifest: packedManifest,\n target: context.target,\n packer: context.packer,\n contract: context.contract,\n policy: consumer,\n });\n for (const diagnostic of diagnostics)\n process.stderr.write(\n `${mode.archive}:1: [publish-contract] ${diagnostic.message} (${context.file})\\n`,\n );\n if (diagnostics.length > 0) process.exitCode = 1;\n }\n};\n\nmain().catch((error: unknown) => {\n process.stderr.write(\n `publish-contract:1: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA,MAAM,oBAAoB;CACxB,wBAAwB;CACxB,SAAS;CACT,QAAQ;AACV;AACA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;AAGrE,MAAa,2BAA2B,YAAqB;CAC3D,MAAM,SAAS,UAAmB;EAChC,IAAI,OAAO,UAAU,YACnB,MAAM,IAAI,MACR,uEACF;EACF,IAAI,MAAM,QAAQ,KAAK,GAAG;GACxB,KAAK,MAAM,QAAQ,OAAO,MAAM,IAAI;GACpC;EACF;EACA,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EACjD,IAAI,iBAAiB,QAAQ;EAC7B,MAAM,YAAqB,OAAO,eAAe,KAAK;EACtD,IAAI,cAAc,OAAO,aAAa,cAAc,MAClD,MAAM,IAAI,MAAM,0CAA0C;EAC5D,KAAK,MAAM,OAAO,QAAQ,QAAQ,KAAK,GAAG;GACxC,MAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;GAC7D,IAAI,OAAO,QAAQ,YAAY,CAAC,cAAc,EAAE,WAAW,aACzD,MAAM,IAAI,MAAM,yCAAyC;GAC3D,MAAM,QAAiB,WAAW;GAClC,IACE,QAAQ,aACR,UAAU,KAAA,MACT,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,IAEzC,MAAM,IAAI,MACR,oEACF;GACF,MAAM,KAAK;EACb;CACF;CACA,MAAM,OAAO;AACf;;AAGA,MAAa,sBAAsB,YAAoC;CACrE,wBAAwB,OAAO;CAC/B,IACE,CAACA,SAAO,OAAO,KACf,CAAC,MAAM,QAAQ,QAAQ,UAAU,KACjC,QAAQ,UAAU,CAAC,WAAW,GAE9B,MAAM,IAAI,MAAM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AAuC;EAC1E,IAAI,KAAK,SAAS,cAAc,QAAQ,aAAa,GAAG;EAIxD,MAAM,cAAa,MAHEC,gCAAAA,sBACnBN,UAAAA,QAAK,QAAQ,MAAM,KAAK,OAAO,CACjC,EAAA,CAC0B,IAAI,sBAAsB;EACpD,IAAI,eAAe,KAAA,GACjB,MAAM,IAAI,MAAM,sCAAsC;EACxD,MAAM,iBAA0B,KAAK,MAAM,UAAU;EACrD,IACE,CAACO,8BAAAA,eAAe,cAAc,KAC9B,OAAO,eAAe,YAAY,YAClC,eAAe,eAAe,MAE9B,MAAM,IAAI,MACR,4DACF;EACF,MAAM,OAAO,eAAe;EAC5B,MAAM,UAAU,SAAS,IAAI,IAAI;EACjC,IAAI,YAAY,KAAA,GACd,MAAM,IAAI,MACR,gEAAgE,MAClE;EACF,8BAAA,kCAAkC;GAChC,UAAU;GACV,WAAW,KAAK;EAClB,CAAC;EACD,MAAM,cAAcF,gCAAAA,qBAAqB;GACvC,UAAU;GACV,QAAQ,QAAQ;GAChB,QAAQ,QAAQ;GAChB,UAAU,QAAQ;GAClB,QAAQ;EACV,CAAC;EACD,KAAK,MAAM,cAAc,aACvB,QAAQ,OAAO,MACb,GAAG,KAAK,QAAQ,yBAAyB,WAAW,QAAQ,IAAI,QAAQ,KAAK,IAC/E;EACF,IAAI,YAAY,SAAS,GAAG,QAAQ,WAAW;CACjD;AACF;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MACb,uBAAuB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAChF;CACA,QAAQ,WAAW;AACrB,CAAC"}
1
+ {"version":3,"file":"publish-contract-cli.cjs","names":["record","realpathSync","require","createRequire","path","readFileSync","existsSync","pathToFileURL","execFileSync","record","parse","transformSync","reviewedViteDtsOptions","realpathSync","require","createRequire","path","readFileSync","pathToFileURL","declarationOnlyDts","resolveManifestContract","readFileSync","path","existsSync","require","createRequire","mkdtempSync","tmpdir","spawnSync","pathToFileURL","parseToolchainPolicy","readFileSync","readGitTrackedOutput","path","githubAutomationFileKind","discoverConsumerManifests","resolveConsumerReleasePack","resolveManifestContract","checkPublishContract","readPackedSyntaxFiles","consumerRecord"],"sources":["../src/publish-build-target-nuxt.ts","../src/publish-build-target-vite.ts","../src/publish-build-target.ts","../src/publish-contract-cli.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync, readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { PublishTarget } from \"./publish-contract\";\n\nconst supportedVersions = {\n \"@nuxt/module-builder\": \"1.0.3\",\n unbuild: \"3.6.1\",\n mkdist: \"2.4.1\",\n} as const;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** Only the reviewed builder and branded target hook may introduce executable build behavior. */\nexport const assertNuxtOutputOptions = (options: unknown) => {\n const visit = (value: unknown) => {\n if (typeof value === \"function\")\n throw new Error(\n \"Unreviewed Nuxt output transform requires a supported target resolver\",\n );\n if (Array.isArray(value)) {\n for (const item of value) visit(item);\n return;\n }\n if (typeof value !== \"object\" || value === null) return;\n if (value instanceof RegExp) return;\n const prototype: unknown = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null)\n throw new Error(\"Unsupported Nuxt output option prototype\");\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\"Unsupported Nuxt output option property\");\n const entry: unknown = descriptor.value;\n if (\n key === \"plugins\" &&\n entry !== undefined &&\n (!Array.isArray(entry) || entry.length > 0)\n )\n throw new Error(\n \"Unreviewed Nuxt output plugins require a supported target resolver\",\n );\n visit(entry);\n }\n };\n visit(options);\n};\n\n/** Read actual normalized entry targets, including mkdist's separate transform. */\nexport const resolvedNuxtTarget = (options: unknown): PublishTarget => {\n assertNuxtOutputOptions(options);\n if (\n !record(options) ||\n !Array.isArray(options[\"entries\"]) ||\n options[\"entries\"].length === 0\n )\n throw new Error(\"Nuxt must resolve at least one JavaScript entry\");\n const emitted = new Set<string>();\n for (const entry of options[\"entries\"]) {\n if (!record(entry)) throw new Error(\"Invalid resolved Nuxt entry\");\n let transform: unknown;\n switch (entry[\"builder\"]) {\n case \"rollup\":\n if (!record(options[\"rollup\"]))\n throw new Error(\"Invalid Nuxt module options\");\n transform = options[\"rollup\"][\"esbuild\"];\n break;\n case \"mkdist\":\n transform = entry[\"esbuild\"];\n break;\n default:\n throw new Error(\"Unsupported Nuxt JavaScript entry builder\");\n }\n if (transform !== undefined && !record(transform))\n throw new Error(\"Invalid Nuxt JavaScript transform options\");\n const target = record(transform) ? transform[\"target\"] : undefined;\n if (target === undefined) {\n emitted.add(\"esnext\");\n continue;\n }\n const targets = typeof target === \"string\" ? [target] : target;\n if (!Array.isArray(targets) || targets.length === 0)\n throw new Error(\"Unsupported resolved Nuxt JavaScript target\");\n for (const item of targets) {\n if (typeof item !== \"string\" || item.length === 0)\n throw new Error(\"Unsupported resolved Nuxt JavaScript target\");\n emitted.add(item);\n }\n }\n return { type: \"javascript\", targets: [...emitted].sort() };\n};\n\n// Run in a separate process: the loader only redirects the constructor's unbuild import.\nconst captureProgram = String.raw`\nimport { register } from 'node:module';\nconst payload = JSON.parse(process.argv[1]);\nregister(payload.loader, import.meta.url);\nconst jitiModule = await import(payload.jiti);\nconst createJiti = jitiModule.createJiti || jitiModule.default;\nconst jiti = createJiti(payload.directory);\nconst config = await jiti.import('./build.config', {try: true, default: true}) || {};\nconst record = value => typeof value === 'object' && value !== null && !Array.isArray(value);\nif (!record(config) || Object.keys(config).some(key => key !== 'hooks')) throw new Error('Nuxt build configuration only supports the declared target hook');\nglobalThis.__stllNuxtTargetHelper = undefined;\nglobalThis.__stllNuxtTargetData = undefined;\nif (config.hooks !== undefined) {\n if (!record(config.hooks) || Object.keys(config.hooks).length !== 1 || !('build:before' in config.hooks)) throw new Error('Nuxt build configuration only supports the declared target hook');\n if (!payload.helper) throw new Error('Nuxt target helper must be installed at the same tooling version');\n const helper = await jiti.import(payload.helper, {default: false});\n const targets = helper.nuxtModuleTargetTargets(config.hooks['build:before']);\n if (!targets) throw new Error('Nuxt build configuration requires immutable nuxtModuleTarget data');\n config.hooks['build:before'] = helper.nuxtModuleTarget(targets);\n globalThis.__stllNuxtTargetHelper = helper;\n globalThis.__stllNuxtTargetData = targets;\n}\nglobalThis.__stllNuxtAbort = new Error('Nuxt target captured');\nglobalThis.__stllNuxtCapture = undefined;\nconst tool = await import(payload.tool);\ntry {\n await tool.build.run({args: {cwd: payload.directory, rootDir: '.', outDir: 'dist', sourcemap: false, stub: false}});\n throw new Error('Nuxt build did not reach the configuration boundary');\n} catch (error) {\n if (error !== globalThis.__stllNuxtAbort) throw error;\n}\nconsole.log('__STLL_NUXT_TARGET__' + JSON.stringify(globalThis.__stllNuxtCapture));\n`;\n\nconst captureShim = (unbuild: string) => `\nimport {build as actualBuild} from ${JSON.stringify(unbuild)};\nexport const build = (root, stub, input) => {\n const expectedHooks = {...input.hooks};\n const helper = globalThis.__stllNuxtTargetHelper;\n if (helper) expectedHooks['build:before'] = helper.nuxtModuleTarget(globalThis.__stllNuxtTargetData);\n const prepare = context => {\n const helper = globalThis.__stllNuxtTargetHelper;\n const loadedHooks = context.options.hooks;\n if (!loadedHooks || typeof loadedHooks !== 'object' || Array.isArray(loadedHooks)) throw new Error('Nuxt target configuration changed during loading');\n const expectedKeys = Reflect.ownKeys(expectedHooks);\n const loadedKeys = Reflect.ownKeys(loadedHooks);\n if (loadedKeys.length !== expectedKeys.length || loadedKeys.some(key => !expectedKeys.includes(key))) throw new Error('Nuxt target configuration changed during loading');\n for (const key of loadedKeys) {\n const descriptor = Object.getOwnPropertyDescriptor(loadedHooks, key);\n if (!descriptor || !('value' in descriptor)) throw new Error('Nuxt target configuration changed during loading');\n if (key === 'build:before' && helper) continue;\n if (descriptor.value !== expectedHooks[key]) throw new Error('Nuxt target configuration changed during loading');\n }\n const declared = loadedHooks['build:before'];\n if (helper) {\n const targets = helper.nuxtModuleTargetTargets(declared);\n if (!targets || JSON.stringify(targets) !== JSON.stringify(globalThis.__stllNuxtTargetData)) throw new Error('Nuxt target configuration changed during loading');\n if (typeof context.hooks.removeHook !== 'function') throw new Error('Unsupported Nuxt hook registration interface');\n // unbuild registers config hooks before build:prepare; remove that exact callback.\n context.hooks.removeHook('build:before', declared);\n const canonical = helper.nuxtModuleTarget(targets);\n context.options.hooks['build:before'] = canonical;\n context.hooks.hook('build:before', canonical);\n }\n // unbuild 3.6.1 normalizes entries before build:before, then cleans output.\n // Append after all registered config hooks so the target helper runs first.\n context.hooks.hook('build:before', final => {\n // The reviewed constructor owns its later hooks; user config accepts only nuxtModuleTarget.\n // Validate executable output options before projecting away functions for the capture.\n (${assertNuxtOutputOptions.toString()})({entries: final.options.entries, rollup: final.options.rollup});\n globalThis.__stllNuxtCapture = {\n entries: final.options.entries.map(entry => ({builder: entry.builder, esbuild: entry.esbuild})),\n rollup: {esbuild: final.options.rollup.esbuild}\n };\n throw globalThis.__stllNuxtAbort;\n });\n };\n expectedHooks['build:prepare'] = prepare;\n return actualBuild(root, stub, {...input, hooks: {...input.hooks, 'build:prepare': prepare}});\n};\n`;\n\nexport const resolveNuxtPublishTarget = (directory: string): PublishTarget => {\n const canonicalDirectory = realpathSync(directory);\n const require = createRequire(path.join(canonicalDirectory, \"package.json\"));\n const manifest: unknown = JSON.parse(\n readFileSync(path.join(canonicalDirectory, \"package.json\"), \"utf8\"),\n );\n if (\n !record(manifest) ||\n manifest[\"build\"] !== undefined ||\n manifest[\"unbuild\"] !== undefined ||\n (record(manifest[\"publishConfig\"]) &&\n (manifest[\"publishConfig\"][\"build\"] !== undefined ||\n manifest[\"publishConfig\"][\"unbuild\"] !== undefined))\n )\n throw new Error(\n \"Nuxt manifest build overrides require a supported target resolver\",\n );\n const configs = [\"ts\", \"mts\", \"cts\", \"js\", \"mjs\", \"cjs\", \"json\"].filter(\n (extension) =>\n existsSync(path.join(canonicalDirectory, `build.config.${extension}`)),\n );\n if (configs.length > 1)\n throw new Error(\"Nuxt supports exactly one build configuration\");\n const tool = realpathSync(require.resolve(\"@nuxt/module-builder\"));\n const toolRequire = createRequire(tool);\n const unbuild = realpathSync(toolRequire.resolve(\"unbuild\"));\n const unbuildRequire = createRequire(unbuild);\n for (const [name, version] of Object.entries(supportedVersions)) {\n let entry: string;\n switch (name) {\n case \"@nuxt/module-builder\":\n entry = tool;\n break;\n case \"unbuild\":\n entry = unbuild;\n break;\n case \"mkdist\":\n entry = realpathSync(unbuildRequire.resolve(\"mkdist\"));\n break;\n default:\n throw new Error(`Unsupported Nuxt build tool ${name}`);\n }\n const metadata: unknown = JSON.parse(\n readFileSync(\n path.resolve(path.dirname(entry), \"../package.json\"),\n \"utf8\",\n ),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(\n `Publish target resolver supports ${name} ${version}; review the adapter before changing build tools`,\n );\n }\n let helper: string | undefined;\n if (configs.length > 0) {\n const helperEntry = realpathSync(\n require.resolve(\"@stll/oxlint-config/build-target\"),\n );\n const metadata: unknown = JSON.parse(\n readFileSync(\n path.resolve(path.dirname(helperEntry), \"../package.json\"),\n \"utf8\",\n ),\n );\n const ownMetadata: unknown = JSON.parse(\n readFileSync(new URL(\"../package.json\", import.meta.url), \"utf8\"),\n );\n if (\n !record(metadata) ||\n !record(ownMetadata) ||\n metadata[\"version\"] !== ownMetadata[\"version\"]\n )\n throw new Error(\n \"Nuxt target helper must use the same tooling version as the resolver\",\n );\n helper = pathToFileURL(helperEntry).href;\n }\n const shim = `data:text/javascript,${encodeURIComponent(captureShim(pathToFileURL(unbuild).href))}`;\n const loader = `\nimport {realpathSync} from 'node:fs';\nimport path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nexport const resolve=(specifier,context,next)=>{\n if(specifier!=='unbuild')return next(specifier,context);\n if(!context.parentURL||!context.parentURL.startsWith('file:')||path.dirname(realpathSync(fileURLToPath(context.parentURL)))!==${JSON.stringify(path.dirname(tool))})throw new Error('Unexpected Nuxt unbuild import parent');\n return {url:${JSON.stringify(shim)},shortCircuit:true};\n};`;\n const output = execFileSync(\n process.versions.bun ? \"node\" : process.execPath,\n [\n \"--input-type=module\",\n \"-e\",\n captureProgram,\n JSON.stringify({\n directory: canonicalDirectory,\n tool: pathToFileURL(tool).href,\n unbuild: pathToFileURL(unbuild).href,\n jiti: pathToFileURL(realpathSync(unbuildRequire.resolve(\"jiti\"))).href,\n helper,\n loader: `data:text/javascript,${encodeURIComponent(loader)}`,\n }),\n ],\n {\n cwd: canonicalDirectory,\n encoding: \"utf8\",\n timeout: 30_000,\n maxBuffer: 1024 * 1024,\n env: { ...process.env, JITI_FS_CACHE: \"0\", JITI_MODULE_CACHE: \"1\" },\n },\n );\n const captures = output\n .split(\"\\n\")\n .filter((line) => line.startsWith(\"__STLL_NUXT_TARGET__\"));\n const capture = captures.at(0);\n if (captures.length !== 1 || capture === undefined)\n throw new Error(\n \"Nuxt did not return exactly one resolved build configuration\",\n );\n return resolvedNuxtTarget(\n JSON.parse(capture.slice(\"__STLL_NUXT_TARGET__\".length)),\n );\n};\n","import { parse } from \"acorn\";\nimport { transformSync } from \"esbuild\";\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { reviewedViteDtsOptions } from \"./publish-build-target-vite-dts\";\nimport { declarationOnlyDts } from \"./publish-build-target-vite-dts-helper\";\nimport type { PublishTarget } from \"./publish-contract\";\n\nconst supportedViteVersion = \"8.1.5\";\nconst declarationHelperImport = \"@stll/oxlint-config/declaration-only-dts\";\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\ntype WalkAstOptions = {\n value: unknown;\n visit: (\n node: Record<string, unknown>,\n parent: Record<string, unknown> | undefined,\n ) => void;\n parent?: Record<string, unknown>;\n};\nconst walkAst = ({ value, visit, parent }: WalkAstOptions) => {\n if (Array.isArray(value)) {\n for (const entry of value)\n walkAst({\n value: entry,\n visit,\n ...(parent === undefined ? {} : { parent }),\n });\n return;\n }\n if (!record(value)) return;\n visit(value, parent);\n for (const entry of Object.values(value))\n if (typeof entry === \"object\" && entry !== null)\n walkAst({ value: entry, visit, parent: value });\n};\nconst astName = (value: unknown) =>\n record(value) && value[\"type\"] === \"Identifier\" ? value[\"name\"] : undefined;\nconst astLiteral = (value: unknown): unknown => {\n if (!record(value))\n throw new Error(\"Declaration helper options must be literal\");\n if (\n value[\"type\"] === \"Literal\" &&\n (typeof value[\"value\"] === \"string\" || typeof value[\"value\"] === \"boolean\")\n )\n return value[\"value\"];\n if (value[\"type\"] === \"ArrayExpression\" && Array.isArray(value[\"elements\"]))\n return value[\"elements\"].map(astLiteral);\n if (\n value[\"type\"] === \"ObjectExpression\" &&\n Array.isArray(value[\"properties\"])\n ) {\n const entries: [string, unknown][] = [];\n for (const property of value[\"properties\"]) {\n if (\n !record(property) ||\n property[\"type\"] !== \"Property\" ||\n property[\"kind\"] !== \"init\" ||\n property[\"computed\"] === true ||\n property[\"method\"] === true ||\n property[\"shorthand\"] === true\n )\n throw new Error(\n \"Declaration helper options must be plain literal properties\",\n );\n const key =\n astName(property[\"key\"]) ??\n (record(property[\"key\"]) ? property[\"key\"][\"value\"] : undefined);\n if (\n typeof key !== \"string\" ||\n entries.some(([previous]) => previous === key)\n )\n throw new Error(\"Invalid declaration helper option key\");\n entries.push([key, astLiteral(property[\"value\"])]);\n }\n return Object.fromEntries(entries);\n }\n throw new Error(\"Declaration helper options must be literal\");\n};\ntype ReviewedDtsConfigurationOptions = {\n source: string;\n directory: string;\n loader: \"ts\" | \"js\";\n};\n/** Prove the helper owns the directly declared plugin; closure brands alone are insufficient. */\nexport const reviewedDtsConfiguration = ({\n source,\n directory,\n loader,\n}: ReviewedDtsConfigurationOptions) => {\n const ast: unknown = parse(\n transformSync(source, { loader, format: \"esm\", target: \"esnext\" }).code,\n { ecmaVersion: \"latest\", sourceType: \"module\" },\n );\n if (!record(ast) || !Array.isArray(ast[\"body\"]))\n throw new Error(\"Invalid Vite configuration AST\");\n const bindings = new Set<string>();\n const defineConfigBindings = new Set<string>();\n const initializers = new Map<unknown, unknown>();\n let exported: unknown;\n for (const statement of ast[\"body\"]) {\n if (!record(statement)) continue;\n if (\n statement[\"type\"] === \"ImportDeclaration\" &&\n record(statement[\"source\"])\n ) {\n const imported = statement[\"source\"][\"value\"];\n if (\n typeof imported === \"string\" &&\n /^(?:vite-plugin-dts|unplugin-dts)(?:\\/|$)/.test(imported)\n )\n throw new Error(\n \"Raw declaration emitters cannot accompany the reviewed helper\",\n );\n if (Array.isArray(statement[\"specifiers\"]))\n for (const specifier of statement[\"specifiers\"]) {\n if (!record(specifier)) continue;\n const local = astName(specifier[\"local\"]);\n const name = astName(specifier[\"imported\"]);\n if (imported === declarationHelperImport) {\n if (\n specifier[\"type\"] !== \"ImportSpecifier\" ||\n name !== \"declarationOnlyDts\" ||\n typeof local !== \"string\"\n )\n throw new Error(\"Use the named declarationOnlyDts helper import\");\n bindings.add(local);\n }\n if (\n imported === \"vite\" &&\n name === \"defineConfig\" &&\n typeof local === \"string\"\n )\n defineConfigBindings.add(local);\n }\n }\n if (\n statement[\"type\"] === \"VariableDeclaration\" &&\n Array.isArray(statement[\"declarations\"])\n )\n for (const declaration of statement[\"declarations\"])\n if (record(declaration))\n initializers.set(astName(declaration[\"id\"]), declaration[\"init\"]);\n if (statement[\"type\"] === \"ExportDefaultDeclaration\")\n exported = statement[\"declaration\"];\n if (\n statement[\"type\"] === \"ExportNamedDeclaration\" &&\n Array.isArray(statement[\"specifiers\"])\n )\n for (const specifier of statement[\"specifiers\"])\n if (record(specifier) && astName(specifier[\"exported\"]) === \"default\")\n exported = specifier[\"local\"];\n }\n if (bindings.size !== 1)\n throw new Error(\n \"Vite declaration plugins require one statically imported helper\",\n );\n if (record(exported) && exported[\"type\"] === \"Identifier\")\n exported = initializers.get(astName(exported));\n if (\n record(exported) &&\n exported[\"type\"] === \"CallExpression\" &&\n defineConfigBindings.has(String(astName(exported[\"callee\"]))) &&\n Array.isArray(exported[\"arguments\"]) &&\n exported[\"arguments\"].length === 1\n )\n exported = exported[\"arguments\"].at(0);\n if (\n !record(exported) ||\n exported[\"type\"] !== \"ObjectExpression\" ||\n !Array.isArray(exported[\"properties\"])\n )\n throw new Error(\n \"Declaration helper requires a directly exported static Vite configuration\",\n );\n const pluginProperties = exported[\"properties\"].filter(\n (property) =>\n record(property) &&\n (astName(property[\"key\"]) === \"plugins\" ||\n (record(property[\"key\"]) && property[\"key\"][\"value\"] === \"plugins\")),\n );\n const property = pluginProperties.at(0);\n if (\n pluginProperties.length !== 1 ||\n !record(property) ||\n property[\"computed\"] === true ||\n property[\"kind\"] !== \"init\" ||\n !record(property[\"value\"]) ||\n property[\"value\"][\"type\"] !== \"ArrayExpression\" ||\n !Array.isArray(property[\"value\"][\"elements\"])\n )\n throw new Error(\"Declaration helper requires a literal plugins array\");\n const calls = property[\"value\"][\"elements\"]\n .map((element) =>\n record(element) && element[\"type\"] === \"AwaitExpression\"\n ? element[\"argument\"]\n : element,\n )\n .filter(\n (element) =>\n record(element) &&\n element[\"type\"] === \"CallExpression\" &&\n bindings.has(String(astName(element[\"callee\"]))),\n );\n const call = calls.at(0);\n if (\n calls.length !== 1 ||\n !record(call) ||\n !Array.isArray(call[\"arguments\"]) ||\n call[\"arguments\"].length !== 1\n )\n throw new Error(\"Declare exactly one direct declaration helper call\");\n walkAst({\n value: ast,\n visit: (node, parent) => {\n if (node[\"type\"] === \"ImportDeclaration\") return;\n const name = astName(node);\n if (typeof name !== \"string\" || !bindings.has(name)) return;\n if (parent?.[\"type\"] === \"ImportSpecifier\") return;\n if (parent !== call || call[\"callee\"] !== node)\n throw new Error(\n \"Declaration helper binding cannot be aliased or invoked indirectly\",\n );\n },\n });\n const argument = call[\"arguments\"].at(0);\n if (\n !record(argument) ||\n argument[\"type\"] !== \"ObjectExpression\" ||\n !Array.isArray(argument[\"properties\"])\n )\n throw new Error(\"Declaration helper options must be a literal object\");\n const directoryProperties = argument[\"properties\"].filter(\n (entry) => record(entry) && astName(entry[\"key\"]) === \"directory\",\n );\n const directoryProperty = directoryProperties.at(0);\n if (\n directoryProperties.length !== 1 ||\n !record(directoryProperty) ||\n directoryProperty[\"computed\"] === true ||\n directoryProperty[\"kind\"] !== \"init\"\n )\n throw new Error(\"Declaration helper requires its package directory\");\n const value = directoryProperty[\"value\"];\n const meta = record(value) ? value[\"object\"] : undefined;\n const importDirectory =\n record(value) &&\n value[\"type\"] === \"MemberExpression\" &&\n value[\"computed\"] === false &&\n astName(value[\"property\"]) === \"dirname\" &&\n record(meta) &&\n meta[\"type\"] === \"MetaProperty\" &&\n astName(meta[\"meta\"]) === \"import\" &&\n astName(meta[\"property\"]) === \"meta\";\n const exactDirectory =\n record(value) &&\n value[\"type\"] === \"Literal\" &&\n value[\"value\"] === directory;\n if (!importDirectory && !exactDirectory)\n throw new Error(\n \"Declaration helper directory must be import.meta.dirname or the exact package directory\",\n );\n return reviewedViteDtsOptions(\n astLiteral({\n ...argument,\n properties: argument[\"properties\"].filter(\n (entry) => entry !== directoryProperty,\n ),\n }),\n );\n};\n\nconst ownEntries = (value: object): [string, unknown][] =>\n 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(\"Unsupported Vite hook property\");\n return [key, descriptor.value];\n });\nconst metadataSource = (value: unknown): string => {\n if (value instanceof RegExp)\n return JSON.stringify([\"regexp\", value.source, value.flags]);\n if (Array.isArray(value))\n return JSON.stringify([\"array\", value.map(metadataSource)]);\n if (record(value)) {\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n )\n throw new Error(\"Unsupported Vite hook metadata\");\n return JSON.stringify([\n \"object\",\n ownEntries(value)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([key, item]) => [key, metadataSource(item)]),\n ]);\n }\n if (value === undefined) return \"undefined\";\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\" ||\n (typeof value === \"number\" && Number.isFinite(value))\n )\n return JSON.stringify(value);\n throw new Error(\"Unsupported Vite hook metadata\");\n};\nconst hookSource = (value: unknown) => {\n if (typeof value === \"function\")\n return JSON.stringify([\n \"function\",\n Function.prototype.toString.call(value),\n ]);\n if (!record(value)) throw new Error(\"Unsupported Vite build hook\");\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n )\n throw new Error(\"Unsupported Vite hook metadata\");\n const entries = ownEntries(value);\n const handler = entries.find(([key]) => key === \"handler\")?.[1];\n if (typeof handler !== \"function\")\n throw new Error(\"Unsupported Vite build hook\");\n const metadata = entries.filter(([key]) => key !== \"handler\");\n if (\n metadata.some(([key]) => ![\"order\", \"sequential\", \"filter\"].includes(key))\n )\n throw new Error(\"Unsupported Vite hook metadata\");\n return JSON.stringify([\n \"object\",\n Function.prototype.toString.call(handler),\n metadataSource(Object.fromEntries(metadata)),\n ]);\n};\nconst pluginEntries = (plugin: object) => {\n const entries = new Map<string, unknown>();\n let current = plugin;\n while (current !== Object.prototype) {\n for (const [key, value] of ownEntries(current)) {\n if (current !== plugin && key === \"constructor\") continue;\n if (!entries.has(key)) entries.set(key, value);\n }\n const prototype: unknown = Object.getPrototypeOf(current);\n if (prototype === null) break;\n if (!record(prototype))\n throw new Error(\"Unsupported Vite plugin prototype\");\n current = prototype;\n }\n return entries;\n};\nconst plugins = (config: unknown): unknown[] => {\n if (\n !record(config) ||\n !record(config[\"build\"]) ||\n !record(config[\"environments\"])\n )\n throw new Error(\"Invalid Vite plugin configuration\");\n const environment =\n config[\"environments\"][\n config[\"build\"][\"ssr\"] === true ||\n (typeof config[\"build\"][\"ssr\"] === \"string\" &&\n config[\"build\"][\"ssr\"] !== \"\")\n ? \"ssr\"\n : \"client\"\n ];\n if (\n !record(environment) ||\n !Array.isArray(environment[\"plugins\"]) ||\n !Array.isArray(config[\"plugins\"])\n )\n throw new Error(\"Missing resolved Vite environment plugins\");\n const options = config[\"build\"][\"rolldownOptions\"];\n const extra = record(options) ? options[\"plugins\"] : undefined;\n if (extra !== undefined && !Array.isArray(extra))\n throw new Error(\n \"Dynamic Vite rolldown plugins require a supported target resolver\",\n );\n return [\n ...config[\"plugins\"],\n ...environment[\"plugins\"],\n ...(extra ?? []),\n ].flat(Infinity);\n};\n\ntype ReviewedVitePluginsOptions = {\n resolved: readonly unknown[];\n reviewed: readonly unknown[];\n};\ntype ReviewedVueOptions = { plugin: unknown; reviewed: unknown };\n/** Vue hook closures may only capture the reviewed factory's default options. */\nexport const assertReviewedVueOptions = ({\n plugin,\n reviewed,\n}: ReviewedVueOptions) => {\n const fail = () =>\n new Error(\"Custom Vue plugin options require a supported target resolver\");\n if (\n !record(plugin) ||\n !record(reviewed) ||\n !record(plugin[\"api\"]) ||\n !record(reviewed[\"api\"])\n )\n throw fail();\n const api = plugin[\"api\"];\n const defaults = reviewed[\"api\"];\n const options = api[\"options\"];\n const defaultOptions = defaults[\"options\"];\n if (!record(options) || !record(defaultOptions)) throw fail();\n if (\n Object.getPrototypeOf(options) !== Object.prototype &&\n Object.getPrototypeOf(options) !== null\n )\n throw fail();\n if (\n metadataSource(api[\"include\"]) !== metadataSource(defaults[\"include\"]) ||\n api[\"exclude\"] !== undefined\n )\n throw fail();\n const lifecycleFields = new Set([\n \"isProduction\",\n \"sourceMap\",\n \"cssDevSourcemap\",\n \"devToolsEnabled\",\n ]);\n for (const [key, value] of ownEntries(options)) {\n if (key === \"root\") {\n if (typeof value !== \"string\") throw fail();\n continue;\n }\n if (lifecycleFields.has(key)) {\n if (typeof value !== \"boolean\") throw fail();\n continue;\n }\n if (key === \"compiler\") {\n if (value !== null && value !== undefined) throw fail();\n continue;\n }\n if (\n !Object.hasOwn(defaultOptions, key) ||\n metadataSource(value) !== metadataSource(defaultOptions[key])\n )\n throw fail();\n }\n for (const [key] of ownEntries(defaultOptions)) {\n if (!Object.hasOwn(options, key) && key !== \"compiler\") throw fail();\n }\n};\nconst vitePluginMetadata = new Set([\n \"enforce\",\n \"_options\",\n \"perEnvironmentStartEndDuringDev\",\n \"perEnvironmentWatchChangeDuringDev\",\n]);\nconst nativeCallbackFields = new Map([\n [\"builtin:vite-resolve\", \"resolveSubpathImports\"],\n [\"builtin:vite-dynamic-import-vars\", \"resolver\"],\n [\"builtin:vite-reporter\", \"logInfo\"],\n]);\nconst nativeOptionsSource = (name: string, value: unknown) => {\n if (!record(value)) return metadataSource(value);\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n )\n throw new Error(\"Unsupported Vite native options\");\n return JSON.stringify(\n ownEntries(value)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([key, item]) => {\n if (\n key === nativeCallbackFields.get(name) &&\n typeof item === \"function\"\n )\n return [\n key,\n \"reviewed-callback\",\n Function.prototype.toString.call(item),\n ];\n return [key, \"metadata\", metadataSource(item)];\n }),\n );\n};\nconst pluginSources = (plugin: object) => {\n const entries = pluginEntries(plugin);\n for (const key of [...vitePluginMetadata, \"apply\"])\n if (!entries.has(key)) entries.set(key, undefined);\n const sources = new Map<string, string>();\n for (const [key, value] of entries) {\n if (key === \"name\" || key === \"api\") continue;\n if (key === \"_options\") {\n const name = entries.get(\"name\");\n if (typeof name !== \"string\") throw new Error(\"Invalid Vite plugin name\");\n sources.set(key, `native:${nativeOptionsSource(name, value)}`);\n continue;\n }\n if (\n vitePluginMetadata.has(key) ||\n (key === \"apply\" && typeof value !== \"function\")\n )\n sources.set(key, `metadata:${metadataSource(value)}`);\n else if (value === undefined) sources.set(key, \"absent-hook\");\n else sources.set(key, `hook:${hookSource(value)}`);\n }\n return sources;\n};\n\n/** Reviewed tool versions own the plugin name, hook name and implementation together. */\nexport const assertReviewedVitePlugins = ({\n resolved,\n reviewed,\n}: ReviewedVitePluginsOptions) => {\n const identities = new Map<string, Map<string, Set<string>>>();\n for (const plugin of reviewed) {\n if (!record(plugin) || typeof plugin[\"name\"] !== \"string\")\n throw new Error(\"Invalid reviewed Vite plugin\");\n const name = plugin[\"name\"];\n const hooks = identities.get(name) ?? new Map<string, Set<string>>();\n identities.set(name, hooks);\n for (const [key, source] of pluginSources(plugin)) {\n const sources = hooks.get(key) ?? new Set<string>();\n sources.add(source);\n hooks.set(key, sources);\n }\n }\n for (const plugin of resolved) {\n if (plugin === undefined || plugin === null || plugin === false) continue;\n if (!record(plugin) || typeof plugin[\"name\"] !== \"string\")\n throw new Error(\n \"Dynamic Vite plugins require a supported target resolver\",\n );\n const name = plugin[\"name\"];\n const hooks = identities.get(name);\n if (hooks === undefined)\n throw new Error(\n `Unreviewed Vite plugin ${name} requires a supported target resolver`,\n );\n for (const [key, source] of pluginSources(plugin)) {\n if (!hooks.get(key)?.has(source))\n throw new Error(\n `Unreviewed Vite hook ${name}:${key} requires a supported target resolver`,\n );\n }\n }\n const pipelineIdentity = (plugin: unknown) => {\n if (!record(plugin) || typeof plugin[\"name\"] !== \"string\")\n throw new Error(\"Invalid reviewed Vite pipeline entry\");\n return JSON.stringify([\n plugin[\"name\"],\n [...pluginSources(plugin)].sort(([a], [b]) => a.localeCompare(b)),\n ]);\n };\n const actualPipeline = resolved.filter(\n (plugin) => plugin !== undefined && plugin !== null && plugin !== false,\n );\n if (\n actualPipeline.length !== reviewed.length ||\n reviewed.some(\n (plugin, index) =>\n pipelineIdentity(plugin) !== pipelineIdentity(actualPipeline[index]),\n )\n )\n throw new Error(\n \"Vite plugin pipeline must match the complete reviewed order\",\n );\n};\n\n/** Vite 8 spreads transform overrides after its resolved build target. */\nexport const resolvedViteTarget = (config: unknown): PublishTarget => {\n if (!record(config) || !record(config[\"build\"]))\n throw new Error(\"Invalid resolved Vite build configuration\");\n if (config[\"builder\"] !== undefined)\n throw new Error(\"Custom Vite builders require a supported target resolver\");\n const build = config[\"build\"];\n const options = build[\"rolldownOptions\"];\n if (options !== undefined && !record(options))\n throw new Error(\"Vite rolldownOptions must be an object\");\n const output = record(options) ? options[\"output\"] : undefined;\n if (output !== undefined) {\n const outputs = Array.isArray(output) ? output : [output];\n for (const entry of outputs) {\n if (!record(entry)) throw new Error(\"Unsupported Vite output options\");\n for (const key of [\"banner\", \"footer\", \"intro\", \"outro\"]) {\n if (entry[key] !== undefined && entry[key] !== \"\")\n throw new Error(\n \"Vite output addons require a supported target resolver\",\n );\n }\n const outputPlugins = entry[\"plugins\"];\n if (\n outputPlugins !== undefined &&\n (!Array.isArray(outputPlugins) || outputPlugins.length > 0)\n )\n throw new Error(\n \"Vite output plugins require a supported target resolver\",\n );\n }\n }\n const transform = record(options) ? options[\"transform\"] : undefined;\n if (transform !== undefined && !record(transform))\n throw new Error(\"Vite transform overrides must be an object\");\n let target = build[\"target\"] === false ? undefined : build[\"target\"];\n if (record(transform) && \"target\" in transform) target = transform[\"target\"];\n if (target === undefined) return { type: \"javascript\", targets: [\"esnext\"] };\n const targets = typeof target === \"string\" ? [target] : target;\n if (!Array.isArray(targets) || targets.length === 0)\n throw new Error(\"Unsupported resolved Vite JavaScript target\");\n const emitted = new Set<string>();\n for (const item of targets) {\n if (typeof item !== \"string\" || item.length === 0)\n throw new Error(\"Unsupported resolved Vite JavaScript target\");\n emitted.add(item);\n }\n return { type: \"javascript\", targets: [...emitted].sort() };\n};\n\n/** Only static build settings needed by the installed tool's canonical profile cross this boundary. */\nexport const reviewedViteBuild = (build: unknown) => {\n if (!record(build)) throw new Error(\"Invalid Vite build configuration\");\n const properties = new Map(ownEntries(build));\n const result: Record<string, unknown> = {};\n for (const key of [\n \"target\",\n \"sourcemap\",\n \"minify\",\n \"ssr\",\n \"cssCodeSplit\",\n \"assetsInlineLimit\",\n \"assetsDir\",\n \"reportCompressedSize\",\n \"chunkSizeWarningLimit\",\n \"modulePreload\",\n ]) {\n const value = properties.get(key);\n metadataSource(value);\n result[key] = value;\n }\n const library = properties.get(\"lib\");\n if (record(library)) {\n if (\n Object.getPrototypeOf(library) !== Object.prototype &&\n Object.getPrototypeOf(library) !== null\n )\n throw new Error(\"Unsupported Vite library configuration\");\n const libraryProperties = new Map(ownEntries(library));\n const fields: Record<string, unknown> = {};\n for (const key of [\"entry\", \"formats\", \"name\"]) {\n const value = libraryProperties.get(key);\n metadataSource(value);\n fields[key] = value;\n }\n result[\"lib\"] = fields;\n } else if (library === undefined || library === false)\n result[\"lib\"] = library;\n else throw new Error(\"Unsupported Vite library configuration\");\n return result;\n};\n\nexport const resolveVitePublishTarget = async (\n directory: string,\n): Promise<PublishTarget> => {\n const canonicalDirectory = realpathSync(directory);\n const require = createRequire(path.join(canonicalDirectory, \"package.json\"));\n const metadata: unknown = JSON.parse(\n readFileSync(require.resolve(\"vite/package.json\"), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== supportedViteVersion)\n throw new Error(\n `Publish target resolver supports Vite ${supportedViteVersion}; review the adapter before changing build tools`,\n );\n const tool: unknown = await import(\n pathToFileURL(realpathSync(require.resolve(\"vite\"))).href\n );\n if (!record(tool) || typeof tool[\"resolveConfig\"] !== \"function\")\n throw new Error(\n \"Installed Vite does not expose its configuration resolver\",\n );\n // Match the legacy CLI builder's patch before configResolved hooks run.\n const patchConfig = (resolved: unknown) => {\n if (\n !record(resolved) ||\n !record(resolved[\"build\"]) ||\n !record(resolved[\"environments\"])\n )\n throw new Error(\"Invalid Vite environment configuration\");\n if (resolved[\"builder\"] !== undefined)\n throw new Error(\n \"Custom Vite builders require a supported target resolver\",\n );\n const environment =\n resolved[\"environments\"][\n resolved[\"build\"][\"ssr\"] === true ||\n (typeof resolved[\"build\"][\"ssr\"] === \"string\" &&\n resolved[\"build\"][\"ssr\"] !== \"\")\n ? \"ssr\"\n : \"client\"\n ];\n if (!record(environment) || !record(environment[\"build\"]))\n throw new Error(\"Missing resolved Vite build environment\");\n resolved[\"build\"] = { ...environment[\"build\"] };\n };\n const config: unknown = await tool[\"resolveConfig\"](\n { root: canonicalDirectory },\n \"build\",\n \"production\",\n \"production\",\n false,\n patchConfig,\n );\n if (!record(config) || !record(config[\"build\"]))\n throw new Error(\"Invalid Vite build configuration\");\n const resolvedPlugins = plugins(config);\n const canonicalVuePlugins: unknown[] = [];\n if (\n resolvedPlugins.some(\n (plugin) => record(plugin) && plugin[\"name\"] === \"vite:vue\",\n )\n ) {\n const vueMetadata: unknown = JSON.parse(\n readFileSync(require.resolve(\"@vitejs/plugin-vue/package.json\"), \"utf8\"),\n );\n if (!record(vueMetadata) || vueMetadata[\"version\"] !== \"6.0.8\")\n throw new Error(\n \"Publish target resolver supports @vitejs/plugin-vue 6.0.8; review the adapter before changing build tools\",\n );\n const vue: unknown = await import(\n pathToFileURL(realpathSync(require.resolve(\"@vitejs/plugin-vue\"))).href\n );\n if (!record(vue) || typeof vue[\"default\"] !== \"function\")\n throw new Error(\"Invalid installed Vue plugin factory\");\n const plugin: unknown = vue[\"default\"]();\n if (!record(plugin)) throw new Error(\"Invalid installed Vue plugin\");\n for (const resolved of resolvedPlugins) {\n if (record(resolved) && resolved[\"name\"] === \"vite:vue\")\n assertReviewedVueOptions({ plugin: resolved, reviewed: plugin });\n }\n canonicalVuePlugins.push(plugin);\n }\n if (\n resolvedPlugins.some(\n (plugin) =>\n record(plugin) && plugin[\"name\"] === \"stll:declaration-only-dts\",\n )\n ) {\n const configFile = config[\"configFile\"];\n if (\n typeof configFile !== \"string\" ||\n path.dirname(realpathSync(configFile)) !== canonicalDirectory\n )\n throw new Error(\n \"Declaration helper requires a package-local Vite config file\",\n );\n const options = reviewedDtsConfiguration({\n source: readFileSync(configFile, \"utf8\"),\n directory: canonicalDirectory,\n loader: /\\.[cm]?ts$/.test(configFile) ? \"ts\" : \"js\",\n });\n canonicalVuePlugins.push(\n declarationOnlyDts({ directory: canonicalDirectory, ...options }),\n );\n }\n const canonicalBuild = reviewedViteBuild(config[\"build\"]);\n const canonical: unknown = await tool[\"resolveConfig\"](\n {\n root: canonicalDirectory,\n configFile: false,\n plugins: canonicalVuePlugins,\n build: canonicalBuild,\n },\n \"build\",\n \"production\",\n \"production\",\n false,\n patchConfig,\n );\n if (\n !record(canonical) ||\n !record(canonical[\"build\"]) ||\n hookSource(config[\"build\"][\"createEnvironment\"]) !==\n hookSource(canonical[\"build\"][\"createEnvironment\"])\n )\n throw new Error(\n \"Custom Vite createEnvironment requires a supported target resolver\",\n );\n const reviewedPlugins = plugins(canonical);\n assertReviewedVitePlugins({\n resolved: resolvedPlugins,\n reviewed: reviewedPlugins,\n });\n return resolvedViteTarget(config);\n};\n","import { spawnSync } from \"node:child_process\";\nimport { existsSync, mkdtempSync, readFileSync, rmSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { resolveNuxtPublishTarget } from \"./publish-build-target-nuxt\";\nimport { resolveVitePublishTarget } from \"./publish-build-target-vite\";\nimport {\n type PublishPacker,\n type PublishTarget,\n resolveManifestContract,\n} from \"./publish-contract\";\n\nconst supportedTsdownVersion = \"0.22.9\";\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst targets = (value: unknown): string[] => {\n if (value === undefined) return [\"esnext\"];\n if (typeof value === \"string\") {\n const identifier = value.trim();\n if (identifier === \"\" || identifier.includes(\",\"))\n throw new Error(\n \"Resolved JavaScript target identifiers must be nonempty and contain no commas\",\n );\n return [identifier];\n }\n if (\n Array.isArray(value) &&\n value.length > 0 &&\n Array.from(value).every((item: unknown) => typeof item === \"string\")\n )\n return value.flatMap((item: string) => targets(item));\n throw new Error(\n \"Build tool returned an unsupported resolved JavaScript target\",\n );\n};\n\n/** Only hooks completed by configuration resolution may run before target capture. */\nexport const assertTsdownBuildExtensions = (options: unknown) => {\n const isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n const entries = (value: object): [string, unknown][] => {\n const prototype: unknown = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null)\n throw new Error(\n \"Unreviewed build option prototype requires a supported target resolver\",\n );\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 \"Unreviewed build option property requires a supported target resolver\",\n );\n return [key, descriptor.value];\n });\n };\n const plugins = (value: unknown, phase: \"configuration\" | \"output\") => {\n if (value === undefined || value === null || value === false) return;\n if (Array.isArray(value)) {\n for (const plugin of value) plugins(plugin, phase);\n return;\n }\n if (!isRecord(value))\n throw new Error(\"Dynamic plugins require a supported target resolver\");\n for (const [key, item] of entries(value)) {\n if (item === undefined) continue;\n if (key === \"name\" && typeof item === \"string\") continue;\n if (\n phase === \"configuration\" &&\n [\"tsdownConfig\", \"tsdownConfigResolved\"].includes(key) &&\n typeof item === \"function\"\n )\n continue;\n throw new Error(\n \"Unreviewed plugin hooks require a supported target resolver\",\n );\n }\n };\n const output = (value: unknown) => {\n if (value === undefined) return;\n if (!isRecord(value))\n throw new Error(\n \"Dynamic output options require a supported target resolver\",\n );\n for (const [key, item] of entries(value)) {\n if (key === \"plugins\") plugins(item, \"output\");\n if (\n [\"banner\", \"footer\", \"intro\", \"outro\"].includes(key) &&\n item !== undefined &&\n item !== \"\"\n )\n throw new Error(\"Output addons require a supported target resolver\");\n }\n };\n if (!isRecord(options)) throw new Error(\"Invalid build configuration\");\n const properties = new Map(entries(options));\n if (properties.get(\"hooks\") !== undefined)\n throw new Error(\"Build hooks require a supported target resolver\");\n plugins(properties.get(\"plugins\"), \"configuration\");\n output(properties.get(\"outputOptions\"));\n for (const key of [\"banner\", \"footer\"]) {\n const addon = properties.get(key);\n if (addon !== undefined && addon !== \"\")\n throw new Error(\"Output addons require a supported target resolver\");\n }\n const input = properties.get(\"inputOptions\");\n if (input !== undefined) {\n if (!isRecord(input))\n throw new Error(\n \"Dynamic tsdown inputOptions require a supported target resolver\",\n );\n plugins(new Map(entries(input)).get(\"plugins\"), \"output\");\n }\n};\n\n/** Extract the final target after supported format and low-level overrides. */\nexport const resolvedTsdownTarget = (configs: unknown): PublishTarget => {\n if (!Array.isArray(configs) || configs.length === 0)\n throw new Error(\"tsdown must resolve at least one build configuration\");\n const emitted = new Set<string>();\n let javascript = false;\n for (const config of configs) {\n if (!record(config))\n throw new Error(\"Invalid resolved tsdown configuration\");\n assertTsdownBuildExtensions(config);\n if (record(config[\"dts\"]) && config[\"dts\"][\"emitDtsOnly\"] === true)\n continue;\n javascript = true;\n const input = config[\"inputOptions\"];\n if (input !== undefined && !record(input))\n throw new Error(\n \"Dynamic tsdown inputOptions require a supported target resolver\",\n );\n const transform = record(input) ? input[\"transform\"] : undefined;\n if (transform !== undefined && !record(transform))\n throw new Error(\"tsdown transform overrides must be an object\");\n const target =\n record(transform) && transform[\"target\"] != null\n ? transform[\"target\"]\n : config[\"target\"];\n for (const item of targets(target)) emitted.add(item);\n }\n return javascript\n ? { type: \"javascript\", targets: [...emitted].sort() }\n : { type: \"types-only\" };\n};\n\nconst exportPaths = (value: unknown): string[] => {\n if (typeof value === \"string\") return [value];\n if (value === null || value === undefined) return [];\n if (Array.isArray(value))\n return value.flatMap((item: unknown) => exportPaths(item));\n if (record(value)) return Object.values(value).flatMap(exportPaths);\n throw new Error(\"Invalid package export declaration\");\n};\n\nconst publishBuildScript = \"build\";\nexport const publishBuildLifecycleScripts = [\n `pre${publishBuildScript}`,\n `post${publishBuildScript}`,\n] as const;\nconst assertPublishBuildLifecycle = (manifest: Record<string, unknown>) => {\n const scripts = manifest[\"scripts\"];\n if (!record(scripts)) return;\n for (const script of publishBuildLifecycleScripts) {\n if (Object.hasOwn(scripts, script))\n throw new Error(\n `Publish target resolver does not support lifecycle script ${script}`,\n );\n }\n};\n\n/** JSON and declaration-only packages have no emitted JavaScript target. */\nexport const assetOnlyTarget = (\n manifest: unknown,\n packer: PublishPacker,\n): PublishTarget | undefined => {\n if (!record(manifest)) throw new Error(\"Package manifest must be an object\");\n assertPublishBuildLifecycle(manifest);\n if (record(manifest[\"scripts\"]) && manifest[\"scripts\"][\"build\"] !== undefined)\n return undefined;\n const published = resolveManifestContract({\n manifest,\n packer,\n target: { type: \"types-only\" },\n });\n const paths = (\n [\"exports\", \"main\", \"module\", \"types\", \"typings\", \"bin\"] as const\n ).flatMap((key) => exportPaths(published.entryPoints[key]));\n if (\n paths.length === 0 ||\n paths.some((item) => !/(?:\\.json|\\.d\\.(?:ts|mts|cts))$/.test(item))\n )\n return undefined;\n return { type: \"types-only\" };\n};\n\n/** Supported build commands have no shell composition or runtime relocation. */\nexport const supportedPublishBuildCommand = (build: string) => {\n const command = build.replace(/[ \\t]+/g, \" \").replace(/^ | $/g, \"\");\n switch (command) {\n case \"tsdown\":\n return \"tsdown\";\n case \"vite build\":\n return \"vite\";\n case \"nuxt-module-build build\":\n return \"nuxt-module-build\";\n }\n throw new Error(\n \"Publish target resolver requires an exact single invocation: tsdown, vite build, or nuxt-module-build build; shell composition, launchers, filters and CLI overrides are unsupported\",\n );\n};\n\nexport const resolvePublishBuildTarget = async (\n directory: string,\n packer: PublishPacker,\n): Promise<PublishTarget> => {\n const manifest: unknown = JSON.parse(\n readFileSync(path.join(directory, \"package.json\"), \"utf8\"),\n );\n const assets = assetOnlyTarget(manifest, packer);\n if (assets !== undefined) return assets;\n if (\n !record(manifest) ||\n !record(manifest[\"scripts\"]) ||\n typeof manifest[\"scripts\"][\"build\"] !== \"string\"\n )\n throw new Error(\n \"A JavaScript package needs an explicitly supported build command\",\n );\n const compiler = supportedPublishBuildCommand(manifest[\"scripts\"][\"build\"]);\n switch (compiler) {\n case \"vite\":\n return await resolveVitePublishTarget(directory);\n case \"nuxt-module-build\":\n return resolveNuxtPublishTarget(directory);\n case \"tsdown\":\n break;\n }\n const configFiles = [\"ts\", \"mts\", \"cts\", \"js\", \"mjs\", \"cjs\", \"json\"]\n .map((extension) => path.join(directory, `tsdown.config.${extension}`))\n .filter(existsSync);\n if (configFiles.length !== 1)\n throw new Error(\n \"Publish target resolver requires exactly one tsdown configuration\",\n );\n const configFile = configFiles.at(0);\n if (configFile === undefined) throw new Error(\"Missing tsdown configuration\");\n const require = createRequire(path.join(directory, \"package.json\"));\n const metadata: unknown = JSON.parse(\n readFileSync(require.resolve(\"tsdown/package.json\"), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== supportedTsdownVersion)\n throw new Error(\n `Publish target resolver supports tsdown ${supportedTsdownVersion}; review the adapter before changing build tools`,\n );\n const loaderRequire = createRequire(import.meta.url);\n // Register tsx in the isolated Node process before any config imports. The\n // global registration avoids namespaced CJS imports rewriting builtin URLs.\n // The caller's Node executable owns config parsing and resolution, even when\n // the guard itself runs under Bun. Only final target data crosses the boundary.\n const scratch = mkdtempSync(path.join(tmpdir(), \"stll-publish-target-\"));\n try {\n const resultFile = path.join(scratch, \"targets.json\");\n const result = spawnSync(\n process.versions.bun ? \"node\" : process.execPath,\n [\n \"--import\",\n pathToFileURL(loaderRequire.resolve(\"tsx\")).href,\n \"--input-type=module\",\n \"--eval\",\n tsdownConfigProcess,\n JSON.stringify({\n directory,\n configFile,\n toolUrl: pathToFileURL(require.resolve(\"tsdown\")).href,\n resultFile,\n }),\n ],\n {\n cwd: directory,\n encoding: \"utf8\",\n timeout: 30_000,\n maxBuffer: 1024 * 1024,\n },\n );\n if (result.error) throw result.error;\n if (result.status !== 0)\n throw new Error(\n `Node tsdown configuration resolver failed: ${result.stderr.trim()}`,\n );\n const resolved: unknown = JSON.parse(readFileSync(resultFile, \"utf8\"));\n return resolvedTsdownTarget(resolved);\n } finally {\n rmSync(scratch, { recursive: true, force: true });\n }\n};\n\n// This is JavaScript executed by Node at the published engine floor. Keep config\n// functions inside the child so JSON cannot silently discard target overrides.\nconst tsdownConfigProcess = `\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { pathToFileURL } from 'node:url';\nconst { directory, configFile, toolUrl, resultFile } = JSON.parse(process.argv[1]);\nconst record = value => typeof value === 'object' && value !== null && !Array.isArray(value);\nconst tool = await import(toolUrl);\nif (typeof tool.resolveUserConfig !== 'function')\n throw new Error('Installed tsdown does not expose its configuration resolver');\nif (tool.globalLogger) tool.globalLogger.level = 'silent';\nconst loaded = configFile.endsWith('.json')\n ? { default: JSON.parse(readFileSync(configFile, 'utf8')) }\n : await import(pathToFileURL(configFile).href);\nif (!record(loaded)) throw new Error('Invalid tsdown module');\nconst exported = loaded.default;\nif (typeof exported === 'function')\n throw new Error('Dynamic root tsdown configurations require a supported target resolver');\nconst configs = Array.isArray(exported) ? exported : [exported];\nconst resolved = [];\nconst assertTsdownBuildExtensions = ${assertTsdownBuildExtensions.toString()};\nfor (const config of configs) {\n if (!record(config)) throw new Error('tsdown configurations must be objects');\n assertTsdownBuildExtensions(config);\n if (config.cwd !== undefined || config.workspace !== undefined || config.fromVite !== undefined)\n throw new Error('Relocated or inherited build configurations require a supported target resolver');\n const output = await tool.resolveUserConfig(\n { ...config, cwd: directory, logLevel: 'silent' }, { cwd: directory }, new Set(),\n );\n if (!Array.isArray(output)) throw new Error('Invalid tsdown resolved configuration');\n for (const entry of output) {\n if (!record(entry)) throw new Error('Invalid resolved tsdown configuration');\n assertTsdownBuildExtensions(entry);\n const input = entry.inputOptions;\n if (input !== undefined && !record(input))\n throw new Error('Dynamic tsdown inputOptions require a supported target resolver');\n const transform = record(input) ? input.transform : undefined;\n if (transform !== undefined && !record(transform))\n throw new Error('tsdown transform overrides must be an object');\n const target = record(transform) && transform.target != null ? transform.target : entry.target;\n const nonemptyIdentifiers = value => typeof value === 'string' && value.trim() !== '' && !value.includes(',');\n if (target !== undefined && !nonemptyIdentifiers(target) &&\n !(Array.isArray(target) && target.length > 0 && Array.from(target).every(nonemptyIdentifiers)))\n throw new Error('Build tool returned an unsupported resolved JavaScript target');\n resolved.push({ target, dts: { emitDtsOnly: record(entry.dts) && entry.dts.emitDtsOnly === true } });\n }\n}\nwriteFileSync(resultFile, JSON.stringify(resolved));\n`;\n","#!/usr/bin/env node\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport {\n assertConsumerPublishableManifest,\n consumerRecord,\n discoverConsumerManifests,\n} from \"./consumer-compat-config\";\nimport { resolveConsumerReleasePack } from \"./consumer-release-pack\";\nimport { readGitTrackedOutput } from \"./git-tracked-output\";\nimport { readPackedSyntaxFiles } from \"./publish-artifact-syntax\";\nimport { resolvePublishBuildTarget } from \"./publish-build-target\";\nimport {\n checkPublishContract,\n type PublishPacker,\n type PublishTarget,\n resolveManifestContract,\n} from \"./publish-contract\";\nimport { githubAutomationFileKind } from \"./toolchain-inputs\";\nimport { parseToolchainPolicy } from \"./toolchain-schema\";\n\ntype Mode =\n | { type: \"help\" }\n | { type: \"check\" }\n | { type: \"write\" }\n | { type: \"artifact\"; archive: string };\n\nconst parseMode = (args: string[]): Mode => {\n if (args.length === 0) return { type: \"check\" };\n if (args.length === 1 && args.at(0) === \"--help\") return { type: \"help\" };\n if (args.length === 1 && args.at(0) === \"--write\") return { type: \"write\" };\n const archive = args.at(1);\n if (\n args.length === 2 &&\n args.at(0) === \"--artifact\" &&\n archive !== undefined &&\n archive !== \"\" &&\n !archive.startsWith(\"--\")\n )\n return { type: \"artifact\", archive };\n throw new Error(\n \"Expected no arguments, --write, or --artifact <archive.tgz>; artifact checking cannot be combined with --write\",\n );\n};\n\ntype PublicContext = {\n file: string;\n target: PublishTarget;\n packer: PublishPacker;\n contract: unknown;\n};\n\nconst root = process.cwd();\nconst main = async () => {\n const mode = parseMode(process.argv.slice(2));\n if (mode.type === \"help\") {\n process.stdout.write(\n \"Usage: stll-publish-contract [--write | --artifact <archive.tgz>]\\n\",\n );\n } else {\n const write = mode.type === \"write\";\n const contexts = new Map<string, PublicContext>();\n const policy = parseToolchainPolicy(\n JSON.parse(\n readFileSync(new URL(\"../toolchain.json\", import.meta.url), \"utf8\"),\n ),\n );\n const consumer = {\n node: policy.consumerNode,\n typescript: policy.consumerTypescript,\n };\n const tracked = readGitTrackedOutput(root, \"paths\").split(\"\\0\");\n const files: Record<string, string> = {};\n for (const file of tracked) {\n if (\n file\n .split(\"/\")\n .some((part) => part === \"node_modules\" || part === \".git\") ||\n (![\"package.json\", \"pnpm-workspace.yaml\"].includes(\n path.posix.basename(file),\n ) &&\n githubAutomationFileKind(file) !== \"workflow\")\n )\n continue;\n files[file] = readFileSync(path.join(root, file), \"utf8\");\n }\n const manifests = discoverConsumerManifests(files);\n const names = new Set<string>();\n for (const manifest of manifests.values()) {\n const name = manifest[\"name\"];\n if (typeof name !== \"string\" || name === \"\") continue;\n if (names.has(name))\n throw new Error(`duplicate workspace package: ${name}`);\n names.add(name);\n }\n let checked = 0;\n for (const [relative, manifest] of [...manifests].sort(([left], [right]) =>\n left.localeCompare(right),\n )) {\n const file = path.posix.join(relative, \"package.json\");\n if (manifest[\"private\"] === true) continue;\n if (relative.split(\"/\").includes(\"vendor\"))\n throw new Error(\n `Published workspace packages under vendor directories are not supported by publish-contract: ${file}; move the package to a supported workspace directory`,\n );\n assertConsumerPublishableManifest({ manifest, directory: relative });\n checked++;\n const directory = path.dirname(path.join(root, file));\n const contractFile = path.join(directory, \"publish-contract.json\");\n const packer = resolveConsumerReleasePack(files).manager;\n const target = await resolvePublishBuildTarget(directory, packer);\n const current = resolveManifestContract({ manifest, target, packer });\n const committed: unknown = write\n ? current\n : JSON.parse(readFileSync(contractFile, \"utf8\"));\n const diagnostics = checkPublishContract({\n packer,\n manifest,\n target,\n contract: committed,\n policy: consumer,\n });\n for (const diagnostic of diagnostics)\n process.stderr.write(\n `${file}:1: [publish-contract] ${diagnostic.message}\\n`,\n );\n if (diagnostics.length > 0) {\n process.exitCode = 1;\n continue;\n }\n const name = manifest[\"name\"];\n if (typeof name !== \"string\")\n throw new Error(`Missing public package name: ${file}`);\n contexts.set(name, { file, target, packer, contract: committed });\n if (write)\n writeFileSync(contractFile, `${JSON.stringify(current, null, 2)}\\n`);\n }\n if (checked === 0) throw new Error(\"No published workspace packages found\");\n if (mode.type !== \"artifact\" || process.exitCode === 1) return;\n const packed = await readPackedSyntaxFiles(\n path.resolve(root, mode.archive),\n );\n const packedText = packed.get(\"package/package.json\");\n if (packedText === undefined)\n throw new Error(\"Artifact has no package/package.json\");\n const packedManifest: unknown = JSON.parse(packedText);\n if (\n !consumerRecord(packedManifest) ||\n typeof packedManifest[\"name\"] !== \"string\" ||\n packedManifest[\"private\"] === true\n )\n throw new Error(\n \"Artifact must identify a declared public workspace package\",\n );\n const name = packedManifest[\"name\"];\n const context = contexts.get(name);\n if (context === undefined)\n throw new Error(\n `Artifact package is not a declared public workspace package: ${name}`,\n );\n assertConsumerPublishableManifest({\n manifest: packedManifest,\n directory: mode.archive,\n });\n const diagnostics = checkPublishContract({\n manifest: packedManifest,\n target: context.target,\n packer: context.packer,\n contract: context.contract,\n policy: consumer,\n });\n for (const diagnostic of diagnostics)\n process.stderr.write(\n `${mode.archive}:1: [publish-contract] ${diagnostic.message} (${context.file})\\n`,\n );\n if (diagnostics.length > 0) process.exitCode = 1;\n }\n};\n\nmain().catch((error: unknown) => {\n process.stderr.write(\n `publish-contract:1: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA,MAAM,oBAAoB;CACxB,wBAAwB;CACxB,SAAS;CACT,QAAQ;AACV;AACA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;AAGrE,MAAa,2BAA2B,YAAqB;CAC3D,MAAM,SAAS,UAAmB;EAChC,IAAI,OAAO,UAAU,YACnB,MAAM,IAAI,MACR,uEACF;EACF,IAAI,MAAM,QAAQ,KAAK,GAAG;GACxB,KAAK,MAAM,QAAQ,OAAO,MAAM,IAAI;GACpC;EACF;EACA,IAAI,OAAO,UAAU,YAAY,UAAU,M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