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/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/docs/configuration-options/index.md b/docs/configuration-options/index.md index 5256e09a2..6b2cfdd49 100755 --- a/docs/configuration-options/index.md +++ b/docs/configuration-options/index.md @@ -908,11 +908,19 @@ exports.foo = foo; ### output.hashCharacters +<<<<<<< HEAD | | | | -----: | :------------------------------ | | 类型: | `"base64" \| "base32" \| "hex"` | | CLI: | `--hashCharacters ` | | 默认: | `"base64"` | +======= +| | | +| -------: | :------------------------------ | +| Type: | `"base64" \| "base36" \| "hex"` | +| CLI: | `--hashCharacters ` | +| Default: | `"base64"` | +>>>>>>> bb6f069ea3623b0297ef3895f2dcb98a2ca5ef58 这个选项决定了 Rollup 在生成文件哈希时可以使用的字符集。 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", 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);