Skip to content

Commit 1068810

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

File tree

8 files changed

+54
-37
lines changed

8 files changed

+54
-37
lines changed

packages/sucrase/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
## Requirements
1515

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

1818
## Install
1919

packages/sucrase/package.json

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313
"author": "Rich Harris",
1414
"homepage": "https://github.com/rollup/plugins/tree/master/packages/sucrase/#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+
"type": "commonjs",
19+
"exports": {
20+
"types": "./types/index.d.ts",
21+
"import": "./dist/es/index.js",
22+
"default": "./dist/cjs/index.js"
23+
},
1824
"engines": {
19-
"node": ">=12.0.0"
25+
"node": ">=14.0.0"
2026
},
2127
"scripts": {
2228
"build": "rollup -c",
@@ -34,6 +40,7 @@
3440
},
3541
"files": [
3642
"dist",
43+
"!dist/**/*.map",
3744
"types",
3845
"README.md",
3946
"LICENSE"
@@ -47,21 +54,24 @@
4754
"jsx"
4855
],
4956
"peerDependencies": {
50-
"rollup": "^2.53.1"
57+
"rollup": "^2.53.1||^3.0.0"
58+
},
59+
"peerDependenciesMeta": {
60+
"rollup": {
61+
"optional": true
62+
}
5163
},
5264
"dependencies": {
53-
"@rollup/pluginutils": "^4.1.1",
54-
"sucrase": "^3.20.0"
65+
"@rollup/pluginutils": "^4.2.1",
66+
"sucrase": "^3.27.0"
5567
},
5668
"devDependencies": {
5769
"@rollup/plugin-alias": "^3.1.4",
58-
"rollup": "^2.67.3"
70+
"rollup": "^3.0.0-7"
5971
},
6072
"types": "./types/index.d.ts",
6173
"ava": {
62-
"babel": {
63-
"compileEnhancements": false
64-
},
74+
"workerThreads": false,
6575
"files": [
6676
"!**/fixtures/**",
6777
"!**/output/**",

packages/sucrase/rollup.config.js

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

packages/sucrase/rollup.config.mjs

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/sucrase/src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const fs = require('fs');
2-
const path = require('path');
1+
import fs from 'fs';
2+
import path from 'path';
33

4-
const { transform } = require('sucrase');
5-
const { createFilter } = require('@rollup/pluginutils');
4+
import { transform } from 'sucrase';
5+
import { createFilter } from '@rollup/pluginutils';
66

7-
module.exports = function sucrase(opts = {}) {
7+
export default function sucrase(opts = {}) {
88
const filter = createFilter(opts.include, opts.exclude);
99

1010
return {
@@ -59,4 +59,4 @@ module.exports = function sucrase(opts = {}) {
5959
};
6060
}
6161
};
62-
};
62+
}
-10 Bytes
Binary file not shown.

pnpm-lock.yaml

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

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)