@farm.js/core 0.1.0-beta.45 → 0.1.0-beta.46

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 (70) 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-EPBXX44K.mjs → chunk-3UUEBVR3.mjs} +3 -3
  6. package/dist/{chunk-IRYMQRYJ.mjs → chunk-ECLWCE4H.mjs} +2 -2
  7. package/dist/{chunk-FLGRRGVU.mjs → chunk-LGCIIMFR.mjs} +2 -2
  8. package/dist/{chunk-FLGRRGVU.mjs.map → chunk-LGCIIMFR.mjs.map} +1 -1
  9. package/dist/{chunk-MU2QKVYL.mjs → chunk-MP2SDRRB.mjs} +2 -2
  10. package/dist/{chunk-VHYARVB7.mjs → chunk-TIESOJ7Z.mjs} +2 -2
  11. package/dist/{chunk-6NCLVPI7.mjs → chunk-TQJMU5BP.mjs} +13 -13
  12. package/dist/chunk-TQJMU5BP.mjs.map +1 -0
  13. package/dist/{chunk-KEPCW6EI.mjs → chunk-U5SPS2HR.mjs} +10 -1
  14. package/dist/chunk-U5SPS2HR.mjs.map +1 -0
  15. package/dist/{chunk-IWPBMZGE.mjs → chunk-V7VDW7IY.mjs} +4 -4
  16. package/dist/{chunk-QLCUQD3U.mjs → chunk-W2O6SKJU.mjs} +2 -2
  17. package/dist/client/lifecycle.mjs +2 -2
  18. package/dist/client-plugins.cjs +1 -1
  19. package/dist/client-plugins.cjs.map +1 -1
  20. package/dist/client-plugins.mjs +2 -2
  21. package/dist/client.cjs +1 -1
  22. package/dist/client.cjs.map +1 -1
  23. package/dist/client.mjs +2 -2
  24. package/dist/index.cjs +18 -9
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.mts +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.mjs +11 -9
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/internal/build-runtime.cjs +16 -9
  31. package/dist/internal/build-runtime.cjs.map +1 -1
  32. package/dist/internal/build-runtime.d.mts +1 -1
  33. package/dist/internal/build-runtime.d.ts +1 -1
  34. package/dist/internal/build-runtime.mjs +6 -6
  35. package/dist/internal/client-runtime.cjs +1 -1
  36. package/dist/internal/client-runtime.cjs.map +1 -1
  37. package/dist/internal/client-runtime.mjs +2 -2
  38. package/dist/internal/config-runtime.cjs.map +1 -1
  39. package/dist/internal/config-runtime.d.mts +1 -1
  40. package/dist/internal/config-runtime.d.ts +1 -1
  41. package/dist/internal/config-runtime.mjs +1 -1
  42. package/dist/middleware.cjs.map +1 -1
  43. package/dist/middleware.mjs +3 -3
  44. package/dist/plugin.cjs +16 -9
  45. package/dist/plugin.cjs.map +1 -1
  46. package/dist/plugin.mjs +5 -5
  47. package/dist/server.cjs +18 -9
  48. package/dist/server.cjs.map +1 -1
  49. package/dist/server.d.mts +1 -1
  50. package/dist/server.d.ts +1 -1
  51. package/dist/server.mjs +7 -5
  52. package/dist/server.mjs.map +1 -1
  53. package/dist/testing.mjs +2 -2
  54. package/dist/{utils-CjZRiq-l.d.mts → utils-9OPxcT1T.d.mts} +9 -1
  55. package/dist/{utils-_LOF-V9f.d.ts → utils-CIIoLfn9.d.ts} +9 -1
  56. package/dist/version.cjs +1 -1
  57. package/dist/version.cjs.map +1 -1
  58. package/dist/version.mjs +1 -1
  59. package/dist/vite.cjs +16 -9
  60. package/dist/vite.cjs.map +1 -1
  61. package/dist/vite.mjs +5 -5
  62. package/package.json +1 -1
  63. package/dist/chunk-6NCLVPI7.mjs.map +0 -1
  64. package/dist/chunk-KEPCW6EI.mjs.map +0 -1
  65. /package/dist/{chunk-EPBXX44K.mjs.map → chunk-3UUEBVR3.mjs.map} +0 -0
  66. /package/dist/{chunk-IRYMQRYJ.mjs.map → chunk-ECLWCE4H.mjs.map} +0 -0
  67. /package/dist/{chunk-MU2QKVYL.mjs.map → chunk-MP2SDRRB.mjs.map} +0 -0
  68. /package/dist/{chunk-VHYARVB7.mjs.map → chunk-TIESOJ7Z.mjs.map} +0 -0
  69. /package/dist/{chunk-IWPBMZGE.mjs.map → chunk-V7VDW7IY.mjs.map} +0 -0
  70. /package/dist/{chunk-QLCUQD3U.mjs.map → chunk-W2O6SKJU.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-6NCLVPI7.mjs";
9
+ } from "./chunk-TQJMU5BP.mjs";
10
10
  import "./chunk-XJTDE4L4.mjs";
11
11
  import "./chunk-CAUVJN4X.mjs";
12
12
  import "./chunk-AMZZCRQ7.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-VHYARVB7.mjs";
39
+ import "./chunk-TIESOJ7Z.mjs";
40
40
  import "./chunk-P7QDS5AT.mjs";
41
41
  import "./chunk-E6EPN5BT.mjs";
42
- import "./chunk-MU2QKVYL.mjs";
42
+ import "./chunk-MP2SDRRB.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-KEPCW6EI.mjs";
47
+ import "./chunk-U5SPS2HR.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-FLGRRGVU.mjs";
66
+ import "./chunk-LGCIIMFR.mjs";
67
67
  import "./chunk-CGILA3WO.mjs";
68
68
  export {
69
69
  FarmRuntimeShutdownError,
package/dist/server.cjs CHANGED
@@ -14828,6 +14828,7 @@ __export(server_exports2, {
14828
14828
  sqliteStorage: () => sqliteStorage,
14829
14829
  startDevServer: () => startDevServer,
14830
14830
  storageCacheAdapter: () => storageCacheAdapter,
14831
+ toRootRelativeUrlPath: () => toRootRelativeUrlPath,
14831
14832
  toViteModuleId: () => toViteModuleId,
14832
14833
  unstable_cache: () => unstable_cache,
14833
14834
  updateTag: () => updateTag,
@@ -14957,6 +14958,14 @@ function resolveAppPath(root, ...paths) {
14957
14958
  return import_path.default.resolve(root, ...paths);
14958
14959
  }
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");
14960
14969
  function toViteModuleId(filePath, root) {
14961
14970
  if (!import_path.default.isAbsolute(filePath)) return filePath;
14962
14971
  const relativePath2 = import_path.default.relative(root, filePath);
@@ -17123,9 +17132,8 @@ var _RouteManager = class _RouteManager {
17123
17132
  return this.clientManifestCache.manifest;
17124
17133
  }
17125
17134
  const toUrlPath = /* @__PURE__ */ __name((absolutePath) => {
17126
- if (absolutePath === normalizedProjectRoot || absolutePath.startsWith(`${normalizedProjectRoot}${import_path5.default.sep}`)) {
17127
- return absolutePath.slice(normalizedProjectRoot.length);
17128
- }
17135
+ const rootRelative = toRootRelativeUrlPath(absolutePath, normalizedProjectRoot);
17136
+ if (rootRelative !== void 0) return rootRelative;
17129
17137
  if (import_path5.default.isAbsolute(absolutePath)) {
17130
17138
  const normalized = absolutePath.replace(/\\/g, "/");
17131
17139
  return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
@@ -21175,7 +21183,7 @@ _setFarmThemeServerSnapshotResolver(() => {
21175
21183
  });
21176
21184
 
21177
21185
  // package.json
21178
- var version = "0.1.0-beta.45";
21186
+ var version = "0.1.0-beta.46";
21179
21187
 
21180
21188
  // src/version.ts
21181
21189
  var FARM_VERSION = version;
@@ -22119,7 +22127,7 @@ var _ServerRenderer = class _ServerRenderer {
22119
22127
  );
22120
22128
  const clientLayouts = layouts.map((layout2, index) => ({
22121
22129
  pattern: layout2.pattern,
22122
- modulePath: layout2.modulePath.startsWith(this.config.root) ? layout2.modulePath.slice(this.config.root.length) : layout2.modulePath,
22130
+ modulePath: toRootRelativeUrlPath(layout2.modulePath, this.config.root) ?? layout2.modulePath,
22123
22131
  shouldHydrate: layoutHydrationMetadata[index]?.shouldHydrate === true,
22124
22132
  islandStrategy: layoutHydrationMetadata[index]?.islandStrategy ?? null
22125
22133
  }));
@@ -22695,7 +22703,7 @@ var _ServerRenderer = class _ServerRenderer {
22695
22703
  const routeSlots = (req.__FARM_ROUTE_SLOTS__ || []).map(
22696
22704
  (slot) => ({
22697
22705
  ...slot,
22698
- modulePath: typeof slot.modulePath === "string" && slot.modulePath.startsWith(this.config.root) ? slot.modulePath.slice(this.config.root.length) : slot.modulePath
22706
+ modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
22699
22707
  })
22700
22708
  );
22701
22709
  const deferredProps = prepareDeferredData({
@@ -22703,7 +22711,7 @@ var _ServerRenderer = class _ServerRenderer {
22703
22711
  slots: routeSlots
22704
22712
  });
22705
22713
  const pagePath = req.__FARM_PAGE_PATH__;
22706
- const relativePath2 = pagePath ? pagePath.startsWith(this.config.root) ? pagePath.slice(this.config.root.length) : pagePath : "/src/app/page.tsx";
22714
+ const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
22707
22715
  const deploymentId = this.getDeploymentId();
22708
22716
  const bootstrapScript = `<script>
22709
22717
  window.__FARM_PROPS__ = ${serializeInlineValue2(deferredProps.data.page)};
@@ -22799,7 +22807,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
22799
22807
  let didError = false;
22800
22808
  const pagePath = req.__FARM_PAGE_PATH__;
22801
22809
  const isClientComponent = req.__FARM_IS_CLIENT_COMPONENT__ === true;
22802
- const relativePath2 = pagePath ? pagePath.startsWith(this.config.root) ? pagePath.slice(this.config.root.length) : pagePath : "/src/app/page.tsx";
22810
+ const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
22803
22811
  const manifest = options.routeManifest ?? this.routeManager.generateClientManifest(this.config.root);
22804
22812
  const clientManifest = {
22805
22813
  clientEntry: "/@farm/client.js",
@@ -22847,7 +22855,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
22847
22855
  const routeSlotPayload = (req.__FARM_ROUTE_SLOTS__ || []).map(
22848
22856
  (slot) => ({
22849
22857
  ...slot,
22850
- modulePath: typeof slot.modulePath === "string" && slot.modulePath.startsWith(this.config.root) ? slot.modulePath.slice(this.config.root.length) : slot.modulePath
22858
+ modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
22851
22859
  })
22852
22860
  );
22853
22861
  const deferredProps = prepareDeferredData({
@@ -32372,6 +32380,7 @@ __name(assertFunction, "assertFunction");
32372
32380
  sqliteStorage,
32373
32381
  startDevServer,
32374
32382
  storageCacheAdapter,
32383
+ toRootRelativeUrlPath,
32375
32384
  toViteModuleId,
32376
32385
  unstable_cache,
32377
32386
  updateTag,