Skip to content

feat(core): accept loadConfig result as config input - #1915

Merged
Timeless0911 merged 4 commits into
mainfrom
chenjiahan/feat-config-load-result
Sep 10, 2026
Merged

feat(core): accept loadConfig result as config input#1915
Timeless0911 merged 4 commits into
mainfrom
chenjiahan/feat-config-load-result

Conversation

@chenjiahan

@chenjiahan chenjiahan commented Sep 9, 2026

Copy link
Copy Markdown
Member

Motivation

Rslib relies on private configuration metadata to preserve file watching and cache dependencies. Rsbuild now supports passing the complete load result directly (rsbuild#8147).

Changes

Allow createRslib to accept a complete loadConfig result, directly or through an async factory, and forward its file path and dependencies alongside the transformed Rsbuild configuration.

Preserve Rsbuild's loaded configuration, including _privateMeta, while removing Rslib's explicit forwarding of that private field.

Update the CLI, test helper, and API documentation to pass complete results; callers passing only result.content must migrate to preserve configuration watching and cache dependencies.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying rslib with  Cloudflare Pages  Cloudflare Pages

Latest commit: 83c488a
Status: ✅  Deploy successful!
Preview URL: https://33e66dec.rslib.pages.dev
Branch Preview URL: https://chenjiahan-feat-config-load.rslib.pages.dev

View logs

@chenjiahan
chenjiahan marked this pull request as ready for review September 10, 2026 02:42
Copilot AI lite review requested due to automatic review settings September 10, 2026 02:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T02:47:48.953234Z c16d029 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

🟡 Changes recommended

The new isLoadConfigResult runtime guard is too permissive and can misclassify user configs, leading to incorrect config handling.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates @rslib/core to let createRslib accept the full loadConfig result (or an async factory returning it), so Rslib can forward config file path + dependency metadata to Rsbuild for better file watching and persistent cache invalidation, without manually forwarding _privateMeta.

Changes:

  • Extend CreateRslibOptions.config to accept LoadConfigResult (and async factories returning it), and forward the load result metadata into createRsbuild.
  • Align loadConfig types/behavior with Rsbuild’s LoadConfigResult shape (including dependencies) and update CLI + test helpers to pass the full result.
  • Update API docs (EN/ZH) and add a unit test covering the “pass full loadConfig result” path.
File summaries
File Description
website/docs/zh/api/javascript-api/core.mdx Documents createRslib accepting LoadConfigResult and explains why callers should pass full results.
website/docs/en/api/javascript-api/core.mdx Same as above for English docs.
tests/scripts/shared.ts Updates test helper to pass full loadConfig() result into createRslib.
packages/core/tests/config.test.ts Adds test asserting Rsbuild receives config file path/dependencies when given full load result.
packages/core/src/types/rslib.ts Broadens CreateRslibOptions.config type to include LoadConfigResult.
packages/core/src/loadConfig.ts Re-exports Rsbuild’s LoadConfigResult shape and returns it directly from loadConfig.
packages/core/src/createRslib.ts Detects LoadConfigResult inputs and forwards metadata to createRsbuild.
packages/core/src/cli/init.ts Ensures CLI passes the complete load result (not just content) into createRslib.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/core/src/createRslib.ts
@Timeless0911
Timeless0911 merged commit f4c996f into main Sep 10, 2026
12 checks passed
@Timeless0911
Timeless0911 deleted the chenjiahan/feat-config-load-result branch September 10, 2026 04:07
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