Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Oct 16, 2025

Add the ability to feature-gate code with comments as well as constants.

Before:

if (THING) doStuff();
if (!THING) doOtherStuff();

After:

/* IF THING */
doStuff();
/* END_IF */

/* IF !THING */
doOtherStuff();
/* END_IF */

The first form is still supported, but the latter is useful in places where the former doesn't work e.g.:

/* IF THING */
export function doStuff() { /* ... */ }
/* END_IF */

If THING flag is not set for a variant, the code between the comments will be stripped out.

Copy link
Member Author

overlookmotel commented Oct 16, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel self-assigned this Oct 16, 2025
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Oct 16, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 16, 2025

Merge activity

Add the ability to feature-gate code with comments as well as constants.

Before:

```js
if (THING) doStuff();
if (!THING) doOtherStuff();
```

After:

```js
/* IF THING */
doStuff();
/* END_IF */

/* IF !THING */
doOtherStuff();
/* END_IF */
```

The first form is still supported, but the latter is useful in places where the former doesn't work e.g.:

```js
/* IF THING */
export function doStuff() { /* ... */ }
/* END_IF */
```

If `THING` flag is not set for a variant, the code between the comments will be stripped out.
graphite-app bot pushed a commit that referenced this pull request Oct 16, 2025
In `oxc_ast_tools` codegen, generated variants of code by parsing source text multiple times, instead of parsing once and then cloning AST. This is a deoptimization in itself, but allows modifying the source text prior to parsing, which is useful for #14681.
@graphite-app graphite-app bot force-pushed the 10-16-perf_ast_tools_parallelize_minifying_code branch from 48387a6 to b0dade2 Compare October 16, 2025 20:52
@graphite-app graphite-app bot force-pushed the 10-16-feat_ast_tools_support_comment_blocks_in_variants branch from 54e9ef6 to eaf1ab1 Compare October 16, 2025 20:52
graphite-app bot pushed a commit that referenced this pull request Oct 16, 2025
Pure refactor. Simplify the codegen for ESTree walker, using the feature flag comments introduced in #14681. Does not alter the generated code, only the codegen.
graphite-app bot pushed a commit that referenced this pull request Oct 16, 2025
…w transfer deserializers (#14683)

Use the feature flag comments introduced in #14681 to remove a bunch of unused code from the raw transfer deserializer used in Oxlint JS plugins. Also remove a little unused code from the parser's deserializers.
Base automatically changed from 10-16-perf_ast_tools_parallelize_minifying_code to main October 16, 2025 20:56
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 16, 2025
@graphite-app graphite-app bot merged commit eaf1ab1 into main Oct 16, 2025
19 checks passed
@graphite-app graphite-app bot deleted the 10-16-feat_ast_tools_support_comment_blocks_in_variants branch October 16, 2025 20:57
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 C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants