feat(codegen): add sourcemap feature flag#17305
Merged
graphite-app[bot] merged 1 commit intomainfrom Dec 23, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a sourcemap feature flag to the oxc_codegen crate, allowing consumers like oxlint to use codegen for fixes without pulling in sourcemap dependencies. The feature is enabled by default to maintain backward compatibility.
Key changes:
- Made
oxc_sourcemapan optional dependency with asourcemapfeature flag (enabled by default) - Added conditional compilation attributes throughout the codebase for sourcemap-related code
- Updated all workspace consumers to explicitly enable or disable the sourcemap feature based on their needs
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
crates/oxc_codegen/Cargo.toml |
Defines the sourcemap feature flag, makes oxc_sourcemap optional, and sets it as default |
crates/oxc_codegen/src/lib.rs |
Gates sourcemap module, types, fields, and methods behind #[cfg(feature = "sourcemap")] with no-op implementations when disabled |
crates/oxc_codegen/tests/integration/main.rs |
Gates sourcemap test module behind the feature flag |
Cargo.toml |
Sets default-features = false for the workspace-level oxc_codegen reference |
crates/oxc/Cargo.toml |
Enables sourcemap feature when the codegen feature is used |
crates/oxc_linter/Cargo.toml |
Disables default features to avoid pulling in sourcemap dependency (key optimization for oxlint) |
crates/oxc_minifier/Cargo.toml |
Explicitly enables sourcemap feature as minifier generates source maps |
crates/oxc_isolated_declarations/Cargo.toml |
Enables sourcemap in dev-dependencies for testing |
crates/oxc_transformer/Cargo.toml |
Enables sourcemap in dev-dependencies for testing |
crates/oxc_transformer_plugins/Cargo.toml |
Enables sourcemap in dev-dependencies for testing |
napi/minify/Cargo.toml |
Enables sourcemap feature as the minify API exposes source maps |
tasks/ast_tools/Cargo.toml |
Enables sourcemap feature for AST tools |
tasks/benchmark/Cargo.toml |
Enables sourcemap feature for benchmarking |
tasks/minsize/Cargo.toml |
Enables sourcemap feature for minsize testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
88b5a6c to
5c23cda
Compare
CodSpeed Performance ReportMerging #17305 will not alter performanceComparing Summary
Footnotes
|
3afea89 to
c1aa6cb
Compare
Member
Author
Merge activity
|
Oxlint uses `oxc_codegen` for fixes, but do not require sourcemap.
c1aa6cb to
e031056
Compare
This was referenced Dec 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Oxlint uses
oxc_codegenfor fixes, but do not require sourcemap.