@farm.js/core 0.1.17 → 0.1.19
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/after.cjs +12 -225
- package/dist/agent-runtime.cjs +83 -2800
- package/dist/api/client.cjs +17 -4060
- package/dist/api/route-manager.cjs +34 -4354
- package/dist/api/runtime.cjs +29 -2696
- package/dist/api.cjs +88 -8434
- package/dist/app-markdown.cjs +39 -280
- package/dist/app-markdown.mjs +3 -3
- package/dist/cache.cjs +38 -1560
- package/dist/chunk-22GUSVNJ.cjs +351 -0
- package/dist/{chunk-EN7WTEAY.mjs → chunk-2ANEVVF7.mjs} +1 -1
- package/dist/chunk-2CQ74SP6.cjs +13 -0
- package/dist/{chunk-YD4J4XCI.mjs → chunk-2GNATDDE.mjs} +1 -1
- package/dist/chunk-2SJ4RQ6P.cjs +57 -0
- package/dist/chunk-3376ZTRC.cjs +1 -0
- package/dist/chunk-4PNUXIVU.cjs +472 -0
- package/dist/chunk-4PPEPOZZ.cjs +21 -0
- package/dist/chunk-4ZFL5GFN.cjs +520 -0
- package/dist/chunk-5OVTOKGH.cjs +65 -0
- package/dist/chunk-5QIKR7RR.cjs +224 -0
- package/dist/chunk-5ZSWG4UX.cjs +127 -0
- package/dist/chunk-62YJ2IEB.cjs +238 -0
- package/dist/chunk-6EODJYCX.cjs +183 -0
- package/dist/chunk-6EXBPJ24.cjs +434 -0
- package/dist/chunk-6QQDAAAZ.cjs +38 -0
- package/dist/chunk-6V4TDWEC.cjs +455 -0
- package/dist/chunk-72ADZ6GQ.cjs +19 -0
- package/dist/chunk-75BRBIFP.cjs +172 -0
- package/dist/{chunk-ZCNJKLA2.mjs → chunk-7BC6GAL7.mjs} +1 -1
- package/dist/chunk-7W3CPVXS.cjs +24 -0
- package/dist/chunk-A6WIQH5Z.cjs +31 -0
- package/dist/chunk-A777V5WU.cjs +725 -0
- package/dist/chunk-AFOD3LYZ.cjs +377 -0
- package/dist/chunk-AH7HOAQ3.cjs +151 -0
- package/dist/chunk-AMDMVWMI.cjs +39 -0
- package/dist/chunk-AORPIPNB.cjs +552 -0
- package/dist/chunk-ARJWXNQL.cjs +256 -0
- package/dist/chunk-AYJR42WX.cjs +711 -0
- package/dist/chunk-BBVSJVBZ.cjs +600 -0
- package/dist/chunk-BIDYX3SL.cjs +91 -0
- package/dist/chunk-BYODCJD6.cjs +663 -0
- package/dist/chunk-C3VRMB6H.cjs +85 -0
- package/dist/chunk-C5GUTBZK.cjs +173 -0
- package/dist/chunk-CIAGU2X4.cjs +337 -0
- package/dist/chunk-CMGMGHUZ.cjs +27 -0
- package/dist/chunk-CXP5U3RW.cjs +54 -0
- package/dist/chunk-D2ULAULS.cjs +166 -0
- package/dist/chunk-D7JTOLFK.cjs +285 -0
- package/dist/chunk-DVM4FKZL.cjs +169 -0
- package/dist/chunk-DYEJQTDN.cjs +49 -0
- package/dist/chunk-E2ROOWQC.cjs +2225 -0
- package/dist/chunk-E3UK5IIB.cjs +593 -0
- package/dist/chunk-EM6SBQKM.cjs +470 -0
- package/dist/chunk-FJSWYIR7.cjs +482 -0
- package/dist/chunk-FK6GO24V.cjs +54 -0
- package/dist/{chunk-MVIWBEJF.mjs → chunk-FVZGEVTO.mjs} +7 -7
- package/dist/chunk-FXUUWYAX.cjs +654 -0
- package/dist/chunk-G3HRIVEY.cjs +395 -0
- package/dist/chunk-G643DQCH.cjs +13 -0
- package/dist/chunk-G7HXGLEC.cjs +175 -0
- package/dist/chunk-GDSHDTJ4.cjs +152 -0
- package/dist/chunk-GPVTX3HT.cjs +1415 -0
- package/dist/chunk-H6G5INWM.cjs +1094 -0
- package/dist/{chunk-DHDVMXYK.mjs → chunk-HALDNTIV.mjs} +30 -4
- package/dist/chunk-HBTUGXHS.cjs +180 -0
- package/dist/chunk-HREOKQWT.cjs +45 -0
- package/dist/{chunk-5QOEPUYE.mjs → chunk-HSDL2AUR.mjs} +1 -1
- package/dist/chunk-I4J452B7.cjs +435 -0
- package/dist/chunk-I57LW5VZ.cjs +94 -0
- package/dist/chunk-I5YBCWQ6.cjs +40 -0
- package/dist/chunk-I7PUUDGY.cjs +389 -0
- package/dist/chunk-IAMRBF3Z.cjs +86 -0
- package/dist/chunk-IQXFRNY2.cjs +169 -0
- package/dist/chunk-ISTFC3MZ.cjs +1357 -0
- package/dist/chunk-IXTFU4PL.cjs +2355 -0
- package/dist/chunk-J3LOGE4T.cjs +42 -0
- package/dist/chunk-J7FSKED3.cjs +93 -0
- package/dist/chunk-JDNHKPTD.cjs +22 -0
- package/dist/chunk-JSROZYYO.cjs +164 -0
- package/dist/chunk-K6FNHVDR.cjs +696 -0
- package/dist/chunk-KGZIORNL.cjs +43 -0
- package/dist/chunk-KR6CKSXT.cjs +15 -0
- package/dist/chunk-KROWKCUH.cjs +185 -0
- package/dist/chunk-KVFPGF2M.cjs +46 -0
- package/dist/{chunk-TNBAYAWO.mjs → chunk-L4DVIHOC.mjs} +1 -1
- package/dist/chunk-LCCBO7PJ.cjs +46 -0
- package/dist/chunk-LIUGYUX3.cjs +22 -0
- package/dist/chunk-LTNGXMQ6.cjs +55 -0
- package/dist/chunk-M2L4MYDQ.cjs +14 -0
- package/dist/chunk-MCJLA63J.cjs +1 -0
- package/dist/chunk-MKB2EGIR.cjs +148 -0
- package/dist/chunk-MQ3H6LT5.cjs +202 -0
- package/dist/chunk-MT763TDW.cjs +43 -0
- package/dist/{chunk-XWAYMDLB.mjs → chunk-MVUREHPN.mjs} +1 -1
- package/dist/chunk-MWSK6C4J.cjs +18 -0
- package/dist/chunk-MWWVKDW3.cjs +169 -0
- package/dist/{chunk-6VQIKZZO.mjs → chunk-N255VYFP.mjs} +1 -1
- package/dist/chunk-NBAHDVOJ.cjs +2040 -0
- package/dist/chunk-NO3WWW3N.cjs +192 -0
- package/dist/chunk-NSFC3LHB.cjs +10244 -0
- package/dist/chunk-NZKJGRB3.cjs +230 -0
- package/dist/chunk-OAVTUMJP.cjs +1496 -0
- package/dist/{chunk-SXHV42UQ.mjs → chunk-OFEY6KHO.mjs} +88 -13
- package/dist/chunk-OHY2ZWUG.cjs +25 -0
- package/dist/chunk-OI6CMLWX.cjs +47 -0
- package/dist/chunk-OWOUTKIJ.cjs +558 -0
- package/dist/chunk-OX6O6WVA.cjs +74 -0
- package/dist/chunk-OXSIH4D6.cjs +476 -0
- package/dist/chunk-OYDRPBBV.cjs +453 -0
- package/dist/chunk-OYEUREB6.cjs +35 -0
- package/dist/chunk-PCOTGFSM.cjs +139 -0
- package/dist/{chunk-76DG3LF3.mjs → chunk-PGQBL5DN.mjs} +1 -1
- package/dist/chunk-PZYCPSCC.cjs +35 -0
- package/dist/chunk-QBK2AA4U.cjs +445 -0
- package/dist/{chunk-UTBVHYS3.mjs → chunk-QBPKKQTD.mjs} +2 -2
- package/dist/chunk-QBPXNZGV.cjs +487 -0
- package/dist/chunk-QNPEUFHQ.cjs +27 -0
- package/dist/chunk-QZRVZSPN.cjs +236 -0
- package/dist/chunk-R5A5KNVX.cjs +20 -0
- package/dist/chunk-R5JIFR6B.cjs +42 -0
- package/dist/chunk-R6AIILII.cjs +193 -0
- package/dist/chunk-RFYO7QUD.cjs +9 -0
- package/dist/chunk-RG3ZOTG5.cjs +34 -0
- package/dist/chunk-ROUTX2E5.cjs +390 -0
- package/dist/chunk-RTHIVJ2G.cjs +54 -0
- package/dist/chunk-S27FMYAM.cjs +644 -0
- package/dist/chunk-S3A45T7F.cjs +166 -0
- package/dist/chunk-S3JO3N4H.cjs +17 -0
- package/dist/chunk-SK35NQKK.cjs +27 -0
- package/dist/chunk-SU7MH53P.cjs +180 -0
- package/dist/chunk-SVRTJOUF.cjs +113 -0
- package/dist/chunk-SWN467MP.cjs +18 -0
- package/dist/chunk-SYQ3MOWW.cjs +73 -0
- package/dist/chunk-T5CERMEH.cjs +417 -0
- package/dist/chunk-TFAXUHWX.cjs +206 -0
- package/dist/chunk-TIWHTW3Q.cjs +24 -0
- package/dist/chunk-TKJZFIML.cjs +20 -0
- package/dist/chunk-TKNSDBBN.cjs +193 -0
- package/dist/chunk-U4KT7QP3.cjs +23 -0
- package/dist/chunk-U5BMPGS3.cjs +862 -0
- package/dist/chunk-UJ2C4ICS.cjs +277 -0
- package/dist/chunk-UQZ4AYTH.cjs +168 -0
- package/dist/chunk-US2QVW3E.cjs +36 -0
- package/dist/{chunk-QGVJVSNX.mjs → chunk-V4AICMQA.mjs} +2 -2
- package/dist/chunk-VB6UCX3V.cjs +421 -0
- package/dist/chunk-VEKFLAQM.cjs +300 -0
- package/dist/chunk-VQDBNVOO.cjs +14 -0
- package/dist/chunk-W4E7WMXE.cjs +71 -0
- package/dist/chunk-WJ3HK3LJ.cjs +1102 -0
- package/dist/chunk-WMAPPDMM.cjs +28 -0
- package/dist/chunk-WMOGFOUJ.cjs +223 -0
- package/dist/chunk-WPYFSQKK.cjs +37 -0
- package/dist/{chunk-56DAX2BE.mjs → chunk-WZXN4R5Y.mjs} +24 -13
- package/dist/chunk-XDGMADQM.cjs +14225 -0
- package/dist/chunk-XGC343EY.cjs +443 -0
- package/dist/chunk-XSKZORAS.cjs +727 -0
- package/dist/chunk-XWAWFQFS.cjs +82 -0
- package/dist/chunk-Y4YMF2NQ.cjs +460 -0
- package/dist/chunk-Y4YWHNKU.cjs +250 -0
- package/dist/chunk-Y53ZSFN6.cjs +504 -0
- package/dist/chunk-YA6LLTIJ.cjs +411 -0
- package/dist/chunk-YFPGHF5F.cjs +202 -0
- package/dist/chunk-YJRZR7VU.cjs +28 -0
- package/dist/chunk-YTAABQEV.cjs +1 -0
- package/dist/chunk-YX3DBN4M.cjs +18 -0
- package/dist/chunk-YZTASLPQ.cjs +64 -0
- package/dist/chunk-Z5HIWVDP.cjs +2173 -0
- package/dist/chunk-ZEG3OPIB.cjs +93 -0
- package/dist/chunk-ZMN3H73H.cjs +155 -0
- package/dist/client/lifecycle.cjs +6 -35
- package/dist/client-plugins.cjs +7 -448
- package/dist/client.cjs +171 -9808
- package/dist/config.cjs +8 -36
- package/dist/cron.cjs +24 -491
- package/dist/deferred.cjs +26 -475
- package/dist/deployment.cjs +39 -210
- package/dist/devtools-5KGPDVKL.cjs +388 -0
- package/dist/{devtools-UFVTMQX5.mjs → devtools-FY5R7TQ4.mjs} +3 -3
- package/dist/devtools-client-4WAPJY5L.cjs +254 -0
- package/dist/devtools-ui-5GBDIGMK.cjs +1296 -0
- package/dist/docs.cjs +46 -5657
- package/dist/docs.mjs +5 -5
- package/dist/env-types.cjs +5 -226
- package/dist/env.cjs +21 -338
- package/dist/environment/vite.cjs +8 -372
- package/dist/environment.cjs +12 -94
- package/dist/font.cjs +13 -63
- package/dist/headers.cjs +7 -123
- package/dist/i18n/client.cjs +55 -294
- package/dist/i18n/index.cjs +22 -209
- package/dist/i18n/server.cjs +22 -745
- package/dist/image/server.cjs +13 -729
- package/dist/image/sharp.cjs +33 -171
- package/dist/image.cjs +41 -85
- package/dist/index.cjs +1151 -68080
- package/dist/index.mjs +14 -14
- package/dist/instrumentation.cjs +12 -138
- package/dist/integration-orm-55F7CII5.cjs +13 -0
- package/dist/integrations.cjs +55 -4090
- package/dist/internal/app-markdown-runtime.cjs +27 -224
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +120 -52259
- package/dist/internal/build-runtime.mjs +13 -13
- package/dist/internal/cli-runtime.cjs +67 -13811
- package/dist/internal/cli-runtime.mjs +7 -7
- package/dist/internal/client-error-overlay.cjs +80 -733
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +81 -913
- package/dist/internal/compression-runtime.cjs +8 -214
- package/dist/internal/config-runtime.cjs +42 -6547
- package/dist/internal/config-runtime.mjs +3 -3
- package/dist/internal/docs-precompiled-runtime.cjs +26 -46
- package/dist/internal/infra-analytics-runtime.cjs +10 -536
- package/dist/internal/isolated-boundary.cjs +14 -414
- package/dist/internal/metadata-image-runtime.cjs +7 -285
- package/dist/internal/product-telemetry-runtime.cjs +42 -97
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-node-env.cjs +6 -63
- package/dist/internal/production-runtime.cjs +418 -7133
- package/dist/internal/production-runtime.mjs +3 -3
- package/dist/internal/request-cookies.cjs +6 -54
- package/dist/json-ld.cjs +24 -50
- package/dist/layers-E4WPJNY5.cjs +17 -0
- package/dist/manager-G4B2IPYE.cjs +14 -0
- package/dist/markdown.cjs +21 -547
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.cjs +36 -2995
- package/dist/navigation.cjs +22 -2588
- package/dist/nitro-4I2MYLY2.cjs +652 -0
- package/dist/observability.cjs +22 -614
- package/dist/og.cjs +5 -28
- package/dist/plugin.cjs +106 -37442
- package/dist/plugin.mjs +9 -9
- package/dist/query/client.cjs +113 -449
- package/dist/query/index.cjs +26 -288
- package/dist/query/parsers.cjs +23 -247
- package/dist/query/server.cjs +36 -298
- package/dist/renderer/react/client.cjs +9 -43
- package/dist/renderer/react/server.cjs +40 -103
- package/dist/renderer/react/vite.cjs +7 -29
- package/dist/renderer-client.cjs +126 -4295
- package/dist/renderer.cjs +31 -249
- package/dist/request.cjs +5 -68
- package/dist/router.cjs +11 -474
- package/dist/routes.cjs +42 -2461
- package/dist/{schema-dev-notice-2IE2F2XI.mjs → schema-dev-notice-O67CPXJ6.mjs} +1 -1
- package/dist/schema-dev-notice-Y7MQEFGN.cjs +56 -0
- package/dist/schema.cjs +6 -33
- package/dist/search-client-G3RICOFU.cjs +13 -0
- package/dist/server-action-security.cjs +25 -541
- package/dist/server-fn-client.cjs +6 -337
- package/dist/server-fn.cjs +32 -1841
- package/dist/server-plugins.cjs +15 -884
- package/dist/server-query-client.cjs +15 -1883
- package/dist/server-query.cjs +16 -1838
- package/dist/server.cjs +296 -44681
- package/dist/server.mjs +11 -11
- package/dist/storage.cjs +57 -576
- package/dist/testing.cjs +89 -3186
- package/dist/theme/client.cjs +13 -108
- package/dist/theme/index.cjs +6 -68
- package/dist/theme/runtime.cjs +13 -78
- package/dist/theme/server.cjs +10 -179
- package/dist/version.cjs +4 -32
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +119 -37773
- package/dist/vite.mjs +9 -9
- package/dist/workflows.cjs +19 -1040
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/client/document-head.ts
|
|
6
|
+
var FARM_NAVIGATION_HEAD_SELECTOR = [
|
|
7
|
+
"meta[name]",
|
|
8
|
+
"meta[property]",
|
|
9
|
+
"meta[http-equiv]",
|
|
10
|
+
"meta[charset]",
|
|
11
|
+
"meta[itemprop]",
|
|
12
|
+
'link[rel~="author"]',
|
|
13
|
+
'link[rel~="canonical"]',
|
|
14
|
+
'link[rel~="alternate"]',
|
|
15
|
+
'link[rel~="icon"]',
|
|
16
|
+
'link[rel~="apple-touch-icon"]',
|
|
17
|
+
'link[rel~="manifest"]',
|
|
18
|
+
'link[rel~="search"]',
|
|
19
|
+
'link[rel~="next"]',
|
|
20
|
+
'link[rel~="prev"]',
|
|
21
|
+
'link[rel~="publisher"]',
|
|
22
|
+
'link[rel~="license"]',
|
|
23
|
+
'link[rel~="help"]',
|
|
24
|
+
'link[rel~="me"]',
|
|
25
|
+
'link[rel~="pingback"]',
|
|
26
|
+
'link[rel~="privacy-policy"]',
|
|
27
|
+
'link[rel~="terms-of-service"]',
|
|
28
|
+
// Page and layout `metadata.jsonLd` (FARM_METADATA_ATTRIBUTE). The site-level
|
|
29
|
+
// agent JSON-LD and app-authored scripts carry no marker and stay in place.
|
|
30
|
+
'script[type="application/ld+json"][data-farm-metadata]'
|
|
31
|
+
].join(",");
|
|
32
|
+
function reconcileFarmDocumentHead(nextDocument) {
|
|
33
|
+
const nextTitle = nextDocument.querySelector("title");
|
|
34
|
+
document.title = _optionalChain([nextTitle, 'optionalAccess', _ => _.textContent]) || "";
|
|
35
|
+
document.head.querySelectorAll(FARM_NAVIGATION_HEAD_SELECTOR).forEach((node) => node.remove());
|
|
36
|
+
nextDocument.head.querySelectorAll(FARM_NAVIGATION_HEAD_SELECTOR).forEach((node) => document.head.appendChild(document.importNode(node, true)));
|
|
37
|
+
}
|
|
38
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, reconcileFarmDocumentHead, "reconcileFarmDocumentHead");
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
exports.FARM_NAVIGATION_HEAD_SELECTOR = FARM_NAVIGATION_HEAD_SELECTOR; exports.reconcileFarmDocumentHead = reconcileFarmDocumentHead;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/config-entry.ts
|
|
6
|
+
function defineConfig(config) {
|
|
7
|
+
return config;
|
|
8
|
+
}
|
|
9
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, defineConfig, "defineConfig");
|
|
10
|
+
var defineFarmConfig = defineConfig;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.defineConfig = defineConfig; exports.defineFarmConfig = defineFarmConfig;
|
|
@@ -0,0 +1,185 @@
|
|
|
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
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/client/chunk-recovery.ts
|
|
6
|
+
var DEFAULT_MAX_AGE_MS = 3e4;
|
|
7
|
+
var STORAGE_KEY_PREFIX = "farm:chunk-recovery:";
|
|
8
|
+
var CHUNK_ERROR_PATTERNS = [
|
|
9
|
+
/ChunkLoadError/i,
|
|
10
|
+
/Loading chunk [\w-]+ failed/i,
|
|
11
|
+
/Loading CSS chunk [\w-]+ failed/i,
|
|
12
|
+
/CSS_CHUNK_LOAD_FAILED/i,
|
|
13
|
+
/failed to fetch dynamically imported module/i,
|
|
14
|
+
/error loading dynamically imported module/i,
|
|
15
|
+
/importing a module script failed/i,
|
|
16
|
+
/unable to preload CSS/i,
|
|
17
|
+
/module script failed/i
|
|
18
|
+
];
|
|
19
|
+
function isChunkLoadError(errorLike) {
|
|
20
|
+
const values = collectErrorText(errorLike);
|
|
21
|
+
if (values.some((value) => CHUNK_ERROR_PATTERNS.some((pattern) => pattern.test(value)))) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
const targetUrl = getEventTargetAssetUrl(errorLike);
|
|
25
|
+
return Boolean(
|
|
26
|
+
targetUrl && /\.(?:m?js|css)(?:[?#].*)?$/i.test(targetUrl) && isSameOriginAssetUrl(targetUrl)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isChunkLoadError, "isChunkLoadError");
|
|
30
|
+
function isSameOriginAssetUrl(url) {
|
|
31
|
+
if (typeof window === "undefined" || !window.location) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return new URL(url, window.location.href).origin === window.location.origin;
|
|
36
|
+
} catch (e) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isSameOriginAssetUrl, "isSameOriginAssetUrl");
|
|
41
|
+
function installChunkErrorRecovery(options = {}) {
|
|
42
|
+
if (typeof window === "undefined") {
|
|
43
|
+
return () => {
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const recover = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (errorLike) => {
|
|
47
|
+
if (!isChunkLoadError(errorLike)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (!markRecovered(options)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
_optionalChain([options, 'access', _ => _.onRecover, 'optionalCall', _2 => _2(errorLike)]);
|
|
54
|
+
getReload(options)();
|
|
55
|
+
}, "recover");
|
|
56
|
+
const onError = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (event) => {
|
|
57
|
+
recover(getErrorEventPayload(event));
|
|
58
|
+
}, "onError");
|
|
59
|
+
const onUnhandledRejection = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (event) => {
|
|
60
|
+
recover(event.reason);
|
|
61
|
+
}, "onUnhandledRejection");
|
|
62
|
+
window.addEventListener("error", onError, true);
|
|
63
|
+
window.addEventListener("unhandledrejection", onUnhandledRejection);
|
|
64
|
+
return () => {
|
|
65
|
+
window.removeEventListener("error", onError, true);
|
|
66
|
+
window.removeEventListener("unhandledrejection", onUnhandledRejection);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, installChunkErrorRecovery, "installChunkErrorRecovery");
|
|
70
|
+
function markRecovered(options) {
|
|
71
|
+
const now = getNow(options);
|
|
72
|
+
const maxAgeMs = _nullishCoalesce(options.maxAgeMs, () => ( DEFAULT_MAX_AGE_MS));
|
|
73
|
+
const storage = getStorage(options);
|
|
74
|
+
const key = getStorageKey(options);
|
|
75
|
+
if (!storage) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const previous = Number(storage.getItem(key));
|
|
80
|
+
if (Number.isFinite(previous) && previous > 0 && now - previous < maxAgeMs) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
storage.setItem(key, String(now));
|
|
84
|
+
return true;
|
|
85
|
+
} catch (e2) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, markRecovered, "markRecovered");
|
|
90
|
+
function getErrorEventPayload(event) {
|
|
91
|
+
if ("error" in event && event.error) {
|
|
92
|
+
return event.error;
|
|
93
|
+
}
|
|
94
|
+
if ("message" in event && event.message) {
|
|
95
|
+
return event.message;
|
|
96
|
+
}
|
|
97
|
+
return event;
|
|
98
|
+
}
|
|
99
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getErrorEventPayload, "getErrorEventPayload");
|
|
100
|
+
function collectErrorText(value, seen = /* @__PURE__ */ new Set()) {
|
|
101
|
+
if (value == null || seen.has(value)) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
seen.add(value);
|
|
105
|
+
if (typeof value === "string") {
|
|
106
|
+
return [value];
|
|
107
|
+
}
|
|
108
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
109
|
+
return [String(value)];
|
|
110
|
+
}
|
|
111
|
+
if (typeof value !== "object") {
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
const record = value;
|
|
115
|
+
const output = [];
|
|
116
|
+
for (const key of ["name", "message", "code", "type", "request", "src", "href"]) {
|
|
117
|
+
const candidate = record[key];
|
|
118
|
+
if (typeof candidate === "string") {
|
|
119
|
+
output.push(candidate);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if ("reason" in record) {
|
|
123
|
+
output.push(...collectErrorText(record.reason, seen));
|
|
124
|
+
}
|
|
125
|
+
if ("error" in record) {
|
|
126
|
+
output.push(...collectErrorText(record.error, seen));
|
|
127
|
+
}
|
|
128
|
+
return output;
|
|
129
|
+
}
|
|
130
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, collectErrorText, "collectErrorText");
|
|
131
|
+
function getEventTargetAssetUrl(value) {
|
|
132
|
+
if (!value || typeof value !== "object") {
|
|
133
|
+
return void 0;
|
|
134
|
+
}
|
|
135
|
+
const target = value.target;
|
|
136
|
+
if (!target || typeof target !== "object") {
|
|
137
|
+
return void 0;
|
|
138
|
+
}
|
|
139
|
+
const tagName = typeof target.tagName === "string" ? target.tagName.toLowerCase() : "";
|
|
140
|
+
if (tagName !== "script" && tagName !== "link") {
|
|
141
|
+
return void 0;
|
|
142
|
+
}
|
|
143
|
+
return typeof target.src === "string" && target.src ? target.src : typeof target.href === "string" && target.href ? target.href : void 0;
|
|
144
|
+
}
|
|
145
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getEventTargetAssetUrl, "getEventTargetAssetUrl");
|
|
146
|
+
function getStorage(options) {
|
|
147
|
+
if ("storage" in options) {
|
|
148
|
+
return options.storage;
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
return window.sessionStorage;
|
|
152
|
+
} catch (e3) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getStorage, "getStorage");
|
|
157
|
+
function getStorageKey(options) {
|
|
158
|
+
if (options.storageKey) {
|
|
159
|
+
return options.storageKey;
|
|
160
|
+
}
|
|
161
|
+
const location = getLocation(options);
|
|
162
|
+
return `${STORAGE_KEY_PREFIX}${location.pathname}${location.search}`;
|
|
163
|
+
}
|
|
164
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getStorageKey, "getStorageKey");
|
|
165
|
+
function getLocation(options) {
|
|
166
|
+
return _nullishCoalesce(options.location, () => ( window.location));
|
|
167
|
+
}
|
|
168
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getLocation, "getLocation");
|
|
169
|
+
function getReload(options) {
|
|
170
|
+
if (options.reload) {
|
|
171
|
+
return options.reload;
|
|
172
|
+
}
|
|
173
|
+
const location = getLocation(options);
|
|
174
|
+
return () => location.reload();
|
|
175
|
+
}
|
|
176
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getReload, "getReload");
|
|
177
|
+
function getNow(options) {
|
|
178
|
+
return options.now ? options.now() : Date.now();
|
|
179
|
+
}
|
|
180
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getNow, "getNow");
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
exports.isChunkLoadError = isChunkLoadError; exports.installChunkErrorRecovery = installChunkErrorRecovery;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk62YJ2IEBcjs = require('./chunk-62YJ2IEB.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWJ3HK3LJcjs = require('./chunk-WJ3HK3LJ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
13
|
+
|
|
14
|
+
// src/navigation.ts
|
|
15
|
+
function useRouter2() {
|
|
16
|
+
const router = _chunk62YJ2IEBcjs.useRouter.call(void 0, );
|
|
17
|
+
return {
|
|
18
|
+
push: router.push,
|
|
19
|
+
replace: router.replace,
|
|
20
|
+
back: router.back,
|
|
21
|
+
forward: router.forward,
|
|
22
|
+
refresh() {
|
|
23
|
+
if (typeof window === "undefined") return Promise.resolve();
|
|
24
|
+
return _chunkWJ3HK3LJcjs.getRouter.call(void 0, ).refresh();
|
|
25
|
+
},
|
|
26
|
+
prefetch(href) {
|
|
27
|
+
if (typeof window === "undefined") return Promise.resolve();
|
|
28
|
+
return _chunkWJ3HK3LJcjs.getRouter.call(void 0, ).prefetch(_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, useRouter2, "useRouter");
|
|
33
|
+
function usePathname() {
|
|
34
|
+
return _chunk62YJ2IEBcjs.useRouter.call(void 0, ).pathname;
|
|
35
|
+
}
|
|
36
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, usePathname, "usePathname");
|
|
37
|
+
function useSearchParams() {
|
|
38
|
+
return _chunk62YJ2IEBcjs.useRouter.call(void 0, ).searchParams;
|
|
39
|
+
}
|
|
40
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, useSearchParams, "useSearchParams");
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
exports.useRouter = useRouter2; exports.usePathname = usePathname; exports.useSearchParams = useSearchParams;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkWMOGFOUJcjs = require('./chunk-WMOGFOUJ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
7
|
+
|
|
8
|
+
// src/query/params.ts
|
|
9
|
+
function parseParam(input, key, parser) {
|
|
10
|
+
const values = input instanceof URLSearchParams ? input.getAll(key) : [_nullishCoalesce(input[key], () => ( ""))];
|
|
11
|
+
return {
|
|
12
|
+
raw: values.length > 1 ? values.join(",") : _nullishCoalesce(values[0], () => ( "")),
|
|
13
|
+
parsed: _chunkWMOGFOUJcjs.parseQueryParameter.call(void 0, parser, values)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, parseParam, "parseParam");
|
|
17
|
+
async function loadRouteParams(input, parsers, options = {}) {
|
|
18
|
+
const resolved = await Promise.resolve(input);
|
|
19
|
+
const result = {};
|
|
20
|
+
for (const [key, parser] of Object.entries(parsers)) {
|
|
21
|
+
const { raw, parsed } = parseParam(resolved, key, parser);
|
|
22
|
+
if (parsed === null && options.strict) {
|
|
23
|
+
throw new Error(`Failed to parse route param "${key}" with value "${raw}"`);
|
|
24
|
+
}
|
|
25
|
+
result[key] = parsed;
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, loadRouteParams, "loadRouteParams");
|
|
30
|
+
function parseRouteParams(input, parsers, options = {}) {
|
|
31
|
+
const result = {};
|
|
32
|
+
for (const [key, parser] of Object.entries(parsers)) {
|
|
33
|
+
const { raw, parsed } = parseParam(input, key, parser);
|
|
34
|
+
if (parsed === null && options.strict) {
|
|
35
|
+
throw new Error(`Failed to parse route param "${key}" with value "${raw}"`);
|
|
36
|
+
}
|
|
37
|
+
result[key] = parsed;
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, parseRouteParams, "parseRouteParams");
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
exports.loadRouteParams = loadRouteParams; exports.parseRouteParams = parseRouteParams;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/i18n/bridge.ts
|
|
6
|
+
var FARM_I18N_SNAPSHOT_RESOLVER = /* @__PURE__ */ Symbol.for("farm.i18n.snapshotResolver");
|
|
7
|
+
function _setFarmI18nSnapshotResolver(resolver) {
|
|
8
|
+
globalThis[FARM_I18N_SNAPSHOT_RESOLVER] = resolver;
|
|
9
|
+
}
|
|
10
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, _setFarmI18nSnapshotResolver, "_setFarmI18nSnapshotResolver");
|
|
11
|
+
function getActiveFarmI18nSnapshot() {
|
|
12
|
+
if (typeof window !== "undefined" && window.__FARM_I18N__) {
|
|
13
|
+
return window.__FARM_I18N__;
|
|
14
|
+
}
|
|
15
|
+
return _optionalChain([globalThis, 'access', _ => _[FARM_I18N_SNAPSHOT_RESOLVER], 'optionalCall', _2 => _2()]);
|
|
16
|
+
}
|
|
17
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getActiveFarmI18nSnapshot, "getActiveFarmI18nSnapshot");
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports._setFarmI18nSnapshotResolver = _setFarmI18nSnapshotResolver; exports.getActiveFarmI18nSnapshot = getActiveFarmI18nSnapshot;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/client-observers.ts
|
|
6
|
+
function notifyClientObserver(observer, args, label = "Client lifecycle") {
|
|
7
|
+
if (!observer) return;
|
|
8
|
+
const report = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (error) => {
|
|
9
|
+
const reportError = globalThis.reportError;
|
|
10
|
+
if (typeof reportError === "function") {
|
|
11
|
+
try {
|
|
12
|
+
reportError.call(globalThis, error);
|
|
13
|
+
return;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
console.error(`[Farm.js] ${label} callback failed:`, error);
|
|
19
|
+
} catch (e2) {
|
|
20
|
+
}
|
|
21
|
+
}, "report");
|
|
22
|
+
try {
|
|
23
|
+
const result = observer(...args);
|
|
24
|
+
if (result && typeof result.then === "function")
|
|
25
|
+
void Promise.resolve(result).catch(report);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
report(error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, notifyClientObserver, "notifyClientObserver");
|
|
31
|
+
|
|
32
|
+
// src/client-retry.ts
|
|
33
|
+
var MAX_TIMER_DELAY = 2147483647;
|
|
34
|
+
function resolveClientRetryCount(value) {
|
|
35
|
+
const count = _nullishCoalesce(value, () => ( 0));
|
|
36
|
+
if (!Number.isSafeInteger(count) || count < 0) {
|
|
37
|
+
throw new RangeError("retry.count must be a non-negative safe integer");
|
|
38
|
+
}
|
|
39
|
+
return count;
|
|
40
|
+
}
|
|
41
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveClientRetryCount, "resolveClientRetryCount");
|
|
42
|
+
function resolveClientRetryDelay(value) {
|
|
43
|
+
const delay = _nullishCoalesce(value, () => ( 0));
|
|
44
|
+
if (!Number.isFinite(delay) || delay < 0 || delay > MAX_TIMER_DELAY) {
|
|
45
|
+
throw new RangeError(`retry.delay must be between 0 and ${MAX_TIMER_DELAY} milliseconds`);
|
|
46
|
+
}
|
|
47
|
+
return delay;
|
|
48
|
+
}
|
|
49
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveClientRetryDelay, "resolveClientRetryDelay");
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
exports.notifyClientObserver = notifyClientObserver; exports.resolveClientRetryCount = resolveClientRetryCount; exports.resolveClientRetryDelay = resolveClientRetryDelay;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/cli-colors.ts
|
|
6
|
+
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
7
|
+
function createCliColors(interactive = process.stdout.isTTY === true) {
|
|
8
|
+
return _picocolors2.default.createColors(interactive);
|
|
9
|
+
}
|
|
10
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createCliColors, "createCliColors");
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.createCliColors = createCliColors;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/route-runtime.ts
|
|
6
|
+
function normalizeFarmRouteRuntimeConfig(value, source = "Route configuration") {
|
|
7
|
+
if (!value) return {};
|
|
8
|
+
const normalized = {};
|
|
9
|
+
if (value.runtime !== void 0) {
|
|
10
|
+
if (value.runtime !== "auto" && value.runtime !== "node" && value.runtime !== "edge") {
|
|
11
|
+
throw new TypeError(`${source} runtime must be "auto", "node", or "edge"`);
|
|
12
|
+
}
|
|
13
|
+
normalized.runtime = value.runtime;
|
|
14
|
+
}
|
|
15
|
+
if (value.regions !== void 0) {
|
|
16
|
+
if (value.regions === "auto") {
|
|
17
|
+
normalized.regions = "auto";
|
|
18
|
+
} else {
|
|
19
|
+
if (!Array.isArray(value.regions) || value.regions.length === 0) {
|
|
20
|
+
throw new TypeError(`${source} regions must be "auto" or a non-empty string array`);
|
|
21
|
+
}
|
|
22
|
+
const regions = Array.from(
|
|
23
|
+
new Set(
|
|
24
|
+
value.regions.map((region) => {
|
|
25
|
+
if (typeof region !== "string" || !region.trim() || /[\u0000-\u001f\u007f]/.test(region)) {
|
|
26
|
+
throw new TypeError(`${source} regions must contain non-empty region identifiers`);
|
|
27
|
+
}
|
|
28
|
+
return region.trim();
|
|
29
|
+
})
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
normalized.regions = regions;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (value.maxDuration !== void 0) {
|
|
36
|
+
if (value.maxDuration === "auto") {
|
|
37
|
+
normalized.maxDuration = "auto";
|
|
38
|
+
} else if (typeof value.maxDuration !== "number" || !Number.isInteger(value.maxDuration) || value.maxDuration <= 0) {
|
|
39
|
+
throw new TypeError(`${source} maxDuration must be "auto" or a positive integer in seconds`);
|
|
40
|
+
} else {
|
|
41
|
+
normalized.maxDuration = value.maxDuration;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return normalized;
|
|
45
|
+
}
|
|
46
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeFarmRouteRuntimeConfig, "normalizeFarmRouteRuntimeConfig");
|
|
47
|
+
function mergeFarmRouteRuntimeConfigs(...configs) {
|
|
48
|
+
const merged = {};
|
|
49
|
+
for (const config of configs) {
|
|
50
|
+
if (!config) continue;
|
|
51
|
+
if (config.runtime !== void 0) merged.runtime = config.runtime;
|
|
52
|
+
if (config.regions !== void 0) merged.regions = config.regions;
|
|
53
|
+
if (config.maxDuration !== void 0) merged.maxDuration = config.maxDuration;
|
|
54
|
+
}
|
|
55
|
+
return merged;
|
|
56
|
+
}
|
|
57
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeFarmRouteRuntimeConfigs, "mergeFarmRouteRuntimeConfigs");
|
|
58
|
+
function resolveFarmRouteRuntimeConfig(config, source) {
|
|
59
|
+
const normalized = normalizeFarmRouteRuntimeConfig(config, source);
|
|
60
|
+
return {
|
|
61
|
+
runtime: _nullishCoalesce(normalized.runtime, () => ( "auto")),
|
|
62
|
+
...normalized.regions && normalized.regions !== "auto" ? { regions: [...normalized.regions] } : {},
|
|
63
|
+
...typeof normalized.maxDuration === "number" ? { maxDuration: normalized.maxDuration } : {}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmRouteRuntimeConfig, "resolveFarmRouteRuntimeConfig");
|
|
67
|
+
function hasFarmRouteRuntimeControls(config) {
|
|
68
|
+
return Boolean(
|
|
69
|
+
config && (config.runtime !== void 0 || config.regions !== void 0 || config.maxDuration !== void 0)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmRouteRuntimeControls, "hasFarmRouteRuntimeControls");
|
|
73
|
+
function getFarmRouteRuntimeConfig(value) {
|
|
74
|
+
if (!value || typeof value !== "object") return {};
|
|
75
|
+
const route = value;
|
|
76
|
+
return {
|
|
77
|
+
...route.runtime !== void 0 ? { runtime: route.runtime } : {},
|
|
78
|
+
...route.regions !== void 0 ? { regions: route.regions } : {},
|
|
79
|
+
...route.maxDuration !== void 0 ? { maxDuration: route.maxDuration } : {}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmRouteRuntimeConfig, "getFarmRouteRuntimeConfig");
|
|
83
|
+
function createFarmRouteRuntimeKey(config) {
|
|
84
|
+
return JSON.stringify({
|
|
85
|
+
runtime: config.runtime,
|
|
86
|
+
regions: config.regions || null,
|
|
87
|
+
maxDuration: config.maxDuration || null
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmRouteRuntimeKey, "createFarmRouteRuntimeKey");
|
|
91
|
+
function resolveFarmRouteRuleRuntimeConfig(pathname, routeRules) {
|
|
92
|
+
if (!routeRules) return {};
|
|
93
|
+
const matches = Object.entries(routeRules).filter(
|
|
94
|
+
([pattern, rule]) => hasFarmRouteRuntimeControls(rule) && farmRouteRuleMatches(pattern, pathname)
|
|
95
|
+
).sort(([left], [right]) => compareFarmRouteRuleSpecificity(left, right));
|
|
96
|
+
return mergeFarmRouteRuntimeConfigs(...matches.map(([, rule]) => rule));
|
|
97
|
+
}
|
|
98
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmRouteRuleRuntimeConfig, "resolveFarmRouteRuleRuntimeConfig");
|
|
99
|
+
function farmRouteRuleMatches(pattern, pathname) {
|
|
100
|
+
const normalizedPattern = normalizeRoutePattern(pattern);
|
|
101
|
+
const normalizedPathname = normalizeRoutePattern(pathname);
|
|
102
|
+
if (normalizedPattern === normalizedPathname) return true;
|
|
103
|
+
const expression = normalizedPattern.split("/").filter(Boolean).map((segment) => {
|
|
104
|
+
if (segment === "**") return ".*";
|
|
105
|
+
if (segment === "*") return "[^/]+";
|
|
106
|
+
if (/^\[\[\.\.\..+\]\]$/.test(segment)) return ".*";
|
|
107
|
+
if (/^\[\.\.\..+\]$/.test(segment)) return ".+";
|
|
108
|
+
if (/^\[.+\]$/.test(segment) || /^:.+$/.test(segment)) return "[^/]+";
|
|
109
|
+
return escapeRegExp(segment);
|
|
110
|
+
}).join("/");
|
|
111
|
+
return new RegExp(`^/${expression}/?$`).test(normalizedPathname);
|
|
112
|
+
}
|
|
113
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, farmRouteRuleMatches, "farmRouteRuleMatches");
|
|
114
|
+
function compareFarmRouteRuleSpecificity(left, right) {
|
|
115
|
+
const leftScore = getFarmRouteRuleSpecificity(left);
|
|
116
|
+
const rightScore = getFarmRouteRuleSpecificity(right);
|
|
117
|
+
return leftScore - rightScore || left.localeCompare(right);
|
|
118
|
+
}
|
|
119
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, compareFarmRouteRuleSpecificity, "compareFarmRouteRuleSpecificity");
|
|
120
|
+
function getFarmRouteRuleSpecificity(pattern) {
|
|
121
|
+
return normalizeRoutePattern(pattern).split("/").filter(Boolean).reduce((score, segment) => {
|
|
122
|
+
if (segment === "**" || segment.startsWith("[[...")) return score + 1;
|
|
123
|
+
if (segment === "*" || segment.startsWith("[...")) return score + 10;
|
|
124
|
+
if (/^\[.+\]$/.test(segment) || /^:.+$/.test(segment)) return score + 50;
|
|
125
|
+
return score + 100;
|
|
126
|
+
}, 0);
|
|
127
|
+
}
|
|
128
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmRouteRuleSpecificity, "getFarmRouteRuleSpecificity");
|
|
129
|
+
function normalizeRoutePattern(value) {
|
|
130
|
+
const withSlash = value.trim().startsWith("/") ? value.trim() : `/${value.trim()}`;
|
|
131
|
+
return withSlash.length > 1 ? withSlash.replace(/\/+$/, "") : withSlash;
|
|
132
|
+
}
|
|
133
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeRoutePattern, "normalizeRoutePattern");
|
|
134
|
+
function escapeRegExp(value) {
|
|
135
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
136
|
+
}
|
|
137
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, escapeRegExp, "escapeRegExp");
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
exports.normalizeFarmRouteRuntimeConfig = normalizeFarmRouteRuntimeConfig; exports.mergeFarmRouteRuntimeConfigs = mergeFarmRouteRuntimeConfigs; exports.resolveFarmRouteRuntimeConfig = resolveFarmRouteRuntimeConfig; exports.hasFarmRouteRuntimeControls = hasFarmRouteRuntimeControls; exports.getFarmRouteRuntimeConfig = getFarmRouteRuntimeConfig; exports.createFarmRouteRuntimeKey = createFarmRouteRuntimeKey; exports.resolveFarmRouteRuleRuntimeConfig = resolveFarmRouteRuleRuntimeConfig; exports.farmRouteRuleMatches = farmRouteRuleMatches;
|