@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/client.mjs CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  createClientPluginManager,
63
63
  installChunkErrorRecovery,
64
64
  isChunkLoadError
65
- } from "./chunk-QLCUQD3U.mjs";
65
+ } from "./chunk-W2O6SKJU.mjs";
66
66
  import "./chunk-GQVQESLY.mjs";
67
67
  import {
68
68
  api,
@@ -80,7 +80,7 @@ import "./chunk-RBRLLZL5.mjs";
80
80
  import "./chunk-WZ5QFROO.mjs";
81
81
  import "./chunk-7ZMKVETU.mjs";
82
82
  import "./chunk-FXG2PS27.mjs";
83
- import "./chunk-FLGRRGVU.mjs";
83
+ import "./chunk-LGCIIMFR.mjs";
84
84
  import "./chunk-CGILA3WO.mjs";
85
85
  export {
86
86
  APIClientError,
package/dist/index.cjs CHANGED
@@ -256,6 +256,13 @@ function matchRoute(url, segments) {
256
256
  function resolveAppPath(root, ...paths) {
257
257
  return import_path.default.resolve(root, ...paths);
258
258
  }
259
+ function toRootRelativeUrlPath(absolutePath, projectRoot) {
260
+ if (absolutePath === projectRoot) return "";
261
+ if (absolutePath.startsWith(`${projectRoot}/`) || absolutePath.startsWith(`${projectRoot}\\`)) {
262
+ return absolutePath.slice(projectRoot.length).replace(/\\/g, "/");
263
+ }
264
+ return void 0;
265
+ }
259
266
  function toViteModuleId(filePath, root) {
260
267
  if (!import_path.default.isAbsolute(filePath)) return filePath;
261
268
  const relativePath2 = import_path.default.relative(root, filePath);
@@ -304,6 +311,7 @@ var init_utils = __esm({
304
311
  __name(segmentsToPattern, "segmentsToPattern");
305
312
  __name(matchRoute, "matchRoute");
306
313
  __name(resolveAppPath, "resolveAppPath");
314
+ __name(toRootRelativeUrlPath, "toRootRelativeUrlPath");
307
315
  __name(toViteModuleId, "toViteModuleId");
308
316
  __name(fileExists, "fileExists");
309
317
  __name(globFiles, "globFiles");
@@ -10544,9 +10552,8 @@ var init_route_manager = __esm({
10544
10552
  return this.clientManifestCache.manifest;
10545
10553
  }
10546
10554
  const toUrlPath = /* @__PURE__ */ __name((absolutePath) => {
10547
- if (absolutePath === normalizedProjectRoot || absolutePath.startsWith(`${normalizedProjectRoot}${import_path5.default.sep}`)) {
10548
- return absolutePath.slice(normalizedProjectRoot.length);
10549
- }
10555
+ const rootRelative = toRootRelativeUrlPath(absolutePath, normalizedProjectRoot);
10556
+ if (rootRelative !== void 0) return rootRelative;
10550
10557
  if (import_path5.default.isAbsolute(absolutePath)) {
10551
10558
  const normalized = absolutePath.replace(/\\/g, "/");
10552
10559
  return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
@@ -15188,7 +15195,7 @@ var init_server3 = __esm({
15188
15195
  var version;
15189
15196
  var init_package = __esm({
15190
15197
  "package.json"() {
15191
- version = "0.1.0-beta.45";
15198
+ version = "0.1.0-beta.46";
15192
15199
  }
15193
15200
  });
15194
15201
 
@@ -16236,7 +16243,7 @@ var init_renderer2 = __esm({
16236
16243
  );
16237
16244
  const clientLayouts = layouts.map((layout2, index) => ({
16238
16245
  pattern: layout2.pattern,
16239
- modulePath: layout2.modulePath.startsWith(this.config.root) ? layout2.modulePath.slice(this.config.root.length) : layout2.modulePath,
16246
+ modulePath: toRootRelativeUrlPath(layout2.modulePath, this.config.root) ?? layout2.modulePath,
16240
16247
  shouldHydrate: layoutHydrationMetadata[index]?.shouldHydrate === true,
16241
16248
  islandStrategy: layoutHydrationMetadata[index]?.islandStrategy ?? null
16242
16249
  }));
@@ -16812,7 +16819,7 @@ var init_renderer2 = __esm({
16812
16819
  const routeSlots = (req.__FARM_ROUTE_SLOTS__ || []).map(
16813
16820
  (slot) => ({
16814
16821
  ...slot,
16815
- modulePath: typeof slot.modulePath === "string" && slot.modulePath.startsWith(this.config.root) ? slot.modulePath.slice(this.config.root.length) : slot.modulePath
16822
+ modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
16816
16823
  })
16817
16824
  );
16818
16825
  const deferredProps = prepareDeferredData({
@@ -16820,7 +16827,7 @@ var init_renderer2 = __esm({
16820
16827
  slots: routeSlots
16821
16828
  });
16822
16829
  const pagePath = req.__FARM_PAGE_PATH__;
16823
- const relativePath2 = pagePath ? pagePath.startsWith(this.config.root) ? pagePath.slice(this.config.root.length) : pagePath : "/src/app/page.tsx";
16830
+ const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
16824
16831
  const deploymentId = this.getDeploymentId();
16825
16832
  const bootstrapScript = `<script>
16826
16833
  window.__FARM_PROPS__ = ${serializeInlineValue2(deferredProps.data.page)};
@@ -16916,7 +16923,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
16916
16923
  let didError = false;
16917
16924
  const pagePath = req.__FARM_PAGE_PATH__;
16918
16925
  const isClientComponent = req.__FARM_IS_CLIENT_COMPONENT__ === true;
16919
- const relativePath2 = pagePath ? pagePath.startsWith(this.config.root) ? pagePath.slice(this.config.root.length) : pagePath : "/src/app/page.tsx";
16926
+ const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
16920
16927
  const manifest = options.routeManifest ?? this.routeManager.generateClientManifest(this.config.root);
16921
16928
  const clientManifest = {
16922
16929
  clientEntry: "/@farm/client.js",
@@ -16964,7 +16971,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
16964
16971
  const routeSlotPayload = (req.__FARM_ROUTE_SLOTS__ || []).map(
16965
16972
  (slot) => ({
16966
16973
  ...slot,
16967
- modulePath: typeof slot.modulePath === "string" && slot.modulePath.startsWith(this.config.root) ? slot.modulePath.slice(this.config.root.length) : slot.modulePath
16974
+ modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
16968
16975
  })
16969
16976
  );
16970
16977
  const deferredProps = prepareDeferredData({
@@ -34212,6 +34219,7 @@ __export(src_exports, {
34212
34219
  storageCacheAdapter: () => storageCacheAdapter,
34213
34220
  titleFromMarkdown: () => titleFromMarkdown,
34214
34221
  toFormData: () => toFormData,
34222
+ toRootRelativeUrlPath: () => toRootRelativeUrlPath,
34215
34223
  toViteModuleId: () => toViteModuleId,
34216
34224
  toggleTheme: () => toggleTheme,
34217
34225
  unstable_cache: () => unstable_cache,
@@ -50297,6 +50305,7 @@ __name(decodeCookiePart, "decodeCookiePart");
50297
50305
  storageCacheAdapter,
50298
50306
  titleFromMarkdown,
50299
50307
  toFormData,
50308
+ toRootRelativeUrlPath,
50300
50309
  toViteModuleId,
50301
50310
  toggleTheme,
50302
50311
  unstable_cache,