Skip to content

Commit e9d4a32

Browse files
committed
chore(build): Use Rolldown
1 parent fe97d67 commit e9d4a32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+225
-179
lines changed

dev-packages/node-core-integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"scripts": {
1313
"build": "run-s build:transpile build:types",
1414
"build:dev": "yarn build",
15-
"build:transpile": "rollup -c rollup.npm.config.mjs",
15+
"build:transpile": "rolldown -c rollup.npm.config.mjs",
1616
"build:types": "tsc -p tsconfig.types.json",
1717
"clean": "rimraf -g **/node_modules && run-p clean:script",
1818
"clean:script": "node scripts/clean.js",

dev-packages/node-integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"scripts": {
1313
"build": "run-s build:transpile build:types",
1414
"build:dev": "yarn build",
15-
"build:transpile": "rollup -c rollup.npm.config.mjs",
15+
"build:transpile": "rolldown -c rollup.npm.config.mjs",
1616
"build:types": "tsc -p tsconfig.types.json",
1717
"clean": "rimraf -g suites/**/node_modules suites/**/tmp_* && run-p clean:script",
1818
"clean:script": "node scripts/clean.js",

dev-packages/rollup-utils/bundleHelpers.mjs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ import deepMerge from 'deepmerge';
99
import {
1010
makeBrowserBuildPlugin,
1111
makeCleanupPlugin,
12-
makeCommonJSPlugin,
1312
makeIsDebugBuildPlugin,
14-
makeJsonPlugin,
1513
makeLicensePlugin,
16-
makeNodeResolvePlugin,
1714
makeRrwebBuildPlugin,
1815
makeSetSDKSourcePlugin,
1916
makeSucrasePlugin,
@@ -26,7 +23,6 @@ const BUNDLE_VARIANTS = ['.js', '.min.js', '.debug.min.js'];
2623
export function makeBaseBundleConfig(options) {
2724
const { bundleType, entrypoints, licenseTitle, outputFileBase, packageSpecificConfig, sucrase } = options;
2825

29-
const nodeResolvePlugin = makeNodeResolvePlugin();
3026
const sucrasePlugin = makeSucrasePlugin({}, sucrase);
3127
const cleanupPlugin = makeCleanupPlugin();
3228
const markAsBrowserBuildPlugin = makeBrowserBuildPlugin(true);
@@ -36,13 +32,6 @@ export function makeBaseBundleConfig(options) {
3632
excludeShadowDom: false,
3733
});
3834

39-
// The `commonjs` plugin is the `esModuleInterop` of the bundling world. When used with `transformMixedEsModules`, it
40-
// will include all dependencies, imported or required, in the final bundle. (Without it, CJS modules aren't included
41-
// at all, and without `transformMixedEsModules`, they're only included if they're imported, not if they're required.)
42-
const commonJSPlugin = makeCommonJSPlugin({ transformMixedEsModules: true });
43-
44-
const jsonPlugin = makeJsonPlugin();
45-
4635
// used by `@sentry/browser`
4736
const standAloneBundleConfig = {
4837
output: {
@@ -94,7 +83,7 @@ export function makeBaseBundleConfig(options) {
9483
output: {
9584
format: 'esm',
9685
},
97-
plugins: [commonJSPlugin, makeTerserPlugin(), licensePlugin],
86+
plugins: [makeTerserPlugin(), licensePlugin],
9887
// Don't bundle any of Node's core modules
9988
external: builtinModules,
10089
};
@@ -103,7 +92,7 @@ export function makeBaseBundleConfig(options) {
10392
output: {
10493
format: 'esm',
10594
},
106-
plugins: [commonJSPlugin, makeIsDebugBuildPlugin(true), makeTerserPlugin()],
95+
plugins: [makeIsDebugBuildPlugin(true), makeTerserPlugin()],
10796
// Don't bundle any of Node's core modules
10897
external: builtinModules,
10998
};
@@ -119,7 +108,7 @@ export function makeBaseBundleConfig(options) {
119108
strict: false,
120109
esModule: false,
121110
},
122-
plugins: [sucrasePlugin, nodeResolvePlugin, cleanupPlugin],
111+
plugins: [sucrasePlugin, cleanupPlugin],
123112
treeshake: 'smallest',
124113
};
125114

dev-packages/rollup-utils/npmHelpers.mjs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { defineConfig } from 'rollup';
1515
import {
1616
makeCleanupPlugin,
1717
makeDebugBuildStatementReplacePlugin,
18-
makeNodeResolvePlugin,
1918
makeRrwebBuildPlugin,
2019
makeSucrasePlugin,
2120
} from './plugins/index.mjs';
@@ -37,7 +36,6 @@ export function makeBaseNPMConfig(options = {}) {
3736
bundledBuiltins = [],
3837
} = options;
3938

40-
const nodeResolvePlugin = makeNodeResolvePlugin();
4139
const sucrasePlugin = makeSucrasePlugin({}, sucrase);
4240
const debugBuildStatementReplacePlugin = makeDebugBuildStatementReplacePlugin();
4341
const cleanupPlugin = makeCleanupPlugin();
@@ -58,9 +56,6 @@ export function makeBaseNPMConfig(options = {}) {
5856
// Include __esModule property when there is a default prop
5957
esModule: 'if-default-prop',
6058

61-
// output individual files rather than one big bundle
62-
preserveModules: true,
63-
6459
// Allow wrappers or helper functions generated by rollup to use any ES2015 features
6560
generatedCode: {
6661
preset: 'es2015',
@@ -96,7 +91,7 @@ export function makeBaseNPMConfig(options = {}) {
9691
},
9792
},
9893

99-
plugins: [nodeResolvePlugin, sucrasePlugin, debugBuildStatementReplacePlugin, rrwebBuildPlugin, cleanupPlugin],
94+
plugins: [sucrasePlugin, debugBuildStatementReplacePlugin, rrwebBuildPlugin, cleanupPlugin],
10095

10196
// don't include imported modules from outside the package in the final output
10297
external: [

dev-packages/rollup-utils/plugins/bundlePlugins.mjs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
import * as childProcess from 'child_process';
1212

13-
import commonjs from '@rollup/plugin-commonjs';
14-
import { nodeResolve } from '@rollup/plugin-node-resolve';
1513
import replace from '@rollup/plugin-replace';
1614
import terser from '@rollup/plugin-terser';
1715
import license from 'rollup-plugin-license';
@@ -146,12 +144,3 @@ export function makeTerserPlugin() {
146144
},
147145
});
148146
}
149-
150-
// We don't pass these plugins any options which need to be calculated or changed by us, so no need to wrap them in
151-
// another factory function, as they are themselves already factory functions.
152-
153-
export function makeNodeResolvePlugin() {
154-
return nodeResolve();
155-
}
156-
157-
export { commonjs as makeCommonJSPlugin };

dev-packages/rollup-utils/plugins/make-esm-plugin.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'node:fs';
2+
import path from 'node:path';
23

34
/**
45
* Outputs a package.json file with {type: module} in the root of the output directory so that Node
@@ -11,9 +12,7 @@ export function makePackageNodeEsm() {
1112
// We need to keep the `sideEffects` value from the original package.json,
1213
// as e.g. webpack seems to depend on this
1314
// without this, tree shaking does not work as expected
14-
const packageJSONPath = (await this.resolve('package.json')).id;
15-
16-
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8'));
15+
const packageJSON = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }));
1716
const sideEffects = packageJSON.sideEffects;
1817
// For module federation we need to keep the version of the package
1918
const version = packageJSON.version;

dev-packages/rollup-utils/plugins/npmPlugins.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ export function makeSucrasePlugin(options = {}, sucraseOptions = {}) {
3838
);
3939
}
4040

41-
export function makeJsonPlugin() {
42-
return json();
43-
}
44-
4541
/**
4642
* Create a plugin which can be used to pause the build process at the given hook.
4743
*

dev-packages/test-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"build": "run-s build:transpile build:types",
3737
"build:tarball": "run-s build:transpile build:types",
3838
"build:dev": "yarn build",
39-
"build:transpile": "rollup -c rollup.npm.config.mjs",
39+
"build:transpile": "rolldown -c rollup.npm.config.mjs",
4040
"build:types": "tsc -p tsconfig.types.json",
4141
"clean": "rimraf -g ./node_modules ./build"
4242
},

dev-packages/test-utils/rollup.npm.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export default makeNPMConfigVariants(
66
output: {
77
// set exports to 'named' or 'auto' so that rollup doesn't warn
88
exports: 'named',
9-
preserveModules: false,
109
},
1110
},
1211
}),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"prettier": "^3.6.2",
130130
"prettier-plugin-astro": "^0.14.1",
131131
"rimraf": "^5.0.10",
132-
"rollup": "^4.35.0",
132+
"rolldown": "^1.0.0-beta.45",
133133
"rollup-plugin-cleanup": "^3.2.1",
134134
"rollup-plugin-license": "^3.3.1",
135135
"size-limit": "~11.1.6",

0 commit comments

Comments
 (0)