Skip to content

Commit 720a253

Browse files
authored
Update rolldown, adopt rolldown-plugin-dts (#3787)
* Update rolldown, adopt rolldown-plugin-dts * js -> ts * rm this file * cleanup * cleanup * prettier
1 parent 2eb8dcf commit 720a253

File tree

7 files changed

+18
-56
lines changed

7 files changed

+18
-56
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ jobs:
2525
- name: Prettier
2626
run: node --run prettier:check
2727
- name: Bundle
28-
run: |
29-
node --run build
30-
node --run build:types
28+
run: node --run build
3129
- name: Build website
3230
run: node --run build:website
3331
- name: Install Playwright Browsers

api-extractor.json

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

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
"./lib/styles.css": "./lib/styles.css",
1818
".": {
1919
"types": "./lib/index.d.ts",
20-
"default": "./lib/bundle.js"
20+
"default": "./lib/index.js"
2121
}
2222
},
23-
"browser": "./lib/bundle.js",
24-
"main": "./lib/bundle.js",
25-
"module": "./lib/bundle.js",
23+
"browser": "./lib/index.js",
24+
"main": "./lib/index.js",
25+
"module": "./lib/index.js",
2626
"types": "./lib/index.d.ts",
2727
"files": [
2828
"lib"
@@ -35,7 +35,6 @@
3535
"preview": "vite preview",
3636
"build:website": "vite build",
3737
"build": "rolldown -c",
38-
"build:types": "tsc -p tsconfig.lib.json && api-extractor run --local --verbose",
3938
"test": "vitest run",
4039
"test:watch": "vitest watch",
4140
"format": "biome format --write",
@@ -46,7 +45,7 @@
4645
"prettier:check": "prettier --check .",
4746
"prettier:format": "prettier --write .",
4847
"typecheck": "tsc --build",
49-
"prepublishOnly": "npm install && node --run build && node --run build:types",
48+
"prepublishOnly": "npm install && node --run build",
5049
"postpublish": "git push --follow-tags origin HEAD"
5150
},
5251
"dependencies": {
@@ -59,7 +58,6 @@
5958
"@faker-js/faker": "^9.6.0",
6059
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
6160
"@linaria/core": "^6.3.0",
62-
"@microsoft/api-extractor": "^7.52.7",
6361
"@tanstack/react-router": "^1.114.16",
6462
"@tanstack/router-plugin": "^1.114.16",
6563
"@types/node": "^22.15.16",
@@ -91,7 +89,8 @@
9189
"react-dnd": "^16.0.1",
9290
"react-dnd-html5-backend": "^16.0.1",
9391
"react-dom": "^19.1.0",
94-
"rolldown": "^1.0.0-beta.8",
92+
"rolldown": "^1.0.0-beta.9",
93+
"rolldown-plugin-dts": "^0.13.3",
9594
"typescript": "~5.8.2",
9695
"vite": "^6.3.5",
9796
"vitest": "^3.1.3",

rolldown.config.js renamed to rolldown.config.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
// @ts-check
2-
import { isAbsolute } from 'node:path';
31
import wyw from '@wyw-in-js/rollup';
4-
import pkg from './package.json' with { type: 'json' };
52
import { defineConfig } from 'rolldown';
3+
import { dts } from 'rolldown-plugin-dts';
4+
5+
import pkg from './package.json' with { type: 'json' };
66

77
export default defineConfig({
88
input: './src/index.ts',
99
output: {
1010
dir: 'lib',
11-
entryFileNames: 'bundle.js',
1211
cssEntryFileNames: 'styles.css',
1312
sourcemap: true
1413
},
1514
platform: 'browser',
16-
external: (id) => !id.startsWith('.') && !isAbsolute(id),
1715
plugins: [
18-
// @ts-expect-error
16+
dts({
17+
tsconfig: './tsconfig.lib.json'
18+
}),
1919
wyw({
20+
exclude: ['**/*.d.ts'],
2021
preprocessor: 'none',
2122
classNameSlug(/** @type {string} */ hash) {
2223
// We add the package version as suffix to avoid style conflicts

tsconfig.lib.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"composite": false,
55
"declaration": true,
66
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"],
7-
"noCheck": true,
8-
"outDir": "./.cache/lib"
7+
"noCheck": true
98
},
109
"files": ["src/index.ts"]
1110
}

tsconfig.vite.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"skipLibCheck": true,
55
"types": ["@vitest/browser/providers/playwright"]
66
},
7-
"include": ["vite.config.ts"]
7+
"include": ["package.json", "rolldown.config.ts", "vite.config.ts"]
88
}

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default defineConfig(({ command }) => ({
6565
exclude: ['./.cache/**/*']
6666
}),
6767
wyw({
68-
exclude: ['./.cache/**/*'],
68+
exclude: ['./.cache/**/*', '**/*.d.ts', '**/*.gen.ts'],
6969
preprocessor: 'none',
7070
displayName: command === 'serve'
7171
})

0 commit comments

Comments
 (0)