Back to Rspack

Glossary

.agents/GLOSSARY.md

2.0.18.3 KB
Original Source

Glossary

Terms and concepts used in Rspack codebase and documentation.

Core Concepts

Bundler

Tool that combines multiple JavaScript modules and dependencies into optimized bundles.

Module

Single unit of code (typically JS/TS file) that can be imported/required by other modules.

Chunk

Group of modules bundled together into a single output file. Types: entry chunks, async chunks, vendor chunks.

Entry Point

Starting point(s) of the application. Rspack builds the module graph from entry points.

Module Graph

Dependency graph structure tracking all modules and their dependencies in compilation.

Chunk Graph

Graph structure tracking relationships between chunks and which modules belong to which chunks.

Compilation Terms

Compilation

Single build instance that processes modules, creates chunks, and generates output assets.

Compiler

Main orchestrator managing compilation lifecycle, plugins, and configuration.

Build

Process of transforming source code into optimized output files.

Make Phase

Phase where modules are built and dependency graph is constructed.

Seal Phase

Phase where compilation is finalized and no more modules can be added.

Emit Phase

Phase where output assets are written to the file system.

Module System

Normal Module

Regular JavaScript/TypeScript module parsed and processed normally.

Context Module

Module created from dynamic require context (e.g., require.context('./dir', true, /\.js$/)).

External Module

Module not bundled but referenced externally (e.g., from CDN or global variable).

Concatenated Module

Multiple modules concatenated together for optimization (scope hoisting).

Runtime Module

Module containing webpack runtime code for module loading and HMR.

Dependency Types

Dependency

Relationship between modules, representing an import, require, or other module reference.

Module Dependency

Dependency on another module (e.g., import './module').

Entry Dependency

Dependency representing an entry point.

Context Dependency

Dependency representing a require context.

External Dependency

Dependency on external module that won't be bundled.

Chunk Types

Entry Chunk

Chunk generated from entry point. Can be initial (loaded immediately) or non-initial.

Async Chunk

Chunk loaded asynchronously (e.g., via dynamic import or code splitting).

Initial Chunk

Chunk that must be loaded before entry point can execute.

Runtime Chunk

Chunk containing webpack runtime code, can be separated for better caching.

Vendor Chunk

Chunk containing third-party dependencies, often separated for caching.

Asset Terms

Asset

Output file generated by compilation (JavaScript, CSS, images, etc.).

Source

Content of an asset, represented as Source object that can be read and transformed.

Asset Info

Metadata about an asset (size, related assets, etc.).

Filename Template

Template string for generating output filenames with placeholders (e.g., [name].[hash].js).

Plugin System

Plugin

JavaScript object or class extending Rspack's functionality by hooking into compilation lifecycle.

Hook

Point in compilation process where plugins can intercept and modify behavior.

Tap

Act of registering a callback function to a hook.

Hook Type

Execution model of a hook (sync/async, series/parallel, bail).

Builtin Plugin

Core plugin provided by Rspack (e.g., JavaScript plugin, CSS plugin).

Loader System Terms

Loader

Function that transforms source code before it's added to the dependency graph.

Loader Chain

Sequence of loaders applied to a module in reverse order.

Loader Context

Context object (this) provided to loaders with utilities and metadata.

Pitch Loader

Loader that executes in the "pitch" phase (before loader chain runs normally).

Optimization Terms

Tree Shaking

Process of removing unused code from bundle by analyzing import/export usage.

Code Splitting

Process of splitting code into multiple chunks for better caching and loading performance.

Minification

Process of reducing code size by removing whitespace, shortening names, and optimizing code.

Scope Hoisting

Optimization that concatenates modules into single scope to reduce function call overhead.

Dead Code Elimination

Removing code that is never executed (form of tree shaking).

Caching Terms

Persistent Cache

Disk-based cache that persists across builds to speed up subsequent builds.

Memory Cache

In-memory cache used during a single build.

Cache Invalidation

Process of determining when cached data is no longer valid and needs regeneration.

Cache Key

Unique identifier for cached data, typically based on file content and configuration.

File System Terms

Input File System

File system abstraction for reading source files.

Output File System

File system abstraction for writing output files.

Intermediate File System

File system abstraction for temporary files during compilation.

Watch File System

File system abstraction for monitoring file changes in watch mode.

Development Terms

Hot Module Replacement (HMR)

Feature allowing updating modules in browser without full page reload.

Watch Mode

Mode where Rspack watches for file changes and automatically rebuilds.

Dev Server

Development server that serves built application and supports HMR.

Source Map

File mapping transformed code back to original source code for debugging.

Build Modes

Development Mode

Optimized for fast builds and debugging, includes source maps and development tools.

Production Mode

Optimized for smaller bundle size and performance, includes minification and tree shaking.

Technical Terms

AST (Abstract Syntax Tree)

Tree representation of syntactic structure of source code.

NAPI (Node-API)

Stable API for building native Node.js addons, used for Rust-JavaScript interop.

Binding

Layer connecting Rust code to JavaScript/TypeScript, typically via NAPI.

Crate

Rust package/library (equivalent to npm package in JavaScript).

Monorepo

Repository containing multiple related packages or projects.

Rspack-Specific Terms

Rspack

High-performance JavaScript bundler written in Rust.

Rstack

Unified JavaScript toolchain centered on Rspack (includes Rspack, Rsbuild, Rslib, etc.).

Builtin Loader

Loader implemented natively in Rust for better performance (e.g., SWC loader, Lightning CSS loader).

Rspack Builtin Plugin

Core plugin provided by Rspack, typically implemented in Rust.

RsDoctor

Build analyzer tool for debugging and optimizing Rspack builds.

Rstest

Testing framework for Rspack.

Rslint

Linter for Rspack projects.

Webpack Compatibility Terms

Webpack Compatible

API or feature that works the same way as in webpack.

Webpack Plugin

Plugin designed for webpack that may or may not work with Rspack.

Webpack Loader

Loader designed for webpack that may or may not work with Rspack.

Abbreviations

  • HMR: Hot Module Replacement
  • AST: Abstract Syntax Tree
  • API: Application Programming Interface
  • NAPI: Node-API
  • CLI: Command Line Interface
  • E2E: End-to-End (testing)
  • ESM: ECMAScript Modules
  • CJS: CommonJS
  • AMD: Asynchronous Module Definition
  • UMD: Universal Module Definition
  • IIFE: Immediately Invoked Function Expression
  • SRI: Subresource Integrity
  • DLL: Dynamic Link Library
  • MF: Module Federation
  • SWC: Speedy Web Compiler
  • CSS: Cascading Style Sheets
  • HTML: HyperText Markup Language
  • JSON: JavaScript Object Notation
  • WASM: WebAssembly
  • TS: TypeScript
  • JS: JavaScript
  • FS: File System
  • URL: Uniform Resource Locator
  • URI: Uniform Resource Identifier
  • CDN: Content Delivery Network

Module Federation

Technique for sharing code between multiple applications at runtime.

Lazy Loading

Loading code only when needed, typically via dynamic imports.

Prefetching

Loading resources in advance before they're needed.

Preloading

Loading critical resources early in page load process.

Resources