@react-router/dev 7.16.0 → 7.17.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,15 +1,29 @@
1
1
  # `@react-router/dev`
2
2
 
3
+ ## v7.17.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix future flag warning URLs and only log each future flag warning one time ([#15138](https://github.com/remix-run/react-router/pull/15138))
8
+
9
+ ### Unstable Changes
10
+
11
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
12
+
13
+ - Prevent RSC route module server exports from being scanned by the client dependency optimizer when `future.unstable_optimizeDeps` is enabled. ([#15005](https://github.com/remix-run/react-router/pull/15005))
14
+ - Updated dependencies:
15
+ - [`react-router@7.17.0`](https://github.com/remix-run/react-router/releases/tag/react-router@7.17.0)
16
+ - [`@react-router/node@7.17.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/node@7.17.0)
17
+ - [`@react-router/serve@7.17.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/serve@7.17.0)
18
+
3
19
  ## v7.16.0
4
20
 
5
21
  ### Minor Changes
6
22
 
7
23
  - Stabilize `future.unstable_trailingSlashAwareDataRequests` as `future.v8_trailingSlashAwareDataRequests` ([#15098](https://github.com/remix-run/react-router/pull/15098))
8
-
9
24
  - The unstable flag is no longer supported and will error during config resolution
10
25
 
11
26
  - Log future flag warnings for upcoming React Router v8 flags ([#15029](https://github.com/remix-run/react-router/pull/15029))
12
-
13
27
  - `v8_middleware`, `v8_splitRouteModules`, `v8_viteEnvironmentApi`, `v8_passThroughRequests`, `v8_trailingSlashAwareDataRequests`
14
28
 
15
29
  ### 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.16.0
3
+ * @react-router/dev v7.17.0
4
4
  *
5
5
  * Copyright (c) Remix Software Inc.
6
6
  *
@@ -312,7 +312,8 @@ async function resolveConfig({
312
312
  viteNodeContext,
313
313
  reactRouterConfigFile,
314
314
  skipRoutes,
315
- validateConfig
315
+ validateConfig,
316
+ shouldLogFutureFlagWarnings
316
317
  }) {
317
318
  let reactRouterUserConfig = {};
318
319
  if (reactRouterConfigFile) {
@@ -556,7 +557,9 @@ async function resolveConfig({
556
557
  for (let preset of reactRouterUserConfig.presets ?? []) {
557
558
  await preset.reactRouterConfigResolved?.({ reactRouterConfig });
558
559
  }
559
- logFutureFlagWarnings(userAndPresetConfigs.future || {});
560
+ if (shouldLogFutureFlagWarnings) {
561
+ logFutureFlagWarnings(userAndPresetConfigs.future || {});
562
+ }
560
563
  return ok(reactRouterConfig);
561
564
  }
562
565
  function logFutureFlagWarning(flag, message) {
@@ -564,7 +567,7 @@ function logFutureFlagWarning(flag, message) {
564
567
  import_picocolors.default.yellow(
565
568
  ` \u26A0\uFE0F Future Flag Warning: ${message}
566
569
  You can use the \`future.${flag}\` flag to opt in early.
567
- -> https://reactrouter.com/upgrading/future-flags#${flag}`
570
+ -> https://reactrouter.com/v7/upgrading/future#future${flag.toLowerCase()}`
568
571
  )
569
572
  );
570
573
  }
@@ -605,7 +608,8 @@ async function createConfigLoader({
605
608
  watch: watch2,
606
609
  mode,
607
610
  skipRoutes,
608
- validateConfig
611
+ validateConfig,
612
+ shouldLogFutureFlagWarnings
609
613
  }) {
610
614
  root = import_pathe3.default.normalize(root ?? process.env.REACT_ROUTER_ROOT ?? process.cwd());
611
615
  let vite2 = await import("vite");
@@ -629,10 +633,17 @@ async function createConfigLoader({
629
633
  viteNodeContext,
630
634
  reactRouterConfigFile,
631
635
  skipRoutes,
632
- validateConfig
636
+ validateConfig,
637
+ shouldLogFutureFlagWarnings
633
638
  });
634
639
  let appDirectory;
635
- let initialConfigResult = await getConfig();
640
+ let initialConfigResult = await resolveConfig({
641
+ root,
642
+ viteNodeContext,
643
+ reactRouterConfigFile,
644
+ skipRoutes,
645
+ validateConfig
646
+ });
636
647
  if (!initialConfigResult.ok) {
637
648
  throw new Error(initialConfigResult.error);
638
649
  }
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.16.0
2
+ * @react-router/dev v7.17.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.16.0
2
+ * @react-router/dev v7.17.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.16.0
2
+ * @react-router/dev v7.17.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -338,7 +338,8 @@ async function resolveConfig({
338
338
  viteNodeContext,
339
339
  reactRouterConfigFile,
340
340
  skipRoutes,
341
- validateConfig
341
+ validateConfig,
342
+ shouldLogFutureFlagWarnings
342
343
  }) {
343
344
  let reactRouterUserConfig = {};
344
345
  if (reactRouterConfigFile) {
@@ -582,7 +583,9 @@ async function resolveConfig({
582
583
  for (let preset of reactRouterUserConfig.presets ?? []) {
583
584
  await preset.reactRouterConfigResolved?.({ reactRouterConfig });
584
585
  }
585
- logFutureFlagWarnings(userAndPresetConfigs.future || {});
586
+ if (shouldLogFutureFlagWarnings) {
587
+ logFutureFlagWarnings(userAndPresetConfigs.future || {});
588
+ }
586
589
  return ok(reactRouterConfig);
587
590
  }
588
591
  function logFutureFlagWarning(flag, message) {
@@ -590,7 +593,7 @@ function logFutureFlagWarning(flag, message) {
590
593
  import_picocolors.default.yellow(
591
594
  ` \u26A0\uFE0F Future Flag Warning: ${message}
592
595
  You can use the \`future.${flag}\` flag to opt in early.
593
- -> https://reactrouter.com/upgrading/future-flags#${flag}`
596
+ -> https://reactrouter.com/v7/upgrading/future#future${flag.toLowerCase()}`
594
597
  )
595
598
  );
596
599
  }
@@ -631,7 +634,8 @@ async function createConfigLoader({
631
634
  watch,
632
635
  mode,
633
636
  skipRoutes,
634
- validateConfig
637
+ validateConfig,
638
+ shouldLogFutureFlagWarnings
635
639
  }) {
636
640
  root = import_pathe3.default.normalize(root ?? process.env.REACT_ROUTER_ROOT ?? process.cwd());
637
641
  let vite2 = await import("vite");
@@ -655,10 +659,17 @@ async function createConfigLoader({
655
659
  viteNodeContext,
656
660
  reactRouterConfigFile,
657
661
  skipRoutes,
658
- validateConfig
662
+ validateConfig,
663
+ shouldLogFutureFlagWarnings
659
664
  });
660
665
  let appDirectory;
661
- let initialConfigResult = await getConfig();
666
+ let initialConfigResult = await resolveConfig({
667
+ root,
668
+ viteNodeContext,
669
+ reactRouterConfigFile,
670
+ skipRoutes,
671
+ validateConfig
672
+ });
662
673
  if (!initialConfigResult.ok) {
663
674
  throw new Error(initialConfigResult.error);
664
675
  }
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.16.0
2
+ * @react-router/dev v7.17.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -375,7 +375,8 @@ async function resolveConfig({
375
375
  viteNodeContext,
376
376
  reactRouterConfigFile,
377
377
  skipRoutes,
378
- validateConfig
378
+ validateConfig,
379
+ shouldLogFutureFlagWarnings
379
380
  }) {
380
381
  let reactRouterUserConfig = {};
381
382
  if (reactRouterConfigFile) {
@@ -619,7 +620,9 @@ async function resolveConfig({
619
620
  for (let preset of reactRouterUserConfig.presets ?? []) {
620
621
  await preset.reactRouterConfigResolved?.({ reactRouterConfig });
621
622
  }
622
- logFutureFlagWarnings(userAndPresetConfigs.future || {});
623
+ if (shouldLogFutureFlagWarnings) {
624
+ logFutureFlagWarnings(userAndPresetConfigs.future || {});
625
+ }
623
626
  return ok(reactRouterConfig);
624
627
  }
625
628
  function logFutureFlagWarning(flag, message) {
@@ -627,7 +630,7 @@ function logFutureFlagWarning(flag, message) {
627
630
  import_picocolors.default.yellow(
628
631
  ` \u26A0\uFE0F Future Flag Warning: ${message}
629
632
  You can use the \`future.${flag}\` flag to opt in early.
630
- -> https://reactrouter.com/upgrading/future-flags#${flag}`
633
+ -> https://reactrouter.com/v7/upgrading/future#future${flag.toLowerCase()}`
631
634
  )
632
635
  );
633
636
  }
@@ -668,7 +671,8 @@ async function createConfigLoader({
668
671
  watch: watch2,
669
672
  mode,
670
673
  skipRoutes,
671
- validateConfig
674
+ validateConfig,
675
+ shouldLogFutureFlagWarnings
672
676
  }) {
673
677
  root = import_pathe3.default.normalize(root ?? process.env.REACT_ROUTER_ROOT ?? process.cwd());
674
678
  let vite2 = await import("vite");
@@ -692,10 +696,17 @@ async function createConfigLoader({
692
696
  viteNodeContext,
693
697
  reactRouterConfigFile,
694
698
  skipRoutes,
695
- validateConfig
699
+ validateConfig,
700
+ shouldLogFutureFlagWarnings
696
701
  });
697
702
  let appDirectory;
698
- let initialConfigResult = await getConfig();
703
+ let initialConfigResult = await resolveConfig({
704
+ root,
705
+ viteNodeContext,
706
+ reactRouterConfigFile,
707
+ skipRoutes,
708
+ validateConfig
709
+ });
699
710
  if (!initialConfigResult.ok) {
700
711
  throw new Error(initialConfigResult.error);
701
712
  }
@@ -3574,7 +3585,8 @@ var reactRouterVitePlugin = () => {
3574
3585
  reactRouterConfigLoader = await createConfigLoader({
3575
3586
  rootDirectory,
3576
3587
  mode,
3577
- watch: viteCommand === "serve"
3588
+ watch: viteCommand === "serve",
3589
+ shouldLogFutureFlagWarnings: viteCommand !== "build" || viteConfigEnv.isSsrBuild === true
3578
3590
  });
3579
3591
  await updatePluginContext();
3580
3592
  let environments = await getEnvironmentsOptions(ctx, viteCommand, {
@@ -6152,6 +6164,13 @@ if (import.meta.hot) {
6152
6164
  }
6153
6165
  };
6154
6166
  }
6167
+ function createClientRouteModuleForOptimizeDepsScan(code) {
6168
+ const ast = import_parser.parse(code, {
6169
+ sourceType: "module"
6170
+ });
6171
+ removeExports(ast, SERVER_ROUTE_EXPORTS);
6172
+ return generate(ast);
6173
+ }
6155
6174
  function createId(id, type, value) {
6156
6175
  let [base, ...rest] = id.split("?");
6157
6176
  const searchParams = new URLSearchParams(rest.join("?"));
@@ -6408,6 +6427,15 @@ ${errors.map((x) => ` - ${x}`).join("\n")}
6408
6427
  reactRouterConfig: config
6409
6428
  });
6410
6429
  let viteNormalizePath = (await import("vite")).normalizePath;
6430
+ let optimizeDepsEntries = getOptimizeDepsEntries({
6431
+ entryClientFilePath: entries.client,
6432
+ reactRouterConfig: config
6433
+ });
6434
+ let routeFiles = new Set(
6435
+ Object.values(config.routes).map(
6436
+ (route) => resolveRelativeRouteFilePath(route, config)
6437
+ )
6438
+ );
6411
6439
  return {
6412
6440
  resolve: {
6413
6441
  dedupe: [
@@ -6430,15 +6458,18 @@ ${errors.map((x) => ` - ${x}`).join("\n")}
6430
6458
  ]
6431
6459
  },
6432
6460
  optimizeDeps: {
6433
- entries: getOptimizeDepsEntries({
6434
- entryClientFilePath: entries.client,
6435
- reactRouterConfig: config
6436
- }),
6461
+ entries: optimizeDepsEntries,
6437
6462
  ...defineOptimizeDepsCompilerOptions({
6438
6463
  rolldown: {
6439
6464
  transform: {
6440
6465
  jsx: "react-jsx"
6441
- }
6466
+ },
6467
+ plugins: config.future.unstable_optimizeDeps ? [
6468
+ createRSCOptimizeDepsRouteModulesPlugin({
6469
+ routeFiles,
6470
+ transformToJs
6471
+ })
6472
+ ] : []
6442
6473
  },
6443
6474
  esbuild: {
6444
6475
  jsx: "automatic"
@@ -6889,6 +6920,32 @@ function invalidateVirtualModules2(viteDevServer) {
6889
6920
  function getRootDirectory(viteUserConfig) {
6890
6921
  return viteUserConfig.root ?? process.env.REACT_ROUTER_ROOT ?? process.cwd();
6891
6922
  }
6923
+ var jsRouteModuleRE = /\.[cm]?[jt]sx?$/;
6924
+ function createRSCOptimizeDepsRouteModulesPlugin({
6925
+ routeFiles,
6926
+ transformToJs
6927
+ }) {
6928
+ return {
6929
+ name: "react-router:rsc-optimize-deps-route-modules",
6930
+ transform: {
6931
+ filter: { id: jsRouteModuleRE },
6932
+ async handler(code, id) {
6933
+ let filename2 = id.split("?")[0];
6934
+ let normalizedFilename = getVite().normalizePath(filename2);
6935
+ if (!routeFiles.has(normalizedFilename)) {
6936
+ return;
6937
+ }
6938
+ let js2 = await transformToJs(code, filename2);
6939
+ let generated = createClientRouteModuleForOptimizeDepsScan(js2);
6940
+ return {
6941
+ code: generated.code,
6942
+ map: null,
6943
+ moduleType: "js"
6944
+ };
6945
+ }
6946
+ }
6947
+ };
6948
+ }
6892
6949
  var getClientBuildDirectory2 = (reactRouterConfig) => import_pathe6.default.join(reactRouterConfig.buildDirectory, "client");
6893
6950
  function getPrerenderConcurrencyConfig2(reactRouterConfig) {
6894
6951
  let concurrency = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-router/dev",
3
- "version": "7.16.0",
3
+ "version": "7.17.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.16.0"
95
+ "@react-router/node": "7.17.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.16.0",
120
- "@react-router/serve": "7.16.0"
119
+ "react-router": "^7.17.0",
120
+ "@react-router/serve": "7.17.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.16.0",
129
- "react-router": "^7.16.0"
128
+ "@react-router/serve": "^7.17.0",
129
+ "react-router": "^7.17.0"
130
130
  },
131
131
  "peerDependenciesMeta": {
132
132
  "@vitejs/plugin-rsc": {