Skip to content

refactor: rename naming convention#26

Merged
chenjiahan merged 5 commits intomainfrom
rename_internals_0315
Mar 15, 2026
Merged

refactor: rename naming convention#26
chenjiahan merged 5 commits intomainfrom
rename_internals_0315

Conversation

@chenjiahan
Copy link
Member

  • update all references from webpack to rspack in code, tests and docs
  • preserve legacy webpack API for backward compatibility

Copilot AI review requested due to automatic review settings March 15, 2026 12:27
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request systematically refactors the naming conventions within the @rspack/dev-middleware package, replacing all instances of 'webpack' with 'rspack' in code, tests, and documentation. The primary objective is to align the project's terminology with its core technology, Rspack, thereby enhancing clarity and consistency. Crucially, the changes also ensure backward compatibility by preserving legacy 'webpack' API shapes where necessary, allowing for a smooth transition for existing users.

Highlights

  • Naming Convention Update: Renamed internal references from 'webpack' to 'rspack' across the codebase, including variable names, logger names, and framework wrapper functions.
  • Backward Compatibility: Introduced 'res.locals.rspack' for middleware context while explicitly preserving 'res.locals.webpack' to ensure existing integrations continue to function without disruption.
  • Documentation and Metadata Alignment: Updated documentation, 'package.json' keywords, and type definitions to reflect the 'rspack' naming, removing 'webpack' specific metadata.
  • Test Suite Adjustments: Modified test helpers and middleware tests to validate the new 'rspack' naming conventions and confirm the continued functionality of backward-compatible 'webpack' references.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Updated documentation links and 'res.locals' property names to reflect 'rspack' terminology.
    • Changed references to 'webpack' in code examples to 'rspack'.
  • package.json
    • Removed 'webpack' from the list of keywords.
    • Removed the 'funding' section related to Open Collective for Webpack.
  • src/index.js
    • Added 'rspack' property to 'ExtendedServerResponse.locals' type definition for middleware context.
    • Updated JSDoc return type descriptions from 'webpack dev middleware' to 'rspack dev middleware'.
    • Changed logger name from 'webpack-dev-middleware' to 'rspack-dev-middleware'.
    • Updated a comment regarding compiler support, removing specific mention of 'webpack@5'.
    • Renamed Hapi wrapper package name from 'webpack-dev-middleware' to 'rspack-dev-middleware'.
    • Changed Hapi server decoration from 'webpackDevMiddleware' to 'rspackDevMiddleware'.
    • Renamed Koa wrapper function from 'webpackDevMiddleware' to 'rspackDevMiddleware'.
    • Updated Koa wrapper function's 'devMiddleware' property assignment.
    • Renamed Hono wrapper function from 'webpackDevMiddleware' to 'rspackDevMiddleware' and updated context setting to 'context.set("rspack", ...)'.
    • Updated Hono wrapper function's 'devMiddleware' property assignment.
  • src/middleware.js
    • Modified middleware to set 'rspack' context in 'res.locals' first, then 'webpack' for backward compatibility.
  • src/utils/setupHooks.js
    • Updated compiler hook tap names from 'webpack-dev-middleware' to 'rspack-dev-middleware'.
  • src/utils/setupOutputFileSystem.js
    • Updated a comment to reference 'rspack-dev-server' instead of 'webpack-dev-server'.
  • src/utils/setupWriteToDisk.js
    • Introduced a new constant 'ASSET_EMITTED_CALLBACK_FLAG' for 'rspack'-specific asset emitted callback.
    • Replaced direct property access 'compiler.hasWebpackDevMiddlewareAssetEmittedCallback' with the new constant.
    • Assigned 'true' to the new 'rspack'-specific asset emitted callback flag.
  • test/helpers/getCompilerHooks.js
    • Updated test helper to check for 'rspack-dev-middleware' tap names.
  • test/middleware.test.js
    • Changed 'server.webpackDevMiddleware' to 'server.rspackDevMiddleware' in Hapi framework factory tests.
    • Added 'rspack: c.get("rspack")' to 'locals' in Hono framework tests.
    • Added an assertion to confirm 'locals.rspack.devMiddleware' is defined in Hono tests.
  • test/utils/setupWriteToDisk.test.js
    • Updated test comments to reflect 'rspack' terminology for asset emitted info style.
    • Updated comments regarding the 'getPath' helper.
  • types/index.d.ts
    • Added 'rspack' property to 'ExtendedServerResponse.locals' type definition.
    • Changed JSDoc return type description from 'webpack dev middleware' to 'rspack dev middleware'.
  • types/utils/setupWriteToDisk.d.ts
    • Removed redundant type definitions for compiler-related interfaces.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively refactors the codebase by renaming all instances of webpack to rspack, which is consistently applied across the code, tests, and documentation. The change also correctly preserves the legacy webpack API on res.locals for backward compatibility, and this is well-tested. I have one suggestion to improve the documentation to make this backward compatibility explicit to users.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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: 9ed6d11517

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

Copy link

Copilot AI left a comment

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 updates the dev-middleware’s public-facing naming and SSR integration points to be Rspack-first (while still keeping a legacy webpack SSR alias in some places), and aligns tests/types/docs accordingly.

Changes:

  • Add res.locals.rspack.devMiddleware SSR state (alongside a legacy res.locals.webpack.devMiddleware alias in the core middleware).
  • Rename hook/plugin identifiers and framework wrapper names from webpack-dev-middleware to rspack-dev-middleware.
  • Update TypeScript typings, tests, and README SSR documentation to reference the new rspack locals shape.

Reviewed changes

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

Show a summary per file
File Description
types/utils/setupWriteToDisk.d.ts Removes redundant typedef comments from generated typings.
types/index.d.ts Extends ExtendedServerResponse.locals typing to include rspack devMiddleware context; updates JSDoc return wording.
test/utils/setupWriteToDisk.test.js Updates test comments to reflect Rspack asset emitted behavior.
test/middleware.test.js Updates hapi property access and SSR locals assertions to include rspack and keep webpack.
test/helpers/getCompilerHooks.js Updates hook tap-name lookup to rspack-dev-middleware.
src/utils/setupWriteToDisk.js Renames internal “assetEmitted callback installed” flag to a Rspack-specific key.
src/utils/setupOutputFileSystem.js Updates TODO wording to reference rspack-dev-server.
src/utils/setupHooks.js Renames compiler hook tap names to rspack-dev-middleware.
src/middleware.js Sets SSR state on responses under both rspack and legacy webpack keys.
src/index.js Renames logger / wrapper function identifiers and hapi decoration name to Rspack; updates SSR-related docs/comments accordingly.
README.md Updates SSR docs to reference res.locals.rspack.devMiddleware and Rspack stats documentation.
package.json Removes webpack keyword and webpack OpenCollective funding metadata.

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

@chenjiahan chenjiahan merged commit 59dac1f into main Mar 15, 2026
5 checks passed
@chenjiahan chenjiahan deleted the rename_internals_0315 branch March 15, 2026 12:43
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