@stll/oxlint-config 1.7.0 → 1.9.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 +9 -7
- package/dist/cloud-setup-cli.cjs +6 -1
- package/dist/cloud-setup-cli.cjs.map +1 -1
- package/dist/cloud-setup-cli.mjs +6 -1
- package/dist/cloud-setup-cli.mjs.map +1 -1
- package/dist/dependabot.d.cts +13 -7
- package/dist/dependabot.d.mts +13 -7
- package/dist/engine-support.d.cts +4 -5
- package/dist/engine-support.d.mts +4 -5
- package/dist/index.d.cts +11 -11
- package/dist/index.d.mts +11 -11
- 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/toolchain-bun.cjs +34 -0
- package/dist/toolchain-bun.cjs.map +1 -0
- package/dist/toolchain-bun.mjs +23 -0
- package/dist/toolchain-bun.mjs.map +1 -0
- package/dist/toolchain-dependabot.cjs +6 -3
- package/dist/toolchain-dependabot.cjs.map +1 -1
- package/dist/toolchain-dependabot.mjs +6 -3
- package/dist/toolchain-dependabot.mjs.map +1 -1
- package/dist/toolchain-guard.cjs +8 -3
- package/dist/toolchain-guard.cjs.map +1 -1
- package/dist/toolchain-guard.mjs +8 -3
- package/dist/toolchain-guard.mjs.map +1 -1
- package/dist/toolchain-inputs.cjs +61 -9
- package/dist/toolchain-inputs.cjs.map +1 -1
- package/dist/toolchain-inputs.mjs +61 -9
- package/dist/toolchain-inputs.mjs.map +1 -1
- package/dist/toolchain-schema.cjs +77 -2
- package/dist/toolchain-schema.cjs.map +1 -1
- package/dist/toolchain-schema.mjs +77 -3
- package/dist/toolchain-schema.mjs.map +1 -1
- package/dist/typecheck-parity.cjs +2 -1
- package/dist/typecheck-parity.cjs.map +1 -1
- package/dist/typecheck-parity.mjs +2 -1
- package/dist/typecheck-parity.mjs.map +1 -1
- package/package.json +5 -5
- package/toolchain.json +12 -7
|
@@ -7,8 +7,8 @@ let node_crypto = require("node:crypto");
|
|
|
7
7
|
let node_module = require("node:module");
|
|
8
8
|
//#region src/publish-build-target-vite-dts.ts
|
|
9
9
|
const reviewedViteDtsVersions = {
|
|
10
|
-
"vite-plugin-dts": "5.
|
|
11
|
-
"unplugin-dts": "1.
|
|
10
|
+
"vite-plugin-dts": "5.1.2",
|
|
11
|
+
"unplugin-dts": "1.1.2"
|
|
12
12
|
};
|
|
13
13
|
const record$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14
14
|
const staticEntries = (value) => {
|
|
@@ -108,6 +108,7 @@ const assertDeclarationOnlyOutput = ({ before, after }) => {
|
|
|
108
108
|
if (!declarationPath(file) && before[file] !== after[file]) throw new Error(`Declaration plugin changed non-declaration output: ${file}`);
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
+
const withheldContextCapabilities = /* @__PURE__ */ new Set(["getNativeBuildContext"]);
|
|
111
112
|
const passiveContextMethods = /* @__PURE__ */ new Set([
|
|
112
113
|
"warn",
|
|
113
114
|
"error",
|
|
@@ -195,6 +196,7 @@ const createDeclarationEmissionLedger = () => {
|
|
|
195
196
|
methods.set(key, forwarded);
|
|
196
197
|
return forwarded;
|
|
197
198
|
}
|
|
199
|
+
if (withheldContextCapabilities.has(key)) return void 0;
|
|
198
200
|
const value = receiver[key];
|
|
199
201
|
if (key === "meta") return contextData(value);
|
|
200
202
|
if (value === null || [
|
|
@@ -223,6 +225,42 @@ const createDeclarationEmissionLedger = () => {
|
|
|
223
225
|
audit
|
|
224
226
|
};
|
|
225
227
|
};
|
|
228
|
+
const idPattern = (value) => {
|
|
229
|
+
if (value === void 0 || typeof value === "string") return value;
|
|
230
|
+
if (value instanceof RegExp) return value;
|
|
231
|
+
if (Array.isArray(value) && value.every((entry) => typeof entry === "string" || entry instanceof RegExp)) return value;
|
|
232
|
+
throw new Error("Declaration hook filters may only name static ids");
|
|
233
|
+
};
|
|
234
|
+
const dataEntries = (value, keys) => Reflect.ownKeys(value).map((key) => {
|
|
235
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
236
|
+
if (typeof key !== "string" || !keys.includes(key) || !descriptor) throw new Error("Invalid reviewed declaration hook");
|
|
237
|
+
if (!("value" in descriptor)) throw new Error("Declaration hooks cannot contain accessors");
|
|
238
|
+
return [key, descriptor.value];
|
|
239
|
+
});
|
|
240
|
+
/**
|
|
241
|
+
* Split a plugin hook into its function and the static id filter of the
|
|
242
|
+
* object form; a filter only narrows which modules reach the handler.
|
|
243
|
+
*/
|
|
244
|
+
const declarationHookParts = (value) => {
|
|
245
|
+
if (typeof value === "function") return { handler: value };
|
|
246
|
+
if (!record$1(value)) throw new Error("Invalid reviewed declaration hook");
|
|
247
|
+
const parts = Object.fromEntries(dataEntries(value, ["handler", "filter"]));
|
|
248
|
+
const filter = parts["filter"];
|
|
249
|
+
if (filter === void 0) return { handler: parts["handler"] };
|
|
250
|
+
if (!record$1(filter)) throw new Error("Invalid reviewed declaration hook");
|
|
251
|
+
const id = Object.fromEntries(dataEntries(filter, ["id"]))["id"];
|
|
252
|
+
if (!record$1(id)) throw new Error("Invalid reviewed declaration hook");
|
|
253
|
+
const idFilter = Object.fromEntries(dataEntries(id, ["include", "exclude"]));
|
|
254
|
+
const ids = {};
|
|
255
|
+
const include = idPattern(idFilter["include"]);
|
|
256
|
+
const exclude = idPattern(idFilter["exclude"]);
|
|
257
|
+
if (include !== void 0) ids.include = include;
|
|
258
|
+
if (exclude !== void 0) ids.exclude = exclude;
|
|
259
|
+
return {
|
|
260
|
+
handler: parts["handler"],
|
|
261
|
+
filter: { id: ids }
|
|
262
|
+
};
|
|
263
|
+
};
|
|
226
264
|
/** Substitute a closed producer context while guarding the actual hook invocation. */
|
|
227
265
|
const guardDeclarationHook = ({ hook, hookName, outputDirectories, ledger = createDeclarationEmissionLedger() }) => {
|
|
228
266
|
if (typeof hook !== "function") throw new Error("Invalid reviewed declaration hook");
|
|
@@ -307,11 +345,13 @@ const declarationOnlyDts = ({ directory, ...options }) => {
|
|
|
307
345
|
const outputDirectories = [];
|
|
308
346
|
const ledger = createDeclarationEmissionLedger();
|
|
309
347
|
const hook = (name) => guardDeclarationHook({
|
|
310
|
-
hook: plugin[name],
|
|
348
|
+
hook: declarationHookParts(plugin[name]).handler,
|
|
311
349
|
hookName: name,
|
|
312
350
|
outputDirectories,
|
|
313
351
|
ledger
|
|
314
352
|
});
|
|
353
|
+
const transformFilter = declarationHookParts(plugin["transform"]).filter;
|
|
354
|
+
const transform = hook("transform");
|
|
315
355
|
const configResolved = hook("configResolved");
|
|
316
356
|
return {
|
|
317
357
|
name: "stll:declaration-only-dts",
|
|
@@ -337,7 +377,10 @@ const declarationOnlyDts = ({ directory, ...options }) => {
|
|
|
337
377
|
await configResolved.call(this, config);
|
|
338
378
|
},
|
|
339
379
|
buildStart: hook("buildStart"),
|
|
340
|
-
transform:
|
|
380
|
+
transform: transformFilter === void 0 ? transform : {
|
|
381
|
+
filter: transformFilter,
|
|
382
|
+
handler: transform
|
|
383
|
+
},
|
|
341
384
|
watchChange: hook("watchChange"),
|
|
342
385
|
generateBundle: {
|
|
343
386
|
order: "post",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-build-target-vite-dts-helper2.cjs","names":["record","path","createHash","lstatSync","readdirSync","readFileSync","realpathSync","require","createRequire","path","readFileSync","compilerPackages"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.0.3\",\n \"unplugin-dts\": \"1.0.3\",\n} as const;\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst staticEntries = (value: unknown): [string, unknown][] => {\n if (\n !record(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n )\n throw new Error(\"Declaration plugin options must be plain static records\");\n return Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\n \"Declaration plugin options cannot contain accessors or symbols\",\n );\n return [key, descriptor.value];\n });\n};\n\nconst relativePattern = (value: unknown): string => {\n if (\n typeof value !== \"string\" ||\n value.trim() === \"\" ||\n path.posix.isAbsolute(value) ||\n /^[A-Za-z]:/.test(value) ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin paths must stay within the package\");\n return value;\n};\nconst patterns = (value: unknown) => {\n if (typeof value === \"string\") return relativePattern(value);\n if (!Array.isArray(value) || value.length === 0)\n throw new Error(\"Declaration plugin include/exclude must be static paths\");\n return Object.freeze(value.map(relativePattern));\n};\n\n/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */\nexport type ReviewedViteDtsOptions = {\n include?: string | readonly string[];\n exclude?: string | readonly string[];\n entryRoot?: string;\n pathsToAliases?: boolean;\n compilerOptions?: Readonly<{ declarationMap: false }>;\n strictOutput?: true;\n declarationOnly?: false;\n};\nexport const reviewedViteDtsOptions = (value: unknown = {}) => {\n const result: ReviewedViteDtsOptions = {};\n for (const [key, entry] of staticEntries(value)) {\n switch (key) {\n case \"include\":\n case \"exclude\":\n result[key] = patterns(entry);\n break;\n case \"entryRoot\":\n result.entryRoot = relativePattern(entry);\n break;\n case \"pathsToAliases\":\n if (typeof entry !== \"boolean\")\n throw new Error(\"pathsToAliases must be a static boolean\");\n result.pathsToAliases = entry;\n break;\n case \"compilerOptions\": {\n const entries = staticEntries(entry);\n if (\n entries.length !== 1 ||\n entries.at(0)?.[0] !== \"declarationMap\" ||\n entries.at(0)?.[1] !== false\n )\n throw new Error(\n \"Only compilerOptions.declarationMap=false is reviewed\",\n );\n result.compilerOptions = Object.freeze({ declarationMap: false });\n break;\n }\n case \"strictOutput\":\n if (entry !== true)\n throw new Error(\"Declaration output containment cannot be disabled\");\n result.strictOutput = true;\n break;\n case \"declarationOnly\":\n if (entry !== false)\n throw new Error(\n \"Declaration plugin cannot remove JavaScript outputs\",\n );\n result.declarationOnly = false;\n break;\n default:\n throw new Error(`Unreviewed declaration plugin option: ${key}`);\n }\n }\n return Object.freeze(result);\n};\n\nexport type DeclarationOutputSnapshot = Readonly<Record<string, string>>;\nconst hash = (value: string | Uint8Array) =>\n createHash(\"sha256\").update(value).digest(\"hex\");\nexport const declarationPath = (file: string) =>\n /\\.d\\.(?:ts|mts|cts)(?:\\.map)?$/.test(file);\nconst safeOutputPath = (file: string) => {\n if (\n file === \"\" ||\n path.posix.isAbsolute(file) ||\n /^[A-Za-z]:/.test(file) ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n file.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin emitted an unsafe output path\");\n};\n\n/** Capture bytes now; later mutations cannot alter this frozen snapshot. */\nexport const snapshotDeclarationDirectory = (\n directory: string,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n if (lstatSync(directory, { throwIfNoEntry: false }) === undefined)\n return Object.freeze(result);\n const visit = (current: string) => {\n const stat = lstatSync(current);\n if (stat.isSymbolicLink())\n throw new Error(\"Declaration output cannot contain symlinks\");\n if (stat.isDirectory()) {\n for (const entry of readdirSync(current))\n visit(path.join(current, entry));\n return;\n }\n if (!stat.isFile())\n throw new Error(\"Declaration output must contain regular files\");\n Object.defineProperty(\n result,\n path.relative(directory, current).split(path.sep).join(\"/\"),\n { value: hash(readFileSync(current)), enumerable: true },\n );\n };\n visit(directory);\n return Object.freeze(result);\n};\n\nexport const snapshotDeclarationBundle = (\n bundle: unknown,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n for (const [file, entry] of staticEntries(bundle)) {\n safeOutputPath(file);\n if (\n !record(entry) ||\n entry[\"fileName\"] !== file ||\n ![\"asset\", \"chunk\"].includes(String(entry[\"type\"]))\n )\n throw new Error(\"Invalid declaration bundle entry\");\n if (declarationPath(file) && entry[\"type\"] !== \"asset\")\n throw new Error(\"Declarations must be emitted as assets\");\n const type = entry[\"type\"];\n const bytes = type === \"chunk\" ? entry[\"code\"] : entry[\"source\"];\n if (typeof bytes !== \"string\" && !(bytes instanceof Uint8Array))\n throw new Error(\"Declaration bundle output must contain text or bytes\");\n Object.defineProperty(result, file, {\n value: `${String(type)}:${hash(bytes)}`,\n enumerable: true,\n });\n }\n return Object.freeze(result);\n};\n\ntype DeclarationOutputOptions = {\n before: DeclarationOutputSnapshot;\n after: DeclarationOutputSnapshot;\n};\n/** This plugin may only add or change declaration files; every existing non-declaration is immutable. */\nexport const assertDeclarationOnlyOutput = ({\n before,\n after,\n}: DeclarationOutputOptions) => {\n for (const file of new Set([...Object.keys(before), ...Object.keys(after)])) {\n safeOutputPath(file);\n if (!declarationPath(file) && before[file] !== after[file])\n throw new Error(\n `Declaration plugin changed non-declaration output: ${file}`,\n );\n }\n};\n\nconst passiveContextMethods = new Set([\n \"warn\",\n \"error\",\n \"info\",\n \"debug\",\n \"addWatchFile\",\n \"getWatchFiles\",\n \"parse\",\n \"resolve\",\n \"getModuleInfo\",\n \"getModuleIds\",\n \"getFileName\",\n]);\nconst contextData = (value: unknown): unknown => {\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\", \"undefined\"].includes(typeof value)\n )\n return value;\n if (Array.isArray(value)) return Object.freeze(value.map(contextData));\n const snapshot = {};\n Object.setPrototypeOf(snapshot, null);\n for (const [key, entry] of staticEntries(value))\n Object.defineProperty(snapshot, key, {\n value: contextData(entry),\n enumerable: true,\n });\n return Object.freeze(snapshot);\n};\nconst declarationAssetName = (value: unknown) => {\n if (typeof value !== \"string\")\n throw new Error(\"Declaration plugin requires an explicit asset fileName\");\n safeOutputPath(value);\n if (!declarationPath(value))\n throw new Error(\n `Declaration plugin emitted non-declaration asset: ${value}`,\n );\n return value;\n};\n\n/** One build owns all emitter references, including assets materialized after the producer hook. */\nexport const createDeclarationEmissionLedger = () => {\n const references = new Map<\n string,\n { fileName: string; getFileName: () => unknown }\n >();\n const wrapContext = (host: unknown) => {\n const receiver = record(host) ? host : {};\n const hostMethod = (name: string) => {\n const method: unknown = receiver[name];\n if (typeof method !== \"function\")\n throw new Error(`Declaration plugin host method unavailable: ${name}`);\n return (...args: unknown[]): unknown =>\n Reflect.apply(method, receiver, args);\n };\n const methods = new Map<string, (...args: unknown[]) => unknown>();\n methods.set(\"emitFile\", (asset: unknown) => {\n const entries = staticEntries(asset);\n if (!record(asset) || asset[\"type\"] !== \"asset\")\n throw new Error(\"Declaration plugin may only emit assets\");\n const fileName = declarationAssetName(asset[\"fileName\"]);\n for (const [, value] of entries)\n if (typeof value === \"function\")\n throw new Error(\"Declaration plugin asset metadata must be static\");\n const source = asset[\"source\"];\n if (\n source !== undefined &&\n typeof source !== \"string\" &&\n !(source instanceof Uint8Array)\n )\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n const getFileName = hostMethod(\"getFileName\");\n const emitted: Record<string, unknown> = {};\n for (const [key, value] of entries) {\n const copied =\n value instanceof Uint8Array\n ? new Uint8Array(value)\n : contextData(value);\n Object.defineProperty(emitted, key, {\n value: copied,\n enumerable: true,\n });\n }\n const reference = hostMethod(\"emitFile\")(emitted);\n if (typeof reference !== \"string\" || references.has(reference))\n throw new Error(\n \"Declaration plugin emitted an invalid asset reference\",\n );\n references.set(reference, {\n fileName,\n getFileName: () => getFileName(reference),\n });\n return reference;\n });\n methods.set(\"setAssetSource\", (reference: unknown, source: unknown) => {\n if (typeof reference !== \"string\" || !references.has(reference))\n throw new Error(\n \"Declaration plugin cannot update a foreign asset reference\",\n );\n if (typeof source !== \"string\" && !(source instanceof Uint8Array))\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n return hostMethod(\"setAssetSource\")(reference, source);\n });\n const surrogate: Record<string, unknown> = {};\n Object.setPrototypeOf(surrogate, null);\n return new Proxy(surrogate, {\n get: (_target, key) => {\n if (typeof key !== \"string\")\n throw new Error(\"Declaration plugin context symbols are unsupported\");\n const method = methods.get(key);\n if (method !== undefined) return method;\n if (passiveContextMethods.has(key)) {\n const forwarded = hostMethod(key);\n methods.set(key, forwarded);\n return forwarded;\n }\n const value: unknown = receiver[key];\n if (key === \"meta\") return contextData(value);\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof value)\n )\n return value;\n throw new Error(\n `Declaration plugin context capability is unsupported: ${key}`,\n );\n },\n set: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n defineProperty: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n setPrototypeOf: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n });\n };\n const audit = () => {\n for (const [reference, emission] of references) {\n const resolved = declarationAssetName(emission.getFileName());\n if (resolved !== emission.fileName)\n throw new Error(\n `Declaration plugin asset reference changed filename: ${reference}`,\n );\n }\n };\n return { wrapContext, audit };\n};\nexport type DeclarationEmissionLedger = ReturnType<\n typeof createDeclarationEmissionLedger\n>;\n\ntype GuardDeclarationHookOptions = {\n hook: unknown;\n hookName: string;\n outputDirectories: readonly string[];\n ledger?: DeclarationEmissionLedger;\n};\n/** Substitute a closed producer context while guarding the actual hook invocation. */\nexport const guardDeclarationHook = ({\n hook,\n hookName,\n outputDirectories,\n ledger = createDeclarationEmissionLedger(),\n}: GuardDeclarationHookOptions) => {\n if (typeof hook !== \"function\")\n throw new Error(\"Invalid reviewed declaration hook\");\n const producer = hook;\n async function guarded(this: unknown, ...args: unknown[]) {\n const beforeDirectories = outputDirectories.map(\n snapshotDeclarationDirectory,\n );\n const bundle = [\"generateBundle\", \"writeBundle\"].includes(hookName)\n ? args.at(1)\n : undefined;\n const beforeBundle =\n bundle === undefined ? undefined : snapshotDeclarationBundle(bundle);\n const result: unknown = await Reflect.apply(\n producer,\n ledger.wrapContext(this),\n args,\n );\n if (result !== undefined)\n throw new Error(\n `Declaration plugin hook ${hookName} returned a dynamic build change`,\n );\n if (beforeBundle !== undefined)\n assertDeclarationOnlyOutput({\n before: beforeBundle,\n after: snapshotDeclarationBundle(bundle),\n });\n for (const [index, directory] of outputDirectories.entries()) {\n const before = beforeDirectories.at(index);\n if (before === undefined)\n throw new Error(\"Missing declaration output snapshot\");\n assertDeclarationOnlyOutput({\n before,\n after: snapshotDeclarationDirectory(directory),\n });\n }\n if ([\"generateBundle\", \"writeBundle\"].includes(hookName)) ledger.audit();\n return result;\n }\n return guarded;\n};\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\n\nimport { compilerPackages } from \"./compiler-packages\";\nimport {\n createDeclarationEmissionLedger,\n guardDeclarationHook,\n type ReviewedViteDtsOptions,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: plugin[name],\n hookName: name,\n outputDirectories,\n ledger,\n });\n const configResolved = hook(\"configResolved\");\n return {\n name: \"stll:declaration-only-dts\",\n apply: \"build\",\n enforce: \"pre\",\n config: hook(\"config\"),\n async configResolved(config) {\n if (\n realpathSync(config.root) !== root ||\n config.build.write === false ||\n config.build.watch\n )\n throw new Error(\n \"Declaration-only adapter requires a package-local production build\",\n );\n const output = path.resolve(root, config.build.outDir);\n const relative = path.relative(root, output);\n if (\n relative === \"\" ||\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n )\n throw new Error(\n \"Declaration output directory must stay within the package\",\n );\n // Check existing ancestor paths before the declaration plugin can write.\n let ancestor = output;\n while (ancestor !== root) {\n try {\n const resolved = realpathSync(ancestor);\n const within = path.relative(root, resolved);\n if (\n within === \"..\" ||\n within.startsWith(`..${path.sep}`) ||\n path.isAbsolute(within)\n )\n throw new Error(\"Declaration output directory leaves the package\");\n break;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"ENOENT\") throw error;\n ancestor = path.dirname(ancestor);\n }\n }\n outputDirectories.push(output);\n await configResolved.call(this, config);\n },\n buildStart: hook(\"buildStart\"),\n transform: hook(\"transform\"),\n watchChange: hook(\"watchChange\"),\n generateBundle: {\n order: \"post\",\n async handler(outputOptions, bundle, isWrite) {\n await hook(\"generateBundle\").call(this, outputOptions, bundle, isWrite);\n ledger.audit();\n },\n },\n writeBundle: {\n order: \"post\",\n async handler(outputOptions, bundle) {\n await hook(\"writeBundle\").call(this, outputOptions, bundle);\n ledger.audit();\n },\n },\n };\n};\n"],"mappings":";;;;;;;;AAIA,MAAa,0BAA0B;CACrC,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,iBAAiB,UAAwC;CAC7D,IACE,CAACA,SAAO,KAAK,KACb,CAAC,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,eAAe,KAAK,CAAC,GAE/D,MAAM,IAAI,MAAM,yDAAyD;CAC3E,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,QAAQ;EACzC,MAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;EAC7D,IAAI,OAAO,QAAQ,YAAY,CAAC,cAAc,EAAE,WAAW,aACzD,MAAM,IAAI,MACR,gEACF;EACF,OAAO,CAAC,KAAK,WAAW,KAAK;CAC/B,CAAC;AACH;AAEA,MAAM,mBAAmB,UAA2B;CAClD,IACE,OAAO,UAAU,YACjB,MAAM,KAAK,MAAM,MACjBC,UAAAA,QAAK,MAAM,WAAW,KAAK,KAC3B,aAAa,KAAK,KAAK,KACvB,MAAM,SAAS,IAAI,KACnB,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,IAAI,GAE9B,MAAM,IAAI,MAAM,uDAAuD;CACzE,OAAO;AACT;AACA,MAAM,YAAY,UAAmB;CACnC,IAAI,OAAO,UAAU,UAAU,OAAO,gBAAgB,KAAK;CAC3D,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAC5C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AAQ;IAC3C,IACE,WAAW,QACX,OAAO,WAAW,KAAKA,UAAAA,QAAK,KAAK,KACjCA,UAAAA,QAAK,WAAW,MAAM,GAEtB,MAAM,IAAI,MAAM,iDAAiD;IACnE;GACF,SAAS,OAAO;IACd,IAAI,CAAC,OAAO,KAAK,KAAK,MAAM,YAAY,UAAU,MAAM;IACxD,WAAWA,UAAAA,QAAK,QAAQ,QAAQ;GAClC;GAEF,kBAAkB,KAAK,MAAM;GAC7B,MAAM,eAAe,KAAK,MAAM,MAAM;EACxC;EACA,YAAY,KAAK,YAAY;EAC7B,WAAW,KAAK,WAAW;EAC3B,aAAa,KAAK,aAAa;EAC/B,gBAAgB;GACd,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ,SAAS;IAC5C,MAAM,KAAK,gBAAgB,CAAC,CAAC,KAAK,MAAM,eAAe,QAAQ,OAAO;IACtE,OAAO,MAAM;GACf;EACF;EACA,aAAa;GACX,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ;IACnC,MAAM,KAAK,aAAa,CAAC,CAAC,KAAK,MAAM,eAAe,MAAM;IAC1D,OAAO,MAAM;GACf;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"publish-build-target-vite-dts-helper2.cjs","names":["record","path","createHash","lstatSync","readdirSync","readFileSync","realpathSync","require","createRequire","path","readFileSync","compilerPackages"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.1.2\",\n \"unplugin-dts\": \"1.1.2\",\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\n// Optional capabilities the plugin probes and handles as absent: withholding\n// the native bundler context keeps it on its bundler-neutral path.\nconst withheldContextCapabilities = new Set([\"getNativeBuildContext\"]);\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 if (withheldContextCapabilities.has(key)) return undefined;\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 IdPattern = string | RegExp | (string | RegExp)[];\ntype DeclarationHookFilter = {\n id: { include?: IdPattern; exclude?: IdPattern };\n};\n\nconst idPattern = (value: unknown): IdPattern | undefined => {\n if (value === undefined || typeof value === \"string\") return value;\n if (value instanceof RegExp) return value;\n if (\n Array.isArray(value) &&\n value.every(\n (entry): entry is string | RegExp =>\n typeof entry === \"string\" || entry instanceof RegExp,\n )\n )\n return value;\n throw new Error(\"Declaration hook filters may only name static ids\");\n};\n\nconst dataEntries = (value: Record<string, unknown>, keys: string[]) =>\n Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !keys.includes(key) || !descriptor)\n throw new Error(\"Invalid reviewed declaration hook\");\n if (!(\"value\" in descriptor))\n throw new Error(\"Declaration hooks cannot contain accessors\");\n return [key, descriptor.value] as const;\n });\n\n/**\n * Split a plugin hook into its function and the static id filter of the\n * object form; a filter only narrows which modules reach the handler.\n */\nexport const declarationHookParts = (\n value: unknown,\n): { handler: unknown; filter?: DeclarationHookFilter } => {\n if (typeof value === \"function\") return { handler: value };\n if (!record(value)) throw new Error(\"Invalid reviewed declaration hook\");\n const parts = Object.fromEntries(dataEntries(value, [\"handler\", \"filter\"]));\n const filter = parts[\"filter\"];\n if (filter === undefined) return { handler: parts[\"handler\"] };\n if (!record(filter)) throw new Error(\"Invalid reviewed declaration hook\");\n const id = Object.fromEntries(dataEntries(filter, [\"id\"]))[\"id\"];\n if (!record(id)) throw new Error(\"Invalid reviewed declaration hook\");\n const idFilter = Object.fromEntries(dataEntries(id, [\"include\", \"exclude\"]));\n const ids: DeclarationHookFilter[\"id\"] = {};\n const include = idPattern(idFilter[\"include\"]);\n const exclude = idPattern(idFilter[\"exclude\"]);\n if (include !== undefined) ids.include = include;\n if (exclude !== undefined) ids.exclude = exclude;\n return { handler: parts[\"handler\"], filter: { id: ids } };\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 declarationHookParts,\n guardDeclarationHook,\n type ReviewedViteDtsOptions,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: declarationHookParts(plugin[name]).handler,\n hookName: name,\n outputDirectories,\n ledger,\n });\n // The object form's static id filter is kept; its handler stays guarded.\n const transformFilter = declarationHookParts(plugin[\"transform\"]).filter;\n const transform = hook(\"transform\");\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:\n transformFilter === undefined\n ? transform\n : { filter: transformFilter, handler: 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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,KAAK,KACnCA,UAAAA,QAAK,WAAW,QAAQ,GAExB,MAAM,IAAI,MACR,2DACF;GAEF,IAAI,WAAW;GACf,OAAO,aAAa,MAClB,IAAI;IACF,MAAM,YAAA,GAAWH,QAAAA,aAAAA,CAAa,QAAQ;IACtC,MAAM,SAASG,UAAAA,QAAK,SAAS,MAAM,QAAQ;IAC3C,IACE,WAAW,QACX,OAAO,WAAW,KAAKA,UAAAA,QAAK,KAAK,KACjCA,UAAAA,QAAK,WAAW,MAAM,GAEtB,MAAM,IAAI,MAAM,iDAAiD;IACnE;GACF,SAAS,OAAO;IACd,IAAI,CAAC,OAAO,KAAK,KAAK,MAAM,YAAY,UAAU,MAAM;IACxD,WAAWA,UAAAA,QAAK,QAAQ,QAAQ;GAClC;GAEF,kBAAkB,KAAK,MAAM;GAC7B,MAAM,eAAe,KAAK,MAAM,MAAM;EACxC;EACA,YAAY,KAAK,YAAY;EAC7B,WACE,oBAAoB,KAAA,IAChB,YACA;GAAE,QAAQ;GAAiB,SAAS;EAAU;EACpD,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"}
|
|
@@ -5,8 +5,8 @@ import { lstatSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
//#region src/publish-build-target-vite-dts.ts
|
|
7
7
|
const reviewedViteDtsVersions = {
|
|
8
|
-
"vite-plugin-dts": "5.
|
|
9
|
-
"unplugin-dts": "1.
|
|
8
|
+
"vite-plugin-dts": "5.1.2",
|
|
9
|
+
"unplugin-dts": "1.1.2"
|
|
10
10
|
};
|
|
11
11
|
const record$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
12
|
const staticEntries = (value) => {
|
|
@@ -106,6 +106,7 @@ const assertDeclarationOnlyOutput = ({ before, after }) => {
|
|
|
106
106
|
if (!declarationPath(file) && before[file] !== after[file]) throw new Error(`Declaration plugin changed non-declaration output: ${file}`);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
+
const withheldContextCapabilities = /* @__PURE__ */ new Set(["getNativeBuildContext"]);
|
|
109
110
|
const passiveContextMethods = /* @__PURE__ */ new Set([
|
|
110
111
|
"warn",
|
|
111
112
|
"error",
|
|
@@ -193,6 +194,7 @@ const createDeclarationEmissionLedger = () => {
|
|
|
193
194
|
methods.set(key, forwarded);
|
|
194
195
|
return forwarded;
|
|
195
196
|
}
|
|
197
|
+
if (withheldContextCapabilities.has(key)) return void 0;
|
|
196
198
|
const value = receiver[key];
|
|
197
199
|
if (key === "meta") return contextData(value);
|
|
198
200
|
if (value === null || [
|
|
@@ -221,6 +223,42 @@ const createDeclarationEmissionLedger = () => {
|
|
|
221
223
|
audit
|
|
222
224
|
};
|
|
223
225
|
};
|
|
226
|
+
const idPattern = (value) => {
|
|
227
|
+
if (value === void 0 || typeof value === "string") return value;
|
|
228
|
+
if (value instanceof RegExp) return value;
|
|
229
|
+
if (Array.isArray(value) && value.every((entry) => typeof entry === "string" || entry instanceof RegExp)) return value;
|
|
230
|
+
throw new Error("Declaration hook filters may only name static ids");
|
|
231
|
+
};
|
|
232
|
+
const dataEntries = (value, keys) => Reflect.ownKeys(value).map((key) => {
|
|
233
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
234
|
+
if (typeof key !== "string" || !keys.includes(key) || !descriptor) throw new Error("Invalid reviewed declaration hook");
|
|
235
|
+
if (!("value" in descriptor)) throw new Error("Declaration hooks cannot contain accessors");
|
|
236
|
+
return [key, descriptor.value];
|
|
237
|
+
});
|
|
238
|
+
/**
|
|
239
|
+
* Split a plugin hook into its function and the static id filter of the
|
|
240
|
+
* object form; a filter only narrows which modules reach the handler.
|
|
241
|
+
*/
|
|
242
|
+
const declarationHookParts = (value) => {
|
|
243
|
+
if (typeof value === "function") return { handler: value };
|
|
244
|
+
if (!record$1(value)) throw new Error("Invalid reviewed declaration hook");
|
|
245
|
+
const parts = Object.fromEntries(dataEntries(value, ["handler", "filter"]));
|
|
246
|
+
const filter = parts["filter"];
|
|
247
|
+
if (filter === void 0) return { handler: parts["handler"] };
|
|
248
|
+
if (!record$1(filter)) throw new Error("Invalid reviewed declaration hook");
|
|
249
|
+
const id = Object.fromEntries(dataEntries(filter, ["id"]))["id"];
|
|
250
|
+
if (!record$1(id)) throw new Error("Invalid reviewed declaration hook");
|
|
251
|
+
const idFilter = Object.fromEntries(dataEntries(id, ["include", "exclude"]));
|
|
252
|
+
const ids = {};
|
|
253
|
+
const include = idPattern(idFilter["include"]);
|
|
254
|
+
const exclude = idPattern(idFilter["exclude"]);
|
|
255
|
+
if (include !== void 0) ids.include = include;
|
|
256
|
+
if (exclude !== void 0) ids.exclude = exclude;
|
|
257
|
+
return {
|
|
258
|
+
handler: parts["handler"],
|
|
259
|
+
filter: { id: ids }
|
|
260
|
+
};
|
|
261
|
+
};
|
|
224
262
|
/** Substitute a closed producer context while guarding the actual hook invocation. */
|
|
225
263
|
const guardDeclarationHook = ({ hook, hookName, outputDirectories, ledger = createDeclarationEmissionLedger() }) => {
|
|
226
264
|
if (typeof hook !== "function") throw new Error("Invalid reviewed declaration hook");
|
|
@@ -305,11 +343,13 @@ const declarationOnlyDts = ({ directory, ...options }) => {
|
|
|
305
343
|
const outputDirectories = [];
|
|
306
344
|
const ledger = createDeclarationEmissionLedger();
|
|
307
345
|
const hook = (name) => guardDeclarationHook({
|
|
308
|
-
hook: plugin[name],
|
|
346
|
+
hook: declarationHookParts(plugin[name]).handler,
|
|
309
347
|
hookName: name,
|
|
310
348
|
outputDirectories,
|
|
311
349
|
ledger
|
|
312
350
|
});
|
|
351
|
+
const transformFilter = declarationHookParts(plugin["transform"]).filter;
|
|
352
|
+
const transform = hook("transform");
|
|
313
353
|
const configResolved = hook("configResolved");
|
|
314
354
|
return {
|
|
315
355
|
name: "stll:declaration-only-dts",
|
|
@@ -335,7 +375,10 @@ const declarationOnlyDts = ({ directory, ...options }) => {
|
|
|
335
375
|
await configResolved.call(this, config);
|
|
336
376
|
},
|
|
337
377
|
buildStart: hook("buildStart"),
|
|
338
|
-
transform:
|
|
378
|
+
transform: transformFilter === void 0 ? transform : {
|
|
379
|
+
filter: transformFilter,
|
|
380
|
+
handler: transform
|
|
381
|
+
},
|
|
339
382
|
watchChange: hook("watchChange"),
|
|
340
383
|
generateBundle: {
|
|
341
384
|
order: "post",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-build-target-vite-dts-helper2.mjs","names":["record"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.0.3\",\n \"unplugin-dts\": \"1.0.3\",\n} as const;\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst staticEntries = (value: unknown): [string, unknown][] => {\n if (\n !record(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n )\n throw new Error(\"Declaration plugin options must be plain static records\");\n return Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !descriptor || !(\"value\" in descriptor))\n throw new Error(\n \"Declaration plugin options cannot contain accessors or symbols\",\n );\n return [key, descriptor.value];\n });\n};\n\nconst relativePattern = (value: unknown): string => {\n if (\n typeof value !== \"string\" ||\n value.trim() === \"\" ||\n path.posix.isAbsolute(value) ||\n /^[A-Za-z]:/.test(value) ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin paths must stay within the package\");\n return value;\n};\nconst patterns = (value: unknown) => {\n if (typeof value === \"string\") return relativePattern(value);\n if (!Array.isArray(value) || value.length === 0)\n throw new Error(\"Declaration plugin include/exclude must be static paths\");\n return Object.freeze(value.map(relativePattern));\n};\n\n/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */\nexport type ReviewedViteDtsOptions = {\n include?: string | readonly string[];\n exclude?: string | readonly string[];\n entryRoot?: string;\n pathsToAliases?: boolean;\n compilerOptions?: Readonly<{ declarationMap: false }>;\n strictOutput?: true;\n declarationOnly?: false;\n};\nexport const reviewedViteDtsOptions = (value: unknown = {}) => {\n const result: ReviewedViteDtsOptions = {};\n for (const [key, entry] of staticEntries(value)) {\n switch (key) {\n case \"include\":\n case \"exclude\":\n result[key] = patterns(entry);\n break;\n case \"entryRoot\":\n result.entryRoot = relativePattern(entry);\n break;\n case \"pathsToAliases\":\n if (typeof entry !== \"boolean\")\n throw new Error(\"pathsToAliases must be a static boolean\");\n result.pathsToAliases = entry;\n break;\n case \"compilerOptions\": {\n const entries = staticEntries(entry);\n if (\n entries.length !== 1 ||\n entries.at(0)?.[0] !== \"declarationMap\" ||\n entries.at(0)?.[1] !== false\n )\n throw new Error(\n \"Only compilerOptions.declarationMap=false is reviewed\",\n );\n result.compilerOptions = Object.freeze({ declarationMap: false });\n break;\n }\n case \"strictOutput\":\n if (entry !== true)\n throw new Error(\"Declaration output containment cannot be disabled\");\n result.strictOutput = true;\n break;\n case \"declarationOnly\":\n if (entry !== false)\n throw new Error(\n \"Declaration plugin cannot remove JavaScript outputs\",\n );\n result.declarationOnly = false;\n break;\n default:\n throw new Error(`Unreviewed declaration plugin option: ${key}`);\n }\n }\n return Object.freeze(result);\n};\n\nexport type DeclarationOutputSnapshot = Readonly<Record<string, string>>;\nconst hash = (value: string | Uint8Array) =>\n createHash(\"sha256\").update(value).digest(\"hex\");\nexport const declarationPath = (file: string) =>\n /\\.d\\.(?:ts|mts|cts)(?:\\.map)?$/.test(file);\nconst safeOutputPath = (file: string) => {\n if (\n file === \"\" ||\n path.posix.isAbsolute(file) ||\n /^[A-Za-z]:/.test(file) ||\n file.includes(\"\\\\\") ||\n file\n .split(\"\")\n .some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n ) ||\n file.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Declaration plugin emitted an unsafe output path\");\n};\n\n/** Capture bytes now; later mutations cannot alter this frozen snapshot. */\nexport const snapshotDeclarationDirectory = (\n directory: string,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n if (lstatSync(directory, { throwIfNoEntry: false }) === undefined)\n return Object.freeze(result);\n const visit = (current: string) => {\n const stat = lstatSync(current);\n if (stat.isSymbolicLink())\n throw new Error(\"Declaration output cannot contain symlinks\");\n if (stat.isDirectory()) {\n for (const entry of readdirSync(current))\n visit(path.join(current, entry));\n return;\n }\n if (!stat.isFile())\n throw new Error(\"Declaration output must contain regular files\");\n Object.defineProperty(\n result,\n path.relative(directory, current).split(path.sep).join(\"/\"),\n { value: hash(readFileSync(current)), enumerable: true },\n );\n };\n visit(directory);\n return Object.freeze(result);\n};\n\nexport const snapshotDeclarationBundle = (\n bundle: unknown,\n): DeclarationOutputSnapshot => {\n const result: Record<string, string> = {};\n for (const [file, entry] of staticEntries(bundle)) {\n safeOutputPath(file);\n if (\n !record(entry) ||\n entry[\"fileName\"] !== file ||\n ![\"asset\", \"chunk\"].includes(String(entry[\"type\"]))\n )\n throw new Error(\"Invalid declaration bundle entry\");\n if (declarationPath(file) && entry[\"type\"] !== \"asset\")\n throw new Error(\"Declarations must be emitted as assets\");\n const type = entry[\"type\"];\n const bytes = type === \"chunk\" ? entry[\"code\"] : entry[\"source\"];\n if (typeof bytes !== \"string\" && !(bytes instanceof Uint8Array))\n throw new Error(\"Declaration bundle output must contain text or bytes\");\n Object.defineProperty(result, file, {\n value: `${String(type)}:${hash(bytes)}`,\n enumerable: true,\n });\n }\n return Object.freeze(result);\n};\n\ntype DeclarationOutputOptions = {\n before: DeclarationOutputSnapshot;\n after: DeclarationOutputSnapshot;\n};\n/** This plugin may only add or change declaration files; every existing non-declaration is immutable. */\nexport const assertDeclarationOnlyOutput = ({\n before,\n after,\n}: DeclarationOutputOptions) => {\n for (const file of new Set([...Object.keys(before), ...Object.keys(after)])) {\n safeOutputPath(file);\n if (!declarationPath(file) && before[file] !== after[file])\n throw new Error(\n `Declaration plugin changed non-declaration output: ${file}`,\n );\n }\n};\n\nconst passiveContextMethods = new Set([\n \"warn\",\n \"error\",\n \"info\",\n \"debug\",\n \"addWatchFile\",\n \"getWatchFiles\",\n \"parse\",\n \"resolve\",\n \"getModuleInfo\",\n \"getModuleIds\",\n \"getFileName\",\n]);\nconst contextData = (value: unknown): unknown => {\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\", \"undefined\"].includes(typeof value)\n )\n return value;\n if (Array.isArray(value)) return Object.freeze(value.map(contextData));\n const snapshot = {};\n Object.setPrototypeOf(snapshot, null);\n for (const [key, entry] of staticEntries(value))\n Object.defineProperty(snapshot, key, {\n value: contextData(entry),\n enumerable: true,\n });\n return Object.freeze(snapshot);\n};\nconst declarationAssetName = (value: unknown) => {\n if (typeof value !== \"string\")\n throw new Error(\"Declaration plugin requires an explicit asset fileName\");\n safeOutputPath(value);\n if (!declarationPath(value))\n throw new Error(\n `Declaration plugin emitted non-declaration asset: ${value}`,\n );\n return value;\n};\n\n/** One build owns all emitter references, including assets materialized after the producer hook. */\nexport const createDeclarationEmissionLedger = () => {\n const references = new Map<\n string,\n { fileName: string; getFileName: () => unknown }\n >();\n const wrapContext = (host: unknown) => {\n const receiver = record(host) ? host : {};\n const hostMethod = (name: string) => {\n const method: unknown = receiver[name];\n if (typeof method !== \"function\")\n throw new Error(`Declaration plugin host method unavailable: ${name}`);\n return (...args: unknown[]): unknown =>\n Reflect.apply(method, receiver, args);\n };\n const methods = new Map<string, (...args: unknown[]) => unknown>();\n methods.set(\"emitFile\", (asset: unknown) => {\n const entries = staticEntries(asset);\n if (!record(asset) || asset[\"type\"] !== \"asset\")\n throw new Error(\"Declaration plugin may only emit assets\");\n const fileName = declarationAssetName(asset[\"fileName\"]);\n for (const [, value] of entries)\n if (typeof value === \"function\")\n throw new Error(\"Declaration plugin asset metadata must be static\");\n const source = asset[\"source\"];\n if (\n source !== undefined &&\n typeof source !== \"string\" &&\n !(source instanceof Uint8Array)\n )\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n const getFileName = hostMethod(\"getFileName\");\n const emitted: Record<string, unknown> = {};\n for (const [key, value] of entries) {\n const copied =\n value instanceof Uint8Array\n ? new Uint8Array(value)\n : contextData(value);\n Object.defineProperty(emitted, key, {\n value: copied,\n enumerable: true,\n });\n }\n const reference = hostMethod(\"emitFile\")(emitted);\n if (typeof reference !== \"string\" || references.has(reference))\n throw new Error(\n \"Declaration plugin emitted an invalid asset reference\",\n );\n references.set(reference, {\n fileName,\n getFileName: () => getFileName(reference),\n });\n return reference;\n });\n methods.set(\"setAssetSource\", (reference: unknown, source: unknown) => {\n if (typeof reference !== \"string\" || !references.has(reference))\n throw new Error(\n \"Declaration plugin cannot update a foreign asset reference\",\n );\n if (typeof source !== \"string\" && !(source instanceof Uint8Array))\n throw new Error(\n \"Declaration plugin asset source must be text or bytes\",\n );\n return hostMethod(\"setAssetSource\")(reference, source);\n });\n const surrogate: Record<string, unknown> = {};\n Object.setPrototypeOf(surrogate, null);\n return new Proxy(surrogate, {\n get: (_target, key) => {\n if (typeof key !== \"string\")\n throw new Error(\"Declaration plugin context symbols are unsupported\");\n const method = methods.get(key);\n if (method !== undefined) return method;\n if (passiveContextMethods.has(key)) {\n const forwarded = hostMethod(key);\n methods.set(key, forwarded);\n return forwarded;\n }\n const value: unknown = receiver[key];\n if (key === \"meta\") return contextData(value);\n if (\n value === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof value)\n )\n return value;\n throw new Error(\n `Declaration plugin context capability is unsupported: ${key}`,\n );\n },\n set: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n defineProperty: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n setPrototypeOf: () => {\n throw new Error(\"Declaration plugin context is readonly\");\n },\n });\n };\n const audit = () => {\n for (const [reference, emission] of references) {\n const resolved = declarationAssetName(emission.getFileName());\n if (resolved !== emission.fileName)\n throw new Error(\n `Declaration plugin asset reference changed filename: ${reference}`,\n );\n }\n };\n return { wrapContext, audit };\n};\nexport type DeclarationEmissionLedger = ReturnType<\n typeof createDeclarationEmissionLedger\n>;\n\ntype GuardDeclarationHookOptions = {\n hook: unknown;\n hookName: string;\n outputDirectories: readonly string[];\n ledger?: DeclarationEmissionLedger;\n};\n/** Substitute a closed producer context while guarding the actual hook invocation. */\nexport const guardDeclarationHook = ({\n hook,\n hookName,\n outputDirectories,\n ledger = createDeclarationEmissionLedger(),\n}: GuardDeclarationHookOptions) => {\n if (typeof hook !== \"function\")\n throw new Error(\"Invalid reviewed declaration hook\");\n const producer = hook;\n async function guarded(this: unknown, ...args: unknown[]) {\n const beforeDirectories = outputDirectories.map(\n snapshotDeclarationDirectory,\n );\n const bundle = [\"generateBundle\", \"writeBundle\"].includes(hookName)\n ? args.at(1)\n : undefined;\n const beforeBundle =\n bundle === undefined ? undefined : snapshotDeclarationBundle(bundle);\n const result: unknown = await Reflect.apply(\n producer,\n ledger.wrapContext(this),\n args,\n );\n if (result !== undefined)\n throw new Error(\n `Declaration plugin hook ${hookName} returned a dynamic build change`,\n );\n if (beforeBundle !== undefined)\n assertDeclarationOnlyOutput({\n before: beforeBundle,\n after: snapshotDeclarationBundle(bundle),\n });\n for (const [index, directory] of outputDirectories.entries()) {\n const before = beforeDirectories.at(index);\n if (before === undefined)\n throw new Error(\"Missing declaration output snapshot\");\n assertDeclarationOnlyOutput({\n before,\n after: snapshotDeclarationDirectory(directory),\n });\n }\n if ([\"generateBundle\", \"writeBundle\"].includes(hookName)) ledger.audit();\n return result;\n }\n return guarded;\n};\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\n\nimport { compilerPackages } from \"./compiler-packages\";\nimport {\n createDeclarationEmissionLedger,\n guardDeclarationHook,\n type ReviewedViteDtsOptions,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: plugin[name],\n hookName: name,\n outputDirectories,\n ledger,\n });\n const configResolved = hook(\"configResolved\");\n return {\n name: \"stll:declaration-only-dts\",\n apply: \"build\",\n enforce: \"pre\",\n config: hook(\"config\"),\n async configResolved(config) {\n if (\n realpathSync(config.root) !== root ||\n config.build.write === false ||\n config.build.watch\n )\n throw new Error(\n \"Declaration-only adapter requires a package-local production build\",\n );\n const output = path.resolve(root, config.build.outDir);\n const relative = path.relative(root, output);\n if (\n relative === \"\" ||\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n )\n throw new Error(\n \"Declaration output directory must stay within the package\",\n );\n // Check existing ancestor paths before the declaration plugin can write.\n let ancestor = output;\n while (ancestor !== root) {\n try {\n const resolved = realpathSync(ancestor);\n const within = path.relative(root, resolved);\n if (\n within === \"..\" ||\n within.startsWith(`..${path.sep}`) ||\n path.isAbsolute(within)\n )\n throw new Error(\"Declaration output directory leaves the package\");\n break;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"ENOENT\") throw error;\n ancestor = path.dirname(ancestor);\n }\n }\n outputDirectories.push(output);\n await configResolved.call(this, config);\n },\n buildStart: hook(\"buildStart\"),\n transform: hook(\"transform\"),\n watchChange: hook(\"watchChange\"),\n generateBundle: {\n order: \"post\",\n async handler(outputOptions, bundle, isWrite) {\n await hook(\"generateBundle\").call(this, outputOptions, bundle, isWrite);\n ledger.audit();\n },\n },\n writeBundle: {\n order: \"post\",\n async handler(outputOptions, bundle) {\n await hook(\"writeBundle\").call(this, outputOptions, bundle);\n ledger.audit();\n },\n },\n };\n};\n"],"mappings":";;;;;;AAIA,MAAa,0BAA0B;CACrC,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,iBAAiB,UAAwC;CAC7D,IACE,CAACA,SAAO,KAAK,KACb,CAAC,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,eAAe,KAAK,CAAC,GAE/D,MAAM,IAAI,MAAM,yDAAyD;CAC3E,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,QAAQ;EACzC,MAAM,aAAa,OAAO,yBAAyB,O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,QAAQ,GAExB,MAAM,IAAI,MACR,2DACF;GAEF,IAAI,WAAW;GACf,OAAO,aAAa,MAClB,IAAI;IACF,MAAM,WAAW,aAAa,QAAQ;IACtC,MAAM,SAAS,KAAK,SAAS,MAAM,QAAQ;IAC3C,IACE,WAAW,QACX,OAAO,WAAW,KAAK,KAAK,KAAK,KACjC,KAAK,WAAW,MAAM,GAEtB,MAAM,IAAI,MAAM,iDAAiD;IACnE;GACF,SAAS,OAAO;IACd,IAAI,CAAC,OAAO,KAAK,KAAK,MAAM,YAAY,UAAU,MAAM;IACxD,WAAW,KAAK,QAAQ,QAAQ;GAClC;GAEF,kBAAkB,KAAK,MAAM;GAC7B,MAAM,eAAe,KAAK,MAAM,MAAM;EACxC;EACA,YAAY,KAAK,YAAY;EAC7B,WAAW,KAAK,WAAW;EAC3B,aAAa,KAAK,aAAa;EAC/B,gBAAgB;GACd,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ,SAAS;IAC5C,MAAM,KAAK,gBAAgB,CAAC,CAAC,KAAK,MAAM,eAAe,QAAQ,OAAO;IACtE,OAAO,MAAM;GACf;EACF;EACA,aAAa;GACX,OAAO;GACP,MAAM,QAAQ,eAAe,QAAQ;IACnC,MAAM,KAAK,aAAa,CAAC,CAAC,KAAK,MAAM,eAAe,MAAM;IAC1D,OAAO,MAAM;GACf;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"publish-build-target-vite-dts-helper2.mjs","names":["record"],"sources":["../src/publish-build-target-vite-dts.ts","../src/publish-build-target-vite-dts-helper.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nexport const reviewedViteDtsVersions = {\n \"vite-plugin-dts\": \"5.1.2\",\n \"unplugin-dts\": \"1.1.2\",\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\n// Optional capabilities the plugin probes and handles as absent: withholding\n// the native bundler context keeps it on its bundler-neutral path.\nconst withheldContextCapabilities = new Set([\"getNativeBuildContext\"]);\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 if (withheldContextCapabilities.has(key)) return undefined;\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 IdPattern = string | RegExp | (string | RegExp)[];\ntype DeclarationHookFilter = {\n id: { include?: IdPattern; exclude?: IdPattern };\n};\n\nconst idPattern = (value: unknown): IdPattern | undefined => {\n if (value === undefined || typeof value === \"string\") return value;\n if (value instanceof RegExp) return value;\n if (\n Array.isArray(value) &&\n value.every(\n (entry): entry is string | RegExp =>\n typeof entry === \"string\" || entry instanceof RegExp,\n )\n )\n return value;\n throw new Error(\"Declaration hook filters may only name static ids\");\n};\n\nconst dataEntries = (value: Record<string, unknown>, keys: string[]) =>\n Reflect.ownKeys(value).map((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || !keys.includes(key) || !descriptor)\n throw new Error(\"Invalid reviewed declaration hook\");\n if (!(\"value\" in descriptor))\n throw new Error(\"Declaration hooks cannot contain accessors\");\n return [key, descriptor.value] as const;\n });\n\n/**\n * Split a plugin hook into its function and the static id filter of the\n * object form; a filter only narrows which modules reach the handler.\n */\nexport const declarationHookParts = (\n value: unknown,\n): { handler: unknown; filter?: DeclarationHookFilter } => {\n if (typeof value === \"function\") return { handler: value };\n if (!record(value)) throw new Error(\"Invalid reviewed declaration hook\");\n const parts = Object.fromEntries(dataEntries(value, [\"handler\", \"filter\"]));\n const filter = parts[\"filter\"];\n if (filter === undefined) return { handler: parts[\"handler\"] };\n if (!record(filter)) throw new Error(\"Invalid reviewed declaration hook\");\n const id = Object.fromEntries(dataEntries(filter, [\"id\"]))[\"id\"];\n if (!record(id)) throw new Error(\"Invalid reviewed declaration hook\");\n const idFilter = Object.fromEntries(dataEntries(id, [\"include\", \"exclude\"]));\n const ids: DeclarationHookFilter[\"id\"] = {};\n const include = idPattern(idFilter[\"include\"]);\n const exclude = idPattern(idFilter[\"exclude\"]);\n if (include !== undefined) ids.include = include;\n if (exclude !== undefined) ids.exclude = exclude;\n return { handler: parts[\"handler\"], filter: { id: ids } };\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 declarationHookParts,\n guardDeclarationHook,\n type ReviewedViteDtsOptions,\n reviewedViteDtsOptions,\n reviewedViteDtsVersions,\n} from \"./publish-build-target-vite-dts\";\n\ntype DeclarationOnlyDtsOptions = { directory: string } & ReviewedViteDtsOptions;\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The actual build uses this closed factory and its guarded declaration hooks. */\nexport const declarationOnlyDts = ({\n directory,\n ...options\n}: DeclarationOnlyDtsOptions): Plugin => {\n const root = realpathSync(directory);\n const require = createRequire(path.join(root, \"package.json\"));\n const pluginRequire = createRequire(require.resolve(\"vite-plugin-dts\"));\n for (const [name, version] of Object.entries(reviewedViteDtsVersions)) {\n const owner = name === \"unplugin-dts\" ? pluginRequire : require;\n const metadata: unknown = JSON.parse(\n readFileSync(owner.resolve(`${name}/package.json`), \"utf8\"),\n );\n if (!record(metadata) || metadata[\"version\"] !== version)\n throw new Error(`Declaration-only adapter requires ${name} ${version}`);\n }\n const compilerRequire = createRequire(pluginRequire.resolve(\"unplugin-dts\"));\n const compilerVersion = (name: string) => {\n try {\n const metadata: unknown = JSON.parse(\n readFileSync(compilerRequire.resolve(`${name}/package.json`), \"utf8\"),\n );\n return record(metadata) && typeof metadata[\"version\"] === \"string\"\n ? metadata[\"version\"]\n : undefined;\n } catch (error) {\n if (!record(error) || error[\"code\"] !== \"MODULE_NOT_FOUND\") throw error;\n return undefined;\n }\n };\n const primaryCompiler = compilerVersion(compilerPackages.typescript);\n const compatibleCompiler =\n primaryCompiler === \"6.0.3\" ||\n (primaryCompiler?.startsWith(\"7.\") === true &&\n compilerVersion(compilerPackages.typescriptCompatibility) === \"6.0.3\");\n if (!compatibleCompiler)\n throw new Error(\n \"Declaration-only adapter requires TypeScript 6.0.3 as typescript or the TypeScript 7 @typescript/typescript6 fallback in the declaration plugin's dependency scope\",\n );\n const loaded: unknown = require(\"vite-plugin-dts\");\n const factory = record(loaded) ? loaded[\"default\"] : loaded;\n if (typeof factory !== \"function\")\n throw new Error(\"Installed declaration plugin does not expose its factory\");\n const plugin: unknown = Reflect.apply(factory, undefined, [\n reviewedViteDtsOptions(options),\n ]);\n if (!record(plugin)) throw new Error(\"Invalid installed declaration plugin\");\n const hookNames = [\n \"config\",\n \"configResolved\",\n \"buildStart\",\n \"transform\",\n \"watchChange\",\n \"generateBundle\",\n \"writeBundle\",\n ] as const;\n const allowed = new Set<string>([\n \"name\",\n \"apply\",\n \"enforce\",\n \"vite\",\n \"rollup\",\n \"rolldown\",\n \"webpack\",\n \"rspack\",\n \"esbuild\",\n ...hookNames,\n ]);\n for (const key of Reflect.ownKeys(plugin)) {\n const descriptor = Object.getOwnPropertyDescriptor(plugin, key);\n if (\n typeof key !== \"string\" ||\n !allowed.has(key) ||\n !descriptor ||\n !(\"value\" in descriptor)\n )\n throw new Error(\"Unreviewed installed declaration plugin shape\");\n }\n if (\n plugin[\"name\"] !== \"unplugin-dts\" ||\n plugin[\"apply\"] !== \"build\" ||\n plugin[\"enforce\"] !== \"pre\"\n )\n throw new Error(\"Unreviewed installed declaration plugin identity\");\n const outputDirectories: string[] = [];\n // Only the dts producer is confined here; JS emitted by other plugins is out of scope.\n // Resolve its emitter references at both output hooks, including deferred assets.\n const ledger = createDeclarationEmissionLedger();\n const hook = (name: (typeof hookNames)[number]) =>\n guardDeclarationHook({\n hook: declarationHookParts(plugin[name]).handler,\n hookName: name,\n outputDirectories,\n ledger,\n });\n // The object form's static id filter is kept; its handler stays guarded.\n const transformFilter = declarationHookParts(plugin[\"transform\"]).filter;\n const transform = hook(\"transform\");\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:\n transformFilter === undefined\n ? transform\n : { filter: transformFilter, handler: transform },\n watchChange: hook(\"watchChange\"),\n generateBundle: {\n order: \"post\",\n async handler(outputOptions, bundle, isWrite) {\n await hook(\"generateBundle\").call(this, outputOptions, bundle, isWrite);\n ledger.audit();\n },\n },\n writeBundle: {\n order: \"post\",\n async handler(outputOptions, bundle) {\n await hook(\"writeBundle\").call(this, outputOptions, bundle);\n ledger.audit();\n },\n },\n };\n};\n"],"mappings":";;;;;;AAIA,MAAa,0BAA0B;CACrC,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,iBAAiB,UAAwC;CAC7D,IACE,CAACA,SAAO,KAAK,KACb,CAAC,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,eAAe,KAAK,CAAC,GAE/D,MAAM,IAAI,MAAM,yDAAyD;CAC3E,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,QAAQ;EACzC,MAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;EAC7D,IAAI,OAAO,QAAQ,YAAY,CAAC,cAAc,EAAE,WAAW,aACzD,MAAM,IAAI,MACR,gEACF;EACF,OAAO,CAAC,KAAK,WAAW,KAAK;CAC/B,CAAC;AACH;AAEA,MAAM,mBAAmB,UAA2B;CAClD,IACE,OAAO,UAAU,YACjB,MAAM,KAAK,MAAM,MACjB,KAAK,MAAM,WAAW,KAAK,KAC3B,aAAa,KAAK,KAAK,KACvB,MAAM,SAAS,IAAI,KACnB,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,IAAI,GAE9B,MAAM,IAAI,MAAM,uDAAuD;CACzE,OAAO;AACT;AACA,MAAM,YAAY,UAAmB;CACnC,IAAI,OAAO,UAAU,UAAU,OAAO,gBAAgB,KAAK;CAC3D,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAC5C,MAAM,IAAI,MAAM,yDAAyD;CAC3E,OAAO,OAAO,OAAO,MAAM,IAAI,eAAe,CAAC;AACjD;AAYA,MAAa,0BAA0B,QAAiB,CAAC,MAAM;CAC7D,MAAM,SAA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;GACF,SAAS,OAAO;IACd,IAAI,CAAC,OAAO,KAAK,KAAK,MAAM,YAAY,UAAU,MAAM;IACxD,WAAW,KAAK,QAAQ,QAAQ;GAClC;GAEF,kBAAkB,KAAK,MAAM;GAC7B,MAAM,eAAe,KAAK,MAAM,MAAM;EACxC;EACA,YAAY,KAAK,YAAY;EAC7B,WACE,oBAAoB,KAAA,IAChB,YACA;GAAE,QAAQ;GAAiB,SAAS;EAAU;EACpD,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"}
|
|
@@ -244,7 +244,7 @@ export const resolve=(specifier,context,next)=>{
|
|
|
244
244
|
};
|
|
245
245
|
//#endregion
|
|
246
246
|
//#region src/publish-build-target-vite.ts
|
|
247
|
-
const supportedViteVersion = "8.
|
|
247
|
+
const supportedViteVersion = "8.3.4";
|
|
248
248
|
const declarationHelperImport = "@stll/oxlint-config/declaration-only-dts";
|
|
249
249
|
const record$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
250
250
|
const walkAst = ({ value, visit, parent }) => {
|
|
@@ -673,7 +673,7 @@ const resolveVitePublishTarget = async (directory) => {
|
|
|
673
673
|
};
|
|
674
674
|
//#endregion
|
|
675
675
|
//#region src/publish-build-target.ts
|
|
676
|
-
const supportedTsdownVersion = "0.
|
|
676
|
+
const supportedTsdownVersion = "0.23.1";
|
|
677
677
|
const record = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
678
678
|
const targets = (value) => {
|
|
679
679
|
if (value === void 0) return ["esnext"];
|