Skip to content

Commit a9e1adc

Browse files
authored
Merge pull request #207 from rollup/sync-af91d778
docs(en): merge rollup/master into rollup-docs-cn/master @ af91d77
2 parents f344c63 + 82f940e commit a9e1adc

45 files changed

Lines changed: 1127 additions & 1061 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 0 additions & 83 deletions
This file was deleted.

.github/instructions/TESTS.instructions.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Checkout Commit
3434
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3535
- name: Setup Node
36-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
36+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
3737
with:
3838
node-version: 24.10.0
3939
- name: Install and Cache Node Dependencies
@@ -209,11 +209,11 @@ jobs:
209209
- name: Checkout Commit
210210
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
211211
- name: Setup Node
212-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
212+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
213213
if: ${{ matrix.settings.target != 'x86_64-pc-windows-gnu' }}
214214
with:
215215
node-version: 24.10.0
216-
- uses: msys2/setup-msys2@cafece8e6baf9247cf9b1bf95097b0b983cc558d # v2
216+
- uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2
217217
if: ${{ matrix.settings.target == 'x86_64-pc-windows-gnu' }}
218218
with:
219219
msystem: ${{ matrix.settings.msystem }}
@@ -252,7 +252,7 @@ jobs:
252252
with:
253253
version: 0.14.1
254254
- name: Install cargo-zigbuild
255-
uses: taiki-e/install-action@85b24a67ef0c632dfefad70b9d5ce8fddb040754 # v2.75.10
255+
uses: taiki-e/install-action@7ea35f098a7369cd23488403f58be9c491a6c55f # v2.77.0
256256
if: ${{ matrix.settings.cross == 'zig' }}
257257
env:
258258
GITHUB_TOKEN: ${{ github.token }}
@@ -417,7 +417,7 @@ jobs:
417417
name: bindings-${{ matrix.settings.target }}
418418
path: dist/
419419
- name: Run Smoke Test
420-
uses: uraimo/run-on-arch-action@d94c13912ea685de38fccc1109385b83fd79427d # v3.0.1
420+
uses: uraimo/run-on-arch-action@f9b26e3a1a408d5fd530d20c17b9f3f4428ff8d9 # v3.1.0
421421
with:
422422
arch: ${{ matrix.settings.arch }}
423423
distro: ${{ matrix.settings.distro }}
@@ -507,7 +507,7 @@ jobs:
507507
- name: Checkout Commit
508508
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
509509
- name: Setup Node
510-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
510+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
511511
with:
512512
node-version: ${{ matrix.node }}
513513
check-latest: true
@@ -563,7 +563,7 @@ jobs:
563563
# Necessary to find the commits included in the release
564564
fetch-depth: 0
565565
- name: Setup Node
566-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
566+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
567567
with:
568568
node-version: 24.10.0
569569
registry-url: 'https://registry.npmjs.org'

.github/workflows/performance-report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
key: x86_64-unknown-linux-gnu-cargo-ubuntu-latest-${{ hashFiles('rust/Cargo.lock') }}
5252
restore-keys: x86_64-unknown-linux-gnu-cargo-ubuntu-latest
5353
- name: Setup Node
54-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
54+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
5555
with:
5656
node-version: 24.10.0
5757
- name: Install and Cache Node Dependencies
@@ -93,7 +93,7 @@ jobs:
9393
key: x86_64-unknown-linux-gnu-cargo-ubuntu-latest-${{ hashFiles('rust/Cargo.lock') }}
9494
restore-keys: x86_64-unknown-linux-gnu-cargo-ubuntu-latest
9595
- name: Setup Node
96-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
96+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
9797
with:
9898
node-version: 24.10.0
9999
- name: Install and Cache Node Dependencies

.github/workflows/repl-artefacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
key: wasm-cargo-ubuntu-latest-${{ hashFiles('rust/Cargo.lock') }}
5252
restore-keys: wasm-cargo-ubuntu-latest
5353
- name: Setup Node
54-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
54+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
5555
with:
5656
node-version: 24.10.0
5757
- name: Install and Cache Node Dependencies

AGENTS.md

Lines changed: 111 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,117 @@
11
# Rollup - Agent Instructions
22

3-
This file provides AI agents with references to detailed conventions and patterns for working with the Cart2Order codebase.
3+
Keep instructions concise, only add non-obvious information. Proactively update AGENTS.md to prevent future mistakes.
44

5-
Always read this file first: @.github/copilot-instructions.md
5+
## General
6+
7+
- Variables and functions should have clear, descriptive names that reflect their purpose and behavior and not e.g. their data types.
8+
- Code should be organized so that things that will most likely change together are located near each other, instead of e.g. grouping solely by technical categories.
9+
10+
## Architecture
11+
12+
- TypeScript + Rust hybrid: Rust code in `rust/` (bindings_napi, bindings_wasm, parse_ast crates) called via `native.js` and `native.wasm.js`
13+
- Generated files: Files with "Do not edit this file directly" comments (e.g., `src/ast/bufferParsers.ts`, `src/ast/childNodeKeys.ts`, `src/ast/nodeIds.ts`) are generated from `scripts/ast-types.ts` via `scripts/generate-ast-converters.ts` and files that are imported in that file
14+
- Tests run against full artifact only—no unit tests to allow easy refactoring of internal APIs
15+
- Test cases in `test/*/samples/` are configured via `_config.js` files; focus tests with `solo: true`
16+
- See CONTRIBUTING.md "How to write tests" for test type selection (function/form/chunking-form/cli/etc.)
17+
18+
## JS-Rust Interface
19+
20+
When adding/modifying functions that cross the JS-Rust boundary:
21+
22+
1. **Rust implementations**: Update `rust/bindings_napi/src/lib.rs` (Node native) and `rust/bindings_wasm/src/lib.rs` (WASM)
23+
2. **JS handover points** (must have matching signatures):
24+
- `native.js` - Node native build (NAPI)
25+
- `native.wasm.js` - Node WASM build
26+
- `browser/src/wasm.ts` - Browser WASM build
27+
3. **Build process**: `rollup.config.ts` replaces `native.js` with `browser/src/wasm.ts` for browser builds; CI replaces it with `native.wasm.js` for Node WASM builds
28+
4. **TypeScript definitions**: `native.d.ts` is auto-generated by napi-rs for NAPI bindings; WASM types are generated in `wasm/bindings_wasm.d.ts`
29+
5. **Testing builds** (will also generate definitions):
30+
- Node native: `npm run build:napi`
31+
- Browser WASM: `npm run build:wasm`
32+
- Node WASM: `npm run build:wasm:node`
33+
34+
## Rust Code Organization
35+
36+
- Focus on performance, avoid unnecessary copying of data or AST loops, build the final buffer once
37+
- When adding headers, reserve space for them once upfront to avoid the need to change all existing buffer references
38+
39+
## Browser Path Shim
40+
41+
- `browser/src/path.ts` replaces `node:path` in the browser build (wired via `rollup.config.ts` aliases)
42+
- `src/utils/relativeId.ts` imports `relative` **directly** from `../../browser/src/path` (not via `src/utils/path.ts`) so it works in both builds
43+
- `src/utils/path.ts` re-exports from `node:path`; for browser builds rollup.config.ts substitutes `browser/src/path.ts` transparently for all other imports
44+
45+
## Development Workflow
46+
47+
### Build Outputs
48+
49+
- **Node build**: Artifacts placed in `dist/` (JavaScript + `.node` native modules)
50+
- **Browser build**: Artifacts placed in `browser/dist/`; browser tests use `browser/dist/rollup.browser.js`
51+
- All tests import from these dist folders - tests run against the full built artifact only
52+
53+
### Quick Rebuild Commands
54+
55+
- `npm run build:quick` - Rebuild both JavaScript and Rust for Node build, copy to dist/
56+
- `npm run update:js` - Rebuild only JavaScript for both Node (`dist/`) and browser (`browser/dist/`), then copy native to dist/; run this after any change to `src/` or `browser/src/`
57+
- `npm run update:napi` - Rebuild only Rust NAPI, copy to dist/
58+
- `npm run build:copy-native` - Copy Rust `.node` files to dist/ (called internally by update commands)
59+
60+
### Full Build Commands
61+
62+
- `npm run build` - Full build: WASM + AST converters + NAPI (release) + JavaScript + copy native
63+
- `npm run build:napi` - Build Rust NAPI bindings (use `-- --release` for optimized)
64+
- `npm run build:wasm` - Build browser WASM
65+
- `npm run build:js` - Build JavaScript (Node and browser)
66+
67+
### Common Workflows
68+
69+
- **Rust changes only**: `npm run update:napi` then `npm run test:only`
70+
- **JavaScript changes only**: `npm run update:js` then `npm run test:only`
71+
- **AST schema changes**: `npm run build:ast-converters` to regenerate TypeScript and Rust files
72+
- **Testing changes**: `npm run build:quick` then `npm run test:only`
673

774
## Testing
875

9-
For how to write tests, read @.github/instructions/TESTS.instructions.md
76+
- Always test edge cases, especially in core logic or build/test infrastructure
77+
- Test names and descriptions use clear, descriptive language of the expected behavior, e.g. "description: 'does X when Y happens"
78+
79+
### Test Types
80+
81+
- Directory based tests
82+
- Should be preferred for tests if possible
83+
- Reside in directories in `test/<category>/samples`
84+
- Each test has a `_config.js` file with a description field and potentially other configuration options
85+
- The preferred way to work on a single or few of those tests is to add `solo: true` to the test's `_config.js` file first, and then run:
86+
```
87+
npm run build:quick
88+
npm run test:quick
89+
```
90+
- Each test category is run by a `test/<category>/index.js` file
91+
- The available options for each test category are defined in `test/types.d.ts`
92+
- Traditional file based tests
93+
- Are run directly by mocha using `describe` and `it` blocks
94+
- Can be found in `test/misc/`, `test/hooks` and `test/incremental`
95+
96+
### Test Categories
97+
98+
- **function**
99+
- Will bundle a `main.js` file next to the `_config.js` file and then run it
100+
- Has `node:assert` injected as a global variable in the bundled test code (`main.js`), allowing you to use `assert` directly without importing
101+
- In `_config.js`, you must explicitly require assert: `const assert = require('node:assert/strict');` to use it in the `exports` function or other config functions
102+
- Use when testing if bundled code still works (use inline assert in the code or the exports field in `_config.js` to make assertions)
103+
- Use when testing build errors, warnings, or plugin hooks
104+
- **form**
105+
- Will bundle a `main.js` file and store the output either as an `_actual` directory with outputs for each format (es.js, cjs.js, amd.js, system.js, umd.js, iife.js) or an `_actual.js` file for a single format, compared with an existing `_expected` directory or `_expected.js` file
106+
- The single `_actual.js` file will be generated if an `_expected.js` file is present. Having a single file is preferred, so when writing a form test, start with writing the `_expected.js` file before running the test for the first time
107+
- **chunking-form**
108+
- Similar to form, but always generates all formats and produces a separate directory for each format; the entire directory is compared with an `_expected` directory
109+
- Use when multiple files are expected in the output
110+
- **cli**
111+
- Use when running rollup as a command line tool
112+
113+
## Code Review Focus
114+
115+
- **Ignore style/linting issues** in test sample files (`test/*/samples/`) except for `_config.js` files
116+
- Test samples intentionally violate best practices to test edge cases—do not flag style violations in these files
117+
- Focus reviews on production code quality

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# rollup changelog
22

3+
## 4.60.3
4+
5+
_2026-05-04_
6+
7+
### Bug Fixes
8+
9+
- Ensure nested "exports" variables are not renamed (#6360)
10+
11+
### Pull Requests
12+
13+
- [#6360](https://github.com/rollup/rollup/pull/6360): fix: do not rename nested "exports" bindings that do not conflict (@tariqrafique, @lukastaegert)
14+
- [#6364](https://github.com/rollup/rollup/pull/6364): chore(deps): update msys2/setup-msys2 digest to e989830 (@renovate[bot])
15+
- [#6365](https://github.com/rollup/rollup/pull/6365): fix(deps): update minor/patch updates (@renovate[bot])
16+
- [#6366](https://github.com/rollup/rollup/pull/6366): fix(deps): update swc monorepo (major) (@renovate[bot])
17+
- [#6367](https://github.com/rollup/rollup/pull/6367): chore(deps): lock file maintenance (@renovate[bot], @lukastaegert)
18+
- [#6368](https://github.com/rollup/rollup/pull/6368): docs: add missing backticks in `plugin-development` (@lumirlumir, @lukastaegert)
19+
320
## 4.60.2
421

522
_2026-04-18_

0 commit comments

Comments
 (0)