From cc993e767e9ae0449d267d0beebac13c92dcb002 Mon Sep 17 00:00:00 2001 From: Ben Scott <227292+BPScott@users.noreply.github.com> Date: Tue, 21 May 2024 21:24:51 -0700 Subject: [PATCH 1/5] Resolve import.meta.{filename,dirname} in files imported from config (#5520) Use correct import.meta.{filename,dirname} in relative imports from transpiled config files --- cli/run/loadConfigFile.ts | 8 +++++++- test/cli/samples/config-import-meta/_config.js | 2 +- test/cli/samples/config-import-meta/plugin/plugin.js | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cli/run/loadConfigFile.ts b/cli/run/loadConfigFile.ts index d01c1980e..33e3297d7 100644 --- a/cli/run/loadConfigFile.ts +++ b/cli/run/loadConfigFile.ts @@ -118,8 +118,14 @@ async function loadTranspiledConfigFile( if (property === 'url') { return `'${pathToFileURL(moduleId).href}'`; } + if (property == 'filename') { + return `'${moduleId}'`; + } + if (property == 'dirname') { + return `'${path.dirname(moduleId)}'`; + } if (property == null) { - return `{url:'${pathToFileURL(moduleId).href}'}`; + return `{url:'${pathToFileURL(moduleId).href}', filename: '${moduleId}', dirname: '${path.dirname(moduleId)}'}`; } } } diff --git a/test/cli/samples/config-import-meta/_config.js b/test/cli/samples/config-import-meta/_config.js index e5a746b07..49681ab38 100644 --- a/test/cli/samples/config-import-meta/_config.js +++ b/test/cli/samples/config-import-meta/_config.js @@ -1,4 +1,4 @@ module.exports = defineTest({ - description: 'uses correct import.meta.url in config files', + description: 'uses correct import.meta.{url,filename,dirname} in config files', command: 'rollup -c --bundleConfigAsCjs' }); diff --git a/test/cli/samples/config-import-meta/plugin/plugin.js b/test/cli/samples/config-import-meta/plugin/plugin.js index c6d15f8db..29f042c94 100644 --- a/test/cli/samples/config-import-meta/plugin/plugin.js +++ b/test/cli/samples/config-import-meta/plugin/plugin.js @@ -9,6 +9,8 @@ const fileName = `test.txt`; function validateImportMeta(importMeta) { assert.strictEqual(importMeta.url, import.meta.url); + assert.strictEqual(importMeta.filename, import.meta.filename); + assert.strictEqual(importMeta.dirname, import.meta.dirname); } validateImportMeta(import.meta); From 13d8c990f1022222f6faeee03750b28d2811cb76 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 22 May 2024 13:31:04 +0900 Subject: [PATCH 2/5] docs: correct base32 to base36 in documentation (#5521) --- docs/configuration-options/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration-options/index.md b/docs/configuration-options/index.md index f106d8811..5742644d6 100755 --- a/docs/configuration-options/index.md +++ b/docs/configuration-options/index.md @@ -910,7 +910,7 @@ exports.foo = foo; | | | | -------: | :------------------------------ | -| Type: | `"base64" \| "base32" \| "hex"` | +| Type: | `"base64" \| "base36" \| "hex"` | | CLI: | `--hashCharacters ` | | Default: | `"base64"` | From bb6f069ea3623b0297ef3895f2dcb98a2ca5ef58 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Wed, 22 May 2024 06:52:20 +0200 Subject: [PATCH 3/5] 4.18.0 --- CHANGELOG.md | 21 +++++++++++++++++++++ browser/package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88942dad7..53ce699b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # rollup changelog +## 4.18.0 + +_2024-05-22_ + +### Features + +- Resolve import.meta.filename and .dirname in transpiled plugins (#5520) + +### Pull Requests + +- [#5504](https://github.com/rollup/rollup/pull/5504): Auto generate node index (@lukastaegert) +- [#5507](https://github.com/rollup/rollup/pull/5507): chore(deps): lock file maintenance minor/patch updates (@renovate[bot]) +- [#5508](https://github.com/rollup/rollup/pull/5508): chore(deps): lock file maintenance (@renovate[bot]) +- [#5510](https://github.com/rollup/rollup/pull/5510): Split up converter.rs into AST nodes (@lukastaegert) +- [#5512](https://github.com/rollup/rollup/pull/5512): chore(deps): update dependency builtin-modules to v4 (@renovate[bot], @lukastaegert) +- [#5514](https://github.com/rollup/rollup/pull/5514): chore(deps): lock file maintenance minor/patch updates (@renovate[bot]) +- [#5518](https://github.com/rollup/rollup/pull/5518): chore(deps): update dependency eslint-plugin-unicorn to v53 (@renovate[bot], @lukastaegert) +- [#5519](https://github.com/rollup/rollup/pull/5519): chore(deps): lock file maintenance minor/patch updates (@renovate[bot], @lukastaegert) +- [#5520](https://github.com/rollup/rollup/pull/5520): Resolve import.meta.{filename,dirname} in files imported from config (@BPScott) +- [#5521](https://github.com/rollup/rollup/pull/5521): docs: correct base32 to base36 in documentation (@highcastlee) + ## 4.17.2 _2024-04-30_ diff --git a/browser/package.json b/browser/package.json index ddd69bac5..8cbc1ab1b 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "4.17.2", + "version": "4.18.0", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/package-lock.json b/package-lock.json index d4d080112..db9455ec3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rollup", - "version": "4.17.2", + "version": "4.18.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rollup", - "version": "4.17.2", + "version": "4.18.0", "license": "MIT", "dependencies": { "@types/estree": "1.0.5" diff --git a/package.json b/package.json index a091a2440..b38442031 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "4.17.2", + "version": "4.18.0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", From 8f10344d915e0af9c3bd23426ecacc4854fe51fb Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Thu, 23 May 2024 09:03:53 +0200 Subject: [PATCH 4/5] Remove weak-napi from dependencies --- package-lock.json | 61 ----------------------------------------------- package.json | 3 +-- 2 files changed, 1 insertion(+), 63 deletions(-) diff --git a/package-lock.json b/package-lock.json index db9455ec3..0dac8503f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -95,7 +95,6 @@ "vitepress": "^1.1.4", "vue": "^3.4.27", "wasm-pack": "^0.12.1", - "weak-napi": "^2.0.2", "yargs-parser": "^21.1.1" }, "engines": { @@ -6990,23 +6989,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-symbol-from-current-process-h": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.2.tgz", - "integrity": "sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw==", - "dev": true, - "license": "MIT" - }, - "node_modules/get-uv-event-loop-napi-h": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/get-uv-event-loop-napi-h/-/get-uv-event-loop-napi-h-1.0.6.tgz", - "integrity": "sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==", - "dev": true, - "license": "MIT", - "dependencies": { - "get-symbol-from-current-process-h": "^1.0.1" - } - }, "node_modules/github-api": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/github-api/-/github-api-3.4.0.tgz", @@ -10567,13 +10549,6 @@ "dev": true, "license": "MIT" }, - "node_modules/node-addon-api": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", - "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==", - "dev": true, - "license": "MIT" - }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -10595,18 +10570,6 @@ } } }, - "node_modules/node-gyp-build": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.1.tgz", - "integrity": "sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==", - "dev": true, - "license": "MIT", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, "node_modules/node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", @@ -12588,17 +12551,6 @@ "node": ">= 0.4" } }, - "node_modules/setimmediate-napi": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/setimmediate-napi/-/setimmediate-napi-1.0.6.tgz", - "integrity": "sha512-sdNXN15Av1jPXuSal4Mk4tEAKn0+8lfF9Z50/negaQMrAIO9c1qM0eiCh8fT6gctp0RiCObk+6/Xfn5RMGdZoA==", - "dev": true, - "license": "MIT", - "dependencies": { - "get-symbol-from-current-process-h": "^1.0.1", - "get-uv-event-loop-napi-h": "^1.0.5" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -14220,19 +14172,6 @@ "defaults": "^1.0.3" } }, - "node_modules/weak-napi": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/weak-napi/-/weak-napi-2.0.2.tgz", - "integrity": "sha512-LcOSVFrghtVXf4QH+DLIy8iPiCktV7lVbqRDYP+bDPpLzC41RCHQPMyQOnPpWO41Ie4CmnDxS+mbL72r5xFMMQ==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "node-addon-api": "^3.0.0", - "node-gyp-build": "^4.2.1", - "setimmediate-napi": "^1.0.3" - } - }, "node_modules/web-worker": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.3.0.tgz", diff --git a/package.json b/package.json index b38442031..871b4c42d 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "test:all": "concurrently --kill-others-on-fail -c green,blue,magenta,cyan,red 'npm:test:only' 'npm:test:browser' 'npm:test:typescript' 'npm:test:package' 'npm:test:options'", "test:coverage": "npm run build:cjs && shx rm -rf coverage/* && nyc --reporter html mocha test/test.js", "test:coverage:browser": "npm run build && shx rm -rf coverage/* && nyc mocha test/browser/index.js", - "test:leak": "node --expose-gc test/leak/index.js", + "test:leak": "npm install --no-save weak-napi && node --expose-gc test/leak/index.js", "test:package": "node scripts/test-package.js", "test:options": "node scripts/test-options.js", "test:only": "mocha test/test.js", @@ -194,7 +194,6 @@ "vitepress": "^1.1.4", "vue": "^3.4.27", "wasm-pack": "^0.12.1", - "weak-napi": "^2.0.2", "yargs-parser": "^21.1.1" }, "overrides": { From b96e636d2d8301e2521e07f689782fb24a3e35c5 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Thu, 23 May 2024 09:08:13 +0200 Subject: [PATCH 5/5] Add note how to install dependencies --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f59b6a89b..50d2827fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,6 +61,10 @@ After applying this setting, you may need to reset your local branch to ensure t git reset --hard ``` +### Installing dependencies + +Running `npm install` will install the necessary dependencies. If it fails, it might be because the Rust toolchain is not yet set up for WebAssembly, see above. + ### How to run one test on your local machine With `npm run test` you can run all tests together.