@farm.js/core 0.1.83 → 0.1.84
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/{analyzer-Y6IY26HI.mjs → analyzer-7RNO3XKC.mjs} +2 -2
- package/dist/analyzer-PFKA5NI6.cjs +17 -0
- package/dist/{chunk-WCSBYQOT.cjs → chunk-22BTYPIX.cjs} +4 -4
- package/dist/{chunk-NGTZHWBG.cjs → chunk-3OKSEJ33.cjs} +31 -10
- package/dist/{chunk-VQ6IXALL.mjs → chunk-3WM7VBGW.mjs} +2 -2
- package/dist/{chunk-IABI62FH.cjs → chunk-57EEWWUS.cjs} +2 -2
- package/dist/{chunk-7X2CYE66.cjs → chunk-5I4ZGKP2.cjs} +255 -199
- package/dist/{chunk-RGTZAM6Y.mjs → chunk-BCCCPFHQ.mjs} +25 -4
- package/dist/{chunk-55UJGUBP.cjs → chunk-BOEDYXAX.cjs} +13 -13
- package/dist/{chunk-DPUZVGXH.mjs → chunk-BRDGINBB.mjs} +31 -28
- package/dist/{chunk-FFWSER54.mjs → chunk-BZY3SRRD.mjs} +1 -1
- package/dist/{chunk-3CZ4MJHW.cjs → chunk-CVZY4TLW.cjs} +1 -1
- package/dist/{chunk-IAIRQAHA.mjs → chunk-CWUQBECF.mjs} +1 -1
- package/dist/{chunk-WZV2G2A6.mjs → chunk-DFDQGHPU.mjs} +83 -27
- package/dist/{chunk-SLIXHUMS.cjs → chunk-DSWSDDP2.cjs} +230 -201
- package/dist/{chunk-EFI6QWBQ.cjs → chunk-EBSL5TW7.cjs} +15 -15
- package/dist/{chunk-U56Z3755.mjs → chunk-EDBIBO67.mjs} +9 -9
- package/dist/{chunk-BBVLOEND.cjs → chunk-F7JVO3OZ.cjs} +4 -4
- package/dist/{chunk-5X5GJU5A.cjs → chunk-GLNVLCUH.cjs} +6 -6
- package/dist/{chunk-DZTWUEBB.cjs → chunk-HOQ2MYBJ.cjs} +10 -10
- package/dist/{chunk-NKVBWPXR.mjs → chunk-I5CVJ24H.mjs} +1 -1
- package/dist/{chunk-R3VLM2MW.mjs → chunk-INU4K4U4.mjs} +5 -5
- package/dist/{chunk-43N3X6OO.mjs → chunk-IRJSZAJB.mjs} +1 -1
- package/dist/{chunk-NDWI6FDH.mjs → chunk-KXVMWLTC.mjs} +59 -30
- package/dist/{chunk-HRH7OKBQ.cjs → chunk-L3BSHASB.cjs} +4 -4
- package/dist/{chunk-ELNRKD4V.mjs → chunk-L5HDCDFT.mjs} +1 -1
- package/dist/{chunk-RNJX3MD6.mjs → chunk-M5XU22PQ.mjs} +1 -1
- package/dist/chunk-MAPHNGTF.cjs +98 -0
- package/dist/{chunk-RE5E2G5S.cjs → chunk-MNUYXZV7.cjs} +2 -18
- package/dist/{chunk-ORBBAA7B.mjs → chunk-MUUDHWQZ.mjs} +1 -1
- package/dist/{chunk-YSU3WCW6.mjs → chunk-MYSH5Y4E.mjs} +1 -1
- package/dist/{chunk-K3GHY7GY.mjs → chunk-NLHSKKTT.mjs} +1 -1
- package/dist/{chunk-JHRJ5V2F.cjs → chunk-OFVBMS6I.cjs} +165 -162
- package/dist/{chunk-3DAJXBSL.cjs → chunk-OP7BIEUW.cjs} +2 -2
- package/dist/chunk-RJBUI5AN.mjs +18 -0
- package/dist/chunk-RQ6XX5IN.mjs +98 -0
- package/dist/{chunk-LN6FAYNB.cjs → chunk-USMRAC72.cjs} +2 -2
- package/dist/{chunk-B5SJYXJK.mjs → chunk-XLULEFRW.mjs} +6 -6
- package/dist/{chunk-A5BHJHDF.cjs → chunk-YU6VL7H5.cjs} +3 -3
- package/dist/{chunk-OM6JIIJU.cjs → chunk-Z37PDUJR.cjs} +4 -4
- package/dist/{devtools-ZM2AR36W.cjs → devtools-4SVIRV4P.cjs} +6 -6
- package/dist/{devtools-OI52TCSD.mjs → devtools-MWQA5LVN.mjs} +4 -4
- package/dist/docs.cjs +6 -6
- package/dist/docs.mjs +5 -5
- package/dist/environment/vite.cjs +5 -5
- package/dist/environment/vite.mjs +4 -4
- package/dist/index.cjs +25 -24
- package/dist/index.mjs +24 -23
- package/dist/internal/build-runtime.cjs +26 -25
- package/dist/internal/build-runtime.mjs +25 -24
- package/dist/internal/cli-runtime.cjs +8 -8
- package/dist/internal/cli-runtime.mjs +7 -7
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +3 -37
- package/dist/internal/client-runtime.d.ts +3 -37
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- 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 +13 -13
- package/dist/internal/production-runtime.mjs +19 -19
- package/dist/internal/renderer-islands.cjs +47 -0
- package/dist/internal/renderer-islands.d.mts +32 -0
- package/dist/internal/renderer-islands.d.ts +32 -0
- package/dist/internal/renderer-islands.mjs +47 -0
- package/dist/island-runtime.d-BA7EPo1v.d.ts +38 -0
- package/dist/island-runtime.d-BBS_YUSX.d.mts +38 -0
- package/dist/plugin.cjs +20 -19
- package/dist/plugin.mjs +19 -18
- package/dist/renderer.cjs +8 -2
- package/dist/renderer.d.mts +81 -1
- package/dist/renderer.d.ts +81 -1
- package/dist/renderer.mjs +7 -1
- package/dist/{rsc-pipeline-MFJZGDPE.cjs → rsc-pipeline-OWBEZ7HB.cjs} +9 -9
- package/dist/{rsc-pipeline-TRZVFCBX.mjs → rsc-pipeline-UT3Z2GDO.mjs} +8 -8
- package/dist/{runtime-O4Y3Z6V3.mjs → runtime-F5I3WY3B.mjs} +10 -11
- package/dist/{runtime-MJUG2HGR.cjs → runtime-SRMQ46SK.cjs} +13 -14
- package/dist/server.cjs +50 -50
- package/dist/server.mjs +28 -28
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +20 -19
- package/dist/vite.d.mts +6 -0
- package/dist/vite.d.ts +6 -0
- package/dist/vite.mjs +19 -18
- package/package.json +8 -3
- package/dist/analyzer-WGH6J2HN.cjs +0 -17
- package/dist/chunk-4QENVMG7.mjs +0 -34
- package/dist/{chunk-NEKO3HM2.cjs → chunk-4B6YJ5DS.cjs} +2 -2
- package/dist/{chunk-CA2HBLXP.mjs → chunk-4EEAPBNV.mjs} +3 -3
|
@@ -0,0 +1,98 @@
|
|
|
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 _chunk7KJJ4SBScjs = require('./chunk-7KJJ4SBS.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk3OKSEJ33cjs = require('./chunk-3OKSEJ33.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk3BIASUGRcjs = require('./chunk-3BIASUGR.cjs');
|
|
13
|
+
|
|
14
|
+
// src/renderer-islands.ts
|
|
15
|
+
var _server = require('@farm.js/islx/islands/server');
|
|
16
|
+
var CLIENT_ATTRIBUTE = "client:";
|
|
17
|
+
var responses = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
var detached = 0;
|
|
19
|
+
function currentResponse() {
|
|
20
|
+
const request = _chunk3BIASUGRcjs._peekCurrentRequest.call(void 0, );
|
|
21
|
+
if (!request) return void 0;
|
|
22
|
+
let response = responses.get(request);
|
|
23
|
+
if (!response) responses.set(request, response = { next: 0, sent: /* @__PURE__ */ new Set() });
|
|
24
|
+
return response;
|
|
25
|
+
}
|
|
26
|
+
function islandName(reference) {
|
|
27
|
+
return `${reference.export} (${reference.src})`;
|
|
28
|
+
}
|
|
29
|
+
function readClientAttributes(props, reference) {
|
|
30
|
+
const rest = {};
|
|
31
|
+
let strategy;
|
|
32
|
+
for (const [key, value] of Object.entries(props)) {
|
|
33
|
+
if (!key.startsWith(CLIENT_ATTRIBUTE)) {
|
|
34
|
+
rest[key] = value;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (value === void 0) continue;
|
|
38
|
+
const name = key.slice(CLIENT_ATTRIBUTE.length);
|
|
39
|
+
if (!_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, name)) {
|
|
40
|
+
throw new TypeError(
|
|
41
|
+
`\`${key}\` on ${islandName(reference)} is not an island strategy. Use \`client:load\`, \`client:idle\`, \`client:visible\` or \`client:interaction\`.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (value !== true && value !== "") {
|
|
45
|
+
throw new TypeError(
|
|
46
|
+
`\`${key}\` on ${islandName(reference)} takes no value. Write \`${key}\` alone.`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
if (strategy) {
|
|
50
|
+
throw new TypeError(
|
|
51
|
+
`${islandName(reference)} has two strategies, \`client:${strategy}\` and \`${key}\`. Keep one.`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
strategy = name;
|
|
55
|
+
}
|
|
56
|
+
return { props: rest, strategy };
|
|
57
|
+
}
|
|
58
|
+
var reported = /* @__PURE__ */ new Set();
|
|
59
|
+
function resolveFarmIsland(props, reference) {
|
|
60
|
+
const { props: islandProps, strategy } = readClientAttributes(props, reference);
|
|
61
|
+
const response = currentResponse();
|
|
62
|
+
const id = response ? `fi${response.next++}` : `fi-${detached++}`;
|
|
63
|
+
try {
|
|
64
|
+
const parts = _server.resolveIslandMarkup.call(void 0, {
|
|
65
|
+
src: reference.src,
|
|
66
|
+
export: reference.export,
|
|
67
|
+
strategy: _nullishCoalesce(_nullishCoalesce(strategy, () => ( reference.strategy)), () => ( "load")),
|
|
68
|
+
id,
|
|
69
|
+
props: islandProps,
|
|
70
|
+
sent: _optionalChain([response, 'optionalAccess', _ => _.sent])
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
props: islandProps,
|
|
74
|
+
values: parts.values,
|
|
75
|
+
element: parts.element,
|
|
76
|
+
script: parts.script
|
|
77
|
+
};
|
|
78
|
+
} catch (error) {
|
|
79
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
80
|
+
const key = `${reference.src}#${reference.export}:${message}`;
|
|
81
|
+
if (!reported.has(key)) {
|
|
82
|
+
reported.add(key);
|
|
83
|
+
console.warn(
|
|
84
|
+
`[Farm.js] ${message}. The server-rendered component was preserved without client hydration.`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function usesFarmRendererIslands(config) {
|
|
91
|
+
const renderer = _chunk3OKSEJ33cjs.resolveFarmRenderer.call(void 0, config.renderer);
|
|
92
|
+
return !_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, renderer) && _chunk3OKSEJ33cjs.getFarmRendererCapabilities.call(void 0, renderer).islands && _optionalChain([config, 'access', _2 => _2.experimental, 'optionalAccess', _3 => _3.isolatedClientHydration]) === "enabled" && _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _4 => _4.experimental, 'optionalAccess', _5 => _5.serverComponents])) === void 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
exports.resolveFarmIsland = resolveFarmIsland; exports.usesFarmRendererIslands = usesFarmRendererIslands;
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/
|
|
2
|
-
function resolveFarmServerComponentsMode(value) {
|
|
3
|
-
if (value === void 0 || value === null || value === false) return void 0;
|
|
4
|
-
if (value === true) return "islands";
|
|
5
|
-
const mode = typeof value === "object" ? value.mode : void 0;
|
|
6
|
-
if (mode === "rsc" || mode === "islands") return mode;
|
|
7
|
-
throw new TypeError(
|
|
8
|
-
'experimental.serverComponents must be true, false, { mode: "rsc" } or { mode: "islands" }.'
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
function isExplicitFarmServerComponentsMode(value) {
|
|
12
|
-
return typeof value === "object" && value !== null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// src/utils/source-dir.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/utils/source-dir.ts
|
|
16
2
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
17
3
|
var FARM_PROJECT_SOURCE_DIRS = /* @__PURE__ */ Symbol.for("farm.projectSourceDirs");
|
|
18
4
|
function getProjectSourceDirs() {
|
|
@@ -29,6 +15,4 @@ function getFarmProjectSourceDir(root) {
|
|
|
29
15
|
|
|
30
16
|
|
|
31
17
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
exports.resolveFarmServerComponentsMode = resolveFarmServerComponentsMode; exports.isExplicitFarmServerComponentsMode = isExplicitFarmServerComponentsMode; exports.setFarmProjectSourceDir = setFarmProjectSourceDir; exports.getFarmProjectSourceDir = getFarmProjectSourceDir;
|
|
18
|
+
exports.setFarmProjectSourceDir = setFarmProjectSourceDir; exports.getFarmProjectSourceDir = getFarmProjectSourceDir;
|