Skip to content

Commit

Permalink
fix(replace): prepare for Rollup 3 (#1286)
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 62f0a13 commit cba9788
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 49 deletions.
2 changes: 1 addition & 1 deletion packages/replace/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
34 changes: 24 additions & 10 deletions packages/replace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@
"author": "Rich Harris <[email protected]>",
"homepage": "https://github.com/rollup/plugins/tree/master/packages/replace#readme",
"bugs": "https://github.com/rollup/plugins/issues",
"main": "dist/rollup-plugin-replace.cjs.js",
"module": "dist/rollup-plugin-replace.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": ">=14.0.0"
},
"scripts": {
"build": "rollup -c",
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
Expand All @@ -31,6 +39,7 @@
},
"files": [
"dist",
"!dist/**/*.map",
"src",
"types",
"README.md"
Expand All @@ -44,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",
"magic-string": "^0.25.7"
"@rollup/pluginutils": "^4.2.1",
"magic-string": "^0.26.4"
},
"devDependencies": {
"@rollup/plugin-buble": "^0.21.3",
"del-cli": "^3.0.1",
"del-cli": "^5.0.0",
"locate-character": "^2.0.5",
"rollup": "^2.67.3",
"source-map": "^0.7.3",
"typescript": "^3.9.7"
"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
15 changes: 0 additions & 15 deletions packages/replace/rollup.config.js

This file was deleted.

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

import buble from '@rollup/plugin-buble';

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: [buble()]
};
2 changes: 1 addition & 1 deletion packages/replace/test/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { readdirSync, readFileSync } = require('fs');

const test = require('ava');

const replace = require('../dist/rollup-plugin-replace.cjs.js');
const replace = require('..');

const transformContext = {};

Expand Down
2 changes: 1 addition & 1 deletion packages/replace/test/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { readdirSync } = require('fs');
const test = require('ava');
const { rollup } = require('rollup');

const replace = require('../dist/rollup-plugin-replace.cjs.js');
const replace = require('..');

const { execute, getCodeFromBundle } = require('./helpers/util');

Expand Down
4 changes: 2 additions & 2 deletions packages/replace/test/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { join } = require('path');
const test = require('ava');
const { rollup } = require('rollup');

const replace = require('../dist/rollup-plugin-replace.cjs.js');
const replace = require('..');

const { getOutputFromGenerated } = require('./helpers/util');

Expand Down Expand Up @@ -63,7 +63,7 @@ test('can be configured with output plugins', async (t) => {
})
);

t.is(code.trim(), 'log("environment", "production");');
t.is(code.trim(), 'log("environment", "production");\n//# sourceMappingURL=main.js.map');
t.truthy(map);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/replace/test/sourcemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ delete global.fetch;
const { SourceMapConsumer } = require('source-map');

global.fetch = fetch;
const replace = require('../dist/rollup-plugin-replace.cjs.js');
const replace = require('..');

const { getOutputFromGenerated } = require('./helpers/util');

Expand Down
30 changes: 12 additions & 18 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 cba9788

Please sign in to comment.