Skip to content

Commit

Permalink
fix(replace): prepare for Rollup 3
Browse files Browse the repository at this point in the history
BREAKING CHANGES: Requires Node 14
  • Loading branch information
lukastaegert committed Oct 1, 2022
1 parent 32aa6d2 commit 631c7fa
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 44 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
63 changes: 51 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"pretty": true,
"sourceMap": true,
"strict": true,
"target": "es2017"
"target": "es2019"
},
"exclude": ["dist", "node_modules", "test/types"]
}

0 comments on commit 631c7fa

Please sign in to comment.