Skip to content

feat: support import.meta style module variables#14539

Merged
LingyuCoder merged 11 commits into
mainfrom
codex/import-meta-rspack-runtime
Jun 29, 2026
Merged

feat: support import.meta style module variables#14539
LingyuCoder merged 11 commits into
mainfrom
codex/import-meta-rspack-runtime

Conversation

@LingyuCoder

@LingyuCoder LingyuCoder commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add import.meta.rspack* aliases for selected rspack runtime module variables
  • keep import.meta runtime alias handling local to import_meta_plugin
  • add module-variables and type coverage for the new aliases

Runtime alias mapping

New import.meta API Existing runtime variable
import.meta.rspackPublicPath __webpack_public_path__
import.meta.rspackBaseUri __webpack_base_uri__
import.meta.rspackShareScopes __webpack_share_scopes__
import.meta.rspackInitSharing __webpack_init_sharing__
import.meta.rspackNonce __webpack_nonce__
import.meta.rspackUniqueId __rspack_unique_id__
import.meta.rspackVersion __rspack_version__
import.meta.rspackHash __webpack_hash__

Copilot AI review requested due to automatic review settings June 22, 2026 12:09

@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: 6319acc1c0

ℹ️ 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 crates/rspack_plugin_javascript/src/parser_plugin/import_meta_plugin.rs Outdated
Comment thread crates/rspack_plugin_javascript/src/parser_plugin/import_meta_plugin.rs Outdated

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.

Pull request overview

This PR adds import.meta.rspack* aliases that expose selected Rspack runtime globals via import.meta, implemented within ImportMetaPlugin, and introduces a new config-case test to validate the behavior.

Changes:

  • Refactors ImportMetaPlugin to drive supported import.meta.* APIs from a centralized static table and adds new import.meta.rspack* runtime-backed aliases.
  • Refactors APIPlugin runtime API identifier handling to use per-API function pointers instead of an enum mode.
  • Adds a new module-variables config case to cover the new import.meta.rspack* aliases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/rspack-test/configCases/module-variables/import-meta-rspack-runtime/rspack.config.js Adds a config-case setup (notably output.publicPath) for the new import.meta runtime alias test.
tests/rspack-test/configCases/module-variables/import-meta-rspack-runtime/index.js Adds assertions validating the new import.meta.rspack* alias surface.
crates/rspack_plugin_javascript/src/parser_plugin/import_meta_plugin.rs Introduces the API table and implements the new import.meta.rspack* runtime alias handling.
crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs Simplifies runtime API identifier handling via function pointers and keeps existing behaviors (e.g. __webpack_layer__).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/rspack_plugin_javascript/src/parser_plugin/import_meta_plugin.rs Outdated
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 1db3100 to chore(deps): update dependency @rsbuild/plugin-sass to v2 (#14609) by renovate[bot]

❌ Size increased by 8.00KB from 67.88MB to 67.89MB (⬆️0.01%)

@codspeed-hq

codspeed-hq Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 41 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing codex/import-meta-rspack-runtime (1db3100) with main (fb91659)

Open in CodSpeed

Footnotes

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

@github-actions

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 5 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
popular-libs 1.7 MB 551.5 KB - -
react-10k 5.6 MB 1.3 MB - -
react-1k 822.8 KB 218.3 KB - -
react-5k 2.7 MB 669.1 KB - -
ui-components 4.9 MB 1.4 MB - -
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 1.7 MB - -
🗜️ Gzip Size 551.5 KB - -
📄 JavaScript 1.7 MB - -
🎨 CSS 0 B - -
🌐 HTML 289.0 B - -
📁 Other Assets 0 B - -

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.6 MB - -
🗜️ Gzip Size 1.3 MB - -
📄 JavaScript 5.6 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 822.8 KB - -
🗜️ Gzip Size 218.3 KB - -
📄 JavaScript 822.4 KB - -
🎨 CSS 0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.7 MB - -
🗜️ Gzip Size 669.1 KB - -
📄 JavaScript 2.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 4.9 MB - -
🗜️ Gzip Size 1.4 MB - -
📄 JavaScript 4.8 MB - -
🎨 CSS 111.9 KB - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

Generated by Rsdoctor GitHub Action

@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: 322eaae6ab

ℹ️ 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 crates/rspack_plugin_javascript/src/parser_plugin/import_meta_plugin.rs Outdated
@LingyuCoder LingyuCoder changed the title feat: support rspack runtime import.meta APIs feat: support import.meta style module variables Jun 26, 2026
@LingyuCoder

Copy link
Copy Markdown
Contributor Author

@codex review

@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: ce5089969e

ℹ️ 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 crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs

@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: d87ca6fe7d

ℹ️ 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 crates/rspack_plugin_javascript/src/parser_plugin/import_meta_plugin.rs Outdated
@LingyuCoder LingyuCoder force-pushed the codex/import-meta-rspack-runtime branch from 3b02e61 to 44faa73 Compare June 26, 2026 10:11

@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: 44faa73513

ℹ️ 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 crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs

@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: cce1130853

ℹ️ 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 crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs

@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: a092177557

ℹ️ 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 crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs
@LingyuCoder LingyuCoder requested a review from hardfist as a code owner June 29, 2026 03:46
@LingyuCoder LingyuCoder requested review from ahabhgk and intellild June 29, 2026 06:10
@LingyuCoder LingyuCoder merged commit 4681914 into main Jun 29, 2026
38 checks passed
@LingyuCoder LingyuCoder deleted the codex/import-meta-rspack-runtime branch June 29, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants