From 8da116cbc59fcaee586602a224cd7c508af02375 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 10 Oct 2022 18:55:54 +0200 Subject: [PATCH] fix(virtual): prepare for Rollup 3 (#1280) BREAKING CHANGES: Requires Node 14 --- packages/virtual/README.md | 2 +- packages/virtual/package.json | 38 ++++++++++++++++-------------- packages/virtual/rollup.config.js | 14 ----------- packages/virtual/rollup.config.mjs | 13 ++++++++++ pnpm-lock.yaml | 28 ++++++---------------- 5 files changed, 41 insertions(+), 54 deletions(-) delete mode 100755 packages/virtual/rollup.config.js create mode 100755 packages/virtual/rollup.config.mjs diff --git a/packages/virtual/README.md b/packages/virtual/README.md index dde9debd9..2318a4ff4 100755 --- a/packages/virtual/README.md +++ b/packages/virtual/README.md @@ -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 diff --git a/packages/virtual/package.json b/packages/virtual/package.json index 1048cf792..1eed63659 100755 --- a/packages/virtual/package.json +++ b/packages/virtual/package.json @@ -13,10 +13,15 @@ "author": "Rich Harris", "homepage": "https://github.com/rollup/plugins/tree/master/packages/virtual#readme", "bugs": "https://github.com/rollup/rollup-plugin-virtual/issues", - "main": "dist/index.js", - "module": "dist/index.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": ">=8.0.0" + "node": ">=14.0.0" }, "scripts": { "build": "rollup -c", @@ -34,6 +39,7 @@ }, "files": [ "dist", + "!dist/**/*.map", "types", "README.md", "LICENSE" @@ -47,25 +53,21 @@ "virtual" ], "peerDependencies": { - "rollup": "^1.20.0||^2.0.0" + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } }, "devDependencies": { - "@rollup/plugin-node-resolve": "^8.4.0", - "@rollup/plugin-typescript": "^6.0.0", - "rollup": "^2.67.3", - "typescript": "^4.1.2" + "@rollup/plugin-node-resolve": "^14.1.0", + "@rollup/plugin-typescript": "^8.5.0", + "rollup": "^3.0.0-7", + "typescript": "^4.8.3" }, - "types": "types/index.d.ts", + "types": "./types/index.d.ts", "ava": { - "babel": { - "compileEnhancements": false - }, - "extensions": [ - "ts" - ], - "require": [ - "ts-node/register" - ], "files": [ "!**/fixtures/**", "!**/helpers/**", diff --git a/packages/virtual/rollup.config.js b/packages/virtual/rollup.config.js deleted file mode 100755 index e6d7e67b6..000000000 --- a/packages/virtual/rollup.config.js +++ /dev/null @@ -1,14 +0,0 @@ -import resolve from '@rollup/plugin-node-resolve'; -import typescript from '@rollup/plugin-typescript'; - -import pkg from './package.json'; - -export default { - input: 'src/index.ts', - plugins: [resolve(), typescript()], - external: ['path'], - output: [ - { format: 'cjs', file: pkg.main, exports: 'auto' }, - { format: 'esm', file: pkg.module } - ] -}; diff --git a/packages/virtual/rollup.config.mjs b/packages/virtual/rollup.config.mjs new file mode 100755 index 000000000..4038d0ead --- /dev/null +++ b/packages/virtual/rollup.config.mjs @@ -0,0 +1,13 @@ +import { readFileSync } from 'fs'; + +import resolve from '@rollup/plugin-node-resolve'; +import typescript from '@rollup/plugin-typescript'; + +import { createConfig } from '../../shared/rollup.config.mjs'; + +export default { + ...createConfig({ + pkg: JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')) + }), + plugins: [resolve(), typescript()] +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d1ec5ada5..85849c006 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -540,14 +540,14 @@ importers: packages/virtual: specifiers: - '@rollup/plugin-node-resolve': ^8.4.0 - '@rollup/plugin-typescript': ^6.0.0 - rollup: ^2.67.3 - typescript: ^4.1.2 + '@rollup/plugin-node-resolve': ^14.1.0 + '@rollup/plugin-typescript': ^8.5.0 + rollup: ^3.0.0-7 + typescript: ^4.8.3 devDependencies: - '@rollup/plugin-node-resolve': 8.4.0_rollup@2.79.1 - '@rollup/plugin-typescript': 6.1.0_gypgyaqhine6mwjfvh7icfhviq - rollup: 2.79.1 + '@rollup/plugin-node-resolve': 14.1.0_rollup@3.0.0-7 + '@rollup/plugin-typescript': 8.5.0_wkkufgeabp7wfx7iyk42bruffi + rollup: 3.0.0-7 typescript: 4.8.4 packages/wasm: @@ -2100,20 +2100,6 @@ packages: typescript: 4.8.4 dev: true - /@rollup/plugin-typescript/6.1.0_gypgyaqhine6mwjfvh7icfhviq: - resolution: {integrity: sha512-hJxaiE6WyNOsK+fZpbFh9CUijZYqPQuAOWO5khaGTUkM8DYNNyA2TDlgamecE+qLOG1G1+CwbWMAx3rbqpp6xQ==} - engines: {node: '>=8.0.0'} - peerDependencies: - rollup: ^2.14.0 - tslib: '*' - typescript: '>=3.4.0' - dependencies: - '@rollup/pluginutils': 3.1.0_rollup@2.79.1 - resolve: 1.22.1 - rollup: 2.79.1 - typescript: 4.8.4 - dev: true - /@rollup/plugin-typescript/8.5.0_typescript@4.8.4: resolution: {integrity: sha512-wMv1/scv0m/rXx21wD2IsBbJFba8wGF3ErJIr6IKRfRj49S85Lszbxb4DCo8iILpluTjk2GAAu9CoZt4G3ppgQ==} engines: {node: '>=8.0.0'}