@farm.js/core 0.1.0-beta.44 → 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 (84) 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-MYNLKNAW.mjs → chunk-EHUGMAWL.mjs} +2 -2
  8. package/dist/{chunk-FY34HLY7.mjs → chunk-LGCIIMFR.mjs} +2 -2
  9. package/dist/{chunk-FY34HLY7.mjs.map → chunk-LGCIIMFR.mjs.map} +1 -1
  10. package/dist/{chunk-MU2QKVYL.mjs → chunk-MP2SDRRB.mjs} +2 -2
  11. package/dist/{chunk-VHYARVB7.mjs → chunk-TIESOJ7Z.mjs} +2 -2
  12. package/dist/{chunk-LIIZPHDO.mjs → chunk-TQJMU5BP.mjs} +16 -16
  13. package/dist/chunk-TQJMU5BP.mjs.map +1 -0
  14. package/dist/{chunk-KEPCW6EI.mjs → chunk-U5SPS2HR.mjs} +10 -1
  15. package/dist/chunk-U5SPS2HR.mjs.map +1 -0
  16. package/dist/{chunk-4MYKKWR4.mjs → chunk-V7VDW7IY.mjs} +7 -7
  17. package/dist/{chunk-BQWTEZSS.mjs → chunk-W2O6SKJU.mjs} +2 -2
  18. package/dist/{chunk-X4MNGHCU.mjs → chunk-XR7M5VXU.mjs} +2 -2
  19. package/dist/{chunk-TUYEGV7H.mjs → chunk-YKAUAZA4.mjs} +7 -3
  20. package/dist/chunk-YKAUAZA4.mjs.map +1 -0
  21. package/dist/client/lifecycle.mjs +2 -2
  22. package/dist/client-plugins.cjs +1 -1
  23. package/dist/client-plugins.cjs.map +1 -1
  24. package/dist/client-plugins.mjs +2 -2
  25. package/dist/client.cjs +1 -1
  26. package/dist/client.cjs.map +1 -1
  27. package/dist/client.mjs +2 -2
  28. package/dist/{devtools-3MSKJ4TE.mjs → devtools-BUFIHBX3.mjs} +3 -3
  29. package/dist/docs.cjs.map +1 -1
  30. package/dist/docs.mjs +3 -3
  31. package/dist/index.cjs +24 -11
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.mts +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.mjs +14 -12
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/internal/build-runtime.cjs +22 -11
  38. package/dist/internal/build-runtime.cjs.map +1 -1
  39. package/dist/internal/build-runtime.d.mts +1 -1
  40. package/dist/internal/build-runtime.d.ts +1 -1
  41. package/dist/internal/build-runtime.mjs +9 -9
  42. package/dist/internal/client-runtime.cjs +1 -1
  43. package/dist/internal/client-runtime.cjs.map +1 -1
  44. package/dist/internal/client-runtime.mjs +2 -2
  45. package/dist/internal/config-runtime.cjs +6 -2
  46. package/dist/internal/config-runtime.cjs.map +1 -1
  47. package/dist/internal/config-runtime.d.mts +1 -1
  48. package/dist/internal/config-runtime.d.ts +1 -1
  49. package/dist/internal/config-runtime.mjs +3 -3
  50. package/dist/{layers-3ZHU4XTZ.mjs → layers-KJI5XUAP.mjs} +2 -2
  51. package/dist/middleware.cjs.map +1 -1
  52. package/dist/middleware.mjs +3 -3
  53. package/dist/plugin.cjs +16 -9
  54. package/dist/plugin.cjs.map +1 -1
  55. package/dist/plugin.mjs +6 -6
  56. package/dist/server.cjs +24 -11
  57. package/dist/server.cjs.map +1 -1
  58. package/dist/server.d.mts +1 -1
  59. package/dist/server.d.ts +1 -1
  60. package/dist/server.mjs +9 -7
  61. package/dist/server.mjs.map +1 -1
  62. package/dist/testing.mjs +2 -2
  63. package/dist/{utils-CjZRiq-l.d.mts → utils-9OPxcT1T.d.mts} +9 -1
  64. package/dist/{utils-_LOF-V9f.d.ts → utils-CIIoLfn9.d.ts} +9 -1
  65. package/dist/version.cjs +1 -1
  66. package/dist/version.cjs.map +1 -1
  67. package/dist/version.mjs +1 -1
  68. package/dist/vite.cjs +22 -11
  69. package/dist/vite.cjs.map +1 -1
  70. package/dist/vite.mjs +6 -6
  71. package/package.json +1 -1
  72. package/dist/chunk-KEPCW6EI.mjs.map +0 -1
  73. package/dist/chunk-LIIZPHDO.mjs.map +0 -1
  74. package/dist/chunk-TUYEGV7H.mjs.map +0 -1
  75. /package/dist/{chunk-EPBXX44K.mjs.map → chunk-3UUEBVR3.mjs.map} +0 -0
  76. /package/dist/{chunk-IRYMQRYJ.mjs.map → chunk-ECLWCE4H.mjs.map} +0 -0
  77. /package/dist/{chunk-MYNLKNAW.mjs.map → chunk-EHUGMAWL.mjs.map} +0 -0
  78. /package/dist/{chunk-MU2QKVYL.mjs.map → chunk-MP2SDRRB.mjs.map} +0 -0
  79. /package/dist/{chunk-VHYARVB7.mjs.map → chunk-TIESOJ7Z.mjs.map} +0 -0
  80. /package/dist/{chunk-4MYKKWR4.mjs.map → chunk-V7VDW7IY.mjs.map} +0 -0
  81. /package/dist/{chunk-BQWTEZSS.mjs.map → chunk-W2O6SKJU.mjs.map} +0 -0
  82. /package/dist/{chunk-X4MNGHCU.mjs.map → chunk-XR7M5VXU.mjs.map} +0 -0
  83. /package/dist/{devtools-3MSKJ4TE.mjs.map → devtools-BUFIHBX3.mjs.map} +0 -0
  84. /package/dist/{layers-3ZHU4XTZ.mjs.map → layers-KJI5XUAP.mjs.map} +0 -0
package/dist/docs.mjs CHANGED
@@ -11,9 +11,9 @@ import {
11
11
  isFarmDocsRequest,
12
12
  loadFarmDocsPage,
13
13
  resolveFarmDocsContentDir
14
- } from "./chunk-X4MNGHCU.mjs";
14
+ } from "./chunk-XR7M5VXU.mjs";
15
15
  import "./chunk-V7RBCSDJ.mjs";
16
- import "./chunk-MYNLKNAW.mjs";
16
+ import "./chunk-EHUGMAWL.mjs";
17
17
  import "./chunk-UVCIEUJC.mjs";
18
18
  import "./chunk-RQ633A5I.mjs";
19
19
  import "./chunk-USLFXFFH.mjs";
@@ -21,7 +21,7 @@ import "./chunk-E257KFBU.mjs";
21
21
  import "./chunk-7MABZJIM.mjs";
22
22
  import "./chunk-H3A35IQ2.mjs";
23
23
  import "./chunk-BNTDKO7T.mjs";
24
- import "./chunk-TUYEGV7H.mjs";
24
+ import "./chunk-YKAUAZA4.mjs";
25
25
  import "./chunk-7ZVN3YZI.mjs";
26
26
  import "./chunk-GY2STC2S.mjs";
27
27
  import "./chunk-A5VG2BDG.mjs";
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");
@@ -6376,6 +6384,9 @@ function getFarmLayerAliases(layers) {
6376
6384
  (layers ?? []).map((layer) => [`#layers/${layer.name}`, import_node_path2.default.join(layer.root, layer.srcDir)])
6377
6385
  );
6378
6386
  }
6387
+ function toExternalSpecifier(resolvedPath) {
6388
+ return import_node_path2.default.isAbsolute(resolvedPath) ? (0, import_node_url2.pathToFileURL)(resolvedPath).href : resolvedPath;
6389
+ }
6379
6390
  function createFarmConfigResolutionPlugin(options) {
6380
6391
  const configEntryChecks = /* @__PURE__ */ new Map();
6381
6392
  return {
@@ -6400,7 +6411,7 @@ function createFarmConfigResolutionPlugin(options) {
6400
6411
  });
6401
6412
  if (resolved.errors.length > 0 || !resolved.path) return;
6402
6413
  return {
6403
- path: resolved.path,
6414
+ path: toExternalSpecifier(resolved.path),
6404
6415
  external: true,
6405
6416
  warnings: resolved.warnings
6406
6417
  };
@@ -6421,7 +6432,7 @@ function createFarmConfigResolutionPlugin(options) {
6421
6432
  return { path: args.path, external: true };
6422
6433
  }
6423
6434
  return {
6424
- path: resolved.path,
6435
+ path: toExternalSpecifier(resolved.path),
6425
6436
  external: true,
6426
6437
  warnings: resolved.warnings
6427
6438
  };
@@ -6707,6 +6718,7 @@ var init_layers = __esm({
6707
6718
  __name(getFarmAppDirectories, "getFarmAppDirectories");
6708
6719
  __name(getFarmLayerAliases, "getFarmLayerAliases");
6709
6720
  WINDOWS_ABSOLUTE_PATH_RE = /^(?:[A-Za-z]:[\\/]|\\\\)/;
6721
+ __name(toExternalSpecifier, "toExternalSpecifier");
6710
6722
  __name(createFarmConfigResolutionPlugin, "createFarmConfigResolutionPlugin");
6711
6723
  __name(loadFarmConfigFile, "loadFarmConfigFile");
6712
6724
  __name(onlyImportsFarmConfigHelpers, "onlyImportsFarmConfigHelpers");
@@ -10540,9 +10552,8 @@ var init_route_manager = __esm({
10540
10552
  return this.clientManifestCache.manifest;
10541
10553
  }
10542
10554
  const toUrlPath = /* @__PURE__ */ __name((absolutePath) => {
10543
- if (absolutePath === normalizedProjectRoot || absolutePath.startsWith(`${normalizedProjectRoot}${import_path5.default.sep}`)) {
10544
- return absolutePath.slice(normalizedProjectRoot.length);
10545
- }
10555
+ const rootRelative = toRootRelativeUrlPath(absolutePath, normalizedProjectRoot);
10556
+ if (rootRelative !== void 0) return rootRelative;
10546
10557
  if (import_path5.default.isAbsolute(absolutePath)) {
10547
10558
  const normalized = absolutePath.replace(/\\/g, "/");
10548
10559
  return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
@@ -15184,7 +15195,7 @@ var init_server3 = __esm({
15184
15195
  var version;
15185
15196
  var init_package = __esm({
15186
15197
  "package.json"() {
15187
- version = "0.1.0-beta.44";
15198
+ version = "0.1.0-beta.46";
15188
15199
  }
15189
15200
  });
15190
15201
 
@@ -16232,7 +16243,7 @@ var init_renderer2 = __esm({
16232
16243
  );
16233
16244
  const clientLayouts = layouts.map((layout2, index) => ({
16234
16245
  pattern: layout2.pattern,
16235
- 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,
16236
16247
  shouldHydrate: layoutHydrationMetadata[index]?.shouldHydrate === true,
16237
16248
  islandStrategy: layoutHydrationMetadata[index]?.islandStrategy ?? null
16238
16249
  }));
@@ -16808,7 +16819,7 @@ var init_renderer2 = __esm({
16808
16819
  const routeSlots = (req.__FARM_ROUTE_SLOTS__ || []).map(
16809
16820
  (slot) => ({
16810
16821
  ...slot,
16811
- 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
16812
16823
  })
16813
16824
  );
16814
16825
  const deferredProps = prepareDeferredData({
@@ -16816,7 +16827,7 @@ var init_renderer2 = __esm({
16816
16827
  slots: routeSlots
16817
16828
  });
16818
16829
  const pagePath = req.__FARM_PAGE_PATH__;
16819
- 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";
16820
16831
  const deploymentId = this.getDeploymentId();
16821
16832
  const bootstrapScript = `<script>
16822
16833
  window.__FARM_PROPS__ = ${serializeInlineValue2(deferredProps.data.page)};
@@ -16912,7 +16923,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
16912
16923
  let didError = false;
16913
16924
  const pagePath = req.__FARM_PAGE_PATH__;
16914
16925
  const isClientComponent = req.__FARM_IS_CLIENT_COMPONENT__ === true;
16915
- 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";
16916
16927
  const manifest = options.routeManifest ?? this.routeManager.generateClientManifest(this.config.root);
16917
16928
  const clientManifest = {
16918
16929
  clientEntry: "/@farm/client.js",
@@ -16960,7 +16971,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
16960
16971
  const routeSlotPayload = (req.__FARM_ROUTE_SLOTS__ || []).map(
16961
16972
  (slot) => ({
16962
16973
  ...slot,
16963
- 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
16964
16975
  })
16965
16976
  );
16966
16977
  const deferredProps = prepareDeferredData({
@@ -34208,6 +34219,7 @@ __export(src_exports, {
34208
34219
  storageCacheAdapter: () => storageCacheAdapter,
34209
34220
  titleFromMarkdown: () => titleFromMarkdown,
34210
34221
  toFormData: () => toFormData,
34222
+ toRootRelativeUrlPath: () => toRootRelativeUrlPath,
34211
34223
  toViteModuleId: () => toViteModuleId,
34212
34224
  toggleTheme: () => toggleTheme,
34213
34225
  unstable_cache: () => unstable_cache,
@@ -50293,6 +50305,7 @@ __name(decodeCookiePart, "decodeCookiePart");
50293
50305
  storageCacheAdapter,
50294
50306
  titleFromMarkdown,
50295
50307
  toFormData,
50308
+ toRootRelativeUrlPath,
50296
50309
  toViteModuleId,
50297
50310
  toggleTheme,
50298
50311
  unstable_cache,