@farm.js/core 0.2.0-beta.1 → 0.2.0-beta.2
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-IUL6OPC3.cjs → agent-mcp-handler-EXOG55M4.cjs} +5 -5
- package/dist/{agent-mcp-handler-GDY5CPPW.mjs → agent-mcp-handler-VX4NDDHR.mjs} +4 -4
- package/dist/{agent-mcp.d-BdM0pIrD.d.ts → agent-mcp.d-DBaonhLg.d.ts} +1 -1
- package/dist/{agent-mcp.d-CMGqpUbk.d.mts → agent-mcp.d-DhCEzIfu.d.mts} +1 -1
- package/dist/agent-runtime.cjs +2 -2
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +1 -1
- package/dist/analyzer-OWIHFO5M.cjs +17 -0
- package/dist/{analyzer-RYSF2BM3.mjs → analyzer-T2U345WL.mjs} +2 -2
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- 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.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/{app-manifest.d-COhjPgHn.d.ts → app-manifest.d-nLVFFd7N.d.ts} +1 -1
- package/dist/{app-manifest.d-BeDB2OVm.d.mts → app-manifest.d-uE0JGZKN.d.mts} +1 -1
- package/dist/app-markdown.cjs +6 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +7 -5
- package/dist/{app.d-CoY-zsJt.d.ts → app.d-CwVkAUEU.d.ts} +13 -7
- package/dist/{app.d-DE5KNbmf.d.mts → app.d-DGGcNXV7.d.mts} +13 -7
- package/dist/{chunk-AG27TI6Q.mjs → chunk-23NBOP43.mjs} +3 -0
- package/dist/{chunk-OOOUYA6L.mjs → chunk-26ZTI2ZO.mjs} +4 -4
- package/dist/{chunk-CPMK7EFR.mjs → chunk-4Q263EQI.mjs} +2 -2
- package/dist/{chunk-2NOHVIJ3.cjs → chunk-5LJF4KUZ.cjs} +17 -4
- package/dist/{chunk-5AL2GXAU.mjs → chunk-7MMDEIVC.mjs} +1 -1
- package/dist/{chunk-QBXS4TNG.mjs → chunk-BL54BTVJ.mjs} +1 -1
- package/dist/{chunk-VZWAXQME.mjs → chunk-BW563VZZ.mjs} +34 -2
- package/dist/{chunk-ZPQY7O64.cjs → chunk-CBB7I6HW.cjs} +3 -3
- package/dist/{chunk-KMGHXIDA.cjs → chunk-CHOOBTDD.cjs} +2 -2
- package/dist/{chunk-ISSFWEPY.mjs → chunk-COK4IXOO.mjs} +35 -18
- package/dist/{chunk-YU2MNIIY.mjs → chunk-CRF5MOLO.mjs} +17 -4
- package/dist/{chunk-NQ3Y6E2T.mjs → chunk-CV4MOEMO.mjs} +2 -2
- package/dist/{chunk-OLKYHTLN.cjs → chunk-DA432P2F.cjs} +5 -5
- package/dist/{chunk-B3HQTGXS.cjs → chunk-DVAZ53X6.cjs} +6 -1
- package/dist/{chunk-XRSNW4IU.mjs → chunk-E72GG355.mjs} +5 -0
- package/dist/{chunk-FJGA3XWL.cjs → chunk-EA5HVG45.cjs} +2 -2
- package/dist/{chunk-NG2EZ6QS.cjs → chunk-EODGIFI7.cjs} +4 -2
- package/dist/{chunk-Y3DO7BIJ.cjs → chunk-EUZFBHPP.cjs} +3 -0
- package/dist/{chunk-KRU3XPOW.cjs → chunk-EXPVSFAG.cjs} +14 -11
- package/dist/{chunk-EACD6ND7.cjs → chunk-EZUTDTFM.cjs} +7 -7
- package/dist/{chunk-KCJBIWBM.mjs → chunk-GVORDLLV.mjs} +1 -1
- package/dist/{chunk-XGL42MQ7.mjs → chunk-HIDZM23B.mjs} +1 -1
- package/dist/{chunk-23BZ7ZH6.mjs → chunk-HNB5JHBO.mjs} +5 -2
- package/dist/{chunk-DZC2XGK4.mjs → chunk-HVGINJTO.mjs} +81 -28
- package/dist/{chunk-EBKYRP2P.mjs → chunk-I5KPOXUE.mjs} +1 -1
- package/dist/{chunk-HR5GU4UU.cjs → chunk-ILQSRLKK.cjs} +4 -4
- package/dist/{chunk-L4B7PB3H.cjs → chunk-J2EKGR6E.cjs} +1025 -480
- package/dist/{chunk-26WP75W5.cjs → chunk-JDT733EW.cjs} +41 -27
- package/dist/{chunk-W53Z4WDI.cjs → chunk-JH4CDG4G.cjs} +8 -8
- package/dist/{chunk-KQ6TYQU7.cjs → chunk-KDQKTX3Q.cjs} +4 -4
- package/dist/{chunk-PEQJ4UUT.mjs → chunk-LP6DIYGA.mjs} +2 -2
- package/dist/{chunk-Z7ZRBCAB.mjs → chunk-LQ3FISSD.mjs} +58 -37
- package/dist/{chunk-KBIM7PFQ.cjs → chunk-M4YXD6MD.cjs} +272 -219
- package/dist/{chunk-6ETHVRFO.cjs → chunk-MWAWMFG3.cjs} +407 -386
- package/dist/{chunk-ECVSRE4Y.mjs → chunk-N2BRIN7I.mjs} +1 -1
- package/dist/{chunk-MO4UTDQ6.mjs → chunk-NNNMFSXG.mjs} +1 -1
- package/dist/{chunk-V3Y3R3JJ.cjs → chunk-NOSLIDSG.cjs} +1 -1
- package/dist/{chunk-ICOJ2BC6.mjs → chunk-NWF2FTFV.mjs} +24 -10
- package/dist/{chunk-M3JYBZO2.cjs → chunk-OLIWLN4I.cjs} +2 -2
- package/dist/{chunk-YPAOC3FO.mjs → chunk-P2TGLGRR.mjs} +4 -4
- package/dist/{chunk-THGSPDFD.cjs → chunk-PAKB6JHX.cjs} +7 -7
- package/dist/{chunk-NVXU5BEG.mjs → chunk-Q637AXGZ.mjs} +172 -47
- package/dist/{chunk-ZZGQD3LL.mjs → chunk-QO24II6C.mjs} +4 -2
- package/dist/{chunk-HENPVGZC.cjs → chunk-RBSGFS5X.cjs} +66 -34
- package/dist/{chunk-IJPRCQHW.cjs → chunk-RGMUS3HO.cjs} +10 -10
- package/dist/{chunk-OIPPISQ6.cjs → chunk-RTAWQXME.cjs} +273 -148
- package/dist/{chunk-DMSXZNQR.cjs → chunk-RZI6436F.cjs} +2 -2
- package/dist/{chunk-HZY63K5C.mjs → chunk-S6MGFULY.mjs} +2 -2
- package/dist/{chunk-5GFTMTX3.cjs → chunk-SAUGKNCF.cjs} +2 -2
- package/dist/{chunk-6BMAGVDI.cjs → chunk-SCE7VWPN.cjs} +12 -12
- package/dist/{chunk-PKV3JGMS.mjs → chunk-SSFAPTRD.mjs} +1 -1
- package/dist/{chunk-ND65INFS.cjs → chunk-SWPLGPYF.cjs} +7 -7
- package/dist/{chunk-WP77JDKI.cjs → chunk-UCJCU2IL.cjs} +14 -14
- package/dist/{chunk-WX752VMN.mjs → chunk-UCRNNDNS.mjs} +1 -1
- package/dist/{chunk-27ESPHQA.cjs → chunk-UGWKNZ4U.cjs} +44 -27
- package/dist/{chunk-FLKG2PYH.cjs → chunk-UOMSGJHK.cjs} +11 -11
- package/dist/{chunk-2U2GRXP5.mjs → chunk-UWDFH3ZV.mjs} +1 -1
- package/dist/{chunk-AMMFRXFW.mjs → chunk-V5FEFFHV.mjs} +1 -1
- package/dist/{chunk-HR4N2K4V.mjs → chunk-WABOJXAA.mjs} +2 -2
- package/dist/{chunk-LTXKRIST.mjs → chunk-WANLI3ZC.mjs} +2 -2
- package/dist/{chunk-HQEYZSF3.cjs → chunk-WPURVYXT.cjs} +2 -2
- package/dist/{chunk-TE7AX6HB.mjs → chunk-WV63R4GE.mjs} +1 -1
- package/dist/{chunk-CIQCJ72N.mjs → chunk-XOLYZZDX.mjs} +693 -148
- package/dist/{chunk-4ZVKDHS6.cjs → chunk-YSRZSKQB.cjs} +4 -4
- package/dist/{cli-runtime.d-jqZ7YCsm.d.ts → cli-runtime.d-Dbl-gIoz.d.ts} +5 -5
- package/dist/{cli-runtime.d-qL44rqYO.d.mts → cli-runtime.d-oUiNuspW.d.mts} +5 -5
- package/dist/{client-component.d-BDD5aiUb.d.ts → client-component.d-CT4q7tmy.d.ts} +1 -1
- package/dist/{client-component.d-B2L2LyAr.d.mts → client-component.d-DaUqOhZT.d.mts} +1 -1
- package/dist/{client-plugins.d-Crct3m_r.d.ts → client-plugins.d-24qhjX8c.d.ts} +30 -4
- package/dist/{client-plugins.d-Dzc3vOw_.d.mts → client-plugins.d-BfGTqbAH.d.mts} +30 -4
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +4 -4
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-JTJA2KIZ.cjs → devtools-5WDQQDTA.cjs} +6 -6
- package/dist/{devtools-5DBTT2DI.mjs → devtools-DPYIYHTI.mjs} +5 -5
- 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/{handler.d-B1S1ZBqS.d.mts → handler.d-GfNuz57p.d.mts} +1 -1
- package/dist/{handler.d-ZweCBJD4.d.ts → handler.d-Oca5kNSz.d.ts} +1 -1
- package/dist/{headers.d-C-yGl_f6.d.mts → headers.d-C_lsQIWA.d.mts} +1 -1
- package/dist/{headers.d-BgBdQN8x.d.ts → headers.d-b8gHJDvu.d.ts} +1 -1
- package/dist/index.cjs +33 -29
- package/dist/{index.d-13h3oDu7.d.mts → index.d-BLtjh1aS.d.mts} +1 -1
- package/dist/{index.d-CtoniAXT.d.ts → index.d-Ckv6kHFm.d.ts} +1 -1
- package/dist/index.d.mts +23 -23
- package/dist/index.d.ts +23 -23
- package/dist/index.mjs +34 -30
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.cjs +4 -2
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +3 -1
- package/dist/internal/app-markdown-runtime.cjs +5 -3
- package/dist/internal/app-markdown-runtime.d.mts +10 -5
- package/dist/internal/app-markdown-runtime.d.ts +10 -5
- package/dist/internal/app-markdown-runtime.mjs +6 -4
- package/dist/internal/build-runtime.cjs +26 -26
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +25 -25
- package/dist/internal/cli-runtime.cjs +10 -10
- package/dist/internal/cli-runtime.d.mts +7 -7
- package/dist/internal/cli-runtime.d.ts +7 -7
- package/dist/internal/cli-runtime.mjs +9 -9
- 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 +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +7 -7
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +6 -6
- package/dist/internal/infra-analytics-runtime.cjs +9 -9
- package/dist/internal/infra-analytics-runtime.mjs +7 -7
- package/dist/internal/metadata-image-runtime.d.mts +2 -2
- package/dist/internal/metadata-image-runtime.d.ts +2 -2
- 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-node-env.cjs +2 -2
- package/dist/internal/production-node-env.mjs +1 -1
- package/dist/internal/production-runtime.cjs +12 -12
- package/dist/internal/production-runtime.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +11 -11
- package/dist/internal/spa-router.cjs +3 -3
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/spa-router.mjs +2 -2
- package/dist/internal/start-manifest.d.mts +1 -1
- package/dist/internal/start-manifest.d.ts +1 -1
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/{mount.d-_6Un9wdK.d.mts → mount.d-BCS8mD4E.d.mts} +1 -1
- package/dist/{mount.d-DyKlRR6z.d.ts → mount.d-DEX8eref.d.ts} +1 -1
- package/dist/{native-tree-5TENEQ7Y.cjs → native-tree-52CUAP3N.cjs} +3 -3
- package/dist/{native-tree-LNO7K6JR.mjs → native-tree-AO7PQ7FR.mjs} +2 -2
- package/dist/{navigation-delegate.d-BbW1_pf_.d.ts → navigation-delegate.d-Cgi28e5Q.d.ts} +1 -1
- package/dist/{navigation-delegate.d-B9GjWbov.d.mts → navigation-delegate.d-F83ugsZW.d.mts} +1 -1
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +4 -4
- package/dist/plugin.cjs +19 -19
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +18 -18
- package/dist/query/client.cjs +7 -7
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan.d-DaM1NPnm.d.mts → render-plan.d-BkVY4aFb.d.mts} +1 -1
- package/dist/{render-plan.d-D0FV9lDT.d.ts → render-plan.d-DCF2GZdD.d.ts} +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +22 -11
- package/dist/renderer.d.ts +22 -11
- package/dist/{request.d-CrXC7voZ.d.ts → request.d-C5o-4dU2.d.ts} +1 -1
- package/dist/{request.d-DVSLilGx.d.mts → request.d-DMPB53-i.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-CWi3UYtR.d.mts → route-rendering.d-DDvArvik.d.mts} +1 -1
- package/dist/{route-rendering.d-OfbM_rj8.d.ts → route-rendering.d-DfP6zRP7.d.ts} +1 -1
- package/dist/{router.d-YKVirmj4.d.mts → router.d-1Skf2XCO.d.mts} +1 -1
- package/dist/{router.d-Bm9FNSu3.d.ts → router.d-s40h7aoS.d.ts} +1 -1
- package/dist/routes.d.mts +3 -3
- package/dist/routes.d.ts +3 -3
- package/dist/{rsc-pipeline-W5DSWDHD.mjs → rsc-pipeline-O2YMVHUF.mjs} +7 -7
- package/dist/{rsc-pipeline-LGXJGGMW.cjs → rsc-pipeline-SFQSMVI7.cjs} +8 -8
- package/dist/{runtime-UOZKSM5S.mjs → runtime-K2X3IZAF.mjs} +6 -6
- package/dist/{runtime-YV4X5FAK.cjs → runtime-WOTVFYQY.cjs} +8 -8
- package/dist/{runtime.d-BVj6apd0.d.mts → runtime.d-Bykc5Qfg.d.mts} +1 -1
- package/dist/{runtime.d-D7QYVJGO.d.ts → runtime.d-k-9kFUsM.d.ts} +1 -1
- package/dist/{server-components-status.d-BDVcxi0z.d.mts → server-components-status.d-D-HixBe0.d.mts} +1 -1
- package/dist/{server-components-status.d-CfKDpmCH.d.ts → server-components-status.d-DLNd1C5j.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +41 -41
- package/dist/server.d.mts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +20 -20
- package/dist/{spa-router.d-DGmropfK.d.mts → spa-router.d-DIlXwm00.d.mts} +2 -2
- package/dist/{spa-router.d-nE1jHNGt.d.ts → spa-router.d-Dl-EJeJT.d.ts} +2 -2
- package/dist/{ssg.d-DS-gXUbf.d.mts → ssg.d-D2ZV0bhs.d.mts} +2 -2
- package/dist/{ssg.d-jXlUAKzg.d.ts → ssg.d-bE-ylg0e.d.ts} +2 -2
- package/dist/{store-core.d-B5cwOd8g.d.ts → store-core.d-BmdnMopD.d.ts} +2 -2
- package/dist/{store-core.d-C-gATBwd.d.mts → store-core.d-DPsCYzV7.d.mts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils.d-BODwBtkz.d.ts → utils.d-BFZQcBZV.d.ts} +1 -1
- package/dist/{utils.d-Cmj-fzds.d.mts → utils.d-nM3OHKq5.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +19 -19
- package/dist/vite.d.mts +6 -6
- package/dist/vite.d.ts +6 -6
- package/dist/vite.mjs +18 -18
- package/package.json +1 -1
- package/dist/analyzer-IIWSUXSQ.cjs +0 -17
|
@@ -28,7 +28,7 @@ var _chunkYUCU6XB4cjs = require('./chunk-YUCU6XB4.cjs');
|
|
|
28
28
|
var _chunk7U4XF76Rcjs = require('./chunk-7U4XF76R.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkNOSLIDSGcjs = require('./chunk-NOSLIDSG.cjs');
|
|
32
32
|
|
|
33
33
|
// src/environment-vite.ts
|
|
34
34
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -158,9 +158,16 @@ var snapshot;
|
|
|
158
158
|
var base;
|
|
159
159
|
var volatile;
|
|
160
160
|
var trace;
|
|
161
|
+
var traceGroups;
|
|
161
162
|
function farmSourceSnapshotPathKey(file, paths = _path2.default) {
|
|
163
|
+
if (paths === _path2.default && _path2.default.sep === "/" && isNormalizedPosixPath(file)) return file;
|
|
162
164
|
return paths.resolve(file);
|
|
163
165
|
}
|
|
166
|
+
function isNormalizedPosixPath(file) {
|
|
167
|
+
if (file.charCodeAt(0) !== 47) return false;
|
|
168
|
+
if (file.length === 1) return true;
|
|
169
|
+
return !file.endsWith("/") && !file.endsWith("/.") && !file.endsWith("/..") && !file.includes("//") && !file.includes("/./") && !file.includes("/../");
|
|
170
|
+
}
|
|
164
171
|
function getFarmSourceStamp(file) {
|
|
165
172
|
try {
|
|
166
173
|
const stat = _fs2.default.statSync(file);
|
|
@@ -268,15 +275,34 @@ function memoizeInFarmSourceSnapshot(scope, key, compute, lasting) {
|
|
|
268
275
|
function noteFarmSourceRead(file) {
|
|
269
276
|
_optionalChain([trace, 'optionalAccess', _20 => _20.add, 'call', _21 => _21(file)]);
|
|
270
277
|
}
|
|
278
|
+
function noteFarmSourceReads(files) {
|
|
279
|
+
if (traceGroups) traceGroups.add(files);
|
|
280
|
+
else if (trace) for (const file of files) trace.add(file);
|
|
281
|
+
}
|
|
271
282
|
function traceFarmSourceReads(operation) {
|
|
283
|
+
const { result, files } = traceReads(operation, false);
|
|
284
|
+
return { result, files: [...files] };
|
|
285
|
+
}
|
|
286
|
+
function traceFarmSourceReadGroups(operation) {
|
|
287
|
+
const { result, files, groups } = traceReads(operation, true);
|
|
288
|
+
return { result, files: [...files], groups: [...groups] };
|
|
289
|
+
}
|
|
290
|
+
function traceReads(operation, grouped) {
|
|
272
291
|
const outer = trace;
|
|
292
|
+
const outerGroups = traceGroups;
|
|
273
293
|
const files = /* @__PURE__ */ new Set();
|
|
294
|
+
const groups = grouped ? /* @__PURE__ */ new Set() : void 0;
|
|
274
295
|
trace = files;
|
|
296
|
+
traceGroups = groups;
|
|
275
297
|
try {
|
|
276
|
-
return { result: operation(), files
|
|
298
|
+
return { result: operation(), files, groups };
|
|
277
299
|
} finally {
|
|
278
300
|
trace = outer;
|
|
279
|
-
|
|
301
|
+
traceGroups = outerGroups;
|
|
302
|
+
if (outer) {
|
|
303
|
+
for (const file of files) outer.add(file);
|
|
304
|
+
if (groups) for (const group of groups) noteFarmSourceReads(group);
|
|
305
|
+
}
|
|
280
306
|
}
|
|
281
307
|
}
|
|
282
308
|
|
|
@@ -304,11 +330,19 @@ function packageNameOf(specifier) {
|
|
|
304
330
|
return { name, subpath: parts.slice(name.startsWith("@") ? 2 : 1).join("/") };
|
|
305
331
|
}
|
|
306
332
|
function findPackageDirectory(importer, name) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
333
|
+
const start = _path2.default.dirname(importer);
|
|
334
|
+
return memoizeInFarmSourceSnapshot(
|
|
335
|
+
"package-directory",
|
|
336
|
+
`${farmSourceSnapshotPathKey(start)}\0${name}`,
|
|
337
|
+
() => {
|
|
338
|
+
for (let current = start; ; current = _path2.default.dirname(current)) {
|
|
339
|
+
const directory = _path2.default.join(current, "node_modules", name);
|
|
340
|
+
if (_fs2.default.existsSync(_path2.default.join(directory, "package.json"))) return _fs2.default.realpathSync(directory);
|
|
341
|
+
if (_path2.default.dirname(current) === current) return null;
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
(directory) => directory !== null
|
|
345
|
+
);
|
|
312
346
|
}
|
|
313
347
|
function pickTarget(value, conditions) {
|
|
314
348
|
if (typeof value === "string") return value;
|
|
@@ -505,7 +539,11 @@ function traceExport(file, name, depth) {
|
|
|
505
539
|
return void 0;
|
|
506
540
|
}
|
|
507
541
|
function traceFarmExport(file, name) {
|
|
508
|
-
return
|
|
542
|
+
return memoizeInFarmSourceSnapshot(
|
|
543
|
+
"export-kind",
|
|
544
|
+
`${farmSourceSnapshotPathKey(file)}\0${name}`,
|
|
545
|
+
() => _optionalChain([traceExport, 'call', _34 => _34(file, name, 0), 'optionalAccess', _35 => _35.kind])
|
|
546
|
+
);
|
|
509
547
|
}
|
|
510
548
|
function isFarmClientExport(file, name) {
|
|
511
549
|
return traceFarmExport(file, name) === "client";
|
|
@@ -785,9 +823,21 @@ function readModuleImports(file) {
|
|
|
785
823
|
return imports;
|
|
786
824
|
}
|
|
787
825
|
var clientOnlyFreeFiles = /* @__PURE__ */ new Set();
|
|
788
|
-
function invalidateFarmClientOnlyScan() {
|
|
826
|
+
function invalidateFarmClientOnlyScan(file, event) {
|
|
827
|
+
if (file && event === "update" && _path2.default.basename(file) !== "package.json" && !isClientOnlyScanned(file)) {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
789
830
|
clientOnlyFreeFiles.clear();
|
|
790
831
|
}
|
|
832
|
+
function isClientOnlyScanned(file) {
|
|
833
|
+
const resolved = _path2.default.resolve(file);
|
|
834
|
+
if (clientOnlyFreeFiles.has(resolved)) return true;
|
|
835
|
+
try {
|
|
836
|
+
return clientOnlyFreeFiles.has(_fs2.default.realpathSync(resolved));
|
|
837
|
+
} catch (e11) {
|
|
838
|
+
return true;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
791
841
|
function resolveServerEntry(importer, specifier) {
|
|
792
842
|
const parsed = packageNameOf(specifier);
|
|
793
843
|
if (!parsed || REACT_PACKAGES.has(parsed.name) || parsed.name.startsWith("@farm.js/")) {
|
|
@@ -873,7 +923,7 @@ function stampScannedPath(directory, target) {
|
|
|
873
923
|
const stat = _fs2.default.statSync(target, { throwIfNoEntry: false });
|
|
874
924
|
if (!stat) return void 0;
|
|
875
925
|
return [_path2.default.relative(directory, target), stat.size, stat.mtimeMs, stat.ctimeMs];
|
|
876
|
-
} catch (
|
|
926
|
+
} catch (e12) {
|
|
877
927
|
return void 0;
|
|
878
928
|
}
|
|
879
929
|
}
|
|
@@ -886,12 +936,12 @@ function usePackageScanCacheFile(file) {
|
|
|
886
936
|
const stored = /* @__PURE__ */ new Map();
|
|
887
937
|
try {
|
|
888
938
|
const value = JSON.parse(_fs2.default.readFileSync(file, "utf8"));
|
|
889
|
-
if (_optionalChain([value, 'optionalAccess', _68 => _68.schema]) === PACKAGE_SCAN_CACHE_SCHEMA && value.farm ===
|
|
939
|
+
if (_optionalChain([value, 'optionalAccess', _68 => _68.schema]) === PACKAGE_SCAN_CACHE_SCHEMA && value.farm === _chunkNOSLIDSGcjs.FARM_VERSION && value.scans && typeof value.scans === "object") {
|
|
890
940
|
for (const [directory, scan] of Object.entries(value.scans)) {
|
|
891
941
|
if (isStoredPackageScan(scan)) stored.set(directory, scan);
|
|
892
942
|
}
|
|
893
943
|
}
|
|
894
|
-
} catch (
|
|
944
|
+
} catch (e13) {
|
|
895
945
|
}
|
|
896
946
|
packageScanCache = { file, stored, dirty: false };
|
|
897
947
|
}
|
|
@@ -915,14 +965,14 @@ function persistPackageScanCache() {
|
|
|
915
965
|
_fs2.default.mkdirSync(_path2.default.dirname(cache2.file), { recursive: true });
|
|
916
966
|
_fs2.default.writeFileSync(
|
|
917
967
|
temporary,
|
|
918
|
-
JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm:
|
|
968
|
+
JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm: _chunkNOSLIDSGcjs.FARM_VERSION, scans })
|
|
919
969
|
);
|
|
920
970
|
_fs2.default.renameSync(temporary, cache2.file);
|
|
921
971
|
cache2.dirty = false;
|
|
922
|
-
} catch (
|
|
972
|
+
} catch (e14) {
|
|
923
973
|
try {
|
|
924
974
|
_fs2.default.rmSync(temporary, { force: true });
|
|
925
|
-
} catch (
|
|
975
|
+
} catch (e15) {
|
|
926
976
|
}
|
|
927
977
|
}
|
|
928
978
|
}
|
|
@@ -946,7 +996,7 @@ function scanPackage(directory) {
|
|
|
946
996
|
stamps.push(stampScannedPath(directory, current));
|
|
947
997
|
try {
|
|
948
998
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
949
|
-
} catch (
|
|
999
|
+
} catch (e16) {
|
|
950
1000
|
continue;
|
|
951
1001
|
}
|
|
952
1002
|
for (const entry of entries) {
|
|
@@ -958,7 +1008,7 @@ function scanPackage(directory) {
|
|
|
958
1008
|
stamps.push(stampScannedPath(directory, file));
|
|
959
1009
|
try {
|
|
960
1010
|
code = _fs2.default.readFileSync(file, "utf8");
|
|
961
|
-
} catch (
|
|
1011
|
+
} catch (e17) {
|
|
962
1012
|
continue;
|
|
963
1013
|
}
|
|
964
1014
|
for (const match of code.matchAll(IMPORT_SPECIFIER)) scan.imports.add(match[1]);
|
|
@@ -985,7 +1035,7 @@ function findFarmServerBundledPackage(importer, specifier) {
|
|
|
985
1035
|
if (manifest.exports === void 0 && manifest.type !== "module" && typeof manifest.module === "string" && typeof manifest.main === "string" && _path2.default.resolve(directory, manifest.main) !== _path2.default.resolve(directory, manifest.module)) {
|
|
986
1036
|
return { name: parsed.name, prebundle: isSelfContainedPackage(manifest, importer) };
|
|
987
1037
|
}
|
|
988
|
-
} catch (
|
|
1038
|
+
} catch (e18) {
|
|
989
1039
|
return null;
|
|
990
1040
|
}
|
|
991
1041
|
const scan = scanPackage(directory);
|
|
@@ -1008,7 +1058,7 @@ function findFarmPackageManifest(importer, specifier) {
|
|
|
1008
1058
|
try {
|
|
1009
1059
|
const manifest = JSON.parse(_fs2.default.readFileSync(_path2.default.join(directory, "package.json"), "utf8"));
|
|
1010
1060
|
names = new Set(Object.keys(_nullishCoalesce(manifest.dependencies, () => ( {}))));
|
|
1011
|
-
} catch (
|
|
1061
|
+
} catch (e19) {
|
|
1012
1062
|
return null;
|
|
1013
1063
|
}
|
|
1014
1064
|
const dependencies = [...scanPackage(directory).imports].filter((imported) => {
|
|
@@ -1454,7 +1504,7 @@ function holdsRouteDefinition(value, definitions) {
|
|
|
1454
1504
|
if (descriptor && "value" in descriptor) next(descriptor.value);
|
|
1455
1505
|
}
|
|
1456
1506
|
}
|
|
1457
|
-
} catch (
|
|
1507
|
+
} catch (e20) {
|
|
1458
1508
|
}
|
|
1459
1509
|
}
|
|
1460
1510
|
return false;
|
|
@@ -1547,7 +1597,7 @@ function readJsonString(text) {
|
|
|
1547
1597
|
try {
|
|
1548
1598
|
const value = JSON.parse(text);
|
|
1549
1599
|
return typeof value === "string" ? value : void 0;
|
|
1550
|
-
} catch (
|
|
1600
|
+
} catch (e21) {
|
|
1551
1601
|
return void 0;
|
|
1552
1602
|
}
|
|
1553
1603
|
}
|
|
@@ -1555,7 +1605,7 @@ function readJsonArray(text) {
|
|
|
1555
1605
|
try {
|
|
1556
1606
|
const value = JSON.parse(text);
|
|
1557
1607
|
return Array.isArray(value) ? value : void 0;
|
|
1558
|
-
} catch (
|
|
1608
|
+
} catch (e22) {
|
|
1559
1609
|
return void 0;
|
|
1560
1610
|
}
|
|
1561
1611
|
}
|
|
@@ -1565,13 +1615,13 @@ function readExports(namespace) {
|
|
|
1565
1615
|
let keys;
|
|
1566
1616
|
try {
|
|
1567
1617
|
keys = Object.keys(namespace);
|
|
1568
|
-
} catch (
|
|
1618
|
+
} catch (e23) {
|
|
1569
1619
|
return [];
|
|
1570
1620
|
}
|
|
1571
1621
|
for (const key of keys) {
|
|
1572
1622
|
try {
|
|
1573
1623
|
entries.push([key, namespace[key]]);
|
|
1574
|
-
} catch (
|
|
1624
|
+
} catch (e24) {
|
|
1575
1625
|
}
|
|
1576
1626
|
}
|
|
1577
1627
|
return entries;
|
|
@@ -1604,7 +1654,7 @@ function toModuleFile(file) {
|
|
|
1604
1654
|
if (file.startsWith("file://")) {
|
|
1605
1655
|
try {
|
|
1606
1656
|
return toPosixPath(_url.fileURLToPath.call(void 0, file));
|
|
1607
|
-
} catch (
|
|
1657
|
+
} catch (e25) {
|
|
1608
1658
|
return toPosixPath(file);
|
|
1609
1659
|
}
|
|
1610
1660
|
}
|
|
@@ -1634,7 +1684,7 @@ function parse(code, file) {
|
|
|
1634
1684
|
function parseAs(code, lang) {
|
|
1635
1685
|
try {
|
|
1636
1686
|
return _parseAst.parseAst.call(void 0, code, { lang });
|
|
1637
|
-
} catch (
|
|
1687
|
+
} catch (e26) {
|
|
1638
1688
|
return null;
|
|
1639
1689
|
}
|
|
1640
1690
|
}
|
|
@@ -1778,7 +1828,7 @@ function packageLookup(directory, packageName) {
|
|
|
1778
1828
|
const candidate = _path2.default.join(current, "node_modules", packageName);
|
|
1779
1829
|
try {
|
|
1780
1830
|
return { from: current, real: _fs2.default.realpathSync(candidate) };
|
|
1781
|
-
} catch (
|
|
1831
|
+
} catch (e27) {
|
|
1782
1832
|
}
|
|
1783
1833
|
}
|
|
1784
1834
|
if (_path2.default.dirname(current) === current) return null;
|
|
@@ -1795,7 +1845,7 @@ function referenceResolveFrom(root, specifier, importer) {
|
|
|
1795
1845
|
if (_optionalChain([app, 'optionalAccess', _101 => _101.real]) === own.real) return null;
|
|
1796
1846
|
try {
|
|
1797
1847
|
return _fs2.default.realpathSync(own.from);
|
|
1798
|
-
} catch (
|
|
1848
|
+
} catch (e28) {
|
|
1799
1849
|
return own.from;
|
|
1800
1850
|
}
|
|
1801
1851
|
}
|
|
@@ -1818,15 +1868,12 @@ function ensureFarmPackageClientReference(root, specifier, exportName, importer)
|
|
|
1818
1868
|
`export { __farm_reference__ as ${exportName} };`,
|
|
1819
1869
|
""
|
|
1820
1870
|
].join("\n");
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
1828
|
-
_fs2.default.writeFileSync(file, source);
|
|
1829
|
-
}
|
|
1871
|
+
memoizeInFarmSourceSnapshot(
|
|
1872
|
+
"client-reference-file",
|
|
1873
|
+
`${file}\0${source}`,
|
|
1874
|
+
() => writeIfChanged(file, source),
|
|
1875
|
+
() => false
|
|
1876
|
+
);
|
|
1830
1877
|
return file;
|
|
1831
1878
|
}
|
|
1832
1879
|
function writeIfChanged(file, source) {
|
|
@@ -2154,7 +2201,8 @@ var PackageClientBoundaryCache = class {
|
|
|
2154
2201
|
else this.dirty = true;
|
|
2155
2202
|
}
|
|
2156
2203
|
}
|
|
2157
|
-
return _optionalChain([entries, 'optionalAccess', _114 => _114.find, 'call', _115 => _115(
|
|
2204
|
+
if (visited.size === 0) return _optionalChain([entries, 'optionalAccess', _114 => _114.find, 'call', _115 => _115((entry) => entry.stops.length === 0)]);
|
|
2205
|
+
return _optionalChain([entries, 'optionalAccess', _116 => _116.find, 'call', _117 => _117(
|
|
2158
2206
|
(entry) => entry.stops.every((file) => visited.has(file)) && !entry.files.some((file) => visited.has(file))
|
|
2159
2207
|
)]);
|
|
2160
2208
|
}
|
|
@@ -2225,7 +2273,7 @@ var PackageClientBoundaryCache = class {
|
|
|
2225
2273
|
}
|
|
2226
2274
|
const contents = JSON.stringify({
|
|
2227
2275
|
schema: SCHEMA_VERSION,
|
|
2228
|
-
farm:
|
|
2276
|
+
farm: _chunkNOSLIDSGcjs.FARM_VERSION,
|
|
2229
2277
|
paths,
|
|
2230
2278
|
entries
|
|
2231
2279
|
});
|
|
@@ -2265,7 +2313,7 @@ function readStoredCache(file) {
|
|
|
2265
2313
|
} catch (e37) {
|
|
2266
2314
|
return null;
|
|
2267
2315
|
}
|
|
2268
|
-
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !==
|
|
2316
|
+
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkNOSLIDSGcjs.FARM_VERSION) {
|
|
2269
2317
|
return null;
|
|
2270
2318
|
}
|
|
2271
2319
|
const { paths, entries } = value;
|
|
@@ -2276,7 +2324,7 @@ function readStoredCache(file) {
|
|
|
2276
2324
|
const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
|
|
2277
2325
|
if (usable.length > 0) valid[key] = usable;
|
|
2278
2326
|
}
|
|
2279
|
-
return { schema: SCHEMA_VERSION, farm:
|
|
2327
|
+
return { schema: SCHEMA_VERSION, farm: _chunkNOSLIDSGcjs.FARM_VERSION, paths, entries: valid };
|
|
2280
2328
|
}
|
|
2281
2329
|
function isRecord(value) {
|
|
2282
2330
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -2314,8 +2362,13 @@ async function withPackageClientBoundaryCache(operation) {
|
|
|
2314
2362
|
await cache2.persist();
|
|
2315
2363
|
}
|
|
2316
2364
|
}
|
|
2365
|
+
function bindPackageClientBoundaryCache() {
|
|
2366
|
+
const cache2 = getPackageClientBoundaryCache();
|
|
2367
|
+
if (!cache2) return (operation) => operation();
|
|
2368
|
+
return (operation) => getPackageClientBoundaryCache() ? operation() : getStorage().run(cache2, operation);
|
|
2369
|
+
}
|
|
2317
2370
|
function usePackageClientBoundaryCacheFile(file) {
|
|
2318
|
-
_optionalChain([getPackageClientBoundaryCache, 'call',
|
|
2371
|
+
_optionalChain([getPackageClientBoundaryCache, 'call', _118 => _118(), 'optionalAccess', _119 => _119.load, 'call', _120 => _120(file)]);
|
|
2319
2372
|
}
|
|
2320
2373
|
function resolvePackageClientBoundaryCacheFile(root, distDir) {
|
|
2321
2374
|
return _path2.default.resolve(root, distDir, "cache", "client-boundaries.json");
|
|
@@ -2332,7 +2385,7 @@ function runWithPackageClientBoundaryCacheFile(file, operation) {
|
|
|
2332
2385
|
var latestDevCache;
|
|
2333
2386
|
function runWithLatestPackageClientBoundaryCache(file, operation) {
|
|
2334
2387
|
if (getPackageClientBoundaryCache()) return operation();
|
|
2335
|
-
if (_optionalChain([latestDevCache, 'optionalAccess',
|
|
2388
|
+
if (_optionalChain([latestDevCache, 'optionalAccess', _121 => _121.file]) !== file) {
|
|
2336
2389
|
const cache2 = new PackageClientBoundaryCache();
|
|
2337
2390
|
cache2.load(file);
|
|
2338
2391
|
latestDevCache = { file, cache: cache2 };
|
|
@@ -2357,9 +2410,9 @@ function realPath(file) {
|
|
|
2357
2410
|
function setFarmRendererHydrationScope(roots, renderer, routeModules) {
|
|
2358
2411
|
const keys = roots.map(realPath);
|
|
2359
2412
|
const ruleSetsHydration = routeModules.some(
|
|
2360
|
-
(entry) => _optionalChain([entry, 'access',
|
|
2413
|
+
(entry) => _optionalChain([entry, 'access', _122 => _122.hydration, 'optionalAccess', _123 => _123.hydrate]) !== void 0 || _optionalChain([entry, 'access', _124 => _124.hydration, 'optionalAccess', _125 => _125.strategy]) !== void 0
|
|
2361
2414
|
);
|
|
2362
|
-
if (!_optionalChain([renderer, 'optionalAccess',
|
|
2415
|
+
if (!_optionalChain([renderer, 'optionalAccess', _126 => _126.hydration]) && !_optionalChain([renderer, 'optionalAccess', _127 => _127.compile]) && !ruleSetsHydration) {
|
|
2363
2416
|
for (const key of keys) scopes.delete(key);
|
|
2364
2417
|
return () => {
|
|
2365
2418
|
};
|
|
@@ -2390,7 +2443,7 @@ function findScope(file) {
|
|
|
2390
2443
|
if (file !== root && !file.startsWith(`${root}${_path2.default.sep}`)) continue;
|
|
2391
2444
|
if (!match || root.length > match.length) match = { length: root.length, scope };
|
|
2392
2445
|
}
|
|
2393
|
-
return _nullishCoalesce(_optionalChain([match, 'optionalAccess',
|
|
2446
|
+
return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _128 => _128.scope]), () => ( null));
|
|
2394
2447
|
}
|
|
2395
2448
|
function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
2396
2449
|
if (scopes.size === 0) return null;
|
|
@@ -2399,7 +2452,7 @@ function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
|
2399
2452
|
if (!scope) return null;
|
|
2400
2453
|
const route = scope.routeModules.get(file);
|
|
2401
2454
|
const options = scope.renderer.hydration;
|
|
2402
|
-
const own = _optionalChain([options, 'optionalAccess',
|
|
2455
|
+
const own = _optionalChain([options, 'optionalAccess', _129 => _129.resolve]) && scope.extensions.has(_path2.default.extname(file).toLowerCase()) ? readOwnHydration(scope, content, file) : {};
|
|
2403
2456
|
if (!route && own.hydrate === void 0 && own.strategy === void 0) return null;
|
|
2404
2457
|
const source = readSource();
|
|
2405
2458
|
const where = `${file} sets its hydration twice`;
|
|
@@ -2413,9 +2466,9 @@ function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
|
2413
2466
|
`${where}: \`export const island = "${source.strategy}"\` and renderer \`${scope.renderer.name}\`'s syntax, which says "${own.strategy}". Keep one of them.`
|
|
2414
2467
|
);
|
|
2415
2468
|
}
|
|
2416
|
-
const kindDefault = _optionalChain([route, 'optionalAccess',
|
|
2417
|
-
const hydrate = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(own.hydrate, () => ( source.hydrate)), () => ( _optionalChain([route, 'optionalAccess',
|
|
2418
|
-
const strategy = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(own.strategy, () => ( source.strategy)), () => ( _optionalChain([route, 'optionalAccess',
|
|
2469
|
+
const kindDefault = _optionalChain([route, 'optionalAccess', _130 => _130.kind]) === "page" ? _optionalChain([options, 'optionalAccess', _131 => _131.pages]) : _optionalChain([route, 'optionalAccess', _132 => _132.kind]) === "layout" ? _optionalChain([options, 'optionalAccess', _133 => _133.layouts]) : void 0;
|
|
2470
|
+
const hydrate = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(own.hydrate, () => ( source.hydrate)), () => ( _optionalChain([route, 'optionalAccess', _134 => _134.hydration, 'access', _135 => _135.hydrate]))), () => ( kindDefault)), () => ( false));
|
|
2471
|
+
const strategy = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(own.strategy, () => ( source.strategy)), () => ( _optionalChain([route, 'optionalAccess', _136 => _136.hydration, 'access', _137 => _137.strategy]))), () => ( ((hydrate || source.clientDirective) && route ? _optionalChain([options, 'optionalAccess', _138 => _138.strategy]) : void 0))), () => ( null));
|
|
2419
2472
|
return { hydrate, strategy };
|
|
2420
2473
|
}
|
|
2421
2474
|
function readOwnHydration(scope, content, file) {
|
|
@@ -2449,7 +2502,7 @@ function compileFarmRendererSource(content, sourcePath) {
|
|
|
2449
2502
|
if (scopes.size === 0) return content;
|
|
2450
2503
|
const file = realPath(sourcePath);
|
|
2451
2504
|
const scope = findScope(file);
|
|
2452
|
-
const compile = _optionalChain([scope, 'optionalAccess',
|
|
2505
|
+
const compile = _optionalChain([scope, 'optionalAccess', _139 => _139.renderer, 'access', _140 => _140.compile]);
|
|
2453
2506
|
if (!scope || !compile || !scope.extensions.has(_path2.default.extname(file).toLowerCase())) {
|
|
2454
2507
|
return content;
|
|
2455
2508
|
}
|
|
@@ -2510,9 +2563,9 @@ function scanMarkdownCode(content) {
|
|
|
2510
2563
|
let inCode = false;
|
|
2511
2564
|
for (; index < lines.length; index++) {
|
|
2512
2565
|
const line = lines[index];
|
|
2513
|
-
const marker = _optionalChain([/^ {0,3}(`{3,}|~{3,})/, 'access',
|
|
2566
|
+
const marker = _optionalChain([/^ {0,3}(`{3,}|~{3,})/, 'access', _141 => _141.exec, 'call', _142 => _142(line), 'optionalAccess', _143 => _143[1]]);
|
|
2514
2567
|
if (fence) {
|
|
2515
|
-
if (_optionalChain([marker, 'optionalAccess',
|
|
2568
|
+
if (_optionalChain([marker, 'optionalAccess', _144 => _144[0]]) === fence[0] && marker.length >= fence.length && line.trim() === marker) {
|
|
2516
2569
|
fence = null;
|
|
2517
2570
|
}
|
|
2518
2571
|
} else if (inCode) {
|
|
@@ -2564,7 +2617,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
2564
2617
|
candidates.add(_path2.default.join(root, normalized));
|
|
2565
2618
|
candidates.add(_path2.default.resolve(root, normalized));
|
|
2566
2619
|
}
|
|
2567
|
-
if (_optionalChain([withoutQuery, 'optionalAccess',
|
|
2620
|
+
if (_optionalChain([withoutQuery, 'optionalAccess', _145 => _145.startsWith, 'call', _146 => _146("/src/")])) {
|
|
2568
2621
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
2569
2622
|
candidates.add(_path2.default.join(process.cwd(), normalized));
|
|
2570
2623
|
candidates.add(_path2.default.resolve(process.cwd(), normalized));
|
|
@@ -2634,7 +2687,7 @@ function hasUseClientDirective(content) {
|
|
|
2634
2687
|
return false;
|
|
2635
2688
|
}
|
|
2636
2689
|
function hasHydrateExport(content) {
|
|
2637
|
-
return _optionalChain([_chunkWMRGIQTAcjs.readFarmHydrateExport.call(void 0, content), 'optionalAccess',
|
|
2690
|
+
return _optionalChain([_chunkWMRGIQTAcjs.readFarmHydrateExport.call(void 0, content), 'optionalAccess', _147 => _147.value]) === true;
|
|
2638
2691
|
}
|
|
2639
2692
|
var REGEXP_PREFIX_PUNCTUATION = /* @__PURE__ */ new Set([
|
|
2640
2693
|
"(",
|
|
@@ -2823,7 +2876,7 @@ function isIslandExportStart(tokens, index) {
|
|
|
2823
2876
|
const token = tokens[index];
|
|
2824
2877
|
const previous = tokens[index - 1];
|
|
2825
2878
|
const startsStatement = !previous || previous.value === ";" || previous.value === "{" || previous.value === "}" || token.line > previous.line;
|
|
2826
|
-
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access',
|
|
2879
|
+
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access', _148 => _148[index + 1], 'optionalAccess', _149 => _149.value]) === "const" && _optionalChain([tokens, 'access', _150 => _150[index + 2], 'optionalAccess', _151 => _151.value]) === "island";
|
|
2827
2880
|
}
|
|
2828
2881
|
function getIslandStrategyExport(content) {
|
|
2829
2882
|
if (!content) return null;
|
|
@@ -2831,15 +2884,15 @@ function getIslandStrategyExport(content) {
|
|
|
2831
2884
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2832
2885
|
if (!isIslandExportStart(tokens, index)) continue;
|
|
2833
2886
|
let valueIndex = index + 3;
|
|
2834
|
-
if (_optionalChain([tokens, 'access',
|
|
2887
|
+
if (_optionalChain([tokens, 'access', _152 => _152[valueIndex], 'optionalAccess', _153 => _153.value]) === ":") {
|
|
2835
2888
|
while (valueIndex < tokens.length && tokens[valueIndex].value !== "=") valueIndex++;
|
|
2836
2889
|
}
|
|
2837
|
-
if (_optionalChain([tokens, 'access',
|
|
2890
|
+
if (_optionalChain([tokens, 'access', _154 => _154[valueIndex], 'optionalAccess', _155 => _155.value]) !== "=") break;
|
|
2838
2891
|
valueIndex++;
|
|
2839
2892
|
const literal = tokens[valueIndex];
|
|
2840
2893
|
if (!literal || literal.kind !== "string" || !_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, literal.value)) break;
|
|
2841
2894
|
let trailingIndex = valueIndex + 1;
|
|
2842
|
-
if (_optionalChain([tokens, 'access',
|
|
2895
|
+
if (_optionalChain([tokens, 'access', _156 => _156[trailingIndex], 'optionalAccess', _157 => _157.value]) === "as" && _optionalChain([tokens, 'access', _158 => _158[trailingIndex + 1], 'optionalAccess', _159 => _159.value]) === "const") {
|
|
2843
2896
|
trailingIndex += 2;
|
|
2844
2897
|
}
|
|
2845
2898
|
const trailing = tokens[trailingIndex];
|
|
@@ -2865,13 +2918,13 @@ function hasAsyncDefaultExport(content) {
|
|
|
2865
2918
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2866
2919
|
const token = tokens[index];
|
|
2867
2920
|
if (token.kind !== "identifier" || token.value !== "export") continue;
|
|
2868
|
-
if (_optionalChain([tokens, 'access',
|
|
2869
|
-
if (_optionalChain([tokens, 'access',
|
|
2921
|
+
if (_optionalChain([tokens, 'access', _160 => _160[index - 1], 'optionalAccess', _161 => _161.value]) === ".") continue;
|
|
2922
|
+
if (_optionalChain([tokens, 'access', _162 => _162[index + 1], 'optionalAccess', _163 => _163.value]) !== "default") continue;
|
|
2870
2923
|
const exported = tokens[index + 2];
|
|
2871
2924
|
if (exported.kind === "identifier" && exported.value === "async") {
|
|
2872
2925
|
return true;
|
|
2873
2926
|
}
|
|
2874
|
-
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access',
|
|
2927
|
+
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access', _164 => _164[index + 3], 'optionalAccess', _165 => _165.value]) !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
|
|
2875
2928
|
return true;
|
|
2876
2929
|
}
|
|
2877
2930
|
}
|
|
@@ -2879,15 +2932,23 @@ function hasAsyncDefaultExport(content) {
|
|
|
2879
2932
|
}
|
|
2880
2933
|
function isAsyncLocalDeclaration(tokens, name) {
|
|
2881
2934
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2882
|
-
if (tokens[index].value === "async" && _optionalChain([tokens, 'access',
|
|
2935
|
+
if (tokens[index].value === "async" && _optionalChain([tokens, 'access', _166 => _166[index + 1], 'optionalAccess', _167 => _167.value]) === "function" && _optionalChain([tokens, 'access', _168 => _168[index + 2], 'optionalAccess', _169 => _169.value]) === name) {
|
|
2883
2936
|
return true;
|
|
2884
2937
|
}
|
|
2885
|
-
if (tokens[index].value === name && _optionalChain([tokens, 'access',
|
|
2938
|
+
if (tokens[index].value === name && _optionalChain([tokens, 'access', _170 => _170[index + 1], 'optionalAccess', _171 => _171.value]) === "=" && _optionalChain([tokens, 'access', _172 => _172[index + 2], 'optionalAccess', _173 => _173.value]) === "async") {
|
|
2886
2939
|
return true;
|
|
2887
2940
|
}
|
|
2888
2941
|
}
|
|
2889
2942
|
return false;
|
|
2890
2943
|
}
|
|
2944
|
+
function parseImportedModuleMetadata(content) {
|
|
2945
|
+
if (!content) return parseClientModuleMetadata(content, false);
|
|
2946
|
+
return memoizeInFarmSourceSnapshot(
|
|
2947
|
+
"imported-module-metadata",
|
|
2948
|
+
content,
|
|
2949
|
+
() => parseClientModuleMetadata(content, false)
|
|
2950
|
+
);
|
|
2951
|
+
}
|
|
2891
2952
|
function parseClientModuleMetadata(content, inspectIslandExport, sourcePath) {
|
|
2892
2953
|
if (!content) {
|
|
2893
2954
|
return {
|
|
@@ -2907,7 +2968,7 @@ function parseClientModuleMetadata(content, inspectIslandExport, sourcePath) {
|
|
|
2907
2968
|
mayCompileFarmRendererSource(sourcePath) && readSourceIfExists(sourcePath) || content,
|
|
2908
2969
|
sourcePath,
|
|
2909
2970
|
() => ({
|
|
2910
|
-
hydrate: typeof _optionalChain([hydrate, 'optionalAccess',
|
|
2971
|
+
hydrate: typeof _optionalChain([hydrate, 'optionalAccess', _174 => _174.value]) === "boolean" ? hydrate.value : void 0,
|
|
2911
2972
|
strategy: getIslandStrategyExport(content),
|
|
2912
2973
|
clientDirective: isClientComponent
|
|
2913
2974
|
})
|
|
@@ -2920,7 +2981,7 @@ function parseClientModuleMetadata(content, inspectIslandExport, sourcePath) {
|
|
|
2920
2981
|
islandStrategy: rendererHydration.strategy
|
|
2921
2982
|
};
|
|
2922
2983
|
}
|
|
2923
|
-
const hasHydrate = _optionalChain([hydrate, 'optionalAccess',
|
|
2984
|
+
const hasHydrate = _optionalChain([hydrate, 'optionalAccess', _175 => _175.value]) === true;
|
|
2924
2985
|
return {
|
|
2925
2986
|
isClientComponent,
|
|
2926
2987
|
hasHydrateExport: hasHydrate,
|
|
@@ -2950,7 +3011,7 @@ function getFarmClientRenderingBindings(code, file, root) {
|
|
|
2950
3011
|
for (const [specifier, locals] of getStaticImportBindings(code)) {
|
|
2951
3012
|
const imported = resolveImportedModule(file, specifier, root);
|
|
2952
3013
|
if (!imported.path) continue;
|
|
2953
|
-
const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([_path2.default.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root
|
|
3014
|
+
const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([_path2.default.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root);
|
|
2954
3015
|
if (metadata.isClientComponent || metadata.shouldHydrate) bindings.push(...locals);
|
|
2955
3016
|
}
|
|
2956
3017
|
return bindings;
|
|
@@ -3123,7 +3184,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
3123
3184
|
return plan;
|
|
3124
3185
|
}
|
|
3125
3186
|
function usesFarmServerTree(plan) {
|
|
3126
|
-
return _optionalChain([plan, 'optionalAccess',
|
|
3187
|
+
return _optionalChain([plan, 'optionalAccess', _176 => _176.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0;
|
|
3127
3188
|
}
|
|
3128
3189
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
3129
3190
|
const plan = {
|
|
@@ -3273,12 +3334,20 @@ function exportListNames(content) {
|
|
|
3273
3334
|
}
|
|
3274
3335
|
return names;
|
|
3275
3336
|
}
|
|
3337
|
+
var NO_IMPORT_BINDINGS = /* @__PURE__ */ new Map();
|
|
3276
3338
|
function getStaticImportBindings(content) {
|
|
3339
|
+
if (!content) return NO_IMPORT_BINDINGS;
|
|
3340
|
+
return memoizeInFarmSourceSnapshot(
|
|
3341
|
+
"import-bindings",
|
|
3342
|
+
content,
|
|
3343
|
+
() => scanStaticImportBindings(content)
|
|
3344
|
+
);
|
|
3345
|
+
}
|
|
3346
|
+
function scanStaticImportBindings(content) {
|
|
3277
3347
|
const bindings = /* @__PURE__ */ new Map();
|
|
3278
|
-
if (!content) return bindings;
|
|
3279
3348
|
const tokens = tokenizeModuleSource(content);
|
|
3280
3349
|
for (let index = 0; index < tokens.length; index++) {
|
|
3281
|
-
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access',
|
|
3350
|
+
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _177 => _177[index - 1], 'optionalAccess', _178 => _178.value]) === ".") continue;
|
|
3282
3351
|
const first = tokens[index + 1];
|
|
3283
3352
|
if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
|
|
3284
3353
|
continue;
|
|
@@ -3286,7 +3355,7 @@ function getStaticImportBindings(content) {
|
|
|
3286
3355
|
let fromIndex = -1;
|
|
3287
3356
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
3288
3357
|
if (tokens[cursor].value === ";") break;
|
|
3289
|
-
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access',
|
|
3358
|
+
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _179 => _179[cursor + 1], 'optionalAccess', _180 => _180.kind]) === "string") {
|
|
3290
3359
|
fromIndex = cursor;
|
|
3291
3360
|
break;
|
|
3292
3361
|
}
|
|
@@ -3295,13 +3364,13 @@ function getStaticImportBindings(content) {
|
|
|
3295
3364
|
const specifier = tokens[fromIndex + 1].value;
|
|
3296
3365
|
const clause = tokens.slice(index + 1, fromIndex);
|
|
3297
3366
|
const localNames = [];
|
|
3298
|
-
if (_optionalChain([clause, 'access',
|
|
3367
|
+
if (_optionalChain([clause, 'access', _181 => _181[0], 'optionalAccess', _182 => _182.kind]) === "identifier" && clause[0].value !== "type") {
|
|
3299
3368
|
localNames.push(clause[0].value);
|
|
3300
3369
|
}
|
|
3301
3370
|
const namespaceAs = clause.findIndex(
|
|
3302
|
-
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access',
|
|
3371
|
+
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _183 => _183[clauseIndex + 1], 'optionalAccess', _184 => _184.value]) === "as"
|
|
3303
3372
|
);
|
|
3304
|
-
if (namespaceAs !== -1 && _optionalChain([clause, 'access',
|
|
3373
|
+
if (namespaceAs !== -1 && _optionalChain([clause, 'access', _185 => _185[namespaceAs + 2], 'optionalAccess', _186 => _186.kind]) === "identifier") {
|
|
3305
3374
|
localNames.push(clause[namespaceAs + 2].value);
|
|
3306
3375
|
}
|
|
3307
3376
|
const openingBrace = clause.findIndex((token) => token.value === "{");
|
|
@@ -3311,11 +3380,11 @@ function getStaticImportBindings(content) {
|
|
|
3311
3380
|
if (openingBrace !== -1 && closingBrace !== -1) {
|
|
3312
3381
|
let entryStart = openingBrace + 1;
|
|
3313
3382
|
for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
|
|
3314
|
-
if (cursor !== closingBrace && _optionalChain([clause, 'access',
|
|
3383
|
+
if (cursor !== closingBrace && _optionalChain([clause, 'access', _187 => _187[cursor], 'optionalAccess', _188 => _188.value]) !== ",") continue;
|
|
3315
3384
|
const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
|
|
3316
3385
|
const asIndex = entry.findIndex((token) => token.value === "as");
|
|
3317
3386
|
const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
|
|
3318
|
-
if (_optionalChain([local, 'optionalAccess',
|
|
3387
|
+
if (_optionalChain([local, 'optionalAccess', _189 => _189.kind]) === "identifier") localNames.push(local.value);
|
|
3319
3388
|
entryStart = cursor + 1;
|
|
3320
3389
|
}
|
|
3321
3390
|
}
|
|
@@ -3352,7 +3421,7 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
3352
3421
|
const open = [];
|
|
3353
3422
|
const isSelfClosing = (openingIndex) => {
|
|
3354
3423
|
for (let index = openingIndex; index < tokens.length; index++) {
|
|
3355
|
-
if (tokens[index].value === ">") return _optionalChain([tokens, 'access',
|
|
3424
|
+
if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _190 => _190[index - 1], 'optionalAccess', _191 => _191.value]) === "/";
|
|
3356
3425
|
}
|
|
3357
3426
|
return false;
|
|
3358
3427
|
};
|
|
@@ -3360,7 +3429,7 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
3360
3429
|
if (tokens[index].value !== "<") continue;
|
|
3361
3430
|
if (tokens[index + 1].value === "/") {
|
|
3362
3431
|
const closing = tokens[index + 2];
|
|
3363
|
-
const at = _optionalChain([closing, 'optionalAccess',
|
|
3432
|
+
const at = _optionalChain([closing, 'optionalAccess', _192 => _192.kind]) === "identifier" ? open.lastIndexOf(closing.value) : -1;
|
|
3364
3433
|
if (at !== -1) open.length = at;
|
|
3365
3434
|
continue;
|
|
3366
3435
|
}
|
|
@@ -3403,7 +3472,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
|
|
|
3403
3472
|
}
|
|
3404
3473
|
function containsClientJsx(tokens, start, end, clientBindings) {
|
|
3405
3474
|
for (let index = start; index < end; index++) {
|
|
3406
|
-
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access',
|
|
3475
|
+
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _193 => _193[index + 1], 'optionalAccess', _194 => _194.value]))) return true;
|
|
3407
3476
|
}
|
|
3408
3477
|
return false;
|
|
3409
3478
|
}
|
|
@@ -3441,7 +3510,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
3441
3510
|
let helperName;
|
|
3442
3511
|
let bodyStart = -1;
|
|
3443
3512
|
let bodyEnd = -1;
|
|
3444
|
-
if (tokens[index].value === "function" && _optionalChain([tokens, 'access',
|
|
3513
|
+
if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _195 => _195[index + 1], 'optionalAccess', _196 => _196.kind]) === "identifier") {
|
|
3445
3514
|
helperName = tokens[index + 1].value;
|
|
3446
3515
|
const parametersStart = tokens.findIndex(
|
|
3447
3516
|
(token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
|
|
@@ -3451,21 +3520,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
3451
3520
|
(token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
|
|
3452
3521
|
);
|
|
3453
3522
|
if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
|
|
3454
|
-
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access',
|
|
3523
|
+
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _197 => _197[index + 1], 'optionalAccess', _198 => _198.kind]) === "identifier") {
|
|
3455
3524
|
helperName = tokens[index + 1].value;
|
|
3456
3525
|
let assignmentIndex = -1;
|
|
3457
3526
|
let arrowIndex = -1;
|
|
3458
3527
|
for (let cursor = index + 2; cursor < tokens.length; cursor++) {
|
|
3459
3528
|
if (tokens[cursor].value === ";") break;
|
|
3460
3529
|
if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
|
|
3461
|
-
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access',
|
|
3530
|
+
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _199 => _199[cursor + 1], 'optionalAccess', _200 => _200.value]) === ">") {
|
|
3462
3531
|
arrowIndex = cursor;
|
|
3463
3532
|
break;
|
|
3464
3533
|
}
|
|
3465
3534
|
}
|
|
3466
3535
|
if (arrowIndex !== -1) {
|
|
3467
3536
|
bodyStart = arrowIndex + 2;
|
|
3468
|
-
bodyEnd = _optionalChain([tokens, 'access',
|
|
3537
|
+
bodyEnd = _optionalChain([tokens, 'access', _201 => _201[bodyStart], 'optionalAccess', _202 => _202.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
|
|
3469
3538
|
} else if (assignmentIndex !== -1) {
|
|
3470
3539
|
bodyStart = assignmentIndex + 1;
|
|
3471
3540
|
bodyEnd = findStatementEnd(tokens, bodyStart);
|
|
@@ -3505,14 +3574,14 @@ function passesElementValuedProps(content, localBindings) {
|
|
|
3505
3574
|
else if (value === "}") braceDepth--;
|
|
3506
3575
|
else if (value === "<" && braceDepth > 0) return true;
|
|
3507
3576
|
else if (value === ">" && braceDepth === 0) {
|
|
3508
|
-
selfClosing = _optionalChain([tokens, 'access',
|
|
3577
|
+
selfClosing = _optionalChain([tokens, 'access', _203 => _203[cursor - 1], 'optionalAccess', _204 => _204.value]) === "/";
|
|
3509
3578
|
break;
|
|
3510
3579
|
}
|
|
3511
3580
|
}
|
|
3512
3581
|
if (selfClosing || cursor >= tokens.length) continue;
|
|
3513
3582
|
for (let child = cursor + 1; child < tokens.length; child++) {
|
|
3514
3583
|
if (tokens[child].value !== "<") continue;
|
|
3515
|
-
const closesBoundary = _optionalChain([tokens, 'access',
|
|
3584
|
+
const closesBoundary = _optionalChain([tokens, 'access', _205 => _205[child + 1], 'optionalAccess', _206 => _206.value]) === "/" && _optionalChain([tokens, 'access', _207 => _207[child + 2], 'optionalAccess', _208 => _208.value]) === name;
|
|
3516
3585
|
if (!closesBoundary) return true;
|
|
3517
3586
|
break;
|
|
3518
3587
|
}
|
|
@@ -3534,7 +3603,7 @@ function rendersOnlyLeafElements(content, localBindings) {
|
|
|
3534
3603
|
else if (value === "<" && braceDepth > 0) return false;
|
|
3535
3604
|
else if (value === ">" && braceDepth === 0) break;
|
|
3536
3605
|
}
|
|
3537
|
-
if (cursor >= tokens.length || _optionalChain([tokens, 'access',
|
|
3606
|
+
if (cursor >= tokens.length || _optionalChain([tokens, 'access', _209 => _209[cursor - 1], 'optionalAccess', _210 => _210.value]) !== "/") return false;
|
|
3538
3607
|
}
|
|
3539
3608
|
return true;
|
|
3540
3609
|
}
|
|
@@ -3546,9 +3615,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
3546
3615
|
const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
|
|
3547
3616
|
for (let index = 0; index < tokens.length; index++) {
|
|
3548
3617
|
let callStart = -1;
|
|
3549
|
-
if (tokens[index].value === "." && (_optionalChain([tokens, 'access',
|
|
3618
|
+
if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _211 => _211[index + 1], 'optionalAccess', _212 => _212.value]) === "map" || _optionalChain([tokens, 'access', _213 => _213[index + 1], 'optionalAccess', _214 => _214.value]) === "flatMap") && _optionalChain([tokens, 'access', _215 => _215[index + 2], 'optionalAccess', _216 => _216.value]) === "(") {
|
|
3550
3619
|
callStart = index + 2;
|
|
3551
|
-
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access',
|
|
3620
|
+
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _217 => _217[index + 1], 'optionalAccess', _218 => _218.value]) === "." && _optionalChain([tokens, 'access', _219 => _219[index + 2], 'optionalAccess', _220 => _220.value]) === "from" && _optionalChain([tokens, 'access', _221 => _221[index + 3], 'optionalAccess', _222 => _222.value]) === "(") {
|
|
3552
3621
|
callStart = index + 3;
|
|
3553
3622
|
}
|
|
3554
3623
|
if (callStart !== -1) {
|
|
@@ -3557,10 +3626,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
3557
3626
|
index = callEnd;
|
|
3558
3627
|
continue;
|
|
3559
3628
|
}
|
|
3560
|
-
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access',
|
|
3629
|
+
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _223 => _223[index + 1], 'optionalAccess', _224 => _224.value]) === "(") {
|
|
3561
3630
|
const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
|
|
3562
3631
|
const bodyStart = conditionEnd + 1;
|
|
3563
|
-
const bodyEnd = _optionalChain([tokens, 'access',
|
|
3632
|
+
const bodyEnd = _optionalChain([tokens, 'access', _225 => _225[bodyStart], 'optionalAccess', _226 => _226.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
|
|
3564
3633
|
if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
|
|
3565
3634
|
}
|
|
3566
3635
|
}
|
|
@@ -3582,7 +3651,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3582
3651
|
if (visiting.has(moduleSourcePath)) return 0;
|
|
3583
3652
|
visiting.add(moduleSourcePath);
|
|
3584
3653
|
const content = readModuleCode(moduleSourcePath);
|
|
3585
|
-
const parsed =
|
|
3654
|
+
const parsed = parseImportedModuleMetadata(content);
|
|
3586
3655
|
if (parsed.isClientComponent) {
|
|
3587
3656
|
if (!isIsolatableClientBoundarySource(content)) {
|
|
3588
3657
|
fallbackReason = `client boundary ${moduleSourcePath} uses an unsupported export shape`;
|
|
@@ -3644,7 +3713,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3644
3713
|
if (reference) importedBoundaryCount += visit(reference);
|
|
3645
3714
|
}
|
|
3646
3715
|
} else {
|
|
3647
|
-
const packageMetadata = inspectPackageClientBoundary(importedPath, root
|
|
3716
|
+
const packageMetadata = inspectPackageClientBoundary(importedPath, root);
|
|
3648
3717
|
if (!packageMetadata.shouldHydrate) continue;
|
|
3649
3718
|
const references = options.packageReferences && projectRoot ? findFarmPackageClientImports(
|
|
3650
3719
|
_nullishCoalesce(content, () => ( "")),
|
|
@@ -3679,7 +3748,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3679
3748
|
const localBindings = _nullishCoalesce(importedBindings.get(specifier), () => ( []));
|
|
3680
3749
|
const staticUses = countStaticJsxUses(content, localBindings);
|
|
3681
3750
|
if (staticUses > 0) {
|
|
3682
|
-
const grows = options.packageReferences === true && projectRoot !== void 0 && (_nullishCoalesce(_optionalChain([findFarmIslandContainers, 'call',
|
|
3751
|
+
const grows = options.packageReferences === true && projectRoot !== void 0 && (_nullishCoalesce(_optionalChain([findFarmIslandContainers, 'call', _227 => _227(_nullishCoalesce(content, () => ( "")), moduleSourcePath, localBindings), 'optionalAccess', _228 => _228.length]), () => ( 0))) > 0;
|
|
3683
3752
|
if (grows) visit(ensureFarmIslandContainerReference(projectRoot));
|
|
3684
3753
|
const container = grows ? void 0 : findParserSensitiveJsxContainer(content, localBindings);
|
|
3685
3754
|
if (container) {
|
|
@@ -3769,43 +3838,65 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
3769
3838
|
function farmWorkspaceServerEntry(entry) {
|
|
3770
3839
|
const real = realpathOrSelf(entry);
|
|
3771
3840
|
if (real.split(_path2.default.sep).includes("node_modules")) return null;
|
|
3772
|
-
if (
|
|
3841
|
+
if (parseImportedModuleMetadata(readIfExists(real)).isClientComponent) return null;
|
|
3773
3842
|
return real;
|
|
3774
3843
|
}
|
|
3775
3844
|
function realpathOrSelf(file) {
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3845
|
+
const real = memoizeInFarmSourceSnapshot(
|
|
3846
|
+
"realpath",
|
|
3847
|
+
farmSourceSnapshotPathKey(file),
|
|
3848
|
+
() => {
|
|
3849
|
+
try {
|
|
3850
|
+
return _fs2.default.realpathSync(file);
|
|
3851
|
+
} catch (e42) {
|
|
3852
|
+
return null;
|
|
3853
|
+
}
|
|
3854
|
+
},
|
|
3855
|
+
(resolved) => resolved !== null
|
|
3856
|
+
);
|
|
3857
|
+
return _nullishCoalesce(real, () => ( file));
|
|
3858
|
+
}
|
|
3859
|
+
var NODE_MODULES_SEGMENT2 = `${_path2.default.sep}node_modules${_path2.default.sep}`;
|
|
3860
|
+
function getInstalledPackageDirectory(file, start) {
|
|
3861
|
+
let end = file.indexOf(_path2.default.sep, start);
|
|
3862
|
+
if (end !== -1 && file[start] === "@") end = file.indexOf(_path2.default.sep, end + 1);
|
|
3863
|
+
return end === -1 ? file : file.slice(0, end);
|
|
3864
|
+
}
|
|
3865
|
+
function installedRealPath(file) {
|
|
3866
|
+
const segment = file.lastIndexOf(NODE_MODULES_SEGMENT2);
|
|
3867
|
+
if (segment === -1) return file;
|
|
3868
|
+
const directory = getInstalledPackageDirectory(file, segment + NODE_MODULES_SEGMENT2.length);
|
|
3869
|
+
const real = realpathOrSelf(directory);
|
|
3870
|
+
if (real === directory || !real.includes(NODE_MODULES_SEGMENT2)) return file;
|
|
3871
|
+
return real + file.slice(directory.length);
|
|
3872
|
+
}
|
|
3873
|
+
var NO_VISITED_FILES = /* @__PURE__ */ new Set();
|
|
3782
3874
|
function getBarePackageReexports(content) {
|
|
3783
3875
|
return getImportSpecifiers(content, { reexportsOnly: true }).filter(
|
|
3784
3876
|
(specifier) => bareSpecifierPackage(specifier)
|
|
3785
3877
|
);
|
|
3786
3878
|
}
|
|
3787
|
-
function inspectPackageClientBoundary(
|
|
3879
|
+
function inspectPackageClientBoundary(importedPath, root, visited) {
|
|
3880
|
+
const resolvedPath = importedPath && installedRealPath(importedPath);
|
|
3788
3881
|
const cache2 = getPackageClientBoundaryCache();
|
|
3789
|
-
if (!cache2 || !resolvedPath || visited.has(resolvedPath)) {
|
|
3790
|
-
return traversePackageClientBoundary(resolvedPath, root, visited);
|
|
3882
|
+
if (!cache2 || !resolvedPath || _optionalChain([visited, 'optionalAccess', _229 => _229.has, 'call', _230 => _230(resolvedPath)])) {
|
|
3883
|
+
return traversePackageClientBoundary(resolvedPath, root, _nullishCoalesce(visited, () => ( /* @__PURE__ */ new Set())));
|
|
3791
3884
|
}
|
|
3792
3885
|
const key = `${_nullishCoalesce(root, () => ( ""))}\0${resolvedPath}`;
|
|
3793
|
-
const cached = cache2.find(key, visited);
|
|
3886
|
+
const cached = cache2.find(key, _nullishCoalesce(visited, () => ( NO_VISITED_FILES)));
|
|
3794
3887
|
if (cached) {
|
|
3795
|
-
for (const file of cached.files)
|
|
3796
|
-
|
|
3797
|
-
noteFarmSourceRead(file);
|
|
3798
|
-
}
|
|
3888
|
+
if (visited) for (const file of cached.files) visited.add(file);
|
|
3889
|
+
noteFarmSourceReads(cached.files);
|
|
3799
3890
|
return { ...cached.result };
|
|
3800
3891
|
}
|
|
3801
3892
|
const trace2 = new PackageInspectionTrace();
|
|
3802
|
-
const result = traversePackageClientBoundary(resolvedPath, root, visited, trace2);
|
|
3893
|
+
const result = traversePackageClientBoundary(resolvedPath, root, _nullishCoalesce(visited, () => ( /* @__PURE__ */ new Set())), trace2);
|
|
3803
3894
|
cache2.add(key, trace2.toEntry(result));
|
|
3804
3895
|
return result;
|
|
3805
3896
|
}
|
|
3806
3897
|
function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
3807
3898
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
3808
|
-
if (resolvedPath) _optionalChain([trace2, 'optionalAccess',
|
|
3899
|
+
if (resolvedPath) _optionalChain([trace2, 'optionalAccess', _231 => _231.stop, 'call', _232 => _232(resolvedPath)]);
|
|
3809
3900
|
return {
|
|
3810
3901
|
isClientComponent: false,
|
|
3811
3902
|
shouldHydrate: false,
|
|
@@ -3813,9 +3904,9 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
|
3813
3904
|
};
|
|
3814
3905
|
}
|
|
3815
3906
|
visited.add(resolvedPath);
|
|
3816
|
-
_optionalChain([trace2, 'optionalAccess',
|
|
3907
|
+
_optionalChain([trace2, 'optionalAccess', _233 => _233.visit, 'call', _234 => _234(resolvedPath)]);
|
|
3817
3908
|
const content = readIfExists(resolvedPath);
|
|
3818
|
-
const parsed =
|
|
3909
|
+
const parsed = parseImportedModuleMetadata(content);
|
|
3819
3910
|
let importsClientBoundary = false;
|
|
3820
3911
|
let importedIslandStrategy = null;
|
|
3821
3912
|
const reexports = getBarePackageReexports(content);
|
|
@@ -3871,7 +3962,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3871
3962
|
braceDepth = Math.max(0, braceDepth - 1);
|
|
3872
3963
|
continue;
|
|
3873
3964
|
}
|
|
3874
|
-
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access',
|
|
3965
|
+
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access', _235 => _235[index - 1], 'optionalAccess', _236 => _236.value]) !== "." && _optionalChain([tokens, 'access', _237 => _237[index + 1], 'optionalAccess', _238 => _238.value]) === "(" && _optionalChain([tokens, 'access', _239 => _239[index + 2], 'optionalAccess', _240 => _240.kind]) === "string") {
|
|
3875
3966
|
matches.add(tokens[index + 2].value);
|
|
3876
3967
|
continue;
|
|
3877
3968
|
}
|
|
@@ -3881,7 +3972,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3881
3972
|
}
|
|
3882
3973
|
if (reexportsOnly && keyword.value !== "export") continue;
|
|
3883
3974
|
const previous = tokens[index - 1];
|
|
3884
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
3975
|
+
if (_optionalChain([previous, 'optionalAccess', _241 => _241.value]) === ".") continue;
|
|
3885
3976
|
const first = tokens[index + 1];
|
|
3886
3977
|
if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
|
|
3887
3978
|
continue;
|
|
@@ -3897,7 +3988,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3897
3988
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
3898
3989
|
const token = tokens[cursor];
|
|
3899
3990
|
if (token.value === ";") break;
|
|
3900
|
-
if (token.value === "from" && _optionalChain([tokens, 'access',
|
|
3991
|
+
if (token.value === "from" && _optionalChain([tokens, 'access', _242 => _242[cursor + 1], 'optionalAccess', _243 => _243.kind]) === "string") {
|
|
3901
3992
|
fromIndex = cursor;
|
|
3902
3993
|
break;
|
|
3903
3994
|
}
|
|
@@ -3915,7 +4006,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3915
4006
|
return Array.from(matches);
|
|
3916
4007
|
}
|
|
3917
4008
|
function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
3918
|
-
if (_optionalChain([tokens, 'access',
|
|
4009
|
+
if (_optionalChain([tokens, 'access', _244 => _244[startIndex], 'optionalAccess', _245 => _245.value]) !== "{") return false;
|
|
3919
4010
|
let closingBraceIndex = -1;
|
|
3920
4011
|
for (let index = startIndex + 1; index < endIndex; index++) {
|
|
3921
4012
|
if (tokens[index].value !== "}") continue;
|
|
@@ -3925,7 +4016,7 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
|
3925
4016
|
if (closingBraceIndex === -1) return false;
|
|
3926
4017
|
let entryStartsAt = startIndex + 1;
|
|
3927
4018
|
for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
|
|
3928
|
-
if (index !== closingBraceIndex && _optionalChain([tokens, 'access',
|
|
4019
|
+
if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _246 => _246[index], 'optionalAccess', _247 => _247.value]) !== ",") continue;
|
|
3929
4020
|
const entry = tokens.slice(entryStartsAt, index);
|
|
3930
4021
|
if (entry.length > 0 && entry[0].value !== "type") return false;
|
|
3931
4022
|
entryStartsAt = index + 1;
|
|
@@ -3999,14 +4090,14 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3999
4090
|
const sourceDir = _chunkMNUYXZV7cjs.getFarmProjectSourceDir.call(void 0, projectRoot);
|
|
4000
4091
|
const cached = projectImportAliasCache.get(projectRoot);
|
|
4001
4092
|
const dependencies = new Set(
|
|
4002
|
-
_nullishCoalesce(_optionalChain([cached, 'optionalAccess',
|
|
4093
|
+
_nullishCoalesce(_optionalChain([cached, 'optionalAccess', _248 => _248.stamps, 'access', _249 => _249.keys, 'call', _250 => _250()]), () => ( PROJECT_ALIAS_FILES.map((file) => _path2.default.join(projectRoot, file))))
|
|
4003
4094
|
);
|
|
4004
4095
|
const stamps = /* @__PURE__ */ new Map();
|
|
4005
4096
|
for (const file of dependencies) {
|
|
4006
4097
|
noteFarmSourceRead(file);
|
|
4007
4098
|
stamps.set(file, getFarmSourceStamp(file));
|
|
4008
4099
|
}
|
|
4009
|
-
if (_optionalChain([cached, 'optionalAccess',
|
|
4100
|
+
if (_optionalChain([cached, 'optionalAccess', _251 => _251.sourceDir]) === sourceDir && [...stamps].every(([file, stamp]) => cached.stamps.get(file) === stamp))
|
|
4010
4101
|
return cached.aliases;
|
|
4011
4102
|
dependencies.clear();
|
|
4012
4103
|
for (const file of PROJECT_ALIAS_FILES) dependencies.add(_path2.default.join(projectRoot, file));
|
|
@@ -4035,7 +4126,7 @@ function readTsconfigPathAliases(projectRoot, dependencies) {
|
|
|
4035
4126
|
const configPath = _path2.default.join(projectRoot, name);
|
|
4036
4127
|
if (!_fs2.default.existsSync(configPath)) continue;
|
|
4037
4128
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set(), dependencies);
|
|
4038
|
-
if (!_optionalChain([resolved, 'optionalAccess',
|
|
4129
|
+
if (!_optionalChain([resolved, 'optionalAccess', _252 => _252.paths])) return [];
|
|
4039
4130
|
const base2 = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
|
|
4040
4131
|
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
4041
4132
|
if (!Array.isArray(targets)) return [];
|
|
@@ -4071,18 +4162,18 @@ function readTsconfigPaths(configPath, visited, dependencies) {
|
|
|
4071
4162
|
inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited, dependencies), () => ( inherited));
|
|
4072
4163
|
}
|
|
4073
4164
|
const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
|
|
4074
|
-
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess',
|
|
4165
|
+
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _253 => _253.baseUrl]);
|
|
4075
4166
|
if (options.paths && typeof options.paths === "object") {
|
|
4076
4167
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
4077
4168
|
}
|
|
4078
4169
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
4079
4170
|
}
|
|
4080
4171
|
function readPackageImportAliases(projectRoot) {
|
|
4081
|
-
const imports = _optionalChain([readPackageJson, 'call',
|
|
4172
|
+
const imports = _optionalChain([readPackageJson, 'call', _254 => _254(_path2.default.join(projectRoot, "package.json")), 'optionalAccess', _255 => _255.imports]);
|
|
4082
4173
|
if (!imports || typeof imports !== "object") return [];
|
|
4083
4174
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
4084
4175
|
const target = resolveConditionalExportTarget(value);
|
|
4085
|
-
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess',
|
|
4176
|
+
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _256 => _256.startsWith, 'call', _257 => _257("./")])) return [];
|
|
4086
4177
|
const wildcardIndex = pattern.indexOf("*");
|
|
4087
4178
|
return [
|
|
4088
4179
|
{
|
|
@@ -4148,15 +4239,15 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
4148
4239
|
const packageJsonPath = _path2.default.join(packageDirectory, "package.json");
|
|
4149
4240
|
const packageJson = readPackageJson(packageJsonPath);
|
|
4150
4241
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
4151
|
-
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess',
|
|
4242
|
+
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _258 => _258.exports]), exportKey);
|
|
4152
4243
|
const candidates = /* @__PURE__ */ new Set();
|
|
4153
|
-
if (_optionalChain([exportTarget, 'optionalAccess',
|
|
4244
|
+
if (_optionalChain([exportTarget, 'optionalAccess', _259 => _259.startsWith, 'call', _260 => _260("./")])) {
|
|
4154
4245
|
candidates.add(_path2.default.resolve(packageDirectory, exportTarget));
|
|
4155
4246
|
}
|
|
4156
4247
|
if (packageSubpath) {
|
|
4157
4248
|
candidates.add(_path2.default.join(packageDirectory, packageSubpath));
|
|
4158
4249
|
} else {
|
|
4159
|
-
for (const entry of [_optionalChain([packageJson, 'optionalAccess',
|
|
4250
|
+
for (const entry of [_optionalChain([packageJson, 'optionalAccess', _261 => _261.browser]), _optionalChain([packageJson, 'optionalAccess', _262 => _262.module]), _optionalChain([packageJson, 'optionalAccess', _263 => _263.main])]) {
|
|
4160
4251
|
if (typeof entry === "string") candidates.add(_path2.default.resolve(packageDirectory, entry));
|
|
4161
4252
|
}
|
|
4162
4253
|
candidates.add(_path2.default.join(packageDirectory, "index"));
|
|
@@ -4221,7 +4312,7 @@ function resolvePackageExport(exportsField, exportKey) {
|
|
|
4221
4312
|
if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
|
|
4222
4313
|
const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
|
|
4223
4314
|
const target = resolveConditionalExportTarget(value);
|
|
4224
|
-
return _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
4315
|
+
return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _264 => _264.replace, 'call', _265 => _265("*", wildcard)]), () => ( null));
|
|
4225
4316
|
}
|
|
4226
4317
|
return null;
|
|
4227
4318
|
}
|
|
@@ -4264,7 +4355,7 @@ function resolveSourceCandidatePath(candidate) {
|
|
|
4264
4355
|
}
|
|
4265
4356
|
for (const sourcePath of paths) {
|
|
4266
4357
|
try {
|
|
4267
|
-
if (_optionalChain([_fs2.default, 'access',
|
|
4358
|
+
if (_optionalChain([_fs2.default, 'access', _266 => _266.statSync, 'call', _267 => _267(sourcePath, { throwIfNoEntry: false }), 'optionalAccess', _268 => _268.isFile, 'call', _269 => _269()])) return sourcePath;
|
|
4268
4359
|
} catch (e46) {
|
|
4269
4360
|
}
|
|
4270
4361
|
}
|
|
@@ -4273,7 +4364,7 @@ function resolveSourceCandidatePath(candidate) {
|
|
|
4273
4364
|
function isFarmPackageClientBoundary(importerPath, specifier, root) {
|
|
4274
4365
|
const imported = resolveImportedModule(importerPath, specifier, root);
|
|
4275
4366
|
if (imported.local || !imported.path) return false;
|
|
4276
|
-
return inspectPackageClientBoundary(imported.path, root
|
|
4367
|
+
return inspectPackageClientBoundary(imported.path, root).shouldHydrate;
|
|
4277
4368
|
}
|
|
4278
4369
|
var CLIENT_PACKAGE_SCAN_EXTENSIONS = /\.(?:[cm]?[jt]sx?)$/;
|
|
4279
4370
|
var CLIENT_PACKAGE_SCAN_SKIP = /* @__PURE__ */ new Set([
|
|
@@ -4369,11 +4460,37 @@ var clientReachableModules = /* @__PURE__ */ new Map();
|
|
|
4369
4460
|
function invalidateFarmClientReachableModules() {
|
|
4370
4461
|
clientReachableModules.clear();
|
|
4371
4462
|
}
|
|
4463
|
+
function isClientEntrySource(content) {
|
|
4464
|
+
return hasUseClientDirective(content) || hasHydrateExport(content);
|
|
4465
|
+
}
|
|
4466
|
+
function getClientReachableImports(content) {
|
|
4467
|
+
return getImportSpecifiers(content, { dynamic: true });
|
|
4468
|
+
}
|
|
4469
|
+
function noteFarmClientReachableModuleChange(file, event, options) {
|
|
4470
|
+
if (event !== "update") {
|
|
4471
|
+
invalidateFarmClientReachableModules();
|
|
4472
|
+
return;
|
|
4473
|
+
}
|
|
4474
|
+
const resolved = _path2.default.resolve(file);
|
|
4475
|
+
let content;
|
|
4476
|
+
for (const [key, scan] of clientReachableModules) {
|
|
4477
|
+
const read = scan.reads.get(resolved);
|
|
4478
|
+
if (!read) {
|
|
4479
|
+
if (options.appSource) clientReachableModules.delete(key);
|
|
4480
|
+
continue;
|
|
4481
|
+
}
|
|
4482
|
+
if (content === void 0) content = readIfExists(resolved);
|
|
4483
|
+
if (read.entry !== void 0 && read.entry !== isClientEntrySource(content) || read.imports !== void 0 && read.imports !== getClientReachableImports(content).join("\0")) {
|
|
4484
|
+
clientReachableModules.delete(key);
|
|
4485
|
+
}
|
|
4486
|
+
}
|
|
4487
|
+
}
|
|
4372
4488
|
function getFarmClientReachableModules(directory, root) {
|
|
4373
4489
|
const key = `${_path2.default.resolve(root)}\0${_path2.default.resolve(directory)}`;
|
|
4374
4490
|
const cached = clientReachableModules.get(key);
|
|
4375
|
-
if (cached) return cached;
|
|
4491
|
+
if (cached) return cached.modules;
|
|
4376
4492
|
const reachable = /* @__PURE__ */ new Set();
|
|
4493
|
+
const reads = /* @__PURE__ */ new Map();
|
|
4377
4494
|
const queue = [];
|
|
4378
4495
|
const walk2 = (current) => {
|
|
4379
4496
|
let entries;
|
|
@@ -4387,8 +4504,9 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
4387
4504
|
if (entry.isDirectory()) {
|
|
4388
4505
|
if (!entry.name.startsWith(".") && !CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
4389
4506
|
} else if (isScannedSourceFile(entry.name)) {
|
|
4390
|
-
const
|
|
4391
|
-
|
|
4507
|
+
const clientEntry = isClientEntrySource(readIfExists(file));
|
|
4508
|
+
reads.set(_path2.default.resolve(file), { entry: clientEntry });
|
|
4509
|
+
if (clientEntry) queue.push(file);
|
|
4392
4510
|
}
|
|
4393
4511
|
}
|
|
4394
4512
|
};
|
|
@@ -4397,14 +4515,18 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
4397
4515
|
const file = _path2.default.resolve(queue.pop());
|
|
4398
4516
|
if (reachable.has(file)) continue;
|
|
4399
4517
|
reachable.add(file);
|
|
4400
|
-
|
|
4518
|
+
const imports = getClientReachableImports(readIfExists(file));
|
|
4519
|
+
const read = reads.get(file);
|
|
4520
|
+
if (read) read.imports = imports.join("\0");
|
|
4521
|
+
else reads.set(file, { imports: imports.join("\0") });
|
|
4522
|
+
for (const specifier of imports) {
|
|
4401
4523
|
const imported = resolveImportedModule(file, specifier, root);
|
|
4402
4524
|
if (imported.local && imported.path && !reachable.has(_path2.default.resolve(imported.path))) {
|
|
4403
4525
|
queue.push(imported.path);
|
|
4404
4526
|
}
|
|
4405
4527
|
}
|
|
4406
4528
|
}
|
|
4407
|
-
clientReachableModules.set(key, reachable);
|
|
4529
|
+
clientReachableModules.set(key, { modules: reachable, reads });
|
|
4408
4530
|
return reachable;
|
|
4409
4531
|
}
|
|
4410
4532
|
function resolveFarmClientOptimizeDeps(directory, root) {
|
|
@@ -4414,7 +4536,7 @@ function resolveFarmClientOptimizeDeps(directory, root) {
|
|
|
4414
4536
|
const imports = scanFarmPackageImports(directory, root);
|
|
4415
4537
|
for (const specifier of imports.client) {
|
|
4416
4538
|
const fonts = findFarmServerBundledPackage(importer, specifier);
|
|
4417
|
-
if (_optionalChain([fonts, 'optionalAccess',
|
|
4539
|
+
if (_optionalChain([fonts, 'optionalAccess', _270 => _270.fonts])) {
|
|
4418
4540
|
exclude.add(fonts.name);
|
|
4419
4541
|
continue;
|
|
4420
4542
|
}
|
|
@@ -4490,13 +4612,13 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4490
4612
|
let projectRoot = process.cwd();
|
|
4491
4613
|
let sources;
|
|
4492
4614
|
const routeSourceFiles = () => {
|
|
4493
|
-
const clientRoutes = _optionalChain([farmApi, 'optionalAccess',
|
|
4494
|
-
if (_optionalChain([sources, 'optionalAccess',
|
|
4615
|
+
const clientRoutes = _optionalChain([farmApi, 'optionalAccess', _271 => _271.getProgrammaticClientRoutes, 'call', _272 => _272()]);
|
|
4616
|
+
if (_optionalChain([sources, 'optionalAccess', _273 => _273.for]) !== clientRoutes || !sources) {
|
|
4495
4617
|
sources = {
|
|
4496
4618
|
for: clientRoutes,
|
|
4497
4619
|
files: /* @__PURE__ */ new Set([
|
|
4498
4620
|
...routesFiles,
|
|
4499
|
-
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess',
|
|
4621
|
+
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess', _274 => _274.routeSourceFiles]), () => ( []))].map(resolvedFile)
|
|
4500
4622
|
])
|
|
4501
4623
|
};
|
|
4502
4624
|
}
|
|
@@ -4517,7 +4639,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4517
4639
|
configResolved(config) {
|
|
4518
4640
|
isBuild = config.command === "build";
|
|
4519
4641
|
projectRoot = config.root;
|
|
4520
|
-
farmApi = _optionalChain([config, 'access',
|
|
4642
|
+
farmApi = _optionalChain([config, 'access', _275 => _275.plugins, 'access', _276 => _276.find, 'call', _277 => _277((plugin) => plugin.name === "farm"), 'optionalAccess', _278 => _278.api]);
|
|
4521
4643
|
sources = void 0;
|
|
4522
4644
|
routesFiles = new Set(
|
|
4523
4645
|
_chunk52Q4OB4Acjs.getFarmSourceRoots.call(void 0, { ...options, root: _nullishCoalesce(options.root, () => ( config.root)) }).flatMap(
|
|
@@ -4530,7 +4652,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4530
4652
|
transform(code, id, transformOptions) {
|
|
4531
4653
|
const environment = resolveBuildEnvironment(
|
|
4532
4654
|
this,
|
|
4533
|
-
_optionalChain([transformOptions, 'optionalAccess',
|
|
4655
|
+
_optionalChain([transformOptions, 'optionalAccess', _279 => _279.ssr])
|
|
4534
4656
|
);
|
|
4535
4657
|
const parse3 = (source) => this.parse(source);
|
|
4536
4658
|
const result = transformEnvironmentFunctions({
|
|
@@ -4543,7 +4665,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4543
4665
|
if (environment === "client" && !isBuild && !_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id) && routeSourceFiles().has(moduleFile(id)) && !isProgrammaticRouteActionProxy(code)) {
|
|
4544
4666
|
this.error(routeSourceError(moduleFile(id)));
|
|
4545
4667
|
}
|
|
4546
|
-
if (environment === "server" && _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access',
|
|
4668
|
+
if (environment === "server" && _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access', _280 => _280.experimental, 'optionalAccess', _281 => _281.serverComponents])) === "islands" && isApplicationScript(id)) {
|
|
4547
4669
|
const file = id.split("?", 1)[0];
|
|
4548
4670
|
const root = _fs.realpathSync.call(void 0, _nullishCoalesce(options.root, () => ( projectRoot)));
|
|
4549
4671
|
const clientCode = getFarmClientReachableModules(root, root).has(_path2.default.resolve(file)) || _fs.existsSync.call(void 0, file) && hasUseClientDirective(_fs.readFileSync.call(void 0, file, "utf8"));
|
|
@@ -4577,7 +4699,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4577
4699
|
for (const id of this.getModuleIds()) {
|
|
4578
4700
|
if (_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
|
|
4579
4701
|
const chain = findClientNodeBuiltinChain(id, (moduleId) => {
|
|
4580
|
-
return _optionalChain([this, 'access',
|
|
4702
|
+
return _optionalChain([this, 'access', _282 => _282.getModuleInfo, 'call', _283 => _283(moduleId), 'optionalAccess', _284 => _284.importedIds]);
|
|
4581
4703
|
});
|
|
4582
4704
|
if (chain) {
|
|
4583
4705
|
this.error(
|
|
@@ -4595,8 +4717,8 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4595
4717
|
}
|
|
4596
4718
|
if (!forbidden.has(moduleFile(id))) continue;
|
|
4597
4719
|
const info = this.getModuleInfo(id);
|
|
4598
|
-
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess',
|
|
4599
|
-
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess',
|
|
4720
|
+
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess', _285 => _285.code]))) continue;
|
|
4721
|
+
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess', _286 => _286.importers, 'access', _287 => _287.map, 'call', _288 => _288(moduleFile)])));
|
|
4600
4722
|
}
|
|
4601
4723
|
}
|
|
4602
4724
|
};
|
|
@@ -4615,8 +4737,8 @@ function resolvedFile(filePath) {
|
|
|
4615
4737
|
}
|
|
4616
4738
|
}
|
|
4617
4739
|
function resolveBuildEnvironment(context, ssr) {
|
|
4618
|
-
if (_optionalChain([context, 'access',
|
|
4619
|
-
if (_optionalChain([context, 'access',
|
|
4740
|
+
if (_optionalChain([context, 'access', _289 => _289.environment, 'optionalAccess', _290 => _290.name]) === "client") return "client";
|
|
4741
|
+
if (_optionalChain([context, 'access', _291 => _291.environment, 'optionalAccess', _292 => _292.name]) === "rsc" || _optionalChain([context, 'access', _293 => _293.environment, 'optionalAccess', _294 => _294.name]) === "ssr") {
|
|
4620
4742
|
return "server";
|
|
4621
4743
|
}
|
|
4622
4744
|
return ssr ? "server" : "client";
|
|
@@ -4943,4 +5065,7 @@ function transformError(id, message) {
|
|
|
4943
5065
|
|
|
4944
5066
|
|
|
4945
5067
|
|
|
4946
|
-
|
|
5068
|
+
|
|
5069
|
+
|
|
5070
|
+
|
|
5071
|
+
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.getFarmSourceStamp = getFarmSourceStamp; exports.FarmSourceSnapshotStore = FarmSourceSnapshotStore; exports.withFarmSourceSnapshot = withFarmSourceSnapshot; exports.withFarmSourceSnapshotOf = withFarmSourceSnapshotOf; exports.memoizeInFarmSourceSnapshot = memoizeInFarmSourceSnapshot; exports.noteFarmSourceRead = noteFarmSourceRead; exports.traceFarmSourceReads = traceFarmSourceReads; exports.traceFarmSourceReadGroups = traceFarmSourceReadGroups; exports.rewriteFarmReactServerClientModuleImports = rewriteFarmReactServerClientModuleImports; exports.rewriteFarmReactServerImports = rewriteFarmReactServerImports; exports.invalidateFarmClientOnlyScan = invalidateFarmClientOnlyScan; exports.farmRelativeImportFiles = farmRelativeImportFiles; exports.usePackageScanCacheFile = usePackageScanCacheFile; exports.persistPackageScanCache = persistPackageScanCache; 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.bindPackageClientBoundaryCache = bindPackageClientBoundaryCache; exports.usePackageClientBoundaryCacheFile = usePackageClientBoundaryCacheFile; exports.resolvePackageClientBoundaryCacheFile = resolvePackageClientBoundaryCacheFile; exports.runWithPackageClientBoundaryCacheFile = runWithPackageClientBoundaryCacheFile; exports.runWithLatestPackageClientBoundaryCache = runWithLatestPackageClientBoundaryCache; exports.dropLatestPackageClientBoundaryCache = dropLatestPackageClientBoundaryCache; exports.setFarmRendererHydrationScope = setFarmRendererHydrationScope; 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.getClientModuleHydrationPlanKey = getClientModuleHydrationPlanKey; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.isFarmClientModulePlanUnchanged = isFarmClientModulePlanUnchanged; exports.getInstalledPackageDirectory = getInstalledPackageDirectory; exports.resolveImportedModule = resolveImportedModule; exports.isFarmPackageClientBoundary = isFarmPackageClientBoundary; exports.collectFarmClientPackageImports = collectFarmClientPackageImports; exports.collectFarmServerBundledPackageInfo = collectFarmServerBundledPackageInfo; exports.noteFarmClientReachableModuleChange = noteFarmClientReachableModuleChange; exports.getFarmClientReachableModules = getFarmClientReachableModules; exports.resolveFarmClientOptimizeDeps = resolveFarmClientOptimizeDeps; exports.createFarmDiagnostic = createFarmDiagnostic; exports.formatFarmDiagnostic = formatFarmDiagnostic; exports.createFarmSourceLocator = createFarmSourceLocator; exports.transformEnvironmentFunctions = transformEnvironmentFunctions; exports.farmEnvironmentFunctionsPlugin = farmEnvironmentFunctionsPlugin;
|