@farm.js/core 0.1.84 → 0.1.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{analyzer-7RNO3XKC.mjs → analyzer-I5S5YKHM.mjs} +2 -2
- package/dist/analyzer-OEMQSLYT.cjs +17 -0
- package/dist/{app.d-eSm7jgoc.d.mts → app.d-Bvpc2eJq.d.mts} +1 -1
- package/dist/{app.d-CVPu_hoD.d.ts → app.d-DEKpJEp4.d.ts} +1 -1
- package/dist/{chunk-CVZY4TLW.cjs → chunk-2NKNP4AH.cjs} +1 -1
- package/dist/{chunk-BRDGINBB.mjs → chunk-3TKGMIPX.mjs} +9 -9
- package/dist/{chunk-KXVMWLTC.mjs → chunk-45ANSCTO.mjs} +85 -15
- package/dist/{chunk-MYSH5Y4E.mjs → chunk-4IE3YK7U.mjs} +1 -1
- package/dist/{chunk-CWUQBECF.mjs → chunk-4SJ22WTT.mjs} +1 -1
- package/dist/{chunk-IRJSZAJB.mjs → chunk-7UTRNV6R.mjs} +1 -1
- package/dist/{chunk-Z37PDUJR.cjs → chunk-BAD6T5NU.cjs} +4 -4
- package/dist/{chunk-USMRAC72.cjs → chunk-BLZCAFGJ.cjs} +2 -2
- package/dist/{chunk-M5XU22PQ.mjs → chunk-CFKAYV7B.mjs} +1 -1
- package/dist/{chunk-MAPHNGTF.cjs → chunk-CPSFDQKJ.cjs} +3 -3
- package/dist/{chunk-3WM7VBGW.mjs → chunk-CVKTYG4L.mjs} +2 -2
- package/dist/{chunk-BOEDYXAX.cjs → chunk-FDU4Q4QP.cjs} +7 -7
- package/dist/{chunk-DSWSDDP2.cjs → chunk-FWLXYNWA.cjs} +379 -309
- package/dist/{chunk-I5CVJ24H.mjs → chunk-GWPANDW3.mjs} +1 -1
- package/dist/{chunk-BCCCPFHQ.mjs → chunk-HV6CYSMF.mjs} +3 -0
- package/dist/{chunk-5I4ZGKP2.cjs → chunk-IAERD73G.cjs} +161 -156
- package/dist/{chunk-EDBIBO67.mjs → chunk-KHIEGVG7.mjs} +1 -1
- package/dist/{chunk-HOQ2MYBJ.cjs → chunk-L2IULWKV.cjs} +9 -9
- package/dist/{chunk-57EEWWUS.cjs → chunk-NXOZRI3B.cjs} +2 -2
- package/dist/{chunk-OFVBMS6I.cjs → chunk-P253SZJF.cjs} +93 -93
- package/dist/{chunk-NLHSKKTT.mjs → chunk-PAENAKTC.mjs} +1 -1
- package/dist/{chunk-OP7BIEUW.cjs → chunk-Q3YWQEUS.cjs} +2 -2
- package/dist/{chunk-EBSL5TW7.cjs → chunk-QYDGIXQ5.cjs} +146 -88
- package/dist/{chunk-DFDQGHPU.mjs → chunk-QYWP5KDY.mjs} +17 -12
- package/dist/{chunk-INU4K4U4.mjs → chunk-RA5OUXOJ.mjs} +2 -2
- package/dist/{chunk-XLULEFRW.mjs → chunk-SB74WCKC.mjs} +67 -9
- package/dist/{chunk-3OKSEJ33.cjs → chunk-T7UC2ORA.cjs} +3 -0
- package/dist/{chunk-22BTYPIX.cjs → chunk-TQJ35BBW.cjs} +4 -4
- package/dist/{chunk-BZY3SRRD.mjs → chunk-UAQQUQWE.mjs} +1 -1
- package/dist/{chunk-YU6VL7H5.cjs → chunk-UDWBTABT.cjs} +3 -3
- package/dist/{chunk-F7JVO3OZ.cjs → chunk-VGZIIOU6.cjs} +4 -4
- package/dist/{chunk-RQ6XX5IN.mjs → chunk-VTEAUQMT.mjs} +1 -1
- package/dist/{chunk-L3BSHASB.cjs → chunk-XMVZXZ32.cjs} +4 -4
- package/dist/{chunk-MUUDHWQZ.mjs → chunk-YMAE32O7.mjs} +1 -1
- package/dist/{chunk-L5HDCDFT.mjs → chunk-YNPVG2GG.mjs} +1 -1
- package/dist/{chunk-GLNVLCUH.cjs → chunk-ZSVFI7JM.cjs} +6 -6
- package/dist/{client-component.d-DLknFP8l.d.ts → client-component.d-CZG02pIh.d.ts} +2 -1
- package/dist/{client-component.d-DLMCzmUx.d.mts → client-component.d-miqIXyQv.d.mts} +2 -1
- package/dist/{devtools-4SVIRV4P.cjs → devtools-A3L7WNTB.cjs} +4 -4
- package/dist/{devtools-MWQA5LVN.mjs → devtools-DGC2247E.mjs} +2 -2
- package/dist/docs.cjs +4 -4
- package/dist/docs.mjs +3 -3
- package/dist/environment/vite.cjs +4 -4
- package/dist/environment/vite.mjs +3 -3
- package/dist/index.cjs +18 -18
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +18 -18
- package/dist/internal/build-runtime.cjs +18 -18
- package/dist/internal/build-runtime.mjs +17 -17
- package/dist/internal/cli-runtime.cjs +6 -6
- package/dist/internal/cli-runtime.mjs +5 -5
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/config-runtime.cjs +4 -4
- package/dist/internal/config-runtime.mjs +3 -3
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-runtime.cjs +15 -8
- package/dist/internal/islands-runtime.d.mts +2 -3
- package/dist/internal/islands-runtime.d.ts +2 -3
- package/dist/internal/islands-runtime.mjs +15 -8
- package/dist/internal/islands-server-tree.cjs +8 -0
- package/dist/internal/islands-server-tree.d.mts +5 -0
- package/dist/internal/islands-server-tree.d.ts +5 -0
- package/dist/internal/islands-server-tree.mjs +8 -0
- package/dist/internal/islx-actions-server.d.mts +0 -3
- package/dist/internal/islx-actions-server.d.ts +0 -3
- 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 +7 -7
- package/dist/internal/production-runtime.mjs +8 -8
- package/dist/plugin.cjs +13 -13
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +12 -12
- package/dist/renderer.cjs +3 -3
- package/dist/renderer.d.mts +10 -2
- package/dist/renderer.d.ts +10 -2
- package/dist/renderer.mjs +2 -2
- package/dist/{rsc-pipeline-UT3Z2GDO.mjs → rsc-pipeline-BROS3NEB.mjs} +4 -4
- package/dist/{rsc-pipeline-OWBEZ7HB.cjs → rsc-pipeline-SNGPAXGW.cjs} +5 -5
- package/dist/{runtime-SRMQ46SK.cjs → runtime-7T5TRAWL.cjs} +9 -9
- package/dist/{runtime-F5I3WY3B.mjs → runtime-SLJLW37A.mjs} +4 -4
- package/dist/server.cjs +38 -38
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.mjs +14 -14
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +13 -13
- package/dist/vite.d.mts +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.mjs +12 -12
- package/package.json +6 -1
- package/dist/analyzer-PFKA5NI6.cjs +0 -17
|
@@ -17,7 +17,7 @@ var _chunk52Q4OB4Acjs = require('./chunk-52Q4OB4A.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkT7UC2ORAcjs = require('./chunk-T7UC2ORA.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -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 _chunk2NKNP4AHcjs = require('./chunk-2NKNP4AH.cjs');
|
|
32
32
|
|
|
33
33
|
// src/environment-vite.ts
|
|
34
34
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -863,6 +863,7 @@ function farmReactServerBuildReachesClientModules(importer, specifier, serverImp
|
|
|
863
863
|
var IMPORT_SPECIFIER = /(?:\bfrom\s*|\bimport\s*\(?\s*)["']([^"'./][^"']*)["']/g;
|
|
864
864
|
var STYLESHEET_IMPORT = /(?:\bfrom\s*|\bimport\s*\(?\s*|\brequire\s*\(\s*)["'][^"']+\.(?:css|scss|sass|less|styl)["']/;
|
|
865
865
|
var MAX_SCANNED_FILES = 2e3;
|
|
866
|
+
var FARM_FONT_MODULE = "@farm.js/core/font";
|
|
866
867
|
var packageScans = /* @__PURE__ */ new Map();
|
|
867
868
|
var PACKAGE_SCAN_CACHE_SCHEMA = 1;
|
|
868
869
|
var packageScanStamps = /* @__PURE__ */ new Map();
|
|
@@ -885,7 +886,7 @@ function usePackageScanCacheFile(file) {
|
|
|
885
886
|
const stored = /* @__PURE__ */ new Map();
|
|
886
887
|
try {
|
|
887
888
|
const value = JSON.parse(_fs2.default.readFileSync(file, "utf8"));
|
|
888
|
-
if (_optionalChain([value, 'optionalAccess', _68 => _68.schema]) === PACKAGE_SCAN_CACHE_SCHEMA && value.farm ===
|
|
889
|
+
if (_optionalChain([value, 'optionalAccess', _68 => _68.schema]) === PACKAGE_SCAN_CACHE_SCHEMA && value.farm === _chunk2NKNP4AHcjs.FARM_VERSION && value.scans && typeof value.scans === "object") {
|
|
889
890
|
for (const [directory, scan] of Object.entries(value.scans)) {
|
|
890
891
|
if (isStoredPackageScan(scan)) stored.set(directory, scan);
|
|
891
892
|
}
|
|
@@ -914,7 +915,7 @@ function persistPackageScanCache() {
|
|
|
914
915
|
_fs2.default.mkdirSync(_path2.default.dirname(cache2.file), { recursive: true });
|
|
915
916
|
_fs2.default.writeFileSync(
|
|
916
917
|
temporary,
|
|
917
|
-
JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm:
|
|
918
|
+
JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm: _chunk2NKNP4AHcjs.FARM_VERSION, scans })
|
|
918
919
|
);
|
|
919
920
|
_fs2.default.renameSync(temporary, cache2.file);
|
|
920
921
|
cache2.dirty = false;
|
|
@@ -987,7 +988,10 @@ function findFarmServerBundledPackage(importer, specifier) {
|
|
|
987
988
|
} catch (e17) {
|
|
988
989
|
return null;
|
|
989
990
|
}
|
|
990
|
-
|
|
991
|
+
const scan = scanPackage(directory);
|
|
992
|
+
if (scan.imports.has(FARM_FONT_MODULE))
|
|
993
|
+
return { name: parsed.name, prebundle: false, fonts: true };
|
|
994
|
+
return scan.stylesheets ? { name: parsed.name, prebundle: false } : null;
|
|
991
995
|
}
|
|
992
996
|
function isSelfContainedPackage(manifest, importer) {
|
|
993
997
|
if (Object.keys(_nullishCoalesce(manifest.dependencies, () => ( {}))).length > 0) return false;
|
|
@@ -2214,7 +2218,7 @@ var PackageClientBoundaryCache = class {
|
|
|
2214
2218
|
}
|
|
2215
2219
|
const contents = JSON.stringify({
|
|
2216
2220
|
schema: SCHEMA_VERSION,
|
|
2217
|
-
farm:
|
|
2221
|
+
farm: _chunk2NKNP4AHcjs.FARM_VERSION,
|
|
2218
2222
|
paths,
|
|
2219
2223
|
entries
|
|
2220
2224
|
});
|
|
@@ -2254,7 +2258,7 @@ function readStoredCache(file) {
|
|
|
2254
2258
|
} catch (e37) {
|
|
2255
2259
|
return null;
|
|
2256
2260
|
}
|
|
2257
|
-
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !==
|
|
2261
|
+
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunk2NKNP4AHcjs.FARM_VERSION) {
|
|
2258
2262
|
return null;
|
|
2259
2263
|
}
|
|
2260
2264
|
const { paths, entries } = value;
|
|
@@ -2265,7 +2269,7 @@ function readStoredCache(file) {
|
|
|
2265
2269
|
const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
|
|
2266
2270
|
if (usable.length > 0) valid[key] = usable;
|
|
2267
2271
|
}
|
|
2268
|
-
return { schema: SCHEMA_VERSION, farm:
|
|
2272
|
+
return { schema: SCHEMA_VERSION, farm: _chunk2NKNP4AHcjs.FARM_VERSION, paths, entries: valid };
|
|
2269
2273
|
}
|
|
2270
2274
|
function isRecord(value) {
|
|
2271
2275
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -2348,7 +2352,7 @@ function setFarmRendererHydrationScope(roots, renderer, routeModules) {
|
|
|
2348
2352
|
const ruleSetsHydration = routeModules.some(
|
|
2349
2353
|
(entry) => _optionalChain([entry, 'access', _120 => _120.hydration, 'optionalAccess', _121 => _121.hydrate]) !== void 0 || _optionalChain([entry, 'access', _122 => _122.hydration, 'optionalAccess', _123 => _123.strategy]) !== void 0
|
|
2350
2354
|
);
|
|
2351
|
-
if (!_optionalChain([renderer, 'optionalAccess', _124 => _124.hydration]) && !ruleSetsHydration) {
|
|
2355
|
+
if (!_optionalChain([renderer, 'optionalAccess', _124 => _124.hydration]) && !_optionalChain([renderer, 'optionalAccess', _125 => _125.compile]) && !ruleSetsHydration) {
|
|
2352
2356
|
for (const key of keys) scopes.delete(key);
|
|
2353
2357
|
return () => {
|
|
2354
2358
|
};
|
|
@@ -2379,7 +2383,7 @@ function findScope(file) {
|
|
|
2379
2383
|
if (file !== root && !file.startsWith(`${root}${_path2.default.sep}`)) continue;
|
|
2380
2384
|
if (!match || root.length > match.length) match = { length: root.length, scope };
|
|
2381
2385
|
}
|
|
2382
|
-
return _nullishCoalesce(_optionalChain([match, 'optionalAccess',
|
|
2386
|
+
return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _126 => _126.scope]), () => ( null));
|
|
2383
2387
|
}
|
|
2384
2388
|
function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
2385
2389
|
if (scopes.size === 0) return null;
|
|
@@ -2388,7 +2392,7 @@ function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
|
2388
2392
|
if (!scope) return null;
|
|
2389
2393
|
const route = scope.routeModules.get(file);
|
|
2390
2394
|
const options = scope.renderer.hydration;
|
|
2391
|
-
const own = _optionalChain([options, 'optionalAccess',
|
|
2395
|
+
const own = _optionalChain([options, 'optionalAccess', _127 => _127.resolve]) && scope.extensions.has(_path2.default.extname(file).toLowerCase()) ? readOwnHydration(scope, content, file) : {};
|
|
2392
2396
|
if (!route && own.hydrate === void 0 && own.strategy === void 0) return null;
|
|
2393
2397
|
const source = readSource();
|
|
2394
2398
|
const where = `${file} sets its hydration twice`;
|
|
@@ -2402,9 +2406,9 @@ function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
|
2402
2406
|
`${where}: \`export const island = "${source.strategy}"\` and renderer \`${scope.renderer.name}\`'s syntax, which says "${own.strategy}". Keep one of them.`
|
|
2403
2407
|
);
|
|
2404
2408
|
}
|
|
2405
|
-
const kindDefault = _optionalChain([route, 'optionalAccess',
|
|
2406
|
-
const hydrate = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(own.hydrate, () => ( source.hydrate)), () => ( _optionalChain([route, 'optionalAccess',
|
|
2407
|
-
const strategy = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(own.strategy, () => ( source.strategy)), () => ( _optionalChain([route, 'optionalAccess',
|
|
2409
|
+
const kindDefault = _optionalChain([route, 'optionalAccess', _128 => _128.kind]) === "page" ? _optionalChain([options, 'optionalAccess', _129 => _129.pages]) : _optionalChain([route, 'optionalAccess', _130 => _130.kind]) === "layout" ? _optionalChain([options, 'optionalAccess', _131 => _131.layouts]) : void 0;
|
|
2410
|
+
const hydrate = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(own.hydrate, () => ( source.hydrate)), () => ( _optionalChain([route, 'optionalAccess', _132 => _132.hydration, 'access', _133 => _133.hydrate]))), () => ( kindDefault)), () => ( false));
|
|
2411
|
+
const strategy = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(own.strategy, () => ( source.strategy)), () => ( _optionalChain([route, 'optionalAccess', _134 => _134.hydration, 'access', _135 => _135.strategy]))), () => ( ((hydrate || source.clientDirective) && route ? _optionalChain([options, 'optionalAccess', _136 => _136.strategy]) : void 0))), () => ( null));
|
|
2408
2412
|
return { hydrate, strategy };
|
|
2409
2413
|
}
|
|
2410
2414
|
function readOwnHydration(scope, content, file) {
|
|
@@ -2413,7 +2417,7 @@ function readOwnHydration(scope, content, file) {
|
|
|
2413
2417
|
try {
|
|
2414
2418
|
value = scope.renderer.hydration.resolve(content, file);
|
|
2415
2419
|
} catch (error) {
|
|
2416
|
-
throw
|
|
2420
|
+
throw _chunkT7UC2ORAcjs.createFarmRendererHookError.call(void 0,
|
|
2417
2421
|
`${where} threw: ${error instanceof Error ? error.message : String(error)}`,
|
|
2418
2422
|
error
|
|
2419
2423
|
);
|
|
@@ -2424,11 +2428,53 @@ function readOwnHydration(scope, content, file) {
|
|
|
2424
2428
|
`${where} returned ${JSON.stringify(value)}. Return \`{ hydrate?, strategy? }\`, or nothing to leave the file to Farm.`
|
|
2425
2429
|
);
|
|
2426
2430
|
}
|
|
2427
|
-
return
|
|
2431
|
+
return _chunkT7UC2ORAcjs.readFarmRendererHydration.call(void 0, value, where);
|
|
2432
|
+
}
|
|
2433
|
+
function mayCompileFarmRendererSource(file) {
|
|
2434
|
+
if (scopes.size === 0) return false;
|
|
2435
|
+
const extension = _path2.default.extname(file).toLowerCase();
|
|
2436
|
+
for (const scope of scopes.values()) {
|
|
2437
|
+
if (scope.renderer.compile && scope.extensions.has(extension)) return true;
|
|
2438
|
+
}
|
|
2439
|
+
return false;
|
|
2440
|
+
}
|
|
2441
|
+
function compileFarmRendererSource(content, sourcePath) {
|
|
2442
|
+
if (scopes.size === 0) return content;
|
|
2443
|
+
const file = realPath(sourcePath);
|
|
2444
|
+
const scope = findScope(file);
|
|
2445
|
+
const compile = _optionalChain([scope, 'optionalAccess', _137 => _137.renderer, 'access', _138 => _138.compile]);
|
|
2446
|
+
if (!scope || !compile || !scope.extensions.has(_path2.default.extname(file).toLowerCase())) {
|
|
2447
|
+
return content;
|
|
2448
|
+
}
|
|
2449
|
+
const where = `Renderer \`${scope.renderer.name}\` compile() for ${file}`;
|
|
2450
|
+
let value;
|
|
2451
|
+
try {
|
|
2452
|
+
value = compile.call(scope.renderer, content, file);
|
|
2453
|
+
} catch (error) {
|
|
2454
|
+
throw _chunkT7UC2ORAcjs.createFarmRendererHookError.call(void 0,
|
|
2455
|
+
`${where} threw: ${error instanceof Error ? error.message : String(error)}`,
|
|
2456
|
+
error
|
|
2457
|
+
);
|
|
2458
|
+
}
|
|
2459
|
+
if (typeof value !== "string") {
|
|
2460
|
+
throw new TypeError(
|
|
2461
|
+
`${where} returned ${value === null ? "null" : typeof value}. Return the module the file compiles to, as JavaScript or TSX source.`
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
return value;
|
|
2428
2465
|
}
|
|
2429
2466
|
|
|
2430
2467
|
// src/utils/client-component.ts
|
|
2431
2468
|
function readIfExists(filePath) {
|
|
2469
|
+
const source = readSourceIfExists(filePath);
|
|
2470
|
+
if (source === null || !mayCompileFarmRendererSource(filePath)) return source;
|
|
2471
|
+
return memoizeInFarmSourceSnapshot(
|
|
2472
|
+
"compiled-source",
|
|
2473
|
+
`${filePath}\0${source}`,
|
|
2474
|
+
() => compileFarmRendererSource(source, filePath)
|
|
2475
|
+
);
|
|
2476
|
+
}
|
|
2477
|
+
function readSourceIfExists(filePath) {
|
|
2432
2478
|
if (filePath.replace(/\\/g, "/").includes(FARM_CLIENT_REFERENCE_DIRECTORY)) {
|
|
2433
2479
|
return readSourceFile(filePath);
|
|
2434
2480
|
}
|
|
@@ -2457,9 +2503,9 @@ function scanMarkdownCode(content) {
|
|
|
2457
2503
|
let inCode = false;
|
|
2458
2504
|
for (; index < lines.length; index++) {
|
|
2459
2505
|
const line = lines[index];
|
|
2460
|
-
const marker = _optionalChain([/^ {0,3}(`{3,}|~{3,})/, 'access',
|
|
2506
|
+
const marker = _optionalChain([/^ {0,3}(`{3,}|~{3,})/, 'access', _139 => _139.exec, 'call', _140 => _140(line), 'optionalAccess', _141 => _141[1]]);
|
|
2461
2507
|
if (fence) {
|
|
2462
|
-
if (_optionalChain([marker, 'optionalAccess',
|
|
2508
|
+
if (_optionalChain([marker, 'optionalAccess', _142 => _142[0]]) === fence[0] && marker.length >= fence.length && line.trim() === marker) {
|
|
2463
2509
|
fence = null;
|
|
2464
2510
|
}
|
|
2465
2511
|
} else if (inCode) {
|
|
@@ -2511,7 +2557,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
2511
2557
|
candidates.add(_path2.default.join(root, normalized));
|
|
2512
2558
|
candidates.add(_path2.default.resolve(root, normalized));
|
|
2513
2559
|
}
|
|
2514
|
-
if (_optionalChain([withoutQuery, 'optionalAccess',
|
|
2560
|
+
if (_optionalChain([withoutQuery, 'optionalAccess', _143 => _143.startsWith, 'call', _144 => _144("/src/")])) {
|
|
2515
2561
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
2516
2562
|
candidates.add(_path2.default.join(process.cwd(), normalized));
|
|
2517
2563
|
candidates.add(_path2.default.resolve(process.cwd(), normalized));
|
|
@@ -2524,7 +2570,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
2524
2570
|
return null;
|
|
2525
2571
|
}
|
|
2526
2572
|
function getFarmClientHydrationPlanOptions(renderer, hasUnsupportedIntegrationProvider) {
|
|
2527
|
-
return { asyncOwnerIslands:
|
|
2573
|
+
return { asyncOwnerIslands: _chunkT7UC2ORAcjs.isReactRenderer.call(void 0, renderer) && !hasUnsupportedIntegrationProvider };
|
|
2528
2574
|
}
|
|
2529
2575
|
function describeSuppressedAsyncHydration(subject, reason) {
|
|
2530
2576
|
const remediation = reason ? "Fix the reason above, or render the interactive UI from a synchronous owner." : 'Move the interactive UI into an eligible "use client" boundary, or render it from a synchronous owner.';
|
|
@@ -2581,7 +2627,7 @@ function hasUseClientDirective(content) {
|
|
|
2581
2627
|
return false;
|
|
2582
2628
|
}
|
|
2583
2629
|
function hasHydrateExport(content) {
|
|
2584
|
-
return _optionalChain([_chunkWMRGIQTAcjs.readFarmHydrateExport.call(void 0, content), 'optionalAccess',
|
|
2630
|
+
return _optionalChain([_chunkWMRGIQTAcjs.readFarmHydrateExport.call(void 0, content), 'optionalAccess', _145 => _145.value]) === true;
|
|
2585
2631
|
}
|
|
2586
2632
|
var REGEXP_PREFIX_PUNCTUATION = /* @__PURE__ */ new Set([
|
|
2587
2633
|
"(",
|
|
@@ -2770,7 +2816,7 @@ function isIslandExportStart(tokens, index) {
|
|
|
2770
2816
|
const token = tokens[index];
|
|
2771
2817
|
const previous = tokens[index - 1];
|
|
2772
2818
|
const startsStatement = !previous || previous.value === ";" || previous.value === "{" || previous.value === "}" || token.line > previous.line;
|
|
2773
|
-
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access',
|
|
2819
|
+
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access', _146 => _146[index + 1], 'optionalAccess', _147 => _147.value]) === "const" && _optionalChain([tokens, 'access', _148 => _148[index + 2], 'optionalAccess', _149 => _149.value]) === "island";
|
|
2774
2820
|
}
|
|
2775
2821
|
function getIslandStrategyExport(content) {
|
|
2776
2822
|
if (!content) return null;
|
|
@@ -2778,15 +2824,15 @@ function getIslandStrategyExport(content) {
|
|
|
2778
2824
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2779
2825
|
if (!isIslandExportStart(tokens, index)) continue;
|
|
2780
2826
|
let valueIndex = index + 3;
|
|
2781
|
-
if (_optionalChain([tokens, 'access',
|
|
2827
|
+
if (_optionalChain([tokens, 'access', _150 => _150[valueIndex], 'optionalAccess', _151 => _151.value]) === ":") {
|
|
2782
2828
|
while (valueIndex < tokens.length && tokens[valueIndex].value !== "=") valueIndex++;
|
|
2783
2829
|
}
|
|
2784
|
-
if (_optionalChain([tokens, 'access',
|
|
2830
|
+
if (_optionalChain([tokens, 'access', _152 => _152[valueIndex], 'optionalAccess', _153 => _153.value]) !== "=") break;
|
|
2785
2831
|
valueIndex++;
|
|
2786
2832
|
const literal = tokens[valueIndex];
|
|
2787
2833
|
if (!literal || literal.kind !== "string" || !_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, literal.value)) break;
|
|
2788
2834
|
let trailingIndex = valueIndex + 1;
|
|
2789
|
-
if (_optionalChain([tokens, 'access',
|
|
2835
|
+
if (_optionalChain([tokens, 'access', _154 => _154[trailingIndex], 'optionalAccess', _155 => _155.value]) === "as" && _optionalChain([tokens, 'access', _156 => _156[trailingIndex + 1], 'optionalAccess', _157 => _157.value]) === "const") {
|
|
2790
2836
|
trailingIndex += 2;
|
|
2791
2837
|
}
|
|
2792
2838
|
const trailing = tokens[trailingIndex];
|
|
@@ -2812,13 +2858,13 @@ function hasAsyncDefaultExport(content) {
|
|
|
2812
2858
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2813
2859
|
const token = tokens[index];
|
|
2814
2860
|
if (token.kind !== "identifier" || token.value !== "export") continue;
|
|
2815
|
-
if (_optionalChain([tokens, 'access',
|
|
2816
|
-
if (_optionalChain([tokens, 'access',
|
|
2861
|
+
if (_optionalChain([tokens, 'access', _158 => _158[index - 1], 'optionalAccess', _159 => _159.value]) === ".") continue;
|
|
2862
|
+
if (_optionalChain([tokens, 'access', _160 => _160[index + 1], 'optionalAccess', _161 => _161.value]) !== "default") continue;
|
|
2817
2863
|
const exported = tokens[index + 2];
|
|
2818
2864
|
if (exported.kind === "identifier" && exported.value === "async") {
|
|
2819
2865
|
return true;
|
|
2820
2866
|
}
|
|
2821
|
-
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access',
|
|
2867
|
+
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access', _162 => _162[index + 3], 'optionalAccess', _163 => _163.value]) !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
|
|
2822
2868
|
return true;
|
|
2823
2869
|
}
|
|
2824
2870
|
}
|
|
@@ -2826,10 +2872,10 @@ function hasAsyncDefaultExport(content) {
|
|
|
2826
2872
|
}
|
|
2827
2873
|
function isAsyncLocalDeclaration(tokens, name) {
|
|
2828
2874
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2829
|
-
if (tokens[index].value === "async" && _optionalChain([tokens, 'access',
|
|
2875
|
+
if (tokens[index].value === "async" && _optionalChain([tokens, 'access', _164 => _164[index + 1], 'optionalAccess', _165 => _165.value]) === "function" && _optionalChain([tokens, 'access', _166 => _166[index + 2], 'optionalAccess', _167 => _167.value]) === name) {
|
|
2830
2876
|
return true;
|
|
2831
2877
|
}
|
|
2832
|
-
if (tokens[index].value === name && _optionalChain([tokens, 'access',
|
|
2878
|
+
if (tokens[index].value === name && _optionalChain([tokens, 'access', _168 => _168[index + 1], 'optionalAccess', _169 => _169.value]) === "=" && _optionalChain([tokens, 'access', _170 => _170[index + 2], 'optionalAccess', _171 => _171.value]) === "async") {
|
|
2833
2879
|
return true;
|
|
2834
2880
|
}
|
|
2835
2881
|
}
|
|
@@ -2848,11 +2894,18 @@ function parseClientModuleMetadata(content, inspectIslandExport, sourcePath) {
|
|
|
2848
2894
|
if (inspectIslandExport && hydrate && hydrate.value === null) {
|
|
2849
2895
|
throw new Error(_chunkWMRGIQTAcjs.formatFarmHydrateExportError.call(void 0, hydrate, sourcePath));
|
|
2850
2896
|
}
|
|
2851
|
-
const rendererHydration = inspectIslandExport && sourcePath ?
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2897
|
+
const rendererHydration = inspectIslandExport && sourcePath ? (
|
|
2898
|
+
// The renderer's own syntax is read from the file as written, before its `compile()`.
|
|
2899
|
+
resolveFarmRendererModuleHydration(
|
|
2900
|
+
mayCompileFarmRendererSource(sourcePath) && readSourceIfExists(sourcePath) || content,
|
|
2901
|
+
sourcePath,
|
|
2902
|
+
() => ({
|
|
2903
|
+
hydrate: typeof _optionalChain([hydrate, 'optionalAccess', _172 => _172.value]) === "boolean" ? hydrate.value : void 0,
|
|
2904
|
+
strategy: getIslandStrategyExport(content),
|
|
2905
|
+
clientDirective: isClientComponent
|
|
2906
|
+
})
|
|
2907
|
+
)
|
|
2908
|
+
) : null;
|
|
2856
2909
|
if (rendererHydration) {
|
|
2857
2910
|
return {
|
|
2858
2911
|
isClientComponent,
|
|
@@ -2860,7 +2913,7 @@ function parseClientModuleMetadata(content, inspectIslandExport, sourcePath) {
|
|
|
2860
2913
|
islandStrategy: rendererHydration.strategy
|
|
2861
2914
|
};
|
|
2862
2915
|
}
|
|
2863
|
-
const hasHydrate = _optionalChain([hydrate, 'optionalAccess',
|
|
2916
|
+
const hasHydrate = _optionalChain([hydrate, 'optionalAccess', _173 => _173.value]) === true;
|
|
2864
2917
|
return {
|
|
2865
2918
|
isClientComponent,
|
|
2866
2919
|
hasHydrateExport: hasHydrate,
|
|
@@ -3063,7 +3116,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
3063
3116
|
return plan;
|
|
3064
3117
|
}
|
|
3065
3118
|
function usesFarmServerTree(plan) {
|
|
3066
|
-
return _optionalChain([plan, 'optionalAccess',
|
|
3119
|
+
return _optionalChain([plan, 'optionalAccess', _174 => _174.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0;
|
|
3067
3120
|
}
|
|
3068
3121
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
3069
3122
|
const plan = {
|
|
@@ -3218,7 +3271,7 @@ function getStaticImportBindings(content) {
|
|
|
3218
3271
|
if (!content) return bindings;
|
|
3219
3272
|
const tokens = tokenizeModuleSource(content);
|
|
3220
3273
|
for (let index = 0; index < tokens.length; index++) {
|
|
3221
|
-
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access',
|
|
3274
|
+
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _175 => _175[index - 1], 'optionalAccess', _176 => _176.value]) === ".") continue;
|
|
3222
3275
|
const first = tokens[index + 1];
|
|
3223
3276
|
if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
|
|
3224
3277
|
continue;
|
|
@@ -3226,7 +3279,7 @@ function getStaticImportBindings(content) {
|
|
|
3226
3279
|
let fromIndex = -1;
|
|
3227
3280
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
3228
3281
|
if (tokens[cursor].value === ";") break;
|
|
3229
|
-
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access',
|
|
3282
|
+
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _177 => _177[cursor + 1], 'optionalAccess', _178 => _178.kind]) === "string") {
|
|
3230
3283
|
fromIndex = cursor;
|
|
3231
3284
|
break;
|
|
3232
3285
|
}
|
|
@@ -3235,13 +3288,13 @@ function getStaticImportBindings(content) {
|
|
|
3235
3288
|
const specifier = tokens[fromIndex + 1].value;
|
|
3236
3289
|
const clause = tokens.slice(index + 1, fromIndex);
|
|
3237
3290
|
const localNames = [];
|
|
3238
|
-
if (_optionalChain([clause, 'access',
|
|
3291
|
+
if (_optionalChain([clause, 'access', _179 => _179[0], 'optionalAccess', _180 => _180.kind]) === "identifier" && clause[0].value !== "type") {
|
|
3239
3292
|
localNames.push(clause[0].value);
|
|
3240
3293
|
}
|
|
3241
3294
|
const namespaceAs = clause.findIndex(
|
|
3242
|
-
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access',
|
|
3295
|
+
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _181 => _181[clauseIndex + 1], 'optionalAccess', _182 => _182.value]) === "as"
|
|
3243
3296
|
);
|
|
3244
|
-
if (namespaceAs !== -1 && _optionalChain([clause, 'access',
|
|
3297
|
+
if (namespaceAs !== -1 && _optionalChain([clause, 'access', _183 => _183[namespaceAs + 2], 'optionalAccess', _184 => _184.kind]) === "identifier") {
|
|
3245
3298
|
localNames.push(clause[namespaceAs + 2].value);
|
|
3246
3299
|
}
|
|
3247
3300
|
const openingBrace = clause.findIndex((token) => token.value === "{");
|
|
@@ -3251,11 +3304,11 @@ function getStaticImportBindings(content) {
|
|
|
3251
3304
|
if (openingBrace !== -1 && closingBrace !== -1) {
|
|
3252
3305
|
let entryStart = openingBrace + 1;
|
|
3253
3306
|
for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
|
|
3254
|
-
if (cursor !== closingBrace && _optionalChain([clause, 'access',
|
|
3307
|
+
if (cursor !== closingBrace && _optionalChain([clause, 'access', _185 => _185[cursor], 'optionalAccess', _186 => _186.value]) !== ",") continue;
|
|
3255
3308
|
const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
|
|
3256
3309
|
const asIndex = entry.findIndex((token) => token.value === "as");
|
|
3257
3310
|
const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
|
|
3258
|
-
if (_optionalChain([local, 'optionalAccess',
|
|
3311
|
+
if (_optionalChain([local, 'optionalAccess', _187 => _187.kind]) === "identifier") localNames.push(local.value);
|
|
3259
3312
|
entryStart = cursor + 1;
|
|
3260
3313
|
}
|
|
3261
3314
|
}
|
|
@@ -3292,7 +3345,7 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
3292
3345
|
const open = [];
|
|
3293
3346
|
const isSelfClosing = (openingIndex) => {
|
|
3294
3347
|
for (let index = openingIndex; index < tokens.length; index++) {
|
|
3295
|
-
if (tokens[index].value === ">") return _optionalChain([tokens, 'access',
|
|
3348
|
+
if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _188 => _188[index - 1], 'optionalAccess', _189 => _189.value]) === "/";
|
|
3296
3349
|
}
|
|
3297
3350
|
return false;
|
|
3298
3351
|
};
|
|
@@ -3300,7 +3353,7 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
3300
3353
|
if (tokens[index].value !== "<") continue;
|
|
3301
3354
|
if (tokens[index + 1].value === "/") {
|
|
3302
3355
|
const closing = tokens[index + 2];
|
|
3303
|
-
const at = _optionalChain([closing, 'optionalAccess',
|
|
3356
|
+
const at = _optionalChain([closing, 'optionalAccess', _190 => _190.kind]) === "identifier" ? open.lastIndexOf(closing.value) : -1;
|
|
3304
3357
|
if (at !== -1) open.length = at;
|
|
3305
3358
|
continue;
|
|
3306
3359
|
}
|
|
@@ -3343,7 +3396,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
|
|
|
3343
3396
|
}
|
|
3344
3397
|
function containsClientJsx(tokens, start, end, clientBindings) {
|
|
3345
3398
|
for (let index = start; index < end; index++) {
|
|
3346
|
-
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access',
|
|
3399
|
+
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _191 => _191[index + 1], 'optionalAccess', _192 => _192.value]))) return true;
|
|
3347
3400
|
}
|
|
3348
3401
|
return false;
|
|
3349
3402
|
}
|
|
@@ -3381,7 +3434,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
3381
3434
|
let helperName;
|
|
3382
3435
|
let bodyStart = -1;
|
|
3383
3436
|
let bodyEnd = -1;
|
|
3384
|
-
if (tokens[index].value === "function" && _optionalChain([tokens, 'access',
|
|
3437
|
+
if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _193 => _193[index + 1], 'optionalAccess', _194 => _194.kind]) === "identifier") {
|
|
3385
3438
|
helperName = tokens[index + 1].value;
|
|
3386
3439
|
const parametersStart = tokens.findIndex(
|
|
3387
3440
|
(token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
|
|
@@ -3391,21 +3444,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
3391
3444
|
(token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
|
|
3392
3445
|
);
|
|
3393
3446
|
if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
|
|
3394
|
-
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access',
|
|
3447
|
+
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _195 => _195[index + 1], 'optionalAccess', _196 => _196.kind]) === "identifier") {
|
|
3395
3448
|
helperName = tokens[index + 1].value;
|
|
3396
3449
|
let assignmentIndex = -1;
|
|
3397
3450
|
let arrowIndex = -1;
|
|
3398
3451
|
for (let cursor = index + 2; cursor < tokens.length; cursor++) {
|
|
3399
3452
|
if (tokens[cursor].value === ";") break;
|
|
3400
3453
|
if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
|
|
3401
|
-
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access',
|
|
3454
|
+
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _197 => _197[cursor + 1], 'optionalAccess', _198 => _198.value]) === ">") {
|
|
3402
3455
|
arrowIndex = cursor;
|
|
3403
3456
|
break;
|
|
3404
3457
|
}
|
|
3405
3458
|
}
|
|
3406
3459
|
if (arrowIndex !== -1) {
|
|
3407
3460
|
bodyStart = arrowIndex + 2;
|
|
3408
|
-
bodyEnd = _optionalChain([tokens, 'access',
|
|
3461
|
+
bodyEnd = _optionalChain([tokens, 'access', _199 => _199[bodyStart], 'optionalAccess', _200 => _200.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
|
|
3409
3462
|
} else if (assignmentIndex !== -1) {
|
|
3410
3463
|
bodyStart = assignmentIndex + 1;
|
|
3411
3464
|
bodyEnd = findStatementEnd(tokens, bodyStart);
|
|
@@ -3445,14 +3498,14 @@ function passesElementValuedProps(content, localBindings) {
|
|
|
3445
3498
|
else if (value === "}") braceDepth--;
|
|
3446
3499
|
else if (value === "<" && braceDepth > 0) return true;
|
|
3447
3500
|
else if (value === ">" && braceDepth === 0) {
|
|
3448
|
-
selfClosing = _optionalChain([tokens, 'access',
|
|
3501
|
+
selfClosing = _optionalChain([tokens, 'access', _201 => _201[cursor - 1], 'optionalAccess', _202 => _202.value]) === "/";
|
|
3449
3502
|
break;
|
|
3450
3503
|
}
|
|
3451
3504
|
}
|
|
3452
3505
|
if (selfClosing || cursor >= tokens.length) continue;
|
|
3453
3506
|
for (let child = cursor + 1; child < tokens.length; child++) {
|
|
3454
3507
|
if (tokens[child].value !== "<") continue;
|
|
3455
|
-
const closesBoundary = _optionalChain([tokens, 'access',
|
|
3508
|
+
const closesBoundary = _optionalChain([tokens, 'access', _203 => _203[child + 1], 'optionalAccess', _204 => _204.value]) === "/" && _optionalChain([tokens, 'access', _205 => _205[child + 2], 'optionalAccess', _206 => _206.value]) === name;
|
|
3456
3509
|
if (!closesBoundary) return true;
|
|
3457
3510
|
break;
|
|
3458
3511
|
}
|
|
@@ -3474,7 +3527,7 @@ function rendersOnlyLeafElements(content, localBindings) {
|
|
|
3474
3527
|
else if (value === "<" && braceDepth > 0) return false;
|
|
3475
3528
|
else if (value === ">" && braceDepth === 0) break;
|
|
3476
3529
|
}
|
|
3477
|
-
if (cursor >= tokens.length || _optionalChain([tokens, 'access',
|
|
3530
|
+
if (cursor >= tokens.length || _optionalChain([tokens, 'access', _207 => _207[cursor - 1], 'optionalAccess', _208 => _208.value]) !== "/") return false;
|
|
3478
3531
|
}
|
|
3479
3532
|
return true;
|
|
3480
3533
|
}
|
|
@@ -3486,9 +3539,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
3486
3539
|
const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
|
|
3487
3540
|
for (let index = 0; index < tokens.length; index++) {
|
|
3488
3541
|
let callStart = -1;
|
|
3489
|
-
if (tokens[index].value === "." && (_optionalChain([tokens, 'access',
|
|
3542
|
+
if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _209 => _209[index + 1], 'optionalAccess', _210 => _210.value]) === "map" || _optionalChain([tokens, 'access', _211 => _211[index + 1], 'optionalAccess', _212 => _212.value]) === "flatMap") && _optionalChain([tokens, 'access', _213 => _213[index + 2], 'optionalAccess', _214 => _214.value]) === "(") {
|
|
3490
3543
|
callStart = index + 2;
|
|
3491
|
-
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access',
|
|
3544
|
+
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _215 => _215[index + 1], 'optionalAccess', _216 => _216.value]) === "." && _optionalChain([tokens, 'access', _217 => _217[index + 2], 'optionalAccess', _218 => _218.value]) === "from" && _optionalChain([tokens, 'access', _219 => _219[index + 3], 'optionalAccess', _220 => _220.value]) === "(") {
|
|
3492
3545
|
callStart = index + 3;
|
|
3493
3546
|
}
|
|
3494
3547
|
if (callStart !== -1) {
|
|
@@ -3497,10 +3550,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
3497
3550
|
index = callEnd;
|
|
3498
3551
|
continue;
|
|
3499
3552
|
}
|
|
3500
|
-
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access',
|
|
3553
|
+
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _221 => _221[index + 1], 'optionalAccess', _222 => _222.value]) === "(") {
|
|
3501
3554
|
const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
|
|
3502
3555
|
const bodyStart = conditionEnd + 1;
|
|
3503
|
-
const bodyEnd = _optionalChain([tokens, 'access',
|
|
3556
|
+
const bodyEnd = _optionalChain([tokens, 'access', _223 => _223[bodyStart], 'optionalAccess', _224 => _224.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
|
|
3504
3557
|
if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
|
|
3505
3558
|
}
|
|
3506
3559
|
}
|
|
@@ -3619,7 +3672,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3619
3672
|
const localBindings = _nullishCoalesce(importedBindings.get(specifier), () => ( []));
|
|
3620
3673
|
const staticUses = countStaticJsxUses(content, localBindings);
|
|
3621
3674
|
if (staticUses > 0) {
|
|
3622
|
-
const grows = options.packageReferences === true && projectRoot !== void 0 && (_nullishCoalesce(_optionalChain([findFarmIslandContainers, 'call',
|
|
3675
|
+
const grows = options.packageReferences === true && projectRoot !== void 0 && (_nullishCoalesce(_optionalChain([findFarmIslandContainers, 'call', _225 => _225(_nullishCoalesce(content, () => ( "")), moduleSourcePath, localBindings), 'optionalAccess', _226 => _226.length]), () => ( 0))) > 0;
|
|
3623
3676
|
if (grows) visit(ensureFarmIslandContainerReference(projectRoot));
|
|
3624
3677
|
const container = grows ? void 0 : findParserSensitiveJsxContainer(content, localBindings);
|
|
3625
3678
|
if (container) {
|
|
@@ -3745,7 +3798,7 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
3745
3798
|
}
|
|
3746
3799
|
function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
3747
3800
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
3748
|
-
if (resolvedPath) _optionalChain([trace2, 'optionalAccess',
|
|
3801
|
+
if (resolvedPath) _optionalChain([trace2, 'optionalAccess', _227 => _227.stop, 'call', _228 => _228(resolvedPath)]);
|
|
3749
3802
|
return {
|
|
3750
3803
|
isClientComponent: false,
|
|
3751
3804
|
shouldHydrate: false,
|
|
@@ -3753,7 +3806,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
|
3753
3806
|
};
|
|
3754
3807
|
}
|
|
3755
3808
|
visited.add(resolvedPath);
|
|
3756
|
-
_optionalChain([trace2, 'optionalAccess',
|
|
3809
|
+
_optionalChain([trace2, 'optionalAccess', _229 => _229.visit, 'call', _230 => _230(resolvedPath)]);
|
|
3757
3810
|
const content = readIfExists(resolvedPath);
|
|
3758
3811
|
const parsed = parseClientModuleMetadata(content, false);
|
|
3759
3812
|
let importsClientBoundary = false;
|
|
@@ -3811,7 +3864,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3811
3864
|
braceDepth = Math.max(0, braceDepth - 1);
|
|
3812
3865
|
continue;
|
|
3813
3866
|
}
|
|
3814
|
-
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access',
|
|
3867
|
+
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access', _231 => _231[index - 1], 'optionalAccess', _232 => _232.value]) !== "." && _optionalChain([tokens, 'access', _233 => _233[index + 1], 'optionalAccess', _234 => _234.value]) === "(" && _optionalChain([tokens, 'access', _235 => _235[index + 2], 'optionalAccess', _236 => _236.kind]) === "string") {
|
|
3815
3868
|
matches.add(tokens[index + 2].value);
|
|
3816
3869
|
continue;
|
|
3817
3870
|
}
|
|
@@ -3821,7 +3874,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3821
3874
|
}
|
|
3822
3875
|
if (reexportsOnly && keyword.value !== "export") continue;
|
|
3823
3876
|
const previous = tokens[index - 1];
|
|
3824
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
3877
|
+
if (_optionalChain([previous, 'optionalAccess', _237 => _237.value]) === ".") continue;
|
|
3825
3878
|
const first = tokens[index + 1];
|
|
3826
3879
|
if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
|
|
3827
3880
|
continue;
|
|
@@ -3837,7 +3890,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3837
3890
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
3838
3891
|
const token = tokens[cursor];
|
|
3839
3892
|
if (token.value === ";") break;
|
|
3840
|
-
if (token.value === "from" && _optionalChain([tokens, 'access',
|
|
3893
|
+
if (token.value === "from" && _optionalChain([tokens, 'access', _238 => _238[cursor + 1], 'optionalAccess', _239 => _239.kind]) === "string") {
|
|
3841
3894
|
fromIndex = cursor;
|
|
3842
3895
|
break;
|
|
3843
3896
|
}
|
|
@@ -3855,14 +3908,14 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3855
3908
|
return Array.from(matches);
|
|
3856
3909
|
}
|
|
3857
3910
|
function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
3858
|
-
if (_optionalChain([tokens, 'access',
|
|
3911
|
+
if (_optionalChain([tokens, 'access', _240 => _240[startIndex], 'optionalAccess', _241 => _241.value]) !== "{") return false;
|
|
3859
3912
|
const closingBraceIndex = tokens.findIndex(
|
|
3860
3913
|
(token, index) => index > startIndex && index < endIndex && token.value === "}"
|
|
3861
3914
|
);
|
|
3862
3915
|
if (closingBraceIndex === -1) return false;
|
|
3863
3916
|
let entryStartsAt = startIndex + 1;
|
|
3864
3917
|
for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
|
|
3865
|
-
if (index !== closingBraceIndex && _optionalChain([tokens, 'access',
|
|
3918
|
+
if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _242 => _242[index], 'optionalAccess', _243 => _243.value]) !== ",") continue;
|
|
3866
3919
|
const entry = tokens.slice(entryStartsAt, index);
|
|
3867
3920
|
if (entry.length > 0 && entry[0].value !== "type") return false;
|
|
3868
3921
|
entryStartsAt = index + 1;
|
|
@@ -3943,7 +3996,7 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3943
3996
|
const sourceDir = _chunkMNUYXZV7cjs.getFarmProjectSourceDir.call(void 0, projectRoot);
|
|
3944
3997
|
const cacheStamp = `${stamp}:${sourceDir}`;
|
|
3945
3998
|
const cached = projectImportAliasCache.get(projectRoot);
|
|
3946
|
-
if (_optionalChain([cached, 'optionalAccess',
|
|
3999
|
+
if (_optionalChain([cached, 'optionalAccess', _244 => _244.stamp]) === cacheStamp) return cached.aliases;
|
|
3947
4000
|
const aliases = [
|
|
3948
4001
|
...readTsconfigPathAliases(projectRoot),
|
|
3949
4002
|
...readPackageImportAliases(projectRoot)
|
|
@@ -3964,7 +4017,7 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
3964
4017
|
const configPath = _path2.default.join(projectRoot, name);
|
|
3965
4018
|
if (!_fs2.default.existsSync(configPath)) continue;
|
|
3966
4019
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
3967
|
-
if (!_optionalChain([resolved, 'optionalAccess',
|
|
4020
|
+
if (!_optionalChain([resolved, 'optionalAccess', _245 => _245.paths])) return [];
|
|
3968
4021
|
const base2 = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
|
|
3969
4022
|
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
3970
4023
|
if (!Array.isArray(targets)) return [];
|
|
@@ -3999,18 +4052,18 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
3999
4052
|
inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
|
|
4000
4053
|
}
|
|
4001
4054
|
const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
|
|
4002
|
-
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess',
|
|
4055
|
+
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _246 => _246.baseUrl]);
|
|
4003
4056
|
if (options.paths && typeof options.paths === "object") {
|
|
4004
4057
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
4005
4058
|
}
|
|
4006
4059
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
4007
4060
|
}
|
|
4008
4061
|
function readPackageImportAliases(projectRoot) {
|
|
4009
|
-
const imports = _optionalChain([readPackageJson, 'call',
|
|
4062
|
+
const imports = _optionalChain([readPackageJson, 'call', _247 => _247(_path2.default.join(projectRoot, "package.json")), 'optionalAccess', _248 => _248.imports]);
|
|
4010
4063
|
if (!imports || typeof imports !== "object") return [];
|
|
4011
4064
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
4012
4065
|
const target = resolveConditionalExportTarget(value);
|
|
4013
|
-
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess',
|
|
4066
|
+
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _249 => _249.startsWith, 'call', _250 => _250("./")])) return [];
|
|
4014
4067
|
const wildcardIndex = pattern.indexOf("*");
|
|
4015
4068
|
return [
|
|
4016
4069
|
{
|
|
@@ -4076,15 +4129,15 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
4076
4129
|
const packageJsonPath = _path2.default.join(packageDirectory, "package.json");
|
|
4077
4130
|
const packageJson = readPackageJson(packageJsonPath);
|
|
4078
4131
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
4079
|
-
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess',
|
|
4132
|
+
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _251 => _251.exports]), exportKey);
|
|
4080
4133
|
const candidates = /* @__PURE__ */ new Set();
|
|
4081
|
-
if (_optionalChain([exportTarget, 'optionalAccess',
|
|
4134
|
+
if (_optionalChain([exportTarget, 'optionalAccess', _252 => _252.startsWith, 'call', _253 => _253("./")])) {
|
|
4082
4135
|
candidates.add(_path2.default.resolve(packageDirectory, exportTarget));
|
|
4083
4136
|
}
|
|
4084
4137
|
if (packageSubpath) {
|
|
4085
4138
|
candidates.add(_path2.default.join(packageDirectory, packageSubpath));
|
|
4086
4139
|
} else {
|
|
4087
|
-
for (const entry of [_optionalChain([packageJson, 'optionalAccess',
|
|
4140
|
+
for (const entry of [_optionalChain([packageJson, 'optionalAccess', _254 => _254.browser]), _optionalChain([packageJson, 'optionalAccess', _255 => _255.module]), _optionalChain([packageJson, 'optionalAccess', _256 => _256.main])]) {
|
|
4088
4141
|
if (typeof entry === "string") candidates.add(_path2.default.resolve(packageDirectory, entry));
|
|
4089
4142
|
}
|
|
4090
4143
|
candidates.add(_path2.default.join(packageDirectory, "index"));
|
|
@@ -4149,7 +4202,7 @@ function resolvePackageExport(exportsField, exportKey) {
|
|
|
4149
4202
|
if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
|
|
4150
4203
|
const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
|
|
4151
4204
|
const target = resolveConditionalExportTarget(value);
|
|
4152
|
-
return _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
4205
|
+
return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _257 => _257.replace, 'call', _258 => _258("*", wildcard)]), () => ( null));
|
|
4153
4206
|
}
|
|
4154
4207
|
return null;
|
|
4155
4208
|
}
|
|
@@ -4192,7 +4245,7 @@ function resolveSourceCandidatePath(candidate) {
|
|
|
4192
4245
|
}
|
|
4193
4246
|
for (const sourcePath of paths) {
|
|
4194
4247
|
try {
|
|
4195
|
-
if (_optionalChain([_fs2.default, 'access',
|
|
4248
|
+
if (_optionalChain([_fs2.default, 'access', _259 => _259.statSync, 'call', _260 => _260(sourcePath, { throwIfNoEntry: false }), 'optionalAccess', _261 => _261.isFile, 'call', _262 => _262()])) return sourcePath;
|
|
4196
4249
|
} catch (e47) {
|
|
4197
4250
|
}
|
|
4198
4251
|
}
|
|
@@ -4341,6 +4394,11 @@ function resolveFarmClientOptimizeDeps(directory, root) {
|
|
|
4341
4394
|
const exclude = /* @__PURE__ */ new Set();
|
|
4342
4395
|
const imports = scanFarmPackageImports(directory, root);
|
|
4343
4396
|
for (const specifier of imports.client) {
|
|
4397
|
+
const fonts = findFarmServerBundledPackage(importer, specifier);
|
|
4398
|
+
if (_optionalChain([fonts, 'optionalAccess', _263 => _263.fonts])) {
|
|
4399
|
+
exclude.add(fonts.name);
|
|
4400
|
+
continue;
|
|
4401
|
+
}
|
|
4344
4402
|
const manifest = findFarmPackageManifest(importer, specifier);
|
|
4345
4403
|
if (manifest && farmReactServerBuildReachesClientModules(importer, specifier, imports.server.has(specifier))) {
|
|
4346
4404
|
exclude.add(manifest.name);
|
|
@@ -4406,20 +4464,20 @@ function transformEnvironmentFunctions(options) {
|
|
|
4406
4464
|
function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
4407
4465
|
let routesFiles = /* @__PURE__ */ new Set();
|
|
4408
4466
|
const componentExtensions = new Set(
|
|
4409
|
-
|
|
4467
|
+
_chunkT7UC2ORAcjs.getFarmRendererComponentExtensions.call(void 0, options.renderer || void 0)
|
|
4410
4468
|
);
|
|
4411
4469
|
let farmApi;
|
|
4412
4470
|
let isBuild = false;
|
|
4413
4471
|
let projectRoot = process.cwd();
|
|
4414
4472
|
let sources;
|
|
4415
4473
|
const routeSourceFiles = () => {
|
|
4416
|
-
const clientRoutes = _optionalChain([farmApi, 'optionalAccess',
|
|
4417
|
-
if (_optionalChain([sources, 'optionalAccess',
|
|
4474
|
+
const clientRoutes = _optionalChain([farmApi, 'optionalAccess', _264 => _264.getProgrammaticClientRoutes, 'call', _265 => _265()]);
|
|
4475
|
+
if (_optionalChain([sources, 'optionalAccess', _266 => _266.for]) !== clientRoutes || !sources) {
|
|
4418
4476
|
sources = {
|
|
4419
4477
|
for: clientRoutes,
|
|
4420
4478
|
files: /* @__PURE__ */ new Set([
|
|
4421
4479
|
...routesFiles,
|
|
4422
|
-
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess',
|
|
4480
|
+
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess', _267 => _267.routeSourceFiles]), () => ( []))].map(resolvedFile)
|
|
4423
4481
|
])
|
|
4424
4482
|
};
|
|
4425
4483
|
}
|
|
@@ -4440,7 +4498,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4440
4498
|
configResolved(config) {
|
|
4441
4499
|
isBuild = config.command === "build";
|
|
4442
4500
|
projectRoot = config.root;
|
|
4443
|
-
farmApi = _optionalChain([config, 'access',
|
|
4501
|
+
farmApi = _optionalChain([config, 'access', _268 => _268.plugins, 'access', _269 => _269.find, 'call', _270 => _270((plugin) => plugin.name === "farm"), 'optionalAccess', _271 => _271.api]);
|
|
4444
4502
|
sources = void 0;
|
|
4445
4503
|
routesFiles = new Set(
|
|
4446
4504
|
_chunk52Q4OB4Acjs.getFarmSourceRoots.call(void 0, { ...options, root: _nullishCoalesce(options.root, () => ( config.root)) }).flatMap(
|
|
@@ -4453,7 +4511,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4453
4511
|
transform(code, id, transformOptions) {
|
|
4454
4512
|
const environment = resolveBuildEnvironment(
|
|
4455
4513
|
this,
|
|
4456
|
-
_optionalChain([transformOptions, 'optionalAccess',
|
|
4514
|
+
_optionalChain([transformOptions, 'optionalAccess', _272 => _272.ssr])
|
|
4457
4515
|
);
|
|
4458
4516
|
const parse3 = (source) => this.parse(source);
|
|
4459
4517
|
const result = transformEnvironmentFunctions({
|
|
@@ -4466,7 +4524,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4466
4524
|
if (environment === "client" && !isBuild && !_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id) && routeSourceFiles().has(moduleFile(id)) && !isProgrammaticRouteActionProxy(code)) {
|
|
4467
4525
|
this.error(routeSourceError(moduleFile(id)));
|
|
4468
4526
|
}
|
|
4469
|
-
if (environment === "server" &&
|
|
4527
|
+
if (environment === "server" && _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access', _273 => _273.experimental, 'optionalAccess', _274 => _274.serverComponents])) === "islands" && isApplicationScript(id)) {
|
|
4470
4528
|
const file = id.split("?", 1)[0];
|
|
4471
4529
|
const root = _fs.realpathSync.call(void 0, _nullishCoalesce(options.root, () => ( projectRoot)));
|
|
4472
4530
|
const clientCode = getFarmClientReachableModules(root, root).has(_path2.default.resolve(file)) || _fs.existsSync.call(void 0, file) && hasUseClientDirective(_fs.readFileSync.call(void 0, file, "utf8"));
|
|
@@ -4500,7 +4558,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4500
4558
|
for (const id of this.getModuleIds()) {
|
|
4501
4559
|
if (_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
|
|
4502
4560
|
const chain = findClientNodeBuiltinChain(id, (moduleId) => {
|
|
4503
|
-
return _optionalChain([this, 'access',
|
|
4561
|
+
return _optionalChain([this, 'access', _275 => _275.getModuleInfo, 'call', _276 => _276(moduleId), 'optionalAccess', _277 => _277.importedIds]);
|
|
4504
4562
|
});
|
|
4505
4563
|
if (chain) {
|
|
4506
4564
|
this.error(
|
|
@@ -4518,8 +4576,8 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4518
4576
|
}
|
|
4519
4577
|
if (!forbidden.has(moduleFile(id))) continue;
|
|
4520
4578
|
const info = this.getModuleInfo(id);
|
|
4521
|
-
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess',
|
|
4522
|
-
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess',
|
|
4579
|
+
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess', _278 => _278.code]))) continue;
|
|
4580
|
+
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess', _279 => _279.importers, 'access', _280 => _280.map, 'call', _281 => _281(moduleFile)])));
|
|
4523
4581
|
}
|
|
4524
4582
|
}
|
|
4525
4583
|
};
|
|
@@ -4538,8 +4596,8 @@ function resolvedFile(filePath) {
|
|
|
4538
4596
|
}
|
|
4539
4597
|
}
|
|
4540
4598
|
function resolveBuildEnvironment(context, ssr) {
|
|
4541
|
-
if (_optionalChain([context, 'access',
|
|
4542
|
-
if (_optionalChain([context, 'access',
|
|
4599
|
+
if (_optionalChain([context, 'access', _282 => _282.environment, 'optionalAccess', _283 => _283.name]) === "client") return "client";
|
|
4600
|
+
if (_optionalChain([context, 'access', _284 => _284.environment, 'optionalAccess', _285 => _285.name]) === "rsc" || _optionalChain([context, 'access', _286 => _286.environment, 'optionalAccess', _287 => _287.name]) === "ssr") {
|
|
4543
4601
|
return "server";
|
|
4544
4602
|
}
|
|
4545
4603
|
return ssr ? "server" : "client";
|