Skip to content

Commit 2ca4b32

Browse files
committed
fix(run): prepare for Rollup 3
BREAKING CHANGES: Requires Node 14
1 parent 32aa6d2 commit 2ca4b32

File tree

8 files changed

+102
-68
lines changed

8 files changed

+102
-68
lines changed

packages/run/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
Using this plugin gives much faster results compared to what you would do with [nodemon](https://nodemon.io/).
1515

16+
## Requirements
17+
18+
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v2.0.0+.
19+
1620
## Install
1721

1822
Using npm:

packages/run/package.json

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313
"author": "Rich Harris",
1414
"homepage": "https://github.com/rollup/plugins/tree/master/packages/run/#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+
"require": "./dist/cjs/index.js",
20+
"import": "./dist/es/index.js"
21+
},
1822
"engines": {
19-
"node": ">=8.0.0"
23+
"node": ">=14.0.0"
2024
},
2125
"scripts": {
2226
"build": "rollup -c",
@@ -32,7 +36,7 @@
3236
"test": "ava"
3337
},
3438
"files": [
35-
"dist",
39+
"dist/**/*.{js,json}",
3640
"types",
3741
"README.md",
3842
"LICENSE"
@@ -43,23 +47,26 @@
4347
"run"
4448
],
4549
"peerDependencies": {
46-
"rollup": "^2.0.0"
50+
"rollup": "^2.0.0||^3.0.0"
51+
},
52+
"peerDependenciesMeta": {
53+
"rollup": {
54+
"optional": true
55+
}
4756
},
4857
"dependencies": {
49-
"@types/node": "14.0.26"
58+
"@types/node": "14.18.30"
5059
},
5160
"devDependencies": {
52-
"@rollup/plugin-typescript": "^5.0.2",
53-
"del": "^5.1.0",
54-
"rollup": "^2.67.3",
55-
"sinon": "9.0.2",
56-
"typescript": "^4.1.2"
61+
"@rollup/plugin-typescript": "^8.5.0",
62+
"del": "^6.1.1",
63+
"rollup": "^3.0.0-7",
64+
"sinon": "^14.0.0",
65+
"typescript": "^4.8.3"
5766
},
5867
"types": "types/index.d.ts",
5968
"ava": {
60-
"babel": {
61-
"compileEnhancements": false
62-
},
69+
"workerThreads": false,
6370
"files": [
6471
"!**/fixtures/**",
6572
"!**/output/**",

packages/run/rollup.config.js

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

packages/run/rollup.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { readFileSync } from 'fs';
2+
3+
import { createConfig } from '../../shared/rollup.config.mjs';
4+
5+
export default createConfig({
6+
pkg: JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'))
7+
});

packages/run/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { resolve, join, dirname } from 'path';
33

44
import { Plugin, RenderedChunk } from 'rollup';
55

6-
import { RollupRunOptions } from '../types';
6+
import type { RollupRunOptions } from '../types';
77

88
export default function run(opts: RollupRunOptions = {}): Plugin {
99
let input: string;

pnpm-lock.yaml

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

shared/rollup.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ export function createConfig({ pkg, external = [] }) {
2323
output: [
2424
{
2525
format: 'cjs',
26-
file: pkg.main,
26+
file: pkg.exports.require,
2727
exports: 'named',
2828
footer: 'module.exports = Object.assign(exports.default, exports);',
2929
sourcemap: true
3030
},
3131
{
3232
format: 'es',
33-
file: pkg.module,
33+
file: pkg.exports.import,
3434
plugins: [emitModulePackageFile()],
3535
sourcemap: true
3636
}

tsconfig.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"pretty": true,
1313
"sourceMap": true,
1414
"strict": true,
15-
"target": "es2017"
15+
"target": "es2019"
1616
},
1717
"exclude": ["dist", "node_modules", "test/types"]
1818
}

0 commit comments

Comments
 (0)