Files
marqdo-app-harness/tsdown.config.ts
T
cflmy 2d4eef4fe0 fork: establish the Marqdo Harness downstream baseline
- keep the full DSH history, MIT license and third-party notices;
- remove upstream publish/upload/desktop packaging workflows so downstream
  CI cannot trigger official credentials or channels;
- exclude the downstream `packages/marqdo/*` packages from the upstream
  bundling graph (they run as TypeScript through Node's type stripping);
- declare app-boot's production peer for the deployed launcher;
- document the product architecture, gates, upstream policy, modification
  log and the M0/M1-M6 evidence.

Upstream: deepseek-harness 4b399c39a6.
Part of marqdo#25 (MDH-00/MDH-02).
2026-11-28 10:41:04 +08:00

41 lines
1.9 KiB
TypeScript

import { globSync } from 'node:fs'
import { defineConfig } from 'tsdown'
import { decoratorPlugin } from './packages/typert/generator/lib/types/tsdown-plugin.js'
import { workspacePackageGlobs } from './scripts/workspace-package-globs.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 after source-only Typert generation. 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)
// Downstream Marqdo packages ship TypeScript executed by Node's native type
// stripping; they have no lib/types entry and must not enter the upstream
// bundling graph (recorded in docs/mdh/upstream-delta.md).
const packages = workspacePackageGlobs(globSync(['vendor/*/package.json', 'packages/*/*/package.json'], { cwd: import.meta.dirname }))
.filter(directory => !directory.startsWith('packages/marqdo/'))
return {
workspace: [...packages, 'apps/cli', ...client ? [] : ['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 ? [] : [decoratorPlugin()],
}
})