@antelopejs/tooling-configs 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +68 -29
  2. package/dist/bin/api-diff.mjs +235 -37
  3. package/dist/bin/body-check.mjs +14 -11
  4. package/dist/bin/capture.mjs +173 -54
  5. package/dist/bin/check-size.mjs +1 -1
  6. package/dist/bin/checks.mjs +166 -11
  7. package/dist/bin/comment-proof.mjs +29 -7
  8. package/dist/bin/garden.mjs +8 -58
  9. package/dist/bin/lease.mjs +48 -11
  10. package/dist/bin/ratchet.mjs +48 -14
  11. package/dist/bin/suppressions.mjs +3 -3
  12. package/dist/bin/sync.mjs +199 -80
  13. package/dist/bin/verify.mjs +1163 -474
  14. package/dist/capture/index.d.mts +6 -1
  15. package/dist/capture/index.mjs +1 -1
  16. package/dist/{ci-workflow-37qJa9LX.mjs → ci-workflow-COJUT12b.mjs} +121 -1
  17. package/dist/eslint.d.mts +16 -3
  18. package/dist/eslint.mjs +21 -6
  19. package/dist/formal/index.d.mts +20 -4
  20. package/dist/formal/index.mjs +71 -19
  21. package/dist/{map-B23_WMGE.mjs → map-DRyYz_Fw.mjs} +20 -1
  22. package/dist/oxc/anti-slop/index.mjs +156 -421
  23. package/dist/oxc/guardrails/index.d.mts +1 -1
  24. package/dist/oxc/guardrails/index.mjs +789 -103
  25. package/dist/oxc/lint.d.mts +13 -15
  26. package/dist/oxc/lint.mjs +19 -29
  27. package/dist/{package-CqqBgE8Y.mjs → package-Dn7VTFUW.mjs} +71 -17
  28. package/dist/{proof-stamp-DDDC0J6l.mjs → proof-stamp-DLWpPwQE.mjs} +72 -10
  29. package/dist/{ratchet-Q-JXuZIX.mjs → ratchet-ClfblHNJ.mjs} +18 -15
  30. package/dist/require-safety-comment-for-type-assertion-mnb0CIxa.mjs +181 -0
  31. package/dist/{scenes-DZVXkcxS.mjs → scenes-d-VQ0LOm.mjs} +4 -1
  32. package/dist/semver-BDxeEcP_.mjs +57 -0
  33. package/dist/{suppression-base-9L8dlMQK.mjs → suppression-base-Drnl6Y7F.mjs} +2 -2
  34. package/dist/{suppression-budget-C0SkPO5R.mjs → suppression-budget-Dvb_IqBo.mjs} +1 -1
  35. package/dist/{suppressions-DM60NkvL.mjs → suppressions-BroaaGJ_.mjs} +1 -1
  36. package/dist/{templates-BKZv-BRw.mjs → templates-lJBZFskp.mjs} +8 -3
  37. package/dist/type-aware-rules-DMuN6sHb.mjs +30 -0
  38. package/dist/{typescript-DAgQIAAR.mjs → typescript-BBbry7uU.mjs} +123 -27
  39. package/dist/verify/index.d.mts +60 -15
  40. package/package.json +3 -1
  41. package/dist/require-safety-comment-for-type-assertion-BBQ669kj.mjs +0 -83
@@ -37,6 +37,8 @@ interface AntelopePresetOptions {
37
37
  /**
38
38
  * Type-aware rules. Defaults to true. Consumers must also set options.typeAware
39
39
  * in their root config because oxlint never reads that field from extends.
40
+ * oxlint-tsgolint reads only TypeScript files, so `.vue` script blocks get
41
+ * these rules from `antelopeNuxtConfig({ typeAware })` in ESLint instead.
40
42
  */
41
43
  typeAware?: boolean;
42
44
  }
@@ -70,6 +72,7 @@ declare function guardrailsRules(): {
70
72
  "antelopejs/no-comments": "error";
71
73
  "antelopejs/no-inherited-key-lookup": "error";
72
74
  "antelopejs/no-presence-only-type-guard": "error";
75
+ "antelopejs/no-read-then-insert": "error";
73
76
  "jest/no-conditional-expect": "off";
74
77
  "jest/no-export": "off";
75
78
  "jest/no-standalone-expect": "off";
@@ -81,6 +84,7 @@ declare function guardrailsRules(): {
81
84
  overrides: ({
82
85
  files: string[];
83
86
  rules: {
87
+ "antelopejs/no-read-then-insert": "off";
84
88
  "antelopejs/no-fs-read-in-tests": "error";
85
89
  "antelopejs/no-constant-value-assertion": "error";
86
90
  "antelopejs/no-self-import-in-tests": "error";
@@ -91,6 +95,7 @@ declare function guardrailsRules(): {
91
95
  files: string[];
92
96
  rules: {
93
97
  "antelopejs/no-fs-read-in-tests": "off";
98
+ "antelopejs/no-read-then-insert"?: undefined;
94
99
  "antelopejs/no-constant-value-assertion"?: undefined;
95
100
  "antelopejs/no-self-import-in-tests"?: undefined;
96
101
  "antelopejs/no-typeof-function-only-test"?: undefined;
@@ -129,20 +134,7 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
129
134
  };
130
135
  } | {
131
136
  rules: {
132
- "typescript/no-unnecessary-type-parameters": "error";
133
- "typescript/no-unsafe-argument": "error";
134
- "typescript/no-unsafe-assignment": "error";
135
- "typescript/no-unsafe-return": "error";
136
- "typescript/use-unknown-in-catch-callback-variable": "error";
137
- "typescript/no-floating-promises": "error";
138
- "typescript/await-thenable": "error";
139
- "typescript/unbound-method": "error";
140
- "typescript/no-meaningless-void-operator": "error";
141
- "typescript/no-misused-spread": "error";
142
- "typescript/no-base-to-string": "error";
143
- "typescript/no-redundant-type-constituents": "error";
144
- "typescript/restrict-template-expressions": "error";
145
- "typescript/require-array-sort-compare": "error";
137
+ [k: string]: "error";
146
138
  };
147
139
  } | {
148
140
  jsPlugins: {
@@ -162,6 +154,7 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
162
154
  "antelopejs/no-comments": "error";
163
155
  "antelopejs/no-inherited-key-lookup": "error";
164
156
  "antelopejs/no-presence-only-type-guard": "error";
157
+ "antelopejs/no-read-then-insert": "error";
165
158
  "jest/no-conditional-expect": "off";
166
159
  "jest/no-export": "off";
167
160
  "jest/no-standalone-expect": "off";
@@ -173,6 +166,7 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
173
166
  overrides: ({
174
167
  files: string[];
175
168
  rules: {
169
+ "antelopejs/no-read-then-insert": "off";
176
170
  "antelopejs/no-fs-read-in-tests": "error";
177
171
  "antelopejs/no-constant-value-assertion": "error";
178
172
  "antelopejs/no-self-import-in-tests": "error";
@@ -183,6 +177,7 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
183
177
  files: string[];
184
178
  rules: {
185
179
  "antelopejs/no-fs-read-in-tests": "off";
180
+ "antelopejs/no-read-then-insert"?: undefined;
186
181
  "antelopejs/no-constant-value-assertion"?: undefined;
187
182
  "antelopejs/no-self-import-in-tests"?: undefined;
188
183
  "antelopejs/no-typeof-function-only-test"?: undefined;
@@ -195,12 +190,15 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
195
190
  specifier: string;
196
191
  }[];
197
192
  rules: {
193
+ "antelopejs/no-unsafe-object-assign": "off" | "error";
198
194
  "antelopejs/require-tsconfig-include": "off" | "error";
195
+ "antelopejs/require-tsconfig-types": "off" | "error";
199
196
  };
200
197
  overrides: {
201
- files: ("oxlint.config.ts" | "oxfmt.config.ts" | "knip.config.ts")[];
198
+ files: string[];
202
199
  rules: {
203
200
  "antelopejs/require-tsconfig-include": "off";
201
+ "antelopejs/require-tsconfig-types": "off";
204
202
  };
205
203
  }[];
206
204
  } | {
package/dist/oxc/lint.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { i as findGitRoot } from "../ceilings-B7KayYIG.mjs";
2
2
  import { t as readCarriedCeilings } from "../renames-L2owF5GD.mjs";
3
- import { t as PRESET_CONFIGS } from "../templates-BKZv-BRw.mjs";
3
+ import { t as PRESET_CONFIGS } from "../templates-lJBZFskp.mjs";
4
+ import { t as TYPE_AWARE_RULES } from "../type-aware-rules-DMuN6sHb.mjs";
4
5
  import { n as TEST_FILE_GLOBS, t as ASSERTION_FUNCTION_NAMES } from "../shared-WC0z3y9F.mjs";
5
6
  import { n as IGNORE_PATTERNS, r as SYNCED_AGENT_PATTERNS } from "../shared-igPpEDpS.mjs";
6
7
  import { defineConfig } from "oxlint";
@@ -109,11 +110,13 @@ function guardrailsRules() {
109
110
  "jest/expect-expect": "off",
110
111
  "antelopejs/no-comments": "error",
111
112
  "antelopejs/no-inherited-key-lookup": "error",
112
- "antelopejs/no-presence-only-type-guard": "error"
113
+ "antelopejs/no-presence-only-type-guard": "error",
114
+ "antelopejs/no-read-then-insert": "error"
113
115
  },
114
116
  overrides: [{
115
117
  files: TEST_FILE_GLOBS,
116
118
  rules: {
119
+ "antelopejs/no-read-then-insert": "off",
117
120
  "antelopejs/no-fs-read-in-tests": "error",
118
121
  "antelopejs/no-constant-value-assertion": "error",
119
122
  "antelopejs/no-self-import-in-tests": "error",
@@ -131,7 +134,8 @@ function guardrailsRules() {
131
134
  });
132
135
  }
133
136
  /**
134
- * With type-aware lint, a file no tsconfig lists is reported. The root configs
137
+ * With type-aware lint, a file no tsconfig lists, or whose tsconfig lists no
138
+ * `compilerOptions.types`, is reported. The root configs
135
139
  * `antelopejs-sync` writes are exempt: a tsconfig that builds `src` reaches them
136
140
  * only through a referenced composite tsconfig, which every repository would need.
137
141
  */
@@ -142,10 +146,17 @@ function guardrailsPreset(typeAware) {
142
146
  name: "antelopejs",
143
147
  specifier: "@antelopejs/tooling-configs/oxc/guardrails"
144
148
  }],
145
- rules: { "antelopejs/require-tsconfig-include": typeAware ? "error" : "off" },
149
+ rules: {
150
+ "antelopejs/no-unsafe-object-assign": typeAware ? "error" : "off",
151
+ "antelopejs/require-tsconfig-include": typeAware ? "error" : "off",
152
+ "antelopejs/require-tsconfig-types": typeAware ? "error" : "off"
153
+ },
146
154
  overrides: [{
147
- files: PRESET_CONFIGS.map(({ path }) => path),
148
- rules: { "antelopejs/require-tsconfig-include": "off" }
155
+ files: PRESET_CONFIGS.map(({ path }) => `./${path}`),
156
+ rules: {
157
+ "antelopejs/require-tsconfig-include": "off",
158
+ "antelopejs/require-tsconfig-types": "off"
159
+ }
149
160
  }]
150
161
  });
151
162
  }
@@ -166,30 +177,9 @@ function complexityPreset(thresholds) {
166
177
  "eslint/complexity": ["error", { max: thresholds.complexity }]
167
178
  } });
168
179
  }
169
- /**
170
- * Besides the base set, five rules reject an `any` or a type parameter that
171
- * stands in for `unknown`, which the anti-slop `unknown` and assertion rules
172
- * never see: a once-used type parameter, `any` passed as a typed argument,
173
- * assigned to a typed binding or returned as a typed result, and an untyped
174
- * `.catch` callback variable.
175
- */
180
+ /** The {@link TYPE_AWARE_RULES} as oxlint names them. */
176
181
  function typeAwarePreset() {
177
- return defineConfig({ rules: {
178
- "typescript/no-unnecessary-type-parameters": "error",
179
- "typescript/no-unsafe-argument": "error",
180
- "typescript/no-unsafe-assignment": "error",
181
- "typescript/no-unsafe-return": "error",
182
- "typescript/use-unknown-in-catch-callback-variable": "error",
183
- "typescript/no-floating-promises": "error",
184
- "typescript/await-thenable": "error",
185
- "typescript/unbound-method": "error",
186
- "typescript/no-meaningless-void-operator": "error",
187
- "typescript/no-misused-spread": "error",
188
- "typescript/no-base-to-string": "error",
189
- "typescript/no-redundant-type-constituents": "error",
190
- "typescript/restrict-template-expressions": "error",
191
- "typescript/require-array-sort-compare": "error"
192
- } });
182
+ return defineConfig({ rules: Object.fromEntries(TYPE_AWARE_RULES.map((rule) => [`typescript/${rule}`, "error"])) });
193
183
  }
194
184
  /** Side-effect imports register classes, so sorting may never relocate them. */
195
185
  function importSortingPreset() {
@@ -1,7 +1,15 @@
1
+ import { t as admits } from "./semver-BDxeEcP_.mjs";
1
2
  import { existsSync, readFileSync } from "node:fs";
2
3
  import { dirname, join } from "node:path";
3
4
  import { fileURLToPath } from "node:url";
4
5
  //#region src/guardrails/package.ts
6
+ /** The capture tool's optional peers, which a repository with `docs/captures.ts` declares as devDependencies at the ranges the pack tests against. */
7
+ const CAPTURE_PEERS = [
8
+ "mongodb-memory-server",
9
+ "pixelmatch",
10
+ "playwright-core",
11
+ "sharp"
12
+ ];
5
13
  function parseManifest(text) {
6
14
  const manifest = JSON.parse(text);
7
15
  if (manifest === null || Array.isArray(manifest)) throw new Error("package.json must contain an object.");
@@ -33,10 +41,16 @@ function toolingVersions() {
33
41
  const knip = manifest.devDependencies?.knip;
34
42
  const tsgolint = manifest.devDependencies?.["oxlint-tsgolint"];
35
43
  if (!lefthook || !knip || !tsgolint || !manifest.version) throw new Error("tooling-configs must declare its version and lefthook, knip and oxlint-tsgolint devDependencies.");
44
+ const tested = manifest.devDependencies ?? {};
36
45
  return {
37
46
  lefthook,
38
47
  knip,
39
48
  tsgolint,
49
+ capture: CAPTURE_PEERS.map((name) => {
50
+ const range = tested[name];
51
+ if (!range) throw new Error(`tooling-configs must declare ${name} as a devDependency.`);
52
+ return [name, range];
53
+ }),
40
54
  pack: manifest.version
41
55
  };
42
56
  }
@@ -95,6 +109,15 @@ const DEFAULT_SCRIPTS = {
95
109
  "format:check": "oxfmt --check .",
96
110
  knip: "knip"
97
111
  };
112
+ function defaultScripts(nuxt) {
113
+ return {
114
+ ...DEFAULT_SCRIPTS,
115
+ ...nuxt && { typecheck: "nuxi typecheck" }
116
+ };
117
+ }
118
+ function sortedEntries(record) {
119
+ return Object.fromEntries(Object.entries(record).sort(([a], [b]) => a.localeCompare(b)));
120
+ }
98
121
  /** Stands in for the current install while the script is split on its separators, since the install holds `&&` itself. */
99
122
  const INSTALL_TOKEN = "\0prepare-install\0";
100
123
  /** Rewrites every earlier synced install to the current one in one pass and keeps a single install, whatever separator joined the copies. */
@@ -119,6 +142,19 @@ function prepareScript(current = "") {
119
142
  if (legacy.test(current)) return current.replace(legacy, `$1${PREPARE_INSTALL}`);
120
143
  return current ? `${current} && ${PREPARE_INSTALL}` : PREPARE_INSTALL;
121
144
  }
145
+ /** Whether `range`'s lowest named version is one the pack's `tested` range admits. A `workspace:` or `catalog:` spec resolves elsewhere and is kept as declared. */
146
+ function withinTested(range, tested) {
147
+ if (range?.startsWith("workspace:") || range?.startsWith("catalog:")) return true;
148
+ const floor = /\d+\.\d+\.\d+/.exec(range ?? "")?.[0];
149
+ return floor !== void 0 && admits(tested, floor);
150
+ }
151
+ /** The devDependencies, with their ranges, that sync writes into `manifest`: tools it lacks, and capture peers it lacks or declares below the pack's tested range. */
152
+ function addedDevDependencies(manifest, versions, options) {
153
+ const declared = manifest.devDependencies ?? {};
154
+ const tools = [["lefthook", versions.lefthook], ["knip", versions.knip]];
155
+ if (options.typeAware) tools.push(["oxlint-tsgolint", versions.tsgolint]);
156
+ return [...tools.filter(([name]) => !declared[name]), ...options.captures ? versions.capture.filter(([name, tested]) => !withinTested(declared[name], tested)) : []];
157
+ }
122
158
  function managedPackage(current, versions, options = {}) {
123
159
  if (current === void 0) throw new Error("package.json is missing.");
124
160
  const manifest = parseManifest(current);
@@ -134,34 +170,52 @@ function managedPackage(current, versions, options = {}) {
134
170
  delete scripts.ratchet;
135
171
  delete scripts["ratchet:update"];
136
172
  }
137
- for (const [name, command] of Object.entries(DEFAULT_SCRIPTS)) scripts[name] ??= name === "typecheck" && options.nuxt ? "nuxi typecheck" : command;
138
- const dependencies = manifest.devDependencies ??= {};
139
- dependencies.lefthook ??= versions.lefthook;
140
- dependencies.knip ??= versions.knip;
141
- if (options.typeAware) dependencies["oxlint-tsgolint"] ??= versions.tsgolint;
142
- manifest.devDependencies = Object.fromEntries(Object.entries(dependencies).sort(([a], [b]) => a.localeCompare(b)));
173
+ for (const [name, command] of Object.entries(defaultScripts(options.nuxt))) scripts[name] ??= command;
174
+ manifest.devDependencies = sortedEntries({
175
+ ...manifest.devDependencies,
176
+ ...Object.fromEntries(addedDevDependencies(manifest, versions, options))
177
+ });
143
178
  return serializeManifest(manifest, current);
144
179
  }
145
180
  /**
146
- * The template profile owns only the scripts `antelopejs-checks` requires and
147
- * the profile's `sync` scripts do not provide. An already complete manifest is
148
- * returned unchanged, so a template is never reformatted for nothing.
181
+ * The template profile owns the scripts and devDependencies `antelopejs-checks`
182
+ * runs, without the hooks: the pack's commands are set, and the other steps get
183
+ * a default only where the template has none, so its own `test`, `lint` or
184
+ * `sync` stays. An already complete manifest is returned unchanged, so a
185
+ * template is never reformatted for nothing.
149
186
  */
150
- function templatePackage(current, options) {
187
+ function templatePackage(current, versions, options) {
151
188
  if (current === void 0) throw new Error("package.json is missing.");
152
189
  const manifest = parseManifest(current);
153
- const commands = repositoryTools(manifest).commands;
154
- const wanted = {
190
+ const { commands } = repositoryTools(manifest);
191
+ const sync = `${commands.sync} --profile template`;
192
+ const scripts = manifest.scripts ??= {};
193
+ const dependencies = manifest.devDependencies ??= {};
194
+ const set = Object.entries({
195
+ checks: commands.checks,
196
+ size: commands.size,
155
197
  suppressions: commands.suppressions,
156
198
  "suppressions:update": `${commands.suppressions} --update`,
157
199
  ...options.ratchet && {
158
200
  ratchet: commands.ratchet,
159
201
  "ratchet:update": `${commands.ratchet} --update`
160
202
  }
161
- };
162
- const scripts = manifest.scripts ??= {};
163
- if (Object.entries(wanted).every(([name, command]) => scripts[name] === command)) return current;
164
- Object.assign(scripts, wanted);
203
+ }).filter(([name, command]) => scripts[name] !== command);
204
+ const defaults = Object.entries({
205
+ ...defaultScripts(options.nuxt),
206
+ sync,
207
+ "sync:check": `${sync} --check`
208
+ }).filter(([name]) => scripts[name] === void 0);
209
+ const missing = Object.entries({
210
+ knip: versions.knip,
211
+ ...options.typeAware && { "oxlint-tsgolint": versions.tsgolint }
212
+ }).filter(([name]) => dependencies[name] === void 0);
213
+ if (set.length + defaults.length + missing.length === 0) return current;
214
+ Object.assign(scripts, Object.fromEntries([...defaults, ...set]));
215
+ manifest.devDependencies = sortedEntries({
216
+ ...dependencies,
217
+ ...Object.fromEntries(missing)
218
+ });
165
219
  return serializeManifest(manifest, current);
166
220
  }
167
221
  function serializeManifest(manifest, current) {
@@ -170,4 +224,4 @@ function serializeManifest(manifest, current) {
170
224
  return `${JSON.stringify(manifest, null, indent).replaceAll("\n", newline)}${newline}`;
171
225
  }
172
226
  //#endregion
173
- export { repositoryTools as a, parseManifest as i, managedPackage as n, templatePackage as o, packageManager as r, toolingVersions as s, execCommand as t };
227
+ export { parseManifest as a, toolingVersions as c, packageManager as i, execCommand as n, repositoryTools as o, managedPackage as r, templatePackage as s, addedDevDependencies as t };
@@ -1,7 +1,8 @@
1
+ import { a as parseManifest } from "./package-Dn7VTFUW.mjs";
1
2
  import { l as resolveRevision, u as trackedManifests } from "./files-DJ0TeaTU.mjs";
2
- import { o as revisionSuppressions, r as countSuppressions } from "./suppressions-DM60NkvL.mjs";
3
- import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync } from "node:fs";
4
- import { dirname, join, matchesGlob } from "node:path";
3
+ import { o as revisionSuppressions, r as countSuppressions } from "./suppressions-BroaaGJ_.mjs";
4
+ import { copyFileSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync } from "node:fs";
5
+ import { dirname, isAbsolute, join, matchesGlob, relative, sep } from "node:path";
5
6
  import { execFileSync, spawnSync } from "node:child_process";
6
7
  import { createHash } from "node:crypto";
7
8
  import { tmpdir } from "node:os";
@@ -90,16 +91,77 @@ function describeAllowance(policy) {
90
91
  //#endregion
91
92
  //#region src/guardrails/revisions.ts
92
93
  const DIRECTORY_LINK = process.platform === "win32" ? "junction" : "dir";
93
- function linkDependencies(root, worktree) {
94
+ /** The parsed manifest of each tracked package of `checkout`, keyed by its directory; an unreadable manifest is left out. */
95
+ function workspaceManifests(checkout) {
96
+ const manifests = /* @__PURE__ */ new Map();
97
+ for (const file of trackedManifests(checkout)) try {
98
+ manifests.set(dirname(file), parseManifest(readFileSync(join(checkout, file), "utf8")));
99
+ } catch {
100
+ continue;
101
+ }
102
+ return manifests;
103
+ }
104
+ /** Maps each named package directory of the checkout to its package in `worktree`: the same directory when it holds a package of that name, otherwise the only package of that name. */
105
+ function ownPackages(root, worktree) {
106
+ const atRevision = workspaceManifests(worktree);
107
+ const byName = /* @__PURE__ */ new Map();
108
+ for (const [directory, { name }] of atRevision) if (name !== void 0) byName.set(name, [...byName.get(name) ?? [], directory]);
109
+ const packages = /* @__PURE__ */ new Map();
110
+ for (const [directory, { name }] of workspaceManifests(root)) {
111
+ if (name === void 0) continue;
112
+ const named = byName.get(name) ?? [];
113
+ if (atRevision.get(directory)?.name === name) packages.set(directory, directory);
114
+ else if (named.length === 1) packages.set(directory, named[0]);
115
+ }
116
+ return packages;
117
+ }
118
+ /** The worktree path standing in for `real`, a path relative to the checkout, when it is a workspace package of the checkout or lies inside one other than the root package, and the revision has a package of that name. */
119
+ function ownCopy(real, packages) {
120
+ const posix = real.split(sep).join("/") || ".";
121
+ if (isAbsolute(real) || posix.split("/").some((part) => part === ".." || part === "node_modules")) return void 0;
122
+ const owner = [...packages.keys()].filter((directory) => posix === directory || posix.startsWith(`${directory}/`)).sort((a, b) => b.length - a.length)[0];
123
+ return owner === void 0 ? void 0 : join(packages.get(owner) ?? owner, posix.slice(owner.length));
124
+ }
125
+ /** Mirrors `path`, a `node_modules`, scope or `.bin` directory of the checkout, into the worktree entry by entry: an entry whose real location is a workspace package of the checkout links to the worktree's package of that name, and every other entry to the checkout's installed one. */
126
+ function mirrorInstalled(installed, path) {
127
+ const { root, realRoot, worktree, packages } = installed;
128
+ mkdirSync(join(worktree, path));
129
+ for (const entry of readdirSync(join(root, path))) {
130
+ const source = join(root, path, entry);
131
+ const target = join(worktree, path, entry);
132
+ if (!existsSync(source) || lstatSync(target, { throwIfNoEntry: false }) !== void 0) continue;
133
+ const directory = statSync(source).isDirectory();
134
+ if (directory && (entry === ".bin" || entry.startsWith("@"))) {
135
+ mirrorInstalled(installed, join(path, entry));
136
+ continue;
137
+ }
138
+ const real = realpathSync(source);
139
+ const own = ownCopy(relative(realRoot, real), packages);
140
+ const type = directory ? DIRECTORY_LINK : "file";
141
+ if (own !== void 0) symlinkSync(join(worktree, own), target, type);
142
+ else if (directory) symlinkSync(source, target, DIRECTORY_LINK);
143
+ else if (lstatSync(source).isSymbolicLink()) symlinkSync(real, target, type);
144
+ else copyFileSync(source, target);
145
+ }
146
+ }
147
+ /** Links the checkout's installed dependencies into `worktree`; with `ownWorkspace`, a dependency on a workspace package resolves to the worktree's own revision of it instead of the checkout's. */
148
+ function linkDependencies(root, worktree, ownWorkspace) {
94
149
  const directories = /* @__PURE__ */ new Set([".", ...trackedManifests(root).map(dirname)]);
150
+ const installed = {
151
+ root,
152
+ realRoot: realpathSync(root),
153
+ worktree,
154
+ packages: ownWorkspace ? ownPackages(root, worktree) : /* @__PURE__ */ new Map()
155
+ };
95
156
  for (const directory of directories) {
96
- const source = join(root, directory, "node_modules");
97
- const target = join(worktree, directory, "node_modules");
98
- if (existsSync(source) && existsSync(dirname(target)) && !existsSync(target)) symlinkSync(source, target, DIRECTORY_LINK);
157
+ const path = join(directory, "node_modules");
158
+ if (!existsSync(join(root, path)) || !existsSync(join(worktree, directory)) || lstatSync(join(worktree, path), { throwIfNoEntry: false }) !== void 0) continue;
159
+ if (ownWorkspace) mirrorInstalled(installed, path);
160
+ else symlinkSync(join(root, path), join(worktree, path), DIRECTORY_LINK);
99
161
  }
100
162
  }
101
163
  /** Compares isolated committed revisions and removes both worktrees even when compilation fails; a policy lets matching `@internal` additions through. */
102
- function compareRevisions(root, baseRef, label, emit, policy) {
164
+ function compareRevisions(root, baseRef, label, emit, { policy, ownWorkspace = false } = {}) {
103
165
  const temporary = mkdtempSync(join(tmpdir(), "antelope-proof-"));
104
166
  const worktrees = [];
105
167
  const results = [];
@@ -136,7 +198,7 @@ function compareRevisions(root, baseRef, label, emit, policy) {
136
198
  ]
137
199
  });
138
200
  worktrees.push(worktree);
139
- linkDependencies(root, worktree);
201
+ linkDependencies(root, worktree, ownWorkspace);
140
202
  const output = join(temporary, side);
141
203
  mkdirSync(output, { recursive: true });
142
204
  results.push(emit(worktree, output, join(temporary, "emit", side)));
@@ -276,4 +338,4 @@ function stampProof(root, command, baseRef, output) {
276
338
  return `${text}<!-- antelopejs-proof base=${stamp.base} head=${stamp.head} lines=${proofLines(lines).length} digest=${proofDigest(stamp, lines)} command: ${command} -->\n`;
277
339
  }
278
340
  //#endregion
279
- export { DIRECTORY_LINK as a, revisionCounts as c, describeAllowance as d, fillStars as f, stampProof as i, allowedByGlob as l, proofDigest as n, compareRevisions as o, recordVerdict as p, proofLines as r, revisionCountRows as s, parseProofStamp as t, createAddedPolicy as u };
341
+ export { DIRECTORY_LINK as a, revisionCounts as c, createAddedPolicy as d, describeAllowance as f, stampProof as i, workspaceManifests as l, recordVerdict as m, proofDigest as n, compareRevisions as o, fillStars as p, proofLines as r, revisionCountRows as s, parseProofStamp as t, allowedByGlob as u };
@@ -1,9 +1,9 @@
1
1
  import { a as formatCeilings, c as parseCeilings, n as MAX_FILE_BYTES, o as isPackRelease, s as isRetired, t as CEILINGS_FILE } from "./ceilings-B7KayYIG.mjs";
2
2
  import { n as renamedPaths, t as readCarriedCeilings } from "./renames-L2owF5GD.mjs";
3
- import { s as toolingVersions } from "./package-CqqBgE8Y.mjs";
3
+ import { c as toolingVersions } from "./package-Dn7VTFUW.mjs";
4
4
  import { n as authoredSizes, o as isAgentFile, r as changedFiles, t as LINT_CONFIG } from "./files-DJ0TeaTU.mjs";
5
5
  import { t as lintDiagnostics } from "./oxlint-DIV-lLSS.mjs";
6
- import "./suppression-budget-C0SkPO5R.mjs";
6
+ import "./suppression-budget-Dvb_IqBo.mjs";
7
7
  import { n as sizeFailure } from "./size-DBatLT-F.mjs";
8
8
  import { copyFileSync, existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
9
9
  import { dirname, join } from "node:path";
@@ -20,7 +20,10 @@ import { tmpdir } from "node:os";
20
20
  const PACK_NEW_RULES = /* @__PURE__ */ new Map([
21
21
  ["antelopejs/no-inherited-key-lookup", "0.2.17"],
22
22
  ["antelopejs/no-presence-only-type-guard", "0.2.17"],
23
+ ["antelopejs/no-read-then-insert", "0.5.1"],
24
+ ["antelopejs/no-unsafe-object-assign", "0.4.2"],
23
25
  ["antelopejs/require-tsconfig-include", "0.2.18"],
26
+ ["antelopejs/require-tsconfig-types", "0.4.2"],
24
27
  ["typescript/no-unnecessary-type-parameters", "0.2.17"],
25
28
  ["typescript/no-unsafe-argument", "0.2.17"],
26
29
  ["typescript/no-unsafe-assignment", "0.2.17"],
@@ -123,20 +126,20 @@ function revisionEntries(root, revision) {
123
126
  }
124
127
  return entries;
125
128
  }
126
- /** Links the `node_modules` of the repository root and of each tracked package into `tree`, so the checkout resolves dependencies as the real one does. */
127
- function linkModules(root, tree, env) {
128
- const manifests = git(root, [
129
+ /** Links each entry a `.gitignore` of the working tree ignores, such as `node_modules` or a generated tsconfig a tracked one extends, into `tree`, so the checkout loads its configuration and resolves dependencies as the real one does, while its own `.gitignore` keeps a whole-tree lint off them. */
130
+ function linkIgnored(root, tree) {
131
+ const entries = git(root, [
129
132
  "ls-files",
130
133
  "-z",
131
- "--",
132
- "package.json",
133
- ":(glob)**/package.json"
134
- ], env).split("\0").filter(Boolean);
135
- for (const manifest of manifests) {
136
- const directory = dirname(manifest);
137
- const modules = join(root, directory, "node_modules");
138
- const target = join(tree, directory, "node_modules");
139
- if (existsSync(modules) && !existsSync(target)) symlinkSync(modules, target, "dir");
134
+ "--others",
135
+ "--ignored",
136
+ "--exclude-per-directory=.gitignore",
137
+ "--directory"
138
+ ], {}).split("\0").filter(Boolean);
139
+ for (const entry of entries) {
140
+ const path = entry.replace(/\/$/u, "");
141
+ const target = join(tree, path);
142
+ if (existsSync(dirname(target)) && !existsSync(target)) symlinkSync(join(root, path), target, entry.endsWith("/") ? "dir" : "file");
140
143
  }
141
144
  }
142
145
  /**
@@ -189,7 +192,7 @@ function withPreviousTree(root, revision, paths, use, { wholeIndex = false } = {
189
192
  `--prefix=${tree}/`
190
193
  ], env);
191
194
  if (wholeIndex) mkdirSync(join(tree, ".git"), { recursive: true });
192
- linkModules(root, tree, env);
195
+ linkIgnored(root, tree);
193
196
  return use(tree);
194
197
  } finally {
195
198
  rmSync(scratch, {