Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(en): merge rollup/master into rollup-docs-cn/master @ 7a2bafbe #58

Merged
merged 10 commits into from
Aug 16, 2023
2 changes: 1 addition & 1 deletion .github/workflows/repl-artefacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v3
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts
run: npm i -g npm@8 && npm ci --ignore-scripts
- name: Run tests
run: npm run ci:test:only
env:
Expand All @@ -120,6 +120,9 @@ jobs:
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Update npm
if: (matrix.node == '14.18.0') && (steps.cache-node-modules.outputs.cache-hit != 'true')
run: npm i -g npm@8
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts
Expand Down Expand Up @@ -148,6 +151,9 @@ jobs:
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Update npm
if: (matrix.node == '14.18.0') && (steps.cache-node-modules.outputs.cache-hit != 'true')
run: npm i -g npm@8
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# rollup changelog

## 3.28.0

_2023-08-09_

### Features

- Add a new property `preliminaryFileName` to generated chunks containing the file name placeholder (#5086)
- Improve performance of sourcemap generation by lazily decoding mappings (#5087)

### Bug Fixes

- Make the `code` property of rendered modules in the output readonly (#5091)

### Pull Requests

- [#5086](https://github.com/rollup/rollup/pull/5086): feat: add `preliminaryFileName` to `OutputChunk` (@lsdsjy)
- [#5087](https://github.com/rollup/rollup/pull/5087): perf(sourcemaps): add back lazy sourcemap decode and handling nullish mappings (@thebanjomatic)
- [#5091](https://github.com/rollup/rollup/pull/5091): fix: the type of RenderedModule.code is readonly (@TrickyPi)

## 3.27.2

_2023-08-04_
Expand Down
2 changes: 1 addition & 1 deletion browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/browser",
"version": "3.27.2",
"version": "3.28.0",
"description": "Next-generation ES module bundler browser build",
"main": "dist/rollup.browser.js",
"module": "dist/es/rollup.browser.js",
Expand Down
2 changes: 1 addition & 1 deletion cli/run/watch-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function watch(command: Record<string, any>): Promise<void> {
const configFile = command.config ? await getConfigPath(command.config) : null;
const runWatchHook = createWatchHooks(command);

onExit(close);
onExit(close as any);
process.on('uncaughtException', closeWithError);
if (!process.stdin.isTTY) {
process.stdin.on('end', close);
Expand Down
1 change: 1 addition & 0 deletions docs/javascript-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ async function generateOutputs(bundle) {
// };
// },
// name: string // 用于命名模式的此 chunk 的名称
// preliminaryFileName: string // 此 chunk 带有哈希占位符的初始文件名
// referencedFiles: string[] // 通过 import.meta.ROLLUP_FILE_URL_<id> 引用的文件
// type: 'chunk', // 表示这是一个 chunk
// }
Expand Down
1 change: 1 addition & 0 deletions docs/plugin-development/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ interface ChunkInfo {
};
moduleIds: string[];
name: string;
preliminaryFileName: string;
referencedFiles: string[];
type: 'chunk';
}
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ npm install rollup --global
# or `npm i rollup -g` for short
```

你现在可以运行 `rollup` 命令了, 试一试吧!
你现在可以运行 `rollup` 命令了,试一试吧!

```shell
rollup
Expand Down Expand Up @@ -55,7 +55,7 @@ export default 'hello world!';
rollup src/main.js -f cjs
```

`-f` 选项 (是 `--format` 的缩写) 指定了产物的类型 — 在本例中是 CommonJS (可以在 Node.js 中运行)。 因为我们没有指定输出文件,所以它将直接打印到 `stdout`:
`-f` 选项 (是 `--format` 的缩写) 指定了产物的类型 — 在本例中是 CommonJS (可以在 Node.js 中运行)。因为我们没有指定输出文件,所以它将直接打印到 `stdout`:

```js
'use strict';
Expand All @@ -75,7 +75,7 @@ module.exports = main;
rollup src/main.js -o bundle.js -f cjs
```

(你也可以使用 `rollup src/main.js -f cjs > bundle.js`,但是后面我们会看到,如果你需要生成 sourcemaps 的话,这种方式的灵活性会更低。)
你也可以使用 `rollup src/main.js -f cjs > bundle.js`,但是后面我们会看到,如果你需要生成 sourcemaps 的话,这种方式的灵活性会更低。

尝试运行这段代码:

Expand Down Expand Up @@ -244,7 +244,7 @@ _注意:结果中只导入了我们实际需要的数据 ——`name`、`devDe

## 使用输出插件 {#using-output-plugins}

某些插件也可以专门应用于某些输出. 有关特定输出插件可以做什么的详细信息,请参见 [插件钩子](../plugin-development/index.md#build-hooks)。简而言之,这些插件只能在 Rollup 的主要分析完成后修改代码。如果使用不兼容的插件作为特定输出插件,Rollup 将会发出警告。一个可能的用例是压缩产物以在浏览器中使用。
某些插件也可以专门应用于某些输出有关特定输出插件可以做什么的详细信息,请参见 [插件钩子](../plugin-development/index.md#build-hooks)。简而言之,这些插件只能在 Rollup 的主要分析完成后修改代码。如果使用不兼容的插件作为特定输出插件,Rollup 将会发出警告。一个可能的用例是压缩产物以在浏览器中使用。

让我们扩展上一个示例,提供一个最小化的构建和一个非最小化的构建。为此,我们需要安装 `@rollup/plugin-terser`:

Expand Down
Loading
Loading