|
| 1 | +# Rspack - GitHub Copilot Instructions |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +Rspack is a high-performance JavaScript bundler written in Rust that offers strong compatibility with the webpack ecosystem. It provides lightning-fast build speeds while allowing seamless replacement of webpack in existing projects. |
| 6 | + |
| 7 | +## Project Architecture |
| 8 | + |
| 9 | +This is a **monorepo** containing both Rust crates and JavaScript packages: |
| 10 | + |
| 11 | +### Rust crates (`crates/`) |
| 12 | + |
| 13 | +- **Core Engine**: Written in Rust for performance |
| 14 | +- **Plugins**: Extensive plugin system (css, javascript, html, etc.) |
| 15 | +- **Bindings**: Node.js bindings through NAPI |
| 16 | +- **Utilities**: Support crates for paths, collections, macros, etc. |
| 17 | + |
| 18 | +### NPM packages (`packages/`) |
| 19 | + |
| 20 | +- **CLI Tools**: Command-line interface and tooling |
| 21 | +- **API Wrappers**: JavaScript APIs wrapping Rust core |
| 22 | +- **Test Tools**: Testing utilities and frameworks |
| 23 | +- **Create Tools**: Project scaffolding tools |
| 24 | + |
| 25 | +## Development Environment |
| 26 | + |
| 27 | +### Prerequisites |
| 28 | + |
| 29 | +- **Rust**: Uses nightly toolchain (see `rust-toolchain.toml`) |
| 30 | +- **Node.js**: 22+ |
| 31 | +- **pnpm**: enforced in `package.json |
| 32 | + |
| 33 | +### Key Commands |
| 34 | + |
| 35 | +```bash |
| 36 | +# Build Rust bindings (development) |
| 37 | +pnpm run build:binding:dev |
| 38 | + |
| 39 | +# Build JavaScript packages |
| 40 | +pnpm run build:js |
| 41 | + |
| 42 | +# Full development build |
| 43 | +pnpm run build:cli:dev |
| 44 | + |
| 45 | +# Run tests |
| 46 | +pnpm run test:unit # JavaScript unit tests |
| 47 | +pnpm run test:e2e # E2E tests |
| 48 | +pnpm run test:webpack # webpack compatibility tests |
| 49 | + |
| 50 | +# Linting |
| 51 | +pnpm run lint:js # Linting with Biome |
| 52 | +pnpm run lint:type # Type checking with Rslint |
| 53 | +``` |
| 54 | + |
| 55 | +### File Organization |
| 56 | + |
| 57 | +``` |
| 58 | +rspack/ |
| 59 | +βββ crates/ # Rust source code |
| 60 | +βββ packages/ # JavaScript packages |
| 61 | +βββ tests/ # Integration tests |
| 62 | +β βββ webpack-test/ # Webpack compatibility tests |
| 63 | +β βββ e2e/ # E2E tests |
| 64 | +β βββ bench/ # Benchmarking |
| 65 | +βββ website/ # Documentation site |
| 66 | +``` |
| 67 | + |
| 68 | +## Contributing Guidelines |
| 69 | + |
| 70 | +- Follow existing code patterns and conventions |
| 71 | +- Add tests for new features |
| 72 | +- Update documentation when changing APIs |
| 73 | +- Run all linters and tests before submitting |
| 74 | +- Use conventional commit messages |
| 75 | +- Keep PRs focused and atomic |
0 commit comments