Skip to content

Commit

Permalink
fix(sucrase): prepare for Rollup 3 (#1283)
Browse files Browse the repository at this point in the history
BREAKING CHANGES: Requires Node 14
  • Loading branch information
lukastaegert committed Oct 10, 2022
1 parent 1a246f9 commit e7d9c37
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 36 deletions.
2 changes: 1 addition & 1 deletion packages/sucrase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

## Requirements

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

## Install

Expand Down
30 changes: 20 additions & 10 deletions packages/sucrase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
"author": "Rich Harris",
"homepage": "https://github.com/rollup/plugins/tree/master/packages/sucrase/#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",
"type": "commonjs",
"exports": {
"types": "./types/index.d.ts",
"import": "./dist/es/index.js",
"default": "./dist/cjs/index.js"
},
"engines": {
"node": ">=12.0.0"
"node": ">=14.0.0"
},
"scripts": {
"build": "rollup -c",
Expand All @@ -34,6 +40,7 @@
},
"files": [
"dist",
"!dist/**/*.map",
"types",
"README.md",
"LICENSE"
Expand All @@ -47,21 +54,24 @@
"jsx"
],
"peerDependencies": {
"rollup": "^2.53.1"
"rollup": "^2.53.1||^3.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
},
"dependencies": {
"@rollup/pluginutils": "^4.1.1",
"sucrase": "^3.20.0"
"@rollup/pluginutils": "^4.2.1",
"sucrase": "^3.27.0"
},
"devDependencies": {
"@rollup/plugin-alias": "^3.1.4",
"rollup": "^2.67.3"
"rollup": "^3.0.0-7"
},
"types": "./types/index.d.ts",
"ava": {
"babel": {
"compileEnhancements": false
},
"workerThreads": false,
"files": [
"!**/fixtures/**",
"!**/output/**",
Expand Down
12 changes: 0 additions & 12 deletions packages/sucrase/rollup.config.js

This file was deleted.

11 changes: 11 additions & 0 deletions packages/sucrase/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: []
};
12 changes: 6 additions & 6 deletions packages/sucrase/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const fs = require('fs');
const path = require('path');
import fs from 'fs';
import path from 'path';

const { transform } = require('sucrase');
const { createFilter } = require('@rollup/pluginutils');
import { transform } from 'sucrase';
import { createFilter } from '@rollup/pluginutils';

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

return {
Expand Down Expand Up @@ -59,4 +59,4 @@ module.exports = function sucrase(opts = {}) {
};
}
};
};
}
Binary file modified packages/sucrase/test/snapshots/test.js.snap
Binary file not shown.
22 changes: 15 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 e7d9c37

Please sign in to comment.