@antelopejs/tooling-configs 0.5.8 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -49
- package/dist/{api-CCOiLN3w.mjs → api-BQLrI_S1.mjs} +19 -2
- package/dist/bin/api-diff.mjs +155 -37
- package/dist/bin/body-check.mjs +6 -3
- package/dist/bin/check-size.mjs +1 -1
- package/dist/bin/checks.mjs +1 -1
- package/dist/bin/comment-proof.mjs +3 -5
- package/dist/bin/garden.mjs +86 -34
- package/dist/bin/lease.mjs +314 -26
- package/dist/bin/ratchet.mjs +4 -4
- package/dist/bin/readme-strip.mjs +1 -1
- package/dist/bin/suppressions.mjs +10 -6
- package/dist/bin/sync.mjs +23 -98
- package/dist/bin/triage.mjs +1 -1
- package/dist/bin/verify.mjs +1 -1
- package/dist/{checks-BC-F8bsv.mjs → checks-BefrkjiT.mjs} +729 -25
- package/dist/{docs-compat-Ft1r2sf0.mjs → docs-compat-CSljVi3O.mjs} +13 -8
- package/dist/eslint.d.mts +13 -4
- package/dist/eslint.mjs +48 -6
- package/dist/guardrails-BfGwehVj.mjs +2414 -0
- package/dist/installed-typescript-6MtIWlE4.mjs +84 -0
- package/dist/oxc/anti-slop/index.mjs +541 -34
- package/dist/oxc/guardrails/index.d.mts +1 -1
- package/dist/oxc/guardrails/index.mjs +2 -1854
- package/dist/oxc/lint.d.mts +10 -1
- package/dist/oxc/lint.mjs +13 -5
- package/dist/{oxlint-CCOJqj3d.mjs → oxlint-CkHhK5K_.mjs} +33 -11
- package/dist/{package-DnxZ2CXZ.mjs → package-DDG3YH7W.mjs} +10 -5
- package/dist/{ports-DGP6bPJy.mjs → ports-DAeEJsYh.mjs} +22 -0
- package/dist/{proof-stamp-lyD84zmj.mjs → proof-stamp-BFV7JTZT.mjs} +5 -4
- package/dist/{ratchet-SQ7vTR0i.mjs → ratchet-2FeMs1kh.mjs} +4 -3
- package/dist/{suppression-base-whhvw-IJ.mjs → suppression-base-CYaLZAq7.mjs} +2 -2
- package/dist/{suppression-budget-CtIYSoDO.mjs → suppression-budget-CPDSFg4X.mjs} +1 -1
- package/dist/{suppressions-C79kRvYI.mjs → suppressions-CxPnh4sC.mjs} +2 -2
- package/dist/{templates-Dg188oRC.mjs → templates-HG0fel2S.mjs} +1 -1
- package/dist/{type-aware-rules-DMuN6sHb.mjs → type-aware-rules-Da3769fI.mjs} +9 -1
- package/dist/{typescript--_8og8AM.mjs → typescript-CxfNxyr2.mjs} +59 -98
- package/dist/{workflow-CPcNc8KL.mjs → workflow-C-oBwL2H.mjs} +25 -1
- package/package.json +9 -5
- package/dist/bin/check-interface-ranges.d.mts +0 -1
- package/dist/bin/check-interface-ranges.mjs +0 -44
- package/dist/interface-ranges-CcVSr59f.mjs +0 -116
package/dist/bin/api-diff.mjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { o as packageManager, s as parseManifest } from "../package-
|
|
2
|
+
import { o as packageManager, s as parseManifest } from "../package-DDG3YH7W.mjs";
|
|
3
|
+
import { r as installedTypeScriptMajor, t as asInstalledCompilerReads } from "../installed-typescript-6MtIWlE4.mjs";
|
|
3
4
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
4
5
|
import { c as repositoryRoot, l as resolveRevision } from "../files-C-JJhExM.mjs";
|
|
5
6
|
import { n as shimInvocation } from "../run-command-BlFRPORx.mjs";
|
|
6
|
-
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-
|
|
7
|
-
import { c as
|
|
7
|
+
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-BFV7JTZT.mjs";
|
|
8
|
+
import { c as unpublishedAt, i as isTestSource, o as outputRoot, r as isExportPath, s as packagesAt, t as emitPackage } from "../typescript-CxfNxyr2.mjs";
|
|
8
9
|
import { createRequire } from "node:module";
|
|
9
10
|
import { copyFileSync, cpSync, existsSync, globSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
|
|
10
11
|
import { basename, dirname, isAbsolute, join, parse, posix, relative, resolve, sep } from "node:path";
|
|
11
12
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
13
|
+
import ts from "@typescript/typescript6";
|
|
12
14
|
import { availableParallelism, freemem } from "node:os";
|
|
13
15
|
import { parseArgs } from "node:util";
|
|
14
16
|
//#region src/guardrails/auto-import-globals.ts
|
|
@@ -122,7 +124,7 @@ function injectingHost(compiler, options, scanned, imports) {
|
|
|
122
124
|
//#region src/guardrails/declaration-order.ts
|
|
123
125
|
const CALL = 0;
|
|
124
126
|
const CONSTRUCT = 1;
|
|
125
|
-
const INDEX = 2;
|
|
127
|
+
const INDEX$1 = 2;
|
|
126
128
|
const CONSTRUCTOR = 3;
|
|
127
129
|
const INSTANCE = 4;
|
|
128
130
|
const STATIC = 5;
|
|
@@ -143,7 +145,7 @@ function memberKey(compiler, member, source) {
|
|
|
143
145
|
name: ""
|
|
144
146
|
};
|
|
145
147
|
if (compiler.isIndexSignatureDeclaration(member)) return {
|
|
146
|
-
rank: INDEX,
|
|
148
|
+
rank: INDEX$1,
|
|
147
149
|
name: member.parameters[0]?.type?.getText(source) ?? ""
|
|
148
150
|
};
|
|
149
151
|
return {
|
|
@@ -198,6 +200,14 @@ function statementName(compiler, statement, source) {
|
|
|
198
200
|
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";
|
|
199
201
|
return statement.getText(source);
|
|
200
202
|
}
|
|
203
|
+
/** The top-level statements of `text` in written order, each with the name `normalizeBundle` orders it by. */
|
|
204
|
+
function namedStatements(compiler, text) {
|
|
205
|
+
const source = compiler.createSourceFile("bundle.d.ts", text, compiler.ScriptTarget.Latest, true);
|
|
206
|
+
return source.statements.map((statement) => ({
|
|
207
|
+
name: statementName(compiler, statement, source),
|
|
208
|
+
text: statement.getText(source)
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
201
211
|
/** 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. */
|
|
202
212
|
function normalizeBundle(compiler, text) {
|
|
203
213
|
const source = compiler.createSourceFile("bundle.d.ts", text, compiler.ScriptTarget.Latest, true);
|
|
@@ -292,10 +302,11 @@ function compilerOptions(compiler, moduleRoot) {
|
|
|
292
302
|
if (existsSync(config)) {
|
|
293
303
|
const read = compiler.readConfigFile(config, compiler.sys.readFile);
|
|
294
304
|
const parsed = compiler.parseJsonConfigFileContent(read.config ?? {}, compiler.sys, moduleRoot, void 0, config);
|
|
305
|
+
const options = asInstalledCompilerReads(parsed.options, installedTypeScriptMajor(moduleRoot));
|
|
295
306
|
return {
|
|
296
|
-
...
|
|
307
|
+
...options,
|
|
297
308
|
...scan,
|
|
298
|
-
paths:
|
|
309
|
+
paths: options.paths ?? paths
|
|
299
310
|
};
|
|
300
311
|
}
|
|
301
312
|
return {
|
|
@@ -359,11 +370,10 @@ function describe(compiler, checker, name, exported, source) {
|
|
|
359
370
|
/** The auto-import surface of one frontend module: one sorted line per name and meaning that unimport would expose from its scanned files. Exports are read with the module's compiler, so `export *` and inferred types resolve as the frontend workspace types them. */
|
|
360
371
|
function moduleSurface(worktree, directory) {
|
|
361
372
|
const moduleRoot = join(worktree, directory);
|
|
362
|
-
const
|
|
363
|
-
const
|
|
364
|
-
const
|
|
365
|
-
const
|
|
366
|
-
const plain = compiler.createProgram([...files, ...presets.map(({ file }) => file)], options);
|
|
373
|
+
const files = scannedFiles(moduleRoot, declaredDirectories(ts, join(moduleRoot, BUILD_FILE), posix.join(directory, BUILD_FILE)));
|
|
374
|
+
const options = compilerOptions(ts, moduleRoot);
|
|
375
|
+
const presets = presetModules(ts, moduleRoot, options);
|
|
376
|
+
const plain = ts.createProgram([...files, ...presets.map(({ file }) => file)], options);
|
|
367
377
|
const scanned = new Map(files.flatMap((file) => {
|
|
368
378
|
const source = plain.getSourceFile(file);
|
|
369
379
|
return source === void 0 ? [] : [[source.fileName, source]];
|
|
@@ -379,29 +389,24 @@ function moduleSurface(worktree, directory) {
|
|
|
379
389
|
specifier: sourceSpecifier(source.fileName)
|
|
380
390
|
}))];
|
|
381
391
|
const imports = autoImports(plain.getTypeChecker(), sources);
|
|
382
|
-
const program =
|
|
392
|
+
const program = ts.createProgram(files, options, injectingHost(ts, options, scanned, imports));
|
|
383
393
|
const checker = program.getTypeChecker();
|
|
384
394
|
const lines = /* @__PURE__ */ new Set();
|
|
385
395
|
for (const file of files) {
|
|
386
396
|
const source = program.getSourceFile(file);
|
|
387
397
|
if (source === void 0) continue;
|
|
388
|
-
for (const { name, symbol } of exportedNames(checker, source)) for (const line of describe(
|
|
398
|
+
for (const { name, symbol } of exportedNames(checker, source)) for (const line of describe(ts, checker, name, symbol, source)) lines.add(line.split(worktree).join("<root>"));
|
|
389
399
|
}
|
|
390
|
-
return
|
|
391
|
-
lines: [...lines].sort(),
|
|
392
|
-
notice
|
|
393
|
-
};
|
|
400
|
+
return [...lines].sort();
|
|
394
401
|
}
|
|
395
402
|
/** Compares the names and signatures each DMS frontend module auto-imports (the exports of the directories its `dms.frontend.build.ts` declares, without `app/build/`) at the base and at committed HEAD. Undefined when neither revision has a frontend module. */
|
|
396
403
|
function autoImportDiff(root, baseRef) {
|
|
397
404
|
if ([baseRef, "HEAD"].every((ref) => moduleRoots(root, resolveRevision(root, ref)).length === 0)) return void 0;
|
|
398
|
-
const notices = /* @__PURE__ */ new Set();
|
|
399
405
|
const result = compareRevisions(root, baseRef, "Auto-imports", (worktree, output) => {
|
|
400
406
|
const directories = moduleRoots(worktree, "HEAD");
|
|
401
407
|
let entries = 0;
|
|
402
408
|
for (const directory of directories) {
|
|
403
|
-
const
|
|
404
|
-
if (notice !== void 0) notices.add(notice);
|
|
409
|
+
const lines = moduleSurface(worktree, directory);
|
|
405
410
|
const path = join(output, directory === "." ? "_root" : directory, "auto-imports.txt");
|
|
406
411
|
mkdirSync(dirname(path), { recursive: true });
|
|
407
412
|
writeFileSync(path, lines.map((line) => `${line}\n`).join(""));
|
|
@@ -414,7 +419,7 @@ function autoImportDiff(root, baseRef) {
|
|
|
414
419
|
});
|
|
415
420
|
return {
|
|
416
421
|
different: result.different,
|
|
417
|
-
output: `${result.output}${result.different ? HINT : ""}
|
|
422
|
+
output: `${result.output}${result.different ? HINT : ""}`
|
|
418
423
|
};
|
|
419
424
|
}
|
|
420
425
|
//#endregion
|
|
@@ -450,9 +455,11 @@ for (const job of jobs) {
|
|
|
450
455
|
});
|
|
451
456
|
}
|
|
452
457
|
`;
|
|
453
|
-
/** Places a copy of `dts-bundle-generator` beside a `typescript` link to the
|
|
454
|
-
function installGenerator(
|
|
455
|
-
const
|
|
458
|
+
/** Places a copy of `dts-bundle-generator` beside a `typescript` link to the pack's `@typescript/typescript6`. The generator requires `typescript` by name, and the one it was installed with may be TypeScript 7, which has no compiler API, so this makes it drive the pack's TypeScript 6. Returns a path to require the copy from. */
|
|
459
|
+
function installGenerator(scratch) {
|
|
460
|
+
const require = createRequire(import.meta.url);
|
|
461
|
+
const source = dirname(require.resolve("dts-bundle-generator/package.json"));
|
|
462
|
+
const compilerRoot = dirname(require.resolve("@typescript/typescript6/package.json"));
|
|
456
463
|
const modules = join(scratch, "generator", "node_modules");
|
|
457
464
|
mkdirSync(modules, { recursive: true });
|
|
458
465
|
cpSync(source, join(modules, "dts-bundle-generator"), {
|
|
@@ -500,14 +507,122 @@ function generateInWorkers(loader, directory, entries, options, workers) {
|
|
|
500
507
|
for (const { indices, result } of jobs) for (const [position, bundle] of JSON.parse(readFileSync(result, "utf8")).entries()) bundles[indices[position]] = bundle;
|
|
501
508
|
return bundles;
|
|
502
509
|
}
|
|
503
|
-
/** Bundles every entry's declarations with the
|
|
504
|
-
function bundleDeclarations(
|
|
505
|
-
const loader = installGenerator(
|
|
510
|
+
/** Bundles every entry's declarations with the pack's TypeScript 6. Large packages are split across worker processes by entry; each bundle depends only on its own entry, so the output is the same as one sequential call. */
|
|
511
|
+
function bundleDeclarations(scratch, entries, options, workers = workerCount(entries.length)) {
|
|
512
|
+
const loader = installGenerator(scratch);
|
|
506
513
|
if (workers > 1) return generateInWorkers(loader, join(scratch, "generator"), entries, options, workers);
|
|
507
514
|
const generate = createRequire(loader)("dts-bundle-generator").generateDtsBundle;
|
|
508
515
|
return generate(entries, options);
|
|
509
516
|
}
|
|
510
517
|
//#endregion
|
|
518
|
+
//#region src/guardrails/declaration-groups.ts
|
|
519
|
+
function entryFiles(output) {
|
|
520
|
+
return readdirSync(output, {
|
|
521
|
+
recursive: true,
|
|
522
|
+
withFileTypes: true
|
|
523
|
+
}).filter((file) => file.isFile()).map((file) => relative(output, join(file.parentPath, file.name)).split("\\").join("/")).sort();
|
|
524
|
+
}
|
|
525
|
+
function byText([a], [b]) {
|
|
526
|
+
if (a === b) return 0;
|
|
527
|
+
return a < b ? -1 : 1;
|
|
528
|
+
}
|
|
529
|
+
function collectDeclarations(compiler, output, entries) {
|
|
530
|
+
const declarations = /* @__PURE__ */ new Map();
|
|
531
|
+
for (const entry of entries) {
|
|
532
|
+
const texts = /* @__PURE__ */ new Map();
|
|
533
|
+
for (const { name, text } of namedStatements(compiler, readFileSync(join(output, entry), "utf8"))) texts.set(name, [...texts.get(name) ?? [], text]);
|
|
534
|
+
for (const [name, parts] of texts) {
|
|
535
|
+
const variants = declarations.get(name) ?? /* @__PURE__ */ new Map();
|
|
536
|
+
const text = parts.join("\n");
|
|
537
|
+
variants.set(text, [...variants.get(text) ?? [], entry]);
|
|
538
|
+
declarations.set(name, variants);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return declarations;
|
|
542
|
+
}
|
|
543
|
+
const HUNK = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/u;
|
|
544
|
+
const CARRIER = "// In ";
|
|
545
|
+
const INDEX = "// Entries";
|
|
546
|
+
const INDEXED = "// ";
|
|
547
|
+
/** Whether `text`, a line of a collated file, is a separator, an index line or a `// In` line rather than declaration text. */
|
|
548
|
+
function isLayout(text) {
|
|
549
|
+
return text === "" || text === INDEX || text.startsWith(INDEXED) || text.startsWith(CARRIER);
|
|
550
|
+
}
|
|
551
|
+
function collatedLines(output) {
|
|
552
|
+
const file = join(output, "declarations.d.ts");
|
|
553
|
+
return existsSync(file) ? readFileSync(file, "utf8").split("\n") : [];
|
|
554
|
+
}
|
|
555
|
+
/** The run of `// In` lines heading the declaration that holds `line`, a 1-based line number: its first line number and its entries joined into one `// In` line. */
|
|
556
|
+
function carrierRun(lines, line) {
|
|
557
|
+
let end = line - 1;
|
|
558
|
+
while (end >= 0 && !lines[end].startsWith(CARRIER)) end -= 1;
|
|
559
|
+
if (end < 0) return void 0;
|
|
560
|
+
let start = end;
|
|
561
|
+
while (lines[start - 1]?.startsWith(CARRIER)) start -= 1;
|
|
562
|
+
return {
|
|
563
|
+
start: start + 1,
|
|
564
|
+
label: `${CARRIER}${lines.slice(start, end + 1).map((text) => text.slice(6)).join(", ")}`
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
/** Appends `run`'s entries to the header of `hunk` when the run lies above it and no earlier hunk showed or named it, and records the run as named. */
|
|
568
|
+
function labelHunk(lines, hunk, mark, run, labelled) {
|
|
569
|
+
if (run === void 0) return;
|
|
570
|
+
const key = `${mark}${run.start}`;
|
|
571
|
+
if (run.start < hunk.start[mark] && !labelled.has(key)) lines[hunk.header] += ` ${run.label}`;
|
|
572
|
+
labelled.add(key);
|
|
573
|
+
}
|
|
574
|
+
/** Appends to a hunk header of `diff`, a comparison of the collated `base` and `head` directories under `root`, the entries of the declaration its first changed declaration line belongs to, when the `// In` lines of that declaration lie above the hunk and no earlier hunk named them. A change far below those lines still names its entries, a hunk that changes only separators, `// In` or index lines is left as git printed it, and a declaration changed in many hunks names its entries once. */
|
|
575
|
+
function labelHunks(diff, root) {
|
|
576
|
+
const sides = {
|
|
577
|
+
"-": collatedLines(join(root, "base")),
|
|
578
|
+
"+": collatedLines(join(root, "head"))
|
|
579
|
+
};
|
|
580
|
+
const labelled = /* @__PURE__ */ new Set();
|
|
581
|
+
const lines = diff.split("\n");
|
|
582
|
+
let hunk;
|
|
583
|
+
for (const [index, line] of lines.entries()) {
|
|
584
|
+
const match = HUNK.exec(line);
|
|
585
|
+
if (match) {
|
|
586
|
+
const start = {
|
|
587
|
+
"-": Number(match[1]),
|
|
588
|
+
"+": Number(match[2])
|
|
589
|
+
};
|
|
590
|
+
hunk = {
|
|
591
|
+
header: index,
|
|
592
|
+
start,
|
|
593
|
+
next: { ...start }
|
|
594
|
+
};
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
if (hunk === void 0) continue;
|
|
598
|
+
if (line.startsWith("diff --git ")) hunk = void 0;
|
|
599
|
+
else if (line.startsWith(" ")) {
|
|
600
|
+
hunk.next["-"] += 1;
|
|
601
|
+
hunk.next["+"] += 1;
|
|
602
|
+
} else if (line.startsWith("-") || line.startsWith("+")) {
|
|
603
|
+
const mark = line.startsWith("-") ? "-" : "+";
|
|
604
|
+
const at = hunk.next[mark];
|
|
605
|
+
hunk.next[mark] += 1;
|
|
606
|
+
if (isLayout(line.slice(1))) continue;
|
|
607
|
+
labelHunk(lines, hunk, mark, carrierRun(sides[mark], at), labelled);
|
|
608
|
+
hunk = void 0;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return lines.join("\n");
|
|
612
|
+
}
|
|
613
|
+
/** Replaces the bundled entries under `output` with one `declarations.d.ts`: an index of the entries, then each declaration text once, under one `// In` line per entry that carries it, or `// In every entry`. A change shared by many entries is printed once, and an added or removed entry adds or removes one line per declaration it shares. Statements of one name are kept together in written order, so a reordered overload still differs. */
|
|
614
|
+
function collateDeclarations(compiler, output) {
|
|
615
|
+
const entries = entryFiles(output);
|
|
616
|
+
if (!entries.length) return;
|
|
617
|
+
const blocks = [...collectDeclarations(compiler, output, entries)].sort(([a], [b]) => a.localeCompare(b)).flatMap(([, variants]) => [...variants].sort(byText).map(([text, carriers]) => `${(carriers.length === entries.length ? ["every entry"] : carriers).map((carrier) => `${CARRIER}${carrier}\n`).join("")}${text}\n`));
|
|
618
|
+
rmSync(output, {
|
|
619
|
+
recursive: true,
|
|
620
|
+
force: true
|
|
621
|
+
});
|
|
622
|
+
mkdirSync(output, { recursive: true });
|
|
623
|
+
writeFileSync(join(output, "declarations.d.ts"), [`${INDEX}\n${entries.map((entry) => `${INDEXED}${entry}\n`).join("")}`, ...blocks].join("\n"));
|
|
624
|
+
}
|
|
625
|
+
//#endregion
|
|
511
626
|
//#region src/guardrails/test-entries.ts
|
|
512
627
|
/** The line a proof half prints for a published test-helper entry it leaves out, so a skip is reported rather than silent. */
|
|
513
628
|
function testEntryNotice(half, directory, target) {
|
|
@@ -1020,10 +1135,9 @@ function publishedDeclarationEntries({ directory, scratch }, manifest, emitted)
|
|
|
1020
1135
|
if (errors) throw new Error(errors);
|
|
1021
1136
|
return published;
|
|
1022
1137
|
}
|
|
1023
|
-
function bundlePackage(paths, manifest, policy
|
|
1138
|
+
function bundlePackage(paths, manifest, policy) {
|
|
1024
1139
|
const { directory, output, scratch } = paths;
|
|
1025
1140
|
const emitted = emitPackage(directory, scratch, true);
|
|
1026
|
-
if (emitted.notice !== void 0) notices?.add(emitted.notice);
|
|
1027
1141
|
const { entries, skipped } = publishedDeclarationEntries(paths, manifest, emitted);
|
|
1028
1142
|
if (!entries.length) return {
|
|
1029
1143
|
count: 0,
|
|
@@ -1036,6 +1150,7 @@ function bundlePackage(paths, manifest, policy, notices) {
|
|
|
1036
1150
|
writeFileSync(config, JSON.stringify({
|
|
1037
1151
|
extends: join(directory, "tsconfig.json"),
|
|
1038
1152
|
compilerOptions: {
|
|
1153
|
+
...emitted.defaults,
|
|
1039
1154
|
composite: false,
|
|
1040
1155
|
incremental: false,
|
|
1041
1156
|
noEmit: false,
|
|
@@ -1045,7 +1160,7 @@ function bundlePackage(paths, manifest, policy, notices) {
|
|
|
1045
1160
|
files: entries.map(({ file }) => join(scratch, file)),
|
|
1046
1161
|
include: []
|
|
1047
1162
|
}));
|
|
1048
|
-
const bundles = bundleDeclarations(
|
|
1163
|
+
const bundles = bundleDeclarations(scratch, entries.map(({ file }) => ({
|
|
1049
1164
|
filePath: generatorEntry(join(scratch, file)),
|
|
1050
1165
|
output: {
|
|
1051
1166
|
exportReferencedTypes: false,
|
|
@@ -1056,13 +1171,13 @@ function bundlePackage(paths, manifest, policy, notices) {
|
|
|
1056
1171
|
for (const [index, { entry }] of entries.entries()) {
|
|
1057
1172
|
const path = join(output, entry);
|
|
1058
1173
|
mkdirSync(dirname(path), { recursive: true });
|
|
1059
|
-
writeFileSync(path, normalizeBundle(
|
|
1174
|
+
writeFileSync(path, normalizeBundle(ts, bundles[index]));
|
|
1060
1175
|
}
|
|
1061
1176
|
if (policy !== void 0) for (const { file, subpath } of entries) {
|
|
1062
1177
|
if (!allowedByGlob(policy, subpath)) continue;
|
|
1063
1178
|
const emittedFile = join(scratch, file);
|
|
1064
1179
|
const module = emitted.modules.get(resolve(emittedFile)) ?? emittedFile;
|
|
1065
|
-
recordVerdict(policy,
|
|
1180
|
+
recordVerdict(policy, ts, {
|
|
1066
1181
|
directory: paths.name,
|
|
1067
1182
|
subpath,
|
|
1068
1183
|
module,
|
|
@@ -1081,7 +1196,6 @@ function bundlePackage(paths, manifest, policy, notices) {
|
|
|
1081
1196
|
}
|
|
1082
1197
|
function declarationDiff(root, baseRef, policy) {
|
|
1083
1198
|
const errors = /* @__PURE__ */ new Set();
|
|
1084
|
-
const notices = /* @__PURE__ */ new Set();
|
|
1085
1199
|
const failedPackages = /* @__PURE__ */ new Set();
|
|
1086
1200
|
const unpublished = /* @__PURE__ */ new Map();
|
|
1087
1201
|
const skippedTests = /* @__PURE__ */ new Set();
|
|
@@ -1099,7 +1213,7 @@ function declarationDiff(root, baseRef, policy) {
|
|
|
1099
1213
|
directory: join(worktree, directory),
|
|
1100
1214
|
output: join(output, key),
|
|
1101
1215
|
scratch: join(scratch, key)
|
|
1102
|
-
}, manifest, policy
|
|
1216
|
+
}, manifest, policy);
|
|
1103
1217
|
entries += bundled.count;
|
|
1104
1218
|
for (const target of bundled.skipped) skippedTests.add(testEntryNotice("API", directory, target));
|
|
1105
1219
|
published.push(...bundled.published);
|
|
@@ -1117,10 +1231,14 @@ function declarationDiff(root, baseRef, policy) {
|
|
|
1117
1231
|
entries,
|
|
1118
1232
|
published
|
|
1119
1233
|
};
|
|
1120
|
-
}, {
|
|
1234
|
+
}, {
|
|
1235
|
+
policy,
|
|
1236
|
+
collate: (output) => collateDeclarations(ts, output),
|
|
1237
|
+
annotate: labelHunks
|
|
1238
|
+
});
|
|
1121
1239
|
return {
|
|
1122
1240
|
different: result.different || errors.size > 0,
|
|
1123
|
-
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("") + [...
|
|
1241
|
+
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("") + [...errors].join("")
|
|
1124
1242
|
};
|
|
1125
1243
|
}
|
|
1126
1244
|
/** Compares declarations, built runtime exports and the auto-import surface of DMS frontend modules, with an optional behavioral probe captured before either build. Added entries whose subpath matches an `allowAdded` glob pass when their module is `@internal`. */
|
package/dist/bin/body-check.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot, l as resolveRevision } from "../files-C-JJhExM.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-
|
|
4
|
+
import { n as lintDiagnostics } from "../oxlint-CkHhK5K_.mjs";
|
|
5
|
+
import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-BFV7JTZT.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
@@ -333,9 +333,12 @@ function parse(args) {
|
|
|
333
333
|
runCli(() => {
|
|
334
334
|
const { base, body, findings, head } = parse(process.argv.slice(2));
|
|
335
335
|
const root = repositoryRoot();
|
|
336
|
-
if (findings) {
|
|
336
|
+
if (findings) try {
|
|
337
337
|
process.stdout.write(findingsBlock(root));
|
|
338
338
|
return 0;
|
|
339
|
+
} catch (error) {
|
|
340
|
+
process.stdout.write(formatFindings([]));
|
|
341
|
+
throw error;
|
|
339
342
|
}
|
|
340
343
|
const current = resolveRevision(root, "HEAD");
|
|
341
344
|
if (head !== void 0 && head !== current) throw new Error(`HEAD is ${current}, not the pull request head ${head}: check out the pull request head (actions/checkout with ref: \${{ github.event.pull_request.head.sha }}) before running antelopejs-body-check.`);
|
package/dist/bin/check-size.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot, n as authoredSizes, s as repositoryPath } from "../files-C-JJhExM.mjs";
|
|
4
|
-
import { l as worktreeSuppressions, o as revisionSuppressions } from "../suppressions-
|
|
4
|
+
import { l as worktreeSuppressions, o as revisionSuppressions } from "../suppressions-CxPnh4sC.mjs";
|
|
5
5
|
import { t as checkSize } from "../size-CCGLY4Ke.mjs";
|
|
6
6
|
import { realpathSync } from "node:fs";
|
|
7
7
|
import { resolve } from "node:path";
|
package/dist/bin/checks.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot } from "../files-C-JJhExM.mjs";
|
|
4
|
-
import { r as runChecks, t as CHECKS_SKIP_ENV } from "../checks-
|
|
4
|
+
import { r as runChecks, t as CHECKS_SKIP_ENV } from "../checks-BefrkjiT.mjs";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
//#region src/bin/checks.ts
|
|
7
7
|
const SIGNAL_EXIT = /* @__PURE__ */ new Map([
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot } from "../files-C-JJhExM.mjs";
|
|
4
|
-
import { c as revisionCounts, i as stampProof, o as compareRevisions } from "../proof-stamp-
|
|
5
|
-
import { a as listsNoFiles,
|
|
4
|
+
import { c as revisionCounts, i as stampProof, o as compareRevisions } from "../proof-stamp-BFV7JTZT.mjs";
|
|
5
|
+
import { a as listsNoFiles, n as extendedConfigs, s as packagesAt, t as emitPackage } from "../typescript-CxfNxyr2.mjs";
|
|
6
6
|
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
7
7
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
8
8
|
//#region src/guardrails/comment-proof.ts
|
|
@@ -21,7 +21,6 @@ function uncommittedBase(worktree, directory) {
|
|
|
21
21
|
}
|
|
22
22
|
/** Proves comment-free JavaScript emit matches, including private packages and excluding tests. A workspace base tsconfig is left out. A package whose tsconfig extends a repository file the commit lacks cannot compile from it, so it is skipped and reported; a missing base outside the repository still fails. */
|
|
23
23
|
function commentProof(root, baseRef) {
|
|
24
|
-
const notices = /* @__PURE__ */ new Set();
|
|
25
24
|
const skipped = /* @__PURE__ */ new Map();
|
|
26
25
|
const result = compareRevisions(root, baseRef, "Comment proof", (worktree, output, scratch) => {
|
|
27
26
|
const tracked = packagesAt(worktree, false);
|
|
@@ -35,7 +34,6 @@ function commentProof(root, baseRef) {
|
|
|
35
34
|
const key = directory === "." ? "_root" : directory;
|
|
36
35
|
const emittedRoot = join(scratch, key);
|
|
37
36
|
const emitted = emitPackage(join(worktree, directory), emittedRoot, false);
|
|
38
|
-
if (emitted.notice !== void 0) notices.add(emitted.notice);
|
|
39
37
|
for (const file of emitted.files) {
|
|
40
38
|
const path = join(output, key, relative(emittedRoot, file));
|
|
41
39
|
mkdirSync(dirname(path), { recursive: true });
|
|
@@ -51,7 +49,7 @@ function commentProof(root, baseRef) {
|
|
|
51
49
|
const skips = [...skipped].sort(([a], [b]) => a.localeCompare(b)).map(([directory, file]) => `Comment proof: skipped ${directory}, its tsconfig extends ${file}, which the commit does not hold.\n`).join("");
|
|
52
50
|
return {
|
|
53
51
|
...result,
|
|
54
|
-
output: stampProof(root, `antelopejs-comment-proof ${baseRef}`, baseRef, result.output + skips +
|
|
52
|
+
output: stampProof(root, `antelopejs-comment-proof ${baseRef}`, baseRef, result.output + skips + revisionCounts(root, baseRef))
|
|
55
53
|
};
|
|
56
54
|
}
|
|
57
55
|
//#endregion
|