From 6a23eb17951313023a1fdf7bb813355df690507a Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 30 Sep 2022 06:59:10 +0200 Subject: [PATCH] fix(run): prepare for Rollup 3 BREAKING CHANGES: Requires Node 14 --- packages/run/README.md | 4 +++ packages/run/package.json | 37 +++++++++++-------- packages/run/rollup.config.js | 13 ------- packages/run/rollup.config.mjs | 7 ++++ packages/run/src/index.ts | 2 +- pnpm-lock.yaml | 66 +++++++++++++++------------------- 6 files changed, 64 insertions(+), 65 deletions(-) delete mode 100644 packages/run/rollup.config.js create mode 100644 packages/run/rollup.config.mjs diff --git a/packages/run/README.md b/packages/run/README.md index b67eb2397..a57b375db 100644 --- a/packages/run/README.md +++ b/packages/run/README.md @@ -13,6 +13,10 @@ Using this plugin gives much faster results compared to what you would do with [nodemon](https://nodemon.io/). +## Requirements + +This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v2.0.0+. + ## Install Using npm: diff --git a/packages/run/package.json b/packages/run/package.json index 89b0ee8c4..763e954a4 100644 --- a/packages/run/package.json +++ b/packages/run/package.json @@ -13,10 +13,15 @@ "author": "Rich Harris", "homepage": "https://github.com/rollup/plugins/tree/master/packages/run/#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", + "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", @@ -33,6 +38,7 @@ }, "files": [ "dist", + "!dist/**/*.map", "types", "README.md", "LICENSE" @@ -43,23 +49,26 @@ "run" ], "peerDependencies": { - "rollup": "^2.0.0" + "rollup": "^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } }, "dependencies": { - "@types/node": "14.0.26" + "@types/node": "14.18.30" }, "devDependencies": { - "@rollup/plugin-typescript": "^5.0.2", - "del": "^5.1.0", - "rollup": "^2.67.3", - "sinon": "9.0.2", - "typescript": "^4.1.2" + "@rollup/plugin-typescript": "^8.5.0", + "del": "^6.1.1", + "rollup": "^3.0.0-7", + "sinon": "^14.0.0", + "typescript": "^4.8.3" }, - "types": "types/index.d.ts", + "types": "./types/index.d.ts", "ava": { - "babel": { - "compileEnhancements": false - }, + "workerThreads": false, "files": [ "!**/fixtures/**", "!**/output/**", diff --git a/packages/run/rollup.config.js b/packages/run/rollup.config.js deleted file mode 100644 index 94a9878f3..000000000 --- a/packages/run/rollup.config.js +++ /dev/null @@ -1,13 +0,0 @@ -import typescript from '@rollup/plugin-typescript'; - -import pkg from './package.json'; - -export default { - input: 'src/index.ts', - plugins: [typescript({ sourceMap: false })], - external: Object.keys(pkg.dependencies).concat(['path', 'child_process']), - output: [ - { format: 'cjs', file: pkg.main, exports: 'auto' }, - { format: 'esm', file: pkg.module } - ] -}; diff --git a/packages/run/rollup.config.mjs b/packages/run/rollup.config.mjs new file mode 100644 index 000000000..2a28aaaf6 --- /dev/null +++ b/packages/run/rollup.config.mjs @@ -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')) +}); diff --git a/packages/run/src/index.ts b/packages/run/src/index.ts index 5e3e8963e..c71a9545d 100644 --- a/packages/run/src/index.ts +++ b/packages/run/src/index.ts @@ -3,7 +3,7 @@ import { resolve, join, dirname } from 'path'; import { Plugin, RenderedChunk } from 'rollup'; -import { RollupRunOptions } from '../types'; +import type { RollupRunOptions } from '../types'; export default function run(opts: RollupRunOptions = {}): Plugin { let input: string; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a9cd5dffc..de01c82ca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -457,19 +457,19 @@ importers: packages/run: specifiers: - '@rollup/plugin-typescript': ^5.0.2 - '@types/node': 14.0.26 - del: ^5.1.0 - rollup: ^2.67.3 - sinon: 9.0.2 - typescript: ^4.1.2 + '@rollup/plugin-typescript': ^8.5.0 + '@types/node': 14.18.30 + del: ^6.1.1 + rollup: ^3.0.0-7 + sinon: ^14.0.0 + typescript: ^4.8.3 dependencies: - '@types/node': 14.0.26 + '@types/node': 14.18.30 devDependencies: - '@rollup/plugin-typescript': 5.0.2_5q64ijqsuisqe52alrh6v6njki - del: 5.1.0 - rollup: 2.79.1 - sinon: 9.0.2 + '@rollup/plugin-typescript': 8.5.0_vmpcm5aav5u37diqfc6pdubvhq + del: 6.1.1 + rollup: 3.0.0-7 + sinon: 14.0.1 typescript: 4.8.3 packages/strip: @@ -2210,21 +2210,14 @@ packages: type-detect: 4.0.8 dev: true - /@sinonjs/fake-timers/6.0.1: - resolution: {integrity: sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA==} + /@sinonjs/fake-timers/9.1.2: + resolution: {integrity: sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==} dependencies: '@sinonjs/commons': 1.8.3 dev: true - /@sinonjs/formatio/5.0.1: - resolution: {integrity: sha512-KaiQ5pBf1MpS09MuA0kp6KBQt2JUOQycqVG1NZXvzeaXe5LGFqAKueIS0bw4w0P9r7KuBSVdUk5QjXsUdu2CxQ==} - dependencies: - '@sinonjs/commons': 1.8.3 - '@sinonjs/samsam': 5.3.1 - dev: true - - /@sinonjs/samsam/5.3.1: - resolution: {integrity: sha512-1Hc0b1TtyfBu8ixF/tpfSHTVWKwCBLY4QJbkgnE7HcwyvT2xArDxb4K7dMgqRm3szI+LJbzmW/s4xxEhv6hwDg==} + /@sinonjs/samsam/6.1.1: + resolution: {integrity: sha512-cZ7rKJTLiE7u7Wi/v9Hc2fs3Ucc3jrWeMgPHbbTCeVAB2S0wOBbYlkJVeNSL04i7fdhT8wIbDq1zhC/PXTD2SA==} dependencies: '@sinonjs/commons': 1.8.3 lodash.get: 4.4.2 @@ -2366,13 +2359,8 @@ packages: resolution: {integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==} dev: true - /@types/node/14.0.26: - resolution: {integrity: sha512-W+fpe5s91FBGE0pEa0lnqGLL4USgpLgs4nokw16SrBBco/gQxuua7KnArSEOd5iaMqbbSHV10vUDkJYJJqpXKA==} - dev: false - /@types/node/14.18.30: resolution: {integrity: sha512-8OEyg4oc/CqN5+LbInKNLA8MfbGzbC+k8lVPePXazuwEVrVeQ9gwMDX00HJwWbC7syc1FWRU6Mow0Lm+mibHAQ==} - dev: true /@types/node/18.7.21: resolution: {integrity: sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==} @@ -3746,6 +3734,11 @@ packages: engines: {node: '>=0.3.1'} dev: true + /diff/5.1.0: + resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==} + engines: {node: '>=0.3.1'} + dev: true + /dir-glob/3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -5604,11 +5597,11 @@ packages: resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} dev: true - /nise/4.1.0: - resolution: {integrity: sha512-eQMEmGN/8arp0xsvGoQ+B1qvSkR73B1nWSCh7nOt5neMCtwcQVYQGdzQMhcNscktTsWB54xnlSQFzOAPJD8nXA==} + /nise/5.1.1: + resolution: {integrity: sha512-yr5kW2THW1AkxVmCnKEh4nbYkJdB3I7LUkiUgOvEkOp414mc2UMaHMA7pjq1nYowhdoJZGwEKGaQVbxfpWj10A==} dependencies: '@sinonjs/commons': 1.8.3 - '@sinonjs/fake-timers': 6.0.1 + '@sinonjs/fake-timers': 9.1.2 '@sinonjs/text-encoding': 0.7.2 just-extend: 4.2.1 path-to-regexp: 1.8.0 @@ -6867,15 +6860,14 @@ packages: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: true - /sinon/9.0.2: - resolution: {integrity: sha512-0uF8Q/QHkizNUmbK3LRFqx5cpTttEVXudywY9Uwzy8bTfZUhljZ7ARzSxnRHWYWtVTeh4Cw+tTb3iU21FQVO9A==} + /sinon/14.0.1: + resolution: {integrity: sha512-JhJ0jCiyBWVAHDS+YSjgEbDn7Wgz9iIjA1/RK+eseJN0vAAWIWiXBdrnb92ELPyjsfreCYntD1ORtLSfIrlvSQ==} dependencies: '@sinonjs/commons': 1.8.3 - '@sinonjs/fake-timers': 6.0.1 - '@sinonjs/formatio': 5.0.1 - '@sinonjs/samsam': 5.3.1 - diff: 4.0.2 - nise: 4.1.0 + '@sinonjs/fake-timers': 9.1.2 + '@sinonjs/samsam': 6.1.1 + diff: 5.1.0 + nise: 5.1.1 supports-color: 7.2.0 dev: true