feat(core)!: support mode in inspectConfig - #1812
Conversation
Deploying rslib with
|
| Latest commit: |
19534b0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://070fe45d.rslib.pages.dev |
| Branch Preview URL: | https://david-feat-inspect-mode.rslib.pages.dev |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
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 theinspectCLI 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
There was a problem hiding this comment.
💡 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".
d76b0ad to
111ce8f
Compare
There was a problem hiding this comment.
💡 Codex Review
rslib/packages/core/src/cli/commands.ts
Line 176 in 111ce8f
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".
|
Replying to “Preserve the CLI's production default”: I intend I updated the CLI and upgrade documentation in 19534b0 to make this behavior clear, so I am keeping the current implementation. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
modesupport torslib inspectand apply the selected mode before composing Rsbuild environments.nonemode fromInspectConfigOptions.Related Links
Checklist