Skip to content

feat!: add test option to preact refresh plugin#71

Merged
chenjiahan merged 3 commits into
mainfrom
chenjiahan/feat-preact-refresh-test-option
Jun 1, 2026
Merged

feat!: add test option to preact refresh plugin#71
chenjiahan merged 3 commits into
mainfrom
chenjiahan/feat-preact-refresh-test-option

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR adds a test option to @rspack/plugin-preact-refresh so loader matching can be configured separately from include, matching @rspack/plugin-react-refresh. It also aligns the defaults by moving the extension matcher to test and leaving include undefined unless explicitly configured.

Validation

  • pnpm build
  • pnpm lint
  • pnpm test

Copilot AI review requested due to automatic review settings June 1, 2026 08:20

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

ℹ️ 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 src/index.ts 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 a new test option to @rspack/plugin-preact-refresh to control loader matching independently of include, aligning behavior and defaults with @rspack/plugin-react-refresh by moving the extension-based matcher to test and leaving include unset unless configured.

Changes:

  • Add test option to plugin API and use it as the Rspack rule’s test condition.
  • Update defaults so test matches common JS/TS extensions (including mjs/cjs variants) while include defaults to undefined.
  • Add config-case tests and update README documentation for the new option and revised include semantics.

Reviewed changes

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

Show a summary per file
File Description
test/configCases/condition/test/rspack.config.js Adds a config-case verifying test can target specific modules independently of include.
test/configCases/condition/test/index.js Asserts the selected module is processed (refresh utils injected) when test matches.
test/configCases/condition/test/file.js Imports a target module (foo) to exercise test matching.
test/configCases/condition/default-test/rspack.config.js Adds a config-case validating default test behavior without options.
test/configCases/condition/default-test/index.js Asserts default test processes .mjs files.
test/configCases/condition/default-test/file.mjs Provides an .mjs module to validate default matching.
src/index.ts Introduces test option, changes normalization/defaults, and wires test/include into the injected module rule.
README.md Documents the new test option and updates include docs/defaults.

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

Comment thread src/index.ts Outdated
@chenjiahan chenjiahan merged commit 3e906b6 into main Jun 1, 2026
4 checks passed
@chenjiahan chenjiahan deleted the chenjiahan/feat-preact-refresh-test-option branch June 1, 2026 13: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.

2 participants