@farm.js/core 0.1.0-beta.48 → 0.1.0-beta.49

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 (92) hide show
  1. package/dist/api/route-manager.cjs.map +1 -1
  2. package/dist/api/route-manager.mjs +2 -2
  3. package/dist/api.cjs.map +1 -1
  4. package/dist/api.mjs +3 -3
  5. package/dist/{chunk-TIESOJ7Z.mjs → chunk-BOSVED4K.mjs} +2 -2
  6. package/dist/{chunk-XR7M5VXU.mjs → chunk-DF6GAB63.mjs} +2 -2
  7. package/dist/{chunk-3P63LWDM.mjs → chunk-DWG3W2FN.mjs} +2 -2
  8. package/dist/{chunk-3UUEBVR3.mjs → chunk-ECGXDMBF.mjs} +3 -3
  9. package/dist/{chunk-MP2SDRRB.mjs → chunk-HB3XKQ5X.mjs} +2 -2
  10. package/dist/{chunk-EHUGMAWL.mjs → chunk-LIBL3V6K.mjs} +3 -3
  11. package/dist/{chunk-ECLWCE4H.mjs → chunk-MHE2AMUC.mjs} +2 -2
  12. package/dist/{chunk-GXASWWJU.mjs → chunk-RS5Z5M26.mjs} +5 -2
  13. package/dist/chunk-RS5Z5M26.mjs.map +1 -0
  14. package/dist/{chunk-HEZHCCMF.mjs → chunk-UQ3PDDAK.mjs} +65 -29
  15. package/dist/chunk-UQ3PDDAK.mjs.map +1 -0
  16. package/dist/{chunk-VZKOMD6C.mjs → chunk-VVVDVGAS.mjs} +8 -8
  17. package/dist/{chunk-NKIHYEWC.mjs → chunk-X3JR4G7L.mjs} +2 -2
  18. package/dist/{chunk-NKIHYEWC.mjs.map → chunk-X3JR4G7L.mjs.map} +1 -1
  19. package/dist/{chunk-4E6VRJ6P.mjs → chunk-XY3B4K5E.mjs} +6 -3
  20. package/dist/chunk-XY3B4K5E.mjs.map +1 -0
  21. package/dist/{chunk-U5SPS2HR.mjs → chunk-YB7QPRM4.mjs} +6 -1
  22. package/dist/chunk-YB7QPRM4.mjs.map +1 -0
  23. package/dist/client/lifecycle.mjs +2 -2
  24. package/dist/client-plugins.cjs +1 -1
  25. package/dist/client-plugins.cjs.map +1 -1
  26. package/dist/client-plugins.mjs +2 -2
  27. package/dist/client.cjs +1 -1
  28. package/dist/client.cjs.map +1 -1
  29. package/dist/client.mjs +2 -2
  30. package/dist/cron.cjs +9 -1
  31. package/dist/cron.cjs.map +1 -1
  32. package/dist/cron.mjs +2 -1
  33. package/dist/{devtools-BUFIHBX3.mjs → devtools-S7KR2MMF.mjs} +5 -4
  34. package/dist/{devtools-BUFIHBX3.mjs.map → devtools-S7KR2MMF.mjs.map} +1 -1
  35. package/dist/docs.mjs +5 -4
  36. package/dist/index.cjs +66 -23
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.mts +1 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.mjs +15 -13
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/internal/build-runtime.cjs +230 -189
  43. package/dist/internal/build-runtime.cjs.map +1 -1
  44. package/dist/internal/build-runtime.d.mts +1 -1
  45. package/dist/internal/build-runtime.d.ts +1 -1
  46. package/dist/internal/build-runtime.mjs +10 -10
  47. package/dist/internal/client-runtime.cjs +1 -1
  48. package/dist/internal/client-runtime.cjs.map +1 -1
  49. package/dist/internal/client-runtime.mjs +2 -2
  50. package/dist/internal/config-runtime.cjs +10 -10
  51. package/dist/internal/config-runtime.cjs.map +1 -1
  52. package/dist/internal/config-runtime.d.mts +1 -1
  53. package/dist/internal/config-runtime.d.ts +1 -1
  54. package/dist/internal/config-runtime.mjs +4 -4
  55. package/dist/middleware.cjs.map +1 -1
  56. package/dist/middleware.mjs +3 -3
  57. package/dist/{nitro-G3BP7E7F.mjs → nitro-VXD26VW2.mjs} +4 -3
  58. package/dist/{nitro-G3BP7E7F.mjs.map → nitro-VXD26VW2.mjs.map} +1 -1
  59. package/dist/plugin.cjs +171 -149
  60. package/dist/plugin.cjs.map +1 -1
  61. package/dist/plugin.mjs +7 -7
  62. package/dist/server.cjs +203 -177
  63. package/dist/server.cjs.map +1 -1
  64. package/dist/server.d.mts +1 -1
  65. package/dist/server.d.ts +1 -1
  66. package/dist/server.mjs +10 -8
  67. package/dist/server.mjs.map +1 -1
  68. package/dist/testing.mjs +2 -2
  69. package/dist/{utils-9OPxcT1T.d.mts → utils--3v-RtD3.d.mts} +7 -1
  70. package/dist/{utils-CIIoLfn9.d.ts → utils-J3ipMElz.d.ts} +7 -1
  71. package/dist/version.cjs +1 -1
  72. package/dist/version.cjs.map +1 -1
  73. package/dist/version.mjs +1 -1
  74. package/dist/vite.cjs +171 -149
  75. package/dist/vite.cjs.map +1 -1
  76. package/dist/vite.mjs +7 -7
  77. package/dist/workflows.cjs +8 -2
  78. package/dist/workflows.cjs.map +1 -1
  79. package/dist/workflows.mjs +2 -1
  80. package/package.json +1 -1
  81. package/dist/chunk-4E6VRJ6P.mjs.map +0 -1
  82. package/dist/chunk-GXASWWJU.mjs.map +0 -1
  83. package/dist/chunk-HEZHCCMF.mjs.map +0 -1
  84. package/dist/chunk-U5SPS2HR.mjs.map +0 -1
  85. /package/dist/{chunk-TIESOJ7Z.mjs.map → chunk-BOSVED4K.mjs.map} +0 -0
  86. /package/dist/{chunk-XR7M5VXU.mjs.map → chunk-DF6GAB63.mjs.map} +0 -0
  87. /package/dist/{chunk-3P63LWDM.mjs.map → chunk-DWG3W2FN.mjs.map} +0 -0
  88. /package/dist/{chunk-3UUEBVR3.mjs.map → chunk-ECGXDMBF.mjs.map} +0 -0
  89. /package/dist/{chunk-MP2SDRRB.mjs.map → chunk-HB3XKQ5X.mjs.map} +0 -0
  90. /package/dist/{chunk-EHUGMAWL.mjs.map → chunk-LIBL3V6K.mjs.map} +0 -0
  91. /package/dist/{chunk-ECLWCE4H.mjs.map → chunk-MHE2AMUC.mjs.map} +0 -0
  92. /package/dist/{chunk-VZKOMD6C.mjs.map → chunk-VVVDVGAS.mjs.map} +0 -0
package/dist/plugin.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  import "./chunk-RQ633A5I.mjs";
7
7
  import {
8
8
  farmPlugin
9
- } from "./chunk-VZKOMD6C.mjs";
9
+ } from "./chunk-VVVDVGAS.mjs";
10
10
  import "./chunk-XJTDE4L4.mjs";
11
11
  import "./chunk-CAUVJN4X.mjs";
12
12
  import "./chunk-AMZZCRQ7.mjs";
@@ -27,8 +27,8 @@ import "./chunk-GY2STC2S.mjs";
27
27
  import "./chunk-JHCNZLFT.mjs";
28
28
  import "./chunk-A5VG2BDG.mjs";
29
29
  import "./chunk-7FBJLMQH.mjs";
30
- import "./chunk-4E6VRJ6P.mjs";
31
- import "./chunk-GXASWWJU.mjs";
30
+ import "./chunk-XY3B4K5E.mjs";
31
+ import "./chunk-RS5Z5M26.mjs";
32
32
  import "./chunk-WORFTBLU.mjs";
33
33
  import "./chunk-7HO6AEOP.mjs";
34
34
  import "./chunk-4IVNW5QD.mjs";
@@ -36,15 +36,15 @@ import "./chunk-H53KVQUU.mjs";
36
36
  import "./chunk-QKVUNGAH.mjs";
37
37
  import "./chunk-HFQ2I2EA.mjs";
38
38
  import "./chunk-T4QJQK76.mjs";
39
- import "./chunk-TIESOJ7Z.mjs";
39
+ import "./chunk-BOSVED4K.mjs";
40
40
  import "./chunk-P7QDS5AT.mjs";
41
41
  import "./chunk-E6EPN5BT.mjs";
42
- import "./chunk-MP2SDRRB.mjs";
42
+ import "./chunk-HB3XKQ5X.mjs";
43
43
  import "./chunk-XJ65E7MB.mjs";
44
44
  import "./chunk-FQYDHKKU.mjs";
45
45
  import "./chunk-SXWF4QRU.mjs";
46
46
  import "./chunk-GIELMNBG.mjs";
47
- import "./chunk-U5SPS2HR.mjs";
47
+ import "./chunk-YB7QPRM4.mjs";
48
48
  import "./chunk-QGOHVJ6J.mjs";
49
49
  import "./chunk-5B33VWGX.mjs";
50
50
  import "./chunk-YTMDIHQN.mjs";
@@ -63,7 +63,7 @@ import "./chunk-RBRLLZL5.mjs";
63
63
  import "./chunk-WZ5QFROO.mjs";
64
64
  import "./chunk-7ZMKVETU.mjs";
65
65
  import "./chunk-FXG2PS27.mjs";
66
- import "./chunk-NKIHYEWC.mjs";
66
+ import "./chunk-X3JR4G7L.mjs";
67
67
  import "./chunk-CGILA3WO.mjs";
68
68
  export {
69
69
  FarmRuntimeShutdownError,
package/dist/server.cjs CHANGED
@@ -617,6 +617,188 @@ var init_server_http = __esm({
617
617
  }
618
618
  });
619
619
 
620
+ // src/utils.ts
621
+ function parseRoutePath(filePath) {
622
+ const segments = [];
623
+ const normalizedPath = filePath.replace(/\\/g, "/");
624
+ const pathParts = normalizedPath.split("/").filter(Boolean);
625
+ const fileName = pathParts.pop() || "";
626
+ const fileType = getRouteType(fileName);
627
+ for (const part of pathParts) {
628
+ if (part.startsWith("(") && part.endsWith(")")) continue;
629
+ if (part.startsWith("[") && part.endsWith("]")) {
630
+ let segment = part.slice(1, -1);
631
+ const isDynamic = true;
632
+ let isOptional = false;
633
+ let isCatchAll = false;
634
+ if (segment.startsWith("[") && segment.endsWith("]")) {
635
+ isOptional = true;
636
+ segment = segment.slice(1, -1);
637
+ if (segment.startsWith("...")) {
638
+ segment = segment.slice(3);
639
+ isCatchAll = true;
640
+ }
641
+ } else if (segment.startsWith("...")) {
642
+ segment = segment.slice(3);
643
+ isCatchAll = true;
644
+ }
645
+ segments.push({ segment, isDynamic, isOptional, isCatchAll });
646
+ } else {
647
+ segments.push({
648
+ segment: part,
649
+ isDynamic: false,
650
+ isOptional: false,
651
+ isCatchAll: false
652
+ });
653
+ }
654
+ }
655
+ return {
656
+ segments,
657
+ filePath: normalizedPath,
658
+ type: fileType
659
+ };
660
+ }
661
+ function getRouteType(fileName) {
662
+ const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|mdx?|markdown)$/, "");
663
+ switch (baseName) {
664
+ case "page":
665
+ return "page";
666
+ case "layout":
667
+ return "layout";
668
+ case "loading":
669
+ return "loading";
670
+ case "error":
671
+ return "error";
672
+ case "not-found":
673
+ return "not-found";
674
+ default:
675
+ return "page";
676
+ }
677
+ }
678
+ function segmentsToPattern(segments) {
679
+ if (segments.length === 0) return "/";
680
+ return "/" + segments.map((segment) => {
681
+ if (!segment.isDynamic) return segment.segment;
682
+ if (segment.isCatchAll) {
683
+ return segment.isOptional ? `*${segment.segment}?` : `*${segment.segment}`;
684
+ }
685
+ return `:${segment.segment}`;
686
+ }).join("/");
687
+ }
688
+ function matchRoute(url, segments) {
689
+ const urlParts = url.split("/").filter(Boolean);
690
+ const params = {};
691
+ if (segments.length === 0) {
692
+ return { params, matches: urlParts.length === 0 };
693
+ }
694
+ let urlIndex = 0;
695
+ let segmentIndex = 0;
696
+ while (segmentIndex < segments.length && urlIndex <= urlParts.length) {
697
+ const segment = segments[segmentIndex];
698
+ if (!segment.isDynamic) {
699
+ if (urlParts[urlIndex] !== segment.segment) {
700
+ return { params: {}, matches: false };
701
+ }
702
+ urlIndex++;
703
+ segmentIndex++;
704
+ } else if (segment.isCatchAll) {
705
+ const remainingParts = urlParts.slice(urlIndex);
706
+ if (remainingParts.length === 0 && !segment.isOptional) {
707
+ return { params: {}, matches: false };
708
+ }
709
+ params[segment.segment] = remainingParts.join("/");
710
+ urlIndex = urlParts.length;
711
+ segmentIndex++;
712
+ } else {
713
+ if (urlIndex >= urlParts.length) {
714
+ return { params: {}, matches: false };
715
+ }
716
+ params[segment.segment] = urlParts[urlIndex];
717
+ urlIndex++;
718
+ segmentIndex++;
719
+ }
720
+ }
721
+ const matches = segmentIndex === segments.length && urlIndex === urlParts.length;
722
+ return { params, matches };
723
+ }
724
+ function resolveAppPath(root, ...paths) {
725
+ return import_path.default.resolve(root, ...paths);
726
+ }
727
+ function toRootRelativeUrlPath(absolutePath, projectRoot) {
728
+ if (absolutePath === projectRoot) return "";
729
+ if (absolutePath.startsWith(`${projectRoot}/`) || absolutePath.startsWith(`${projectRoot}\\`)) {
730
+ return absolutePath.slice(projectRoot.length).replace(/\\/g, "/");
731
+ }
732
+ return void 0;
733
+ }
734
+ function toPosixPath(filePath) {
735
+ return filePath.replace(/\\/g, "/");
736
+ }
737
+ function toViteModuleId(filePath, root) {
738
+ if (!import_path.default.isAbsolute(filePath)) return filePath;
739
+ const relativePath2 = import_path.default.relative(root, filePath);
740
+ if (relativePath2 && !relativePath2.startsWith("..") && !import_path.default.isAbsolute(relativePath2)) {
741
+ return `/${relativePath2.split(import_path.default.sep).join("/")}`;
742
+ }
743
+ const normalizedPath = filePath.replace(/\\/g, "/");
744
+ return normalizedPath.startsWith("/") ? `/@fs${normalizedPath}` : `/@fs/${normalizedPath}`;
745
+ }
746
+ async function fileExists(filePath) {
747
+ try {
748
+ const fs13 = await import("fs/promises");
749
+ await fs13.access(filePath);
750
+ return true;
751
+ } catch {
752
+ return false;
753
+ }
754
+ }
755
+ async function globFiles(pattern, cwd) {
756
+ const glob = await import("fast-glob");
757
+ return glob.default(pattern, { cwd, absolute: false });
758
+ }
759
+ function parseSearchParams(searchParams) {
760
+ const result = {};
761
+ for (const [key, value] of searchParams.entries()) {
762
+ if (key in result) {
763
+ const existing = result[key];
764
+ if (Array.isArray(existing)) {
765
+ existing.push(value);
766
+ } else {
767
+ result[key] = [existing, value];
768
+ }
769
+ } else {
770
+ result[key] = value;
771
+ }
772
+ }
773
+ return result;
774
+ }
775
+ var import_path, logger;
776
+ var init_utils = __esm({
777
+ "src/utils.ts"() {
778
+ "use strict";
779
+ import_path = __toESM(require("path"));
780
+ __name(parseRoutePath, "parseRoutePath");
781
+ __name(getRouteType, "getRouteType");
782
+ __name(segmentsToPattern, "segmentsToPattern");
783
+ __name(matchRoute, "matchRoute");
784
+ __name(resolveAppPath, "resolveAppPath");
785
+ __name(toRootRelativeUrlPath, "toRootRelativeUrlPath");
786
+ __name(toPosixPath, "toPosixPath");
787
+ __name(toViteModuleId, "toViteModuleId");
788
+ __name(fileExists, "fileExists");
789
+ __name(globFiles, "globFiles");
790
+ __name(parseSearchParams, "parseSearchParams");
791
+ logger = {
792
+ info: /* @__PURE__ */ __name((message) => console.log(`[info] ${message}`), "info"),
793
+ success: /* @__PURE__ */ __name((message) => console.log(`[success] ${message}`), "success"),
794
+ warn: /* @__PURE__ */ __name((message) => console.warn(`\u26A0\uFE0F ${message}`), "warn"),
795
+ error: /* @__PURE__ */ __name((message) => console.error(`\u274C ${message}`), "error"),
796
+ ready: /* @__PURE__ */ __name((message) => console.log(`${message}`), "ready"),
797
+ event: /* @__PURE__ */ __name((message) => console.log(` ${message}`), "event")
798
+ };
799
+ }
800
+ });
801
+
620
802
  // src/workflows.ts
621
803
  var workflows_exports = {};
622
804
  __export(workflows_exports, {
@@ -785,14 +967,14 @@ async function prepareFarmWorkflowsForNitro(config) {
785
967
  const tasks = {};
786
968
  const scheduledTasks = createScheduledTasks(workflows);
787
969
  for (const workflow of workflows) {
788
- const wrapperPath = path32.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
970
+ const wrapperPath = toPosixPath(path32.join(generatedDir, `${safeFileName(workflow.id)}.mjs`));
789
971
  await fs13.writeFile(wrapperPath, createNitroTaskWrapper(workflow), "utf8");
790
972
  tasks[workflow.id] = {
791
973
  handler: wrapperPath,
792
974
  description: workflow.description || `Farm workflow ${workflow.id}`
793
975
  };
794
976
  }
795
- const handlerPath = path32.join(generatedDir, "http-handler.mjs");
977
+ const handlerPath = toPosixPath(path32.join(generatedDir, "http-handler.mjs"));
796
978
  await fs13.writeFile(
797
979
  handlerPath,
798
980
  createNitroWorkflowHTTPHandler(
@@ -1151,6 +1333,7 @@ var init_workflows = __esm({
1151
1333
  "src/workflows.ts"() {
1152
1334
  "use strict";
1153
1335
  init_server_http();
1336
+ init_utils();
1154
1337
  DEFAULT_FARM_WORKFLOW_DIRS = ["src/jobs", "src/workflows", "src/cron"];
1155
1338
  DEFAULT_FARM_WORKFLOW_ROUTE = "/api/_farm/workflows";
1156
1339
  DEFAULT_FARM_WORKFLOW_SECRET_ENV = "CRON_SECRET";
@@ -1303,6 +1486,7 @@ var DEFAULT_FARM_CRON_SECRET_ENV, CRON_FIELD_RANGES;
1303
1486
  var init_cron = __esm({
1304
1487
  "src/cron.ts"() {
1305
1488
  "use strict";
1489
+ init_utils();
1306
1490
  DEFAULT_FARM_CRON_SECRET_ENV = "CRON_SECRET";
1307
1491
  CRON_FIELD_RANGES = [
1308
1492
  [0, 59, "minute"],
@@ -14828,6 +15012,7 @@ __export(server_exports2, {
14828
15012
  sqliteStorage: () => sqliteStorage,
14829
15013
  startDevServer: () => startDevServer,
14830
15014
  storageCacheAdapter: () => storageCacheAdapter,
15015
+ toPosixPath: () => toPosixPath,
14831
15016
  toRootRelativeUrlPath: () => toRootRelativeUrlPath,
14832
15017
  toViteModuleId: () => toViteModuleId,
14833
15018
  unstable_cache: () => unstable_cache,
@@ -14844,180 +15029,7 @@ init_app_markdown_config();
14844
15029
  init_markdown();
14845
15030
  init_workflows();
14846
15031
  init_cron();
14847
-
14848
- // src/utils.ts
14849
- var import_path = __toESM(require("path"));
14850
- function parseRoutePath(filePath) {
14851
- const segments = [];
14852
- const normalizedPath = filePath.replace(/\\/g, "/");
14853
- const pathParts = normalizedPath.split("/").filter(Boolean);
14854
- const fileName = pathParts.pop() || "";
14855
- const fileType = getRouteType(fileName);
14856
- for (const part of pathParts) {
14857
- if (part.startsWith("(") && part.endsWith(")")) continue;
14858
- if (part.startsWith("[") && part.endsWith("]")) {
14859
- let segment = part.slice(1, -1);
14860
- const isDynamic = true;
14861
- let isOptional = false;
14862
- let isCatchAll = false;
14863
- if (segment.startsWith("[") && segment.endsWith("]")) {
14864
- isOptional = true;
14865
- segment = segment.slice(1, -1);
14866
- if (segment.startsWith("...")) {
14867
- segment = segment.slice(3);
14868
- isCatchAll = true;
14869
- }
14870
- } else if (segment.startsWith("...")) {
14871
- segment = segment.slice(3);
14872
- isCatchAll = true;
14873
- }
14874
- segments.push({ segment, isDynamic, isOptional, isCatchAll });
14875
- } else {
14876
- segments.push({
14877
- segment: part,
14878
- isDynamic: false,
14879
- isOptional: false,
14880
- isCatchAll: false
14881
- });
14882
- }
14883
- }
14884
- return {
14885
- segments,
14886
- filePath: normalizedPath,
14887
- type: fileType
14888
- };
14889
- }
14890
- __name(parseRoutePath, "parseRoutePath");
14891
- function getRouteType(fileName) {
14892
- const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|mdx?|markdown)$/, "");
14893
- switch (baseName) {
14894
- case "page":
14895
- return "page";
14896
- case "layout":
14897
- return "layout";
14898
- case "loading":
14899
- return "loading";
14900
- case "error":
14901
- return "error";
14902
- case "not-found":
14903
- return "not-found";
14904
- default:
14905
- return "page";
14906
- }
14907
- }
14908
- __name(getRouteType, "getRouteType");
14909
- function segmentsToPattern(segments) {
14910
- if (segments.length === 0) return "/";
14911
- return "/" + segments.map((segment) => {
14912
- if (!segment.isDynamic) return segment.segment;
14913
- if (segment.isCatchAll) {
14914
- return segment.isOptional ? `*${segment.segment}?` : `*${segment.segment}`;
14915
- }
14916
- return `:${segment.segment}`;
14917
- }).join("/");
14918
- }
14919
- __name(segmentsToPattern, "segmentsToPattern");
14920
- function matchRoute(url, segments) {
14921
- const urlParts = url.split("/").filter(Boolean);
14922
- const params = {};
14923
- if (segments.length === 0) {
14924
- return { params, matches: urlParts.length === 0 };
14925
- }
14926
- let urlIndex = 0;
14927
- let segmentIndex = 0;
14928
- while (segmentIndex < segments.length && urlIndex <= urlParts.length) {
14929
- const segment = segments[segmentIndex];
14930
- if (!segment.isDynamic) {
14931
- if (urlParts[urlIndex] !== segment.segment) {
14932
- return { params: {}, matches: false };
14933
- }
14934
- urlIndex++;
14935
- segmentIndex++;
14936
- } else if (segment.isCatchAll) {
14937
- const remainingParts = urlParts.slice(urlIndex);
14938
- if (remainingParts.length === 0 && !segment.isOptional) {
14939
- return { params: {}, matches: false };
14940
- }
14941
- params[segment.segment] = remainingParts.join("/");
14942
- urlIndex = urlParts.length;
14943
- segmentIndex++;
14944
- } else {
14945
- if (urlIndex >= urlParts.length) {
14946
- return { params: {}, matches: false };
14947
- }
14948
- params[segment.segment] = urlParts[urlIndex];
14949
- urlIndex++;
14950
- segmentIndex++;
14951
- }
14952
- }
14953
- const matches = segmentIndex === segments.length && urlIndex === urlParts.length;
14954
- return { params, matches };
14955
- }
14956
- __name(matchRoute, "matchRoute");
14957
- function resolveAppPath(root, ...paths) {
14958
- return import_path.default.resolve(root, ...paths);
14959
- }
14960
- __name(resolveAppPath, "resolveAppPath");
14961
- function toRootRelativeUrlPath(absolutePath, projectRoot) {
14962
- if (absolutePath === projectRoot) return "";
14963
- if (absolutePath.startsWith(`${projectRoot}/`) || absolutePath.startsWith(`${projectRoot}\\`)) {
14964
- return absolutePath.slice(projectRoot.length).replace(/\\/g, "/");
14965
- }
14966
- return void 0;
14967
- }
14968
- __name(toRootRelativeUrlPath, "toRootRelativeUrlPath");
14969
- function toViteModuleId(filePath, root) {
14970
- if (!import_path.default.isAbsolute(filePath)) return filePath;
14971
- const relativePath2 = import_path.default.relative(root, filePath);
14972
- if (relativePath2 && !relativePath2.startsWith("..") && !import_path.default.isAbsolute(relativePath2)) {
14973
- return `/${relativePath2.split(import_path.default.sep).join("/")}`;
14974
- }
14975
- const normalizedPath = filePath.replace(/\\/g, "/");
14976
- return normalizedPath.startsWith("/") ? `/@fs${normalizedPath}` : `/@fs/${normalizedPath}`;
14977
- }
14978
- __name(toViteModuleId, "toViteModuleId");
14979
- async function fileExists(filePath) {
14980
- try {
14981
- const fs13 = await import("fs/promises");
14982
- await fs13.access(filePath);
14983
- return true;
14984
- } catch {
14985
- return false;
14986
- }
14987
- }
14988
- __name(fileExists, "fileExists");
14989
- async function globFiles(pattern, cwd) {
14990
- const glob = await import("fast-glob");
14991
- return glob.default(pattern, { cwd, absolute: false });
14992
- }
14993
- __name(globFiles, "globFiles");
14994
- function parseSearchParams(searchParams) {
14995
- const result = {};
14996
- for (const [key, value] of searchParams.entries()) {
14997
- if (key in result) {
14998
- const existing = result[key];
14999
- if (Array.isArray(existing)) {
15000
- existing.push(value);
15001
- } else {
15002
- result[key] = [existing, value];
15003
- }
15004
- } else {
15005
- result[key] = value;
15006
- }
15007
- }
15008
- return result;
15009
- }
15010
- __name(parseSearchParams, "parseSearchParams");
15011
- var logger = {
15012
- info: /* @__PURE__ */ __name((message) => console.log(`[info] ${message}`), "info"),
15013
- success: /* @__PURE__ */ __name((message) => console.log(`[success] ${message}`), "success"),
15014
- warn: /* @__PURE__ */ __name((message) => console.warn(`\u26A0\uFE0F ${message}`), "warn"),
15015
- error: /* @__PURE__ */ __name((message) => console.error(`\u274C ${message}`), "error"),
15016
- ready: /* @__PURE__ */ __name((message) => console.log(`${message}`), "ready"),
15017
- event: /* @__PURE__ */ __name((message) => console.log(` ${message}`), "event")
15018
- };
15019
-
15020
- // src/app.ts
15032
+ init_utils();
15021
15033
  init_storage();
15022
15034
  init_observability();
15023
15035
  init_route_rules();
@@ -15026,6 +15038,9 @@ init_server_http();
15026
15038
  init_image_config();
15027
15039
  init_layers();
15028
15040
 
15041
+ // src/routing/route-manager.ts
15042
+ init_utils();
15043
+
15029
15044
  // src/ssg.ts
15030
15045
  var import_promises2 = require("fs/promises");
15031
15046
  var OPTIONAL_CATCH_ALL_SEGMENT = /^\[\[\.\.\.([^\]]+)\]\]$/;
@@ -16777,6 +16792,7 @@ function normalizePathname(pathname) {
16777
16792
  __name(normalizePathname, "normalizePathname");
16778
16793
 
16779
16794
  // src/routing/route-slots.ts
16795
+ init_utils();
16780
16796
  var SLOT_SEGMENT = /^@([A-Za-z][A-Za-z0-9_-]*)$/;
16781
16797
  function parseRouteSlotFile(filePath) {
16782
16798
  const normalized = filePath.replace(/\\/g, "/");
@@ -17829,6 +17845,7 @@ __name(safeGlobFiles, "safeGlobFiles");
17829
17845
  // src/server/renderer.ts
17830
17846
  var fs3 = __toESM(require("fs"));
17831
17847
  var path11 = __toESM(require("path"));
17848
+ init_utils();
17832
17849
 
17833
17850
  // src/server/full-document.ts
17834
17851
  function stripContentsWrappers(markup) {
@@ -21234,7 +21251,7 @@ _setFarmThemeServerSnapshotResolver(() => {
21234
21251
  });
21235
21252
 
21236
21253
  // package.json
21237
- var version = "0.1.0-beta.48";
21254
+ var version = "0.1.0-beta.49";
21238
21255
 
21239
21256
  // src/version.ts
21240
21257
  var FARM_VERSION = version;
@@ -23468,6 +23485,9 @@ function createFarmApp(config, viteServer) {
23468
23485
  }
23469
23486
  __name(createFarmApp, "createFarmApp");
23470
23487
 
23488
+ // src/vite.ts
23489
+ init_utils();
23490
+
23471
23491
  // src/default-styles.ts
23472
23492
  var defaultGlobalCSS = `@import "tailwindcss";
23473
23493
  `;
@@ -23745,6 +23765,7 @@ __name(isArrayIndex, "isArrayIndex");
23745
23765
  // src/api/route-manager.ts
23746
23766
  var fs5 = __toESM(require("fs"));
23747
23767
  var path15 = __toESM(require("path"));
23768
+ init_utils();
23748
23769
  init_route_runtime();
23749
23770
 
23750
23771
  // src/api/runtime.ts
@@ -24652,6 +24673,7 @@ function normalizeMiddlewareModule(middlewareModule, routePath) {
24652
24673
  __name(normalizeMiddlewareModule, "normalizeMiddlewareModule");
24653
24674
 
24654
24675
  // src/middleware/manager.ts
24676
+ init_utils();
24655
24677
  init_response();
24656
24678
  init_observability();
24657
24679
 
@@ -25098,6 +25120,7 @@ init_type_generator();
25098
25120
  // src/routing/generate-route-types.ts
25099
25121
  var path17 = __toESM(require("path"));
25100
25122
  var fs7 = __toESM(require("fs"));
25123
+ init_utils();
25101
25124
  init_write_file_if_changed();
25102
25125
  init_renderer();
25103
25126
  function routeSegmentsToTsTypeLiteral(segments) {
@@ -30731,6 +30754,7 @@ async function defineConfig2(config = {}) {
30731
30754
  __name(defineConfig2, "defineConfig");
30732
30755
 
30733
30756
  // src/server.ts
30757
+ init_utils();
30734
30758
  init_storage();
30735
30759
  init_cache();
30736
30760
 
@@ -31140,6 +31164,7 @@ __name(assertServerQueryKey, "assertServerQueryKey");
31140
31164
 
31141
31165
  // src/server/create-server.ts
31142
31166
  var import_vite3 = require("vite");
31167
+ init_utils();
31143
31168
  init_config4();
31144
31169
 
31145
31170
  // src/plugin.ts
@@ -32489,6 +32514,7 @@ __name(assertFunction, "assertFunction");
32489
32514
  sqliteStorage,
32490
32515
  startDevServer,
32491
32516
  storageCacheAdapter,
32517
+ toPosixPath,
32492
32518
  toRootRelativeUrlPath,
32493
32519
  toViteModuleId,
32494
32520
  unstable_cache,