@stll/oxlint-config 1.3.1 → 1.5.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 +341 -28
- package/dist/cloud-setup-cli.cjs +20 -40
- package/dist/cloud-setup-cli.cjs.map +1 -1
- package/dist/cloud-setup-cli.mjs +21 -41
- package/dist/cloud-setup-cli.mjs.map +1 -1
- package/dist/consumer-compat-cli.cjs +52 -251
- package/dist/consumer-compat-cli.cjs.map +1 -1
- package/dist/consumer-compat-cli.mjs +7 -206
- package/dist/consumer-compat-cli.mjs.map +1 -1
- package/dist/consumer-node-support.cjs +497 -0
- package/dist/consumer-node-support.cjs.map +1 -0
- package/dist/consumer-node-support.mjs +381 -0
- package/dist/consumer-node-support.mjs.map +1 -0
- package/dist/dependabot-cli.cjs +91 -0
- package/dist/dependabot-cli.cjs.map +1 -0
- package/dist/dependabot-cli.d.cts +1 -0
- package/dist/dependabot-cli.d.mts +1 -0
- package/dist/dependabot-cli.mjs +91 -0
- package/dist/dependabot-cli.mjs.map +1 -0
- package/dist/dependabot.cjs +7 -0
- package/dist/dependabot.d.cts +118 -0
- package/dist/dependabot.d.mts +118 -0
- package/dist/dependabot.mjs +3 -0
- package/dist/generated-file.cjs +61 -0
- package/dist/generated-file.cjs.map +1 -0
- package/dist/generated-file.mjs +44 -0
- package/dist/generated-file.mjs.map +1 -0
- package/dist/git-tracked-output.cjs +2 -2
- package/dist/git-tracked-output.mjs +1 -1
- package/dist/jsonc.cjs +66 -0
- package/dist/jsonc.cjs.map +1 -0
- package/dist/jsonc.mjs +61 -0
- package/dist/jsonc.mjs.map +1 -0
- package/dist/publish-artifact-syntax.cjs +1309 -0
- package/dist/publish-artifact-syntax.cjs.map +1 -0
- package/dist/publish-artifact-syntax.mjs +1265 -0
- package/dist/publish-artifact-syntax.mjs.map +1 -0
- package/dist/publish-build-target-vite-dts-helper2.cjs +1 -1
- package/dist/publish-build-target-vite-dts-helper2.mjs +1 -1
- package/dist/publish-contract-cli.cjs +55 -14
- package/dist/publish-contract-cli.cjs.map +1 -1
- package/dist/publish-contract-cli.mjs +50 -9
- package/dist/publish-contract-cli.mjs.map +1 -1
- package/dist/quarantine-cli.cjs +66 -0
- package/dist/quarantine-cli.cjs.map +1 -0
- package/dist/quarantine-cli.d.cts +1 -0
- package/dist/quarantine-cli.d.mts +1 -0
- package/dist/quarantine-cli.mjs +66 -0
- package/dist/quarantine-cli.mjs.map +1 -0
- package/dist/quarantine-policy.cjs +10 -0
- package/dist/quarantine-policy.d.cts +27 -0
- package/dist/quarantine-policy.d.mts +27 -0
- package/dist/quarantine-policy.mjs +1 -0
- package/dist/quarantine-policy2.cjs +399 -0
- package/dist/quarantine-policy2.cjs.map +1 -0
- package/dist/quarantine-policy2.mjs +352 -0
- package/dist/quarantine-policy2.mjs.map +1 -0
- package/dist/toolchain-changed.cjs +16 -67
- package/dist/toolchain-changed.cjs.map +1 -1
- package/dist/toolchain-changed.mjs +19 -70
- package/dist/toolchain-changed.mjs.map +1 -1
- package/dist/toolchain-check-cli.cjs +1 -0
- package/dist/toolchain-check-cli.cjs.map +1 -1
- package/dist/toolchain-check-cli.mjs +1 -0
- package/dist/toolchain-check-cli.mjs.map +1 -1
- package/dist/toolchain-dependabot.cjs +529 -0
- package/dist/toolchain-dependabot.cjs.map +1 -0
- package/dist/toolchain-dependabot.mjs +485 -0
- package/dist/toolchain-dependabot.mjs.map +1 -0
- package/dist/toolchain-guard.cjs +1143 -432
- package/dist/toolchain-guard.cjs.map +1 -1
- package/dist/toolchain-guard.mjs +1132 -421
- package/dist/toolchain-guard.mjs.map +1 -1
- package/dist/toolchain-inputs.cjs +216 -38
- package/dist/toolchain-inputs.cjs.map +1 -1
- package/dist/toolchain-inputs.mjs +213 -41
- package/dist/toolchain-inputs.mjs.map +1 -1
- package/dist/toolchain-schema.cjs +0 -493
- package/dist/toolchain-schema.cjs.map +1 -1
- package/dist/toolchain-schema.mjs +3 -379
- package/dist/toolchain-schema.mjs.map +1 -1
- package/dist/typecheck-parity.cjs +4 -3
- package/dist/typecheck-parity.cjs.map +1 -1
- package/dist/typecheck-parity.mjs +4 -3
- package/dist/typecheck-parity.mjs.map +1 -1
- package/dist/typecheck-probe-cli.cjs +3 -3
- package/dist/typecheck-probe-cli.cjs.map +1 -1
- package/dist/typecheck-probe-cli.mjs +3 -3
- package/dist/typecheck-probe-cli.mjs.map +1 -1
- package/package.json +25 -1
- package/toolchain.json +11 -4
- package/dist/publish-contract.cjs +0 -431
- package/dist/publish-contract.cjs.map +0 -1
- package/dist/publish-contract.mjs +0 -396
- package/dist/publish-contract.mjs.map +0 -1
package/toolchain.json
CHANGED
|
@@ -25,14 +25,16 @@
|
|
|
25
25
|
"typescript6Compatibility": {
|
|
26
26
|
"version": "6.0.3",
|
|
27
27
|
"packageAlias": "typescript-compat",
|
|
28
|
-
"apiConsumers": [
|
|
28
|
+
"apiConsumers": [
|
|
29
|
+
"TypeScript compiler API"
|
|
30
|
+
],
|
|
29
31
|
"peerBlockers": [
|
|
30
32
|
"@astrojs/check",
|
|
31
33
|
"@typescript-eslint/utils",
|
|
32
34
|
"dependency-cruiser"
|
|
33
35
|
]
|
|
34
36
|
},
|
|
35
|
-
"@stll/oxlint-plugin": "0.
|
|
37
|
+
"@stll/oxlint-plugin": "0.3.0",
|
|
36
38
|
"lefthook": "2.1.16",
|
|
37
39
|
"node": "26.x",
|
|
38
40
|
"postgres": "18",
|
|
@@ -119,8 +121,13 @@
|
|
|
119
121
|
},
|
|
120
122
|
"groups": {
|
|
121
123
|
"dependencies": {
|
|
122
|
-
"patterns": [
|
|
123
|
-
|
|
124
|
+
"patterns": [
|
|
125
|
+
"*"
|
|
126
|
+
],
|
|
127
|
+
"updateTypes": [
|
|
128
|
+
"minor",
|
|
129
|
+
"patch"
|
|
130
|
+
]
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
133
|
},
|
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
const require_toolchain_inputs = require("./toolchain-inputs.cjs");
|
|
2
|
-
const require_toolchain_schema = require("./toolchain-schema.cjs");
|
|
3
|
-
let semver = require("semver");
|
|
4
|
-
let node_util = require("node:util");
|
|
5
|
-
let yaml = require("yaml");
|
|
6
|
-
//#region src/consumer-release-pack.ts
|
|
7
|
-
const record$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
|
-
const exactVersion = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
|
|
9
|
-
const outputDirectory = "<consumer-release-pack-output>";
|
|
10
|
-
const packerSetupExpression = /^npm\s+install\s+((?:(?:--global|-g|--ignore-scripts)\s+)+)(npm|pnpm)@([^\s]+)$/;
|
|
11
|
-
const defaultRunShell = (defaults) => {
|
|
12
|
-
if (!record$1(defaults) || !record$1(defaults["run"])) return void 0;
|
|
13
|
-
return defaults["run"]["shell"];
|
|
14
|
-
};
|
|
15
|
-
const packArguments = (line) => {
|
|
16
|
-
const command = /^(npm|pnpm)\s+pack(?:\s+(.*))?$/.exec(line);
|
|
17
|
-
const manager = command?.[1];
|
|
18
|
-
if (manager !== "npm" && manager !== "pnpm") throw new Error("Unsupported release pack command");
|
|
19
|
-
const tokens = (command?.[2] ?? "").match(/"[^"\n]*"|'[^'\n]*'|[^\s]+/g) ?? [];
|
|
20
|
-
const args = [];
|
|
21
|
-
let destination = false;
|
|
22
|
-
for (let index = 0; index < tokens.length; index++) {
|
|
23
|
-
const token = tokens.at(index);
|
|
24
|
-
if (token === "--pack-destination") {
|
|
25
|
-
if (destination) throw new Error("Repeated release pack destination");
|
|
26
|
-
const value = tokens.at(++index);
|
|
27
|
-
if (value === void 0 || !/^(?:"\$GITHUB_WORKSPACE\/[A-Za-z0-9_/-]+"|[A-Za-z0-9_/-]+)$/.test(value) || value.split("/").includes("..")) throw new Error("Unsupported release pack destination");
|
|
28
|
-
destination = true;
|
|
29
|
-
args.push(token, outputDirectory);
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (token !== "--ignore-scripts" && !(manager === "pnpm" && token === "--config.ignore-scripts=true") && token !== "--json" && token !== "--silent") throw new Error("Unsupported release pack arguments");
|
|
33
|
-
if (args.includes(token)) throw new Error("Repeated release pack flag");
|
|
34
|
-
args.push(token);
|
|
35
|
-
}
|
|
36
|
-
if (!destination || !args.includes("--ignore-scripts") && !args.includes("--config.ignore-scripts=true")) throw new Error("Release pack requires scripts disabled and --pack-destination");
|
|
37
|
-
return {
|
|
38
|
-
manager,
|
|
39
|
-
arguments: args
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
/** Both setup provenance and packing require unconditional shell commands. */
|
|
43
|
-
const assertReleaseShellContext = ({ step, kind, location, inheritedShell }) => {
|
|
44
|
-
const run = step["run"];
|
|
45
|
-
if (typeof run !== "string") throw new Error(`Unsupported release ${kind} shell context: ${location}`);
|
|
46
|
-
const shell = step["shell"] === void 0 ? inheritedShell : step["shell"];
|
|
47
|
-
if (shell !== void 0 && shell !== "bash" && shell !== "sh") throw new Error(`Unsupported release ${kind} shell context: ${location}`);
|
|
48
|
-
let quote;
|
|
49
|
-
let code = "";
|
|
50
|
-
for (let index = 0; index < run.length; index += 1) {
|
|
51
|
-
const char = run[index];
|
|
52
|
-
if (char === "\n") {
|
|
53
|
-
if (quote !== void 0) throw new Error(`Unsupported release ${kind} shell context: ${location}`);
|
|
54
|
-
code += "\n";
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (quote !== "single" && char === "\\") {
|
|
58
|
-
if (run[index + 1] === "\n" || run[index + 1] === "\r" && run[index + 2] === "\n") throw new Error(`Unsupported release ${kind} shell context: ${location}`);
|
|
59
|
-
index += 1;
|
|
60
|
-
code += " ";
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
if (quote !== "single" && (char === "`" || char === "$" && run[index + 1] === "(")) throw new Error(`Unsupported release ${kind} shell context: ${location}`);
|
|
64
|
-
if (quote === "single") {
|
|
65
|
-
if (char === "'") quote = void 0;
|
|
66
|
-
code += " ";
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (quote === "double") {
|
|
70
|
-
if (char === "\"") quote = void 0;
|
|
71
|
-
code += " ";
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
if (char === "'") {
|
|
75
|
-
quote = "single";
|
|
76
|
-
code += " ";
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (char === "\"") {
|
|
80
|
-
quote = "double";
|
|
81
|
-
code += " ";
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
if (char === "#" && (index === 0 || /\s/.test(run[index - 1] ?? ""))) {
|
|
85
|
-
while (index + 1 < run.length && run[index + 1] !== "\n") index += 1;
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
code += char;
|
|
89
|
-
}
|
|
90
|
-
if (quote !== void 0 || /[;&|<>]/.test(code) || code.split("\n").some((line) => /^\s*(?:if|then|elif|else|fi|for|do|done|while|until|case|esac|function|select|exit|return|exec|break|continue|trap|eval|source|hash|alias|unalias)\b/.test(line)) || /(?:^|\n)\s*\.(?:\s|$)/.test(code) || /(?:^|\n)\s*[A-Za-z_]\w*\s*\(\s*\)\s*[{(]/.test(code) || kind === "setup" && /[(){}]/.test(code)) throw new Error(`Unsupported release ${kind} shell context: ${location}`);
|
|
91
|
-
if (kind !== "setup") return;
|
|
92
|
-
for (const line of run.split("\n")) {
|
|
93
|
-
const command = line.trim();
|
|
94
|
-
if (command === "" || command.startsWith("#")) continue;
|
|
95
|
-
if (packerSetupExpression.test(command) || /^(?:npm|pnpm)\s+pack(?:\s|$)/.test(command) || [
|
|
96
|
-
"set -e",
|
|
97
|
-
"set -eu",
|
|
98
|
-
"set -euo pipefail"
|
|
99
|
-
].includes(command)) continue;
|
|
100
|
-
throw new Error(`Unsupported release setup command context: ${location}`);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
/** Resolve the repository's release packer without substituting another manager. */
|
|
104
|
-
const resolveConsumerReleasePack = (files) => {
|
|
105
|
-
const candidates = [];
|
|
106
|
-
for (const [file, text] of Object.entries(files)) {
|
|
107
|
-
if (require_toolchain_inputs.githubAutomationFileKind(file) !== "workflow") continue;
|
|
108
|
-
const document = (0, yaml.parseDocument)(text, {
|
|
109
|
-
uniqueKeys: true,
|
|
110
|
-
merge: true
|
|
111
|
-
});
|
|
112
|
-
if (document.errors.length > 0) throw new Error(`Invalid release workflow YAML: ${file}`);
|
|
113
|
-
const source = document.toJS({ maxAliasCount: 100 });
|
|
114
|
-
if (!record$1(source) || !record$1(source["jobs"])) continue;
|
|
115
|
-
for (const [jobName, job] of Object.entries(source["jobs"])) {
|
|
116
|
-
if (!record$1(job) || !Array.isArray(job["steps"])) continue;
|
|
117
|
-
if (!job["steps"].some((step) => record$1(step) && typeof step["run"] === "string" && step["run"].split("\n").some((line) => !line.trimStart().startsWith("#") && /\b(?:npm|pnpm)\s+pack\b/.test(line)))) continue;
|
|
118
|
-
const jobShell = defaultRunShell(job["defaults"]);
|
|
119
|
-
const inheritedShell = jobShell === void 0 ? defaultRunShell(source["defaults"]) : jobShell;
|
|
120
|
-
const versions = /* @__PURE__ */ new Map();
|
|
121
|
-
let packed;
|
|
122
|
-
for (const step of job["steps"]) {
|
|
123
|
-
if (!record$1(step)) continue;
|
|
124
|
-
if (typeof step["uses"] === "string" && step["uses"].startsWith("pnpm/action-setup@")) {
|
|
125
|
-
if (step["if"] !== void 0 || step["continue-on-error"] !== void 0) throw new Error(`Conditional release packer setup: ${file}:${jobName}`);
|
|
126
|
-
const inputs = step["with"];
|
|
127
|
-
const version = record$1(inputs) ? inputs["version"] : void 0;
|
|
128
|
-
if (typeof version !== "string" || !exactVersion.test(version)) throw new Error(`Release pnpm setup requires an exact version: ${file}:${jobName}`);
|
|
129
|
-
const values = versions.get("pnpm") ?? [];
|
|
130
|
-
values.push(version);
|
|
131
|
-
versions.set("pnpm", values);
|
|
132
|
-
}
|
|
133
|
-
if (typeof step["run"] !== "string") continue;
|
|
134
|
-
for (const rawLine of step["run"].split("\n")) {
|
|
135
|
-
const line = rawLine.trim();
|
|
136
|
-
if (line.startsWith("#")) continue;
|
|
137
|
-
const setupCommand = /\bnpm\s+(?:install|i)\b[^\n]*\b(?:npm|pnpm)@/.test(line);
|
|
138
|
-
if (setupCommand) assertReleaseShellContext({
|
|
139
|
-
step,
|
|
140
|
-
kind: "setup",
|
|
141
|
-
location: `${file}:${jobName}`,
|
|
142
|
-
inheritedShell
|
|
143
|
-
});
|
|
144
|
-
const setup = packerSetupExpression.exec(line);
|
|
145
|
-
if (setupCommand && setup === null) throw new Error(`Unsupported release packer setup command: ${file}:${jobName}`);
|
|
146
|
-
if (setup !== null && /(?:^|\s)(?:--global|-g)(?:\s|$)/.test(setup[1] ?? "")) {
|
|
147
|
-
if (step["if"] !== void 0 || step["continue-on-error"] !== void 0) throw new Error(`Conditional release packer setup: ${file}:${jobName}`);
|
|
148
|
-
const manager = setup[2];
|
|
149
|
-
const version = setup[3];
|
|
150
|
-
if (manager === void 0 || version === void 0 || !exactVersion.test(version)) throw new Error(`Release packer setup requires an exact version: ${file}:${jobName}`);
|
|
151
|
-
const values = versions.get(manager) ?? [];
|
|
152
|
-
values.push(version);
|
|
153
|
-
versions.set(manager, values);
|
|
154
|
-
}
|
|
155
|
-
if (!/\b(?:npm|pnpm)\s+pack\b/.test(line)) continue;
|
|
156
|
-
if (job["if"] !== void 0 || step["if"] !== void 0 || step["continue-on-error"] !== void 0 || packed !== void 0) throw new Error(`Ambiguous release pack command: ${file}:${jobName}`);
|
|
157
|
-
assertReleaseShellContext({
|
|
158
|
-
step,
|
|
159
|
-
kind: "pack",
|
|
160
|
-
location: `${file}:${jobName}`,
|
|
161
|
-
inheritedShell
|
|
162
|
-
});
|
|
163
|
-
const command = packArguments(line);
|
|
164
|
-
const selected = versions.get(command.manager);
|
|
165
|
-
const version = selected?.at(0);
|
|
166
|
-
if (selected?.length !== 1 || version === void 0) throw new Error(`Missing or ambiguous exact release packer version: ${file}:${jobName}`);
|
|
167
|
-
packed = {
|
|
168
|
-
manager: command.manager,
|
|
169
|
-
version,
|
|
170
|
-
arguments: command.arguments
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if (packed !== void 0) candidates.push(packed);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
const selected = candidates.at(0);
|
|
178
|
-
if (candidates.length !== 1 || selected === void 0) throw new Error("Require exactly one identifiable release pack job");
|
|
179
|
-
return selected;
|
|
180
|
-
};
|
|
181
|
-
const consumerReleasePackArguments = ({ packer, directory }) => {
|
|
182
|
-
if (directory.length === 0) throw new Error("Release pack output directory is required");
|
|
183
|
-
return ["pack", ...packer.arguments.map((argument) => argument === outputDirectory ? directory : argument)];
|
|
184
|
-
};
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/publish-contract.ts
|
|
187
|
-
const record = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
188
|
-
const object = (value, field) => {
|
|
189
|
-
if (!record(value)) throw new Error(`${field} must be an object`);
|
|
190
|
-
return value;
|
|
191
|
-
};
|
|
192
|
-
const closedKeys = (value, allowed, field) => {
|
|
193
|
-
for (const key of Object.keys(value)) if (!allowed.includes(key)) throw new Error(`${field}.${key} is unsupported`);
|
|
194
|
-
};
|
|
195
|
-
const text = (value, field) => {
|
|
196
|
-
if (typeof value !== "string" || value.trim() === "") throw new Error(`${field} must be a nonempty string`);
|
|
197
|
-
return value;
|
|
198
|
-
};
|
|
199
|
-
const stringMap = (value, field) => {
|
|
200
|
-
const result = /* @__PURE__ */ new Map();
|
|
201
|
-
for (const [key, entry] of Object.entries(object(value, field))) result.set(text(key, field), text(entry, `${field}.${key}`));
|
|
202
|
-
return Object.fromEntries(result);
|
|
203
|
-
};
|
|
204
|
-
const exportTarget = (value, field) => {
|
|
205
|
-
if (value === null) return null;
|
|
206
|
-
if (typeof value === "string") return text(value, field);
|
|
207
|
-
if (Array.isArray(value)) return value.map((entry, index) => exportTarget(entry, `${field}[${index}]`));
|
|
208
|
-
const result = /* @__PURE__ */ new Map();
|
|
209
|
-
for (const [key, entry] of Object.entries(object(value, field))) result.set(text(key, field), exportTarget(entry, `${field}.${key}`));
|
|
210
|
-
return Object.fromEntries(result);
|
|
211
|
-
};
|
|
212
|
-
const typesVersions = (value) => {
|
|
213
|
-
const result = /* @__PURE__ */ new Map();
|
|
214
|
-
for (const [range, paths] of Object.entries(object(value, "typesVersions"))) {
|
|
215
|
-
const mappings = /* @__PURE__ */ new Map();
|
|
216
|
-
for (const [pattern, entries] of Object.entries(object(paths, `typesVersions.${range}`))) {
|
|
217
|
-
if (!Array.isArray(entries)) throw new Error(`typesVersions.${range}.${pattern} must be an array`);
|
|
218
|
-
mappings.set(text(pattern, "typesVersions pattern"), entries.map((entry) => text(entry, "typesVersions path")));
|
|
219
|
-
}
|
|
220
|
-
result.set(text(range, "typesVersions range"), Object.fromEntries(mappings));
|
|
221
|
-
}
|
|
222
|
-
return Object.fromEntries(result);
|
|
223
|
-
};
|
|
224
|
-
const entryPointKeys = [
|
|
225
|
-
"type",
|
|
226
|
-
"exports",
|
|
227
|
-
"main",
|
|
228
|
-
"module",
|
|
229
|
-
"types",
|
|
230
|
-
"typings",
|
|
231
|
-
"bin",
|
|
232
|
-
"typesVersions"
|
|
233
|
-
];
|
|
234
|
-
const publishConfigOverrideKeys = entryPointKeys.filter((key) => key !== "type");
|
|
235
|
-
const entryPoints = (value) => {
|
|
236
|
-
const source = object(value, "entryPoints");
|
|
237
|
-
closedKeys(source, entryPointKeys, "entryPoints");
|
|
238
|
-
const result = {};
|
|
239
|
-
if ("type" in source) {
|
|
240
|
-
if (source["type"] !== "module" && source["type"] !== "commonjs") throw new Error("entryPoints.type must be module or commonjs");
|
|
241
|
-
result.type = source["type"];
|
|
242
|
-
}
|
|
243
|
-
if ("exports" in source) result.exports = exportTarget(source["exports"], "entryPoints.exports");
|
|
244
|
-
for (const key of [
|
|
245
|
-
"main",
|
|
246
|
-
"module",
|
|
247
|
-
"types",
|
|
248
|
-
"typings"
|
|
249
|
-
]) if (key in source) result[key] = text(source[key], `entryPoints.${key}`);
|
|
250
|
-
if ("bin" in source) result.bin = typeof source["bin"] === "string" ? text(source["bin"], "entryPoints.bin") : stringMap(source["bin"], "entryPoints.bin");
|
|
251
|
-
if ("typesVersions" in source) result.typesVersions = typesVersions(source["typesVersions"]);
|
|
252
|
-
return result;
|
|
253
|
-
};
|
|
254
|
-
const publishTarget = (value) => {
|
|
255
|
-
const source = object(value, "target");
|
|
256
|
-
if (source["type"] === "types-only") {
|
|
257
|
-
closedKeys(source, ["type"], "target");
|
|
258
|
-
return { type: "types-only" };
|
|
259
|
-
}
|
|
260
|
-
if (source["type"] !== "javascript") throw new Error("target.type must be javascript or types-only");
|
|
261
|
-
closedKeys(source, ["type", "targets"], "target");
|
|
262
|
-
if (!Array.isArray(source["targets"]) || source["targets"].length === 0) throw new Error("target.targets must be a nonempty array");
|
|
263
|
-
const targets = Array.from(source["targets"]).map((entry) => {
|
|
264
|
-
const target = text(entry, "target.targets");
|
|
265
|
-
if (/[\s,]/.test(target) || Array.from(target).some((character) => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127)) throw new Error("target.targets must contain resolved target identifiers");
|
|
266
|
-
return target;
|
|
267
|
-
});
|
|
268
|
-
return {
|
|
269
|
-
type: "javascript",
|
|
270
|
-
targets: [...new Set(targets)].sort()
|
|
271
|
-
};
|
|
272
|
-
};
|
|
273
|
-
const parsePublishContract = (value) => {
|
|
274
|
-
const source = object(value, "publish contract");
|
|
275
|
-
closedKeys(source, [
|
|
276
|
-
"engines",
|
|
277
|
-
"peerDependencies",
|
|
278
|
-
"target",
|
|
279
|
-
"entryPoints"
|
|
280
|
-
], "publish contract");
|
|
281
|
-
return {
|
|
282
|
-
engines: stringMap(source["engines"], "engines"),
|
|
283
|
-
peerDependencies: stringMap(source["peerDependencies"], "peerDependencies"),
|
|
284
|
-
target: publishTarget(source["target"]),
|
|
285
|
-
entryPoints: entryPoints(source["entryPoints"])
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
const publishPackers = ["npm", "pnpm"];
|
|
289
|
-
const resolveManifestContract = ({ packer, manifest, target }) => {
|
|
290
|
-
if (!publishPackers.includes(packer)) throw new Error("publish packer must be npm or pnpm");
|
|
291
|
-
const source = object(manifest, "package manifest");
|
|
292
|
-
const config = "publishConfig" in source ? object(source["publishConfig"], "publishConfig") : {};
|
|
293
|
-
closedKeys(config, [
|
|
294
|
-
...publishConfigOverrideKeys,
|
|
295
|
-
"access",
|
|
296
|
-
"registry"
|
|
297
|
-
], "publishConfig");
|
|
298
|
-
if (packer === "npm") {
|
|
299
|
-
for (const key of publishConfigOverrideKeys) if (Object.hasOwn(config, key) && !(key === "exports" || key === "typesVersions" ? JSON.stringify(config[key]) === JSON.stringify(source[key]) : (0, node_util.isDeepStrictEqual)(config[key], source[key]))) throw new Error(`npm pack does not apply differing publishConfig.${key}; move the published entry to package.json or use pnpm`);
|
|
300
|
-
}
|
|
301
|
-
for (const field of [
|
|
302
|
-
"browser",
|
|
303
|
-
"esnext",
|
|
304
|
-
"es2015",
|
|
305
|
-
"unpkg",
|
|
306
|
-
"umd:main"
|
|
307
|
-
]) if (Object.hasOwn(source, field) || Object.hasOwn(config, field)) throw new Error(`published entry field ${field} is unsupported`);
|
|
308
|
-
const published = {};
|
|
309
|
-
for (const key of entryPointKeys) if (packer === "pnpm" && key !== "type" && key in config) published[key] = config[key];
|
|
310
|
-
else if (key in source) published[key] = source[key];
|
|
311
|
-
if (typeof published["bin"] === "string") {
|
|
312
|
-
const command = text(source["name"], "package name for bin").split("/").at(-1);
|
|
313
|
-
if (command === void 0 || command === "") throw new Error("package name must determine its bin command");
|
|
314
|
-
published["bin"] = { [command]: published["bin"] };
|
|
315
|
-
}
|
|
316
|
-
let engines = {};
|
|
317
|
-
if (Object.hasOwn(source, "engines")) engines = source["engines"];
|
|
318
|
-
return parsePublishContract({
|
|
319
|
-
engines,
|
|
320
|
-
peerDependencies: Object.hasOwn(source, "peerDependencies") ? source["peerDependencies"] : {},
|
|
321
|
-
target,
|
|
322
|
-
entryPoints: published
|
|
323
|
-
});
|
|
324
|
-
};
|
|
325
|
-
const consumerPolicy = (policy) => {
|
|
326
|
-
closedKeys(object(policy, "consumer policy"), ["node", "typescript"], "consumer policy");
|
|
327
|
-
for (const [field, major] of [["node", 22], ["typescript", 6]]) {
|
|
328
|
-
const version = (0, semver.parse)(policy[field]);
|
|
329
|
-
if (version === null || version.version !== policy[field] || version.major !== major || version.prerelease.length !== 0) throw new Error(`consumer policy ${field} must pin an exact stable ${major}.x release`);
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
/** Share the accepted Node target grammar between static and packed checks. */
|
|
333
|
-
const publishedNodeTargetSupportsConsumer = ({ target, node }) => {
|
|
334
|
-
const match = /^node([1-9]\d*)(?:\.(0|[1-9]\d*))?(?:\.(0|[1-9]\d*))?$/i.exec(target);
|
|
335
|
-
const version = match === null ? null : (0, semver.parse)(`${match[1]}.${match[2] ?? "0"}.${match[3] ?? "0"}`);
|
|
336
|
-
return version !== null && (0, semver.lte)(version, node);
|
|
337
|
-
};
|
|
338
|
-
const checkPublishContract = ({ packer, manifest, target, contract, policy }) => {
|
|
339
|
-
consumerPolicy(policy);
|
|
340
|
-
const current = resolveManifestContract({
|
|
341
|
-
packer,
|
|
342
|
-
manifest,
|
|
343
|
-
target
|
|
344
|
-
});
|
|
345
|
-
const committed = parsePublishContract(contract);
|
|
346
|
-
const diagnostics = [];
|
|
347
|
-
const add = (field, message) => diagnostics.push({
|
|
348
|
-
field,
|
|
349
|
-
message
|
|
350
|
-
});
|
|
351
|
-
const compare = (field, expected, actual) => {
|
|
352
|
-
if (field !== "entryPoints.exports" && field !== "entryPoints.typesVersions" && record(expected) && record(actual)) {
|
|
353
|
-
for (const key of /* @__PURE__ */ new Set([...Object.keys(expected), ...Object.keys(actual)])) compare(`${field}.${key}`, Object.hasOwn(expected, key) ? expected[key] : void 0, Object.hasOwn(actual, key) ? actual[key] : void 0);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
if (JSON.stringify(expected) !== JSON.stringify(actual)) add(field, `published ${field} differs from the committed contract`);
|
|
357
|
-
};
|
|
358
|
-
for (const field of [
|
|
359
|
-
"engines",
|
|
360
|
-
"peerDependencies",
|
|
361
|
-
"target",
|
|
362
|
-
"entryPoints"
|
|
363
|
-
]) compare(field, committed[field], current[field]);
|
|
364
|
-
const support = (field, range, version) => {
|
|
365
|
-
if (range !== void 0 && !(0, semver.satisfies)(version, range)) add(field, `${field} must support consumer version ${version}`);
|
|
366
|
-
};
|
|
367
|
-
if (!require_toolchain_schema.consumerNodeSupportMatches({
|
|
368
|
-
range: current.engines["node"],
|
|
369
|
-
node: policy.node
|
|
370
|
-
})) add("engines.node", `engines.node must support consumer version ${policy.node}`);
|
|
371
|
-
support("engines.typescript", current.engines["typescript"], policy.typescript);
|
|
372
|
-
support("peerDependencies.typescript", current.peerDependencies["typescript"], policy.typescript);
|
|
373
|
-
if ("bun" in current.engines) add("engines.bun", "published packages must not require Bun");
|
|
374
|
-
for (const peer of [
|
|
375
|
-
"bun",
|
|
376
|
-
"bun-types",
|
|
377
|
-
"@types/bun",
|
|
378
|
-
"@typescript/native"
|
|
379
|
-
]) if (Object.hasOwn(current.peerDependencies, peer)) add(`peerDependencies.${peer}`, "published packages must not require development runtime or compiler packages");
|
|
380
|
-
if (current.target.type === "javascript") for (const selected of current.target.targets) {
|
|
381
|
-
if (/^bun(?:$|[0-9])/i.test(selected)) {
|
|
382
|
-
add("target", "published JavaScript must not require Bun");
|
|
383
|
-
continue;
|
|
384
|
-
}
|
|
385
|
-
if (!/^node/i.test(selected)) continue;
|
|
386
|
-
if (!publishedNodeTargetSupportsConsumer({
|
|
387
|
-
target: selected,
|
|
388
|
-
node: policy.node
|
|
389
|
-
})) add("target", `JavaScript target ${selected} must support consumer Node ${policy.node}`);
|
|
390
|
-
}
|
|
391
|
-
return diagnostics;
|
|
392
|
-
};
|
|
393
|
-
//#endregion
|
|
394
|
-
Object.defineProperty(exports, "checkPublishContract", {
|
|
395
|
-
enumerable: true,
|
|
396
|
-
get: function() {
|
|
397
|
-
return checkPublishContract;
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
Object.defineProperty(exports, "consumerReleasePackArguments", {
|
|
401
|
-
enumerable: true,
|
|
402
|
-
get: function() {
|
|
403
|
-
return consumerReleasePackArguments;
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
Object.defineProperty(exports, "parsePublishContract", {
|
|
407
|
-
enumerable: true,
|
|
408
|
-
get: function() {
|
|
409
|
-
return parsePublishContract;
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
Object.defineProperty(exports, "publishedNodeTargetSupportsConsumer", {
|
|
413
|
-
enumerable: true,
|
|
414
|
-
get: function() {
|
|
415
|
-
return publishedNodeTargetSupportsConsumer;
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
Object.defineProperty(exports, "resolveConsumerReleasePack", {
|
|
419
|
-
enumerable: true,
|
|
420
|
-
get: function() {
|
|
421
|
-
return resolveConsumerReleasePack;
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
Object.defineProperty(exports, "resolveManifestContract", {
|
|
425
|
-
enumerable: true,
|
|
426
|
-
get: function() {
|
|
427
|
-
return resolveManifestContract;
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
|
|
431
|
-
//# sourceMappingURL=publish-contract.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publish-contract.cjs","names":["record","githubAutomationFileKind","parseDocument","isDeepStrictEqual","parse","lte","satisfies","consumerNodeSupportMatches"],"sources":["../src/consumer-release-pack.ts","../src/publish-contract.ts"],"sourcesContent":["import { parseDocument } from \"yaml\";\n\nimport { githubAutomationFileKind } from \"./toolchain-inputs\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst exactVersion = /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/;\nconst outputDirectory = \"<consumer-release-pack-output>\";\nconst packerSetupExpression =\n /^npm\\s+install\\s+((?:(?:--global|-g|--ignore-scripts)\\s+)+)(npm|pnpm)@([^\\s]+)$/;\nconst defaultRunShell = (defaults: unknown) => {\n if (!record(defaults) || !record(defaults[\"run\"])) return undefined;\n return defaults[\"run\"][\"shell\"];\n};\n\nexport type ConsumerReleasePack = {\n manager: \"npm\" | \"pnpm\";\n version: string;\n arguments: string[];\n};\n\nconst packArguments = (line: string) => {\n const command = /^(npm|pnpm)\\s+pack(?:\\s+(.*))?$/.exec(line);\n const manager = command?.[1];\n if (manager !== \"npm\" && manager !== \"pnpm\")\n throw new Error(\"Unsupported release pack command\");\n const raw = command?.[2] ?? \"\";\n const tokens = raw.match(/\"[^\"\\n]*\"|'[^'\\n]*'|[^\\s]+/g) ?? [];\n const args: string[] = [];\n let destination = false;\n for (let index = 0; index < tokens.length; index++) {\n const token = tokens.at(index);\n if (token === \"--pack-destination\") {\n if (destination) throw new Error(\"Repeated release pack destination\");\n const value = tokens.at(++index);\n if (\n value === undefined ||\n !/^(?:\"\\$GITHUB_WORKSPACE\\/[A-Za-z0-9_/-]+\"|[A-Za-z0-9_/-]+)$/.test(\n value,\n ) ||\n value.split(\"/\").includes(\"..\")\n )\n throw new Error(\"Unsupported release pack destination\");\n destination = true;\n args.push(token, outputDirectory);\n continue;\n }\n if (\n token !== \"--ignore-scripts\" &&\n !(manager === \"pnpm\" && token === \"--config.ignore-scripts=true\") &&\n token !== \"--json\" &&\n token !== \"--silent\"\n )\n throw new Error(\"Unsupported release pack arguments\");\n if (args.includes(token)) throw new Error(\"Repeated release pack flag\");\n args.push(token);\n }\n if (\n !destination ||\n (!args.includes(\"--ignore-scripts\") &&\n !args.includes(\"--config.ignore-scripts=true\"))\n )\n throw new Error(\n \"Release pack requires scripts disabled and --pack-destination\",\n );\n return { manager, arguments: args } satisfies Pick<\n ConsumerReleasePack,\n \"manager\" | \"arguments\"\n >;\n};\n\ntype ReleaseShellContextOptions = {\n step: Record<string, unknown>;\n kind: \"setup\" | \"pack\";\n location: string;\n inheritedShell: unknown;\n};\n\n/** Both setup provenance and packing require unconditional shell commands. */\nconst assertReleaseShellContext = ({\n step,\n kind,\n location,\n inheritedShell,\n}: ReleaseShellContextOptions) => {\n const run = step[\"run\"];\n if (typeof run !== \"string\")\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n const shell = step[\"shell\"] === undefined ? inheritedShell : step[\"shell\"];\n if (shell !== undefined && shell !== \"bash\" && shell !== \"sh\")\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n let quote: \"single\" | \"double\" | undefined;\n let code = \"\";\n for (let index = 0; index < run.length; index += 1) {\n const char = run[index];\n if (char === \"\\n\") {\n if (quote !== undefined)\n throw new Error(\n `Unsupported release ${kind} shell context: ${location}`,\n );\n code += \"\\n\";\n continue;\n }\n if (quote !== \"single\" && char === \"\\\\\") {\n if (\n run[index + 1] === \"\\n\" ||\n (run[index + 1] === \"\\r\" && run[index + 2] === \"\\n\")\n )\n throw new Error(\n `Unsupported release ${kind} shell context: ${location}`,\n );\n index += 1;\n code += \" \";\n continue;\n }\n if (\n quote !== \"single\" &&\n (char === \"`\" || (char === \"$\" && run[index + 1] === \"(\"))\n )\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n if (quote === \"single\") {\n if (char === \"'\") quote = undefined;\n code += \" \";\n continue;\n }\n if (quote === \"double\") {\n if (char === '\"') quote = undefined;\n code += \" \";\n continue;\n }\n if (char === \"'\") {\n quote = \"single\";\n code += \" \";\n continue;\n }\n if (char === '\"') {\n quote = \"double\";\n code += \" \";\n continue;\n }\n if (char === \"#\" && (index === 0 || /\\s/.test(run[index - 1] ?? \"\"))) {\n while (index + 1 < run.length && run[index + 1] !== \"\\n\") index += 1;\n continue;\n }\n code += char;\n }\n if (\n quote !== undefined ||\n /[;&|<>]/.test(code) ||\n code\n .split(\"\\n\")\n .some((line) =>\n /^\\s*(?:if|then|elif|else|fi|for|do|done|while|until|case|esac|function|select|exit|return|exec|break|continue|trap|eval|source|hash|alias|unalias)\\b/.test(\n line,\n ),\n ) ||\n /(?:^|\\n)\\s*\\.(?:\\s|$)/.test(code) ||\n /(?:^|\\n)\\s*[A-Za-z_]\\w*\\s*\\(\\s*\\)\\s*[{(]/.test(code) ||\n (kind === \"setup\" && /[(){}]/.test(code))\n )\n throw new Error(`Unsupported release ${kind} shell context: ${location}`);\n if (kind !== \"setup\") return;\n for (const line of run.split(\"\\n\")) {\n const command = line.trim();\n if (command === \"\" || command.startsWith(\"#\")) continue;\n if (\n packerSetupExpression.test(command) ||\n /^(?:npm|pnpm)\\s+pack(?:\\s|$)/.test(command) ||\n [\"set -e\", \"set -eu\", \"set -euo pipefail\"].includes(command)\n )\n continue;\n throw new Error(`Unsupported release setup command context: ${location}`);\n }\n};\n\n/** Resolve the repository's release packer without substituting another manager. */\nexport const resolveConsumerReleasePack = (\n files: Record<string, string>,\n): ConsumerReleasePack => {\n const candidates: ConsumerReleasePack[] = [];\n for (const [file, text] of Object.entries(files)) {\n if (githubAutomationFileKind(file) !== \"workflow\") continue;\n const document = parseDocument(text, { uniqueKeys: true, merge: true });\n if (document.errors.length > 0)\n throw new Error(`Invalid release workflow YAML: ${file}`);\n const source: unknown = document.toJS({ maxAliasCount: 100 });\n if (!record(source) || !record(source[\"jobs\"])) continue;\n for (const [jobName, job] of Object.entries(source[\"jobs\"])) {\n if (!record(job) || !Array.isArray(job[\"steps\"])) continue;\n const packsRelease = job[\"steps\"].some(\n (step: unknown) =>\n record(step) &&\n typeof step[\"run\"] === \"string\" &&\n step[\"run\"]\n .split(\"\\n\")\n .some(\n (line) =>\n !line.trimStart().startsWith(\"#\") &&\n /\\b(?:npm|pnpm)\\s+pack\\b/.test(line),\n ),\n );\n if (!packsRelease) continue;\n const jobShell = defaultRunShell(job[\"defaults\"]);\n const inheritedShell =\n jobShell === undefined ? defaultRunShell(source[\"defaults\"]) : jobShell;\n const versions = new Map<string, string[]>();\n let packed: ConsumerReleasePack | undefined;\n for (const step of job[\"steps\"]) {\n if (!record(step)) continue;\n if (\n typeof step[\"uses\"] === \"string\" &&\n step[\"uses\"].startsWith(\"pnpm/action-setup@\")\n ) {\n if (\n step[\"if\"] !== undefined ||\n step[\"continue-on-error\"] !== undefined\n )\n throw new Error(\n `Conditional release packer setup: ${file}:${jobName}`,\n );\n const inputs = step[\"with\"];\n const version = record(inputs) ? inputs[\"version\"] : undefined;\n if (typeof version !== \"string\" || !exactVersion.test(version))\n throw new Error(\n `Release pnpm setup requires an exact version: ${file}:${jobName}`,\n );\n const values = versions.get(\"pnpm\") ?? [];\n values.push(version);\n versions.set(\"pnpm\", values);\n }\n if (typeof step[\"run\"] !== \"string\") continue;\n for (const rawLine of step[\"run\"].split(\"\\n\")) {\n const line = rawLine.trim();\n if (line.startsWith(\"#\")) continue;\n const setupCommand =\n /\\bnpm\\s+(?:install|i)\\b[^\\n]*\\b(?:npm|pnpm)@/.test(line);\n if (setupCommand)\n assertReleaseShellContext({\n step,\n kind: \"setup\",\n location: `${file}:${jobName}`,\n inheritedShell,\n });\n const setup = packerSetupExpression.exec(line);\n if (setupCommand && setup === null)\n throw new Error(\n `Unsupported release packer setup command: ${file}:${jobName}`,\n );\n if (\n setup !== null &&\n /(?:^|\\s)(?:--global|-g)(?:\\s|$)/.test(setup[1] ?? \"\")\n ) {\n if (\n step[\"if\"] !== undefined ||\n step[\"continue-on-error\"] !== undefined\n )\n throw new Error(\n `Conditional release packer setup: ${file}:${jobName}`,\n );\n const manager = setup[2];\n const version = setup[3];\n if (\n manager === undefined ||\n version === undefined ||\n !exactVersion.test(version)\n )\n throw new Error(\n `Release packer setup requires an exact version: ${file}:${jobName}`,\n );\n const values = versions.get(manager) ?? [];\n values.push(version);\n versions.set(manager, values);\n }\n if (!/\\b(?:npm|pnpm)\\s+pack\\b/.test(line)) continue;\n if (\n job[\"if\"] !== undefined ||\n step[\"if\"] !== undefined ||\n step[\"continue-on-error\"] !== undefined ||\n packed !== undefined\n )\n throw new Error(\n `Ambiguous release pack command: ${file}:${jobName}`,\n );\n assertReleaseShellContext({\n step,\n kind: \"pack\",\n location: `${file}:${jobName}`,\n inheritedShell,\n });\n const command = packArguments(line);\n const selected = versions.get(command.manager);\n const version = selected?.at(0);\n if (selected?.length !== 1 || version === undefined)\n throw new Error(\n `Missing or ambiguous exact release packer version: ${file}:${jobName}`,\n );\n packed = {\n manager: command.manager,\n version,\n arguments: command.arguments,\n };\n }\n }\n if (packed !== undefined) candidates.push(packed);\n }\n }\n const selected = candidates.at(0);\n if (candidates.length !== 1 || selected === undefined)\n throw new Error(\"Require exactly one identifiable release pack job\");\n return selected;\n};\n\ntype ConsumerReleasePackArgumentsOptions = {\n packer: ConsumerReleasePack;\n directory: string;\n};\nexport const consumerReleasePackArguments = ({\n packer,\n directory,\n}: ConsumerReleasePackArgumentsOptions) => {\n if (directory.length === 0)\n throw new Error(\"Release pack output directory is required\");\n return [\n \"pack\",\n ...packer.arguments.map((argument) =>\n argument === outputDirectory ? directory : argument,\n ),\n ];\n};\n","import { isDeepStrictEqual } from \"node:util\";\nimport { lte, parse, satisfies } from \"semver\";\n\nimport { consumerNodeSupportMatches } from \"./consumer-node-support\";\n\nexport type PublishTarget =\n | { type: \"javascript\"; targets: readonly string[] }\n | { type: \"types-only\" };\n\ntype ExportTarget =\n | string\n | null\n | ExportTarget[]\n | { [condition: string]: ExportTarget };\n\ntype EntryPoints = {\n type?: \"module\" | \"commonjs\";\n exports?: ExportTarget;\n main?: string;\n module?: string;\n types?: string;\n typings?: string;\n bin?: string | Record<string, string>;\n typesVersions?: Record<string, Record<string, string[]>>;\n};\n\nexport type PublishContract = {\n engines: Record<string, string>;\n peerDependencies: Record<string, string>;\n target: PublishTarget;\n entryPoints: EntryPoints;\n};\n\nexport type ConsumerPolicy = { node: string; typescript: string };\nexport type PublishContractDiagnostic = { field: string; message: string };\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst object = (value: unknown, field: string) => {\n if (!record(value)) throw new Error(`${field} must be an object`);\n return value;\n};\n\nconst closedKeys = (\n value: Record<string, unknown>,\n allowed: readonly string[],\n field: string,\n) => {\n for (const key of Object.keys(value))\n if (!allowed.includes(key))\n throw new Error(`${field}.${key} is unsupported`);\n};\n\nconst text = (value: unknown, field: string) => {\n if (typeof value !== \"string\" || value.trim() === \"\")\n throw new Error(`${field} must be a nonempty string`);\n return value;\n};\n\nconst stringMap = (value: unknown, field: string) => {\n const result = new Map<string, string>();\n for (const [key, entry] of Object.entries(object(value, field)))\n result.set(text(key, field), text(entry, `${field}.${key}`));\n return Object.fromEntries(result);\n};\n\nconst exportTarget = (value: unknown, field: string): ExportTarget => {\n if (value === null) return null;\n if (typeof value === \"string\") return text(value, field);\n if (Array.isArray(value))\n return value.map((entry: unknown, index) =>\n exportTarget(entry, `${field}[${index}]`),\n );\n const result = new Map<string, ExportTarget>();\n for (const [key, entry] of Object.entries(object(value, field)))\n result.set(text(key, field), exportTarget(entry, `${field}.${key}`));\n return Object.fromEntries(result);\n};\n\nconst typesVersions = (value: unknown) => {\n const result = new Map<string, Record<string, string[]>>();\n for (const [range, paths] of Object.entries(object(value, \"typesVersions\"))) {\n const mappings = new Map<string, string[]>();\n for (const [pattern, entries] of Object.entries(\n object(paths, `typesVersions.${range}`),\n )) {\n if (!Array.isArray(entries))\n throw new Error(`typesVersions.${range}.${pattern} must be an array`);\n mappings.set(\n text(pattern, \"typesVersions pattern\"),\n entries.map((entry: unknown) => text(entry, \"typesVersions path\")),\n );\n }\n result.set(\n text(range, \"typesVersions range\"),\n Object.fromEntries(mappings),\n );\n }\n return Object.fromEntries(result);\n};\n\nconst entryPointKeys = [\n \"type\",\n \"exports\",\n \"main\",\n \"module\",\n \"types\",\n \"typings\",\n \"bin\",\n \"typesVersions\",\n] as const;\n\nexport const publishConfigOverrideKeys = entryPointKeys.filter(\n (key) => key !== \"type\",\n);\n\nconst entryPoints = (value: unknown): EntryPoints => {\n const source = object(value, \"entryPoints\");\n closedKeys(source, entryPointKeys, \"entryPoints\");\n const result: EntryPoints = {};\n if (\"type\" in source) {\n if (source[\"type\"] !== \"module\" && source[\"type\"] !== \"commonjs\")\n throw new Error(\"entryPoints.type must be module or commonjs\");\n result.type = source[\"type\"];\n }\n if (\"exports\" in source)\n result.exports = exportTarget(source[\"exports\"], \"entryPoints.exports\");\n for (const key of [\"main\", \"module\", \"types\", \"typings\"] as const)\n if (key in source) result[key] = text(source[key], `entryPoints.${key}`);\n if (\"bin\" in source)\n result.bin =\n typeof source[\"bin\"] === \"string\"\n ? text(source[\"bin\"], \"entryPoints.bin\")\n : stringMap(source[\"bin\"], \"entryPoints.bin\");\n if (\"typesVersions\" in source)\n result.typesVersions = typesVersions(source[\"typesVersions\"]);\n return result;\n};\n\nconst publishTarget = (value: unknown): PublishTarget => {\n const source = object(value, \"target\");\n if (source[\"type\"] === \"types-only\") {\n closedKeys(source, [\"type\"], \"target\");\n return { type: \"types-only\" };\n }\n if (source[\"type\"] !== \"javascript\")\n throw new Error(\"target.type must be javascript or types-only\");\n closedKeys(source, [\"type\", \"targets\"], \"target\");\n if (!Array.isArray(source[\"targets\"]) || source[\"targets\"].length === 0)\n throw new Error(\"target.targets must be a nonempty array\");\n const targets = Array.from(source[\"targets\"]).map((entry: unknown) => {\n const target = text(entry, \"target.targets\");\n if (\n /[\\s,]/.test(target) ||\n Array.from(target).some(\n (character) =>\n character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,\n )\n )\n throw new Error(\n \"target.targets must contain resolved target identifiers\",\n );\n return target;\n });\n return { type: \"javascript\", targets: [...new Set(targets)].sort() };\n};\n\nexport const parsePublishContract = (value: unknown): PublishContract => {\n const source = object(value, \"publish contract\");\n closedKeys(\n source,\n [\"engines\", \"peerDependencies\", \"target\", \"entryPoints\"],\n \"publish contract\",\n );\n return {\n engines: stringMap(source[\"engines\"], \"engines\"),\n peerDependencies: stringMap(source[\"peerDependencies\"], \"peerDependencies\"),\n target: publishTarget(source[\"target\"]),\n entryPoints: entryPoints(source[\"entryPoints\"]),\n };\n};\n\nconst publishPackers = [\"npm\", \"pnpm\"] as const;\nexport type PublishPacker = (typeof publishPackers)[number];\n\ntype ResolveManifestContractOptions = {\n packer: PublishPacker;\n manifest: unknown;\n target: PublishTarget;\n};\n\nexport const resolveManifestContract = ({\n packer,\n manifest,\n target,\n}: ResolveManifestContractOptions): PublishContract => {\n if (!publishPackers.includes(packer))\n throw new Error(\"publish packer must be npm or pnpm\");\n const source = object(manifest, \"package manifest\");\n const config =\n \"publishConfig\" in source\n ? object(source[\"publishConfig\"], \"publishConfig\")\n : {};\n closedKeys(\n config,\n [...publishConfigOverrideKeys, \"access\", \"registry\"],\n \"publishConfig\",\n );\n if (packer === \"npm\")\n for (const key of publishConfigOverrideKeys)\n if (\n Object.hasOwn(config, key) &&\n !(key === \"exports\" || key === \"typesVersions\"\n ? JSON.stringify(config[key]) === JSON.stringify(source[key])\n : isDeepStrictEqual(config[key], source[key]))\n )\n throw new Error(\n `npm pack does not apply differing publishConfig.${key}; move the published entry to package.json or use pnpm`,\n );\n for (const field of [\"browser\", \"esnext\", \"es2015\", \"unpkg\", \"umd:main\"])\n if (Object.hasOwn(source, field) || Object.hasOwn(config, field))\n throw new Error(`published entry field ${field} is unsupported`);\n const published: Record<string, unknown> = {};\n for (const key of entryPointKeys) {\n if (packer === \"pnpm\" && key !== \"type\" && key in config)\n published[key] = config[key];\n else if (key in source) published[key] = source[key];\n }\n if (typeof published[\"bin\"] === \"string\") {\n const name = text(source[\"name\"], \"package name for bin\");\n const command = name.split(\"/\").at(-1);\n if (command === undefined || command === \"\")\n throw new Error(\"package name must determine its bin command\");\n published[\"bin\"] = { [command]: published[\"bin\"] };\n }\n let engines: unknown = {};\n if (Object.hasOwn(source, \"engines\")) engines = source[\"engines\"];\n return parsePublishContract({\n engines,\n peerDependencies: Object.hasOwn(source, \"peerDependencies\")\n ? source[\"peerDependencies\"]\n : {},\n target,\n entryPoints: published,\n });\n};\n\nconst consumerPolicy = (policy: ConsumerPolicy) => {\n closedKeys(\n object(policy, \"consumer policy\"),\n [\"node\", \"typescript\"],\n \"consumer policy\",\n );\n for (const [field, major] of [\n [\"node\", 22],\n [\"typescript\", 6],\n ] as const) {\n const version = parse(policy[field]);\n if (\n version === null ||\n version.version !== policy[field] ||\n version.major !== major ||\n version.prerelease.length !== 0\n )\n throw new Error(\n `consumer policy ${field} must pin an exact stable ${major}.x release`,\n );\n }\n};\n\ntype CheckPublishContractOptions = ResolveManifestContractOptions & {\n contract: unknown;\n policy: ConsumerPolicy;\n};\n\n/** Share the accepted Node target grammar between static and packed checks. */\nexport const publishedNodeTargetSupportsConsumer = ({\n target,\n node,\n}: {\n target: string;\n node: string;\n}) => {\n const match = /^node([1-9]\\d*)(?:\\.(0|[1-9]\\d*))?(?:\\.(0|[1-9]\\d*))?$/i.exec(\n target,\n );\n const version =\n match === null\n ? null\n : parse(`${match[1]}.${match[2] ?? \"0\"}.${match[3] ?? \"0\"}`);\n return version !== null && lte(version, node);\n};\n\nexport const checkPublishContract = ({\n packer,\n manifest,\n target,\n contract,\n policy,\n}: CheckPublishContractOptions) => {\n consumerPolicy(policy);\n const current = resolveManifestContract({ packer, manifest, target });\n const committed = parsePublishContract(contract);\n const diagnostics: PublishContractDiagnostic[] = [];\n const add = (field: string, message: string) =>\n diagnostics.push({ field, message });\n const compare = (field: string, expected: unknown, actual: unknown) => {\n if (\n field !== \"entryPoints.exports\" &&\n field !== \"entryPoints.typesVersions\" &&\n record(expected) &&\n record(actual)\n ) {\n for (const key of new Set([\n ...Object.keys(expected),\n ...Object.keys(actual),\n ]))\n compare(\n `${field}.${key}`,\n Object.hasOwn(expected, key) ? expected[key] : undefined,\n Object.hasOwn(actual, key) ? actual[key] : undefined,\n );\n return;\n }\n if (JSON.stringify(expected) !== JSON.stringify(actual))\n add(field, `published ${field} differs from the committed contract`);\n };\n for (const field of [\n \"engines\",\n \"peerDependencies\",\n \"target\",\n \"entryPoints\",\n ] as const)\n compare(field, committed[field], current[field]);\n const support = (\n field: string,\n range: string | undefined,\n version: string,\n ) => {\n if (range !== undefined && !satisfies(version, range))\n add(field, `${field} must support consumer version ${version}`);\n };\n if (\n !consumerNodeSupportMatches({\n range: current.engines[\"node\"],\n node: policy.node,\n })\n )\n add(\n \"engines.node\",\n `engines.node must support consumer version ${policy.node}`,\n );\n support(\n \"engines.typescript\",\n current.engines[\"typescript\"],\n policy.typescript,\n );\n support(\n \"peerDependencies.typescript\",\n current.peerDependencies[\"typescript\"],\n policy.typescript,\n );\n if (\"bun\" in current.engines)\n add(\"engines.bun\", \"published packages must not require Bun\");\n for (const peer of [\"bun\", \"bun-types\", \"@types/bun\", \"@typescript/native\"])\n if (Object.hasOwn(current.peerDependencies, peer))\n add(\n `peerDependencies.${peer}`,\n \"published packages must not require development runtime or compiler packages\",\n );\n if (current.target.type === \"javascript\")\n for (const selected of current.target.targets) {\n if (/^bun(?:$|[0-9])/i.test(selected)) {\n add(\"target\", \"published JavaScript must not require Bun\");\n continue;\n }\n if (!/^node/i.test(selected)) continue;\n if (\n !publishedNodeTargetSupportsConsumer({\n target: selected,\n node: policy.node,\n })\n )\n add(\n \"target\",\n `JavaScript target ${selected} must support consumer Node ${policy.node}`,\n );\n }\n return diagnostics;\n};\n"],"mappings":";;;;;;AAIA,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AACrE,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,wBACJ;AACF,MAAM,mBAAmB,aAAsB;CAC7C,IAAI,CAACA,SAAO,QAAQ,KAAK,CAACA,SAAO,SAAS,MAAM,GAAG,OAAO,KAAA;CAC1D,OAAO,SAAS,MAAM,CAAC;AACzB;AAQA,MAAM,iBAAiB,SAAiB;CAC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