Skip to content

feat(ast)!: split MetaProperty into ImportMeta and NewTarget#24557

Merged
graphite-app[bot] merged 1 commit into
mainfrom
codex/split-meta-property
Jul 15, 2026
Merged

feat(ast)!: split MetaProperty into ImportMeta and NewTarget#24557
graphite-app[bot] merged 1 commit into
mainfrom
codex/split-meta-property

Conversation

@camc314

@camc314 camc314 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the generic Rust MetaProperty AST node with dedicated ImportMeta and NewTarget nodes
  • preserve the ESTree MetaProperty shape and generated public TypeScript types
  • update parser, formatter, codegen, lint, transform, minifier, traversal, and React compiler consumers

Summary

Remove MetaProperty AST node, in favour of two separate nodes (ImportMeta and NewTarget)

Breaking Change

The Rust AST field changes from:

pub struct MetaProperty<'a> {
    pub node_id: Cell<NodeId>,
    pub span: Span,
    pub meta: IdentifierName<'a>,
    pub property: IdentifierName<'a>,
}

to:

/// /// `import.meta` in `console.log(import.meta);`.
pub struct ImportMeta {
    pub node_id: Cell<NodeId>,
    pub span: Span,
}

/// `new.target` in `function F() { return new.target; }`.
pub struct NewTarget {
    pub node_id: Cell<NodeId>,
    pub span: Span,
}

Why?

The current AST could represent shapes such as:

foo.bar

By constructing the node manually. However this doesn't make sense, and is invalid.

How to migrate?

  1. Replace any Expression::MetaProperty matches/checks with the dedicated Expression::ImportMeta and Expression::NewTarget varients
  2. Replace any new_meta_property construction with the new new_import_meta or new_new_target APIs.
  3. Inspecting the meta/property identifier names is no longer required.

Copilot AI review requested due to automatic review settings July 15, 2026 13:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added A-linter Area - Linter A-parser Area - Parser A-cli Area - CLI A-minifier Area - Minifier A-ast Area - AST A-transformer Area - Transformer / Transpiler A-codegen Area - Code Generation A-ast-tools Area - AST tools A-formatter Area - Formatter A-linter-plugins Area - Linter JS plugins labels Jul 15, 2026
@camc314 camc314 changed the title refactor(ast): split meta property expressions feat(ast)!: split MetaProperty into ImportMeta and NewTarget Jul 15, 2026
@camc314 camc314 self-assigned this Jul 15, 2026
@camc314
camc314 marked this pull request as draft July 15, 2026 13:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 12ae2981e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread napi/parser/src-js/generated/lazy/constructors.js
@camc314
camc314 force-pushed the codex/split-meta-property branch from 12ae298 to c64ae42 Compare July 15, 2026 13:42
@codspeed-hq

codspeed-hq Bot commented Jul 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 9 skipped benchmarks1


Comparing codex/split-meta-property (97b4466) with main (71c2f53)2

Open in CodSpeed

Footnotes

  1. 9 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.

  2. No successful run was found on main (510c435) during the generation of this report, so 71c2f53 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@camc314
camc314 force-pushed the codex/split-meta-property branch from c64ae42 to ee6663b Compare July 15, 2026 13:46
@camc314

camc314 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@camc314 camc314 added run-monitor-oxc Add to a PR to dispatch oxc-project/monitor-oxc CI against it run-oxfmt-ecosystem-ci run-oxlint-ecosystem-ci labels Jul 15, 2026
@oxc-guard

oxc-guard Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Oxfmt Ecosystem CI

suite oxfmt@latest main refs/pull/24557/head branch
tale/headplane
formatjs/formatjs
fastify/fastify-vite
cnpm/cnpmcore
fuma-nama/fumadocs
openclaw/openclaw
vuejs/pinia
Comfy-Org/ComfyUI_frontend ⚠️
vercel/turborepo
eggjs/egg
AmanVarshney01/create-better-t-stack
huggingface/huggingface.js
cloudflare/agents
lichess-org/lila
vuejs/core
cloudflare/workers-sdk
mantinedev/mantine
actualbudget/actual
mastodon/mastodon
getsentry/sentry-javascript
npmx-dev/npmx.dev
aidenybai/react-grab
rolldown/rolldown
monkeytypegame/monkeytype
dyad-sh/dyad

💥 = panic, ⚠️ = error e.g. parse error (main/branch columns: only new errors), ❌ = diff or exit code mismatch, 🟨 = differs from oxfmt@latest (merged-but-unreleased changes)

@oxc-guard

oxc-guard Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@oxc-guard

oxc-guard Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@oxc-guard oxc-guard Bot removed run-oxlint-ecosystem-ci run-monitor-oxc Add to a PR to dispatch oxc-project/monitor-oxc CI against it labels Jul 15, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: ee6663b3d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@camc314
camc314 force-pushed the codex/split-meta-property branch from ee6663b to 82d6ad5 Compare July 15, 2026 14:19
@camc314

camc314 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@camc314
camc314 marked this pull request as ready for review July 15, 2026 14:33
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Jul 15, 2026

camc314 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

…24557)

## Summary
- replace the generic Rust MetaProperty AST node with dedicated ImportMeta and NewTarget nodes
- preserve the ESTree MetaProperty shape and generated public TypeScript types
- update parser, formatter, codegen, lint, transform, minifier, traversal, and React compiler consumers

## Summary

Remove `MetaProperty` AST node, in favour of two separate nodes (`ImportMeta` and `NewTarget`)

## Breaking Change

The Rust AST field changes from:

```rust
pub struct MetaProperty<'a> {
    pub node_id: Cell<NodeId>,
    pub span: Span,
    pub meta: IdentifierName<'a>,
    pub property: IdentifierName<'a>,
}
```

to:

```rust
/// /// `import.meta` in `console.log(import.meta);`.
pub struct ImportMeta {
    pub node_id: Cell<NodeId>,
    pub span: Span,
}

/// `new.target` in `function F() { return new.target; }`.
pub struct NewTarget {
    pub node_id: Cell<NodeId>,
    pub span: Span,
}
```

## Why?

The current AST could represent shapes such as:

```
foo.bar
```

By constructing the node manually. However this doesn't make sense, and is invalid.

## How to migrate?

1. Replace any `Expression::MetaProperty` matches/checks with the dedicated `Expression::ImportMeta` and `Expression::NewTarget` varients
2. Replace any `new_meta_property` construction with the new `new_import_meta` or `new_new_target` APIs.
3. Inspecting the `meta`/`property` identifier names is no longer required.
@graphite-app
graphite-app Bot force-pushed the codex/split-meta-property branch from 97b4466 to 54cc121 Compare July 15, 2026 14:48
@graphite-app
graphite-app Bot merged commit 54cc121 into main Jul 15, 2026
30 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jul 15, 2026
@graphite-app
graphite-app Bot deleted the codex/split-meta-property branch July 15, 2026 14:53
camc314 added a commit that referenced this pull request Jul 21, 2026
### 💥 BREAKING CHANGES

- 54cc121 ast: [**BREAKING**] Split `MetaProperty` into `ImportMeta` and
`NewTarget` (#24557) (camc314)

### 🚀 Features

- 4c71560 parser: More friendly error for spread element in dynamic
imports (#24705) (sapphi-red)
- 7b045cd minfier: Drop last break from last switch case (#24673)
(Armano)
- 7d3c178 minifier: Remove unreachable recursive functions (#24125)
(Dunqing)
- 94f99b3 ast: Allow `NONE` to be passed to AST builder methods where
`Option<ArenaVec>` is expected (#24629) (overlookmotel)
- 77230c5 ast: Accept arrays for `ArenaVec` params of AST builder
methods (#24621) (overlookmotel)
- f08b152 allocator: Implement `FromIn` for array to `Vec` conversion
(#24620) (overlookmotel)
- 2338c13 track-memory-allocations: Track heap deallocs, alloc bytes,
and peak growth (#24619) (Boshen)
- 7aa4739 syntax,transformer: Move JSX entity decoder to `oxc_syntax`
(#24617) (camc314)
- 2b097c4 str: Export `Str` as `ArenaStr` (#24604) (overlookmotel)
- 3acf4c1 minifier: Expand switch optimiation to remove empty cases
(#24520) (Armano)
- 129b759 parser: Improve diagnostics for unparenthesized LHS on
exponential expr (#24569) (camc314)
- 4d0c601 minifier: Fold arithmetic over undefined and null operands
(#24485) (Dunqing)
- 91541dd minifier: Drop empty switch statements  (#24527) (Armano)
- d05224d ast_visit: Generate VisitJs visitor that skips TypeScript
type-space (#24499) (Boshen)
- 3d22307 parser: Add `ParseOptions::enable_ident_hashes` (#24491)
(Boshen)

### 🐛 Bug Fixes

- 64c2241 minifier: Align class heritage removal with assumptions
(#24533) (Dunqing)
- 48b59f4 parser: Span ambient generator diagnostics (#24711) (camc314)
- e750a82 ecmascript: Fix false negative for may_have_side_effects on
dynamic property access (#24709) (sapphi-red)
- f145d73 minifier: Guard reordered identifier reads (#24698) (Dunqing)
- a2ef382 isolated-declarations: Reject `window.Symbol` as global symbol
reference (#24689) (camc314)
- b1bcf72 minifier: Invalidate facts for redeclared bindings (#24658)
(Dunqing)
- 921b834 minifier: Don't treat a conditionally-assigned var as
write-once (#24650) (Dunqing)
- 061af1f minifier: Avoid stale pure function summaries (#24636)
(Dunqing)
- 40c2f43 allocator: `Vec::from_array_in` do not allocate zero-length
array (#24628) (overlookmotel)
- 70994ae codegen: Preserve comments before expression operands (#24510)
(Dunqing)
- 7b4baff parser: Reject new import member access (#23459) (camc314)
- 128b385 minifier: Clippy warning with no-debug-assertions (#24547)
(camc314)
- 8421feb parser: Use first `as` span for imported name (#24537)
(leaysgur)
- c517aa0 parser: Reject invalid accessor assertions (#24504) (camc314)

### ⚡ Performance

- 884d9eb parser: Pre-size cover-grammar assignment target buffers
(#24683) (Boshen)
- d3f07a0 diagnostics: Box OxcDiagnosticInner to reduce binary size
(#24665) (Boshen)
- bcc9de0 parser: Defer diagnostic creation until parse exit (#24663)
(Boshen)
- c35d8ab allocator: Mark `ReplaceWith` panic path cold (#24515)
(camc314)
- ba65790 semantic, allocator: Branchless `clone_in` for semantic IDs
(#24564) (overlookmotel)
- 747feec parser: Build AST nodes with the AST builder instead of
cloning (#24540) (Boshen)
- ba35a0d react_compiler: Use IndexVec for dense id-keyed maps (#24549)
(Boshen)
- b685062 react_compiler: Keep small hot-path collections inline
(#24514) (Marius Schulz)
- a149e95 transformer: Outline rare expression exits (#24512) (camc314)
- 7808a6e react_compiler: Make aliasing effects cheap to intern and
clone (#24506) (Marius Schulz)
- 3a36f2a react_compiler: Store AbstractValue reasons as a u16 bitmask
(#24480) (Boshen)
- 1c96753 react_compiler: Use FxHashMap for the lookup-only aliasing
node map (#24490) (Boshen)

Co-authored-by: Cameron <[email protected]>
camc314 added a commit that referenced this pull request Jul 21, 2026
# Oxlint
### 💥 BREAKING CHANGES

- 54cc121 ast: [**BREAKING**] Split `MetaProperty` into `ImportMeta` and
`NewTarget` (#24557) (camc314)

### 🚀 Features

- 7b045cd minfier: Drop last break from last switch case (#24673)
(Armano)
- dd18383 linter/node: Implement no-top-level-await rule (#24634)
(Connor Shea)
- 16a65f2 linter/react: Implement function-component-definition rule
(#24471) (Cole Ellison)
- 7f1f585 linter: Reuse `jest/padding-around-test-blocks` for
`vitest/padding-around-test-blocks` (#24519) (Mikhail Baev)
- 99978a8 linter/import/consistent-type-specifier-style: Support
`prefer-top-level-if-only-type-imports` option (#24502) (camc314)

### 🐛 Bug Fixes

- 0184ad6 linter/unicorn/no-useless-undefined: Preserve valid parameter
defaults (#24686) (camc314)
- 8694167 linter/eslint/prefer-destructuring: Handle typed declarations
(#24616) (camc314)
- 477cf0f linter/eslint/no-throw-literal: Handle assigned errors
(#24561) (Cole Ellison)
- ac9200a linter: Detect React components from returned JSX (#24521)
(camc314)
- c0a6522 linter/eslint/no-useless-computed-key: Allow TS syntax in
computed keys (#24524) (Cole Ellison)

### ⚡ Performance

- 346eed1 linter/unicorn/prefer-event-target: Only run on `Class` and
`NewExpression` nodes (#24685) (Mikhail Baev)
- 7be5cf0 oxlint/lsp: Only invoke lint on code actions when document is
not opened (#24676) (Sysix)
- d3f07a0 diagnostics: Box OxcDiagnosticInner to reduce binary size
(#24665) (Boshen)
- 90ae040 linter/reporter/stylish: Compute diagnostic Info once per
diagnostic (#24525) (connorshea)

### 📚 Documentation

- e6f7174 linter/valid-expect: Fix correct example being identical to
incorrect one (#24468) (mkan0141)
# Oxfmt
### 💥 BREAKING CHANGES

- 54cc121 ast: [**BREAKING**] Split `MetaProperty` into `ImportMeta` and
`NewTarget` (#24557) (camc314)

### 🚀 Features

- 3d22307 parser: Add `ParseOptions::enable_ident_hashes` (#24491)
(Boshen)

### 🐛 Bug Fixes

- 6fe866a oxfmt: Keep tailwind classes glued to template expr with
`preserveWhitespace` (#24609) (leaysgur)
- 33e32d8 formatter_css: Use `line_suffix` for EOL line comment (#24580)
(leaysgur)
- 5f76998 formatter_graphql: Keep same line comments pending across
intervening tokens (#24579) (leaysgur)

Co-authored-by: Boshen <[email protected]>
Co-authored-by: Cameron <[email protected]>
graphite-app Bot pushed a commit that referenced this pull request Jul 21, 2026
Follow-on after #24557. Avoid runtime construction of `Ident`s (which involves runtime hash calculation) in custom serializers for `ImportMeta` and `NewTarget`. Instead use `static_ident!` which calculates the hash at compile time.
graphite-app Bot pushed a commit that referenced this pull request Jul 22, 2026
…et` (#24775)

Follow-on after #24557. Handle when `ImportMeta` / `NewTarget` has an empty span (`SPAN`). This code path is not exercised at present, but it seems a good idea to be prepared for when we may serialize AST after transformation.
graphite-app Bot pushed a commit that referenced this pull request Jul 22, 2026
…arget` (#24776)

Follow-on after #24557. Pure refactor.

Personally, I think it's clearer to have helper function below the main code, so it reads top-to-bottom.

It's a matter of taste, but it's consistent with other serializers (since it happens to be my taste, and I wrote most of the serializers).
graphite-app Bot pushed a commit that referenced this pull request Jul 22, 2026
…rget` (#24777)

Follow-on after #24557. Docs-only change. Add doc comments to custom serializers for `ImportMeta` and `NewTarget`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-ast-tools Area - AST tools A-cli Area - CLI A-codegen Area - Code Generation A-formatter Area - Formatter A-linter Area - Linter A-linter-plugins Area - Linter JS plugins A-minifier Area - Minifier A-parser Area - Parser A-transformer Area - Transformer / Transpiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants