Profile source capture, Nix evaluation/realization, resource/query checking, and implementation builds without putting timings into immutable outputs. Keep modular repositories; bound independent capture work, snapshot jj once per observation, and retain final concurrent-edit and Git completeness checks. Compose exact resource/closure/frontend/toolchain checks as memoized Nix derivations. Preserve whole-workspace validation and the full compiler path when no checked dependency is supplied. Share canonical Nixpkgs by content, index workspace build contexts once, and narrow lock/driver/compiler inputs with conservative complete-source fallback. Batch React witness checks only when distinct source closures cannot share ambient declarations; otherwise run the original independent TypeScript checks. Seed local authoring toolchains with exact canonical fetch identities when they match the selected inputs; retain store-path inputs for overrides. Add generic correctness checks rather than permanent Reader timing/content fixtures. Verify actual Reader edits and rejection/recovery in a private workbench, preserving the original user's workbench and runtime. Query checking currently caches at resource/closure boundaries, not individual query semantic dependency boundaries. Template helper pins and reproducible fixture snapshots follow in a separate publication change.
52 lines
1.7 KiB
JavaScript
52 lines
1.7 KiB
JavaScript
import { execFileSync } from "node:child_process";
|
|
import { fileURLToPath } from "node:url";
|
|
import { measureBuild } from "./build-profile.mjs";
|
|
|
|
// Component witnesses share bindings and usually the same source graph.
|
|
// Check a bounded batch once when distinct source closures cannot supply
|
|
// ambient declarations to one another. Otherwise use the original checks.
|
|
export function checkComponentTypes({ node, tsc, work, witnesses, assets, props, packageRevision }) {
|
|
const checkTypes = (files, combined = false) =>
|
|
execFileSync(
|
|
node,
|
|
[
|
|
...(combined ? [fileURLToPath(new URL("./component-type-batch.mjs", import.meta.url))] : []),
|
|
tsc,
|
|
...(combined ? [String(files.length)] : []),
|
|
"--noEmit",
|
|
"--strict",
|
|
"--skipLibCheck",
|
|
"false",
|
|
"--target",
|
|
"es2024",
|
|
"--lib",
|
|
"es2024,dom,dom.iterable,esnext.disposable",
|
|
"--module",
|
|
"nodenext",
|
|
"--moduleResolution",
|
|
"nodenext",
|
|
"--jsx",
|
|
"react-jsx",
|
|
...files,
|
|
assets,
|
|
props,
|
|
],
|
|
{ cwd: work, stdio: combined ? "pipe" : "inherit" },
|
|
);
|
|
measureBuild("component-typecheck", { package: packageRevision, components: witnesses.length }, () => {
|
|
for (let start = 0; start < witnesses.length; start += 1000) {
|
|
const batch = witnesses.slice(start, start + 1000);
|
|
if (batch.length === 1) checkTypes(batch);
|
|
else {
|
|
try {
|
|
checkTypes(batch, true);
|
|
} catch (error) {
|
|
if (!(error.status > 0) && error.code !== "ENOBUFS") throw error;
|
|
console.error("Component batch requires independent witness checks");
|
|
for (const witness of batch) checkTypes([witness]);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|