@farm.js/core 0.1.85 → 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-R6KNJ6IO.mjs → analyzer-I5S5YKHM.mjs} +2 -2
- package/dist/analyzer-OEMQSLYT.cjs +17 -0
- package/dist/{chunk-3HWNYLQV.cjs → chunk-2NKNP4AH.cjs} +1 -1
- package/dist/{chunk-X7RSOEMQ.mjs → chunk-3TKGMIPX.mjs} +7 -7
- package/dist/{chunk-GFVPQ25Z.mjs → chunk-45ANSCTO.mjs} +12 -12
- package/dist/{chunk-MYSH5Y4E.mjs → chunk-4IE3YK7U.mjs} +1 -1
- package/dist/{chunk-CWUQBECF.mjs → chunk-4SJ22WTT.mjs} +1 -1
- package/dist/{chunk-PQR5A7R2.mjs → chunk-7UTRNV6R.mjs} +1 -1
- package/dist/{chunk-RVJQHQCG.cjs → chunk-BAD6T5NU.cjs} +4 -4
- package/dist/{chunk-HKJIUZS5.cjs → chunk-BLZCAFGJ.cjs} +2 -2
- package/dist/{chunk-YS647ASS.mjs → chunk-CFKAYV7B.mjs} +1 -1
- package/dist/{chunk-MAPHNGTF.cjs → chunk-CPSFDQKJ.cjs} +3 -3
- package/dist/{chunk-YX532KEF.mjs → chunk-CVKTYG4L.mjs} +2 -2
- package/dist/{chunk-BBX4RPOV.cjs → chunk-FDU4Q4QP.cjs} +7 -7
- package/dist/{chunk-UEQC4ZLP.cjs → chunk-FWLXYNWA.cjs} +164 -164
- package/dist/{chunk-XIXAUXV3.mjs → chunk-GWPANDW3.mjs} +1 -1
- package/dist/{chunk-BCCCPFHQ.mjs → chunk-HV6CYSMF.mjs} +3 -0
- package/dist/{chunk-WYTK7HQS.cjs → chunk-IAERD73G.cjs} +155 -155
- package/dist/{chunk-4QCMTIBM.mjs → chunk-KHIEGVG7.mjs} +1 -1
- package/dist/{chunk-7TPLDPNC.cjs → chunk-L2IULWKV.cjs} +9 -9
- package/dist/{chunk-BZN5HX7Y.cjs → chunk-NXOZRI3B.cjs} +2 -2
- package/dist/{chunk-H6C45DCF.cjs → chunk-P253SZJF.cjs} +93 -93
- package/dist/{chunk-Z3LOPHSO.mjs → chunk-PAENAKTC.mjs} +1 -1
- package/dist/{chunk-Q7GB3I4O.cjs → chunk-Q3YWQEUS.cjs} +2 -2
- package/dist/{chunk-OYM6VJEF.cjs → chunk-QYDGIXQ5.cjs} +137 -88
- package/dist/{chunk-U6HUVY5R.mjs → chunk-QYWP5KDY.mjs} +10 -10
- package/dist/{chunk-2DMOB6BH.mjs → chunk-RA5OUXOJ.mjs} +2 -2
- package/dist/{chunk-3TCFONUE.mjs → chunk-SB74WCKC.mjs} +57 -8
- package/dist/{chunk-3OKSEJ33.cjs → chunk-T7UC2ORA.cjs} +3 -0
- package/dist/{chunk-TOUC6BR3.cjs → chunk-TQJ35BBW.cjs} +4 -4
- package/dist/{chunk-CDZ55QRD.mjs → chunk-UAQQUQWE.mjs} +1 -1
- package/dist/{chunk-QUHDVJMR.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-J7VIXTPQ.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/{devtools-SXL5RFE5.cjs → devtools-A3L7WNTB.cjs} +4 -4
- package/dist/{devtools-34ZQWX3M.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 +17 -17
- package/dist/index.mjs +16 -16
- 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/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 +4 -4
- package/dist/internal/production-runtime.mjs +3 -3
- package/dist/plugin.cjs +13 -13
- 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-MW2V3WEE.mjs → rsc-pipeline-BROS3NEB.mjs} +4 -4
- package/dist/{rsc-pipeline-ESPGX4VX.cjs → rsc-pipeline-SNGPAXGW.cjs} +5 -5
- package/dist/{runtime-FCMLEBTX.cjs → runtime-7T5TRAWL.cjs} +9 -9
- package/dist/{runtime-KGSOEMLT.mjs → runtime-SLJLW37A.mjs} +4 -4
- package/dist/server.cjs +38 -38
- 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.mjs +12 -12
- package/package.json +1 -1
- package/dist/analyzer-XVY76XMM.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);
|
|
@@ -886,7 +886,7 @@ function usePackageScanCacheFile(file) {
|
|
|
886
886
|
const stored = /* @__PURE__ */ new Map();
|
|
887
887
|
try {
|
|
888
888
|
const value = JSON.parse(_fs2.default.readFileSync(file, "utf8"));
|
|
889
|
-
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") {
|
|
890
890
|
for (const [directory, scan] of Object.entries(value.scans)) {
|
|
891
891
|
if (isStoredPackageScan(scan)) stored.set(directory, scan);
|
|
892
892
|
}
|
|
@@ -915,7 +915,7 @@ function persistPackageScanCache() {
|
|
|
915
915
|
_fs2.default.mkdirSync(_path2.default.dirname(cache2.file), { recursive: true });
|
|
916
916
|
_fs2.default.writeFileSync(
|
|
917
917
|
temporary,
|
|
918
|
-
JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm:
|
|
918
|
+
JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm: _chunk2NKNP4AHcjs.FARM_VERSION, scans })
|
|
919
919
|
);
|
|
920
920
|
_fs2.default.renameSync(temporary, cache2.file);
|
|
921
921
|
cache2.dirty = false;
|
|
@@ -2218,7 +2218,7 @@ var PackageClientBoundaryCache = class {
|
|
|
2218
2218
|
}
|
|
2219
2219
|
const contents = JSON.stringify({
|
|
2220
2220
|
schema: SCHEMA_VERSION,
|
|
2221
|
-
farm:
|
|
2221
|
+
farm: _chunk2NKNP4AHcjs.FARM_VERSION,
|
|
2222
2222
|
paths,
|
|
2223
2223
|
entries
|
|
2224
2224
|
});
|
|
@@ -2258,7 +2258,7 @@ function readStoredCache(file) {
|
|
|
2258
2258
|
} catch (e37) {
|
|
2259
2259
|
return null;
|
|
2260
2260
|
}
|
|
2261
|
-
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !==
|
|
2261
|
+
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunk2NKNP4AHcjs.FARM_VERSION) {
|
|
2262
2262
|
return null;
|
|
2263
2263
|
}
|
|
2264
2264
|
const { paths, entries } = value;
|
|
@@ -2269,7 +2269,7 @@ function readStoredCache(file) {
|
|
|
2269
2269
|
const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
|
|
2270
2270
|
if (usable.length > 0) valid[key] = usable;
|
|
2271
2271
|
}
|
|
2272
|
-
return { schema: SCHEMA_VERSION, farm:
|
|
2272
|
+
return { schema: SCHEMA_VERSION, farm: _chunk2NKNP4AHcjs.FARM_VERSION, paths, entries: valid };
|
|
2273
2273
|
}
|
|
2274
2274
|
function isRecord(value) {
|
|
2275
2275
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -2352,7 +2352,7 @@ function setFarmRendererHydrationScope(roots, renderer, routeModules) {
|
|
|
2352
2352
|
const ruleSetsHydration = routeModules.some(
|
|
2353
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
|
|
2354
2354
|
);
|
|
2355
|
-
if (!_optionalChain([renderer, 'optionalAccess', _124 => _124.hydration]) && !ruleSetsHydration) {
|
|
2355
|
+
if (!_optionalChain([renderer, 'optionalAccess', _124 => _124.hydration]) && !_optionalChain([renderer, 'optionalAccess', _125 => _125.compile]) && !ruleSetsHydration) {
|
|
2356
2356
|
for (const key of keys) scopes.delete(key);
|
|
2357
2357
|
return () => {
|
|
2358
2358
|
};
|
|
@@ -2383,7 +2383,7 @@ function findScope(file) {
|
|
|
2383
2383
|
if (file !== root && !file.startsWith(`${root}${_path2.default.sep}`)) continue;
|
|
2384
2384
|
if (!match || root.length > match.length) match = { length: root.length, scope };
|
|
2385
2385
|
}
|
|
2386
|
-
return _nullishCoalesce(_optionalChain([match, 'optionalAccess',
|
|
2386
|
+
return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _126 => _126.scope]), () => ( null));
|
|
2387
2387
|
}
|
|
2388
2388
|
function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
2389
2389
|
if (scopes.size === 0) return null;
|
|
@@ -2392,7 +2392,7 @@ function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
|
2392
2392
|
if (!scope) return null;
|
|
2393
2393
|
const route = scope.routeModules.get(file);
|
|
2394
2394
|
const options = scope.renderer.hydration;
|
|
2395
|
-
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) : {};
|
|
2396
2396
|
if (!route && own.hydrate === void 0 && own.strategy === void 0) return null;
|
|
2397
2397
|
const source = readSource();
|
|
2398
2398
|
const where = `${file} sets its hydration twice`;
|
|
@@ -2406,9 +2406,9 @@ function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
|
2406
2406
|
`${where}: \`export const island = "${source.strategy}"\` and renderer \`${scope.renderer.name}\`'s syntax, which says "${own.strategy}". Keep one of them.`
|
|
2407
2407
|
);
|
|
2408
2408
|
}
|
|
2409
|
-
const kindDefault = _optionalChain([route, 'optionalAccess',
|
|
2410
|
-
const hydrate = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(own.hydrate, () => ( source.hydrate)), () => ( _optionalChain([route, 'optionalAccess',
|
|
2411
|
-
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));
|
|
2412
2412
|
return { hydrate, strategy };
|
|
2413
2413
|
}
|
|
2414
2414
|
function readOwnHydration(scope, content, file) {
|
|
@@ -2417,7 +2417,7 @@ function readOwnHydration(scope, content, file) {
|
|
|
2417
2417
|
try {
|
|
2418
2418
|
value = scope.renderer.hydration.resolve(content, file);
|
|
2419
2419
|
} catch (error) {
|
|
2420
|
-
throw
|
|
2420
|
+
throw _chunkT7UC2ORAcjs.createFarmRendererHookError.call(void 0,
|
|
2421
2421
|
`${where} threw: ${error instanceof Error ? error.message : String(error)}`,
|
|
2422
2422
|
error
|
|
2423
2423
|
);
|
|
@@ -2428,11 +2428,53 @@ function readOwnHydration(scope, content, file) {
|
|
|
2428
2428
|
`${where} returned ${JSON.stringify(value)}. Return \`{ hydrate?, strategy? }\`, or nothing to leave the file to Farm.`
|
|
2429
2429
|
);
|
|
2430
2430
|
}
|
|
2431
|
-
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;
|
|
2432
2465
|
}
|
|
2433
2466
|
|
|
2434
2467
|
// src/utils/client-component.ts
|
|
2435
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) {
|
|
2436
2478
|
if (filePath.replace(/\\/g, "/").includes(FARM_CLIENT_REFERENCE_DIRECTORY)) {
|
|
2437
2479
|
return readSourceFile(filePath);
|
|
2438
2480
|
}
|
|
@@ -2461,9 +2503,9 @@ function scanMarkdownCode(content) {
|
|
|
2461
2503
|
let inCode = false;
|
|
2462
2504
|
for (; index < lines.length; index++) {
|
|
2463
2505
|
const line = lines[index];
|
|
2464
|
-
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]]);
|
|
2465
2507
|
if (fence) {
|
|
2466
|
-
if (_optionalChain([marker, 'optionalAccess',
|
|
2508
|
+
if (_optionalChain([marker, 'optionalAccess', _142 => _142[0]]) === fence[0] && marker.length >= fence.length && line.trim() === marker) {
|
|
2467
2509
|
fence = null;
|
|
2468
2510
|
}
|
|
2469
2511
|
} else if (inCode) {
|
|
@@ -2515,7 +2557,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
2515
2557
|
candidates.add(_path2.default.join(root, normalized));
|
|
2516
2558
|
candidates.add(_path2.default.resolve(root, normalized));
|
|
2517
2559
|
}
|
|
2518
|
-
if (_optionalChain([withoutQuery, 'optionalAccess',
|
|
2560
|
+
if (_optionalChain([withoutQuery, 'optionalAccess', _143 => _143.startsWith, 'call', _144 => _144("/src/")])) {
|
|
2519
2561
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
2520
2562
|
candidates.add(_path2.default.join(process.cwd(), normalized));
|
|
2521
2563
|
candidates.add(_path2.default.resolve(process.cwd(), normalized));
|
|
@@ -2528,7 +2570,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
2528
2570
|
return null;
|
|
2529
2571
|
}
|
|
2530
2572
|
function getFarmClientHydrationPlanOptions(renderer, hasUnsupportedIntegrationProvider) {
|
|
2531
|
-
return { asyncOwnerIslands:
|
|
2573
|
+
return { asyncOwnerIslands: _chunkT7UC2ORAcjs.isReactRenderer.call(void 0, renderer) && !hasUnsupportedIntegrationProvider };
|
|
2532
2574
|
}
|
|
2533
2575
|
function describeSuppressedAsyncHydration(subject, reason) {
|
|
2534
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.';
|
|
@@ -2585,7 +2627,7 @@ function hasUseClientDirective(content) {
|
|
|
2585
2627
|
return false;
|
|
2586
2628
|
}
|
|
2587
2629
|
function hasHydrateExport(content) {
|
|
2588
|
-
return _optionalChain([_chunkWMRGIQTAcjs.readFarmHydrateExport.call(void 0, content), 'optionalAccess',
|
|
2630
|
+
return _optionalChain([_chunkWMRGIQTAcjs.readFarmHydrateExport.call(void 0, content), 'optionalAccess', _145 => _145.value]) === true;
|
|
2589
2631
|
}
|
|
2590
2632
|
var REGEXP_PREFIX_PUNCTUATION = /* @__PURE__ */ new Set([
|
|
2591
2633
|
"(",
|
|
@@ -2774,7 +2816,7 @@ function isIslandExportStart(tokens, index) {
|
|
|
2774
2816
|
const token = tokens[index];
|
|
2775
2817
|
const previous = tokens[index - 1];
|
|
2776
2818
|
const startsStatement = !previous || previous.value === ";" || previous.value === "{" || previous.value === "}" || token.line > previous.line;
|
|
2777
|
-
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";
|
|
2778
2820
|
}
|
|
2779
2821
|
function getIslandStrategyExport(content) {
|
|
2780
2822
|
if (!content) return null;
|
|
@@ -2782,15 +2824,15 @@ function getIslandStrategyExport(content) {
|
|
|
2782
2824
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2783
2825
|
if (!isIslandExportStart(tokens, index)) continue;
|
|
2784
2826
|
let valueIndex = index + 3;
|
|
2785
|
-
if (_optionalChain([tokens, 'access',
|
|
2827
|
+
if (_optionalChain([tokens, 'access', _150 => _150[valueIndex], 'optionalAccess', _151 => _151.value]) === ":") {
|
|
2786
2828
|
while (valueIndex < tokens.length && tokens[valueIndex].value !== "=") valueIndex++;
|
|
2787
2829
|
}
|
|
2788
|
-
if (_optionalChain([tokens, 'access',
|
|
2830
|
+
if (_optionalChain([tokens, 'access', _152 => _152[valueIndex], 'optionalAccess', _153 => _153.value]) !== "=") break;
|
|
2789
2831
|
valueIndex++;
|
|
2790
2832
|
const literal = tokens[valueIndex];
|
|
2791
2833
|
if (!literal || literal.kind !== "string" || !_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, literal.value)) break;
|
|
2792
2834
|
let trailingIndex = valueIndex + 1;
|
|
2793
|
-
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") {
|
|
2794
2836
|
trailingIndex += 2;
|
|
2795
2837
|
}
|
|
2796
2838
|
const trailing = tokens[trailingIndex];
|
|
@@ -2816,13 +2858,13 @@ function hasAsyncDefaultExport(content) {
|
|
|
2816
2858
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2817
2859
|
const token = tokens[index];
|
|
2818
2860
|
if (token.kind !== "identifier" || token.value !== "export") continue;
|
|
2819
|
-
if (_optionalChain([tokens, 'access',
|
|
2820
|
-
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;
|
|
2821
2863
|
const exported = tokens[index + 2];
|
|
2822
2864
|
if (exported.kind === "identifier" && exported.value === "async") {
|
|
2823
2865
|
return true;
|
|
2824
2866
|
}
|
|
2825
|
-
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)) {
|
|
2826
2868
|
return true;
|
|
2827
2869
|
}
|
|
2828
2870
|
}
|
|
@@ -2830,10 +2872,10 @@ function hasAsyncDefaultExport(content) {
|
|
|
2830
2872
|
}
|
|
2831
2873
|
function isAsyncLocalDeclaration(tokens, name) {
|
|
2832
2874
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2833
|
-
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) {
|
|
2834
2876
|
return true;
|
|
2835
2877
|
}
|
|
2836
|
-
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") {
|
|
2837
2879
|
return true;
|
|
2838
2880
|
}
|
|
2839
2881
|
}
|
|
@@ -2852,11 +2894,18 @@ function parseClientModuleMetadata(content, inspectIslandExport, sourcePath) {
|
|
|
2852
2894
|
if (inspectIslandExport && hydrate && hydrate.value === null) {
|
|
2853
2895
|
throw new Error(_chunkWMRGIQTAcjs.formatFarmHydrateExportError.call(void 0, hydrate, sourcePath));
|
|
2854
2896
|
}
|
|
2855
|
-
const rendererHydration = inspectIslandExport && sourcePath ?
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
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;
|
|
2860
2909
|
if (rendererHydration) {
|
|
2861
2910
|
return {
|
|
2862
2911
|
isClientComponent,
|
|
@@ -2864,7 +2913,7 @@ function parseClientModuleMetadata(content, inspectIslandExport, sourcePath) {
|
|
|
2864
2913
|
islandStrategy: rendererHydration.strategy
|
|
2865
2914
|
};
|
|
2866
2915
|
}
|
|
2867
|
-
const hasHydrate = _optionalChain([hydrate, 'optionalAccess',
|
|
2916
|
+
const hasHydrate = _optionalChain([hydrate, 'optionalAccess', _173 => _173.value]) === true;
|
|
2868
2917
|
return {
|
|
2869
2918
|
isClientComponent,
|
|
2870
2919
|
hasHydrateExport: hasHydrate,
|
|
@@ -3067,7 +3116,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
3067
3116
|
return plan;
|
|
3068
3117
|
}
|
|
3069
3118
|
function usesFarmServerTree(plan) {
|
|
3070
|
-
return _optionalChain([plan, 'optionalAccess',
|
|
3119
|
+
return _optionalChain([plan, 'optionalAccess', _174 => _174.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0;
|
|
3071
3120
|
}
|
|
3072
3121
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
3073
3122
|
const plan = {
|
|
@@ -3222,7 +3271,7 @@ function getStaticImportBindings(content) {
|
|
|
3222
3271
|
if (!content) return bindings;
|
|
3223
3272
|
const tokens = tokenizeModuleSource(content);
|
|
3224
3273
|
for (let index = 0; index < tokens.length; index++) {
|
|
3225
|
-
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;
|
|
3226
3275
|
const first = tokens[index + 1];
|
|
3227
3276
|
if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
|
|
3228
3277
|
continue;
|
|
@@ -3230,7 +3279,7 @@ function getStaticImportBindings(content) {
|
|
|
3230
3279
|
let fromIndex = -1;
|
|
3231
3280
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
3232
3281
|
if (tokens[cursor].value === ";") break;
|
|
3233
|
-
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") {
|
|
3234
3283
|
fromIndex = cursor;
|
|
3235
3284
|
break;
|
|
3236
3285
|
}
|
|
@@ -3239,13 +3288,13 @@ function getStaticImportBindings(content) {
|
|
|
3239
3288
|
const specifier = tokens[fromIndex + 1].value;
|
|
3240
3289
|
const clause = tokens.slice(index + 1, fromIndex);
|
|
3241
3290
|
const localNames = [];
|
|
3242
|
-
if (_optionalChain([clause, 'access',
|
|
3291
|
+
if (_optionalChain([clause, 'access', _179 => _179[0], 'optionalAccess', _180 => _180.kind]) === "identifier" && clause[0].value !== "type") {
|
|
3243
3292
|
localNames.push(clause[0].value);
|
|
3244
3293
|
}
|
|
3245
3294
|
const namespaceAs = clause.findIndex(
|
|
3246
|
-
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access',
|
|
3295
|
+
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _181 => _181[clauseIndex + 1], 'optionalAccess', _182 => _182.value]) === "as"
|
|
3247
3296
|
);
|
|
3248
|
-
if (namespaceAs !== -1 && _optionalChain([clause, 'access',
|
|
3297
|
+
if (namespaceAs !== -1 && _optionalChain([clause, 'access', _183 => _183[namespaceAs + 2], 'optionalAccess', _184 => _184.kind]) === "identifier") {
|
|
3249
3298
|
localNames.push(clause[namespaceAs + 2].value);
|
|
3250
3299
|
}
|
|
3251
3300
|
const openingBrace = clause.findIndex((token) => token.value === "{");
|
|
@@ -3255,11 +3304,11 @@ function getStaticImportBindings(content) {
|
|
|
3255
3304
|
if (openingBrace !== -1 && closingBrace !== -1) {
|
|
3256
3305
|
let entryStart = openingBrace + 1;
|
|
3257
3306
|
for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
|
|
3258
|
-
if (cursor !== closingBrace && _optionalChain([clause, 'access',
|
|
3307
|
+
if (cursor !== closingBrace && _optionalChain([clause, 'access', _185 => _185[cursor], 'optionalAccess', _186 => _186.value]) !== ",") continue;
|
|
3259
3308
|
const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
|
|
3260
3309
|
const asIndex = entry.findIndex((token) => token.value === "as");
|
|
3261
3310
|
const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
|
|
3262
|
-
if (_optionalChain([local, 'optionalAccess',
|
|
3311
|
+
if (_optionalChain([local, 'optionalAccess', _187 => _187.kind]) === "identifier") localNames.push(local.value);
|
|
3263
3312
|
entryStart = cursor + 1;
|
|
3264
3313
|
}
|
|
3265
3314
|
}
|
|
@@ -3296,7 +3345,7 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
3296
3345
|
const open = [];
|
|
3297
3346
|
const isSelfClosing = (openingIndex) => {
|
|
3298
3347
|
for (let index = openingIndex; index < tokens.length; index++) {
|
|
3299
|
-
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]) === "/";
|
|
3300
3349
|
}
|
|
3301
3350
|
return false;
|
|
3302
3351
|
};
|
|
@@ -3304,7 +3353,7 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
3304
3353
|
if (tokens[index].value !== "<") continue;
|
|
3305
3354
|
if (tokens[index + 1].value === "/") {
|
|
3306
3355
|
const closing = tokens[index + 2];
|
|
3307
|
-
const at = _optionalChain([closing, 'optionalAccess',
|
|
3356
|
+
const at = _optionalChain([closing, 'optionalAccess', _190 => _190.kind]) === "identifier" ? open.lastIndexOf(closing.value) : -1;
|
|
3308
3357
|
if (at !== -1) open.length = at;
|
|
3309
3358
|
continue;
|
|
3310
3359
|
}
|
|
@@ -3347,7 +3396,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
|
|
|
3347
3396
|
}
|
|
3348
3397
|
function containsClientJsx(tokens, start, end, clientBindings) {
|
|
3349
3398
|
for (let index = start; index < end; index++) {
|
|
3350
|
-
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;
|
|
3351
3400
|
}
|
|
3352
3401
|
return false;
|
|
3353
3402
|
}
|
|
@@ -3385,7 +3434,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
3385
3434
|
let helperName;
|
|
3386
3435
|
let bodyStart = -1;
|
|
3387
3436
|
let bodyEnd = -1;
|
|
3388
|
-
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") {
|
|
3389
3438
|
helperName = tokens[index + 1].value;
|
|
3390
3439
|
const parametersStart = tokens.findIndex(
|
|
3391
3440
|
(token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
|
|
@@ -3395,21 +3444,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
3395
3444
|
(token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
|
|
3396
3445
|
);
|
|
3397
3446
|
if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
|
|
3398
|
-
} 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") {
|
|
3399
3448
|
helperName = tokens[index + 1].value;
|
|
3400
3449
|
let assignmentIndex = -1;
|
|
3401
3450
|
let arrowIndex = -1;
|
|
3402
3451
|
for (let cursor = index + 2; cursor < tokens.length; cursor++) {
|
|
3403
3452
|
if (tokens[cursor].value === ";") break;
|
|
3404
3453
|
if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
|
|
3405
|
-
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access',
|
|
3454
|
+
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _197 => _197[cursor + 1], 'optionalAccess', _198 => _198.value]) === ">") {
|
|
3406
3455
|
arrowIndex = cursor;
|
|
3407
3456
|
break;
|
|
3408
3457
|
}
|
|
3409
3458
|
}
|
|
3410
3459
|
if (arrowIndex !== -1) {
|
|
3411
3460
|
bodyStart = arrowIndex + 2;
|
|
3412
|
-
bodyEnd = _optionalChain([tokens, 'access',
|
|
3461
|
+
bodyEnd = _optionalChain([tokens, 'access', _199 => _199[bodyStart], 'optionalAccess', _200 => _200.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
|
|
3413
3462
|
} else if (assignmentIndex !== -1) {
|
|
3414
3463
|
bodyStart = assignmentIndex + 1;
|
|
3415
3464
|
bodyEnd = findStatementEnd(tokens, bodyStart);
|
|
@@ -3449,14 +3498,14 @@ function passesElementValuedProps(content, localBindings) {
|
|
|
3449
3498
|
else if (value === "}") braceDepth--;
|
|
3450
3499
|
else if (value === "<" && braceDepth > 0) return true;
|
|
3451
3500
|
else if (value === ">" && braceDepth === 0) {
|
|
3452
|
-
selfClosing = _optionalChain([tokens, 'access',
|
|
3501
|
+
selfClosing = _optionalChain([tokens, 'access', _201 => _201[cursor - 1], 'optionalAccess', _202 => _202.value]) === "/";
|
|
3453
3502
|
break;
|
|
3454
3503
|
}
|
|
3455
3504
|
}
|
|
3456
3505
|
if (selfClosing || cursor >= tokens.length) continue;
|
|
3457
3506
|
for (let child = cursor + 1; child < tokens.length; child++) {
|
|
3458
3507
|
if (tokens[child].value !== "<") continue;
|
|
3459
|
-
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;
|
|
3460
3509
|
if (!closesBoundary) return true;
|
|
3461
3510
|
break;
|
|
3462
3511
|
}
|
|
@@ -3478,7 +3527,7 @@ function rendersOnlyLeafElements(content, localBindings) {
|
|
|
3478
3527
|
else if (value === "<" && braceDepth > 0) return false;
|
|
3479
3528
|
else if (value === ">" && braceDepth === 0) break;
|
|
3480
3529
|
}
|
|
3481
|
-
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;
|
|
3482
3531
|
}
|
|
3483
3532
|
return true;
|
|
3484
3533
|
}
|
|
@@ -3490,9 +3539,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
3490
3539
|
const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
|
|
3491
3540
|
for (let index = 0; index < tokens.length; index++) {
|
|
3492
3541
|
let callStart = -1;
|
|
3493
|
-
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]) === "(") {
|
|
3494
3543
|
callStart = index + 2;
|
|
3495
|
-
} 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]) === "(") {
|
|
3496
3545
|
callStart = index + 3;
|
|
3497
3546
|
}
|
|
3498
3547
|
if (callStart !== -1) {
|
|
@@ -3501,10 +3550,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
3501
3550
|
index = callEnd;
|
|
3502
3551
|
continue;
|
|
3503
3552
|
}
|
|
3504
|
-
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]) === "(") {
|
|
3505
3554
|
const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
|
|
3506
3555
|
const bodyStart = conditionEnd + 1;
|
|
3507
|
-
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 === ";");
|
|
3508
3557
|
if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
|
|
3509
3558
|
}
|
|
3510
3559
|
}
|
|
@@ -3623,7 +3672,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3623
3672
|
const localBindings = _nullishCoalesce(importedBindings.get(specifier), () => ( []));
|
|
3624
3673
|
const staticUses = countStaticJsxUses(content, localBindings);
|
|
3625
3674
|
if (staticUses > 0) {
|
|
3626
|
-
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;
|
|
3627
3676
|
if (grows) visit(ensureFarmIslandContainerReference(projectRoot));
|
|
3628
3677
|
const container = grows ? void 0 : findParserSensitiveJsxContainer(content, localBindings);
|
|
3629
3678
|
if (container) {
|
|
@@ -3749,7 +3798,7 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
3749
3798
|
}
|
|
3750
3799
|
function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
3751
3800
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
3752
|
-
if (resolvedPath) _optionalChain([trace2, 'optionalAccess',
|
|
3801
|
+
if (resolvedPath) _optionalChain([trace2, 'optionalAccess', _227 => _227.stop, 'call', _228 => _228(resolvedPath)]);
|
|
3753
3802
|
return {
|
|
3754
3803
|
isClientComponent: false,
|
|
3755
3804
|
shouldHydrate: false,
|
|
@@ -3757,7 +3806,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
|
3757
3806
|
};
|
|
3758
3807
|
}
|
|
3759
3808
|
visited.add(resolvedPath);
|
|
3760
|
-
_optionalChain([trace2, 'optionalAccess',
|
|
3809
|
+
_optionalChain([trace2, 'optionalAccess', _229 => _229.visit, 'call', _230 => _230(resolvedPath)]);
|
|
3761
3810
|
const content = readIfExists(resolvedPath);
|
|
3762
3811
|
const parsed = parseClientModuleMetadata(content, false);
|
|
3763
3812
|
let importsClientBoundary = false;
|
|
@@ -3815,7 +3864,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3815
3864
|
braceDepth = Math.max(0, braceDepth - 1);
|
|
3816
3865
|
continue;
|
|
3817
3866
|
}
|
|
3818
|
-
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") {
|
|
3819
3868
|
matches.add(tokens[index + 2].value);
|
|
3820
3869
|
continue;
|
|
3821
3870
|
}
|
|
@@ -3825,7 +3874,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3825
3874
|
}
|
|
3826
3875
|
if (reexportsOnly && keyword.value !== "export") continue;
|
|
3827
3876
|
const previous = tokens[index - 1];
|
|
3828
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
3877
|
+
if (_optionalChain([previous, 'optionalAccess', _237 => _237.value]) === ".") continue;
|
|
3829
3878
|
const first = tokens[index + 1];
|
|
3830
3879
|
if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
|
|
3831
3880
|
continue;
|
|
@@ -3841,7 +3890,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3841
3890
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
3842
3891
|
const token = tokens[cursor];
|
|
3843
3892
|
if (token.value === ";") break;
|
|
3844
|
-
if (token.value === "from" && _optionalChain([tokens, 'access',
|
|
3893
|
+
if (token.value === "from" && _optionalChain([tokens, 'access', _238 => _238[cursor + 1], 'optionalAccess', _239 => _239.kind]) === "string") {
|
|
3845
3894
|
fromIndex = cursor;
|
|
3846
3895
|
break;
|
|
3847
3896
|
}
|
|
@@ -3859,14 +3908,14 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3859
3908
|
return Array.from(matches);
|
|
3860
3909
|
}
|
|
3861
3910
|
function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
3862
|
-
if (_optionalChain([tokens, 'access',
|
|
3911
|
+
if (_optionalChain([tokens, 'access', _240 => _240[startIndex], 'optionalAccess', _241 => _241.value]) !== "{") return false;
|
|
3863
3912
|
const closingBraceIndex = tokens.findIndex(
|
|
3864
3913
|
(token, index) => index > startIndex && index < endIndex && token.value === "}"
|
|
3865
3914
|
);
|
|
3866
3915
|
if (closingBraceIndex === -1) return false;
|
|
3867
3916
|
let entryStartsAt = startIndex + 1;
|
|
3868
3917
|
for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
|
|
3869
|
-
if (index !== closingBraceIndex && _optionalChain([tokens, 'access',
|
|
3918
|
+
if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _242 => _242[index], 'optionalAccess', _243 => _243.value]) !== ",") continue;
|
|
3870
3919
|
const entry = tokens.slice(entryStartsAt, index);
|
|
3871
3920
|
if (entry.length > 0 && entry[0].value !== "type") return false;
|
|
3872
3921
|
entryStartsAt = index + 1;
|
|
@@ -3947,7 +3996,7 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3947
3996
|
const sourceDir = _chunkMNUYXZV7cjs.getFarmProjectSourceDir.call(void 0, projectRoot);
|
|
3948
3997
|
const cacheStamp = `${stamp}:${sourceDir}`;
|
|
3949
3998
|
const cached = projectImportAliasCache.get(projectRoot);
|
|
3950
|
-
if (_optionalChain([cached, 'optionalAccess',
|
|
3999
|
+
if (_optionalChain([cached, 'optionalAccess', _244 => _244.stamp]) === cacheStamp) return cached.aliases;
|
|
3951
4000
|
const aliases = [
|
|
3952
4001
|
...readTsconfigPathAliases(projectRoot),
|
|
3953
4002
|
...readPackageImportAliases(projectRoot)
|
|
@@ -3968,7 +4017,7 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
3968
4017
|
const configPath = _path2.default.join(projectRoot, name);
|
|
3969
4018
|
if (!_fs2.default.existsSync(configPath)) continue;
|
|
3970
4019
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
3971
|
-
if (!_optionalChain([resolved, 'optionalAccess',
|
|
4020
|
+
if (!_optionalChain([resolved, 'optionalAccess', _245 => _245.paths])) return [];
|
|
3972
4021
|
const base2 = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
|
|
3973
4022
|
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
3974
4023
|
if (!Array.isArray(targets)) return [];
|
|
@@ -4003,18 +4052,18 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
4003
4052
|
inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
|
|
4004
4053
|
}
|
|
4005
4054
|
const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
|
|
4006
|
-
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]);
|
|
4007
4056
|
if (options.paths && typeof options.paths === "object") {
|
|
4008
4057
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
4009
4058
|
}
|
|
4010
4059
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
4011
4060
|
}
|
|
4012
4061
|
function readPackageImportAliases(projectRoot) {
|
|
4013
|
-
const imports = _optionalChain([readPackageJson, 'call',
|
|
4062
|
+
const imports = _optionalChain([readPackageJson, 'call', _247 => _247(_path2.default.join(projectRoot, "package.json")), 'optionalAccess', _248 => _248.imports]);
|
|
4014
4063
|
if (!imports || typeof imports !== "object") return [];
|
|
4015
4064
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
4016
4065
|
const target = resolveConditionalExportTarget(value);
|
|
4017
|
-
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess',
|
|
4066
|
+
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _249 => _249.startsWith, 'call', _250 => _250("./")])) return [];
|
|
4018
4067
|
const wildcardIndex = pattern.indexOf("*");
|
|
4019
4068
|
return [
|
|
4020
4069
|
{
|
|
@@ -4080,15 +4129,15 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
4080
4129
|
const packageJsonPath = _path2.default.join(packageDirectory, "package.json");
|
|
4081
4130
|
const packageJson = readPackageJson(packageJsonPath);
|
|
4082
4131
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
4083
|
-
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess',
|
|
4132
|
+
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _251 => _251.exports]), exportKey);
|
|
4084
4133
|
const candidates = /* @__PURE__ */ new Set();
|
|
4085
|
-
if (_optionalChain([exportTarget, 'optionalAccess',
|
|
4134
|
+
if (_optionalChain([exportTarget, 'optionalAccess', _252 => _252.startsWith, 'call', _253 => _253("./")])) {
|
|
4086
4135
|
candidates.add(_path2.default.resolve(packageDirectory, exportTarget));
|
|
4087
4136
|
}
|
|
4088
4137
|
if (packageSubpath) {
|
|
4089
4138
|
candidates.add(_path2.default.join(packageDirectory, packageSubpath));
|
|
4090
4139
|
} else {
|
|
4091
|
-
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])]) {
|
|
4092
4141
|
if (typeof entry === "string") candidates.add(_path2.default.resolve(packageDirectory, entry));
|
|
4093
4142
|
}
|
|
4094
4143
|
candidates.add(_path2.default.join(packageDirectory, "index"));
|
|
@@ -4153,7 +4202,7 @@ function resolvePackageExport(exportsField, exportKey) {
|
|
|
4153
4202
|
if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
|
|
4154
4203
|
const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
|
|
4155
4204
|
const target = resolveConditionalExportTarget(value);
|
|
4156
|
-
return _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
4205
|
+
return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _257 => _257.replace, 'call', _258 => _258("*", wildcard)]), () => ( null));
|
|
4157
4206
|
}
|
|
4158
4207
|
return null;
|
|
4159
4208
|
}
|
|
@@ -4196,7 +4245,7 @@ function resolveSourceCandidatePath(candidate) {
|
|
|
4196
4245
|
}
|
|
4197
4246
|
for (const sourcePath of paths) {
|
|
4198
4247
|
try {
|
|
4199
|
-
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;
|
|
4200
4249
|
} catch (e47) {
|
|
4201
4250
|
}
|
|
4202
4251
|
}
|
|
@@ -4346,7 +4395,7 @@ function resolveFarmClientOptimizeDeps(directory, root) {
|
|
|
4346
4395
|
const imports = scanFarmPackageImports(directory, root);
|
|
4347
4396
|
for (const specifier of imports.client) {
|
|
4348
4397
|
const fonts = findFarmServerBundledPackage(importer, specifier);
|
|
4349
|
-
if (_optionalChain([fonts, 'optionalAccess',
|
|
4398
|
+
if (_optionalChain([fonts, 'optionalAccess', _263 => _263.fonts])) {
|
|
4350
4399
|
exclude.add(fonts.name);
|
|
4351
4400
|
continue;
|
|
4352
4401
|
}
|
|
@@ -4415,20 +4464,20 @@ function transformEnvironmentFunctions(options) {
|
|
|
4415
4464
|
function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
4416
4465
|
let routesFiles = /* @__PURE__ */ new Set();
|
|
4417
4466
|
const componentExtensions = new Set(
|
|
4418
|
-
|
|
4467
|
+
_chunkT7UC2ORAcjs.getFarmRendererComponentExtensions.call(void 0, options.renderer || void 0)
|
|
4419
4468
|
);
|
|
4420
4469
|
let farmApi;
|
|
4421
4470
|
let isBuild = false;
|
|
4422
4471
|
let projectRoot = process.cwd();
|
|
4423
4472
|
let sources;
|
|
4424
4473
|
const routeSourceFiles = () => {
|
|
4425
|
-
const clientRoutes = _optionalChain([farmApi, 'optionalAccess',
|
|
4426
|
-
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) {
|
|
4427
4476
|
sources = {
|
|
4428
4477
|
for: clientRoutes,
|
|
4429
4478
|
files: /* @__PURE__ */ new Set([
|
|
4430
4479
|
...routesFiles,
|
|
4431
|
-
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess',
|
|
4480
|
+
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess', _267 => _267.routeSourceFiles]), () => ( []))].map(resolvedFile)
|
|
4432
4481
|
])
|
|
4433
4482
|
};
|
|
4434
4483
|
}
|
|
@@ -4449,7 +4498,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4449
4498
|
configResolved(config) {
|
|
4450
4499
|
isBuild = config.command === "build";
|
|
4451
4500
|
projectRoot = config.root;
|
|
4452
|
-
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]);
|
|
4453
4502
|
sources = void 0;
|
|
4454
4503
|
routesFiles = new Set(
|
|
4455
4504
|
_chunk52Q4OB4Acjs.getFarmSourceRoots.call(void 0, { ...options, root: _nullishCoalesce(options.root, () => ( config.root)) }).flatMap(
|
|
@@ -4462,7 +4511,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4462
4511
|
transform(code, id, transformOptions) {
|
|
4463
4512
|
const environment = resolveBuildEnvironment(
|
|
4464
4513
|
this,
|
|
4465
|
-
_optionalChain([transformOptions, 'optionalAccess',
|
|
4514
|
+
_optionalChain([transformOptions, 'optionalAccess', _272 => _272.ssr])
|
|
4466
4515
|
);
|
|
4467
4516
|
const parse3 = (source) => this.parse(source);
|
|
4468
4517
|
const result = transformEnvironmentFunctions({
|
|
@@ -4475,7 +4524,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4475
4524
|
if (environment === "client" && !isBuild && !_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id) && routeSourceFiles().has(moduleFile(id)) && !isProgrammaticRouteActionProxy(code)) {
|
|
4476
4525
|
this.error(routeSourceError(moduleFile(id)));
|
|
4477
4526
|
}
|
|
4478
|
-
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)) {
|
|
4479
4528
|
const file = id.split("?", 1)[0];
|
|
4480
4529
|
const root = _fs.realpathSync.call(void 0, _nullishCoalesce(options.root, () => ( projectRoot)));
|
|
4481
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"));
|
|
@@ -4509,7 +4558,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4509
4558
|
for (const id of this.getModuleIds()) {
|
|
4510
4559
|
if (_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
|
|
4511
4560
|
const chain = findClientNodeBuiltinChain(id, (moduleId) => {
|
|
4512
|
-
return _optionalChain([this, 'access',
|
|
4561
|
+
return _optionalChain([this, 'access', _275 => _275.getModuleInfo, 'call', _276 => _276(moduleId), 'optionalAccess', _277 => _277.importedIds]);
|
|
4513
4562
|
});
|
|
4514
4563
|
if (chain) {
|
|
4515
4564
|
this.error(
|
|
@@ -4527,8 +4576,8 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4527
4576
|
}
|
|
4528
4577
|
if (!forbidden.has(moduleFile(id))) continue;
|
|
4529
4578
|
const info = this.getModuleInfo(id);
|
|
4530
|
-
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess',
|
|
4531
|
-
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)])));
|
|
4532
4581
|
}
|
|
4533
4582
|
}
|
|
4534
4583
|
};
|
|
@@ -4547,8 +4596,8 @@ function resolvedFile(filePath) {
|
|
|
4547
4596
|
}
|
|
4548
4597
|
}
|
|
4549
4598
|
function resolveBuildEnvironment(context, ssr) {
|
|
4550
|
-
if (_optionalChain([context, 'access',
|
|
4551
|
-
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") {
|
|
4552
4601
|
return "server";
|
|
4553
4602
|
}
|
|
4554
4603
|
return ssr ? "server" : "client";
|