-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathtsup.config.ts
More file actions
53 lines (51 loc) · 1.64 KB
/
tsup.config.ts
File metadata and controls
53 lines (51 loc) · 1.64 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
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "tsup";
const here = fileURLToPath(new URL(".", import.meta.url));
// Resolve "ink" imports inside the CLI bundle to our cell-diff renderer's
// shim. The real "ink" package never makes it into dist/cli; everything that
// imports Box / Text / Static / useApp / useInput / useStdout / render flows
// through src/renderer/ink-compat. Library + dashboard bundles are unchanged.
const inkCompatPath = resolve(here, "src/renderer/ink-compat/index.ts");
export default defineConfig([
{
entry: ["src/index.ts"],
format: ["esm"],
dts: true,
clean: true,
sourcemap: true,
target: "node22",
outDir: "dist",
},
{
entry: ["src/cli/index.ts"],
format: ["esm"],
dts: false,
clean: false,
sourcemap: true,
target: "node22",
outDir: "dist/cli",
banner: { js: "#!/usr/bin/env node" },
// Force the CLI bundle to inline "ink" + anything that depends on it so
// the alias actually fires. Without noExternal, tsup keeps "ink" as a
// literal external import and node would resolve it to the real
// package at runtime; ink-text-input's internal `from "ink"` would
// also slip past the alias.
noExternal: ["ink", "ink-text-input"],
esbuildOptions(options) {
options.alias = { ...(options.alias ?? {}), ink: inkCompatPath };
},
},
{
entry: { app: "dashboard/app.js" },
format: ["esm"],
dts: false,
clean: true,
sourcemap: true,
target: "es2022",
platform: "browser",
outDir: "dashboard/dist",
noExternal: [/.*/],
splitting: false,
},
]);