check:changed reads tsconfig.json as plain JSON and loads TypeScript only for one with comments: loading it took most of the plan's time on a busy machine. Version 98 of shared· speed· Oct 10 (2026-10-10 16:03 UTC) · Not checked
Version 97 · Files at version 98
1 file, 16 lines added, 2 removed.
--- a/scripts/check-changed.mjs
+++ b/scripts/check-changed.mjs
@@ -15,10 +15,10 @@
15 15 // A change to setup (package.json, the lockfile, tsconfig.json, abso.json, biome.json) runs the full check. 16 16 import { spawn, spawnSync } from "node:child_process"; 17 17 import { mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs"; 18 + import { createRequire } from "node:module"; 18 19 import { availableParallelism } from "node:os"; 19 20 import { dirname, extname, join, matchesGlob, relative, resolve, sep } from "node:path"; 20 21 import { fileURLToPath } from "node:url"; 21 − import ts from "typescript";
23 23 const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); @@ -118,6 +118,20 @@
118 118 return [...files].filter(Boolean); 122 + * A tsconfig's JSON. Plain JSON is read as it is; one with comments goes through TypeScript's reader, loaded 123 + * only then, since loading TypeScript takes seconds on a busy machine. 125 + function readTsconfig(path) { 126 + const text = readFileSync(path, "utf8"); 128 + return JSON.parse(text); 130 + const ts = createRequire(join(root, "package.json"))("typescript"); 131 + return ts.parseConfigFileTextToJson(path, text).config ?? {}; 121 135 /** What the changed files reach: test files to run per test group, tsconfigs to check, files for biome. */ 122 136 export function plan(changed, files = allFiles()) { 123 137 const known = new Set(files); @@ -146,7 +160,7 @@
146 160 if (t) t.files.push(t.cwd === "." ? f : f.slice(t.cwd.length + 1)); 148 162 const typechecks = TYPECHECKS.filter((c) => { 149 − const cfg = ts.readConfigFile(join(root, c.tsconfig), (p) => readFileSync(p, "utf8")).config ?? {};
163 + const cfg = readTsconfig(join(root, c.tsconfig)); 150 164 const dir = posix(dirname(c.tsconfig)); 151 165 const inc = (cfg.include ?? ["**/*"]).map((g) => posix(join(dir, g))); 152 166 const exc = (cfg.exclude ?? []).map((g) => posix(join(dir, g)));