From 0ce33089d98c970ffe9f1505255341683890ea5b Mon Sep 17 00:00:00 2001 From: imccyu Date: Fri, 23 Oct 2026 15:49:01 +0800 Subject: [PATCH] fix(build): raise Host compiler heap limit to 8 GiB --- package.json | 2 +- scripts/build.spec.ts | 10 ++++++++++ scripts/ci-workflow.spec.ts | 4 ++-- scripts/compile-referenced-projects.ts | 4 ++-- scripts/wine-windows-gates.sh | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 2ce35f4ac4..078904611d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "build:bench": "npm run build:native-system && npm run build:lib && tsdown --config-loader native --config benchmarks/tsdown.config.ts", "build:official": "tsx scripts/build.ts --profile official", "build:lib": "pnpm run build:lib:host && pnpm run build:lib:client", - "build:lib:host": "tsx scripts/compile-referenced-projects.ts host-libraries && node --max-old-space-size=4096 ./node_modules/typescript/bin/tsc -p tsconfig.host.json && pnpm --filter @deepseek-ai/dsh-desktop run bundle", + "build:lib:host": "tsx scripts/compile-referenced-projects.ts host-libraries && node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc -p tsconfig.host.json && pnpm --filter @deepseek-ai/dsh-desktop run bundle", "build:lib:client": "tsc -b tsconfig.client.json && tsdown --config-loader native --env.DSH_BUILD_FACE client", "build:web": "pnpm --filter @deepseek-ai/dsh-web-frontend run build", "build:desktop": "pnpm --filter @deepseek-ai/dsh-desktop run build", diff --git a/scripts/build.spec.ts b/scripts/build.spec.ts index 157edf8b46..f808f77de6 100644 --- a/scripts/build.spec.ts +++ b/scripts/build.spec.ts @@ -60,6 +60,16 @@ describe('repository build CLI', () => { }) describe('repository build steps', () => { + it.each(['complete', 'check', 'typecheck'] as const)('gives Host compilers an 8 GiB heap in %s scope', (scope) => { + const gates = buildGates(root, scope) + for (const gate of gates.filter(gate => gate.id === 'host-src' || gate.id === 'host-check')) { + expect(gate.args[0]).toBe('--max-old-space-size=8192') + } + for (const gate of gates.filter(gate => gate.id === 'client-src' || gate.id === 'client-check')) { + expect(gate.args.some(arg => arg.startsWith('--max-old-space-size'))).toBe(false) + } + }) + it('keeps artifact steps in serial dependency order', () => { expect(graph(buildGates(root, 'artifacts'))).toEqual(artifactGraph) }) diff --git a/scripts/ci-workflow.spec.ts b/scripts/ci-workflow.spec.ts index 637b3432bd..11fa8aeb0b 100644 --- a/scripts/ci-workflow.spec.ts +++ b/scripts/ci-workflow.spec.ts @@ -143,7 +143,7 @@ describe('CI workflow', () => { const scripts = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8')) as { scripts: Record } const hostSteps = scripts.scripts['build:lib:host']!.split(' && ') expect(hostSteps[0]).toBe('tsx scripts/compile-referenced-projects.ts host-libraries') - expect(hostSteps).toContain('node --max-old-space-size=4096 ./node_modules/typescript/bin/tsc -p tsconfig.host.json') + expect(hostSteps).toContain('node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc -p tsconfig.host.json') expect(hostSteps.at(-1)).toBe('pnpm --filter @deepseek-ai/dsh-desktop run bundle') expect(scripts.scripts['build:lib:client']).toContain('tsc -b tsconfig.client.json') expect(scripts.scripts.typecheck).toBe('tsx scripts/build.ts --scope typecheck') @@ -738,7 +738,7 @@ describe('CI workflow', () => { 'wine_node "$scratch/logs/host-references.log" --import tsx/esm scripts/compile-referenced-projects.ts host', ) const aggregate = wineGates.indexOf( - 'wine_node "$scratch/logs/host-tsc.log" --max-old-space-size=4096 "$tsc_js" -p tsconfig.host.json --pretty false', + 'wine_node "$scratch/logs/host-tsc.log" --max-old-space-size=8192 "$tsc_js" -p tsconfig.host.json --pretty false', ) const metadata = wineGates.indexOf('wine_node "$scratch/logs/host-typert.log" --import tsx/esm scripts/generate-typert.ts') expect(metadata).toBeGreaterThan(-1) diff --git a/scripts/compile-referenced-projects.ts b/scripts/compile-referenced-projects.ts index fe0751b2d3..f86d500965 100644 --- a/scripts/compile-referenced-projects.ts +++ b/scripts/compile-referenced-projects.ts @@ -48,7 +48,7 @@ export function runPnpmCommand(root: string, args: readonly string[]): void { * @param root - Repository root containing the aggregate tsconfig. * @param face - Independent compiler face whose package projects are emitted. * @param mode - Check package types by default; benchmark emission defers diagnostics to required full builds. - * @returns Arguments for `process.execPath`, including the heap limit the Host face needs. + * @returns Arguments for `process.execPath`, including an 8 GiB old-space heap limit for the Host face. * @throws If the aggregate configuration is invalid, has no references, or can emit files. */ export function referencedProjectsCompilerArgs( @@ -109,7 +109,7 @@ export function aggregateBuildArgs(face: 'host' | 'client'): string[] { } function hostHeapArgs(face: 'host' | 'client'): string[] { - return face === 'host' ? ['--max-old-space-size=4096'] : [] + return face === 'host' ? ['--max-old-space-size=8192'] : [] } /** diff --git a/scripts/wine-windows-gates.sh b/scripts/wine-windows-gates.sh index 3e2c0ef291..edd01072b5 100755 --- a/scripts/wine-windows-gates.sh +++ b/scripts/wine-windows-gates.sh @@ -253,7 +253,7 @@ grep -q '^smoke: win32 x64' "$scratch/logs/smoke.log" || { echo 'wine-windows-ga build_gate() { wine_node "$scratch/logs/host-typert.log" --import tsx/esm scripts/generate-typert.ts || return $? wine_node "$scratch/logs/host-references.log" --import tsx/esm scripts/compile-referenced-projects.ts host || return $? - wine_node "$scratch/logs/host-tsc.log" --max-old-space-size=4096 "$tsc_js" -p tsconfig.host.json --pretty false || return $? + wine_node "$scratch/logs/host-tsc.log" --max-old-space-size=8192 "$tsc_js" -p tsconfig.host.json --pretty false || return $? wine_node "$scratch/logs/host-tsdown.log" "$tsdown_js" --env.DSH_BUILD_FACE host || return $? (cd apps/desktop && wine_node "$scratch/logs/desktop-tsdown.log" "../../$tsdown_js") || return $? wine_node "$scratch/logs/client-tsc.log" "$tsc_js" -b tsconfig.client.json --pretty false || return $?