Skip to content

Commit 2a5b9a4

Browse files
chore: migrate from rollup to rolldown
1 parent 122f4e3 commit 2a5b9a4

File tree

6 files changed

+1078
-1042
lines changed

6 files changed

+1078
-1042
lines changed

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"start": "npm run bundle && http-server . -o example",
77
"clean": "shx rm -rf lib lib-esm _bundles",
88
"compile": "tsc --outdir lib && tsc -m es6 --outdir lib-esm",
9-
"bundle": "rollup -c",
9+
"bundle": "rolldown -c rolldown.config.mjs",
1010
"build": "npm run clean && npm run compile && npm run bundle",
1111
"prepublishOnly": "npm run build",
1212
"release": "release"
@@ -38,8 +38,6 @@
3838
"preact": "^10.28.1"
3939
},
4040
"devDependencies": {
41-
"@rollup/plugin-node-resolve": "^9.0.0",
42-
"@rollup/plugin-typescript": "^6.0.0",
4341
"@types/d3-hierarchy": "^1.1.5",
4442
"@types/d3-interpolate": "^1.3.0",
4543
"@uirouter/core": "^6.0.6",
@@ -48,8 +46,8 @@
4846
"husky": "^4.3.0",
4947
"prettier": "^2.1.2",
5048
"pretty-quick": "^3.0.2",
51-
"rollup": "^2.27.1",
52-
"rollup-plugin-postcss": "^3.1.8",
49+
"rolldown": "^1.0.0-beta.58",
50+
"rollup-plugin-styles": "^4.0.0",
5351
"serve": "^11.3.2",
5452
"shx": "^0.3.2",
5553
"tslib": "^2.0.1",

rolldown.config.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { defineConfig } from 'rolldown';
2+
import styles from 'rollup-plugin-styles';
3+
4+
export default defineConfig({
5+
input: 'src/visualizer.ts',
6+
// Tell rolldown to let plugins handle CSS instead of its built-in extraction
7+
moduleTypes: {
8+
'.css': 'js',
9+
},
10+
plugins: [
11+
// Inject CSS into the document <head> at runtime
12+
styles({ mode: 'inject' }),
13+
],
14+
resolve: {
15+
alias: {
16+
// Redirect react jsx-runtime to preact's jsx-runtime
17+
'react/jsx-runtime': 'preact/jsx-runtime',
18+
},
19+
},
20+
output: [
21+
{
22+
file: '_bundles/ui-router-visualizer.js',
23+
format: 'umd',
24+
name: '@uirouter/visualizer',
25+
sourcemap: true,
26+
},
27+
{
28+
file: '_bundles/ui-router-visualizer.esm.js',
29+
format: 'esm',
30+
sourcemap: true,
31+
},
32+
],
33+
});

rollup.config.js

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

src/statevis/StateVisualizer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ export class StateVisualizer extends Component<IProps, IState> {
160160
>
161161
<StateVisWindow
162162
minimized={this.state.minimized}
163-
ref={(windowRef) => (this.windowEl = (windowRef && windowRef.el) || this.windowEl)}
163+
ref={(windowRef) => {
164+
this.windowEl = (windowRef && windowRef.el) || this.windowEl;
165+
}}
164166
onResize={({ width, height }) => this.setState({ width, height })}
165167
>
166168
<div

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
"compilerOptions": {
44
"jsx": "react",
55
"jsxFactory": "h",
6-
"lib": ["es6", "dom"],
6+
"lib": ["ES2018", "dom"],
77
"rootDir": ".",
88
"sourceRoot": "src",
99
"moduleResolution": "node",
1010
"target": "es5",
1111
"sourceMap": true,
12-
"inlineSources": true
12+
"inlineSources": true,
13+
"skipLibCheck": true
1314
}
1415
}

0 commit comments

Comments
 (0)