Skip to content

Commit

Permalink
fix(multi-entry): prepare for Rollup 3 (#1289)
Browse files Browse the repository at this point in the history
BREAKING CHANGES: Requires Node 14
  • Loading branch information
lukastaegert authored Oct 10, 2022
1 parent 1284c11 commit b2253ba
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 29 deletions.
2 changes: 1 addition & 1 deletion packages/multi-entry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ _Note: `default` exports cannot be combined and exported by this plugin. Only na

## Requirements

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

## Install

Expand Down
26 changes: 17 additions & 9 deletions packages/multi-entry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
"author": "rollup",
"homepage": "https://github.com/rollup/plugins/tree/master/packages/multi-entry/#readme",
"bugs": "https://github.com/rollup/plugins/issues",
"main": "dist/index.js",
"module": "dist/index.es.js",
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"exports": {
"types": "./types/index.d.ts",
"import": "./dist/es/index.js",
"default": "./dist/cjs/index.js"
},
"engines": {
"node": ">=10.0.0"
"node": ">=14.0.0"
},
"scripts": {
"build": "rollup -c",
Expand All @@ -33,6 +38,7 @@
},
"files": [
"dist",
"!dist/**/*.map",
"types",
"README.md",
"LICENSE"
Expand All @@ -46,20 +52,22 @@
"entries"
],
"peerDependencies": {
"rollup": "^1.20.0 || ^2.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
},
"dependencies": {
"@rollup/plugin-virtual": "^2.0.3",
"matched": "^5.0.0"
"matched": "^5.0.1"
},
"devDependencies": {
"rollup": "^2.67.3"
"rollup": "^3.0.0-7"
},
"types": "./types/index.d.ts",
"ava": {
"babel": {
"compileEnhancements": false
},
"files": [
"!**/fixtures/**",
"!**/helpers/**",
Expand Down
10 changes: 0 additions & 10 deletions packages/multi-entry/rollup.config.js

This file was deleted.

11 changes: 11 additions & 0 deletions packages/multi-entry/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { readFileSync } from 'fs';

import { createConfig } from '../../shared/rollup.config.mjs';

export default {
...createConfig({
pkg: JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'))
}),
input: 'src/index.js',
plugins: []
};
1 change: 1 addition & 0 deletions packages/multi-entry/test/node_modules/current-package

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* eslint-disable no-bitwise */

import { createRequire } from 'module';

import test from 'ava';
import { rollup } from 'rollup';

import { getCode } from '../../../util/test';
import multiEntry from 'current-package';

import multiEntry from '../';
import { getCode } from '../../../util/test.js';

test('takes a single file as input', async (t) => {
const bundle = await rollup({ input: 'test/fixtures/0.js', plugins: [multiEntry()] });
Expand Down Expand Up @@ -81,3 +83,11 @@ test('makes a bundle with entryFileName as the filename', async (t) => {
const [result] = await getCode(bundle, { format: 'cjs' }, true);
t.is(result.fileName, 'testing.js');
});

test('works as CJS plugin', async (t) => {
const require = createRequire(import.meta.url);
const multiEntryPluginCjs = require('current-package');
const bundle = await rollup({ input: 'test/fixtures/0.js', plugins: [multiEntryPluginCjs()] });
const code = await getCode(bundle);
t.truthy(code.includes('exports.zero = zero;'));
});
13 changes: 6 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b2253ba

Please sign in to comment.