@stll/oxlint-config 1.6.2 → 1.8.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.
- package/README.md +4 -4
- package/dist/cloud-setup-cli.mjs +1 -1
- package/dist/consumer-compat-cli.cjs.map +1 -1
- package/dist/consumer-compat-cli.mjs.map +1 -1
- package/dist/consumer-node-support.mjs +1 -1
- package/dist/dependabot.d.cts +23 -7
- package/dist/dependabot.d.mts +23 -7
- package/dist/engine-support-cli.cjs.map +1 -1
- package/dist/engine-support-cli.mjs.map +1 -1
- package/dist/engine-support.d.cts +4 -5
- package/dist/engine-support.d.mts +4 -5
- package/dist/git-tracked-output.cjs.map +1 -1
- package/dist/git-tracked-output.mjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.mts +11 -11
- package/dist/publish-artifact-syntax.cjs.map +1 -1
- package/dist/publish-artifact-syntax.mjs.map +1 -1
- package/dist/publish-build-target-nuxt-helper.d.cts +3 -4
- package/dist/publish-build-target-nuxt-helper.d.mts +3 -4
- package/dist/publish-build-target-vite-dts-helper.d.cts +2 -2
- package/dist/publish-build-target-vite-dts-helper.d.mts +2 -2
- package/dist/publish-build-target-vite-dts-helper2.cjs +47 -4
- package/dist/publish-build-target-vite-dts-helper2.cjs.map +1 -1
- package/dist/publish-build-target-vite-dts-helper2.mjs +47 -4
- package/dist/publish-build-target-vite-dts-helper2.mjs.map +1 -1
- package/dist/publish-contract-cli.cjs +2 -2
- package/dist/publish-contract-cli.cjs.map +1 -1
- package/dist/publish-contract-cli.mjs +2 -2
- package/dist/publish-contract-cli.mjs.map +1 -1
- package/dist/quarantine-policy.d.cts +9 -9
- package/dist/quarantine-policy.d.mts +9 -9
- package/dist/quarantine-policy2.cjs.map +1 -1
- package/dist/quarantine-policy2.mjs.map +1 -1
- package/dist/toolchain-changed.cjs +1 -3
- package/dist/toolchain-changed.cjs.map +1 -1
- package/dist/toolchain-changed.mjs +2 -4
- package/dist/toolchain-changed.mjs.map +1 -1
- package/dist/toolchain-dependabot.cjs +6 -3
- package/dist/toolchain-dependabot.cjs.map +1 -1
- package/dist/toolchain-dependabot.mjs +7 -4
- package/dist/toolchain-dependabot.mjs.map +1 -1
- package/dist/toolchain-guard.cjs +11 -4
- package/dist/toolchain-guard.cjs.map +1 -1
- package/dist/toolchain-guard.mjs +12 -5
- package/dist/toolchain-guard.mjs.map +1 -1
- package/dist/toolchain-inputs.cjs +159 -17
- package/dist/toolchain-inputs.cjs.map +1 -1
- package/dist/toolchain-inputs.mjs +148 -18
- package/dist/toolchain-inputs.mjs.map +1 -1
- package/dist/toolchain-schema.cjs +189 -1
- package/dist/toolchain-schema.cjs.map +1 -1
- package/dist/toolchain-schema.mjs +177 -3
- package/dist/toolchain-schema.mjs.map +1 -1
- package/dist/typecheck-parity.cjs.map +1 -1
- package/dist/typecheck-parity.mjs.map +1 -1
- package/dist/wasi-loader-normalizer-cli.cjs.map +1 -1
- package/dist/wasi-loader-normalizer-cli.mjs.map +1 -1
- package/package.json +6 -8
- package/toolchain.json +66 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-artifact-syntax.cjs","names":["record","githubAutomationFileKind","parseDocument","record","path","parse","Module","record","isDeepStrictEqual","parse","lte","satisfies","consumerNodeSupportMatches","spawn","createInterface","once","record","javascript","path","realpath","mkdtemp","tmpdir","mkdir","writeFile","fileURLToPath","rm","promisify","execFile","path","mkdtemp","tmpdir","mkdir","writeFile","rm"],"sources":["../src/consumer-release-pack.ts","../src/publish-artifact-parser.ts","../src/publish-contract.ts","../src/publish-node-resolver.ts","../src/publish-runtime-imports.ts","../src/publish-artifact-syntax.ts"],"sourcesContent":["import { parseDocument } from \"yaml\";\n\nimport { githubAutomationFileKind } from \"./toolchain-inputs\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst exactVersion = /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/;\nconst outputDirectory = \"<consumer-release-pack-output>\";\nconst packerSetupExpression =\n /^npm\\s+install\\s+((?:(?:--global|-g|--ignore-scripts)\\s+)+)(npm|pnpm)@([^\\s]+)$/;\nconst defaultRunShell = (defaults: unknown) => {\n if (!record(defaults) || !record(defaults[\"run\"])) return undefined;\n return defaults[\"run\"][\"shell\"];\n};\n\nexport type ConsumerReleasePack = {\n manager: \"npm\" | \"pnpm\";\n version: string;\n arguments: string[];\n};\n\nconst packArguments = (line: string) => {\n const command = /^(npm|pnpm)\\s+pack(?:\\s+(.*))?$/.exec(line);\n const manager = command?.[1];\n if (manager !== \"npm\" && manager !== \"pnpm\")\n throw new Error(\"Unsupported release pack command\");\n const raw = command?.[2] ?? \"\";\n const tokens = raw.match(/\"[^\"\\n]*\"|'[^'\\n]*'|[^\\s]+/g) ?? [];\n const args: string[] = [];\n let destination = false;\n for (let index = 0; index < tokens.length; index++) {\n const token = tokens.at(index);\n if (token === \"--pack-destination\") {\n if (destination) throw new Error(\"Repeated release pack destination\");\n const value = tokens.at(++index);\n if (\n value === undefined ||\n !/^(?:\"\\$GITHUB_WORKSPACE\\/[A-Za-z0-9_/-]+\"|[A-Za-z0-9_/-]+)$/.test(\n value,\n ) ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Unsupported release pack destination\");\n destination = true;\n args.push(token, outputDirectory);\n continue;\n }\n if (\n token !== \"--ignore-scripts\" &&\n !(manager === \"pnpm\" && token === \"--config.ignore-scripts=true\") &&\n token !== \"--json\" &&\n token !== \"--silent\"\n )\n throw new Error(\"Unsupported release pack arguments\");\n if (args.includes(token)) throw new Error(\"Repeated release pack flag\");\n args.push(token);\n }\n if (\n !destination ||\n (!args.includes(\"--ignore-scripts\") &&\n !args.includes(\"--config.ignore-scripts=true\"))\n )\n throw new Error(\n \"Release pack requires scripts disabled and --pack-destination\",\n );\n return { manager, arguments: args } satisfies Pick<\n ConsumerReleasePack,\n \"manager\" | \"arguments\"\n >;\n};\n\ntype ReleaseShellContextOptions = {\n step: Record<string, unknown>;\n kind: \"setup\" | \"pack\";\n location: string;\n inheritedShell: unknown;\n};\n\n/** Both setup provenance and packing require unconditional shell commands. */\nconst assertReleaseShellContext = ({\n step,\n kind,\n location,\n inheritedShell,\n}: ReleaseShellContextOptions) => {\n const run = step[\"run\"];\n if (typeof run !== \"string\")\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n const shell = step[\"shell\"] === undefined ? inheritedShell : step[\"shell\"];\n if (shell !== undefined && shell !== \"bash\" && shell !== \"sh\")\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n let quote: \"single\" | \"double\" | undefined;\n let code = \"\";\n for (let index = 0; index < run.length; index += 1) {\n const char = run[index];\n if (char === \"\\n\") {\n if (quote !== undefined)\n throw new Error(\n `Unsupported release ${kind} shell context: ${location}`,\n );\n code += \"\\n\";\n continue;\n }\n if (quote !== \"single\" && char === \"\\\\\") {\n if (\n run[index + 1] === \"\\n\" ||\n (run[index + 1] === \"\\r\" && run[index + 2] === \"\\n\")\n )\n throw new Error(\n `Unsupported release ${kind} shell context: ${location}`,\n );\n index += 1;\n code += \" \";\n continue;\n }\n if (\n quote !== \"single\" &&\n (char === \"`\" || (char === \"$\" && run[index + 1] === \"(\"))\n )\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n if (quote === \"single\") {\n if (char === \"'\") quote = undefined;\n code += \" \";\n continue;\n }\n if (quote === \"double\") {\n if (char === '\"') quote = undefined;\n code += \" \";\n continue;\n }\n if (char === \"'\") {\n quote = \"single\";\n code += \" \";\n continue;\n }\n if (char === '\"') {\n quote = \"double\";\n code += \" \";\n continue;\n }\n if (char === \"#\" && (index === 0 || /\\s/.test(run[index - 1] ?? \"\"))) {\n while (index + 1 < run.length && run[index + 1] !== \"\\n\") index += 1;\n continue;\n }\n code += char;\n }\n if (\n quote !== undefined ||\n /[;&|<>]/.test(code) ||\n code\n .split(\"\\n\")\n .some((line) =>\n /^\\s*(?:if|then|elif|else|fi|for|do|done|while|until|case|esac|function|select|exit|return|exec|break|continue|trap|eval|source|hash|alias|unalias)\\b/.test(\n line,\n ),\n ) ||\n /(?:^|\\n)\\s*\\.(?:\\s|$)/.test(code) ||\n /(?:^|\\n)\\s*[A-Za-z_]\\w*\\s*\\(\\s*\\)\\s*[{(]/.test(code) ||\n (kind === \"setup\" && /[(){}]/.test(code))\n )\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n if (kind !== \"setup\") return;\n for (const line of run.split(\"\\n\")) {\n const command = line.trim();\n if (command === \"\" || command.startsWith(\"#\")) continue;\n if (\n packerSetupExpression.test(command) ||\n /^(?:npm|pnpm)\\s+pack(?:\\s|$)/.test(command) ||\n [\"set -e\", \"set -eu\", \"set -euo pipefail\"].includes(command)\n )\n continue;\n throw new Error(`Unsupported release setup command context: ${location}`);\n }\n};\n\n/** Resolve the repository's release packer without substituting another manager. */\nexport const resolveConsumerReleasePack = (\n files: Record<string, string>,\n): ConsumerReleasePack => {\n const candidates: ConsumerReleasePack[] = [];\n for (const [file, text] of Object.entries(files)) {\n if (githubAutomationFileKind(file) !== \"workflow\") continue;\n const document = parseDocument(text, { uniqueKeys: true, merge: true });\n if (document.errors.length > 0)\n throw new Error(`Invalid release workflow YAML: ${file}`);\n const source: unknown = document.toJS({ maxAliasCount: 100 });\n if (!record(source) || !record(source[\"jobs\"])) continue;\n for (const [jobName, job] of Object.entries(source[\"jobs\"])) {\n if (!record(job) || !Array.isArray(job[\"steps\"])) continue;\n const packsRelease = job[\"steps\"].some(\n (step: unknown) =>\n record(step) &&\n typeof step[\"run\"] === \"string\" &&\n step[\"run\"]\n .split(\"\\n\")\n .some(\n (line) =>\n !line.trimStart().startsWith(\"#\") &&\n /\\b(?:npm|pnpm)\\s+pack\\b/.test(line),\n ),\n );\n if (!packsRelease) continue;\n const jobShell = defaultRunShell(job[\"defaults\"]);\n const inheritedShell =\n jobShell === undefined ? defaultRunShell(source[\"defaults\"]) : jobShell;\n const versions = new Map<string, string[]>();\n let packed: ConsumerReleasePack | undefined;\n for (const step of job[\"steps\"]) {\n if (!record(step)) continue;\n if (\n typeof step[\"uses\"] === \"string\" &&\n step[\"uses\"].startsWith(\"pnpm/action-setup@\")\n ) {\n if (\n step[\"if\"] !== undefined ||\n step[\"continue-on-error\"] !== undefined\n )\n throw new Error(\n `Conditional release packer setup: ${file}:${jobName}`,\n );\n const inputs = step[\"with\"];\n const version = record(inputs) ? inputs[\"version\"] : undefined;\n if (typeof version !== \"string\" || !exactVersion.test(version))\n throw new Error(\n `Release pnpm setup requires an exact version: ${file}:${jobName}`,\n );\n const values = versions.get(\"pnpm\") ?? [];\n values.push(version);\n versions.set(\"pnpm\", values);\n }\n if (typeof step[\"run\"] !== \"string\") continue;\n for (const rawLine of step[\"run\"].split(\"\\n\")) {\n const line = rawLine.trim();\n if (line.startsWith(\"#\")) continue;\n const setupCommand =\n /\\bnpm\\s+(?:install|i)\\b[^\\n]*\\b(?:npm|pnpm)@/.test(line);\n if (setupCommand)\n assertReleaseShellContext({\n step,\n kind: \"setup\",\n location: `${file}:${jobName}`,\n inheritedShell,\n });\n const setup = packerSetupExpression.exec(line);\n if (setupCommand && setup === null)\n throw new Error(\n `Unsupported release packer setup command: ${file}:${jobName}`,\n );\n if (\n setup !== null &&\n /(?:^|\\s)(?:--global|-g)(?:\\s|$)/.test(setup[1] ?? \"\")\n ) {\n if (\n step[\"if\"] !== undefined ||\n step[\"continue-on-error\"] !== undefined\n )\n throw new Error(\n `Conditional release packer setup: ${file}:${jobName}`,\n );\n const manager = setup[2];\n const version = setup[3];\n if (\n manager === undefined ||\n version === undefined ||\n !exactVersion.test(version)\n )\n throw new Error(\n `Release packer setup requires an exact version: ${file}:${jobName}`,\n );\n const values = versions.get(manager) ?? [];\n values.push(version);\n versions.set(manager, values);\n }\n if (!/\\b(?:npm|pnpm)\\s+pack\\b/.test(line)) continue;\n if (\n job[\"if\"] !== undefined ||\n step[\"if\"] !== undefined ||\n step[\"continue-on-error\"] !== undefined ||\n packed !== undefined\n )\n throw new Error(\n `Ambiguous release pack command: ${file}:${jobName}`,\n );\n assertReleaseShellContext({\n step,\n kind: \"pack\",\n location: `${file}:${jobName}`,\n inheritedShell,\n });\n const command = packArguments(line);\n const selected = versions.get(command.manager);\n const version = selected?.at(0);\n if (selected?.length !== 1 || version === undefined)\n throw new Error(\n `Missing or ambiguous exact release packer version: ${file}:${jobName}`,\n );\n packed = {\n manager: command.manager,\n version,\n arguments: command.arguments,\n };\n }\n }\n if (packed !== undefined) candidates.push(packed);\n }\n }\n const selected = candidates.at(0);\n if (candidates.length !== 1 || selected === undefined)\n throw new Error(\"Require exactly one identifiable release pack job\");\n return selected;\n};\n\ntype ConsumerReleasePackArgumentsOptions = {\n packer: ConsumerReleasePack;\n directory: string;\n};\nexport const consumerReleasePackArguments = ({\n packer,\n directory,\n}: ConsumerReleasePackArgumentsOptions) => {\n if (directory.length === 0)\n throw new Error(\"Release pack output directory is required\");\n return [\n \"pack\",\n ...packer.arguments.map((argument) =>\n argument === outputDirectory ? directory : argument,\n ),\n ];\n};\n","import { parse, type Options } from \"acorn\";\nimport Module from \"node:module\";\nimport path from \"node:path\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nexport const packageMode = (\n files: Map<string, string>,\n file: string,\n): \"module\" | \"script\" | \"detect\" => {\n let directory = path.posix.dirname(file);\n while (directory !== \".\") {\n const source = files.get(`${directory}/package.json`);\n if (source !== undefined) {\n const manifest: unknown = JSON.parse(source);\n if (!record(manifest))\n throw new Error(`Invalid packed manifest: ${directory}`);\n if (manifest[\"type\"] === \"module\") return \"module\";\n if (manifest[\"type\"] === \"commonjs\") return \"script\";\n if (manifest[\"type\"] !== undefined)\n throw new Error(`Invalid packed package type: ${directory}`);\n return \"detect\";\n }\n directory = path.posix.dirname(directory);\n }\n return \"detect\";\n};\n\nexport const parseArtifactSource = (source: string, options: Options) => {\n const script = options.sourceType === \"script\";\n const content = script\n ? source.replace(/^\\uFEFF/, \"\").replace(/^#![^\\r\\n]*/, \"\")\n : source;\n try {\n return parse(script ? Module.wrap(content) : content, options);\n } catch (error) {\n if (\n !script ||\n !(error instanceof SyntaxError) ||\n !record(error) ||\n typeof error[\"pos\"] !== \"number\"\n )\n throw error;\n const prefixLength = Module.wrap(\"\\u0000\").indexOf(\"\\u0000\");\n const position = Math.max(\n 0,\n Math.min(\n source.length,\n error[\"pos\"] - prefixLength + source.length - content.length,\n ),\n );\n const lines = source.slice(0, position).split(/\\r\\n|[\\n\\r\\u2028\\u2029]/);\n const location = `(${lines.length}:${lines.at(-1)?.length ?? 0})`;\n throw new SyntaxError(error.message.replace(/\\(\\d+:\\d+\\)$/, location));\n }\n};\n","import { isDeepStrictEqual } from \"node:util\";\nimport { lte, parse, satisfies } from \"semver\";\n\nimport { consumerNodeSupportMatches } from \"./consumer-node-support\";\n\nexport type PublishTarget =\n | { type: \"javascript\"; targets: readonly string[] }\n | { type: \"types-only\" };\n\ntype ExportTarget =\n | string\n | null\n | ExportTarget[]\n | { [condition: string]: ExportTarget };\n\ntype EntryPoints = {\n type?: \"module\" | \"commonjs\";\n exports?: ExportTarget;\n main?: string;\n module?: string;\n types?: string;\n typings?: string;\n bin?: string | Record<string, string>;\n typesVersions?: Record<string, Record<string, string[]>>;\n};\n\nexport type PublishContract = {\n engines: Record<string, string>;\n peerDependencies: Record<string, string>;\n target: PublishTarget;\n entryPoints: EntryPoints;\n};\n\nexport type ConsumerPolicy = { node: string; typescript: string };\nexport type PublishContractDiagnostic = { field: string; message: string };\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst object = (value: unknown, field: string) => {\n if (!record(value)) throw new Error(`${field} must be an object`);\n return value;\n};\n\nconst closedKeys = (\n value: Record<string, unknown>,\n allowed: readonly string[],\n field: string,\n) => {\n for (const key of Object.keys(value))\n if (!allowed.includes(key))\n throw new Error(`${field}.${key} is unsupported`);\n};\n\nconst text = (value: unknown, field: string) => {\n if (typeof value !== \"string\" || value.trim() === \"\")\n throw new Error(`${field} must be a nonempty string`);\n return value;\n};\n\nconst stringMap = (value: unknown, field: string) => {\n const result = new Map<string, string>();\n for (const [key, entry] of Object.entries(object(value, field)))\n result.set(text(key, field), text(entry, `${field}.${key}`));\n return Object.fromEntries(result);\n};\n\nconst exportTarget = (value: unknown, field: string): ExportTarget => {\n if (value === null) return null;\n if (typeof value === \"string\") return text(value, field);\n if (Array.isArray(value))\n return value.map((entry: unknown, index) =>\n exportTarget(entry, `${field}[${index}]`),\n );\n const result = new Map<string, ExportTarget>();\n for (const [key, entry] of Object.entries(object(value, field)))\n result.set(text(key, field), exportTarget(entry, `${field}.${key}`));\n return Object.fromEntries(result);\n};\n\nconst typesVersions = (value: unknown) => {\n const result = new Map<string, Record<string, string[]>>();\n for (const [range, paths] of Object.entries(object(value, \"typesVersions\"))) {\n const mappings = new Map<string, string[]>();\n for (const [pattern, entries] of Object.entries(\n object(paths, `typesVersions.${range}`),\n )) {\n if (!Array.isArray(entries))\n throw new Error(`typesVersions.${range}.${pattern} must be an array`);\n mappings.set(\n text(pattern, \"typesVersions pattern\"),\n entries.map((entry: unknown) => text(entry, \"typesVersions path\")),\n );\n }\n result.set(\n text(range, \"typesVersions range\"),\n Object.fromEntries(mappings),\n );\n }\n return Object.fromEntries(result);\n};\n\nconst entryPointKeys = [\n \"type\",\n \"exports\",\n \"main\",\n \"module\",\n \"types\",\n \"typings\",\n \"bin\",\n \"typesVersions\",\n] as const;\n\nexport const publishConfigOverrideKeys = entryPointKeys.filter(\n (key) => key !== \"type\",\n);\n\nconst entryPoints = (value: unknown): EntryPoints => {\n const source = object(value, \"entryPoints\");\n closedKeys(source, entryPointKeys, \"entryPoints\");\n const result: EntryPoints = {};\n if (\"type\" in source) {\n if (source[\"type\"] !== \"module\" && source[\"type\"] !== \"commonjs\")\n throw new Error(\"entryPoints.type must be module or commonjs\");\n result.type = source[\"type\"];\n }\n if (\"exports\" in source)\n result.exports = exportTarget(source[\"exports\"], \"entryPoints.exports\");\n for (const key of [\"main\", \"module\", \"types\", \"typings\"] as const)\n if (key in source) result[key] = text(source[key], `entryPoints.${key}`);\n if (\"bin\" in source)\n result.bin =\n typeof source[\"bin\"] === \"string\"\n ? text(source[\"bin\"], \"entryPoints.bin\")\n : stringMap(source[\"bin\"], \"entryPoints.bin\");\n if (\"typesVersions\" in source)\n result.typesVersions = typesVersions(source[\"typesVersions\"]);\n return result;\n};\n\nconst publishTarget = (value: unknown): PublishTarget => {\n const source = object(value, \"target\");\n if (source[\"type\"] === \"types-only\") {\n closedKeys(source, [\"type\"], \"target\");\n return { type: \"types-only\" };\n }\n if (source[\"type\"] !== \"javascript\")\n throw new Error(\"target.type must be javascript or types-only\");\n closedKeys(source, [\"type\", \"targets\"], \"target\");\n if (!Array.isArray(source[\"targets\"]) || source[\"targets\"].length === 0)\n throw new Error(\"target.targets must be a nonempty array\");\n const targets = Array.from(source[\"targets\"]).map((entry: unknown) => {\n const target = text(entry, \"target.targets\");\n if (\n /[\\s,]/.test(target) ||\n Array.from(target).some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n )\n )\n throw new Error(\n \"target.targets must contain resolved target identifiers\",\n );\n return target;\n });\n return { type: \"javascript\", targets: [...new Set(targets)].sort() };\n};\n\nexport const parsePublishContract = (value: unknown): PublishContract => {\n const source = object(value, \"publish contract\");\n closedKeys(\n source,\n [\"engines\", \"peerDependencies\", \"target\", \"entryPoints\"],\n \"publish contract\",\n );\n return {\n engines: stringMap(source[\"engines\"], \"engines\"),\n peerDependencies: stringMap(source[\"peerDependencies\"], \"peerDependencies\"),\n target: publishTarget(source[\"target\"]),\n entryPoints: entryPoints(source[\"entryPoints\"]),\n };\n};\n\nconst publishPackers = [\"npm\", \"pnpm\"] as const;\nexport type PublishPacker = (typeof publishPackers)[number];\n\ntype ResolveManifestContractOptions = {\n packer: PublishPacker;\n manifest: unknown;\n target: PublishTarget;\n};\n\nexport const resolveManifestContract = ({\n packer,\n manifest,\n target,\n}: ResolveManifestContractOptions): PublishContract => {\n if (!publishPackers.includes(packer))\n throw new Error(\"publish packer must be npm or pnpm\");\n const source = object(manifest, \"package manifest\");\n const config =\n \"publishConfig\" in source\n ? object(source[\"publishConfig\"], \"publishConfig\")\n : {};\n closedKeys(\n config,\n [...publishConfigOverrideKeys, \"access\", \"registry\"],\n \"publishConfig\",\n );\n if (packer === \"npm\")\n for (const key of publishConfigOverrideKeys)\n if (\n Object.hasOwn(config, key) &&\n !(key === \"exports\" || key === \"typesVersions\"\n ? JSON.stringify(config[key]) === JSON.stringify(source[key])\n : isDeepStrictEqual(config[key], source[key]))\n )\n throw new Error(\n `npm pack does not apply differing publishConfig.${key}; move the published entry to package.json or use pnpm`,\n );\n for (const field of [\"browser\", \"esnext\", \"es2015\", \"unpkg\", \"umd:main\"])\n if (Object.hasOwn(source, field) || Object.hasOwn(config, field))\n throw new Error(`published entry field ${field} is unsupported`);\n const published: Record<string, unknown> = {};\n for (const key of entryPointKeys) {\n if (packer === \"pnpm\" && key !== \"type\" && key in config)\n published[key] = config[key];\n else if (key in source) published[key] = source[key];\n }\n if (typeof published[\"bin\"] === \"string\") {\n const name = text(source[\"name\"], \"package name for bin\");\n const command = name.split(\"/\").at(-1);\n if (command === undefined || command === \"\")\n throw new Error(\"package name must determine its bin command\");\n published[\"bin\"] = { [command]: published[\"bin\"] };\n }\n let engines: unknown = {};\n if (Object.hasOwn(source, \"engines\")) engines = source[\"engines\"];\n return parsePublishContract({\n engines,\n peerDependencies: Object.hasOwn(source, \"peerDependencies\")\n ? source[\"peerDependencies\"]\n : {},\n target,\n entryPoints: published,\n });\n};\n\nconst consumerPolicy = (policy: ConsumerPolicy) => {\n closedKeys(\n object(policy, \"consumer policy\"),\n [\"node\", \"typescript\"],\n \"consumer policy\",\n );\n for (const [field, major] of [\n [\"node\", 22],\n [\"typescript\", 6],\n ] as const) {\n const version = parse(policy[field]);\n if (\n version === null ||\n version.version !== policy[field] ||\n version.major !== major ||\n version.prerelease.length !== 0\n )\n throw new Error(\n `consumer policy ${field} must pin an exact stable ${major}.x release`,\n );\n }\n};\n\ntype CheckPublishContractOptions = ResolveManifestContractOptions & {\n contract: unknown;\n policy: ConsumerPolicy;\n};\n\n/** Share the accepted Node target grammar between static and packed checks. */\nexport const publishedNodeTargetSupportsConsumer = ({\n target,\n node,\n}: {\n target: string;\n node: string;\n}) => {\n const match = /^node([1-9]\\d*)(?:\\.(0|[1-9]\\d*))?(?:\\.(0|[1-9]\\d*))?$/i.exec(\n target,\n );\n const version =\n match === null\n ? null\n : parse(`${match[1]}.${match[2] ?? \"0\"}.${match[3] ?? \"0\"}`);\n return version !== null && lte(version, node);\n};\n\nexport const checkPublishContract = ({\n packer,\n manifest,\n target,\n contract,\n policy,\n}: CheckPublishContractOptions) => {\n consumerPolicy(policy);\n const current = resolveManifestContract({ packer, manifest, target });\n const committed = parsePublishContract(contract);\n const diagnostics: PublishContractDiagnostic[] = [];\n const add = (field: string, message: string) =>\n diagnostics.push({ field, message });\n const compare = (field: string, expected: unknown, actual: unknown) => {\n if (\n field !== \"entryPoints.exports\" &&\n field !== \"entryPoints.typesVersions\" &&\n record(expected) &&\n record(actual)\n ) {\n for (const key of new Set([\n ...Object.keys(expected),\n ...Object.keys(actual),\n ]))\n compare(\n `${field}.${key}`,\n Object.hasOwn(expected, key) ? expected[key] : undefined,\n Object.hasOwn(actual, key) ? actual[key] : undefined,\n );\n return;\n }\n if (JSON.stringify(expected) !== JSON.stringify(actual))\n add(field, `published ${field} differs from the committed contract`);\n };\n for (const field of [\n \"engines\",\n \"peerDependencies\",\n \"target\",\n \"entryPoints\",\n ] as const)\n compare(field, committed[field], current[field]);\n const support = (\n field: string,\n range: string | undefined,\n version: string,\n ) => {\n if (range !== undefined && !satisfies(version, range))\n add(field, `${field} must support consumer version ${version}`);\n };\n if (\n !consumerNodeSupportMatches({\n range: current.engines[\"node\"],\n node: policy.node,\n })\n )\n add(\n \"engines.node\",\n `engines.node must support consumer version ${policy.node}`,\n );\n support(\n \"engines.typescript\",\n current.engines[\"typescript\"],\n policy.typescript,\n );\n support(\n \"peerDependencies.typescript\",\n current.peerDependencies[\"typescript\"],\n policy.typescript,\n );\n if (\"bun\" in current.engines)\n add(\"engines.bun\", \"published packages must not require Bun\");\n for (const peer of [\"bun\", \"bun-types\", \"@types/bun\", \"@typescript/native\"])\n if (Object.hasOwn(current.peerDependencies, peer))\n add(\n `peerDependencies.${peer}`,\n \"published packages must not require development runtime or compiler packages\",\n );\n if (current.target.type === \"javascript\")\n for (const selected of current.target.targets) {\n if (/^bun(?:$|[0-9])/i.test(selected)) {\n add(\"target\", \"published JavaScript must not require Bun\");\n continue;\n }\n if (!/^node/i.test(selected)) continue;\n if (\n !publishedNodeTargetSupportsConsumer({\n target: selected,\n node: policy.node,\n })\n )\n add(\n \"target\",\n `JavaScript target ${selected} must support consumer Node ${policy.node}`,\n );\n }\n return diagnostics;\n};\n","import { spawn } from \"node:child_process\";\nimport { once } from \"node:events\";\nimport { createInterface } from \"node:readline\";\n\n// This worker imports only Node builtins. Package code is never loaded.\nconst worker = String.raw`\nimport {createRequire, isBuiltin} from 'node:module';\nimport {readFileSync, existsSync} from 'node:fs';\nimport path from 'node:path';\nimport {pathToFileURL} from 'node:url';\nimport {createInterface} from 'node:readline';\nconst selfReference = (specifier, file) => {\n let directory = path.dirname(file);\n while (true) {\n const manifest = path.join(directory, 'package.json');\n if (existsSync(manifest)) {\n const {name} = JSON.parse(readFileSync(manifest, 'utf8'));\n return typeof name === 'string' &&\n (specifier === name || specifier.startsWith(name + '/'));\n }\n const parent = path.dirname(directory);\n if (parent === directory) return false;\n directory = parent;\n }\n};\nconst bare = specifier => typeof specifier === 'string' &&\n !specifier.startsWith('.') && !specifier.startsWith('/') &&\n !specifier.startsWith('#') && !specifier.includes(':');\nfor await (const line of createInterface({input: process.stdin})) {\n const {specifier, file, mode} = JSON.parse(line);\n try {\n const resolved = mode === 'require'\n ? createRequire(file).resolve(specifier)\n : import.meta.resolve(specifier, pathToFileURL(file).href);\n console.log(JSON.stringify({url: isBuiltin(resolved) ||\n (bare(specifier) && !selfReference(specifier, file)) ? null :\n mode === 'require' ? pathToFileURL(resolved).href : resolved}));\n } catch (error) {\n // Node reports the selected missing dependency, including external #imports\n // targets. Never reinterpret its exports/imports selection ourselves.\n const missing = /^Cannot find (?:package|module) '([^']+)'/.exec(error.message)?.[1];\n if (bare(missing) && !selfReference(missing, file) &&\n ['MODULE_NOT_FOUND', 'ERR_MODULE_NOT_FOUND'].includes(error.code))\n console.log(JSON.stringify({url: null}));\n else console.log(JSON.stringify({error: String(error)}));\n }\n}\n`;\n\ntype NodeResolution = {\n specifier: string;\n file: string;\n mode: \"import\" | \"require\";\n};\n\n/** One metadata-only Node process per archive, with default import/require conditions. */\nexport const createPackedNodeResolver = () => {\n const child = spawn(\n \"node\",\n [\n \"--experimental-import-meta-resolve\",\n \"--input-type=module\",\n \"--eval\",\n worker,\n ],\n {\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n env: { ...process.env, NODE_OPTIONS: undefined, NODE_PATH: undefined },\n },\n );\n let stderr = \"\";\n child.stderr.setEncoding(\"utf8\");\n child.stderr.on(\"data\", (chunk: string) => {\n if (stderr.length < 16_384) stderr += chunk;\n });\n child.on(\"error\", (error) => child.stdout.destroy(error));\n const output = createInterface({ input: child.stdout });\n const lines = output[Symbol.asyncIterator]();\n return {\n resolve: async (request: NodeResolution) => {\n const timeout = setTimeout(() => child.kill(), 10_000);\n try {\n child.stdin.write(`${JSON.stringify(request)}\\n`);\n const line = await lines.next();\n if (line.done === true)\n throw new Error(`Node resolver stopped: ${stderr}`);\n const response: unknown = JSON.parse(line.value);\n if (typeof response !== \"object\" || response === null)\n throw new Error(\"Invalid Node resolver response\");\n if (\"error\" in response && typeof response.error === \"string\")\n throw new Error(response.error);\n if (\n !(\"url\" in response) ||\n (response.url !== null && typeof response.url !== \"string\")\n )\n throw new Error(\"Invalid Node resolver URL\");\n return response.url;\n } finally {\n clearTimeout(timeout);\n }\n },\n close: async () => {\n output.close();\n if (\n child.pid !== undefined &&\n child.exitCode === null &&\n child.signalCode === null\n ) {\n const exited = once(child, \"exit\");\n child.kill();\n await exited;\n }\n },\n };\n};\n","import { mkdir, mkdtemp, realpath, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { packageMode, parseArtifactSource } from \"./publish-artifact-parser\";\nimport { createPackedNodeResolver } from \"./publish-node-resolver\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst javascript = /\\.(?:js|mjs|cjs)$/iu;\nconst opaque = /\\.(?:json|node)$/u;\nconst declarationFile = /\\.d\\.[cm]?ts$/iu;\n\ntype PackedRuntimeImportsOptions = {\n members: ReadonlySet<string>;\n readSource: (file: string) => Promise<string>;\n assertRegular: (file: string) => Promise<void>;\n};\n\nconst packagePath = (file: string) => {\n const normalized = path.posix.normalize(file);\n if (\n (normalized !== \"package\" && !normalized.startsWith(\"package/\")) ||\n file.includes(\"\\\\\")\n )\n throw new Error(`Runtime import escapes the packed package: ${file}`);\n return normalized;\n};\n\nconst targets = (value: unknown): string[] => {\n if (typeof value === \"string\") return [value];\n if (value === undefined || value === null) return [];\n if (Array.isArray(value)) return value.flatMap(targets);\n if (!record(value)) throw new Error(\"Invalid packed runtime entry target\");\n return Object.entries(value).flatMap(([key, entry]) =>\n key === \"types\" || key === \"typings\" ? [] : targets(entry),\n );\n};\n\nconst identifier = (value: unknown) =>\n record(value) &&\n value[\"type\"] === \"Identifier\" &&\n typeof value[\"name\"] === \"string\"\n ? value[\"name\"]\n : undefined;\nconst literal = (value: unknown) =>\n record(value) &&\n value[\"type\"] === \"Literal\" &&\n typeof value[\"value\"] === \"string\"\n ? value[\"value\"]\n : undefined;\nconst nodes = (value: unknown): Record<string, unknown>[] => {\n if (Array.isArray(value)) return value.flatMap(nodes);\n return record(value) && typeof value[\"type\"] === \"string\" ? [value] : [];\n};\nconst children = (node: Record<string, unknown>) =>\n Object.values(node).flatMap(nodes);\nconst patternNames = (value: unknown): string[] => {\n const name = identifier(value);\n if (name !== undefined) return [name];\n if (!record(value)) return [];\n switch (value[\"type\"]) {\n case \"ObjectPattern\":\n return nodes(value[\"properties\"]).flatMap((property) =>\n patternNames(\n property[\"type\"] === \"RestElement\"\n ? property[\"argument\"]\n : property[\"value\"],\n ),\n );\n case \"ArrayPattern\":\n return nodes(value[\"elements\"]).flatMap(patternNames);\n case \"RestElement\":\n return patternNames(value[\"argument\"]);\n case \"AssignmentPattern\":\n return patternNames(value[\"left\"]);\n default:\n return [];\n }\n};\ntype Binding =\n | \"other\"\n | \"require\"\n | \"factory\"\n | \"module\"\n | \"module-api\"\n | \"filename\";\ntype Scope = Map<string, Binding>;\nconst bindingScope = (scopes: readonly Scope[], name: string) =>\n scopes.findLast((scope) => scope.has(name));\nconst binding = (scopes: readonly Scope[], name: string) =>\n bindingScope(scopes, name)?.get(name);\nconst memberName = (value: Record<string, unknown>) =>\n value[\"computed\"] === true\n ? literal(value[\"property\"])\n : identifier(value[\"property\"]);\nconst loaderBinding = (\n value: unknown,\n scopes: readonly Scope[],\n): Binding | undefined => {\n const name = identifier(value);\n if (name !== undefined) {\n const resolved = binding(scopes, name);\n return resolved === \"filename\" ? \"other\" : resolved;\n }\n if (!record(value) || value[\"type\"] !== \"MemberExpression\") return undefined;\n const owner = identifier(value[\"object\"]);\n if (owner === undefined) return undefined;\n const kind = binding(scopes, owner);\n const property = memberName(value);\n if (kind === \"module-api\" && property === \"createRequire\") return \"factory\";\n if (kind === \"module\" && property === \"require\") return \"require\";\n if (kind === \"require\" && property === \"resolve\") return \"require\";\n return undefined;\n};\nconst scopeDeclarations = (\n node: Record<string, unknown>,\n): Record<string, unknown>[] => {\n if (\n (node[\"type\"] === \"ExportNamedDeclaration\" ||\n node[\"type\"] === \"ExportDefaultDeclaration\") &&\n record(node[\"declaration\"])\n )\n return scopeDeclarations(node[\"declaration\"]);\n return [node];\n};\nconst functionNode = (node: Record<string, unknown>) =>\n [\n \"FunctionDeclaration\",\n \"FunctionExpression\",\n \"ArrowFunctionExpression\",\n ].includes(String(node[\"type\"]));\n\ntype StaticImport = { specifier: string; mode: \"import\" | \"require\" };\n/** Read syntax only; known loaders must have statically resolvable bindings. */\nconst staticImports = (\n tree: unknown,\n mode: \"script\" | \"module\",\n): StaticImport[] => {\n const result: StaticImport[] = [];\n const functionScopes = new WeakMap<Scope, \"wrapper\" | \"function\">();\n const resolvedFactories = new Set<Record<string, unknown>>();\n const resolvedNamespaces = new Set<Record<string, unknown>>();\n const allowedLoaderReferences = new Set<Record<string, unknown>>();\n const allowReference = (value: unknown) => {\n for (const node of nodes(value)) {\n allowedLoaderReferences.add(node);\n for (const child of children(node)) allowReference(child);\n }\n };\n const allowPattern = (value: unknown) => {\n if (!record(value)) return;\n if (value[\"type\"] === \"Identifier\") allowedLoaderReferences.add(value);\n else if (value[\"type\"] === \"Property\") allowPattern(value[\"value\"]);\n else if (value[\"type\"] === \"AssignmentPattern\") allowPattern(value[\"left\"]);\n else if (value[\"type\"] === \"RestElement\") allowPattern(value[\"argument\"]);\n else if ([\"ObjectPattern\", \"ArrayPattern\"].includes(String(value[\"type\"])))\n for (const child of children(value)) allowPattern(child);\n };\n const unresolvable = (description: string) =>\n new Error(`Unresolvable dynamic loader: ${description}`);\n const loaderName = (name: string, scopes: readonly Scope[]) => {\n const previous = binding(scopes, name);\n return (\n (mode === \"script\" &&\n [\"require\", \"module\", \"createRequire\"].includes(name)) ||\n (previous !== undefined &&\n previous !== \"other\" &&\n previous !== \"filename\")\n );\n };\n const loaderValue = (value: unknown, scopes: readonly Scope[]): boolean => {\n if (!record(value)) return false;\n const kind = loaderBinding(value, scopes);\n if (kind !== undefined && kind !== \"other\") return true;\n if (\n functionNode(value) ||\n [\n \"CallExpression\",\n \"MemberExpression\",\n \"UnaryExpression\",\n \"BinaryExpression\",\n \"TemplateLiteral\",\n ].includes(String(value[\"type\"]))\n )\n return false;\n if (value[\"type\"] === \"Property\")\n return loaderValue(value[\"value\"], scopes);\n return children(value).some((child) => loaderValue(child, scopes));\n };\n const exportedLoader = (\n value: unknown,\n scopes: readonly Scope[],\n ): boolean => {\n if (!record(value) || functionNode(value)) return false;\n if (loaderValue(value, scopes)) return true;\n if (value[\"type\"] === \"CallExpression\") {\n const callee = loaderBinding(value[\"callee\"], scopes);\n return (\n callee === \"factory\" ||\n (callee === \"require\" &&\n [\"node:module\", \"module\"].includes(\n literal(nodes(value[\"arguments\"]).at(0)) ?? \"\",\n ))\n );\n }\n if (value[\"type\"] === \"Property\")\n return exportedLoader(value[\"value\"], scopes);\n if (\n [\n \"ObjectExpression\",\n \"ArrayExpression\",\n \"ConditionalExpression\",\n \"LogicalExpression\",\n \"SequenceExpression\",\n ].includes(String(value[\"type\"]))\n )\n return children(value).some((child) => exportedLoader(child, scopes));\n return false;\n };\n const unsupportedPropagation = () =>\n unresolvable(\"unsupported loader propagation across module exports\");\n const walk = (\n node: Record<string, unknown>,\n scopes: readonly Scope[],\n parent?: Record<string, unknown>,\n ) => {\n const kind = node[\"type\"];\n if (\n kind === \"Program\" ||\n kind === \"BlockStatement\" ||\n functionNode(node) ||\n kind === \"CatchClause\" ||\n kind === \"ForStatement\" ||\n kind === \"ForOfStatement\" ||\n kind === \"ForInStatement\"\n ) {\n const local: Scope = new Map();\n const bind = (pattern: unknown) => {\n allowPattern(pattern);\n for (const name of patternNames(pattern)) {\n if (loaderName(name, scopes))\n throw unresolvable(`unsupported loader binding: ${name}`);\n local.set(name, \"other\");\n }\n };\n const bindVariable = (\n entry: Record<string, unknown>,\n declarationKind: unknown,\n ) => {\n if (\n declarationKind === \"var\" &&\n node[\"type\"] === \"BlockStatement\" &&\n node !== root\n )\n return;\n allowPattern(entry[\"id\"]);\n for (const name of patternNames(entry[\"id\"])) {\n // An uninitialized var redeclares, but does not replace, a CJS parameter.\n if (\n mode === \"script\" &&\n node === root &&\n declarationKind === \"var\" &&\n entry[\"init\"] === null &&\n (name === \"require\" || name === \"module\")\n )\n continue;\n local.set(name, \"other\");\n }\n };\n if (functionNode(node)) {\n if (kind !== \"ArrowFunctionExpression\")\n functionScopes.set(local, \"function\");\n bind(node[\"id\"]);\n for (const parameter of nodes(node[\"params\"])) bind(parameter);\n }\n if (kind === \"CatchClause\") bind(node[\"param\"]);\n if (\n kind === \"ArrowFunctionExpression\" &&\n record(node[\"body\"]) &&\n node[\"body\"][\"type\"] !== \"BlockStatement\" &&\n loaderValue(node[\"body\"], [...scopes, local])\n )\n throw unresolvable(\"loader returned through an unsupported function\");\n const statements =\n kind === \"Program\" || kind === \"BlockStatement\"\n ? nodes(node[\"body\"]).flatMap(scopeDeclarations)\n : children(node).flatMap(scopeDeclarations);\n const declarations: Record<string, unknown>[] = [];\n for (const statement of statements) {\n if (statement[\"type\"] === \"VariableDeclaration\") {\n for (const entry of nodes(statement[\"declarations\"])) {\n bindVariable(entry, statement[\"kind\"]);\n declarations.push(entry);\n }\n } else if (\n statement[\"type\"] === \"FunctionDeclaration\" ||\n statement[\"type\"] === \"ClassDeclaration\"\n )\n bind(statement[\"id\"]);\n else if (statement[\"type\"] === \"ImportDeclaration\") {\n allowReference(statement[\"specifiers\"]);\n const moduleImport = [\"node:module\", \"module\"].includes(\n literal(statement[\"source\"]) ?? \"\",\n );\n const specifiers = nodes(statement[\"specifiers\"]);\n if (moduleImport && specifiers.length === 0)\n throw unresolvable(\n \"module import needs recognized static bindings\",\n );\n for (const specifier of specifiers) {\n const name = identifier(specifier[\"local\"]);\n if (name === undefined)\n throw unresolvable(\n \"import binding cannot be resolved statically\",\n );\n if (!moduleImport) {\n local.set(name, \"other\");\n continue;\n }\n const imported =\n identifier(specifier[\"imported\"]) ??\n literal(specifier[\"imported\"]);\n if (imported === \"createRequire\") local.set(name, \"factory\");\n else if (\n [\"ImportDefaultSpecifier\", \"ImportNamespaceSpecifier\"].includes(\n String(specifier[\"type\"]),\n ) ||\n imported === \"Module\" ||\n imported === \"default\"\n )\n local.set(name, \"module-api\");\n else throw unresolvable(\"unsupported node:module import binding\");\n }\n }\n }\n // `var` declarations shadow throughout their function, including nested blocks.\n if (functionNode(node) || kind === \"Program\" || node === root) {\n const hoisted = (entry: Record<string, unknown>) => {\n if (functionNode(entry)) return;\n if (\n entry[\"type\"] === \"VariableDeclaration\" &&\n entry[\"kind\"] === \"var\"\n )\n for (const declaration of nodes(entry[\"declarations\"])) {\n bindVariable(declaration, \"var\");\n if (!declarations.includes(declaration))\n declarations.push(declaration);\n }\n for (const child of children(entry)) hoisted(child);\n };\n for (const statement of statements) hoisted(statement);\n }\n const nested = [...scopes, local];\n let changed = true;\n const assign = (name: string, value: Binding) => {\n const owner = bindingScope(nested, name);\n if (owner === undefined)\n throw unresolvable(\"loader declaration has no owning scope\");\n if (owner.get(name) === value) return;\n if (owner.get(name) !== \"other\")\n throw unresolvable(\"conflicting loader binding declarations\");\n owner.set(name, value);\n changed = true;\n };\n while (changed) {\n changed = false;\n for (const entry of declarations) {\n const name = identifier(entry[\"id\"]);\n const initial = entry[\"init\"];\n if (!record(initial)) continue;\n const alias = loaderBinding(initial, nested);\n const nodeModule =\n initial[\"type\"] === \"CallExpression\" &&\n loaderBinding(initial[\"callee\"], nested) === \"require\" &&\n [\"node:module\", \"module\"].includes(\n literal(nodes(initial[\"arguments\"]).at(0)) ?? \"\",\n );\n if (\n (nodeModule || alias === \"module-api\") &&\n record(entry[\"id\"]) &&\n entry[\"id\"][\"type\"] === \"ObjectPattern\"\n ) {\n for (const property of nodes(entry[\"id\"][\"properties\"])) {\n const key =\n property[\"computed\"] === true\n ? literal(property[\"key\"])\n : (identifier(property[\"key\"]) ?? literal(property[\"key\"]));\n if (property[\"type\"] === \"RestElement\" || key === undefined)\n throw unresolvable(\n \"module loader destructuring cannot be resolved statically\",\n );\n const factoryName = identifier(property[\"value\"]);\n if (\n key === \"createRequire\" ||\n key === \"Module\" ||\n key === \"default\"\n ) {\n if (factoryName === undefined)\n throw unresolvable(\n \"module loader binding pattern cannot be resolved statically\",\n );\n assign(\n factoryName,\n key === \"createRequire\" ? \"factory\" : \"module-api\",\n );\n } else\n throw unresolvable(\n \"unsupported module namespace destructuring\",\n );\n }\n } else if (\n name === undefined &&\n alias !== undefined &&\n alias !== \"other\"\n ) {\n throw unresolvable(\n \"loader destructuring cannot be resolved statically\",\n );\n }\n if (nodeModule) resolvedNamespaces.add(initial);\n if (alias !== undefined && alias !== \"other\") allowReference(initial);\n if (name === undefined) continue;\n if (alias !== undefined && alias !== \"other\") assign(name, alias);\n if (nodeModule) assign(name, \"module-api\");\n if (\n initial[\"type\"] === \"CallExpression\" &&\n loaderBinding(initial[\"callee\"], nested) === \"factory\"\n ) {\n const argument = nodes(initial[\"arguments\"]).at(0);\n const object = argument?.[\"object\"];\n const importMeta =\n record(object) &&\n object[\"type\"] === \"MetaProperty\" &&\n identifier(object[\"meta\"]) === \"import\" &&\n identifier(object[\"property\"]) === \"meta\";\n if (\n nodes(initial[\"arguments\"]).length !== 1 ||\n !(\n (identifier(argument) === \"__filename\" &&\n binding(nested, \"__filename\") === \"filename\") ||\n (argument?.[\"type\"] === \"MemberExpression\" &&\n argument[\"computed\"] === false &&\n importMeta &&\n identifier(argument[\"property\"]) === \"url\")\n )\n )\n throw unresolvable(\n \"createRequire needs import.meta.url or __filename\",\n );\n assign(name, \"require\");\n resolvedFactories.add(initial);\n }\n }\n }\n for (const entry of declarations) {\n const initial = entry[\"init\"];\n for (const name of patternNames(entry[\"id\"])) {\n if (loaderName(name, scopes) && binding(nested, name) === \"other\")\n throw unresolvable(`unknown loader declaration: ${name}`);\n const resolved = binding(nested, name);\n const source = loaderBinding(initial, nested);\n if (\n initial !== null &&\n resolved !== undefined &&\n resolved !== \"other\" &&\n (source === undefined || source === \"other\") &&\n (!record(initial) ||\n (!resolvedFactories.has(initial) &&\n !resolvedNamespaces.has(initial)))\n )\n throw unresolvable(`unknown loader initializer: ${name}`);\n }\n if (\n loaderBinding(initial, nested) === undefined &&\n loaderValue(initial, nested)\n )\n throw unresolvable(\n \"binding initializer cannot be resolved statically\",\n );\n }\n for (const child of children(node)) walk(child, nested, node);\n return;\n }\n if (\n kind === \"ExportDefaultDeclaration\" &&\n exportedLoader(node[\"declaration\"], scopes)\n )\n throw unsupportedPropagation();\n if (kind === \"ExportNamedDeclaration\") {\n const declaration = node[\"declaration\"];\n if (record(declaration) && declaration[\"type\"] === \"VariableDeclaration\")\n for (const entry of nodes(declaration[\"declarations\"])) {\n if (\n patternNames(entry[\"id\"]).some((name) => {\n const resolved = binding(scopes, name);\n return (\n resolved !== undefined &&\n resolved !== \"other\" &&\n resolved !== \"filename\"\n );\n }) ||\n exportedLoader(entry[\"init\"], scopes)\n )\n throw unsupportedPropagation();\n }\n if (literal(node[\"source\"]) === undefined)\n for (const specifier of nodes(node[\"specifiers\"]))\n if (exportedLoader(specifier[\"local\"], scopes))\n throw unsupportedPropagation();\n // Exported names and source re-export names are not lexical references.\n // All actual local bindings were checked before granting this permission.\n allowReference(node[\"specifiers\"]);\n }\n if (\n kind === \"ImportDeclaration\" ||\n kind === \"ExportNamedDeclaration\" ||\n kind === \"ExportAllDeclaration\"\n ) {\n const specifier = literal(node[\"source\"]);\n if (\n kind !== \"ImportDeclaration\" &&\n [\"node:module\", \"module\"].includes(specifier ?? \"\")\n )\n throw unsupportedPropagation();\n if (specifier !== undefined) result.push({ specifier, mode: \"import\" });\n }\n if (kind === \"ImportExpression\") {\n const specifier = literal(node[\"source\"]);\n if (specifier === undefined)\n throw unresolvable(\"dynamic import needs a literal module specifier\");\n if ([\"node:module\", \"module\"].includes(specifier))\n throw unresolvable(\"dynamic module namespace imports are unsupported\");\n result.push({ specifier, mode: \"import\" });\n }\n if (kind === \"CallExpression\") {\n const callee = node[\"callee\"];\n const resolved = loaderBinding(callee, scopes);\n const specifier = literal(nodes(node[\"arguments\"]).at(0));\n if (resolved === \"require\") {\n if (specifier === undefined || nodes(node[\"arguments\"]).length !== 1)\n throw unresolvable(\n \"require/resolve needs one literal module specifier\",\n );\n allowReference(callee);\n if (\n [\"node:module\", \"module\"].includes(specifier) &&\n !resolvedNamespaces.has(node)\n )\n throw unresolvable(\n \"module namespace needs a resolvable local binding\",\n );\n result.push({ specifier, mode: \"require\" });\n }\n if (resolved === \"factory\") {\n if (!resolvedFactories.has(node))\n throw unresolvable(\n \"createRequire result needs a resolvable local binding\",\n );\n allowReference(callee);\n }\n if (\n record(callee) &&\n callee[\"type\"] === \"MemberExpression\" &&\n [\"require\", \"factory\"].includes(\n loaderBinding(callee[\"object\"], scopes) ?? \"\",\n ) &&\n resolved === undefined\n )\n throw unresolvable(\"loader method cannot be resolved statically\");\n if (\n resolved !== \"require\" &&\n resolved !== \"factory\" &&\n nodes(node[\"arguments\"]).some((argument) =>\n loaderValue(argument, scopes),\n )\n )\n throw unresolvable(\"loader passed through an unsupported call\");\n }\n if (kind === \"AssignmentExpression\") {\n const assigned = loaderBinding(node[\"right\"], scopes);\n if (\n exportedLoader(node[\"right\"], scopes) &&\n (node[\"operator\"] !== \"=\" ||\n loaderBinding(node[\"left\"], scopes) !== assigned ||\n assigned === undefined)\n )\n throw unsupportedPropagation();\n for (const name of patternNames(node[\"left\"])) {\n const previous = binding(scopes, name);\n if (\n loaderName(name, scopes) &&\n (previous === undefined || previous === \"other\")\n )\n throw unresolvable(`unknown loader assignment: ${name}`);\n if (\n previous !== undefined &&\n previous !== \"other\" &&\n (node[\"operator\"] !== \"=\" ||\n loaderBinding(node[\"right\"], scopes) !== previous)\n )\n throw unresolvable(\n \"loader reassignment cannot be resolved statically\",\n );\n }\n }\n if (kind === \"ReturnStatement\" && loaderValue(node[\"argument\"], scopes))\n throw unresolvable(\"loader returned through an unsupported function\");\n // Only the recognized static forms grant permission to reference a loader.\n const nonReference =\n parent !== undefined &&\n ((parent[\"type\"] === \"MemberExpression\" &&\n parent[\"computed\"] === false &&\n parent[\"property\"] === node) ||\n ([\"Property\", \"MethodDefinition\", \"PropertyDefinition\"].includes(\n String(parent[\"type\"]),\n ) &&\n parent[\"computed\"] === false &&\n parent[\"key\"] === node &&\n parent[\"value\"] !== node));\n const reference = loaderBinding(node, scopes);\n const name = identifier(node);\n if (!nonReference && !allowedLoaderReferences.has(node)) {\n const owner = scopes.findLast((scope) => functionScopes.has(scope));\n if (\n (name === \"arguments\" &&\n owner !== undefined &&\n functionScopes.get(owner) === \"wrapper\") ||\n name === \"eval\" ||\n name === \"Function\"\n )\n throw unresolvable(`unsupported dynamic loader escape: ${name}`);\n }\n if (kind === \"MemberExpression\") {\n const owner = identifier(node[\"object\"]);\n const property = memberName(node);\n const ownerBinding = loaderBinding(node[\"object\"], scopes);\n if (\n (ownerBinding === \"module\" &&\n (property === \"constructor\" || property === \"require\")) ||\n (ownerBinding === \"require\" &&\n [\"cache\", \"extensions\", \"main\"].includes(property ?? \"\")) ||\n (owner === \"process\" && property === \"mainModule\") ||\n ((owner === \"globalThis\" || owner === \"global\") &&\n [\"require\", \"eval\", \"Function\"].includes(property ?? \"\"))\n )\n throw unresolvable(\"unsupported dynamic loader escape property\");\n }\n if (\n name !== undefined &&\n loaderName(name, scopes) &&\n (reference === undefined || reference === \"other\") &&\n !nonReference &&\n !allowedLoaderReferences.has(node)\n )\n throw unresolvable(`unknown loader reference: ${name}`);\n const moduleExports =\n reference === \"module\" &&\n parent?.[\"type\"] === \"MemberExpression\" &&\n parent[\"object\"] === node &&\n memberName(parent) === \"exports\";\n if (\n reference !== undefined &&\n reference !== \"other\" &&\n !moduleExports &&\n !nonReference &&\n !allowedLoaderReferences.has(node)\n )\n throw unresolvable(\"loader reference is not a recognized static form\");\n for (const child of children(node)) walk(child, scopes, node);\n };\n const root = nodes(tree).at(0);\n if (root !== undefined) {\n const wrapper: Scope = new Map();\n if (mode === \"script\") {\n wrapper.set(\"require\", \"require\");\n wrapper.set(\"module\", \"module\");\n wrapper.set(\"__filename\", \"filename\");\n functionScopes.set(wrapper, \"wrapper\");\n }\n walk(root, [wrapper]);\n }\n return result;\n};\n\n/** Validate the static local runtime closure against regular packed members. */\nexport const assertPackedRuntimeImports = async ({\n members,\n readSource,\n assertRegular,\n}: PackedRuntimeImportsOptions) => {\n const files = new Map<string, string>();\n const read = async (file: string) => {\n if (!members.has(file))\n throw new Error(`Missing packed runtime file: ${file}`);\n await assertRegular(file);\n const cached = files.get(file);\n if (cached !== undefined) return cached;\n const source = await readSource(file);\n files.set(file, source);\n return source;\n };\n const manifest = async (file: string) => {\n const value: unknown = JSON.parse(await read(file));\n if (!record(value)) throw new Error(`Invalid packed manifest: ${file}`);\n return value;\n };\n const scratch = await realpath(\n await mkdtemp(path.join(tmpdir(), \"packed-node-resolution-\")),\n );\n const resolver = createPackedNodeResolver();\n try {\n // Recreate the archive's existence index without extracting paths or links.\n // Node reads manifest contents; other members are byte-free placeholders.\n // Every selected target is still validated as a regular archive member.\n for (const file of members) {\n const directory = file.endsWith(\"/\");\n const member = directory ? file.slice(0, -1) : file;\n if (packagePath(member) !== member)\n throw new Error(`Invalid packed member path: ${file}`);\n const destination = path.join(scratch, member);\n if (directory) {\n await mkdir(destination, { recursive: true });\n continue;\n }\n await mkdir(path.dirname(destination), { recursive: true });\n await writeFile(\n destination,\n path.posix.basename(file) === \"package.json\" ? await read(file) : \"\",\n );\n }\n // External dependencies are outside the archive closure. Give Node inert\n // metadata for bare #imports targets so it can select the exact runtime\n // condition without requiring a dependency install or executing packages.\n const externalFiles = new Set<string>();\n for (const file of members) {\n if (path.posix.basename(file) !== \"package.json\") continue;\n const owner = await manifest(file);\n for (const target of targets(owner[\"imports\"])) {\n if (\n target.startsWith(\".\") ||\n target.startsWith(\"#\") ||\n target.includes(\":\")\n )\n continue;\n const parts = target.split(\"/\");\n const name = target.startsWith(\"@\")\n ? parts.slice(0, 2).join(\"/\")\n : parts.at(0);\n if (\n name === undefined ||\n !/^(?:@[a-z0-9._~-]+\\/)?[a-z0-9._~-]+$/iu.test(name) ||\n name.split(\"/\").some((part) => part === \".\" || part === \"..\")\n )\n throw new Error(`Unsupported external import mapping: ${target}`);\n if (name === owner[\"name\"]) continue;\n const directory = path.join(scratch, \"node_modules\", name);\n await mkdir(directory, { recursive: true });\n await writeFile(\n path.join(directory, \"package.json\"),\n JSON.stringify({\n name,\n exports: { \".\": \"./external.cjs\", \"./*\": \"./external.cjs\" },\n }),\n );\n const entry = path.join(directory, \"external.cjs\");\n await writeFile(entry, \"\");\n externalFiles.add(entry);\n }\n }\n const resolveImport = async ({\n specifier,\n mode,\n importer,\n }: StaticImport & { importer: string }): Promise<string[]> => {\n let resolved: string | null;\n try {\n resolved = await resolver.resolve({\n specifier,\n mode,\n file: path.join(scratch, importer),\n });\n } catch (error) {\n throw new Error(\n `Missing packed runtime import: ${importer} -> ${specifier}: ${String(error)}`,\n { cause: error },\n );\n }\n if (resolved === null) return [];\n const url = new URL(resolved);\n if (url.protocol !== \"file:\")\n throw new Error(`Unsupported packed runtime URL: ${resolved}`);\n const destination = fileURLToPath(url);\n if (externalFiles.has(destination)) return [];\n const file = packagePath(\n path.relative(scratch, destination).split(path.sep).join(\"/\"),\n );\n if (!members.has(file))\n throw new Error(\n `Missing packed runtime import: ${importer} -> ${specifier} (${file})`,\n );\n return [file];\n };\n for (const file of members)\n if (path.posix.basename(file) === \"package.json\") await manifest(file);\n const root = await manifest(\"package/package.json\");\n const pending = [...members].filter((file) => javascript.test(file));\n const scripts = new Set(pending);\n const bin = root[\"bin\"];\n const bins: unknown[] = [];\n if (typeof bin === \"string\") bins.push(bin);\n else if (record(bin)) bins.push(...Object.values(bin));\n else if (bin !== undefined)\n throw new Error(\"Invalid packed bin declaration\");\n for (const entry of bins) {\n if (\n typeof entry !== \"string\" ||\n entry === \"\" ||\n path.posix.isAbsolute(entry) ||\n entry.includes(\"\\\\\")\n )\n throw new Error(\"Invalid packed bin entry\");\n const file = packagePath(path.posix.join(\"package\", entry));\n scripts.add(file);\n pending.push(file);\n }\n const addEntry = (entry: string, mode: \"file\" | \"url\") => {\n if (declarationFile.test(entry)) return;\n if (path.posix.isAbsolute(entry) || entry.includes(\"\\\\\"))\n throw new Error(`Runtime entry escapes the packed package: ${entry}`);\n if (mode === \"url\" && /%2f|%5c/iu.test(entry))\n throw new Error(`Invalid packed entry URL: ${entry}`);\n const file = packagePath(\n mode === \"url\"\n ? fileURLToPath(new URL(entry, \"file:///package/package.json\")).slice(\n 1,\n )\n : path.posix.join(\"package\", entry),\n );\n if (!file.includes(\"*\")) {\n if (javascript.test(file) || path.posix.extname(file) === \"\")\n scripts.add(file);\n pending.push(file);\n return;\n }\n const [prefix, suffix] = file.split(\"*\");\n if (\n prefix === undefined ||\n suffix === undefined ||\n file.split(\"*\").length !== 2\n )\n throw new Error(`Unsupported packed entry pattern: ${entry}`);\n const matches = [...members].filter(\n (candidate) =>\n !candidate.endsWith(\"/\") &&\n candidate.length >= prefix.length + suffix.length &&\n candidate.startsWith(prefix) &&\n candidate.endsWith(suffix),\n );\n if (matches.length === 0)\n throw new Error(`Missing packed runtime entry pattern: ${entry}`);\n for (const match of matches)\n if (javascript.test(match)) scripts.add(match);\n pending.push(...matches);\n };\n for (const target of targets(root[\"module\"])) addEntry(target, \"file\");\n for (const target of targets(root[\"exports\"])) addEntry(target, \"url\");\n if (root[\"main\"] !== undefined) {\n const entry = root[\"main\"];\n if (\n typeof entry !== \"string\" ||\n path.posix.isAbsolute(entry) ||\n entry.includes(\"\\\\\")\n )\n throw new Error(\"Invalid packed main entry\");\n if (!declarationFile.test(entry)) {\n const resolved = (\n await resolveImport({\n specifier: \"./package\",\n mode: \"require\",\n importer: \"entry.cjs\",\n })\n ).at(0);\n if (resolved === undefined)\n throw new Error(`Missing packed runtime main: ${entry}`);\n if (!opaque.test(resolved)) scripts.add(resolved);\n pending.push(resolved);\n }\n }\n const validated = new Set<string>();\n const traversed = new Set<string>();\n while (pending.length > 0) {\n const file = pending.pop();\n if (file === undefined) continue;\n if (!validated.has(file)) {\n if (!members.has(file))\n throw new Error(`Missing packed runtime file: ${file}`);\n await assertRegular(file);\n validated.add(file);\n }\n if (!scripts.has(file) || traversed.has(file)) continue;\n traversed.add(file);\n const source = await read(file);\n let mode: ReturnType<typeof packageMode>;\n if (/\\.mjs$/iu.test(file)) mode = \"module\";\n else if (/\\.cjs$/iu.test(file)) mode = \"script\";\n else mode = packageMode(files, file);\n const parse = (sourceType: \"script\" | \"module\") => {\n try {\n const tree = parseArtifactSource(source, {\n ecmaVersion: \"latest\",\n sourceType,\n allowHashBang: true,\n allowReturnOutsideFunction: sourceType === \"script\",\n });\n // The shared parser wraps CommonJS. Its require parameter is the runtime loader.\n if (sourceType === \"script\") {\n const statement = tree.body.at(0);\n if (\n statement?.type === \"ExpressionStatement\" &&\n statement.expression.type === \"FunctionExpression\"\n )\n return { tree: statement.expression.body, mode: sourceType };\n }\n return { tree, mode: sourceType };\n } catch (error) {\n if (!(error instanceof SyntaxError)) throw error;\n throw new SyntaxError(\n `Packed runtime import syntax ${file}: ${error.message}`,\n { cause: error },\n );\n }\n };\n let parsed: ReturnType<typeof parse>;\n if (mode === \"detect\") {\n try {\n parsed = parse(\"script\");\n } catch {\n parsed = parse(\"module\");\n }\n } else parsed = parse(mode);\n let dependencies: StaticImport[];\n try {\n dependencies = staticImports(parsed.tree, parsed.mode);\n } catch (error) {\n throw new Error(`Packed runtime imports ${file}: ${String(error)}`, {\n cause: error,\n });\n }\n for (const dependency of dependencies) {\n const resolved = await resolveImport({\n ...dependency,\n importer: file,\n });\n for (const target of resolved) {\n if (\n javascript.test(target) ||\n path.posix.extname(target) === \"\" ||\n (dependency.mode === \"require\" && !opaque.test(target))\n )\n scripts.add(target);\n pending.push(target);\n }\n }\n }\n } finally {\n try {\n await resolver.close();\n } finally {\n await rm(scratch, { recursive: true, force: true });\n }\n }\n};\n","import type { Options } from \"acorn\";\nimport { execFile } from \"node:child_process\";\nimport { mkdtemp, mkdir, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport { promisify } from \"node:util\";\n\nimport { packageMode, parseArtifactSource } from \"./publish-artifact-parser\";\nimport {\n publishedNodeTargetSupportsConsumer,\n type PublishTarget,\n} from \"./publish-contract\";\nimport { assertPackedRuntimeImports } from \"./publish-runtime-imports\";\n\nconst command = promisify(execFile);\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst javascript = /\\.(?:js|mjs|cjs)$/i;\n\nconst syntaxYears = new Map(\n Object.entries({\n es5: 5,\n es2015: 2015,\n es2016: 2016,\n es2017: 2017,\n es2018: 2018,\n es2019: 2019,\n es2020: 2020,\n es2021: 2021,\n es2022: 2022,\n es2023: 2023,\n es2024: 2024,\n es2025: 2025,\n } as const satisfies Record<string, Options[\"ecmaVersion\"]>),\n);\n\n/** Explicit ECMAScript targets bound syntax; unbounded targets use native Node. */\nexport const artifactEcmaVersion = ({\n target,\n node,\n}: {\n target: PublishTarget;\n node: string;\n}): Options[\"ecmaVersion\"] => {\n if (target.type === \"types-only\") return \"latest\";\n if (target.targets.length === 0)\n throw new Error(\"Packed JavaScript requires a declared target\");\n let version: Options[\"ecmaVersion\"] = \"latest\";\n for (const identifier of target.targets) {\n if (identifier === \"esnext\") continue;\n const year = syntaxYears.get(identifier);\n if (year !== undefined) {\n if (version === \"latest\" || year < version) version = year;\n continue;\n }\n if (publishedNodeTargetSupportsConsumer({ target: identifier, node }))\n continue;\n throw new Error(\n `Unsupported packed JavaScript syntax target ${identifier}; use an explicit ECMAScript year or a supported Node target`,\n );\n }\n return version;\n};\n\nconst packedBinFiles = (files: Map<string, string>) => {\n const result = new Set<string>();\n for (const [file, source] of files) {\n if (path.posix.basename(file) !== \"package.json\") continue;\n const manifest: unknown = JSON.parse(source);\n if (!record(manifest)) throw new Error(`Invalid packed manifest: ${file}`);\n const bin = manifest[\"bin\"];\n if (bin === undefined) continue;\n let entries: unknown[] | undefined;\n if (typeof bin === \"string\") entries = [bin];\n else if (record(bin)) entries = Object.values(bin);\n if (entries === undefined)\n throw new Error(`Unsupported packed bin declaration: ${file}`);\n for (const entry of entries) {\n if (\n typeof entry !== \"string\" ||\n entry === \"\" ||\n path.posix.isAbsolute(entry) ||\n entry.includes(\"\\\\\") ||\n entry.split(\"/\").includes(\"..\")\n )\n throw new Error(`Unsafe packed bin declaration: ${file}`);\n result.add(path.posix.join(path.posix.dirname(file), entry));\n }\n }\n return result;\n};\nconst syntaxFiles = (files: Map<string, string>) => {\n const bins = packedBinFiles(files);\n for (const file of bins) {\n const source = files.get(file);\n if (source === undefined)\n throw new Error(`Missing packed executable: ${file}`);\n if (\n !javascript.test(file) &&\n !/^#!(?:[^\\n]*\\/node|\\/usr\\/bin\\/env(?: -S)? node)(?:[ \\r\\n]|$)/.test(\n source,\n )\n )\n throw new Error(`Unsupported packed executable language: ${file}`);\n }\n return [\n ...new Set(\n [...files.keys()]\n .filter((file) => javascript.test(file))\n .concat([...bins]),\n ),\n ];\n};\n\ntype ArtifactSyntaxOptions = {\n files: Map<string, string>;\n target: PublishTarget;\n node: string;\n};\n\n/** Enumerate all chunks and bins, including JavaScript outside declared exports. */\nexport const assertPackedArtifactSyntax = ({\n files,\n target,\n node,\n}: ArtifactSyntaxOptions) => {\n const ecmaVersion = artifactEcmaVersion({ target, node });\n const selected = syntaxFiles(files);\n if (target.type === \"types-only\" && selected.length > 0)\n throw new Error(`Types-only artifact contains JavaScript: ${selected[0]}`);\n for (const file of selected) {\n const source = files.get(file);\n if (source === undefined)\n throw new Error(`Missing packed JavaScript: ${file}`);\n let mode = packageMode(files, file);\n if (/\\.mjs$/i.test(file)) mode = \"module\";\n if (/\\.cjs$/i.test(file)) mode = \"script\";\n const parseMode = (sourceType: \"script\" | \"module\") => {\n const tree = parseArtifactSource(source, {\n ecmaVersion,\n sourceType,\n allowHashBang: true,\n allowReturnOutsideFunction: sourceType === \"script\",\n });\n // Acorn permits module declarations independently of ecmaVersion.\n if (\n ecmaVersion === 5 &&\n tree.body.some((item) => /^(?:Import|Export)/.test(item.type))\n )\n throw new Error(\"Module declarations exceed ES5\");\n };\n try {\n if (mode === \"detect\") {\n try {\n parseMode(\"script\");\n } catch {\n parseMode(\"module\");\n }\n } else parseMode(mode);\n } catch (error) {\n throw new Error(\n `Packed JavaScript ${file} exceeds its declared syntax target: ${String(error)}`,\n );\n }\n }\n};\n\nconst archiveMembers = (members: readonly string[]) => {\n const seen = new Set<string>();\n for (const file of members) {\n const parts = file.split(\"/\");\n if (\n !file.startsWith(\"package/\") ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n parts.some((part) => part === \"..\" || part === \".\") ||\n parts.slice(0, -1).some((part) => part === \"\") ||\n seen.has(file)\n )\n throw new Error(`Unsupported packed artifact member: ${file}`);\n seen.add(file);\n }\n return members;\n};\n\ntype CheckPackedArtifactOptions = ArtifactSyntaxOptions & {\n executable: string;\n};\nexport const checkPackedJavaScriptWithNode = async ({\n files,\n target,\n node,\n executable,\n}: CheckPackedArtifactOptions) => {\n assertPackedArtifactSyntax({ files, target, node });\n archiveMembers([...files.keys()]);\n const scratch = await mkdtemp(path.join(tmpdir(), \"stll-artifact-syntax-\"));\n try {\n for (const [file, source] of files) {\n const destination = path.join(scratch, file);\n await mkdir(path.dirname(destination), { recursive: true });\n await writeFile(destination, source);\n }\n for (const file of syntaxFiles(files)) {\n try {\n await command(executable, [\"--check\", path.join(scratch, file)], {\n cwd: scratch,\n env: { PATH: \"/usr/bin:/bin\", HOME: scratch },\n });\n } catch (error) {\n throw new Error(\n `Packed JavaScript ${file} is incompatible with consumer Node ${node}: ${String(error)}`,\n );\n }\n }\n } finally {\n await rm(scratch, { recursive: true, force: true });\n }\n};\n\n/** Read bytes without extracting archive-controlled paths or links. */\nexport const readPackedSyntaxFiles = async (archive: string) => {\n const { stdout: listing } = await command(\"tar\", [\"-tzf\", archive], {\n maxBuffer: 16 * 1024 * 1024,\n });\n const files = new Map<string, string>();\n const members = new Set(\n archiveMembers(listing.split(\"\\n\").filter((entry) => entry !== \"\")),\n );\n const regularFiles = new Set<string>();\n const assertRegular = async (file: string) => {\n if (!members.has(file))\n throw new Error(`Missing packed syntax input: ${file}`);\n if (regularFiles.has(file)) return;\n const { stdout: metadata } = await command(\"tar\", [\"-tvzf\", archive, file]);\n if (\n !metadata.startsWith(\"-\") ||\n metadata.trimEnd().split(\"\\n\").length !== 1\n )\n throw new Error(`Packed syntax input must be a regular file: ${file}`);\n regularFiles.add(file);\n };\n const readSource = async (file: string) => {\n const cached = files.get(file);\n if (cached !== undefined) return cached;\n await assertRegular(file);\n const { stdout } = await command(\"tar\", [\"-xOf\", archive, file], {\n maxBuffer: 16 * 1024 * 1024,\n });\n files.set(file, stdout);\n return stdout;\n };\n for (const file of members)\n if (javascript.test(file) || path.posix.basename(file) === \"package.json\")\n await readSource(file);\n for (const file of packedBinFiles(files))\n if (!files.has(file)) await readSource(file);\n await assertPackedRuntimeImports({ members, readSource, assertRegular });\n return files;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAIA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AACrE,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,wBACJ;AACF,MAAM,mBAAmB,aAAsB;CAC7C,IAAI,CAACA,SAAO,QAAQ,KAAK,CAACA,SAAO,SAAS,MAAM,GAAG,OAAO,KAAA;CAC1D,OAAO,SAAS,MAAM,CAAC;AACzB;AAQA,MAAM,iBAAiB,SAAiB;CACtC,MAAM,UAAU,kCAAkC,KAAK,IAAI;CAC3D,MAAM,UAAU,UAAU;CAC1B,IAAI,YAAY,SAAS,YAAY,QACnC,MAAM,IAAI,MAAM,kCAAkC;CAEpD,MAAM,UADM,UAAU,MAAM,GAAA,CACT,MAAM,6BAA6B,KAAK,CAAC;CAC5D,MAAM,OAAiB,CAAC;CACxB,IAAI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aAAa,IAAI,IAAI;CACvB;CACA,MAAM,aAAa,OAAO,SAAiB;EACzC,MAAM,SAAS,MAAM,IAAI,IAAI;EAC7B,IAAI,WAAW,KAAA,GAAW,OAAO;EACjC,MAAM,cAAc,IAAI;EACxB,MAAM,EAAE,WAAW,MAAM,QAAQ,OAAO;GAAC;GAAQ;GAAS;EAAI,GAAG,EAC/D,WAAW,SACb,CAAC;EACD,MAAM,IAAI,MAAM,MAAM;EACtB,OAAO;CACT;CACA,KAAK,MAAM,QAAQ,SACjB,IAAI,WAAW,KAAK,IAAI,KAAKL,UAAAA,QAAK,MAAM,SAAS,IAAI,MAAM,gBACzD,MAAM,WAAW,IAAI;CACzB,KAAK,MAAM,QAAQ,eAAe,KAAK,GACrC,IAAI,CAAC,MAAM,IAAI,IAAI,GAAG,MAAM,WAAW,IAAI;CAC7C,MAAM,2BAA2B;EAAE;EAAS;EAAY;CAAc,CAAC;CACvE,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"publish-artifact-syntax.cjs","names":["record","githubAutomationFileKind","parseDocument","record","path","parse","Module","record","isDeepStrictEqual","parse","lte","satisfies","consumerNodeSupportMatches","spawn","createInterface","once","record","javascript","path","realpath","mkdtemp","tmpdir","mkdir","writeFile","fileURLToPath","rm","promisify","execFile","path","mkdtemp","tmpdir","mkdir","writeFile","rm"],"sources":["../src/consumer-release-pack.ts","../src/publish-artifact-parser.ts","../src/publish-contract.ts","../src/publish-node-resolver.ts","../src/publish-runtime-imports.ts","../src/publish-artifact-syntax.ts"],"sourcesContent":["import { parseDocument } from \"yaml\";\n\nimport { githubAutomationFileKind } from \"./toolchain-inputs\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst exactVersion = /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/;\nconst outputDirectory = \"<consumer-release-pack-output>\";\nconst packerSetupExpression =\n /^npm\\s+install\\s+((?:(?:--global|-g|--ignore-scripts)\\s+)+)(npm|pnpm)@([^\\s]+)$/;\nconst defaultRunShell = (defaults: unknown) => {\n if (!record(defaults) || !record(defaults[\"run\"])) return undefined;\n return defaults[\"run\"][\"shell\"];\n};\n\nexport type ConsumerReleasePack = {\n manager: \"npm\" | \"pnpm\";\n version: string;\n arguments: string[];\n};\n\nconst packArguments = (line: string) => {\n const command = /^(npm|pnpm)\\s+pack(?:\\s+(.*))?$/.exec(line);\n const manager = command?.[1];\n if (manager !== \"npm\" && manager !== \"pnpm\")\n throw new Error(\"Unsupported release pack command\");\n const raw = command?.[2] ?? \"\";\n const tokens = raw.match(/\"[^\"\\n]*\"|'[^'\\n]*'|[^\\s]+/g) ?? [];\n const args: string[] = [];\n let destination = false;\n for (let index = 0; index < tokens.length; index++) {\n const token = tokens.at(index);\n if (token === \"--pack-destination\") {\n if (destination) throw new Error(\"Repeated release pack destination\");\n const value = tokens.at(++index);\n if (\n value === undefined ||\n !/^(?:\"\\$GITHUB_WORKSPACE\\/[A-Za-z0-9_/-]+\"|[A-Za-z0-9_/-]+)$/.test(\n value,\n ) ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Unsupported release pack destination\");\n destination = true;\n args.push(token, outputDirectory);\n continue;\n }\n if (\n token !== \"--ignore-scripts\" &&\n !(manager === \"pnpm\" && token === \"--config.ignore-scripts=true\") &&\n token !== \"--json\" &&\n token !== \"--silent\"\n )\n throw new Error(\"Unsupported release pack arguments\");\n if (args.includes(token)) throw new Error(\"Repeated release pack flag\");\n args.push(token);\n }\n if (\n !destination ||\n (!args.includes(\"--ignore-scripts\") &&\n !args.includes(\"--config.ignore-scripts=true\"))\n )\n throw new Error(\n \"Release pack requires scripts disabled and --pack-destination\",\n );\n return { manager, arguments: args } satisfies Pick<\n ConsumerReleasePack,\n \"manager\" | \"arguments\"\n >;\n};\n\ntype ReleaseShellContextOptions = {\n step: Record<string, unknown>;\n kind: \"setup\" | \"pack\";\n location: string;\n inheritedShell: unknown;\n};\n\n/** Both setup provenance and packing require unconditional shell commands. */\nconst assertReleaseShellContext = ({\n step,\n kind,\n location,\n inheritedShell,\n}: ReleaseShellContextOptions) => {\n const run = step[\"run\"];\n if (typeof run !== \"string\")\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n const shell = step[\"shell\"] === undefined ? inheritedShell : step[\"shell\"];\n if (shell !== undefined && shell !== \"bash\" && shell !== \"sh\")\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n let quote: \"single\" | \"double\" | undefined;\n let code = \"\";\n for (let index = 0; index < run.length; index += 1) {\n const char = run[index];\n if (char === \"\\n\") {\n if (quote !== undefined)\n throw new Error(\n `Unsupported release ${kind} shell context: ${location}`,\n );\n code += \"\\n\";\n continue;\n }\n if (quote !== \"single\" && char === \"\\\\\") {\n if (\n run[index + 1] === \"\\n\" ||\n (run[index + 1] === \"\\r\" && run[index + 2] === \"\\n\")\n )\n throw new Error(\n `Unsupported release ${kind} shell context: ${location}`,\n );\n index += 1;\n code += \" \";\n continue;\n }\n if (\n quote !== \"single\" &&\n (char === \"`\" || (char === \"$\" && run[index + 1] === \"(\"))\n )\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n if (quote === \"single\") {\n if (char === \"'\") quote = undefined;\n code += \" \";\n continue;\n }\n if (quote === \"double\") {\n if (char === '\"') quote = undefined;\n code += \" \";\n continue;\n }\n if (char === \"'\") {\n quote = \"single\";\n code += \" \";\n continue;\n }\n if (char === '\"') {\n quote = \"double\";\n code += \" \";\n continue;\n }\n if (char === \"#\" && (index === 0 || /\\s/.test(run[index - 1] ?? \"\"))) {\n while (index + 1 < run.length && run[index + 1] !== \"\\n\") index += 1;\n continue;\n }\n code += char;\n }\n if (\n quote !== undefined ||\n /[;&|<>]/.test(code) ||\n code\n .split(\"\\n\")\n .some((line) =>\n /^\\s*(?:if|then|elif|else|fi|for|do|done|while|until|case|esac|function|select|exit|return|exec|break|continue|trap|eval|source|hash|alias|unalias)\\b/.test(\n line,\n ),\n ) ||\n /(?:^|\\n)\\s*\\.(?:\\s|$)/.test(code) ||\n /(?:^|\\n)\\s*[A-Za-z_]\\w*\\s*\\(\\s*\\)\\s*[{(]/.test(code) ||\n (kind === \"setup\" && /[(){}]/.test(code))\n )\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n if (kind !== \"setup\") return;\n for (const line of run.split(\"\\n\")) {\n const command = line.trim();\n if (command === \"\" || command.startsWith(\"#\")) continue;\n if (\n packerSetupExpression.test(command) ||\n /^(?:npm|pnpm)\\s+pack(?:\\s|$)/.test(command) ||\n [\"set -e\", \"set -eu\", \"set -euo pipefail\"].includes(command)\n )\n continue;\n throw new Error(`Unsupported release setup command context: ${location}`);\n }\n};\n\n/** Resolve the repository's release packer without substituting another manager. */\nexport const resolveConsumerReleasePack = (\n files: Record<string, string>,\n): ConsumerReleasePack => {\n const candidates: ConsumerReleasePack[] = [];\n for (const [file, text] of Object.entries(files)) {\n if (githubAutomationFileKind(file) !== \"workflow\") continue;\n const document = parseDocument(text, { uniqueKeys: true, merge: true });\n if (document.errors.length > 0)\n throw new Error(`Invalid release workflow YAML: ${file}`);\n const source: unknown = document.toJS({ maxAliasCount: 100 });\n if (!record(source) || !record(source[\"jobs\"])) continue;\n for (const [jobName, job] of Object.entries(source[\"jobs\"])) {\n if (!record(job) || !Array.isArray(job[\"steps\"])) continue;\n const packsRelease = job[\"steps\"].some(\n (step: unknown) =>\n record(step) &&\n typeof step[\"run\"] === \"string\" &&\n step[\"run\"]\n .split(\"\\n\")\n .some(\n (line) =>\n !line.trimStart().startsWith(\"#\") &&\n /\\b(?:npm|pnpm)\\s+pack\\b/.test(line),\n ),\n );\n if (!packsRelease) continue;\n const jobShell = defaultRunShell(job[\"defaults\"]);\n const inheritedShell =\n jobShell === undefined ? defaultRunShell(source[\"defaults\"]) : jobShell;\n const versions = new Map<string, string[]>();\n let packed: ConsumerReleasePack | undefined;\n for (const step of job[\"steps\"]) {\n if (!record(step)) continue;\n if (\n typeof step[\"uses\"] === \"string\" &&\n step[\"uses\"].startsWith(\"pnpm/action-setup@\")\n ) {\n if (\n step[\"if\"] !== undefined ||\n step[\"continue-on-error\"] !== undefined\n )\n throw new Error(\n `Conditional release packer setup: ${file}:${jobName}`,\n );\n const inputs = step[\"with\"];\n const version = record(inputs) ? inputs[\"version\"] : undefined;\n if (typeof version !== \"string\" || !exactVersion.test(version))\n throw new Error(\n `Release pnpm setup requires an exact version: ${file}:${jobName}`,\n );\n const values = versions.get(\"pnpm\") ?? [];\n values.push(version);\n versions.set(\"pnpm\", values);\n }\n if (typeof step[\"run\"] !== \"string\") continue;\n for (const rawLine of step[\"run\"].split(\"\\n\")) {\n const line = rawLine.trim();\n if (line.startsWith(\"#\")) continue;\n const setupCommand =\n /\\bnpm\\s+(?:install|i)\\b[^\\n]*\\b(?:npm|pnpm)@/.test(line);\n if (setupCommand)\n assertReleaseShellContext({\n step,\n kind: \"setup\",\n location: `${file}:${jobName}`,\n inheritedShell,\n });\n const setup = packerSetupExpression.exec(line);\n if (setupCommand && setup === null)\n throw new Error(\n `Unsupported release packer setup command: ${file}:${jobName}`,\n );\n if (\n setup !== null &&\n /(?:^|\\s)(?:--global|-g)(?:\\s|$)/.test(setup[1] ?? \"\")\n ) {\n if (\n step[\"if\"] !== undefined ||\n step[\"continue-on-error\"] !== undefined\n )\n throw new Error(\n `Conditional release packer setup: ${file}:${jobName}`,\n );\n const manager = setup[2];\n const version = setup[3];\n if (\n manager === undefined ||\n version === undefined ||\n !exactVersion.test(version)\n )\n throw new Error(\n `Release packer setup requires an exact version: ${file}:${jobName}`,\n );\n const values = versions.get(manager) ?? [];\n values.push(version);\n versions.set(manager, values);\n }\n if (!/\\b(?:npm|pnpm)\\s+pack\\b/.test(line)) continue;\n if (\n job[\"if\"] !== undefined ||\n step[\"if\"] !== undefined ||\n step[\"continue-on-error\"] !== undefined ||\n packed !== undefined\n )\n throw new Error(\n `Ambiguous release pack command: ${file}:${jobName}`,\n );\n assertReleaseShellContext({\n step,\n kind: \"pack\",\n location: `${file}:${jobName}`,\n inheritedShell,\n });\n const command = packArguments(line);\n const selected = versions.get(command.manager);\n const version = selected?.at(0);\n if (selected?.length !== 1 || version === undefined)\n throw new Error(\n `Missing or ambiguous exact release packer version: ${file}:${jobName}`,\n );\n packed = {\n manager: command.manager,\n version,\n arguments: command.arguments,\n };\n }\n }\n if (packed !== undefined) candidates.push(packed);\n }\n }\n const selected = candidates.at(0);\n if (candidates.length !== 1 || selected === undefined)\n throw new Error(\"Require exactly one identifiable release pack job\");\n return selected;\n};\n\ntype ConsumerReleasePackArgumentsOptions = {\n packer: ConsumerReleasePack;\n directory: string;\n};\nexport const consumerReleasePackArguments = ({\n packer,\n directory,\n}: ConsumerReleasePackArgumentsOptions) => {\n if (directory.length === 0)\n throw new Error(\"Release pack output directory is required\");\n return [\n \"pack\",\n ...packer.arguments.map((argument) =>\n argument === outputDirectory ? directory : argument,\n ),\n ];\n};\n","import { type Options, parse } from \"acorn\";\nimport Module from \"node:module\";\nimport path from \"node:path\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nexport const packageMode = (\n files: Map<string, string>,\n file: string,\n): \"module\" | \"script\" | \"detect\" => {\n let directory = path.posix.dirname(file);\n while (directory !== \".\") {\n const source = files.get(`${directory}/package.json`);\n if (source !== undefined) {\n const manifest: unknown = JSON.parse(source);\n if (!record(manifest))\n throw new Error(`Invalid packed manifest: ${directory}`);\n if (manifest[\"type\"] === \"module\") return \"module\";\n if (manifest[\"type\"] === \"commonjs\") return \"script\";\n if (manifest[\"type\"] !== undefined)\n throw new Error(`Invalid packed package type: ${directory}`);\n return \"detect\";\n }\n directory = path.posix.dirname(directory);\n }\n return \"detect\";\n};\n\nexport const parseArtifactSource = (source: string, options: Options) => {\n const script = options.sourceType === \"script\";\n const content = script\n ? source.replace(/^\\uFEFF/, \"\").replace(/^#![^\\r\\n]*/, \"\")\n : source;\n try {\n return parse(script ? Module.wrap(content) : content, options);\n } catch (error) {\n if (\n !script ||\n !(error instanceof SyntaxError) ||\n !record(error) ||\n typeof error[\"pos\"] !== \"number\"\n )\n throw error;\n const prefixLength = Module.wrap(\"\\u0000\").indexOf(\"\\u0000\");\n const position = Math.max(\n 0,\n Math.min(\n source.length,\n error[\"pos\"] - prefixLength + source.length - content.length,\n ),\n );\n const lines = source.slice(0, position).split(/\\r\\n|[\\n\\r\\u2028\\u2029]/);\n const location = `(${lines.length}:${lines.at(-1)?.length ?? 0})`;\n throw new SyntaxError(error.message.replace(/\\(\\d+:\\d+\\)$/, location));\n }\n};\n","import { isDeepStrictEqual } from \"node:util\";\nimport { lte, parse, satisfies } from \"semver\";\n\nimport { consumerNodeSupportMatches } from \"./consumer-node-support\";\n\nexport type PublishTarget =\n { type: \"javascript\"; targets: readonly string[] } | { type: \"types-only\" };\n\ntype ExportTarget =\n string | null | ExportTarget[] | { [condition: string]: ExportTarget };\n\ntype EntryPoints = {\n type?: \"module\" | \"commonjs\";\n exports?: ExportTarget;\n main?: string;\n module?: string;\n types?: string;\n typings?: string;\n bin?: string | Record<string, string>;\n typesVersions?: Record<string, Record<string, string[]>>;\n};\n\nexport type PublishContract = {\n engines: Record<string, string>;\n peerDependencies: Record<string, string>;\n target: PublishTarget;\n entryPoints: EntryPoints;\n};\n\nexport type ConsumerPolicy = { node: string; typescript: string };\nexport type PublishContractDiagnostic = { field: string; message: string };\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst object = (value: unknown, field: string) => {\n if (!record(value)) throw new Error(`${field} must be an object`);\n return value;\n};\n\nconst closedKeys = (\n value: Record<string, unknown>,\n allowed: readonly string[],\n field: string,\n) => {\n for (const key of Object.keys(value))\n if (!allowed.includes(key))\n throw new Error(`${field}.${key} is unsupported`);\n};\n\nconst text = (value: unknown, field: string) => {\n if (typeof value !== \"string\" || value.trim() === \"\")\n throw new Error(`${field} must be a nonempty string`);\n return value;\n};\n\nconst stringMap = (value: unknown, field: string) => {\n const result = new Map<string, string>();\n for (const [key, entry] of Object.entries(object(value, field)))\n result.set(text(key, field), text(entry, `${field}.${key}`));\n return Object.fromEntries(result);\n};\n\nconst exportTarget = (value: unknown, field: string): ExportTarget => {\n if (value === null) return null;\n if (typeof value === \"string\") return text(value, field);\n if (Array.isArray(value))\n return value.map((entry: unknown, index) =>\n exportTarget(entry, `${field}[${index}]`),\n );\n const result = new Map<string, ExportTarget>();\n for (const [key, entry] of Object.entries(object(value, field)))\n result.set(text(key, field), exportTarget(entry, `${field}.${key}`));\n return Object.fromEntries(result);\n};\n\nconst typesVersions = (value: unknown) => {\n const result = new Map<string, Record<string, string[]>>();\n for (const [range, paths] of Object.entries(object(value, \"typesVersions\"))) {\n const mappings = new Map<string, string[]>();\n for (const [pattern, entries] of Object.entries(\n object(paths, `typesVersions.${range}`),\n )) {\n if (!Array.isArray(entries))\n throw new Error(`typesVersions.${range}.${pattern} must be an array`);\n mappings.set(\n text(pattern, \"typesVersions pattern\"),\n entries.map((entry: unknown) => text(entry, \"typesVersions path\")),\n );\n }\n result.set(\n text(range, \"typesVersions range\"),\n Object.fromEntries(mappings),\n );\n }\n return Object.fromEntries(result);\n};\n\nconst entryPointKeys = [\n \"type\",\n \"exports\",\n \"main\",\n \"module\",\n \"types\",\n \"typings\",\n \"bin\",\n \"typesVersions\",\n] as const;\n\nexport const publishConfigOverrideKeys = entryPointKeys.filter(\n (key) => key !== \"type\",\n);\n\nconst entryPoints = (value: unknown): EntryPoints => {\n const source = object(value, \"entryPoints\");\n closedKeys(source, entryPointKeys, \"entryPoints\");\n const result: EntryPoints = {};\n if (\"type\" in source) {\n if (source[\"type\"] !== \"module\" && source[\"type\"] !== \"commonjs\")\n throw new Error(\"entryPoints.type must be module or commonjs\");\n result.type = source[\"type\"];\n }\n if (\"exports\" in source)\n result.exports = exportTarget(source[\"exports\"], \"entryPoints.exports\");\n for (const key of [\"main\", \"module\", \"types\", \"typings\"] as const)\n if (key in source) result[key] = text(source[key], `entryPoints.${key}`);\n if (\"bin\" in source)\n result.bin =\n typeof source[\"bin\"] === \"string\"\n ? text(source[\"bin\"], \"entryPoints.bin\")\n : stringMap(source[\"bin\"], \"entryPoints.bin\");\n if (\"typesVersions\" in source)\n result.typesVersions = typesVersions(source[\"typesVersions\"]);\n return result;\n};\n\nconst publishTarget = (value: unknown): PublishTarget => {\n const source = object(value, \"target\");\n if (source[\"type\"] === \"types-only\") {\n closedKeys(source, [\"type\"], \"target\");\n return { type: \"types-only\" };\n }\n if (source[\"type\"] !== \"javascript\")\n throw new Error(\"target.type must be javascript or types-only\");\n closedKeys(source, [\"type\", \"targets\"], \"target\");\n if (!Array.isArray(source[\"targets\"]) || source[\"targets\"].length === 0)\n throw new Error(\"target.targets must be a nonempty array\");\n const targets = Array.from(source[\"targets\"]).map((entry: unknown) => {\n const target = text(entry, \"target.targets\");\n if (\n /[\\s,]/.test(target) ||\n Array.from(target).some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n )\n )\n throw new Error(\n \"target.targets must contain resolved target identifiers\",\n );\n return target;\n });\n return { type: \"javascript\", targets: [...new Set(targets)].sort() };\n};\n\nexport const parsePublishContract = (value: unknown): PublishContract => {\n const source = object(value, \"publish contract\");\n closedKeys(\n source,\n [\"engines\", \"peerDependencies\", \"target\", \"entryPoints\"],\n \"publish contract\",\n );\n return {\n engines: stringMap(source[\"engines\"], \"engines\"),\n peerDependencies: stringMap(source[\"peerDependencies\"], \"peerDependencies\"),\n target: publishTarget(source[\"target\"]),\n entryPoints: entryPoints(source[\"entryPoints\"]),\n };\n};\n\nconst publishPackers = [\"npm\", \"pnpm\"] as const;\nexport type PublishPacker = (typeof publishPackers)[number];\n\ntype ResolveManifestContractOptions = {\n packer: PublishPacker;\n manifest: unknown;\n target: PublishTarget;\n};\n\nexport const resolveManifestContract = ({\n packer,\n manifest,\n target,\n}: ResolveManifestContractOptions): PublishContract => {\n if (!publishPackers.includes(packer))\n throw new Error(\"publish packer must be npm or pnpm\");\n const source = object(manifest, \"package manifest\");\n const config =\n \"publishConfig\" in source\n ? object(source[\"publishConfig\"], \"publishConfig\")\n : {};\n closedKeys(\n config,\n [...publishConfigOverrideKeys, \"access\", \"registry\"],\n \"publishConfig\",\n );\n if (packer === \"npm\")\n for (const key of publishConfigOverrideKeys)\n if (\n Object.hasOwn(config, key) &&\n !(key === \"exports\" || key === \"typesVersions\"\n ? JSON.stringify(config[key]) === JSON.stringify(source[key])\n : isDeepStrictEqual(config[key], source[key]))\n )\n throw new Error(\n `npm pack does not apply differing publishConfig.${key}; move the published entry to package.json or use pnpm`,\n );\n for (const field of [\"browser\", \"esnext\", \"es2015\", \"unpkg\", \"umd:main\"])\n if (Object.hasOwn(source, field) || Object.hasOwn(config, field))\n throw new Error(`published entry field ${field} is unsupported`);\n const published: Record<string, unknown> = {};\n for (const key of entryPointKeys) {\n if (packer === \"pnpm\" && key !== \"type\" && key in config)\n published[key] = config[key];\n else if (key in source) published[key] = source[key];\n }\n if (typeof published[\"bin\"] === \"string\") {\n const name = text(source[\"name\"], \"package name for bin\");\n const command = name.split(\"/\").at(-1);\n if (command === undefined || command === \"\")\n throw new Error(\"package name must determine its bin command\");\n published[\"bin\"] = { [command]: published[\"bin\"] };\n }\n let engines: unknown = {};\n if (Object.hasOwn(source, \"engines\")) engines = source[\"engines\"];\n return parsePublishContract({\n engines,\n peerDependencies: Object.hasOwn(source, \"peerDependencies\")\n ? source[\"peerDependencies\"]\n : {},\n target,\n entryPoints: published,\n });\n};\n\nconst consumerPolicy = (policy: ConsumerPolicy) => {\n closedKeys(\n object(policy, \"consumer policy\"),\n [\"node\", \"typescript\"],\n \"consumer policy\",\n );\n for (const [field, major] of [\n [\"node\", 22],\n [\"typescript\", 6],\n ] as const) {\n const version = parse(policy[field]);\n if (\n version === null ||\n version.version !== policy[field] ||\n version.major !== major ||\n version.prerelease.length !== 0\n )\n throw new Error(\n `consumer policy ${field} must pin an exact stable ${major}.x release`,\n );\n }\n};\n\ntype CheckPublishContractOptions = ResolveManifestContractOptions & {\n contract: unknown;\n policy: ConsumerPolicy;\n};\n\n/** Share the accepted Node target grammar between static and packed checks. */\nexport const publishedNodeTargetSupportsConsumer = ({\n target,\n node,\n}: {\n target: string;\n node: string;\n}) => {\n const match = /^node([1-9]\\d*)(?:\\.(0|[1-9]\\d*))?(?:\\.(0|[1-9]\\d*))?$/i.exec(\n target,\n );\n const version =\n match === null\n ? null\n : parse(`${match[1]}.${match[2] ?? \"0\"}.${match[3] ?? \"0\"}`);\n return version !== null && lte(version, node);\n};\n\nexport const checkPublishContract = ({\n packer,\n manifest,\n target,\n contract,\n policy,\n}: CheckPublishContractOptions) => {\n consumerPolicy(policy);\n const current = resolveManifestContract({ packer, manifest, target });\n const committed = parsePublishContract(contract);\n const diagnostics: PublishContractDiagnostic[] = [];\n const add = (field: string, message: string) =>\n diagnostics.push({ field, message });\n const compare = (field: string, expected: unknown, actual: unknown) => {\n if (\n field !== \"entryPoints.exports\" &&\n field !== \"entryPoints.typesVersions\" &&\n record(expected) &&\n record(actual)\n ) {\n for (const key of new Set([\n ...Object.keys(expected),\n ...Object.keys(actual),\n ]))\n compare(\n `${field}.${key}`,\n Object.hasOwn(expected, key) ? expected[key] : undefined,\n Object.hasOwn(actual, key) ? actual[key] : undefined,\n );\n return;\n }\n if (JSON.stringify(expected) !== JSON.stringify(actual))\n add(field, `published ${field} differs from the committed contract`);\n };\n for (const field of [\n \"engines\",\n \"peerDependencies\",\n \"target\",\n \"entryPoints\",\n ] as const)\n compare(field, committed[field], current[field]);\n const support = (\n field: string,\n range: string | undefined,\n version: string,\n ) => {\n if (range !== undefined && !satisfies(version, range))\n add(field, `${field} must support consumer version ${version}`);\n };\n if (\n !consumerNodeSupportMatches({\n range: current.engines[\"node\"],\n node: policy.node,\n })\n )\n add(\n \"engines.node\",\n `engines.node must support consumer version ${policy.node}`,\n );\n support(\n \"engines.typescript\",\n current.engines[\"typescript\"],\n policy.typescript,\n );\n support(\n \"peerDependencies.typescript\",\n current.peerDependencies[\"typescript\"],\n policy.typescript,\n );\n if (\"bun\" in current.engines)\n add(\"engines.bun\", \"published packages must not require Bun\");\n for (const peer of [\"bun\", \"bun-types\", \"@types/bun\", \"@typescript/native\"])\n if (Object.hasOwn(current.peerDependencies, peer))\n add(\n `peerDependencies.${peer}`,\n \"published packages must not require development runtime or compiler packages\",\n );\n if (current.target.type === \"javascript\")\n for (const selected of current.target.targets) {\n if (/^bun(?:$|[0-9])/i.test(selected)) {\n add(\"target\", \"published JavaScript must not require Bun\");\n continue;\n }\n if (!/^node/i.test(selected)) continue;\n if (\n !publishedNodeTargetSupportsConsumer({\n target: selected,\n node: policy.node,\n })\n )\n add(\n \"target\",\n `JavaScript target ${selected} must support consumer Node ${policy.node}`,\n );\n }\n return diagnostics;\n};\n","import { spawn } from \"node:child_process\";\nimport { once } from \"node:events\";\nimport { createInterface } from \"node:readline\";\n\n// This worker imports only Node builtins. Package code is never loaded.\nconst worker = String.raw`\nimport {createRequire, isBuiltin} from 'node:module';\nimport {readFileSync, existsSync} from 'node:fs';\nimport path from 'node:path';\nimport {pathToFileURL} from 'node:url';\nimport {createInterface} from 'node:readline';\nconst selfReference = (specifier, file) => {\n let directory = path.dirname(file);\n while (true) {\n const manifest = path.join(directory, 'package.json');\n if (existsSync(manifest)) {\n const {name} = JSON.parse(readFileSync(manifest, 'utf8'));\n return typeof name === 'string' &&\n (specifier === name || specifier.startsWith(name + '/'));\n }\n const parent = path.dirname(directory);\n if (parent === directory) return false;\n directory = parent;\n }\n};\nconst bare = specifier => typeof specifier === 'string' &&\n !specifier.startsWith('.') && !specifier.startsWith('/') &&\n !specifier.startsWith('#') && !specifier.includes(':');\nfor await (const line of createInterface({input: process.stdin})) {\n const {specifier, file, mode} = JSON.parse(line);\n try {\n const resolved = mode === 'require'\n ? createRequire(file).resolve(specifier)\n : import.meta.resolve(specifier, pathToFileURL(file).href);\n console.log(JSON.stringify({url: isBuiltin(resolved) ||\n (bare(specifier) && !selfReference(specifier, file)) ? null :\n mode === 'require' ? pathToFileURL(resolved).href : resolved}));\n } catch (error) {\n // Node reports the selected missing dependency, including external #imports\n // targets. Never reinterpret its exports/imports selection ourselves.\n const missing = /^Cannot find (?:package|module) '([^']+)'/.exec(error.message)?.[1];\n if (bare(missing) && !selfReference(missing, file) &&\n ['MODULE_NOT_FOUND', 'ERR_MODULE_NOT_FOUND'].includes(error.code))\n console.log(JSON.stringify({url: null}));\n else console.log(JSON.stringify({error: String(error)}));\n }\n}\n`;\n\ntype NodeResolution = {\n specifier: string;\n file: string;\n mode: \"import\" | \"require\";\n};\n\n/** One metadata-only Node process per archive, with default import/require conditions. */\nexport const createPackedNodeResolver = () => {\n const child = spawn(\n \"node\",\n [\n \"--experimental-import-meta-resolve\",\n \"--input-type=module\",\n \"--eval\",\n worker,\n ],\n {\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n env: { ...process.env, NODE_OPTIONS: undefined, NODE_PATH: undefined },\n },\n );\n let stderr = \"\";\n child.stderr.setEncoding(\"utf8\");\n child.stderr.on(\"data\", (chunk: string) => {\n if (stderr.length < 16_384) stderr += chunk;\n });\n child.on(\"error\", (error) => child.stdout.destroy(error));\n const output = createInterface({ input: child.stdout });\n const lines = output[Symbol.asyncIterator]();\n return {\n resolve: async (request: NodeResolution) => {\n const timeout = setTimeout(() => child.kill(), 10_000);\n try {\n child.stdin.write(`${JSON.stringify(request)}\\n`);\n const line = await lines.next();\n if (line.done === true)\n throw new Error(`Node resolver stopped: ${stderr}`);\n const response: unknown = JSON.parse(line.value);\n if (typeof response !== \"object\" || response === null)\n throw new Error(\"Invalid Node resolver response\");\n if (\"error\" in response && typeof response.error === \"string\")\n throw new Error(response.error);\n if (\n !(\"url\" in response) ||\n (response.url !== null && typeof response.url !== \"string\")\n )\n throw new Error(\"Invalid Node resolver URL\");\n return response.url;\n } finally {\n clearTimeout(timeout);\n }\n },\n close: async () => {\n output.close();\n if (\n child.pid !== undefined &&\n child.exitCode === null &&\n child.signalCode === null\n ) {\n const exited = once(child, \"exit\");\n child.kill();\n await exited;\n }\n },\n };\n};\n","import { mkdir, mkdtemp, realpath, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { packageMode, parseArtifactSource } from \"./publish-artifact-parser\";\nimport { createPackedNodeResolver } from \"./publish-node-resolver\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst javascript = /\\.(?:js|mjs|cjs)$/iu;\nconst opaque = /\\.(?:json|node)$/u;\nconst declarationFile = /\\.d\\.[cm]?ts$/iu;\n\ntype PackedRuntimeImportsOptions = {\n members: ReadonlySet<string>;\n readSource: (file: string) => Promise<string>;\n assertRegular: (file: string) => Promise<void>;\n};\n\nconst packagePath = (file: string) => {\n const normalized = path.posix.normalize(file);\n if (\n (normalized !== \"package\" && !normalized.startsWith(\"package/\")) ||\n file.includes(\"\\\\\")\n )\n throw new Error(`Runtime import escapes the packed package: ${file}`);\n return normalized;\n};\n\nconst targets = (value: unknown): string[] => {\n if (typeof value === \"string\") return [value];\n if (value === undefined || value === null) return [];\n if (Array.isArray(value)) return value.flatMap(targets);\n if (!record(value)) throw new Error(\"Invalid packed runtime entry target\");\n return Object.entries(value).flatMap(([key, entry]) =>\n key === \"types\" || key === \"typings\" ? [] : targets(entry),\n );\n};\n\nconst identifier = (value: unknown) =>\n record(value) &&\n value[\"type\"] === \"Identifier\" &&\n typeof value[\"name\"] === \"string\"\n ? value[\"name\"]\n : undefined;\nconst literal = (value: unknown) =>\n record(value) &&\n value[\"type\"] === \"Literal\" &&\n typeof value[\"value\"] === \"string\"\n ? value[\"value\"]\n : undefined;\nconst nodes = (value: unknown): Record<string, unknown>[] => {\n if (Array.isArray(value)) return value.flatMap(nodes);\n return record(value) && typeof value[\"type\"] === \"string\" ? [value] : [];\n};\nconst children = (node: Record<string, unknown>) =>\n Object.values(node).flatMap(nodes);\nconst patternNames = (value: unknown): string[] => {\n const name = identifier(value);\n if (name !== undefined) return [name];\n if (!record(value)) return [];\n switch (value[\"type\"]) {\n case \"ObjectPattern\":\n return nodes(value[\"properties\"]).flatMap((property) =>\n patternNames(\n property[\"type\"] === \"RestElement\"\n ? property[\"argument\"]\n : property[\"value\"],\n ),\n );\n case \"ArrayPattern\":\n return nodes(value[\"elements\"]).flatMap(patternNames);\n case \"RestElement\":\n return patternNames(value[\"argument\"]);\n case \"AssignmentPattern\":\n return patternNames(value[\"left\"]);\n default:\n return [];\n }\n};\ntype Binding =\n \"other\" | \"require\" | \"factory\" | \"module\" | \"module-api\" | \"filename\";\ntype Scope = Map<string, Binding>;\nconst bindingScope = (scopes: readonly Scope[], name: string) =>\n scopes.findLast((scope) => scope.has(name));\nconst binding = (scopes: readonly Scope[], name: string) =>\n bindingScope(scopes, name)?.get(name);\nconst memberName = (value: Record<string, unknown>) =>\n value[\"computed\"] === true\n ? literal(value[\"property\"])\n : identifier(value[\"property\"]);\nconst loaderBinding = (\n value: unknown,\n scopes: readonly Scope[],\n): Binding | undefined => {\n const name = identifier(value);\n if (name !== undefined) {\n const resolved = binding(scopes, name);\n return resolved === \"filename\" ? \"other\" : resolved;\n }\n if (!record(value) || value[\"type\"] !== \"MemberExpression\") return undefined;\n const owner = identifier(value[\"object\"]);\n if (owner === undefined) return undefined;\n const kind = binding(scopes, owner);\n const property = memberName(value);\n if (kind === \"module-api\" && property === \"createRequire\") return \"factory\";\n if (kind === \"module\" && property === \"require\") return \"require\";\n if (kind === \"require\" && property === \"resolve\") return \"require\";\n return undefined;\n};\nconst scopeDeclarations = (\n node: Record<string, unknown>,\n): Record<string, unknown>[] => {\n if (\n (node[\"type\"] === \"ExportNamedDeclaration\" ||\n node[\"type\"] === \"ExportDefaultDeclaration\") &&\n record(node[\"declaration\"])\n )\n return scopeDeclarations(node[\"declaration\"]);\n return [node];\n};\nconst functionNode = (node: Record<string, unknown>) =>\n [\n \"FunctionDeclaration\",\n \"FunctionExpression\",\n \"ArrowFunctionExpression\",\n ].includes(String(node[\"type\"]));\n\ntype StaticImport = { specifier: string; mode: \"import\" | \"require\" };\n/** Read syntax only; known loaders must have statically resolvable bindings. */\nconst staticImports = (\n tree: unknown,\n mode: \"script\" | \"module\",\n): StaticImport[] => {\n const result: StaticImport[] = [];\n const functionScopes = new WeakMap<Scope, \"wrapper\" | \"function\">();\n const resolvedFactories = new Set<Record<string, unknown>>();\n const resolvedNamespaces = new Set<Record<string, unknown>>();\n const allowedLoaderReferences = new Set<Record<string, unknown>>();\n const allowReference = (value: unknown) => {\n for (const node of nodes(value)) {\n allowedLoaderReferences.add(node);\n for (const child of children(node)) allowReference(child);\n }\n };\n const allowPattern = (value: unknown) => {\n if (!record(value)) return;\n if (value[\"type\"] === \"Identifier\") allowedLoaderReferences.add(value);\n else if (value[\"type\"] === \"Property\") allowPattern(value[\"value\"]);\n else if (value[\"type\"] === \"AssignmentPattern\") allowPattern(value[\"left\"]);\n else if (value[\"type\"] === \"RestElement\") allowPattern(value[\"argument\"]);\n else if ([\"ObjectPattern\", \"ArrayPattern\"].includes(String(value[\"type\"])))\n for (const child of children(value)) allowPattern(child);\n };\n const unresolvable = (description: string) =>\n new Error(`Unresolvable dynamic loader: ${description}`);\n const loaderName = (name: string, scopes: readonly Scope[]) => {\n const previous = binding(scopes, name);\n return (\n (mode === \"script\" &&\n [\"require\", \"module\", \"createRequire\"].includes(name)) ||\n (previous !== undefined &&\n previous !== \"other\" &&\n previous !== \"filename\")\n );\n };\n const loaderValue = (value: unknown, scopes: readonly Scope[]): boolean => {\n if (!record(value)) return false;\n const kind = loaderBinding(value, scopes);\n if (kind !== undefined && kind !== \"other\") return true;\n if (\n functionNode(value) ||\n [\n \"CallExpression\",\n \"MemberExpression\",\n \"UnaryExpression\",\n \"BinaryExpression\",\n \"TemplateLiteral\",\n ].includes(String(value[\"type\"]))\n )\n return false;\n if (value[\"type\"] === \"Property\")\n return loaderValue(value[\"value\"], scopes);\n return children(value).some((child) => loaderValue(child, scopes));\n };\n const exportedLoader = (\n value: unknown,\n scopes: readonly Scope[],\n ): boolean => {\n if (!record(value) || functionNode(value)) return false;\n if (loaderValue(value, scopes)) return true;\n if (value[\"type\"] === \"CallExpression\") {\n const callee = loaderBinding(value[\"callee\"], scopes);\n return (\n callee === \"factory\" ||\n (callee === \"require\" &&\n [\"node:module\", \"module\"].includes(\n literal(nodes(value[\"arguments\"]).at(0)) ?? \"\",\n ))\n );\n }\n if (value[\"type\"] === \"Property\")\n return exportedLoader(value[\"value\"], scopes);\n if (\n [\n \"ObjectExpression\",\n \"ArrayExpression\",\n \"ConditionalExpression\",\n \"LogicalExpression\",\n \"SequenceExpression\",\n ].includes(String(value[\"type\"]))\n )\n return children(value).some((child) => exportedLoader(child, scopes));\n return false;\n };\n const unsupportedPropagation = () =>\n unresolvable(\"unsupported loader propagation across module exports\");\n const walk = (\n node: Record<string, unknown>,\n scopes: readonly Scope[],\n parent?: Record<string, unknown>,\n ) => {\n const kind = node[\"type\"];\n if (\n kind === \"Program\" ||\n kind === \"BlockStatement\" ||\n functionNode(node) ||\n kind === \"CatchClause\" ||\n kind === \"ForStatement\" ||\n kind === \"ForOfStatement\" ||\n kind === \"ForInStatement\"\n ) {\n const local: Scope = new Map();\n const bind = (pattern: unknown) => {\n allowPattern(pattern);\n for (const name of patternNames(pattern)) {\n if (loaderName(name, scopes))\n throw unresolvable(`unsupported loader binding: ${name}`);\n local.set(name, \"other\");\n }\n };\n const bindVariable = (\n entry: Record<string, unknown>,\n declarationKind: unknown,\n ) => {\n if (\n declarationKind === \"var\" &&\n node[\"type\"] === \"BlockStatement\" &&\n node !== root\n )\n return;\n allowPattern(entry[\"id\"]);\n for (const name of patternNames(entry[\"id\"])) {\n // An uninitialized var redeclares, but does not replace, a CJS parameter.\n if (\n mode === \"script\" &&\n node === root &&\n declarationKind === \"var\" &&\n entry[\"init\"] === null &&\n (name === \"require\" || name === \"module\")\n )\n continue;\n local.set(name, \"other\");\n }\n };\n if (functionNode(node)) {\n if (kind !== \"ArrowFunctionExpression\")\n functionScopes.set(local, \"function\");\n bind(node[\"id\"]);\n for (const parameter of nodes(node[\"params\"])) bind(parameter);\n }\n if (kind === \"CatchClause\") bind(node[\"param\"]);\n if (\n kind === \"ArrowFunctionExpression\" &&\n record(node[\"body\"]) &&\n node[\"body\"][\"type\"] !== \"BlockStatement\" &&\n loaderValue(node[\"body\"], [...scopes, local])\n )\n throw unresolvable(\"loader returned through an unsupported function\");\n const statements =\n kind === \"Program\" || kind === \"BlockStatement\"\n ? nodes(node[\"body\"]).flatMap(scopeDeclarations)\n : children(node).flatMap(scopeDeclarations);\n const declarations: Record<string, unknown>[] = [];\n for (const statement of statements) {\n if (statement[\"type\"] === \"VariableDeclaration\") {\n for (const entry of nodes(statement[\"declarations\"])) {\n bindVariable(entry, statement[\"kind\"]);\n declarations.push(entry);\n }\n } else if (\n statement[\"type\"] === \"FunctionDeclaration\" ||\n statement[\"type\"] === \"ClassDeclaration\"\n )\n bind(statement[\"id\"]);\n else if (statement[\"type\"] === \"ImportDeclaration\") {\n allowReference(statement[\"specifiers\"]);\n const moduleImport = [\"node:module\", \"module\"].includes(\n literal(statement[\"source\"]) ?? \"\",\n );\n const specifiers = nodes(statement[\"specifiers\"]);\n if (moduleImport && specifiers.length === 0)\n throw unresolvable(\n \"module import needs recognized static bindings\",\n );\n for (const specifier of specifiers) {\n const name = identifier(specifier[\"local\"]);\n if (name === undefined)\n throw unresolvable(\n \"import binding cannot be resolved statically\",\n );\n if (!moduleImport) {\n local.set(name, \"other\");\n continue;\n }\n const imported =\n identifier(specifier[\"imported\"]) ??\n literal(specifier[\"imported\"]);\n if (imported === \"createRequire\") local.set(name, \"factory\");\n else if (\n [\"ImportDefaultSpecifier\", \"ImportNamespaceSpecifier\"].includes(\n String(specifier[\"type\"]),\n ) ||\n imported === \"Module\" ||\n imported === \"default\"\n )\n local.set(name, \"module-api\");\n else throw unresolvable(\"unsupported node:module import binding\");\n }\n }\n }\n // `var` declarations shadow throughout their function, including nested blocks.\n if (functionNode(node) || kind === \"Program\" || node === root) {\n const hoisted = (entry: Record<string, unknown>) => {\n if (functionNode(entry)) return;\n if (\n entry[\"type\"] === \"VariableDeclaration\" &&\n entry[\"kind\"] === \"var\"\n )\n for (const declaration of nodes(entry[\"declarations\"])) {\n bindVariable(declaration, \"var\");\n if (!declarations.includes(declaration))\n declarations.push(declaration);\n }\n for (const child of children(entry)) hoisted(child);\n };\n for (const statement of statements) hoisted(statement);\n }\n const nested = [...scopes, local];\n let changed = true;\n const assign = (name: string, value: Binding) => {\n const owner = bindingScope(nested, name);\n if (owner === undefined)\n throw unresolvable(\"loader declaration has no owning scope\");\n if (owner.get(name) === value) return;\n if (owner.get(name) !== \"other\")\n throw unresolvable(\"conflicting loader binding declarations\");\n owner.set(name, value);\n changed = true;\n };\n while (changed) {\n changed = false;\n for (const entry of declarations) {\n const name = identifier(entry[\"id\"]);\n const initial = entry[\"init\"];\n if (!record(initial)) continue;\n const alias = loaderBinding(initial, nested);\n const nodeModule =\n initial[\"type\"] === \"CallExpression\" &&\n loaderBinding(initial[\"callee\"], nested) === \"require\" &&\n [\"node:module\", \"module\"].includes(\n literal(nodes(initial[\"arguments\"]).at(0)) ?? \"\",\n );\n if (\n (nodeModule || alias === \"module-api\") &&\n record(entry[\"id\"]) &&\n entry[\"id\"][\"type\"] === \"ObjectPattern\"\n ) {\n for (const property of nodes(entry[\"id\"][\"properties\"])) {\n const key =\n property[\"computed\"] === true\n ? literal(property[\"key\"])\n : (identifier(property[\"key\"]) ?? literal(property[\"key\"]));\n if (property[\"type\"] === \"RestElement\" || key === undefined)\n throw unresolvable(\n \"module loader destructuring cannot be resolved statically\",\n );\n const factoryName = identifier(property[\"value\"]);\n if (\n key === \"createRequire\" ||\n key === \"Module\" ||\n key === \"default\"\n ) {\n if (factoryName === undefined)\n throw unresolvable(\n \"module loader binding pattern cannot be resolved statically\",\n );\n assign(\n factoryName,\n key === \"createRequire\" ? \"factory\" : \"module-api\",\n );\n } else\n throw unresolvable(\n \"unsupported module namespace destructuring\",\n );\n }\n } else if (\n name === undefined &&\n alias !== undefined &&\n alias !== \"other\"\n ) {\n throw unresolvable(\n \"loader destructuring cannot be resolved statically\",\n );\n }\n if (nodeModule) resolvedNamespaces.add(initial);\n if (alias !== undefined && alias !== \"other\") allowReference(initial);\n if (name === undefined) continue;\n if (alias !== undefined && alias !== \"other\") assign(name, alias);\n if (nodeModule) assign(name, \"module-api\");\n if (\n initial[\"type\"] === \"CallExpression\" &&\n loaderBinding(initial[\"callee\"], nested) === \"factory\"\n ) {\n const argument = nodes(initial[\"arguments\"]).at(0);\n const object = argument?.[\"object\"];\n const importMeta =\n record(object) &&\n object[\"type\"] === \"MetaProperty\" &&\n identifier(object[\"meta\"]) === \"import\" &&\n identifier(object[\"property\"]) === \"meta\";\n if (\n nodes(initial[\"arguments\"]).length !== 1 ||\n !(\n (identifier(argument) === \"__filename\" &&\n binding(nested, \"__filename\") === \"filename\") ||\n (argument?.[\"type\"] === \"MemberExpression\" &&\n argument[\"computed\"] === false &&\n importMeta &&\n identifier(argument[\"property\"]) === \"url\")\n )\n )\n throw unresolvable(\n \"createRequire needs import.meta.url or __filename\",\n );\n assign(name, \"require\");\n resolvedFactories.add(initial);\n }\n }\n }\n for (const entry of declarations) {\n const initial = entry[\"init\"];\n for (const name of patternNames(entry[\"id\"])) {\n if (loaderName(name, scopes) && binding(nested, name) === \"other\")\n throw unresolvable(`unknown loader declaration: ${name}`);\n const resolved = binding(nested, name);\n const source = loaderBinding(initial, nested);\n if (\n initial !== null &&\n resolved !== undefined &&\n resolved !== \"other\" &&\n (source === undefined || source === \"other\") &&\n (!record(initial) ||\n (!resolvedFactories.has(initial) &&\n !resolvedNamespaces.has(initial)))\n )\n throw unresolvable(`unknown loader initializer: ${name}`);\n }\n if (\n loaderBinding(initial, nested) === undefined &&\n loaderValue(initial, nested)\n )\n throw unresolvable(\n \"binding initializer cannot be resolved statically\",\n );\n }\n for (const child of children(node)) walk(child, nested, node);\n return;\n }\n if (\n kind === \"ExportDefaultDeclaration\" &&\n exportedLoader(node[\"declaration\"], scopes)\n )\n throw unsupportedPropagation();\n if (kind === \"ExportNamedDeclaration\") {\n const declaration = node[\"declaration\"];\n if (record(declaration) && declaration[\"type\"] === \"VariableDeclaration\")\n for (const entry of nodes(declaration[\"declarations\"])) {\n if (\n patternNames(entry[\"id\"]).some((name) => {\n const resolved = binding(scopes, name);\n return (\n resolved !== undefined &&\n resolved !== \"other\" &&\n resolved !== \"filename\"\n );\n }) ||\n exportedLoader(entry[\"init\"], scopes)\n )\n throw unsupportedPropagation();\n }\n if (literal(node[\"source\"]) === undefined)\n for (const specifier of nodes(node[\"specifiers\"]))\n if (exportedLoader(specifier[\"local\"], scopes))\n throw unsupportedPropagation();\n // Exported names and source re-export names are not lexical references.\n // All actual local bindings were checked before granting this permission.\n allowReference(node[\"specifiers\"]);\n }\n if (\n kind === \"ImportDeclaration\" ||\n kind === \"ExportNamedDeclaration\" ||\n kind === \"ExportAllDeclaration\"\n ) {\n const specifier = literal(node[\"source\"]);\n if (\n kind !== \"ImportDeclaration\" &&\n [\"node:module\", \"module\"].includes(specifier ?? \"\")\n )\n throw unsupportedPropagation();\n if (specifier !== undefined) result.push({ specifier, mode: \"import\" });\n }\n if (kind === \"ImportExpression\") {\n const specifier = literal(node[\"source\"]);\n if (specifier === undefined)\n throw unresolvable(\"dynamic import needs a literal module specifier\");\n if ([\"node:module\", \"module\"].includes(specifier))\n throw unresolvable(\"dynamic module namespace imports are unsupported\");\n result.push({ specifier, mode: \"import\" });\n }\n if (kind === \"CallExpression\") {\n const callee = node[\"callee\"];\n const resolved = loaderBinding(callee, scopes);\n const specifier = literal(nodes(node[\"arguments\"]).at(0));\n if (resolved === \"require\") {\n if (specifier === undefined || nodes(node[\"arguments\"]).length !== 1)\n throw unresolvable(\n \"require/resolve needs one literal module specifier\",\n );\n allowReference(callee);\n if (\n [\"node:module\", \"module\"].includes(specifier) &&\n !resolvedNamespaces.has(node)\n )\n throw unresolvable(\n \"module namespace needs a resolvable local binding\",\n );\n result.push({ specifier, mode: \"require\" });\n }\n if (resolved === \"factory\") {\n if (!resolvedFactories.has(node))\n throw unresolvable(\n \"createRequire result needs a resolvable local binding\",\n );\n allowReference(callee);\n }\n if (\n record(callee) &&\n callee[\"type\"] === \"MemberExpression\" &&\n [\"require\", \"factory\"].includes(\n loaderBinding(callee[\"object\"], scopes) ?? \"\",\n ) &&\n resolved === undefined\n )\n throw unresolvable(\"loader method cannot be resolved statically\");\n if (\n resolved !== \"require\" &&\n resolved !== \"factory\" &&\n nodes(node[\"arguments\"]).some((argument) =>\n loaderValue(argument, scopes),\n )\n )\n throw unresolvable(\"loader passed through an unsupported call\");\n }\n if (kind === \"AssignmentExpression\") {\n const assigned = loaderBinding(node[\"right\"], scopes);\n if (\n exportedLoader(node[\"right\"], scopes) &&\n (node[\"operator\"] !== \"=\" ||\n loaderBinding(node[\"left\"], scopes) !== assigned ||\n assigned === undefined)\n )\n throw unsupportedPropagation();\n for (const name of patternNames(node[\"left\"])) {\n const previous = binding(scopes, name);\n if (\n loaderName(name, scopes) &&\n (previous === undefined || previous === \"other\")\n )\n throw unresolvable(`unknown loader assignment: ${name}`);\n if (\n previous !== undefined &&\n previous !== \"other\" &&\n (node[\"operator\"] !== \"=\" ||\n loaderBinding(node[\"right\"], scopes) !== previous)\n )\n throw unresolvable(\n \"loader reassignment cannot be resolved statically\",\n );\n }\n }\n if (kind === \"ReturnStatement\" && loaderValue(node[\"argument\"], scopes))\n throw unresolvable(\"loader returned through an unsupported function\");\n // Only the recognized static forms grant permission to reference a loader.\n const nonReference =\n parent !== undefined &&\n ((parent[\"type\"] === \"MemberExpression\" &&\n parent[\"computed\"] === false &&\n parent[\"property\"] === node) ||\n ([\"Property\", \"MethodDefinition\", \"PropertyDefinition\"].includes(\n String(parent[\"type\"]),\n ) &&\n parent[\"computed\"] === false &&\n parent[\"key\"] === node &&\n parent[\"value\"] !== node));\n const reference = loaderBinding(node, scopes);\n const name = identifier(node);\n if (!nonReference && !allowedLoaderReferences.has(node)) {\n const owner = scopes.findLast((scope) => functionScopes.has(scope));\n if (\n (name === \"arguments\" &&\n owner !== undefined &&\n functionScopes.get(owner) === \"wrapper\") ||\n name === \"eval\" ||\n name === \"Function\"\n )\n throw unresolvable(`unsupported dynamic loader escape: ${name}`);\n }\n if (kind === \"MemberExpression\") {\n const owner = identifier(node[\"object\"]);\n const property = memberName(node);\n const ownerBinding = loaderBinding(node[\"object\"], scopes);\n if (\n (ownerBinding === \"module\" &&\n (property === \"constructor\" || property === \"require\")) ||\n (ownerBinding === \"require\" &&\n [\"cache\", \"extensions\", \"main\"].includes(property ?? \"\")) ||\n (owner === \"process\" && property === \"mainModule\") ||\n ((owner === \"globalThis\" || owner === \"global\") &&\n [\"require\", \"eval\", \"Function\"].includes(property ?? \"\"))\n )\n throw unresolvable(\"unsupported dynamic loader escape property\");\n }\n if (\n name !== undefined &&\n loaderName(name, scopes) &&\n (reference === undefined || reference === \"other\") &&\n !nonReference &&\n !allowedLoaderReferences.has(node)\n )\n throw unresolvable(`unknown loader reference: ${name}`);\n const moduleExports =\n reference === \"module\" &&\n parent?.[\"type\"] === \"MemberExpression\" &&\n parent[\"object\"] === node &&\n memberName(parent) === \"exports\";\n if (\n reference !== undefined &&\n reference !== \"other\" &&\n !moduleExports &&\n !nonReference &&\n !allowedLoaderReferences.has(node)\n )\n throw unresolvable(\"loader reference is not a recognized static form\");\n for (const child of children(node)) walk(child, scopes, node);\n };\n const root = nodes(tree).at(0);\n if (root !== undefined) {\n const wrapper: Scope = new Map();\n if (mode === \"script\") {\n wrapper.set(\"require\", \"require\");\n wrapper.set(\"module\", \"module\");\n wrapper.set(\"__filename\", \"filename\");\n functionScopes.set(wrapper, \"wrapper\");\n }\n walk(root, [wrapper]);\n }\n return result;\n};\n\n/** Validate the static local runtime closure against regular packed members. */\nexport const assertPackedRuntimeImports = async ({\n members,\n readSource,\n assertRegular,\n}: PackedRuntimeImportsOptions) => {\n const files = new Map<string, string>();\n const read = async (file: string) => {\n if (!members.has(file))\n throw new Error(`Missing packed runtime file: ${file}`);\n await assertRegular(file);\n const cached = files.get(file);\n if (cached !== undefined) return cached;\n const source = await readSource(file);\n files.set(file, source);\n return source;\n };\n const manifest = async (file: string) => {\n const value: unknown = JSON.parse(await read(file));\n if (!record(value)) throw new Error(`Invalid packed manifest: ${file}`);\n return value;\n };\n const scratch = await realpath(\n await mkdtemp(path.join(tmpdir(), \"packed-node-resolution-\")),\n );\n const resolver = createPackedNodeResolver();\n try {\n // Recreate the archive's existence index without extracting paths or links.\n // Node reads manifest contents; other members are byte-free placeholders.\n // Every selected target is still validated as a regular archive member.\n for (const file of members) {\n const directory = file.endsWith(\"/\");\n const member = directory ? file.slice(0, -1) : file;\n if (packagePath(member) !== member)\n throw new Error(`Invalid packed member path: ${file}`);\n const destination = path.join(scratch, member);\n if (directory) {\n await mkdir(destination, { recursive: true });\n continue;\n }\n await mkdir(path.dirname(destination), { recursive: true });\n await writeFile(\n destination,\n path.posix.basename(file) === \"package.json\" ? await read(file) : \"\",\n );\n }\n // External dependencies are outside the archive closure. Give Node inert\n // metadata for bare #imports targets so it can select the exact runtime\n // condition without requiring a dependency install or executing packages.\n const externalFiles = new Set<string>();\n for (const file of members) {\n if (path.posix.basename(file) !== \"package.json\") continue;\n const owner = await manifest(file);\n for (const target of targets(owner[\"imports\"])) {\n if (\n target.startsWith(\".\") ||\n target.startsWith(\"#\") ||\n target.includes(\":\")\n )\n continue;\n const parts = target.split(\"/\");\n const name = target.startsWith(\"@\")\n ? parts.slice(0, 2).join(\"/\")\n : parts.at(0);\n if (\n name === undefined ||\n !/^(?:@[a-z0-9._~-]+\\/)?[a-z0-9._~-]+$/iu.test(name) ||\n name.split(\"/\").some((part) => part === \".\" || part === \"..\")\n )\n throw new Error(`Unsupported external import mapping: ${target}`);\n if (name === owner[\"name\"]) continue;\n const directory = path.join(scratch, \"node_modules\", name);\n await mkdir(directory, { recursive: true });\n await writeFile(\n path.join(directory, \"package.json\"),\n JSON.stringify({\n name,\n exports: { \".\": \"./external.cjs\", \"./*\": \"./external.cjs\" },\n }),\n );\n const entry = path.join(directory, \"external.cjs\");\n await writeFile(entry, \"\");\n externalFiles.add(entry);\n }\n }\n const resolveImport = async ({\n specifier,\n mode,\n importer,\n }: StaticImport & { importer: string }): Promise<string[]> => {\n let resolved: string | null;\n try {\n resolved = await resolver.resolve({\n specifier,\n mode,\n file: path.join(scratch, importer),\n });\n } catch (error) {\n throw new Error(\n `Missing packed runtime import: ${importer} -> ${specifier}: ${String(error)}`,\n { cause: error },\n );\n }\n if (resolved === null) return [];\n const url = new URL(resolved);\n if (url.protocol !== \"file:\")\n throw new Error(`Unsupported packed runtime URL: ${resolved}`);\n const destination = fileURLToPath(url);\n if (externalFiles.has(destination)) return [];\n const file = packagePath(\n path.relative(scratch, destination).split(path.sep).join(\"/\"),\n );\n if (!members.has(file))\n throw new Error(\n `Missing packed runtime import: ${importer} -> ${specifier} (${file})`,\n );\n return [file];\n };\n for (const file of members)\n if (path.posix.basename(file) === \"package.json\") await manifest(file);\n const root = await manifest(\"package/package.json\");\n const pending = [...members].filter((file) => javascript.test(file));\n const scripts = new Set(pending);\n const bin = root[\"bin\"];\n const bins: unknown[] = [];\n if (typeof bin === \"string\") bins.push(bin);\n else if (record(bin)) bins.push(...Object.values(bin));\n else if (bin !== undefined)\n throw new Error(\"Invalid packed bin declaration\");\n for (const entry of bins) {\n if (\n typeof entry !== \"string\" ||\n entry === \"\" ||\n path.posix.isAbsolute(entry) ||\n entry.includes(\"\\\\\")\n )\n throw new Error(\"Invalid packed bin entry\");\n const file = packagePath(path.posix.join(\"package\", entry));\n scripts.add(file);\n pending.push(file);\n }\n const addEntry = (entry: string, mode: \"file\" | \"url\") => {\n if (declarationFile.test(entry)) return;\n if (path.posix.isAbsolute(entry) || entry.includes(\"\\\\\"))\n throw new Error(`Runtime entry escapes the packed package: ${entry}`);\n if (mode === \"url\" && /%2f|%5c/iu.test(entry))\n throw new Error(`Invalid packed entry URL: ${entry}`);\n const file = packagePath(\n mode === \"url\"\n ? fileURLToPath(new URL(entry, \"file:///package/package.json\")).slice(\n 1,\n )\n : path.posix.join(\"package\", entry),\n );\n if (!file.includes(\"*\")) {\n if (javascript.test(file) || path.posix.extname(file) === \"\")\n scripts.add(file);\n pending.push(file);\n return;\n }\n const [prefix, suffix] = file.split(\"*\");\n if (\n prefix === undefined ||\n suffix === undefined ||\n file.split(\"*\").length !== 2\n )\n throw new Error(`Unsupported packed entry pattern: ${entry}`);\n const matches = [...members].filter(\n (candidate) =>\n !candidate.endsWith(\"/\") &&\n candidate.length >= prefix.length + suffix.length &&\n candidate.startsWith(prefix) &&\n candidate.endsWith(suffix),\n );\n if (matches.length === 0)\n throw new Error(`Missing packed runtime entry pattern: ${entry}`);\n for (const match of matches)\n if (javascript.test(match)) scripts.add(match);\n pending.push(...matches);\n };\n for (const target of targets(root[\"module\"])) addEntry(target, \"file\");\n for (const target of targets(root[\"exports\"])) addEntry(target, \"url\");\n if (root[\"main\"] !== undefined) {\n const entry = root[\"main\"];\n if (\n typeof entry !== \"string\" ||\n path.posix.isAbsolute(entry) ||\n entry.includes(\"\\\\\")\n )\n throw new Error(\"Invalid packed main entry\");\n if (!declarationFile.test(entry)) {\n const resolved = (\n await resolveImport({\n specifier: \"./package\",\n mode: \"require\",\n importer: \"entry.cjs\",\n })\n ).at(0);\n if (resolved === undefined)\n throw new Error(`Missing packed runtime main: ${entry}`);\n if (!opaque.test(resolved)) scripts.add(resolved);\n pending.push(resolved);\n }\n }\n const validated = new Set<string>();\n const traversed = new Set<string>();\n while (pending.length > 0) {\n const file = pending.pop();\n if (file === undefined) continue;\n if (!validated.has(file)) {\n if (!members.has(file))\n throw new Error(`Missing packed runtime file: ${file}`);\n await assertRegular(file);\n validated.add(file);\n }\n if (!scripts.has(file) || traversed.has(file)) continue;\n traversed.add(file);\n const source = await read(file);\n let mode: ReturnType<typeof packageMode>;\n if (/\\.mjs$/iu.test(file)) mode = \"module\";\n else if (/\\.cjs$/iu.test(file)) mode = \"script\";\n else mode = packageMode(files, file);\n const parse = (sourceType: \"script\" | \"module\") => {\n try {\n const tree = parseArtifactSource(source, {\n ecmaVersion: \"latest\",\n sourceType,\n allowHashBang: true,\n allowReturnOutsideFunction: sourceType === \"script\",\n });\n // The shared parser wraps CommonJS. Its require parameter is the runtime loader.\n if (sourceType === \"script\") {\n const statement = tree.body.at(0);\n if (\n statement?.type === \"ExpressionStatement\" &&\n statement.expression.type === \"FunctionExpression\"\n )\n return { tree: statement.expression.body, mode: sourceType };\n }\n return { tree, mode: sourceType };\n } catch (error) {\n if (!(error instanceof SyntaxError)) throw error;\n throw new SyntaxError(\n `Packed runtime import syntax ${file}: ${error.message}`,\n { cause: error },\n );\n }\n };\n let parsed: ReturnType<typeof parse>;\n if (mode === \"detect\") {\n try {\n parsed = parse(\"script\");\n } catch {\n parsed = parse(\"module\");\n }\n } else parsed = parse(mode);\n let dependencies: StaticImport[];\n try {\n dependencies = staticImports(parsed.tree, parsed.mode);\n } catch (error) {\n throw new Error(`Packed runtime imports ${file}: ${String(error)}`, {\n cause: error,\n });\n }\n for (const dependency of dependencies) {\n const resolved = await resolveImport({\n ...dependency,\n importer: file,\n });\n for (const target of resolved) {\n if (\n javascript.test(target) ||\n path.posix.extname(target) === \"\" ||\n (dependency.mode === \"require\" && !opaque.test(target))\n )\n scripts.add(target);\n pending.push(target);\n }\n }\n }\n } finally {\n try {\n await resolver.close();\n } finally {\n await rm(scratch, { recursive: true, force: true });\n }\n }\n};\n","import type { Options } from \"acorn\";\nimport { execFile } from \"node:child_process\";\nimport { mkdir, mkdtemp, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport { promisify } from \"node:util\";\n\nimport { packageMode, parseArtifactSource } from \"./publish-artifact-parser\";\nimport {\n publishedNodeTargetSupportsConsumer,\n type PublishTarget,\n} from \"./publish-contract\";\nimport { assertPackedRuntimeImports } from \"./publish-runtime-imports\";\n\nconst command = promisify(execFile);\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst javascript = /\\.(?:js|mjs|cjs)$/i;\n\nconst syntaxYears = new Map(\n Object.entries({\n es5: 5,\n es2015: 2015,\n es2016: 2016,\n es2017: 2017,\n es2018: 2018,\n es2019: 2019,\n es2020: 2020,\n es2021: 2021,\n es2022: 2022,\n es2023: 2023,\n es2024: 2024,\n es2025: 2025,\n } as const satisfies Record<string, Options[\"ecmaVersion\"]>),\n);\n\n/** Explicit ECMAScript targets bound syntax; unbounded targets use native Node. */\nexport const artifactEcmaVersion = ({\n target,\n node,\n}: {\n target: PublishTarget;\n node: string;\n}): Options[\"ecmaVersion\"] => {\n if (target.type === \"types-only\") return \"latest\";\n if (target.targets.length === 0)\n throw new Error(\"Packed JavaScript requires a declared target\");\n let version: Options[\"ecmaVersion\"] = \"latest\";\n for (const identifier of target.targets) {\n if (identifier === \"esnext\") continue;\n const year = syntaxYears.get(identifier);\n if (year !== undefined) {\n if (version === \"latest\" || year < version) version = year;\n continue;\n }\n if (publishedNodeTargetSupportsConsumer({ target: identifier, node }))\n continue;\n throw new Error(\n `Unsupported packed JavaScript syntax target ${identifier}; use an explicit ECMAScript year or a supported Node target`,\n );\n }\n return version;\n};\n\nconst packedBinFiles = (files: Map<string, string>) => {\n const result = new Set<string>();\n for (const [file, source] of files) {\n if (path.posix.basename(file) !== \"package.json\") continue;\n const manifest: unknown = JSON.parse(source);\n if (!record(manifest)) throw new Error(`Invalid packed manifest: ${file}`);\n const bin = manifest[\"bin\"];\n if (bin === undefined) continue;\n let entries: unknown[] | undefined;\n if (typeof bin === \"string\") entries = [bin];\n else if (record(bin)) entries = Object.values(bin);\n if (entries === undefined)\n throw new Error(`Unsupported packed bin declaration: ${file}`);\n for (const entry of entries) {\n if (\n typeof entry !== \"string\" ||\n entry === \"\" ||\n path.posix.isAbsolute(entry) ||\n entry.includes(\"\\\\\") ||\n entry.split(\"/\").includes(\"..\")\n )\n throw new Error(`Unsafe packed bin declaration: ${file}`);\n result.add(path.posix.join(path.posix.dirname(file), entry));\n }\n }\n return result;\n};\nconst syntaxFiles = (files: Map<string, string>) => {\n const bins = packedBinFiles(files);\n for (const file of bins) {\n const source = files.get(file);\n if (source === undefined)\n throw new Error(`Missing packed executable: ${file}`);\n if (\n !javascript.test(file) &&\n !/^#!(?:[^\\n]*\\/node|\\/usr\\/bin\\/env(?: -S)? node)(?:[ \\r\\n]|$)/.test(\n source,\n )\n )\n throw new Error(`Unsupported packed executable language: ${file}`);\n }\n return [\n ...new Set(\n [...files.keys()]\n .filter((file) => javascript.test(file))\n .concat([...bins]),\n ),\n ];\n};\n\ntype ArtifactSyntaxOptions = {\n files: Map<string, string>;\n target: PublishTarget;\n node: string;\n};\n\n/** Enumerate all chunks and bins, including JavaScript outside declared exports. */\nexport const assertPackedArtifactSyntax = ({\n files,\n target,\n node,\n}: ArtifactSyntaxOptions) => {\n const ecmaVersion = artifactEcmaVersion({ target, node });\n const selected = syntaxFiles(files);\n if (target.type === \"types-only\" && selected.length > 0)\n throw new Error(`Types-only artifact contains JavaScript: ${selected[0]}`);\n for (const file of selected) {\n const source = files.get(file);\n if (source === undefined)\n throw new Error(`Missing packed JavaScript: ${file}`);\n let mode = packageMode(files, file);\n if (/\\.mjs$/i.test(file)) mode = \"module\";\n if (/\\.cjs$/i.test(file)) mode = \"script\";\n const parseMode = (sourceType: \"script\" | \"module\") => {\n const tree = parseArtifactSource(source, {\n ecmaVersion,\n sourceType,\n allowHashBang: true,\n allowReturnOutsideFunction: sourceType === \"script\",\n });\n // Acorn permits module declarations independently of ecmaVersion.\n if (\n ecmaVersion === 5 &&\n tree.body.some((item) => /^(?:Import|Export)/.test(item.type))\n )\n throw new Error(\"Module declarations exceed ES5\");\n };\n try {\n if (mode === \"detect\") {\n try {\n parseMode(\"script\");\n } catch {\n parseMode(\"module\");\n }\n } else parseMode(mode);\n } catch (error) {\n throw new Error(\n `Packed JavaScript ${file} exceeds its declared syntax target: ${String(error)}`,\n );\n }\n }\n};\n\nconst archiveMembers = (members: readonly string[]) => {\n const seen = new Set<string>();\n for (const file of members) {\n const parts = file.split(\"/\");\n if (\n !file.startsWith(\"package/\") ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n parts.some((part) => part === \"..\" || part === \".\") ||\n parts.slice(0, -1).some((part) => part === \"\") ||\n seen.has(file)\n )\n throw new Error(`Unsupported packed artifact member: ${file}`);\n seen.add(file);\n }\n return members;\n};\n\ntype CheckPackedArtifactOptions = ArtifactSyntaxOptions & {\n executable: string;\n};\nexport const checkPackedJavaScriptWithNode = async ({\n files,\n target,\n node,\n executable,\n}: CheckPackedArtifactOptions) => {\n assertPackedArtifactSyntax({ files, target, node });\n archiveMembers([...files.keys()]);\n const scratch = await mkdtemp(path.join(tmpdir(), \"stll-artifact-syntax-\"));\n try {\n for (const [file, source] of files) {\n const destination = path.join(scratch, file);\n await mkdir(path.dirname(destination), { recursive: true });\n await writeFile(destination, source);\n }\n for (const file of syntaxFiles(files)) {\n try {\n await command(executable, [\"--check\", path.join(scratch, file)], {\n cwd: scratch,\n env: { PATH: \"/usr/bin:/bin\", HOME: scratch },\n });\n } catch (error) {\n throw new Error(\n `Packed JavaScript ${file} is incompatible with consumer Node ${node}: ${String(error)}`,\n );\n }\n }\n } finally {\n await rm(scratch, { recursive: true, force: true });\n }\n};\n\n/** Read bytes without extracting archive-controlled paths or links. */\nexport const readPackedSyntaxFiles = async (archive: string) => {\n const { stdout: listing } = await command(\"tar\", [\"-tzf\", archive], {\n maxBuffer: 16 * 1024 * 1024,\n });\n const files = new Map<string, string>();\n const members = new Set(\n archiveMembers(listing.split(\"\\n\").filter((entry) => entry !== \"\")),\n );\n const regularFiles = new Set<string>();\n const assertRegular = async (file: string) => {\n if (!members.has(file))\n throw new Error(`Missing packed syntax input: ${file}`);\n if (regularFiles.has(file)) return;\n const { stdout: metadata } = await command(\"tar\", [\"-tvzf\", archive, file]);\n if (\n !metadata.startsWith(\"-\") ||\n metadata.trimEnd().split(\"\\n\").length !== 1\n )\n throw new Error(`Packed syntax input must be a regular file: ${file}`);\n regularFiles.add(file);\n };\n const readSource = async (file: string) => {\n const cached = files.get(file);\n if (cached !== undefined) return cached;\n await assertRegular(file);\n const { stdout } = await command(\"tar\", [\"-xOf\", archive, file], {\n maxBuffer: 16 * 1024 * 1024,\n });\n files.set(file, stdout);\n return stdout;\n };\n for (const file of members)\n if (javascript.test(file) || path.posix.basename(file) === \"package.json\")\n await readSource(file);\n for (const file of packedBinFiles(files))\n if (!files.has(file)) await readSource(file);\n await assertPackedRuntimeImports({ members, readSource, assertRegular });\n return files;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAIA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AACrE,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,wBACJ;AACF,MAAM,mBAAmB,aAAsB;CAC7C,IAAI,CAACA,SAAO,QAAQ,KAAK,CAACA,SAAO,SAAS,MAAM,GAAG,OAAO,KAAA;CAC1D,OAAO,SAAS,MAAM,CAAC;AACzB;AAQA,MAAM,iBAAiB,SAAiB;CACtC,MAAM,UAAU,kCAAkC,KAAK,IAAI;CAC3D,MAAM,UAAU,UAAU;CAC1B,IAAI,YAAY,SAAS,YAAY,QACnC,MAAM,IAAI,MAAM,kCAAkC;CAEpD,MAAM,UADM,UAAU,MAAM,GAAA,CACT,MAAM,6BAA6B,KAAK,CAAC;CAC5D,MAAM,OAAiB,CAAC;CACxB,IAAI,cAAc;CAClB,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS;EAClD,MAAM,QAAQ,OAAO,GAAG,KAAK;EAC7B,IAAI,UAA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