feat: add rspack version detection helpers#1394
Open
dannyhw wants to merge 1 commit into
Open
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
9b5229f to
89f3c09
Compare
89f3c09 to
7cbf8b8
Compare
Utilities for the upcoming dual rspack-major support (see agent_context/rspackv2-jul2026/): getRspackVersion / getRspackMajorVersion / isRspack2 resolve @rspack/core/package.json without importing the package - safe on any Node version (@rspack/core@2 is ESM-only and cannot be require()d on Node < 20.19) and safe when rspack is not installed (webpack-only projects). getRspackMajorVersionFromCompiler covers plugin contexts via compiler.webpack.rspackVersion. ConfigKeys additions (cache, experiments) describe config keys the commands already read. No behavior change; nothing consumes the helpers yet.
7cbf8b8 to
81936bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second PR of the Rspack 2 support stack split out of #1393 (design doc in #1395). Deliberately minimal — pure utilities, nothing wired up yet:
helpers/rspackVersion.ts:getRspackVersion/getRspackMajorVersion/isRspack2resolve the installed@rspack/coreversion via itspackage.jsonwithout importing the package — safe on any Node version (@rspack/core@2is ESM-only and cannot berequire()d on Node < 20.19) and safe when rspack isn't installed (webpack-only projects).getRspackMajorVersionFromCompilercovers plugin contexts viacompiler.webpack.rspackVersion.ConfigKeysadditions (cache,experiments) incommands/types.ts— type-only; describes config keys the commands already read.No behavior change, no dependency changes, no changeset. Consumers arrive with the follow-up PRs:
ERR_REQUIRE_ESM)@rspack/core@^2devDep + type fallout + dual-major jest lane + CI lanes (Rspack 1 + Windows)Everything here was previously reviewed as part of #1393; the branch there stays as the reference implementation until the stack lands.
Verification
turbo run typecheck test --force— 17/17 tasks green (repack 280/280)biome check— clean