@stll/oxlint-config 1.8.0 → 2.0.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.
Files changed (63) hide show
  1. package/README.md +99 -67
  2. package/dist/cloud-setup-cli.cjs +5 -1
  3. package/dist/cloud-setup-cli.cjs.map +1 -1
  4. package/dist/cloud-setup-cli.mjs +6 -2
  5. package/dist/cloud-setup-cli.mjs.map +1 -1
  6. package/dist/dependabot.d.cts +0 -19
  7. package/dist/dependabot.d.mts +0 -19
  8. package/dist/git-tracked-output.cjs +1 -1
  9. package/dist/git-tracked-output.mjs +1 -1
  10. package/dist/publish-artifact-syntax.cjs +1 -1
  11. package/dist/publish-artifact-syntax.mjs +1 -1
  12. package/dist/publish-contract-cli.cjs +2 -2
  13. package/dist/publish-contract-cli.mjs +2 -2
  14. package/dist/quarantine-cli.cjs +3 -2
  15. package/dist/quarantine-cli.cjs.map +1 -1
  16. package/dist/quarantine-cli.mjs +3 -2
  17. package/dist/quarantine-cli.mjs.map +1 -1
  18. package/dist/quarantine-policy.d.cts +25 -2
  19. package/dist/quarantine-policy.d.mts +25 -2
  20. package/dist/quarantine-policy2.cjs +177 -5
  21. package/dist/quarantine-policy2.cjs.map +1 -1
  22. package/dist/quarantine-policy2.mjs +166 -6
  23. package/dist/quarantine-policy2.mjs.map +1 -1
  24. package/dist/toolchain-changed-cli.cjs +1477 -2
  25. package/dist/toolchain-changed-cli.cjs.map +1 -1
  26. package/dist/toolchain-changed-cli.mjs +1474 -1
  27. package/dist/toolchain-changed-cli.mjs.map +1 -1
  28. package/dist/toolchain-check-cli.cjs +2 -0
  29. package/dist/toolchain-check-cli.cjs.map +1 -1
  30. package/dist/toolchain-check-cli.mjs +2 -0
  31. package/dist/toolchain-check-cli.mjs.map +1 -1
  32. package/dist/toolchain-guard.cjs +355 -241
  33. package/dist/toolchain-guard.cjs.map +1 -1
  34. package/dist/toolchain-guard.mjs +352 -244
  35. package/dist/toolchain-guard.mjs.map +1 -1
  36. package/dist/toolchain-inputs.cjs +13 -40
  37. package/dist/toolchain-inputs.cjs.map +1 -1
  38. package/dist/toolchain-inputs.mjs +13 -40
  39. package/dist/toolchain-inputs.mjs.map +1 -1
  40. package/dist/toolchain-schema.cjs +69 -46
  41. package/dist/toolchain-schema.cjs.map +1 -1
  42. package/dist/toolchain-schema.mjs +69 -47
  43. package/dist/toolchain-schema.mjs.map +1 -1
  44. package/dist/typecheck-probe-cli.cjs +40 -2
  45. package/dist/typecheck-probe-cli.cjs.map +1 -1
  46. package/dist/typecheck-probe-cli.mjs +39 -1
  47. package/dist/typecheck-probe-cli.mjs.map +1 -1
  48. package/package.json +3 -4
  49. package/toolchain.json +2 -28
  50. package/dist/toolchain-changed.cjs +0 -1484
  51. package/dist/toolchain-changed.cjs.map +0 -1
  52. package/dist/toolchain-changed.mjs +0 -1477
  53. package/dist/toolchain-changed.mjs.map +0 -1
  54. package/dist/typecheck-parity-cli.cjs +0 -71
  55. package/dist/typecheck-parity-cli.cjs.map +0 -1
  56. package/dist/typecheck-parity-cli.d.cts +0 -1
  57. package/dist/typecheck-parity-cli.d.mts +0 -1
  58. package/dist/typecheck-parity-cli.mjs +0 -71
  59. package/dist/typecheck-parity-cli.mjs.map +0 -1
  60. package/dist/typecheck-parity.cjs +0 -907
  61. package/dist/typecheck-parity.cjs.map +0 -1
  62. package/dist/typecheck-parity.mjs +0 -896
  63. package/dist/typecheck-parity.mjs.map +0 -1
@@ -1,3 +1,25 @@
1
+ //#region src/dated-entry-scope.d.ts
2
+ /** A tracked file at the base revision: absent (`text: undefined`) or unreadable. */
3
+ type BaseFile = {
4
+ text: string | undefined;
5
+ } | {
6
+ unavailable: string;
7
+ };
8
+ /**
9
+ * Which overdue dated entries (quarantine excludes, Rust exceptions) fail. The
10
+ * clock alone never fails a change that leaves an entry untouched: `enforce`
11
+ * fails every overdue entry (default branch, schedule), `advisory` only warns
12
+ * (local runs), and `changed` fails entries absent or different at the base.
13
+ */
14
+ type ExpiryScope = {
15
+ kind: "enforce";
16
+ } | {
17
+ kind: "advisory";
18
+ } | {
19
+ kind: "changed";
20
+ readBase: (path: string) => BaseFile;
21
+ };
22
+ //#endregion
1
23
  //#region src/quarantine-policy-core.d.ts
2
24
  export declare const REQUIRED_RELEASE_AGE_SECONDS: number;
3
25
  export declare const NPM_REGISTRY = "https://registry.npmjs.org";
@@ -15,13 +37,14 @@ type RepositoryQuarantineOptions = {
15
37
  files: Record<string, string>;
16
38
  now?: Date | undefined;
17
39
  npmrcPresent?: boolean | undefined;
40
+ expiry?: ExpiryScope | undefined;
18
41
  };
19
- export declare const checkRepositoryQuarantine: ({ files, now, npmrcPresent }: RepositoryQuarantineOptions) => CheckResult;
42
+ export declare const checkRepositoryQuarantine: ({ files, now, npmrcPresent, expiry }: RepositoryQuarantineOptions) => CheckResult;
20
43
  export declare const synchronizeRepositoryQuarantine: ({ files, now }: RepositoryQuarantineOptions) => string;
21
44
  export declare const pruneRepositoryQuarantine: ({ files, now }: RepositoryQuarantineOptions) => {
22
45
  bunfig: string;
23
46
  pruned: string[];
24
47
  };
25
48
  //#endregion
26
- export {};
49
+ export type { ExpiryScope };
27
50
  //# sourceMappingURL=quarantine-policy.d.cts.map
@@ -1,3 +1,25 @@
1
+ //#region src/dated-entry-scope.d.ts
2
+ /** A tracked file at the base revision: absent (`text: undefined`) or unreadable. */
3
+ type BaseFile = {
4
+ text: string | undefined;
5
+ } | {
6
+ unavailable: string;
7
+ };
8
+ /**
9
+ * Which overdue dated entries (quarantine excludes, Rust exceptions) fail. The
10
+ * clock alone never fails a change that leaves an entry untouched: `enforce`
11
+ * fails every overdue entry (default branch, schedule), `advisory` only warns
12
+ * (local runs), and `changed` fails entries absent or different at the base.
13
+ */
14
+ type ExpiryScope = {
15
+ kind: "enforce";
16
+ } | {
17
+ kind: "advisory";
18
+ } | {
19
+ kind: "changed";
20
+ readBase: (path: string) => BaseFile;
21
+ };
22
+ //#endregion
1
23
  //#region src/quarantine-policy-core.d.ts
2
24
  export declare const REQUIRED_RELEASE_AGE_SECONDS: number;
3
25
  export declare const NPM_REGISTRY = "https://registry.npmjs.org";
@@ -15,13 +37,14 @@ type RepositoryQuarantineOptions = {
15
37
  files: Record<string, string>;
16
38
  now?: Date | undefined;
17
39
  npmrcPresent?: boolean | undefined;
40
+ expiry?: ExpiryScope | undefined;
18
41
  };
19
- export declare const checkRepositoryQuarantine: ({ files, now, npmrcPresent }: RepositoryQuarantineOptions) => CheckResult;
42
+ export declare const checkRepositoryQuarantine: ({ files, now, npmrcPresent, expiry }: RepositoryQuarantineOptions) => CheckResult;
20
43
  export declare const synchronizeRepositoryQuarantine: ({ files, now }: RepositoryQuarantineOptions) => string;
21
44
  export declare const pruneRepositoryQuarantine: ({ files, now }: RepositoryQuarantineOptions) => {
22
45
  bunfig: string;
23
46
  pruned: string[];
24
47
  };
25
48
  //#endregion
26
- export {};
49
+ export type { ExpiryScope };
27
50
  //# sourceMappingURL=quarantine-policy.d.mts.map
@@ -1,5 +1,154 @@
1
1
  const require_jsonc = require("./jsonc.cjs");
2
+ let node_child_process = require("node:child_process");
3
+ let node_fs = require("node:fs");
2
4
  let smol_toml = require("smol-toml");
5
+ //#region src/dated-entry-scope.ts
6
+ /**
7
+ * Decide one overdue entry. `unchangedAt` reports whether the base file text
8
+ * declares the same entry identically; a base that cannot prove that fails.
9
+ * The base is read only here, so runs without overdue entries never need it.
10
+ */
11
+ const overdueVerdict = (scope, path, unchangedAt) => {
12
+ if (scope.kind === "enforce") return { fail: true };
13
+ if (scope.kind === "advisory") return { fail: false };
14
+ const base = scope.readBase(path);
15
+ if ("unavailable" in base) return {
16
+ fail: true,
17
+ unavailable: base.unavailable
18
+ };
19
+ if (base.text === void 0) return { fail: true };
20
+ try {
21
+ return unchangedAt(base.text) ? { fail: false } : { fail: true };
22
+ } catch {
23
+ return { fail: true };
24
+ }
25
+ };
26
+ const scopedEvents = /* @__PURE__ */ new Set([
27
+ "pull_request",
28
+ "pull_request_target",
29
+ "merge_group"
30
+ ]);
31
+ const COMMIT = /^[0-9a-f]{40}(?:[0-9a-f]{24})?$/u;
32
+ const record$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
33
+ const eventBase = (event, eventPath) => {
34
+ if (eventPath === void 0 || eventPath === "") return void 0;
35
+ const payload = JSON.parse((0, node_fs.readFileSync)(eventPath, "utf8"));
36
+ if (!record$1(payload)) return void 0;
37
+ let sha;
38
+ if (event === "merge_group") {
39
+ const group = payload["merge_group"];
40
+ sha = record$1(group) ? group["base_sha"] : void 0;
41
+ } else {
42
+ const pullRequest = payload["pull_request"];
43
+ const base = record$1(pullRequest) ? pullRequest["base"] : void 0;
44
+ sha = record$1(base) ? base["sha"] : void 0;
45
+ }
46
+ return typeof sha === "string" && COMMIT.test(sha) ? sha : void 0;
47
+ };
48
+ /**
49
+ * Derive the expiry scope from the run context. Pushes, schedules, dispatches,
50
+ * other GitHub events and non-GitHub CI enforce; pull requests and merge groups
51
+ * compare with the event's base commit, fetching only that commit when a
52
+ * shallow checkout lacks it; local runs are advisory.
53
+ */
54
+ const resolveExpiryScope = (root, env = process.env) => {
55
+ if (env["GITHUB_ACTIONS"] !== "true") {
56
+ const ci = env["CI"];
57
+ return ci === void 0 || ci === "" || ci === "false" || ci === "0" ? { kind: "advisory" } : { kind: "enforce" };
58
+ }
59
+ const event = env["GITHUB_EVENT_NAME"];
60
+ if (event === void 0 || !scopedEvents.has(event)) return { kind: "enforce" };
61
+ let sha;
62
+ try {
63
+ sha = eventBase(event, env["GITHUB_EVENT_PATH"]);
64
+ } catch {
65
+ sha = void 0;
66
+ }
67
+ if (sha === void 0) {
68
+ const unavailable = `the ${event} event payload (GITHUB_EVENT_PATH) has no readable base commit`;
69
+ return {
70
+ kind: "changed",
71
+ readBase: () => ({ unavailable })
72
+ };
73
+ }
74
+ const base = sha;
75
+ const git = (args) => (0, node_child_process.execFileSync)("git", args, {
76
+ cwd: root,
77
+ encoding: "utf8",
78
+ env: {
79
+ ...env,
80
+ GIT_TERMINAL_PROMPT: "0"
81
+ },
82
+ stdio: [
83
+ "ignore",
84
+ "pipe",
85
+ "ignore"
86
+ ],
87
+ maxBuffer: 16777216,
88
+ timeout: 12e4
89
+ });
90
+ const succeeds = (args) => {
91
+ try {
92
+ git(args);
93
+ return true;
94
+ } catch {
95
+ return false;
96
+ }
97
+ };
98
+ const hasCommit = () => succeeds([
99
+ "cat-file",
100
+ "-e",
101
+ `${base}^{commit}`
102
+ ]);
103
+ let commitProblem;
104
+ const ensureCommit = () => {
105
+ if (commitProblem !== void 0) return commitProblem;
106
+ if (hasCommit()) return commitProblem = null;
107
+ let remotes;
108
+ try {
109
+ remotes = git(["remote"]).split("\n").filter(Boolean);
110
+ } catch {
111
+ remotes = [];
112
+ }
113
+ let remote;
114
+ if (remotes.includes("origin")) remote = "origin";
115
+ else if (remotes.length === 1) remote = remotes.at(0);
116
+ if (remote === void 0) return commitProblem = `base commit ${base} is not in the clone and no single checkout remote can fetch it; check out with actions/checkout`;
117
+ succeeds([
118
+ "fetch",
119
+ "--no-tags",
120
+ "--depth=1",
121
+ remote,
122
+ base
123
+ ]);
124
+ commitProblem = hasCommit() ? null : `base commit ${base} is not in the clone and "git fetch --no-tags --depth=1 ${remote} ${base}" failed; keep the actions/checkout credentials (persist-credentials: true) or check out with fetch-depth: 0`;
125
+ return commitProblem;
126
+ };
127
+ const files = /* @__PURE__ */ new Map();
128
+ const read = (path) => {
129
+ const problem = ensureCommit();
130
+ if (problem !== null) return { unavailable: problem };
131
+ if (!succeeds([
132
+ "cat-file",
133
+ "-e",
134
+ `${base}:./${path}`
135
+ ])) return { text: void 0 };
136
+ try {
137
+ return { text: git(["show", `${base}:./${path}`]) };
138
+ } catch {
139
+ return { unavailable: `cannot read ${path} at base commit ${base}` };
140
+ }
141
+ };
142
+ return {
143
+ kind: "changed",
144
+ readBase: (path) => {
145
+ const cached = files.get(path) ?? read(path);
146
+ files.set(path, cached);
147
+ return cached;
148
+ }
149
+ };
150
+ };
151
+ //#endregion
3
152
  //#region src/quarantine-policy-core.ts
4
153
  const REQUIRED_RELEASE_AGE_SECONDS = 432e3;
5
154
  const NPM_REGISTRY = "https://registry.npmjs.org";
@@ -182,7 +331,12 @@ const validNow = (now) => {
182
331
  if (!Number.isFinite(now.getTime())) return fail("Quarantine policy requires a valid current date");
183
332
  return now.getTime();
184
333
  };
185
- const checkQuarantinePolicy = ({ bunfig, lockfile, parseToml, npmrcPresent = false, now = /* @__PURE__ */ new Date(), firstPartyPackages }) => {
334
+ /** Whether the base bunfig declares this temporary exclude with the same expiry. */
335
+ const declaresTemporary = (baseBunfig, parseToml, name, timestamp) => readSourceArray(baseBunfig, parseToml).entries.some((entry) => {
336
+ const annotation = annotationOf(entry);
337
+ return entry.name === name && annotation.type === "expires" && annotation.timestamp === timestamp;
338
+ });
339
+ const checkQuarantinePolicy = ({ bunfig, lockfile, parseToml, npmrcPresent = false, now = /* @__PURE__ */ new Date(), firstPartyPackages, expiry = { kind: "enforce" } }) => {
186
340
  const errors = [];
187
341
  const warnings = [];
188
342
  try {
@@ -210,8 +364,13 @@ const checkQuarantinePolicy = ({ bunfig, lockfile, parseToml, npmrcPresent = fal
210
364
  errors.push(`bunfig.toml third-party quarantine exclude "${entry.name}" must use quarantine-expires:`);
211
365
  continue;
212
366
  }
213
- if (nowMs >= timestampMs + 24 * HOUR_MS) errors.push(`bunfig.toml temporary quarantine exclude "${entry.name}" expired at ${annotation.timestamp} and is still present`);
214
- else if (nowMs >= timestampMs) warnings.push(`bunfig.toml temporary quarantine exclude "${entry.name}" expired at ${annotation.timestamp}; its removal PR should be merged`);
367
+ if (nowMs >= timestampMs + 24 * HOUR_MS) {
368
+ const overdue = `bunfig.toml temporary quarantine exclude "${entry.name}" expired at ${annotation.timestamp} and is still present`;
369
+ const verdict = overdueVerdict(expiry, "bunfig.toml", (base) => declaresTemporary(base, parseToml, entry.name, annotation.timestamp));
370
+ if (!verdict.fail) warnings.push(`${overdue}; merge its removal PR (default-branch and scheduled runs fail, as do changes that add or edit it)`);
371
+ else if (verdict.unavailable === void 0) errors.push(overdue);
372
+ else errors.push(`${overdue}; cannot tell whether this change adds it: ${verdict.unavailable}`);
373
+ } else if (nowMs >= timestampMs) warnings.push(`bunfig.toml temporary quarantine exclude "${entry.name}" expired at ${annotation.timestamp}; its removal PR should be merged`);
215
374
  else if (nowMs >= timestampMs - 48 * HOUR_MS) warnings.push(`bunfig.toml temporary quarantine exclude "${entry.name}" expires at ${annotation.timestamp}; prepare its removal PR`);
216
375
  }
217
376
  const required = readRegistryFirstPartyPackages(lockfile);
@@ -324,13 +483,14 @@ const declaredFirstPartyPackages = (files) => {
324
483
  }
325
484
  return names;
326
485
  };
327
- const checkRepositoryQuarantine = ({ files, now, npmrcPresent }) => checkQuarantinePolicy({
486
+ const checkRepositoryQuarantine = ({ files, now, npmrcPresent, expiry }) => checkQuarantinePolicy({
328
487
  bunfig: files["bunfig.toml"] ?? "",
329
488
  lockfile: files["bun.lock"],
330
489
  firstPartyPackages: declaredFirstPartyPackages(files),
331
490
  parseToml: smol_toml.parse,
332
491
  ...now === void 0 ? {} : { now },
333
- ...npmrcPresent === void 0 ? {} : { npmrcPresent }
492
+ ...npmrcPresent === void 0 ? {} : { npmrcPresent },
493
+ ...expiry === void 0 ? {} : { expiry }
334
494
  });
335
495
  const synchronizeRepositoryQuarantine = ({ files, now }) => {
336
496
  const firstPartyPackages = /* @__PURE__ */ new Set([...declaredFirstPartyPackages(files), ...readRegistryFirstPartyPackages(files["bun.lock"])]);
@@ -383,12 +543,24 @@ Object.defineProperty(exports, "exactTimestamp", {
383
543
  return exactTimestamp;
384
544
  }
385
545
  });
546
+ Object.defineProperty(exports, "overdueVerdict", {
547
+ enumerable: true,
548
+ get: function() {
549
+ return overdueVerdict;
550
+ }
551
+ });
386
552
  Object.defineProperty(exports, "pruneRepositoryQuarantine", {
387
553
  enumerable: true,
388
554
  get: function() {
389
555
  return pruneRepositoryQuarantine;
390
556
  }
391
557
  });
558
+ Object.defineProperty(exports, "resolveExpiryScope", {
559
+ enumerable: true,
560
+ get: function() {
561
+ return resolveExpiryScope;
562
+ }
563
+ });
392
564
  Object.defineProperty(exports, "synchronizeRepositoryQuarantine", {
393
565
  enumerable: true,
394
566
  get: function() {
@@ -1 +1 @@
1
- {"version":3,"file":"quarantine-policy2.cjs","names":["parseJsonc","parse"],"sources":["../src/quarantine-policy-core.ts","../src/quarantine-policy.ts"],"sourcesContent":["import { parseJsonc } from \"./jsonc\";\n\nexport const REQUIRED_RELEASE_AGE_SECONDS = 5 * 24 * 60 * 60;\nexport const NPM_REGISTRY = \"https://registry.npmjs.org\";\nexport const EXACT_UTC_TIMESTAMP =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$/u;\nconst HOUR_MS = 60 * 60 * 1000;\nconst EXACT_PACKAGE = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u;\nconst REGISTRY_VERSION =\n /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/u;\n\ntype ParseToml = (text: string) => unknown;\ntype FirstPartyPackages = ReadonlySet<string> | readonly string[];\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst fail: (message: string) => never = (message) => {\n throw new Error(message);\n};\nconst ownPackage = (name: string) => name.startsWith(\"@stll/\");\nconst exactPackage = (name: string) =>\n name.length <= 214 && EXACT_PACKAGE.test(name);\nexport const isFirstPartyPackageName = (name: string): boolean =>\n exactPackage(name) && ownPackage(name);\n\nexport const exactTimestamp = (value: string): boolean => {\n const timestamp = Date.parse(value);\n return (\n EXACT_UTC_TIMESTAMP.test(value) &&\n !Number.isNaN(timestamp) &&\n new Date(timestamp).toISOString() === value\n );\n};\n\nexport const readParsedExcludes = (\n bunfig: string,\n parseToml: ParseToml,\n): string[] => {\n const parsed = parseToml(bunfig);\n if (!isRecord(parsed) || !isRecord(parsed[\"install\"]))\n return fail(\"bunfig.toml must contain an [install] table\");\n const install = parsed[\"install\"];\n if (\n (\"registry\" in install && install[\"registry\"] !== NPM_REGISTRY) ||\n (\"scopes\" in install &&\n (!isRecord(install[\"scopes\"]) ||\n Object.keys(install[\"scopes\"]).length > 0))\n )\n fail(\"bunfig.toml quarantine policy requires the canonical npm registry\");\n if (install[\"minimumReleaseAge\"] !== REQUIRED_RELEASE_AGE_SECONDS)\n fail(\n `bunfig.toml must set minimumReleaseAge = ${REQUIRED_RELEASE_AGE_SECONDS}`,\n );\n if (!Array.isArray(install[\"minimumReleaseAgeExcludes\"]))\n return fail(\n \"bunfig.toml must declare minimumReleaseAgeExcludes as an array\",\n );\n const names: string[] = [];\n for (const value of install[\"minimumReleaseAgeExcludes\"]) {\n if (typeof value !== \"string\" || !exactPackage(value))\n return fail(\n \"bunfig.toml minimumReleaseAgeExcludes must contain only exact npm package names\",\n );\n names.push(value);\n }\n if (new Set(names).size !== names.length)\n fail(\"bunfig.toml minimumReleaseAgeExcludes must not contain duplicates\");\n return names;\n};\n\ntype Token = {\n type: \"string\" | \"atom\" | \"punctuation\" | \"comment\" | \"newline\";\n start: number;\n end: number;\n text: string;\n};\n// Tokenize before locating declarations: text in comments, multiline strings and\n// unrelated tables cannot masquerade as the install policy's source array.\nconst tokensOf = (text: string): Token[] => {\n const tokens: Token[] = [];\n let index = 0;\n while (index < text.length) {\n const start = index;\n const character = text.charAt(index++);\n if (character === \"\\n\") {\n tokens.push({ type: \"newline\", start, end: index, text: character });\n continue;\n }\n if (/\\s/u.test(character)) continue;\n let type: Token[\"type\"];\n if (character === \"#\") {\n type = \"comment\";\n while (index < text.length && text.charAt(index) !== \"\\n\") index++;\n } else if (character === '\"' || character === \"'\") {\n type = \"string\";\n const triple = text.slice(start, start + 3) === character.repeat(3);\n if (triple) index = start + 3;\n while (index < text.length) {\n const current = text.charAt(index++);\n if (character === '\"' && current === \"\\\\\") {\n index++;\n continue;\n }\n if (current !== character) continue;\n if (!triple) break;\n if (text.slice(index - 1, index + 2) !== character.repeat(3)) continue;\n index += 2;\n while (text.charAt(index) === character) index++;\n break;\n }\n } else if (\"[]=.,{}\".includes(character)) type = \"punctuation\";\n else {\n type = \"atom\";\n while (\n index < text.length &&\n !/[\\s#[\\]=.,{}\"']/u.test(text.charAt(index))\n )\n index++;\n }\n tokens.push({\n type,\n start,\n end: index,\n text:\n type === \"comment\"\n ? text.slice(start, index).replace(/\\r$/u, \"\")\n : text.slice(start, index),\n });\n }\n return tokens;\n};\n\nconst stringValue = (token: Token, parseToml: ParseToml): string => {\n const parsed = parseToml(`value = ${token.text}`);\n if (!isRecord(parsed) || typeof parsed[\"value\"] !== \"string\")\n return fail(\"bunfig.toml has an unsupported quarantine string\");\n return parsed[\"value\"];\n};\nconst keyParts = (tokens: readonly Token[], parseToml: ParseToml): string[] =>\n tokens\n .filter(({ text }) => text !== \".\")\n .map((token) =>\n token.type === \"string\" ? stringValue(token, parseToml) : token.text,\n );\n\ntype Entry = {\n name: string;\n token: Token;\n comment: Token | undefined;\n comma: Token | undefined;\n};\ntype SourceArray = {\n open: Token;\n close: Token;\n entries: Entry[];\n comments: Token[];\n};\nconst readSourceArray = (bunfig: string, parseToml: ParseToml): SourceArray => {\n const names = readParsedExcludes(bunfig, parseToml);\n let table: string[] = [];\n let statement: Token[] = [];\n let depth = 0;\n let found: SourceArray | undefined;\n const visitStatement = () => {\n const meaningful = statement.filter(\n ({ type }) => type !== \"comment\" && type !== \"newline\",\n );\n const first = meaningful.at(0);\n if (first?.text === \"[\") {\n const end = meaningful.at(-1);\n if (end?.text === \"]\")\n table = keyParts(meaningful.slice(1, -1), parseToml);\n return;\n }\n const equals = meaningful.findIndex(({ text }) => text === \"=\");\n if (equals < 0) return;\n const key = [...table, ...keyParts(meaningful.slice(0, equals), parseToml)];\n if (\n key.join(\".\") !== \"install.minimumReleaseAgeExcludes\" ||\n key.length !== 2\n )\n return;\n const open = meaningful.at(equals + 1);\n const close = meaningful.at(-1);\n if (\n open === undefined ||\n close === undefined ||\n open.text !== \"[\" ||\n close.text !== \"]\" ||\n found !== undefined\n )\n fail(\n \"bunfig.toml must declare a single install minimumReleaseAgeExcludes array\",\n );\n const values = meaningful.slice(equals + 2, -1);\n if (values.some(({ type, text }) => type !== \"string\" && text !== \",\"))\n fail(\"bunfig.toml quarantine array must contain package strings\");\n const strings = values.filter(({ type }) => type === \"string\");\n const comments = statement.filter(({ type }) => type === \"comment\");\n const entries = strings.map((token, index) => {\n const next = strings.at(index + 1)?.start ?? Number.POSITIVE_INFINITY;\n const comment = comments.find(\n (candidate) =>\n candidate.start >= token.end &&\n candidate.start < next &&\n !bunfig.slice(token.end, candidate.start).includes(\"\\n\"),\n );\n const following = values.find(\n (candidate) => candidate.start >= token.end,\n );\n return {\n name: stringValue(token, parseToml),\n token,\n comment,\n comma: following?.text === \",\" ? following : undefined,\n };\n });\n if (\n entries.length !== names.length ||\n entries.some(({ name }, index) => name !== names.at(index))\n )\n fail(\n \"bunfig.toml quarantine source does not match its parsed install array\",\n );\n found = { open, close, entries, comments };\n };\n for (const token of tokensOf(bunfig)) {\n if (token.type === \"newline\" && depth === 0) {\n visitStatement();\n statement = [];\n continue;\n }\n statement.push(token);\n if (token.type !== \"punctuation\") continue;\n if (token.text === \"[\" || token.text === \"{\") depth++;\n if (token.text === \"]\" || token.text === \"}\") depth--;\n }\n visitStatement();\n if (found === undefined)\n return fail(\n \"bunfig.toml must declare an explicit [install] minimumReleaseAgeExcludes array\",\n );\n return found;\n};\n\ntype Annotation =\n | { type: \"none\" }\n | { type: \"invalid\" }\n | { type: \"expires\" | \"excluded-since\"; timestamp: string };\nconst annotationOf = ({ comment }: Entry): Annotation => {\n if (comment === undefined) return { type: \"none\" };\n const match = /^#\\s*quarantine-(expires|excluded-since):\\s*(\\S+)\\s*$/u.exec(\n comment.text,\n );\n const marker = match?.at(1);\n const timestamp = match?.at(2);\n if (\n (marker === \"expires\" || marker === \"excluded-since\") &&\n timestamp !== undefined\n )\n return { type: marker, timestamp };\n return { type: \"invalid\" };\n};\n\nexport const readRegistryFirstPartyPackages = (\n lockfile: string | undefined,\n): Set<string> => {\n if (lockfile === undefined) return new Set();\n const parsed = parseJsonc(lockfile);\n if (!isRecord(parsed) || !isRecord(parsed[\"packages\"]))\n return fail(\"bun.lock must contain a packages mapping\");\n const names = new Set<string>();\n for (const value of Object.values(parsed[\"packages\"])) {\n if (!Array.isArray(value)) continue;\n const identity: unknown = value.at(0);\n if (typeof identity !== \"string\") continue;\n const separator = identity.lastIndexOf(\"@\");\n const name = identity.slice(0, separator);\n if (\n exactPackage(name) &&\n ownPackage(name) &&\n REGISTRY_VERSION.test(identity.slice(separator + 1))\n )\n names.add(name);\n }\n return names;\n};\n\nconst ownNames = (names: FirstPartyPackages): Set<string> => {\n const result = new Set(names);\n for (const name of result)\n if (!exactPackage(name) || !ownPackage(name))\n fail(`Expected an exact first-party npm package name: ${name}`);\n return result;\n};\nconst validNow = (now: Date): number => {\n if (!Number.isFinite(now.getTime()))\n return fail(\"Quarantine policy requires a valid current date\");\n return now.getTime();\n};\nexport type CheckResult = { errors: string[]; warnings: string[] };\ntype CheckOptions = {\n bunfig: string;\n lockfile: string | undefined;\n parseToml: ParseToml;\n npmrcPresent?: boolean;\n now?: Date;\n firstPartyPackages?: FirstPartyPackages;\n};\nexport const checkQuarantinePolicy = ({\n bunfig,\n lockfile,\n parseToml,\n npmrcPresent = false,\n now = new Date(),\n firstPartyPackages,\n}: CheckOptions): CheckResult => {\n const errors: string[] = [];\n const warnings: string[] = [];\n try {\n const nowMs = validNow(now);\n const { entries } = readSourceArray(bunfig, parseToml);\n if (npmrcPresent)\n errors.push(\n \"bunfig.toml quarantine policy does not allow a repository .npmrc\",\n );\n for (const entry of entries) {\n const annotation = annotationOf(entry);\n if (ownPackage(entry.name) && annotation.type === \"none\") continue;\n if (annotation.type === \"none\" || annotation.type === \"invalid\") {\n errors.push(\n `bunfig.toml has an unannotated or malformed quarantine exclude: ${entry.name}`,\n );\n continue;\n }\n if (!exactTimestamp(annotation.timestamp)) {\n errors.push(\n `bunfig.toml quarantine exclude \"${entry.name}\" has an invalid UTC timestamp: ${annotation.timestamp}`,\n );\n continue;\n }\n const timestampMs = Date.parse(annotation.timestamp);\n if (ownPackage(entry.name)) {\n if (annotation.type !== \"excluded-since\")\n errors.push(\n `bunfig.toml first-party quarantine exclude \"${entry.name}\" must be permanent (quarantine-excluded-since: or no timestamp)`,\n );\n else if (timestampMs > nowMs)\n errors.push(\n `bunfig.toml first-party quarantine exclude \"${entry.name}\" has a future exclusion date`,\n );\n continue;\n }\n if (annotation.type !== \"expires\") {\n errors.push(\n `bunfig.toml third-party quarantine exclude \"${entry.name}\" must use quarantine-expires:`,\n );\n continue;\n }\n if (nowMs >= timestampMs + 24 * HOUR_MS)\n errors.push(\n `bunfig.toml temporary quarantine exclude \"${entry.name}\" expired at ${annotation.timestamp} and is still present`,\n );\n else if (nowMs >= timestampMs)\n warnings.push(\n `bunfig.toml temporary quarantine exclude \"${entry.name}\" expired at ${annotation.timestamp}; its removal PR should be merged`,\n );\n else if (nowMs >= timestampMs - 48 * HOUR_MS)\n warnings.push(\n `bunfig.toml temporary quarantine exclude \"${entry.name}\" expires at ${annotation.timestamp}; prepare its removal PR`,\n );\n }\n const required = readRegistryFirstPartyPackages(lockfile);\n if (firstPartyPackages !== undefined) {\n for (const name of ownNames(firstPartyPackages)) required.add(name);\n }\n const declared = new Set(entries.map(({ name }) => name));\n const missing = [...required].filter((name) => !declared.has(name)).sort();\n if (missing.length > 0)\n errors.push(\n `bunfig.toml is missing registry-backed first-party quarantine excludes: ${missing.join(\", \")}`,\n );\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n }\n return { errors, warnings };\n};\n\ntype PruneOptions = { bunfig: string; parseToml: ParseToml; now?: Date };\nexport const pruneExpiredExcludes = ({\n bunfig,\n parseToml,\n now = new Date(),\n}: PruneOptions): { bunfig: string; pruned: string[] } => {\n const nowMs = validNow(now);\n const { entries, close } = readSourceArray(bunfig, parseToml);\n const removals: { start: number; end: number }[] = [];\n const pruned: string[] = [];\n for (const entry of entries) {\n if (ownPackage(entry.name)) continue;\n const annotation = annotationOf(entry);\n if (annotation.type !== \"expires\" || !exactTimestamp(annotation.timestamp))\n return fail(\n `bunfig.toml third-party quarantine exclude \"${entry.name}\" must have an exact UTC quarantine-expires: annotation`,\n );\n if (nowMs < Date.parse(annotation.timestamp)) continue;\n const lineStart = bunfig.lastIndexOf(\"\\n\", entry.token.start - 1) + 1;\n const nextNewline = bunfig.indexOf(\"\\n\", entry.token.end);\n const lineEnd = nextNewline < 0 ? bunfig.length : nextNewline;\n const commentInside =\n entry.comment !== undefined && entry.comment.start < close.start;\n const end = commentInside\n ? (entry.comment?.end ?? entry.token.end)\n : (entry.comma?.end ?? entry.token.end);\n if (\n bunfig.slice(lineStart, entry.token.start).trim() === \"\" &&\n bunfig.slice(end, lineEnd).trim() === \"\"\n )\n removals.push({\n start: lineStart,\n end: nextNewline < 0 ? lineEnd : lineEnd + 1,\n });\n else removals.push({ start: entry.token.start, end });\n if (entry.comment !== undefined && !commentInside)\n removals.push({ start: entry.comment.start, end: entry.comment.end });\n pruned.push(entry.name);\n }\n let result = bunfig;\n for (const removal of removals.toReversed())\n result = result.slice(0, removal.start) + result.slice(removal.end);\n // Never return edited TOML without confirming the resulting source is valid.\n readSourceArray(result, parseToml);\n return { bunfig: result, pruned };\n};\n\ntype SynchronizeOptions = {\n bunfig: string;\n firstPartyPackages: FirstPartyPackages;\n parseToml: ParseToml;\n now?: Date;\n};\nexport const synchronizeFirstPartyExcludes = ({\n bunfig,\n firstPartyPackages,\n parseToml,\n now = new Date(),\n}: SynchronizeOptions): string => {\n validNow(now);\n const required = ownNames(firstPartyPackages);\n const { open, close, entries, comments } = readSourceArray(bunfig, parseToml);\n const attachedComments = new Set(\n entries.flatMap(({ comment }) => (comment === undefined ? [] : [comment])),\n );\n const lines = comments\n .filter((comment) => !attachedComments.has(comment))\n .map(({ text }) => ` ${text}`);\n const seen = new Set<string>();\n for (const entry of entries) {\n if (!ownPackage(entry.name)) {\n const annotation = annotationOf(entry);\n if (\n annotation.type !== \"expires\" ||\n !exactTimestamp(annotation.timestamp)\n )\n return fail(\n `bunfig.toml third-party quarantine exclude \"${entry.name}\" must have an exact UTC quarantine-expires: annotation`,\n );\n lines.push(\n ` ${entry.token.text},${entry.comment === undefined ? \"\" : ` ${entry.comment.text}`}`,\n );\n continue;\n }\n if (!required.has(entry.name)) continue;\n seen.add(entry.name);\n const annotation = annotationOf(entry);\n const timestamp =\n annotation.type === \"excluded-since\" &&\n exactTimestamp(annotation.timestamp)\n ? annotation.timestamp\n : now.toISOString();\n lines.push(\n ` ${JSON.stringify(entry.name)}, # quarantine-excluded-since: ${timestamp}`,\n );\n }\n for (const name of [...required]\n .filter((requiredPackage) => !seen.has(requiredPackage))\n .sort())\n lines.push(\n ` ${JSON.stringify(name)}, # quarantine-excluded-since: ${now.toISOString()}`,\n );\n const newline = bunfig.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const trailingComment = entries.at(-1)?.comment;\n const end =\n trailingComment !== undefined && trailingComment.start > close.end\n ? trailingComment.end\n : close.end;\n const result =\n bunfig.slice(0, open.start) +\n `[${newline}${lines.join(newline)}${lines.length === 0 ? \"\" : newline}]` +\n bunfig.slice(end);\n readSourceArray(result, parseToml);\n return result;\n};\n","import { parse } from \"smol-toml\";\n\nimport {\n checkQuarantinePolicy,\n isFirstPartyPackageName,\n pruneExpiredExcludes,\n readRegistryFirstPartyPackages,\n REQUIRED_RELEASE_AGE_SECONDS,\n synchronizeFirstPartyExcludes,\n} from \"./quarantine-policy-core\";\n\nexport {\n EXACT_UTC_TIMESTAMP,\n NPM_REGISTRY,\n REQUIRED_RELEASE_AGE_SECONDS,\n exactTimestamp,\n} from \"./quarantine-policy-core\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** Derive exact registry identities before install, including catalog references. */\nexport const declaredFirstPartyPackages = (files: Record<string, string>) => {\n const names = new Set<string>();\n for (const [file, text] of Object.entries(files)) {\n if (!/(?:^|\\/)package\\.json$/.test(file)) continue;\n const manifest: unknown = JSON.parse(text);\n if (!record(manifest)) throw new Error(`${file} must contain an object`);\n for (const field of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n ]) {\n const dependencies = manifest[field];\n if (!record(dependencies)) continue;\n for (const [name, specifier] of Object.entries(dependencies)) {\n if (typeof specifier !== \"string\") continue;\n if (\n /^(?:workspace:|file:|link:|git(?:\\+|:)|https?:|github:|\\.\\.?\\/|\\/)/.test(\n specifier,\n )\n )\n continue;\n if (specifier.startsWith(\"npm:\")) {\n const alias = /^npm:(@[^/]+\\/[^@]+|[^@]+)@/.exec(specifier)?.at(1);\n if (alias !== undefined && isFirstPartyPackageName(alias))\n names.add(alias);\n continue;\n }\n if (isFirstPartyPackageName(name)) names.add(name);\n }\n }\n }\n return names;\n};\n\ntype RepositoryQuarantineOptions = {\n files: Record<string, string>;\n now?: Date | undefined;\n npmrcPresent?: boolean | undefined;\n};\n\nexport const checkRepositoryQuarantine = ({\n files,\n now,\n npmrcPresent,\n}: RepositoryQuarantineOptions) =>\n checkQuarantinePolicy({\n bunfig: files[\"bunfig.toml\"] ?? \"\",\n lockfile: files[\"bun.lock\"],\n firstPartyPackages: declaredFirstPartyPackages(files),\n parseToml: parse,\n ...(now === undefined ? {} : { now }),\n ...(npmrcPresent === undefined ? {} : { npmrcPresent }),\n });\n\nexport const synchronizeRepositoryQuarantine = ({\n files,\n now,\n}: RepositoryQuarantineOptions) => {\n const firstPartyPackages = new Set([\n ...declaredFirstPartyPackages(files),\n ...readRegistryFirstPartyPackages(files[\"bun.lock\"]),\n ]);\n return synchronizeFirstPartyExcludes({\n bunfig:\n files[\"bunfig.toml\"] ??\n `[install]\\nminimumReleaseAge = ${REQUIRED_RELEASE_AGE_SECONDS}\\nminimumReleaseAgeExcludes = []\\n`,\n firstPartyPackages,\n parseToml: parse,\n ...(now === undefined ? {} : { now }),\n });\n};\n\nexport const pruneRepositoryQuarantine = ({\n files,\n now,\n}: RepositoryQuarantineOptions) =>\n pruneExpiredExcludes({\n bunfig: files[\"bunfig.toml\"] ?? \"\",\n parseToml: parse,\n ...(now === undefined ? {} : { now }),\n });\n"],"mappings":";;;AAEA,MAAa,+BAA+B;AAC5C,MAAa,eAAe;AAC5B,MAAa,sBACX;AACF,MAAM,UAAU;AAChB,MAAM,gBAAgB;AACtB,MAAM,mBACJ;AAIF,MAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AACrE,MAAM,QAAoC,YAAY;CACpD,MAAM,IAAI,MAAM,OAAO;AACzB;AACA,MAAM,cAAc,SAAiB,KAAK,WAAW,QAAQ;AAC7D,MAAM,gBAAgB,SACpB,KAAK,UAAU,OAAO,cAAc,KAAK,IAAI;AAC/C,MAAa,2BAA2B,SACtC,aAAa,IAAI,KAAK,WAAW,IAAI;AAEvC,MAAa,kBAAkB,UAA2B;CACxD,MAAM,YAAY,KAAK,MAAM,KAAK;CAClC,OACE,oBAAoB,KAAK,KAAK,KAC9B,CAAC,OAAO,MAAM,SAAS,KACvB,IAAI,KAAK,SAAS,CAAC,CAAC,YAAY,MAAM;AAE1C;AAEA,MAAa,sBACX,QACA,cACa;CACb,MAAM,SAAS,UAAU,MAAM;CAC/B,IAAI,CAAC,SAAS,MAAM,KAAK,CAAC,SAAS,OAAO,UAAU,GAClD,OAAO,KAAK,6CAA6C;CAC3D,MAAM,UAAU,OAAO;CACvB,IACG,cAAc,WAAW,QAAQ,gBAAA,gCACjC,YAAY,YACV,CAAC,SAAS,QAAQ,SAAS,KAC1B,OAAO,KAAK,QAAQ,SAAS,CAAC,CAAC,SAAS,IAE5C,KAAK,mEAAmE;CAC1E,IAAI,QAAQ,yBAAA,OACV,KACE,4CAA4C,8BAC9C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WAAW,CACrD,CAAC;CACD,OAAO,8BAA8B;EACnC,QACE,MAAM,kBACN;EACF;EACA,WAAWA,UAAAA;EACX,GAAI,QAAQ,KAAA,IAAY,CAAC,IAAI,EAAE,IAAI;CACrC,CAAC;AACH;AAEA,MAAa,6BAA6B,EACxC,OACA,UAEA,qBAAqB;CACnB,QAAQ,MAAM,kBAAkB;CAChC,WAAWA,UAAAA;CACX,GAAI,QAAQ,KAAA,IAAY,CAAC,IAAI,EAAE,IAAI;AACrC,CAAC"}
1
+ {"version":3,"file":"quarantine-policy2.cjs","names":["record","readFileSync","execFileSync","parseJsonc","parse"],"sources":["../src/dated-entry-scope.ts","../src/quarantine-policy-core.ts","../src/quarantine-policy.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\n\n/** A tracked file at the base revision: absent (`text: undefined`) or unreadable. */\nexport type BaseFile = { text: string | undefined } | { unavailable: string };\n\n/**\n * Which overdue dated entries (quarantine excludes, Rust exceptions) fail. The\n * clock alone never fails a change that leaves an entry untouched: `enforce`\n * fails every overdue entry (default branch, schedule), `advisory` only warns\n * (local runs), and `changed` fails entries absent or different at the base.\n */\nexport type ExpiryScope =\n | { kind: \"enforce\" }\n | { kind: \"advisory\" }\n | { kind: \"changed\"; readBase: (path: string) => BaseFile };\n\nexport type OverdueVerdict =\n { fail: false } | { fail: true; unavailable?: string };\n\n/**\n * Decide one overdue entry. `unchangedAt` reports whether the base file text\n * declares the same entry identically; a base that cannot prove that fails.\n * The base is read only here, so runs without overdue entries never need it.\n */\nexport const overdueVerdict = (\n scope: ExpiryScope,\n path: string,\n unchangedAt: (baseText: string) => boolean,\n): OverdueVerdict => {\n if (scope.kind === \"enforce\") return { fail: true };\n if (scope.kind === \"advisory\") return { fail: false };\n const base = scope.readBase(path);\n if (\"unavailable\" in base)\n return { fail: true, unavailable: base.unavailable };\n if (base.text === undefined) return { fail: true };\n try {\n return unchangedAt(base.text) ? { fail: false } : { fail: true };\n } catch {\n return { fail: true };\n }\n};\n\ntype Environment = Readonly<Record<string, string | undefined>>;\n\nconst scopedEvents = new Set([\n \"pull_request\",\n \"pull_request_target\",\n \"merge_group\",\n]);\nconst COMMIT = /^[0-9a-f]{40}(?:[0-9a-f]{24})?$/u;\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst eventBase = (event: string, eventPath: string | undefined) => {\n if (eventPath === undefined || eventPath === \"\") return undefined;\n const payload: unknown = JSON.parse(readFileSync(eventPath, \"utf8\"));\n if (!record(payload)) return undefined;\n let sha: unknown;\n if (event === \"merge_group\") {\n const group = payload[\"merge_group\"];\n sha = record(group) ? group[\"base_sha\"] : undefined;\n } else {\n const pullRequest = payload[\"pull_request\"];\n const base = record(pullRequest) ? pullRequest[\"base\"] : undefined;\n sha = record(base) ? base[\"sha\"] : undefined;\n }\n return typeof sha === \"string\" && COMMIT.test(sha) ? sha : undefined;\n};\n\n/**\n * Derive the expiry scope from the run context. Pushes, schedules, dispatches,\n * other GitHub events and non-GitHub CI enforce; pull requests and merge groups\n * compare with the event's base commit, fetching only that commit when a\n * shallow checkout lacks it; local runs are advisory.\n */\nexport const resolveExpiryScope = (\n root: string,\n env: Environment = process.env,\n): ExpiryScope => {\n if (env[\"GITHUB_ACTIONS\"] !== \"true\") {\n const ci = env[\"CI\"];\n return ci === undefined || ci === \"\" || ci === \"false\" || ci === \"0\"\n ? { kind: \"advisory\" }\n : { kind: \"enforce\" };\n }\n const event = env[\"GITHUB_EVENT_NAME\"];\n if (event === undefined || !scopedEvents.has(event))\n return { kind: \"enforce\" };\n let sha: string | undefined;\n try {\n sha = eventBase(event, env[\"GITHUB_EVENT_PATH\"]);\n } catch {\n sha = undefined;\n }\n if (sha === undefined) {\n const unavailable = `the ${event} event payload (GITHUB_EVENT_PATH) has no readable base commit`;\n return { kind: \"changed\", readBase: () => ({ unavailable }) };\n }\n const base = sha;\n const git = (args: string[]) =>\n execFileSync(\"git\", args, {\n cwd: root,\n encoding: \"utf8\",\n env: { ...env, GIT_TERMINAL_PROMPT: \"0\" },\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n maxBuffer: 16 * 1024 * 1024,\n timeout: 120_000,\n });\n const succeeds = (args: string[]) => {\n try {\n git(args);\n return true;\n } catch {\n return false;\n }\n };\n const hasCommit = () => succeeds([\"cat-file\", \"-e\", `${base}^{commit}`]);\n let commitProblem: string | null | undefined;\n // Shallow checkouts lack the base; fetch exactly that commit once.\n const ensureCommit = () => {\n if (commitProblem !== undefined) return commitProblem;\n if (hasCommit()) return (commitProblem = null);\n let remotes: string[];\n try {\n remotes = git([\"remote\"]).split(\"\\n\").filter(Boolean);\n } catch {\n remotes = [];\n }\n let remote: string | undefined;\n if (remotes.includes(\"origin\")) remote = \"origin\";\n else if (remotes.length === 1) remote = remotes.at(0);\n if (remote === undefined)\n return (commitProblem = `base commit ${base} is not in the clone and no single checkout remote can fetch it; check out with actions/checkout`);\n succeeds([\"fetch\", \"--no-tags\", \"--depth=1\", remote, base]);\n commitProblem = hasCommit()\n ? null\n : `base commit ${base} is not in the clone and \"git fetch --no-tags --depth=1 ${remote} ${base}\" failed; keep the actions/checkout credentials (persist-credentials: true) or check out with fetch-depth: 0`;\n return commitProblem;\n };\n const files = new Map<string, BaseFile>();\n const read = (path: string): BaseFile => {\n const problem = ensureCommit();\n if (problem !== null) return { unavailable: problem };\n if (!succeeds([\"cat-file\", \"-e\", `${base}:./${path}`]))\n return { text: undefined };\n try {\n return { text: git([\"show\", `${base}:./${path}`]) };\n } catch {\n return { unavailable: `cannot read ${path} at base commit ${base}` };\n }\n };\n return {\n kind: \"changed\",\n readBase: (path) => {\n const cached = files.get(path) ?? read(path);\n files.set(path, cached);\n return cached;\n },\n };\n};\n","import { type ExpiryScope, overdueVerdict } from \"./dated-entry-scope\";\nimport { parseJsonc } from \"./jsonc\";\n\nexport const REQUIRED_RELEASE_AGE_SECONDS = 5 * 24 * 60 * 60;\nexport const NPM_REGISTRY = \"https://registry.npmjs.org\";\nexport const EXACT_UTC_TIMESTAMP =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$/u;\nconst HOUR_MS = 60 * 60 * 1000;\nconst EXACT_PACKAGE = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u;\nconst REGISTRY_VERSION =\n /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/u;\n\ntype ParseToml = (text: string) => unknown;\ntype FirstPartyPackages = ReadonlySet<string> | readonly string[];\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst fail: (message: string) => never = (message) => {\n throw new Error(message);\n};\nconst ownPackage = (name: string) => name.startsWith(\"@stll/\");\nconst exactPackage = (name: string) =>\n name.length <= 214 && EXACT_PACKAGE.test(name);\nexport const isFirstPartyPackageName = (name: string): boolean =>\n exactPackage(name) && ownPackage(name);\n\nexport const exactTimestamp = (value: string): boolean => {\n const timestamp = Date.parse(value);\n return (\n EXACT_UTC_TIMESTAMP.test(value) &&\n !Number.isNaN(timestamp) &&\n new Date(timestamp).toISOString() === value\n );\n};\n\nexport const readParsedExcludes = (\n bunfig: string,\n parseToml: ParseToml,\n): string[] => {\n const parsed = parseToml(bunfig);\n if (!isRecord(parsed) || !isRecord(parsed[\"install\"]))\n return fail(\"bunfig.toml must contain an [install] table\");\n const install = parsed[\"install\"];\n if (\n (\"registry\" in install && install[\"registry\"] !== NPM_REGISTRY) ||\n (\"scopes\" in install &&\n (!isRecord(install[\"scopes\"]) ||\n Object.keys(install[\"scopes\"]).length > 0))\n )\n fail(\"bunfig.toml quarantine policy requires the canonical npm registry\");\n if (install[\"minimumReleaseAge\"] !== REQUIRED_RELEASE_AGE_SECONDS)\n fail(\n `bunfig.toml must set minimumReleaseAge = ${REQUIRED_RELEASE_AGE_SECONDS}`,\n );\n if (!Array.isArray(install[\"minimumReleaseAgeExcludes\"]))\n return fail(\n \"bunfig.toml must declare minimumReleaseAgeExcludes as an array\",\n );\n const names: string[] = [];\n for (const value of install[\"minimumReleaseAgeExcludes\"]) {\n if (typeof value !== \"string\" || !exactPackage(value))\n return fail(\n \"bunfig.toml minimumReleaseAgeExcludes must contain only exact npm package names\",\n );\n names.push(value);\n }\n if (new Set(names).size !== names.length)\n fail(\"bunfig.toml minimumReleaseAgeExcludes must not contain duplicates\");\n return names;\n};\n\ntype Token = {\n type: \"string\" | \"atom\" | \"punctuation\" | \"comment\" | \"newline\";\n start: number;\n end: number;\n text: string;\n};\n// Tokenize before locating declarations: text in comments, multiline strings and\n// unrelated tables cannot masquerade as the install policy's source array.\nconst tokensOf = (text: string): Token[] => {\n const tokens: Token[] = [];\n let index = 0;\n while (index < text.length) {\n const start = index;\n const character = text.charAt(index++);\n if (character === \"\\n\") {\n tokens.push({ type: \"newline\", start, end: index, text: character });\n continue;\n }\n if (/\\s/u.test(character)) continue;\n let type: Token[\"type\"];\n if (character === \"#\") {\n type = \"comment\";\n while (index < text.length && text.charAt(index) !== \"\\n\") index++;\n } else if (character === '\"' || character === \"'\") {\n type = \"string\";\n const triple = text.slice(start, start + 3) === character.repeat(3);\n if (triple) index = start + 3;\n while (index < text.length) {\n const current = text.charAt(index++);\n if (character === '\"' && current === \"\\\\\") {\n index++;\n continue;\n }\n if (current !== character) continue;\n if (!triple) break;\n if (text.slice(index - 1, index + 2) !== character.repeat(3)) continue;\n index += 2;\n while (text.charAt(index) === character) index++;\n break;\n }\n } else if (\"[]=.,{}\".includes(character)) type = \"punctuation\";\n else {\n type = \"atom\";\n while (\n index < text.length &&\n !/[\\s#[\\]=.,{}\"']/u.test(text.charAt(index))\n )\n index++;\n }\n tokens.push({\n type,\n start,\n end: index,\n text:\n type === \"comment\"\n ? text.slice(start, index).replace(/\\r$/u, \"\")\n : text.slice(start, index),\n });\n }\n return tokens;\n};\n\nconst stringValue = (token: Token, parseToml: ParseToml): string => {\n const parsed = parseToml(`value = ${token.text}`);\n if (!isRecord(parsed) || typeof parsed[\"value\"] !== \"string\")\n return fail(\"bunfig.toml has an unsupported quarantine string\");\n return parsed[\"value\"];\n};\nconst keyParts = (tokens: readonly Token[], parseToml: ParseToml): string[] =>\n tokens\n .filter(({ text }) => text !== \".\")\n .map((token) =>\n token.type === \"string\" ? stringValue(token, parseToml) : token.text,\n );\n\ntype Entry = {\n name: string;\n token: Token;\n comment: Token | undefined;\n comma: Token | undefined;\n};\ntype SourceArray = {\n open: Token;\n close: Token;\n entries: Entry[];\n comments: Token[];\n};\nconst readSourceArray = (bunfig: string, parseToml: ParseToml): SourceArray => {\n const names = readParsedExcludes(bunfig, parseToml);\n let table: string[] = [];\n let statement: Token[] = [];\n let depth = 0;\n let found: SourceArray | undefined;\n const visitStatement = () => {\n const meaningful = statement.filter(\n ({ type }) => type !== \"comment\" && type !== \"newline\",\n );\n const first = meaningful.at(0);\n if (first?.text === \"[\") {\n const end = meaningful.at(-1);\n if (end?.text === \"]\")\n table = keyParts(meaningful.slice(1, -1), parseToml);\n return;\n }\n const equals = meaningful.findIndex(({ text }) => text === \"=\");\n if (equals < 0) return;\n const key = [...table, ...keyParts(meaningful.slice(0, equals), parseToml)];\n if (\n key.join(\".\") !== \"install.minimumReleaseAgeExcludes\" ||\n key.length !== 2\n )\n return;\n const open = meaningful.at(equals + 1);\n const close = meaningful.at(-1);\n if (\n open === undefined ||\n close === undefined ||\n open.text !== \"[\" ||\n close.text !== \"]\" ||\n found !== undefined\n )\n fail(\n \"bunfig.toml must declare a single install minimumReleaseAgeExcludes array\",\n );\n const values = meaningful.slice(equals + 2, -1);\n if (values.some(({ type, text }) => type !== \"string\" && text !== \",\"))\n fail(\"bunfig.toml quarantine array must contain package strings\");\n const strings = values.filter(({ type }) => type === \"string\");\n const comments = statement.filter(({ type }) => type === \"comment\");\n const entries = strings.map((token, index) => {\n const next = strings.at(index + 1)?.start ?? Number.POSITIVE_INFINITY;\n const comment = comments.find(\n (candidate) =>\n candidate.start >= token.end &&\n candidate.start < next &&\n !bunfig.slice(token.end, candidate.start).includes(\"\\n\"),\n );\n const following = values.find(\n (candidate) => candidate.start >= token.end,\n );\n return {\n name: stringValue(token, parseToml),\n token,\n comment,\n comma: following?.text === \",\" ? following : undefined,\n };\n });\n if (\n entries.length !== names.length ||\n entries.some(({ name }, index) => name !== names.at(index))\n )\n fail(\n \"bunfig.toml quarantine source does not match its parsed install array\",\n );\n found = { open, close, entries, comments };\n };\n for (const token of tokensOf(bunfig)) {\n if (token.type === \"newline\" && depth === 0) {\n visitStatement();\n statement = [];\n continue;\n }\n statement.push(token);\n if (token.type !== \"punctuation\") continue;\n if (token.text === \"[\" || token.text === \"{\") depth++;\n if (token.text === \"]\" || token.text === \"}\") depth--;\n }\n visitStatement();\n if (found === undefined)\n return fail(\n \"bunfig.toml must declare an explicit [install] minimumReleaseAgeExcludes array\",\n );\n return found;\n};\n\ntype Annotation =\n | { type: \"none\" }\n | { type: \"invalid\" }\n | { type: \"expires\" | \"excluded-since\"; timestamp: string };\nconst annotationOf = ({ comment }: Entry): Annotation => {\n if (comment === undefined) return { type: \"none\" };\n const match = /^#\\s*quarantine-(expires|excluded-since):\\s*(\\S+)\\s*$/u.exec(\n comment.text,\n );\n const marker = match?.at(1);\n const timestamp = match?.at(2);\n if (\n (marker === \"expires\" || marker === \"excluded-since\") &&\n timestamp !== undefined\n )\n return { type: marker, timestamp };\n return { type: \"invalid\" };\n};\n\nexport const readRegistryFirstPartyPackages = (\n lockfile: string | undefined,\n): Set<string> => {\n if (lockfile === undefined) return new Set();\n const parsed = parseJsonc(lockfile);\n if (!isRecord(parsed) || !isRecord(parsed[\"packages\"]))\n return fail(\"bun.lock must contain a packages mapping\");\n const names = new Set<string>();\n for (const value of Object.values(parsed[\"packages\"])) {\n if (!Array.isArray(value)) continue;\n const identity: unknown = value.at(0);\n if (typeof identity !== \"string\") continue;\n const separator = identity.lastIndexOf(\"@\");\n const name = identity.slice(0, separator);\n if (\n exactPackage(name) &&\n ownPackage(name) &&\n REGISTRY_VERSION.test(identity.slice(separator + 1))\n )\n names.add(name);\n }\n return names;\n};\n\nconst ownNames = (names: FirstPartyPackages): Set<string> => {\n const result = new Set(names);\n for (const name of result)\n if (!exactPackage(name) || !ownPackage(name))\n fail(`Expected an exact first-party npm package name: ${name}`);\n return result;\n};\nconst validNow = (now: Date): number => {\n if (!Number.isFinite(now.getTime()))\n return fail(\"Quarantine policy requires a valid current date\");\n return now.getTime();\n};\nexport type CheckResult = { errors: string[]; warnings: string[] };\ntype CheckOptions = {\n bunfig: string;\n lockfile: string | undefined;\n parseToml: ParseToml;\n npmrcPresent?: boolean;\n now?: Date;\n firstPartyPackages?: FirstPartyPackages;\n expiry?: ExpiryScope;\n};\n/** Whether the base bunfig declares this temporary exclude with the same expiry. */\nconst declaresTemporary = (\n baseBunfig: string,\n parseToml: ParseToml,\n name: string,\n timestamp: string,\n) =>\n readSourceArray(baseBunfig, parseToml).entries.some((entry) => {\n const annotation = annotationOf(entry);\n return (\n entry.name === name &&\n annotation.type === \"expires\" &&\n annotation.timestamp === timestamp\n );\n });\nexport const checkQuarantinePolicy = ({\n bunfig,\n lockfile,\n parseToml,\n npmrcPresent = false,\n now = new Date(),\n firstPartyPackages,\n expiry = { kind: \"enforce\" },\n}: CheckOptions): CheckResult => {\n const errors: string[] = [];\n const warnings: string[] = [];\n try {\n const nowMs = validNow(now);\n const { entries } = readSourceArray(bunfig, parseToml);\n if (npmrcPresent)\n errors.push(\n \"bunfig.toml quarantine policy does not allow a repository .npmrc\",\n );\n for (const entry of entries) {\n const annotation = annotationOf(entry);\n if (ownPackage(entry.name) && annotation.type === \"none\") continue;\n if (annotation.type === \"none\" || annotation.type === \"invalid\") {\n errors.push(\n `bunfig.toml has an unannotated or malformed quarantine exclude: ${entry.name}`,\n );\n continue;\n }\n if (!exactTimestamp(annotation.timestamp)) {\n errors.push(\n `bunfig.toml quarantine exclude \"${entry.name}\" has an invalid UTC timestamp: ${annotation.timestamp}`,\n );\n continue;\n }\n const timestampMs = Date.parse(annotation.timestamp);\n if (ownPackage(entry.name)) {\n if (annotation.type !== \"excluded-since\")\n errors.push(\n `bunfig.toml first-party quarantine exclude \"${entry.name}\" must be permanent (quarantine-excluded-since: or no timestamp)`,\n );\n else if (timestampMs > nowMs)\n errors.push(\n `bunfig.toml first-party quarantine exclude \"${entry.name}\" has a future exclusion date`,\n );\n continue;\n }\n if (annotation.type !== \"expires\") {\n errors.push(\n `bunfig.toml third-party quarantine exclude \"${entry.name}\" must use quarantine-expires:`,\n );\n continue;\n }\n if (nowMs >= timestampMs + 24 * HOUR_MS) {\n const overdue = `bunfig.toml temporary quarantine exclude \"${entry.name}\" expired at ${annotation.timestamp} and is still present`;\n const verdict = overdueVerdict(expiry, \"bunfig.toml\", (base) =>\n declaresTemporary(base, parseToml, entry.name, annotation.timestamp),\n );\n if (!verdict.fail)\n warnings.push(\n `${overdue}; merge its removal PR (default-branch and scheduled runs fail, as do changes that add or edit it)`,\n );\n else if (verdict.unavailable === undefined) errors.push(overdue);\n else\n errors.push(\n `${overdue}; cannot tell whether this change adds it: ${verdict.unavailable}`,\n );\n } else if (nowMs >= timestampMs)\n warnings.push(\n `bunfig.toml temporary quarantine exclude \"${entry.name}\" expired at ${annotation.timestamp}; its removal PR should be merged`,\n );\n else if (nowMs >= timestampMs - 48 * HOUR_MS)\n warnings.push(\n `bunfig.toml temporary quarantine exclude \"${entry.name}\" expires at ${annotation.timestamp}; prepare its removal PR`,\n );\n }\n const required = readRegistryFirstPartyPackages(lockfile);\n if (firstPartyPackages !== undefined) {\n for (const name of ownNames(firstPartyPackages)) required.add(name);\n }\n const declared = new Set(entries.map(({ name }) => name));\n const missing = [...required].filter((name) => !declared.has(name)).sort();\n if (missing.length > 0)\n errors.push(\n `bunfig.toml is missing registry-backed first-party quarantine excludes: ${missing.join(\", \")}`,\n );\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n }\n return { errors, warnings };\n};\n\ntype PruneOptions = { bunfig: string; parseToml: ParseToml; now?: Date };\nexport const pruneExpiredExcludes = ({\n bunfig,\n parseToml,\n now = new Date(),\n}: PruneOptions): { bunfig: string; pruned: string[] } => {\n const nowMs = validNow(now);\n const { entries, close } = readSourceArray(bunfig, parseToml);\n const removals: { start: number; end: number }[] = [];\n const pruned: string[] = [];\n for (const entry of entries) {\n if (ownPackage(entry.name)) continue;\n const annotation = annotationOf(entry);\n if (annotation.type !== \"expires\" || !exactTimestamp(annotation.timestamp))\n return fail(\n `bunfig.toml third-party quarantine exclude \"${entry.name}\" must have an exact UTC quarantine-expires: annotation`,\n );\n if (nowMs < Date.parse(annotation.timestamp)) continue;\n const lineStart = bunfig.lastIndexOf(\"\\n\", entry.token.start - 1) + 1;\n const nextNewline = bunfig.indexOf(\"\\n\", entry.token.end);\n const lineEnd = nextNewline < 0 ? bunfig.length : nextNewline;\n const commentInside =\n entry.comment !== undefined && entry.comment.start < close.start;\n const end = commentInside\n ? (entry.comment?.end ?? entry.token.end)\n : (entry.comma?.end ?? entry.token.end);\n if (\n bunfig.slice(lineStart, entry.token.start).trim() === \"\" &&\n bunfig.slice(end, lineEnd).trim() === \"\"\n )\n removals.push({\n start: lineStart,\n end: nextNewline < 0 ? lineEnd : lineEnd + 1,\n });\n else removals.push({ start: entry.token.start, end });\n if (entry.comment !== undefined && !commentInside)\n removals.push({ start: entry.comment.start, end: entry.comment.end });\n pruned.push(entry.name);\n }\n let result = bunfig;\n for (const removal of removals.toReversed())\n result = result.slice(0, removal.start) + result.slice(removal.end);\n // Never return edited TOML without confirming the resulting source is valid.\n readSourceArray(result, parseToml);\n return { bunfig: result, pruned };\n};\n\ntype SynchronizeOptions = {\n bunfig: string;\n firstPartyPackages: FirstPartyPackages;\n parseToml: ParseToml;\n now?: Date;\n};\nexport const synchronizeFirstPartyExcludes = ({\n bunfig,\n firstPartyPackages,\n parseToml,\n now = new Date(),\n}: SynchronizeOptions): string => {\n validNow(now);\n const required = ownNames(firstPartyPackages);\n const { open, close, entries, comments } = readSourceArray(bunfig, parseToml);\n const attachedComments = new Set(\n entries.flatMap(({ comment }) => (comment === undefined ? [] : [comment])),\n );\n const lines = comments\n .filter((comment) => !attachedComments.has(comment))\n .map(({ text }) => ` ${text}`);\n const seen = new Set<string>();\n for (const entry of entries) {\n if (!ownPackage(entry.name)) {\n const annotation = annotationOf(entry);\n if (\n annotation.type !== \"expires\" ||\n !exactTimestamp(annotation.timestamp)\n )\n return fail(\n `bunfig.toml third-party quarantine exclude \"${entry.name}\" must have an exact UTC quarantine-expires: annotation`,\n );\n lines.push(\n ` ${entry.token.text},${entry.comment === undefined ? \"\" : ` ${entry.comment.text}`}`,\n );\n continue;\n }\n if (!required.has(entry.name)) continue;\n seen.add(entry.name);\n const annotation = annotationOf(entry);\n const timestamp =\n annotation.type === \"excluded-since\" &&\n exactTimestamp(annotation.timestamp)\n ? annotation.timestamp\n : now.toISOString();\n lines.push(\n ` ${JSON.stringify(entry.name)}, # quarantine-excluded-since: ${timestamp}`,\n );\n }\n for (const name of [...required]\n .filter((requiredPackage) => !seen.has(requiredPackage))\n .sort())\n lines.push(\n ` ${JSON.stringify(name)}, # quarantine-excluded-since: ${now.toISOString()}`,\n );\n const newline = bunfig.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const trailingComment = entries.at(-1)?.comment;\n const end =\n trailingComment !== undefined && trailingComment.start > close.end\n ? trailingComment.end\n : close.end;\n const result =\n bunfig.slice(0, open.start) +\n `[${newline}${lines.join(newline)}${lines.length === 0 ? \"\" : newline}]` +\n bunfig.slice(end);\n readSourceArray(result, parseToml);\n return result;\n};\n","import { parse } from \"smol-toml\";\n\nimport type { ExpiryScope } from \"./dated-entry-scope\";\nimport {\n checkQuarantinePolicy,\n isFirstPartyPackageName,\n pruneExpiredExcludes,\n readRegistryFirstPartyPackages,\n REQUIRED_RELEASE_AGE_SECONDS,\n synchronizeFirstPartyExcludes,\n} from \"./quarantine-policy-core\";\n\nexport type { ExpiryScope } from \"./dated-entry-scope\";\nexport {\n EXACT_UTC_TIMESTAMP,\n NPM_REGISTRY,\n REQUIRED_RELEASE_AGE_SECONDS,\n exactTimestamp,\n} from \"./quarantine-policy-core\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** Derive exact registry identities before install, including catalog references. */\nexport const declaredFirstPartyPackages = (files: Record<string, string>) => {\n const names = new Set<string>();\n for (const [file, text] of Object.entries(files)) {\n if (!/(?:^|\\/)package\\.json$/.test(file)) continue;\n const manifest: unknown = JSON.parse(text);\n if (!record(manifest)) throw new Error(`${file} must contain an object`);\n for (const field of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n ]) {\n const dependencies = manifest[field];\n if (!record(dependencies)) continue;\n for (const [name, specifier] of Object.entries(dependencies)) {\n if (typeof specifier !== \"string\") continue;\n if (\n /^(?:workspace:|file:|link:|git(?:\\+|:)|https?:|github:|\\.\\.?\\/|\\/)/.test(\n specifier,\n )\n )\n continue;\n if (specifier.startsWith(\"npm:\")) {\n const alias = /^npm:(@[^/]+\\/[^@]+|[^@]+)@/.exec(specifier)?.at(1);\n if (alias !== undefined && isFirstPartyPackageName(alias))\n names.add(alias);\n continue;\n }\n if (isFirstPartyPackageName(name)) names.add(name);\n }\n }\n }\n return names;\n};\n\ntype RepositoryQuarantineOptions = {\n files: Record<string, string>;\n now?: Date | undefined;\n npmrcPresent?: boolean | undefined;\n expiry?: ExpiryScope | undefined;\n};\n\nexport const checkRepositoryQuarantine = ({\n files,\n now,\n npmrcPresent,\n expiry,\n}: RepositoryQuarantineOptions) =>\n checkQuarantinePolicy({\n bunfig: files[\"bunfig.toml\"] ?? \"\",\n lockfile: files[\"bun.lock\"],\n firstPartyPackages: declaredFirstPartyPackages(files),\n parseToml: parse,\n ...(now === undefined ? {} : { now }),\n ...(npmrcPresent === undefined ? {} : { npmrcPresent }),\n ...(expiry === undefined ? {} : { expiry }),\n });\n\nexport const synchronizeRepositoryQuarantine = ({\n files,\n now,\n}: RepositoryQuarantineOptions) => {\n const firstPartyPackages = new Set([\n ...declaredFirstPartyPackages(files),\n ...readRegistryFirstPartyPackages(files[\"bun.lock\"]),\n ]);\n return synchronizeFirstPartyExcludes({\n bunfig:\n files[\"bunfig.toml\"] ??\n `[install]\\nminimumReleaseAge = ${REQUIRED_RELEASE_AGE_SECONDS}\\nminimumReleaseAgeExcludes = []\\n`,\n firstPartyPackages,\n parseToml: parse,\n ...(now === undefined ? {} : { now }),\n });\n};\n\nexport const pruneRepositoryQuarantine = ({\n files,\n now,\n}: RepositoryQuarantineOptions) =>\n pruneExpiredExcludes({\n bunfig: files[\"bunfig.toml\"] ?? \"\",\n parseToml: parse,\n ...(now === undefined ? {} : { now }),\n });\n"],"mappings":";;;;;;;;;;AAyBA,MAAa,kBACX,OACA,MACA,gBACmB;CACnB,IAAI,MAAM,SAAS,WAAW,OAAO,EAAE,MAAM,KAAK;CAClD,IAAI,MAAM,SAAS,YAAY,OAAO,EAAE,MAAM,MAAM;CACpD,MAAM,OAAO,MAAM,SAAS,IAAI;CAChC,IAAI,iBAAiB,MACnB,OAAO;EAAE,MAAM;EAAM,aAAa,KAAK;CAAY;CACrD,IAAI,KAAK,SAAS,KAAA,GAAW,OAAO,EAAE,MAAM,KAAK;CACjD,IAAI;EACF,OAAO,YAAY,KAAK,IAAI,IAAI,EAAE,MAAM,MAAM,IAAI,EAAE,MAAM,KAAK;CACjE,QAAQ;EACN,OAAO,EAAE,MAAM,KAAK;CACtB;AACF;AAIA,MAAM,+BAAe,IAAI,IAAI;CAC3B;CACA;CACA;AACF,CAAC;AACD,MAAM,SAAS;AAEf,MAAMA,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,aAAa,OAAe,cAAkC;CAClE,IAAI,cAAc,KAAA,KAAa,cAAc,IAAI,OAAO,KAAA;C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