Skip to content

Commit 6aca0c8

Browse files
chore: migrate from tsup to tsdown (#60)
* chore: migrate from tsup to tsdown tsup is effectively unmaintained and has a bug with TypeScript 6.0 (egoist/tsup#1388 — unconditionally injects baseUrl which triggers TS5101). tsdown is the spiritual successor, powered by Rolldown, and supports TS6 out of the box. - Replace tsup + esbuild with tsdown (rolldown-based bundler) - Port react-compiler babel plugin from esbuild onLoad to rolldown transform hook - Remove fixCjsDefaultInteropPlugin (rolldown handles CJS interop correctly without the isNodeMode bug) - Update package.json exports to match tsdown output extensions (.mjs/.d.mts for ESM, .cjs/.d.cts for CJS) - Update api-extractor config for new .d.mts entry point - Remove esbuild from onlyBuiltDependencies in pnpm-workspace.yaml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: resolve knip issues with tsdown migration - Remove rolldown type import (transitive dep, not direct) — let TS infer the plugin type - Remove babel-plugin-react-compiler from knip ignoreDependencies (knip can now detect it via tsdown config) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: fix review findings from tsdown migration - Update AGENTS.md references from tsup to tsdown - Update dependabot.yml build-tools group pattern from tsup to tsdown - Add condition-specific types in package.json exports (d.mts for ESM, d.cts for CJS) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: enable babel sourcemaps in react-compiler plugin Pass sourceMaps: true to transformAsync so the transform produces source maps that Rolldown can chain into the final bundle output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a3b5990 commit 6aca0c8

10 files changed

Lines changed: 4720 additions & 2609 deletions

File tree

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ updates:
4343
- "jsdom"
4444
build-tools:
4545
patterns:
46-
- "tsup"
46+
- "tsdown"
4747
- "vite"
4848
- "@vitejs/*"
4949
types:

AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ This file provides guidance to AI coding assistants when working with code in th
1313
All commands run from `packages/seatmaps/`:
1414

1515
```bash
16-
pnpm build # Build CJS + ESM via tsup
17-
pnpm dev # Watch mode with tsup
16+
pnpm build # Build CJS + ESM via tsdown
17+
pnpm dev # Watch mode with tsdown
1818
pnpm test # Run tests with Vitest
1919
pnpm test:watch # Watch mode for tests
2020
pnpm lint # ESLint
@@ -61,7 +61,7 @@ Uses Emotion (`@emotion/react`, `@emotion/styled`) for dynamic SVG styling. Emot
6161
## TypeScript Configuration
6262

6363
- Single `tsconfig.json` (ES2020, strict mode, JSX react-jsx, bundler module resolution)
64-
- tsup handles CJS/ESM bundling → `dist/`
64+
- tsdown handles CJS/ESM bundling → `dist/`
6565
- Tests and stories excluded from compilation
6666

6767
## Testing

knip.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"$schema": "https://unpkg.com/knip@5/schema.json",
3-
"ignoreDependencies": [
4-
"@babel/preset-typescript",
5-
"babel-plugin-react-compiler"
6-
]
3+
"ignoreDependencies": ["@babel/preset-typescript"]
74
}

packages/seatmaps/api-extractor.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3-
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
3+
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.mts",
44
"apiReport": {
55
"enabled": true,
66
"reportFileName": "<unscopedPackageName>.api.md",

packages/seatmaps/api/react-seatmaps.api.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
55
```ts
66

7+
import * as _$react_jsx_runtime0 from 'react/jsx-runtime';
78
import { CSSProperties } from 'react';
89
import { default as React_2 } from 'react';
9-
import * as react_jsx_runtime from 'react/jsx-runtime';
1010
import { ReactNode } from 'react';
1111

1212
// @public
@@ -26,7 +26,7 @@ export interface AreaProps {
2626
}
2727

2828
// @public
29-
export const Badge: (input: BadgeProps) => react_jsx_runtime.JSX.Element;
29+
export const Badge: (input: BadgeProps) => _$react_jsx_runtime0.JSX.Element;
3030

3131
// @public
3232
export interface BadgeProps {
@@ -37,7 +37,7 @@ export interface BadgeProps {
3737
}
3838

3939
// @public
40-
export const Block: (input: BlockProps) => react_jsx_runtime.JSX.Element;
40+
export const Block: (input: BlockProps) => _$react_jsx_runtime0.JSX.Element;
4141

4242
// @public
4343
export interface BlockProps {
@@ -50,7 +50,7 @@ export interface BlockProps {
5050
}
5151

5252
// @public
53-
export const Circle: (input: CircleProps) => react_jsx_runtime.JSX.Element;
53+
export const Circle: (input: CircleProps) => _$react_jsx_runtime0.JSX.Element;
5454

5555
// @public
5656
export interface CircleProps {
@@ -67,15 +67,15 @@ export interface Dimensions {
6767
}
6868

6969
// @public
70-
export const Div: (input: DivProps) => react_jsx_runtime.JSX.Element;
70+
export const Div: (input: DivProps) => _$react_jsx_runtime0.JSX.Element;
7171

7272
// @public
7373
export interface DivProps {
7474
children?: ReactNode;
7575
}
7676

7777
// @public
78-
export const Ellipse: (input: EllipseProps) => react_jsx_runtime.JSX.Element;
78+
export const Ellipse: (input: EllipseProps) => _$react_jsx_runtime0.JSX.Element;
7979

8080
// @public
8181
export interface EllipseProps {
@@ -101,7 +101,7 @@ export interface NewSeatCountBadgeProps {
101101
}
102102

103103
// @public
104-
export const Rectangle: (input: RectangleProps) => react_jsx_runtime.JSX.Element;
104+
export const Rectangle: (input: RectangleProps) => _$react_jsx_runtime0.JSX.Element;
105105

106106
// @public
107107
export interface RectangleProps {
@@ -114,7 +114,7 @@ export interface RectangleProps {
114114
}
115115

116116
// @public
117-
export const Row: (input: RowProps) => react_jsx_runtime.JSX.Element;
117+
export const Row: (input: RowProps) => _$react_jsx_runtime0.JSX.Element;
118118

119119
// @public
120120
export interface RowProps {
@@ -130,16 +130,16 @@ export interface RowProps {
130130
export const Seat: React_2.ForwardRefExoticComponent<SeatProps & React_2.RefAttributes<SVGGElement>>;
131131

132132
// @public
133-
export const SeatCountBadge: (input: SeatCountBadgeProps) => react_jsx_runtime.JSX.Element;
133+
export const SeatCountBadge: (input: SeatCountBadgeProps) => _$react_jsx_runtime0.JSX.Element;
134134

135135
// @public
136-
export const SeatCountBadgeOnEllipse: (input: NewSeatCountBadgeProps) => react_jsx_runtime.JSX.Element;
136+
export const SeatCountBadgeOnEllipse: (input: NewSeatCountBadgeProps) => _$react_jsx_runtime0.JSX.Element;
137137

138138
// @public
139139
export type SeatCountBadgeProps = LegacySeatCountBadgeProps | NewSeatCountBadgeProps;
140140

141141
// @public
142-
export const Seatmap: (input: SeatmapProps) => react_jsx_runtime.JSX.Element;
142+
export const Seatmap: (input: SeatmapProps) => _$react_jsx_runtime0.JSX.Element;
143143

144144
// @public
145145
export interface SeatmapAreaData {
@@ -193,7 +193,7 @@ export interface SeatmapEllipseDecoration {
193193
}
194194

195195
// @public
196-
export const SeatmapLayout: (input: SeatmapLayoutProps) => react_jsx_runtime.JSX.Element;
196+
export const SeatmapLayout: (input: SeatmapLayoutProps) => _$react_jsx_runtime0.JSX.Element;
197197

198198
// @public
199199
export interface SeatmapLayoutData {
@@ -316,7 +316,7 @@ export enum SeatShape {
316316
}
317317

318318
// @public
319-
const Text_2: (input: TextProps) => react_jsx_runtime.JSX.Element;
319+
const Text_2: (input: TextProps) => _$react_jsx_runtime0.JSX.Element;
320320
export { Text_2 as Text }
321321

322322
// @public

packages/seatmaps/package.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,31 @@
1111
"type": "module",
1212
"exports": {
1313
".": {
14-
"types": "./dist/index.d.ts",
15-
"import": "./dist/index.js",
16-
"require": "./dist/index.cjs"
14+
"import": {
15+
"types": "./dist/index.d.mts",
16+
"default": "./dist/index.mjs"
17+
},
18+
"require": {
19+
"types": "./dist/index.d.cts",
20+
"default": "./dist/index.cjs"
21+
}
1722
},
1823
"./package.json": "./package.json"
1924
},
2025
"main": "./dist/index.cjs",
21-
"module": "./dist/index.js",
22-
"types": "./dist/index.d.ts",
26+
"module": "./dist/index.mjs",
27+
"types": "./dist/index.d.mts",
2328
"files": [
2429
"dist"
2530
],
2631
"scripts": {
2732
"api": "api-extractor run --local",
2833
"api:check": "api-extractor run",
29-
"build": "tsup",
34+
"build": "tsdown",
3035
"build-storybook": "storybook build",
3136
"ch": "pnpm lint && pnpm typecheck && pnpm test && pnpm format:check && pnpm api:check",
3237
"clean": "rm -rf dist",
33-
"dev": "tsup --watch",
38+
"dev": "tsdown --watch",
3439
"format": "prettier --write .",
3540
"format:check": "prettier --check .",
3641
"lint": "eslint src",
@@ -57,7 +62,6 @@
5762
"@types/react-dom": "^19.2.3",
5863
"@vitejs/plugin-react": "^6.0.1",
5964
"babel-plugin-react-compiler": "^1.0.0",
60-
"esbuild": "^0.27.4",
6165
"eslint": "^10.1.0",
6266
"eslint-plugin-react": "^7.35.0",
6367
"eslint-plugin-react-hooks": "^7.0.1",
@@ -66,7 +70,7 @@
6670
"react": "^19.2.4",
6771
"react-dom": "^19.2.4",
6872
"storybook": "^10.3.1",
69-
"tsup": "^8.0.0",
73+
"tsdown": "^0.21.7",
7074
"typescript": "^5.7.0",
7175
"typescript-eslint": "^8.57.1",
7276
"vite": "^8.0.5",

packages/seatmaps/tsdown.config.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { transformAsync } from '@babel/core';
2+
import { defineConfig } from 'tsdown';
3+
4+
const reactCompilerPlugin = {
5+
name: 'react-compiler',
6+
transform: {
7+
filter: {
8+
id: /\.[jt]sx?$/,
9+
},
10+
async handler(code, id) {
11+
if (id.includes('node_modules')) return undefined;
12+
const result = await transformAsync(code, {
13+
filename: id,
14+
plugins: [['babel-plugin-react-compiler']],
15+
presets: [['@babel/preset-typescript', { isTSX: true, allExtensions: true }]],
16+
sourceMaps: true,
17+
});
18+
if (!result?.code) return undefined;
19+
return { code: result.code, map: result.map ?? undefined };
20+
},
21+
},
22+
};
23+
24+
export default defineConfig({
25+
entry: ['src/index.ts'],
26+
format: ['cjs', 'esm'],
27+
dts: true,
28+
sourcemap: true,
29+
deps: {
30+
neverBundle: ['react', 'react-dom', 'react/jsx-runtime', '@emotion/react', '@emotion/styled'],
31+
},
32+
plugins: [reactCompilerPlugin],
33+
});

packages/seatmaps/tsup.config.ts

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

0 commit comments

Comments
 (0)