@farm.js/core 0.1.18 → 0.1.20
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.
- package/dist/agent-runtime.d.mts +2 -3
- package/dist/agent-runtime.d.ts +2 -3
- package/dist/api/route-manager.cjs +5 -5
- package/dist/api/route-manager.d.mts +2 -3
- package/dist/api/route-manager.d.ts +2 -3
- package/dist/api/route-manager.mjs +4 -4
- package/dist/api.cjs +6 -6
- package/dist/api.d.mts +3 -4
- package/dist/api.d.ts +3 -4
- package/dist/api.mjs +5 -5
- package/dist/{app-BHY_10Lm.d.ts → app-DAyPE-gr.d.ts} +11 -4
- package/dist/{app-BMk0do23.d.mts → app-D_6nTit-.d.mts} +11 -4
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +3 -4
- package/dist/app-markdown.d.ts +3 -4
- package/dist/app-markdown.mjs +3 -3
- package/dist/{chunk-FS7FLPOG.mjs → chunk-2J7W2WND.mjs} +3 -2
- package/dist/{chunk-YS3TRKCG.mjs → chunk-2M435BUE.mjs} +6 -1
- package/dist/{chunk-WJ3HK3LJ.cjs → chunk-2QLBIPFT.cjs} +4 -4
- package/dist/{chunk-FJSWYIR7.cjs → chunk-3IL5UC5I.cjs} +2 -2
- package/dist/chunk-43FMW62B.mjs +67 -0
- package/dist/{chunk-A7T6345N.mjs → chunk-5UX4C5QI.mjs} +10 -7
- package/dist/{chunk-KPNVGRBL.mjs → chunk-5V37LKBG.mjs} +105 -41
- package/dist/chunk-75WGQVQA.cjs +46 -0
- package/dist/{chunk-ZCNJKLA2.mjs → chunk-7BC6GAL7.mjs} +1 -1
- package/dist/{chunk-J2OP5GG3.cjs → chunk-A777V5WU.cjs} +28 -28
- package/dist/{chunk-NWOD6NIT.cjs → chunk-A7T6JZNI.cjs} +1 -1
- package/dist/{chunk-E2BMSZ2W.cjs → chunk-AH7HOAQ3.cjs} +2 -2
- package/dist/{chunk-AFOD3LYZ.cjs → chunk-B3WK4DTX.cjs} +10 -9
- package/dist/{chunk-TWGMSEHX.cjs → chunk-BBVSJVBZ.cjs} +88 -13
- package/dist/{chunk-AORPIPNB.cjs → chunk-BHJUZ64B.cjs} +18 -14
- package/dist/chunk-BMWDEBXO.cjs +67 -0
- package/dist/{chunk-ATERBVHQ.mjs → chunk-CQHFU55R.mjs} +5 -4
- package/dist/{chunk-XSKZORAS.cjs → chunk-DX4VKYAJ.cjs} +5 -5
- package/dist/{chunk-AWRISO2H.cjs → chunk-E2ROOWQC.cjs} +30 -4
- package/dist/{chunk-3XG26Z3J.mjs → chunk-F7E2AZKQ.mjs} +1 -1
- package/dist/{chunk-7WPA7GBZ.mjs → chunk-GHFS7RUB.mjs} +1 -1
- package/dist/{chunk-UN5GHC5V.cjs → chunk-GQFSCBKJ.cjs} +249 -185
- package/dist/{chunk-NZ2JVBT2.mjs → chunk-GZ3ZPTQV.mjs} +2 -2
- package/dist/{chunk-DHDVMXYK.mjs → chunk-HALDNTIV.mjs} +30 -4
- package/dist/{chunk-5QOEPUYE.mjs → chunk-HSDL2AUR.mjs} +1 -1
- package/dist/{chunk-BSTRERPP.cjs → chunk-I5YBCWQ6.cjs} +2 -2
- package/dist/{chunk-TYQUSXUG.cjs → chunk-ISTFC3MZ.cjs} +4 -4
- package/dist/{chunk-RKQVJN2O.mjs → chunk-JIKGGIOL.mjs} +1 -1
- package/dist/{chunk-GYKJCFTS.mjs → chunk-K6MG3SEG.mjs} +124 -82
- package/dist/{chunk-OXSIH4D6.cjs → chunk-KNPRCKXK.cjs} +6 -1
- package/dist/{chunk-TNBAYAWO.mjs → chunk-L4DVIHOC.mjs} +1 -1
- package/dist/{chunk-XWAYMDLB.mjs → chunk-MVUREHPN.mjs} +1 -1
- package/dist/{chunk-6VQIKZZO.mjs → chunk-N255VYFP.mjs} +1 -1
- package/dist/{chunk-GNEO2XOF.cjs → chunk-NBAHDVOJ.cjs} +4 -4
- package/dist/{chunk-EN7WTEAY.mjs → chunk-NRS46D4L.mjs} +2 -2
- package/dist/{chunk-A72YEUZ3.mjs → chunk-OCE65DDM.mjs} +1 -1
- package/dist/{chunk-SXHV42UQ.mjs → chunk-OFEY6KHO.mjs} +88 -13
- package/dist/{chunk-OIEOCXKG.cjs → chunk-OYDRPBBV.cjs} +2 -2
- package/dist/{chunk-76DG3LF3.mjs → chunk-PGQBL5DN.mjs} +1 -1
- package/dist/{chunk-UDBJCUPA.mjs → chunk-PUCUVI7K.mjs} +11 -7
- package/dist/{chunk-IKNRN4VS.cjs → chunk-PZX6I4JW.cjs} +462 -420
- package/dist/{chunk-GDSHDTJ4.cjs → chunk-Q5B3KJBP.cjs} +2 -2
- package/dist/{chunk-TSWW5BVH.mjs → chunk-QMV4QELL.mjs} +1 -1
- package/dist/{chunk-QGVJVSNX.mjs → chunk-RMIJFZU3.mjs} +28 -4
- package/dist/{chunk-MKB2EGIR.cjs → chunk-SOR334EB.cjs} +3 -2
- package/dist/{chunk-57J3Y7Y3.mjs → chunk-TIKNUAU7.mjs} +3 -2
- package/dist/chunk-VVBO3QH7.mjs +46 -0
- package/dist/{chunk-UTBVHYS3.mjs → chunk-W7MZXRXM.mjs} +20 -5
- package/dist/{chunk-Y53ZSFN6.cjs → chunk-WM6HL7E7.cjs} +4 -3
- package/dist/{chunk-WZMNW2IW.cjs → chunk-XFFQSD2F.cjs} +4 -4
- package/dist/{chunk-62YJ2IEB.cjs → chunk-XI3GWPUS.cjs} +23 -20
- package/dist/{chunk-KVFPGF2M.cjs → chunk-YJJLXIIS.cjs} +7 -7
- package/dist/{chunk-NV3A5DXM.cjs → chunk-YP5JZ4LF.cjs} +42 -18
- package/dist/{chunk-B4CH33IG.cjs → chunk-ZE6ONQ5R.cjs} +39 -24
- package/dist/{client-plugins-JXXmZliS.d.mts → client-plugins-CWrhb1ir.d.mts} +26 -3
- package/dist/{client-plugins-C089bQhN.d.ts → client-plugins-DPf0qZey.d.ts} +26 -3
- package/dist/client-plugins.d.mts +2 -3
- package/dist/client-plugins.d.ts +2 -3
- package/dist/client.cjs +4 -4
- package/dist/client.d.mts +9 -38
- package/dist/client.d.ts +9 -38
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +2 -3
- package/dist/config.d.ts +2 -3
- package/dist/{devtools-UFVTMQX5.mjs → devtools-MTB5SA2B.mjs} +5 -5
- package/dist/{devtools-OUIPHVV6.cjs → devtools-R6MDDAZK.cjs} +9 -9
- package/dist/docs.cjs +9 -8
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +8 -7
- package/dist/index.cjs +29 -28
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +28 -27
- package/dist/integrations.d.mts +2 -3
- package/dist/integrations.d.ts +2 -3
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -3
- package/dist/internal/app-markdown-runtime.d.ts +2 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +22 -21
- package/dist/internal/build-runtime.d.mts +4 -5
- package/dist/internal/build-runtime.d.ts +4 -5
- package/dist/internal/build-runtime.mjs +21 -20
- package/dist/internal/cli-runtime.cjs +12 -12
- package/dist/internal/cli-runtime.mjs +11 -11
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +2 -3
- package/dist/internal/compression-runtime.d.ts +2 -3
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.d.mts +3 -4
- package/dist/internal/config-runtime.d.ts +3 -4
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +5 -5
- package/dist/internal/production-runtime.d.mts +8 -9
- package/dist/internal/production-runtime.d.ts +8 -9
- package/dist/internal/production-runtime.mjs +4 -4
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.mjs +1 -1
- package/dist/{metadata-C1Z9vLbb.d.mts → metadata-CO9fRyyJ.d.mts} +1 -1
- package/dist/{metadata-BcNJP4fq.d.ts → metadata-zY9wltwH.d.ts} +1 -1
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +4 -11
- package/dist/middleware.d.ts +4 -11
- package/dist/middleware.mjs +3 -3
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +42 -3
- package/dist/navigation.d.ts +42 -3
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-CVZ36JM5.mjs → nitro-4LFVTT24.mjs} +2 -2
- package/dist/{nitro-4I2MYLY2.cjs → nitro-TSGDUJMN.cjs} +3 -3
- package/dist/plugin.cjs +23 -17
- package/dist/plugin.d.mts +3 -4
- package/dist/plugin.d.ts +3 -4
- package/dist/plugin.mjs +23 -17
- package/dist/{production-runtime-jcrTlRTb.d.mts → production-runtime-CywsHwnG.d.mts} +1 -1
- package/dist/{production-runtime-oKmC0WU-.d.ts → production-runtime-lkfwujwK.d.ts} +1 -1
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-DOB9cV-h.d.ts → render-plan-DHF0GeWo.d.ts} +1 -1
- package/dist/{render-plan-BLIfc4jt.d.mts → render-plan-LVy6sGQe.d.mts} +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +4 -5
- package/dist/renderer-client.d.ts +4 -5
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +3 -0
- package/dist/renderer.d.ts +3 -0
- package/dist/{request-Cr53NRHr.d.mts → request-6AkmhEYE.d.mts} +1 -1
- package/dist/{request-Dt2gNuQD.d.ts → request-BYxlRqA9.d.ts} +1 -1
- package/dist/request.d.mts +3 -4
- package/dist/request.d.ts +3 -4
- package/dist/{route-rendering-CWYd8Mv1.d.ts → route-rendering-CWaKiUbS.d.ts} +1 -1
- package/dist/{route-rendering-CeFBEAoZ.d.mts → route-rendering-Dd8Jmml7.d.mts} +1 -1
- package/dist/router-B2m4fvve.d.ts +50 -0
- package/dist/router-xwEE112q.d.mts +50 -0
- package/dist/routes.cjs +3 -3
- package/dist/routes.d.mts +2 -3
- package/dist/routes.d.ts +2 -3
- package/dist/routes.mjs +2 -2
- package/dist/{schema-dev-notice-2IE2F2XI.mjs → schema-dev-notice-O67CPXJ6.mjs} +1 -1
- package/dist/{schema-dev-notice-MXSZMVDG.cjs → schema-dev-notice-Y7MQEFGN.cjs} +3 -3
- package/dist/server-plugins.d.mts +3 -4
- package/dist/server-plugins.d.ts +3 -4
- package/dist/server.cjs +33 -32
- package/dist/server.d.mts +8 -9
- package/dist/server.d.ts +8 -9
- package/dist/server.mjs +19 -18
- package/dist/{spa-router-CQWiYGxS.d.mts → spa-router-DVEHQnWo.d.mts} +3 -3
- package/dist/{spa-router-Wjiw-8hB.d.ts → spa-router-Y8rrXTVK.d.ts} +3 -3
- package/dist/testing.cjs +6 -6
- package/dist/testing.d.mts +2 -3
- package/dist/testing.d.ts +2 -3
- package/dist/testing.mjs +5 -5
- package/dist/{types-D-1WTE72.d.mts → types-DFbjpjXX.d.mts} +8 -0
- package/dist/{types-D-1WTE72.d.ts → types-DFbjpjXX.d.ts} +8 -0
- package/dist/{utils-uUxF0K0P.d.mts → utils-DSPx34-A.d.mts} +1 -1
- package/dist/{utils-B0XJmG_b.d.ts → utils-Dvuny_08.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +18 -17
- package/dist/vite.d.mts +2 -3
- package/dist/vite.d.ts +2 -3
- package/dist/vite.mjs +17 -16
- package/package.json +3 -3
- package/dist/chunk-7GNWGLWB.mjs +0 -14
- package/dist/chunk-VQDBNVOO.cjs +0 -14
- package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
- package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
- /package/dist/{chunk-IAMRBF3Z.cjs → chunk-N4RLRSWW.cjs} +0 -0
- /package/dist/{chunk-BNGS6KJ6.mjs → chunk-YOYF2E4U.mjs} +0 -0
|
@@ -11,7 +11,7 @@ var _chunkKGZIORNLcjs = require('./chunk-KGZIORNL.cjs');
|
|
|
11
11
|
var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkBBVSJVBZcjs = require('./chunk-BBVSJVBZ.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
|
|
@@ -1194,11 +1194,11 @@ function shouldReturnMarkdown(request) {
|
|
|
1194
1194
|
if (url.pathname.endsWith(".md")) return true;
|
|
1195
1195
|
const accept = request.headers.get("accept");
|
|
1196
1196
|
const markdown = Math.max(
|
|
1197
|
-
|
|
1198
|
-
|
|
1197
|
+
_chunkBBVSJVBZcjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
|
|
1198
|
+
_chunkBBVSJVBZcjs.farmAcceptQuality.call(void 0, accept, "text/plain")
|
|
1199
1199
|
);
|
|
1200
1200
|
if (markdown <= 0) return false;
|
|
1201
|
-
return markdown >=
|
|
1201
|
+
return markdown >= _chunkBBVSJVBZcjs.farmAcceptQuality.call(void 0, accept, "text/html", { wildcards: true });
|
|
1202
1202
|
}
|
|
1203
1203
|
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldReturnMarkdown, "shouldReturnMarkdown");
|
|
1204
1204
|
function escapeAttribute(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readSchemaTables
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HALDNTIV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
resolveSchemaModels
|
|
6
6
|
} from "./chunk-ZMSZZXOR.mjs";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "./chunk-OLYK7EAK.mjs";
|
|
27
27
|
import {
|
|
28
28
|
discoverProgrammaticRoutePaths
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-YOYF2E4U.mjs";
|
|
30
30
|
import {
|
|
31
31
|
readFarmI18nCatalogs
|
|
32
32
|
} from "./chunk-FV45CKBC.mjs";
|
|
@@ -145,9 +145,13 @@ var BLOCK_TAGS = /<\/?(ul|ol|main|section|article|header|footer|nav|aside|div|fo
|
|
|
145
145
|
var BOX_TAGS = /<\/?(label|button|input|select|textarea|option|output|meter|progress|td|th)\b[^>]*>/gi;
|
|
146
146
|
function htmlToMarkdown(html, options = {}) {
|
|
147
147
|
const title = options.title ?? extractHtmlTitle(html);
|
|
148
|
+
const streamed = readStreamedBoundaryInstructions(html);
|
|
148
149
|
let source = extractHtmlBody(
|
|
149
150
|
removeHiddenElements(
|
|
150
|
-
|
|
151
|
+
resolveStreamedBoundaries(
|
|
152
|
+
html.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi, ""),
|
|
153
|
+
streamed
|
|
154
|
+
).replace(/<!--[\s\S]*?-->/g, "")
|
|
151
155
|
)
|
|
152
156
|
);
|
|
153
157
|
const codeBlocks = [];
|
|
@@ -422,6 +426,7 @@ var VOID_TAGS = /* @__PURE__ */ new Set([
|
|
|
422
426
|
]);
|
|
423
427
|
function removeHiddenElements(html) {
|
|
424
428
|
const openingTag = /<([a-zA-Z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g;
|
|
429
|
+
let closingTags;
|
|
425
430
|
let result = "";
|
|
426
431
|
let cursor = 0;
|
|
427
432
|
let match;
|
|
@@ -431,7 +436,8 @@ function removeHiddenElements(html) {
|
|
|
431
436
|
const start = match.index;
|
|
432
437
|
let end = start + tag.length;
|
|
433
438
|
if (!VOID_TAGS.has(name.toLowerCase()) && !isSelfClosingTag(tag)) {
|
|
434
|
-
|
|
439
|
+
closingTags ?? (closingTags = matchClosingTags(html));
|
|
440
|
+
const close = closingTags.get(start);
|
|
435
441
|
if (close === void 0) continue;
|
|
436
442
|
end = close;
|
|
437
443
|
}
|
|
@@ -458,24 +464,93 @@ function isSelfClosingTag(tag) {
|
|
|
458
464
|
return /(?:^<[a-zA-Z][\w:-]*|[\s"'])\/>$/.test(tag);
|
|
459
465
|
}
|
|
460
466
|
__name(isSelfClosingTag, "isSelfClosingTag");
|
|
461
|
-
function
|
|
467
|
+
function matchClosingTags(html) {
|
|
462
468
|
const tags = /<(\/?)([a-zA-Z][\w:-]*)(?:[^>"']|"[^"]*"|'[^']*')*>/g;
|
|
463
|
-
|
|
464
|
-
const
|
|
465
|
-
let depth = 1;
|
|
469
|
+
const open = /* @__PURE__ */ new Map();
|
|
470
|
+
const closes = /* @__PURE__ */ new Map();
|
|
466
471
|
let match;
|
|
467
472
|
while (match = tags.exec(html)) {
|
|
468
|
-
|
|
473
|
+
const name = match[2].toLowerCase();
|
|
469
474
|
if (match[1]) {
|
|
470
|
-
|
|
471
|
-
if (
|
|
472
|
-
} else if (!isSelfClosingTag(match[0])) {
|
|
473
|
-
|
|
475
|
+
const start = open.get(name)?.pop();
|
|
476
|
+
if (start !== void 0) closes.set(start, match.index + match[0].length);
|
|
477
|
+
} else if (!VOID_TAGS.has(name) && !isSelfClosingTag(match[0])) {
|
|
478
|
+
let starts = open.get(name);
|
|
479
|
+
if (!starts) open.set(name, starts = []);
|
|
480
|
+
starts.push(match.index);
|
|
474
481
|
}
|
|
475
482
|
}
|
|
476
|
-
return
|
|
483
|
+
return closes;
|
|
484
|
+
}
|
|
485
|
+
__name(matchClosingTags, "matchClosingTags");
|
|
486
|
+
function readStreamedBoundaryInstructions(html) {
|
|
487
|
+
const boundaries = /* @__PURE__ */ new Map();
|
|
488
|
+
const placeholders = /* @__PURE__ */ new Map();
|
|
489
|
+
for (const [, script] of html.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi)) {
|
|
490
|
+
for (const [, kind, first, second] of script.matchAll(
|
|
491
|
+
/\$R([CRS])\("([^"\\]+)","([^"\\]+)"/g
|
|
492
|
+
)) {
|
|
493
|
+
if (kind === "S") placeholders.set(second, first);
|
|
494
|
+
else boundaries.set(first, second);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return { boundaries, placeholders };
|
|
498
|
+
}
|
|
499
|
+
__name(readStreamedBoundaryInstructions, "readStreamedBoundaryInstructions");
|
|
500
|
+
function resolveStreamedBoundaries(html, { boundaries, placeholders }) {
|
|
501
|
+
if (boundaries.size === 0 && placeholders.size === 0) return html;
|
|
502
|
+
const wanted = /* @__PURE__ */ new Set([...boundaries.values(), ...placeholders.values()]);
|
|
503
|
+
const segments = /* @__PURE__ */ new Map();
|
|
504
|
+
const closingTags = matchClosingTags(html);
|
|
505
|
+
const openingTag = /<([a-zA-Z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g;
|
|
506
|
+
let page = "";
|
|
507
|
+
let cursor = 0;
|
|
508
|
+
let match;
|
|
509
|
+
while (match = openingTag.exec(html)) {
|
|
510
|
+
const id = /\sid="([^"]*)"/.exec(match[2])?.[1];
|
|
511
|
+
if (!id || !wanted.has(id) || segments.has(id)) continue;
|
|
512
|
+
const close = closingTags.get(match.index);
|
|
513
|
+
if (close === void 0) continue;
|
|
514
|
+
const contentStart = match.index + match[0].length;
|
|
515
|
+
segments.set(id, html.slice(contentStart, html.lastIndexOf("<", close - 1)));
|
|
516
|
+
page += html.slice(cursor, match.index);
|
|
517
|
+
cursor = close;
|
|
518
|
+
openingTag.lastIndex = close;
|
|
519
|
+
}
|
|
520
|
+
page += html.slice(cursor);
|
|
521
|
+
const used = /* @__PURE__ */ new Set();
|
|
522
|
+
const expand = /* @__PURE__ */ __name((fragment) => {
|
|
523
|
+
const template = /<template\b[^>]*\sid="([^"]+)"[^>]*>\s*<\/template>/gi;
|
|
524
|
+
let output = "";
|
|
525
|
+
let position = 0;
|
|
526
|
+
let found;
|
|
527
|
+
while (found = template.exec(fragment)) {
|
|
528
|
+
const id = found[1];
|
|
529
|
+
const segmentId = boundaries.get(id) ?? placeholders.get(id);
|
|
530
|
+
const segment = segmentId === void 0 ? void 0 : segments.get(segmentId);
|
|
531
|
+
if (segment === void 0 || used.has(segmentId)) continue;
|
|
532
|
+
used.add(segmentId);
|
|
533
|
+
output += fragment.slice(position, found.index) + expand(segment);
|
|
534
|
+
position = found.index + found[0].length;
|
|
535
|
+
if (boundaries.has(id)) {
|
|
536
|
+
const marker = /<!--(\/?)(?:\$[?!~]?|&)-->/g;
|
|
537
|
+
marker.lastIndex = position;
|
|
538
|
+
let depth = 0;
|
|
539
|
+
let end;
|
|
540
|
+
while (end = marker.exec(fragment)) {
|
|
541
|
+
if (!end[1]) depth += 1;
|
|
542
|
+
else if (depth === 0) break;
|
|
543
|
+
else depth -= 1;
|
|
544
|
+
}
|
|
545
|
+
if (end) position = end.index;
|
|
546
|
+
}
|
|
547
|
+
template.lastIndex = position;
|
|
548
|
+
}
|
|
549
|
+
return output + fragment.slice(position);
|
|
550
|
+
}, "expand");
|
|
551
|
+
return expand(page);
|
|
477
552
|
}
|
|
478
|
-
__name(
|
|
553
|
+
__name(resolveStreamedBoundaries, "resolveStreamedBoundaries");
|
|
479
554
|
function stripTags(input) {
|
|
480
555
|
return input.replace(/<[^>]+>/g, "");
|
|
481
556
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkOWOUTKIJcjs = require('./chunk-OWOUTKIJ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkISTFC3MZcjs = require('./chunk-ISTFC3MZ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
|
|
@@ -197,7 +197,7 @@ function createFarmMetadataRouteResponse(kind, value, routeModule = {}, options
|
|
|
197
197
|
if (isResponse(value)) {
|
|
198
198
|
return method === "HEAD" ? _chunkTKJZFIMLcjs.omitFarmResponseBody.call(void 0, value) : value;
|
|
199
199
|
}
|
|
200
|
-
const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ?
|
|
200
|
+
const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ? _chunkISTFC3MZcjs.serializeFarmLlmsTxt.call(void 0, value) : serializeManifest(value);
|
|
201
201
|
const contentType = kind === "sitemap" ? "application/xml; charset=utf-8" : kind === "robots" || kind === "llms" || kind === "llms-full" ? "text/plain; charset=utf-8" : "application/manifest+json; charset=utf-8";
|
|
202
202
|
return new Response(method === "HEAD" ? null : body, {
|
|
203
203
|
headers: {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-IOEH4VWN.mjs";
|
|
7
7
|
import {
|
|
8
8
|
APIRouteConflictError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CQHFU55R.mjs";
|
|
10
10
|
import {
|
|
11
11
|
findProgrammaticRouteFilesInDir
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YOYF2E4U.mjs";
|
|
13
13
|
import {
|
|
14
14
|
isFarmAPIRouteFileName
|
|
15
15
|
} from "./chunk-CU625VAY.mjs";
|
|
@@ -31,6 +31,9 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
createCliColors
|
|
33
33
|
} from "./chunk-I2BHUNBU.mjs";
|
|
34
|
+
import {
|
|
35
|
+
loadFarmDevModule
|
|
36
|
+
} from "./chunk-43FMW62B.mjs";
|
|
34
37
|
import {
|
|
35
38
|
toPosixPath,
|
|
36
39
|
toViteModuleId
|
|
@@ -249,7 +252,7 @@ function farmApiPlugin(options = {}) {
|
|
|
249
252
|
try {
|
|
250
253
|
const relativePath = path.relative(apiDir, path.dirname(filePath));
|
|
251
254
|
const routePath = "/api/" + (relativePath === "." ? "" : relativePath.replace(/\\/g, "/"));
|
|
252
|
-
const routeModule = await server
|
|
255
|
+
const routeModule = await loadFarmDevModule(server, filePath);
|
|
253
256
|
const endpoints = {};
|
|
254
257
|
const availableMethods = [];
|
|
255
258
|
for (const method of API_ROUTE_METHODS) {
|
|
@@ -281,7 +284,7 @@ function farmApiPlugin(options = {}) {
|
|
|
281
284
|
for (const routesFile of routesFiles) {
|
|
282
285
|
if (fs.existsSync(routesFile)) {
|
|
283
286
|
try {
|
|
284
|
-
const routesModule = await server
|
|
287
|
+
const routesModule = await loadFarmDevModule(server, routesFile);
|
|
285
288
|
for (const [exportName, exportValue] of Object.entries(routesModule)) {
|
|
286
289
|
const endpoint = exportValue;
|
|
287
290
|
if (endpoint && endpoint.__path) {
|
|
@@ -307,7 +310,8 @@ function farmApiPlugin(options = {}) {
|
|
|
307
310
|
const { getProgrammaticRouteManifest } = await import("./routes.mjs");
|
|
308
311
|
for (const routeFile of routeFiles) {
|
|
309
312
|
try {
|
|
310
|
-
const routesModule = await
|
|
313
|
+
const routesModule = await loadFarmDevModule(
|
|
314
|
+
server,
|
|
311
315
|
toViteModuleId(routeFile, server.config.root)
|
|
312
316
|
);
|
|
313
317
|
const manifest = getProgrammaticRouteManifest(routesModule);
|
|
@@ -471,7 +475,7 @@ function farmApiPlugin(options = {}) {
|
|
|
471
475
|
if (await recoverFailedDiscovery?.()) return [];
|
|
472
476
|
const previousState = snapshotRouteState();
|
|
473
477
|
try {
|
|
474
|
-
const routesModule = await server
|
|
478
|
+
const routesModule = await loadFarmDevModule(server, file);
|
|
475
479
|
removeEndpointsFromFile(file);
|
|
476
480
|
for (const [exportName, exportValue] of Object.entries(routesModule)) {
|
|
477
481
|
const endpoint = exportValue;
|
|
@@ -524,7 +528,7 @@ function farmApiPlugin(options = {}) {
|
|
|
524
528
|
log(`API route file removed: ${routePath}`);
|
|
525
529
|
return [];
|
|
526
530
|
}
|
|
527
|
-
const routeModule = await server
|
|
531
|
+
const routeModule = await loadFarmDevModule(server, file);
|
|
528
532
|
removeEndpointsFromFile(file);
|
|
529
533
|
const availableMethods = [];
|
|
530
534
|
for (const method of API_ROUTE_METHODS) {
|