Skip to content

Commit b2253ba

Browse files
authored
fix(multi-entry): prepare for Rollup 3 (#1289)
BREAKING CHANGES: Requires Node 14
1 parent 1284c11 commit b2253ba

File tree

7 files changed

+48
-29
lines changed

7 files changed

+48
-29
lines changed

packages/multi-entry/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ _Note: `default` exports cannot be combined and exported by this plugin. Only na
1717

1818
## Requirements
1919

20-
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.3.0+) and Rollup v1.20.0+.
20+
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v1.20.0+.
2121

2222
## Install
2323

packages/multi-entry/package.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@
1313
"author": "rollup",
1414
"homepage": "https://github.com/rollup/plugins/tree/master/packages/multi-entry/#readme",
1515
"bugs": "https://github.com/rollup/plugins/issues",
16-
"main": "dist/index.js",
17-
"module": "dist/index.es.js",
16+
"main": "./dist/cjs/index.js",
17+
"module": "./dist/es/index.js",
18+
"exports": {
19+
"types": "./types/index.d.ts",
20+
"import": "./dist/es/index.js",
21+
"default": "./dist/cjs/index.js"
22+
},
1823
"engines": {
19-
"node": ">=10.0.0"
24+
"node": ">=14.0.0"
2025
},
2126
"scripts": {
2227
"build": "rollup -c",
@@ -33,6 +38,7 @@
3338
},
3439
"files": [
3540
"dist",
41+
"!dist/**/*.map",
3642
"types",
3743
"README.md",
3844
"LICENSE"
@@ -46,20 +52,22 @@
4652
"entries"
4753
],
4854
"peerDependencies": {
49-
"rollup": "^1.20.0 || ^2.0.0"
55+
"rollup": "^1.20.0||^2.0.0||^3.0.0"
56+
},
57+
"peerDependenciesMeta": {
58+
"rollup": {
59+
"optional": true
60+
}
5061
},
5162
"dependencies": {
5263
"@rollup/plugin-virtual": "^2.0.3",
53-
"matched": "^5.0.0"
64+
"matched": "^5.0.1"
5465
},
5566
"devDependencies": {
56-
"rollup": "^2.67.3"
67+
"rollup": "^3.0.0-7"
5768
},
5869
"types": "./types/index.d.ts",
5970
"ava": {
60-
"babel": {
61-
"compileEnhancements": false
62-
},
6371
"files": [
6472
"!**/fixtures/**",
6573
"!**/helpers/**",

packages/multi-entry/rollup.config.js

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { readFileSync } from 'fs';
2+
3+
import { createConfig } from '../../shared/rollup.config.mjs';
4+
5+
export default {
6+
...createConfig({
7+
pkg: JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'))
8+
}),
9+
input: 'src/index.js',
10+
plugins: []
11+
};

packages/multi-entry/test/node_modules/current-package

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/multi-entry/test/test.js renamed to packages/multi-entry/test/test.mjs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/* eslint-disable no-bitwise */
22

3+
import { createRequire } from 'module';
4+
35
import test from 'ava';
46
import { rollup } from 'rollup';
57

6-
import { getCode } from '../../../util/test';
8+
import multiEntry from 'current-package';
79

8-
import multiEntry from '../';
10+
import { getCode } from '../../../util/test.js';
911

1012
test('takes a single file as input', async (t) => {
1113
const bundle = await rollup({ input: 'test/fixtures/0.js', plugins: [multiEntry()] });
@@ -81,3 +83,11 @@ test('makes a bundle with entryFileName as the filename', async (t) => {
8183
const [result] = await getCode(bundle, { format: 'cjs' }, true);
8284
t.is(result.fileName, 'testing.js');
8385
});
86+
87+
test('works as CJS plugin', async (t) => {
88+
const require = createRequire(import.meta.url);
89+
const multiEntryPluginCjs = require('current-package');
90+
const bundle = await rollup({ input: 'test/fixtures/0.js', plugins: [multiEntryPluginCjs()] });
91+
const code = await getCode(bundle);
92+
t.truthy(code.includes('exports.zero = zero;'));
93+
});

pnpm-lock.yaml

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)