feat(cli): opt-in per-script codebase digests (per_script_digest) (#12267)

* feat(cli): opt-in per-script codebase digests from each script's imports

* fix(cli): digest only the tsconfig esbuild applies, with its extends chain

* perf(cli): skip codebase digests in the lockfile dedupe pass

* fix(cli): digest package.json build fields and package-resolved tsconfig bases

* fix(cli): resolve tsconfig extends exactly as esbuild does, BOM included

* fix(cli): fall through unmatched nested export conditions in tsconfig extends

* refactor(cli): hash every config of an extended tsconfig package

* fix(cli): hash every file of an extended tsconfig package, through symlinks

* style(cli): escape the BOM and sort package files in the digest

* docs(cli): note runtime-read files in the per_script_digest description
This commit is contained in:
Ruben Fiszel
2026-11-06 13:32:55 +01:00
committed by GitHub
parent 8a53808622
commit 706d1763f1
9 changed files with 818 additions and 49 deletions
+10 -7
View File
@@ -63,6 +63,7 @@ import {
} from "../../core/conf.ts";
import {
SyncCodebase,
isPerScriptDigest,
listSyncCodebases,
uncoveredBundleInputs,
} from "../../utils/codebase.ts";
@@ -451,11 +452,13 @@ export async function handleFile(
metafile: true,
}));
const endTime = performance.now();
const uncovered = uncoveredBundleInputs(
codebase,
path,
Object.keys(out.metafile?.inputs ?? {})
);
const uncovered = isPerScriptDigest(codebase)
? []
: uncoveredBundleInputs(
codebase,
path,
Object.keys(out.metafile?.inputs ?? {})
);
if (uncovered.length > 0) {
log.warnAlways(
`${path} bundles files outside codebase ${codebase.relative_path}; edits to them won't be detected as changes unless listed in extra_digest_paths: ${uncovered.join(", ")}`
@@ -569,7 +572,7 @@ export async function handleFile(
}
if (typed && codebase) {
typed.codebase = await codebase.getDigest(forceTar);
typed.codebase = await codebase.getDigest(path, forceTar);
}
// Scan for modules: folder layout (entry point inside __mod/) or flat layout
@@ -626,7 +629,7 @@ export async function handleFile(
debounce_args_to_accumulate: typed?.debounce_args_to_accumulate,
max_total_debouncing_time: typed?.max_total_debouncing_time,
max_total_debounces_amount: typed?.max_total_debounces_amount,
codebase: await codebase?.getDigest(forceTar),
codebase: await codebase?.getDigest(path, forceTar),
timeout: nonePositiveInt(typed?.timeout),
// 0 means "delete immediately after completion", so it must survive as 0
// rather than being folded into "unset" the way the positive-only settings are.