Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from rollup to rolldown #3578

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
{
"presets": [
[
"@babel/env",
{
"loose": true,
"bugfixes": true,
"shippedProposals": true
}
],
["@babel/react", { "runtime": "automatic" }],
"@babel/typescript"
],
"plugins": [
"@babel/transform-runtime",
["optimize-clsx", { "functionNames": ["getCellClassname"] }]
]
"presets": ["@babel/typescript"]
}
13 changes: 2 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"start": "vite serve --clearScreen false",
"preview": "vite preview",
"build:website": "vite build",
"build": "rollup --config --no-stdin",
"build": "rolldown -c",
"build:types": "tsc -p tsconfig.lib.json && api-extractor run --local --verbose",
"test": "vitest run",
"test:watch": "vitest watch",
Expand All @@ -55,21 +55,14 @@
"clsx": "^2.0.0"
},
"devDependencies": {
"@babel/core": "^7.26.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

"@babel/plugin-transform-runtime": "^7.25.9",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.26.0",
"@babel/runtime": "^7.26.0",
"@biomejs/biome": "1.9.4",
"@eslint/compat": "^1.2.4",
"@eslint/markdown": "^6.2.1",
"@faker-js/faker": "^9.3.0",
"@ianvs/prettier-plugin-sort-imports": "^4.0.2",
"@linaria/core": "^6.0.0",
"@microsoft/api-extractor": "^7.48.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^16.0.0",
"@tanstack/react-router": "^1.85.5",
"@tanstack/router-plugin": "^1.69.1",
"@testing-library/dom": "^10.1.0",
Expand All @@ -86,7 +79,6 @@
"@vitest/eslint-plugin": "^1.1.17",
"@wyw-in-js/rollup": "^0.5.0",
"@wyw-in-js/vite": "^0.5.0",
"babel-plugin-optimize-clsx": "^2.6.2",
"browserslist": "^4.24.3",
"eslint": "^9.17.0",
"eslint-plugin-jest-dom": "^5.5.0",
Expand All @@ -105,8 +97,7 @@
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.3.1",
"rollup": "^4.28.1",
"rollup-plugin-postcss": "^4.0.2",
"rolldown": "^0.15.1",
"typescript": "~5.7.2",
"vite": "^6.0.3",
"vitest": "^2.1.8",
Expand Down
49 changes: 49 additions & 0 deletions rolldown.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// @ts-check
import { isAbsolute } from 'node:path';
import wyw from '@wyw-in-js/rollup';
import pkg from './package.json' with { type: 'json' };
import { defineConfig } from 'rolldown';

/**
* TODO: https://github.com/rolldown/rolldown/issues/3200
* @type {readonly import('rolldown').OutputOptions[]}
*/
const outputs = [
{
dir: 'lib',
entryFileNames: 'bundle.js',
cssEntryFileNames: 'styles.css',
format: 'es',
sourcemap: true
},
{
dir: 'lib',
entryFileNames: 'bundle.cjs',
cssEntryFileNames: 'styles.css',
format: 'cjs',
sourcemap: true
}
];

export default outputs.map((output) =>
defineConfig({
input: './src/index.ts',
output,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output cannot be an array?

platform: 'browser',
external: (id) => !id.startsWith('.') && !isAbsolute(id),
plugins: [
// @ts-expect-error
wyw({
preprocessor: 'none',
/**
* @param {string} hash
*/
classNameSlug(hash) {
// We add the package version as suffix to avoid style conflicts
// between multiple versions of RDG on the same page.
return `${hash}${pkg.version.replaceAll('.', '-')}`;
}
})
]
})
);
50 changes: 0 additions & 50 deletions rollup.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion tsconfig.js.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"allowJs": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"skipLibCheck": true
},
"include": ["**/*.js", ".github/**/*.js"],
"include": ["**/*.js", ".github/**/*.js", "package.json"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we include package.json?

"exclude": ["./coverage/**/*", "./dist/**/*", "./lib/**/*"]
}
Loading