@farm.js/core 0.1.14 → 0.1.15
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/{chunk-U6CRU23N.mjs → chunk-FBHGHMOA.mjs} +1 -1
- package/dist/{chunk-J2F5LFQ2.mjs → chunk-JRF3C33L.mjs} +171 -5
- package/dist/{chunk-DNCKVMSV.mjs → chunk-UE75PB52.mjs} +1 -1
- package/dist/index.cjs +172 -6
- package/dist/index.mjs +3 -3
- package/dist/internal/build-runtime.cjs +172 -6
- package/dist/internal/build-runtime.mjs +3 -3
- package/dist/internal/client-error-overlay.cjs +1 -1
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/product-telemetry-runtime.cjs +1 -1
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/plugin.cjs +171 -5
- package/dist/plugin.mjs +2 -2
- package/dist/server.cjs +171 -5
- package/dist/server.mjs +2 -2
- package/dist/version.cjs +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +171 -5
- package/dist/vite.mjs +2 -2
- package/package.json +3 -3
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
resolveFarmClientCacheAdapterEntry,
|
|
64
64
|
resolveFarmIsolatedClientHydrationMode,
|
|
65
65
|
resolveFarmNotFoundComponentPath
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-JRF3C33L.mjs";
|
|
67
67
|
import {
|
|
68
68
|
findRequestBoundSourceBlockers,
|
|
69
69
|
generateFarmTypeArtifacts,
|
|
@@ -257,7 +257,7 @@ import {
|
|
|
257
257
|
} from "./chunk-Z2RZJZIZ.mjs";
|
|
258
258
|
import {
|
|
259
259
|
FARM_VERSION
|
|
260
|
-
} from "./chunk-
|
|
260
|
+
} from "./chunk-UE75PB52.mjs";
|
|
261
261
|
import {
|
|
262
262
|
resolveFarmTrailingSlashRedirect,
|
|
263
263
|
setFarmTrailingSlashPreference
|
|
@@ -1224,9 +1224,10 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
1224
1224
|
const importedBindings = getStaticImportBindings(content);
|
|
1225
1225
|
let estimatedBoundaryCount2 = 0;
|
|
1226
1226
|
for (const specifier of new Set(getImportSpecifiers(content))) {
|
|
1227
|
-
const
|
|
1227
|
+
const imported = resolveImportedModule(moduleSourcePath, specifier, root);
|
|
1228
|
+
const importedPath = imported.path;
|
|
1228
1229
|
if (!importedPath) continue;
|
|
1229
|
-
if (!
|
|
1230
|
+
if (!imported.local) {
|
|
1230
1231
|
const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
|
|
1231
1232
|
if (packageMetadata.shouldHydrate) {
|
|
1232
1233
|
if (options.staticPackageBoundaries) {
|
|
@@ -1295,8 +1296,8 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
1295
1296
|
let importsClientBoundary = false;
|
|
1296
1297
|
let importedIslandStrategy = null;
|
|
1297
1298
|
for (const specifier of getImportSpecifiers(content)) {
|
|
1298
|
-
const
|
|
1299
|
-
const importedMetadata =
|
|
1299
|
+
const imported = resolveImportedModule(resolvedPath, specifier, root);
|
|
1300
|
+
const importedMetadata = imported.local ? inspectClientModuleMetadata(imported.path, root, visited, false) : inspectPackageClientBoundary(imported.path, root, visited);
|
|
1300
1301
|
if (importedMetadata.isClientComponent || importedMetadata.shouldHydrate) {
|
|
1301
1302
|
importsClientBoundary = true;
|
|
1302
1303
|
if (importedIslandStrategy === null) {
|
|
@@ -1425,6 +1426,171 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
|
1425
1426
|
return true;
|
|
1426
1427
|
}
|
|
1427
1428
|
__name(isTypeOnlyNamedClause, "isTypeOnlyNamedClause");
|
|
1429
|
+
function resolveImportedModule(importerPath, specifier, root) {
|
|
1430
|
+
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
1431
|
+
return { path: resolveImportedModuleSourcePath(importerPath, specifier, root), local: true };
|
|
1432
|
+
}
|
|
1433
|
+
const aliased = resolveProjectAliasSourcePath(specifier, root);
|
|
1434
|
+
if (aliased !== void 0) return { path: aliased, local: true };
|
|
1435
|
+
return { path: resolvePackageModuleSourcePath(importerPath, specifier, root), local: false };
|
|
1436
|
+
}
|
|
1437
|
+
__name(resolveImportedModule, "resolveImportedModule");
|
|
1438
|
+
var projectImportAliasCache = /* @__PURE__ */ new Map();
|
|
1439
|
+
var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
|
|
1440
|
+
function resolveProjectAliasSourcePath(specifier, root) {
|
|
1441
|
+
if (!root) return void 0;
|
|
1442
|
+
const projectRoot = path.resolve(root);
|
|
1443
|
+
let match;
|
|
1444
|
+
for (const alias of getProjectImportAliases(projectRoot)) {
|
|
1445
|
+
const captured = matchProjectImportAlias(alias, specifier);
|
|
1446
|
+
if (captured === null) continue;
|
|
1447
|
+
if (!match || alias.prefix.length > match.alias.prefix.length) match = { alias, captured };
|
|
1448
|
+
}
|
|
1449
|
+
if (!match) return void 0;
|
|
1450
|
+
return resolveSourceCandidate(
|
|
1451
|
+
match.alias.targets.map(
|
|
1452
|
+
(target) => path.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
|
|
1453
|
+
)
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
__name(resolveProjectAliasSourcePath, "resolveProjectAliasSourcePath");
|
|
1457
|
+
function matchProjectImportAlias(alias, specifier) {
|
|
1458
|
+
if (!alias.wildcard) return specifier === alias.prefix ? "" : null;
|
|
1459
|
+
if (specifier.length < alias.prefix.length + alias.suffix.length || !specifier.startsWith(alias.prefix) || !specifier.endsWith(alias.suffix)) {
|
|
1460
|
+
return null;
|
|
1461
|
+
}
|
|
1462
|
+
return specifier.slice(alias.prefix.length, specifier.length - alias.suffix.length);
|
|
1463
|
+
}
|
|
1464
|
+
__name(matchProjectImportAlias, "matchProjectImportAlias");
|
|
1465
|
+
function getProjectImportAliases(projectRoot) {
|
|
1466
|
+
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
1467
|
+
try {
|
|
1468
|
+
return String(fs.statSync(path.join(projectRoot, file)).mtimeMs);
|
|
1469
|
+
} catch {
|
|
1470
|
+
return "-";
|
|
1471
|
+
}
|
|
1472
|
+
}).join(":");
|
|
1473
|
+
const cached = projectImportAliasCache.get(projectRoot);
|
|
1474
|
+
if (cached?.stamp === stamp) return cached.aliases;
|
|
1475
|
+
const aliases = [
|
|
1476
|
+
...readTsconfigPathAliases(projectRoot),
|
|
1477
|
+
...readPackageImportAliases(projectRoot)
|
|
1478
|
+
];
|
|
1479
|
+
if (!aliases.some((alias) => alias.prefix === "@/")) {
|
|
1480
|
+
aliases.push({
|
|
1481
|
+
prefix: "@/",
|
|
1482
|
+
suffix: "",
|
|
1483
|
+
wildcard: true,
|
|
1484
|
+
targets: [path.join(projectRoot, "src", "*")]
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
projectImportAliasCache.set(projectRoot, { stamp, aliases });
|
|
1488
|
+
return aliases;
|
|
1489
|
+
}
|
|
1490
|
+
__name(getProjectImportAliases, "getProjectImportAliases");
|
|
1491
|
+
function readTsconfigPathAliases(projectRoot) {
|
|
1492
|
+
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
1493
|
+
const configPath = path.join(projectRoot, name);
|
|
1494
|
+
if (!fs.existsSync(configPath)) continue;
|
|
1495
|
+
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
1496
|
+
if (!resolved?.paths) return [];
|
|
1497
|
+
const base = resolved.baseUrl ?? resolved.pathsDirectory;
|
|
1498
|
+
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
1499
|
+
if (!Array.isArray(targets)) return [];
|
|
1500
|
+
const wildcardIndex = pattern.indexOf("*");
|
|
1501
|
+
return [
|
|
1502
|
+
{
|
|
1503
|
+
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
1504
|
+
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
1505
|
+
wildcard: wildcardIndex !== -1,
|
|
1506
|
+
targets: targets.filter((target) => typeof target === "string").map((target) => path.resolve(base, target))
|
|
1507
|
+
}
|
|
1508
|
+
];
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
return [];
|
|
1512
|
+
}
|
|
1513
|
+
__name(readTsconfigPathAliases, "readTsconfigPathAliases");
|
|
1514
|
+
function readTsconfigPaths(configPath, visited) {
|
|
1515
|
+
if (visited.has(configPath)) return null;
|
|
1516
|
+
visited.add(configPath);
|
|
1517
|
+
const config = readJsonWithComments(configPath);
|
|
1518
|
+
if (!config) return null;
|
|
1519
|
+
const directory = path.dirname(configPath);
|
|
1520
|
+
const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
|
|
1521
|
+
(parent) => typeof parent === "string" && parent.startsWith(".")
|
|
1522
|
+
);
|
|
1523
|
+
let inherited = null;
|
|
1524
|
+
for (const parent of parents) {
|
|
1525
|
+
const parentPath = path.resolve(
|
|
1526
|
+
directory,
|
|
1527
|
+
parent.endsWith(".json") ? parent : `${parent}.json`
|
|
1528
|
+
);
|
|
1529
|
+
inherited = readTsconfigPaths(parentPath, visited) ?? inherited;
|
|
1530
|
+
}
|
|
1531
|
+
const options = config.compilerOptions ?? {};
|
|
1532
|
+
const baseUrl = typeof options.baseUrl === "string" ? path.resolve(directory, options.baseUrl) : inherited?.baseUrl;
|
|
1533
|
+
if (options.paths && typeof options.paths === "object") {
|
|
1534
|
+
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
1535
|
+
}
|
|
1536
|
+
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
1537
|
+
}
|
|
1538
|
+
__name(readTsconfigPaths, "readTsconfigPaths");
|
|
1539
|
+
function readPackageImportAliases(projectRoot) {
|
|
1540
|
+
const imports = readPackageJson(path.join(projectRoot, "package.json"))?.imports;
|
|
1541
|
+
if (!imports || typeof imports !== "object") return [];
|
|
1542
|
+
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
1543
|
+
const target = resolveConditionalExportTarget(value);
|
|
1544
|
+
if (!pattern.startsWith("#") || !target?.startsWith("./")) return [];
|
|
1545
|
+
const wildcardIndex = pattern.indexOf("*");
|
|
1546
|
+
return [
|
|
1547
|
+
{
|
|
1548
|
+
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
1549
|
+
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
1550
|
+
wildcard: wildcardIndex !== -1,
|
|
1551
|
+
targets: [path.resolve(projectRoot, target)]
|
|
1552
|
+
}
|
|
1553
|
+
];
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
__name(readPackageImportAliases, "readPackageImportAliases");
|
|
1557
|
+
function readJsonWithComments(filePath) {
|
|
1558
|
+
let source;
|
|
1559
|
+
try {
|
|
1560
|
+
source = fs.readFileSync(filePath, "utf8");
|
|
1561
|
+
} catch {
|
|
1562
|
+
return null;
|
|
1563
|
+
}
|
|
1564
|
+
let output = "";
|
|
1565
|
+
let inString = false;
|
|
1566
|
+
for (let index = 0; index < source.length; index++) {
|
|
1567
|
+
const char = source[index];
|
|
1568
|
+
if (inString) {
|
|
1569
|
+
output += char;
|
|
1570
|
+
if (char === "\\") output += source[++index] ?? "";
|
|
1571
|
+
else if (char === '"') inString = false;
|
|
1572
|
+
continue;
|
|
1573
|
+
}
|
|
1574
|
+
if (char === '"') {
|
|
1575
|
+
inString = true;
|
|
1576
|
+
output += char;
|
|
1577
|
+
} else if (char === "/" && source[index + 1] === "/") {
|
|
1578
|
+
while (index < source.length && source[index] !== "\n") index++;
|
|
1579
|
+
output += "\n";
|
|
1580
|
+
} else if (char === "/" && source[index + 1] === "*") {
|
|
1581
|
+
const end = source.indexOf("*/", index + 2);
|
|
1582
|
+
index = end === -1 ? source.length : end + 1;
|
|
1583
|
+
} else {
|
|
1584
|
+
output += char;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
try {
|
|
1588
|
+
return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
|
|
1589
|
+
} catch {
|
|
1590
|
+
return null;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
__name(readJsonWithComments, "readJsonWithComments");
|
|
1428
1594
|
function resolveImportedModuleSourcePath(importerPath, specifier, root) {
|
|
1429
1595
|
if (!specifier.startsWith(".") && !specifier.startsWith("/")) {
|
|
1430
1596
|
return resolvePackageModuleSourcePath(importerPath, specifier, root);
|
package/dist/index.cjs
CHANGED
|
@@ -14902,9 +14902,10 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
14902
14902
|
const importedBindings = getStaticImportBindings(content);
|
|
14903
14903
|
let estimatedBoundaryCount2 = 0;
|
|
14904
14904
|
for (const specifier of new Set(getImportSpecifiers(content))) {
|
|
14905
|
-
const
|
|
14905
|
+
const imported = resolveImportedModule(moduleSourcePath, specifier, root);
|
|
14906
|
+
const importedPath = imported.path;
|
|
14906
14907
|
if (!importedPath) continue;
|
|
14907
|
-
if (!
|
|
14908
|
+
if (!imported.local) {
|
|
14908
14909
|
const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
|
|
14909
14910
|
if (packageMetadata.shouldHydrate) {
|
|
14910
14911
|
if (options.staticPackageBoundaries) {
|
|
@@ -14972,8 +14973,8 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
14972
14973
|
let importsClientBoundary = false;
|
|
14973
14974
|
let importedIslandStrategy = null;
|
|
14974
14975
|
for (const specifier of getImportSpecifiers(content)) {
|
|
14975
|
-
const
|
|
14976
|
-
const importedMetadata =
|
|
14976
|
+
const imported = resolveImportedModule(resolvedPath, specifier, root);
|
|
14977
|
+
const importedMetadata = imported.local ? inspectClientModuleMetadata(imported.path, root, visited, false) : inspectPackageClientBoundary(imported.path, root, visited);
|
|
14977
14978
|
if (importedMetadata.isClientComponent || importedMetadata.shouldHydrate) {
|
|
14978
14979
|
importsClientBoundary = true;
|
|
14979
14980
|
if (importedIslandStrategy === null) {
|
|
@@ -15098,6 +15099,161 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
|
15098
15099
|
}
|
|
15099
15100
|
return true;
|
|
15100
15101
|
}
|
|
15102
|
+
function resolveImportedModule(importerPath, specifier, root) {
|
|
15103
|
+
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
15104
|
+
return { path: resolveImportedModuleSourcePath(importerPath, specifier, root), local: true };
|
|
15105
|
+
}
|
|
15106
|
+
const aliased = resolveProjectAliasSourcePath(specifier, root);
|
|
15107
|
+
if (aliased !== void 0) return { path: aliased, local: true };
|
|
15108
|
+
return { path: resolvePackageModuleSourcePath(importerPath, specifier, root), local: false };
|
|
15109
|
+
}
|
|
15110
|
+
function resolveProjectAliasSourcePath(specifier, root) {
|
|
15111
|
+
if (!root) return void 0;
|
|
15112
|
+
const projectRoot = import_path4.default.resolve(root);
|
|
15113
|
+
let match;
|
|
15114
|
+
for (const alias of getProjectImportAliases(projectRoot)) {
|
|
15115
|
+
const captured = matchProjectImportAlias(alias, specifier);
|
|
15116
|
+
if (captured === null) continue;
|
|
15117
|
+
if (!match || alias.prefix.length > match.alias.prefix.length) match = { alias, captured };
|
|
15118
|
+
}
|
|
15119
|
+
if (!match) return void 0;
|
|
15120
|
+
return resolveSourceCandidate(
|
|
15121
|
+
match.alias.targets.map(
|
|
15122
|
+
(target) => import_path4.default.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
|
|
15123
|
+
)
|
|
15124
|
+
);
|
|
15125
|
+
}
|
|
15126
|
+
function matchProjectImportAlias(alias, specifier) {
|
|
15127
|
+
if (!alias.wildcard) return specifier === alias.prefix ? "" : null;
|
|
15128
|
+
if (specifier.length < alias.prefix.length + alias.suffix.length || !specifier.startsWith(alias.prefix) || !specifier.endsWith(alias.suffix)) {
|
|
15129
|
+
return null;
|
|
15130
|
+
}
|
|
15131
|
+
return specifier.slice(alias.prefix.length, specifier.length - alias.suffix.length);
|
|
15132
|
+
}
|
|
15133
|
+
function getProjectImportAliases(projectRoot) {
|
|
15134
|
+
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
15135
|
+
try {
|
|
15136
|
+
return String(import_fs2.default.statSync(import_path4.default.join(projectRoot, file)).mtimeMs);
|
|
15137
|
+
} catch {
|
|
15138
|
+
return "-";
|
|
15139
|
+
}
|
|
15140
|
+
}).join(":");
|
|
15141
|
+
const cached = projectImportAliasCache.get(projectRoot);
|
|
15142
|
+
if (cached?.stamp === stamp) return cached.aliases;
|
|
15143
|
+
const aliases = [
|
|
15144
|
+
...readTsconfigPathAliases(projectRoot),
|
|
15145
|
+
...readPackageImportAliases(projectRoot)
|
|
15146
|
+
];
|
|
15147
|
+
if (!aliases.some((alias) => alias.prefix === "@/")) {
|
|
15148
|
+
aliases.push({
|
|
15149
|
+
prefix: "@/",
|
|
15150
|
+
suffix: "",
|
|
15151
|
+
wildcard: true,
|
|
15152
|
+
targets: [import_path4.default.join(projectRoot, "src", "*")]
|
|
15153
|
+
});
|
|
15154
|
+
}
|
|
15155
|
+
projectImportAliasCache.set(projectRoot, { stamp, aliases });
|
|
15156
|
+
return aliases;
|
|
15157
|
+
}
|
|
15158
|
+
function readTsconfigPathAliases(projectRoot) {
|
|
15159
|
+
for (const name2 of ["tsconfig.json", "jsconfig.json"]) {
|
|
15160
|
+
const configPath = import_path4.default.join(projectRoot, name2);
|
|
15161
|
+
if (!import_fs2.default.existsSync(configPath)) continue;
|
|
15162
|
+
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
15163
|
+
if (!resolved?.paths) return [];
|
|
15164
|
+
const base = resolved.baseUrl ?? resolved.pathsDirectory;
|
|
15165
|
+
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
15166
|
+
if (!Array.isArray(targets)) return [];
|
|
15167
|
+
const wildcardIndex = pattern.indexOf("*");
|
|
15168
|
+
return [
|
|
15169
|
+
{
|
|
15170
|
+
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
15171
|
+
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
15172
|
+
wildcard: wildcardIndex !== -1,
|
|
15173
|
+
targets: targets.filter((target) => typeof target === "string").map((target) => import_path4.default.resolve(base, target))
|
|
15174
|
+
}
|
|
15175
|
+
];
|
|
15176
|
+
});
|
|
15177
|
+
}
|
|
15178
|
+
return [];
|
|
15179
|
+
}
|
|
15180
|
+
function readTsconfigPaths(configPath, visited) {
|
|
15181
|
+
if (visited.has(configPath)) return null;
|
|
15182
|
+
visited.add(configPath);
|
|
15183
|
+
const config = readJsonWithComments(configPath);
|
|
15184
|
+
if (!config) return null;
|
|
15185
|
+
const directory = import_path4.default.dirname(configPath);
|
|
15186
|
+
const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
|
|
15187
|
+
(parent) => typeof parent === "string" && parent.startsWith(".")
|
|
15188
|
+
);
|
|
15189
|
+
let inherited = null;
|
|
15190
|
+
for (const parent of parents) {
|
|
15191
|
+
const parentPath = import_path4.default.resolve(
|
|
15192
|
+
directory,
|
|
15193
|
+
parent.endsWith(".json") ? parent : `${parent}.json`
|
|
15194
|
+
);
|
|
15195
|
+
inherited = readTsconfigPaths(parentPath, visited) ?? inherited;
|
|
15196
|
+
}
|
|
15197
|
+
const options = config.compilerOptions ?? {};
|
|
15198
|
+
const baseUrl = typeof options.baseUrl === "string" ? import_path4.default.resolve(directory, options.baseUrl) : inherited?.baseUrl;
|
|
15199
|
+
if (options.paths && typeof options.paths === "object") {
|
|
15200
|
+
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
15201
|
+
}
|
|
15202
|
+
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
15203
|
+
}
|
|
15204
|
+
function readPackageImportAliases(projectRoot) {
|
|
15205
|
+
const imports = readPackageJson(import_path4.default.join(projectRoot, "package.json"))?.imports;
|
|
15206
|
+
if (!imports || typeof imports !== "object") return [];
|
|
15207
|
+
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
15208
|
+
const target = resolveConditionalExportTarget(value);
|
|
15209
|
+
if (!pattern.startsWith("#") || !target?.startsWith("./")) return [];
|
|
15210
|
+
const wildcardIndex = pattern.indexOf("*");
|
|
15211
|
+
return [
|
|
15212
|
+
{
|
|
15213
|
+
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
15214
|
+
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
15215
|
+
wildcard: wildcardIndex !== -1,
|
|
15216
|
+
targets: [import_path4.default.resolve(projectRoot, target)]
|
|
15217
|
+
}
|
|
15218
|
+
];
|
|
15219
|
+
});
|
|
15220
|
+
}
|
|
15221
|
+
function readJsonWithComments(filePath) {
|
|
15222
|
+
let source;
|
|
15223
|
+
try {
|
|
15224
|
+
source = import_fs2.default.readFileSync(filePath, "utf8");
|
|
15225
|
+
} catch {
|
|
15226
|
+
return null;
|
|
15227
|
+
}
|
|
15228
|
+
let output = "";
|
|
15229
|
+
let inString = false;
|
|
15230
|
+
for (let index = 0; index < source.length; index++) {
|
|
15231
|
+
const char = source[index];
|
|
15232
|
+
if (inString) {
|
|
15233
|
+
output += char;
|
|
15234
|
+
if (char === "\\") output += source[++index] ?? "";
|
|
15235
|
+
else if (char === '"') inString = false;
|
|
15236
|
+
continue;
|
|
15237
|
+
}
|
|
15238
|
+
if (char === '"') {
|
|
15239
|
+
inString = true;
|
|
15240
|
+
output += char;
|
|
15241
|
+
} else if (char === "/" && source[index + 1] === "/") {
|
|
15242
|
+
while (index < source.length && source[index] !== "\n") index++;
|
|
15243
|
+
output += "\n";
|
|
15244
|
+
} else if (char === "/" && source[index + 1] === "*") {
|
|
15245
|
+
const end = source.indexOf("*/", index + 2);
|
|
15246
|
+
index = end === -1 ? source.length : end + 1;
|
|
15247
|
+
} else {
|
|
15248
|
+
output += char;
|
|
15249
|
+
}
|
|
15250
|
+
}
|
|
15251
|
+
try {
|
|
15252
|
+
return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
|
|
15253
|
+
} catch {
|
|
15254
|
+
return null;
|
|
15255
|
+
}
|
|
15256
|
+
}
|
|
15101
15257
|
function resolveImportedModuleSourcePath(importerPath, specifier, root) {
|
|
15102
15258
|
if (!specifier.startsWith(".") && !specifier.startsWith("/")) {
|
|
15103
15259
|
return resolvePackageModuleSourcePath(importerPath, specifier, root);
|
|
@@ -15228,7 +15384,7 @@ function resolveSourceCandidate(candidates) {
|
|
|
15228
15384
|
}
|
|
15229
15385
|
return null;
|
|
15230
15386
|
}
|
|
15231
|
-
var import_fs2, import_path4, import_url3, FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES, RESOLVABLE_SOURCE_EXTENSIONS, REGEXP_PREFIX_PUNCTUATION, REGEXP_PREFIX_KEYWORDS, PARSER_SENSITIVE_JSX_CONTAINERS;
|
|
15387
|
+
var import_fs2, import_path4, import_url3, FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES, RESOLVABLE_SOURCE_EXTENSIONS, REGEXP_PREFIX_PUNCTUATION, REGEXP_PREFIX_KEYWORDS, PARSER_SENSITIVE_JSX_CONTAINERS, projectImportAliasCache, PROJECT_ALIAS_FILES;
|
|
15232
15388
|
var init_client_component = __esm({
|
|
15233
15389
|
"src/utils/client-component.ts"() {
|
|
15234
15390
|
"use strict";
|
|
@@ -15334,6 +15490,16 @@ var init_client_component = __esm({
|
|
|
15334
15490
|
__name(inspectPackageClientBoundary, "inspectPackageClientBoundary");
|
|
15335
15491
|
__name(getImportSpecifiers, "getImportSpecifiers");
|
|
15336
15492
|
__name(isTypeOnlyNamedClause, "isTypeOnlyNamedClause");
|
|
15493
|
+
__name(resolveImportedModule, "resolveImportedModule");
|
|
15494
|
+
projectImportAliasCache = /* @__PURE__ */ new Map();
|
|
15495
|
+
PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
|
|
15496
|
+
__name(resolveProjectAliasSourcePath, "resolveProjectAliasSourcePath");
|
|
15497
|
+
__name(matchProjectImportAlias, "matchProjectImportAlias");
|
|
15498
|
+
__name(getProjectImportAliases, "getProjectImportAliases");
|
|
15499
|
+
__name(readTsconfigPathAliases, "readTsconfigPathAliases");
|
|
15500
|
+
__name(readTsconfigPaths, "readTsconfigPaths");
|
|
15501
|
+
__name(readPackageImportAliases, "readPackageImportAliases");
|
|
15502
|
+
__name(readJsonWithComments, "readJsonWithComments");
|
|
15337
15503
|
__name(resolveImportedModuleSourcePath, "resolveImportedModuleSourcePath");
|
|
15338
15504
|
__name(resolvePackageModuleSourcePath, "resolvePackageModuleSourcePath");
|
|
15339
15505
|
__name(findPackageDirectory, "findPackageDirectory");
|
|
@@ -21872,7 +22038,7 @@ var init_server3 = __esm({
|
|
|
21872
22038
|
var version;
|
|
21873
22039
|
var init_package = __esm({
|
|
21874
22040
|
"package.json"() {
|
|
21875
|
-
version = "0.1.
|
|
22041
|
+
version = "0.1.15";
|
|
21876
22042
|
}
|
|
21877
22043
|
});
|
|
21878
22044
|
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-J6JRB2ER.mjs";
|
|
7
7
|
import {
|
|
8
8
|
build
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FBHGHMOA.mjs";
|
|
10
10
|
import "./chunk-S3FNNQHR.mjs";
|
|
11
11
|
import "./chunk-655RLQQL.mjs";
|
|
12
12
|
import {
|
|
@@ -240,7 +240,7 @@ import {
|
|
|
240
240
|
PluginManager,
|
|
241
241
|
createFarmApp,
|
|
242
242
|
definePlugin
|
|
243
|
-
} from "./chunk-
|
|
243
|
+
} from "./chunk-JRF3C33L.mjs";
|
|
244
244
|
import {
|
|
245
245
|
analyzeStaticRouteCandidate,
|
|
246
246
|
collectSSGPages,
|
|
@@ -593,7 +593,7 @@ import {
|
|
|
593
593
|
} from "./chunk-KI3MESHB.mjs";
|
|
594
594
|
import "./chunk-QVKYGNVM.mjs";
|
|
595
595
|
import "./chunk-Z2RZJZIZ.mjs";
|
|
596
|
-
import "./chunk-
|
|
596
|
+
import "./chunk-UE75PB52.mjs";
|
|
597
597
|
import "./chunk-54UPOYFS.mjs";
|
|
598
598
|
import "./chunk-WNSDDRNU.mjs";
|
|
599
599
|
import {
|