Files
deepseek-harness/tsdown.config.ts
T
imccyu 04af9a1df7 perf(build): generate Typert contracts without bundling for typecheck and lint
Type checks only need Host declarations and Typert-generated
declarations, but typecheck, lint, lint:fix, doc-typecheck, and the CI
typert-contracts gate rebuilt the whole Host tsdown pass, Desktop bundle
included, to obtain them. A source-only scripts/generate-typert.ts now
runs the same generator and artifact writer as the tsdown plugin, beside
Host package compilation: Typert reads only sources once the missing
@deepseek-ai/dsh-client-file-upload/types path alias exists, and
rejectBuildOutputs fails the pass when a workspace lib/ declaration
enters its program. typecheck runs as a build.ts scope that checks both
aggregates in build mode after their own face compiles.

Refs #5852
2026-10-12 11:06:49 +08:00

37 lines
1.5 KiB
TypeScript

import { defineConfig } from 'tsdown'
import { typertPlugin } from './packages/typert/generator/lib/types/tsdown-plugin.js'
import { WORKSPACE_TYPERT_FACES } from './scripts/typert-faces.ts'
function isBuildFaceClient(value: unknown): boolean {
if (value === undefined || value === 'host') return false
if (value === 'client') return true
throw new Error(`tsdown: --env.DSH_BUILD_FACE must be host or client, received ${String(value)}`)
}
/**
* The ordinary workspace build consumes JavaScript emitted by the Host
* TypeScript project and runs Typert. The Client pass selects packages that
* declare a browser bundle and lets their package-local configs emit both
* their Node loader entry and browser artifact. `apps/desktop` bundles after
* this pass (root package.json `build:lib:host`): its main bundle inlines
* workspace devDependencies from their lib/ output, and tsdown builds
* workspace members concurrently without ordering them.
*/
export default defineConfig(({ env }) => {
const client = isBuildFaceClient(env?.DSH_BUILD_FACE)
return {
workspace: client
? ['vendor/*', 'packages/*/*', 'apps/cli']
: ['vendor/*', 'packages/*/*', 'apps/cli', 'apps/desktop-host'],
entry: client ? '' : ['lib/types/{index,startup}.js'],
outDir: 'lib',
format: ['esm'],
platform: 'node',
target: 'es2024',
fixedExtension: false,
dts: false,
clean: false,
plugins: client ? [] : [typertPlugin({ mode: 'workspace', faces: WORKSPACE_TYPERT_FACES })],
}
})