@reckona/mreact-router 0.0.51 → 0.0.53

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.
Files changed (54) hide show
  1. package/README.md +5 -5
  2. package/dist/actions.d.ts +1 -6
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +6 -98
  5. package/dist/actions.js.map +1 -1
  6. package/dist/adapters/cloudflare.d.ts +11 -2
  7. package/dist/adapters/cloudflare.d.ts.map +1 -1
  8. package/dist/adapters/cloudflare.js +205 -6
  9. package/dist/adapters/cloudflare.js.map +1 -1
  10. package/dist/build.d.ts +2 -0
  11. package/dist/build.d.ts.map +1 -1
  12. package/dist/build.js +79 -14
  13. package/dist/build.js.map +1 -1
  14. package/dist/bundle-pipeline.d.ts +2 -0
  15. package/dist/bundle-pipeline.d.ts.map +1 -1
  16. package/dist/bundle-pipeline.js +1 -0
  17. package/dist/bundle-pipeline.js.map +1 -1
  18. package/dist/cli.js +6 -5
  19. package/dist/cli.js.map +1 -1
  20. package/dist/csrf.d.ts +7 -0
  21. package/dist/csrf.d.ts.map +1 -0
  22. package/dist/csrf.js +104 -0
  23. package/dist/csrf.js.map +1 -0
  24. package/dist/file-conventions.d.ts.map +1 -1
  25. package/dist/file-conventions.js +16 -0
  26. package/dist/file-conventions.js.map +1 -1
  27. package/dist/import-policy.d.ts.map +1 -1
  28. package/dist/import-policy.js +2 -0
  29. package/dist/import-policy.js.map +1 -1
  30. package/dist/index.d.ts +4 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/module-runner.d.ts +2 -0
  35. package/dist/module-runner.d.ts.map +1 -1
  36. package/dist/module-runner.js +1 -0
  37. package/dist/module-runner.js.map +1 -1
  38. package/dist/multipart.d.ts +19 -0
  39. package/dist/multipart.d.ts.map +1 -0
  40. package/dist/multipart.js +362 -0
  41. package/dist/multipart.js.map +1 -0
  42. package/dist/native-route-matcher.d.ts.map +1 -1
  43. package/dist/native-route-matcher.js +14 -1
  44. package/dist/native-route-matcher.js.map +1 -1
  45. package/dist/render.d.ts.map +1 -1
  46. package/dist/render.js +79 -8
  47. package/dist/render.js.map +1 -1
  48. package/dist/routes.d.ts +1 -1
  49. package/dist/routes.d.ts.map +1 -1
  50. package/dist/routes.js +58 -5
  51. package/dist/routes.js.map +1 -1
  52. package/dist/types.d.ts +10 -3
  53. package/dist/types.d.ts.map +1 -1
  54. package/package.json +11 -11
package/dist/build.js CHANGED
@@ -28,6 +28,7 @@ export async function buildApp(options) {
28
28
  const shouldBuildCloudflare = buildTargets.includes("cloudflare");
29
29
  const shouldBuildAwsLambda = buildTargets.includes("aws-lambda");
30
30
  const routes = await scanAppRoutes({ appDir: project.routesDir });
31
+ const vitePlugins = options.viteConfig?.plugins;
31
32
  const files = await collectBuildFiles(project.projectRoot, project.allowedSourceDirs, project.routesDir);
32
33
  const serverDir = join(options.outDir, "server");
33
34
  const clientDir = join(options.outDir, "client");
@@ -42,7 +43,7 @@ export async function buildApp(options) {
42
43
  await mkdir(join(clientDir, ".vite"), { recursive: true });
43
44
  await mkdir(join(clientDir, "assets", "routes"), { recursive: true });
44
45
  await copyPublicAssets(project.publicDir, join(clientDir, "public"));
45
- const appConventionPublicAssets = await copyAppFileConventionAssets(project.routesDir, join(clientDir, "public"));
46
+ const appConventionPublicAssets = await copyAppFileConventionAssets(project.routesDir, clientDir);
46
47
  await copyPublicAssets(project.publicDir, clientDir);
47
48
  const publicAssets = [
48
49
  ...new Set([...(await collectPublicAssetPaths(project.publicDir)), ...appConventionPublicAssets]),
@@ -60,6 +61,7 @@ export async function buildApp(options) {
60
61
  project,
61
62
  projectRoot: project.projectRoot,
62
63
  routes,
64
+ vitePlugins,
63
65
  });
64
66
  const generatedImportPolicy = buildGeneratedImportPolicy({
65
67
  files,
@@ -80,6 +82,7 @@ export async function buildApp(options) {
80
82
  route,
81
83
  sourceMapDir: join(options.outDir, "source-maps", "client"),
82
84
  sourceMaps: project.clientSourceMaps,
85
+ vitePlugins,
83
86
  })));
84
87
  const navigationRuntimeScript = clientRoutes.some((route) => route.navigation === true && !route.client)
85
88
  ? await writeNavigationRuntimeBundle(clientDir)
@@ -93,7 +96,9 @@ export async function buildApp(options) {
93
96
  appDir: project.routesDir,
94
97
  assetBaseUrl: project.assetBaseUrl,
95
98
  clientRoutes: clientManifestRoutes,
99
+ project,
96
100
  routes,
101
+ serverModules,
97
102
  });
98
103
  let cloudflareRouteModules;
99
104
  if (shouldBuildCloudflare) {
@@ -105,6 +110,7 @@ export async function buildApp(options) {
105
110
  routesDir: project.routesDir,
106
111
  routes,
107
112
  serverModules,
113
+ vitePlugins,
108
114
  });
109
115
  }
110
116
  const serverManifest = {
@@ -438,6 +444,15 @@ function isNodeError(error) {
438
444
  async function prerenderStaticRoutes(options) {
439
445
  const clientScripts = new Map(options.clientRoutes.flatMap((route) => route.client && route.script !== undefined ? [[route.path, route.script]] : []));
440
446
  const prerendered = {};
447
+ const importPolicy = {
448
+ allowedPackages: await readDeclaredProjectPackages(options.project.projectRoot),
449
+ allowedSourceDirs: options.project.allowedSourceDirs,
450
+ projectRoot: options.project.projectRoot,
451
+ };
452
+ const serverModuleMap = new Map(Object.entries(options.serverModules).map(([file, artifact]) => [
453
+ join(options.project.projectRoot, file),
454
+ artifact,
455
+ ]));
441
456
  for (const route of options.routes) {
442
457
  if (route.kind !== "page") {
443
458
  continue;
@@ -451,7 +466,9 @@ async function prerenderStaticRoutes(options) {
451
466
  appDir: options.appDir,
452
467
  assetBaseUrl: options.assetBaseUrl,
453
468
  clientScripts,
469
+ importPolicy,
454
470
  request: new Request(`http://mreact.local${pathname}`),
471
+ serverModules: serverModuleMap,
455
472
  });
456
473
  const headers = {};
457
474
  response.headers.forEach((value, key) => {
@@ -542,6 +559,7 @@ async function buildServerModuleArtifacts(options) {
542
559
  code: stripRouteLoaderOnlyExports(source),
543
560
  filename: absoluteFile,
544
561
  importPolicy: requestModuleImportPolicy,
562
+ vitePlugins: options.vitePlugins,
545
563
  });
546
564
  artifact.loader = {
547
565
  code,
@@ -554,6 +572,7 @@ async function buildServerModuleArtifacts(options) {
554
572
  code: stripRouteMetadataOnlyExports(source),
555
573
  filename: absoluteFile,
556
574
  importPolicy: requestModuleImportPolicy,
575
+ vitePlugins: options.vitePlugins,
557
576
  });
558
577
  artifact.routeMetadata = {
559
578
  code,
@@ -568,6 +587,7 @@ async function buildServerModuleArtifacts(options) {
568
587
  importPolicy: requestModuleImportPolicy,
569
588
  routeKind: route?.kind,
570
589
  source,
590
+ vitePlugins: options.vitePlugins,
571
591
  }),
572
592
  sourceHash: hashText(source),
573
593
  };
@@ -639,6 +659,7 @@ async function buildServerModuleArtifacts(options) {
639
659
  code: output.code,
640
660
  filename: absoluteFile,
641
661
  serverOutput,
662
+ vitePlugins: options.vitePlugins,
642
663
  }),
643
664
  }
644
665
  : {}),
@@ -662,6 +683,7 @@ async function buildServerComponentBundleArtifactCode(options) {
662
683
  serverOutput: options.serverOutput,
663
684
  },
664
685
  sourcefile: options.filename,
686
+ vitePlugins: options.vitePlugins,
665
687
  });
666
688
  }
667
689
  function builtRouteSourceAnalysisSummary(options) {
@@ -728,6 +750,7 @@ async function buildRequestModuleArtifactCode(options) {
728
750
  code: stripRouteRequestOnlyExports(options.source),
729
751
  filename: options.filename,
730
752
  importPolicy: options.importPolicy,
753
+ vitePlugins: options.vitePlugins,
731
754
  });
732
755
  }
733
756
  async function bundleRouteLoaderModuleCode(options) {
@@ -747,6 +770,7 @@ async function bundleRouteRequestModuleCode(options) {
747
770
  code: options.code,
748
771
  filename: options.filename,
749
772
  platform: "node",
773
+ vitePlugins: options.vitePlugins,
750
774
  plugins: [
751
775
  createAppRouterImportPolicyPlugin({
752
776
  appDir: options.appDir,
@@ -794,18 +818,24 @@ async function writeCloudflareRouteModules(options) {
794
818
  const routeId = routeIdForPath(route.path);
795
819
  const routeModuleFile = `routes/${routeId}.mjs`;
796
820
  let routeModuleExports;
797
- if (route.kind === "server") {
821
+ if (route.kind === "server" || route.kind === "metadata") {
798
822
  try {
799
823
  const routeOutput = await buildCloudflareServerRouteModule({
800
824
  filename: route.file,
825
+ vitePlugins: options.vitePlugins,
801
826
  });
802
827
  const serverRouteFile = `routes/${routeId}.${hashText(routeOutput).slice(0, 8)}.server.mjs`;
803
828
  await writeFile(join(options.cloudflareDir, serverRouteFile), routeOutput);
804
829
  const serverRouteImport = `./${serverRouteFile.split("/").pop() ?? serverRouteFile}`;
805
- routeModuleExports = [`export * from ${JSON.stringify(serverRouteImport)};`];
830
+ routeModuleExports = [
831
+ `export * from ${JSON.stringify(serverRouteImport)};`,
832
+ ...(route.kind === "metadata"
833
+ ? [`export { default } from ${JSON.stringify(serverRouteImport)};`]
834
+ : []),
835
+ ];
806
836
  }
807
837
  catch (error) {
808
- throw new Error(`Failed to build Cloudflare server route module for ${routeFile}: ${errorMessage(error)}`);
838
+ throw new Error(`Failed to build Cloudflare ${route.kind} route module for ${routeFile}: ${errorMessage(error)}`);
809
839
  }
810
840
  await writeFile(join(options.cloudflareDir, routeModuleFile), `${routeModuleExports.join("\n")}\n`);
811
841
  registryEntries.push(`${JSON.stringify(routeFile)}: () => import(${JSON.stringify(`./${routeModuleFile}`)})`);
@@ -827,12 +857,14 @@ async function writeCloudflareRouteModules(options) {
827
857
  projectRoot: options.projectRoot,
828
858
  routesDir: options.routesDir,
829
859
  serverModules: options.serverModules,
860
+ vitePlugins: options.vitePlugins,
830
861
  })
831
862
  : await buildCloudflareStringRouteComponentModule({
832
863
  filename: route.file,
833
864
  projectRoot: options.projectRoot,
834
865
  routesDir: options.routesDir,
835
866
  serverModules: options.serverModules,
867
+ vitePlugins: options.vitePlugins,
836
868
  });
837
869
  const componentFile = `routes/${routeId}.${hashText(componentOutput).slice(0, 8)}.component.mjs`;
838
870
  await writeFile(join(options.cloudflareDir, componentFile), componentOutput);
@@ -849,6 +881,7 @@ async function writeCloudflareRouteModules(options) {
849
881
  const loaderOutput = await buildCloudflareRouteLoaderModule({
850
882
  filename: route.file,
851
883
  projectRoot: options.projectRoot,
884
+ vitePlugins: options.vitePlugins,
852
885
  });
853
886
  const loaderFile = `routes/${routeId}.${hashText(loaderOutput).slice(0, 8)}.loader.mjs`;
854
887
  await writeFile(join(options.cloudflareDir, loaderFile), loaderOutput);
@@ -873,7 +906,10 @@ async function writeCloudflareRouteModules(options) {
873
906
  return { registryFile: "route-modules.mjs" };
874
907
  }
875
908
  async function buildCloudflareServerComponentModule(options) {
876
- const metadataModule = await buildCloudflareRouteMetadataExportModule(options.filename);
909
+ const metadataModule = await buildCloudflareRouteMetadataExportModule({
910
+ filename: options.filename,
911
+ vitePlugins: options.vitePlugins,
912
+ });
877
913
  const entry = `import * as routeModule from ${JSON.stringify(options.filename)};
878
914
  ${metadataModule === undefined ? "const metadataModule = {};" : 'import * as metadataModule from "mreact:metadata";'}
879
915
 
@@ -898,6 +934,7 @@ export const slots = routeModule.slots;`;
898
934
  cloudflareWorkspaceRuntimePlugin(),
899
935
  ],
900
936
  resolveDir: dirname(options.filename),
937
+ vitePlugins: options.vitePlugins,
901
938
  });
902
939
  }
903
940
  async function buildCloudflareStringRouteComponentModule(options) {
@@ -908,6 +945,7 @@ async function buildCloudflareStringRouteComponentModule(options) {
908
945
  projectRoot: options.projectRoot,
909
946
  serverModules: options.serverModules,
910
947
  serverOutput: "string",
948
+ vitePlugins: options.vitePlugins,
911
949
  });
912
950
  }
913
951
  const pageModule = await buildCloudflareComponentExportModule({
@@ -915,12 +953,14 @@ async function buildCloudflareStringRouteComponentModule(options) {
915
953
  projectRoot: options.projectRoot,
916
954
  serverModules: options.serverModules,
917
955
  serverOutput: "string",
956
+ vitePlugins: options.vitePlugins,
918
957
  });
919
958
  const shellModules = await Promise.all(shellFiles.map((shell) => buildCloudflareComponentExportModule({
920
959
  filename: shell.file,
921
960
  projectRoot: options.projectRoot,
922
961
  serverModules: options.serverModules,
923
962
  serverOutput: "string",
963
+ vitePlugins: options.vitePlugins,
924
964
  })));
925
965
  const shellImports = shellFiles.map((_, index) => `import * as shell${index} from "mreact:shell-${index}";`);
926
966
  const shellDefinitions = shellFiles.map((shell, index) => `{ component: selectComponent(shell${index}, ${JSON.stringify(shell.file)}), id: ${JSON.stringify(shell.id)}, kind: ${JSON.stringify(shell.kind)}, module: shell${index} }`);
@@ -982,6 +1022,7 @@ ${cloudflareShellRuntimeSource()}`;
982
1022
  ]),
983
1023
  plugins: [cloudflareWorkspaceRuntimePlugin()],
984
1024
  resolveDir: dirname(options.filename),
1025
+ vitePlugins: options.vitePlugins,
985
1026
  });
986
1027
  }
987
1028
  async function buildCloudflareStreamRouteComponentModule(options) {
@@ -990,6 +1031,7 @@ async function buildCloudflareStreamRouteComponentModule(options) {
990
1031
  projectRoot: options.projectRoot,
991
1032
  serverModules: options.serverModules,
992
1033
  serverOutput: "stream",
1034
+ vitePlugins: options.vitePlugins,
993
1035
  });
994
1036
  const shellFiles = await cloudflareShellFilesForPage(options.routesDir, options.filename);
995
1037
  const shellModules = await Promise.all(shellFiles.map((shell) => buildCloudflareComponentExportModule({
@@ -997,6 +1039,7 @@ async function buildCloudflareStreamRouteComponentModule(options) {
997
1039
  projectRoot: options.projectRoot,
998
1040
  serverModules: options.serverModules,
999
1041
  serverOutput: "string",
1042
+ vitePlugins: options.vitePlugins,
1000
1043
  })));
1001
1044
  const shellImports = shellFiles.map((_, index) => `import * as shell${index} from "mreact:shell-${index}";`);
1002
1045
  const shellDefinitions = shellFiles.map((shell, index) => `{ component: selectComponent(shell${index}, ${JSON.stringify(shell.file)}), id: ${JSON.stringify(shell.id)}, kind: ${JSON.stringify(shell.kind)}, module: shell${index} }`);
@@ -1074,6 +1117,7 @@ ${cloudflareShellRuntimeSource()}`;
1074
1117
  ]),
1075
1118
  plugins: [cloudflareWorkspaceRuntimePlugin()],
1076
1119
  resolveDir: dirname(options.filename),
1120
+ vitePlugins: options.vitePlugins,
1077
1121
  });
1078
1122
  }
1079
1123
  function cloudflareShellRuntimeSource() {
@@ -1241,9 +1285,9 @@ function routeMetadataHeadTags(metadata) {
1241
1285
 
1242
1286
  function openGraphImages(openGraph) {
1243
1287
  if (openGraph?.images !== undefined && openGraph.images.length > 0) {
1244
- return openGraph.images.map(metadataString);
1288
+ return openGraph.images.map(metadataImageUrl);
1245
1289
  }
1246
- return openGraph?.image === undefined ? [] : [metadataString(openGraph.image)];
1290
+ return openGraph?.image === undefined ? [] : [metadataImageUrl(openGraph.image)];
1247
1291
  }
1248
1292
 
1249
1293
  function headDescriptorTags(descriptors, nonce) {
@@ -1289,6 +1333,13 @@ function metadataString(value) {
1289
1333
  throw new Error("Invalid metadata field: expected string, number, or boolean.");
1290
1334
  }
1291
1335
 
1336
+ function metadataImageUrl(value) {
1337
+ if (typeof value === "object" && value !== null && "url" in value) {
1338
+ return metadataString(value.url);
1339
+ }
1340
+ return metadataString(value);
1341
+ }
1342
+
1292
1343
  function cloudflareRouteHeadTags(manifest, routePath) {
1293
1344
  const route = manifest.routes.find((route) => route.path === routePath);
1294
1345
  const css = route?.css ?? [];
@@ -1317,7 +1368,10 @@ function escapeHtml(value) {
1317
1368
  }`;
1318
1369
  }
1319
1370
  async function buildCloudflareComponentExportModule(options) {
1320
- const metadataModule = await buildCloudflareRouteMetadataExportModule(options.filename);
1371
+ const metadataModule = await buildCloudflareRouteMetadataExportModule({
1372
+ filename: options.filename,
1373
+ vitePlugins: options.vitePlugins,
1374
+ });
1321
1375
  const entry = `import * as routeModule from ${JSON.stringify(options.filename)};
1322
1376
  ${metadataModule === undefined ? "const metadataModule = {};" : 'import * as metadataModule from "mreact:metadata";'}
1323
1377
 
@@ -1342,6 +1396,7 @@ export const slots = routeModule.slots;`;
1342
1396
  cloudflareWorkspaceRuntimePlugin(),
1343
1397
  ],
1344
1398
  resolveDir: dirname(options.filename),
1399
+ vitePlugins: options.vitePlugins,
1345
1400
  });
1346
1401
  }
1347
1402
  async function buildCloudflareRouteLoaderModule(options) {
@@ -1351,21 +1406,23 @@ async function buildCloudflareRouteLoaderModule(options) {
1351
1406
  filename: `${options.filename}.mreact-cloudflare-loader.js`,
1352
1407
  plugins: [cloudflareWorkspaceRuntimePlugin()],
1353
1408
  resolveDir: dirname(options.filename),
1409
+ vitePlugins: options.vitePlugins,
1354
1410
  });
1355
1411
  }
1356
- async function buildCloudflareRouteMetadataExportModule(filename) {
1357
- const source = await readFile(filename, "utf8");
1412
+ async function buildCloudflareRouteMetadataExportModule(options) {
1413
+ const source = await readFile(options.filename, "utf8");
1358
1414
  if (!hasMetadataExport(source)) {
1359
1415
  return undefined;
1360
1416
  }
1361
- const entry = `import * as routeMetadataModule from ${JSON.stringify(filename)};
1417
+ const entry = `import * as routeMetadataModule from ${JSON.stringify(options.filename)};
1362
1418
  export const generateMetadata = routeMetadataModule.generateMetadata;
1363
1419
  export const metadata = routeMetadataModule.metadata;`;
1364
1420
  return bundleCloudflareModule({
1365
1421
  entry,
1366
- filename: `${filename}.mreact-cloudflare-metadata.js`,
1422
+ filename: `${options.filename}.mreact-cloudflare-metadata.js`,
1367
1423
  plugins: [cloudflareWorkspaceRuntimePlugin()],
1368
- resolveDir: dirname(filename),
1424
+ resolveDir: dirname(options.filename),
1425
+ vitePlugins: options.vitePlugins,
1369
1426
  });
1370
1427
  }
1371
1428
  async function buildCloudflareServerRouteModule(options) {
@@ -1386,6 +1443,7 @@ export default defaultHandler;`;
1386
1443
  filename: `${options.filename}.mreact-cloudflare-server-route.js`,
1387
1444
  plugins: [cloudflareWorkspaceRuntimePlugin()],
1388
1445
  resolveDir: dirname(options.filename),
1446
+ vitePlugins: options.vitePlugins,
1389
1447
  });
1390
1448
  }
1391
1449
  async function bundleCloudflareModule(options) {
@@ -1397,6 +1455,7 @@ async function bundleCloudflareModule(options) {
1397
1455
  preserveExports: true,
1398
1456
  plugins: options.plugins,
1399
1457
  target: "es2022",
1458
+ vitePlugins: options.vitePlugins,
1400
1459
  });
1401
1460
  const code = output.code;
1402
1461
  if (code === undefined) {
@@ -1432,6 +1491,7 @@ async function bundleCloudflareVirtualModule(options) {
1432
1491
  ...options.plugins,
1433
1492
  ],
1434
1493
  resolveDir: options.resolveDir,
1494
+ vitePlugins: options.vitePlugins,
1435
1495
  });
1436
1496
  }
1437
1497
  async function cloudflareShellFilesForPage(routesDir, pageFile) {
@@ -1527,6 +1587,7 @@ function cloudflareWorkspaceRuntimePlugin() {
1527
1587
  });
1528
1588
  const routerCachePath = packageFile("router", "@reckona/mreact-router", "cache");
1529
1589
  const routerCookiesPath = packageFile("router", "@reckona/mreact-router", "cookies");
1590
+ const routerCsrfPath = packageFile("router", "@reckona/mreact-router", "csrf");
1530
1591
  const routerDeferredPath = packageFile("router", "@reckona/mreact-router", "deferred");
1531
1592
  const routerI18nPath = packageFile("router", "@reckona/mreact-router", "i18n");
1532
1593
  const routerLinkPath = packageFile("router", "@reckona/mreact-router", "link");
@@ -1593,6 +1654,7 @@ export function escapeHtmlBatch(values) {
1593
1654
  buildApi.onLoad({ filter: /^index$/, namespace: "mreact-cloudflare-router-index" }, () => ({
1594
1655
  contents: `export { cacheControl, revalidatePath } from ${JSON.stringify(routerCachePath)};
1595
1656
  export { deleteCookie, parseCookieHeader, serializeCookie, setCookie } from ${JSON.stringify(routerCookiesPath)};
1657
+ export { createFormCsrfToken, formCsrfCookie, formCsrfFieldName, serverActionCookie, validateFormCsrf } from ${JSON.stringify(routerCsrfPath)};
1596
1658
  export { defer, isDeferredLoaderData } from ${JSON.stringify(routerDeferredPath)};
1597
1659
  export { defineMessages, detectLocale } from ${JSON.stringify(routerI18nPath)};
1598
1660
  export { Link, linkProps } from ${JSON.stringify(routerLinkPath)};
@@ -1610,7 +1672,8 @@ export { cookies, headers, html, json, next, notFound, redirect, redirectExterna
1610
1672
  };
1611
1673
  }
1612
1674
  function cloudflareRouteRequiresGeneratedModule(route, prerenderedRoutes) {
1613
- return (route.kind === "server" ||
1675
+ return (route.kind === "metadata" ||
1676
+ route.kind === "server" ||
1614
1677
  (route.kind === "page" &&
1615
1678
  (route.segments.some((segment) => segment.kind !== "static") ||
1616
1679
  prerenderedRoutes[route.path] === undefined)));
@@ -1645,6 +1708,7 @@ async function writeClientRouteBundle(options) {
1645
1708
  pageFile: route.file,
1646
1709
  projectRoot: options.projectRoot,
1647
1710
  routeId: routeIdForPath(route.path),
1711
+ vitePlugins: options.vitePlugins,
1648
1712
  });
1649
1713
  const source = await readFile(route.file, "utf8");
1650
1714
  const clientSource = stripRouteClientOnlyExports(source);
@@ -1735,6 +1799,7 @@ async function writeRouteCssAssets(options) {
1735
1799
  filename: options.pageFile,
1736
1800
  minify: true,
1737
1801
  platform: "browser",
1802
+ vitePlugins: options.vitePlugins,
1738
1803
  });
1739
1804
  const cssAssets = (output.assets ?? []).filter((asset) => asset.fileName.endsWith(".css"));
1740
1805
  const written = [];