@react-router/dev 7.9.4-pre.0 → 7.9.5-pre.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/CHANGELOG.md +18 -4
- package/dist/cli/index.js +19 -9
- package/dist/config/default-rsc-entries/entry.client.tsx +2 -2
- package/dist/config.d.ts +14 -4
- package/dist/config.js +1 -1
- package/dist/routes.js +1 -1
- package/dist/vite/cloudflare.js +15 -6
- package/dist/vite.js +106 -37
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
# `@react-router/dev`
|
|
2
2
|
|
|
3
|
-
## 7.9.
|
|
3
|
+
## 7.9.5-pre.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Introduce a `prerender.unstable_concurrency` option, to support running the prerendering concurrently, potentially speeding up the build. ([#14380](https://github.com/remix-run/react-router/pull/14380))
|
|
8
|
+
- Move RSCHydratedRouter and utils to `/dom` export. ([#14457](https://github.com/remix-run/react-router/pull/14457))
|
|
9
|
+
- Ensure route navigation doesn't remove CSS `link` elements used by dynamic imports ([#14463](https://github.com/remix-run/react-router/pull/14463))
|
|
10
|
+
- Typegen: only register route module types for routes within the app directory ([#14439](https://github.com/remix-run/react-router/pull/14439))
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- `react-router@7.9.5-pre.0`
|
|
13
|
+
- `@react-router/node@7.9.5-pre.0`
|
|
14
|
+
- `@react-router/serve@7.9.5-pre.0`
|
|
15
|
+
|
|
16
|
+
## 7.9.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
6
19
|
|
|
7
20
|
- Update `valibot` dependency to `^1.1.0` ([#14379](https://github.com/remix-run/react-router/pull/14379))
|
|
21
|
+
|
|
8
22
|
- New (unstable) `useRoute` hook for accessing data from specific routes ([#14407](https://github.com/remix-run/react-router/pull/14407))
|
|
9
23
|
|
|
10
24
|
For example, let's say you have an `admin` route somewhere in your app and you want any child routes of `admin` to all have access to the `loaderData` and `actionData` from `admin.`
|
|
@@ -106,9 +120,9 @@
|
|
|
106
120
|
```
|
|
107
121
|
|
|
108
122
|
- Updated dependencies:
|
|
109
|
-
- `react-router@7.9.4
|
|
110
|
-
- `@react-router/node@7.9.4
|
|
111
|
-
- `@react-router/serve@7.9.4
|
|
123
|
+
- `react-router@7.9.4`
|
|
124
|
+
- `@react-router/node@7.9.4`
|
|
125
|
+
- `@react-router/serve@7.9.4`
|
|
112
126
|
|
|
113
127
|
## 7.9.3
|
|
114
128
|
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @react-router/dev v7.9.
|
|
3
|
+
* @react-router/dev v7.9.5-pre.0
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -390,11 +390,20 @@ async function resolveConfig({
|
|
|
390
390
|
if (!ssr && serverBundles) {
|
|
391
391
|
serverBundles = void 0;
|
|
392
392
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
393
|
+
if (prerender) {
|
|
394
|
+
let isValidPrerenderPathsConfig = (p) => typeof p === "boolean" || typeof p === "function" || Array.isArray(p);
|
|
395
|
+
let isValidPrerenderConfig = isValidPrerenderPathsConfig(prerender) || typeof prerender === "object" && "paths" in prerender && isValidPrerenderPathsConfig(prerender.paths);
|
|
396
|
+
if (!isValidPrerenderConfig) {
|
|
397
|
+
return err(
|
|
398
|
+
"The `prerender`/`prerender.paths` config must be a boolean, an array of string paths, or a function returning a boolean or array of string paths."
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
let isValidConcurrencyConfig = typeof prerender != "object" || !("unstable_concurrency" in prerender) || typeof prerender.unstable_concurrency === "number" && Number.isInteger(prerender.unstable_concurrency) && prerender.unstable_concurrency > 0;
|
|
402
|
+
if (!isValidConcurrencyConfig) {
|
|
403
|
+
return err(
|
|
404
|
+
"The `prerender.unstable_concurrency` config must be a positive integer if specified."
|
|
405
|
+
);
|
|
406
|
+
}
|
|
398
407
|
}
|
|
399
408
|
let routeDiscovery;
|
|
400
409
|
if (userRouteDiscovery == null) {
|
|
@@ -1061,13 +1070,13 @@ function routeModulesType(ctx) {
|
|
|
1061
1070
|
(route) => t2.tsPropertySignature(
|
|
1062
1071
|
t2.stringLiteral(route.id),
|
|
1063
1072
|
t2.tsTypeAnnotation(
|
|
1064
|
-
t2.tsTypeQuery(
|
|
1073
|
+
isInAppDirectory(ctx, route.file) ? t2.tsTypeQuery(
|
|
1065
1074
|
t2.tsImportType(
|
|
1066
1075
|
t2.stringLiteral(
|
|
1067
1076
|
`./${Path3.relative(ctx.rootDirectory, ctx.config.appDirectory)}/${route.file}`
|
|
1068
1077
|
)
|
|
1069
1078
|
)
|
|
1070
|
-
)
|
|
1079
|
+
) : t2.tsUnknownKeyword()
|
|
1071
1080
|
)
|
|
1072
1081
|
)
|
|
1073
1082
|
)
|
|
@@ -1771,7 +1780,7 @@ function resolveEnvironmentsOptions(environmentResolvers, resolverOptions) {
|
|
|
1771
1780
|
function isNonNullable(x) {
|
|
1772
1781
|
return x != null;
|
|
1773
1782
|
}
|
|
1774
|
-
var import_node_crypto, import_node_fs3, import_promises2, path7, url, babel2, import_node_fetch_server2, import_react_router2, import_es_module_lexer, import_pick3, import_jsesc, import_picocolors5, import_kebabCase, CLIENT_NON_COMPONENT_EXPORTS, CLIENT_ROUTE_EXPORTS, BUILD_CLIENT_ROUTE_QUERY_STRING, SSR_BUNDLE_PREFIX, virtualHmrRuntime, virtualInjectHmrRuntime, virtual, getServerBuildDirectory, getClientBuildDirectory, defaultEntriesDir, defaultEntries, REACT_REFRESH_HEADER;
|
|
1783
|
+
var import_node_crypto, import_node_fs3, import_promises2, path7, url, babel2, import_node_fetch_server2, import_react_router2, import_es_module_lexer, import_pick3, import_jsesc, import_picocolors5, import_kebabCase, import_p_map, CLIENT_NON_COMPONENT_EXPORTS, CLIENT_ROUTE_EXPORTS, BUILD_CLIENT_ROUTE_QUERY_STRING, SSR_BUNDLE_PREFIX, virtualHmrRuntime, virtualInjectHmrRuntime, virtual, getServerBuildDirectory, getClientBuildDirectory, defaultEntriesDir, defaultEntries, REACT_REFRESH_HEADER;
|
|
1775
1784
|
var init_plugin = __esm({
|
|
1776
1785
|
"vite/plugin.ts"() {
|
|
1777
1786
|
"use strict";
|
|
@@ -1788,6 +1797,7 @@ var init_plugin = __esm({
|
|
|
1788
1797
|
import_jsesc = __toESM(require("jsesc"));
|
|
1789
1798
|
import_picocolors5 = __toESM(require("picocolors"));
|
|
1790
1799
|
import_kebabCase = __toESM(require("lodash/kebabCase"));
|
|
1800
|
+
import_p_map = __toESM(require("p-map"));
|
|
1791
1801
|
init_typegen();
|
|
1792
1802
|
init_invariant();
|
|
1793
1803
|
init_babel();
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
unstable_createCallServer as createCallServer,
|
|
13
13
|
unstable_getRSCStream as getRSCStream,
|
|
14
14
|
unstable_RSCHydratedRouter as RSCHydratedRouter,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
type unstable_RSCPayload as RSCPayload,
|
|
16
|
+
} from "react-router/dom";
|
|
17
17
|
|
|
18
18
|
setServerCallback(
|
|
19
19
|
createCallServer({
|
package/dist/config.d.ts
CHANGED
|
@@ -58,6 +58,9 @@ type BuildEndHook = (args: {
|
|
|
58
58
|
reactRouterConfig: ResolvedReactRouterConfig;
|
|
59
59
|
viteConfig: Vite.ResolvedConfig;
|
|
60
60
|
}) => void | Promise<void>;
|
|
61
|
+
type PrerenderPaths = boolean | Array<string> | ((args: {
|
|
62
|
+
getStaticPaths: () => string[];
|
|
63
|
+
}) => Array<string> | Promise<Array<string>>);
|
|
61
64
|
/**
|
|
62
65
|
* Config to be exported via the default export from `react-router.config.ts`.
|
|
63
66
|
*/
|
|
@@ -93,10 +96,17 @@ type ReactRouterConfig = {
|
|
|
93
96
|
/**
|
|
94
97
|
* An array of URLs to prerender to HTML files at build time. Can also be a
|
|
95
98
|
* function returning an array to dynamically generate URLs.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
*
|
|
100
|
+
* `unstable_concurrency` defaults to 1, which means "no concurrency" - fully serial execution.
|
|
101
|
+
* Setting it to a value more than 1 enables concurrent prerendering.
|
|
102
|
+
* Setting it to a value higher than one can increase the speed of the build,
|
|
103
|
+
* but may consume more resources, and send more concurrent requests to the
|
|
104
|
+
* server/CMS.
|
|
105
|
+
*/
|
|
106
|
+
prerender?: PrerenderPaths | {
|
|
107
|
+
paths: PrerenderPaths;
|
|
108
|
+
unstable_concurrency?: number;
|
|
109
|
+
};
|
|
100
110
|
/**
|
|
101
111
|
* An array of React Router plugin config presets to ease integration with
|
|
102
112
|
* other platforms and tools.
|
package/dist/config.js
CHANGED
package/dist/routes.js
CHANGED
package/dist/vite/cloudflare.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.9.
|
|
2
|
+
* @react-router/dev v7.9.5-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -420,11 +420,20 @@ async function resolveConfig({
|
|
|
420
420
|
if (!ssr && serverBundles) {
|
|
421
421
|
serverBundles = void 0;
|
|
422
422
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
423
|
+
if (prerender) {
|
|
424
|
+
let isValidPrerenderPathsConfig = (p) => typeof p === "boolean" || typeof p === "function" || Array.isArray(p);
|
|
425
|
+
let isValidPrerenderConfig = isValidPrerenderPathsConfig(prerender) || typeof prerender === "object" && "paths" in prerender && isValidPrerenderPathsConfig(prerender.paths);
|
|
426
|
+
if (!isValidPrerenderConfig) {
|
|
427
|
+
return err(
|
|
428
|
+
"The `prerender`/`prerender.paths` config must be a boolean, an array of string paths, or a function returning a boolean or array of string paths."
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
let isValidConcurrencyConfig = typeof prerender != "object" || !("unstable_concurrency" in prerender) || typeof prerender.unstable_concurrency === "number" && Number.isInteger(prerender.unstable_concurrency) && prerender.unstable_concurrency > 0;
|
|
432
|
+
if (!isValidConcurrencyConfig) {
|
|
433
|
+
return err(
|
|
434
|
+
"The `prerender.unstable_concurrency` config must be a positive integer if specified."
|
|
435
|
+
);
|
|
436
|
+
}
|
|
428
437
|
}
|
|
429
438
|
let routeDiscovery;
|
|
430
439
|
if (userRouteDiscovery == null) {
|
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.9.
|
|
2
|
+
* @react-router/dev v7.9.5-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -59,6 +59,7 @@ var import_pick3 = __toESM(require("lodash/pick"));
|
|
|
59
59
|
var import_jsesc = __toESM(require("jsesc"));
|
|
60
60
|
var import_picocolors4 = __toESM(require("picocolors"));
|
|
61
61
|
var import_kebabCase = __toESM(require("lodash/kebabCase"));
|
|
62
|
+
var import_p_map = __toESM(require("p-map"));
|
|
62
63
|
|
|
63
64
|
// typegen/index.ts
|
|
64
65
|
var import_promises = __toESM(require("fs/promises"));
|
|
@@ -447,11 +448,20 @@ async function resolveConfig({
|
|
|
447
448
|
if (!ssr && serverBundles) {
|
|
448
449
|
serverBundles = void 0;
|
|
449
450
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
451
|
+
if (prerender) {
|
|
452
|
+
let isValidPrerenderPathsConfig = (p) => typeof p === "boolean" || typeof p === "function" || Array.isArray(p);
|
|
453
|
+
let isValidPrerenderConfig = isValidPrerenderPathsConfig(prerender) || typeof prerender === "object" && "paths" in prerender && isValidPrerenderPathsConfig(prerender.paths);
|
|
454
|
+
if (!isValidPrerenderConfig) {
|
|
455
|
+
return err(
|
|
456
|
+
"The `prerender`/`prerender.paths` config must be a boolean, an array of string paths, or a function returning a boolean or array of string paths."
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
let isValidConcurrencyConfig = typeof prerender != "object" || !("unstable_concurrency" in prerender) || typeof prerender.unstable_concurrency === "number" && Number.isInteger(prerender.unstable_concurrency) && prerender.unstable_concurrency > 0;
|
|
460
|
+
if (!isValidConcurrencyConfig) {
|
|
461
|
+
return err(
|
|
462
|
+
"The `prerender.unstable_concurrency` config must be a positive integer if specified."
|
|
463
|
+
);
|
|
464
|
+
}
|
|
455
465
|
}
|
|
456
466
|
let routeDiscovery;
|
|
457
467
|
if (userRouteDiscovery == null) {
|
|
@@ -1049,13 +1059,13 @@ function routeModulesType(ctx) {
|
|
|
1049
1059
|
(route) => t2.tsPropertySignature(
|
|
1050
1060
|
t2.stringLiteral(route.id),
|
|
1051
1061
|
t2.tsTypeAnnotation(
|
|
1052
|
-
t2.tsTypeQuery(
|
|
1062
|
+
isInAppDirectory(ctx, route.file) ? t2.tsTypeQuery(
|
|
1053
1063
|
t2.tsImportType(
|
|
1054
1064
|
t2.stringLiteral(
|
|
1055
1065
|
`./${Path3.relative(ctx.rootDirectory, ctx.config.appDirectory)}/${route.file}`
|
|
1056
1066
|
)
|
|
1057
1067
|
)
|
|
1058
|
-
)
|
|
1068
|
+
) : t2.tsUnknownKeyword()
|
|
1059
1069
|
)
|
|
1060
1070
|
)
|
|
1061
1071
|
)
|
|
@@ -2549,7 +2559,7 @@ var getClientEntryChunk = (ctx, viteManifest) => {
|
|
|
2549
2559
|
invariant(chunk, `Chunk not found: ${filePath}`);
|
|
2550
2560
|
return chunk;
|
|
2551
2561
|
};
|
|
2552
|
-
var getReactRouterManifestBuildAssets = (ctx, viteConfig, viteManifest, entryFilePath, route) => {
|
|
2562
|
+
var getReactRouterManifestBuildAssets = (ctx, viteConfig, viteManifest, allDynamicCssFiles, entryFilePath, route) => {
|
|
2553
2563
|
let entryChunk = resolveChunk(ctx, viteManifest, entryFilePath);
|
|
2554
2564
|
invariant(entryChunk, `Chunk not found: ${entryFilePath}`);
|
|
2555
2565
|
let isRootRoute = Boolean(route && route.parentId === void 0);
|
|
@@ -2582,7 +2592,10 @@ var getReactRouterManifestBuildAssets = (ctx, viteConfig, viteManifest, entryFil
|
|
|
2582
2592
|
// in the manifest that isn't tied to any route file. If we want to render these
|
|
2583
2593
|
// styles correctly, we need to include them in the root route.
|
|
2584
2594
|
isRootRoute ? getCssCodeSplitDisabledFile(ctx, viteConfig, viteManifest) : null,
|
|
2585
|
-
chunks.flatMap((e) => e.css ?? []).map((href) =>
|
|
2595
|
+
chunks.flatMap((e) => e.css ?? []).map((href) => {
|
|
2596
|
+
let publicHref = `${ctx.publicPath}${href}`;
|
|
2597
|
+
return allDynamicCssFiles.has(href) ? `${publicHref}#` : publicHref;
|
|
2598
|
+
})
|
|
2586
2599
|
].flat(1).filter(isNonNullable)
|
|
2587
2600
|
)
|
|
2588
2601
|
};
|
|
@@ -2605,6 +2618,44 @@ function resolveDependantChunks(viteManifest, entryChunks) {
|
|
|
2605
2618
|
}
|
|
2606
2619
|
return Array.from(chunks);
|
|
2607
2620
|
}
|
|
2621
|
+
function getAllDynamicCssFiles(ctx, viteManifest) {
|
|
2622
|
+
let allDynamicCssFiles = /* @__PURE__ */ new Set();
|
|
2623
|
+
for (let route of Object.values(ctx.reactRouterConfig.routes)) {
|
|
2624
|
+
let routeFile = path6.join(ctx.reactRouterConfig.appDirectory, route.file);
|
|
2625
|
+
let entryChunk = resolveChunk(
|
|
2626
|
+
ctx,
|
|
2627
|
+
viteManifest,
|
|
2628
|
+
`${routeFile}${BUILD_CLIENT_ROUTE_QUERY_STRING}`
|
|
2629
|
+
);
|
|
2630
|
+
if (entryChunk) {
|
|
2631
|
+
let walk2 = function(chunk, isDynamicImportContext) {
|
|
2632
|
+
if (visitedChunks.has(chunk)) {
|
|
2633
|
+
return;
|
|
2634
|
+
}
|
|
2635
|
+
visitedChunks.add(chunk);
|
|
2636
|
+
if (isDynamicImportContext && chunk.css) {
|
|
2637
|
+
for (let cssFile of chunk.css) {
|
|
2638
|
+
allDynamicCssFiles.add(cssFile);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
if (chunk.dynamicImports) {
|
|
2642
|
+
for (let dynamicImportKey of chunk.dynamicImports) {
|
|
2643
|
+
walk2(viteManifest[dynamicImportKey], true);
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
if (chunk.imports) {
|
|
2647
|
+
for (let importKey of chunk.imports) {
|
|
2648
|
+
walk2(viteManifest[importKey], isDynamicImportContext);
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
};
|
|
2652
|
+
var walk = walk2;
|
|
2653
|
+
let visitedChunks = /* @__PURE__ */ new Set();
|
|
2654
|
+
walk2(entryChunk, false);
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
return allDynamicCssFiles;
|
|
2658
|
+
}
|
|
2608
2659
|
function dedupe(array2) {
|
|
2609
2660
|
return [...new Set(array2)];
|
|
2610
2661
|
}
|
|
@@ -2894,10 +2945,12 @@ var reactRouterVitePlugin = () => {
|
|
|
2894
2945
|
let viteManifest = await loadViteManifest(
|
|
2895
2946
|
getClientBuildDirectory(ctx.reactRouterConfig)
|
|
2896
2947
|
);
|
|
2948
|
+
let allDynamicCssFiles = getAllDynamicCssFiles(ctx, viteManifest);
|
|
2897
2949
|
let entry = getReactRouterManifestBuildAssets(
|
|
2898
2950
|
ctx,
|
|
2899
2951
|
viteConfig2,
|
|
2900
2952
|
viteManifest,
|
|
2953
|
+
allDynamicCssFiles,
|
|
2901
2954
|
ctx.entryClientFilePath,
|
|
2902
2955
|
null
|
|
2903
2956
|
);
|
|
@@ -2949,6 +3002,7 @@ var reactRouterVitePlugin = () => {
|
|
|
2949
3002
|
ctx,
|
|
2950
3003
|
viteConfig2,
|
|
2951
3004
|
viteManifest,
|
|
3005
|
+
allDynamicCssFiles,
|
|
2952
3006
|
`${routeFile}${BUILD_CLIENT_ROUTE_QUERY_STRING}`,
|
|
2953
3007
|
route
|
|
2954
3008
|
),
|
|
@@ -3778,7 +3832,7 @@ var reactRouterVitePlugin = () => {
|
|
|
3778
3832
|
"",
|
|
3779
3833
|
` But other route exports in '${importerShort}' depend on '${id}'.`,
|
|
3780
3834
|
"",
|
|
3781
|
-
" See https://
|
|
3835
|
+
" See https://reactrouter.com/explanation/code-splitting#removal-of-server-code",
|
|
3782
3836
|
""
|
|
3783
3837
|
].join("\n")
|
|
3784
3838
|
);
|
|
@@ -3789,7 +3843,7 @@ var reactRouterVitePlugin = () => {
|
|
|
3789
3843
|
"",
|
|
3790
3844
|
` '${id}' imported by '${importerShort}'`,
|
|
3791
3845
|
"",
|
|
3792
|
-
" See https://
|
|
3846
|
+
" See https://reactrouter.com/explanation/code-splitting#removal-of-server-code",
|
|
3793
3847
|
""
|
|
3794
3848
|
].join("\n")
|
|
3795
3849
|
);
|
|
@@ -4202,10 +4256,10 @@ async function handlePrerender(viteConfig, reactRouterConfig, serverBuildDirecto
|
|
|
4202
4256
|
}
|
|
4203
4257
|
}
|
|
4204
4258
|
let buildRoutes = createPrerenderRoutes(build.routes);
|
|
4205
|
-
|
|
4259
|
+
let prerenderSinglePath = async (path9) => {
|
|
4206
4260
|
let matches = (0, import_react_router2.matchRoutes)(buildRoutes, `/${path9}/`.replace(/^\/\/+/, "/"));
|
|
4207
4261
|
if (!matches) {
|
|
4208
|
-
|
|
4262
|
+
return;
|
|
4209
4263
|
}
|
|
4210
4264
|
let leafRoute = matches ? matches[matches.length - 1].route : null;
|
|
4211
4265
|
let manifestRoute = leafRoute ? build.routes[leafRoute.id]?.module : null;
|
|
@@ -4262,7 +4316,13 @@ async function handlePrerender(viteConfig, reactRouterConfig, serverBuildDirecto
|
|
|
4262
4316
|
} : void 0
|
|
4263
4317
|
);
|
|
4264
4318
|
}
|
|
4319
|
+
};
|
|
4320
|
+
let concurrency = 1;
|
|
4321
|
+
let { prerender } = reactRouterConfig;
|
|
4322
|
+
if (typeof prerender === "object" && "unstable_concurrency" in prerender) {
|
|
4323
|
+
concurrency = prerender.unstable_concurrency ?? 1;
|
|
4265
4324
|
}
|
|
4325
|
+
await (0, import_p_map.default)(build.prerender, prerenderSinglePath, { concurrency });
|
|
4266
4326
|
}
|
|
4267
4327
|
function getStaticPrerenderPaths(routes) {
|
|
4268
4328
|
let paths = ["/"];
|
|
@@ -4378,31 +4438,40 @@ ${content.toString("utf8")}`
|
|
|
4378
4438
|
);
|
|
4379
4439
|
}
|
|
4380
4440
|
async function getPrerenderPaths(prerender, ssr, routes, logWarning = false) {
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4441
|
+
if (prerender == null || prerender === false) {
|
|
4442
|
+
return [];
|
|
4443
|
+
}
|
|
4444
|
+
let pathsConfig;
|
|
4445
|
+
if (typeof prerender === "object" && "paths" in prerender) {
|
|
4446
|
+
pathsConfig = prerender.paths;
|
|
4447
|
+
} else {
|
|
4448
|
+
pathsConfig = prerender;
|
|
4449
|
+
}
|
|
4450
|
+
if (pathsConfig === false) {
|
|
4451
|
+
return [];
|
|
4452
|
+
}
|
|
4453
|
+
let prerenderRoutes = createPrerenderRoutes(routes);
|
|
4454
|
+
if (pathsConfig === true) {
|
|
4455
|
+
let { paths, paramRoutes } = getStaticPrerenderPaths(prerenderRoutes);
|
|
4456
|
+
if (logWarning && !ssr && paramRoutes.length > 0) {
|
|
4457
|
+
console.warn(
|
|
4458
|
+
import_picocolors4.default.yellow(
|
|
4459
|
+
[
|
|
4460
|
+
"\u26A0\uFE0F Paths with dynamic/splat params cannot be prerendered when using `prerender: true`. You may want to use the `prerender()` API to prerender the following paths:",
|
|
4461
|
+
...paramRoutes.map((p) => " - " + p)
|
|
4462
|
+
].join("\n")
|
|
4463
|
+
)
|
|
4464
|
+
);
|
|
4403
4465
|
}
|
|
4466
|
+
return paths;
|
|
4467
|
+
}
|
|
4468
|
+
if (typeof pathsConfig === "function") {
|
|
4469
|
+
let paths = await pathsConfig({
|
|
4470
|
+
getStaticPaths: () => getStaticPrerenderPaths(prerenderRoutes).paths
|
|
4471
|
+
});
|
|
4472
|
+
return paths;
|
|
4404
4473
|
}
|
|
4405
|
-
return
|
|
4474
|
+
return pathsConfig;
|
|
4406
4475
|
}
|
|
4407
4476
|
function groupRoutesByParentId2(manifest) {
|
|
4408
4477
|
let routes = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/dev",
|
|
3
|
-
"version": "7.9.
|
|
3
|
+
"version": "7.9.5-pre.0",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"isbot": "^5.1.11",
|
|
79
79
|
"jsesc": "3.0.2",
|
|
80
80
|
"lodash": "^4.17.21",
|
|
81
|
+
"p-map": "^7.0.3",
|
|
81
82
|
"pathe": "^1.1.2",
|
|
82
83
|
"picocolors": "^1.1.1",
|
|
83
84
|
"prettier": "^3.6.2",
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
"tinyglobby": "^0.2.14",
|
|
87
88
|
"valibot": "^1.1.0",
|
|
88
89
|
"vite-node": "^3.2.2",
|
|
89
|
-
"@react-router/node": "7.9.
|
|
90
|
+
"@react-router/node": "7.9.5-pre.0"
|
|
90
91
|
},
|
|
91
92
|
"devDependencies": {
|
|
92
93
|
"@types/babel__core": "^7.20.5",
|
|
@@ -109,16 +110,16 @@
|
|
|
109
110
|
"vite": "^6.1.0",
|
|
110
111
|
"wireit": "0.14.9",
|
|
111
112
|
"wrangler": "^4.23.0",
|
|
112
|
-
"@react-router/serve": "7.9.
|
|
113
|
-
"react-router": "^7.9.
|
|
113
|
+
"@react-router/serve": "7.9.5-pre.0",
|
|
114
|
+
"react-router": "^7.9.5-pre.0"
|
|
114
115
|
},
|
|
115
116
|
"peerDependencies": {
|
|
116
117
|
"@vitejs/plugin-rsc": "*",
|
|
117
118
|
"typescript": "^5.1.0",
|
|
118
119
|
"vite": "^5.1.0 || ^6.0.0 || ^7.0.0",
|
|
119
120
|
"wrangler": "^3.28.2 || ^4.0.0",
|
|
120
|
-
"@react-router/serve": "^7.9.
|
|
121
|
-
"react-router": "^7.9.
|
|
121
|
+
"@react-router/serve": "^7.9.5-pre.0",
|
|
122
|
+
"react-router": "^7.9.5-pre.0"
|
|
122
123
|
},
|
|
123
124
|
"peerDependenciesMeta": {
|
|
124
125
|
"@vitejs/plugin-rsc": {
|