forked from Mars-Sea/dsh-commandcode-provider
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
64 lines (61 loc) · 2.19 KB
/
Copy pathtsdown.config.ts
File metadata and controls
64 lines (61 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { defineConfig } from 'tsdown'
/**
* Self-contained build for the published bundle: transpile src/ to ESM under
* lib/ without project references or type checking (the reference pattern for
* out-of-tree dsh bundles). Peer packages stay external.
*
* The second config emits the browser client bundle (lib/client.js) from
* src/client/index.ts. The host's client-modules scanner loads any bundle
* that declares `dsh.client` + `exports["./client"]`; the artifact must call
* `window.__ModuleLoader__.load({ id, factory })` — the same handoff shape the
* harness's own client packages emit (see clientBundle() in the harness
* packages/client/tsdown.client.ts). The client half only imports
* `@deepseek-ai/cordis` (a platform module resolved from the loader's module
* table at runtime), so it stays external here too.
*/
const lib = defineConfig({
entry: ['src/index.ts'],
format: ['esm'],
target: 'node22',
outDir: 'lib',
clean: true,
sourcemap: true,
dts: true,
outExtension: () => ({ js: '.js', dts: '.d.ts' }),
external: [
'@deepseek-ai/cordis',
'@deepseek-ai/schemastery',
'@deepseek-ai/dsh-llm',
'@deepseek-ai/dsh-credentials',
'@deepseek-ai/dsh-launch-environment',
'@deepseek-ai/dsh-settings',
'@deepseek-ai/dsh-typert-protocol',
'@deepseek-ai/dsh-web',
],
})
const client = defineConfig({
entry: { client: 'src/client/index.ts' },
outDir: 'lib',
format: 'cjs',
platform: 'browser',
target: 'es2022',
sourcemap: true,
dts: false,
clean: false,
// Only platform/seed modules and host-shipped client bundles are resolvable
// from the loader's module table at runtime; anything else must stay
// external (a cross-plugin value import would be a build error upstream).
external: [
'@deepseek-ai/cordis',
'react',
'react/jsx-runtime',
'@deepseek-ai/dsh-client-ui-primitives',
],
outputOptions: {
entryFileNames: 'client.js',
banner: `window.__ModuleLoader__.load({ id: ${JSON.stringify('@mars-sea/dsh-commandcode-provider')}, factory: (require) => {`,
footer: 'return module.exports; } });',
intro: 'var module = { exports: {} }; var exports = module.exports;',
},
})
export default [lib, client]