@stll/oxlint-config 1.0.1 → 1.1.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 +85 -4
- package/dist/cloud-setup-cli.cjs +62 -21
- package/dist/cloud-setup-cli.cjs.map +1 -1
- package/dist/cloud-setup-cli.mjs +63 -22
- package/dist/cloud-setup-cli.mjs.map +1 -1
- package/dist/consumer-compat-cli.cjs +7 -6
- package/dist/consumer-compat-cli.cjs.map +1 -1
- package/dist/consumer-compat-cli.mjs +7 -6
- package/dist/consumer-compat-cli.mjs.map +1 -1
- package/dist/git-tracked-output.cjs +46 -0
- package/dist/git-tracked-output.cjs.map +1 -0
- package/dist/git-tracked-output.mjs +39 -0
- package/dist/git-tracked-output.mjs.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/publish-build-target-vite-dts-helper.mjs +1 -2
- package/dist/publish-build-target-vite-dts-helper2.cjs +5 -5
- package/dist/publish-build-target-vite-dts-helper2.cjs.map +1 -1
- package/dist/publish-contract-cli.cjs +20 -21
- package/dist/publish-contract-cli.cjs.map +1 -1
- package/dist/publish-contract-cli.mjs +8 -9
- package/dist/publish-contract-cli.mjs.map +1 -1
- package/dist/publish-contract.cjs +1 -1
- package/dist/publish-contract.cjs.map +1 -1
- package/dist/publish-contract.mjs +1 -1
- package/dist/rolldown-runtime.cjs +1 -1
- package/dist/toolchain-changed.cjs +19 -14
- package/dist/toolchain-changed.cjs.map +1 -1
- package/dist/toolchain-changed.mjs +21 -16
- package/dist/toolchain-changed.mjs.map +1 -1
- package/dist/toolchain-check-cli.cjs.map +1 -1
- package/dist/toolchain-check-cli.mjs.map +1 -1
- package/dist/toolchain-guard.cjs +68 -59
- package/dist/toolchain-guard.cjs.map +1 -1
- package/dist/toolchain-guard.mjs +75 -66
- package/dist/toolchain-guard.mjs.map +1 -1
- package/dist/toolchain-inputs.cjs +670 -32
- package/dist/toolchain-inputs.cjs.map +1 -1
- package/dist/toolchain-inputs.mjs +647 -33
- package/dist/toolchain-inputs.mjs.map +1 -1
- package/dist/toolchain-schema.cjs +1 -1
- package/dist/toolchain-schema.cjs.map +1 -1
- package/dist/toolchain-schema.mjs +2 -2
- package/dist/typecheck-parity-cli.cjs.map +1 -1
- package/dist/typecheck-parity-cli.mjs.map +1 -1
- package/dist/typecheck-parity.cjs +8 -7
- package/dist/typecheck-parity.cjs.map +1 -1
- package/dist/typecheck-parity.mjs +6 -5
- package/dist/typecheck-parity.mjs.map +1 -1
- package/dist/typecheck-probe-cli.cjs +1 -1
- package/dist/typecheck-probe-cli.cjs.map +1 -1
- package/dist/typecheck-probe-cli.mjs +1 -1
- package/package.json +6 -6
|
@@ -3,8 +3,8 @@ const require_compiler_packages = require("./compiler-packages.cjs");
|
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
6
|
-
let node_module = require("node:module");
|
|
7
6
|
let node_crypto = require("node:crypto");
|
|
7
|
+
let node_module = require("node:module");
|
|
8
8
|
//#region src/publish-build-target-vite-dts.ts
|
|
9
9
|
const reviewedViteDtsVersions = {
|
|
10
10
|
"vite-plugin-dts": "5.0.3",
|
|
@@ -256,10 +256,10 @@ const record = (value) => typeof value === "object" && value !== null && !Array.
|
|
|
256
256
|
/** The actual build uses this closed factory and its guarded declaration hooks. */
|
|
257
257
|
const declarationOnlyDts = ({ directory, ...options }) => {
|
|
258
258
|
const root = (0, node_fs.realpathSync)(directory);
|
|
259
|
-
const require = (0, node_module.createRequire)(node_path.default.join(root, "package.json"));
|
|
260
|
-
const pluginRequire = (0, node_module.createRequire)(require.resolve("vite-plugin-dts"));
|
|
259
|
+
const require$1 = (0, node_module.createRequire)(node_path.default.join(root, "package.json"));
|
|
260
|
+
const pluginRequire = (0, node_module.createRequire)(require$1.resolve("vite-plugin-dts"));
|
|
261
261
|
for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {
|
|
262
|
-
const metadata = JSON.parse((0, node_fs.readFileSync)((name === "unplugin-dts" ? pluginRequire : require).resolve(`${name}/package.json`), "utf8"));
|
|
262
|
+
const metadata = JSON.parse((0, node_fs.readFileSync)((name === "unplugin-dts" ? pluginRequire : require$1).resolve(`${name}/package.json`), "utf8"));
|
|
263
263
|
if (!record(metadata) || metadata["version"] !== version) throw new Error(`Declaration-only adapter requires ${name} ${version}`);
|
|
264
264
|
}
|
|
265
265
|
const compilerRequire = (0, node_module.createRequire)(pluginRequire.resolve("unplugin-dts"));
|
|
@@ -274,7 +274,7 @@ const declarationOnlyDts = ({ directory, ...options }) => {
|
|
|
274
274
|
};
|
|
275
275
|
const primaryCompiler = compilerVersion(require_compiler_packages.compilerPackages.typescript);
|
|
276
276
|
if (!(primaryCompiler === "6.0.3" || primaryCompiler?.startsWith("7.") === true && compilerVersion(require_compiler_packages.compilerPackages.typescriptCompatibility) === "6.0.3")) throw new Error("Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope");
|
|
277
|
-
const loaded = require("vite-plugin-dts");
|
|
277
|
+
const loaded = require$1("vite-plugin-dts");
|
|
278
278
|
const factory = record(loaded) ? loaded["default"] : loaded;
|
|
279
279
|
if (typeof factory !== "function") throw new Error("Installed declaration plugin does not expose its factory");
|
|
280
280
|
const plugin = Reflect.apply(factory, void 0, [reviewedViteDtsOptions(options)]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-build-target-vite-dts-helper2.cjs","names":["record","path","path","compilerPackages"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.0.3\",\n \"unplugin-dts\": \"1.0.3\",\n} as const;\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst staticEntries = (value: unknown): [string, unknown][] => {\n if (\n !record(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n )\n throw new Error(\"Declaration plugin options must be plain static records\");\n return Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\n \"Declaration plugin options cannot contain accessors or symbols\",\n );\n return [key, descriptor.value];\n });\n};\n\nconst relativePattern = (value: unknown): string => {\n if (\n typeof value !== \"string\" ||\n value.trim() === \"\" ||\n path.posix.isAbsolute(value) ||\n /^[A-Za-z]:/.test(value) ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin paths must stay within the package\");\n return value;\n};\nconst patterns = (value: unknown) => {\n if (typeof value === \"string\") return relativePattern(value);\n if (!Array.isArray(value) || value.length === 0)\n throw new Error(\"Declaration plugin include/exclude must be static paths\");\n return Object.freeze(value.map(relativePattern));\n};\n\n/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */\nexport type ReviewedViteDtsOptions = {\n include?: string | readonly string[];\n exclude?: string | readonly string[];\n entryRoot?: string;\n pathsToAliases?: boolean;\n compilerOptions?: Readonly<{ declarationMap: false }>;\n strictOutput?: true;\n declarationOnly?: false;\n};\nexport const reviewedViteDtsOptions = (value: unknown = {}) => {\n const result: ReviewedViteDtsOptions = {};\n for (const [key, entry] of staticEntries(value)) {\n switch (key) {\n case \"include\":\n case \"exclude\":\n result[key] = patterns(entry);\n break;\n case \"entryRoot\":\n result.entryRoot = relativePattern(entry);\n break;\n case \"pathsToAliases\":\n if (typeof entry !== \"boolean\")\n throw new Error(\"pathsToAliases must be a static boolean\");\n result.pathsToAliases = entry;\n break;\n case \"compilerOptions\": {\n const entries = staticEntries(entry);\n if (\n entries.length !== 1 ||\n entries.at(0)?.[0] !== \"declarationMap\" ||\n entries.at(0)?.[1] !== false\n )\n throw new Error(\n \"Only compilerOptions.declarationMap=false is reviewed\",\n );\n result.compilerOptions = Object.freeze({ declarationMap: false });\n break;\n }\n case \"strictOutput\":\n if (entry !== true)\n throw new Error(\"Declaration output containment cannot be disabled\");\n result.strictOutput = true;\n break;\n case \"declarationOnly\":\n if (entry !== false)\n throw new Error(\n \"Declaration plugin cannot remove JavaScript outputs\",\n );\n result.declarationOnly = false;\n break;\n default:\n throw new Error(`Unreviewed declaration plugin option: ${key}`);\n }\n }\n return Object.freeze(result);\n};\n\nexport type DeclarationOutputSnapshot = Readonly<Record<string, string>>;\nconst hash = (value: string | Uint8Array) =>\n createHash(\"sha256\").update(value).digest(\"hex\");\nexport const declarationPath = (file: string) =>\n /\\.d\\.(?:ts|mts|cts)(?:\\.map)?$/.test(file);\nconst safeOutputPath = (file: string) => {\n if (\n file === \"\" ||\n path.posix.isAbsolute(file) ||\n /^[A-Za-z]:/.test(file) ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n file.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin emitted an unsafe output path\");\n};\n\n/** Capture bytes now; later mutations cannot alter this frozen snapshot. */\nexport const snapshotDeclarationDirectory = (\n directory: string,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n if (lstatSync(directory, { throwIfNoEntry: false }) === undefined)\n return Object.freeze(result);\n const visit = (current: string) => {\n const stat = lstatSync(current);\n if (stat.isSymbolicLink())\n throw new Error(\"Declaration output cannot contain symlinks\");\n if (stat.isDirectory()) {\n for (const entry of readdirSync(current))\n visit(path.join(current, entry));\n return;\n }\n if (!stat.isFile())\n throw new Error(\"Declaration output must contain regular files\");\n Object.defineProperty(\n result,\n path.relative(directory, current).split(path.sep).join(\"/\"),\n { value: hash(readFileSync(current)), enumerable: true },\n );\n };\n visit(directory);\n return Object.freeze(result);\n};\n\nexport const snapshotDeclarationBundle = (\n bundle: unknown,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n for (const [file, entry] of staticEntries(bundle)) {\n safeOutputPath(file);\n if (\n !record(entry) ||\n entry[\"fileName\"] !== file ||\n ![\"asset\", \"chunk\"].includes(String(entry[\"type\"]))\n )\n throw new Error(\"Invalid declaration bundle entry\");\n if (declarationPath(file) && entry[\"type\"] !== \"asset\")\n throw new Error(\"Declarations must be emitted as assets\");\n const type = entry[\"type\"];\n const bytes = type === \"chunk\" ? entry[\"code\"] : entry[\"source\"];\n if (typeof bytes !== \"string\" && !(bytes instanceof Uint8Array))\n throw new Error(\"Declaration bundle output must contain text or bytes\");\n Object.defineProperty(result, file, {\n value: `${String(type)}:${hash(bytes)}`,\n enumerable: true,\n });\n }\n return Object.freeze(result);\n};\n\ntype DeclarationOutputOptions = {\n before: DeclarationOutputSnapshot;\n after: DeclarationOutputSnapshot;\n};\n/** This plugin may only add or change declaration files; every existing non-declaration is immutable. */\nexport const assertDeclarationOnlyOutput = ({\n before,\n after,\n}: DeclarationOutputOptions) => {\n for (const file of new Set([...Object.keys(before), ...Object.keys(after)])) {\n safeOutputPath(file);\n if (!declarationPath(file) && before[file] !== after[file])\n throw new Error(\n `Declaration plugin changed non-declaration output: ${file}`,\n );\n }\n};\n\nconst passiveContextMethods = new Set([\n \"warn\",\n \"error\",\n \"info\",\n \"debug\",\n \"addWatchFile\",\n \"getWatchFiles\",\n \"parse\",\n \"resolve\",\n \"getModuleInfo\",\n \"getModuleIds\",\n \"getFileName\",\n]);\nconst contextData = (value: unknown): unknown => {\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\", \"undefined\"].includes(typeof value)\n )\n return value;\n if (Array.isArray(value)) return Object.freeze(value.map(contextData));\n const snapshot = {};\n Object.setPrototypeOf(snapshot, null);\n for (const [key, entry] of staticEntries(value))\n Object.defineProperty(snapshot, key, {\n value: contextData(entry),\n enumerable: true,\n });\n return Object.freeze(snapshot);\n};\nconst declarationAssetName = (value: unknown) => {\n if (typeof value !== \"string\")\n throw new Error(\"Declaration plugin requires an explicit asset fileName\");\n safeOutputPath(value);\n if (!declarationPath(value))\n throw new Error(\n `Declaration plugin emitted non-declaration asset: ${value}`,\n );\n return value;\n};\n\n/** One build owns all emitter references, including assets materialized after the producer hook. */\nexport const createDeclarationEmissionLedger = () => {\n const references = new Map<\n string,\n { fileName: string; getFileName: () => unknown }\n >();\n const wrapContext = (host: unknown) => {\n const receiver = record(host) ? host : {};\n const hostMethod = (name: string) => {\n const method: unknown = receiver[name];\n if (typeof method !== \"function\")\n throw new Error(`Declaration plugin host method unavailable: ${name}`);\n return (...args: unknown[]): unknown =>\n Reflect.apply(method, receiver, args);\n };\n const methods = new Map<string, (...args: unknown[]) => unknown>();\n methods.set(\"emitFile\", (asset: unknown) => {\n const entries = staticEntries(asset);\n if (!record(asset) || asset[\"type\"] !== \"asset\")\n throw new Error(\"Declaration plugin may only emit assets\");\n const fileName = declarationAssetName(asset[\"fileName\"]);\n for (const [, value] of entries)\n if (typeof value === \"function\")\n throw new Error(\"Declaration plugin asset metadata must be static\");\n const source = asset[\"source\"];\n if (\n source !== undefined &&\n typeof source !== \"string\" &&\n !(source instanceof Uint8Array)\n )\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n const getFileName = hostMethod(\"getFileName\");\n const emitted: Record<string, unknown> = {};\n for (const [key, value] of entries) {\n const copied =\n value instanceof Uint8Array\n ? new Uint8Array(value)\n : contextData(value);\n Object.defineProperty(emitted, key, {\n value: copied,\n enumerable: true,\n });\n }\n const reference = hostMethod(\"emitFile\")(emitted);\n if (typeof reference !== \"string\" || references.has(reference))\n throw new Error(\n \"Declaration plugin emitted an invalid asset reference\",\n );\n references.set(reference, {\n fileName,\n getFileName: () => getFileName(reference),\n });\n return reference;\n });\n methods.set(\"setAssetSource\", (reference: unknown, source: unknown) => {\n if (typeof reference !== \"string\" || !references.has(reference))\n throw new Error(\n \"Declaration plugin cannot update a foreign asset reference\",\n );\n if (typeof source !== \"string\" && !(source instanceof Uint8Array))\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n return hostMethod(\"setAssetSource\")(reference, source);\n });\n const surrogate: Record<string, unknown> = {};\n Object.setPrototypeOf(surrogate, null);\n return new Proxy(surrogate, {\n get: (_target, key) => {\n if (typeof key !== \"string\")\n throw new Error(\"Declaration plugin context symbols are unsupported\");\n const method = methods.get(key);\n if (method !== undefined) return method;\n if (passiveContextMethods.has(key)) {\n const forwarded = hostMethod(key);\n methods.set(key, forwarded);\n return forwarded;\n }\n const value: unknown = receiver[key];\n if (key === \"meta\") return contextData(value);\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof value)\n )\n return value;\n throw new Error(\n `Declaration plugin context capability is unsupported: ${key}`,\n );\n },\n set: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n defineProperty: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n setPrototypeOf: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n });\n };\n const audit = () => {\n for (const [reference, emission] of references) {\n const resolved = declarationAssetName(emission.getFileName());\n if (resolved !== emission.fileName)\n throw new Error(\n `Declaration plugin asset reference changed filename: ${reference}`,\n );\n }\n };\n return { wrapContext, audit };\n};\nexport type DeclarationEmissionLedger = ReturnType<\n typeof createDeclarationEmissionLedger\n>;\n\ntype GuardDeclarationHookOptions = {\n hook: unknown;\n hookName: string;\n outputDirectories: readonly string[];\n ledger?: DeclarationEmissionLedger;\n};\n/** Substitute a closed producer context while guarding the actual hook invocation. */\nexport const guardDeclarationHook = ({\n hook,\n hookName,\n outputDirectories,\n ledger = createDeclarationEmissionLedger(),\n}: GuardDeclarationHookOptions) => {\n if (typeof hook !== \"function\")\n throw new Error(\"Invalid reviewed declaration hook\");\n const producer = hook;\n async function guarded(this: unknown, ...args: unknown[]) {\n const beforeDirectories = outputDirectories.map(\n snapshotDeclarationDirectory,\n );\n const bundle = [\"generateBundle\", \"writeBundle\"].includes(hookName)\n ? args.at(1)\n : undefined;\n const beforeBundle =\n bundle === undefined ? undefined : snapshotDeclarationBundle(bundle);\n const result: unknown = await Reflect.apply(\n producer,\n ledger.wrapContext(this),\n args,\n );\n if (result !== undefined)\n throw new Error(\n `Declaration plugin hook ${hookName} returned a dynamic build change`,\n );\n if (beforeBundle !== undefined)\n assertDeclarationOnlyOutput({\n before: beforeBundle,\n after: snapshotDeclarationBundle(bundle),\n });\n for (const [index, directory] of outputDirectories.entries()) {\n const before = beforeDirectories.at(index);\n if (before === undefined)\n throw new Error(\"Missing declaration output snapshot\");\n assertDeclarationOnlyOutput({\n before,\n after: snapshotDeclarationDirectory(directory),\n });\n }\n if ([\"generateBundle\", \"writeBundle\"].includes(hookName)) ledger.audit();\n return result;\n }\n return guarded;\n};\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\n\nimport { compilerPackages } from \"./compiler-packages\";\nimport {\n createDeclarationEmissionLedger,\n guardDeclarationHook,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n type ReviewedViteDtsOptions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: plugin[name],\n hookName: name,\n outputDirectories,\n ledger,\n });\n const configResolved = hook(\"configResolved\");\n return {\n name: \"stll:declaration-only-dts\",\n apply: \"build\",\n enforce: \"pre\",\n config: hook(\"config\"),\n async configResolved(config) {\n if (\n realpathSync(config.root) !== root ||\n config.build.write === false ||\n config.build.watch\n )\n throw new Error(\n \"Declaration-only adapter requires a package-local production build\",\n );\n const output = path.resolve(root, config.build.outDir);\n const relative = path.relative(root, output);\n if (\n relative === \"\" ||\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n )\n throw new Error(\n \"Declaration output directory must stay within the package\",\n );\n // Check existing ancestor paths before the declaration plugin can write.\n let ancestor = output;\n while (ancestor !== root) {\n try {\n const resolved = realpathSync(ancestor);\n const within = path.relative(root, resolved);\n if (\n within === \"..\" ||\n within.startsWith(`..${path.sep}`) ||\n path.isAbsolute(within)\n )\n throw new Error(\"Declaration output directory leaves the package\");\n break;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"ENOENT\") throw error;\n ancestor = path.dirname(ancestor);\n }\n }\n outputDirectories.push(output);\n await configResolved.call(this, config);\n },\n buildStart: hook(\"buildStart\"),\n transform: hook(\"transform\"),\n watchChange: hook(\"watchChange\"),\n generateBundle: {\n order: \"post\",\n async handler(outputOptions, bundle, isWrite) {\n await hook(\"generateBundle\").call(this, outputOptions, bundle, isWrite);\n ledger.audit();\n },\n },\n writeBundle: {\n order: \"post\",\n async handler(outputOptions, bundle) {\n await hook(\"writeBundle\").call(this, outputOptions, bundle);\n ledger.audit();\n },\n },\n };\n};\n"],"mappings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;EACxC;EACA,YAAY,KAAK,YAAY;EAC7B,WAAW,KAAK,WAAW;EAC3B,aAAa,KAAK,aAAa;EAC/B,gBAAgB;GACd,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ,SAAS;IAC5C,MAAM,KAAK,gBAAgB,CAAC,CAAC,KAAK,MAAM,eAAe,QAAQ,OAAO;IACtE,OAAO,MAAM;GACf;EACF;EACA,aAAa;GACX,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ;IACnC,MAAM,KAAK,aAAa,CAAC,CAAC,KAAK,MAAM,eAAe,MAAM;IAC1D,OAAO,MAAM;GACf;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"publish-build-target-vite-dts-helper2.cjs","names":["record","path","createHash","lstatSync","readdirSync","readFileSync","realpathSync","require","createRequire","path","readFileSync","compilerPackages"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.0.3\",\n \"unplugin-dts\": \"1.0.3\",\n} as const;\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst staticEntries = (value: unknown): [string, unknown][] => {\n if (\n !record(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n )\n throw new Error(\"Declaration plugin options must be plain static records\");\n return Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\n \"Declaration plugin options cannot contain accessors or symbols\",\n );\n return [key, descriptor.value];\n });\n};\n\nconst relativePattern = (value: unknown): string => {\n if (\n typeof value !== \"string\" ||\n value.trim() === \"\" ||\n path.posix.isAbsolute(value) ||\n /^[A-Za-z]:/.test(value) ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin paths must stay within the package\");\n return value;\n};\nconst patterns = (value: unknown) => {\n if (typeof value === \"string\") return relativePattern(value);\n if (!Array.isArray(value) || value.length === 0)\n throw new Error(\"Declaration plugin include/exclude must be static paths\");\n return Object.freeze(value.map(relativePattern));\n};\n\n/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */\nexport type ReviewedViteDtsOptions = {\n include?: string | readonly string[];\n exclude?: string | readonly string[];\n entryRoot?: string;\n pathsToAliases?: boolean;\n compilerOptions?: Readonly<{ declarationMap: false }>;\n strictOutput?: true;\n declarationOnly?: false;\n};\nexport const reviewedViteDtsOptions = (value: unknown = {}) => {\n const result: ReviewedViteDtsOptions = {};\n for (const [key, entry] of staticEntries(value)) {\n switch (key) {\n case \"include\":\n case \"exclude\":\n result[key] = patterns(entry);\n break;\n case \"entryRoot\":\n result.entryRoot = relativePattern(entry);\n break;\n case \"pathsToAliases\":\n if (typeof entry !== \"boolean\")\n throw new Error(\"pathsToAliases must be a static boolean\");\n result.pathsToAliases = entry;\n break;\n case \"compilerOptions\": {\n const entries = staticEntries(entry);\n if (\n entries.length !== 1 ||\n entries.at(0)?.[0] !== \"declarationMap\" ||\n entries.at(0)?.[1] !== false\n )\n throw new Error(\n \"Only compilerOptions.declarationMap=false is reviewed\",\n );\n result.compilerOptions = Object.freeze({ declarationMap: false });\n break;\n }\n case \"strictOutput\":\n if (entry !== true)\n throw new Error(\"Declaration output containment cannot be disabled\");\n result.strictOutput = true;\n break;\n case \"declarationOnly\":\n if (entry !== false)\n throw new Error(\n \"Declaration plugin cannot remove JavaScript outputs\",\n );\n result.declarationOnly = false;\n break;\n default:\n throw new Error(`Unreviewed declaration plugin option: ${key}`);\n }\n }\n return Object.freeze(result);\n};\n\nexport type DeclarationOutputSnapshot = Readonly<Record<string, string>>;\nconst hash = (value: string | Uint8Array) =>\n createHash(\"sha256\").update(value).digest(\"hex\");\nexport const declarationPath = (file: string) =>\n /\\.d\\.(?:ts|mts|cts)(?:\\.map)?$/.test(file);\nconst safeOutputPath = (file: string) => {\n if (\n file === \"\" ||\n path.posix.isAbsolute(file) ||\n /^[A-Za-z]:/.test(file) ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n file.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin emitted an unsafe output path\");\n};\n\n/** Capture bytes now; later mutations cannot alter this frozen snapshot. */\nexport const snapshotDeclarationDirectory = (\n directory: string,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n if (lstatSync(directory, { throwIfNoEntry: false }) === undefined)\n return Object.freeze(result);\n const visit = (current: string) => {\n const stat = lstatSync(current);\n if (stat.isSymbolicLink())\n throw new Error(\"Declaration output cannot contain symlinks\");\n if (stat.isDirectory()) {\n for (const entry of readdirSync(current))\n visit(path.join(current, entry));\n return;\n }\n if (!stat.isFile())\n throw new Error(\"Declaration output must contain regular files\");\n Object.defineProperty(\n result,\n path.relative(directory, current).split(path.sep).join(\"/\"),\n { value: hash(readFileSync(current)), enumerable: true },\n );\n };\n visit(directory);\n return Object.freeze(result);\n};\n\nexport const snapshotDeclarationBundle = (\n bundle: unknown,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n for (const [file, entry] of staticEntries(bundle)) {\n safeOutputPath(file);\n if (\n !record(entry) ||\n entry[\"fileName\"] !== file ||\n ![\"asset\", \"chunk\"].includes(String(entry[\"type\"]))\n )\n throw new Error(\"Invalid declaration bundle entry\");\n if (declarationPath(file) && entry[\"type\"] !== \"asset\")\n throw new Error(\"Declarations must be emitted as assets\");\n const type = entry[\"type\"];\n const bytes = type === \"chunk\" ? entry[\"code\"] : entry[\"source\"];\n if (typeof bytes !== \"string\" && !(bytes instanceof Uint8Array))\n throw new Error(\"Declaration bundle output must contain text or bytes\");\n Object.defineProperty(result, file, {\n value: `${String(type)}:${hash(bytes)}`,\n enumerable: true,\n });\n }\n return Object.freeze(result);\n};\n\ntype DeclarationOutputOptions = {\n before: DeclarationOutputSnapshot;\n after: DeclarationOutputSnapshot;\n};\n/** This plugin may only add or change declaration files; every existing non-declaration is immutable. */\nexport const assertDeclarationOnlyOutput = ({\n before,\n after,\n}: DeclarationOutputOptions) => {\n for (const file of new Set([...Object.keys(before), ...Object.keys(after)])) {\n safeOutputPath(file);\n if (!declarationPath(file) && before[file] !== after[file])\n throw new Error(\n `Declaration plugin changed non-declaration output: ${file}`,\n );\n }\n};\n\nconst passiveContextMethods = new Set([\n \"warn\",\n \"error\",\n \"info\",\n \"debug\",\n \"addWatchFile\",\n \"getWatchFiles\",\n \"parse\",\n \"resolve\",\n \"getModuleInfo\",\n \"getModuleIds\",\n \"getFileName\",\n]);\nconst contextData = (value: unknown): unknown => {\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\", \"undefined\"].includes(typeof value)\n )\n return value;\n if (Array.isArray(value)) return Object.freeze(value.map(contextData));\n const snapshot = {};\n Object.setPrototypeOf(snapshot, null);\n for (const [key, entry] of staticEntries(value))\n Object.defineProperty(snapshot, key, {\n value: contextData(entry),\n enumerable: true,\n });\n return Object.freeze(snapshot);\n};\nconst declarationAssetName = (value: unknown) => {\n if (typeof value !== \"string\")\n throw new Error(\"Declaration plugin requires an explicit asset fileName\");\n safeOutputPath(value);\n if (!declarationPath(value))\n throw new Error(\n `Declaration plugin emitted non-declaration asset: ${value}`,\n );\n return value;\n};\n\n/** One build owns all emitter references, including assets materialized after the producer hook. */\nexport const createDeclarationEmissionLedger = () => {\n const references = new Map<\n string,\n { fileName: string; getFileName: () => unknown }\n >();\n const wrapContext = (host: unknown) => {\n const receiver = record(host) ? host : {};\n const hostMethod = (name: string) => {\n const method: unknown = receiver[name];\n if (typeof method !== \"function\")\n throw new Error(`Declaration plugin host method unavailable: ${name}`);\n return (...args: unknown[]): unknown =>\n Reflect.apply(method, receiver, args);\n };\n const methods = new Map<string, (...args: unknown[]) => unknown>();\n methods.set(\"emitFile\", (asset: unknown) => {\n const entries = staticEntries(asset);\n if (!record(asset) || asset[\"type\"] !== \"asset\")\n throw new Error(\"Declaration plugin may only emit assets\");\n const fileName = declarationAssetName(asset[\"fileName\"]);\n for (const [, value] of entries)\n if (typeof value === \"function\")\n throw new Error(\"Declaration plugin asset metadata must be static\");\n const source = asset[\"source\"];\n if (\n source !== undefined &&\n typeof source !== \"string\" &&\n !(source instanceof Uint8Array)\n )\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n const getFileName = hostMethod(\"getFileName\");\n const emitted: Record<string, unknown> = {};\n for (const [key, value] of entries) {\n const copied =\n value instanceof Uint8Array\n ? new Uint8Array(value)\n : contextData(value);\n Object.defineProperty(emitted, key, {\n value: copied,\n enumerable: true,\n });\n }\n const reference = hostMethod(\"emitFile\")(emitted);\n if (typeof reference !== \"string\" || references.has(reference))\n throw new Error(\n \"Declaration plugin emitted an invalid asset reference\",\n );\n references.set(reference, {\n fileName,\n getFileName: () => getFileName(reference),\n });\n return reference;\n });\n methods.set(\"setAssetSource\", (reference: unknown, source: unknown) => {\n if (typeof reference !== \"string\" || !references.has(reference))\n throw new Error(\n \"Declaration plugin cannot update a foreign asset reference\",\n );\n if (typeof source !== \"string\" && !(source instanceof Uint8Array))\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n return hostMethod(\"setAssetSource\")(reference, source);\n });\n const surrogate: Record<string, unknown> = {};\n Object.setPrototypeOf(surrogate, null);\n return new Proxy(surrogate, {\n get: (_target, key) => {\n if (typeof key !== \"string\")\n throw new Error(\"Declaration plugin context symbols are unsupported\");\n const method = methods.get(key);\n if (method !== undefined) return method;\n if (passiveContextMethods.has(key)) {\n const forwarded = hostMethod(key);\n methods.set(key, forwarded);\n return forwarded;\n }\n const value: unknown = receiver[key];\n if (key === \"meta\") return contextData(value);\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof value)\n )\n return value;\n throw new Error(\n `Declaration plugin context capability is unsupported: ${key}`,\n );\n },\n set: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n defineProperty: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n setPrototypeOf: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n });\n };\n const audit = () => {\n for (const [reference, emission] of references) {\n const resolved = declarationAssetName(emission.getFileName());\n if (resolved !== emission.fileName)\n throw new Error(\n `Declaration plugin asset reference changed filename: ${reference}`,\n );\n }\n };\n return { wrapContext, audit };\n};\nexport type DeclarationEmissionLedger = ReturnType<\n typeof createDeclarationEmissionLedger\n>;\n\ntype GuardDeclarationHookOptions = {\n hook: unknown;\n hookName: string;\n outputDirectories: readonly string[];\n ledger?: DeclarationEmissionLedger;\n};\n/** Substitute a closed producer context while guarding the actual hook invocation. */\nexport const guardDeclarationHook = ({\n hook,\n hookName,\n outputDirectories,\n ledger = createDeclarationEmissionLedger(),\n}: GuardDeclarationHookOptions) => {\n if (typeof hook !== \"function\")\n throw new Error(\"Invalid reviewed declaration hook\");\n const producer = hook;\n async function guarded(this: unknown, ...args: unknown[]) {\n const beforeDirectories = outputDirectories.map(\n snapshotDeclarationDirectory,\n );\n const bundle = [\"generateBundle\", \"writeBundle\"].includes(hookName)\n ? args.at(1)\n : undefined;\n const beforeBundle =\n bundle === undefined ? undefined : snapshotDeclarationBundle(bundle);\n const result: unknown = await Reflect.apply(\n producer,\n ledger.wrapContext(this),\n args,\n );\n if (result !== undefined)\n throw new Error(\n `Declaration plugin hook ${hookName} returned a dynamic build change`,\n );\n if (beforeBundle !== undefined)\n assertDeclarationOnlyOutput({\n before: beforeBundle,\n after: snapshotDeclarationBundle(bundle),\n });\n for (const [index, directory] of outputDirectories.entries()) {\n const before = beforeDirectories.at(index);\n if (before === undefined)\n throw new Error(\"Missing declaration output snapshot\");\n assertDeclarationOnlyOutput({\n before,\n after: snapshotDeclarationDirectory(directory),\n });\n }\n if ([\"generateBundle\", \"writeBundle\"].includes(hookName)) ledger.audit();\n return result;\n }\n return guarded;\n};\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\n\nimport { compilerPackages } from \"./compiler-packages\";\nimport {\n createDeclarationEmissionLedger,\n guardDeclarationHook,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n type ReviewedViteDtsOptions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: plugin[name],\n hookName: name,\n outputDirectories,\n ledger,\n });\n const configResolved = hook(\"configResolved\");\n return {\n name: \"stll:declaration-only-dts\",\n apply: \"build\",\n enforce: \"pre\",\n config: hook(\"config\"),\n async configResolved(config) {\n if (\n realpathSync(config.root) !== root ||\n config.build.write === false ||\n config.build.watch\n )\n throw new Error(\n \"Declaration-only adapter requires a package-local production build\",\n );\n const output = path.resolve(root, config.build.outDir);\n const relative = path.relative(root, output);\n if (\n relative === \"\" ||\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n )\n throw new Error(\n \"Declaration output directory must stay within the package\",\n );\n // Check existing ancestor paths before the declaration plugin can write.\n let ancestor = output;\n while (ancestor !== root) {\n try {\n const resolved = realpathSync(ancestor);\n const within = path.relative(root, resolved);\n if (\n within === \"..\" ||\n within.startsWith(`..${path.sep}`) ||\n path.isAbsolute(within)\n )\n throw new Error(\"Declaration output directory leaves the package\");\n break;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"ENOENT\") throw error;\n ancestor = path.dirname(ancestor);\n }\n }\n outputDirectories.push(output);\n await configResolved.call(this, config);\n },\n buildStart: hook(\"buildStart\"),\n transform: hook(\"transform\"),\n watchChange: hook(\"watchChange\"),\n generateBundle: {\n order: \"post\",\n async handler(outputOptions, bundle, isWrite) {\n await hook(\"generateBundle\").call(this, outputOptions, bundle, isWrite);\n ledger.audit();\n },\n },\n writeBundle: {\n order: \"post\",\n async handler(outputOptions, bundle) {\n await hook(\"writeBundle\").call(this, outputOptions, bundle);\n ledger.audit();\n },\n },\n };\n};\n"],"mappings":";;;;;;;;AAIA,MAAa,0BAA0B;CACrC,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,iBAAiB,UAAwC;CAC7D,IACE,CAACA,SAAO,KAAK,KACb,CAAC,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,eAAe,KAAK,CAAC,GAE/D,MAAM,IAAI,MAAM,yDAAyD;CAC3E,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,QAAQ;EACzC,MAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;EAC7D,IAAI,OAAO,QAAQ,YAAY,CAAC,cAAc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,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_rolldown_runtime = require("./rolldown-runtime.cjs");
|
|
4
4
|
const require_toolchain_inputs = require("./toolchain-inputs.cjs");
|
|
5
|
+
const require_git_tracked_output = require("./git-tracked-output.cjs");
|
|
5
6
|
const require_toolchain_schema = require("./toolchain-schema.cjs");
|
|
6
7
|
const require_publish_contract = require("./publish-contract.cjs");
|
|
7
8
|
const require_publish_build_target_vite_dts_helper = require("./publish-build-target-vite-dts-helper2.cjs");
|
|
@@ -9,8 +10,8 @@ let node_fs = require("node:fs");
|
|
|
9
10
|
let node_child_process = require("node:child_process");
|
|
10
11
|
let node_path = require("node:path");
|
|
11
12
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
12
|
-
let node_module = require("node:module");
|
|
13
13
|
let node_os = require("node:os");
|
|
14
|
+
let node_module = require("node:module");
|
|
14
15
|
let node_url = require("node:url");
|
|
15
16
|
let acorn = require("acorn");
|
|
16
17
|
let esbuild = require("esbuild");
|
|
@@ -161,7 +162,7 @@ export const build = (root, stub, input) => {
|
|
|
161
162
|
`;
|
|
162
163
|
const resolveNuxtPublishTarget = (directory) => {
|
|
163
164
|
const canonicalDirectory = (0, node_fs.realpathSync)(directory);
|
|
164
|
-
const require = (0, node_module.createRequire)(node_path.default.join(canonicalDirectory, "package.json"));
|
|
165
|
+
const require$3 = (0, node_module.createRequire)(node_path.default.join(canonicalDirectory, "package.json"));
|
|
165
166
|
const manifest = JSON.parse((0, node_fs.readFileSync)(node_path.default.join(canonicalDirectory, "package.json"), "utf8"));
|
|
166
167
|
if (!record$2(manifest) || manifest["build"] !== void 0 || manifest["unbuild"] !== void 0 || record$2(manifest["publishConfig"]) && (manifest["publishConfig"]["build"] !== void 0 || manifest["publishConfig"]["unbuild"] !== void 0)) throw new Error("Nuxt manifest build overrides require a supported target resolver");
|
|
167
168
|
const configs = [
|
|
@@ -174,8 +175,9 @@ const resolveNuxtPublishTarget = (directory) => {
|
|
|
174
175
|
"json"
|
|
175
176
|
].filter((extension) => (0, node_fs.existsSync)(node_path.default.join(canonicalDirectory, `build.config.${extension}`)));
|
|
176
177
|
if (configs.length > 1) throw new Error("Nuxt supports exactly one build configuration");
|
|
177
|
-
const tool = (0, node_fs.realpathSync)(require.resolve("@nuxt/module-builder"));
|
|
178
|
-
const
|
|
178
|
+
const tool = (0, node_fs.realpathSync)(require$3.resolve("@nuxt/module-builder"));
|
|
179
|
+
const toolRequire = (0, node_module.createRequire)(tool);
|
|
180
|
+
const unbuild = (0, node_fs.realpathSync)(toolRequire.resolve("unbuild"));
|
|
179
181
|
const unbuildRequire = (0, node_module.createRequire)(unbuild);
|
|
180
182
|
for (const [name, version] of Object.entries(supportedVersions)) {
|
|
181
183
|
let entry;
|
|
@@ -196,7 +198,7 @@ const resolveNuxtPublishTarget = (directory) => {
|
|
|
196
198
|
}
|
|
197
199
|
let helper;
|
|
198
200
|
if (configs.length > 0) {
|
|
199
|
-
const helperEntry = (0, node_fs.realpathSync)(require.resolve("@stll/oxlint-config/build-target"));
|
|
201
|
+
const helperEntry = (0, node_fs.realpathSync)(require$3.resolve("@stll/oxlint-config/build-target"));
|
|
200
202
|
const metadata = JSON.parse((0, node_fs.readFileSync)(node_path.default.resolve(node_path.default.dirname(helperEntry), "../package.json"), "utf8"));
|
|
201
203
|
const ownMetadata = JSON.parse((0, node_fs.readFileSync)(new URL("../package.json", require("url").pathToFileURL(__filename).href), "utf8"));
|
|
202
204
|
if (!record$2(metadata) || !record$2(ownMetadata) || metadata["version"] !== ownMetadata["version"]) throw new Error("Nuxt target helper must use the same tooling version as the resolver");
|
|
@@ -228,7 +230,7 @@ export const resolve=(specifier,context,next)=>{
|
|
|
228
230
|
cwd: canonicalDirectory,
|
|
229
231
|
encoding: "utf8",
|
|
230
232
|
timeout: 3e4,
|
|
231
|
-
maxBuffer:
|
|
233
|
+
maxBuffer: 1048576,
|
|
232
234
|
env: {
|
|
233
235
|
...process.env,
|
|
234
236
|
JITI_FS_CACHE: "0",
|
|
@@ -611,10 +613,10 @@ const reviewedViteBuild = (build) => {
|
|
|
611
613
|
};
|
|
612
614
|
const resolveVitePublishTarget = async (directory) => {
|
|
613
615
|
const canonicalDirectory = (0, node_fs.realpathSync)(directory);
|
|
614
|
-
const require = (0, node_module.createRequire)(node_path.default.join(canonicalDirectory, "package.json"));
|
|
615
|
-
const metadata = JSON.parse((0, node_fs.readFileSync)(require.resolve("vite/package.json"), "utf8"));
|
|
616
|
+
const require$2 = (0, node_module.createRequire)(node_path.default.join(canonicalDirectory, "package.json"));
|
|
617
|
+
const metadata = JSON.parse((0, node_fs.readFileSync)(require$2.resolve("vite/package.json"), "utf8"));
|
|
616
618
|
if (!record$1(metadata) || metadata["version"] !== supportedViteVersion) throw new Error(`Publish target resolver supports Vite ${supportedViteVersion}; review the adapter before changing build tools`);
|
|
617
|
-
const tool = await import((0, node_url.pathToFileURL)((0, node_fs.realpathSync)(require.resolve("vite"))).href);
|
|
619
|
+
const tool = await import((0, node_url.pathToFileURL)((0, node_fs.realpathSync)(require$2.resolve("vite"))).href);
|
|
618
620
|
if (!record$1(tool) || typeof tool["resolveConfig"] !== "function") throw new Error("Installed Vite does not expose its configuration resolver");
|
|
619
621
|
const patchConfig = (resolved) => {
|
|
620
622
|
if (!record$1(resolved) || !record$1(resolved["build"]) || !record$1(resolved["environments"])) throw new Error("Invalid Vite environment configuration");
|
|
@@ -628,9 +630,9 @@ const resolveVitePublishTarget = async (directory) => {
|
|
|
628
630
|
const resolvedPlugins = plugins(config);
|
|
629
631
|
const canonicalVuePlugins = [];
|
|
630
632
|
if (resolvedPlugins.some((plugin) => record$1(plugin) && plugin["name"] === "vite:vue")) {
|
|
631
|
-
const vueMetadata = JSON.parse((0, node_fs.readFileSync)(require.resolve("@vitejs/plugin-vue/package.json"), "utf8"));
|
|
633
|
+
const vueMetadata = JSON.parse((0, node_fs.readFileSync)(require$2.resolve("@vitejs/plugin-vue/package.json"), "utf8"));
|
|
632
634
|
if (!record$1(vueMetadata) || vueMetadata["version"] !== "6.0.8") throw new Error("Publish target resolver supports @vitejs/plugin-vue 6.0.8; review the adapter before changing build tools");
|
|
633
|
-
const vue = await import((0, node_url.pathToFileURL)((0, node_fs.realpathSync)(require.resolve("@vitejs/plugin-vue"))).href);
|
|
635
|
+
const vue = await import((0, node_url.pathToFileURL)((0, node_fs.realpathSync)(require$2.resolve("@vitejs/plugin-vue"))).href);
|
|
634
636
|
if (!record$1(vue) || typeof vue["default"] !== "function") throw new Error("Invalid installed Vue plugin factory");
|
|
635
637
|
const plugin = vue["default"]();
|
|
636
638
|
if (!record$1(plugin)) throw new Error("Invalid installed Vue plugin");
|
|
@@ -810,7 +812,6 @@ const resolvePublishBuildTarget = async (directory, packer) => {
|
|
|
810
812
|
switch (supportedPublishBuildCommand(manifest["scripts"]["build"])) {
|
|
811
813
|
case "vite": return await resolveVitePublishTarget(directory);
|
|
812
814
|
case "nuxt-module-build": return resolveNuxtPublishTarget(directory);
|
|
813
|
-
case "tsdown": break;
|
|
814
815
|
}
|
|
815
816
|
const configFiles = [
|
|
816
817
|
"ts",
|
|
@@ -824,8 +825,8 @@ const resolvePublishBuildTarget = async (directory, packer) => {
|
|
|
824
825
|
if (configFiles.length !== 1) throw new Error("Publish target resolver requires exactly one tsdown configuration");
|
|
825
826
|
const configFile = configFiles.at(0);
|
|
826
827
|
if (configFile === void 0) throw new Error("Missing tsdown configuration");
|
|
827
|
-
const require = (0, node_module.createRequire)(node_path.default.join(directory, "package.json"));
|
|
828
|
-
const metadata = JSON.parse((0, node_fs.readFileSync)(require.resolve("tsdown/package.json"), "utf8"));
|
|
828
|
+
const require$1 = (0, node_module.createRequire)(node_path.default.join(directory, "package.json"));
|
|
829
|
+
const metadata = JSON.parse((0, node_fs.readFileSync)(require$1.resolve("tsdown/package.json"), "utf8"));
|
|
829
830
|
if (!record(metadata) || metadata["version"] !== supportedTsdownVersion) throw new Error(`Publish target resolver supports tsdown ${supportedTsdownVersion}; review the adapter before changing build tools`);
|
|
830
831
|
const loaderRequire = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
831
832
|
const scratch = (0, node_fs.mkdtempSync)(node_path.default.join((0, node_os.tmpdir)(), "stll-publish-target-"));
|
|
@@ -840,14 +841,14 @@ const resolvePublishBuildTarget = async (directory, packer) => {
|
|
|
840
841
|
JSON.stringify({
|
|
841
842
|
directory,
|
|
842
843
|
configFile,
|
|
843
|
-
toolUrl: (0, node_url.pathToFileURL)(require.resolve("tsdown")).href,
|
|
844
|
+
toolUrl: (0, node_url.pathToFileURL)(require$1.resolve("tsdown")).href,
|
|
844
845
|
resultFile
|
|
845
846
|
})
|
|
846
847
|
], {
|
|
847
848
|
cwd: directory,
|
|
848
849
|
encoding: "utf8",
|
|
849
850
|
timeout: 3e4,
|
|
850
|
-
maxBuffer:
|
|
851
|
+
maxBuffer: 1048576
|
|
851
852
|
});
|
|
852
853
|
if (result.error) throw result.error;
|
|
853
854
|
if (result.status !== 0) throw new Error(`Node tsdown configuration resolver failed: ${result.stderr.trim()}`);
|
|
@@ -921,10 +922,7 @@ const main = async () => {
|
|
|
921
922
|
node: policy.consumerNode,
|
|
922
923
|
typescript: policy.consumerTypescript
|
|
923
924
|
};
|
|
924
|
-
const tracked =
|
|
925
|
-
cwd: root,
|
|
926
|
-
encoding: "utf8"
|
|
927
|
-
}).split("\0");
|
|
925
|
+
const tracked = require_git_tracked_output.readGitTrackedOutput(root, "paths").split("\0");
|
|
928
926
|
const files = {};
|
|
929
927
|
for (const file of tracked) {
|
|
930
928
|
if (file.split("/").some((part) => part === "node_modules" || part === ".git") || !["package.json", "pnpm-workspace.yaml"].includes(node_path.default.posix.basename(file)) && require_toolchain_inputs.githubAutomationFileKind(file) !== "workflow") continue;
|
|
@@ -957,11 +955,12 @@ const main = async () => {
|
|
|
957
955
|
target,
|
|
958
956
|
packer
|
|
959
957
|
});
|
|
958
|
+
const committed = write ? current : JSON.parse((0, node_fs.readFileSync)(contractFile, "utf8"));
|
|
960
959
|
const diagnostics = require_publish_contract.checkPublishContract({
|
|
961
960
|
packer,
|
|
962
961
|
manifest,
|
|
963
962
|
target,
|
|
964
|
-
contract:
|
|
963
|
+
contract: committed,
|
|
965
964
|
policy: consumer
|
|
966
965
|
});
|
|
967
966
|
for (const diagnostic of diagnostics) process.stderr.write(`${file}:1: [publish-contract] ${diagnostic.message}\n`);
|