Skip to content

Commit 2b156b6

Browse files
authored
chore: migrate from tsup to tsdown (#1303)
* chore: migrate from tsup to tsdown tsup has been discontinued (https://github.com/egoist/tsup) and tsdown is the recommended replacement that is much faster. Changes: - Replace tsup with tsdown v0.18.0 dependency across all packages - Create new tsdown.config.ts files for all 8 packages - Update build scripts in package.json files - Update Dockerfile.manage-api-test to reference tsdown - Add custom rawPlugin for agents-run-api to handle ?raw XML imports - Use regex pattern for noExternal to properly bundle subpath imports - Set hash: false for predictable DTS file paths - Add outExtensions config to maintain .js/.cjs file extensions Closes: PRD-5456 * add changelog
1 parent 050f7a7 commit 2b156b6

23 files changed

+515
-212
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@inkeep/agents-cli": patch
3+
"@inkeep/agents-core": patch
4+
"@inkeep/agents-manage-api": patch
5+
"@inkeep/agents-manage-ui": patch
6+
"@inkeep/agents-run-api": patch
7+
"@inkeep/agents-sdk": patch
8+
"@inkeep/create-agents": patch
9+
"@inkeep/ai-sdk-provider": patch
10+
---
11+
12+
migrate from tsup to tsdown

Dockerfile.manage-api-test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN pnpm fetch
2121
COPY packages/agents-core/ ./packages/agents-core/
2222
COPY packages/agents-manage-mcp/ ./packages/agents-manage-mcp/
2323
COPY agents-manage-api/ ./agents-manage-api/
24-
COPY tsup.config.ts ./
24+
COPY tsdown.config.ts ./
2525

2626
# Install dependencies
2727
RUN pnpm install --frozen-lockfile --offline
@@ -33,7 +33,7 @@ WORKDIR /app/packages/agents-core
3333
RUN pnpm build
3434

3535
WORKDIR /app/packages/agents-manage-mcp
36-
RUN pnpm tsup
36+
RUN pnpm tsdown
3737

3838
WORKDIR /app/agents-manage-api
3939
RUN pnpm build

agents-cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
"./package.json": "./package.json"
1414
},
1515
"scripts": {
16-
"build": "tsup",
16+
"build": "tsdown",
1717
"cli": "node ./dist/index.js",
1818
"postinstall": "node scripts/ensure-keytar.mjs || true",
1919
"prepare": "pnpm build --no-dts",
20-
"dev": "MODE=watch tsup",
20+
"dev": "MODE=watch tsdown",
2121
"test": "node -e \"process.exit(process.env.CI ? 0 : 1)\" && vitest --run --config vitest.config.ci.ts || vitest --run",
2222
"test:debug": "vitest --run --reporter=verbose --no-coverage",
2323
"test:watch": "vitest",
@@ -78,7 +78,7 @@
7878
"@types/node": "^20.10.0",
7979
"@vitest/coverage-v8": "^3.2.4",
8080
"pino-pretty": "^13.1.1",
81-
"tsup": "^8.5.0",
81+
"tsdown": "^0.18.0",
8282
"typescript": "^5.9.2",
8383
"vitest": "^3.2.4"
8484
},
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig } from 'tsup';
1+
import { defineConfig } from 'tsdown';
22

33
export default defineConfig({
44
watch: process.env.MODE === 'watch',
@@ -9,7 +9,6 @@ export default defineConfig({
99
format: ['esm'],
1010
target: 'node20',
1111
dts: process.env.MODE !== 'watch',
12-
bundle: true,
1312
// Minimal external list - just problematic packages
1413
// @nangohq/node uses axios which has CommonJS dependencies (form-data, combined-stream)
1514
// that use dynamic require('util') which can't be bundled into ESM
@@ -23,12 +22,18 @@ export default defineConfig({
2322
'@nangohq/node',
2423
'@nangohq/types',
2524
],
26-
// Bundle workspace packages
27-
noExternal: ['@inkeep/agents-core'],
25+
// Bundle workspace packages (use regex to match all subpath imports)
26+
noExternal: [/^@inkeep\/agents-core/],
2827
banner: {
2928
js: '#!/usr/bin/env node',
3029
},
3130
outDir: 'dist',
3231
shims: true,
3332
splitting: false,
33+
// Disable hash in filenames for predictable DTS file paths
34+
hash: false,
35+
// Keep .js extension (tsdown 0.18+ defaults to .mjs)
36+
outExtensions() {
37+
return { js: '.js', dts: '.d.ts' };
38+
},
3439
});

agents-manage-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"type": "module",
1919
"scripts": {
2020
"dev": "vite",
21-
"build": "tsup",
21+
"build": "tsdown",
2222
"start": "node dist/index.js",
2323
"test": "vitest --run",
2424
"test:watch": "vitest",
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { defineConfig } from 'tsup';
2-
import rootConfig from '../tsup.config';
1+
import { defineConfig } from 'tsdown';
2+
import rootConfig from '../tsdown.config.ts';
33

44
export default defineConfig({
55
...rootConfig,
66
entry: ['src/index.ts', 'src/factory.ts'],
77
format: ['esm'],
88
external: ['keytar'],
99
noExternal: ['@inkeep/agents-manage-mcp'],
10-
async onSuccess() {},
1110
});

agents-run-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"dev": "vite",
1818
"dev:with-bypass": "PORT=3003 vite",
1919
"dev:without-bypass": "PORT=3004 INKEEP_AGENTS_RUN_API_BYPASS_SECRET= vite",
20-
"build": "tsup",
20+
"build": "tsdown",
2121
"start": "node dist/index.js",
2222
"test": "./run-tests.sh",
2323
"test:ci": "vitest --run --config vitest.config.ci.ts",

agents-run-api/tsdown.config.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { readFileSync } from 'node:fs';
2+
import { dirname, resolve } from 'node:path';
3+
import type { Plugin } from 'rolldown';
4+
import { defineConfig } from 'tsdown';
5+
import rootConfig from '../tsdown.config.ts';
6+
7+
// Plugin to handle ?raw imports (Vite-style)
8+
function rawPlugin(): Plugin {
9+
return {
10+
name: 'raw-import',
11+
resolveId(source, importer) {
12+
if (source.endsWith('?raw')) {
13+
const actualPath = source.slice(0, -4); // Remove ?raw
14+
const importerDir = importer ? dirname(importer) : process.cwd();
15+
const resolved = resolve(importerDir, actualPath);
16+
return `\0raw:${resolved}`;
17+
}
18+
return null;
19+
},
20+
load(id) {
21+
if (id.startsWith('\0raw:')) {
22+
const filePath = id.slice(5); // Remove \0raw:
23+
const content = readFileSync(filePath, 'utf-8');
24+
return `export default ${JSON.stringify(content)};`;
25+
}
26+
return null;
27+
},
28+
};
29+
}
30+
31+
export default defineConfig({
32+
...rootConfig,
33+
entry: ['src/index.ts', 'src/instrumentation.ts'],
34+
external: ['keytar'],
35+
plugins: [rawPlugin()],
36+
});

agents-run-api/tsup.config.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"version": "0.1.0",
6464
"dependencies": {
6565
"npm-run-all": "^4.1.5",
66-
"tsup": "^8.5.0",
66+
"tsdown": "^0.18.0",
6767
"zod": "^4.1.12",
6868
"@hono/zod-openapi": "^1.1.5"
6969
},

0 commit comments

Comments
 (0)