From 1c35a625e177865ff7c851441b85af3a43c8dd72 Mon Sep 17 00:00:00 2001 From: CRT Date: Thu, 15 Oct 2026 06:36:24 +0800 Subject: [PATCH] build-node: TypeScript's own script runs under Bun (node_modules/.bin/tsc is a .exe / .cmd shim on Windows: the Windows acceptance cell packed nothing on dc387f6) --- tools/build-node.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/build-node.ts b/tools/build-node.ts index 586d863..47b69c1 100644 --- a/tools/build-node.ts +++ b/tools/build-node.ts @@ -41,8 +41,10 @@ export function buildNode(out = NODE_BUNDLE): { path: string; bytes: number } { export function buildEntry(dir = join(ROOT, 'dist')): void { const types = join(dir, 'types'); rmSync(types, { recursive: true, force: true }); - if (!statSync(join(ROOT, 'node_modules', '.bin', 'tsc'), { throwIfNoEntry: false })) throw new Error('no TypeScript in node_modules: run `bun install` first (npm pack builds the declarations with it)'); - const tsc = Bun.spawnSync([join(ROOT, 'node_modules', '.bin', 'tsc'), '-p', 'tsconfig.types.json', '--outDir', types], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' }); + // TypeScript's own script, run by Bun: node_modules/.bin/tsc is a .exe / .cmd shim on Windows + const tscJs = join(ROOT, 'node_modules', 'typescript', 'bin', 'tsc'); + if (!statSync(tscJs, { throwIfNoEntry: false })) throw new Error('no TypeScript in node_modules: run `bun install` first (npm pack builds the declarations with it)'); + const tsc = Bun.spawnSync([process.execPath, tscJs, '-p', 'tsconfig.types.json', '--outDir', types], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' }); if (tsc.exitCode !== 0) throw new Error(`tsc (declarations) failed\n${tsc.stdout.toString()}${tsc.stderr.toString()}`); if (!statSync(join(types, 'lib', 'config.d.ts'), { throwIfNoEntry: false })) throw new Error('no dist/types/lib/config.d.ts'); pruneDeclarations(types, 'lib/config.d.ts');