@stll/oxlint-config 1.4.0 → 1.5.1
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 +90 -14
- package/dist/cloud-setup-cli.cjs +3 -3
- package/dist/cloud-setup-cli.mjs +3 -3
- package/dist/consumer-compat-cli.cjs +2 -2
- package/dist/consumer-compat-cli.mjs +2 -2
- package/dist/dependabot-cli.cjs +34 -10
- package/dist/dependabot-cli.cjs.map +1 -1
- package/dist/dependabot-cli.mjs +35 -11
- package/dist/dependabot-cli.mjs.map +1 -1
- package/dist/dependabot.cjs +2 -0
- package/dist/dependabot.d.cts +12 -2
- package/dist/dependabot.d.mts +12 -2
- package/dist/dependabot.mjs +2 -2
- package/dist/generated-file.cjs +2 -2
- package/dist/generated-file.mjs +2 -2
- 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 +2 -2
- package/dist/publish-artifact-syntax.mjs +2 -2
- 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 +2 -2
- package/dist/publish-contract-cli.mjs +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 +11 -66
- package/dist/toolchain-changed.cjs.map +1 -1
- package/dist/toolchain-changed.mjs +13 -68
- 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 +77 -3
- package/dist/toolchain-dependabot.cjs.map +1 -1
- package/dist/toolchain-dependabot.mjs +66 -4
- package/dist/toolchain-dependabot.mjs.map +1 -1
- package/dist/toolchain-guard.cjs +49 -10
- package/dist/toolchain-guard.cjs.map +1 -1
- package/dist/toolchain-guard.mjs +51 -12
- package/dist/toolchain-guard.mjs.map +1 -1
- package/dist/toolchain-inputs.cjs +104 -18
- package/dist/toolchain-inputs.cjs.map +1 -1
- package/dist/toolchain-inputs.mjs +106 -20
- package/dist/toolchain-inputs.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 +2 -2
- package/dist/typecheck-probe-cli.mjs +2 -2
- package/package.json +13 -1
- package/toolchain.json +11 -4
package/dist/jsonc.mjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//#region src/jsonc.ts
|
|
2
|
+
/** JSONC permits comments and trailing commas, never alterations inside strings. */
|
|
3
|
+
const parseJsonc = (text) => {
|
|
4
|
+
let clean = "";
|
|
5
|
+
let quote = false;
|
|
6
|
+
for (let index = 0; index < text.length; index++) {
|
|
7
|
+
const char = text[index];
|
|
8
|
+
if (quote) {
|
|
9
|
+
clean += char;
|
|
10
|
+
if (char === "\\") {
|
|
11
|
+
index++;
|
|
12
|
+
clean += text[index] ?? "";
|
|
13
|
+
} else if (char === "\"") quote = false;
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
if (char === "\"") {
|
|
17
|
+
quote = true;
|
|
18
|
+
clean += char;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (char === "/" && text[index + 1] === "/") {
|
|
22
|
+
while (index < text.length && text[index] !== "\n") index++;
|
|
23
|
+
clean += "\n";
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (char === "/" && text[index + 1] === "*") {
|
|
27
|
+
index += 2;
|
|
28
|
+
while (index < text.length && !(text[index] === "*" && text[index + 1] === "/")) index++;
|
|
29
|
+
if (index >= text.length) throw new Error("Unterminated JSONC comment");
|
|
30
|
+
index++;
|
|
31
|
+
clean += " ";
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
clean += char;
|
|
35
|
+
}
|
|
36
|
+
let result = "";
|
|
37
|
+
quote = false;
|
|
38
|
+
for (let index = 0; index < clean.length; index++) {
|
|
39
|
+
const char = clean[index];
|
|
40
|
+
if (quote) {
|
|
41
|
+
result += char;
|
|
42
|
+
if (char === "\\") {
|
|
43
|
+
index++;
|
|
44
|
+
result += clean[index] ?? "";
|
|
45
|
+
} else if (char === "\"") quote = false;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (char === "\"") quote = true;
|
|
49
|
+
if (char === ",") {
|
|
50
|
+
let next = index + 1;
|
|
51
|
+
while (/\s/.test(clean[next] ?? "") && next < clean.length) next++;
|
|
52
|
+
if (clean[next] === "}" || clean[next] === "]") continue;
|
|
53
|
+
}
|
|
54
|
+
result += char;
|
|
55
|
+
}
|
|
56
|
+
return JSON.parse(result);
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { parseJsonc as t };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=jsonc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc.mjs","names":[],"sources":["../src/jsonc.ts"],"sourcesContent":["/** JSONC permits comments and trailing commas, never alterations inside strings. */\nexport const parseJsonc = (text: string): unknown => {\n let clean = \"\";\n let quote = false;\n for (let index = 0; index < text.length; index++) {\n const char = text[index];\n if (quote) {\n clean += char;\n if (char === \"\\\\\") {\n index++;\n clean += text[index] ?? \"\";\n } else if (char === '\"') quote = false;\n continue;\n }\n if (char === '\"') {\n quote = true;\n clean += char;\n continue;\n }\n if (char === \"/\" && text[index + 1] === \"/\") {\n while (index < text.length && text[index] !== \"\\n\") index++;\n clean += \"\\n\";\n continue;\n }\n if (char === \"/\" && text[index + 1] === \"*\") {\n index += 2;\n while (\n index < text.length &&\n !(text[index] === \"*\" && text[index + 1] === \"/\")\n )\n index++;\n if (index >= text.length) throw new Error(\"Unterminated JSONC comment\");\n index++;\n clean += \" \";\n continue;\n }\n clean += char;\n }\n let result = \"\";\n quote = false;\n for (let index = 0; index < clean.length; index++) {\n const char = clean[index];\n if (quote) {\n result += char;\n if (char === \"\\\\\") {\n index++;\n result += clean[index] ?? \"\";\n } else if (char === '\"') quote = false;\n continue;\n }\n if (char === '\"') quote = true;\n if (char === \",\") {\n let next = index + 1;\n while (/\\s/.test(clean[next] ?? \"\") && next < clean.length) next++;\n if (clean[next] === \"}\" || clean[next] === \"]\") continue;\n }\n result += char;\n }\n return JSON.parse(result);\n};\n"],"mappings":";;AACA,MAAa,cAAc,SAA0B;CACnD,IAAI,QAAQ;CACZ,IAAI,QAAQ;CACZ,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;EAChD,MAAM,OAAO,KAAK;EAClB,IAAI,OAAO;GACT,SAAS;GACT,IAAI,SAAS,MAAM;IACjB;IACA,SAAS,KAAK,UAAU;GAC1B,OAAO,IAAI,SAAS,MAAK,QAAQ;GACjC;EACF;EACA,IAAI,SAAS,MAAK;GAChB,QAAQ;GACR,SAAS;GACT;EACF;EACA,IAAI,SAAS,OAAO,KAAK,QAAQ,OAAO,KAAK;GAC3C,OAAO,QAAQ,KAAK,UAAU,KAAK,WAAW,MAAM;GACpD,SAAS;GACT;EACF;EACA,IAAI,SAAS,OAAO,KAAK,QAAQ,OAAO,KAAK;GAC3C,SAAS;GACT,OACE,QAAQ,KAAK,UACb,EAAE,KAAK,WAAW,OAAO,KAAK,QAAQ,OAAO,MAE7C;GACF,IAAI,SAAS,KAAK,QAAQ,MAAM,IAAI,MAAM,4BAA4B;GACtE;GACA,SAAS;GACT;EACF;EACA,SAAS;CACX;CACA,IAAI,SAAS;CACb,QAAQ;CACR,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;EACjD,MAAM,OAAO,MAAM;EACnB,IAAI,OAAO;GACT,UAAU;GACV,IAAI,SAAS,MAAM;IACjB;IACA,UAAU,MAAM,UAAU;GAC5B,OAAO,IAAI,SAAS,MAAK,QAAQ;GACjC;EACF;EACA,IAAI,SAAS,MAAK,QAAQ;EAC1B,IAAI,SAAS,KAAK;GAChB,IAAI,OAAO,QAAQ;GACnB,OAAO,KAAK,KAAK,MAAM,SAAS,EAAE,KAAK,OAAO,MAAM,QAAQ;GAC5D,IAAI,MAAM,UAAU,OAAO,MAAM,UAAU,KAAK;EAClD;EACA,UAAU;CACZ;CACA,OAAO,KAAK,MAAM,MAAM;AAC1B"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime.cjs");
|
|
2
2
|
const require_toolchain_inputs = require("./toolchain-inputs.cjs");
|
|
3
3
|
const require_consumer_node_support = require("./consumer-node-support.cjs");
|
|
4
|
-
let
|
|
4
|
+
let node_fs_promises = require("node:fs/promises");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
7
|
+
let node_child_process = require("node:child_process");
|
|
7
8
|
let semver = require("semver");
|
|
8
9
|
let node_util = require("node:util");
|
|
9
10
|
let yaml = require("yaml");
|
|
10
11
|
let node_os = require("node:os");
|
|
11
12
|
let node_module = require("node:module");
|
|
12
13
|
node_module = require_rolldown_runtime.__toESM(node_module, 1);
|
|
13
|
-
let node_fs_promises = require("node:fs/promises");
|
|
14
14
|
let acorn = require("acorn");
|
|
15
15
|
let node_url = require("node:url");
|
|
16
16
|
let node_events = require("node:events");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { n as githubAutomationFileKind } from "./toolchain-inputs.mjs";
|
|
2
2
|
import { n as consumerNodeSupportMatches } from "./consumer-node-support.mjs";
|
|
3
3
|
import Module from "node:module";
|
|
4
|
-
import {
|
|
4
|
+
import { mkdir, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
|
+
import { execFile, spawn } from "node:child_process";
|
|
6
7
|
import { lte, parse, satisfies } from "semver";
|
|
7
8
|
import { isDeepStrictEqual, promisify } from "node:util";
|
|
8
9
|
import { parseDocument } from "yaml";
|
|
9
10
|
import { tmpdir } from "node:os";
|
|
10
|
-
import { mkdir, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
|
|
11
11
|
import { parse as parse$2 } from "acorn";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
import { once } from "node:events";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime.cjs");
|
|
2
2
|
const require_compiler_packages = require("./compiler-packages.cjs");
|
|
3
|
-
let node_fs = require("node:fs");
|
|
4
3
|
let node_path = require("node:path");
|
|
5
4
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
5
|
+
let node_fs = require("node:fs");
|
|
6
6
|
let node_crypto = require("node:crypto");
|
|
7
7
|
let node_module = require("node:module");
|
|
8
8
|
//#region src/publish-build-target-vite-dts.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as compilerPackages } from "./compiler-packages.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import { lstatSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
4
3
|
import path from "node:path";
|
|
4
|
+
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 = {
|
|
@@ -7,10 +7,10 @@ const require_consumer_node_support = require("./consumer-node-support.cjs");
|
|
|
7
7
|
const require_toolchain_schema = require("./toolchain-schema.cjs");
|
|
8
8
|
const require_publish_artifact_syntax = require("./publish-artifact-syntax.cjs");
|
|
9
9
|
const require_publish_build_target_vite_dts_helper = require("./publish-build-target-vite-dts-helper2.cjs");
|
|
10
|
-
let node_fs = require("node:fs");
|
|
11
|
-
let node_child_process = require("node:child_process");
|
|
12
10
|
let node_path = require("node:path");
|
|
13
11
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
12
|
+
let node_fs = require("node:fs");
|
|
13
|
+
let node_child_process = require("node:child_process");
|
|
14
14
|
let node_os = require("node:os");
|
|
15
15
|
let node_module = require("node:module");
|
|
16
16
|
let acorn = require("acorn");
|
|
@@ -6,9 +6,9 @@ import { t as parseToolchainPolicy } from "./toolchain-schema.mjs";
|
|
|
6
6
|
import { a as resolveManifestContract, n as readPackedSyntaxFiles, r as checkPublishContract, s as resolveConsumerReleasePack } from "./publish-artifact-syntax.mjs";
|
|
7
7
|
import { n as reviewedViteDtsOptions, t as declarationOnlyDts } from "./publish-build-target-vite-dts-helper2.mjs";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
|
+
import path from "node:path";
|
|
9
10
|
import { existsSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
10
11
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
11
|
-
import path from "node:path";
|
|
12
12
|
import { tmpdir } from "node:os";
|
|
13
13
|
import { parse } from "acorn";
|
|
14
14
|
import { pathToFileURL } from "node:url";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_generated_file = require("./generated-file.cjs");
|
|
4
|
+
const require_quarantine_policy = require("./quarantine-policy2.cjs");
|
|
5
|
+
const require_toolchain_guard = require("./toolchain-guard.cjs");
|
|
6
|
+
let node_fs_promises = require("node:fs/promises");
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
//#region src/quarantine-cli.ts
|
|
9
|
+
const usage = "Usage: stll-quarantine [--check | --sync | --prune]\nRun from the repository root; --check is the default.";
|
|
10
|
+
const main = async () => {
|
|
11
|
+
const args = process.argv.slice(2);
|
|
12
|
+
if (args.length === 1 && args.at(0) === "--help") {
|
|
13
|
+
process.stdout.write(`${usage}\n`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const mode = args.at(0) ?? "--check";
|
|
17
|
+
if (args.length > 1 || ![
|
|
18
|
+
"--check",
|
|
19
|
+
"--sync",
|
|
20
|
+
"--prune"
|
|
21
|
+
].includes(mode)) throw new Error(usage);
|
|
22
|
+
const root = await (0, node_fs_promises.realpath)(process.cwd());
|
|
23
|
+
const { files, trackedFiles, diagnostics } = require_toolchain_guard.readToolchainInputs(root, { bunLock: "content" });
|
|
24
|
+
const destination = (0, node_path.join)(root, "bunfig.toml");
|
|
25
|
+
for (const file of ["bunfig.toml", "bun.lock"]) {
|
|
26
|
+
const source = (0, node_path.join)(root, file);
|
|
27
|
+
if (await require_generated_file.checkGeneratedOutput(source) !== void 0) files[file] = await (0, node_fs_promises.readFile)(source, "utf8");
|
|
28
|
+
}
|
|
29
|
+
const remaining = await require_generated_file.generationDiagnostics({
|
|
30
|
+
diagnostics,
|
|
31
|
+
outputs: [{
|
|
32
|
+
relative: "bunfig.toml",
|
|
33
|
+
destination
|
|
34
|
+
}]
|
|
35
|
+
});
|
|
36
|
+
if (remaining.length > 0) throw new Error(remaining.map(({ path, message }) => `${path}: ${message}`).join("\n"));
|
|
37
|
+
if (mode === "--check") {
|
|
38
|
+
const npmrc = await (0, node_fs_promises.lstat)((0, node_path.join)(root, ".npmrc")).catch((error) => {
|
|
39
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return void 0;
|
|
40
|
+
throw error;
|
|
41
|
+
});
|
|
42
|
+
const result = require_quarantine_policy.checkRepositoryQuarantine({
|
|
43
|
+
files,
|
|
44
|
+
npmrcPresent: npmrc !== void 0 || trackedFiles.has(".npmrc")
|
|
45
|
+
});
|
|
46
|
+
for (const warning of result.warnings) process.stderr.write(`warning: ${warning}\n`);
|
|
47
|
+
if (result.errors.length > 0) throw new Error(result.errors.join("\n"));
|
|
48
|
+
process.stdout.write("Verified bunfig.toml quarantine policy\n");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const text = mode === "--sync" ? require_quarantine_policy.synchronizeRepositoryQuarantine({ files }) : require_quarantine_policy.pruneRepositoryQuarantine({ files }).bunfig;
|
|
52
|
+
const stat = await require_generated_file.checkGeneratedOutput(destination);
|
|
53
|
+
if (text !== files["bunfig.toml"]) await require_generated_file.writeGeneratedFile({
|
|
54
|
+
destination,
|
|
55
|
+
text,
|
|
56
|
+
mode: stat === void 0 ? 420 : stat.mode & 511
|
|
57
|
+
});
|
|
58
|
+
process.stdout.write(`${mode === "--sync" ? "Synchronized" : "Pruned"} bunfig.toml quarantine policy\n`);
|
|
59
|
+
};
|
|
60
|
+
main().catch((error) => {
|
|
61
|
+
process.stderr.write(`quarantine: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
62
|
+
process.exitCode = 1;
|
|
63
|
+
});
|
|
64
|
+
//#endregion
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=quarantine-cli.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quarantine-cli.cjs","names":["realpath","readToolchainInputs","join","checkGeneratedOutput","readFile","generationDiagnostics","lstat","checkRepositoryQuarantine","synchronizeRepositoryQuarantine","pruneRepositoryQuarantine","writeGeneratedFile"],"sources":["../src/quarantine-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { lstat, readFile, realpath } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport {\n checkGeneratedOutput,\n generationDiagnostics,\n writeGeneratedFile,\n} from \"./generated-file\";\nimport {\n checkRepositoryQuarantine,\n pruneRepositoryQuarantine,\n synchronizeRepositoryQuarantine,\n} from \"./quarantine-policy\";\nimport { readToolchainInputs } from \"./toolchain-guard\";\n\nconst usage =\n \"Usage: stll-quarantine [--check | --sync | --prune]\\nRun from the repository root; --check is the default.\";\nconst main = async () => {\n const args = process.argv.slice(2);\n if (args.length === 1 && args.at(0) === \"--help\") {\n process.stdout.write(`${usage}\\n`);\n return;\n }\n const mode = args.at(0) ?? \"--check\";\n if (args.length > 1 || ![\"--check\", \"--sync\", \"--prune\"].includes(mode))\n throw new Error(usage);\n const root = await realpath(process.cwd());\n const { files, trackedFiles, diagnostics } = readToolchainInputs(root, {\n bunLock: \"content\",\n });\n const destination = join(root, \"bunfig.toml\");\n // These root inputs may be new outputs not yet staged in Git.\n for (const file of [\"bunfig.toml\", \"bun.lock\"]) {\n const source = join(root, file);\n if ((await checkGeneratedOutput(source)) !== undefined)\n files[file] = await readFile(source, \"utf8\");\n }\n const remaining = await generationDiagnostics({\n diagnostics,\n outputs: [{ relative: \"bunfig.toml\", destination }],\n });\n if (remaining.length > 0)\n throw new Error(\n remaining.map(({ path, message }) => `${path}: ${message}`).join(\"\\n\"),\n );\n if (mode === \"--check\") {\n const npmrc = await lstat(join(root, \".npmrc\")).catch((error: unknown) => {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\")\n return undefined;\n throw error;\n });\n const result = checkRepositoryQuarantine({\n files,\n npmrcPresent: npmrc !== undefined || trackedFiles.has(\".npmrc\"),\n });\n for (const warning of result.warnings)\n process.stderr.write(`warning: ${warning}\\n`);\n if (result.errors.length > 0) throw new Error(result.errors.join(\"\\n\"));\n process.stdout.write(\"Verified bunfig.toml quarantine policy\\n\");\n return;\n }\n const text =\n mode === \"--sync\"\n ? synchronizeRepositoryQuarantine({ files })\n : pruneRepositoryQuarantine({ files }).bunfig;\n const stat = await checkGeneratedOutput(destination);\n if (text !== files[\"bunfig.toml\"])\n await writeGeneratedFile({\n destination,\n text,\n mode: stat === undefined ? 0o644 : stat.mode & 0o777,\n });\n process.stdout.write(\n `${mode === \"--sync\" ? \"Synchronized\" : \"Pruned\"} bunfig.toml quarantine policy\\n`,\n );\n};\nmain().catch((error: unknown) => {\n process.stderr.write(\n `quarantine: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;AAgBA,MAAM,QACJ;AACF,MAAM,OAAO,YAAY;CACvB,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CACjC,IAAI,KAAK,WAAW,KAAK,KAAK,GAAG,CAAC,MAAM,UAAU;EAChD,QAAQ,OAAO,MAAM,GAAG,MAAM,GAAG;EACjC;CACF;CACA,MAAM,OAAO,KAAK,GAAG,CAAC,KAAK;CAC3B,IAAI,KAAK,SAAS,KAAK,CAAC;EAAC;EAAW;EAAU;CAAS,CAAC,CAAC,SAAS,IAAI,GACpE,MAAM,IAAI,MAAM,KAAK;CACvB,MAAM,OAAO,OAAA,GAAMA,iBAAAA,SAAAA,CAAS,QAAQ,IAAI,CAAC;CACzC,MAAM,EAAE,OAAO,cAAc,gBAAgBC,wBAAAA,oBAAoB,MAAM,EACrE,SAAS,UACX,CAAC;CACD,MAAM,eAAA,GAAcC,UAAAA,KAAAA,CAAK,MAAM,aAAa;CAE5C,KAAK,MAAM,QAAQ,CAAC,eAAe,UAAU,GAAG;EAC9C,MAAM,UAAA,GAASA,UAAAA,KAAAA,CAAK,MAAM,IAAI;EAC9B,IAAK,MAAMC,uBAAAA,qBAAqB,MAAM,MAAO,KAAA,GAC3C,MAAM,QAAQ,OAAA,GAAMC,iBAAAA,SAAAA,CAAS,QAAQ,MAAM;CAC/C;CACA,MAAM,YAAY,MAAMC,uBAAAA,sBAAsB;EAC5C;EACA,SAAS,CAAC;GAAE,UAAU;GAAe;EAAY,CAAC;CACpD,CAAC;CACD,IAAI,UAAU,SAAS,GACrB,MAAM,IAAI,MACR,UAAU,KAAK,EAAE,MAAM,cAAc,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,KAAK,IAAI,CACvE;CACF,IAAI,SAAS,WAAW;EACtB,MAAM,QAAQ,OAAA,GAAMC,iBAAAA,MAAAA,EAAAA,GAAMJ,UAAAA,KAAAA,CAAK,MAAM,QAAQ,CAAC,CAAC,CAAC,OAAO,UAAmB;GACxE,IAAI,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS,UAC9D,OAAO,KAAA;GACT,MAAM;EACR,CAAC;EACD,MAAM,SAASK,0BAAAA,0BAA0B;GACvC;GACA,cAAc,UAAU,KAAA,KAAa,aAAa,IAAI,QAAQ;EAChE,CAAC;EACD,KAAK,MAAM,WAAW,OAAO,UAC3B,QAAQ,OAAO,MAAM,YAAY,QAAQ,GAAG;EAC9C,IAAI,OAAO,OAAO,SAAS,GAAG,MAAM,IAAI,MAAM,OAAO,OAAO,KAAK,IAAI,CAAC;EACtE,QAAQ,OAAO,MAAM,0CAA0C;EAC/D;CACF;CACA,MAAM,OACJ,SAAS,WACLC,0BAAAA,gCAAgC,EAAE,MAAM,CAAC,IACzCC,0BAAAA,0BAA0B,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3C,MAAM,OAAO,MAAMN,uBAAAA,qBAAqB,WAAW;CACnD,IAAI,SAAS,MAAM,gBACjB,MAAMO,uBAAAA,mBAAmB;EACvB;EACA;EACA,MAAM,SAAS,KAAA,IAAY,MAAQ,KAAK,OAAO;CACjD,CAAC;CACH,QAAQ,OAAO,MACb,GAAG,SAAS,WAAW,iBAAiB,SAAS,iCACnD;AACF;AACA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MACb,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GACxE;CACA,QAAQ,WAAW;AACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { n as generationDiagnostics, r as writeGeneratedFile, t as checkGeneratedOutput } from "./generated-file.mjs";
|
|
3
|
+
import { i as synchronizeRepositoryQuarantine, r as pruneRepositoryQuarantine, t as checkRepositoryQuarantine } from "./quarantine-policy2.mjs";
|
|
4
|
+
import { r as readToolchainInputs } from "./toolchain-guard.mjs";
|
|
5
|
+
import { lstat, readFile, realpath } from "node:fs/promises";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
//#region src/quarantine-cli.ts
|
|
8
|
+
const usage = "Usage: stll-quarantine [--check | --sync | --prune]\nRun from the repository root; --check is the default.";
|
|
9
|
+
const main = async () => {
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
if (args.length === 1 && args.at(0) === "--help") {
|
|
12
|
+
process.stdout.write(`${usage}\n`);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const mode = args.at(0) ?? "--check";
|
|
16
|
+
if (args.length > 1 || ![
|
|
17
|
+
"--check",
|
|
18
|
+
"--sync",
|
|
19
|
+
"--prune"
|
|
20
|
+
].includes(mode)) throw new Error(usage);
|
|
21
|
+
const root = await realpath(process.cwd());
|
|
22
|
+
const { files, trackedFiles, diagnostics } = readToolchainInputs(root, { bunLock: "content" });
|
|
23
|
+
const destination = join(root, "bunfig.toml");
|
|
24
|
+
for (const file of ["bunfig.toml", "bun.lock"]) {
|
|
25
|
+
const source = join(root, file);
|
|
26
|
+
if (await checkGeneratedOutput(source) !== void 0) files[file] = await readFile(source, "utf8");
|
|
27
|
+
}
|
|
28
|
+
const remaining = await generationDiagnostics({
|
|
29
|
+
diagnostics,
|
|
30
|
+
outputs: [{
|
|
31
|
+
relative: "bunfig.toml",
|
|
32
|
+
destination
|
|
33
|
+
}]
|
|
34
|
+
});
|
|
35
|
+
if (remaining.length > 0) throw new Error(remaining.map(({ path, message }) => `${path}: ${message}`).join("\n"));
|
|
36
|
+
if (mode === "--check") {
|
|
37
|
+
const npmrc = await lstat(join(root, ".npmrc")).catch((error) => {
|
|
38
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return void 0;
|
|
39
|
+
throw error;
|
|
40
|
+
});
|
|
41
|
+
const result = checkRepositoryQuarantine({
|
|
42
|
+
files,
|
|
43
|
+
npmrcPresent: npmrc !== void 0 || trackedFiles.has(".npmrc")
|
|
44
|
+
});
|
|
45
|
+
for (const warning of result.warnings) process.stderr.write(`warning: ${warning}\n`);
|
|
46
|
+
if (result.errors.length > 0) throw new Error(result.errors.join("\n"));
|
|
47
|
+
process.stdout.write("Verified bunfig.toml quarantine policy\n");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const text = mode === "--sync" ? synchronizeRepositoryQuarantine({ files }) : pruneRepositoryQuarantine({ files }).bunfig;
|
|
51
|
+
const stat = await checkGeneratedOutput(destination);
|
|
52
|
+
if (text !== files["bunfig.toml"]) await writeGeneratedFile({
|
|
53
|
+
destination,
|
|
54
|
+
text,
|
|
55
|
+
mode: stat === void 0 ? 420 : stat.mode & 511
|
|
56
|
+
});
|
|
57
|
+
process.stdout.write(`${mode === "--sync" ? "Synchronized" : "Pruned"} bunfig.toml quarantine policy\n`);
|
|
58
|
+
};
|
|
59
|
+
main().catch((error) => {
|
|
60
|
+
process.stderr.write(`quarantine: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
61
|
+
process.exitCode = 1;
|
|
62
|
+
});
|
|
63
|
+
//#endregion
|
|
64
|
+
export {};
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=quarantine-cli.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quarantine-cli.mjs","names":[],"sources":["../src/quarantine-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { lstat, readFile, realpath } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport {\n checkGeneratedOutput,\n generationDiagnostics,\n writeGeneratedFile,\n} from \"./generated-file\";\nimport {\n checkRepositoryQuarantine,\n pruneRepositoryQuarantine,\n synchronizeRepositoryQuarantine,\n} from \"./quarantine-policy\";\nimport { readToolchainInputs } from \"./toolchain-guard\";\n\nconst usage =\n \"Usage: stll-quarantine [--check | --sync | --prune]\\nRun from the repository root; --check is the default.\";\nconst main = async () => {\n const args = process.argv.slice(2);\n if (args.length === 1 && args.at(0) === \"--help\") {\n process.stdout.write(`${usage}\\n`);\n return;\n }\n const mode = args.at(0) ?? \"--check\";\n if (args.length > 1 || ![\"--check\", \"--sync\", \"--prune\"].includes(mode))\n throw new Error(usage);\n const root = await realpath(process.cwd());\n const { files, trackedFiles, diagnostics } = readToolchainInputs(root, {\n bunLock: \"content\",\n });\n const destination = join(root, \"bunfig.toml\");\n // These root inputs may be new outputs not yet staged in Git.\n for (const file of [\"bunfig.toml\", \"bun.lock\"]) {\n const source = join(root, file);\n if ((await checkGeneratedOutput(source)) !== undefined)\n files[file] = await readFile(source, \"utf8\");\n }\n const remaining = await generationDiagnostics({\n diagnostics,\n outputs: [{ relative: \"bunfig.toml\", destination }],\n });\n if (remaining.length > 0)\n throw new Error(\n remaining.map(({ path, message }) => `${path}: ${message}`).join(\"\\n\"),\n );\n if (mode === \"--check\") {\n const npmrc = await lstat(join(root, \".npmrc\")).catch((error: unknown) => {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\")\n return undefined;\n throw error;\n });\n const result = checkRepositoryQuarantine({\n files,\n npmrcPresent: npmrc !== undefined || trackedFiles.has(\".npmrc\"),\n });\n for (const warning of result.warnings)\n process.stderr.write(`warning: ${warning}\\n`);\n if (result.errors.length > 0) throw new Error(result.errors.join(\"\\n\"));\n process.stdout.write(\"Verified bunfig.toml quarantine policy\\n\");\n return;\n }\n const text =\n mode === \"--sync\"\n ? synchronizeRepositoryQuarantine({ files })\n : pruneRepositoryQuarantine({ files }).bunfig;\n const stat = await checkGeneratedOutput(destination);\n if (text !== files[\"bunfig.toml\"])\n await writeGeneratedFile({\n destination,\n text,\n mode: stat === undefined ? 0o644 : stat.mode & 0o777,\n });\n process.stdout.write(\n `${mode === \"--sync\" ? \"Synchronized\" : \"Pruned\"} bunfig.toml quarantine policy\\n`,\n );\n};\nmain().catch((error: unknown) => {\n process.stderr.write(\n `quarantine: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;AAgBA,MAAM,QACJ;AACF,MAAM,OAAO,YAAY;CACvB,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CACjC,IAAI,KAAK,WAAW,KAAK,KAAK,GAAG,CAAC,MAAM,UAAU;EAChD,QAAQ,OAAO,MAAM,GAAG,MAAM,GAAG;EACjC;CACF;CACA,MAAM,OAAO,KAAK,GAAG,CAAC,KAAK;CAC3B,IAAI,KAAK,SAAS,KAAK,CAAC;EAAC;EAAW;EAAU;CAAS,CAAC,CAAC,SAAS,IAAI,GACpE,MAAM,IAAI,MAAM,KAAK;CACvB,MAAM,OAAO,MAAM,SAAS,QAAQ,IAAI,CAAC;CACzC,MAAM,EAAE,OAAO,cAAc,gBAAgB,oBAAoB,MAAM,EACrE,SAAS,UACX,CAAC;CACD,MAAM,cAAc,KAAK,MAAM,aAAa;CAE5C,KAAK,MAAM,QAAQ,CAAC,eAAe,UAAU,GAAG;EAC9C,MAAM,SAAS,KAAK,MAAM,IAAI;EAC9B,IAAK,MAAM,qBAAqB,MAAM,MAAO,KAAA,GAC3C,MAAM,QAAQ,MAAM,SAAS,QAAQ,MAAM;CAC/C;CACA,MAAM,YAAY,MAAM,sBAAsB;EAC5C;EACA,SAAS,CAAC;GAAE,UAAU;GAAe;EAAY,CAAC;CACpD,CAAC;CACD,IAAI,UAAU,SAAS,GACrB,MAAM,IAAI,MACR,UAAU,KAAK,EAAE,MAAM,cAAc,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,KAAK,IAAI,CACvE;CACF,IAAI,SAAS,WAAW;EACtB,MAAM,QAAQ,MAAM,MAAM,KAAK,MAAM,QAAQ,CAAC,CAAC,CAAC,OAAO,UAAmB;GACxE,IAAI,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS,UAC9D,OAAO,KAAA;GACT,MAAM;EACR,CAAC;EACD,MAAM,SAAS,0BAA0B;GACvC;GACA,cAAc,UAAU,KAAA,KAAa,aAAa,IAAI,QAAQ;EAChE,CAAC;EACD,KAAK,MAAM,WAAW,OAAO,UAC3B,QAAQ,OAAO,MAAM,YAAY,QAAQ,GAAG;EAC9C,IAAI,OAAO,OAAO,SAAS,GAAG,MAAM,IAAI,MAAM,OAAO,OAAO,KAAK,IAAI,CAAC;EACtE,QAAQ,OAAO,MAAM,0CAA0C;EAC/D;CACF;CACA,MAAM,OACJ,SAAS,WACL,gCAAgC,EAAE,MAAM,CAAC,IACzC,0BAA0B,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3C,MAAM,OAAO,MAAM,qBAAqB,WAAW;CACnD,IAAI,SAAS,MAAM,gBACjB,MAAM,mBAAmB;EACvB;EACA;EACA,MAAM,SAAS,KAAA,IAAY,MAAQ,KAAK,OAAO;CACjD,CAAC;CACH,QAAQ,OAAO,MACb,GAAG,SAAS,WAAW,iBAAiB,SAAS,iCACnD;AACF;AACA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MACb,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GACxE;CACA,QAAQ,WAAW;AACrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_quarantine_policy = require("./quarantine-policy2.cjs");
|
|
3
|
+
exports.EXACT_UTC_TIMESTAMP = require_quarantine_policy.EXACT_UTC_TIMESTAMP;
|
|
4
|
+
exports.NPM_REGISTRY = require_quarantine_policy.NPM_REGISTRY;
|
|
5
|
+
exports.REQUIRED_RELEASE_AGE_SECONDS = require_quarantine_policy.REQUIRED_RELEASE_AGE_SECONDS;
|
|
6
|
+
exports.checkRepositoryQuarantine = require_quarantine_policy.checkRepositoryQuarantine;
|
|
7
|
+
exports.declaredFirstPartyPackages = require_quarantine_policy.declaredFirstPartyPackages;
|
|
8
|
+
exports.exactTimestamp = require_quarantine_policy.exactTimestamp;
|
|
9
|
+
exports.pruneRepositoryQuarantine = require_quarantine_policy.pruneRepositoryQuarantine;
|
|
10
|
+
exports.synchronizeRepositoryQuarantine = require_quarantine_policy.synchronizeRepositoryQuarantine;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/quarantine-policy-core.d.ts
|
|
2
|
+
declare const REQUIRED_RELEASE_AGE_SECONDS: number;
|
|
3
|
+
declare const NPM_REGISTRY = "https://registry.npmjs.org";
|
|
4
|
+
declare const EXACT_UTC_TIMESTAMP: RegExp;
|
|
5
|
+
declare const exactTimestamp: (value: string) => boolean;
|
|
6
|
+
type CheckResult = {
|
|
7
|
+
errors: string[];
|
|
8
|
+
warnings: string[];
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/quarantine-policy.d.ts
|
|
12
|
+
/** Derive exact registry identities before install, including catalog references. */
|
|
13
|
+
declare const declaredFirstPartyPackages: (files: Record<string, string>) => Set<string>;
|
|
14
|
+
type RepositoryQuarantineOptions = {
|
|
15
|
+
files: Record<string, string>;
|
|
16
|
+
now?: Date | undefined;
|
|
17
|
+
npmrcPresent?: boolean | undefined;
|
|
18
|
+
};
|
|
19
|
+
declare const checkRepositoryQuarantine: ({ files, now, npmrcPresent }: RepositoryQuarantineOptions) => CheckResult;
|
|
20
|
+
declare const synchronizeRepositoryQuarantine: ({ files, now }: RepositoryQuarantineOptions) => string;
|
|
21
|
+
declare const pruneRepositoryQuarantine: ({ files, now }: RepositoryQuarantineOptions) => {
|
|
22
|
+
bunfig: string;
|
|
23
|
+
pruned: string[];
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { EXACT_UTC_TIMESTAMP, NPM_REGISTRY, REQUIRED_RELEASE_AGE_SECONDS, checkRepositoryQuarantine, declaredFirstPartyPackages, exactTimestamp, pruneRepositoryQuarantine, synchronizeRepositoryQuarantine };
|
|
27
|
+
//# sourceMappingURL=quarantine-policy.d.cts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/quarantine-policy-core.d.ts
|
|
2
|
+
declare const REQUIRED_RELEASE_AGE_SECONDS: number;
|
|
3
|
+
declare const NPM_REGISTRY = "https://registry.npmjs.org";
|
|
4
|
+
declare const EXACT_UTC_TIMESTAMP: RegExp;
|
|
5
|
+
declare const exactTimestamp: (value: string) => boolean;
|
|
6
|
+
type CheckResult = {
|
|
7
|
+
errors: string[];
|
|
8
|
+
warnings: string[];
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/quarantine-policy.d.ts
|
|
12
|
+
/** Derive exact registry identities before install, including catalog references. */
|
|
13
|
+
declare const declaredFirstPartyPackages: (files: Record<string, string>) => Set<string>;
|
|
14
|
+
type RepositoryQuarantineOptions = {
|
|
15
|
+
files: Record<string, string>;
|
|
16
|
+
now?: Date | undefined;
|
|
17
|
+
npmrcPresent?: boolean | undefined;
|
|
18
|
+
};
|
|
19
|
+
declare const checkRepositoryQuarantine: ({ files, now, npmrcPresent }: RepositoryQuarantineOptions) => CheckResult;
|
|
20
|
+
declare const synchronizeRepositoryQuarantine: ({ files, now }: RepositoryQuarantineOptions) => string;
|
|
21
|
+
declare const pruneRepositoryQuarantine: ({ files, now }: RepositoryQuarantineOptions) => {
|
|
22
|
+
bunfig: string;
|
|
23
|
+
pruned: string[];
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { EXACT_UTC_TIMESTAMP, NPM_REGISTRY, REQUIRED_RELEASE_AGE_SECONDS, checkRepositoryQuarantine, declaredFirstPartyPackages, exactTimestamp, pruneRepositoryQuarantine, synchronizeRepositoryQuarantine };
|
|
27
|
+
//# sourceMappingURL=quarantine-policy.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as EXACT_UTC_TIMESTAMP, o as NPM_REGISTRY, s as REQUIRED_RELEASE_AGE_SECONDS, t as checkRepositoryQuarantine, n as declaredFirstPartyPackages, c as exactTimestamp, r as pruneRepositoryQuarantine, i as synchronizeRepositoryQuarantine } from "./quarantine-policy2.mjs";
|