Skip to content

feat(codegen): add sourcemap feature flag#17305

Merged
graphite-app[bot] merged 1 commit intomainfrom
feat/sourcemap-feature-flag
Dec 23, 2025
Merged

feat(codegen): add sourcemap feature flag#17305
graphite-app[bot] merged 1 commit intomainfrom
feat/sourcemap-feature-flag

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Dec 23, 2025

Oxlint uses oxc_codegen for fixes, but do not require sourcemap.

Copilot AI review requested due to automatic review settings December 23, 2025 10:10
@github-actions github-actions bot added A-linter Area - Linter A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler A-codegen Area - Code Generation A-isolated-declarations Isolated Declarations A-ast-tools Area - AST tools C-enhancement Category - New feature or request labels Dec 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_sourcemap an optional dependency with a sourcemap feature 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.

@Boshen Boshen force-pushed the feat/sourcemap-feature-flag branch from 88b5a6c to 5c23cda Compare December 23, 2025 10:14
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 23, 2025

CodSpeed Performance Report

Merging #17305 will not alter performance

Comparing feat/sourcemap-feature-flag (c1aa6cb) with main (8e4409a)

Summary

✅ 42 untouched
⏩ 3 skipped1

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Boshen Boshen force-pushed the feat/sourcemap-feature-flag branch 2 times, most recently from 3afea89 to c1aa6cb Compare December 23, 2025 10:22
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Dec 23, 2025
Copy link
Member Author

Boshen commented Dec 23, 2025

Merge activity

Oxlint uses `oxc_codegen` for fixes, but do not require sourcemap.
@graphite-app graphite-app bot force-pushed the feat/sourcemap-feature-flag branch from c1aa6cb to e031056 Compare December 23, 2025 10:28
@graphite-app graphite-app bot merged commit e031056 into main Dec 23, 2025
20 checks passed
@graphite-app graphite-app bot deleted the feat/sourcemap-feature-flag branch December 23, 2025 10:34
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast-tools Area - AST tools A-codegen Area - Code Generation A-isolated-declarations Isolated Declarations A-linter Area - Linter A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants