@farm.js/core 0.1.72 → 0.1.73
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-handler-VIT4GOSR.mjs → agent-mcp-handler-RK7LDYEL.mjs} +4 -4
- package/dist/{agent-mcp-handler-KE4J3W7S.cjs → agent-mcp-handler-VBCA3WZ6.cjs} +5 -5
- package/dist/{agent-mcp.d-BO3rZXEM.d.ts → agent-mcp.d-D_gHjCAE.d.ts} +1 -1
- package/dist/{agent-mcp.d-Cwff7lcA.d.mts → agent-mcp.d-PvEf-1mi.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/{analyzer-5Q75LTIL.mjs → analyzer-MFYCJT75.mjs} +2 -2
- package/dist/analyzer-V5ZMRIIY.cjs +16 -0
- package/dist/api/node.d.mts +4 -4
- package/dist/api/node.d.ts +4 -4
- package/dist/api/route-manager.d.mts +4 -4
- package/dist/api/route-manager.d.ts +4 -4
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api.d.mts +5 -5
- package/dist/api.d.ts +5 -5
- package/dist/{app-manifest.d-DwjGkYlP.d.ts → app-manifest.d-BpVTg43i.d.ts} +1 -1
- package/dist/{app-manifest.d-USD_IbFd.d.mts → app-manifest.d-CN7cEWHX.d.mts} +1 -1
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +3 -3
- package/dist/{app.d-fW06_h8h.d.mts → app.d-BFWzAdTe.d.mts} +10 -4
- package/dist/{app.d-DAmF2MAk.d.ts → app.d-DO4PTCWm.d.ts} +10 -4
- package/dist/{chunk-OSMUE5ST.mjs → chunk-462MUII7.mjs} +3 -3
- package/dist/{chunk-MWUDEYBI.mjs → chunk-4CTCSKAF.mjs} +1 -1
- package/dist/{chunk-FSSONJRV.cjs → chunk-4YHGQDTT.cjs} +12 -12
- package/dist/{chunk-YCNHUIPR.cjs → chunk-4Z3YLMSW.cjs} +10 -10
- package/dist/{chunk-O32QPFVV.cjs → chunk-5PDMBWAF.cjs} +5 -5
- package/dist/{chunk-E2V7RRFL.mjs → chunk-6O6PAZZR.mjs} +1 -1
- package/dist/{chunk-LXEJNWF5.mjs → chunk-73K53YPP.mjs} +2 -2
- package/dist/{chunk-WIJF3PBM.mjs → chunk-7GMBETHM.mjs} +1 -1
- package/dist/{chunk-DGNMXL2O.mjs → chunk-B67CW2LM.mjs} +1 -1
- package/dist/{chunk-E3LE6EZH.cjs → chunk-CLEWORVY.cjs} +2 -2
- package/dist/{chunk-KPJYBSHL.mjs → chunk-CPMME66W.mjs} +149 -22
- package/dist/{chunk-VAWDGGW3.mjs → chunk-CYRIIVD4.mjs} +26 -15
- package/dist/{chunk-RFWWXEIF.mjs → chunk-FRO4BB2T.mjs} +1 -1
- package/dist/{chunk-N3XO5AL5.cjs → chunk-GPO3LJDJ.cjs} +2 -2
- package/dist/{chunk-645ENY7W.mjs → chunk-GZOKWJIW.mjs} +4 -4
- package/dist/{chunk-NAXKOTPP.cjs → chunk-HFUOLILA.cjs} +21 -21
- package/dist/{chunk-C2JOS77Z.cjs → chunk-HGB4PM2C.cjs} +178 -51
- package/dist/{chunk-BE7AQXJB.cjs → chunk-HTXKSREF.cjs} +255 -89
- package/dist/{chunk-Z3GPAFIA.mjs → chunk-HY6IVQ54.mjs} +1 -1
- package/dist/{chunk-3JN5M3T5.mjs → chunk-IBVN7SW5.mjs} +247 -81
- package/dist/{chunk-OSEQL34Q.cjs → chunk-ILQ5DKYF.cjs} +2 -2
- package/dist/{chunk-AUAMXI6N.mjs → chunk-IXZSBO76.mjs} +1 -1
- package/dist/{chunk-77VNYVVX.mjs → chunk-JMOCMXTQ.mjs} +1 -1
- package/dist/{chunk-5R4Q5FN7.cjs → chunk-KDOZORJD.cjs} +52 -41
- package/dist/{chunk-7QCJDYZQ.cjs → chunk-KTDG4THT.cjs} +2 -2
- package/dist/{chunk-L6E4SHUB.cjs → chunk-LGR7565L.cjs} +6 -6
- package/dist/chunk-LRPPXKCX.mjs +58 -0
- package/dist/{chunk-5XFKWHZD.mjs → chunk-MJEKMT6B.mjs} +95 -106
- package/dist/chunk-NDOE76QC.cjs +58 -0
- package/dist/{chunk-REP6HWJN.mjs → chunk-OBYM5S5G.mjs} +2 -2
- package/dist/{chunk-ZUVAGMQ5.cjs → chunk-ODBM54RT.cjs} +7 -7
- package/dist/{chunk-J5ASGNKF.mjs → chunk-OIP62QEL.mjs} +1 -1
- package/dist/{chunk-3WG7GJQL.cjs → chunk-OXNZUCHN.cjs} +9 -9
- package/dist/{chunk-C5AM2XDN.cjs → chunk-PXAHSCR6.cjs} +4 -4
- package/dist/{chunk-BSXKZPFE.mjs → chunk-QGCSUC5O.mjs} +112 -70
- package/dist/{chunk-EXN4DTVF.cjs → chunk-QKEZLYON.cjs} +2 -2
- package/dist/{chunk-QUYAGU65.mjs → chunk-REK6HZSU.mjs} +267 -231
- package/dist/{chunk-5X6OHJEE.cjs → chunk-ROCF6UQD.cjs} +5 -8
- package/dist/{chunk-KQAB5LML.mjs → chunk-SUQACHER.mjs} +2 -2
- package/dist/{chunk-NV26EGMC.mjs → chunk-SVQX5HYW.mjs} +2 -2
- package/dist/{chunk-CBLRSZQL.cjs → chunk-TAU3OF5B.cjs} +223 -234
- package/dist/{chunk-IWCYRDRQ.cjs → chunk-TDCP3Z4T.cjs} +3 -3
- package/dist/{chunk-TP4RAV7Y.cjs → chunk-TU6VAH4V.cjs} +8 -8
- package/dist/{chunk-ZDZUFD67.cjs → chunk-UVQRMUAR.cjs} +1 -1
- package/dist/{chunk-JMFTKNBA.mjs → chunk-UVZMSRHF.mjs} +2 -2
- package/dist/{chunk-GF22VGMS.cjs → chunk-VPETSSWN.cjs} +2 -2
- package/dist/{chunk-AYVGD3PK.mjs → chunk-XI3OXOMK.mjs} +1 -1
- package/dist/{chunk-HLMUWKAP.cjs → chunk-XUSJVHHD.cjs} +408 -366
- package/dist/{chunk-ET6WW3FY.cjs → chunk-YZK64PZT.cjs} +433 -397
- package/dist/{chunk-DS7JGFW5.mjs → chunk-Z3IN6GEX.mjs} +4 -7
- package/dist/{client-component.d-ciHeCxr-.d.mts → client-component.d-C71rMuHF.d.mts} +2 -2
- package/dist/{client-component.d-9J7CkTWW.d.ts → client-component.d-sF-Znk0j.d.ts} +2 -2
- package/dist/{client-plugins.d-JnRz5a1o.d.mts → client-plugins.d-B-Gd9mWR.d.mts} +1 -1
- package/dist/{client-plugins.d-CUOhfapO.d.ts → client-plugins.d-MFibjgBg.d.ts} +1 -1
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/desktop.d.mts +3 -3
- package/dist/desktop.d.ts +3 -3
- package/dist/{devtools-IZFUYWPG.cjs → devtools-6K4QXFRL.cjs} +5 -5
- package/dist/{devtools-7JPQMSTQ.mjs → devtools-TDIJ6HVC.mjs} +4 -4
- package/dist/docs.cjs +8 -8
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +7 -7
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{headers.d-rbbTKGaN.d.mts → headers.d-BUxGJTsj.d.mts} +1 -1
- package/dist/{headers.d-CqpTL_fZ.d.ts → headers.d-uQ6BR59u.d.ts} +1 -1
- package/dist/index.cjs +24 -22
- package/dist/{index.d-CMKvzHLW.d.ts → index.d-BCGfxCXY.d.ts} +1 -1
- package/dist/{index.d-D_B2D9Il.d.mts → index.d-CuWOJ-un.d.mts} +1 -1
- package/dist/index.d.mts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.mjs +23 -21
- package/dist/integrations/orm.d.mts +2 -2
- package/dist/integrations/orm.d.ts +2 -2
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +23 -23
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +22 -22
- package/dist/internal/cli-runtime.cjs +9 -9
- package/dist/internal/cli-runtime.mjs +8 -8
- 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 +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +2 -2
- package/dist/internal/compression-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.d.mts +4 -4
- package/dist/internal/config-runtime.d.ts +4 -4
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/infra-analytics-runtime.cjs +9 -9
- package/dist/internal/infra-analytics-runtime.mjs +7 -7
- 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 +11 -11
- package/dist/internal/production-runtime.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +10 -10
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.d.mts +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/{mount.d-ImEO7q8a.d.mts → mount.d-BIYmcGGg.d.mts} +1 -1
- package/dist/{mount.d-B0XMxDRh.d.ts → mount.d-q8k0cJV0.d.ts} +1 -1
- package/dist/{native-tree-L2IIEBXH.mjs → native-tree-OYGKP2NZ.mjs} +2 -2
- package/dist/{native-tree-GF4BH33L.cjs → native-tree-R6CQMDTI.cjs} +3 -3
- package/dist/{navigation-delegate.d-RRx1CSlb.d.ts → navigation-delegate.d-Btfs6Uoa.d.ts} +1 -1
- package/dist/{navigation-delegate.d-83Q7ksf7.d.mts → navigation-delegate.d-CYBUupsv.d.mts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/{observability.d-B2363jB6.d.mts → observability.d-DdJRiaIX.d.mts} +27 -3
- package/dist/{observability.d-B2363jB6.d.ts → observability.d-DdJRiaIX.d.ts} +27 -3
- package/dist/observability.d.mts +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/plugin.cjs +15 -15
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +14 -14
- package/dist/{render-plan.d-Ds2sXJ5m.d.ts → render-plan.d-0FHusf1D.d.ts} +1 -1
- package/dist/{render-plan.d-wP8nTeRV.d.mts → render-plan.d-BlyxqKMu.d.mts} +1 -1
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/{request.d-zpSn6pu_.d.ts → request.d-CPdVjssg.d.ts} +1 -1
- package/dist/{request.d-F3h7K37m.d.mts → request.d-CX-gks1l.d.mts} +1 -1
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/{route-rendering.d-Mw0ZKG2e.d.mts → route-rendering.d-CcvZ_4N2.d.mts} +1 -1
- package/dist/{route-rendering.d-BL0_AdKj.d.ts → route-rendering.d-DcOoSNoG.d.ts} +1 -1
- package/dist/{router.d-NGVsU11T.d.mts → router.d-C8RHma4A.d.mts} +1 -1
- package/dist/{router.d-BwXigemZ.d.ts → router.d-D2QnK8cM.d.ts} +1 -1
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/{rsc-pipeline-DHYZLWSF.mjs → rsc-pipeline-LC2FBZAR.mjs} +5 -5
- package/dist/{rsc-pipeline-BNXYMG4G.cjs → rsc-pipeline-NTAM65NT.cjs} +6 -6
- package/dist/{runtime-XPYKUNL3.mjs → runtime-MWAC7NWR.mjs} +5 -5
- package/dist/{runtime-IWOT6ZVC.cjs → runtime-U4PAMTVH.cjs} +7 -7
- package/dist/{runtime.d-OBIZWpx1.d.ts → runtime.d-1l_1bLrL.d.ts} +1 -1
- package/dist/{runtime.d-BA3MzhXz.d.mts → runtime.d-BQUHHq8M.d.mts} +1 -1
- package/dist/server-plugins.d.mts +4 -4
- package/dist/server-plugins.d.ts +4 -4
- package/dist/server.cjs +37 -35
- package/dist/server.d.mts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +20 -18
- package/dist/{spa-router.d-DrYT944-.d.ts → spa-router.d-BJtXNeqo.d.ts} +2 -2
- package/dist/{spa-router.d-BG2XzE5p.d.mts → spa-router.d-BzPdi48R.d.mts} +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/{utils.d-C1k9BJeD.d.mts → utils.d-B4ZW-6z6.d.mts} +1 -1
- package/dist/{utils.d-DcF4wxey.d.ts → utils.d-DquC6qxy.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +17 -15
- package/dist/vite.d.mts +16 -7
- package/dist/vite.d.ts +16 -7
- package/dist/vite.mjs +16 -14
- package/package.json +1 -1
- package/dist/analyzer-UJG4MIZW.cjs +0 -16
- package/dist/chunk-V3UOEWCB.cjs +0 -46
- package/dist/chunk-VE3FWJBO.mjs +0 -46
|
@@ -21,7 +21,7 @@ var _chunkE7QOEV5Zcjs = require('./chunk-E7QOEV5Z.cjs');
|
|
|
21
21
|
var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkUVQRMUARcjs = require('./chunk-UVQRMUAR.cjs');
|
|
25
25
|
|
|
26
26
|
// src/environment-vite.ts
|
|
27
27
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -1634,6 +1634,149 @@ function rewriteFarmPackageClientImports(options) {
|
|
|
1634
1634
|
return changed ? output : null;
|
|
1635
1635
|
}
|
|
1636
1636
|
|
|
1637
|
+
// src/islands-containers.ts
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
|
|
1641
|
+
var FARM_ISLAND_CONTAINER_EXPORT = "FarmIslandContainer";
|
|
1642
|
+
var CONTAINER_LOCAL = "__FarmIslandContainer__";
|
|
1643
|
+
var ISLAND_CONTAINER_TAGS = /* @__PURE__ */ new Set([
|
|
1644
|
+
"table",
|
|
1645
|
+
"thead",
|
|
1646
|
+
"tbody",
|
|
1647
|
+
"tfoot",
|
|
1648
|
+
"tr",
|
|
1649
|
+
"select",
|
|
1650
|
+
"optgroup",
|
|
1651
|
+
"datalist",
|
|
1652
|
+
"svg",
|
|
1653
|
+
"ul",
|
|
1654
|
+
"ol"
|
|
1655
|
+
]);
|
|
1656
|
+
var FLOW_CONTENT_TAGS = /* @__PURE__ */ new Set(["td", "th", "caption", "foreignObject", "li"]);
|
|
1657
|
+
function farmIslandContainerReferencePath(root) {
|
|
1658
|
+
return _path2.default.join(root, ".farm", "client-references", "farm.js+core", "__island-container.tsx");
|
|
1659
|
+
}
|
|
1660
|
+
function ensureFarmIslandContainerReference(root) {
|
|
1661
|
+
const file = farmIslandContainerReferencePath(root);
|
|
1662
|
+
const source = [
|
|
1663
|
+
"// Generated by Farm: the island around an element whose children are client components (RFC 0006).",
|
|
1664
|
+
FARM_CLIENT_REFERENCE_PRAGMA,
|
|
1665
|
+
'"use client";',
|
|
1666
|
+
`export function ${FARM_ISLAND_CONTAINER_EXPORT}({ children }: { children?: unknown }) {`,
|
|
1667
|
+
" return children as never;",
|
|
1668
|
+
"}",
|
|
1669
|
+
""
|
|
1670
|
+
].join("\n");
|
|
1671
|
+
let current = null;
|
|
1672
|
+
try {
|
|
1673
|
+
current = _fs2.default.readFileSync(file, "utf8");
|
|
1674
|
+
} catch (e23) {
|
|
1675
|
+
}
|
|
1676
|
+
if (current !== source) {
|
|
1677
|
+
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
1678
|
+
_fs2.default.writeFileSync(file, source);
|
|
1679
|
+
}
|
|
1680
|
+
return file;
|
|
1681
|
+
}
|
|
1682
|
+
function parse2(code, file) {
|
|
1683
|
+
const extension = _path2.default.extname(file).slice(1);
|
|
1684
|
+
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : extension === "js" || extension === "mjs" || extension === "cjs" || extension === "jsx" ? "jsx" : "tsx";
|
|
1685
|
+
return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => {
|
|
1686
|
+
try {
|
|
1687
|
+
return _parseAst.parseAst.call(void 0, code, { lang });
|
|
1688
|
+
} catch (e24) {
|
|
1689
|
+
return null;
|
|
1690
|
+
}
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
function jsxName(node) {
|
|
1694
|
+
if (!node) return null;
|
|
1695
|
+
if (node.type === "JSXIdentifier") return node.name;
|
|
1696
|
+
if (node.type === "JSXMemberExpression") {
|
|
1697
|
+
let object = node.object;
|
|
1698
|
+
while (object.type === "JSXMemberExpression") object = object.object;
|
|
1699
|
+
return object.type === "JSXIdentifier" ? object.name : null;
|
|
1700
|
+
}
|
|
1701
|
+
return null;
|
|
1702
|
+
}
|
|
1703
|
+
function findFarmIslandContainers(code, file, bindings) {
|
|
1704
|
+
if (bindings.length === 0) return [];
|
|
1705
|
+
if (!/<(?:table|thead|tbody|tfoot|tr|select|optgroup|datalist|svg|ul|ol)[\s>/]/.test(code)) {
|
|
1706
|
+
return [];
|
|
1707
|
+
}
|
|
1708
|
+
const program = parse2(code, file);
|
|
1709
|
+
if (!program) return null;
|
|
1710
|
+
const names = new Set(bindings);
|
|
1711
|
+
const found = /* @__PURE__ */ new Map();
|
|
1712
|
+
const open = [];
|
|
1713
|
+
const visit = (node) => {
|
|
1714
|
+
if (!node || typeof node !== "object") return;
|
|
1715
|
+
if (Array.isArray(node)) {
|
|
1716
|
+
for (const child of node) visit(child);
|
|
1717
|
+
return;
|
|
1718
|
+
}
|
|
1719
|
+
const current = node;
|
|
1720
|
+
if (typeof current.type !== "string") return;
|
|
1721
|
+
if (current.type === "JSXElement") {
|
|
1722
|
+
const name = jsxName(_optionalChain([current, 'access', _90 => _90.openingElement, 'optionalAccess', _91 => _91.name]));
|
|
1723
|
+
if (name && names.has(name)) {
|
|
1724
|
+
let container;
|
|
1725
|
+
for (let depth = open.length - 1; depth >= 0; depth--) {
|
|
1726
|
+
const tag = jsxName(open[depth].openingElement.name);
|
|
1727
|
+
if (FLOW_CONTENT_TAGS.has(tag)) break;
|
|
1728
|
+
if (ISLAND_CONTAINER_TAGS.has(tag)) container = open[depth];
|
|
1729
|
+
}
|
|
1730
|
+
if (container && !found.has(container.start)) {
|
|
1731
|
+
found.set(container.start, {
|
|
1732
|
+
tag: jsxName(container.openingElement.name),
|
|
1733
|
+
start: container.start,
|
|
1734
|
+
end: container.end
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
const host = _optionalChain([current, 'access', _92 => _92.openingElement, 'optionalAccess', _93 => _93.name, 'optionalAccess', _94 => _94.type]) === "JSXIdentifier" && (ISLAND_CONTAINER_TAGS.has(name) || FLOW_CONTENT_TAGS.has(name));
|
|
1739
|
+
if (host) open.push(current);
|
|
1740
|
+
visit(_optionalChain([current, 'access', _95 => _95.openingElement, 'optionalAccess', _96 => _96.attributes]));
|
|
1741
|
+
visit(current.children);
|
|
1742
|
+
if (host) open.pop();
|
|
1743
|
+
return;
|
|
1744
|
+
}
|
|
1745
|
+
for (const [key, value] of Object.entries(current)) {
|
|
1746
|
+
if (key === "start" || key === "end" || key === "loc" || key === "range") continue;
|
|
1747
|
+
if (value && typeof value === "object") visit(value);
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
visit(program);
|
|
1751
|
+
const sorted = [...found.values()].sort((a, b) => a.start - b.start);
|
|
1752
|
+
const outermost = [];
|
|
1753
|
+
for (const container of sorted) {
|
|
1754
|
+
const last = outermost[outermost.length - 1];
|
|
1755
|
+
if (last && container.start >= last.start && container.end <= last.end) continue;
|
|
1756
|
+
outermost.push(container);
|
|
1757
|
+
}
|
|
1758
|
+
return outermost;
|
|
1759
|
+
}
|
|
1760
|
+
function wrapFarmIslandContainers(options) {
|
|
1761
|
+
const containers = findFarmIslandContainers(options.code, options.file, options.bindings);
|
|
1762
|
+
if (!containers || containers.length === 0) return null;
|
|
1763
|
+
let code = options.code;
|
|
1764
|
+
for (const container of [...containers].reverse()) {
|
|
1765
|
+
code = code.slice(0, container.start) + `<${CONTAINER_LOCAL}>` + code.slice(container.start, container.end) + `</${CONTAINER_LOCAL}>` + code.slice(container.end);
|
|
1766
|
+
}
|
|
1767
|
+
const specifier = JSON.stringify(options.reference.split(_path2.default.sep).join("/"));
|
|
1768
|
+
const declaration = `import { ${FARM_ISLAND_CONTAINER_EXPORT} as ${CONTAINER_LOCAL} } from ${specifier};
|
|
1769
|
+
`;
|
|
1770
|
+
let prologueEnd = 0;
|
|
1771
|
+
for (const statement of _nullishCoalesce(_optionalChain([parse2, 'call', _97 => _97(options.code, options.file), 'optionalAccess', _98 => _98.body]), () => ( []))) {
|
|
1772
|
+
if (statement.type !== "ExpressionStatement" || typeof statement.directive !== "string") break;
|
|
1773
|
+
prologueEnd = statement.end;
|
|
1774
|
+
}
|
|
1775
|
+
if (prologueEnd === 0) return declaration + code;
|
|
1776
|
+
return `${code.slice(0, prologueEnd)}
|
|
1777
|
+
${declaration}${code.slice(prologueEnd)}`;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1637
1780
|
// src/utils/package-client-boundary-cache.ts
|
|
1638
1781
|
var _async_hooks = require('async_hooks');
|
|
1639
1782
|
|
|
@@ -1681,7 +1824,7 @@ function stampPackagePath(target, kind) {
|
|
|
1681
1824
|
const stat = _fs2.default.statSync(target, { throwIfNoEntry: false });
|
|
1682
1825
|
if (!stat || (kind === "file" ? !stat.isFile() : !stat.isDirectory())) return void 0;
|
|
1683
1826
|
return [target, stat.size, stat.mtimeMs, stat.ctimeMs];
|
|
1684
|
-
} catch (
|
|
1827
|
+
} catch (e25) {
|
|
1685
1828
|
return void 0;
|
|
1686
1829
|
}
|
|
1687
1830
|
}
|
|
@@ -1717,7 +1860,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1717
1860
|
else this.dirty = true;
|
|
1718
1861
|
}
|
|
1719
1862
|
}
|
|
1720
|
-
return _optionalChain([entries, 'optionalAccess',
|
|
1863
|
+
return _optionalChain([entries, 'optionalAccess', _99 => _99.find, 'call', _100 => _100(
|
|
1721
1864
|
(entry) => entry.stops.every((file) => visited.has(file)) && !entry.files.some((file) => visited.has(file))
|
|
1722
1865
|
)]);
|
|
1723
1866
|
}
|
|
@@ -1736,7 +1879,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1736
1879
|
await _fs2.default.promises.mkdir(_path2.default.dirname(file), { recursive: true });
|
|
1737
1880
|
await _fs2.default.promises.writeFile(temporary, contents);
|
|
1738
1881
|
await _fs2.default.promises.rename(temporary, file);
|
|
1739
|
-
} catch (
|
|
1882
|
+
} catch (e26) {
|
|
1740
1883
|
await _fs2.default.promises.rm(temporary, { force: true }).catch(() => {
|
|
1741
1884
|
});
|
|
1742
1885
|
}
|
|
@@ -1751,10 +1894,10 @@ var PackageClientBoundaryCache = class {
|
|
|
1751
1894
|
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
1752
1895
|
_fs2.default.writeFileSync(temporary, contents);
|
|
1753
1896
|
_fs2.default.renameSync(temporary, file);
|
|
1754
|
-
} catch (
|
|
1897
|
+
} catch (e27) {
|
|
1755
1898
|
try {
|
|
1756
1899
|
_fs2.default.rmSync(temporary, { force: true });
|
|
1757
|
-
} catch (
|
|
1900
|
+
} catch (e28) {
|
|
1758
1901
|
}
|
|
1759
1902
|
}
|
|
1760
1903
|
}
|
|
@@ -1788,7 +1931,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1788
1931
|
}
|
|
1789
1932
|
const contents = JSON.stringify({
|
|
1790
1933
|
schema: SCHEMA_VERSION,
|
|
1791
|
-
farm:
|
|
1934
|
+
farm: _chunkUVQRMUARcjs.FARM_VERSION,
|
|
1792
1935
|
paths,
|
|
1793
1936
|
entries
|
|
1794
1937
|
});
|
|
@@ -1825,10 +1968,10 @@ function readStoredCache(file) {
|
|
|
1825
1968
|
let value;
|
|
1826
1969
|
try {
|
|
1827
1970
|
value = JSON.parse(_fs2.default.readFileSync(file, "utf8"));
|
|
1828
|
-
} catch (
|
|
1971
|
+
} catch (e29) {
|
|
1829
1972
|
return null;
|
|
1830
1973
|
}
|
|
1831
|
-
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !==
|
|
1974
|
+
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkUVQRMUARcjs.FARM_VERSION) {
|
|
1832
1975
|
return null;
|
|
1833
1976
|
}
|
|
1834
1977
|
const { paths, entries } = value;
|
|
@@ -1839,7 +1982,7 @@ function readStoredCache(file) {
|
|
|
1839
1982
|
const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
|
|
1840
1983
|
if (usable.length > 0) valid[key] = usable;
|
|
1841
1984
|
}
|
|
1842
|
-
return { schema: SCHEMA_VERSION, farm:
|
|
1985
|
+
return { schema: SCHEMA_VERSION, farm: _chunkUVQRMUARcjs.FARM_VERSION, paths, entries: valid };
|
|
1843
1986
|
}
|
|
1844
1987
|
function isRecord(value) {
|
|
1845
1988
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -1878,7 +2021,7 @@ async function withPackageClientBoundaryCache(operation) {
|
|
|
1878
2021
|
}
|
|
1879
2022
|
}
|
|
1880
2023
|
function usePackageClientBoundaryCacheFile(file) {
|
|
1881
|
-
_optionalChain([getPackageClientBoundaryCache, 'call',
|
|
2024
|
+
_optionalChain([getPackageClientBoundaryCache, 'call', _101 => _101(), 'optionalAccess', _102 => _102.load, 'call', _103 => _103(file)]);
|
|
1882
2025
|
}
|
|
1883
2026
|
function resolvePackageClientBoundaryCacheFile(root, distDir) {
|
|
1884
2027
|
return _path2.default.resolve(root, distDir, "cache", "client-boundaries.json");
|
|
@@ -1895,7 +2038,7 @@ function runWithPackageClientBoundaryCacheFile(file, operation) {
|
|
|
1895
2038
|
var latestDevCache;
|
|
1896
2039
|
function runWithLatestPackageClientBoundaryCache(file, operation) {
|
|
1897
2040
|
if (getPackageClientBoundaryCache()) return operation();
|
|
1898
|
-
if (_optionalChain([latestDevCache, 'optionalAccess',
|
|
2041
|
+
if (_optionalChain([latestDevCache, 'optionalAccess', _104 => _104.file]) !== file) {
|
|
1899
2042
|
const cache2 = new PackageClientBoundaryCache();
|
|
1900
2043
|
cache2.load(file);
|
|
1901
2044
|
latestDevCache = { file, cache: cache2 };
|
|
@@ -1929,7 +2072,7 @@ function readSourceFileContents(filePath) {
|
|
|
1929
2072
|
return null;
|
|
1930
2073
|
}
|
|
1931
2074
|
return _fs2.default.readFileSync(filePath, "utf-8");
|
|
1932
|
-
} catch (
|
|
2075
|
+
} catch (e30) {
|
|
1933
2076
|
return null;
|
|
1934
2077
|
}
|
|
1935
2078
|
}
|
|
@@ -1942,7 +2085,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
1942
2085
|
if (modulePath.startsWith("file://")) {
|
|
1943
2086
|
try {
|
|
1944
2087
|
candidates.add(_url.fileURLToPath.call(void 0, modulePath));
|
|
1945
|
-
} catch (
|
|
2088
|
+
} catch (e31) {
|
|
1946
2089
|
}
|
|
1947
2090
|
}
|
|
1948
2091
|
if (modulePath.startsWith("/@fs/")) {
|
|
@@ -1955,7 +2098,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
1955
2098
|
candidates.add(_path2.default.join(root, normalized));
|
|
1956
2099
|
candidates.add(_path2.default.resolve(root, normalized));
|
|
1957
2100
|
}
|
|
1958
|
-
if (_optionalChain([withoutQuery, 'optionalAccess',
|
|
2101
|
+
if (_optionalChain([withoutQuery, 'optionalAccess', _105 => _105.startsWith, 'call', _106 => _106("/src/")])) {
|
|
1959
2102
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
1960
2103
|
candidates.add(_path2.default.join(process.cwd(), normalized));
|
|
1961
2104
|
candidates.add(_path2.default.resolve(process.cwd(), normalized));
|
|
@@ -2034,7 +2177,7 @@ function hasHydrateExport(content) {
|
|
|
2034
2177
|
for (const match of content.matchAll(/\bexport\s*\{([^}]*)\}/g)) {
|
|
2035
2178
|
for (const specifier of match[1].split(",")) {
|
|
2036
2179
|
const parts = specifier.trim().split(/\s+as\s+/);
|
|
2037
|
-
const exportedName2 = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess',
|
|
2180
|
+
const exportedName2 = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess', _107 => _107.trim, 'call', _108 => _108()]);
|
|
2038
2181
|
if (exportedName2 === "hydrate") {
|
|
2039
2182
|
return true;
|
|
2040
2183
|
}
|
|
@@ -2227,7 +2370,7 @@ function isIslandExportStart(tokens, index) {
|
|
|
2227
2370
|
const token = tokens[index];
|
|
2228
2371
|
const previous = tokens[index - 1];
|
|
2229
2372
|
const startsStatement = !previous || previous.value === ";" || previous.value === "{" || previous.value === "}" || token.line > previous.line;
|
|
2230
|
-
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access',
|
|
2373
|
+
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access', _109 => _109[index + 1], 'optionalAccess', _110 => _110.value]) === "const" && _optionalChain([tokens, 'access', _111 => _111[index + 2], 'optionalAccess', _112 => _112.value]) === "island";
|
|
2231
2374
|
}
|
|
2232
2375
|
function getIslandStrategyExport(content) {
|
|
2233
2376
|
if (!content) return null;
|
|
@@ -2235,15 +2378,15 @@ function getIslandStrategyExport(content) {
|
|
|
2235
2378
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2236
2379
|
if (!isIslandExportStart(tokens, index)) continue;
|
|
2237
2380
|
let valueIndex = index + 3;
|
|
2238
|
-
if (_optionalChain([tokens, 'access',
|
|
2381
|
+
if (_optionalChain([tokens, 'access', _113 => _113[valueIndex], 'optionalAccess', _114 => _114.value]) === ":") {
|
|
2239
2382
|
while (valueIndex < tokens.length && tokens[valueIndex].value !== "=") valueIndex++;
|
|
2240
2383
|
}
|
|
2241
|
-
if (_optionalChain([tokens, 'access',
|
|
2384
|
+
if (_optionalChain([tokens, 'access', _115 => _115[valueIndex], 'optionalAccess', _116 => _116.value]) !== "=") break;
|
|
2242
2385
|
valueIndex++;
|
|
2243
2386
|
const literal = tokens[valueIndex];
|
|
2244
2387
|
if (!literal || literal.kind !== "string" || !_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, literal.value)) break;
|
|
2245
2388
|
let trailingIndex = valueIndex + 1;
|
|
2246
|
-
if (_optionalChain([tokens, 'access',
|
|
2389
|
+
if (_optionalChain([tokens, 'access', _117 => _117[trailingIndex], 'optionalAccess', _118 => _118.value]) === "as" && _optionalChain([tokens, 'access', _119 => _119[trailingIndex + 1], 'optionalAccess', _120 => _120.value]) === "const") {
|
|
2247
2390
|
trailingIndex += 2;
|
|
2248
2391
|
}
|
|
2249
2392
|
const trailing = tokens[trailingIndex];
|
|
@@ -2269,13 +2412,13 @@ function hasAsyncDefaultExport(content) {
|
|
|
2269
2412
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2270
2413
|
const token = tokens[index];
|
|
2271
2414
|
if (token.kind !== "identifier" || token.value !== "export") continue;
|
|
2272
|
-
if (_optionalChain([tokens, 'access',
|
|
2273
|
-
if (_optionalChain([tokens, 'access',
|
|
2415
|
+
if (_optionalChain([tokens, 'access', _121 => _121[index - 1], 'optionalAccess', _122 => _122.value]) === ".") continue;
|
|
2416
|
+
if (_optionalChain([tokens, 'access', _123 => _123[index + 1], 'optionalAccess', _124 => _124.value]) !== "default") continue;
|
|
2274
2417
|
const exported = tokens[index + 2];
|
|
2275
2418
|
if (exported.kind === "identifier" && exported.value === "async") {
|
|
2276
2419
|
return true;
|
|
2277
2420
|
}
|
|
2278
|
-
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access',
|
|
2421
|
+
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access', _125 => _125[index + 3], 'optionalAccess', _126 => _126.value]) !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
|
|
2279
2422
|
return true;
|
|
2280
2423
|
}
|
|
2281
2424
|
}
|
|
@@ -2283,10 +2426,10 @@ function hasAsyncDefaultExport(content) {
|
|
|
2283
2426
|
}
|
|
2284
2427
|
function isAsyncLocalDeclaration(tokens, name) {
|
|
2285
2428
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2286
|
-
if (tokens[index].value === "async" && _optionalChain([tokens, 'access',
|
|
2429
|
+
if (tokens[index].value === "async" && _optionalChain([tokens, 'access', _127 => _127[index + 1], 'optionalAccess', _128 => _128.value]) === "function" && _optionalChain([tokens, 'access', _129 => _129[index + 2], 'optionalAccess', _130 => _130.value]) === name) {
|
|
2287
2430
|
return true;
|
|
2288
2431
|
}
|
|
2289
|
-
if (tokens[index].value === name && _optionalChain([tokens, 'access',
|
|
2432
|
+
if (tokens[index].value === name && _optionalChain([tokens, 'access', _131 => _131[index + 1], 'optionalAccess', _132 => _132.value]) === "=" && _optionalChain([tokens, 'access', _133 => _133[index + 2], 'optionalAccess', _134 => _134.value]) === "async") {
|
|
2290
2433
|
return true;
|
|
2291
2434
|
}
|
|
2292
2435
|
}
|
|
@@ -2326,6 +2469,16 @@ function resolveOwnerSourcePath(resolvedPath, root) {
|
|
|
2326
2469
|
}
|
|
2327
2470
|
return current;
|
|
2328
2471
|
}
|
|
2472
|
+
function getFarmClientRenderingBindings(code, file, root) {
|
|
2473
|
+
const bindings = [];
|
|
2474
|
+
for (const [specifier, locals] of getStaticImportBindings(code)) {
|
|
2475
|
+
const imported = resolveImportedModule(file, specifier, root);
|
|
2476
|
+
if (!imported.path) continue;
|
|
2477
|
+
const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([_path2.default.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root, /* @__PURE__ */ new Set());
|
|
2478
|
+
if (metadata.isClientComponent || metadata.shouldHydrate) bindings.push(...locals);
|
|
2479
|
+
}
|
|
2480
|
+
return bindings;
|
|
2481
|
+
}
|
|
2329
2482
|
function collectFarmRenderedClientModules(modulePath, root) {
|
|
2330
2483
|
const resolvedPath = resolveOwnerSourcePath(resolveModuleSourcePath(modulePath, root), root);
|
|
2331
2484
|
if (!resolvedPath) return null;
|
|
@@ -2487,7 +2640,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
2487
2640
|
return plan;
|
|
2488
2641
|
}
|
|
2489
2642
|
function usesFarmServerTree(plan) {
|
|
2490
|
-
return _optionalChain([plan, 'optionalAccess',
|
|
2643
|
+
return _optionalChain([plan, 'optionalAccess', _135 => _135.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0;
|
|
2491
2644
|
}
|
|
2492
2645
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
2493
2646
|
const plan = {
|
|
@@ -2591,6 +2744,13 @@ function enforceFarmIsolatedHydrationRouteBudget(layouts, routes, layoutAppliesT
|
|
|
2591
2744
|
(ancestor) => ancestor !== layout && ancestor.depth < layout.depth && ancestor.metadata.shouldHydrate && layoutAppliesToRoute(ancestor.pattern, layout.pattern)
|
|
2592
2745
|
);
|
|
2593
2746
|
if (hasRouteWideAncestor && layout.metadata.hasIsolatedClientBoundaries) {
|
|
2747
|
+
if (options.serverOwners && !layout.metadata.asyncOwnerIslands) {
|
|
2748
|
+
layout.metadata.shouldHydrate = layout.metadata.legacyShouldHydrate;
|
|
2749
|
+
layout.metadata.islandStrategy = layout.metadata.legacyIslandStrategy;
|
|
2750
|
+
layout.metadata.hasIsolatedClientBoundaries = false;
|
|
2751
|
+
layout.metadata.serverTreeLayout = true;
|
|
2752
|
+
continue;
|
|
2753
|
+
}
|
|
2594
2754
|
restoreRouteWideHydration(layout.metadata);
|
|
2595
2755
|
}
|
|
2596
2756
|
}
|
|
@@ -2610,7 +2770,7 @@ function clientModulePlanSignature(content) {
|
|
|
2610
2770
|
isIsolatableClientBoundarySource(content),
|
|
2611
2771
|
getImportSpecifiers(content).sort()
|
|
2612
2772
|
]);
|
|
2613
|
-
} catch (
|
|
2773
|
+
} catch (e32) {
|
|
2614
2774
|
return null;
|
|
2615
2775
|
}
|
|
2616
2776
|
}
|
|
@@ -2635,7 +2795,7 @@ function getStaticImportBindings(content) {
|
|
|
2635
2795
|
if (!content) return bindings;
|
|
2636
2796
|
const tokens = tokenizeModuleSource(content);
|
|
2637
2797
|
for (let index = 0; index < tokens.length; index++) {
|
|
2638
|
-
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access',
|
|
2798
|
+
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _136 => _136[index - 1], 'optionalAccess', _137 => _137.value]) === ".") continue;
|
|
2639
2799
|
const first = tokens[index + 1];
|
|
2640
2800
|
if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
|
|
2641
2801
|
continue;
|
|
@@ -2643,7 +2803,7 @@ function getStaticImportBindings(content) {
|
|
|
2643
2803
|
let fromIndex = -1;
|
|
2644
2804
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
2645
2805
|
if (tokens[cursor].value === ";") break;
|
|
2646
|
-
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access',
|
|
2806
|
+
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _138 => _138[cursor + 1], 'optionalAccess', _139 => _139.kind]) === "string") {
|
|
2647
2807
|
fromIndex = cursor;
|
|
2648
2808
|
break;
|
|
2649
2809
|
}
|
|
@@ -2652,13 +2812,13 @@ function getStaticImportBindings(content) {
|
|
|
2652
2812
|
const specifier = tokens[fromIndex + 1].value;
|
|
2653
2813
|
const clause = tokens.slice(index + 1, fromIndex);
|
|
2654
2814
|
const localNames = [];
|
|
2655
|
-
if (_optionalChain([clause, 'access',
|
|
2815
|
+
if (_optionalChain([clause, 'access', _140 => _140[0], 'optionalAccess', _141 => _141.kind]) === "identifier" && clause[0].value !== "type") {
|
|
2656
2816
|
localNames.push(clause[0].value);
|
|
2657
2817
|
}
|
|
2658
2818
|
const namespaceAs = clause.findIndex(
|
|
2659
|
-
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access',
|
|
2819
|
+
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _142 => _142[clauseIndex + 1], 'optionalAccess', _143 => _143.value]) === "as"
|
|
2660
2820
|
);
|
|
2661
|
-
if (namespaceAs !== -1 && _optionalChain([clause, 'access',
|
|
2821
|
+
if (namespaceAs !== -1 && _optionalChain([clause, 'access', _144 => _144[namespaceAs + 2], 'optionalAccess', _145 => _145.kind]) === "identifier") {
|
|
2662
2822
|
localNames.push(clause[namespaceAs + 2].value);
|
|
2663
2823
|
}
|
|
2664
2824
|
const openingBrace = clause.findIndex((token) => token.value === "{");
|
|
@@ -2668,11 +2828,11 @@ function getStaticImportBindings(content) {
|
|
|
2668
2828
|
if (openingBrace !== -1 && closingBrace !== -1) {
|
|
2669
2829
|
let entryStart = openingBrace + 1;
|
|
2670
2830
|
for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
|
|
2671
|
-
if (cursor !== closingBrace && _optionalChain([clause, 'access',
|
|
2831
|
+
if (cursor !== closingBrace && _optionalChain([clause, 'access', _146 => _146[cursor], 'optionalAccess', _147 => _147.value]) !== ",") continue;
|
|
2672
2832
|
const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
|
|
2673
2833
|
const asIndex = entry.findIndex((token) => token.value === "as");
|
|
2674
2834
|
const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
|
|
2675
|
-
if (_optionalChain([local, 'optionalAccess',
|
|
2835
|
+
if (_optionalChain([local, 'optionalAccess', _148 => _148.kind]) === "identifier") localNames.push(local.value);
|
|
2676
2836
|
entryStart = cursor + 1;
|
|
2677
2837
|
}
|
|
2678
2838
|
}
|
|
@@ -2709,14 +2869,14 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
2709
2869
|
const open = [];
|
|
2710
2870
|
const isSelfClosing = (openingIndex) => {
|
|
2711
2871
|
for (let index = openingIndex; index < tokens.length; index++) {
|
|
2712
|
-
if (tokens[index].value === ">") return _optionalChain([tokens, 'access',
|
|
2872
|
+
if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _149 => _149[index - 1], 'optionalAccess', _150 => _150.value]) === "/";
|
|
2713
2873
|
}
|
|
2714
2874
|
return false;
|
|
2715
2875
|
};
|
|
2716
2876
|
for (let index = 0; index < tokens.length - 1; index++) {
|
|
2717
2877
|
if (tokens[index].value !== "<") continue;
|
|
2718
2878
|
if (tokens[index + 1].value === "/") {
|
|
2719
|
-
const closing = _optionalChain([tokens, 'access',
|
|
2879
|
+
const closing = _optionalChain([tokens, 'access', _151 => _151[index + 2], 'optionalAccess', _152 => _152.value]);
|
|
2720
2880
|
const at = closing ? open.lastIndexOf(closing) : -1;
|
|
2721
2881
|
if (at !== -1) open.length = at;
|
|
2722
2882
|
continue;
|
|
@@ -2759,7 +2919,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
|
|
|
2759
2919
|
}
|
|
2760
2920
|
function containsClientJsx(tokens, start, end, clientBindings) {
|
|
2761
2921
|
for (let index = start; index < end; index++) {
|
|
2762
|
-
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access',
|
|
2922
|
+
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _153 => _153[index + 1], 'optionalAccess', _154 => _154.value]))) return true;
|
|
2763
2923
|
}
|
|
2764
2924
|
return false;
|
|
2765
2925
|
}
|
|
@@ -2797,7 +2957,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
2797
2957
|
let helperName;
|
|
2798
2958
|
let bodyStart = -1;
|
|
2799
2959
|
let bodyEnd = -1;
|
|
2800
|
-
if (tokens[index].value === "function" && _optionalChain([tokens, 'access',
|
|
2960
|
+
if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _155 => _155[index + 1], 'optionalAccess', _156 => _156.kind]) === "identifier") {
|
|
2801
2961
|
helperName = tokens[index + 1].value;
|
|
2802
2962
|
const parametersStart = tokens.findIndex(
|
|
2803
2963
|
(token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
|
|
@@ -2807,21 +2967,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
2807
2967
|
(token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
|
|
2808
2968
|
);
|
|
2809
2969
|
if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
|
|
2810
|
-
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access',
|
|
2970
|
+
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _157 => _157[index + 1], 'optionalAccess', _158 => _158.kind]) === "identifier") {
|
|
2811
2971
|
helperName = tokens[index + 1].value;
|
|
2812
2972
|
let assignmentIndex = -1;
|
|
2813
2973
|
let arrowIndex = -1;
|
|
2814
2974
|
for (let cursor = index + 2; cursor < tokens.length; cursor++) {
|
|
2815
2975
|
if (tokens[cursor].value === ";") break;
|
|
2816
2976
|
if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
|
|
2817
|
-
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access',
|
|
2977
|
+
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _159 => _159[cursor + 1], 'optionalAccess', _160 => _160.value]) === ">") {
|
|
2818
2978
|
arrowIndex = cursor;
|
|
2819
2979
|
break;
|
|
2820
2980
|
}
|
|
2821
2981
|
}
|
|
2822
2982
|
if (arrowIndex !== -1) {
|
|
2823
2983
|
bodyStart = arrowIndex + 2;
|
|
2824
|
-
bodyEnd = _optionalChain([tokens, 'access',
|
|
2984
|
+
bodyEnd = _optionalChain([tokens, 'access', _161 => _161[bodyStart], 'optionalAccess', _162 => _162.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
|
|
2825
2985
|
} else if (assignmentIndex !== -1) {
|
|
2826
2986
|
bodyStart = assignmentIndex + 1;
|
|
2827
2987
|
bodyEnd = findStatementEnd(tokens, bodyStart);
|
|
@@ -2861,14 +3021,14 @@ function passesElementValuedProps(content, localBindings) {
|
|
|
2861
3021
|
else if (value === "}") braceDepth--;
|
|
2862
3022
|
else if (value === "<" && braceDepth > 0) return true;
|
|
2863
3023
|
else if (value === ">" && braceDepth === 0) {
|
|
2864
|
-
selfClosing = _optionalChain([tokens, 'access',
|
|
3024
|
+
selfClosing = _optionalChain([tokens, 'access', _163 => _163[cursor - 1], 'optionalAccess', _164 => _164.value]) === "/";
|
|
2865
3025
|
break;
|
|
2866
3026
|
}
|
|
2867
3027
|
}
|
|
2868
3028
|
if (selfClosing || cursor >= tokens.length) continue;
|
|
2869
3029
|
for (let child = cursor + 1; child < tokens.length; child++) {
|
|
2870
3030
|
if (tokens[child].value !== "<") continue;
|
|
2871
|
-
const closesBoundary = _optionalChain([tokens, 'access',
|
|
3031
|
+
const closesBoundary = _optionalChain([tokens, 'access', _165 => _165[child + 1], 'optionalAccess', _166 => _166.value]) === "/" && _optionalChain([tokens, 'access', _167 => _167[child + 2], 'optionalAccess', _168 => _168.value]) === name;
|
|
2872
3032
|
if (!closesBoundary) return true;
|
|
2873
3033
|
break;
|
|
2874
3034
|
}
|
|
@@ -2890,7 +3050,7 @@ function rendersOnlyLeafElements(content, localBindings) {
|
|
|
2890
3050
|
else if (value === "<" && braceDepth > 0) return false;
|
|
2891
3051
|
else if (value === ">" && braceDepth === 0) break;
|
|
2892
3052
|
}
|
|
2893
|
-
if (cursor >= tokens.length || _optionalChain([tokens, 'access',
|
|
3053
|
+
if (cursor >= tokens.length || _optionalChain([tokens, 'access', _169 => _169[cursor - 1], 'optionalAccess', _170 => _170.value]) !== "/") return false;
|
|
2894
3054
|
}
|
|
2895
3055
|
return true;
|
|
2896
3056
|
}
|
|
@@ -2902,9 +3062,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
2902
3062
|
const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
|
|
2903
3063
|
for (let index = 0; index < tokens.length; index++) {
|
|
2904
3064
|
let callStart = -1;
|
|
2905
|
-
if (tokens[index].value === "." && (_optionalChain([tokens, 'access',
|
|
3065
|
+
if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _171 => _171[index + 1], 'optionalAccess', _172 => _172.value]) === "map" || _optionalChain([tokens, 'access', _173 => _173[index + 1], 'optionalAccess', _174 => _174.value]) === "flatMap") && _optionalChain([tokens, 'access', _175 => _175[index + 2], 'optionalAccess', _176 => _176.value]) === "(") {
|
|
2906
3066
|
callStart = index + 2;
|
|
2907
|
-
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access',
|
|
3067
|
+
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _177 => _177[index + 1], 'optionalAccess', _178 => _178.value]) === "." && _optionalChain([tokens, 'access', _179 => _179[index + 2], 'optionalAccess', _180 => _180.value]) === "from" && _optionalChain([tokens, 'access', _181 => _181[index + 3], 'optionalAccess', _182 => _182.value]) === "(") {
|
|
2908
3068
|
callStart = index + 3;
|
|
2909
3069
|
}
|
|
2910
3070
|
if (callStart !== -1) {
|
|
@@ -2913,10 +3073,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
2913
3073
|
index = callEnd;
|
|
2914
3074
|
continue;
|
|
2915
3075
|
}
|
|
2916
|
-
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access',
|
|
3076
|
+
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _183 => _183[index + 1], 'optionalAccess', _184 => _184.value]) === "(") {
|
|
2917
3077
|
const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
|
|
2918
3078
|
const bodyStart = conditionEnd + 1;
|
|
2919
|
-
const bodyEnd = _optionalChain([tokens, 'access',
|
|
3079
|
+
const bodyEnd = _optionalChain([tokens, 'access', _185 => _185[bodyStart], 'optionalAccess', _186 => _186.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
|
|
2920
3080
|
if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
|
|
2921
3081
|
}
|
|
2922
3082
|
}
|
|
@@ -3028,7 +3188,9 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3028
3188
|
const localBindings = _nullishCoalesce(importedBindings.get(specifier), () => ( []));
|
|
3029
3189
|
const staticUses = countStaticJsxUses(content, localBindings);
|
|
3030
3190
|
if (staticUses > 0) {
|
|
3031
|
-
const
|
|
3191
|
+
const grows = options.packageReferences === true && projectRoot !== void 0 && (_nullishCoalesce(_optionalChain([findFarmIslandContainers, 'call', _187 => _187(_nullishCoalesce(content, () => ( "")), moduleSourcePath, localBindings), 'optionalAccess', _188 => _188.length]), () => ( 0))) > 0;
|
|
3192
|
+
if (grows) visit(ensureFarmIslandContainerReference(projectRoot));
|
|
3193
|
+
const container = grows ? void 0 : findParserSensitiveJsxContainer(content, localBindings);
|
|
3032
3194
|
if (container) {
|
|
3033
3195
|
fallbackReason = `the client boundary imported from ${specifier} renders inside <${container}>, where the HTML parser relocates its hydration marker`;
|
|
3034
3196
|
fallbackHint = `Move "use client" up to a component that renders the whole <${container}>${_nullishCoalesce(PARSER_SENSITIVE_FLOW_HINTS[container], () => ( ""))}`;
|
|
@@ -3122,7 +3284,7 @@ function farmWorkspaceServerEntry(entry) {
|
|
|
3122
3284
|
function realpathOrSelf(file) {
|
|
3123
3285
|
try {
|
|
3124
3286
|
return _fs2.default.realpathSync(file);
|
|
3125
|
-
} catch (
|
|
3287
|
+
} catch (e33) {
|
|
3126
3288
|
return file;
|
|
3127
3289
|
}
|
|
3128
3290
|
}
|
|
@@ -3152,7 +3314,7 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
3152
3314
|
}
|
|
3153
3315
|
function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
3154
3316
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
3155
|
-
if (resolvedPath) _optionalChain([trace2, 'optionalAccess',
|
|
3317
|
+
if (resolvedPath) _optionalChain([trace2, 'optionalAccess', _189 => _189.stop, 'call', _190 => _190(resolvedPath)]);
|
|
3156
3318
|
return {
|
|
3157
3319
|
isClientComponent: false,
|
|
3158
3320
|
shouldHydrate: false,
|
|
@@ -3160,7 +3322,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
|
3160
3322
|
};
|
|
3161
3323
|
}
|
|
3162
3324
|
visited.add(resolvedPath);
|
|
3163
|
-
_optionalChain([trace2, 'optionalAccess',
|
|
3325
|
+
_optionalChain([trace2, 'optionalAccess', _191 => _191.visit, 'call', _192 => _192(resolvedPath)]);
|
|
3164
3326
|
const content = readIfExists(resolvedPath);
|
|
3165
3327
|
const parsed = parseClientModuleMetadata(content, false);
|
|
3166
3328
|
let importsClientBoundary = false;
|
|
@@ -3218,7 +3380,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3218
3380
|
braceDepth = Math.max(0, braceDepth - 1);
|
|
3219
3381
|
continue;
|
|
3220
3382
|
}
|
|
3221
|
-
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access',
|
|
3383
|
+
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access', _193 => _193[index - 1], 'optionalAccess', _194 => _194.value]) !== "." && _optionalChain([tokens, 'access', _195 => _195[index + 1], 'optionalAccess', _196 => _196.value]) === "(" && _optionalChain([tokens, 'access', _197 => _197[index + 2], 'optionalAccess', _198 => _198.kind]) === "string") {
|
|
3222
3384
|
matches.add(tokens[index + 2].value);
|
|
3223
3385
|
continue;
|
|
3224
3386
|
}
|
|
@@ -3228,7 +3390,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3228
3390
|
}
|
|
3229
3391
|
if (reexportsOnly && keyword.value !== "export") continue;
|
|
3230
3392
|
const previous = tokens[index - 1];
|
|
3231
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
3393
|
+
if (_optionalChain([previous, 'optionalAccess', _199 => _199.value]) === ".") continue;
|
|
3232
3394
|
const first = tokens[index + 1];
|
|
3233
3395
|
if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
|
|
3234
3396
|
continue;
|
|
@@ -3244,7 +3406,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3244
3406
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
3245
3407
|
const token = tokens[cursor];
|
|
3246
3408
|
if (token.value === ";") break;
|
|
3247
|
-
if (token.value === "from" && _optionalChain([tokens, 'access',
|
|
3409
|
+
if (token.value === "from" && _optionalChain([tokens, 'access', _200 => _200[cursor + 1], 'optionalAccess', _201 => _201.kind]) === "string") {
|
|
3248
3410
|
fromIndex = cursor;
|
|
3249
3411
|
break;
|
|
3250
3412
|
}
|
|
@@ -3262,14 +3424,14 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3262
3424
|
return Array.from(matches);
|
|
3263
3425
|
}
|
|
3264
3426
|
function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
3265
|
-
if (_optionalChain([tokens, 'access',
|
|
3427
|
+
if (_optionalChain([tokens, 'access', _202 => _202[startIndex], 'optionalAccess', _203 => _203.value]) !== "{") return false;
|
|
3266
3428
|
const closingBraceIndex = tokens.findIndex(
|
|
3267
3429
|
(token, index) => index > startIndex && index < endIndex && token.value === "}"
|
|
3268
3430
|
);
|
|
3269
3431
|
if (closingBraceIndex === -1) return false;
|
|
3270
3432
|
let entryStartsAt = startIndex + 1;
|
|
3271
3433
|
for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
|
|
3272
|
-
if (index !== closingBraceIndex && _optionalChain([tokens, 'access',
|
|
3434
|
+
if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _204 => _204[index], 'optionalAccess', _205 => _205.value]) !== ",") continue;
|
|
3273
3435
|
const entry = tokens.slice(entryStartsAt, index);
|
|
3274
3436
|
if (entry.length > 0 && entry[0].value !== "type") return false;
|
|
3275
3437
|
entryStartsAt = index + 1;
|
|
@@ -3343,14 +3505,14 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3343
3505
|
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
3344
3506
|
try {
|
|
3345
3507
|
return String(_fs2.default.statSync(_path2.default.join(projectRoot, file)).mtimeMs);
|
|
3346
|
-
} catch (
|
|
3508
|
+
} catch (e34) {
|
|
3347
3509
|
return "-";
|
|
3348
3510
|
}
|
|
3349
3511
|
}).join(":");
|
|
3350
3512
|
const sourceDir = _chunkRE5E2G5Scjs.getFarmProjectSourceDir.call(void 0, projectRoot);
|
|
3351
3513
|
const cacheStamp = `${stamp}:${sourceDir}`;
|
|
3352
3514
|
const cached = projectImportAliasCache.get(projectRoot);
|
|
3353
|
-
if (_optionalChain([cached, 'optionalAccess',
|
|
3515
|
+
if (_optionalChain([cached, 'optionalAccess', _206 => _206.stamp]) === cacheStamp) return cached.aliases;
|
|
3354
3516
|
const aliases = [
|
|
3355
3517
|
...readTsconfigPathAliases(projectRoot),
|
|
3356
3518
|
...readPackageImportAliases(projectRoot)
|
|
@@ -3371,7 +3533,7 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
3371
3533
|
const configPath = _path2.default.join(projectRoot, name);
|
|
3372
3534
|
if (!_fs2.default.existsSync(configPath)) continue;
|
|
3373
3535
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
3374
|
-
if (!_optionalChain([resolved, 'optionalAccess',
|
|
3536
|
+
if (!_optionalChain([resolved, 'optionalAccess', _207 => _207.paths])) return [];
|
|
3375
3537
|
const base = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
|
|
3376
3538
|
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
3377
3539
|
if (!Array.isArray(targets)) return [];
|
|
@@ -3406,18 +3568,18 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
3406
3568
|
inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
|
|
3407
3569
|
}
|
|
3408
3570
|
const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
|
|
3409
|
-
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess',
|
|
3571
|
+
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _208 => _208.baseUrl]);
|
|
3410
3572
|
if (options.paths && typeof options.paths === "object") {
|
|
3411
3573
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
3412
3574
|
}
|
|
3413
3575
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
3414
3576
|
}
|
|
3415
3577
|
function readPackageImportAliases(projectRoot) {
|
|
3416
|
-
const imports = _optionalChain([readPackageJson, 'call',
|
|
3578
|
+
const imports = _optionalChain([readPackageJson, 'call', _209 => _209(_path2.default.join(projectRoot, "package.json")), 'optionalAccess', _210 => _210.imports]);
|
|
3417
3579
|
if (!imports || typeof imports !== "object") return [];
|
|
3418
3580
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
3419
3581
|
const target = resolveConditionalExportTarget(value);
|
|
3420
|
-
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess',
|
|
3582
|
+
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _211 => _211.startsWith, 'call', _212 => _212("./")])) return [];
|
|
3421
3583
|
const wildcardIndex = pattern.indexOf("*");
|
|
3422
3584
|
return [
|
|
3423
3585
|
{
|
|
@@ -3433,7 +3595,7 @@ function readJsonWithComments(filePath) {
|
|
|
3433
3595
|
let source;
|
|
3434
3596
|
try {
|
|
3435
3597
|
source = _fs2.default.readFileSync(filePath, "utf8");
|
|
3436
|
-
} catch (
|
|
3598
|
+
} catch (e35) {
|
|
3437
3599
|
return null;
|
|
3438
3600
|
}
|
|
3439
3601
|
let output = "";
|
|
@@ -3461,7 +3623,7 @@ function readJsonWithComments(filePath) {
|
|
|
3461
3623
|
}
|
|
3462
3624
|
try {
|
|
3463
3625
|
return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
|
|
3464
|
-
} catch (
|
|
3626
|
+
} catch (e36) {
|
|
3465
3627
|
return null;
|
|
3466
3628
|
}
|
|
3467
3629
|
}
|
|
@@ -3483,15 +3645,15 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
3483
3645
|
const packageJsonPath = _path2.default.join(packageDirectory, "package.json");
|
|
3484
3646
|
const packageJson = readPackageJson(packageJsonPath);
|
|
3485
3647
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
3486
|
-
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess',
|
|
3648
|
+
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _213 => _213.exports]), exportKey);
|
|
3487
3649
|
const candidates = /* @__PURE__ */ new Set();
|
|
3488
|
-
if (_optionalChain([exportTarget, 'optionalAccess',
|
|
3650
|
+
if (_optionalChain([exportTarget, 'optionalAccess', _214 => _214.startsWith, 'call', _215 => _215("./")])) {
|
|
3489
3651
|
candidates.add(_path2.default.resolve(packageDirectory, exportTarget));
|
|
3490
3652
|
}
|
|
3491
3653
|
if (packageSubpath) {
|
|
3492
3654
|
candidates.add(_path2.default.join(packageDirectory, packageSubpath));
|
|
3493
3655
|
} else {
|
|
3494
|
-
for (const entry of [_optionalChain([packageJson, 'optionalAccess',
|
|
3656
|
+
for (const entry of [_optionalChain([packageJson, 'optionalAccess', _216 => _216.browser]), _optionalChain([packageJson, 'optionalAccess', _217 => _217.module]), _optionalChain([packageJson, 'optionalAccess', _218 => _218.main])]) {
|
|
3495
3657
|
if (typeof entry === "string") candidates.add(_path2.default.resolve(packageDirectory, entry));
|
|
3496
3658
|
}
|
|
3497
3659
|
candidates.add(_path2.default.join(packageDirectory, "index"));
|
|
@@ -3527,7 +3689,7 @@ function findPackageDirectory2(importerPath, packageName, root) {
|
|
|
3527
3689
|
function readPackageJson(packageJsonPath) {
|
|
3528
3690
|
try {
|
|
3529
3691
|
return JSON.parse(_fs2.default.readFileSync(packageJsonPath, "utf8"));
|
|
3530
|
-
} catch (
|
|
3692
|
+
} catch (e37) {
|
|
3531
3693
|
return null;
|
|
3532
3694
|
}
|
|
3533
3695
|
}
|
|
@@ -3556,7 +3718,7 @@ function resolvePackageExport(exportsField, exportKey) {
|
|
|
3556
3718
|
if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
|
|
3557
3719
|
const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
|
|
3558
3720
|
const target = resolveConditionalExportTarget(value);
|
|
3559
|
-
return _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
3721
|
+
return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _219 => _219.replace, 'call', _220 => _220("*", wildcard)]), () => ( null));
|
|
3560
3722
|
}
|
|
3561
3723
|
return null;
|
|
3562
3724
|
}
|
|
@@ -3589,7 +3751,7 @@ function resolveSourceCandidate(candidates) {
|
|
|
3589
3751
|
for (const sourcePath of paths) {
|
|
3590
3752
|
try {
|
|
3591
3753
|
if (_fs2.default.statSync(sourcePath).isFile()) return sourcePath;
|
|
3592
|
-
} catch (
|
|
3754
|
+
} catch (e38) {
|
|
3593
3755
|
}
|
|
3594
3756
|
}
|
|
3595
3757
|
}
|
|
@@ -3632,7 +3794,7 @@ function scanFarmPackageImports(directory, root) {
|
|
|
3632
3794
|
let entries;
|
|
3633
3795
|
try {
|
|
3634
3796
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
3635
|
-
} catch (
|
|
3797
|
+
} catch (e39) {
|
|
3636
3798
|
return;
|
|
3637
3799
|
}
|
|
3638
3800
|
for (const entry of entries) {
|
|
@@ -3665,7 +3827,7 @@ function collectFarmServerBundledPackageInfo(directory) {
|
|
|
3665
3827
|
let entries;
|
|
3666
3828
|
try {
|
|
3667
3829
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
3668
|
-
} catch (
|
|
3830
|
+
} catch (e40) {
|
|
3669
3831
|
return;
|
|
3670
3832
|
}
|
|
3671
3833
|
for (const entry of entries) {
|
|
@@ -3704,7 +3866,7 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
3704
3866
|
let entries;
|
|
3705
3867
|
try {
|
|
3706
3868
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
3707
|
-
} catch (
|
|
3869
|
+
} catch (e41) {
|
|
3708
3870
|
return;
|
|
3709
3871
|
}
|
|
3710
3872
|
for (const entry of entries) {
|
|
@@ -3807,13 +3969,13 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3807
3969
|
let projectRoot = process.cwd();
|
|
3808
3970
|
let sources;
|
|
3809
3971
|
const routeSourceFiles = () => {
|
|
3810
|
-
const clientRoutes = _optionalChain([farmApi, 'optionalAccess',
|
|
3811
|
-
if (_optionalChain([sources, 'optionalAccess',
|
|
3972
|
+
const clientRoutes = _optionalChain([farmApi, 'optionalAccess', _221 => _221.getProgrammaticClientRoutes, 'call', _222 => _222()]);
|
|
3973
|
+
if (_optionalChain([sources, 'optionalAccess', _223 => _223.for]) !== clientRoutes || !sources) {
|
|
3812
3974
|
sources = {
|
|
3813
3975
|
for: clientRoutes,
|
|
3814
3976
|
files: /* @__PURE__ */ new Set([
|
|
3815
3977
|
...routesFiles,
|
|
3816
|
-
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess',
|
|
3978
|
+
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess', _224 => _224.routeSourceFiles]), () => ( []))].map(resolvedFile)
|
|
3817
3979
|
])
|
|
3818
3980
|
};
|
|
3819
3981
|
}
|
|
@@ -3826,7 +3988,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3826
3988
|
configResolved(config) {
|
|
3827
3989
|
isBuild = config.command === "build";
|
|
3828
3990
|
projectRoot = config.root;
|
|
3829
|
-
farmApi = _optionalChain([config, 'access',
|
|
3991
|
+
farmApi = _optionalChain([config, 'access', _225 => _225.plugins, 'access', _226 => _226.find, 'call', _227 => _227((plugin) => plugin.name === "farm"), 'optionalAccess', _228 => _228.api]);
|
|
3830
3992
|
sources = void 0;
|
|
3831
3993
|
routesFiles = new Set(
|
|
3832
3994
|
_chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, { ...options, root: _nullishCoalesce(options.root, () => ( config.root)) }).flatMap(
|
|
@@ -3839,14 +4001,14 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3839
4001
|
transform(code, id, transformOptions) {
|
|
3840
4002
|
const environment = resolveBuildEnvironment(
|
|
3841
4003
|
this,
|
|
3842
|
-
_optionalChain([transformOptions, 'optionalAccess',
|
|
4004
|
+
_optionalChain([transformOptions, 'optionalAccess', _229 => _229.ssr])
|
|
3843
4005
|
);
|
|
3844
|
-
const
|
|
3845
|
-
const result = transformEnvironmentFunctions({ code, id, environment, parse:
|
|
4006
|
+
const parse3 = (source) => this.parse(source);
|
|
4007
|
+
const result = transformEnvironmentFunctions({ code, id, environment, parse: parse3 });
|
|
3846
4008
|
if (environment === "client" && !isBuild && !_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id) && routeSourceFiles().has(moduleFile(id)) && !isProgrammaticRouteActionProxy(code)) {
|
|
3847
4009
|
this.error(routeSourceError(moduleFile(id)));
|
|
3848
4010
|
}
|
|
3849
|
-
if (environment === "server" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access',
|
|
4011
|
+
if (environment === "server" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access', _230 => _230.experimental, 'optionalAccess', _231 => _231.serverComponents])) === "islands" && isApplicationScript(id)) {
|
|
3850
4012
|
const file = id.split("?", 1)[0];
|
|
3851
4013
|
const root = _fs.realpathSync.call(void 0, _nullishCoalesce(options.root, () => ( projectRoot)));
|
|
3852
4014
|
const clientCode = getFarmClientReachableModules(root, root).has(_path2.default.resolve(file)) || _fs.existsSync.call(void 0, file) && hasUseClientDirective(_fs.readFileSync.call(void 0, file, "utf8"));
|
|
@@ -3867,7 +4029,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3867
4029
|
for (const id of this.getModuleIds()) {
|
|
3868
4030
|
if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
|
|
3869
4031
|
const chain = findClientNodeBuiltinChain(id, (moduleId) => {
|
|
3870
|
-
return _optionalChain([this, 'access',
|
|
4032
|
+
return _optionalChain([this, 'access', _232 => _232.getModuleInfo, 'call', _233 => _233(moduleId), 'optionalAccess', _234 => _234.importedIds]);
|
|
3871
4033
|
});
|
|
3872
4034
|
if (chain) {
|
|
3873
4035
|
this.error(
|
|
@@ -3878,8 +4040,8 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3878
4040
|
}
|
|
3879
4041
|
if (!forbidden.has(moduleFile(id))) continue;
|
|
3880
4042
|
const info = this.getModuleInfo(id);
|
|
3881
|
-
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess',
|
|
3882
|
-
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess',
|
|
4043
|
+
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess', _235 => _235.code]))) continue;
|
|
4044
|
+
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess', _236 => _236.importers, 'access', _237 => _237.map, 'call', _238 => _238(moduleFile)])));
|
|
3883
4045
|
}
|
|
3884
4046
|
}
|
|
3885
4047
|
};
|
|
@@ -3893,13 +4055,13 @@ function moduleFile(id) {
|
|
|
3893
4055
|
function resolvedFile(filePath) {
|
|
3894
4056
|
try {
|
|
3895
4057
|
return moduleFile(_fs.realpathSync.call(void 0, filePath));
|
|
3896
|
-
} catch (
|
|
4058
|
+
} catch (e42) {
|
|
3897
4059
|
return moduleFile(filePath);
|
|
3898
4060
|
}
|
|
3899
4061
|
}
|
|
3900
4062
|
function resolveBuildEnvironment(context, ssr) {
|
|
3901
|
-
if (_optionalChain([context, 'access',
|
|
3902
|
-
if (_optionalChain([context, 'access',
|
|
4063
|
+
if (_optionalChain([context, 'access', _239 => _239.environment, 'optionalAccess', _240 => _240.name]) === "client") return "client";
|
|
4064
|
+
if (_optionalChain([context, 'access', _241 => _241.environment, 'optionalAccess', _242 => _242.name]) === "rsc" || _optionalChain([context, 'access', _243 => _243.environment, 'optionalAccess', _244 => _244.name]) === "ssr") {
|
|
3903
4065
|
return "server";
|
|
3904
4066
|
}
|
|
3905
4067
|
return ssr ? "server" : "client";
|
|
@@ -4209,4 +4371,8 @@ function transformError(id, message) {
|
|
|
4209
4371
|
|
|
4210
4372
|
|
|
4211
4373
|
|
|
4212
|
-
|
|
4374
|
+
|
|
4375
|
+
|
|
4376
|
+
|
|
4377
|
+
|
|
4378
|
+
exports.FARM_BROWSER_BUILTIN_PREFIX = FARM_BROWSER_BUILTIN_PREFIX; exports.resolveFarmBrowserBuiltin = resolveFarmBrowserBuiltin; exports.loadFarmBrowserBuiltin = loadFarmBrowserBuiltin; exports.farmBrowserBuiltinsOptimizerPlugin = farmBrowserBuiltinsOptimizerPlugin; exports.programmaticClientRouteKey = programmaticClientRouteKey; exports.resolveProgrammaticClientRoutes = resolveProgrammaticClientRoutes; exports.createEvaluatedRouteGraph = createEvaluatedRouteGraph; exports.mergeProgrammaticClientRoutes = mergeProgrammaticClientRoutes; exports.generateProgrammaticClientRouteModule = generateProgrammaticClientRouteModule; exports.FarmSourceSnapshotStore = FarmSourceSnapshotStore; exports.withFarmSourceSnapshot = withFarmSourceSnapshot; exports.traceFarmSourceReads = traceFarmSourceReads; exports.rewriteFarmReactServerClientModuleImports = rewriteFarmReactServerClientModuleImports; exports.rewriteFarmReactServerImports = rewriteFarmReactServerImports; exports.invalidateFarmClientOnlyScan = invalidateFarmClientOnlyScan; exports.farmRelativeImportFiles = farmRelativeImportFiles; exports.FARM_CLIENT_REFERENCE_PRAGMA = FARM_CLIENT_REFERENCE_PRAGMA; exports.FARM_CLIENT_REFERENCE_DIRECTORY = FARM_CLIENT_REFERENCE_DIRECTORY; exports.FARM_RESOLVE_FROM_PREFIX = FARM_RESOLVE_FROM_PREFIX; exports.parseFarmResolveFrom = parseFarmResolveFrom; exports.ensureFarmPackageClientReference = ensureFarmPackageClientReference; exports.ensureFarmInternalClientReference = ensureFarmInternalClientReference; exports.rewriteFarmPackageClientImports = rewriteFarmPackageClientImports; exports.farmIslandContainerReferencePath = farmIslandContainerReferencePath; exports.ensureFarmIslandContainerReference = ensureFarmIslandContainerReference; exports.wrapFarmIslandContainers = wrapFarmIslandContainers; exports.withPackageClientBoundaryCache = withPackageClientBoundaryCache; exports.usePackageClientBoundaryCacheFile = usePackageClientBoundaryCacheFile; exports.resolvePackageClientBoundaryCacheFile = resolvePackageClientBoundaryCacheFile; exports.runWithPackageClientBoundaryCacheFile = runWithPackageClientBoundaryCacheFile; exports.runWithLatestPackageClientBoundaryCache = runWithLatestPackageClientBoundaryCache; exports.dropLatestPackageClientBoundaryCache = dropLatestPackageClientBoundaryCache; exports.resolveModuleSourcePath = resolveModuleSourcePath; exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.hasUseClientDirective = hasUseClientDirective; exports.getIslandStrategyExport = getIslandStrategyExport; exports.stripUseClientDirective = stripUseClientDirective; exports.getFarmClientRenderingBindings = getFarmClientRenderingBindings; exports.collectFarmRenderedClientModules = collectFarmRenderedClientModules; exports.collectFarmServerStylesheets = collectFarmServerStylesheets; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.isFarmClientModulePlanUnchanged = isFarmClientModulePlanUnchanged; exports.resolveImportedModule = resolveImportedModule; exports.isFarmPackageClientBoundary = isFarmPackageClientBoundary; exports.collectFarmClientPackageImports = collectFarmClientPackageImports; exports.collectFarmServerBundledPackageInfo = collectFarmServerBundledPackageInfo; exports.invalidateFarmClientReachableModules = invalidateFarmClientReachableModules; exports.getFarmClientReachableModules = getFarmClientReachableModules; exports.resolveFarmClientOptimizeDeps = resolveFarmClientOptimizeDeps; exports.transformEnvironmentFunctions = transformEnvironmentFunctions; exports.farmEnvironmentFunctionsPlugin = farmEnvironmentFunctionsPlugin;
|