@farm.js/core 0.1.86 → 0.1.87
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-mcp.d-7uKdOttc.d.ts → agent-mcp.d-BdM0pIrD.d.ts} +1 -1
- package/dist/{agent-mcp.d-LChlR2au.d.mts → agent-mcp.d-CMGqpUbk.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/analyzer-LLU2Z6I4.cjs +17 -0
- package/dist/{analyzer-I5S5YKHM.mjs → analyzer-W4EB7DHL.mjs} +2 -2
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- package/dist/api/route-manager.cjs +3 -3
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +2 -2
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.cjs +4 -4
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/api.mjs +3 -3
- package/dist/{app-manifest.d-QMdmqqCr.d.mts → app-manifest.d-BeDB2OVm.d.mts} +1 -1
- package/dist/{app-manifest.d-CRp21oAz.d.ts → app-manifest.d-COhjPgHn.d.ts} +1 -1
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/{app.d-Bvpc2eJq.d.mts → app.d-AVZXCfcO.d.mts} +5 -4
- package/dist/{app.d-DEKpJEp4.d.ts → app.d-b3A4cca5.d.ts} +5 -4
- package/dist/{chunk-SB74WCKC.mjs → chunk-26HESRBL.mjs} +4 -4
- package/dist/chunk-2HTNASSB.cjs +134 -0
- package/dist/{chunk-BAD6T5NU.cjs → chunk-33WR5XV5.cjs} +4 -4
- package/dist/{chunk-YMAE32O7.mjs → chunk-3F55K4MC.mjs} +1 -1
- package/dist/{chunk-CVKTYG4L.mjs → chunk-4FGTNYHE.mjs} +2 -2
- package/dist/{chunk-CFKAYV7B.mjs → chunk-5D73SKF3.mjs} +1 -1
- package/dist/{chunk-Q3YWQEUS.cjs → chunk-7BNVUIGL.cjs} +2 -2
- package/dist/{chunk-RA5OUXOJ.mjs → chunk-A2PPQ5LB.mjs} +2 -2
- package/dist/{chunk-KHIEGVG7.mjs → chunk-ALOFMAFA.mjs} +10 -4
- package/dist/{chunk-BLZCAFGJ.cjs → chunk-CXHVRHM2.cjs} +2 -2
- package/dist/{chunk-3RVLJTFZ.mjs → chunk-D7LXBLUW.mjs} +1 -1
- package/dist/{chunk-45ANSCTO.mjs → chunk-EZYNIADW.mjs} +63 -37
- package/dist/{chunk-NAHDG6UX.mjs → chunk-HFRG2IQS.mjs} +1 -1
- package/dist/{chunk-7H2TXT2K.mjs → chunk-HX5HLFBZ.mjs} +7 -0
- package/dist/{chunk-2NKNP4AH.cjs → chunk-HYL372GW.cjs} +1 -1
- package/dist/{chunk-25JGHAGH.cjs → chunk-I2RBHZF7.cjs} +15 -8
- package/dist/{chunk-NXOZRI3B.cjs → chunk-IM422XKU.cjs} +2 -2
- package/dist/{chunk-6QYPP5KC.mjs → chunk-K5FLQJW5.mjs} +2 -2
- package/dist/chunk-K6RMOB25.mjs +134 -0
- package/dist/{chunk-UAQQUQWE.mjs → chunk-LBJOHMTB.mjs} +1 -1
- package/dist/{chunk-QYWP5KDY.mjs → chunk-LIWVPE72.mjs} +59 -21
- package/dist/{chunk-FDU4Q4QP.cjs → chunk-MZR22RAC.cjs} +10 -4
- package/dist/chunk-NDMPGFKL.cjs +47 -0
- package/dist/{chunk-YHM4PXJY.mjs → chunk-O5YM6GU3.mjs} +1 -1
- package/dist/{chunk-GWPANDW3.mjs → chunk-O7K4HMAQ.mjs} +1 -1
- package/dist/{chunk-7UTRNV6R.mjs → chunk-Q73LRKLP.mjs} +1 -1
- package/dist/{chunk-3TKGMIPX.mjs → chunk-QLRI2BX5.mjs} +90 -11
- package/dist/{chunk-PAENAKTC.mjs → chunk-QSDIJ45N.mjs} +1 -1
- package/dist/{chunk-UDWBTABT.cjs → chunk-RGYS5OPL.cjs} +3 -3
- package/dist/{chunk-FWLXYNWA.cjs → chunk-SDNYULFS.cjs} +347 -321
- package/dist/chunk-TCGPBSVY.mjs +47 -0
- package/dist/{chunk-P253SZJF.cjs → chunk-TI4BZV6M.cjs} +353 -274
- package/dist/{chunk-QYDGIXQ5.cjs → chunk-U3A46QFD.cjs} +9 -9
- package/dist/{chunk-VGHDPEPQ.cjs → chunk-UA77C2ZA.cjs} +2 -2
- package/dist/{chunk-U54REWMJ.cjs → chunk-VCI776NG.cjs} +13 -13
- package/dist/{chunk-IAERD73G.cjs → chunk-VCZ4EM5K.cjs} +367 -329
- package/dist/{chunk-5P65LXGU.cjs → chunk-WSQ3S3NV.cjs} +2 -2
- package/dist/{chunk-VTEAUQMT.mjs → chunk-X2SMVPLH.mjs} +19 -3
- package/dist/{chunk-TQJ35BBW.cjs → chunk-XFUPWRKT.cjs} +4 -4
- package/dist/{chunk-DJ3PVHTW.cjs → chunk-XGPRM7OK.cjs} +3 -3
- package/dist/{chunk-CPSFDQKJ.cjs → chunk-Z43CIBUR.cjs} +20 -4
- package/dist/{chunk-L2IULWKV.cjs → chunk-ZCX2XJPY.cjs} +3 -3
- package/dist/{cli-runtime.d-DaElKjaL.d.ts → cli-runtime.d-jqZ7YCsm.d.ts} +5 -5
- package/dist/{cli-runtime.d-C7aMfoTq.d.mts → cli-runtime.d-qL44rqYO.d.mts} +5 -5
- package/dist/{client-component.d-miqIXyQv.d.mts → client-component.d-B2L2LyAr.d.mts} +1 -1
- package/dist/{client-component.d-CZG02pIh.d.ts → client-component.d-BDD5aiUb.d.ts} +1 -1
- package/dist/{client-plugins.d-BVXjyIkY.d.ts → client-plugins.d-Crct3m_r.d.ts} +14 -5
- package/dist/{client-plugins.d-BwKwuO_0.d.mts → client-plugins.d-Dzc3vOw_.d.mts} +14 -5
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +8 -7
- package/dist/client.d.ts +8 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-A3L7WNTB.cjs → devtools-GPIKZ5AV.cjs} +5 -3
- package/dist/{devtools-DGC2247E.mjs → devtools-GWJZPWIW.mjs} +4 -2
- package/dist/docs.cjs +6 -4
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +5 -3
- package/dist/environment/vite.cjs +4 -4
- package/dist/environment/vite.mjs +3 -3
- package/dist/font.cjs +4 -2
- package/dist/font.d.mts +13 -1
- package/dist/font.d.ts +13 -1
- package/dist/font.mjs +3 -1
- package/dist/{handler.d-BKTWzzNA.d.mts → handler.d-B1S1ZBqS.d.mts} +1 -1
- package/dist/{handler.d-Dzpyg3-N.d.ts → handler.d-ZweCBJD4.d.ts} +1 -1
- package/dist/{headers.d-PZyXcDAH.d.ts → headers.d-BgBdQN8x.d.ts} +1 -1
- package/dist/{headers.d-5opjyhXw.d.mts → headers.d-C-yGl_f6.d.mts} +1 -1
- package/dist/image-attributes.d-BMPDQO1q.d.mts +55 -0
- package/dist/image-attributes.d-BMPDQO1q.d.ts +55 -0
- package/dist/image.cjs +5 -127
- package/dist/image.d.mts +3 -13
- package/dist/image.d.ts +3 -13
- package/dist/image.mjs +5 -127
- package/dist/index.cjs +24 -22
- package/dist/{index.d-C0Mie66f.d.mts → index.d-13h3oDu7.d.mts} +1 -1
- package/dist/{index.d-DV2q-0mE.d.ts → index.d-CtoniAXT.d.ts} +1 -1
- package/dist/index.d.mts +24 -23
- package/dist/index.d.ts +24 -23
- package/dist/index.mjs +23 -21
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/build-runtime.cjs +19 -19
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +18 -18
- package/dist/internal/cli-runtime.cjs +5 -3
- package/dist/internal/cli-runtime.d.mts +7 -7
- package/dist/internal/cli-runtime.d.ts +7 -7
- package/dist/internal/cli-runtime.mjs +4 -2
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +66 -40
- package/dist/internal/client-runtime.d.mts +6 -6
- package/dist/internal/client-runtime.d.ts +6 -6
- package/dist/internal/client-runtime.mjs +53 -27
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +6 -4
- 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 -3
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-boot.cjs +44 -16
- package/dist/internal/islands-boot.d.mts +3 -1
- package/dist/internal/islands-boot.d.ts +3 -1
- package/dist/internal/islands-boot.mjs +28 -0
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +6 -6
- package/dist/internal/production-runtime.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +5 -5
- package/dist/internal/renderer-islands.cjs +35 -8
- package/dist/internal/renderer-islands.d.mts +9 -1
- package/dist/internal/renderer-islands.d.ts +9 -1
- package/dist/internal/renderer-islands.mjs +35 -8
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/start-manifest.d.mts +1 -1
- package/dist/internal/start-manifest.d.ts +1 -1
- package/dist/{island-runtime.d-BA7EPo1v.d.ts → island-runtime.d-D2Mh5eTU.d.ts} +5 -1
- package/dist/{island-runtime.d-BBS_YUSX.d.mts → island-runtime.d-lrpEJlgg.d.mts} +5 -1
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/middleware.mjs +3 -3
- package/dist/{mount.d-gWul1GA1.d.ts → mount.d-DyKlRR6z.d.ts} +1 -1
- package/dist/{mount.d-CZ_qL1iS.d.mts → mount.d-_6Un9wdK.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BBTzhJLj.d.mts → navigation-delegate.d-ChfinbWB.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BZsYEAet.d.ts → navigation-delegate.d-fMgELdAe.d.ts} +1 -1
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/{plugin-QOTAPTVV.mjs → plugin-EVKQZBNW.mjs} +1 -1
- package/dist/{plugin-3PT7I26P.cjs → plugin-MWO3G2XM.cjs} +2 -2
- package/dist/plugin.cjs +16 -16
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +15 -15
- package/dist/{render-plan.d-AaJsYPX-.d.ts → render-plan.d-D0FV9lDT.d.ts} +1 -1
- package/dist/{render-plan.d-bnWxS12w.d.mts → render-plan.d-DaM1NPnm.d.mts} +1 -1
- package/dist/renderer-client.cjs +6 -1
- package/dist/renderer-client.d.mts +6 -5
- package/dist/renderer-client.d.ts +6 -5
- package/dist/renderer-client.mjs +5 -0
- package/dist/renderer.cjs +3 -3
- package/dist/renderer.mjs +2 -2
- package/dist/{request.d-CAeitOG1.d.ts → request.d-CrXC7voZ.d.ts} +1 -1
- package/dist/{request.d-C2HOn3Hi.d.mts → request.d-DVSLilGx.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-CYA-ulnX.d.mts → route-rendering.d-CWi3UYtR.d.mts} +1 -1
- package/dist/{route-rendering.d-A1dIkUK5.d.ts → route-rendering.d-OfbM_rj8.d.ts} +1 -1
- package/dist/{router.d-A_Yt6jYz.d.ts → router.d-D5Mp7bpO.d.ts} +1 -1
- package/dist/{router.d-8lxnzlkr.d.mts → router.d-DrQ1QDFk.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{rsc-pipeline-BROS3NEB.mjs → rsc-pipeline-KLMQU3YP.mjs} +5 -3
- package/dist/{rsc-pipeline-SNGPAXGW.cjs → rsc-pipeline-TQOSDWOU.cjs} +6 -4
- package/dist/{runtime-SLJLW37A.mjs → runtime-BDPBO65S.mjs} +5 -3
- package/dist/{runtime-7T5TRAWL.cjs → runtime-CQSCRVZ7.cjs} +7 -5
- package/dist/{runtime.d-C_rZ9_DD.d.mts → runtime.d-BVj6apd0.d.mts} +1 -1
- package/dist/{runtime.d-BPyvWrgQ.d.ts → runtime.d-D7QYVJGO.d.ts} +1 -1
- package/dist/{server-components-status.d-BpxiEMQE.d.mts → server-components-status.d-BDVcxi0z.d.mts} +1 -1
- package/dist/{server-components-status.d-C2UEKJn7.d.ts → server-components-status.d-CfKDpmCH.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +37 -37
- package/dist/server.d.mts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +17 -17
- package/dist/{spa-router.d-Cw5i_15e.d.ts → spa-router.d-BXxoU3Cv.d.ts} +2 -2
- package/dist/{spa-router.d-BD-6WX1R.d.mts → spa-router.d-CXgvy-7L.d.mts} +2 -2
- package/dist/{ssg.d-CCE9aob5.d.mts → ssg.d-DS-gXUbf.d.mts} +2 -2
- package/dist/{ssg.d-Bifiq0EL.d.ts → ssg.d-jXlUAKzg.d.ts} +2 -2
- package/dist/{store-core.d-BN2MxSG9.d.mts → store-core.d-CDbVAbTn.d.mts} +3 -2
- package/dist/{store-core.d-5tVn5vi1.d.ts → store-core.d-D00BsbnO.d.ts} +3 -2
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +2 -2
- package/dist/{utils.d-BUjpSNIO.d.ts → utils.d-BODwBtkz.d.ts} +1 -1
- package/dist/{utils.d-wGPLeVbq.d.mts → utils.d-Cmj-fzds.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +21 -19
- package/dist/vite.d.mts +21 -7
- package/dist/vite.d.ts +21 -7
- package/dist/vite.mjs +20 -18
- package/package.json +2 -2
- package/dist/analyzer-OEMQSLYT.cjs +0 -17
- package/dist/chunk-7EPYN7GW.cjs +0 -30
- package/dist/chunk-HZOMT5DY.mjs +0 -30
- package/dist/{chunk-4B6YJ5DS.cjs → chunk-4ZVKDHS6.cjs} +3 -3
- package/dist/{chunk-4EEAPBNV.mjs → chunk-PEQJ4UUT.mjs} +3 -3
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_FARM_IMAGE_DEVICE_SIZES,
|
|
3
|
+
DEFAULT_FARM_IMAGE_FORMATS,
|
|
4
|
+
DEFAULT_FARM_IMAGE_PATH,
|
|
5
|
+
DEFAULT_FARM_IMAGE_QUALITIES,
|
|
6
|
+
DEFAULT_FARM_IMAGE_SIZES
|
|
7
|
+
} from "./chunk-AOIUYHPH.mjs";
|
|
8
|
+
|
|
9
|
+
// src/image-attributes.ts
|
|
10
|
+
var FALLBACK_CONFIG = {
|
|
11
|
+
provider: "auto",
|
|
12
|
+
path: DEFAULT_FARM_IMAGE_PATH,
|
|
13
|
+
deviceSizes: DEFAULT_FARM_IMAGE_DEVICE_SIZES,
|
|
14
|
+
imageSizes: DEFAULT_FARM_IMAGE_SIZES,
|
|
15
|
+
qualities: DEFAULT_FARM_IMAGE_QUALITIES,
|
|
16
|
+
formats: DEFAULT_FARM_IMAGE_FORMATS
|
|
17
|
+
};
|
|
18
|
+
function getImageConfig() {
|
|
19
|
+
return typeof __FARM_IMAGE_CONFIG__ !== "undefined" && __FARM_IMAGE_CONFIG__ ? __FARM_IMAGE_CONFIG__ : FALLBACK_CONFIG;
|
|
20
|
+
}
|
|
21
|
+
function defaultImageLoader(config) {
|
|
22
|
+
return ({ src, width, quality }) => {
|
|
23
|
+
const query = new URLSearchParams({
|
|
24
|
+
url: src,
|
|
25
|
+
w: String(width),
|
|
26
|
+
q: String(quality)
|
|
27
|
+
});
|
|
28
|
+
return `${config.path}?${query}`;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function getClosestQuality(quality, allowed) {
|
|
32
|
+
const requested = quality ?? 75;
|
|
33
|
+
return allowed.reduce(
|
|
34
|
+
(closest, candidate) => Math.abs(candidate - requested) < Math.abs(closest - requested) ? candidate : closest
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function getCandidateWidths(config, width, sizes, fill) {
|
|
38
|
+
const allSizes = [.../* @__PURE__ */ new Set([...config.imageSizes, ...config.deviceSizes])].sort(
|
|
39
|
+
(left, right) => left - right
|
|
40
|
+
);
|
|
41
|
+
if (fill || sizes) {
|
|
42
|
+
const viewportPercentages = [...sizes?.matchAll(/(^|\s)(\d{1,3})vw/g) ?? []].map(
|
|
43
|
+
(match) => Number(match[2])
|
|
44
|
+
);
|
|
45
|
+
if (viewportPercentages.length > 0) {
|
|
46
|
+
const smallestRatio = Math.min(...viewportPercentages) / 100;
|
|
47
|
+
const minimum = config.deviceSizes[0] * smallestRatio;
|
|
48
|
+
return { widths: allSizes.filter((candidate) => candidate >= minimum), descriptor: "w" };
|
|
49
|
+
}
|
|
50
|
+
return { widths: allSizes, descriptor: "w" };
|
|
51
|
+
}
|
|
52
|
+
if (!width) return { widths: config.deviceSizes.slice(), descriptor: "w" };
|
|
53
|
+
const requested = [width, width * 2];
|
|
54
|
+
const widths = requested.map(
|
|
55
|
+
(target) => allSizes.find((candidate) => candidate >= target) ?? allSizes.at(-1)
|
|
56
|
+
);
|
|
57
|
+
return { widths: [...new Set(widths)], descriptor: "x" };
|
|
58
|
+
}
|
|
59
|
+
function isStaticImageData(value) {
|
|
60
|
+
return typeof value === "object" && value !== null && typeof value.src === "string";
|
|
61
|
+
}
|
|
62
|
+
function shouldSkipOptimization(src, config) {
|
|
63
|
+
return config.provider === "none" || src.startsWith("data:") || src.startsWith("blob:") || /\.svg(?:$|[?#])/i.test(src);
|
|
64
|
+
}
|
|
65
|
+
function resolveImageAttributes(options) {
|
|
66
|
+
const {
|
|
67
|
+
src: srcInput,
|
|
68
|
+
alt,
|
|
69
|
+
width: widthInput,
|
|
70
|
+
height: heightInput,
|
|
71
|
+
fill = false,
|
|
72
|
+
quality: qualityInput,
|
|
73
|
+
sizes: sizesInput,
|
|
74
|
+
loading,
|
|
75
|
+
preload = false,
|
|
76
|
+
placeholder = "empty",
|
|
77
|
+
blurDataURL: blurDataURLInput,
|
|
78
|
+
unoptimized: unoptimizedInput = false,
|
|
79
|
+
loader: loaderInput,
|
|
80
|
+
style,
|
|
81
|
+
...rest
|
|
82
|
+
} = options;
|
|
83
|
+
const config = getImageConfig();
|
|
84
|
+
const staticImage = isStaticImageData(srcInput) ? srcInput : void 0;
|
|
85
|
+
const src = typeof srcInput === "string" ? srcInput : srcInput.src;
|
|
86
|
+
const width = Number(widthInput ?? staticImage?.width) || void 0;
|
|
87
|
+
const height = Number(heightInput ?? staticImage?.height) || void 0;
|
|
88
|
+
const blurDataURL = blurDataURLInput ?? staticImage?.blurDataURL;
|
|
89
|
+
if (!fill && (!width || !height)) {
|
|
90
|
+
throw new TypeError(
|
|
91
|
+
"Farm Image requires width and height unless src is a static import or fill is enabled"
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
if (fill && (widthInput !== void 0 || heightInput !== void 0)) {
|
|
95
|
+
throw new TypeError("Farm Image cannot use width or height together with fill");
|
|
96
|
+
}
|
|
97
|
+
if (placeholder === "blur" && !blurDataURL) {
|
|
98
|
+
throw new TypeError("Farm Image placeholder=blur requires a static import or blurDataURL");
|
|
99
|
+
}
|
|
100
|
+
const unoptimized = unoptimizedInput || shouldSkipOptimization(src, config);
|
|
101
|
+
const quality = getClosestQuality(qualityInput, config.qualities);
|
|
102
|
+
const loader = loaderInput ?? defaultImageLoader(config);
|
|
103
|
+
const sizes = sizesInput ?? (fill ? "100vw" : void 0);
|
|
104
|
+
const candidates = getCandidateWidths(config, width, sizes, fill);
|
|
105
|
+
const srcSet = unoptimized ? void 0 : candidates.widths.map((candidate, index) => {
|
|
106
|
+
const descriptor = candidates.descriptor === "w" ? `${candidate}w` : `${index + 1}x`;
|
|
107
|
+
return `${loader({ src, width: candidate, quality })} ${descriptor}`;
|
|
108
|
+
}).join(", ");
|
|
109
|
+
const renderedSrc = unoptimized ? src : loader({ src, width: candidates.widths.at(-1) ?? width ?? config.deviceSizes[0], quality });
|
|
110
|
+
const fillStyle = fill ? { position: "absolute", inset: 0, width: "100%", height: "100%" } : void 0;
|
|
111
|
+
const placeholderStyle = placeholder === "blur" ? {
|
|
112
|
+
backgroundImage: `url("${blurDataURL}")`,
|
|
113
|
+
backgroundPosition: "50% 50%",
|
|
114
|
+
backgroundRepeat: "no-repeat",
|
|
115
|
+
backgroundSize: "cover"
|
|
116
|
+
} : void 0;
|
|
117
|
+
return {
|
|
118
|
+
...rest,
|
|
119
|
+
alt,
|
|
120
|
+
src: renderedSrc,
|
|
121
|
+
srcSet,
|
|
122
|
+
sizes,
|
|
123
|
+
width: fill ? void 0 : width,
|
|
124
|
+
height: fill ? void 0 : height,
|
|
125
|
+
loading: preload ? "eager" : loading ?? "lazy",
|
|
126
|
+
fetchPriority: preload ? "high" : rest.fetchPriority,
|
|
127
|
+
decoding: rest.decoding ?? "async",
|
|
128
|
+
style: { ...fillStyle, ...placeholderStyle, ...style }
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
resolveImageAttributes
|
|
134
|
+
};
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
inferFarmIslandStrategy,
|
|
35
35
|
invalidateFarmRouteRootInferences,
|
|
36
36
|
isFarmDocsClientConfigModule,
|
|
37
|
+
isFarmLayoutModule,
|
|
37
38
|
mergeFarmViteAlias,
|
|
38
39
|
redactFarmDocsClientConfig,
|
|
39
40
|
resolveDevGlobalStylesheetHref,
|
|
@@ -43,7 +44,7 @@ import {
|
|
|
43
44
|
resolveFarmIslxActionsMode,
|
|
44
45
|
resolveFarmRouteRootStrategy,
|
|
45
46
|
toBakedMarkdownSourcePath
|
|
46
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-QLRI2BX5.mjs";
|
|
47
48
|
import {
|
|
48
49
|
generateFarmClientPluginEntryCode,
|
|
49
50
|
hasFarmServerRuntimePlugins,
|
|
@@ -59,12 +60,9 @@ import {
|
|
|
59
60
|
generateFarmTypeArtifacts,
|
|
60
61
|
resolveRouteRenderingConfig
|
|
61
62
|
} from "./chunk-4SJ22WTT.mjs";
|
|
62
|
-
import {
|
|
63
|
-
usesFarmRendererIslands
|
|
64
|
-
} from "./chunk-VTEAUQMT.mjs";
|
|
65
63
|
import {
|
|
66
64
|
_setFarmInfraAnalyticsWebMCPRoute
|
|
67
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-5D73SKF3.mjs";
|
|
68
66
|
import {
|
|
69
67
|
createFarmRouteRenderPlan,
|
|
70
68
|
farmPathGuardCoversEndpoint,
|
|
@@ -73,7 +71,7 @@ import {
|
|
|
73
71
|
getSharedLayoutPrefixLength,
|
|
74
72
|
parseFarmLayoutChainHeader,
|
|
75
73
|
renderFarmLocaleAlternateLinks
|
|
76
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-PEQJ4UUT.mjs";
|
|
77
75
|
import {
|
|
78
76
|
FARM_NATIVE_TREE_CONTENT_TYPE
|
|
79
77
|
} from "./chunk-LLZSYFOM.mjs";
|
|
@@ -91,13 +89,13 @@ import {
|
|
|
91
89
|
resolveFarmMCPRouteLabel,
|
|
92
90
|
resolveFarmMarkdownRouteLabel,
|
|
93
91
|
setFarmRouteLabel
|
|
94
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-4FGTNYHE.mjs";
|
|
95
93
|
import {
|
|
96
94
|
FARM_DEFAULT_MCP_PATH
|
|
97
95
|
} from "./chunk-HR4N2K4V.mjs";
|
|
98
96
|
import {
|
|
99
97
|
isFarmPreviewDeploymentEnvironment
|
|
100
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-Q73LRKLP.mjs";
|
|
101
99
|
import {
|
|
102
100
|
createFarmServerFnBoundaryModule,
|
|
103
101
|
isFarmServerFnBoundaryId,
|
|
@@ -105,7 +103,7 @@ import {
|
|
|
105
103
|
} from "./chunk-GNZIAJGB.mjs";
|
|
106
104
|
import {
|
|
107
105
|
resolveFarmLayoutFonts
|
|
108
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-TCGPBSVY.mjs";
|
|
109
107
|
import {
|
|
110
108
|
FARM_BROWSER_BUILTIN_PREFIX,
|
|
111
109
|
FARM_CLIENT_REFERENCE_DIRECTORY,
|
|
@@ -148,7 +146,7 @@ import {
|
|
|
148
146
|
usePackageScanCacheFile,
|
|
149
147
|
withFarmSourceSnapshotOf,
|
|
150
148
|
wrapFarmIslandContainers
|
|
151
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-26HESRBL.mjs";
|
|
152
150
|
import {
|
|
153
151
|
generateFarmDocsAdapterClientRuntime,
|
|
154
152
|
getFarmDocsAdapterConfigModule
|
|
@@ -170,6 +168,9 @@ import {
|
|
|
170
168
|
FARM_DEVTOOLS_PATH,
|
|
171
169
|
resolveFarmDevtoolsConfig
|
|
172
170
|
} from "./chunk-CU5SYTJG.mjs";
|
|
171
|
+
import {
|
|
172
|
+
usesFarmRendererIslands
|
|
173
|
+
} from "./chunk-X2SMVPLH.mjs";
|
|
173
174
|
import {
|
|
174
175
|
FARM_PREVIEW_ROBOTS_TAG,
|
|
175
176
|
resolveFarmAgentCrawlers,
|
|
@@ -194,10 +195,6 @@ import {
|
|
|
194
195
|
resolveFarmRendererAppSetup,
|
|
195
196
|
resolveFarmServerComponentsMode
|
|
196
197
|
} from "./chunk-HV6CYSMF.mjs";
|
|
197
|
-
import {
|
|
198
|
-
getPublicFarmImageConfig,
|
|
199
|
-
resolveFarmImageConfig
|
|
200
|
-
} from "./chunk-AOIUYHPH.mjs";
|
|
201
198
|
import {
|
|
202
199
|
FARM_PREVIEW_REQUEST_HEADER
|
|
203
200
|
} from "./chunk-7VJXYB6S.mjs";
|
|
@@ -234,7 +231,7 @@ import {
|
|
|
234
231
|
} from "./chunk-BMQAPZXD.mjs";
|
|
235
232
|
import {
|
|
236
233
|
MiddlewareManager
|
|
237
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-D7LXBLUW.mjs";
|
|
238
235
|
import {
|
|
239
236
|
_runWithMiddlewareContext,
|
|
240
237
|
_runWithMiddlewareData
|
|
@@ -250,7 +247,7 @@ import {
|
|
|
250
247
|
} from "./chunk-IYEY3JWJ.mjs";
|
|
251
248
|
import {
|
|
252
249
|
APIRouteManager
|
|
253
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-HFRG2IQS.mjs";
|
|
254
251
|
import {
|
|
255
252
|
getFarmI18nClientSnapshot
|
|
256
253
|
} from "./chunk-O7JEFGUV.mjs";
|
|
@@ -283,7 +280,7 @@ import {
|
|
|
283
280
|
invalidateFailedFarmDevModules,
|
|
284
281
|
invalidateFarmDevDependents,
|
|
285
282
|
loadFarmDevModule
|
|
286
|
-
} from "./chunk-
|
|
283
|
+
} from "./chunk-HX5HLFBZ.mjs";
|
|
287
284
|
import {
|
|
288
285
|
isFarmI18nCatalogFile,
|
|
289
286
|
resolveFarmI18nMessagePath
|
|
@@ -313,10 +310,14 @@ import {
|
|
|
313
310
|
} from "./chunk-EILUVBKS.mjs";
|
|
314
311
|
import {
|
|
315
312
|
FARM_VERSION
|
|
316
|
-
} from "./chunk-
|
|
313
|
+
} from "./chunk-O7K4HMAQ.mjs";
|
|
317
314
|
import {
|
|
318
315
|
DEFAULT_FARM_API_BASE_PATH
|
|
319
316
|
} from "./chunk-W6QLRQ3V.mjs";
|
|
317
|
+
import {
|
|
318
|
+
getPublicFarmImageConfig,
|
|
319
|
+
resolveFarmImageConfig
|
|
320
|
+
} from "./chunk-AOIUYHPH.mjs";
|
|
320
321
|
import {
|
|
321
322
|
createFarmPageDataRedirectResponse,
|
|
322
323
|
getFarmPageDataRedirectFromResponse
|
|
@@ -1288,7 +1289,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
1288
1289
|
return import("./workflows.mjs");
|
|
1289
1290
|
}
|
|
1290
1291
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
1291
|
-
return import("./devtools-
|
|
1292
|
+
return import("./devtools-GWJZPWIW.mjs");
|
|
1292
1293
|
}
|
|
1293
1294
|
function loadFarmDevtoolsUIRuntime() {
|
|
1294
1295
|
return import("./devtools-ui-BOG33MT5.mjs");
|
|
@@ -2298,6 +2299,22 @@ function isFarmAppRuntimeFile(file, appDirs, routeModuleExtensions) {
|
|
|
2298
2299
|
function shouldEmitFarmClientRootHmr(renderer) {
|
|
2299
2300
|
return getFarmRendererCapabilities(resolveFarmRenderer(renderer)).reconcilesRerenders;
|
|
2300
2301
|
}
|
|
2302
|
+
function reachesSharedFarmRendererIsland(graph, file, islandModules) {
|
|
2303
|
+
const queue = Array.from(graph?.getModulesByFile(file) ?? []);
|
|
2304
|
+
const seen = new Set(queue);
|
|
2305
|
+
for (const node of queue) {
|
|
2306
|
+
if (node.file && islandModules.has(path6.resolve(node.file))) {
|
|
2307
|
+
if (node.importers.size > 0) return true;
|
|
2308
|
+
continue;
|
|
2309
|
+
}
|
|
2310
|
+
for (const importer of node.importers) {
|
|
2311
|
+
if (seen.has(importer)) continue;
|
|
2312
|
+
seen.add(importer);
|
|
2313
|
+
queue.push(importer);
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
return false;
|
|
2317
|
+
}
|
|
2301
2318
|
var FARM_RUNTIME_MODULE_PREFIX = "/@farm/runtime/";
|
|
2302
2319
|
function toFarmRuntimeModuleId(specifier) {
|
|
2303
2320
|
return FARM_RUNTIME_MODULE_PREFIX + specifier;
|
|
@@ -2332,7 +2349,9 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
|
|
|
2332
2349
|
const fontImports = farmFontImportsPlugin({
|
|
2333
2350
|
root: options.root,
|
|
2334
2351
|
basePath: options.basePath,
|
|
2335
|
-
publicDir: options.publicDir
|
|
2352
|
+
publicDir: options.publicDir,
|
|
2353
|
+
// A production build never starts the app, so it reads the directories from these options.
|
|
2354
|
+
isLayoutModule: (id) => isFarmLayoutModule(id, getFarmAppDirectories(farmApp?.getConfig() ?? options))
|
|
2336
2355
|
});
|
|
2337
2356
|
let farmApp;
|
|
2338
2357
|
const isFarmGeneratedOutput = (file) => {
|
|
@@ -5216,7 +5235,17 @@ export { manifest };
|
|
|
5216
5235
|
);
|
|
5217
5236
|
return;
|
|
5218
5237
|
}` : "";
|
|
5219
|
-
const
|
|
5238
|
+
const rendererIslandHmr = rendererIslandModule && !transformOptions?.ssr && !/\bimport\.meta\.hot\b/.test(transformedCode) && shouldEmitFarmClientRootHmr(currentConfig.renderer);
|
|
5239
|
+
const hmrCode = rendererIslandHmr ? `
|
|
5240
|
+
if (import.meta.hot) {
|
|
5241
|
+
import.meta.hot.accept((newModule) => {
|
|
5242
|
+
const runtime = window.__FARM_ISOLATED_HYDRATION_RUNTIME__;
|
|
5243
|
+
if (!newModule || !runtime?.updateModule?.(${JSON.stringify(toViteModuleId(cleanId, root))}, newModule)) {
|
|
5244
|
+
import.meta.hot.invalidate();
|
|
5245
|
+
}
|
|
5246
|
+
});
|
|
5247
|
+
}
|
|
5248
|
+
` : transformOptions?.ssr || reactRefreshActive || rendererIslandModule || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
|
|
5220
5249
|
if (import.meta.hot) {
|
|
5221
5250
|
import.meta.hot.accept((newModule) => {
|
|
5222
5251
|
${isolatedHmrUpdate}
|
|
@@ -5517,6 +5546,14 @@ if (import.meta.hot) {
|
|
|
5517
5546
|
return [];
|
|
5518
5547
|
}
|
|
5519
5548
|
}
|
|
5549
|
+
if (currentFarmConfig && planRouteManager && usesFarmRendererIslands(currentFarmConfig) && shouldEmitFarmClientRootHmr(currentFarmConfig.renderer) && reachesSharedFarmRendererIsland(
|
|
5550
|
+
server2.environments.client?.moduleGraph,
|
|
5551
|
+
normalizedFile,
|
|
5552
|
+
planRouteManager.getIsolatedClientBoundaryModules(currentFarmConfig.root)
|
|
5553
|
+
)) {
|
|
5554
|
+
reloadAfterEdit();
|
|
5555
|
+
return [];
|
|
5556
|
+
}
|
|
5520
5557
|
if (/\.[cm]?[jt]sx?$/.test(normalizedFile) && !server2.environments.client?.moduleGraph.getModulesByFile(normalizedFile)?.size && invalidateFarmDevDependents(server2, file, getFarmRenderedServerModules()).length > 0) {
|
|
5521
5558
|
logUpdate("PAGE", `updated ${path6.basename(file)}`);
|
|
5522
5559
|
reloadAfterEdit();
|
|
@@ -8363,6 +8400,7 @@ export {
|
|
|
8363
8400
|
transformIsolatedClientBoundaryModule,
|
|
8364
8401
|
isFarmAppRuntimeFile,
|
|
8365
8402
|
shouldEmitFarmClientRootHmr,
|
|
8403
|
+
reachesSharedFarmRendererIsland,
|
|
8366
8404
|
farmPlugin,
|
|
8367
8405
|
defineConfig
|
|
8368
8406
|
};
|
|
@@ -18,6 +18,9 @@ var _chunkLSHX2H5Gcjs = require('./chunk-LSHX2H5G.cjs');
|
|
|
18
18
|
var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
var _chunkZ43CIBURcjs = require('./chunk-Z43CIBUR.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
|
|
@@ -48,9 +51,6 @@ var _chunk52Q4OB4Acjs = require('./chunk-52Q4OB4A.cjs');
|
|
|
48
51
|
var _chunkT7UC2ORAcjs = require('./chunk-T7UC2ORA.cjs');
|
|
49
52
|
|
|
50
53
|
|
|
51
|
-
var _chunkMCSRMEQVcjs = require('./chunk-MCSRMEQV.cjs');
|
|
52
|
-
|
|
53
|
-
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
var _chunkHQKCSJEHcjs = require('./chunk-HQKCSJEH.cjs');
|
|
@@ -96,6 +96,9 @@ var _chunk7Q7UB4TLcjs = require('./chunk-7Q7UB4TL.cjs');
|
|
|
96
96
|
var _chunkPMJSG4JScjs = require('./chunk-PMJSG4JS.cjs');
|
|
97
97
|
|
|
98
98
|
|
|
99
|
+
var _chunkMCSRMEQVcjs = require('./chunk-MCSRMEQV.cjs');
|
|
100
|
+
|
|
101
|
+
|
|
99
102
|
var _chunkNLBHLPEOcjs = require('./chunk-NLBHLPEO.cjs');
|
|
100
103
|
|
|
101
104
|
|
|
@@ -1057,6 +1060,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
1057
1060
|
mode
|
|
1058
1061
|
});
|
|
1059
1062
|
userConfig = layerResolution.config;
|
|
1063
|
+
const rendererServerComponentsIslands = _chunkZ43CIBURcjs.resolveFarmRendererServerComponentsIslands.call(void 0, userConfig);
|
|
1060
1064
|
if (userConfig.typescript !== void 0) {
|
|
1061
1065
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
1062
1066
|
'The top-level "typescript" option is not supported and has no effect. Configure TypeScript in `tsconfig.json` and run `tsc --noEmit` separately when builds must enforce project type errors.'
|
|
@@ -1184,7 +1188,9 @@ async function resolveConfig(userConfig, mode) {
|
|
|
1184
1188
|
// isolatedClientHydration itself.
|
|
1185
1189
|
isolatedClientHydration: _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([userConfig, 'access', _55 => _55.experimental, 'optionalAccess', _56 => _56.serverComponents])) === "islands" ? "enabled" : "off",
|
|
1186
1190
|
ppr: false,
|
|
1187
|
-
...userConfig.experimental
|
|
1191
|
+
...userConfig.experimental,
|
|
1192
|
+
// Another renderer's islands run without Farm's server components engine, which renders React.
|
|
1193
|
+
...rendererServerComponentsIslands ? { serverComponents: false } : {}
|
|
1188
1194
|
},
|
|
1189
1195
|
agent: resolveFarmAgentConfig(userConfig.agent, {
|
|
1190
1196
|
docs: docs.enabled,
|
|
@@ -0,0 +1,47 @@
|
|
|
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; }// src/font.ts
|
|
2
|
+
function defineLayoutFonts(fonts) {
|
|
3
|
+
return fonts;
|
|
4
|
+
}
|
|
5
|
+
function resolveFarmLayoutFonts(layouts) {
|
|
6
|
+
let resolved;
|
|
7
|
+
for (const layout of layouts) {
|
|
8
|
+
const fonts = _nullishCoalesce(layout.fonts, () => ( layout.__farmLayoutFonts));
|
|
9
|
+
if (!fonts) continue;
|
|
10
|
+
resolved = { ...resolved, ...fonts };
|
|
11
|
+
}
|
|
12
|
+
return resolved;
|
|
13
|
+
}
|
|
14
|
+
function inferFarmLayoutFonts(uses) {
|
|
15
|
+
const fonts = uses.filter((use) => isFarmFont(use[0]));
|
|
16
|
+
const body = _nullishCoalesce(_optionalChain([fonts, 'access', _ => _.find, 'call', _2 => _2(([, property]) => property === "className"), 'optionalAccess', _3 => _3[0]]), () => ( _optionalChain([fonts, 'access', _4 => _4.find, 'call', _5 => _5(([font]) => !isMonospaceFont(font)), 'optionalAccess', _6 => _6[0]])));
|
|
17
|
+
const code = _nullishCoalesce(_optionalChain([fonts, 'access', _7 => _7.find, 'call', _8 => _8(([font]) => font !== body && isMonospaceFont(font)), 'optionalAccess', _9 => _9[0]]), () => ( (body && isMonospaceFont(body) ? body : void 0)));
|
|
18
|
+
if (!body && !code) return void 0;
|
|
19
|
+
return { ...body ? { body } : {}, ...code ? { code } : {} };
|
|
20
|
+
}
|
|
21
|
+
function isFarmFont(value) {
|
|
22
|
+
if (!value || typeof value !== "object") return false;
|
|
23
|
+
const font = value;
|
|
24
|
+
return typeof font.className === "string" && typeof font.variable === "string" && typeof _optionalChain([font, 'access', _10 => _10.style, 'optionalAccess', _11 => _11.fontFamily]) === "string" && Array.isArray(font.preloads);
|
|
25
|
+
}
|
|
26
|
+
function isMonospaceFont(font) {
|
|
27
|
+
return /(?:^|,)\s*monospace\s*$/i.test(font.style.fontFamily);
|
|
28
|
+
}
|
|
29
|
+
function fontCompilerError(loader) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`[Farm fonts] ${loader}() must be called at module scope with static options and compiled by the Farm Vite plugin.`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function localFont(_options) {
|
|
35
|
+
return fontCompilerError("localFont");
|
|
36
|
+
}
|
|
37
|
+
function remoteFont(_options) {
|
|
38
|
+
return fontCompilerError("remoteFont");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
exports.defineLayoutFonts = defineLayoutFonts; exports.resolveFarmLayoutFonts = resolveFarmLayoutFonts; exports.inferFarmLayoutFonts = inferFarmLayoutFonts; exports.localFont = localFont; exports.remoteFont = remoteFont;
|
|
@@ -56,10 +56,10 @@ import {
|
|
|
56
56
|
stripRouteGroups,
|
|
57
57
|
takeFarmHoistedHead,
|
|
58
58
|
takeFarmNavigationOutlet
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-PEQJ4UUT.mjs";
|
|
60
60
|
import {
|
|
61
61
|
listFarmMCPLlmsTxtLinks
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-4FGTNYHE.mjs";
|
|
63
63
|
import {
|
|
64
64
|
FARM_DEFAULT_MCP_PATH,
|
|
65
65
|
collectFarmDefaultMCPPages,
|
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
traceFarmSourceReads,
|
|
105
105
|
usesFarmServerTree,
|
|
106
106
|
withFarmSourceSnapshot
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-26HESRBL.mjs";
|
|
108
108
|
import {
|
|
109
109
|
_setDefaultFarmThemeConfig,
|
|
110
110
|
getTheme
|
|
@@ -166,9 +166,6 @@ import {
|
|
|
166
166
|
resolveFarmRendererModule,
|
|
167
167
|
resolveFarmServerComponentsMode
|
|
168
168
|
} from "./chunk-HV6CYSMF.mjs";
|
|
169
|
-
import {
|
|
170
|
-
resolveFarmImageConfig
|
|
171
|
-
} from "./chunk-AOIUYHPH.mjs";
|
|
172
169
|
import {
|
|
173
170
|
resolveCronConfig
|
|
174
171
|
} from "./chunk-7VJXYB6S.mjs";
|
|
@@ -266,8 +263,9 @@ import {
|
|
|
266
263
|
toFileModuleUrl
|
|
267
264
|
} from "./chunk-VHIXGZYH.mjs";
|
|
268
265
|
import {
|
|
266
|
+
createFarmDevModuleCheck,
|
|
269
267
|
loadFarmDevModule
|
|
270
|
-
} from "./chunk-
|
|
268
|
+
} from "./chunk-HX5HLFBZ.mjs";
|
|
271
269
|
import {
|
|
272
270
|
resolveFarmI18nConfig
|
|
273
271
|
} from "./chunk-VJSXPN3W.mjs";
|
|
@@ -306,10 +304,13 @@ import {
|
|
|
306
304
|
} from "./chunk-EILUVBKS.mjs";
|
|
307
305
|
import {
|
|
308
306
|
FARM_VERSION
|
|
309
|
-
} from "./chunk-
|
|
307
|
+
} from "./chunk-O7K4HMAQ.mjs";
|
|
310
308
|
import {
|
|
311
309
|
normalizeFarmAPIConfig
|
|
312
310
|
} from "./chunk-W6QLRQ3V.mjs";
|
|
311
|
+
import {
|
|
312
|
+
resolveFarmImageConfig
|
|
313
|
+
} from "./chunk-AOIUYHPH.mjs";
|
|
313
314
|
import {
|
|
314
315
|
_setFarmSearchPreserveRoutes
|
|
315
316
|
} from "./chunk-VDQZV6BX.mjs";
|
|
@@ -2206,7 +2207,7 @@ function farmFontImportsPlugin(options = {}) {
|
|
|
2206
2207
|
production
|
|
2207
2208
|
);
|
|
2208
2209
|
},
|
|
2209
|
-
async transform(code, id) {
|
|
2210
|
+
async transform(code, id, transformOptions) {
|
|
2210
2211
|
const result = await transformFarmFontCalls({
|
|
2211
2212
|
code,
|
|
2212
2213
|
id,
|
|
@@ -2217,6 +2218,13 @@ function farmFontImportsPlugin(options = {}) {
|
|
|
2217
2218
|
register: (moduleId, calls) => registry.register(moduleId, calls, production)
|
|
2218
2219
|
});
|
|
2219
2220
|
if (!result) registry.clearModule(id.split("?", 1)[0]);
|
|
2221
|
+
const server = this.environment ? this.environment.config.consumer === "server" : transformOptions?.ssr === true;
|
|
2222
|
+
const cleanId = id.split("?", 1)[0];
|
|
2223
|
+
if (server && MODULE_EXTENSION_RE.test(cleanId) && options.isLayoutModule?.(cleanId)) {
|
|
2224
|
+
const source = result?.code ?? code;
|
|
2225
|
+
const inferred = addInferredLayoutFonts(source, this.parse(source));
|
|
2226
|
+
if (inferred) return { code: inferred, map: null };
|
|
2227
|
+
}
|
|
2220
2228
|
return result ? { code: result.code, map: null } : null;
|
|
2221
2229
|
},
|
|
2222
2230
|
async generateBundle(_options, bundle) {
|
|
@@ -2561,6 +2569,74 @@ ${FONT_SECTION_END}
|
|
|
2561
2569
|
return resource;
|
|
2562
2570
|
}
|
|
2563
2571
|
};
|
|
2572
|
+
function isFarmLayoutModule(id, appDirs) {
|
|
2573
|
+
if (!/\/layout\.[cm]?[jt]sx?$/.test(id)) return false;
|
|
2574
|
+
return appDirs.some((appDir) => id.startsWith(`${appDir.replace(/\\/g, "/")}/`));
|
|
2575
|
+
}
|
|
2576
|
+
var LAYOUT_FONTS_EXPORT = "__farmLayoutFonts";
|
|
2577
|
+
var LAYOUT_FONT_PROPERTIES = /* @__PURE__ */ new Set(["className", "variable"]);
|
|
2578
|
+
function addInferredLayoutFonts(code, ast) {
|
|
2579
|
+
const body = (Array.isArray(ast.body) ? ast.body : []).filter(isAstNode);
|
|
2580
|
+
if (body.some((statement) => statement.type === "ExportAllDeclaration")) return null;
|
|
2581
|
+
if (moduleExports(body, "fonts") || moduleExports(body, LAYOUT_FONTS_EXPORT)) return null;
|
|
2582
|
+
const bindings = moduleScopeBindings(body);
|
|
2583
|
+
const uses = [];
|
|
2584
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2585
|
+
walkAst(ast, (node) => {
|
|
2586
|
+
if (node.type !== "MemberExpression" || node.computed === true) return;
|
|
2587
|
+
if (!isAstNode(node.object) || node.object.type !== "Identifier") return;
|
|
2588
|
+
const name = node.object.name;
|
|
2589
|
+
const property2 = readPropertyName(node.property);
|
|
2590
|
+
if (typeof name !== "string" || !bindings.has(name)) return;
|
|
2591
|
+
if (!property2 || !LAYOUT_FONT_PROPERTIES.has(property2)) return;
|
|
2592
|
+
const key = `${name}.${property2}`;
|
|
2593
|
+
if (seen.has(key)) return;
|
|
2594
|
+
seen.add(key);
|
|
2595
|
+
uses.push(`[${name}, ${JSON.stringify(property2)}]`);
|
|
2596
|
+
});
|
|
2597
|
+
if (uses.length === 0) return null;
|
|
2598
|
+
return `${code}
|
|
2599
|
+
import { inferFarmLayoutFonts as __farmInferLayoutFonts } from "@farm.js/core/font";
|
|
2600
|
+
export const ${LAYOUT_FONTS_EXPORT} = /* @__PURE__ */ __farmInferLayoutFonts([${uses.join(", ")}]);
|
|
2601
|
+
`;
|
|
2602
|
+
}
|
|
2603
|
+
function moduleExports(body, name) {
|
|
2604
|
+
return body.some((statement) => {
|
|
2605
|
+
if (statement.type !== "ExportNamedDeclaration") return false;
|
|
2606
|
+
const specifiers = Array.isArray(statement.specifiers) ? statement.specifiers : [];
|
|
2607
|
+
if (specifiers.some((specifier) => readPropertyName(specifier.exported) === name)) return true;
|
|
2608
|
+
return isAstNode(statement.declaration) && declaredNames(statement.declaration).includes(name);
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2611
|
+
function moduleScopeBindings(body) {
|
|
2612
|
+
const names = /* @__PURE__ */ new Set();
|
|
2613
|
+
for (const statement of body) {
|
|
2614
|
+
if (statement.type === "ImportDeclaration") {
|
|
2615
|
+
if (statement.importKind === "type") continue;
|
|
2616
|
+
const specifiers = Array.isArray(statement.specifiers) ? statement.specifiers : [];
|
|
2617
|
+
for (const specifier of specifiers) {
|
|
2618
|
+
if (specifier.importKind === "type" || !isAstNode(specifier.local)) continue;
|
|
2619
|
+
if (typeof specifier.local.name === "string") names.add(specifier.local.name);
|
|
2620
|
+
}
|
|
2621
|
+
continue;
|
|
2622
|
+
}
|
|
2623
|
+
const declaration = statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
|
|
2624
|
+
if (isAstNode(declaration)) for (const name of declaredNames(declaration)) names.add(name);
|
|
2625
|
+
}
|
|
2626
|
+
return names;
|
|
2627
|
+
}
|
|
2628
|
+
function declaredNames(declaration) {
|
|
2629
|
+
if (declaration.type === "VariableDeclaration") {
|
|
2630
|
+
const declarations = Array.isArray(declaration.declarations) ? declaration.declarations : [];
|
|
2631
|
+
return declarations.flatMap(
|
|
2632
|
+
(declarator) => isAstNode(declarator.id) && declarator.id.type === "Identifier" && typeof declarator.id.name === "string" ? [declarator.id.name] : []
|
|
2633
|
+
);
|
|
2634
|
+
}
|
|
2635
|
+
if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && isAstNode(declaration.id) && typeof declaration.id.name === "string") {
|
|
2636
|
+
return [declaration.id.name];
|
|
2637
|
+
}
|
|
2638
|
+
return [];
|
|
2639
|
+
}
|
|
2564
2640
|
function findFontBindings(ast) {
|
|
2565
2641
|
const named = /* @__PURE__ */ new Map();
|
|
2566
2642
|
const namespaces = /* @__PURE__ */ new Set();
|
|
@@ -4264,6 +4340,7 @@ var ServerRenderer = class {
|
|
|
4264
4340
|
constructor(config, routeManager, i18nRuntime, viteServer) {
|
|
4265
4341
|
this.ssgManifest = [];
|
|
4266
4342
|
this.dataCache = getFarmDataCache();
|
|
4343
|
+
this.rendererServerModuleCurrent = () => true;
|
|
4267
4344
|
this.config = config;
|
|
4268
4345
|
this.routeManager = routeManager;
|
|
4269
4346
|
this.i18nRuntime = i18nRuntime;
|
|
@@ -4272,7 +4349,7 @@ var ServerRenderer = class {
|
|
|
4272
4349
|
this.loadSSGManifest();
|
|
4273
4350
|
}
|
|
4274
4351
|
async initialize() {
|
|
4275
|
-
if (this.rendererRuntime) return;
|
|
4352
|
+
if (this.rendererRuntime && this.rendererServerModuleCurrent()) return;
|
|
4276
4353
|
if (this.islandValues()) {
|
|
4277
4354
|
installFarmIslandValues();
|
|
4278
4355
|
(await import("./internal/islands-server.mjs")).installFarmIslandsServer();
|
|
@@ -4289,6 +4366,7 @@ var ServerRenderer = class {
|
|
|
4289
4366
|
this.config.renderer.server
|
|
4290
4367
|
)
|
|
4291
4368
|
).href);
|
|
4369
|
+
this.rendererServerModuleCurrent = this.viteServer && !isReactRenderer(this.config.renderer) && !isFarmRendererDisabled(this.config.renderer) ? createFarmDevModuleCheck(this.viteServer, loaded) : () => true;
|
|
4292
4370
|
const runtime = loaded;
|
|
4293
4371
|
assertFarmRendererServerModule(runtime, this.config.renderer);
|
|
4294
4372
|
assertFarmRendererStreamingRuntime(
|
|
@@ -6734,7 +6812,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6734
6812
|
const renderToPipeableStream = runtime.renderToPipeableStream ?? (getFarmRendererStreamingCapabilitiesForRuntime(this.config.renderer, "node").web && runtime.renderToReadableStream ? pipeFarmRendererWebStream(runtime) : void 0);
|
|
6735
6813
|
const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
6736
6814
|
const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument(req);
|
|
6737
|
-
if (!renderToPipeableStream || _isFarmMarkdownPageCheck(req.headers?.[FARM_MARKDOWN_PAGE_CHECK_HEADER]) || streamDocument &&
|
|
6815
|
+
if (!renderToPipeableStream || _isFarmMarkdownPageCheck(req.headers?.[FARM_MARKDOWN_PAGE_CHECK_HEADER]) || streamDocument && options.captureStaticShell) {
|
|
6738
6816
|
return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
|
|
6739
6817
|
}
|
|
6740
6818
|
return new Promise((resolve3, reject) => {
|
|
@@ -8810,6 +8888,7 @@ export {
|
|
|
8810
8888
|
RouteManager,
|
|
8811
8889
|
createFarmDevClientManifest,
|
|
8812
8890
|
farmFontImportsPlugin,
|
|
8891
|
+
isFarmLayoutModule,
|
|
8813
8892
|
mergeFarmFontCss,
|
|
8814
8893
|
resolveDevGlobalStylesheetHref,
|
|
8815
8894
|
collectDevStylesheetUrls,
|