@react-router/dev 7.15.0 → 7.16.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,19 +1,52 @@
1
1
  # `@react-router/dev`
2
2
 
3
+ ## v7.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Stabilize `future.unstable_trailingSlashAwareDataRequests` as `future.v8_trailingSlashAwareDataRequests` ([#15098](https://github.com/remix-run/react-router/pull/15098))
8
+
9
+ - The unstable flag is no longer supported and will error during config resolution
10
+
11
+ - Log future flag warnings for upcoming React Router v8 flags ([#15029](https://github.com/remix-run/react-router/pull/15029))
12
+
13
+ - `v8_middleware`, `v8_splitRouteModules`, `v8_viteEnvironmentApi`, `v8_passThroughRequests`, `v8_trailingSlashAwareDataRequests`
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies:
18
+ - [`react-router@7.16.0`](https://github.com/remix-run/react-router/releases/tag/react-router@7.16.0)
19
+ - [`@react-router/node@7.16.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/node@7.16.0)
20
+ - [`@react-router/serve@7.16.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/serve@7.16.0)
21
+
22
+ ## v7.15.1
23
+
24
+ ### Patch Changes
25
+
26
+ - Fix `basename` conflicting with `app` directory name when Vite `base` is set ([#15027](https://github.com/remix-run/react-router/pull/15027))
27
+
28
+ When the Vite `base` config and React Router `basename` both match the
29
+ app directory name (e.g. `base: "/app/"`, `basename: "/app/"`), Vite would
30
+ strip the base prefix from server-build virtual module import paths, causing
31
+ "Failed to load url /root.tsx" errors. The fix uses `/@fs/` absolute paths
32
+ for those imports to bypass Vite's base-stripping logic.
33
+
34
+ - Updated dependencies:
35
+ - [`react-router@7.15.1`](https://github.com/remix-run/react-router/releases/tag/react-router@7.15.1)
36
+ - [`@react-router/node@7.15.1`](https://github.com/remix-run/react-router/releases/tag/@react-router/node@7.15.1)
37
+ - [`@react-router/serve@7.15.1`](https://github.com/remix-run/react-router/releases/tag/@react-router/serve@7.15.1)
38
+
3
39
  ## v7.15.0
4
40
 
5
41
  ### Minor Changes
6
42
 
7
43
  - Stabilize `future.unstable_passThroughRequests` as `future.v8_passThroughRequests` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
8
-
9
44
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
10
45
 
11
46
  - Stabilize `prerender.unstable_concurrency` as `prerender.concurrency` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
12
-
13
47
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
14
48
 
15
49
  - 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
50
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
18
51
 
19
52
  ### 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.15.0
3
+ * @react-router/dev v7.16.0
4
4
  *
5
5
  * Copyright (c) Remix Software Inc.
6
6
  *
@@ -514,6 +514,11 @@ async function resolveConfig({
514
514
  "The `future.unstable_passThroughRequests` flag has been stabilized as `future.v8_passThroughRequests`"
515
515
  );
516
516
  }
517
+ if ("unstable_trailingSlashAwareDataRequests" in futureConfig) {
518
+ return err(
519
+ "The `future.unstable_trailingSlashAwareDataRequests` flag has been stabilized as `future.v8_trailingSlashAwareDataRequests`"
520
+ );
521
+ }
517
522
  if ("unstable_subResourceIntegrity" in futureConfig) {
518
523
  return err(
519
524
  "The `future.unstable_subResourceIntegrity` flag has been stabilized and moved to a top-level `config.subResourceIntegrity` field"
@@ -523,7 +528,7 @@ async function resolveConfig({
523
528
  let future = {
524
529
  unstable_optimizeDeps: userAndPresetConfigs.future?.unstable_optimizeDeps ?? false,
525
530
  v8_passThroughRequests: userAndPresetConfigs.future?.v8_passThroughRequests ?? false,
526
- unstable_trailingSlashAwareDataRequests: userAndPresetConfigs.future?.unstable_trailingSlashAwareDataRequests ?? false,
531
+ v8_trailingSlashAwareDataRequests: userAndPresetConfigs.future?.v8_trailingSlashAwareDataRequests ?? false,
527
532
  unstable_previewServerPrerendering: userAndPresetConfigs.future?.unstable_previewServerPrerendering ?? false,
528
533
  v8_middleware: userAndPresetConfigs.future?.v8_middleware ?? false,
529
534
  v8_splitRouteModules: userAndPresetConfigs.future?.v8_splitRouteModules ?? false,
@@ -551,8 +556,50 @@ async function resolveConfig({
551
556
  for (let preset of reactRouterUserConfig.presets ?? []) {
552
557
  await preset.reactRouterConfigResolved?.({ reactRouterConfig });
553
558
  }
559
+ logFutureFlagWarnings(userAndPresetConfigs.future || {});
554
560
  return ok(reactRouterConfig);
555
561
  }
562
+ function logFutureFlagWarning(flag, message) {
563
+ console.log(
564
+ import_picocolors.default.yellow(
565
+ ` \u26A0\uFE0F Future Flag Warning: ${message}
566
+ You can use the \`future.${flag}\` flag to opt in early.
567
+ -> https://reactrouter.com/upgrading/future-flags#${flag}`
568
+ )
569
+ );
570
+ }
571
+ function logFutureFlagWarnings(future) {
572
+ if (future.v8_middleware === void 0) {
573
+ logFutureFlagWarning(
574
+ "v8_middleware",
575
+ "Route middleware support is changing in React Router v8."
576
+ );
577
+ }
578
+ if (future.v8_splitRouteModules === void 0) {
579
+ logFutureFlagWarning(
580
+ "v8_splitRouteModules",
581
+ "Route module splitting behavior is changing in React Router v8."
582
+ );
583
+ }
584
+ if (future.v8_viteEnvironmentApi === void 0) {
585
+ logFutureFlagWarning(
586
+ "v8_viteEnvironmentApi",
587
+ "Vite Environment API usage is changing in React Router v8."
588
+ );
589
+ }
590
+ if (future.v8_passThroughRequests === void 0) {
591
+ logFutureFlagWarning(
592
+ "v8_passThroughRequests",
593
+ "Request handling behavior is changing in React Router v8."
594
+ );
595
+ }
596
+ if (future.v8_trailingSlashAwareDataRequests === void 0) {
597
+ logFutureFlagWarning(
598
+ "v8_trailingSlashAwareDataRequests",
599
+ "Data request URL formats are changing in React Router v8."
600
+ );
601
+ }
602
+ }
556
603
  async function createConfigLoader({
557
604
  rootDirectory: root,
558
605
  watch: watch2,
package/dist/config.d.ts CHANGED
@@ -39,7 +39,7 @@ type ServerModuleFormat = "esm" | "cjs";
39
39
  interface FutureConfig {
40
40
  unstable_optimizeDeps: boolean;
41
41
  v8_passThroughRequests: boolean;
42
- unstable_trailingSlashAwareDataRequests: boolean;
42
+ v8_trailingSlashAwareDataRequests: boolean;
43
43
  /**
44
44
  * Prerender with Vite Preview server
45
45
  */
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.15.0
2
+ * @react-router/dev v7.16.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.15.0
2
+ * @react-router/dev v7.16.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.15.0
2
+ * @react-router/dev v7.16.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -540,6 +540,11 @@ async function resolveConfig({
540
540
  "The `future.unstable_passThroughRequests` flag has been stabilized as `future.v8_passThroughRequests`"
541
541
  );
542
542
  }
543
+ if ("unstable_trailingSlashAwareDataRequests" in futureConfig) {
544
+ return err(
545
+ "The `future.unstable_trailingSlashAwareDataRequests` flag has been stabilized as `future.v8_trailingSlashAwareDataRequests`"
546
+ );
547
+ }
543
548
  if ("unstable_subResourceIntegrity" in futureConfig) {
544
549
  return err(
545
550
  "The `future.unstable_subResourceIntegrity` flag has been stabilized and moved to a top-level `config.subResourceIntegrity` field"
@@ -549,7 +554,7 @@ async function resolveConfig({
549
554
  let future = {
550
555
  unstable_optimizeDeps: userAndPresetConfigs.future?.unstable_optimizeDeps ?? false,
551
556
  v8_passThroughRequests: userAndPresetConfigs.future?.v8_passThroughRequests ?? false,
552
- unstable_trailingSlashAwareDataRequests: userAndPresetConfigs.future?.unstable_trailingSlashAwareDataRequests ?? false,
557
+ v8_trailingSlashAwareDataRequests: userAndPresetConfigs.future?.v8_trailingSlashAwareDataRequests ?? false,
553
558
  unstable_previewServerPrerendering: userAndPresetConfigs.future?.unstable_previewServerPrerendering ?? false,
554
559
  v8_middleware: userAndPresetConfigs.future?.v8_middleware ?? false,
555
560
  v8_splitRouteModules: userAndPresetConfigs.future?.v8_splitRouteModules ?? false,
@@ -577,8 +582,50 @@ async function resolveConfig({
577
582
  for (let preset of reactRouterUserConfig.presets ?? []) {
578
583
  await preset.reactRouterConfigResolved?.({ reactRouterConfig });
579
584
  }
585
+ logFutureFlagWarnings(userAndPresetConfigs.future || {});
580
586
  return ok(reactRouterConfig);
581
587
  }
588
+ function logFutureFlagWarning(flag, message) {
589
+ console.log(
590
+ import_picocolors.default.yellow(
591
+ ` \u26A0\uFE0F Future Flag Warning: ${message}
592
+ You can use the \`future.${flag}\` flag to opt in early.
593
+ -> https://reactrouter.com/upgrading/future-flags#${flag}`
594
+ )
595
+ );
596
+ }
597
+ function logFutureFlagWarnings(future) {
598
+ if (future.v8_middleware === void 0) {
599
+ logFutureFlagWarning(
600
+ "v8_middleware",
601
+ "Route middleware support is changing in React Router v8."
602
+ );
603
+ }
604
+ if (future.v8_splitRouteModules === void 0) {
605
+ logFutureFlagWarning(
606
+ "v8_splitRouteModules",
607
+ "Route module splitting behavior is changing in React Router v8."
608
+ );
609
+ }
610
+ if (future.v8_viteEnvironmentApi === void 0) {
611
+ logFutureFlagWarning(
612
+ "v8_viteEnvironmentApi",
613
+ "Vite Environment API usage is changing in React Router v8."
614
+ );
615
+ }
616
+ if (future.v8_passThroughRequests === void 0) {
617
+ logFutureFlagWarning(
618
+ "v8_passThroughRequests",
619
+ "Request handling behavior is changing in React Router v8."
620
+ );
621
+ }
622
+ if (future.v8_trailingSlashAwareDataRequests === void 0) {
623
+ logFutureFlagWarning(
624
+ "v8_trailingSlashAwareDataRequests",
625
+ "Data request URL formats are changing in React Router v8."
626
+ );
627
+ }
628
+ }
582
629
  async function createConfigLoader({
583
630
  rootDirectory: root,
584
631
  watch,
@@ -802,7 +849,7 @@ var serverBuildId = "virtual:react-router/server-build";
802
849
  function importWrangler() {
803
850
  try {
804
851
  return import("wrangler");
805
- } catch (_) {
852
+ } catch (e) {
806
853
  throw Error("Could not import `wrangler`. Do you have it installed?");
807
854
  }
808
855
  }
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.15.0
2
+ * @react-router/dev v7.16.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -577,6 +577,11 @@ async function resolveConfig({
577
577
  "The `future.unstable_passThroughRequests` flag has been stabilized as `future.v8_passThroughRequests`"
578
578
  );
579
579
  }
580
+ if ("unstable_trailingSlashAwareDataRequests" in futureConfig) {
581
+ return err(
582
+ "The `future.unstable_trailingSlashAwareDataRequests` flag has been stabilized as `future.v8_trailingSlashAwareDataRequests`"
583
+ );
584
+ }
580
585
  if ("unstable_subResourceIntegrity" in futureConfig) {
581
586
  return err(
582
587
  "The `future.unstable_subResourceIntegrity` flag has been stabilized and moved to a top-level `config.subResourceIntegrity` field"
@@ -586,7 +591,7 @@ async function resolveConfig({
586
591
  let future = {
587
592
  unstable_optimizeDeps: userAndPresetConfigs.future?.unstable_optimizeDeps ?? false,
588
593
  v8_passThroughRequests: userAndPresetConfigs.future?.v8_passThroughRequests ?? false,
589
- unstable_trailingSlashAwareDataRequests: userAndPresetConfigs.future?.unstable_trailingSlashAwareDataRequests ?? false,
594
+ v8_trailingSlashAwareDataRequests: userAndPresetConfigs.future?.v8_trailingSlashAwareDataRequests ?? false,
590
595
  unstable_previewServerPrerendering: userAndPresetConfigs.future?.unstable_previewServerPrerendering ?? false,
591
596
  v8_middleware: userAndPresetConfigs.future?.v8_middleware ?? false,
592
597
  v8_splitRouteModules: userAndPresetConfigs.future?.v8_splitRouteModules ?? false,
@@ -614,8 +619,50 @@ async function resolveConfig({
614
619
  for (let preset of reactRouterUserConfig.presets ?? []) {
615
620
  await preset.reactRouterConfigResolved?.({ reactRouterConfig });
616
621
  }
622
+ logFutureFlagWarnings(userAndPresetConfigs.future || {});
617
623
  return ok(reactRouterConfig);
618
624
  }
625
+ function logFutureFlagWarning(flag, message) {
626
+ console.log(
627
+ import_picocolors.default.yellow(
628
+ ` \u26A0\uFE0F Future Flag Warning: ${message}
629
+ You can use the \`future.${flag}\` flag to opt in early.
630
+ -> https://reactrouter.com/upgrading/future-flags#${flag}`
631
+ )
632
+ );
633
+ }
634
+ function logFutureFlagWarnings(future) {
635
+ if (future.v8_middleware === void 0) {
636
+ logFutureFlagWarning(
637
+ "v8_middleware",
638
+ "Route middleware support is changing in React Router v8."
639
+ );
640
+ }
641
+ if (future.v8_splitRouteModules === void 0) {
642
+ logFutureFlagWarning(
643
+ "v8_splitRouteModules",
644
+ "Route module splitting behavior is changing in React Router v8."
645
+ );
646
+ }
647
+ if (future.v8_viteEnvironmentApi === void 0) {
648
+ logFutureFlagWarning(
649
+ "v8_viteEnvironmentApi",
650
+ "Vite Environment API usage is changing in React Router v8."
651
+ );
652
+ }
653
+ if (future.v8_passThroughRequests === void 0) {
654
+ logFutureFlagWarning(
655
+ "v8_passThroughRequests",
656
+ "Request handling behavior is changing in React Router v8."
657
+ );
658
+ }
659
+ if (future.v8_trailingSlashAwareDataRequests === void 0) {
660
+ logFutureFlagWarning(
661
+ "v8_trailingSlashAwareDataRequests",
662
+ "Data request URL formats are changing in React Router v8."
663
+ );
664
+ }
665
+ }
619
666
  async function createConfigLoader({
620
667
  rootDirectory: root,
621
668
  watch: watch2,
@@ -1394,14 +1441,18 @@ var import_react_router = require("react-router");
1394
1441
 
1395
1442
  // vite/resolve-file-url.ts
1396
1443
  var path3 = __toESM(require("path"));
1397
- var resolveFileUrl = ({ rootDirectory }, filePath) => {
1444
+ var resolveFileUrl = ({ rootDirectory }, filePath, { publicPath } = {}) => {
1398
1445
  let vite2 = getVite();
1399
1446
  let relativePath = path3.relative(rootDirectory, filePath);
1400
1447
  let isWithinRoot = !relativePath.startsWith("..") && !path3.isAbsolute(relativePath);
1401
1448
  if (!isWithinRoot) {
1402
1449
  return path3.posix.join("/@fs", vite2.normalizePath(filePath));
1403
1450
  }
1404
- return "/" + vite2.normalizePath(relativePath);
1451
+ let url2 = "/" + vite2.normalizePath(relativePath);
1452
+ if (publicPath && publicPath !== "/" && url2.startsWith(publicPath)) {
1453
+ return path3.posix.join("/@fs", vite2.normalizePath(filePath));
1454
+ }
1455
+ return url2;
1405
1456
  };
1406
1457
 
1407
1458
  // vite/styles.ts
@@ -1732,7 +1783,7 @@ function hasDependency({
1732
1783
  }) {
1733
1784
  try {
1734
1785
  return Boolean(require.resolve(name, { paths: [rootDirectory] }));
1735
- } catch (err2) {
1786
+ } catch (e) {
1736
1787
  return false;
1737
1788
  }
1738
1789
  }
@@ -3152,7 +3203,9 @@ var reactRouterVitePlugin = () => {
3152
3203
  let isSpaMode = isSpaModeEnabled(ctx.reactRouterConfig);
3153
3204
  return `
3154
3205
  import * as entryServer from ${JSON.stringify(
3155
- resolveFileUrl(ctx, ctx.entryServerFilePath)
3206
+ resolveFileUrl(ctx, ctx.entryServerFilePath, {
3207
+ publicPath: ctx.publicPath
3208
+ })
3156
3209
  )};
3157
3210
  ${Object.keys(routes).map((key, index) => {
3158
3211
  let route = routes[key];
@@ -3162,7 +3215,8 @@ var reactRouterVitePlugin = () => {
3162
3215
  return `import * as route${index} from ${JSON.stringify(
3163
3216
  resolveFileUrl(
3164
3217
  ctx,
3165
- resolveRelativeRouteFilePath(route, ctx.reactRouterConfig)
3218
+ resolveRelativeRouteFilePath(route, ctx.reactRouterConfig),
3219
+ { publicPath: ctx.publicPath }
3166
3220
  )
3167
3221
  )};`;
3168
3222
  }
@@ -4646,7 +4700,7 @@ ${html}`
4646
4700
  },
4647
4701
  async finalize(buildDirectory) {
4648
4702
  invariant(viteConfig);
4649
- let { ssr, future } = ctx.reactRouterConfig;
4703
+ let { ssr } = ctx.reactRouterConfig;
4650
4704
  if (!ssr) {
4651
4705
  let spaFallback = path7.join(buildDirectory, "__spa-fallback.html");
4652
4706
  let index = path7.join(buildDirectory, "index.html");
@@ -4979,7 +5033,7 @@ function getStaticPrerenderPaths(routes) {
4979
5033
  }
4980
5034
  async function prerenderData(handler, prerenderPath, onlyRoutes, clientBuildDirectory, reactRouterConfig, viteConfig, requestInit) {
4981
5035
  let dataRequestPath;
4982
- if (reactRouterConfig.future.unstable_trailingSlashAwareDataRequests) {
5036
+ if (reactRouterConfig.future.v8_trailingSlashAwareDataRequests) {
4983
5037
  if (prerenderPath.endsWith("/")) {
4984
5038
  dataRequestPath = `${prerenderPath}_.data`;
4985
5039
  } else {
@@ -6262,10 +6316,6 @@ function reactRouterRSCVitePlugin() {
6262
6316
  ([routeFile]) => import_pathe6.default.normalize(routeFile).endsWith(normalizedFile)
6263
6317
  )?.[1];
6264
6318
  }
6265
- function isMdxRouteModule(filename2) {
6266
- let extension = import_pathe6.default.extname(filename2).toLowerCase();
6267
- return extension === ".md" || extension === ".mdx";
6268
- }
6269
6319
  function getTransformLanguage(filename2) {
6270
6320
  let extension = import_pathe6.default.extname(filename2).toLowerCase();
6271
6321
  switch (extension) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-router/dev",
3
- "version": "7.15.0",
3
+ "version": "7.16.0",
4
4
  "description": "Dev tools and CLI for React Router",
5
5
  "homepage": "https://reactrouter.com",
6
6
  "bugs": {
@@ -92,7 +92,7 @@
92
92
  "tinyglobby": "^0.2.14",
93
93
  "valibot": "^1.2.0",
94
94
  "vite-node": "^3.2.2",
95
- "@react-router/node": "7.15.0"
95
+ "@react-router/node": "7.16.0"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@types/babel__core": "^7.20.5",
@@ -116,8 +116,8 @@
116
116
  "vite": "^6.3.0",
117
117
  "wireit": "0.14.9",
118
118
  "wrangler": "^4.23.0",
119
- "react-router": "^7.15.0",
120
- "@react-router/serve": "7.15.0"
119
+ "react-router": "^7.16.0",
120
+ "@react-router/serve": "7.16.0"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "@vitejs/plugin-rsc": "~0.5.21",
@@ -125,8 +125,8 @@
125
125
  "typescript": "^5.1.0 || ^6.0.0",
126
126
  "vite": "^5.1.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
127
127
  "wrangler": "^3.28.2 || ^4.0.0",
128
- "@react-router/serve": "^7.15.0",
129
- "react-router": "^7.15.0"
128
+ "@react-router/serve": "^7.16.0",
129
+ "react-router": "^7.16.0"
130
130
  },
131
131
  "peerDependenciesMeta": {
132
132
  "@vitejs/plugin-rsc": {