@farm.js/core 0.1.22 → 0.1.23

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 (150) hide show
  1. package/dist/agent-runtime.d.mts +3 -2
  2. package/dist/agent-runtime.d.ts +3 -2
  3. package/dist/api/route-manager.cjs +3 -2
  4. package/dist/api/route-manager.d.mts +3 -2
  5. package/dist/api/route-manager.d.ts +3 -2
  6. package/dist/api/route-manager.mjs +2 -1
  7. package/dist/api.cjs +4 -3
  8. package/dist/api.d.mts +4 -3
  9. package/dist/api.d.ts +4 -3
  10. package/dist/api.mjs +3 -2
  11. package/dist/{app-B7qKw8Ny.d.ts → app-BV-7wV5q.d.ts} +3 -3
  12. package/dist/{app-0e-oTC_R.d.mts → app-BZDWwwFa.d.mts} +3 -3
  13. package/dist/app-markdown.d.mts +4 -3
  14. package/dist/app-markdown.d.ts +4 -3
  15. package/dist/chunk-2VQKKQ6D.mjs +51 -0
  16. package/dist/{chunk-EGJDUF4Q.mjs → chunk-3ATMYLLJ.mjs} +6 -12
  17. package/dist/{chunk-HSDL2AUR.mjs → chunk-47H7VENP.mjs} +20 -32
  18. package/dist/{chunk-EXUMQVY3.cjs → chunk-4DKZ6JR3.cjs} +258 -256
  19. package/dist/{chunk-PUCUVI7K.mjs → chunk-72VJRKJD.mjs} +1 -1
  20. package/dist/{chunk-PC33YKTC.mjs → chunk-7LU4IOXQ.mjs} +128 -126
  21. package/dist/{chunk-SPSQFO3Z.mjs → chunk-BDJNP7AQ.mjs} +9 -13
  22. package/dist/{chunk-GXXONIAR.cjs → chunk-DNLQMFER.cjs} +12 -16
  23. package/dist/{chunk-SO7CRMP6.cjs → chunk-DW34V5SM.cjs} +5 -5
  24. package/dist/{chunk-X2ZUD4GI.mjs → chunk-EHUZ2MKO.mjs} +1 -1
  25. package/dist/{chunk-3NM6SRI6.mjs → chunk-F3VB7ONA.mjs} +10 -8
  26. package/dist/{chunk-P5HSJCXI.cjs → chunk-III667SJ.cjs} +291 -260
  27. package/dist/chunk-IK6LVLKC.cjs +51 -0
  28. package/dist/{chunk-B3WK4DTX.cjs → chunk-IMBMOEWT.cjs} +5 -1
  29. package/dist/{chunk-IILNZK5G.mjs → chunk-JHWOVJ3M.mjs} +46 -62
  30. package/dist/{chunk-TKNSDBBN.cjs → chunk-K3F2E6GS.cjs} +20 -1
  31. package/dist/{chunk-RTHIVJ2G.cjs → chunk-KCMTCM6I.cjs} +7 -8
  32. package/dist/{chunk-Q3PX2TGL.cjs → chunk-LQIRVSBY.cjs} +30 -40
  33. package/dist/chunk-LYLEZIG3.cjs +73 -0
  34. package/dist/{chunk-NBAHDVOJ.cjs → chunk-LYM7HY34.cjs} +20 -32
  35. package/dist/{chunk-K6FNHVDR.cjs → chunk-MPEYMSCF.cjs} +6 -12
  36. package/dist/{chunk-BHJUZ64B.cjs → chunk-QTBEAKCJ.cjs} +7 -7
  37. package/dist/{chunk-J6JRB2ER.mjs → chunk-S67OYZU7.mjs} +1 -1
  38. package/dist/chunk-SFGWNC43.mjs +97 -0
  39. package/dist/{chunk-AYJR42WX.cjs → chunk-UFDV5N3C.cjs} +2 -2
  40. package/dist/chunk-UYIHRDE4.cjs +97 -0
  41. package/dist/{chunk-Y4YMF2NQ.cjs → chunk-VPTDD5XF.cjs} +46 -62
  42. package/dist/{chunk-AAWTJW2G.mjs → chunk-VPY755R2.mjs} +58 -27
  43. package/dist/{chunk-GKT4ONKN.mjs → chunk-VVJCWBIE.mjs} +2 -2
  44. package/dist/{chunk-2HCEC2YO.cjs → chunk-VXCA7RZP.cjs} +1 -1
  45. package/dist/{chunk-CQHFU55R.mjs → chunk-WNUBR4CA.mjs} +5 -1
  46. package/dist/{chunk-CIAGU2X4.cjs → chunk-XSIRSMAS.cjs} +10 -8
  47. package/dist/{chunk-ONMW3EVV.mjs → chunk-YGMK6ESJ.mjs} +20 -30
  48. package/dist/chunk-YOZYCI6Z.mjs +73 -0
  49. package/dist/{chunk-HLCDYJY7.mjs → chunk-YQVSHTMR.mjs} +20 -1
  50. package/dist/{chunk-F5D4XEAS.mjs → chunk-ZZSRYEYU.mjs} +7 -8
  51. package/dist/{client-plugins-CWrhb1ir.d.mts → client-plugins-B_XzCegf.d.mts} +11 -9
  52. package/dist/{client-plugins-DPf0qZey.d.ts → client-plugins-CKsXQfXY.d.ts} +11 -9
  53. package/dist/client-plugins.d.mts +3 -2
  54. package/dist/client-plugins.d.ts +3 -2
  55. package/dist/client.d.mts +7 -6
  56. package/dist/client.d.ts +7 -6
  57. package/dist/config.d.mts +3 -2
  58. package/dist/config.d.ts +3 -2
  59. package/dist/{devtools-EZ5ORGAK.mjs → devtools-OY4SNU3P.mjs} +4 -3
  60. package/dist/{devtools-6DQHO7EK.cjs → devtools-UHRSZ7VA.cjs} +5 -4
  61. package/dist/docs.cjs +9 -6
  62. package/dist/docs.mjs +8 -5
  63. package/dist/index.cjs +23 -20
  64. package/dist/index.d.mts +14 -13
  65. package/dist/index.d.ts +14 -13
  66. package/dist/index.mjs +18 -15
  67. package/dist/instrumentation.cjs +3 -2
  68. package/dist/instrumentation.mjs +2 -1
  69. package/dist/integrations.d.mts +3 -2
  70. package/dist/integrations.d.ts +3 -2
  71. package/dist/internal/app-markdown-runtime.d.mts +3 -2
  72. package/dist/internal/app-markdown-runtime.d.ts +3 -2
  73. package/dist/internal/build-runtime.cjs +17 -14
  74. package/dist/internal/build-runtime.d.mts +5 -4
  75. package/dist/internal/build-runtime.d.ts +5 -4
  76. package/dist/internal/build-runtime.mjs +16 -13
  77. package/dist/internal/cli-runtime.cjs +10 -7
  78. package/dist/internal/cli-runtime.mjs +9 -6
  79. package/dist/internal/client-error-overlay.cjs +4 -4
  80. package/dist/internal/client-error-overlay.mjs +1 -1
  81. package/dist/internal/compression-runtime.d.mts +3 -2
  82. package/dist/internal/compression-runtime.d.ts +3 -2
  83. package/dist/internal/config-runtime.cjs +5 -4
  84. package/dist/internal/config-runtime.d.mts +4 -3
  85. package/dist/internal/config-runtime.d.ts +4 -3
  86. package/dist/internal/config-runtime.mjs +4 -3
  87. package/dist/internal/metadata-image-runtime.cjs +3 -2
  88. package/dist/internal/metadata-image-runtime.mjs +2 -1
  89. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  90. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  91. package/dist/internal/production-runtime.d.mts +9 -8
  92. package/dist/internal/production-runtime.d.ts +9 -8
  93. package/dist/layers-4PNE2HOY.cjs +18 -0
  94. package/dist/{layers-CJKSJGLN.mjs → layers-BRQF5ETU.mjs} +2 -1
  95. package/dist/{manager-NPG43N46.mjs → manager-RT733VRK.mjs} +2 -2
  96. package/dist/{manager-G4B2IPYE.cjs → manager-XZ5TX7AO.cjs} +3 -3
  97. package/dist/{metadata-CO9fRyyJ.d.mts → metadata-B08w4EYV.d.mts} +1 -1
  98. package/dist/{metadata-zY9wltwH.d.ts → metadata-IQEblkZp.d.ts} +1 -1
  99. package/dist/middleware.d.mts +5 -4
  100. package/dist/middleware.d.ts +5 -4
  101. package/dist/navigation.d.mts +6 -5
  102. package/dist/navigation.d.ts +6 -5
  103. package/dist/{nitro-TSGDUJMN.cjs → nitro-KQDU7CFE.cjs} +2 -2
  104. package/dist/{nitro-4LFVTT24.mjs → nitro-ZKLGOTVY.mjs} +1 -1
  105. package/dist/node-module-bundle-L5L7JCZ4.mjs +11 -0
  106. package/dist/node-module-bundle-VAFZOXMJ.cjs +11 -0
  107. package/dist/plugin.cjs +11 -9
  108. package/dist/plugin.d.mts +3 -2
  109. package/dist/plugin.d.ts +3 -2
  110. package/dist/plugin.mjs +10 -8
  111. package/dist/{production-runtime-CywsHwnG.d.mts → production-runtime-C3bGFEaM.d.mts} +1 -1
  112. package/dist/{production-runtime-lkfwujwK.d.ts → production-runtime-DRSOkc-d.d.ts} +1 -1
  113. package/dist/{render-plan-LVy6sGQe.d.mts → render-plan-B6CKNl4e.d.mts} +1 -1
  114. package/dist/{render-plan-DHF0GeWo.d.ts → render-plan-CCFuMLNS.d.ts} +1 -1
  115. package/dist/renderer-client.d.mts +5 -4
  116. package/dist/renderer-client.d.ts +5 -4
  117. package/dist/{request-6AkmhEYE.d.mts → request-DgD1XsTx.d.mts} +1 -1
  118. package/dist/{request-BYxlRqA9.d.ts → request-Dn6VURbE.d.ts} +1 -1
  119. package/dist/request.d.mts +4 -3
  120. package/dist/request.d.ts +4 -3
  121. package/dist/{route-rendering-Dd8Jmml7.d.mts → route-rendering-76A5I_kE.d.mts} +1 -1
  122. package/dist/{route-rendering-CWaKiUbS.d.ts → route-rendering-LAmQEdyG.d.ts} +1 -1
  123. package/dist/{router-B2m4fvve.d.ts → router-BSOOGya2.d.ts} +1 -1
  124. package/dist/{router-xwEE112q.d.mts → router-CnrRSa9d.d.mts} +1 -1
  125. package/dist/routes.d.mts +3 -2
  126. package/dist/routes.d.ts +3 -2
  127. package/dist/server-plugins.d.mts +4 -3
  128. package/dist/server-plugins.d.ts +4 -3
  129. package/dist/server.cjs +39 -26
  130. package/dist/server.d.mts +9 -8
  131. package/dist/server.d.ts +9 -8
  132. package/dist/server.mjs +24 -11
  133. package/dist/{spa-router-Y8rrXTVK.d.ts → spa-router-BMrSsG5b.d.ts} +2 -2
  134. package/dist/{spa-router-DVEHQnWo.d.mts → spa-router-DnYhWCvI.d.mts} +2 -2
  135. package/dist/testing.cjs +2 -1
  136. package/dist/testing.d.mts +3 -2
  137. package/dist/testing.d.ts +3 -2
  138. package/dist/testing.mjs +2 -1
  139. package/dist/{utils-DSPx34-A.d.mts → utils-ABkktwku.d.mts} +1 -1
  140. package/dist/{utils-Dvuny_08.d.ts → utils-C3GguS-Q.d.ts} +1 -1
  141. package/dist/version.cjs +2 -2
  142. package/dist/version.mjs +1 -1
  143. package/dist/vite.cjs +11 -9
  144. package/dist/vite.d.mts +3 -2
  145. package/dist/vite.d.ts +3 -2
  146. package/dist/vite.mjs +10 -8
  147. package/dist/workflows.cjs +2 -2
  148. package/dist/workflows.mjs +1 -1
  149. package/package.json +21 -11
  150. package/dist/layers-E4WPJNY5.cjs +0 -17
@@ -8,6 +8,10 @@ var _chunkKGZIORNLcjs = require('./chunk-KGZIORNL.cjs');
8
8
 
9
9
 
10
10
 
11
+ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
12
+
13
+
14
+
11
15
  var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
12
16
 
13
17
 
@@ -22,23 +26,6 @@ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
22
26
  // src/docs/handler.ts
23
27
  var _fs = require('fs');
24
28
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
- var _docs = require('@farming-labs/docs');
42
29
  var _marked = require('marked');
43
30
  var _sugarhigh = require('sugar-high');
44
31
 
@@ -1074,7 +1061,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
1074
1061
  const url = new URL(request.url);
1075
1062
  let loadedPages;
1076
1063
  const getPages = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _nullishCoalesce(loadedPages, () => ( (loadedPages = getLoadedDocsPages(contentDir, docs)))), "getPages");
1077
- const sitemapManifest = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _docs.buildDocsSitemapManifest.call(void 0, {
1064
+ const sitemapManifest = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsSitemapManifest({
1078
1065
  pages: getPages().map(toDocsSitemapPage),
1079
1066
  entry: docs.entry,
1080
1067
  siteTitle: getDocsTitle(docs),
@@ -1084,9 +1071,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
1084
1071
  "Content-Type": contentType,
1085
1072
  "Cache-Control": "public, max-age=60"
1086
1073
  }), "textHeaders");
1087
- const llmsFormat = _docs.resolveDocsLlmsTxtFormat.call(void 0, url);
1074
+ const llmsFormat = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).resolveDocsLlmsTxtFormat(url);
1088
1075
  if (llmsFormat) {
1089
- const generated = _docs.renderDocsLlmsTxt.call(void 0,
1076
+ const generated = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsLlmsTxt(
1090
1077
  getPages().map(toDocsLlmsPage),
1091
1078
  getDocsLlmsOptions(docs, request)
1092
1079
  );
@@ -1095,10 +1082,10 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
1095
1082
  headers: textHeaders("text/plain; charset=utf-8")
1096
1083
  });
1097
1084
  }
1098
- const sitemapFormat = _docs.resolveDocsSitemapRequest.call(void 0, url, _nullishCoalesce(docs.config.sitemap, () => ( true)));
1085
+ const sitemapFormat = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).resolveDocsSitemapRequest(url, _nullishCoalesce(docs.config.sitemap, () => ( true)));
1099
1086
  if (sitemapFormat === "xml") {
1100
1087
  return new Response(
1101
- _docs.renderDocsSitemapXml.call(void 0, sitemapManifest(), {
1088
+ _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsSitemapXml(sitemapManifest(), {
1102
1089
  baseUrl: url.origin,
1103
1090
  includeLastmod: true
1104
1091
  }),
@@ -1110,7 +1097,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
1110
1097
  }
1111
1098
  if (sitemapFormat === "markdown") {
1112
1099
  return new Response(
1113
- _docs.renderDocsSitemapMarkdown.call(void 0, sitemapManifest(), {
1100
+ _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsSitemapMarkdown(sitemapManifest(), {
1114
1101
  includeDescriptions: true
1115
1102
  }),
1116
1103
  {
@@ -1119,9 +1106,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
1119
1106
  }
1120
1107
  );
1121
1108
  }
1122
- if (_docs.resolveDocsRobotsRequest.call(void 0, url, _nullishCoalesce(docs.config.robots, () => ( true)))) {
1109
+ if (_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).resolveDocsRobotsRequest(url, _nullishCoalesce(docs.config.robots, () => ( true)))) {
1123
1110
  return new Response(
1124
- _docs.renderDocsRobotsTxt.call(void 0, {
1111
+ _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsRobotsTxt({
1125
1112
  entry: docs.entry,
1126
1113
  sitemap: _nullishCoalesce(docs.config.sitemap, () => ( true)),
1127
1114
  robots: _nullishCoalesce(docs.config.robots, () => ( true)),
@@ -1133,8 +1120,8 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
1133
1120
  }
1134
1121
  );
1135
1122
  }
1136
- if (_docs.isDocsAgentDiscoveryRequest.call(void 0, url)) {
1137
- const spec = _docs.buildDocsAgentDiscoverySpec.call(void 0, getDocsDiscoveryOptions(docs, request));
1123
+ if (_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).isDocsAgentDiscoveryRequest(url)) {
1124
+ const spec = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsAgentDiscoverySpec(getDocsDiscoveryOptions(docs, request));
1138
1125
  const title = getDocsTitle(docs);
1139
1126
  return new Response(
1140
1127
  JSON.stringify({
@@ -1153,9 +1140,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
1153
1140
  }
1154
1141
  );
1155
1142
  }
1156
- if (_docs.isDocsAgentsRequest.call(void 0, url)) {
1143
+ if (_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).isDocsAgentsRequest(url)) {
1157
1144
  return new Response(
1158
- `${_docs.renderDocsAgentsDocument.call(void 0, getDocsDiscoveryOptions(docs, request)).trim()}
1145
+ `${_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsAgentsDocument(getDocsDiscoveryOptions(docs, request)).trim()}
1159
1146
  `,
1160
1147
  {
1161
1148
  status: 200,
@@ -1163,9 +1150,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
1163
1150
  }
1164
1151
  );
1165
1152
  }
1166
- if (_docs.isDocsSkillRequest.call(void 0, url)) {
1153
+ if (_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).isDocsSkillRequest(url)) {
1167
1154
  return new Response(
1168
- `${_docs.renderDocsSkillDocument.call(void 0, getDocsDiscoveryOptions(docs, request)).trim()}
1155
+ `${_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsSkillDocument(getDocsDiscoveryOptions(docs, request)).trim()}
1169
1156
  `,
1170
1157
  {
1171
1158
  status: 200,
@@ -1941,6 +1928,7 @@ function createFarmDocsHandler(docs, options) {
1941
1928
  const fallbackFontPreloadHeader = renderFarmDocsFontPreloadHeader(fontAssets);
1942
1929
  return /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async function handleFarmDocsRequest(request) {
1943
1930
  if (!_optionalChain([docs, 'optionalAccess', _82 => _82.enabled]) || request.method !== "GET" && request.method !== "HEAD") return null;
1931
+ await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
1944
1932
  const contentDir = resolveFarmDocsContentDir(docs, options);
1945
1933
  const requestUrl = new URL(request.url);
1946
1934
  const socialImageSlug = getFarmDocsSocialImageSlug(docs, requestUrl);
@@ -1976,7 +1964,7 @@ function createFarmDocsHandler(docs, options) {
1976
1964
  return omitFarmDocsHeadBody(
1977
1965
  request,
1978
1966
  new Response(
1979
- _docs.renderDocsMarkdownDocument.call(void 0, toFarmDocsMarkdownPage(page), {
1967
+ _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsMarkdownDocument(toFarmDocsMarkdownPage(page), {
1980
1968
  origin,
1981
1969
  llms: _nullishCoalesce(docs.config.llmsTxt, () => ( true)),
1982
1970
  sitemap: docs.config.sitemap
@@ -363,26 +363,20 @@ async function loadWorkflowModule(filePath, root) {
363
363
  const fs = await import("fs/promises");
364
364
  const path = await import("path");
365
365
  const { pathToFileURL } = await import("url");
366
- const { build } = await import("esbuild");
367
366
  const outDir = path.join(root, ".farm", ".workflow-loader");
368
367
  await fs.mkdir(outDir, { recursive: true });
369
368
  const outfile = path.join(
370
369
  outDir,
371
370
  `workflow-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
372
371
  );
373
- await build({
374
- absWorkingDir: root,
375
- entryPoints: [filePath],
372
+ const { bundleNodeModule } = await import("./node-module-bundle-VAFZOXMJ.cjs");
373
+ await bundleNodeModule({
374
+ root,
375
+ entry: filePath,
376
376
  outfile,
377
- bundle: true,
378
- format: "esm",
379
- platform: "node",
380
377
  target: `node${process.versions.node.split(".")[0]}`,
381
- packages: "external",
382
- external: ["@farm.js/core", "@farm.js/core/*", "nitro", "nitro/*"],
383
- jsx: "automatic",
384
- logLevel: "silent",
385
- sourcemap: "inline"
378
+ externalPackages: true,
379
+ external: [/^@farm\.js\/core(?:\/|$)/, /^nitro(?:\/|$)/]
386
380
  });
387
381
  try {
388
382
  return await import(
@@ -6,7 +6,7 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
6
6
  var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
7
7
 
8
8
 
9
- var _chunkB3WK4DTXcjs = require('./chunk-B3WK4DTX.cjs');
9
+ var _chunkIMBMOEWTcjs = require('./chunk-IMBMOEWT.cjs');
10
10
 
11
11
 
12
12
  var _chunkN4RLRSWWcjs = require('./chunk-N4RLRSWW.cjs');
@@ -105,7 +105,7 @@ function farmApiPlugin(options = {}) {
105
105
  const existing = apiRoutesCache.get(routePath);
106
106
  const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
107
107
  if (existingFile) {
108
- throw new (0, _chunkB3WK4DTXcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
108
+ throw new (0, _chunkIMBMOEWTcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
109
109
  }
110
110
  if (existing) {
111
111
  if (!existing.methods.includes(normalizedMethod)) {
@@ -268,7 +268,7 @@ function farmApiPlugin(options = {}) {
268
268
  log(`API route discovered: ${availableMethods.join(", ")} ${routePath}`);
269
269
  }
270
270
  } catch (e) {
271
- if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
271
+ if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
272
272
  log(`API route load failed at ${filePath}: ${e.message}`);
273
273
  }
274
274
  }
@@ -295,7 +295,7 @@ function farmApiPlugin(options = {}) {
295
295
  }
296
296
  }
297
297
  } catch (e) {
298
- if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
298
+ if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
299
299
  log(`Root routes.ts load failed: ${e.message}`);
300
300
  }
301
301
  break;
@@ -326,7 +326,7 @@ function farmApiPlugin(options = {}) {
326
326
  }
327
327
  }
328
328
  } catch (e) {
329
- if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
329
+ if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
330
330
  log(`Programmatic routes file load failed at ${routeFile}: ${e.message}`);
331
331
  }
332
332
  }
@@ -503,7 +503,7 @@ function farmApiPlugin(options = {}) {
503
503
  log(`API router recreated`);
504
504
  } catch (e) {
505
505
  restoreRouteState(previousState);
506
- if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
506
+ if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
507
507
  log(`Root routes.ts HMR failed: ${e.message}`);
508
508
  }
509
509
  return [];
@@ -541,7 +541,7 @@ function farmApiPlugin(options = {}) {
541
541
  log(`API router recreated`);
542
542
  } catch (e) {
543
543
  restoreRouteState(previousState);
544
- if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
544
+ if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
545
545
  log(`API route HMR failed: ${e.message}`);
546
546
  }
547
547
  return [];
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  APITypeGenerator
3
- } from "./chunk-3NM6SRI6.mjs";
3
+ } from "./chunk-F3VB7ONA.mjs";
4
4
  import {
5
5
  __name,
6
6
  __require
@@ -0,0 +1,97 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-LPEX4YW6.mjs";
4
+
5
+ // src/build/node-module-bundle.ts
6
+ import { isBuiltin } from "module";
7
+ import path from "path";
8
+ import { stripVTControlCharacters } from "util";
9
+ var NON_PACKAGE_SPECIFIER_RE = /^(?:[./\\#]|[A-Za-z]:[\\/])/;
10
+ function isPackageSpecifier(specifier) {
11
+ return !specifier.startsWith("\0") && !NON_PACKAGE_SPECIFIER_RE.test(specifier) && !path.isAbsolute(specifier);
12
+ }
13
+ __name(isPackageSpecifier, "isPackageSpecifier");
14
+ var DECLARATION_FILE_RE = /\.d\.(?:[^./\\]+\.)?[cm]?ts$/;
15
+ function isDeclarationFile(id) {
16
+ return DECLARATION_FILE_RE.test(id.split("?", 1)[0]);
17
+ }
18
+ __name(isDeclarationFile, "isDeclarationFile");
19
+ var packageResolvers = /* @__PURE__ */ new Map();
20
+ async function resolvePackageWithoutTsconfig(source, importer, kind) {
21
+ const condition = kind === "require-call" ? "require" : "import";
22
+ let resolver = packageResolvers.get(condition);
23
+ if (!resolver) {
24
+ resolver = import("rolldown/experimental").then(
25
+ ({ ResolverFactory }) => new ResolverFactory({
26
+ conditionNames: [condition, "node", "default"],
27
+ mainFields: ["main", "module"]
28
+ })
29
+ );
30
+ packageResolvers.set(condition, resolver);
31
+ }
32
+ const result = await (await resolver).async(path.dirname(importer), source);
33
+ return result.path ?? null;
34
+ }
35
+ __name(resolvePackageWithoutTsconfig, "resolvePackageWithoutTsconfig");
36
+ async function bundleNodeModule(options) {
37
+ const { rolldown } = await import("rolldown");
38
+ const plugins = options.externalPackages ? [externalizePackagesPlugin()] : [];
39
+ plugins.push(...options.plugins ?? []);
40
+ try {
41
+ const bundle = await rolldown({
42
+ cwd: options.root,
43
+ input: options.entry,
44
+ platform: "node",
45
+ logLevel: "silent",
46
+ external: options.external,
47
+ plugins,
48
+ // Package imports stay external by the path they were found at (as esbuild
49
+ // did), so a workspace symlink is not mistaken for a local alias target.
50
+ resolve: options.externalPackages ? { symlinks: false } : void 0,
51
+ transform: { target: options.target, jsx: { runtime: "automatic" } }
52
+ });
53
+ try {
54
+ await bundle.write({
55
+ file: options.outfile,
56
+ format: "esm",
57
+ sourcemap: "inline",
58
+ codeSplitting: false
59
+ });
60
+ } finally {
61
+ await bundle.close();
62
+ }
63
+ } catch (error) {
64
+ throw withPlainDiagnostics(error);
65
+ }
66
+ }
67
+ __name(bundleNodeModule, "bundleNodeModule");
68
+ function externalizePackagesPlugin() {
69
+ return {
70
+ name: "farm-externalize-packages",
71
+ async resolveId(source, importer, extraOptions) {
72
+ if (!importer || !isPackageSpecifier(source) || isBuiltin(source)) return null;
73
+ const resolved = await this.resolve(source, importer, {
74
+ kind: extraOptions.kind,
75
+ skipSelf: true
76
+ });
77
+ if (resolved && !resolved.external && !resolved.id.startsWith("\0") && !resolved.id.split(/[\\/]/).includes("node_modules") && !isDeclarationFile(resolved.id)) {
78
+ return resolved;
79
+ }
80
+ return { id: source, external: true };
81
+ }
82
+ };
83
+ }
84
+ __name(externalizePackagesPlugin, "externalizePackagesPlugin");
85
+ function withPlainDiagnostics(error) {
86
+ if (!(error instanceof Error)) return error;
87
+ error.message = stripVTControlCharacters(error.message);
88
+ if (typeof error.stack === "string") error.stack = stripVTControlCharacters(error.stack);
89
+ return error;
90
+ }
91
+ __name(withPlainDiagnostics, "withPlainDiagnostics");
92
+
93
+ export {
94
+ isDeclarationFile,
95
+ resolvePackageWithoutTsconfig,
96
+ bundleNodeModule
97
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkCIAGU2X4cjs = require('./chunk-CIAGU2X4.cjs');
3
+ var _chunkXSIRSMAScjs = require('./chunk-XSIRSMAS.cjs');
4
4
 
5
5
 
6
6
 
@@ -603,7 +603,7 @@ var _OpenAPIManager = class _OpenAPIManager {
603
603
  this.appDir = appDirs[appDirs.length - 1];
604
604
  this.config = config;
605
605
  this.generator = new OpenAPIGenerator(this.appDir, config, context);
606
- this.apiTypeGenerator = new (0, _chunkCIAGU2X4cjs.APITypeGenerator)(appDirs);
606
+ this.apiTypeGenerator = new (0, _chunkXSIRSMAScjs.APITypeGenerator)(appDirs);
607
607
  }
608
608
  /**
609
609
  * Generate OpenAPI spec from API routes
@@ -0,0 +1,97 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
4
+
5
+ // src/build/node-module-bundle.ts
6
+ var _module = require('module');
7
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
8
+ var _util = require('util');
9
+ var NON_PACKAGE_SPECIFIER_RE = /^(?:[./\\#]|[A-Za-z]:[\\/])/;
10
+ function isPackageSpecifier(specifier) {
11
+ return !specifier.startsWith("\0") && !NON_PACKAGE_SPECIFIER_RE.test(specifier) && !_path2.default.isAbsolute(specifier);
12
+ }
13
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isPackageSpecifier, "isPackageSpecifier");
14
+ var DECLARATION_FILE_RE = /\.d\.(?:[^./\\]+\.)?[cm]?ts$/;
15
+ function isDeclarationFile(id) {
16
+ return DECLARATION_FILE_RE.test(id.split("?", 1)[0]);
17
+ }
18
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isDeclarationFile, "isDeclarationFile");
19
+ var packageResolvers = /* @__PURE__ */ new Map();
20
+ async function resolvePackageWithoutTsconfig(source, importer, kind) {
21
+ const condition = kind === "require-call" ? "require" : "import";
22
+ let resolver = packageResolvers.get(condition);
23
+ if (!resolver) {
24
+ resolver = import("rolldown/experimental").then(
25
+ ({ ResolverFactory }) => new ResolverFactory({
26
+ conditionNames: [condition, "node", "default"],
27
+ mainFields: ["main", "module"]
28
+ })
29
+ );
30
+ packageResolvers.set(condition, resolver);
31
+ }
32
+ const result = await (await resolver).async(_path2.default.dirname(importer), source);
33
+ return _nullishCoalesce(result.path, () => ( null));
34
+ }
35
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolvePackageWithoutTsconfig, "resolvePackageWithoutTsconfig");
36
+ async function bundleNodeModule(options) {
37
+ const { rolldown } = await import("rolldown");
38
+ const plugins = options.externalPackages ? [externalizePackagesPlugin()] : [];
39
+ plugins.push(..._nullishCoalesce(options.plugins, () => ( [])));
40
+ try {
41
+ const bundle = await rolldown({
42
+ cwd: options.root,
43
+ input: options.entry,
44
+ platform: "node",
45
+ logLevel: "silent",
46
+ external: options.external,
47
+ plugins,
48
+ // Package imports stay external by the path they were found at (as esbuild
49
+ // did), so a workspace symlink is not mistaken for a local alias target.
50
+ resolve: options.externalPackages ? { symlinks: false } : void 0,
51
+ transform: { target: options.target, jsx: { runtime: "automatic" } }
52
+ });
53
+ try {
54
+ await bundle.write({
55
+ file: options.outfile,
56
+ format: "esm",
57
+ sourcemap: "inline",
58
+ codeSplitting: false
59
+ });
60
+ } finally {
61
+ await bundle.close();
62
+ }
63
+ } catch (error) {
64
+ throw withPlainDiagnostics(error);
65
+ }
66
+ }
67
+ _chunkS3JO3N4Hcjs.__name.call(void 0, bundleNodeModule, "bundleNodeModule");
68
+ function externalizePackagesPlugin() {
69
+ return {
70
+ name: "farm-externalize-packages",
71
+ async resolveId(source, importer, extraOptions) {
72
+ if (!importer || !isPackageSpecifier(source) || _module.isBuiltin.call(void 0, source)) return null;
73
+ const resolved = await this.resolve(source, importer, {
74
+ kind: extraOptions.kind,
75
+ skipSelf: true
76
+ });
77
+ if (resolved && !resolved.external && !resolved.id.startsWith("\0") && !resolved.id.split(/[\\/]/).includes("node_modules") && !isDeclarationFile(resolved.id)) {
78
+ return resolved;
79
+ }
80
+ return { id: source, external: true };
81
+ }
82
+ };
83
+ }
84
+ _chunkS3JO3N4Hcjs.__name.call(void 0, externalizePackagesPlugin, "externalizePackagesPlugin");
85
+ function withPlainDiagnostics(error) {
86
+ if (!(error instanceof Error)) return error;
87
+ error.message = _util.stripVTControlCharacters.call(void 0, error.message);
88
+ if (typeof error.stack === "string") error.stack = _util.stripVTControlCharacters.call(void 0, error.stack);
89
+ return error;
90
+ }
91
+ _chunkS3JO3N4Hcjs.__name.call(void 0, withPlainDiagnostics, "withPlainDiagnostics");
92
+
93
+
94
+
95
+
96
+
97
+ exports.isDeclarationFile = isDeclarationFile; exports.resolvePackageWithoutTsconfig = resolvePackageWithoutTsconfig; exports.bundleNodeModule = bundleNodeModule;
@@ -1,4 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+ var _chunkUYIHRDE4cjs = require('./chunk-UYIHRDE4.cjs');
6
+
2
7
 
3
8
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
4
9
 
@@ -146,62 +151,47 @@ function toExternalSpecifier(resolvedPath) {
146
151
  return _path2.default.isAbsolute(resolvedPath) ? _url.pathToFileURL.call(void 0, resolvedPath).href : resolvedPath;
147
152
  }
148
153
  _chunkS3JO3N4Hcjs.__name.call(void 0, toExternalSpecifier, "toExternalSpecifier");
154
+ var BARE_SPECIFIER_RE = /^[^./]/;
149
155
  function createFarmConfigResolutionPlugin(options) {
150
156
  const configEntryChecks = /* @__PURE__ */ new Map();
151
157
  return {
152
158
  name: "farm-config-package-resolution",
153
- setup(pluginBuild) {
154
- pluginBuild.onResolve({ filter: /^@farm\.js\/core$/ }, async (args) => {
155
- if (_optionalChain([args, 'access', _ => _.pluginData, 'optionalAccess', _2 => _2.farmConfigExternal]) || args.kind !== "import-statement" || !args.importer) {
156
- return;
157
- }
158
- let configEntryCheck = configEntryChecks.get(args.importer);
159
- if (!configEntryCheck) {
160
- configEntryCheck = onlyImportsFarmConfigHelpers(args.importer, options.transform);
161
- configEntryChecks.set(args.importer, configEntryCheck);
162
- }
163
- if (!await configEntryCheck) return;
164
- const resolved = await pluginBuild.resolve(FARM_CONFIG_ENTRY, {
165
- importer: args.importer,
166
- kind: args.kind,
167
- namespace: args.namespace,
168
- resolveDir: args.resolveDir,
169
- pluginData: { farmConfigExternal: true }
159
+ async resolveId(source, importer, extraOptions) {
160
+ if (!importer || extraOptions.isEntry || !BARE_SPECIFIER_RE.test(source) || source.startsWith("\0") || _module.isBuiltin.call(void 0, source) || _path2.default.isAbsolute(source) || WINDOWS_ABSOLUTE_PATH_RE.test(source)) {
161
+ return null;
162
+ }
163
+ const resolveRuntimePath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (specifier) => {
164
+ const resolved = await this.resolve(specifier, importer, {
165
+ kind: extraOptions.kind,
166
+ skipSelf: true
170
167
  });
171
- if (resolved.errors.length > 0 || !resolved.path) return;
172
- return {
173
- path: toExternalSpecifier(resolved.path),
174
- external: true,
175
- warnings: resolved.warnings
176
- };
177
- });
178
- pluginBuild.onResolve({ filter: /^[^./]/ }, async (args) => {
179
- if (args.kind === "entry-point" || _path2.default.isAbsolute(args.path) || WINDOWS_ABSOLUTE_PATH_RE.test(args.path)) {
180
- return;
168
+ if (!_optionalChain([resolved, 'optionalAccess', _ => _.id]) || !_chunkUYIHRDE4cjs.isDeclarationFile.call(void 0, resolved.id)) return _optionalChain([resolved, 'optionalAccess', _2 => _2.id]);
169
+ return await _asyncNullishCoalesce(await _chunkUYIHRDE4cjs.resolvePackageWithoutTsconfig.call(void 0, specifier, importer, extraOptions.kind), async () => ( void 0));
170
+ }, "resolveRuntimePath");
171
+ if (source === FARM_CORE_PACKAGE && extraOptions.kind === "import-statement") {
172
+ let configEntryCheck = configEntryChecks.get(importer);
173
+ if (!configEntryCheck) {
174
+ configEntryCheck = onlyImportsFarmConfigHelpers(importer, options.transform);
175
+ configEntryChecks.set(importer, configEntryCheck);
181
176
  }
182
- if (_optionalChain([args, 'access', _3 => _3.pluginData, 'optionalAccess', _4 => _4.farmConfigExternal])) return;
183
- const resolved = await pluginBuild.resolve(args.path, {
184
- importer: args.importer,
185
- kind: args.kind,
186
- namespace: args.namespace,
187
- resolveDir: args.resolveDir,
188
- pluginData: { farmConfigExternal: true }
189
- });
190
- if (resolved.errors.length > 0 || !resolved.path) {
191
- return { path: args.path, external: true };
177
+ if (await configEntryCheck) {
178
+ const configEntry = await resolveRuntimePath(FARM_CONFIG_ENTRY);
179
+ if (configEntry) {
180
+ return { id: toExternalSpecifier(configEntry), external: true };
181
+ }
192
182
  }
193
- return {
194
- path: toExternalSpecifier(resolved.path),
195
- external: true,
196
- warnings: resolved.warnings
197
- };
198
- });
183
+ }
184
+ const resolvedId = await resolveRuntimePath(source);
185
+ if (!resolvedId) {
186
+ return { id: source, external: true };
187
+ }
188
+ return { id: toExternalSpecifier(resolvedId), external: true };
199
189
  }
200
190
  };
201
191
  }
202
192
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmConfigResolutionPlugin, "createFarmConfigResolutionPlugin");
203
193
  async function loadFarmConfigFile(configPath, options) {
204
- const { build, transform } = await import("esbuild");
194
+ const { transform } = await import("rolldown/utils");
205
195
  const cacheRoot = _path2.default.resolve(options.cacheRoot || options.root);
206
196
  const configCacheDir = _path2.default.join(cacheRoot, ".farm", ".config-loader");
207
197
  await _promises.mkdir.call(void 0, configCacheDir, { recursive: true });
@@ -209,18 +199,12 @@ async function loadFarmConfigFile(configPath, options) {
209
199
  configCacheDir,
210
200
  `farm-config-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
211
201
  );
212
- await build({
213
- absWorkingDir: _path2.default.resolve(options.root),
214
- entryPoints: [_path2.default.resolve(configPath)],
202
+ await _chunkUYIHRDE4cjs.bundleNodeModule.call(void 0, {
203
+ root: _path2.default.resolve(options.root),
204
+ entry: _path2.default.resolve(configPath),
215
205
  outfile: modulePath,
216
- bundle: true,
217
- format: "esm",
218
- platform: "node",
219
206
  target: `node${process.versions.node.split(".")[0]}`,
220
- plugins: [createFarmConfigResolutionPlugin({ transform })],
221
- jsx: "automatic",
222
- logLevel: "silent",
223
- sourcemap: "inline"
207
+ plugins: [createFarmConfigResolutionPlugin({ transform })]
224
208
  });
225
209
  const moduleUrl = `${_url.pathToFileURL.call(void 0, modulePath).href}?t=${Date.now()}`;
226
210
  try {
@@ -242,12 +226,12 @@ async function onlyImportsFarmConfigHelpers(importer, transform) {
242
226
  try {
243
227
  const source = _fs.readFileSync.call(void 0, importer, "utf8");
244
228
  if (!source.includes(FARM_CORE_PACKAGE)) return false;
245
- const transformed = await transform(source, {
246
- format: "esm",
247
- jsx: "automatic",
248
- loader: getEsbuildLoader(importer),
249
- sourcefile: importer
229
+ const transformed = await transform(importer, source, {
230
+ lang: getSourceLang(importer),
231
+ sourceType: "module",
232
+ jsx: { runtime: "automatic" }
250
233
  });
234
+ if (transformed.errors.length > 0) return false;
251
235
  const references = [...transformed.code.matchAll(FARM_CORE_REFERENCE_RE)];
252
236
  if (references.length === 0) return false;
253
237
  const safeImportRanges = [];
@@ -268,7 +252,7 @@ async function onlyImportsFarmConfigHelpers(importer, transform) {
268
252
  }
269
253
  }
270
254
  _chunkS3JO3N4Hcjs.__name.call(void 0, onlyImportsFarmConfigHelpers, "onlyImportsFarmConfigHelpers");
271
- function getEsbuildLoader(file) {
255
+ function getSourceLang(file) {
272
256
  switch (_path2.default.extname(file)) {
273
257
  case ".ts":
274
258
  case ".mts":
@@ -282,7 +266,7 @@ function getEsbuildLoader(file) {
282
266
  return "js";
283
267
  }
284
268
  }
285
- _chunkS3JO3N4Hcjs.__name.call(void 0, getEsbuildLoader, "getEsbuildLoader");
269
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getSourceLang, "getSourceLang");
286
270
  function normalizeLayerEntries(value, owner) {
287
271
  if (value === void 0) return [];
288
272
  if (!Array.isArray(value)) {