@react-router/dev 0.0.0-experimental-795b50c5b → 0.0.0-experimental-ae6d61df4

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/dist/routes.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-795b50c5b
2
+ * @react-router/dev v0.0.0-experimental-ae6d61df4
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-795b50c5b
2
+ * @react-router/dev v0.0.0-experimental-ae6d61df4
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -407,7 +407,8 @@ async function resolveConfig({
407
407
  root,
408
408
  viteNodeContext,
409
409
  reactRouterConfigFile,
410
- skipRoutes
410
+ skipRoutes,
411
+ validateConfig
411
412
  }) {
412
413
  let reactRouterUserConfig = {};
413
414
  if (reactRouterConfigFile) {
@@ -425,6 +426,12 @@ async function resolveConfig({
425
426
  return err(`${reactRouterConfigFile} must export a config`);
426
427
  }
427
428
  reactRouterUserConfig = configModule.default;
429
+ if (validateConfig) {
430
+ const error = validateConfig(reactRouterUserConfig);
431
+ if (error) {
432
+ return err(error);
433
+ }
434
+ }
428
435
  } catch (error) {
429
436
  return err(`Error loading ${reactRouterConfigFile}: ${error}`);
430
437
  }
@@ -513,7 +520,7 @@ async function resolveConfig({
513
520
  }
514
521
  let appDirectory = import_pathe3.default.resolve(root, userAppDirectory || "app");
515
522
  let buildDirectory = import_pathe3.default.resolve(root, userBuildDirectory);
516
- let rootRouteFile = findEntry(appDirectory, "root");
523
+ let rootRouteFile = findEntry(appDirectory, "root", { absolute: true });
517
524
  if (!rootRouteFile) {
518
525
  let rootRouteDisplayPath = import_pathe3.default.relative(
519
526
  root,
@@ -554,7 +561,7 @@ async function resolveConfig({
554
561
  {
555
562
  id: "root",
556
563
  path: "",
557
- file: rootRouteFile,
564
+ file: import_pathe3.default.relative(appDirectory, rootRouteFile),
558
565
  children: result.routeConfig
559
566
  }
560
567
  ];
@@ -592,6 +599,7 @@ async function resolveConfig({
592
599
  serverBundles,
593
600
  serverModuleFormat,
594
601
  ssr,
602
+ unstable_rootRouteFile: rootRouteFile,
595
603
  unstable_routeConfig: routeConfig
596
604
  });
597
605
  for (let preset of reactRouterUserConfig.presets ?? []) {
@@ -603,7 +611,8 @@ async function createConfigLoader({
603
611
  rootDirectory: root,
604
612
  watch,
605
613
  mode,
606
- skipRoutes
614
+ skipRoutes,
615
+ validateConfig
607
616
  }) {
608
617
  root = import_pathe3.default.normalize(root ?? process.env.REACT_ROUTER_ROOT ?? process.cwd());
609
618
  let vite2 = await import("vite");
@@ -622,7 +631,13 @@ async function createConfigLoader({
622
631
  });
623
632
  };
624
633
  updateReactRouterConfigFile();
625
- let getConfig = () => resolveConfig({ root, viteNodeContext, reactRouterConfigFile, skipRoutes });
634
+ let getConfig = () => resolveConfig({
635
+ root,
636
+ viteNodeContext,
637
+ reactRouterConfigFile,
638
+ skipRoutes,
639
+ validateConfig
640
+ });
626
641
  let appDirectory;
627
642
  let initialConfigResult = await getConfig();
628
643
  if (!initialConfigResult.ok) {