Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 0 additions & 83 deletions .github/copilot-instructions.md

This file was deleted.

41 changes: 0 additions & 41 deletions .github/instructions/TESTS.instructions.md

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Checkout Commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.10.0
- name: Install and Cache Node Dependencies
Expand Down Expand Up @@ -209,11 +209,11 @@ jobs:
- name: Checkout Commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
if: ${{ matrix.settings.target != 'x86_64-pc-windows-gnu' }}
with:
node-version: 24.10.0
- uses: msys2/setup-msys2@cafece8e6baf9247cf9b1bf95097b0b983cc558d # v2
- uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2
if: ${{ matrix.settings.target == 'x86_64-pc-windows-gnu' }}
with:
msystem: ${{ matrix.settings.msystem }}
Expand Down Expand Up @@ -252,7 +252,7 @@ jobs:
with:
version: 0.14.1
- name: Install cargo-zigbuild
uses: taiki-e/install-action@85b24a67ef0c632dfefad70b9d5ce8fddb040754 # v2.75.10
uses: taiki-e/install-action@7ea35f098a7369cd23488403f58be9c491a6c55f # v2.77.0
if: ${{ matrix.settings.cross == 'zig' }}
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -417,7 +417,7 @@ jobs:
name: bindings-${{ matrix.settings.target }}
path: dist/
- name: Run Smoke Test
uses: uraimo/run-on-arch-action@d94c13912ea685de38fccc1109385b83fd79427d # v3.0.1
uses: uraimo/run-on-arch-action@f9b26e3a1a408d5fd530d20c17b9f3f4428ff8d9 # v3.1.0
with:
arch: ${{ matrix.settings.arch }}
distro: ${{ matrix.settings.distro }}
Expand Down Expand Up @@ -507,7 +507,7 @@ jobs:
- name: Checkout Commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node }}
check-latest: true
Expand Down Expand Up @@ -563,7 +563,7 @@ jobs:
# Necessary to find the commits included in the release
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.10.0
registry-url: 'https://registry.npmjs.org'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/performance-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
key: x86_64-unknown-linux-gnu-cargo-ubuntu-latest-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: x86_64-unknown-linux-gnu-cargo-ubuntu-latest
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.10.0
- name: Install and Cache Node Dependencies
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
key: x86_64-unknown-linux-gnu-cargo-ubuntu-latest-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: x86_64-unknown-linux-gnu-cargo-ubuntu-latest
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.10.0
- name: Install and Cache Node Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repl-artefacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
key: wasm-cargo-ubuntu-latest-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: wasm-cargo-ubuntu-latest
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.10.0
- name: Install and Cache Node Dependencies
Expand Down
114 changes: 111 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,117 @@
# Rollup - Agent Instructions

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

Always read this file first: @.github/copilot-instructions.md
## General

- Variables and functions should have clear, descriptive names that reflect their purpose and behavior and not e.g. their data types.
- 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.

## Architecture

- TypeScript + Rust hybrid: Rust code in `rust/` (bindings_napi, bindings_wasm, parse_ast crates) called via `native.js` and `native.wasm.js`
- 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
- Tests run against full artifact only—no unit tests to allow easy refactoring of internal APIs
- Test cases in `test/*/samples/` are configured via `_config.js` files; focus tests with `solo: true`
- See CONTRIBUTING.md "How to write tests" for test type selection (function/form/chunking-form/cli/etc.)

## JS-Rust Interface

When adding/modifying functions that cross the JS-Rust boundary:

1. **Rust implementations**: Update `rust/bindings_napi/src/lib.rs` (Node native) and `rust/bindings_wasm/src/lib.rs` (WASM)
2. **JS handover points** (must have matching signatures):
- `native.js` - Node native build (NAPI)
- `native.wasm.js` - Node WASM build
- `browser/src/wasm.ts` - Browser WASM build
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
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`
5. **Testing builds** (will also generate definitions):
- Node native: `npm run build:napi`
- Browser WASM: `npm run build:wasm`
- Node WASM: `npm run build:wasm:node`

## Rust Code Organization

- Focus on performance, avoid unnecessary copying of data or AST loops, build the final buffer once
- When adding headers, reserve space for them once upfront to avoid the need to change all existing buffer references

## Browser Path Shim

- `browser/src/path.ts` replaces `node:path` in the browser build (wired via `rollup.config.ts` aliases)
- `src/utils/relativeId.ts` imports `relative` **directly** from `../../browser/src/path` (not via `src/utils/path.ts`) so it works in both builds
- `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

## Development Workflow

### Build Outputs

- **Node build**: Artifacts placed in `dist/` (JavaScript + `.node` native modules)
- **Browser build**: Artifacts placed in `browser/dist/`; browser tests use `browser/dist/rollup.browser.js`
- All tests import from these dist folders - tests run against the full built artifact only

### Quick Rebuild Commands

- `npm run build:quick` - Rebuild both JavaScript and Rust for Node build, copy to dist/
- `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/`
- `npm run update:napi` - Rebuild only Rust NAPI, copy to dist/
- `npm run build:copy-native` - Copy Rust `.node` files to dist/ (called internally by update commands)

### Full Build Commands

- `npm run build` - Full build: WASM + AST converters + NAPI (release) + JavaScript + copy native
- `npm run build:napi` - Build Rust NAPI bindings (use `-- --release` for optimized)
- `npm run build:wasm` - Build browser WASM
- `npm run build:js` - Build JavaScript (Node and browser)

### Common Workflows

- **Rust changes only**: `npm run update:napi` then `npm run test:only`
- **JavaScript changes only**: `npm run update:js` then `npm run test:only`
- **AST schema changes**: `npm run build:ast-converters` to regenerate TypeScript and Rust files
- **Testing changes**: `npm run build:quick` then `npm run test:only`

## Testing

For how to write tests, read @.github/instructions/TESTS.instructions.md
- Always test edge cases, especially in core logic or build/test infrastructure
- Test names and descriptions use clear, descriptive language of the expected behavior, e.g. "description: 'does X when Y happens"

### Test Types

- Directory based tests
- Should be preferred for tests if possible
- Reside in directories in `test/<category>/samples`
- Each test has a `_config.js` file with a description field and potentially other configuration options
- 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:
```
npm run build:quick
npm run test:quick
```
- Each test category is run by a `test/<category>/index.js` file
- The available options for each test category are defined in `test/types.d.ts`
- Traditional file based tests
- Are run directly by mocha using `describe` and `it` blocks
- Can be found in `test/misc/`, `test/hooks` and `test/incremental`

### Test Categories

- **function**
- Will bundle a `main.js` file next to the `_config.js` file and then run it
- Has `node:assert` injected as a global variable in the bundled test code (`main.js`), allowing you to use `assert` directly without importing
- 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
- Use when testing if bundled code still works (use inline assert in the code or the exports field in `_config.js` to make assertions)
- Use when testing build errors, warnings, or plugin hooks
- **form**
- 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
- 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
- **chunking-form**
- 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
- Use when multiple files are expected in the output
- **cli**
- Use when running rollup as a command line tool

## Code Review Focus

- **Ignore style/linting issues** in test sample files (`test/*/samples/`) except for `_config.js` files
- Test samples intentionally violate best practices to test edge cases—do not flag style violations in these files
- Focus reviews on production code quality
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# rollup changelog

## 4.60.3

_2026-05-04_

### Bug Fixes

- Ensure nested "exports" variables are not renamed (#6360)

### Pull Requests

- [#6360](https://github.com/rollup/rollup/pull/6360): fix: do not rename nested "exports" bindings that do not conflict (@tariqrafique, @lukastaegert)
- [#6364](https://github.com/rollup/rollup/pull/6364): chore(deps): update msys2/setup-msys2 digest to e989830 (@renovate[bot])
- [#6365](https://github.com/rollup/rollup/pull/6365): fix(deps): update minor/patch updates (@renovate[bot])
- [#6366](https://github.com/rollup/rollup/pull/6366): fix(deps): update swc monorepo (major) (@renovate[bot])
- [#6367](https://github.com/rollup/rollup/pull/6367): chore(deps): lock file maintenance (@renovate[bot], @lukastaegert)
- [#6368](https://github.com/rollup/rollup/pull/6368): docs: add missing backticks in `plugin-development` (@lumirlumir, @lukastaegert)

## 4.60.2

_2026-04-18_
Expand Down
Loading
Loading