rsbuild-plugin-react-router 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -186,8 +186,14 @@ If none are found, it falls back to defaults.
186
186
 
187
187
  ### Framework Mode
188
188
 
189
- React Router Framework Mode is implemented as a Vite plugin. This Rsbuild
190
- plugin targets Data Mode only and does not support Framework Mode.
189
+ React Router "Framework Mode" is implemented as a Vite plugin, but this Rsbuild
190
+ plugin aims to provide equivalent **framework-mode behaviors** (typegen, Route
191
+ Module API types, route module splitting, SPA/SSR/prerender strategies) on top
192
+ of Rsbuild/Rspack.
193
+
194
+ In practice, you should be able to use the `@react-router/dev/*` config + routes
195
+ APIs, import generated `./+types/*` in route modules, and use the standard
196
+ `entry.client`/`entry.server` entrypoints like you would in the official setup.
191
197
 
192
198
  ### FAQ
193
199
 
@@ -647,7 +653,15 @@ The plugin automatically:
647
653
 
648
654
  ## React Router Framework Mode
649
655
 
650
- React Router "Framework Mode" wraps Data Mode using a Vite plugin. This Rsbuild plugin currently targets React Router's Data Mode build/runtime model and does not implement the Vite plugin layer (type-safe href, route module splitting, etc.).
656
+ React Router "Framework Mode" wraps Data Mode using a Vite plugin. This Rsbuild
657
+ plugin aims to match the important behaviors without depending on Vite:
658
+
659
+ - Typegen + Route Module API types (`./+types/*`)
660
+ - Route module splitting (`future.v8_splitRouteModules`)
661
+ - SPA mode (`ssr: false`), SSR mode, and static prerendering (`prerender`)
662
+
663
+ Some Vite-specific integrations (for example Vite's environment API + critical
664
+ CSS endpoint) are not supported 1:1.
651
665
 
652
666
  ## Examples
653
667
 
@@ -0,0 +1,16 @@
1
+ var __webpack_require__ = {};
2
+ __webpack_require__.n = (module)=>{
3
+ var getter = module && module.__esModule ? ()=>module.default : ()=>module;
4
+ return __webpack_require__.d(getter, {
5
+ a: getter
6
+ }), getter;
7
+ }, __webpack_require__.d = (exports, getters, values)=>{
8
+ var define = (defs, kind)=>{
9
+ for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
10
+ enumerable: !0,
11
+ [kind]: defs[key]
12
+ });
13
+ };
14
+ define(getters, "get"), define(values, "value");
15
+ }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
16
+ export { __webpack_require__ };
package/dist/index.cjs CHANGED
@@ -7,11 +7,14 @@ __webpack_require__.n = (module)=>{
7
7
  return __webpack_require__.d(getter, {
8
8
  a: getter
9
9
  }), getter;
10
- }, __webpack_require__.d = (exports1, definition)=>{
11
- for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
12
- enumerable: !0,
13
- get: definition[key]
14
- });
10
+ }, __webpack_require__.d = (exports1, getters, values)=>{
11
+ var define = (defs, kind)=>{
12
+ for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
13
+ enumerable: !0,
14
+ [kind]: defs[key]
15
+ });
16
+ };
17
+ define(getters, "get"), define(values, "value");
15
18
  }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
16
19
  "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
17
20
  value: 'Module'
@@ -163,9 +166,10 @@ const RESOLVABLE_BUILD_EXPORTS = new Set([
163
166
  }
164
167
  }, bundle = await tryLoadBundle('static/js/app') ?? await tryLoadBundle('app');
165
168
  if (!bundle || !bundle.routes) throw Error('Server bundle not found or invalid');
166
- let { createRequestListener } = await import("@react-router/node"), normalizedBuild = normalizeBuildModule(bundle), build = await resolveBuildExports(normalizedBuild), listener = createRequestListener({
167
- build
168
- });
169
+ let rr = await import("react-router"), nfs = await import("@remix-run/node-fetch-server");
170
+ if ('function' != typeof rr.createRequestHandler) throw Error('[rsbuild-plugin-react-router] Missing `createRequestHandler` export from `react-router`');
171
+ if ('function' != typeof nfs.createRequestListener) throw Error('[rsbuild-plugin-react-router] Missing `createRequestListener` export from `@remix-run/node-fetch-server`');
172
+ let normalizedBuild = normalizeBuildModule(bundle), build = await resolveBuildExports(normalizedBuild), requestHandler = rr.createRequestHandler(build, 'development'), listener = nfs.createRequestListener((request)=>requestHandler(request));
169
173
  await listener(req, res);
170
174
  } catch (error) {
171
175
  console.error('SSR Error:', error), next(error);
@@ -885,7 +889,10 @@ const DEFAULT_MANIFEST_DIR = 'static/js', getManifestDirFromEntryAsset = (entryM
885
889
  if (!isBuild) return 'static/js/virtual/react-router/browser-manifest.js';
886
890
  let dir = getManifestDirFromEntryAsset(entryModulePath);
887
891
  return `${dir}/manifest-${version}.js`;
888
- }, getManifestVersion = (fingerprintedValues, isBuild)=>isBuild ? (0, external_node_crypto_namespaceObject.createHash)('md5').update(JSON.stringify(fingerprintedValues)).digest('hex').slice(0, 8) : String(Math.random());
892
+ }, getManifestVersion = (fingerprintedValues, isBuild)=>isBuild ? (0, external_node_crypto_namespaceObject.createHash)('md5').update(JSON.stringify(fingerprintedValues)).digest('hex').slice(0, 8) : String(Math.random()), getRouteEntryName = (route)=>{
893
+ let extensionIndex = route.file.lastIndexOf('.');
894
+ return extensionIndex >= 0 ? route.file.slice(0, extensionIndex) : route.file;
895
+ };
889
896
  async function getReactRouterManifestForDev(routes, options, clientStats, context, assetPrefix = '/', routeChunkOptions) {
890
897
  let result = {}, splitRouteModules = routeChunkOptions?.splitRouteModules ?? !1, enforceSplitRouteModules = 'enforce' === splitRouteModules, isBuild = routeChunkOptions?.isBuild ?? !1, routeChunkConfig = splitRouteModules && routeChunkOptions?.rootRouteFile ? {
891
898
  splitRouteModules,
@@ -893,22 +900,33 @@ async function getReactRouterManifestForDev(routes, options, clientStats, contex
893
900
  rootRouteFile: routeChunkOptions.rootRouteFile
894
901
  } : null, getAssetsForChunk = (chunkName)=>{
895
902
  let assets = clientStats?.assetsByChunkName?.[chunkName];
896
- return assets ? Array.isArray(assets) ? assets : [
903
+ if (!assets) return [
904
+ `${DEFAULT_MANIFEST_DIR}/${chunkName}.js`
905
+ ];
906
+ let normalizedAssets = Array.isArray(assets) ? assets : [
897
907
  assets
898
- ] : [];
908
+ ];
909
+ return normalizedAssets.some((asset)=>asset.endsWith('.js')) ? normalizedAssets : [
910
+ `${DEFAULT_MANIFEST_DIR}/${chunkName}.js`,
911
+ ...normalizedAssets
912
+ ];
899
913
  }, getModulePathForChunk = (chunkName)=>{
900
914
  let jsAssets = getAssetsForChunk(chunkName).filter((asset)=>asset.endsWith('.js'));
901
915
  return jsAssets[0] ? combineURLs(assetPrefix, jsAssets[0]) : void 0;
902
916
  };
903
917
  for (let [key, route] of Object.entries(routes)){
904
- let assets = getAssetsForChunk(route.id), jsAssets = assets.filter((asset)=>asset.endsWith('.js')) || [], cssAssets = assets.filter((asset)=>asset.endsWith('.css')) || [], routeFilePath = (0, external_pathe_namespaceObject.resolve)(context, route.file), exports1 = new Set(), hasRouteChunkByExportName = {
918
+ let routeEntryName = getRouteEntryName(route), assets = getAssetsForChunk(routeEntryName), jsAssets = assets.filter((asset)=>asset.endsWith('.js')) || [], cssAssets = assets.filter((asset)=>asset.endsWith('.css')) || [], routeFilePath = (0, external_pathe_namespaceObject.resolve)(context, route.file), exports1 = new Set(), hasRouteChunkByExportName = {
905
919
  clientAction: !1,
906
920
  clientLoader: !1,
907
921
  clientMiddleware: !1,
908
922
  HydrateFallback: !1
909
923
  };
910
924
  try {
911
- let source = await (0, promises_namespaceObject.readFile)(routeFilePath, 'utf8'), code = await transformToEsm(source, routeFilePath);
925
+ let source = await (0, promises_namespaceObject.readFile)(routeFilePath, 'utf8');
926
+ !isBuild && 0 === cssAssets.length && /\.(?:css|less|sass|scss)(?:\?[^'"`]+)?['"`]/.test(source) && (cssAssets = [
927
+ `${DEFAULT_MANIFEST_DIR.replace('/js', '/css')}/${routeEntryName}.css`
928
+ ]);
929
+ let code = await transformToEsm(source, routeFilePath);
912
930
  if (exports1 = new Set(await getExportNames(code)), isBuild && routeChunkConfig) {
913
931
  let { hasRouteChunkByExportName: chunkInfo } = await detectRouteChunksIfEnabled(routeChunkOptions?.cache, routeChunkConfig, routeFilePath, code);
914
932
  hasRouteChunkByExportName = chunkInfo;
@@ -948,7 +966,7 @@ async function getReactRouterManifestForDev(routes, options, clientStats, contex
948
966
  css: cssAssets.map((asset)=>combineURLs(assetPrefix, asset))
949
967
  };
950
968
  }
951
- let entryAssets = clientStats?.assetsByChunkName?.['entry.client'], entryJsAssets = entryAssets?.filter((asset)=>asset.endsWith('.js')) || [], entryCssAssets = entryAssets?.filter((asset)=>asset.endsWith('.css')) || [], fingerprintedValues = {
969
+ let entryAssets = getAssetsForChunk('entry.client'), entryJsAssets = entryAssets.filter((asset)=>asset.endsWith('.js')), entryCssAssets = entryAssets.filter((asset)=>asset.endsWith('.css')), fingerprintedValues = {
952
970
  entry: {
953
971
  module: combineURLs(assetPrefix, entryJsAssets[0] || ''),
954
972
  imports: entryJsAssets.map((asset)=>combineURLs(assetPrefix, asset)),
@@ -1545,9 +1563,32 @@ const redirectStatusCodes = new Set([
1545
1563
  });
1546
1564
  }
1547
1565
  });
1548
- let allowedActionOriginsForBuild = !1 === allowedActionOrigins ? void 0 : allowedActionOrigins, bundleVirtualModules = Object.fromEntries(Object.entries(routesByServerBundleId).map(([bundleId, bundleRoutes])=>[
1549
- `virtual/react-router/server-build-${bundleId}`,
1550
- generateServerBuild(bundleRoutes, {
1566
+ let allowedActionOriginsForBuild = !1 === allowedActionOrigins ? void 0 : allowedActionOrigins, vmodTempDir = `rspack-virtual-module-${process.pid}-${Math.random().toString(16).slice(2)}`;
1567
+ api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig })=>{
1568
+ var publicPath;
1569
+ let bundleVirtualModules, bundleManifestModules, vmodPlugin = (publicPath = assetPrefix = normalizeAssetPrefix(config.output?.assetPrefix), bundleVirtualModules = Object.fromEntries(Object.entries(routesByServerBundleId).map(([bundleId, bundleRoutes])=>[
1570
+ `virtual/react-router/server-build-${bundleId}`,
1571
+ generateServerBuild(bundleRoutes, {
1572
+ entryServerPath: finalEntryServerPath,
1573
+ assetsBuildDirectory,
1574
+ basename,
1575
+ appDirectory,
1576
+ ssr,
1577
+ federation: options.federation,
1578
+ future,
1579
+ allowedActionOrigins: allowedActionOriginsForBuild,
1580
+ prerender: prerenderPaths,
1581
+ routeDiscovery,
1582
+ publicPath,
1583
+ serverManifestId: `virtual/react-router/server-manifest-${bundleId}`
1584
+ })
1585
+ ])), bundleManifestModules = Object.fromEntries(Object.entries(routesByServerBundleId).filter(([, bundleRoutes])=>bundleRoutes && Object.keys(bundleRoutes).length > 0).map(([bundleId])=>[
1586
+ `virtual/react-router/server-manifest-${bundleId}`,
1587
+ 'export default {};'
1588
+ ])), new external_rspack_plugin_virtual_module_namespaceObject.RspackVirtualModulePlugin({
1589
+ 'virtual/react-router/browser-manifest': 'export default {};',
1590
+ 'virtual/react-router/server-manifest': 'export default {};',
1591
+ 'virtual/react-router/server-build': generateServerBuild(routes, {
1551
1592
  entryServerPath: finalEntryServerPath,
1552
1593
  assetsBuildDirectory,
1553
1594
  basename,
@@ -1558,35 +1599,12 @@ const redirectStatusCodes = new Set([
1558
1599
  allowedActionOrigins: allowedActionOriginsForBuild,
1559
1600
  prerender: prerenderPaths,
1560
1601
  routeDiscovery,
1561
- publicPath: assetPrefix,
1562
- serverManifestId: `virtual/react-router/server-manifest-${bundleId}`
1563
- })
1564
- ])), bundleManifestModules = Object.fromEntries(Object.entries(routesByServerBundleId).filter(([, bundleRoutes])=>bundleRoutes && Object.keys(bundleRoutes).length > 0).map(([bundleId])=>[
1565
- `virtual/react-router/server-manifest-${bundleId}`,
1566
- 'export default {};'
1567
- ])), vmodTempDir = `rspack-virtual-module-${process.pid}-${Math.random().toString(16).slice(2)}`, vmodPlugin = new external_rspack_plugin_virtual_module_namespaceObject.RspackVirtualModulePlugin({
1568
- 'virtual/react-router/browser-manifest': 'export default {};',
1569
- 'virtual/react-router/server-manifest': 'export default {};',
1570
- 'virtual/react-router/server-build': generateServerBuild(routes, {
1571
- entryServerPath: finalEntryServerPath,
1572
- assetsBuildDirectory,
1573
- basename,
1574
- appDirectory,
1575
- ssr,
1576
- federation: options.federation,
1577
- future,
1578
- allowedActionOrigins: allowedActionOriginsForBuild,
1579
- prerender: prerenderPaths,
1580
- routeDiscovery,
1581
- publicPath: assetPrefix
1582
- }),
1583
- ...bundleVirtualModules,
1584
- ...bundleManifestModules,
1585
- 'virtual/react-router/with-props': generateWithProps()
1586
- }, vmodTempDir);
1587
- api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig })=>{
1588
- assetPrefix = normalizeAssetPrefix(config.output?.assetPrefix);
1589
- let useAsyncNodeChunkLoading = options.federation && 'commonjs' === resolvedServerOutput, nodeChunkLoading = 'module' === resolvedServerOutput ? 'import' : useAsyncNodeChunkLoading ? 'async-node' : 'require', serverBuildFileBase = (serverBuildFile || 'index.js').replace(/\.js$/, ''), nodeEntries = {
1602
+ publicPath
1603
+ }),
1604
+ ...bundleVirtualModules,
1605
+ ...bundleManifestModules,
1606
+ 'virtual/react-router/with-props': generateWithProps()
1607
+ }, vmodTempDir)), useAsyncNodeChunkLoading = options.federation && 'commonjs' === resolvedServerOutput, nodeChunkLoading = 'module' === resolvedServerOutput ? 'import' : useAsyncNodeChunkLoading ? 'async-node' : 'require', serverBuildFileBase = (serverBuildFile || 'index.js').replace(/\.js$/, ''), nodeEntries = {
1590
1608
  ...hasServerApp ? {
1591
1609
  'static/js/app': serverAppPath
1592
1610
  } : {
@@ -1601,8 +1619,6 @@ const redirectStatusCodes = new Set([
1601
1619
  },
1602
1620
  dev: {
1603
1621
  writeToDisk: !0,
1604
- hmr: !1,
1605
- liveReload: !0,
1606
1622
  setupMiddlewares: pluginOptions.customServer || !ssr ? [] : [
1607
1623
  (middlewares, server)=>{
1608
1624
  middlewares.push(createDevServerMiddleware(server));
@@ -1636,10 +1652,6 @@ const redirectStatusCodes = new Set([
1636
1652
  tools: {
1637
1653
  rspack: {
1638
1654
  name: 'web',
1639
- experiments: {
1640
- topLevelAwait: !0,
1641
- outputModule: !0
1642
- },
1643
1655
  ...options.federation ? {
1644
1656
  output: {
1645
1657
  chunkLoading: 'import'
@@ -1683,12 +1695,6 @@ const redirectStatusCodes = new Set([
1683
1695
  dependencies: [
1684
1696
  'web'
1685
1697
  ],
1686
- experiments: {
1687
- outputModule: 'module' === resolvedServerOutput,
1688
- ...options.federation ? {
1689
- asyncStartup: !0
1690
- } : {}
1691
- },
1692
1698
  externalsType: resolvedServerOutput,
1693
1699
  output: {
1694
1700
  chunkFormat: resolvedServerOutput,
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
1
  let lexer_C;
2
- import { fileURLToPath as __rspack_fileURLToPath, pathToFileURL } from "node:url";
3
- import { dirname as __rspack_dirname, sep } from "node:path";
4
- import * as __rspack_external__babel_types_69e65b52 from "@babel/types";
5
- import { __webpack_require__ } from "./rslib-runtime.js";
2
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
6
3
  import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
7
4
  import { mkdir, readFile, writeFile } from "node:fs/promises";
8
5
  import { createRequire } from "node:module";
6
+ import { pathToFileURL, fileURLToPath as __rspack_fileURLToPath } from "node:url";
9
7
  import fs_extra from "fs-extra";
10
8
  import { createJiti } from "jiti";
11
9
  import jsesc from "jsesc";
12
10
  import { basename as external_pathe_basename, dirname, extname, isAbsolute, normalize, relative, resolve } from "pathe";
13
11
  import { RspackVirtualModulePlugin } from "rspack-plugin-virtual-module";
14
12
  import { parse } from "@babel/parser";
13
+ import { callExpression, functionExpression, identifier as types_identifier, importDeclaration, importSpecifier, isClassDeclaration, isExportAllDeclaration, isExportDeclaration, isExportDefaultDeclaration, isExportNamedDeclaration, isFunctionDeclaration, isIdentifier, isImportDeclaration, isNodesEquivalent, isObjectProperty, isPattern, isRestElement, isStatement, isVariableDeclaration, isVariableDeclarator, stringLiteral, variableDeclaration, variableDeclarator as types_variableDeclarator } from "@babel/types";
15
14
  import { deadCodeElimination, findReferencedIdentifiers } from "babel-dead-code-elimination";
16
15
  import { createHash } from "node:crypto";
17
- import { transform } from "esbuild";
18
16
  import { rspack } from "@rsbuild/core";
19
- import { createRequestHandler, matchRoutes } from "./906.js";
17
+ import { createRequestHandler, matchRoutes } from "react-router";
18
+ import { sep, dirname as __rspack_dirname } from "node:path";
19
+ import * as __rspack_external_esbuild from "esbuild";
20
20
  let generator_namespaceObject = require("@babel/generator");
21
21
  var A, A1, ImportType, generator_default = __webpack_require__.n(generator_namespaceObject);
22
22
  let traverse_namespaceObject = require("@babel/traverse");
@@ -123,7 +123,7 @@ function invalidDestructureError(name) {
123
123
  return Error(`Cannot remove destructured export "${name}"`);
124
124
  }
125
125
  function toFunctionExpression(decl) {
126
- return __rspack_external__babel_types_69e65b52.functionExpression(decl.id, decl.params, decl.body, decl.generator, decl.async);
126
+ return functionExpression(decl.id, decl.params, decl.body, decl.generator, decl.async);
127
127
  }
128
128
  function combineURLs(baseURL, relativeURL) {
129
129
  return relativeURL ? `${baseURL.replace(/\/+$/, '')}/${relativeURL.replace(/^\/+/, '')}` : baseURL;
@@ -293,17 +293,17 @@ let routeChunkQueryStringPrefix = '?route-chunk=', routeChunkQueryStrings = {
293
293
  }, codeToAst = (code, cache, cacheKey)=>structuredClone(getOrSetFromCache(cache, `${cacheKey}::codeToAst`, code, ()=>parse(code, {
294
294
  sourceType: 'module'
295
295
  }))), isNodePathWithNode = (path)=>!(!path || 'object' != typeof path || Array.isArray(path)) && 'node' in path && !!path.node, assertNodePathIsVariableDeclarator = (path)=>{
296
- invariant(path && !Array.isArray(path) && __rspack_external__babel_types_69e65b52.isVariableDeclarator(path.node), `Expected a VariableDeclarator path, but got ${Array.isArray(path) ? 'an array' : path?.node?.type}`);
296
+ invariant(path && !Array.isArray(path) && isVariableDeclarator(path.node), `Expected a VariableDeclarator path, but got ${Array.isArray(path) ? 'an array' : path?.node?.type}`);
297
297
  }, assertNodePathIsPattern = (path)=>{
298
- invariant(path && !Array.isArray(path) && __rspack_external__babel_types_69e65b52.isPattern(path.node), `Expected a Pattern path, but got ${Array.isArray(path) ? 'an array' : path?.node?.type}`);
298
+ invariant(path && !Array.isArray(path) && isPattern(path.node), `Expected a Pattern path, but got ${Array.isArray(path) ? 'an array' : path?.node?.type}`);
299
299
  }, getExportDependencies = (code, cache, cacheKey)=>getOrSetFromCache(cache, `${cacheKey}::getExportDependencies`, code, ()=>{
300
300
  let exportDependencies = new Map();
301
301
  function handleExport(exportName, exportPath, identifiersPath = exportPath) {
302
302
  let identifiers = getDependentIdentifiersForPath(identifiersPath), topLevelStatements = new Set([
303
303
  exportPath.node,
304
304
  ...getTopLevelStatementsForPaths(identifiers)
305
- ]), topLevelNonModuleStatements = new Set(Array.from(topLevelStatements).filter((statement)=>!__rspack_external__babel_types_69e65b52.isImportDeclaration(statement) && !__rspack_external__babel_types_69e65b52.isExportDeclaration(statement))), importedIdentifierNames = new Set();
306
- for (let identifier of identifiers)__rspack_external__babel_types_69e65b52.isIdentifier(identifier.node) && identifier.parentPath?.parentPath?.isImportDeclaration() && importedIdentifierNames.add(identifier.node.name);
305
+ ]), topLevelNonModuleStatements = new Set(Array.from(topLevelStatements).filter((statement)=>!isImportDeclaration(statement) && !isExportDeclaration(statement))), importedIdentifierNames = new Set();
306
+ for (let identifier of identifiers)isIdentifier(identifier.node) && identifier.parentPath?.parentPath?.isImportDeclaration() && importedIdentifierNames.add(identifier.node.name);
307
307
  let exportedVariableDeclarators = new Set();
308
308
  for (let identifier of identifiers){
309
309
  if (identifier.parentPath?.isVariableDeclarator()) {
@@ -334,31 +334,31 @@ let routeChunkQueryStringPrefix = '?route-chunk=', routeChunkQueryStrings = {
334
334
  return traverse(codeToAst(code, cache, cacheKey), {
335
335
  ExportDeclaration (exportPath) {
336
336
  let { node } = exportPath;
337
- if (__rspack_external__babel_types_69e65b52.isExportAllDeclaration(node)) return;
338
- if (__rspack_external__babel_types_69e65b52.isExportDefaultDeclaration(node)) return void handleExport('default', exportPath);
337
+ if (isExportAllDeclaration(node)) return;
338
+ if (isExportDefaultDeclaration(node)) return void handleExport('default', exportPath);
339
339
  let { declaration } = node;
340
- if (__rspack_external__babel_types_69e65b52.isVariableDeclaration(declaration)) {
340
+ if (isVariableDeclaration(declaration)) {
341
341
  let { declarations } = declaration;
342
342
  for(let i = 0; i < declarations.length; i++){
343
343
  let declarator = declarations[i];
344
- if (__rspack_external__babel_types_69e65b52.isIdentifier(declarator.id)) {
344
+ if (isIdentifier(declarator.id)) {
345
345
  let declaratorPath = exportPath.get(`declaration.declarations.${i}`);
346
346
  assertNodePathIsVariableDeclarator(declaratorPath), handleExport(declarator.id.name, exportPath, declaratorPath);
347
347
  continue;
348
348
  }
349
- if (__rspack_external__babel_types_69e65b52.isPattern(declarator.id)) {
349
+ if (isPattern(declarator.id)) {
350
350
  let exportedPatternPath = exportPath.get(`declaration.declarations.${i}.id`);
351
- for (let identifier of (assertNodePathIsPattern(exportedPatternPath), getIdentifiersForPatternPath(exportedPatternPath)))__rspack_external__babel_types_69e65b52.isIdentifier(identifier.node) && handleExport(identifier.node.name, exportPath, identifier);
351
+ for (let identifier of (assertNodePathIsPattern(exportedPatternPath), getIdentifiersForPatternPath(exportedPatternPath)))isIdentifier(identifier.node) && handleExport(identifier.node.name, exportPath, identifier);
352
352
  }
353
353
  }
354
354
  return;
355
355
  }
356
- if (__rspack_external__babel_types_69e65b52.isFunctionDeclaration(declaration) || __rspack_external__babel_types_69e65b52.isClassDeclaration(declaration)) {
356
+ if (isFunctionDeclaration(declaration) || isClassDeclaration(declaration)) {
357
357
  invariant(declaration.id, 'Expected exported function or class declaration to have a name when not the default export'), handleExport(declaration.id.name, exportPath);
358
358
  return;
359
359
  }
360
- if (__rspack_external__babel_types_69e65b52.isExportNamedDeclaration(node)) {
361
- for (let specifier of node.specifiers)if (__rspack_external__babel_types_69e65b52.isIdentifier(specifier.exported)) {
360
+ if (isExportNamedDeclaration(node)) {
361
+ for (let specifier of node.specifiers)if (isIdentifier(specifier.exported)) {
362
362
  let name = specifier.exported.name, specifierPath = exportPath.get('specifiers').find((path)=>path.node === specifier);
363
363
  invariant(specifierPath, `Expected to find specifier path for ${name}`), handleExport(name, exportPath, specifierPath);
364
364
  }
@@ -397,7 +397,7 @@ let routeChunkQueryStringPrefix = '?route-chunk=', routeChunkQueryStrings = {
397
397
  if (withinImportStatement || withinExportStatement || getDependentIdentifiersForPath(topLevelStatement, {
398
398
  visited,
399
399
  identifiers
400
- }), withinExportStatement && path.isIdentifier() && (__rspack_external__babel_types_69e65b52.isPattern(path.parentPath.node) || __rspack_external__babel_types_69e65b52.isPattern(path.parentPath.parentPath?.node))) {
400
+ }), withinExportStatement && path.isIdentifier() && (isPattern(path.parentPath.node) || isPattern(path.parentPath.parentPath?.node))) {
401
401
  let variableDeclarator = path.findParent((p)=>p.isVariableDeclarator());
402
402
  variableDeclarator && (invariant(variableDeclarator && !Array.isArray(variableDeclarator), `Expected a Path, but got ${Array.isArray(variableDeclarator) ? 'an array' : variableDeclarator}`), getDependentIdentifiersForPath(variableDeclarator, {
403
403
  visited,
@@ -407,7 +407,7 @@ let routeChunkQueryStringPrefix = '?route-chunk=', routeChunkQueryStrings = {
407
407
  return identifiers;
408
408
  }, getTopLevelStatementPathForPath = (path)=>{
409
409
  let ancestry = path.getAncestry(), topLevelStatement = ancestry[ancestry.length - 2];
410
- return invariant(topLevelStatement && !Array.isArray(topLevelStatement) && __rspack_external__babel_types_69e65b52.isStatement(topLevelStatement.node), `Expected a Statement path, but got ${Array.isArray(topLevelStatement) ? 'an array' : topLevelStatement?.node?.type}`), topLevelStatement;
410
+ return invariant(topLevelStatement && !Array.isArray(topLevelStatement) && isStatement(topLevelStatement.node), `Expected a Statement path, but got ${Array.isArray(topLevelStatement) ? 'an array' : topLevelStatement?.node?.type}`), topLevelStatement;
411
411
  }, getTopLevelStatementsForPaths = (paths)=>{
412
412
  let topLevelStatements = new Set();
413
413
  for (let path of paths){
@@ -421,10 +421,10 @@ let routeChunkQueryStringPrefix = '?route-chunk=', routeChunkQueryStrings = {
421
421
  let { properties } = currentPath.node;
422
422
  for(let i = 0; i < properties.length; i++){
423
423
  let property = properties[i];
424
- if (__rspack_external__babel_types_69e65b52.isObjectProperty(property)) {
424
+ if (isObjectProperty(property)) {
425
425
  let valuePath = currentPath.get(`properties.${i}.value`);
426
426
  isNodePathWithNode(valuePath) && walk(valuePath);
427
- } else if (__rspack_external__babel_types_69e65b52.isRestElement(property)) {
427
+ } else if (isRestElement(property)) {
428
428
  let argumentPath = currentPath.get(`properties.${i}.argument`);
429
429
  isNodePathWithNode(argumentPath) && walk(argumentPath);
430
430
  }
@@ -439,7 +439,7 @@ let routeChunkQueryStringPrefix = '?route-chunk=', routeChunkQueryStrings = {
439
439
  let argumentPath = currentPath.get('argument');
440
440
  isNodePathWithNode(argumentPath) && walk(argumentPath);
441
441
  }
442
- }(patternPath), identifiers), getExportedName = (exported)=>__rspack_external__babel_types_69e65b52.isIdentifier(exported) ? exported.name : exported.value, setsIntersect = (set1, set2)=>{
442
+ }(patternPath), identifiers), getExportedName = (exported)=>isIdentifier(exported) ? exported.name : exported.value, setsIntersect = (set1, set2)=>{
443
443
  let smallerSet = set1, largerSet = set2;
444
444
  for (let element of (set1.size > set2.size && (smallerSet = set2, largerSet = set1), smallerSet))if (largerSet.has(element)) return !0;
445
445
  return !1;
@@ -487,7 +487,7 @@ let routeChunkQueryStringPrefix = '?route-chunk=', routeChunkQueryStrings = {
487
487
  for (let declarator of dependencies.exportedVariableDeclarators)omittedExportedVariableDeclarators.add(declarator);
488
488
  }
489
489
  let ast = codeToAst(code, cache, cacheKey), omittedStatementsArray = Array.from(omittedStatements), omittedExportedVariableDeclaratorsArray = Array.from(omittedExportedVariableDeclarators);
490
- if (ast.program.body = ast.program.body.filter((node)=>omittedStatementsArray.every((statement)=>!__rspack_external__babel_types_69e65b52.isNodesEquivalent(node, statement))).map((node)=>__rspack_external__babel_types_69e65b52.isImportDeclaration(node) && 0 !== node.specifiers.length && (node.specifiers = node.specifiers.filter((specifier)=>{
490
+ if (ast.program.body = ast.program.body.filter((node)=>omittedStatementsArray.every((statement)=>!isNodesEquivalent(node, statement))).map((node)=>isImportDeclaration(node) && 0 !== node.specifiers.length && (node.specifiers = node.specifiers.filter((specifier)=>{
491
491
  let importedName = specifier.local.name;
492
492
  for (let retainedExportName of retainedExportNames){
493
493
  let dependencies = exportDependencies.get(retainedExportName);
@@ -499,14 +499,14 @@ let routeChunkQueryStringPrefix = '?route-chunk=', routeChunkQueryStrings = {
499
499
  }
500
500
  return !0;
501
501
  }), 0 === node.specifiers.length) ? null : node).map((node)=>{
502
- if (!__rspack_external__babel_types_69e65b52.isExportDeclaration(node) || __rspack_external__babel_types_69e65b52.isExportAllDeclaration(node)) return node;
503
- if (__rspack_external__babel_types_69e65b52.isExportDefaultDeclaration(node)) return isOmitted('default') ? null : node;
504
- if (__rspack_external__babel_types_69e65b52.isVariableDeclaration(node.declaration)) return (node.declaration.declarations = node.declaration.declarations.filter((declarationNode)=>omittedExportedVariableDeclaratorsArray.every((declarator)=>!__rspack_external__babel_types_69e65b52.isNodesEquivalent(declarationNode, declarator))), 0 === node.declaration.declarations.length) ? null : node;
505
- if (__rspack_external__babel_types_69e65b52.isFunctionDeclaration(node.declaration) || __rspack_external__babel_types_69e65b52.isClassDeclaration(node.declaration)) {
502
+ if (!isExportDeclaration(node) || isExportAllDeclaration(node)) return node;
503
+ if (isExportDefaultDeclaration(node)) return isOmitted('default') ? null : node;
504
+ if (isVariableDeclaration(node.declaration)) return (node.declaration.declarations = node.declaration.declarations.filter((declarationNode)=>omittedExportedVariableDeclaratorsArray.every((declarator)=>!isNodesEquivalent(declarationNode, declarator))), 0 === node.declaration.declarations.length) ? null : node;
505
+ if (isFunctionDeclaration(node.declaration) || isClassDeclaration(node.declaration)) {
506
506
  let declarationId = node.declaration.id;
507
507
  return invariant(declarationId, 'Expected exported function or class declaration to have a name when not the default export'), isOmitted(declarationId.name) ? null : node;
508
508
  }
509
- if (__rspack_external__babel_types_69e65b52.isExportNamedDeclaration(node)) return 0 === node.specifiers.length ? node : (node.specifiers = node.specifiers.filter((specifier)=>!isOmitted(getExportedName(specifier.exported))), 0 === node.specifiers.length) ? null : node;
509
+ if (isExportNamedDeclaration(node)) return 0 === node.specifiers.length ? node : (node.specifiers = node.specifiers.filter((specifier)=>!isOmitted(getExportedName(specifier.exported))), 0 === node.specifiers.length) ? null : node;
510
510
  throw Error('Unknown node type');
511
511
  }).filter(Boolean), 0 !== ast.program.body.length) return generate(ast, generateOptions).code;
512
512
  }))(code, routeChunkExportNames, {}, cache, cacheKey) : ((code, exportName, generateOptions = {}, cache, cacheKey)=>getOrSetFromCache(cache, `${cacheKey}::getChunkedExport::${exportName}::${JSON.stringify(generateOptions)}`, code, ()=>{
@@ -514,14 +514,14 @@ let routeChunkQueryStringPrefix = '?route-chunk=', routeChunkQueryStrings = {
514
514
  let dependencies = getExportDependencies(code, cache, cacheKey).get(exportName);
515
515
  invariant(dependencies, 'Expected export to have dependencies');
516
516
  let topLevelStatementsArray = Array.from(dependencies.topLevelStatements), exportedVariableDeclaratorsArray = Array.from(dependencies.exportedVariableDeclarators), ast = codeToAst(code, cache, cacheKey);
517
- return ast.program.body = ast.program.body.filter((node)=>topLevelStatementsArray.some((statement)=>__rspack_external__babel_types_69e65b52.isNodesEquivalent(node, statement))).map((node)=>__rspack_external__babel_types_69e65b52.isImportDeclaration(node) ? 0 === dependencies.importedIdentifierNames.size ? null : (node.specifiers = node.specifiers.filter((specifier)=>dependencies.importedIdentifierNames.has(specifier.local.name)), invariant(node.specifiers.length > 0, 'Expected import statement to have used specifiers'), node) : node).map((node)=>{
518
- if (!__rspack_external__babel_types_69e65b52.isExportDeclaration(node)) return node;
519
- if (__rspack_external__babel_types_69e65b52.isExportAllDeclaration(node)) return null;
520
- if (__rspack_external__babel_types_69e65b52.isExportDefaultDeclaration(node)) return 'default' === exportName ? node : null;
517
+ return ast.program.body = ast.program.body.filter((node)=>topLevelStatementsArray.some((statement)=>isNodesEquivalent(node, statement))).map((node)=>isImportDeclaration(node) ? 0 === dependencies.importedIdentifierNames.size ? null : (node.specifiers = node.specifiers.filter((specifier)=>dependencies.importedIdentifierNames.has(specifier.local.name)), invariant(node.specifiers.length > 0, 'Expected import statement to have used specifiers'), node) : node).map((node)=>{
518
+ if (!isExportDeclaration(node)) return node;
519
+ if (isExportAllDeclaration(node)) return null;
520
+ if (isExportDefaultDeclaration(node)) return 'default' === exportName ? node : null;
521
521
  let { declaration } = node;
522
- if (__rspack_external__babel_types_69e65b52.isVariableDeclaration(declaration)) return (declaration.declarations = declaration.declarations.filter((declarationNode)=>exportedVariableDeclaratorsArray.some((declarator)=>__rspack_external__babel_types_69e65b52.isNodesEquivalent(declarationNode, declarator))), 0 === declaration.declarations.length) ? null : node;
523
- if (__rspack_external__babel_types_69e65b52.isFunctionDeclaration(node.declaration) || __rspack_external__babel_types_69e65b52.isClassDeclaration(node.declaration)) return node.declaration.id?.name === exportName ? node : null;
524
- if (__rspack_external__babel_types_69e65b52.isExportNamedDeclaration(node)) return 0 === node.specifiers.length || (node.specifiers = node.specifiers.filter((specifier)=>getExportedName(specifier.exported) === exportName), 0 === node.specifiers.length) ? null : node;
522
+ if (isVariableDeclaration(declaration)) return (declaration.declarations = declaration.declarations.filter((declarationNode)=>exportedVariableDeclaratorsArray.some((declarator)=>isNodesEquivalent(declarationNode, declarator))), 0 === declaration.declarations.length) ? null : node;
523
+ if (isFunctionDeclaration(node.declaration) || isClassDeclaration(node.declaration)) return node.declaration.id?.name === exportName ? node : null;
524
+ if (isExportNamedDeclaration(node)) return 0 === node.specifiers.length || (node.specifiers = node.specifiers.filter((specifier)=>getExportedName(specifier.exported) === exportName), 0 === node.specifiers.length) ? null : node;
525
525
  throw Error('Unknown export node type');
526
526
  }).filter(Boolean), generate(ast, generateOptions).code;
527
527
  }))(code, chunkName, {}, cache, cacheKey)) ?? null;
@@ -596,7 +596,7 @@ function lexer_parse(E, g = "@") {
596
596
  }
597
597
  let lexer_init = WebAssembly.compile((A1 = "AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gA39/fwADMTAAAQECAgICAgICAgICAgICAgICAgIAAwMDBAQAAAUAAAAAAAMDAwAGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUHA8gALfwBBwPIACwd6FQZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAml0AAgCYWkACQJpZAAKAmlwAAsCZXMADAJlZQANA2VscwAOA2VsZQAPAnJpABACcmUAEQFmABICbXMAEwVwYXJzZQAUC19faGVhcF9iYXNlAwEKzkQwaAEBf0EAIAA2AoAKQQAoAtwJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgKECkEAIAA2AogKQQBBADYC4AlBAEEANgLwCUEAQQA2AugJQQBBADYC5AlBAEEANgL4CUEAQQA2AuwJIAEL0wEBA39BACgC8AkhBEEAQQAoAogKIgU2AvAJQQAgBDYC9AlBACAFQSRqNgKICiAEQSBqQeAJIAQbIAU2AgBBACgC1AkhBEEAKALQCSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGIgAbIAQgA0YiBBs2AgwgBSADNgIUIAVBADYCECAFIAI2AgQgBUEANgIgIAVBA0EBQQIgABsgBBs2AhwgBUEAKALQCSADRiICOgAYAkACQCACDQBBACgC1AkgA0cNAQtBAEEBOgCMCgsLXgEBf0EAKAL4CSIEQRBqQeQJIAQbQQAoAogKIgQ2AgBBACAENgL4CUEAIARBFGo2AogKQQBBAToAjAogBEEANgIQIAQgAzYCDCAEIAI2AgggBCABNgIEIAQgADYCAAsIAEEAKAKQCgsVAEEAKALoCSgCAEEAKALcCWtBAXULHgEBf0EAKALoCSgCBCIAQQAoAtwJa0EBdUF/IAAbCxUAQQAoAugJKAIIQQAoAtwJa0EBdQseAQF/QQAoAugJKAIMIgBBACgC3AlrQ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LIAMLC+wBAgBBgAgLzgEAAHgAcABvAHIAdABtAHAAbwByAHQAZgBvAHIAZQB0AGEAbwB1AHIAYwBlAHIAbwBtAHUAbgBjAHQAaQBvAG4AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=", "u" > typeof Buffer ? Buffer.from(A1, "base64") : Uint8Array.from(atob(A1), (A)=>A.charCodeAt(0)))).then(WebAssembly.instantiate).then(({ exports: A })=>{
598
598
  lexer_C = A;
599
- }), transformToEsm = async (code, resourcePath)=>(await transform(code, {
599
+ }), transformToEsm = async (code, resourcePath)=>(await __rspack_external_esbuild.transform(code, {
600
600
  jsx: 'automatic',
601
601
  format: 'esm',
602
602
  platform: 'neutral',
@@ -630,6 +630,9 @@ let lexer_init = WebAssembly.compile((A1 = "AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/
630
630
  return '.' === dir ? DEFAULT_MANIFEST_DIR : dir;
631
631
  })(entryModulePath);
632
632
  return `${dir}/manifest-${version}.js`;
633
+ }, getRouteEntryName = (route)=>{
634
+ let extensionIndex = route.file.lastIndexOf('.');
635
+ return extensionIndex >= 0 ? route.file.slice(0, extensionIndex) : route.file;
633
636
  };
634
637
  async function getReactRouterManifestForDev(routes, options, clientStats, context, assetPrefix = '/', routeChunkOptions) {
635
638
  let result = {}, splitRouteModules = routeChunkOptions?.splitRouteModules ?? !1, enforceSplitRouteModules = 'enforce' === splitRouteModules, isBuild = routeChunkOptions?.isBuild ?? !1, routeChunkConfig = splitRouteModules && routeChunkOptions?.rootRouteFile ? {
@@ -638,22 +641,33 @@ async function getReactRouterManifestForDev(routes, options, clientStats, contex
638
641
  rootRouteFile: routeChunkOptions.rootRouteFile
639
642
  } : null, getAssetsForChunk = (chunkName)=>{
640
643
  let assets = clientStats?.assetsByChunkName?.[chunkName];
641
- return assets ? Array.isArray(assets) ? assets : [
644
+ if (!assets) return [
645
+ `${DEFAULT_MANIFEST_DIR}/${chunkName}.js`
646
+ ];
647
+ let normalizedAssets = Array.isArray(assets) ? assets : [
642
648
  assets
643
- ] : [];
649
+ ];
650
+ return normalizedAssets.some((asset)=>asset.endsWith('.js')) ? normalizedAssets : [
651
+ `${DEFAULT_MANIFEST_DIR}/${chunkName}.js`,
652
+ ...normalizedAssets
653
+ ];
644
654
  }, getModulePathForChunk = (chunkName)=>{
645
655
  let jsAssets = getAssetsForChunk(chunkName).filter((asset)=>asset.endsWith('.js'));
646
656
  return jsAssets[0] ? combineURLs(assetPrefix, jsAssets[0]) : void 0;
647
657
  };
648
658
  for (let [key, route] of Object.entries(routes)){
649
- let assets = getAssetsForChunk(route.id), jsAssets = assets.filter((asset)=>asset.endsWith('.js')) || [], cssAssets = assets.filter((asset)=>asset.endsWith('.css')) || [], routeFilePath = resolve(context, route.file), exports = new Set(), hasRouteChunkByExportName = {
659
+ let routeEntryName = getRouteEntryName(route), assets = getAssetsForChunk(routeEntryName), jsAssets = assets.filter((asset)=>asset.endsWith('.js')) || [], cssAssets = assets.filter((asset)=>asset.endsWith('.css')) || [], routeFilePath = resolve(context, route.file), exports = new Set(), hasRouteChunkByExportName = {
650
660
  clientAction: !1,
651
661
  clientLoader: !1,
652
662
  clientMiddleware: !1,
653
663
  HydrateFallback: !1
654
664
  };
655
665
  try {
656
- let source = await readFile(routeFilePath, 'utf8'), code = await transformToEsm(source, routeFilePath);
666
+ let source = await readFile(routeFilePath, 'utf8');
667
+ !isBuild && 0 === cssAssets.length && /\.(?:css|less|sass|scss)(?:\?[^'"`]+)?['"`]/.test(source) && (cssAssets = [
668
+ `${DEFAULT_MANIFEST_DIR.replace('/js', '/css')}/${routeEntryName}.css`
669
+ ]);
670
+ let code = await transformToEsm(source, routeFilePath);
657
671
  if (exports = new Set(await getExportNames(code)), isBuild && routeChunkConfig) {
658
672
  let { hasRouteChunkByExportName: chunkInfo } = await detectRouteChunksIfEnabled(routeChunkOptions?.cache, routeChunkConfig, routeFilePath, code);
659
673
  hasRouteChunkByExportName = chunkInfo;
@@ -693,7 +707,7 @@ async function getReactRouterManifestForDev(routes, options, clientStats, contex
693
707
  css: cssAssets.map((asset)=>combineURLs(assetPrefix, asset))
694
708
  };
695
709
  }
696
- let entryAssets = clientStats?.assetsByChunkName?.['entry.client'], entryJsAssets = entryAssets?.filter((asset)=>asset.endsWith('.js')) || [], entryCssAssets = entryAssets?.filter((asset)=>asset.endsWith('.css')) || [], fingerprintedValues = {
710
+ let entryAssets = getAssetsForChunk('entry.client'), entryJsAssets = entryAssets.filter((asset)=>asset.endsWith('.js')), entryCssAssets = entryAssets.filter((asset)=>asset.endsWith('.css')), fingerprintedValues = {
697
711
  entry: {
698
712
  module: combineURLs(assetPrefix, entryJsAssets[0] || ''),
699
713
  imports: entryJsAssets.map((asset)=>combineURLs(assetPrefix, asset)),
@@ -1220,9 +1234,32 @@ let redirectStatusCodes = new Set([
1220
1234
  });
1221
1235
  }
1222
1236
  });
1223
- let allowedActionOriginsForBuild = !1 === allowedActionOrigins ? void 0 : allowedActionOrigins, bundleVirtualModules = Object.fromEntries(Object.entries(routesByServerBundleId).map(([bundleId, bundleRoutes])=>[
1224
- `virtual/react-router/server-build-${bundleId}`,
1225
- generateServerBuild(bundleRoutes, {
1237
+ let allowedActionOriginsForBuild = !1 === allowedActionOrigins ? void 0 : allowedActionOrigins, vmodTempDir = `rspack-virtual-module-${process.pid}-${Math.random().toString(16).slice(2)}`;
1238
+ api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig })=>{
1239
+ var publicPath;
1240
+ let bundleVirtualModules, bundleManifestModules, vmodPlugin = (publicPath = assetPrefix = normalizeAssetPrefix(config.output?.assetPrefix), bundleVirtualModules = Object.fromEntries(Object.entries(routesByServerBundleId).map(([bundleId, bundleRoutes])=>[
1241
+ `virtual/react-router/server-build-${bundleId}`,
1242
+ generateServerBuild(bundleRoutes, {
1243
+ entryServerPath: finalEntryServerPath,
1244
+ assetsBuildDirectory,
1245
+ basename,
1246
+ appDirectory,
1247
+ ssr,
1248
+ federation: options.federation,
1249
+ future,
1250
+ allowedActionOrigins: allowedActionOriginsForBuild,
1251
+ prerender: prerenderPaths,
1252
+ routeDiscovery,
1253
+ publicPath,
1254
+ serverManifestId: `virtual/react-router/server-manifest-${bundleId}`
1255
+ })
1256
+ ])), bundleManifestModules = Object.fromEntries(Object.entries(routesByServerBundleId).filter(([, bundleRoutes])=>bundleRoutes && Object.keys(bundleRoutes).length > 0).map(([bundleId])=>[
1257
+ `virtual/react-router/server-manifest-${bundleId}`,
1258
+ 'export default {};'
1259
+ ])), new RspackVirtualModulePlugin({
1260
+ 'virtual/react-router/browser-manifest': 'export default {};',
1261
+ 'virtual/react-router/server-manifest': 'export default {};',
1262
+ 'virtual/react-router/server-build': generateServerBuild(routes, {
1226
1263
  entryServerPath: finalEntryServerPath,
1227
1264
  assetsBuildDirectory,
1228
1265
  basename,
@@ -1233,31 +1270,11 @@ let redirectStatusCodes = new Set([
1233
1270
  allowedActionOrigins: allowedActionOriginsForBuild,
1234
1271
  prerender: prerenderPaths,
1235
1272
  routeDiscovery,
1236
- publicPath: assetPrefix,
1237
- serverManifestId: `virtual/react-router/server-manifest-${bundleId}`
1238
- })
1239
- ])), bundleManifestModules = Object.fromEntries(Object.entries(routesByServerBundleId).filter(([, bundleRoutes])=>bundleRoutes && Object.keys(bundleRoutes).length > 0).map(([bundleId])=>[
1240
- `virtual/react-router/server-manifest-${bundleId}`,
1241
- 'export default {};'
1242
- ])), vmodTempDir = `rspack-virtual-module-${process.pid}-${Math.random().toString(16).slice(2)}`, vmodPlugin = new RspackVirtualModulePlugin({
1243
- 'virtual/react-router/browser-manifest': 'export default {};',
1244
- 'virtual/react-router/server-manifest': 'export default {};',
1245
- 'virtual/react-router/server-build': generateServerBuild(routes, {
1246
- entryServerPath: finalEntryServerPath,
1247
- assetsBuildDirectory,
1248
- basename,
1249
- appDirectory,
1250
- ssr,
1251
- federation: options.federation,
1252
- future,
1253
- allowedActionOrigins: allowedActionOriginsForBuild,
1254
- prerender: prerenderPaths,
1255
- routeDiscovery,
1256
- publicPath: assetPrefix
1257
- }),
1258
- ...bundleVirtualModules,
1259
- ...bundleManifestModules,
1260
- 'virtual/react-router/with-props': `
1273
+ publicPath
1274
+ }),
1275
+ ...bundleVirtualModules,
1276
+ ...bundleManifestModules,
1277
+ 'virtual/react-router/with-props': `
1261
1278
  import { createElement as h } from "react";
1262
1279
  import { useActionData, useLoaderData, useMatches, useParams, useRouteError } from "react-router";
1263
1280
 
@@ -1294,10 +1311,7 @@ let redirectStatusCodes = new Set([
1294
1311
  };
1295
1312
  }
1296
1313
  `
1297
- }, vmodTempDir);
1298
- api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig })=>{
1299
- assetPrefix = normalizeAssetPrefix(config.output?.assetPrefix);
1300
- let useAsyncNodeChunkLoading = options.federation && 'commonjs' === resolvedServerOutput, nodeChunkLoading = 'module' === resolvedServerOutput ? 'import' : useAsyncNodeChunkLoading ? 'async-node' : 'require', serverBuildFileBase = (serverBuildFile || 'index.js').replace(/\.js$/, ''), nodeEntries = {
1314
+ }, vmodTempDir)), useAsyncNodeChunkLoading = options.federation && 'commonjs' === resolvedServerOutput, nodeChunkLoading = 'module' === resolvedServerOutput ? 'import' : useAsyncNodeChunkLoading ? 'async-node' : 'require', serverBuildFileBase = (serverBuildFile || 'index.js').replace(/\.js$/, ''), nodeEntries = {
1301
1315
  ...hasServerApp ? {
1302
1316
  'static/js/app': serverAppPath
1303
1317
  } : {
@@ -1312,8 +1326,6 @@ let redirectStatusCodes = new Set([
1312
1326
  },
1313
1327
  dev: {
1314
1328
  writeToDisk: !0,
1315
- hmr: !1,
1316
- liveReload: !0,
1317
1329
  setupMiddlewares: pluginOptions.customServer || !ssr ? [] : [
1318
1330
  (middlewares, server)=>{
1319
1331
  middlewares.push(async (req, res, next)=>{
@@ -1327,9 +1339,10 @@ let redirectStatusCodes = new Set([
1327
1339
  }
1328
1340
  }, bundle = await tryLoadBundle('static/js/app') ?? await tryLoadBundle('app');
1329
1341
  if (!bundle || !bundle.routes) throw Error('Server bundle not found or invalid');
1330
- let { createRequestListener } = await import("@react-router/node"), normalizedBuild = normalizeBuildModule(bundle), build = await resolveBuildExports(normalizedBuild), listener = createRequestListener({
1331
- build
1332
- });
1342
+ let rr = await import("react-router"), nfs = await import("@remix-run/node-fetch-server");
1343
+ if ('function' != typeof rr.createRequestHandler) throw Error('[rsbuild-plugin-react-router] Missing `createRequestHandler` export from `react-router`');
1344
+ if ('function' != typeof nfs.createRequestListener) throw Error('[rsbuild-plugin-react-router] Missing `createRequestListener` export from `@remix-run/node-fetch-server`');
1345
+ let normalizedBuild = normalizeBuildModule(bundle), build = await resolveBuildExports(normalizedBuild), requestHandler = rr.createRequestHandler(build, 'development'), listener = nfs.createRequestListener((request)=>requestHandler(request));
1333
1346
  await listener(req, res);
1334
1347
  } catch (error) {
1335
1348
  console.error('SSR Error:', error), next(error);
@@ -1365,10 +1378,6 @@ let redirectStatusCodes = new Set([
1365
1378
  tools: {
1366
1379
  rspack: {
1367
1380
  name: 'web',
1368
- experiments: {
1369
- topLevelAwait: !0,
1370
- outputModule: !0
1371
- },
1372
1381
  ...options.federation ? {
1373
1382
  output: {
1374
1383
  chunkLoading: 'import'
@@ -1412,12 +1421,6 @@ let redirectStatusCodes = new Set([
1412
1421
  dependencies: [
1413
1422
  'web'
1414
1423
  ],
1415
- experiments: {
1416
- outputModule: 'module' === resolvedServerOutput,
1417
- ...options.federation ? {
1418
- asyncStartup: !0
1419
- } : {}
1420
- },
1421
1424
  externalsType: resolvedServerOutput,
1422
1425
  output: {
1423
1426
  chunkFormat: resolvedServerOutput,
@@ -1787,7 +1790,7 @@ let redirectStatusCodes = new Set([
1787
1790
  let declaration = path.get('declaration'), expr = declaration.isExpression() ? declaration.node : declaration.isFunctionDeclaration() ? toFunctionExpression(declaration.node) : void 0;
1788
1791
  if (expr) {
1789
1792
  let uid = getHocUid(path, 'withComponentProps');
1790
- declaration.replaceWith(__rspack_external__babel_types_69e65b52.callExpression(uid, [
1793
+ declaration.replaceWith(callExpression(uid, [
1791
1794
  expr
1792
1795
  ]));
1793
1796
  }
@@ -1801,7 +1804,7 @@ let redirectStatusCodes = new Set([
1801
1804
  let { name } = id.node;
1802
1805
  if (!isNamedComponentExport(name)) return;
1803
1806
  let uid = getHocUid(path, `with${name}Props`);
1804
- init.replaceWith(__rspack_external__babel_types_69e65b52.callExpression(uid, [
1807
+ init.replaceWith(callExpression(uid, [
1805
1808
  expr
1806
1809
  ]));
1807
1810
  });
@@ -1811,15 +1814,15 @@ let redirectStatusCodes = new Set([
1811
1814
  let { name } = id;
1812
1815
  if (!isNamedComponentExport(name)) return;
1813
1816
  let uid = getHocUid(path, `with${name}Props`);
1814
- decl.replaceWith(__rspack_external__babel_types_69e65b52.variableDeclaration('const', [
1815
- __rspack_external__babel_types_69e65b52.variableDeclarator(__rspack_external__babel_types_69e65b52.identifier(name), __rspack_external__babel_types_69e65b52.callExpression(uid, [
1817
+ decl.replaceWith(variableDeclaration('const', [
1818
+ types_variableDeclarator(types_identifier(name), callExpression(uid, [
1816
1819
  toFunctionExpression(decl.node)
1817
1820
  ]))
1818
1821
  ]));
1819
1822
  }
1820
1823
  }
1821
1824
  }
1822
- }), hocs.length > 0 && ast.program.body.unshift(__rspack_external__babel_types_69e65b52.importDeclaration(hocs.map(([name, identifier])=>__rspack_external__babel_types_69e65b52.importSpecifier(identifier, __rspack_external__babel_types_69e65b52.identifier(name))), __rspack_external__babel_types_69e65b52.stringLiteral('virtual/react-router/with-props'))), 'web' === args.environment.name && (scopeCrawled = !1, traverse(ast, {
1825
+ }), hocs.length > 0 && ast.program.body.unshift(importDeclaration(hocs.map(([name, identifier])=>importSpecifier(identifier, types_identifier(name))), stringLiteral('virtual/react-router/with-props'))), 'web' === args.environment.name && (scopeCrawled = !1, traverse(ast, {
1823
1826
  Program (path) {
1824
1827
  scopeCrawled || (path.scope.crawl(), scopeCrawled = !0);
1825
1828
  },
@@ -1,6 +1,6 @@
1
1
  import { hydrateRoot } from "react-dom/client";
2
2
  import { HydratedRouter } from "react-router/dom";
3
- import { startTransition, createElement, StrictMode } from "../946.js";
4
- startTransition(()=>{
5
- hydrateRoot(document, createElement(StrictMode, null, createElement(HydratedRouter, null)));
3
+ import * as __rspack_external_react from "react";
4
+ __rspack_external_react.startTransition(()=>{
5
+ hydrateRoot(document, __rspack_external_react.createElement(__rspack_external_react.StrictMode, null, __rspack_external_react.createElement(HydratedRouter, null)));
6
6
  });
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
3
  var __webpack_require__ = {};
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
6
- enumerable: !0,
7
- get: definition[key]
8
- });
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
7
+ enumerable: !0,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get"), define(values, "value");
9
12
  }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
10
13
  "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
11
14
  value: 'Module'
@@ -2,11 +2,11 @@ import { PassThrough } from "node:stream";
2
2
  import { createReadableStreamFromReadable } from "@react-router/node";
3
3
  import { isbot } from "isbot";
4
4
  import { renderToPipeableStream } from "react-dom/server";
5
- import { createElement } from "../946.js";
6
- import { ServerRouter } from "../906.js";
5
+ import { ServerRouter } from "react-router";
6
+ import * as __rspack_external_react from "react";
7
7
  export default function(request, responseStatusCode, responseHeaders, routerContext) {
8
8
  return new Promise((resolve, reject)=>{
9
- let shellRendered = !1, statusCode = responseStatusCode, userAgent = request.headers.get('user-agent'), readyOption = userAgent && isbot(userAgent) || routerContext.isSpaMode ? 'onAllReady' : 'onShellReady', { pipe, abort } = renderToPipeableStream(createElement(ServerRouter, {
9
+ let shellRendered = !1, statusCode = responseStatusCode, userAgent = request.headers.get('user-agent'), readyOption = userAgent && isbot(userAgent) || routerContext.isSpaMode ? 'onAllReady' : 'onShellReady', { pipe, abort } = renderToPipeableStream(__rspack_external_react.createElement(ServerRouter, {
10
10
  context: routerContext,
11
11
  url: request.url
12
12
  }), {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "rsbuild-plugin-react-router",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "React Router plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/rspack-contrib/rsbuild-plugin-react-router.git",
7
+ "url": "git+https://github.com/rstackjs/rsbuild-plugin-react-router.git",
8
8
  "directory": ""
9
9
  },
10
10
  "keywords": [
@@ -54,7 +54,8 @@
54
54
  "@babel/traverse": "^7.28.6",
55
55
  "@babel/types": "^7.28.6",
56
56
  "@react-router/node": "^7.13.0",
57
- "@rspack/plugin-react-refresh": "^1.6.0",
57
+ "@remix-run/node-fetch-server": "^0.13.0",
58
+ "@rspack/plugin-react-refresh": "^2.0.2",
58
59
  "babel-dead-code-elimination": "^1.0.12",
59
60
  "esbuild": "^0.27.2",
60
61
  "execa": "^9.6.1",
@@ -69,9 +70,12 @@
69
70
  "devDependencies": {
70
71
  "@changesets/cli": "^2.29.8",
71
72
  "@react-router/dev": "^7.13.0",
72
- "@rsbuild/core": "1.7.2",
73
- "@rslib/core": "^0.19.3",
74
- "@rspack/core": "1.7.4",
73
+ "@rsbuild/core": "2.0.15",
74
+ "@rslib/core": "^0.22.1",
75
+ "@rspack/core": "2.0.8",
76
+ "@swc/helpers": "^0.5.23",
77
+ "@rstest/core": "^0.8.1",
78
+ "@rstest/coverage-istanbul": "^0.2.0",
75
79
  "@types/babel__core": "^7.20.5",
76
80
  "@types/babel__generator": "^7.27.0",
77
81
  "@types/babel__traverse": "^7.28.0",
@@ -79,8 +83,6 @@
79
83
  "@types/jsesc": "^3.0.3",
80
84
  "@types/node": "^25.0.10",
81
85
  "@types/react": "^19.2.10",
82
- "@rstest/core": "^0.8.1",
83
- "@rstest/coverage-istanbul": "^0.2.0",
84
86
  "@types/react-dom": "^19.2.3",
85
87
  "es-module-lexer": "1.7.0",
86
88
  "kill-port": "^2.0.1",
@@ -94,7 +96,7 @@
94
96
  "@rsbuild/config": "1.0.1"
95
97
  },
96
98
  "peerDependencies": {
97
- "@rsbuild/core": "^1.7.2"
99
+ "@rsbuild/core": "^2.0.0"
98
100
  },
99
101
  "publishConfig": {
100
102
  "access": "public",
package/dist/906.js DELETED
@@ -1 +0,0 @@
1
- export { ServerRouter, createRequestHandler, matchRoutes } from "react-router";
package/dist/946.js DELETED
@@ -1 +0,0 @@
1
- export { StrictMode, createElement, startTransition } from "react";
@@ -1,23 +0,0 @@
1
- var __webpack_module_cache__ = {};
2
- function __webpack_require__(moduleId) {
3
- var cachedModule = __webpack_module_cache__[moduleId];
4
- if (void 0 !== cachedModule) return cachedModule.exports;
5
- var module = __webpack_module_cache__[moduleId] = {
6
- exports: {}
7
- };
8
- return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
9
- }
10
- __webpack_require__.add = function(modules) {
11
- Object.assign(__webpack_require__.m, modules);
12
- }, __webpack_require__.n = (module)=>{
13
- var getter = module && module.__esModule ? ()=>module.default : ()=>module;
14
- return __webpack_require__.d(getter, {
15
- a: getter
16
- }), getter;
17
- }, __webpack_require__.d = (exports, definition)=>{
18
- for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
19
- enumerable: !0,
20
- get: definition[key]
21
- });
22
- }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
23
- export { __webpack_require__ };