Skip to content

Commit e828ecc

Browse files
authored
Merge pull request #162 from rollup/sync-0595e433
docs(en): merge rollup/master into rollup-docs-cn/master @ 0595e43
2 parents 8db00bf + bf78d9e commit e828ecc

31 files changed

+406
-360
lines changed

.github/workflows/build-and-tests.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Setup Node
3636
uses: actions/setup-node@v4
3737
with:
38-
node-version: 20
38+
node-version: 22
3939
- name: Cache Node Modules
4040
id: cache-node-modules
4141
uses: actions/cache@v4
@@ -207,7 +207,7 @@ jobs:
207207
uses: actions/setup-node@v4
208208
if: ${{ !matrix.settings.docker }}
209209
with:
210-
node-version: 20
210+
node-version: 22
211211
- name: Install Toolchain
212212
uses: dtolnay/rust-toolchain@stable
213213
if: ${{ !matrix.settings.docker }}
@@ -415,12 +415,12 @@ jobs:
415415
target: aarch64-apple-darwin
416416
node:
417417
- '18.0.0'
418-
- '20'
418+
- '22'
419419
include:
420420
- settings:
421421
host: ubuntu-latest
422422
target: x86_64-unknown-linux-gnu
423-
node: '20'
423+
node: '22'
424424
command: 'ci:coverage'
425425
additionalName: ' with Coverage'
426426
coverage: true
@@ -463,7 +463,7 @@ jobs:
463463
env:
464464
CI: true
465465
- name: Upload coverage
466-
uses: codecov/codecov-action@v4
466+
uses: codecov/codecov-action@v5
467467
if: matrix.coverage
468468
with:
469469
token: ${{ secrets.CODECOV_TOKEN }}

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# rollup changelog
22

3+
## 4.28.0
4+
5+
_2024-11-30_
6+
7+
### Features
8+
9+
- Allow to specify how to handle import attributes when transpiling Rollup config files (#5743)
10+
11+
### Pull Requests
12+
13+
- [#5743](https://github.com/rollup/rollup/pull/5743): fix: supports modify the import attributes key in the config file (@TrickyPi, @lukastaegert)
14+
- [#5747](https://github.com/rollup/rollup/pull/5747): chore(deps): update codecov/codecov-action action to v5 (@renovate[bot])
15+
- [#5748](https://github.com/rollup/rollup/pull/5748): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])
16+
317
## 4.27.4
418

519
_2024-11-23_

browser/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rollup/browser",
3-
"version": "4.27.4",
3+
"version": "4.28.0",
44
"description": "Next-generation ES module bundler browser build",
55
"main": "dist/rollup.browser.js",
66
"module": "dist/es/rollup.browser.js",

cli/run/loadConfigFile.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'node:path';
33
import process from 'node:process';
44
import { pathToFileURL } from 'node:url';
55
import * as rollup from '../../src/node-entry';
6-
import type { MergedRollupOptions } from '../../src/rollup/types';
6+
import type { ImportAttributesKey, MergedRollupOptions } from '../../src/rollup/types';
77
import { bold } from '../../src/utils/colors';
88
import {
99
error,
@@ -90,11 +90,16 @@ function getDefaultFromCjs(namespace: GenericConfigObject): unknown {
9090
return namespace.default || namespace;
9191
}
9292

93+
function getConfigImportAttributesKey(input: unknown): ImportAttributesKey | undefined {
94+
if (input === 'assert' || input === 'with') return input;
95+
return;
96+
}
97+
9398
async function loadTranspiledConfigFile(
9499
fileName: string,
95100
commandOptions: Record<string, unknown>
96101
): Promise<unknown> {
97-
const { bundleConfigAsCjs, configPlugin, silent } = commandOptions;
102+
const { bundleConfigAsCjs, configPlugin, configImportAttributesKey, silent } = commandOptions;
98103
const warnings = batchWarnings(commandOptions);
99104
const inputOptions = {
100105
external: (id: string) => (id[0] !== '.' && !path.isAbsolute(id)) || id.slice(-5) === '.json',
@@ -110,6 +115,7 @@ async function loadTranspiledConfigFile(
110115
} = await bundle.generate({
111116
exports: 'named',
112117
format: bundleConfigAsCjs ? 'cjs' : 'es',
118+
importAttributesKey: getConfigImportAttributesKey(configImportAttributesKey),
113119
plugins: [
114120
{
115121
name: 'transpile-import-meta',

docs/command-line-interface/index.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,17 @@ export default {
479479
480480
这允许你在配置中使用 CommonJS 常用的变量/方法,例如 `__dirname``require.resolve`,即使配置本身是作为 ES 模块编写的。
481481
482-
### `--configPlugin <plugin>` {#configplugin-plugin}
482+
### `--configImportAttributesKey <with | assert>`
483+
484+
控制 Rollup 在配置文件中用于导入属性的关键字。
485+
486+
```shell
487+
rollup --config rollup.config.ts --configPlugin typescript --configImportAttributesKey with
488+
```
489+
490+
此选项仅在使用 [`--configPlugin`](#configplugin-plugin) 或 [`--bundleConfigAsCjs`](#bundleconfigascjs) 选项时可用。
491+
492+
### `--configPlugin <plugin>`
483493
484494
允许指定 Rollup 插件来转译或控制解析配置文件。主要好处是可以使用非 JavaScript 的配置文件。例如,如果你安装了 `@rollup/plugin-typescript`,则以下内容将允许你使用 TypeScript 编写配置文件:
485495

0 commit comments

Comments
 (0)