Skip to content

Commit a4c43b0

Browse files
committed
fix(scripts): route the census transpile through transpileChecked (#14957)
`check:parse-guard` caught a raw `ts.transpileModule` in the generator. The raw call reports NOTHING on a source it could not read and still returns an `outputText`, so an unparseable module would have been evaluated as whatever survived and the census would have scored the tree against wreckage — with a clean exit and a smaller, confident number. That is this artefact's own failure class one layer down, so the fix is the sanctioned wrapper rather than a diagnostics flag: `transpileChecked` forces `reportDiagnostics: true` and refuses instead of emitting. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk
1 parent 5629e6f commit a4c43b0

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

scripts/platform-object-tenancy-census.mjs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ import { createRequire } from 'node:module';
111111
import { dirname, join, resolve } from 'node:path';
112112
import { fileURLToPath } from 'node:url';
113113

114-
import ts from 'typescript';
115-
116114
import { isEntrypoint } from './invoked-as.mjs';
115+
import { transpileChecked } from './ts-parse.mjs';
117116

118117
const ROOT = join(fileURLToPath(new URL('.', import.meta.url)), '..');
119118

@@ -219,9 +218,13 @@ export function createSourceLoader(root = ROOT) {
219218
const hit = cache.get(file);
220219
if (hit) return hit.exports;
221220
const source = readFileSync(file, 'utf8');
222-
const js = ts.transpileModule(source, {
223-
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022 },
224-
fileName: file,
221+
// `transpileChecked`, never a raw `ts.transpileModule`: the raw call reports
222+
// NOTHING on a source it could not read and still returns an `outputText`,
223+
// so an unparseable module would be evaluated as whatever survived and the
224+
// census would score the tree against wreckage with a clean exit. That is
225+
// this artefact's own failure class one layer down (`check-parse-guard`).
226+
const js = transpileChecked(file, source, {
227+
compilerOptions: { module: 'commonjs', target: 'es2022' },
225228
}).outputText;
226229
const mod = { exports: {} };
227230
// Seeded BEFORE evaluation so an import cycle sees the partial module the

0 commit comments

Comments
 (0)