@farm.js/core 0.1.28 → 0.1.29
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 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/api/route-manager.d.mts +1 -1
- package/dist/api/route-manager.d.ts +1 -1
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.cjs +2 -2
- package/dist/api.d.mts +18 -4
- package/dist/api.d.ts +18 -4
- package/dist/api.mjs +1 -1
- package/dist/{app-DSSq6wiN.d.mts → app-DAuUTIZf.d.mts} +3 -3
- package/dist/app-markdown.cjs +5 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +4 -3
- package/dist/{app-M8nVWvNU.d.ts → app-sUJ3jnTZ.d.ts} +3 -3
- package/dist/{chunk-N6UROPT7.mjs → chunk-2FQHH5SC.mjs} +12 -13
- package/dist/{chunk-2CNBR3EB.mjs → chunk-2UABTL3Y.mjs} +2 -2
- package/dist/{chunk-JUFRXDTK.cjs → chunk-3FCFQP5V.cjs} +17 -5
- package/dist/{chunk-FVCSLZWT.mjs → chunk-5KDPVSS3.mjs} +268 -152
- package/dist/{chunk-XSPGWQWA.cjs → chunk-6CNX6Q3K.cjs} +96 -24
- package/dist/{chunk-NVBS5WSZ.mjs → chunk-6G3ZZ2IE.mjs} +1 -1
- package/dist/{chunk-QBPXNZGV.cjs → chunk-6MVFL3R5.cjs} +25 -6
- package/dist/{chunk-F52CDFJM.cjs → chunk-74T3CEA7.cjs} +388 -272
- package/dist/{chunk-PZPDGOU5.mjs → chunk-7CXKSRKL.mjs} +11 -7
- package/dist/{chunk-K3YEZLSY.mjs → chunk-ATXI6LGT.mjs} +96 -24
- package/dist/{chunk-2DLN6HG4.mjs → chunk-BZ3CHOFX.mjs} +1 -1
- package/dist/{chunk-EWZ3XHKQ.cjs → chunk-BZAGKCKB.cjs} +2 -2
- package/dist/{chunk-FB3H4INL.mjs → chunk-D234YWNA.mjs} +1 -1
- package/dist/{chunk-KXGDXYUC.mjs → chunk-DGXN3L4D.mjs} +17 -5
- package/dist/{chunk-UX2DD2VK.mjs → chunk-E7UN576T.mjs} +1 -1
- package/dist/chunk-FJ3M4CUX.cjs +46 -0
- package/dist/chunk-FXEF4PPL.mjs +47 -0
- package/dist/{chunk-KOQ555NR.cjs → chunk-JFHKNFEO.cjs} +24 -20
- package/dist/{chunk-BYODCJD6.cjs → chunk-K7CELQLK.cjs} +12 -13
- package/dist/{chunk-A672WZEG.cjs → chunk-NPPL5YDT.cjs} +2 -2
- package/dist/{chunk-TII23GJC.cjs → chunk-NXG66MR7.cjs} +3 -3
- package/dist/{chunk-R6AIILII.cjs → chunk-OZVEHHMA.cjs} +15 -14
- package/dist/{chunk-T7HQ3I4C.mjs → chunk-PQD2AI3B.mjs} +1 -1
- package/dist/{chunk-VQXDC5UV.cjs → chunk-Q5JFU33Q.cjs} +4 -4
- package/dist/{chunk-FZC7EEPM.mjs → chunk-RSOJ7DRT.mjs} +26 -7
- package/dist/{chunk-Y7GW7J46.cjs → chunk-WPPX4G7Q.cjs} +1 -1
- package/dist/{chunk-ID6OVSLH.cjs → chunk-X4ZV4QC5.cjs} +175 -171
- package/dist/chunk-XD32KALF.cjs +47 -0
- package/dist/{chunk-RDV44SED.mjs → chunk-XJJVLDM6.mjs} +15 -14
- package/dist/{chunk-55ZY4ZA7.cjs → chunk-XLTV4VOG.cjs} +21 -16
- package/dist/{chunk-REGFZJEJ.mjs → chunk-YMUE7L3D.mjs} +18 -13
- package/dist/chunk-Z3HATSKO.mjs +46 -0
- package/dist/{chunk-MH24QDVJ.cjs → chunk-ZDILFMWN.cjs} +13 -13
- package/dist/{chunk-ZRIE4KMG.mjs → chunk-ZYVFAOBT.mjs} +17 -13
- package/dist/{client-plugins-CgYNY7jF.d.mts → client-plugins-BX2ptm4H.d.mts} +7 -2
- package/dist/{client-plugins-Fl9Og3yB.d.ts → client-plugins-BmxM5KW_.d.ts} +7 -2
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/{devtools-5AREISIA.cjs → devtools-GGVPZHJX.cjs} +95 -20
- package/dist/{devtools-3E7ZANMZ.mjs → devtools-THVNPI2M.mjs} +79 -4
- package/dist/{devtools-client-4WAPJY5L.cjs → devtools-client-CXQ6PXI6.cjs} +1 -1
- package/dist/{devtools-client-LEUIHHAS.mjs → devtools-client-HJS2T34Y.mjs} +1 -1
- package/dist/docs.cjs +8 -7
- package/dist/docs.mjs +7 -6
- package/dist/index.cjs +18 -16
- package/dist/index.d.mts +24 -14
- package/dist/index.d.ts +24 -14
- package/dist/index.mjs +17 -15
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.cjs +4 -3
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.mjs +3 -2
- package/dist/internal/build-runtime.cjs +15 -13
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +14 -12
- package/dist/internal/cli-runtime.cjs +7 -6
- package/dist/internal/cli-runtime.mjs +6 -5
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.cjs +3 -2
- package/dist/internal/compression-runtime.d.mts +5 -3
- package/dist/internal/compression-runtime.d.ts +5 -3
- package/dist/internal/compression-runtime.mjs +2 -1
- package/dist/internal/config-runtime.cjs +6 -5
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/product-telemetry-runtime.cjs +10 -6
- package/dist/internal/product-telemetry-runtime.mjs +9 -5
- package/dist/internal/production-runtime.cjs +19 -5
- package/dist/internal/production-runtime.d.mts +35 -8
- package/dist/internal/production-runtime.d.ts +35 -8
- package/dist/internal/production-runtime.mjs +18 -4
- package/dist/markdown.cjs +3 -2
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.mjs +2 -1
- package/dist/{metadata-B0X-qtcQ.d.mts → metadata-DsEaK7mQ.d.mts} +1 -1
- package/dist/{metadata-BdDKgd7K.d.ts → metadata-fwZ3gfG6.d.ts} +1 -1
- package/dist/middleware.cjs +3 -2
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.ts +3 -3
- package/dist/middleware.mjs +2 -1
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/plugin.cjs +10 -9
- package/dist/plugin.d.mts +2 -2
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.mjs +9 -8
- package/dist/{production-runtime-BjgFgDIg.d.mts → production-runtime-Baqgwtvc.d.mts} +1 -1
- package/dist/{production-runtime-Dx_qMA3t.d.ts → production-runtime-DNkpFnmg.d.ts} +1 -1
- package/dist/{render-plan-_1TAWODt.d.mts → render-plan-DhwQnmmX.d.mts} +1 -1
- package/dist/{render-plan-B41EWmBb.d.ts → render-plan-rkIK9wd9.d.ts} +1 -1
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/{request-Dbf3G0zM.d.ts → request-BcY4RYPC.d.ts} +1 -1
- package/dist/{request-BhE4luLv.d.mts → request-CFy1BltJ.d.mts} +1 -1
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/{route-rendering-zzfx_GHf.d.mts → route-rendering-BkS0TBlB.d.mts} +1 -1
- package/dist/{route-rendering-Z7PveTZE.d.ts → route-rendering-D4XpMjam.d.ts} +1 -1
- package/dist/{router-BatNMsa1.d.mts → router-C4zPlC3V.d.mts} +1 -1
- package/dist/{router-DtNRhQl3.d.ts → router-Cq7BcZxg.d.ts} +1 -1
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/server-plugins.cjs +3 -2
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +2 -1
- package/dist/server.cjs +33 -28
- package/dist/server.d.mts +8 -8
- package/dist/server.d.ts +8 -8
- package/dist/server.mjs +16 -11
- package/dist/{spa-router-BE3bwU-J.d.ts → spa-router-B1HI3X9k.d.ts} +2 -2
- package/dist/{spa-router-DQOnHZVj.d.mts → spa-router-DzPZH-AO.d.mts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils-DLK1ERNl.d.mts → utils-CEBktlBG.d.mts} +1 -1
- package/dist/{utils-u7ZBSWAK.d.ts → utils-DMD1Hzta.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +10 -9
- package/dist/vite.d.mts +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.mjs +9 -8
- package/package.json +1 -1
|
@@ -13,6 +13,9 @@ var _chunkXGC343EYcjs = require('./chunk-XGC343EY.cjs');
|
|
|
13
13
|
var _chunkE3UK5IIBcjs = require('./chunk-E3UK5IIB.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
var _chunkFJ3M4CUXcjs = require('./chunk-FJ3M4CUX.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
var _chunkOX6O6WVAcjs = require('./chunk-OX6O6WVA.cjs');
|
|
@@ -637,21 +640,17 @@ function applyProductionMiddlewareHeaders(response, middlewareHeaders) {
|
|
|
637
640
|
if (!middlewareHeaders || Array.from(middlewareHeaders.keys()).length === 0) {
|
|
638
641
|
return response;
|
|
639
642
|
}
|
|
640
|
-
const headers = new Headers(response.headers);
|
|
641
643
|
const getSetCookie = middlewareHeaders.getSetCookie;
|
|
642
644
|
const setCookies = getSetCookie ? getSetCookie.call(middlewareHeaders) : middlewareHeaders.get("set-cookie") ? [middlewareHeaders.get("set-cookie")] : [];
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
status: response.status,
|
|
653
|
-
statusText: response.statusText,
|
|
654
|
-
headers
|
|
645
|
+
return _chunkFJ3M4CUXcjs._withFarmResponseHeaders.call(void 0, response, (headers) => {
|
|
646
|
+
for (const [key, value] of middlewareHeaders) {
|
|
647
|
+
if (key.toLowerCase() === "set-cookie") continue;
|
|
648
|
+
if (headers.has(key)) continue;
|
|
649
|
+
headers.set(key, value);
|
|
650
|
+
}
|
|
651
|
+
for (const cookie of setCookies) {
|
|
652
|
+
headers.append("Set-Cookie", cookie);
|
|
653
|
+
}
|
|
655
654
|
});
|
|
656
655
|
}
|
|
657
656
|
_chunkS3JO3N4Hcjs.__name.call(void 0, applyProductionMiddlewareHeaders, "applyProductionMiddlewareHeaders");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkOWOUTKIJcjs = require('./chunk-OWOUTKIJ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkXLTV4VOGcjs = require('./chunk-XLTV4VOG.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
|
|
@@ -210,7 +210,7 @@ function createFarmMetadataRouteResponse(kind, value, routeModule = {}, options
|
|
|
210
210
|
if (isResponse(value)) {
|
|
211
211
|
return method === "HEAD" ? _chunkTKJZFIMLcjs.omitFarmResponseBody.call(void 0, value) : value;
|
|
212
212
|
}
|
|
213
|
-
const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ?
|
|
213
|
+
const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ? _chunkXLTV4VOGcjs.serializeFarmLlmsTxt.call(void 0, value) : serializeManifest(value);
|
|
214
214
|
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";
|
|
215
215
|
return new Response(method === "HEAD" ? null : body, {
|
|
216
216
|
headers: {
|
|
@@ -1,7 +1,7 @@
|
|
|
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(); } } 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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk6CNX6Q3Kcjs = require('./chunk-6CNX6Q3K.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -116,7 +116,7 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
116
116
|
}
|
|
117
117
|
const url = new URL(options.request.url);
|
|
118
118
|
const hasMarkdownExtension = url.pathname.toLowerCase().endsWith(".md");
|
|
119
|
-
if (!hasMarkdownExtension && !
|
|
119
|
+
if (!hasMarkdownExtension && !_chunk6CNX6Q3Kcjs.requestAcceptsMarkdown.call(void 0, options.request.headers.get("accept"))) {
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
122
122
|
const targetPathname = normalizeFarmMarkdownRoutePath(url.pathname);
|
|
@@ -134,7 +134,7 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
134
134
|
if (!hasMarkdownExtension) {
|
|
135
135
|
headers.set("Vary", "Accept");
|
|
136
136
|
}
|
|
137
|
-
return
|
|
137
|
+
return _chunk6CNX6Q3Kcjs.createFarmMarkdownViewResponse.call(void 0, {
|
|
138
138
|
request: options.request,
|
|
139
139
|
requestUrl: url,
|
|
140
140
|
markdown: source.source,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }
|
|
2
2
|
|
|
3
|
+
var _chunkFJ3M4CUXcjs = require('./chunk-FJ3M4CUX.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
7
|
|
|
5
8
|
// src/plugins/compression.ts
|
|
@@ -57,8 +60,12 @@ function isCompressibleMediaType(mediaType) {
|
|
|
57
60
|
return COMPRESSIBLE_MEDIA_TYPE_SUFFIXES.some((suffix) => mediaType.endsWith(suffix));
|
|
58
61
|
}
|
|
59
62
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isCompressibleMediaType, "isCompressibleMediaType");
|
|
60
|
-
function isCompressionEligible(request, response) {
|
|
61
|
-
if (
|
|
63
|
+
function isCompressionEligible(request, response, bufferedText) {
|
|
64
|
+
if (
|
|
65
|
+
// Known buffered text proves a body without reading response.body, which
|
|
66
|
+
// would create a lazy response's Web stream.
|
|
67
|
+
request.method !== "HEAD" && bufferedText === void 0 && !response.body || response.status === 204 || response.status === 205 || response.status === 304 || response.headers.has("content-encoding") || response.headers.has("content-range") || _optionalChain([response, 'access', _11 => _11.headers, 'access', _12 => _12.get, 'call', _13 => _13("cache-control"), 'optionalAccess', _14 => _14.toLowerCase, 'call', _15 => _15(), 'access', _16 => _16.includes, 'call', _17 => _17("no-transform")])
|
|
68
|
+
) {
|
|
62
69
|
return false;
|
|
63
70
|
}
|
|
64
71
|
const mediaType = _optionalChain([response, 'access', _18 => _18.headers, 'access', _19 => _19.get, 'call', _20 => _20("content-type"), 'optionalAccess', _21 => _21.split, 'call', _22 => _22(";", 1), 'access', _23 => _23[0], 'optionalAccess', _24 => _24.trim, 'call', _25 => _25(), 'access', _26 => _26.toLowerCase, 'call', _27 => _27()]);
|
|
@@ -88,9 +95,9 @@ function compressedHeaders(response, encoding) {
|
|
|
88
95
|
return headers;
|
|
89
96
|
}
|
|
90
97
|
_chunkS3JO3N4Hcjs.__name.call(void 0, compressedHeaders, "compressedHeaders");
|
|
91
|
-
function compressBufferedResponse(response, text, encoding) {
|
|
98
|
+
function compressBufferedResponse(response, text, encoding, lazyBody) {
|
|
92
99
|
const headers = compressedHeaders(response, encoding);
|
|
93
|
-
_optionalChain([response, 'access', _28 => _28.body, 'optionalAccess', _29 => _29.cancel, 'call', _30 => _30(), 'access', _31 => _31.catch, 'call', _32 => _32(() => {
|
|
100
|
+
if (!lazyBody) _optionalChain([response, 'access', _28 => _28.body, 'optionalAccess', _29 => _29.cancel, 'call', _30 => _30(), 'access', _31 => _31.catch, 'call', _32 => _32(() => {
|
|
94
101
|
})]);
|
|
95
102
|
const input = Buffer.from(text);
|
|
96
103
|
let cancelled = false;
|
|
@@ -143,21 +150,15 @@ function compressResponse(response, encoding) {
|
|
|
143
150
|
}
|
|
144
151
|
_chunkS3JO3N4Hcjs.__name.call(void 0, compressResponse, "compressResponse");
|
|
145
152
|
function varyIdentityResponse(response) {
|
|
146
|
-
|
|
147
|
-
appendVary(headers, "Accept-Encoding");
|
|
148
|
-
return new Response(response.body, {
|
|
149
|
-
status: response.status,
|
|
150
|
-
statusText: response.statusText,
|
|
151
|
-
headers
|
|
152
|
-
});
|
|
153
|
+
return _chunkFJ3M4CUXcjs._withFarmResponseHeaders.call(void 0, response, (headers) => appendVary(headers, "Accept-Encoding"));
|
|
153
154
|
}
|
|
154
155
|
_chunkS3JO3N4Hcjs.__name.call(void 0, varyIdentityResponse, "varyIdentityResponse");
|
|
155
|
-
function compressFarmResponse(request, response, bufferedText) {
|
|
156
|
-
if (!isCompressionEligible(request, response)) return response;
|
|
156
|
+
function compressFarmResponse(request, response, bufferedText, lazyBody = false) {
|
|
157
|
+
if (!isCompressionEligible(request, response, bufferedText)) return response;
|
|
157
158
|
if (request.method === "HEAD") return varyIdentityResponse(response);
|
|
158
159
|
const encoding = selectEncoding(_nullishCoalesce(request.headers.get("accept-encoding"), () => ( "")));
|
|
159
160
|
if (!encoding) return varyIdentityResponse(response);
|
|
160
|
-
return bufferedText === void 0 ? compressResponse(response, encoding) : compressBufferedResponse(response, bufferedText, encoding);
|
|
161
|
+
return bufferedText === void 0 ? compressResponse(response, encoding) : compressBufferedResponse(response, bufferedText, encoding, lazyBody);
|
|
161
162
|
}
|
|
162
163
|
_chunkS3JO3N4Hcjs.__name.call(void 0, compressFarmResponse, "compressFarmResponse");
|
|
163
164
|
function createCompressionPlugin({
|
|
@@ -15,7 +15,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
15
15
|
var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk6CNX6Q3Kcjs = require('./chunk-6CNX6Q3K.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
|
|
@@ -1181,11 +1181,11 @@ function shouldReturnMarkdown(request) {
|
|
|
1181
1181
|
if (url.pathname.endsWith(".md")) return true;
|
|
1182
1182
|
const accept = request.headers.get("accept");
|
|
1183
1183
|
const markdown = Math.max(
|
|
1184
|
-
|
|
1185
|
-
|
|
1184
|
+
_chunk6CNX6Q3Kcjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
|
|
1185
|
+
_chunk6CNX6Q3Kcjs.farmAcceptQuality.call(void 0, accept, "text/plain")
|
|
1186
1186
|
);
|
|
1187
1187
|
if (markdown <= 0) return false;
|
|
1188
|
-
return markdown >=
|
|
1188
|
+
return markdown >= _chunk6CNX6Q3Kcjs.farmAcceptQuality.call(void 0, accept, "text/html", { wildcards: true });
|
|
1189
1189
|
}
|
|
1190
1190
|
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldReturnMarkdown, "shouldReturnMarkdown");
|
|
1191
1191
|
function escapeAttribute(value) {
|
|
@@ -336,32 +336,49 @@ function assertPluginDependencies(plugins, integrations) {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
const state = /* @__PURE__ */ new Map();
|
|
339
|
-
const
|
|
339
|
+
const path3 = [];
|
|
340
340
|
const visit = /* @__PURE__ */ __name((plugin) => {
|
|
341
341
|
if (state.get(plugin) === "done") return;
|
|
342
342
|
if (state.get(plugin) === "visiting") {
|
|
343
|
-
const cycle = [...
|
|
343
|
+
const cycle = [...path3.slice(path3.indexOf(plugin)), plugin].map(
|
|
344
344
|
(entry) => pluginShortName(entry.name)
|
|
345
345
|
);
|
|
346
346
|
throw new Error(`Plugins depend on each other in a cycle: ${cycle.join(" \u2192 ")}.`);
|
|
347
347
|
}
|
|
348
348
|
state.set(plugin, "visiting");
|
|
349
|
-
|
|
349
|
+
path3.push(plugin);
|
|
350
350
|
for (const dependency of plugin.dependsOn ?? []) {
|
|
351
351
|
for (const candidate of plugins) {
|
|
352
352
|
if (candidate !== plugin && matches(candidate, dependency)) visit(candidate);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
|
|
355
|
+
path3.pop();
|
|
356
356
|
state.set(plugin, "done");
|
|
357
357
|
}, "visit");
|
|
358
358
|
for (const plugin of plugins) visit(plugin);
|
|
359
359
|
}
|
|
360
360
|
__name(assertPluginDependencies, "assertPluginDependencies");
|
|
361
361
|
|
|
362
|
+
// src/utils/source-dir.ts
|
|
363
|
+
import path from "path";
|
|
364
|
+
var FARM_PROJECT_SOURCE_DIRS = /* @__PURE__ */ Symbol.for("farm.projectSourceDirs");
|
|
365
|
+
function getProjectSourceDirs() {
|
|
366
|
+
const globalState = globalThis;
|
|
367
|
+
return globalState[FARM_PROJECT_SOURCE_DIRS] ?? (globalState[FARM_PROJECT_SOURCE_DIRS] = /* @__PURE__ */ new Map());
|
|
368
|
+
}
|
|
369
|
+
__name(getProjectSourceDirs, "getProjectSourceDirs");
|
|
370
|
+
function setFarmProjectSourceDir(root, srcDir) {
|
|
371
|
+
getProjectSourceDirs().set(path.resolve(root), srcDir);
|
|
372
|
+
}
|
|
373
|
+
__name(setFarmProjectSourceDir, "setFarmProjectSourceDir");
|
|
374
|
+
function getFarmProjectSourceDir(root) {
|
|
375
|
+
return getProjectSourceDirs().get(path.resolve(root)) ?? "src";
|
|
376
|
+
}
|
|
377
|
+
__name(getFarmProjectSourceDir, "getFarmProjectSourceDir");
|
|
378
|
+
|
|
362
379
|
// src/auth-config.ts
|
|
363
380
|
import { createRequire } from "module";
|
|
364
|
-
import
|
|
381
|
+
import path2 from "path";
|
|
365
382
|
import { pathToFileURL } from "url";
|
|
366
383
|
function resolveFarmAuthConfig(input) {
|
|
367
384
|
const config = input === true ? {} : input && typeof input === "object" ? input : {};
|
|
@@ -392,10 +409,10 @@ function resolveFarmAuthConfig(input) {
|
|
|
392
409
|
__name(resolveFarmAuthConfig, "resolveFarmAuthConfig");
|
|
393
410
|
async function resolveFarmAuthIntegration(config, options) {
|
|
394
411
|
if (!config.enabled) return void 0;
|
|
395
|
-
const root =
|
|
412
|
+
const root = path2.resolve(options.root);
|
|
396
413
|
let modulePath;
|
|
397
414
|
try {
|
|
398
|
-
const resolveFromApp = createRequire(
|
|
415
|
+
const resolveFromApp = createRequire(path2.join(root, "package.json"));
|
|
399
416
|
modulePath = resolveFromApp.resolve("@farm.js/auth/internal");
|
|
400
417
|
} catch {
|
|
401
418
|
throw new Error(
|
|
@@ -478,6 +495,8 @@ function validateFarmAuthConfig(config) {
|
|
|
478
495
|
__name(validateFarmAuthConfig, "validateFarmAuthConfig");
|
|
479
496
|
|
|
480
497
|
export {
|
|
498
|
+
setFarmProjectSourceDir,
|
|
499
|
+
getFarmProjectSourceDir,
|
|
481
500
|
resolveFarmDevIndicatorsConfig,
|
|
482
501
|
generateFarmDevIndicatorsClientRuntime,
|
|
483
502
|
resolveFarmAuthConfig,
|