@react-router/dev 7.14.1 → 7.15.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 CHANGED
@@ -1,5 +1,49 @@
1
1
  # `@react-router/dev`
2
2
 
3
+ ## v7.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Stabilize `future.unstable_passThroughRequests` as `future.v8_passThroughRequests` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
8
+
9
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
10
+
11
+ - Stabilize `prerender.unstable_concurrency` as `prerender.concurrency` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
12
+
13
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
14
+
15
+ - Stabilize `future.unstable_subResourceIntegrity` as a top-level `subResourceIntegrity` config option in `react-router.config.ts` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
16
+
17
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies:
22
+ - [`react-router@7.15.0`](https://github.com/remix-run/react-router/releases/tag/react-router@7.15.0)
23
+ - [`@react-router/node@7.15.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/node@7.15.0)
24
+ - [`@react-router/serve@7.15.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/serve@7.15.0)
25
+
26
+ ## v7.14.2
27
+
28
+ ### Patch Changes
29
+
30
+ - Fix typegen for layouts without pages ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
31
+
32
+ Previously, typegen could produce `pages: ;` in `.react-router/types/+routes.ts` when a route corresponded to 0 pages.
33
+ Now, `pages: never;` is correctly generated for those cases.
34
+
35
+ ### Unstable Changes
36
+
37
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
38
+
39
+ - For `unstable_reactRouterRSC` Vite plugin consumers, require `@vitejs/plugin-react` in user Vite config, and more reliably split route modules. ([#14965](https://github.com/remix-run/react-router/pull/14965)) ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
40
+ - ⚠️ This is a breaking change if you have begun using the `unstable_reactRouterRSC` Vite plugin - please install `@vitejs/plugin-react` and add the `react` plugin to your Vite plugins array.
41
+
42
+ - Updated dependencies:
43
+ - [`react-router@7.14.2`](https://github.com/remix-run/react-router/releases/tag/react-router@7.14.2)
44
+ - [`@react-router/node@7.14.2`](https://github.com/remix-run/react-router/releases/tag/@react-router/node@7.14.2)
45
+ - [`@react-router/serve@7.14.2`](https://github.com/remix-run/react-router/releases/tag/@react-router/serve@7.14.2)
46
+
3
47
  ## v7.14.1
4
48
 
5
49
  ### Patch Changes
package/dist/cli/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @react-router/dev v7.14.1
3
+ * @react-router/dev v7.15.0
4
4
  *
5
5
  * Copyright (c) Remix Software Inc.
6
6
  *
@@ -398,10 +398,15 @@ async function resolveConfig({
398
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
399
  );
400
400
  }
401
- let isValidConcurrencyConfig = typeof prerender2 != "object" || !("unstable_concurrency" in prerender2) || typeof prerender2.unstable_concurrency === "number" && Number.isInteger(prerender2.unstable_concurrency) && prerender2.unstable_concurrency > 0;
401
+ if (typeof prerender2 === "object" && "unstable_concurrency" in prerender2) {
402
+ return err(
403
+ "The `prerender.unstable_concurrency` config field has been stabilized as `prerender.concurrency`"
404
+ );
405
+ }
406
+ let isValidConcurrencyConfig = typeof prerender2 != "object" || !("concurrency" in prerender2) || typeof prerender2.concurrency === "number" && Number.isInteger(prerender2.concurrency) && prerender2.concurrency > 0;
402
407
  if (!isValidConcurrencyConfig) {
403
408
  return err(
404
- "The `prerender.unstable_concurrency` config must be a positive integer if specified."
409
+ "The `prerender.concurrency` config must be a positive integer if specified."
405
410
  );
406
411
  }
407
412
  }
@@ -493,20 +498,31 @@ async function resolveConfig({
493
498
  }
494
499
  }
495
500
  let futureConfig = userAndPresetConfigs.future;
496
- if (futureConfig?.unstable_splitRouteModules !== void 0) {
497
- return err(
498
- 'The "future.unstable_splitRouteModules" flag has been stabilized as "future.v8_splitRouteModules"'
499
- );
500
- }
501
- if (futureConfig?.unstable_viteEnvironmentApi !== void 0) {
502
- return err(
503
- 'The "future.unstable_viteEnvironmentApi" flag has been stabilized as "future.v8_viteEnvironmentApi"'
504
- );
501
+ if (futureConfig) {
502
+ if ("unstable_splitRouteModules" in futureConfig) {
503
+ return err(
504
+ "The `future.unstable_splitRouteModules` flag has been stabilized as `future.v8_splitRouteModules`"
505
+ );
506
+ }
507
+ if ("unstable_viteEnvironmentApi" in futureConfig) {
508
+ return err(
509
+ "The `future.unstable_viteEnvironmentApi` flag has been stabilized as `future.v8_viteEnvironmentApi`"
510
+ );
511
+ }
512
+ if ("unstable_passThroughRequests" in futureConfig) {
513
+ return err(
514
+ "The `future.unstable_passThroughRequests` flag has been stabilized as `future.v8_passThroughRequests`"
515
+ );
516
+ }
517
+ if ("unstable_subResourceIntegrity" in futureConfig) {
518
+ return err(
519
+ "The `future.unstable_subResourceIntegrity` flag has been stabilized and moved to a top-level `config.subResourceIntegrity` field"
520
+ );
521
+ }
505
522
  }
506
523
  let future = {
507
524
  unstable_optimizeDeps: userAndPresetConfigs.future?.unstable_optimizeDeps ?? false,
508
- unstable_passThroughRequests: userAndPresetConfigs.future?.unstable_passThroughRequests ?? false,
509
- unstable_subResourceIntegrity: userAndPresetConfigs.future?.unstable_subResourceIntegrity ?? false,
525
+ v8_passThroughRequests: userAndPresetConfigs.future?.v8_passThroughRequests ?? false,
510
526
  unstable_trailingSlashAwareDataRequests: userAndPresetConfigs.future?.unstable_trailingSlashAwareDataRequests ?? false,
511
527
  unstable_previewServerPrerendering: userAndPresetConfigs.future?.unstable_previewServerPrerendering ?? false,
512
528
  v8_middleware: userAndPresetConfigs.future?.v8_middleware ?? false,
@@ -514,6 +530,7 @@ async function resolveConfig({
514
530
  v8_viteEnvironmentApi: (userAndPresetConfigs.future?.v8_viteEnvironmentApi || userAndPresetConfigs.future?.unstable_previewServerPrerendering) ?? false
515
531
  };
516
532
  let allowedActionOrigins = userAndPresetConfigs.allowedActionOrigins ?? false;
533
+ let subResourceIntegrity = userAndPresetConfigs.subResourceIntegrity ?? false;
517
534
  let reactRouterConfig = deepFreeze({
518
535
  appDirectory,
519
536
  basename: basename3,
@@ -527,6 +544,7 @@ async function resolveConfig({
527
544
  serverBundles,
528
545
  serverModuleFormat,
529
546
  ssr,
547
+ subResourceIntegrity,
530
548
  allowedActionOrigins,
531
549
  unstable_routeConfig: routeConfig
532
550
  });
@@ -1078,7 +1096,7 @@ function routeFilesType({
1078
1096
  t2.tsPropertySignature(
1079
1097
  t2.identifier("page"),
1080
1098
  t2.tsTypeAnnotation(
1081
- pages ? t2.tsUnionType(
1099
+ pages.size > 0 ? t2.tsUnionType(
1082
1100
  Array.from(pages).map(
1083
1101
  (page) => t2.tsLiteralType(t2.stringLiteral(page))
1084
1102
  )
package/dist/config.d.ts CHANGED
@@ -38,8 +38,7 @@ type ServerBundlesBuildManifest = BaseBuildManifest & {
38
38
  type ServerModuleFormat = "esm" | "cjs";
39
39
  interface FutureConfig {
40
40
  unstable_optimizeDeps: boolean;
41
- unstable_passThroughRequests: boolean;
42
- unstable_subResourceIntegrity: boolean;
41
+ v8_passThroughRequests: boolean;
43
42
  unstable_trailingSlashAwareDataRequests: boolean;
44
43
  /**
45
44
  * Prerender with Vite Preview server
@@ -103,7 +102,7 @@ type ReactRouterConfig = {
103
102
  * An array of URLs to prerender to HTML files at build time. Can also be a
104
103
  * function returning an array to dynamically generate URLs.
105
104
  *
106
- * `unstable_concurrency` defaults to 1, which means "no concurrency" - fully serial execution.
105
+ * `concurrency` defaults to 1, which means "no concurrency" - fully serial execution.
107
106
  * Setting it to a value more than 1 enables concurrent prerendering.
108
107
  * Setting it to a value higher than one can increase the speed of the build,
109
108
  * but may consume more resources, and send more concurrent requests to the
@@ -111,7 +110,7 @@ type ReactRouterConfig = {
111
110
  */
112
111
  prerender?: PrerenderPaths | {
113
112
  paths: PrerenderPaths;
114
- unstable_concurrency?: number;
113
+ concurrency?: number;
115
114
  };
116
115
  /**
117
116
  * An array of React Router plugin config presets to ease integration with
@@ -153,6 +152,11 @@ type ReactRouterConfig = {
153
152
  * SPA without server-rendering. Default's to `true`.
154
153
  */
155
154
  ssr?: boolean;
155
+ /**
156
+ * Enable subresource integrity hashes on asset script tags. Defaults to
157
+ * `false`.
158
+ */
159
+ subResourceIntegrity?: boolean;
156
160
  /**
157
161
  * An array of allowed origin hosts for action submissions to UI routes (does not apply
158
162
  * to resource routes). Supports micromatch glob patterns (`*` to match one segment,
@@ -259,6 +263,10 @@ type ResolvedReactRouterConfig = Readonly<{
259
263
  * SPA without server-rendering. Default's to `true`.
260
264
  */
261
265
  ssr: boolean;
266
+ /**
267
+ * Whether to generate subresource integrity hashes for asset script tags.
268
+ */
269
+ subResourceIntegrity: boolean;
262
270
  /**
263
271
  * The allowed origins for actions / mutations. Does not apply to routes
264
272
  * without a component. micromatch glob patterns are supported.
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.14.1
2
+ * @react-router/dev v7.15.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/routes.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.14.1
2
+ * @react-router/dev v7.15.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.14.1
2
+ * @react-router/dev v7.15.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -424,10 +424,15 @@ async function resolveConfig({
424
424
  "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."
425
425
  );
426
426
  }
427
- let isValidConcurrencyConfig = typeof prerender != "object" || !("unstable_concurrency" in prerender) || typeof prerender.unstable_concurrency === "number" && Number.isInteger(prerender.unstable_concurrency) && prerender.unstable_concurrency > 0;
427
+ if (typeof prerender === "object" && "unstable_concurrency" in prerender) {
428
+ return err(
429
+ "The `prerender.unstable_concurrency` config field has been stabilized as `prerender.concurrency`"
430
+ );
431
+ }
432
+ let isValidConcurrencyConfig = typeof prerender != "object" || !("concurrency" in prerender) || typeof prerender.concurrency === "number" && Number.isInteger(prerender.concurrency) && prerender.concurrency > 0;
428
433
  if (!isValidConcurrencyConfig) {
429
434
  return err(
430
- "The `prerender.unstable_concurrency` config must be a positive integer if specified."
435
+ "The `prerender.concurrency` config must be a positive integer if specified."
431
436
  );
432
437
  }
433
438
  }
@@ -519,20 +524,31 @@ async function resolveConfig({
519
524
  }
520
525
  }
521
526
  let futureConfig = userAndPresetConfigs.future;
522
- if (futureConfig?.unstable_splitRouteModules !== void 0) {
523
- return err(
524
- 'The "future.unstable_splitRouteModules" flag has been stabilized as "future.v8_splitRouteModules"'
525
- );
526
- }
527
- if (futureConfig?.unstable_viteEnvironmentApi !== void 0) {
528
- return err(
529
- 'The "future.unstable_viteEnvironmentApi" flag has been stabilized as "future.v8_viteEnvironmentApi"'
530
- );
527
+ if (futureConfig) {
528
+ if ("unstable_splitRouteModules" in futureConfig) {
529
+ return err(
530
+ "The `future.unstable_splitRouteModules` flag has been stabilized as `future.v8_splitRouteModules`"
531
+ );
532
+ }
533
+ if ("unstable_viteEnvironmentApi" in futureConfig) {
534
+ return err(
535
+ "The `future.unstable_viteEnvironmentApi` flag has been stabilized as `future.v8_viteEnvironmentApi`"
536
+ );
537
+ }
538
+ if ("unstable_passThroughRequests" in futureConfig) {
539
+ return err(
540
+ "The `future.unstable_passThroughRequests` flag has been stabilized as `future.v8_passThroughRequests`"
541
+ );
542
+ }
543
+ if ("unstable_subResourceIntegrity" in futureConfig) {
544
+ return err(
545
+ "The `future.unstable_subResourceIntegrity` flag has been stabilized and moved to a top-level `config.subResourceIntegrity` field"
546
+ );
547
+ }
531
548
  }
532
549
  let future = {
533
550
  unstable_optimizeDeps: userAndPresetConfigs.future?.unstable_optimizeDeps ?? false,
534
- unstable_passThroughRequests: userAndPresetConfigs.future?.unstable_passThroughRequests ?? false,
535
- unstable_subResourceIntegrity: userAndPresetConfigs.future?.unstable_subResourceIntegrity ?? false,
551
+ v8_passThroughRequests: userAndPresetConfigs.future?.v8_passThroughRequests ?? false,
536
552
  unstable_trailingSlashAwareDataRequests: userAndPresetConfigs.future?.unstable_trailingSlashAwareDataRequests ?? false,
537
553
  unstable_previewServerPrerendering: userAndPresetConfigs.future?.unstable_previewServerPrerendering ?? false,
538
554
  v8_middleware: userAndPresetConfigs.future?.v8_middleware ?? false,
@@ -540,6 +556,7 @@ async function resolveConfig({
540
556
  v8_viteEnvironmentApi: (userAndPresetConfigs.future?.v8_viteEnvironmentApi || userAndPresetConfigs.future?.unstable_previewServerPrerendering) ?? false
541
557
  };
542
558
  let allowedActionOrigins = userAndPresetConfigs.allowedActionOrigins ?? false;
559
+ let subResourceIntegrity = userAndPresetConfigs.subResourceIntegrity ?? false;
543
560
  let reactRouterConfig = deepFreeze({
544
561
  appDirectory,
545
562
  basename,
@@ -553,6 +570,7 @@ async function resolveConfig({
553
570
  serverBundles,
554
571
  serverModuleFormat,
555
572
  ssr,
573
+ subResourceIntegrity,
556
574
  allowedActionOrigins,
557
575
  unstable_routeConfig: routeConfig
558
576
  });