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
22 changes: 11 additions & 11 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Rspack

## Project Overview
## Project overview

Rspack is a high-performance JavaScript bundler written in Rust that offers strong compatibility with the webpack ecosystem.

## Project Architecture
## Project architecture

- **Monorepo** with Rust crates (`crates/`) and JavaScript packages (`packages/`)
- See [Project Architecture](website/docs/en/contribute/development/project.md) for details
Expand Down Expand Up @@ -44,16 +44,16 @@ Depends on what you have modified, you need to rebuild by `pnpm run build:js` or
- **JavaScript**: Use `--inspect` flag, attach with `Attach JavaScript`
- **rust-lldb**: `rust-lldb -- node /path/to/rspack build` for panic debugging

## Code Quality
## Code quality

- **Linting**: `pnpm run lint:js` (Biome), `pnpm run lint:rs` (cargo check), `pnpm run lint:type` (Rslint)
- **Formatting**: `pnpm run format:rs` (cargo fmt), `pnpm run format:js` (prettier), `pnpm run format:toml` (taplo)
- **Rust gate**: After modifying Rust code, ensure both `cargo fmt --all --check` and `cargo lint` pass before commit/PR
- **Style**: snake_case for Rust, camelCase for JS/TS

## Common Tasks
## Common tasks

### Adding a New Feature
### Adding a new feature

1. Create feature branch from `main`
2. Implement in appropriate crate/package
Expand All @@ -63,17 +63,17 @@ Depends on what you have modified, you need to rebuild by `pnpm run build:js` or
6. Format: `pnpm run format:rs && pnpm run format:js`
7. Create PR

### Modifying Code
### Modifying code

- **Rust**: Core in `crates/rspack_core/`, plugins in `crates/rspack_plugin_*/`, rebuild with `pnpm run build:binding:dev`, test with `pnpm run test:rs`, and ensure `cargo fmt --all --check && cargo lint` passes
- **JS/TS**: API in `packages/rspack/src/`, CLI in `packages/rspack-cli/src/`, rebuild with `pnpm run build:js`, test with `pnpm run test:unit`

### Adding Tests
### Adding tests

- **Rust**: Add `#[test]` functions in same file or `tests/` directory
- **JavaScript**: Add cases in `tests/rspack-test/{type}Cases/` (Normal, Config, Hot, Watch, StatsOutput, StatsAPI, Diagnostic, Hash, Compiler, Defaults, Error, Hook, TreeShaking, Builtin)

## Dependency Management
## Dependency management

- **Package manager**: pnpm (workspaces for monorepo)
- **Rust**: `Cargo.toml` in each crate
Expand All @@ -93,7 +93,7 @@ Depends on what you have modified, you need to rebuild by `pnpm run build:js` or
- **API**: `website/docs/en/api/`
- **Extract API**: `pnpm run api-extractor:local`

## Pull Request Guidelines
## Pull request guidelines

- **Template**: Use `.github/PULL_REQUEST_TEMPLATE.md`
- **Title prefix**: `test:`, `fix:`, `feat:`, `refactor:`, `chore:`
Expand All @@ -113,15 +113,15 @@ Depends on what you have modified, you need to rebuild by `pnpm run build:js` or
- Prefer these types for release impact: `fix`, `feat`; use `!` or `BREAKING CHANGE:` only for incompatible changes
- Keep PRs focused (one feature/fix per PR)

## Finding Code
## Finding code

- **Rust core**: `crates/rspack_core/`
- **Plugins**: `crates/rspack_plugin_*/`
- **JavaScript API**: `packages/rspack/src/`
- **CLI**: `packages/rspack-cli/src/`
- **Tests**: `tests/rspack-test/`

## Error Handling
## Error handling

- Use `rspack_error` crate for Rust errors
- Provide clear, actionable error messages
Expand Down
6 changes: 3 additions & 3 deletions crates/rspack_binding_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Shared binding API for Rspack, providing bridge interfaces between Rspack core f
- `plugin`: Enable SWC plugin support
- `sftrace-setup`: Enable performance tracing setup

## Important Notice
## Important notice

⚠️ **Version Compatibility Warning**

Expand All @@ -23,13 +23,13 @@ Shared binding API for Rspack, providing bridge interfaces between Rspack core f
- It is recommended to lock specific version numbers in production environments
- Please thoroughly test all functionality before upgrading

## API Usage Warning
## API usage warning

🚨 **This package's API should NOT be used as a public Rust API**

This crate is designed to be linked as a **C dynamic library** during Rspack binding generation, not as a public Rust API for external consumption.

### For Developers
### For developers

If you're working on Rspack itself:

Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A toolkit for debugging and testing rspack internals.

## Commands

### `compare` - Compare Cache In Directories
### `compare` - Compare cache in directories

Compare the cache content of two directories to verify they contain identical data.

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"build:cli:release:browser": "pnpm --filter @rspack/binding build:release:browser && pnpm run build:js",
"test:js": "pnpm -r run test",
"format:rs": "cargo fmt --all",
"format:js": "prettier . --write",
"format-ci:js": "prettier . --check",
"format:js": "prettier . --write && heading-case --write",
"format-ci:js": "prettier . --check && heading-case",
"format-ci:toml": "taplo format --check",
"format:toml": "taplo format",
"lint:js": "pnpm run lint-ci:js --write",
Expand Down Expand Up @@ -73,6 +73,7 @@
"check-dependency-version-consistency": "^5.0.1",
"commander": "14.0.3",
"cross-env": "^10.1.0",
"heading-case": "^1.0.7",
"husky": "^9.1.7",
"is-ci": "4.1.0",
"lint-staged": "^16.2.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack-test-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Test tools for rspack.

## Wasm Tests
## Wasm tests

We expect to reuse the tests for Rspack wasm target as many as possible and we have managed to do it partially. Currently wasm tests should be run with an environment variable `WASM=1` under the following limitations:

Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/e2e/cases/lazy-compilation/cross-origin/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cross-Origin Lazy Compilation Test
# Cross-Origin lazy compilation test

This test verifies that lazy compilation works correctly
when the lazy compilation server runs on a different origin (port) than the frontend dev server.
Expand Down Expand Up @@ -38,7 +38,7 @@ when the lazy compilation server runs on a different origin (port) than the fron
+----------------------+ | |
```

## Key Points
## Key points

1. **Two Separate Servers**: Frontend runs on port 8500, lazy compilation on port 8600
2. **Cross-Origin Request**: Browser sends POST request to a different origin
Expand Down
4 changes: 2 additions & 2 deletions website/docs/en/config/filename-placeholders.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ URL placeholders expose information about the current request URL.
| -------- | ----------- |
| `[url]` | URL value |

## Hash Length
## Hash length

Hash placeholders (`[hash]`, `[contenthash]`, `[chunkhash]`) support length modifiers using `[hash:n]`, where the default length is 16.

Expand Down Expand Up @@ -153,7 +153,7 @@ Entry chunks and chunks produced by [optimization.splitChunks](/plugins/webpack/

:::

## Escaping Placeholders
## Escaping placeholders

If you want to preserve the literal placeholder text instead of having Rspack interpolate it, escape the brackets with backslashes.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/en/config/module-rules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import WebpackLicense from '@components/WebpackLicense';

<WebpackLicense from="https://webpack.docschina.org/configuration/module/" />

# Module Rules
# Module rules

- **Type:** `(Rule | Falsy)[]`
- **Default:** `[]`
Expand Down
Loading
Loading