Skip to content

Commit

Permalink
fix(buble): prepare for Rollup 3 (#1305)
Browse files Browse the repository at this point in the history
BREAKING CHANGES: Requires Node 14
  • Loading branch information
lukastaegert committed Oct 8, 2022
1 parent 26a46ed commit 196263a
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 69 deletions.
2 changes: 1 addition & 1 deletion packages/buble/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 v1.20.0+.

## Install

Expand Down
33 changes: 22 additions & 11 deletions packages/buble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
"author": "Rich Harris <richard.a.harris@gmail.com>",
"homepage": "https://github.com/rollup/plugins/tree/master/packages/buble/#readme",
"bugs": "https://github.com/rollup/plugins/issues",
"main": "dist/rollup-plugin-buble.cjs.js",
"module": "dist/rollup-plugin-buble.es.js",
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"exports": {
"import": "./dist/es/index.js",
"types": "./types/index.d.ts",
"default": "./dist/cjs/index.js"
},
"engines": {
"node": ">= 8.0.0"
"node": ">=14.0.0"
},
"scripts": {
"build": "rollup -c",
Expand All @@ -34,6 +39,7 @@
},
"files": [
"dist",
"!dist/**/*.map",
"types",
"README.md",
"LICENSE"
Expand All @@ -47,21 +53,26 @@
"modules"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
},
"dependencies": {
"@rollup/pluginutils": "^3.1.0",
"@rollup/pluginutils": "^4.2.1",
"@types/buble": "^0.19.2",
"buble": "^0.20.0"
},
"devDependencies": {
"@rollup/plugin-typescript": "^5.0.2",
"del-cli": "^3.0.1",
"rollup": "^2.67.3",
"source-map": "^0.7.3",
"typescript": "4.1.2"
"@rollup/plugin-typescript": "^8.5.0",
"del-cli": "^5.0.0",
"rollup": "^3.0.0-7",
"source-map": "^0.7.4",
"typescript": "^4.8.3"
},
"types": "types/index.d.ts",
"types": "./types/index.d.ts",
"ava": {
"workerThreads": false,
"files": [
Expand Down
13 changes: 0 additions & 13 deletions packages/buble/rollup.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions packages/buble/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
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'))
});
2 changes: 1 addition & 1 deletion packages/buble/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { transform } from 'buble';
import { Plugin } from 'rollup';
import { createFilter } from '@rollup/pluginutils';

import { RollupBubleOptions } from '../types';
import type { RollupBubleOptions } from '../types';

export default function buble(options: RollupBubleOptions = {}): Plugin {
const filter = createFilter(options.include, options.exclude);
Expand Down
22 changes: 10 additions & 12 deletions packages/buble/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@ const getChunksFromGenerated = (generated) => {
function getChunksFromBundle(bundle) {
return bundle
.generate({
format: 'esm'
format: 'es'
})
.then(getChunksFromGenerated);
}

test('transforms files', async (t) =>
rollup
.rollup({
input: 'fixtures/basic/main.js',
plugins: [buble()]
})
.then(getChunksFromBundle)
.then((generated) => {
t.is(generated.length, 1);
t.is(generated[0].code, 'function main () { return 42; }\n\nexport { main as default };\n');
}));
test('transforms files', async (t) => {
const bundle = await rollup.rollup({
input: `${__dirname}/fixtures/basic/main.js`,
plugins: [buble()]
});
const generated = await getChunksFromBundle(bundle);
t.is(generated.length, 1);
t.is(generated[0].code, 'function main () { return 42; }\n\nexport { main as default };\n');
});
42 changes: 11 additions & 31 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 196263a

Please sign in to comment.