Skip to content

Commit 947f6ae

Browse files
AI Feature Agentclaude
andcommitted
Switch to tsup for dual CJS/ESM packaging (0.0.8)
Fixes broken ESM resolution in Cloudflare Workers (workerd) by shipping proper ESM (.mjs) alongside CJS (.js) with correct package.json exports field. Replaces plain tsc build with tsup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b711199 commit 947f6ae

4 files changed

Lines changed: 799 additions & 9 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_modules/
33

44
# Build output
55
lib/
6+
dist/
67

78
# Logs
89
*.log

package.json

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
{
22
"name": "xstate-migrate",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "A migration library for persisted XState machines",
5-
"main": "lib/index.js",
6-
"types": "lib/index.d.ts",
5+
"main": "dist/index.js",
6+
"module": "dist/index.mjs",
7+
"types": "dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"import": {
11+
"types": "./dist/index.d.mts",
12+
"default": "./dist/index.mjs"
13+
},
14+
"require": {
15+
"types": "./dist/index.d.ts",
16+
"default": "./dist/index.js"
17+
}
18+
}
19+
},
720
"scripts": {
8-
"build": "tsc",
21+
"build": "tsup",
922
"test": "jest",
1023
"test:coverage": "jest --coverage",
1124
"test:mutate": "stryker run",
1225
"lint": "eslint 'src/**/*.ts'",
1326
"format": "prettier --write 'src/**/*.ts'",
14-
"prepare": "npm run build",
15-
"prepublishOnly": "npm test && npm run lint"
27+
"prepare": "pnpm run build",
28+
"prepublishOnly": "pnpm test && pnpm run lint"
1629
},
1730
"keywords": [
1831
"xstate",
@@ -41,10 +54,11 @@
4154
"jest": "^29.7.0",
4255
"prettier": "^3.5.0",
4356
"ts-jest": "^29.4.6",
57+
"tsup": "^8.5.1",
4458
"typescript": "^5.9.3",
4559
"xstate": "^5.28.0"
4660
},
4761
"files": [
48-
"lib/**/*"
62+
"dist/**/*"
4963
]
5064
}

0 commit comments

Comments
 (0)