@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
@@ -7,7 +7,7 @@ import {
7
7
  memoryRateLimitStorage,
8
8
  middleware,
9
9
  unwrapMiddleware
10
- } from "./chunk-IRYMQRYJ.mjs";
10
+ } from "./chunk-ECLWCE4H.mjs";
11
11
  import {
12
12
  applyProductionMiddlewareHeaders,
13
13
  createProductionMiddlewareRunner
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  MiddlewareManager,
17
17
  createContext
18
- } from "./chunk-VHYARVB7.mjs";
18
+ } from "./chunk-TIESOJ7Z.mjs";
19
19
  import {
20
20
  _runWithMiddlewareContext,
21
21
  _runWithMiddlewareData,
@@ -24,7 +24,7 @@ import {
24
24
  getMiddlewareValue
25
25
  } from "./chunk-P7QDS5AT.mjs";
26
26
  import "./chunk-GIELMNBG.mjs";
27
- import "./chunk-KEPCW6EI.mjs";
27
+ import "./chunk-U5SPS2HR.mjs";
28
28
  import "./chunk-QGOHVJ6J.mjs";
29
29
  import "./chunk-RHIFZZUI.mjs";
30
30
  import "./chunk-LM2YNO4U.mjs";
package/dist/plugin.cjs CHANGED
@@ -12766,6 +12766,14 @@ function resolveAppPath(root, ...paths) {
12766
12766
  return import_path.default.resolve(root, ...paths);
12767
12767
  }
12768
12768
  __name(resolveAppPath, "resolveAppPath");
12769
+ function toRootRelativeUrlPath(absolutePath, projectRoot) {
12770
+ if (absolutePath === projectRoot) return "";
12771
+ if (absolutePath.startsWith(`${projectRoot}/`) || absolutePath.startsWith(`${projectRoot}\\`)) {
12772
+ return absolutePath.slice(projectRoot.length).replace(/\\/g, "/");
12773
+ }
12774
+ return void 0;
12775
+ }
12776
+ __name(toRootRelativeUrlPath, "toRootRelativeUrlPath");
12769
12777
  function toViteModuleId(filePath, root) {
12770
12778
  if (!import_path.default.isAbsolute(filePath)) return filePath;
12771
12779
  const relativePath2 = import_path.default.relative(root, filePath);
@@ -14915,9 +14923,8 @@ var _RouteManager = class _RouteManager {
14915
14923
  return this.clientManifestCache.manifest;
14916
14924
  }
14917
14925
  const toUrlPath = /* @__PURE__ */ __name((absolutePath) => {
14918
- if (absolutePath === normalizedProjectRoot || absolutePath.startsWith(`${normalizedProjectRoot}${import_path5.default.sep}`)) {
14919
- return absolutePath.slice(normalizedProjectRoot.length);
14920
- }
14926
+ const rootRelative = toRootRelativeUrlPath(absolutePath, normalizedProjectRoot);
14927
+ if (rootRelative !== void 0) return rootRelative;
14921
14928
  if (import_path5.default.isAbsolute(absolutePath)) {
14922
14929
  const normalized = absolutePath.replace(/\\/g, "/");
14923
14930
  return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
@@ -18963,7 +18970,7 @@ _setFarmThemeServerSnapshotResolver(() => {
18963
18970
  });
18964
18971
 
18965
18972
  // package.json
18966
- var version = "0.1.0-beta.45";
18973
+ var version = "0.1.0-beta.46";
18967
18974
 
18968
18975
  // src/version.ts
18969
18976
  var FARM_VERSION = version;
@@ -19907,7 +19914,7 @@ var _ServerRenderer = class _ServerRenderer {
19907
19914
  );
19908
19915
  const clientLayouts = layouts.map((layout2, index) => ({
19909
19916
  pattern: layout2.pattern,
19910
- modulePath: layout2.modulePath.startsWith(this.config.root) ? layout2.modulePath.slice(this.config.root.length) : layout2.modulePath,
19917
+ modulePath: toRootRelativeUrlPath(layout2.modulePath, this.config.root) ?? layout2.modulePath,
19911
19918
  shouldHydrate: layoutHydrationMetadata[index]?.shouldHydrate === true,
19912
19919
  islandStrategy: layoutHydrationMetadata[index]?.islandStrategy ?? null
19913
19920
  }));
@@ -20483,7 +20490,7 @@ var _ServerRenderer = class _ServerRenderer {
20483
20490
  const routeSlots = (req.__FARM_ROUTE_SLOTS__ || []).map(
20484
20491
  (slot) => ({
20485
20492
  ...slot,
20486
- modulePath: typeof slot.modulePath === "string" && slot.modulePath.startsWith(this.config.root) ? slot.modulePath.slice(this.config.root.length) : slot.modulePath
20493
+ modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
20487
20494
  })
20488
20495
  );
20489
20496
  const deferredProps = prepareDeferredData({
@@ -20491,7 +20498,7 @@ var _ServerRenderer = class _ServerRenderer {
20491
20498
  slots: routeSlots
20492
20499
  });
20493
20500
  const pagePath = req.__FARM_PAGE_PATH__;
20494
- const relativePath2 = pagePath ? pagePath.startsWith(this.config.root) ? pagePath.slice(this.config.root.length) : pagePath : "/src/app/page.tsx";
20501
+ const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
20495
20502
  const deploymentId = this.getDeploymentId();
20496
20503
  const bootstrapScript = `<script>
20497
20504
  window.__FARM_PROPS__ = ${serializeInlineValue2(deferredProps.data.page)};
@@ -20587,7 +20594,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
20587
20594
  let didError = false;
20588
20595
  const pagePath = req.__FARM_PAGE_PATH__;
20589
20596
  const isClientComponent = req.__FARM_IS_CLIENT_COMPONENT__ === true;
20590
- const relativePath2 = pagePath ? pagePath.startsWith(this.config.root) ? pagePath.slice(this.config.root.length) : pagePath : "/src/app/page.tsx";
20597
+ const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
20591
20598
  const manifest = options.routeManifest ?? this.routeManager.generateClientManifest(this.config.root);
20592
20599
  const clientManifest = {
20593
20600
  clientEntry: "/@farm/client.js",
@@ -20635,7 +20642,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
20635
20642
  const routeSlotPayload = (req.__FARM_ROUTE_SLOTS__ || []).map(
20636
20643
  (slot) => ({
20637
20644
  ...slot,
20638
- modulePath: typeof slot.modulePath === "string" && slot.modulePath.startsWith(this.config.root) ? slot.modulePath.slice(this.config.root.length) : slot.modulePath
20645
+ modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
20639
20646
  })
20640
20647
  );
20641
20648
  const deferredProps = prepareDeferredData({