Skip to content

feat(core)!: support mode in inspectConfig - #1812

Merged
elecmonkey merged 3 commits into
mainfrom
david/feat-inspect-mode
Jul 30, 2026
Merged

elecmonkey merged 3 commits into
mainfrom
david/feat-inspect-mode

Conversation

@Timeless0911

@Timeless0911 Timeless0911 commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add mode support to rslib inspect and apply the selected mode before composing Rsbuild environments.
  • Keep production as the default and inspect only Module Federation libraries in development mode.
  • Remove the invalid none mode from InspectConfigOptions.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings July 29, 2026 10:51
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Deploying rslib with  Cloudflare Pages  Cloudflare Pages

Latest commit: 19534b0
Status: ✅  Deploy successful!
Preview URL: https://070fe45d.rslib.pages.dev
Branch Preview URL: https://david-feat-inspect-mode.rslib.pages.dev

View logs

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

ℹ️ 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 packages/core/src/cli/commands.ts

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 explicit mode support to rslib inspect and rslib.inspectConfig(), ensuring the chosen mode is applied before composing Rsbuild environments, while keeping production as the default and limiting development-mode inspection to Module Federation (format: 'mf') libraries.

Changes:

  • Add --mode (development|production) to the inspect CLI command and validate mode values at runtime.
  • Update rslib.inspectConfig() typing and behavior: reject invalid modes (e.g. 'none'), apply mode before environment composition, and inspect only MF environments in development mode.
  • Add/extend integration tests and update English/Chinese docs and upgrade notes accordingly.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
website/docs/zh/guide/upgrade/v0-to-v1.mdx Document removal of invalid 'none' inspect mode and MF-only behavior in development mode.
website/docs/zh/guide/basic/cli.mdx Update inspect CLI docs to include --mode and refreshed output examples.
website/docs/zh/api/javascript-api/instance.mdx Update InspectConfigOptions type docs and add mode guidance and outputPath clarifications.
website/docs/en/guide/upgrade/v0-to-v1.mdx Mirror the upgrade note updates for English docs.
website/docs/en/guide/basic/cli.mdx Update inspect CLI docs to include --mode and refreshed output examples.
website/docs/en/api/javascript-api/instance.mdx Update API docs for InspectConfigOptions and add mode guidance and outputPath clarifications.
tests/integration/javascript-api/inspect-config/package.json Add an ESM test fixture package for the new inspect-config integration tests.
tests/integration/javascript-api/inspect-config/index.test.ts Add coverage for mode application, MF-only dev inspection, and invalid mode rejection.
tests/integration/cli/mf/mf.test.ts Add CLI coverage for inspect --mode development on MF fixtures.
tests/integration/cli/inspect/inspect.test.ts Add CLI coverage ensuring --mode rejects unsupported values.
tests/integration/cli/help/snapshots/index.test.ts.snap Update CLI help snapshot to include --mode and revised inspect description.
pnpm-lock.yaml Register the new integration test workspace package.
packages/core/src/types/rslib.ts Narrow InspectConfigOptions.mode to `'development'
packages/core/src/createRslib.ts Implement mode validation, apply mode before composing environments, and prune to MF envs for dev inspect.
packages/core/src/cli/commands.ts Add --mode option to inspect and forward it into rslib.inspectConfig().
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread website/docs/en/guide/basic/cli.mdx
Comment thread website/docs/zh/guide/basic/cli.mdx

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

ℹ️ 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 packages/core/src/cli/commands.ts Outdated
Comment thread packages/core/src/createRslib.ts
@Timeless0911
Timeless0911 force-pushed the david/feat-inspect-mode branch from d76b0ad to 111ce8f Compare July 29, 2026 18:26

@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

mode: options.mode,

P2 Badge Preserve the CLI's production default

When NODE_ENV=development is inherited and --mode is omitted, forwarding undefined makes inspectConfig() infer development mode even though the CLI documents production as its default. Consequently, NODE_ENV=development rslib inspect now inspects only MF libraries and fails with No mf format found for an ordinary ESM/CJS project, whereas the command previously inspected its production configuration; pass the CLI's production default explicitly while retaining inference for JavaScript API callers.

ℹ️ 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".

Timeless0911 commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Replying to “Preserve the CLI's production default”:

I intend rslib inspect to infer its mode from NODE_ENV when --mode is omitted, matching rslib.inspectConfig(). Therefore, NODE_ENV=development rslib inspect entering development mode and inspecting only Module Federation libraries is expected behavior. Users can pass --mode production when they want to inspect production configurations explicitly.

I updated the CLI and upgrade documentation in 19534b0 to make this behavior clear, so I am keeping the current implementation.

@Timeless0911

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 19534b0d3b

ℹ️ 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".

@elecmonkey
elecmonkey merged commit 69a445d into main Jul 30, 2026
12 checks passed
@elecmonkey
elecmonkey deleted the david/feat-inspect-mode branch July 30, 2026 03:54
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

Sponsor
SponsoredKunjungi sekarang
Promo