@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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { n as generationDiagnostics, r as writeGeneratedFile, t as checkGeneratedOutput } from "./generated-file.mjs";
|
|
3
|
+
import { r as readToolchainInputs } from "./toolchain-guard.mjs";
|
|
4
|
+
import { i as parseDependabotInput, r as generateDependabotConfig } from "./toolchain-dependabot.mjs";
|
|
5
|
+
import { t as parseToolchainPolicy } from "./toolchain-schema.mjs";
|
|
6
|
+
import "./dependabot.mjs";
|
|
7
|
+
import { readFile, realpath } from "node:fs/promises";
|
|
8
|
+
import { join, resolve } from "node:path";
|
|
9
|
+
//#region src/dependabot-cli.ts
|
|
10
|
+
const usage = "Usage: stll-dependabot [--check] [--config <path>] (run from repository root)\n stll-dependabot --help";
|
|
11
|
+
const main = async () => {
|
|
12
|
+
const args = process.argv.slice(2);
|
|
13
|
+
if (args.length === 1 && args.at(0) === "--help") {
|
|
14
|
+
process.stdout.write(`${usage}\n`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let mode = "write";
|
|
18
|
+
let config;
|
|
19
|
+
for (let index = 0; index < args.length; index++) {
|
|
20
|
+
const arg = args[index];
|
|
21
|
+
if (arg === "--check" && mode === "write") {
|
|
22
|
+
mode = "check";
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (arg === "--config" && config === void 0) {
|
|
26
|
+
const next = args.at(index + 1);
|
|
27
|
+
if (next === void 0 || next.startsWith("--")) throw new Error(usage);
|
|
28
|
+
config = next;
|
|
29
|
+
index++;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
throw new Error(usage);
|
|
33
|
+
}
|
|
34
|
+
const root = await realpath(process.cwd());
|
|
35
|
+
const { files, trackedFiles, diagnostics } = readToolchainInputs(root);
|
|
36
|
+
const policy = parseToolchainPolicy(JSON.parse(await readFile(new URL("../toolchain.json", import.meta.url), "utf8")));
|
|
37
|
+
const yaml = join(root, ".github/dependabot.yaml");
|
|
38
|
+
const yml = join(root, ".github/dependabot.yml");
|
|
39
|
+
const yamlStat = await checkGeneratedOutput(yaml);
|
|
40
|
+
const ymlStat = await checkGeneratedOutput(yml);
|
|
41
|
+
const candidates = [{
|
|
42
|
+
relative: ".github/dependabot.yaml",
|
|
43
|
+
path: yaml,
|
|
44
|
+
stat: yamlStat
|
|
45
|
+
}, {
|
|
46
|
+
relative: ".github/dependabot.yml",
|
|
47
|
+
path: yml,
|
|
48
|
+
stat: ymlStat
|
|
49
|
+
}].filter(({ relative, stat }) => stat !== void 0 || trackedFiles.has(relative));
|
|
50
|
+
if (candidates.length > 1) throw new Error("keep exactly one Dependabot configuration: .yml or .yaml");
|
|
51
|
+
const selected = candidates.at(0) ?? {
|
|
52
|
+
relative: ".github/dependabot.yml",
|
|
53
|
+
path: yml,
|
|
54
|
+
stat: ymlStat
|
|
55
|
+
};
|
|
56
|
+
const remainingDiagnostics = await generationDiagnostics({
|
|
57
|
+
diagnostics,
|
|
58
|
+
outputs: [{
|
|
59
|
+
relative: selected.relative,
|
|
60
|
+
destination: selected.path
|
|
61
|
+
}]
|
|
62
|
+
});
|
|
63
|
+
if (remainingDiagnostics.length !== 0) throw new Error(remainingDiagnostics.map(({ path, message }) => `${path}: ${message}`).join("\n"));
|
|
64
|
+
const declarations = config === void 0 ? void 0 : parseDependabotInput(JSON.parse(await readFile(resolve(root, config), "utf8")));
|
|
65
|
+
const text = generateDependabotConfig({
|
|
66
|
+
files,
|
|
67
|
+
policy: policy.dependabot,
|
|
68
|
+
updates: declarations
|
|
69
|
+
});
|
|
70
|
+
const destination = selected.path;
|
|
71
|
+
if (mode === "check") {
|
|
72
|
+
if (selected.stat === void 0 || await readFile(destination, "utf8") !== text) throw new Error(`${selected.relative} has drifted; run stll-dependabot${config === void 0 ? "" : ` --config ${config}`}`);
|
|
73
|
+
process.stdout.write(`Verified ${selected.relative}\n`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const permissions = selected.stat?.mode;
|
|
77
|
+
await writeGeneratedFile({
|
|
78
|
+
destination,
|
|
79
|
+
text,
|
|
80
|
+
mode: permissions === void 0 ? 420 : permissions & 511
|
|
81
|
+
});
|
|
82
|
+
process.stdout.write(`Generated ${selected.relative}\n`);
|
|
83
|
+
};
|
|
84
|
+
main().catch((error) => {
|
|
85
|
+
process.stderr.write(`dependabot: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
86
|
+
process.exitCode = 1;
|
|
87
|
+
});
|
|
88
|
+
//#endregion
|
|
89
|
+
export {};
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=dependabot-cli.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependabot-cli.mjs","names":[],"sources":["../src/dependabot-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { readFile, realpath } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\n\nimport {\n generateDependabotConfig,\n parseDependabotInput,\n parseToolchainPolicy,\n} from \"./dependabot\";\nimport {\n checkGeneratedOutput,\n generationDiagnostics,\n writeGeneratedFile,\n} from \"./generated-file\";\nimport { readToolchainInputs } from \"./toolchain-guard\";\n\nconst usage =\n \"Usage: stll-dependabot [--check] [--config <path>] (run from repository root)\\n stll-dependabot --help\";\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 let mode: \"write\" | \"check\" = \"write\";\n let config: string | undefined;\n for (let index = 0; index < args.length; index++) {\n const arg = args[index];\n if (arg === \"--check\" && mode === \"write\") {\n mode = \"check\";\n continue;\n }\n if (arg === \"--config\" && config === undefined) {\n const next = args.at(index + 1);\n if (next === undefined || next.startsWith(\"--\")) throw new Error(usage);\n config = next;\n index++;\n continue;\n }\n throw new Error(usage);\n }\n const root = await realpath(process.cwd());\n const { files, trackedFiles, diagnostics } = readToolchainInputs(root);\n const policy = parseToolchainPolicy(\n JSON.parse(\n await readFile(new URL(\"../toolchain.json\", import.meta.url), \"utf8\"),\n ),\n );\n const yaml = join(root, \".github/dependabot.yaml\");\n const yml = join(root, \".github/dependabot.yml\");\n const yamlStat = await checkGeneratedOutput(yaml);\n const ymlStat = await checkGeneratedOutput(yml);\n const candidates = [\n { relative: \".github/dependabot.yaml\", path: yaml, stat: yamlStat },\n { relative: \".github/dependabot.yml\", path: yml, stat: ymlStat },\n ].filter(\n ({ relative, stat }) => stat !== undefined || trackedFiles.has(relative),\n );\n if (candidates.length > 1)\n throw new Error(\"keep exactly one Dependabot configuration: .yml or .yaml\");\n const selected = candidates.at(0) ?? {\n relative: \".github/dependabot.yml\",\n path: yml,\n stat: ymlStat,\n };\n const remainingDiagnostics = await generationDiagnostics({\n diagnostics,\n outputs: [{ relative: selected.relative, destination: selected.path }],\n });\n if (remainingDiagnostics.length !== 0)\n throw new Error(\n remainingDiagnostics\n .map(({ path, message }) => `${path}: ${message}`)\n .join(\"\\n\"),\n );\n const declarations =\n config === undefined\n ? undefined\n : parseDependabotInput(\n JSON.parse(await readFile(resolve(root, config), \"utf8\")),\n );\n const text = generateDependabotConfig({\n files,\n policy: policy.dependabot,\n updates: declarations,\n });\n const destination = selected.path;\n if (mode === \"check\") {\n if (\n selected.stat === undefined ||\n (await readFile(destination, \"utf8\")) !== text\n )\n throw new Error(\n `${selected.relative} has drifted; run stll-dependabot${config === undefined ? \"\" : ` --config ${config}`}`,\n );\n process.stdout.write(`Verified ${selected.relative}\\n`);\n return;\n }\n const permissions = selected.stat?.mode;\n await writeGeneratedFile({\n destination,\n text,\n mode: permissions === undefined ? 0o644 : permissions & 0o777,\n });\n process.stdout.write(`Generated ${selected.relative}\\n`);\n};\n\nmain().catch((error: unknown) => {\n process.stderr.write(\n `dependabot: ${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,IAAI,OAA0B;CAC9B,IAAI;CACJ,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;EAChD,MAAM,MAAM,KAAK;EACjB,IAAI,QAAQ,aAAa,SAAS,SAAS;GACzC,OAAO;GACP;EACF;EACA,IAAI,QAAQ,cAAc,WAAW,KAAA,GAAW;GAC9C,MAAM,OAAO,KAAK,GAAG,QAAQ,CAAC;GAC9B,IAAI,SAAS,KAAA,KAAa,KAAK,WAAW,IAAI,GAAG,MAAM,IAAI,MAAM,KAAK;GACtE,SAAS;GACT;GACA;EACF;EACA,MAAM,IAAI,MAAM,KAAK;CACvB;CACA,MAAM,OAAO,MAAM,SAAS,QAAQ,IAAI,CAAC;CACzC,MAAM,EAAE,OAAO,cAAc,gBAAgB,oBAAoB,IAAI;CACrE,MAAM,SAAS,qBACb,KAAK,MACH,MAAM,SAAS,IAAI,IAAI,qBAAqB,YAAY,GAAG,GAAG,MAAM,CACtE,CACF;CACA,MAAM,OAAO,KAAK,MAAM,yBAAyB;CACjD,MAAM,MAAM,KAAK,MAAM,wBAAwB;CAC/C,MAAM,WAAW,MAAM,qBAAqB,IAAI;CAChD,MAAM,UAAU,MAAM,qBAAqB,GAAG;CAC9C,MAAM,aAAa,CACjB;EAAE,UAAU;EAA2B,MAAM;EAAM,MAAM;CAAS,GAClE;EAAE,UAAU;EAA0B,MAAM;EAAK,MAAM;CAAQ,CACjE,CAAC,CAAC,QACC,EAAE,UAAU,WAAW,SAAS,KAAA,KAAa,aAAa,IAAI,QAAQ,CACzE;CACA,IAAI,WAAW,SAAS,GACtB,MAAM,IAAI,MAAM,0DAA0D;CAC5E,MAAM,WAAW,WAAW,GAAG,CAAC,KAAK;EACnC,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,MAAM,uBAAuB,MAAM,sBAAsB;EACvD;EACA,SAAS,CAAC;GAAE,UAAU,SAAS;GAAU,aAAa,SAAS;EAAK,CAAC;CACvE,CAAC;CACD,IAAI,qBAAqB,WAAW,GAClC,MAAM,IAAI,MACR,qBACG,KAAK,EAAE,MAAM,cAAc,GAAG,KAAK,IAAI,SAAS,CAAC,CACjD,KAAK,IAAI,CACd;CACF,MAAM,eACJ,WAAW,KAAA,IACP,KAAA,IACA,qBACE,KAAK,MAAM,MAAM,SAAS,QAAQ,MAAM,MAAM,GAAG,MAAM,CAAC,CAC1D;CACN,MAAM,OAAO,yBAAyB;EACpC;EACA,QAAQ,OAAO;EACf,SAAS;CACX,CAAC;CACD,MAAM,cAAc,SAAS;CAC7B,IAAI,SAAS,SAAS;EACpB,IACE,SAAS,SAAS,KAAA,KACjB,MAAM,SAAS,aAAa,MAAM,MAAO,MAE1C,MAAM,IAAI,MACR,GAAG,SAAS,SAAS,mCAAmC,WAAW,KAAA,IAAY,KAAK,aAAa,UACnG;EACF,QAAQ,OAAO,MAAM,YAAY,SAAS,SAAS,GAAG;EACtD;CACF;CACA,MAAM,cAAc,SAAS,MAAM;CACnC,MAAM,mBAAmB;EACvB;EACA;EACA,MAAM,gBAAgB,KAAA,IAAY,MAAQ,cAAc;CAC1D,CAAC;CACD,QAAQ,OAAO,MAAM,aAAa,SAAS,SAAS,GAAG;AACzD;AAEA,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,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_toolchain_dependabot = require("./toolchain-dependabot.cjs");
|
|
3
|
+
const require_toolchain_schema = require("./toolchain-schema.cjs");
|
|
4
|
+
exports.generateDependabotConfig = require_toolchain_dependabot.generateDependabotConfig;
|
|
5
|
+
exports.parseDependabotInput = require_toolchain_dependabot.parseDependabotInput;
|
|
6
|
+
exports.parseToolchainPolicy = require_toolchain_schema.parseToolchainPolicy;
|
|
7
|
+
exports.supportedDependabotEcosystems = require_toolchain_dependabot.supportedDependabotEcosystems;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
//#region src/toolchain-dependabot.d.ts
|
|
2
|
+
declare const supportedDependabotEcosystems: readonly ["bazel", "bun", "bundler", "cargo", "composer", "conda", "deno", "devcontainers", "docker", "docker-compose", "dotnet-sdk", "elm", "gitsubmodule", "github-actions", "gomod", "gradle", "helm", "julia", "maven", "mix", "nix", "npm", "nuget", "opentofu", "pip", "pre-commit", "pub", "rust-toolchain", "sbt", "swift", "terraform", "uv", "vcpkg"];
|
|
3
|
+
type DependabotEcosystem = (typeof supportedDependabotEcosystems)[number];
|
|
4
|
+
type DependabotPolicy = {
|
|
5
|
+
schedule: {
|
|
6
|
+
interval: string;
|
|
7
|
+
day: string;
|
|
8
|
+
time: string;
|
|
9
|
+
timezone: string;
|
|
10
|
+
};
|
|
11
|
+
cooldown: {
|
|
12
|
+
defaultDays: number;
|
|
13
|
+
};
|
|
14
|
+
groups: Record<string, {
|
|
15
|
+
patterns: readonly string[];
|
|
16
|
+
updateTypes: readonly string[];
|
|
17
|
+
}>;
|
|
18
|
+
ignoredPackages: readonly string[];
|
|
19
|
+
ignoredActions: readonly string[];
|
|
20
|
+
ignoredImages: readonly string[];
|
|
21
|
+
};
|
|
22
|
+
type CheckDependabotOptions = {
|
|
23
|
+
files: Record<string, string>;
|
|
24
|
+
policy: DependabotPolicy;
|
|
25
|
+
};
|
|
26
|
+
/** Repository declarations own coverage only; shared policy owns every update option. */
|
|
27
|
+
declare const parseDependabotInput: (input: unknown) => {
|
|
28
|
+
ecosystem: "bazel" | "bun" | "bundler" | "cargo" | "composer" | "conda" | "deno" | "devcontainers" | "docker" | "docker-compose" | "dotnet-sdk" | "elm" | "github-actions" | "gitsubmodule" | "gomod" | "gradle" | "helm" | "julia" | "maven" | "mix" | "nix" | "npm" | "nuget" | "opentofu" | "pip" | "pre-commit" | "pub" | "rust-toolchain" | "sbt" | "swift" | "terraform" | "uv" | "vcpkg";
|
|
29
|
+
directories: string[];
|
|
30
|
+
}[];
|
|
31
|
+
type GenerateDependabotOptions = CheckDependabotOptions & {
|
|
32
|
+
updates?: ReturnType<typeof parseDependabotInput> | undefined;
|
|
33
|
+
};
|
|
34
|
+
/** Generate canonical YAML from the same ecosystem enumeration used by the guard. */
|
|
35
|
+
declare const generateDependabotConfig: ({ files, policy, updates: declarations }: GenerateDependabotOptions) => string;
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/toolchain-schema.d.ts
|
|
38
|
+
/** Reject unsupported or incomplete installed policies before inspecting a consumer. */
|
|
39
|
+
declare const parseToolchainPolicy: (input: unknown) => {
|
|
40
|
+
bun: string;
|
|
41
|
+
typescript: string;
|
|
42
|
+
node: string;
|
|
43
|
+
postgres: string;
|
|
44
|
+
valkey: string;
|
|
45
|
+
valkeyArtifacts: {
|
|
46
|
+
amd64: {
|
|
47
|
+
server: {
|
|
48
|
+
url: string;
|
|
49
|
+
sha256: string;
|
|
50
|
+
};
|
|
51
|
+
tools: {
|
|
52
|
+
url: string;
|
|
53
|
+
sha256: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
arm64: {
|
|
57
|
+
server: {
|
|
58
|
+
url: string;
|
|
59
|
+
sha256: string;
|
|
60
|
+
};
|
|
61
|
+
tools: {
|
|
62
|
+
url: string;
|
|
63
|
+
sha256: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
consumerNode: string;
|
|
68
|
+
consumerNpm: string;
|
|
69
|
+
consumerPnpm: string;
|
|
70
|
+
consumerTypescript: string;
|
|
71
|
+
python: string;
|
|
72
|
+
rust: string;
|
|
73
|
+
packages: Record<string, string>;
|
|
74
|
+
actions: Record<string, {
|
|
75
|
+
sha: string;
|
|
76
|
+
version: string;
|
|
77
|
+
}>;
|
|
78
|
+
typescriptInstallLayouts: ({
|
|
79
|
+
readonly type: "direct";
|
|
80
|
+
readonly compilerPackage: "typescript";
|
|
81
|
+
readonly compilerSpecifier: string;
|
|
82
|
+
readonly typecheckCommand: string;
|
|
83
|
+
readonly compatibilityPackage?: never;
|
|
84
|
+
readonly compatibilitySpecifier?: never;
|
|
85
|
+
} | {
|
|
86
|
+
readonly type: "split-compatibility";
|
|
87
|
+
readonly compilerPackage: string;
|
|
88
|
+
readonly compilerSpecifier: string;
|
|
89
|
+
readonly compatibilityPackage: string;
|
|
90
|
+
readonly compatibilitySpecifier: string;
|
|
91
|
+
readonly typecheckCommand: string;
|
|
92
|
+
})[];
|
|
93
|
+
typescript6Compatibility: {
|
|
94
|
+
version: string;
|
|
95
|
+
packageAlias: string;
|
|
96
|
+
};
|
|
97
|
+
dependabot: {
|
|
98
|
+
schedule: {
|
|
99
|
+
interval: string;
|
|
100
|
+
day: string;
|
|
101
|
+
time: string;
|
|
102
|
+
timezone: string;
|
|
103
|
+
};
|
|
104
|
+
cooldown: {
|
|
105
|
+
defaultDays: number;
|
|
106
|
+
};
|
|
107
|
+
groups: Record<string, {
|
|
108
|
+
patterns: string[];
|
|
109
|
+
updateTypes: string[];
|
|
110
|
+
}>;
|
|
111
|
+
ignoredPackages: string[];
|
|
112
|
+
ignoredActions: string[];
|
|
113
|
+
ignoredImages: string[];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
//#endregion
|
|
117
|
+
export { type DependabotEcosystem, generateDependabotConfig, parseDependabotInput, parseToolchainPolicy, supportedDependabotEcosystems };
|
|
118
|
+
//# sourceMappingURL=dependabot.d.cts.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
//#region src/toolchain-dependabot.d.ts
|
|
2
|
+
declare const supportedDependabotEcosystems: readonly ["bazel", "bun", "bundler", "cargo", "composer", "conda", "deno", "devcontainers", "docker", "docker-compose", "dotnet-sdk", "elm", "gitsubmodule", "github-actions", "gomod", "gradle", "helm", "julia", "maven", "mix", "nix", "npm", "nuget", "opentofu", "pip", "pre-commit", "pub", "rust-toolchain", "sbt", "swift", "terraform", "uv", "vcpkg"];
|
|
3
|
+
type DependabotEcosystem = (typeof supportedDependabotEcosystems)[number];
|
|
4
|
+
type DependabotPolicy = {
|
|
5
|
+
schedule: {
|
|
6
|
+
interval: string;
|
|
7
|
+
day: string;
|
|
8
|
+
time: string;
|
|
9
|
+
timezone: string;
|
|
10
|
+
};
|
|
11
|
+
cooldown: {
|
|
12
|
+
defaultDays: number;
|
|
13
|
+
};
|
|
14
|
+
groups: Record<string, {
|
|
15
|
+
patterns: readonly string[];
|
|
16
|
+
updateTypes: readonly string[];
|
|
17
|
+
}>;
|
|
18
|
+
ignoredPackages: readonly string[];
|
|
19
|
+
ignoredActions: readonly string[];
|
|
20
|
+
ignoredImages: readonly string[];
|
|
21
|
+
};
|
|
22
|
+
type CheckDependabotOptions = {
|
|
23
|
+
files: Record<string, string>;
|
|
24
|
+
policy: DependabotPolicy;
|
|
25
|
+
};
|
|
26
|
+
/** Repository declarations own coverage only; shared policy owns every update option. */
|
|
27
|
+
declare const parseDependabotInput: (input: unknown) => {
|
|
28
|
+
ecosystem: "bazel" | "bun" | "bundler" | "cargo" | "composer" | "conda" | "deno" | "devcontainers" | "docker" | "docker-compose" | "dotnet-sdk" | "elm" | "github-actions" | "gitsubmodule" | "gomod" | "gradle" | "helm" | "julia" | "maven" | "mix" | "nix" | "npm" | "nuget" | "opentofu" | "pip" | "pre-commit" | "pub" | "rust-toolchain" | "sbt" | "swift" | "terraform" | "uv" | "vcpkg";
|
|
29
|
+
directories: string[];
|
|
30
|
+
}[];
|
|
31
|
+
type GenerateDependabotOptions = CheckDependabotOptions & {
|
|
32
|
+
updates?: ReturnType<typeof parseDependabotInput> | undefined;
|
|
33
|
+
};
|
|
34
|
+
/** Generate canonical YAML from the same ecosystem enumeration used by the guard. */
|
|
35
|
+
declare const generateDependabotConfig: ({ files, policy, updates: declarations }: GenerateDependabotOptions) => string;
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/toolchain-schema.d.ts
|
|
38
|
+
/** Reject unsupported or incomplete installed policies before inspecting a consumer. */
|
|
39
|
+
declare const parseToolchainPolicy: (input: unknown) => {
|
|
40
|
+
bun: string;
|
|
41
|
+
typescript: string;
|
|
42
|
+
node: string;
|
|
43
|
+
postgres: string;
|
|
44
|
+
valkey: string;
|
|
45
|
+
valkeyArtifacts: {
|
|
46
|
+
amd64: {
|
|
47
|
+
server: {
|
|
48
|
+
url: string;
|
|
49
|
+
sha256: string;
|
|
50
|
+
};
|
|
51
|
+
tools: {
|
|
52
|
+
url: string;
|
|
53
|
+
sha256: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
arm64: {
|
|
57
|
+
server: {
|
|
58
|
+
url: string;
|
|
59
|
+
sha256: string;
|
|
60
|
+
};
|
|
61
|
+
tools: {
|
|
62
|
+
url: string;
|
|
63
|
+
sha256: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
consumerNode: string;
|
|
68
|
+
consumerNpm: string;
|
|
69
|
+
consumerPnpm: string;
|
|
70
|
+
consumerTypescript: string;
|
|
71
|
+
python: string;
|
|
72
|
+
rust: string;
|
|
73
|
+
packages: Record<string, string>;
|
|
74
|
+
actions: Record<string, {
|
|
75
|
+
sha: string;
|
|
76
|
+
version: string;
|
|
77
|
+
}>;
|
|
78
|
+
typescriptInstallLayouts: ({
|
|
79
|
+
readonly type: "direct";
|
|
80
|
+
readonly compilerPackage: "typescript";
|
|
81
|
+
readonly compilerSpecifier: string;
|
|
82
|
+
readonly typecheckCommand: string;
|
|
83
|
+
readonly compatibilityPackage?: never;
|
|
84
|
+
readonly compatibilitySpecifier?: never;
|
|
85
|
+
} | {
|
|
86
|
+
readonly type: "split-compatibility";
|
|
87
|
+
readonly compilerPackage: string;
|
|
88
|
+
readonly compilerSpecifier: string;
|
|
89
|
+
readonly compatibilityPackage: string;
|
|
90
|
+
readonly compatibilitySpecifier: string;
|
|
91
|
+
readonly typecheckCommand: string;
|
|
92
|
+
})[];
|
|
93
|
+
typescript6Compatibility: {
|
|
94
|
+
version: string;
|
|
95
|
+
packageAlias: string;
|
|
96
|
+
};
|
|
97
|
+
dependabot: {
|
|
98
|
+
schedule: {
|
|
99
|
+
interval: string;
|
|
100
|
+
day: string;
|
|
101
|
+
time: string;
|
|
102
|
+
timezone: string;
|
|
103
|
+
};
|
|
104
|
+
cooldown: {
|
|
105
|
+
defaultDays: number;
|
|
106
|
+
};
|
|
107
|
+
groups: Record<string, {
|
|
108
|
+
patterns: string[];
|
|
109
|
+
updateTypes: string[];
|
|
110
|
+
}>;
|
|
111
|
+
ignoredPackages: string[];
|
|
112
|
+
ignoredActions: string[];
|
|
113
|
+
ignoredImages: string[];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
//#endregion
|
|
117
|
+
export { type DependabotEcosystem, generateDependabotConfig, parseDependabotInput, parseToolchainPolicy, supportedDependabotEcosystems };
|
|
118
|
+
//# sourceMappingURL=dependabot.d.mts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as supportedDependabotEcosystems, i as parseDependabotInput, r as generateDependabotConfig } from "./toolchain-dependabot.mjs";
|
|
2
|
+
import { t as parseToolchainPolicy } from "./toolchain-schema.mjs";
|
|
3
|
+
export { generateDependabotConfig, parseDependabotInput, parseToolchainPolicy, supportedDependabotEcosystems };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
let node_fs_promises = require("node:fs/promises");
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
//#region src/generated-file.ts
|
|
5
|
+
const optionalStat = async (path) => {
|
|
6
|
+
try {
|
|
7
|
+
return await (0, node_fs_promises.lstat)(path);
|
|
8
|
+
} catch (error) {
|
|
9
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return void 0;
|
|
10
|
+
throw error;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const checkGeneratedOutput = async (destination) => {
|
|
14
|
+
const parent = (0, node_path.dirname)(destination);
|
|
15
|
+
const parentStat = await optionalStat(parent);
|
|
16
|
+
if (parentStat !== void 0 && (parentStat.isSymbolicLink() || !parentStat.isDirectory())) throw new Error("generated output parent must be a real repository directory");
|
|
17
|
+
const destinationStat = await optionalStat(destination);
|
|
18
|
+
if (destinationStat !== void 0 && (destinationStat.isSymbolicLink() || !destinationStat.isFile() || destinationStat.nlink !== 1)) throw new Error("generated output destination must be a single-link regular repository file");
|
|
19
|
+
return destinationStat;
|
|
20
|
+
};
|
|
21
|
+
/** Only absent owned outputs may be recovered while reading tracked inputs. */
|
|
22
|
+
const generationDiagnostics = async ({ diagnostics, outputs }) => {
|
|
23
|
+
const missing = /* @__PURE__ */ new Set();
|
|
24
|
+
for (const { relative, destination } of outputs) if (await checkGeneratedOutput(destination) === void 0) missing.add(relative);
|
|
25
|
+
return diagnostics.filter(({ path }) => !missing.has(path));
|
|
26
|
+
};
|
|
27
|
+
const writeGeneratedFile = async ({ destination, text, mode }) => {
|
|
28
|
+
await checkGeneratedOutput(destination);
|
|
29
|
+
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(destination), { recursive: true });
|
|
30
|
+
const output = await (0, node_fs_promises.open)(destination, node_fs.constants.O_WRONLY | node_fs.constants.O_CREAT | node_fs.constants.O_NOFOLLOW, mode);
|
|
31
|
+
try {
|
|
32
|
+
const opened = await output.stat();
|
|
33
|
+
if (!opened.isFile() || opened.nlink !== 1) throw new Error("generated output destination must be a single-link regular repository file");
|
|
34
|
+
await output.truncate(0);
|
|
35
|
+
await output.writeFile(text, "utf8");
|
|
36
|
+
await output.chmod(mode);
|
|
37
|
+
} finally {
|
|
38
|
+
await output.close();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
Object.defineProperty(exports, "checkGeneratedOutput", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function() {
|
|
45
|
+
return checkGeneratedOutput;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "generationDiagnostics", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function() {
|
|
51
|
+
return generationDiagnostics;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "writeGeneratedFile", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function() {
|
|
57
|
+
return writeGeneratedFile;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=generated-file.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-file.cjs","names":["lstat","dirname","mkdir","open","constants"],"sources":["../src/generated-file.ts"],"sourcesContent":["import { constants } from \"node:fs\";\nimport { lstat, mkdir, open } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nconst optionalStat = async (path: string) => {\n try {\n return await lstat(path);\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\")\n return undefined;\n throw error;\n }\n};\n\nexport const checkGeneratedOutput = async (destination: string) => {\n const parent = dirname(destination);\n const parentStat = await optionalStat(parent);\n if (\n parentStat !== undefined &&\n (parentStat.isSymbolicLink() || !parentStat.isDirectory())\n )\n throw new Error(\n \"generated output parent must be a real repository directory\",\n );\n const destinationStat = await optionalStat(destination);\n if (\n destinationStat !== undefined &&\n (destinationStat.isSymbolicLink() ||\n !destinationStat.isFile() ||\n destinationStat.nlink !== 1)\n )\n throw new Error(\n \"generated output destination must be a single-link regular repository file\",\n );\n return destinationStat;\n};\n\ntype GenerationDiagnosticsOptions = {\n diagnostics: readonly { path: string; message: string }[];\n outputs: readonly { relative: string; destination: string }[];\n};\n\n/** Only absent owned outputs may be recovered while reading tracked inputs. */\nexport const generationDiagnostics = async ({\n diagnostics,\n outputs,\n}: GenerationDiagnosticsOptions) => {\n const missing = new Set<string>();\n for (const { relative, destination } of outputs) {\n if ((await checkGeneratedOutput(destination)) === undefined)\n missing.add(relative);\n }\n return diagnostics.filter(({ path }) => !missing.has(path));\n};\n\ntype GeneratedFileOptions = {\n destination: string;\n text: string;\n mode: number;\n};\n\nexport const writeGeneratedFile = async ({\n destination,\n text,\n mode,\n}: GeneratedFileOptions) => {\n await checkGeneratedOutput(destination);\n await mkdir(dirname(destination), { recursive: true });\n const output = await open(\n destination,\n constants.O_WRONLY | constants.O_CREAT | constants.O_NOFOLLOW,\n mode,\n );\n try {\n const opened = await output.stat();\n if (!opened.isFile() || opened.nlink !== 1)\n throw new Error(\n \"generated output destination must be a single-link regular repository file\",\n );\n await output.truncate(0);\n await output.writeFile(text, \"utf8\");\n await output.chmod(mode);\n } finally {\n await output.close();\n }\n};\n"],"mappings":";;;;AAIA,MAAM,eAAe,OAAO,SAAiB;CAC3C,IAAI;EACF,OAAO,OAAA,GAAMA,iBAAAA,MAAAA,CAAM,IAAI;CACzB,SAAS,OAAO;EACd,IAAI,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS,UAC9D,OAAO,KAAA;EACT,MAAM;CACR;AACF;AAEA,MAAa,uBAAuB,OAAO,gBAAwB;CACjE,MAAM,UAAA,GAASC,UAAAA,QAAAA,CAAQ,WAAW;CAClC,MAAM,aAAa,MAAM,aAAa,MAAM;CAC5C,IACE,eAAe,KAAA,MACd,WAAW,eAAe,KAAK,CAAC,WAAW,YAAY,IAExD,MAAM,IAAI,MACR,6DACF;CACF,MAAM,kBAAkB,MAAM,aAAa,WAAW;CACtD,IACE,oBAAoB,KAAA,MACnB,gBAAgB,eAAe,KAC9B,CAAC,gBAAgB,OAAO,KACxB,gBAAgB,UAAU,IAE5B,MAAM,IAAI,MACR,4EACF;CACF,OAAO;AACT;;AAQA,MAAa,wBAAwB,OAAO,EAC1C,aACA,cACkC;CAClC,MAAM,0BAAU,IAAI,IAAY;CAChC,KAAK,MAAM,EAAE,UAAU,iBAAiB,SACtC,IAAK,MAAM,qBAAqB,WAAW,MAAO,KAAA,GAChD,QAAQ,IAAI,QAAQ;CAExB,OAAO,YAAY,QAAQ,EAAE,WAAW,CAAC,QAAQ,IAAI,IAAI,CAAC;AAC5D;AAQA,MAAa,qBAAqB,OAAO,EACvC,aACA,MACA,WAC0B;CAC1B,MAAM,qBAAqB,WAAW;CACtC,OAAA,GAAMC,iBAAAA,MAAAA,EAAAA,GAAMD,UAAAA,QAAAA,CAAQ,WAAW,GAAG,EAAE,WAAW,KAAK,CAAC;CACrD,MAAM,SAAS,OAAA,GAAME,iBAAAA,KAAAA,CACnB,aACAC,QAAAA,UAAU,WAAWA,QAAAA,UAAU,UAAUA,QAAAA,UAAU,YACnD,IACF;CACA,IAAI;EACF,MAAM,SAAS,MAAM,OAAO,KAAK;EACjC,IAAI,CAAC,OAAO,OAAO,KAAK,OAAO,UAAU,GACvC,MAAM,IAAI,MACR,4EACF;EACF,MAAM,OAAO,SAAS,CAAC;EACvB,MAAM,OAAO,UAAU,MAAM,MAAM;EACnC,MAAM,OAAO,MAAM,IAAI;CACzB,UAAU;EACR,MAAM,OAAO,MAAM;CACrB;AACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { lstat, mkdir, open } from "node:fs/promises";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import { constants } from "node:fs";
|
|
4
|
+
//#region src/generated-file.ts
|
|
5
|
+
const optionalStat = async (path) => {
|
|
6
|
+
try {
|
|
7
|
+
return await lstat(path);
|
|
8
|
+
} catch (error) {
|
|
9
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return void 0;
|
|
10
|
+
throw error;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const checkGeneratedOutput = async (destination) => {
|
|
14
|
+
const parent = dirname(destination);
|
|
15
|
+
const parentStat = await optionalStat(parent);
|
|
16
|
+
if (parentStat !== void 0 && (parentStat.isSymbolicLink() || !parentStat.isDirectory())) throw new Error("generated output parent must be a real repository directory");
|
|
17
|
+
const destinationStat = await optionalStat(destination);
|
|
18
|
+
if (destinationStat !== void 0 && (destinationStat.isSymbolicLink() || !destinationStat.isFile() || destinationStat.nlink !== 1)) throw new Error("generated output destination must be a single-link regular repository file");
|
|
19
|
+
return destinationStat;
|
|
20
|
+
};
|
|
21
|
+
/** Only absent owned outputs may be recovered while reading tracked inputs. */
|
|
22
|
+
const generationDiagnostics = async ({ diagnostics, outputs }) => {
|
|
23
|
+
const missing = /* @__PURE__ */ new Set();
|
|
24
|
+
for (const { relative, destination } of outputs) if (await checkGeneratedOutput(destination) === void 0) missing.add(relative);
|
|
25
|
+
return diagnostics.filter(({ path }) => !missing.has(path));
|
|
26
|
+
};
|
|
27
|
+
const writeGeneratedFile = async ({ destination, text, mode }) => {
|
|
28
|
+
await checkGeneratedOutput(destination);
|
|
29
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
30
|
+
const output = await open(destination, constants.O_WRONLY | constants.O_CREAT | constants.O_NOFOLLOW, mode);
|
|
31
|
+
try {
|
|
32
|
+
const opened = await output.stat();
|
|
33
|
+
if (!opened.isFile() || opened.nlink !== 1) throw new Error("generated output destination must be a single-link regular repository file");
|
|
34
|
+
await output.truncate(0);
|
|
35
|
+
await output.writeFile(text, "utf8");
|
|
36
|
+
await output.chmod(mode);
|
|
37
|
+
} finally {
|
|
38
|
+
await output.close();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { generationDiagnostics as n, writeGeneratedFile as r, checkGeneratedOutput as t };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=generated-file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-file.mjs","names":[],"sources":["../src/generated-file.ts"],"sourcesContent":["import { constants } from \"node:fs\";\nimport { lstat, mkdir, open } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nconst optionalStat = async (path: string) => {\n try {\n return await lstat(path);\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\")\n return undefined;\n throw error;\n }\n};\n\nexport const checkGeneratedOutput = async (destination: string) => {\n const parent = dirname(destination);\n const parentStat = await optionalStat(parent);\n if (\n parentStat !== undefined &&\n (parentStat.isSymbolicLink() || !parentStat.isDirectory())\n )\n throw new Error(\n \"generated output parent must be a real repository directory\",\n );\n const destinationStat = await optionalStat(destination);\n if (\n destinationStat !== undefined &&\n (destinationStat.isSymbolicLink() ||\n !destinationStat.isFile() ||\n destinationStat.nlink !== 1)\n )\n throw new Error(\n \"generated output destination must be a single-link regular repository file\",\n );\n return destinationStat;\n};\n\ntype GenerationDiagnosticsOptions = {\n diagnostics: readonly { path: string; message: string }[];\n outputs: readonly { relative: string; destination: string }[];\n};\n\n/** Only absent owned outputs may be recovered while reading tracked inputs. */\nexport const generationDiagnostics = async ({\n diagnostics,\n outputs,\n}: GenerationDiagnosticsOptions) => {\n const missing = new Set<string>();\n for (const { relative, destination } of outputs) {\n if ((await checkGeneratedOutput(destination)) === undefined)\n missing.add(relative);\n }\n return diagnostics.filter(({ path }) => !missing.has(path));\n};\n\ntype GeneratedFileOptions = {\n destination: string;\n text: string;\n mode: number;\n};\n\nexport const writeGeneratedFile = async ({\n destination,\n text,\n mode,\n}: GeneratedFileOptions) => {\n await checkGeneratedOutput(destination);\n await mkdir(dirname(destination), { recursive: true });\n const output = await open(\n destination,\n constants.O_WRONLY | constants.O_CREAT | constants.O_NOFOLLOW,\n mode,\n );\n try {\n const opened = await output.stat();\n if (!opened.isFile() || opened.nlink !== 1)\n throw new Error(\n \"generated output destination must be a single-link regular repository file\",\n );\n await output.truncate(0);\n await output.writeFile(text, \"utf8\");\n await output.chmod(mode);\n } finally {\n await output.close();\n }\n};\n"],"mappings":";;;;AAIA,MAAM,eAAe,OAAO,SAAiB;CAC3C,IAAI;EACF,OAAO,MAAM,MAAM,IAAI;CACzB,SAAS,OAAO;EACd,IAAI,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS,UAC9D,OAAO,KAAA;EACT,MAAM;CACR;AACF;AAEA,MAAa,uBAAuB,OAAO,gBAAwB;CACjE,MAAM,SAAS,QAAQ,WAAW;CAClC,MAAM,aAAa,MAAM,aAAa,MAAM;CAC5C,IACE,eAAe,KAAA,MACd,WAAW,eAAe,KAAK,CAAC,WAAW,YAAY,IAExD,MAAM,IAAI,MACR,6DACF;CACF,MAAM,kBAAkB,MAAM,aAAa,WAAW;CACtD,IACE,oBAAoB,KAAA,MACnB,gBAAgB,eAAe,KAC9B,CAAC,gBAAgB,OAAO,KACxB,gBAAgB,UAAU,IAE5B,MAAM,IAAI,MACR,4EACF;CACF,OAAO;AACT;;AAQA,MAAa,wBAAwB,OAAO,EAC1C,aACA,cACkC;CAClC,MAAM,0BAAU,IAAI,IAAY;CAChC,KAAK,MAAM,EAAE,UAAU,iBAAiB,SACtC,IAAK,MAAM,qBAAqB,WAAW,MAAO,KAAA,GAChD,QAAQ,IAAI,QAAQ;CAExB,OAAO,YAAY,QAAQ,EAAE,WAAW,CAAC,QAAQ,IAAI,IAAI,CAAC;AAC5D;AAQA,MAAa,qBAAqB,OAAO,EACvC,aACA,MACA,WAC0B;CAC1B,MAAM,qBAAqB,WAAW;CACtC,MAAM,MAAM,QAAQ,WAAW,GAAG,EAAE,WAAW,KAAK,CAAC;CACrD,MAAM,SAAS,MAAM,KACnB,aACA,UAAU,WAAW,UAAU,UAAU,UAAU,YACnD,IACF;CACA,IAAI;EACF,MAAM,SAAS,MAAM,OAAO,KAAK;EACjC,IAAI,CAAC,OAAO,OAAO,KAAK,OAAO,UAAU,GACvC,MAAM,IAAI,MACR,4EACF;EACF,MAAM,OAAO,SAAS,CAAC;EACvB,MAAM,OAAO,UAAU,MAAM,MAAM;EACnC,MAAM,OAAO,MAAM,IAAI;CACzB,UAAU;EACR,MAAM,OAAO,MAAM;CACrB;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime.cjs");
|
|
2
|
-
let node_fs = require("node:fs");
|
|
3
|
-
let node_child_process = require("node:child_process");
|
|
4
2
|
let node_path = require("node:path");
|
|
5
3
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
let node_child_process = require("node:child_process");
|
|
6
6
|
let node_os = require("node:os");
|
|
7
7
|
//#region src/git-tracked-output.ts
|
|
8
8
|
/** Stream Git's file list to disk so consumer size cannot exhaust maxBuffer. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import path from "node:path";
|
|
1
2
|
import { closeSync, mkdtempSync, openSync, readFileSync, rmSync } from "node:fs";
|
|
2
3
|
import { execFileSync } from "node:child_process";
|
|
3
|
-
import path from "node:path";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
//#region src/git-tracked-output.ts
|
|
6
6
|
/** Stream Git's file list to disk so consumer size cannot exhaust maxBuffer. */
|
package/dist/jsonc.cjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
Object.defineProperty(exports, "parseJsonc", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function() {
|
|
62
|
+
return parseJsonc;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=jsonc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc.cjs","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"}
|
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"}
|