@farm.js/core 0.1.41 → 0.1.43
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-BOqIxJLI.d.mts → agent-mcp-3KDz4hr9.d.mts} +1 -1
- package/dist/{agent-mcp-D0eZKfci.d.ts → agent-mcp-6yRebHk7.d.ts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- 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 +8 -3
- package/dist/api.d.ts +8 -3
- package/dist/api.mjs +1 -1
- package/dist/{app-DM8e1z3G.d.ts → app-8Db1zR-2.d.ts} +8 -4
- package/dist/{app-CzTSMJaf.d.mts → app-DlTWv4cn.d.mts} +8 -4
- package/dist/app-manifest-TRzS7ZZ9.d.mts +120 -0
- package/dist/app-manifest-cO2jkG1F.d.ts +120 -0
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/{chunk-ECKF2BAM.cjs → chunk-2GVF3C2F.cjs} +255 -42
- package/dist/chunk-2NXO5SBY.mjs +57 -0
- package/dist/chunk-3BROEWFY.cjs +39 -0
- package/dist/{chunk-ENOBPDKZ.mjs → chunk-4MRQ5OKQ.mjs} +14 -9
- package/dist/{chunk-R65GCA6A.mjs → chunk-4OCEMK72.mjs} +260 -49
- package/dist/{chunk-6PKXK4TY.mjs → chunk-53ZV6K65.mjs} +1 -1
- package/dist/{chunk-LYIZHJTK.cjs → chunk-5LPHJZSI.cjs} +14 -14
- package/dist/chunk-5NIWBWDD.mjs +97 -0
- package/dist/{chunk-NRDBW4MP.mjs → chunk-7IQQIPRZ.mjs} +10 -0
- package/dist/{chunk-FJGIVDA5.mjs → chunk-7SCCY6SI.mjs} +80 -177
- package/dist/chunk-APDGOKKE.cjs +148 -0
- package/dist/chunk-AZBSVLRM.cjs +132 -0
- package/dist/{chunk-PN676AZF.cjs → chunk-BKPXWRTT.cjs} +6 -6
- package/dist/chunk-CEDPEDNW.cjs +98 -0
- package/dist/chunk-D5RFPV2H.mjs +148 -0
- package/dist/{chunk-BYQVROIP.mjs → chunk-DMRPN25V.mjs} +69 -0
- package/dist/{chunk-724JLMS4.mjs → chunk-F646BZ4Y.mjs} +4 -2
- package/dist/{chunk-C5KVWHIH.cjs → chunk-G2Z5DGMS.cjs} +5 -3
- package/dist/{chunk-L6HYACBE.cjs → chunk-GVNCWSQV.cjs} +145 -127
- package/dist/{chunk-24SP5TGU.mjs → chunk-H4LXPWI2.mjs} +2 -2
- package/dist/chunk-H7BLEEAE.cjs +57 -0
- package/dist/{chunk-JOTUZIM4.cjs → chunk-HUMEHX24.cjs} +2 -2
- package/dist/{chunk-BD3D7EZV.cjs → chunk-IXFOBGLQ.cjs} +9 -3
- package/dist/{chunk-3TB5QGUW.cjs → chunk-JAXDRRRC.cjs} +70 -1
- package/dist/{chunk-32TZ3QTP.cjs → chunk-JDJAPCR2.cjs} +421 -210
- package/dist/{chunk-MHN4UR5U.cjs → chunk-KFZZFZ7J.cjs} +7 -7
- package/dist/chunk-LRJRXXQZ.cjs +109 -0
- package/dist/{chunk-EX4MKHXN.cjs → chunk-LVABUXLA.cjs} +22 -17
- package/dist/{chunk-HCSVR4YZ.mjs → chunk-M3BXTWJM.mjs} +18 -0
- package/dist/{chunk-PYHPXPSW.mjs → chunk-NXO75WY4.mjs} +1 -1
- package/dist/{chunk-BGGWKZ2V.mjs → chunk-OYSGGV6O.mjs} +137 -167
- package/dist/{chunk-JR4QCLJY.cjs → chunk-PDU4P2IC.cjs} +19 -1
- package/dist/chunk-PJEHUSHA.mjs +229 -0
- package/dist/chunk-QGH2RQVF.mjs +132 -0
- package/dist/{chunk-YWMZUGIS.mjs → chunk-R3ZFQJEF.mjs} +247 -34
- package/dist/{chunk-ROQ4C4LJ.cjs → chunk-RACQTC7K.cjs} +274 -371
- package/dist/{chunk-WSOBCAYO.cjs → chunk-RQYTOFQM.cjs} +23 -23
- package/dist/chunk-S34OBRMZ.mjs +109 -0
- package/dist/{chunk-TS4JHGUJ.mjs → chunk-S3ZEMCE6.mjs} +9 -3
- package/dist/{chunk-WWFTAUFG.cjs → chunk-SBH2JLLF.cjs} +12 -2
- package/dist/{chunk-YSLWRWWP.cjs → chunk-SKK6UF5P.cjs} +200 -46
- package/dist/chunk-T7J7E63D.cjs +144 -0
- package/dist/{chunk-SVPGWJZF.mjs → chunk-TESO7EFU.mjs} +125 -107
- package/dist/{chunk-OQ4YXWH4.cjs → chunk-VIVQERJ5.cjs} +320 -351
- package/dist/{chunk-JIYYX7WU.mjs → chunk-VLXNGUKO.mjs} +1 -1
- package/dist/{chunk-OFZUJMCU.mjs → chunk-WPJQN64R.mjs} +195 -41
- package/dist/chunk-XARSG2TG.mjs +144 -0
- package/dist/chunk-XUGFRFD2.mjs +39 -0
- package/dist/{chunk-EH3464KF.cjs → chunk-YBDSTNMH.cjs} +1 -1
- package/dist/{chunk-VLPII2JJ.mjs → chunk-YGZH4T2X.mjs} +1 -1
- package/dist/chunk-YKUEJ3MG.cjs +229 -0
- package/dist/{chunk-4C7KTKX7.mjs → chunk-ZYWJIPKQ.mjs} +1 -1
- package/dist/{client-plugins-CkYwvDJ0.d.mts → client-plugins-Cv0OJtnM.d.mts} +98 -7
- package/dist/{client-plugins-DfeKd0sD.d.ts → client-plugins-kwQuZcWq.d.ts} +98 -7
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +4 -3
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +3 -2
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-N3QLRIQU.mjs → devtools-M22FEFPK.mjs} +4 -4
- package/dist/{devtools-2YHAJYH6.cjs → devtools-MLB3JJMC.cjs} +5 -5
- package/dist/docs.cjs +6 -6
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +5 -5
- package/dist/index-CQOp8EmB.d.mts +48 -0
- package/dist/index-DAl0QTZS.d.ts +48 -0
- package/dist/index.cjs +41 -24
- package/dist/index.d.mts +15 -14
- package/dist/index.d.ts +15 -14
- package/dist/index.mjs +46 -29
- 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 +29 -15
- package/dist/internal/build-runtime.d.mts +12 -16
- package/dist/internal/build-runtime.d.ts +12 -16
- package/dist/internal/build-runtime.mjs +28 -14
- package/dist/internal/cli-runtime.cjs +23 -11
- package/dist/internal/cli-runtime.mjs +23 -11
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +5 -1
- package/dist/internal/client-runtime.d.mts +1 -0
- package/dist/internal/client-runtime.d.ts +1 -0
- package/dist/internal/client-runtime.mjs +4 -0
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +5 -5
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/internal/form-actions-client.cjs +18 -0
- package/dist/internal/form-actions-client.d.mts +5 -0
- package/dist/internal/form-actions-client.d.ts +5 -0
- package/dist/internal/form-actions-client.mjs +18 -0
- package/dist/internal/form-actions.cjs +18 -0
- package/dist/internal/form-actions.d.mts +14 -0
- package/dist/internal/form-actions.d.ts +14 -0
- package/dist/internal/form-actions.mjs +18 -0
- package/dist/internal/island-codec.cjs +22 -0
- package/dist/internal/island-codec.d.mts +29 -0
- package/dist/internal/island-codec.d.ts +29 -0
- package/dist/internal/island-codec.mjs +22 -0
- package/dist/internal/island-value-store.cjs +13 -0
- package/dist/internal/island-value-store.d.mts +6 -0
- package/dist/internal/island-value-store.d.ts +6 -0
- package/dist/internal/island-value-store.mjs +13 -0
- package/dist/internal/islands-runtime.cjs +77 -0
- package/dist/internal/islands-runtime.d.mts +57 -0
- package/dist/internal/islands-runtime.d.ts +57 -0
- package/dist/internal/islands-runtime.mjs +77 -0
- package/dist/internal/islands-server.cjs +19 -0
- package/dist/internal/islands-server.d.mts +3 -0
- package/dist/internal/islands-server.d.ts +3 -0
- package/dist/internal/islands-server.mjs +19 -0
- package/dist/internal/islx-client.cjs +5 -0
- package/dist/internal/islx-client.d.mts +2 -0
- package/dist/internal/islx-client.d.ts +2 -0
- package/dist/internal/islx-client.mjs +3 -0
- package/dist/internal/islx-react.cjs +4 -0
- package/dist/internal/islx-react.d.mts +1 -0
- package/dist/internal/islx-react.d.ts +1 -0
- package/dist/internal/islx-react.mjs +2 -0
- package/dist/internal/islx-server.cjs +5 -0
- package/dist/internal/islx-server.d.mts +2 -0
- package/dist/internal/islx-server.d.ts +2 -0
- package/dist/internal/islx-server.mjs +3 -0
- package/dist/internal/isolated-boundary.cjs +4 -3
- package/dist/internal/isolated-boundary.d.mts +13 -1
- package/dist/internal/isolated-boundary.d.ts +13 -1
- package/dist/internal/isolated-boundary.mjs +3 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +24 -7
- package/dist/internal/production-runtime.d.mts +20 -127
- package/dist/internal/production-runtime.d.ts +20 -127
- package/dist/internal/production-runtime.mjs +24 -7
- package/dist/internal/server-tree.cjs +6 -3
- package/dist/internal/server-tree.d.mts +25 -2
- package/dist/internal/server-tree.d.ts +25 -2
- package/dist/internal/server-tree.mjs +7 -4
- package/dist/island-value-protocol-BRayRghM.d.mts +12 -0
- package/dist/island-value-protocol-BRayRghM.d.ts +12 -0
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.ts +3 -3
- package/dist/navigation.cjs +5 -4
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +4 -3
- package/dist/og.d.mts +5 -0
- package/dist/og.d.ts +5 -0
- package/dist/plugin.cjs +18 -12
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +17 -11
- package/dist/{production-runtime-DFC7pgbp.d.ts → production-runtime-5nArjFpn.d.ts} +1 -1
- package/dist/{production-runtime-BTkXQdYy.d.mts → production-runtime-BzsF2z5F.d.mts} +1 -1
- package/dist/query/client.cjs +6 -5
- package/dist/query/client.mjs +2 -1
- package/dist/{render-plan-5rFeWmk7.d.mts → render-plan-B9yQorV4.d.mts} +4 -2
- package/dist/{render-plan-BoAK9xFC.d.ts → render-plan-fg6E_HvL.d.ts} +4 -2
- package/dist/renderer/react/server.cjs +7 -6
- package/dist/renderer/react/server.d.mts +3 -1
- package/dist/renderer/react/server.d.ts +3 -1
- package/dist/renderer/react/server.mjs +5 -4
- package/dist/renderer-client.cjs +5 -4
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +2 -1
- package/dist/renderer.d.mts +3 -1
- package/dist/renderer.d.ts +3 -1
- package/dist/{request-BxBWigtl.d.mts → request-C4j_g-BH.d.mts} +1 -1
- package/dist/{request-fciwmd3n.d.ts → request-gz8vFK0n.d.ts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering-BLZT0IP0.d.ts → route-rendering-DamyKVi3.d.ts} +1 -1
- package/dist/{route-rendering-BCM1QzEf.d.mts → route-rendering-iTTOwz1f.d.mts} +1 -1
- package/dist/{router-DyZJWc1_.d.mts → router-EoSzHlos.d.mts} +1 -1
- package/dist/{router-CkheNX3-.d.ts → router-OVjDqVo8.d.ts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/rsc-pipeline-LK4K5JFK.mjs +77 -0
- package/dist/rsc-pipeline-YCDRJME4.cjs +77 -0
- package/dist/{runtime-DfU4sKa5.d.ts → runtime-CwiuozLd.d.ts} +1 -1
- package/dist/{runtime-wexvUN5J.d.mts → runtime-DDH4tiuF.d.mts} +1 -1
- package/dist/{schema-dev-notice-5JPE67AI.cjs → schema-dev-notice-77ZL23PL.cjs} +4 -4
- package/dist/{schema-dev-notice-WLPZ6WKU.mjs → schema-dev-notice-BLXOS6U2.mjs} +2 -2
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server.cjs +56 -38
- package/dist/server.d.mts +15 -10
- package/dist/server.d.ts +15 -10
- package/dist/server.mjs +36 -18
- package/dist/{spa-router-DgsMXqfX.d.mts → spa-router-Br4qFCWf.d.mts} +8 -3
- package/dist/{spa-router-CcejECnG.d.ts → spa-router-BsWUKH73.d.ts} +8 -3
- package/dist/{ssg-1FGaFISl.d.ts → ssg-Csy2vwpi.d.ts} +2 -2
- package/dist/{ssg-Bg4bMMhM.d.mts → ssg-Donyfcxy.d.mts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils-Dxbh6Hgj.d.ts → utils-Luk72LXC.d.ts} +1 -1
- package/dist/{utils-8wtTYiH4.d.mts → utils-d_k1ZZw0.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +18 -12
- package/dist/vite.d.mts +6 -4
- package/dist/vite.d.ts +6 -4
- package/dist/vite.mjs +17 -11
- package/package.json +53 -1
- package/dist/{chunk-35WS7P2V.mjs → chunk-26CXZR6L.mjs} +3 -3
- package/dist/{chunk-QEILRWVV.cjs → chunk-3XEMGDBF.cjs} +2 -2
- package/dist/{chunk-BPOTSHDO.cjs → chunk-IOAUK4OI.cjs} +2 -2
- package/dist/{chunk-BYR3RQPB.mjs → chunk-T76H22WI.mjs} +4 -4
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
4
|
|
|
5
|
+
// src/server-components-mode.ts
|
|
6
|
+
function resolveFarmServerComponentsMode(value) {
|
|
7
|
+
if (value === void 0 || value === null || value === false) return void 0;
|
|
8
|
+
if (value === true) return "rsc";
|
|
9
|
+
const mode = typeof value === "object" ? value.mode : void 0;
|
|
10
|
+
if (mode === "rsc" || mode === "islands") return mode;
|
|
11
|
+
throw new TypeError(
|
|
12
|
+
'experimental.serverComponents must be true, false, { mode: "rsc" } or { mode: "islands" }.'
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmServerComponentsMode, "resolveFarmServerComponentsMode");
|
|
16
|
+
function isExplicitFarmServerComponentsMode(value) {
|
|
17
|
+
return typeof value === "object" && value !== null;
|
|
18
|
+
}
|
|
19
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isExplicitFarmServerComponentsMode, "isExplicitFarmServerComponentsMode");
|
|
20
|
+
|
|
5
21
|
// src/dev-indicators.ts
|
|
6
22
|
function resolveFarmDevIndicatorsConfig(config, mode = "development") {
|
|
7
23
|
return {
|
|
@@ -446,4 +462,6 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, validateFarmAuthConfig, "validateFarmAuthC
|
|
|
446
462
|
|
|
447
463
|
|
|
448
464
|
|
|
449
|
-
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
exports.resolveFarmServerComponentsMode = resolveFarmServerComponentsMode; exports.isExplicitFarmServerComponentsMode = isExplicitFarmServerComponentsMode; exports.setFarmProjectSourceDir = setFarmProjectSourceDir; exports.getFarmProjectSourceDir = getFarmProjectSourceDir; exports.resolveFarmDevIndicatorsConfig = resolveFarmDevIndicatorsConfig; exports.generateFarmDevIndicatorsClientRuntime = generateFarmDevIndicatorsClientRuntime; exports.resolveFarmAuthConfig = resolveFarmAuthConfig; exports.resolveFarmAuthIntegration = resolveFarmAuthIntegration;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FARM_ACTION_TAG,
|
|
3
|
+
FARM_OBJECT_TAG,
|
|
4
|
+
FARM_REFERENCE_TAG,
|
|
5
|
+
FARM_SLOT_TAG,
|
|
6
|
+
FARM_TAG,
|
|
7
|
+
FARM_TAG_VALUE,
|
|
8
|
+
getFarmTag
|
|
9
|
+
} from "./chunk-2NXO5SBY.mjs";
|
|
10
|
+
import {
|
|
11
|
+
__name
|
|
12
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
13
|
+
|
|
14
|
+
// src/client/island-codec.ts
|
|
15
|
+
var TYPED_ARRAYS = {
|
|
16
|
+
Int8Array,
|
|
17
|
+
Uint8Array,
|
|
18
|
+
Uint8ClampedArray,
|
|
19
|
+
Int16Array,
|
|
20
|
+
Uint16Array,
|
|
21
|
+
Int32Array,
|
|
22
|
+
Uint32Array,
|
|
23
|
+
Float32Array,
|
|
24
|
+
Float64Array,
|
|
25
|
+
BigInt64Array,
|
|
26
|
+
BigUint64Array
|
|
27
|
+
};
|
|
28
|
+
function toBase64(bytes) {
|
|
29
|
+
let binary = "";
|
|
30
|
+
for (let index = 0; index < bytes.length; index += 32768) {
|
|
31
|
+
binary += String.fromCharCode(...bytes.subarray(index, index + 32768));
|
|
32
|
+
}
|
|
33
|
+
return btoa(binary);
|
|
34
|
+
}
|
|
35
|
+
__name(toBase64, "toBase64");
|
|
36
|
+
function fromBase64(base64) {
|
|
37
|
+
const binary = atob(base64);
|
|
38
|
+
const bytes = new Uint8Array(binary.length);
|
|
39
|
+
for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index);
|
|
40
|
+
return bytes;
|
|
41
|
+
}
|
|
42
|
+
__name(fromBase64, "fromBase64");
|
|
43
|
+
function farmTagged(tag, value) {
|
|
44
|
+
return value === void 0 ? { [FARM_TAG]: tag } : { [FARM_TAG]: tag, [FARM_TAG_VALUE]: value };
|
|
45
|
+
}
|
|
46
|
+
__name(farmTagged, "farmTagged");
|
|
47
|
+
function needsFarmObjectTag(object) {
|
|
48
|
+
return Object.prototype.hasOwnProperty.call(object, FARM_TAG);
|
|
49
|
+
}
|
|
50
|
+
__name(needsFarmObjectTag, "needsFarmObjectTag");
|
|
51
|
+
function encodeFarmLeaf(value) {
|
|
52
|
+
switch (typeof value) {
|
|
53
|
+
case "undefined":
|
|
54
|
+
return farmTagged("u");
|
|
55
|
+
case "bigint":
|
|
56
|
+
return farmTagged("B", value.toString());
|
|
57
|
+
case "number":
|
|
58
|
+
if (Number.isNaN(value)) return farmTagged("n", "NaN");
|
|
59
|
+
if (value === Infinity) return farmTagged("n", "Infinity");
|
|
60
|
+
if (value === -Infinity) return farmTagged("n", "-Infinity");
|
|
61
|
+
if (Object.is(value, -0)) return farmTagged("n", "-0");
|
|
62
|
+
return void 0;
|
|
63
|
+
case "object":
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
if (value === null) return void 0;
|
|
69
|
+
if (value instanceof Date) {
|
|
70
|
+
return farmTagged("D", Number.isNaN(value.getTime()) ? null : value.toISOString());
|
|
71
|
+
}
|
|
72
|
+
if (typeof URL === "function" && value instanceof URL) return farmTagged("U", value.href);
|
|
73
|
+
if (value instanceof RegExp) return farmTagged("R", [value.source, value.flags]);
|
|
74
|
+
if (value instanceof ArrayBuffer) {
|
|
75
|
+
return farmTagged("Y", ["ArrayBuffer", toBase64(new Uint8Array(value))]);
|
|
76
|
+
}
|
|
77
|
+
if (ArrayBuffer.isView(value)) {
|
|
78
|
+
const name = value instanceof DataView ? "DataView" : value.constructor.name;
|
|
79
|
+
if (name !== "DataView" && !(name in TYPED_ARRAYS)) return void 0;
|
|
80
|
+
const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
81
|
+
return farmTagged("Y", [name, toBase64(bytes)]);
|
|
82
|
+
}
|
|
83
|
+
return void 0;
|
|
84
|
+
}
|
|
85
|
+
__name(encodeFarmLeaf, "encodeFarmLeaf");
|
|
86
|
+
var NOT_A_FARM_MARKER = /* @__PURE__ */ Symbol.for("farm.codec.not-a-marker");
|
|
87
|
+
function farmPlainObject(entries) {
|
|
88
|
+
const object = {};
|
|
89
|
+
for (const [key, value] of entries) {
|
|
90
|
+
Object.defineProperty(object, key, {
|
|
91
|
+
value,
|
|
92
|
+
enumerable: true,
|
|
93
|
+
writable: true,
|
|
94
|
+
configurable: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return object;
|
|
98
|
+
}
|
|
99
|
+
__name(farmPlainObject, "farmPlainObject");
|
|
100
|
+
function decodeFarmTagged(object, decodeChild) {
|
|
101
|
+
const tag = object[FARM_TAG];
|
|
102
|
+
const data = object[FARM_TAG_VALUE];
|
|
103
|
+
switch (tag) {
|
|
104
|
+
case FARM_REFERENCE_TAG:
|
|
105
|
+
case FARM_SLOT_TAG:
|
|
106
|
+
case FARM_ACTION_TAG:
|
|
107
|
+
return NOT_A_FARM_MARKER;
|
|
108
|
+
case FARM_OBJECT_TAG:
|
|
109
|
+
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
110
|
+
return farmPlainObject(
|
|
111
|
+
Object.entries(data).map(([key, value]) => [key, decodeChild(value)])
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case "u":
|
|
116
|
+
return void 0;
|
|
117
|
+
case "n":
|
|
118
|
+
if (data === "NaN") return Number.NaN;
|
|
119
|
+
if (data === "Infinity") return Infinity;
|
|
120
|
+
if (data === "-Infinity") return -Infinity;
|
|
121
|
+
if (data === "-0") return -0;
|
|
122
|
+
break;
|
|
123
|
+
case "B":
|
|
124
|
+
if (typeof data === "string" && /^-?\d+$/.test(data)) return BigInt(data);
|
|
125
|
+
break;
|
|
126
|
+
case "D":
|
|
127
|
+
if (data === null) return new Date(Number.NaN);
|
|
128
|
+
if (typeof data === "string") return new Date(data);
|
|
129
|
+
break;
|
|
130
|
+
case "U":
|
|
131
|
+
if (typeof data === "string") return new URL(data);
|
|
132
|
+
break;
|
|
133
|
+
case "R":
|
|
134
|
+
if (Array.isArray(data) && typeof data[0] === "string" && typeof data[1] === "string") {
|
|
135
|
+
return new RegExp(data[0], data[1]);
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
case "Y": {
|
|
139
|
+
if (!Array.isArray(data) || typeof data[0] !== "string" || typeof data[1] !== "string") break;
|
|
140
|
+
const bytes = fromBase64(data[1]);
|
|
141
|
+
if (data[0] === "ArrayBuffer") return bytes.buffer;
|
|
142
|
+
if (data[0] === "DataView") return new DataView(bytes.buffer);
|
|
143
|
+
const TypedArray = Object.prototype.hasOwnProperty.call(TYPED_ARRAYS, data[0]) ? TYPED_ARRAYS[data[0]] : void 0;
|
|
144
|
+
if (!TypedArray || bytes.byteLength % TypedArray.BYTES_PER_ELEMENT !== 0) break;
|
|
145
|
+
return new TypedArray(
|
|
146
|
+
bytes.buffer,
|
|
147
|
+
0,
|
|
148
|
+
bytes.byteLength / TypedArray.BYTES_PER_ELEMENT
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
case "M":
|
|
152
|
+
if (Array.isArray(data) && data.every((entry) => Array.isArray(entry) && entry.length === 2)) {
|
|
153
|
+
return new Map(data.map(([key, value]) => [decodeChild(key), decodeChild(value)]));
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
case "S":
|
|
157
|
+
if (Array.isArray(data)) return new Set(data.map(decodeChild));
|
|
158
|
+
break;
|
|
159
|
+
default:
|
|
160
|
+
throw new TypeError(`unknown ${JSON.stringify(tag)} tag`);
|
|
161
|
+
}
|
|
162
|
+
throw new TypeError(`malformed ${JSON.stringify(tag)} tag`);
|
|
163
|
+
}
|
|
164
|
+
__name(decodeFarmTagged, "decodeFarmTagged");
|
|
165
|
+
function encodeFarmJson(value, seen = /* @__PURE__ */ new Set()) {
|
|
166
|
+
const leaf = encodeFarmLeaf(value);
|
|
167
|
+
if (leaf) return leaf;
|
|
168
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
169
|
+
if (typeof value === "number") return value;
|
|
170
|
+
if (typeof value !== "object") throw new TypeError(`${typeof value} values are not serializable`);
|
|
171
|
+
if (seen.has(value)) throw new TypeError("circular values are not serializable");
|
|
172
|
+
seen.add(value);
|
|
173
|
+
try {
|
|
174
|
+
if (Array.isArray(value)) return value.map((entry) => encodeFarmJson(entry, seen));
|
|
175
|
+
if (value instanceof Map) {
|
|
176
|
+
return farmTagged(
|
|
177
|
+
"M",
|
|
178
|
+
Array.from(value, ([key, entry]) => [
|
|
179
|
+
encodeFarmJson(key, seen),
|
|
180
|
+
encodeFarmJson(entry, seen)
|
|
181
|
+
])
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
if (value instanceof Set) {
|
|
185
|
+
return farmTagged(
|
|
186
|
+
"S",
|
|
187
|
+
Array.from(value, (entry) => encodeFarmJson(entry, seen))
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
const prototype = Object.getPrototypeOf(value);
|
|
191
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
192
|
+
throw new TypeError("class instances are not serializable");
|
|
193
|
+
}
|
|
194
|
+
const encoded = Object.fromEntries(
|
|
195
|
+
Object.entries(value).map(([key, entry]) => [key, encodeFarmJson(entry, seen)])
|
|
196
|
+
);
|
|
197
|
+
return needsFarmObjectTag(value) ? farmTagged(FARM_OBJECT_TAG, encoded) : encoded;
|
|
198
|
+
} finally {
|
|
199
|
+
seen.delete(value);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
__name(encodeFarmJson, "encodeFarmJson");
|
|
203
|
+
function decodeFarmJson(value) {
|
|
204
|
+
if (Array.isArray(value)) return value.map(decodeFarmJson);
|
|
205
|
+
if (!value || typeof value !== "object") return value;
|
|
206
|
+
if (getFarmTag(value) !== void 0) {
|
|
207
|
+
const decoded = decodeFarmTagged(value, decodeFarmJson);
|
|
208
|
+
if (decoded === NOT_A_FARM_MARKER) {
|
|
209
|
+
throw new TypeError(
|
|
210
|
+
`a ${JSON.stringify(value[FARM_TAG])} reference is not allowed here`
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
return decoded;
|
|
214
|
+
}
|
|
215
|
+
if (needsFarmObjectTag(value)) throw new TypeError('malformed "$" tag');
|
|
216
|
+
return farmPlainObject(Object.entries(value).map(([key, entry]) => [key, decodeFarmJson(entry)]));
|
|
217
|
+
}
|
|
218
|
+
__name(decodeFarmJson, "decodeFarmJson");
|
|
219
|
+
|
|
220
|
+
export {
|
|
221
|
+
farmTagged,
|
|
222
|
+
needsFarmObjectTag,
|
|
223
|
+
encodeFarmLeaf,
|
|
224
|
+
NOT_A_FARM_MARKER,
|
|
225
|
+
farmPlainObject,
|
|
226
|
+
decodeFarmTagged,
|
|
227
|
+
encodeFarmJson,
|
|
228
|
+
decodeFarmJson
|
|
229
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isExplicitFarmServerComponentsMode,
|
|
3
|
+
resolveFarmServerComponentsMode
|
|
4
|
+
} from "./chunk-M3BXTWJM.mjs";
|
|
5
|
+
import {
|
|
6
|
+
logger
|
|
7
|
+
} from "./chunk-KI3MESHB.mjs";
|
|
8
|
+
import {
|
|
9
|
+
__name
|
|
10
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
11
|
+
|
|
12
|
+
// src/server-components-status.ts
|
|
13
|
+
import { existsSync, realpathSync } from "fs";
|
|
14
|
+
import path from "path";
|
|
15
|
+
var FARM_RSC_PACKAGES = [
|
|
16
|
+
"@farm.js/plugin",
|
|
17
|
+
"@vitejs/plugin-rsc",
|
|
18
|
+
"react-server-dom-webpack"
|
|
19
|
+
];
|
|
20
|
+
var FARM_RSC_INSTALL_HINT = `pnpm add ${FARM_RSC_PACKAGES.join(" ")}`;
|
|
21
|
+
var FARM_RSC_BLOCKING_KEYS = [
|
|
22
|
+
"auth",
|
|
23
|
+
"integrations",
|
|
24
|
+
"headers",
|
|
25
|
+
"redirects",
|
|
26
|
+
"rewrites",
|
|
27
|
+
"routeRules",
|
|
28
|
+
"context"
|
|
29
|
+
];
|
|
30
|
+
var FARM_RSC_IGNORED_KEYS = [
|
|
31
|
+
"plugins",
|
|
32
|
+
"storage",
|
|
33
|
+
"schema",
|
|
34
|
+
"cron",
|
|
35
|
+
"workflows",
|
|
36
|
+
"docs",
|
|
37
|
+
"theme",
|
|
38
|
+
"observability"
|
|
39
|
+
];
|
|
40
|
+
function farmConfigUsesServerComponents(config) {
|
|
41
|
+
return resolveFarmServerComponentsMode(config?.experimental?.serverComponents) === "rsc";
|
|
42
|
+
}
|
|
43
|
+
__name(farmConfigUsesServerComponents, "farmConfigUsesServerComponents");
|
|
44
|
+
function findFarmAppPackageDir(root, packageName) {
|
|
45
|
+
for (let dir = path.resolve(root); ; dir = path.dirname(dir)) {
|
|
46
|
+
const candidate = path.join(dir, "node_modules", packageName);
|
|
47
|
+
if (existsSync(path.join(candidate, "package.json"))) return realpathSync(candidate);
|
|
48
|
+
if (path.dirname(dir) === dir) return void 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
__name(findFarmAppPackageDir, "findFarmAppPackageDir");
|
|
52
|
+
function isSet(value) {
|
|
53
|
+
if (value === void 0 || value === false || value === null) return false;
|
|
54
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
55
|
+
return typeof value !== "object" || Object.keys(value).length > 0;
|
|
56
|
+
}
|
|
57
|
+
__name(isSet, "isSet");
|
|
58
|
+
function inspectFarmServerComponents(config, root) {
|
|
59
|
+
const value = config?.experimental?.serverComponents;
|
|
60
|
+
const mode = resolveFarmServerComponentsMode(value);
|
|
61
|
+
const enabled = mode === "rsc";
|
|
62
|
+
const explicit = enabled && isExplicitFarmServerComponentsMode(value);
|
|
63
|
+
const missingPackages = enabled ? FARM_RSC_PACKAGES.filter((name) => !findFarmAppPackageDir(root, name)) : [];
|
|
64
|
+
return {
|
|
65
|
+
mode,
|
|
66
|
+
enabled,
|
|
67
|
+
explicit,
|
|
68
|
+
missingPackages,
|
|
69
|
+
// `true` predates the pipeline; `{ mode: "rsc" }` is new and fails with the install command.
|
|
70
|
+
fallback: enabled && !explicit && missingPackages.length > 0,
|
|
71
|
+
blockingKeys: enabled ? FARM_RSC_BLOCKING_KEYS.filter((key) => isSet(config?.[key])) : [],
|
|
72
|
+
ignoredKeys: enabled ? FARM_RSC_IGNORED_KEYS.filter((key) => isSet(config?.[key])) : []
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
__name(inspectFarmServerComponents, "inspectFarmServerComponents");
|
|
76
|
+
function formatKeys(keys) {
|
|
77
|
+
return keys.map((key) => `\`${key}\``).join(", ");
|
|
78
|
+
}
|
|
79
|
+
__name(formatKeys, "formatKeys");
|
|
80
|
+
function formatFarmRscFallbackMessage(missingPackages, blockingKeys = []) {
|
|
81
|
+
if (blockingKeys.length > 0) {
|
|
82
|
+
return `experimental.serverComponents is true, but this app uses ${formatKeys(
|
|
83
|
+
blockingKeys
|
|
84
|
+
)}, which the RSC pipeline does not run yet, so it runs without React Server Components. Remove the flag, or move ${blockingKeys.length === 1 ? "that feature" : "those features"} out of farm.config to turn RSC on.`;
|
|
85
|
+
}
|
|
86
|
+
return `experimental.serverComponents is true, but ${missingPackages.join(", ")} ${missingPackages.length === 1 ? "is" : "are"} not installed, so the app runs without React Server Components. \`farm dev\` and \`farm build\` install them outside CI; in CI or with another tool, run ${FARM_RSC_INSTALL_HINT}.`;
|
|
87
|
+
}
|
|
88
|
+
__name(formatFarmRscFallbackMessage, "formatFarmRscFallbackMessage");
|
|
89
|
+
function formatFarmRscBlockingMessage(blockingKeys) {
|
|
90
|
+
return `experimental.serverComponents runs on the RSC pipeline, which does not run ${formatKeys(
|
|
91
|
+
blockingKeys
|
|
92
|
+
)} yet. Serving the app without ${blockingKeys.length === 1 ? "it" : "them"} could expose what ${blockingKeys.length === 1 ? "it protects" : "they protect"}, so RSC does not start. Remove experimental.serverComponents to keep ${blockingKeys.length === 1 ? "it" : "them"}.`;
|
|
93
|
+
}
|
|
94
|
+
__name(formatFarmRscBlockingMessage, "formatFarmRscBlockingMessage");
|
|
95
|
+
var warnedFallback = false;
|
|
96
|
+
function farmAppUsesRscPipeline(config, root) {
|
|
97
|
+
const status = inspectFarmServerComponents(config, root);
|
|
98
|
+
if (status.mode === "islands") return false;
|
|
99
|
+
if (!status.enabled) return false;
|
|
100
|
+
if (status.fallback) {
|
|
101
|
+
if (!warnedFallback) {
|
|
102
|
+
warnedFallback = true;
|
|
103
|
+
logger.warn(
|
|
104
|
+
`[Farm.js] ${formatFarmRscFallbackMessage(status.missingPackages, status.blockingKeys)}`
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (status.blockingKeys.length > 0) {
|
|
110
|
+
throw new Error(`[Farm.js] ${formatFarmRscBlockingMessage(status.blockingKeys)}`);
|
|
111
|
+
}
|
|
112
|
+
if (status.ignoredKeys.length > 0) {
|
|
113
|
+
logger.warn(
|
|
114
|
+
`[Farm.js] experimental.serverComponents runs on the RSC pipeline, which does not run ${formatKeys(
|
|
115
|
+
status.ignoredKeys
|
|
116
|
+
)} yet. ${status.ignoredKeys.length === 1 ? "It is" : "They are"} ignored.`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
__name(farmAppUsesRscPipeline, "farmAppUsesRscPipeline");
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
FARM_RSC_PACKAGES,
|
|
125
|
+
FARM_RSC_INSTALL_HINT,
|
|
126
|
+
farmConfigUsesServerComponents,
|
|
127
|
+
findFarmAppPackageDir,
|
|
128
|
+
inspectFarmServerComponents,
|
|
129
|
+
formatFarmRscFallbackMessage,
|
|
130
|
+
formatFarmRscBlockingMessage,
|
|
131
|
+
farmAppUsesRscPipeline
|
|
132
|
+
};
|