@antelopejs/tooling-configs 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +38 -26
  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 +141 -14
  7. package/dist/bin/comment-proof.mjs +29 -7
  8. package/dist/bin/garden.mjs +2 -57
  9. package/dist/bin/ratchet.mjs +48 -14
  10. package/dist/bin/suppressions.mjs +3 -3
  11. package/dist/bin/sync.mjs +74 -41
  12. package/dist/bin/verify.mjs +898 -366
  13. package/dist/capture/index.d.mts +6 -1
  14. package/dist/capture/index.mjs +1 -1
  15. package/dist/{ci-workflow-37qJa9LX.mjs → ci-workflow-COJUT12b.mjs} +121 -1
  16. package/dist/eslint.d.mts +16 -3
  17. package/dist/eslint.mjs +21 -6
  18. package/dist/formal/index.d.mts +20 -4
  19. package/dist/formal/index.mjs +71 -19
  20. package/dist/{map-B23_WMGE.mjs → map-DRyYz_Fw.mjs} +20 -1
  21. package/dist/oxc/anti-slop/index.mjs +50 -55
  22. package/dist/oxc/guardrails/index.d.mts +1 -1
  23. package/dist/oxc/guardrails/index.mjs +520 -103
  24. package/dist/oxc/lint.d.mts +7 -15
  25. package/dist/oxc/lint.mjs +16 -28
  26. package/dist/{package-CqqBgE8Y.mjs → package-Dn7VTFUW.mjs} +71 -17
  27. package/dist/{proof-stamp-DDDC0J6l.mjs → proof-stamp-DLWpPwQE.mjs} +72 -10
  28. package/dist/{ratchet-Q-JXuZIX.mjs → ratchet-BTiPMqam.mjs} +17 -15
  29. package/dist/require-safety-comment-for-type-assertion-mnb0CIxa.mjs +181 -0
  30. package/dist/{scenes-DZVXkcxS.mjs → scenes-d-VQ0LOm.mjs} +4 -1
  31. package/dist/semver-BDxeEcP_.mjs +57 -0
  32. package/dist/{suppression-base-9L8dlMQK.mjs → suppression-base-Drnl6Y7F.mjs} +2 -2
  33. package/dist/{suppression-budget-C0SkPO5R.mjs → suppression-budget-Dvb_IqBo.mjs} +1 -1
  34. package/dist/{suppressions-DM60NkvL.mjs → suppressions-BroaaGJ_.mjs} +1 -1
  35. package/dist/{templates-BKZv-BRw.mjs → templates-lJBZFskp.mjs} +8 -3
  36. package/dist/type-aware-rules-DMuN6sHb.mjs +30 -0
  37. package/dist/{typescript-DAgQIAAR.mjs → typescript-BBbry7uU.mjs} +123 -27
  38. package/dist/verify/index.d.mts +60 -15
  39. package/package.json +3 -1
  40. package/dist/require-safety-comment-for-type-assertion-BBQ669kj.mjs +0 -83
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { i as parseManifest, r as packageManager } from "../package-CqqBgE8Y.mjs";
2
+ import { a as parseManifest, i as packageManager } from "../package-Dn7VTFUW.mjs";
3
3
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
4
4
  import { c as repositoryRoot, l as resolveRevision } from "../files-DJ0TeaTU.mjs";
5
- import { a as DIRECTORY_LINK, c as revisionCounts, d as describeAllowance, f as fillStars, i as stampProof, l as allowedByGlob, o as compareRevisions, p as recordVerdict, u as createAddedPolicy } from "../proof-stamp-DDDC0J6l.mjs";
6
- import { a as outputRoot, i as loadTypeScript, n as isExportPath, o as packagesAt, r as isTestSource, s as unpublishedAt, t as emitPackage } from "../typescript-DAgQIAAR.mjs";
5
+ import { a as DIRECTORY_LINK, c as revisionCounts, d as createAddedPolicy, f as describeAllowance, i as stampProof, l as workspaceManifests, m as recordVerdict, o as compareRevisions, p as fillStars, u as allowedByGlob } from "../proof-stamp-DLWpPwQE.mjs";
6
+ import { c as packagesAt, i as isTestSource, l as unpublishedAt, o as loadTypeScript, r as isExportPath, s as outputRoot, t as emitPackage } from "../typescript-BBbry7uU.mjs";
7
7
  import { createRequire } from "node:module";
8
- import { copyFileSync, cpSync, existsSync, globSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
9
- import { basename, dirname, isAbsolute, join, parse, posix, relative, resolve } from "node:path";
8
+ import { copyFileSync, cpSync, existsSync, globSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
9
+ import { basename, dirname, isAbsolute, join, parse, posix, relative, resolve, sep } from "node:path";
10
10
  import { execFileSync, spawnSync } from "node:child_process";
11
11
  import { availableParallelism, freemem } from "node:os";
12
12
  import { parseArgs } from "node:util";
@@ -197,15 +197,31 @@ function statementName(compiler, statement, source) {
197
197
  if (compiler.isFunctionDeclaration(statement) || compiler.isClassDeclaration(statement) || compiler.isInterfaceDeclaration(statement) || compiler.isTypeAliasDeclaration(statement) || compiler.isEnumDeclaration(statement) || compiler.isModuleDeclaration(statement) || compiler.isImportEqualsDeclaration(statement)) return statement.name?.getText(source) ?? "default";
198
198
  return statement.getText(source);
199
199
  }
200
- /** Prints a bundle in canonical form: top-level statements by name and object members in a fixed order. */
200
+ /** Prints a bundle in canonical form: top-level statements by name and object members in a fixed order. Statements of one name, such as merged interface blocks, which the bundler emits in an order that varies between runs, are ordered by their normalized text. Merged blocks that declare the same method therefore compare equal in either block order, though TypeScript resolves the later block's overloads first. Function declarations of one name are overloads, come first among their name, and keep their order. */
201
201
  function normalizeBundle(compiler, text) {
202
202
  const source = compiler.createSourceFile("bundle.d.ts", text, compiler.ScriptTarget.Latest, true);
203
- const statements = [...source.statements].sort((a, b) => statementName(compiler, a, source).localeCompare(statementName(compiler, b, source)));
204
- const normalized = sortDeclarationMembers(compiler, compiler.factory.updateSourceFile(source, statements), source);
205
- return compiler.createPrinter({
203
+ const normalized = sortDeclarationMembers(compiler, source, source);
204
+ const printer = compiler.createPrinter({
206
205
  removeComments: true,
207
206
  newLine: compiler.NewLineKind.LineFeed
208
- }).printFile(normalized);
207
+ });
208
+ const keyed = source.statements.map((statement, index) => {
209
+ const node = normalized.statements[index];
210
+ return {
211
+ node,
212
+ name: statementName(compiler, statement, source),
213
+ overload: compiler.isFunctionDeclaration(statement),
214
+ text: printer.printNode(compiler.EmitHint.Unspecified, node, normalized)
215
+ };
216
+ });
217
+ keyed.sort((a, b) => {
218
+ const byName = a.name.localeCompare(b.name);
219
+ if (byName !== 0) return byName;
220
+ if (a.overload !== b.overload) return a.overload ? -1 : 1;
221
+ if (a.overload || a.text === b.text) return 0;
222
+ return a.text < b.text ? -1 : 1;
223
+ });
224
+ return printer.printFile(compiler.factory.updateSourceFile(normalized, keyed.map(({ node }) => node)));
209
225
  }
210
226
  //#endregion
211
227
  //#region src/guardrails/auto-imports.ts
@@ -274,7 +290,7 @@ function compilerOptions(compiler, moduleRoot) {
274
290
  };
275
291
  if (existsSync(config)) {
276
292
  const read = compiler.readConfigFile(config, compiler.sys.readFile);
277
- const parsed = compiler.parseJsonConfigFileContent(read.config ?? {}, compiler.sys, moduleRoot);
293
+ const parsed = compiler.parseJsonConfigFileContent(read.config ?? {}, compiler.sys, moduleRoot, void 0, config);
278
294
  return {
279
295
  ...parsed.options,
280
296
  ...scan,
@@ -499,14 +515,41 @@ function testEntryNotice(half, directory, target) {
499
515
  //#endregion
500
516
  //#region src/guardrails/runtime-diff.ts
501
517
  const DESCRIBE = `
502
- const { readFileSync, existsSync } = require("node:fs");
503
- const { dirname, join, extname } = require("node:path");
518
+ const { readFileSync, writeFileSync, existsSync, realpathSync } = require("node:fs");
519
+ const { dirname, join, extname, sep } = require("node:path");
504
520
  const { pathToFileURL } = require("node:url");
505
- const file = process.argv[2];
521
+ const [file, destination] = process.argv.splice(2);
506
522
  let directory = dirname(file);
507
523
  while (!existsSync(join(directory, "package.json")) && dirname(directory) !== directory) directory = dirname(directory);
508
524
  const manifest = existsSync(join(directory, "package.json")) ? JSON.parse(readFileSync(join(directory, "package.json"), "utf8")) : {};
509
525
  const esm = extname(file) === ".mjs" || (extname(file) === ".js" && manifest.type === "module");
526
+ let description;
527
+ let failed = false;
528
+ process.on("uncaughtExceptionMonitor", () => { failed = true; });
529
+ process.on("exit", code => {
530
+ if (failed) return;
531
+ const recorded = description ?? { kind: esm ? "esm" : "cjs" };
532
+ writeFileSync(destination, JSON.stringify(code === 0 && description ? recorded : { ...recorded, exit: code }));
533
+ });
534
+ const Module = require("node:module");
535
+ const aliases = Object.entries(manifest.antelopeJs?.paths ?? {}).map(([key, values]) => ({
536
+ key: key.replace(/\\*$/, ""),
537
+ values: values.map(value => join(directory, manifest.antelopeJs.baseUrl ?? "", value.replace(/\\*$/, ""))),
538
+ }));
539
+ const packageDirectories = [directory, realpathSync(directory)];
540
+ const resolveFilename = Module._resolveFilename;
541
+ Module._resolveFilename = function (request, parent, ...rest) {
542
+ const caller = parent?.filename ?? "";
543
+ if (packageDirectories.some(root => caller.startsWith(root + sep)) && !caller.includes(sep + "node_modules" + sep))
544
+ for (const { key, values } of aliases)
545
+ if (request.startsWith(key))
546
+ for (const value of values) {
547
+ const candidate = join(value, request.slice(key.length));
548
+ if (existsSync(candidate + ".js") || existsSync(join(candidate, "index.js")))
549
+ return resolveFilename.call(this, candidate, parent, ...rest);
550
+ }
551
+ return resolveFilename.call(this, request, parent, ...rest);
552
+ };
510
553
  const seen = new Map();
511
554
  function functionInfo(fn) {
512
555
  let constructible = true;
@@ -532,9 +575,11 @@ function properties(object, observe) {
532
575
  }
533
576
  (async () => {
534
577
  const value = esm ? await import(pathToFileURL(file).href) : require(file);
535
- process.stdout.write(JSON.stringify({ kind: esm ? "esm" : "cjs", value: valueInfo(value), properties: typeof value === "function" ? [] : properties(value, true) }));
536
- })().catch(error => { process.stderr.write(String(error.stack)); process.exitCode = 1; });
578
+ description = { kind: esm ? "esm" : "cjs", value: valueInfo(value), properties: typeof value === "function" ? [] : properties(value, true) };
579
+ })().catch(error => { failed = true; process.stderr.write(String(error.stack)); process.exitCode = 1; });
537
580
  `;
581
+ /** A file a wildcard export matches is a runtime entry only when Node loads it as JavaScript; declarations, build info and templates it also publishes are data. */
582
+ const JS_MODULE = /\.[cm]?js$/u;
538
583
  function runtimeTargets(target, entry = "exports", subpath = ".") {
539
584
  if (target == null) return [];
540
585
  if (Array.isArray(target)) return target.flatMap((value, index) => runtimeTargets(value, `${entry}/${index}`, subpath));
@@ -553,6 +598,17 @@ function runtimeTargets(target, entry = "exports", subpath = ".") {
553
598
  return runtimeTargets(value, `${entry}/${key}`, key.startsWith(".") ? key.slice(2) || "." : subpath);
554
599
  });
555
600
  }
601
+ /** The regular files below `directory`, following a directory link unless it leads back to a directory the walk is already inside, so a dependency linked back to its own package cannot loop the walk. */
602
+ function filesUnder(directory, ancestors = /* @__PURE__ */ new Set()) {
603
+ const real = realpathSync(directory);
604
+ if (ancestors.has(real)) return [];
605
+ const inside = new Set(ancestors).add(real);
606
+ return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
607
+ const path = join(directory, entry.name);
608
+ if (entry.isDirectory() || entry.isSymbolicLink() && existsSync(path) && statSync(path).isDirectory()) return filesUnder(path, inside);
609
+ return entry.isFile() ? [path] : [];
610
+ });
611
+ }
556
612
  function builtEntries(directory, manifest) {
557
613
  const targets = runtimeTargets(manifest.exports);
558
614
  if (manifest.main) targets.push({
@@ -582,13 +638,11 @@ function builtEntries(directory, manifest) {
582
638
  const parent = dirname(prefix);
583
639
  const pattern = new RegExp(`^${resolve(directory, target).split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")).join("(.*)")}$`, "u");
584
640
  if (!existsSync(parent)) throw new Error(`${directory}: missing build output for ${target}.`);
585
- const found = readdirSync(parent, {
586
- recursive: true,
587
- withFileTypes: true
588
- }).filter((file) => file.isFile()).map((file) => join(file.parentPath, file.name)).filter((file) => pattern.test(file));
641
+ const found = filesUnder(parent).filter((file) => pattern.test(file));
589
642
  if (!found.length) throw new Error(`${directory}: missing built runtime entry ${target}.`);
590
- const matches = found.filter((file) => !isTestSource(output, file));
591
- if (matches.length < found.length) skipped.push(target);
643
+ const modules = found.filter((file) => JS_MODULE.test(file));
644
+ const matches = modules.filter((file) => !isTestSource(output, file));
645
+ if (matches.length < modules.length) skipped.push(target);
592
646
  return matches.sort().map((file) => {
593
647
  const capture = pattern.exec(file)?.[1] ?? relative(directory, file);
594
648
  return {
@@ -601,7 +655,7 @@ function builtEntries(directory, manifest) {
601
655
  skipped
602
656
  };
603
657
  }
604
- function childJson(args, cwd) {
658
+ function runChild(args, cwd) {
605
659
  const result = spawnSync(process.execPath, args, {
606
660
  cwd,
607
661
  encoding: "utf8",
@@ -614,12 +668,45 @@ function childJson(args, cwd) {
614
668
  ]
615
669
  });
616
670
  if (result.error) throw result.error;
617
- if (result.status !== 0) throw new Error(result.stderr || `Runtime child exited with ${result.status ?? result.signal}.`);
618
- return `${JSON.stringify(JSON.parse(result.stdout), null, 2)}\n`;
671
+ return result;
619
672
  }
620
- function buildPackage(directory, output, manifest, describe) {
621
- const buildManifest = parseManifest(readFileSync(join(directory, "package.json"), "utf8"));
622
- if (buildManifest.scripts?.build) execFileSync(packageManager(buildManifest), ["run", "build"], {
673
+ function childFailure(result) {
674
+ return new Error(result.stderr || `Runtime child exited with ${result.status ?? result.signal}.`);
675
+ }
676
+ function formatJson(json) {
677
+ return `${JSON.stringify(JSON.parse(json), null, 2)}\n`;
678
+ }
679
+ function childJson(args, cwd) {
680
+ const result = runChild(args, cwd);
681
+ if (result.status !== 0) throw childFailure(result);
682
+ return formatJson(result.stdout);
683
+ }
684
+ /** Describes one built entry into `destination`, away from the entry's own stdout, with the exit code of an entry that ends with a non-zero code or exits while it loads; an uncaught error is a failure. */
685
+ function describeEntry(describe, file, destination, cwd) {
686
+ rmSync(destination, { force: true });
687
+ const result = runChild([
688
+ "--unhandled-rejections=throw",
689
+ describe,
690
+ file,
691
+ destination
692
+ ], cwd);
693
+ if (!existsSync(destination)) throw childFailure(result);
694
+ writeFileSync(destination, formatJson(readFileSync(destination, "utf8")));
695
+ }
696
+ /** The package manager that builds `directory`, read like corepack reads it: from the nearest manifest between `directory` and `worktree` that declares `packageManager`, or pnpm when none does. */
697
+ function declaredPackageManager(worktree, directory) {
698
+ for (let folder = directory;; folder = dirname(folder)) {
699
+ const path = join(worktree, folder, "package.json");
700
+ if (existsSync(path)) {
701
+ const manifest = parseManifest(readFileSync(path, "utf8"));
702
+ if (manifest.packageManager !== void 0) return packageManager(manifest);
703
+ }
704
+ if (folder === ".") return packageManager({});
705
+ }
706
+ }
707
+ function runBuild(directory, manager) {
708
+ const manifest = parseManifest(readFileSync(join(directory, "package.json"), "utf8"));
709
+ if (manifest.scripts?.build) execFileSync(manager, ["run", "build"], {
623
710
  cwd: directory,
624
711
  encoding: "utf8",
625
712
  shell: process.platform === "win32",
@@ -634,6 +721,88 @@ function buildPackage(directory, output, manifest, describe) {
634
721
  "pipe"
635
722
  ]
636
723
  });
724
+ return manifest;
725
+ }
726
+ /** Builds `directory`, a workspace package a published one depends on, and returns the execution error a failed build reports. */
727
+ function buildDependency(worktree, directory) {
728
+ try {
729
+ runBuild(join(worktree, directory), declaredPackageManager(worktree, directory));
730
+ return [];
731
+ } catch (error) {
732
+ return [`Execution error: ${directory}: ${error instanceof Error ? error.message : String(error)}\n`];
733
+ }
734
+ }
735
+ /** The tracked package `name` resolves to from `directory` in `worktree`, through the installed links Node would follow. */
736
+ function installedPackage(worktree, directory, name, manifests) {
737
+ for (let at = directory;; at = dirname(at)) {
738
+ const link = join(worktree, at, "node_modules", name);
739
+ if (existsSync(link)) {
740
+ const real = relative(realpathSync(worktree), realpathSync(link)).split(sep).join("/") || ".";
741
+ return manifests.has(real) ? real : void 0;
742
+ }
743
+ if (at === ".") return void 0;
744
+ }
745
+ }
746
+ /** `published` and the tracked workspace packages they depend on, transitively, each after its dependencies, so a build resolves this revision's built output; a `devDependencies` edge that closes a cycle gives way. */
747
+ function buildOrder(worktree, published) {
748
+ const manifests = workspaceManifests(worktree);
749
+ const edges = /* @__PURE__ */ new Map();
750
+ const edgesOf = (directory) => {
751
+ const known = edges.get(directory);
752
+ if (known !== void 0) return known;
753
+ const manifest = manifests.get(directory) ?? {};
754
+ const found = [
755
+ {
756
+ field: manifest.dependencies,
757
+ development: false
758
+ },
759
+ {
760
+ field: manifest.peerDependencies,
761
+ development: false
762
+ },
763
+ {
764
+ field: manifest.optionalDependencies,
765
+ development: false
766
+ },
767
+ {
768
+ field: manifest.devDependencies,
769
+ development: true
770
+ }
771
+ ].flatMap(({ field, development }) => Object.keys(field ?? {}).flatMap((name) => {
772
+ const to = installedPackage(worktree, directory, name, manifests);
773
+ return to === void 0 || to === directory ? [] : [{
774
+ to,
775
+ development
776
+ }];
777
+ }));
778
+ edges.set(directory, found);
779
+ return found;
780
+ };
781
+ const reaches = (from, target) => {
782
+ const stack = [from];
783
+ const seen = new Set(stack);
784
+ for (let next = stack.pop(); next !== void 0; next = stack.pop()) {
785
+ if (next === target) return true;
786
+ for (const { to } of edgesOf(next)) if (!seen.has(to)) {
787
+ seen.add(to);
788
+ stack.push(to);
789
+ }
790
+ }
791
+ return false;
792
+ };
793
+ const order = [];
794
+ const visited = /* @__PURE__ */ new Set();
795
+ const visit = (directory) => {
796
+ if (visited.has(directory)) return;
797
+ visited.add(directory);
798
+ for (const { to, development } of edgesOf(directory)) if (!development || !reaches(to, directory)) visit(to);
799
+ order.push(directory);
800
+ };
801
+ for (const directory of published) visit(directory);
802
+ return order;
803
+ }
804
+ function buildPackage(directory, manager, output, manifest, describe) {
805
+ const buildManifest = runBuild(directory, manager);
637
806
  let built;
638
807
  try {
639
808
  built = builtEntries(directory, manifest);
@@ -644,9 +813,8 @@ function buildPackage(directory, output, manifest, describe) {
644
813
  const { entries, skipped } = built;
645
814
  for (const { entry, file } of entries) {
646
815
  const destination = join(output, `${encodeURIComponent(entry)}.json`);
647
- const metadata = childJson([describe, file], directory);
648
816
  mkdirSync(dirname(destination), { recursive: true });
649
- writeFileSync(destination, metadata);
817
+ describeEntry(describe, file, destination, directory);
650
818
  }
651
819
  return {
652
820
  count: entries.length,
@@ -667,10 +835,16 @@ function runtimeDiff(root, baseRef, probe, policy) {
667
835
  mkdirSync(scratch, { recursive: true });
668
836
  const describe = join(scratch, "describe.cjs");
669
837
  writeFileSync(describe, DESCRIBE);
670
- for (const { directory, manifest } of packages) {
838
+ const manifests = new Map(packages.map(({ directory, manifest }) => [directory, manifest]));
839
+ for (const directory of buildOrder(worktree, packages.map(({ directory }) => directory))) {
840
+ const manifest = manifests.get(directory);
841
+ if (manifest === void 0) {
842
+ errors.push(...buildDependency(worktree, directory));
843
+ continue;
844
+ }
671
845
  const folder = encodeURIComponent(directory).replaceAll(".", "%2E");
672
846
  try {
673
- const built = buildPackage(join(worktree, directory), join(output, folder), manifest, describe);
847
+ const built = buildPackage(join(worktree, directory), declaredPackageManager(worktree, directory), join(output, folder), manifest, describe);
674
848
  if (built === void 0) skippedPackages.add(directory);
675
849
  else {
676
850
  entries += built.count;
@@ -700,7 +874,10 @@ function runtimeDiff(root, baseRef, probe, policy) {
700
874
  entries,
701
875
  published
702
876
  };
703
- }, policy);
877
+ }, {
878
+ policy,
879
+ ownWorkspace: true
880
+ });
704
881
  return {
705
882
  different: result.different || errors.length > 0,
706
883
  output: (errors.length && !result.different ? result.output.replace(/^Runtime API:[^\n]*\n/u, "Runtime API: comparison incomplete due to execution errors.\n") : result.output) + [...skippedPackages].map((directory) => `Runtime API: skipped ${directory}, which has no build script and no committed runtime entry.\n`).join("") + [...skippedTests].sort().join("") + errors.join("")
@@ -773,7 +950,7 @@ function authoredDeclaration(directory, target, path, scratch) {
773
950
  }
774
951
  function publishedEntries(directory, manifest, emitted, scratch) {
775
952
  const outputRoot = resolve(directory, emitted.options.outDir ?? ".");
776
- const files = emitted.files.map((file) => relative(scratch, file).split("\\").join("/"));
953
+ const files = [...emitted.files, ...emitted.withheld].map((file) => relative(scratch, file).split("\\").join("/"));
777
954
  const entries = [];
778
955
  const skipped = [];
779
956
  for (const { entry, target, subpath } of entryPatterns(manifest)) {
@@ -815,17 +992,37 @@ function bundleDependencies(directory, scratch) {
815
992
  }
816
993
  symlinkSync(join(current, "node_modules"), join(scratch, "node_modules"), DIRECTORY_LINK);
817
994
  }
995
+ /** The emit mirrors its source root into `scratch`, so each `paths` target under that root is pointed at the emitted declarations rather than the worktree's sources, which lie outside the bundle's `rootDir`. */
996
+ function emittedPaths(emitted, scratch) {
997
+ const [module] = emitted.modules;
998
+ if (emitted.paths === void 0 || module === void 0) return void 0;
999
+ const [file, source] = module;
1000
+ const depth = relative(scratch, dirname(file)).split(sep).filter(Boolean).length;
1001
+ let sourceRoot = dirname(source);
1002
+ for (let level = 0; level < depth; level += 1) sourceRoot = dirname(sourceRoot);
1003
+ return Object.fromEntries(Object.entries(emitted.paths).map(([key, targets]) => [key, targets.map((target) => {
1004
+ const inner = relative(sourceRoot, target);
1005
+ return inner.startsWith(`..${sep}`) || isAbsolute(inner) ? target : join(scratch, inner);
1006
+ })]));
1007
+ }
818
1008
  /** dts-bundle-generator 9 remaps a .d.mts/.d.cts root twice; a source-named copy preserves its declaration text. */
819
1009
  function generatorEntry(file) {
820
1010
  const alias = file.replace(/\.d\.([cm]ts)$/u, ".$1");
821
1011
  if (alias !== file) copyFileSync(file, alias);
822
1012
  return alias;
823
1013
  }
1014
+ /** The published entries, failing first on the declaration errors of the modules they reach, so a module whose declaration TypeScript withheld is reported by its own diagnostic. */
1015
+ function publishedDeclarationEntries({ directory, scratch }, manifest, emitted) {
1016
+ const published = publishedEntries(directory, manifest, emitted, scratch);
1017
+ const errors = emitted.declarationErrors(published.entries.map(({ file }) => emitted.modules.get(resolve(scratch, file)) ?? join(directory, file.replace(/^\.published\//u, ""))));
1018
+ if (errors) throw new Error(errors);
1019
+ return published;
1020
+ }
824
1021
  function bundlePackage(paths, manifest, policy, notices) {
825
1022
  const { directory, output, scratch } = paths;
826
1023
  const emitted = emitPackage(directory, scratch, true);
827
1024
  if (emitted.notice !== void 0) notices?.add(emitted.notice);
828
- const { entries, skipped } = publishedEntries(directory, manifest, emitted, scratch);
1025
+ const { entries, skipped } = publishedDeclarationEntries(paths, manifest, emitted);
829
1026
  if (!entries.length) return {
830
1027
  count: 0,
831
1028
  published: [],
@@ -840,7 +1037,8 @@ function bundlePackage(paths, manifest, policy, notices) {
840
1037
  composite: false,
841
1038
  incremental: false,
842
1039
  noEmit: false,
843
- rootDir: scratch
1040
+ rootDir: scratch,
1041
+ paths: emittedPaths(emitted, scratch)
844
1042
  },
845
1043
  files: entries.map(({ file }) => join(scratch, file)),
846
1044
  include: []
@@ -917,7 +1115,7 @@ function declarationDiff(root, baseRef, policy) {
917
1115
  entries,
918
1116
  published
919
1117
  };
920
- }, policy);
1118
+ }, { policy });
921
1119
  return {
922
1120
  different: result.different || errors.size > 0,
923
1121
  output: (errors.size > 0 && !result.different ? result.output.replace(/^API:[^\n]*\n/u, "API: comparison incomplete due to execution errors.\n") : result.output) + [...unpublished].sort(([a], [b]) => a.localeCompare(b)).map(([directory, reason]) => `API: skipped ${directory}, ${reason}.\n`).join("") + [...skippedTests].sort().join("") + [...notices].sort().join("") + [...errors].join("")
@@ -2,7 +2,7 @@
2
2
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
3
3
  import { c as repositoryRoot, l as resolveRevision } from "../files-DJ0TeaTU.mjs";
4
4
  import { t as lintDiagnostics } from "../oxlint-DIV-lLSS.mjs";
5
- import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-DDDC0J6l.mjs";
5
+ import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-DLWpPwQE.mjs";
6
6
  import { readFileSync } from "node:fs";
7
7
  import { spawnSync } from "node:child_process";
8
8
  import { parseArgs } from "node:util";
@@ -228,23 +228,26 @@ function outsideProblems(lines) {
228
228
  return reference ? [`line ${line.number}: \`${reference[0]}\` sits in a findings-left section outside an antelopejs-findings block. Print the list with \`antelopejs-body-check --findings\`, copy its block, and give each finding its reason.`] : [];
229
229
  });
230
230
  }
231
+ function suppressionTable(lines) {
232
+ const texts = lines.map(({ text }) => text.trim());
233
+ const header = texts.findIndex((text) => SUPPRESSION_HEADER.test(text));
234
+ if (header === -1) return void 0;
235
+ const end = texts.findIndex((text, index) => index > header && !text.startsWith("|"));
236
+ return texts.slice(header + 1, end === -1 ? void 0 : end);
237
+ }
231
238
  function tableRows(lines) {
232
239
  const rows = /* @__PURE__ */ new Map();
233
- for (const { text } of lines) {
234
- const cells = text.trim().replace(/^\|/u, "").replace(/\|$/u, "").split("|").map((cell) => cell.trim());
240
+ for (const line of lines) {
241
+ const cells = line.trim().replace(/^\|/u, "").replace(/\|$/u, "").split("|").map((cell) => cell.trim());
235
242
  if (cells.length === 3 && /^\d+$/u.test(cells[1])) rows.set(cells[0], `${cells[1]} | ${cells[2]}`);
236
243
  }
237
244
  return rows;
238
245
  }
239
246
  function suppressionProblems(root, block, rerun) {
240
- if (!block.lines.some(({ text }) => SUPPRESSION_HEADER.test(text.trim()))) return [];
241
- const base = block.stamp?.base ?? "HEAD";
242
- const copied = tableRows(block.lines);
243
- const current = tableRows(revisionCountRows(root, base).map((text) => ({
244
- number: 0,
245
- text,
246
- inFindingsSection: false
247
- })));
247
+ const table = suppressionTable(block.lines);
248
+ if (table === void 0) return [];
249
+ const copied = tableRows(table);
250
+ const current = tableRows(revisionCountRows(root, block.stamp?.base ?? "HEAD"));
248
251
  return [.../* @__PURE__ */ new Set([...copied.keys(), ...current.keys()])].flatMap((label) => copied.get(label) === current.get(label) ? [] : [`line ${block.start}: suppression row ${label} reads ${copied.get(label) ?? "nothing"}, which no longer matches HEAD (${current.get(label) ?? "no row"}). ${rerun}`]);
249
252
  }
250
253
  function sharesBase(root, stampBase, base) {