@absolutejs/absolute 0.19.0-beta.1132 → 0.19.0-beta.1133
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/cli/index.js
CHANGED
|
@@ -1158,6 +1158,222 @@ var init_devCert = __esm(() => {
|
|
|
1158
1158
|
KEY_PATH = join5(CERT_DIR, "key.pem");
|
|
1159
1159
|
});
|
|
1160
1160
|
|
|
1161
|
+
// src/cli/scripts/eslintChunked.ts
|
|
1162
|
+
var exports_eslintChunked = {};
|
|
1163
|
+
__export(exports_eslintChunked, {
|
|
1164
|
+
upstreamRef: () => upstreamRef,
|
|
1165
|
+
ruleSummary: () => ruleSummary,
|
|
1166
|
+
parseChunkedArgs: () => parseChunkedArgs,
|
|
1167
|
+
gitVisibleFiles: () => gitVisibleFiles,
|
|
1168
|
+
gitChangedFiles: () => gitChangedFiles,
|
|
1169
|
+
eslintChunked: () => eslintChunked
|
|
1170
|
+
});
|
|
1171
|
+
import { relative, resolve as resolve4 } from "path";
|
|
1172
|
+
var DEFAULT_CHUNK_SIZE = 20, DEFAULT_SHARDS = 4, DEFAULT_CONCURRENCY = 2, DEFAULT_REPORT = ".absolutejs/lint-report.txt", CHILD_HEAP_MB = 4096, DJB2_SEED = 5381, DJB2_MULTIPLIER = 33, MS_PER_SECOND = 1000, SUMMARY_RULE_WIDTH = 60, SUMMARY_COUNT_PAD = 5, PORCELAIN_STATUS_WIDTH = 3, RENAME_ARROW = " -> ", ASCII_ESC = 27, LINTABLE_EXTENSIONS, ANSI_COLOR, stripAnsi = (text) => text.replace(ANSI_COLOR, ""), shardOf = (path, shards) => [...path].reduce((accumulator, character) => (Math.imul(accumulator, DJB2_MULTIPLIER) ^ character.charCodeAt(0)) >>> 0, DJB2_SEED) % shards, gitLines = (cmd, cwd) => Bun.spawnSync(cmd, { cwd }).stdout.toString().split(`
|
|
1173
|
+
`).map((line) => line.trimEnd()).filter(Boolean), applyChangedBase = (parsed, base) => {
|
|
1174
|
+
parsed.changedOnly = true;
|
|
1175
|
+
parsed.changedBase = base;
|
|
1176
|
+
}, porcelainPath = (line) => {
|
|
1177
|
+
const path = line.slice(PORCELAIN_STATUS_WIDTH);
|
|
1178
|
+
const [, renameTarget] = path.split(RENAME_ARROW);
|
|
1179
|
+
return renameTarget ?? path;
|
|
1180
|
+
}, matchesAnyGlob = (file, globs) => globs.some((pattern) => new Bun.Glob(pattern).match(file)), resolveLintSet = (parsed, cwd) => {
|
|
1181
|
+
const visible = gitVisibleFiles(cwd);
|
|
1182
|
+
const matched = parsed.globs.length === 0 ? visible.filter((file) => LINTABLE_EXTENSIONS.test(file)) : visible.filter((file) => matchesAnyGlob(file, parsed.globs));
|
|
1183
|
+
return matched.sort();
|
|
1184
|
+
}, buildShardChunks = (files, shards, chunkSize) => {
|
|
1185
|
+
const shardFiles = Array.from({ length: shards }, () => []);
|
|
1186
|
+
for (const file of files)
|
|
1187
|
+
shardFiles[shardOf(file, shards)]?.push(file);
|
|
1188
|
+
const shardChunks = Array.from({ length: shards }, () => []);
|
|
1189
|
+
for (let shard = 0;shard < shards; shard++) {
|
|
1190
|
+
const owned = shardFiles[shard] ?? [];
|
|
1191
|
+
for (let index = 0;index < owned.length; index += chunkSize)
|
|
1192
|
+
shardChunks[shard]?.push(owned.slice(index, index + chunkSize));
|
|
1193
|
+
}
|
|
1194
|
+
return shardChunks;
|
|
1195
|
+
}, runEslintProcess = async (chunk, cacheLocation, passthrough, cwd) => {
|
|
1196
|
+
const hasMaxWarnings = passthrough.some((arg) => arg.startsWith("--max-warnings"));
|
|
1197
|
+
const cacheArgs = cacheLocation === null ? [] : [
|
|
1198
|
+
"--cache",
|
|
1199
|
+
"--cache-location",
|
|
1200
|
+
cacheLocation,
|
|
1201
|
+
"--cache-strategy",
|
|
1202
|
+
"content"
|
|
1203
|
+
];
|
|
1204
|
+
const proc = Bun.spawn([
|
|
1205
|
+
resolve4(cwd, "node_modules/.bin/eslint"),
|
|
1206
|
+
"--color",
|
|
1207
|
+
...hasMaxWarnings ? [] : ["--max-warnings", "0"],
|
|
1208
|
+
...cacheArgs,
|
|
1209
|
+
...passthrough,
|
|
1210
|
+
...chunk
|
|
1211
|
+
], {
|
|
1212
|
+
cwd,
|
|
1213
|
+
env: {
|
|
1214
|
+
...process.env,
|
|
1215
|
+
NODE_OPTIONS: `--max-old-space-size=${CHILD_HEAP_MB}`
|
|
1216
|
+
},
|
|
1217
|
+
stderr: "pipe",
|
|
1218
|
+
stdout: "pipe"
|
|
1219
|
+
});
|
|
1220
|
+
const [out, err, exitCode] = await Promise.all([
|
|
1221
|
+
new Response(proc.stdout).text(),
|
|
1222
|
+
new Response(proc.stderr).text(),
|
|
1223
|
+
proc.exited
|
|
1224
|
+
]);
|
|
1225
|
+
return { combined: out + err, exitCode };
|
|
1226
|
+
}, retryEachFile = async (chunk, passthrough, cwd) => {
|
|
1227
|
+
console.warn(`ESLint could not process ${chunk.length} files together; retrying each file`);
|
|
1228
|
+
const results = [];
|
|
1229
|
+
for (const file of chunk) {
|
|
1230
|
+
results.push(await runEslintProcess([file], null, passthrough, cwd));
|
|
1231
|
+
}
|
|
1232
|
+
return results;
|
|
1233
|
+
}, wasSilentCrash = (results, chunk) => {
|
|
1234
|
+
const [first] = results;
|
|
1235
|
+
return first !== undefined && first.exitCode !== 0 && first.combined.trim().length === 0 && chunk.length > 1;
|
|
1236
|
+
}, eslintChunked = async (args, cwd = process.cwd()) => {
|
|
1237
|
+
const parsed = parseChunkedArgs(args);
|
|
1238
|
+
let files = resolveLintSet(parsed, cwd);
|
|
1239
|
+
if (parsed.changedOnly) {
|
|
1240
|
+
const base = parsed.changedBase ?? upstreamRef(cwd);
|
|
1241
|
+
const changed = gitChangedFiles(cwd, base);
|
|
1242
|
+
files = files.filter((file) => changed.has(file));
|
|
1243
|
+
}
|
|
1244
|
+
if (parsed.changedOnly && files.length === 0) {
|
|
1245
|
+
console.log("\u2713 Lint (--changed): no lintable files differ \u2014 nothing to do");
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1248
|
+
const cachePrefix = `${getCacheLocation(args)}-shard-`;
|
|
1249
|
+
const fingerprint = createEslintCacheFingerprint(cwd);
|
|
1250
|
+
for (let shard = 0;shard < parsed.shards; shard++)
|
|
1251
|
+
prepareEslintCache({
|
|
1252
|
+
cacheLocation: relative(cwd, resolve4(cwd, `${cachePrefix}${shard}`)),
|
|
1253
|
+
cwd,
|
|
1254
|
+
fingerprint
|
|
1255
|
+
});
|
|
1256
|
+
const shardChunks = buildShardChunks(files, parsed.shards, parsed.chunkSize);
|
|
1257
|
+
const totalChunks = shardChunks.reduce((sum, list) => sum + list.length, 0);
|
|
1258
|
+
const concurrency = Math.max(1, Number(process.env.LINT_CONCURRENCY) || DEFAULT_CONCURRENCY);
|
|
1259
|
+
console.log(`Linting ${files.length} files in ${totalChunks} chunks of ${parsed.chunkSize} ` + `(${parsed.shards} cache shards, concurrency ${concurrency}${parsed.changedOnly ? ", --changed" : ""})`);
|
|
1260
|
+
const startedAt = Date.now();
|
|
1261
|
+
let failedChunks = 0;
|
|
1262
|
+
let completedChunks = 0;
|
|
1263
|
+
let report = "";
|
|
1264
|
+
const runChunk = async (shard, chunk) => {
|
|
1265
|
+
let results = [
|
|
1266
|
+
await runEslintProcess(chunk, `${cachePrefix}${shard}`, parsed.passthrough, cwd)
|
|
1267
|
+
];
|
|
1268
|
+
if (wasSilentCrash(results, chunk))
|
|
1269
|
+
results = await retryEachFile(chunk, parsed.passthrough, cwd);
|
|
1270
|
+
const combined = results.map((result) => result.combined).join("");
|
|
1271
|
+
const exitCode = results.some((result) => result.exitCode !== 0) ? 1 : 0;
|
|
1272
|
+
const silentFailure = exitCode !== 0 && combined.trim().length === 0 ? `ESLint chunk exited ${exitCode} without diagnostics (${chunk[0]} \u2026 ${chunk[chunk.length - 1]})
|
|
1273
|
+
` : "";
|
|
1274
|
+
if (combined.trim())
|
|
1275
|
+
process.stdout.write(combined);
|
|
1276
|
+
if (silentFailure)
|
|
1277
|
+
process.stderr.write(silentFailure);
|
|
1278
|
+
report += stripAnsi(combined + silentFailure);
|
|
1279
|
+
completedChunks++;
|
|
1280
|
+
process.stdout.write(` \xB7 chunk ${completedChunks}/${totalChunks}
|
|
1281
|
+
`);
|
|
1282
|
+
if (exitCode !== 0)
|
|
1283
|
+
failedChunks++;
|
|
1284
|
+
};
|
|
1285
|
+
const lanes = Array.from({ length: concurrency }, () => []);
|
|
1286
|
+
shardChunks.forEach((chunkList, shard) => lanes[shard % concurrency]?.push(...chunkList.map((chunk) => ({ chunk, shard }))));
|
|
1287
|
+
await Promise.all(lanes.map((laneChunks) => laneChunks.reduce((previous, item) => previous.then(() => runChunk(item.shard, item.chunk)), Promise.resolve())));
|
|
1288
|
+
const summary = ruleSummary(report);
|
|
1289
|
+
const elapsed = ((Date.now() - startedAt) / MS_PER_SECOND).toFixed(1);
|
|
1290
|
+
const header = `eslint report \u2014 ${files.length} files, ${totalChunks} chunks, ${elapsed}s
|
|
1291
|
+
${"=".repeat(SUMMARY_RULE_WIDTH)}
|
|
1292
|
+
`;
|
|
1293
|
+
await Bun.write(resolve4(cwd, parsed.outFile), header + report + summary);
|
|
1294
|
+
console.log(summary);
|
|
1295
|
+
console.log(`Full report written to ${parsed.outFile}`);
|
|
1296
|
+
if (failedChunks > 0) {
|
|
1297
|
+
console.error(`\u2717 Lint failed (${failedChunks}/${totalChunks} chunks) in ${elapsed}s`);
|
|
1298
|
+
process.exit(1);
|
|
1299
|
+
}
|
|
1300
|
+
console.log(`\u2713 Lint passed (${totalChunks} chunks) in ${elapsed}s`);
|
|
1301
|
+
}, gitChangedFiles = (cwd, base) => {
|
|
1302
|
+
const committed = base === null ? [] : gitLines([
|
|
1303
|
+
"git",
|
|
1304
|
+
"diff",
|
|
1305
|
+
"--name-only",
|
|
1306
|
+
"--diff-filter=ACMR",
|
|
1307
|
+
`${base}...HEAD`
|
|
1308
|
+
], cwd);
|
|
1309
|
+
const local = gitLines(["git", "status", "--porcelain"], cwd).map(porcelainPath);
|
|
1310
|
+
return new Set([...committed, ...local]);
|
|
1311
|
+
}, gitVisibleFiles = (cwd) => gitLines(["git", "ls-files", "--cached", "--others", "--exclude-standard"], cwd), parseChunkedArgs = (args) => {
|
|
1312
|
+
const parsed = {
|
|
1313
|
+
changedBase: null,
|
|
1314
|
+
changedOnly: false,
|
|
1315
|
+
chunkSize: DEFAULT_CHUNK_SIZE,
|
|
1316
|
+
globs: [],
|
|
1317
|
+
outFile: DEFAULT_REPORT,
|
|
1318
|
+
passthrough: [],
|
|
1319
|
+
shards: DEFAULT_SHARDS
|
|
1320
|
+
};
|
|
1321
|
+
for (let index = 0;index < args.length; index++) {
|
|
1322
|
+
const arg = args[index];
|
|
1323
|
+
if (arg === undefined || arg === "--chunked")
|
|
1324
|
+
continue;
|
|
1325
|
+
if (arg === "--changed")
|
|
1326
|
+
parsed.changedOnly = true;
|
|
1327
|
+
else if (arg.startsWith("--changed="))
|
|
1328
|
+
applyChangedBase(parsed, arg.slice("--changed=".length));
|
|
1329
|
+
else if (arg === "--changed-base")
|
|
1330
|
+
applyChangedBase(parsed, args[++index] ?? null);
|
|
1331
|
+
else if (arg === "--out")
|
|
1332
|
+
parsed.outFile = args[++index] ?? parsed.outFile;
|
|
1333
|
+
else if (arg.startsWith("--out="))
|
|
1334
|
+
parsed.outFile = arg.slice("--out=".length);
|
|
1335
|
+
else if (arg === "--chunk-size")
|
|
1336
|
+
parsed.chunkSize = Number(args[++index]) || DEFAULT_CHUNK_SIZE;
|
|
1337
|
+
else if (arg === "--shards")
|
|
1338
|
+
parsed.shards = Number(args[++index]) || DEFAULT_SHARDS;
|
|
1339
|
+
else if (arg.startsWith("-"))
|
|
1340
|
+
parsed.passthrough.push(arg);
|
|
1341
|
+
else
|
|
1342
|
+
parsed.globs.push(arg);
|
|
1343
|
+
}
|
|
1344
|
+
return parsed;
|
|
1345
|
+
}, ruleSummary = (report) => {
|
|
1346
|
+
const ruleCounts = new Map;
|
|
1347
|
+
for (const match of report.matchAll(/^\s+\d+:\d+\s+(?:error|warning)\s+.*?\s+([@a-z][\w@/-]*)\s*$/gm)) {
|
|
1348
|
+
const [, rule] = match;
|
|
1349
|
+
if (rule !== undefined)
|
|
1350
|
+
ruleCounts.set(rule, (ruleCounts.get(rule) ?? 0) + 1);
|
|
1351
|
+
}
|
|
1352
|
+
const ranked = [...ruleCounts.entries()].sort(([, leftCount], [, rightCount]) => rightCount - leftCount);
|
|
1353
|
+
const total = ranked.reduce((sum, [, count]) => sum + count, 0);
|
|
1354
|
+
const body = ranked.map(([rule, count]) => ` ${String(count).padStart(SUMMARY_COUNT_PAD)} ${rule}`).join(`
|
|
1355
|
+
`);
|
|
1356
|
+
return `
|
|
1357
|
+
${"=".repeat(SUMMARY_RULE_WIDTH)}
|
|
1358
|
+
BY RULE (${total} problems):
|
|
1359
|
+
${body}
|
|
1360
|
+
`;
|
|
1361
|
+
}, upstreamRef = (cwd) => {
|
|
1362
|
+
const [ref] = gitLines([
|
|
1363
|
+
"git",
|
|
1364
|
+
"rev-parse",
|
|
1365
|
+
"--abbrev-ref",
|
|
1366
|
+
"--symbolic-full-name",
|
|
1367
|
+
"@{upstream}"
|
|
1368
|
+
], cwd);
|
|
1369
|
+
return ref ?? null;
|
|
1370
|
+
};
|
|
1371
|
+
var init_eslintChunked = __esm(() => {
|
|
1372
|
+
init_eslint();
|
|
1373
|
+
LINTABLE_EXTENSIONS = /\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs|vue|svelte)$/;
|
|
1374
|
+
ANSI_COLOR = new RegExp(`${String.fromCharCode(ASCII_ESC)}\\[[0-9;]*m`, "g");
|
|
1375
|
+
});
|
|
1376
|
+
|
|
1161
1377
|
// src/cli/scripts/eslint.ts
|
|
1162
1378
|
import { createHash } from "crypto";
|
|
1163
1379
|
import {
|
|
@@ -1168,7 +1384,7 @@ import {
|
|
|
1168
1384
|
rmSync as rmSync3,
|
|
1169
1385
|
writeFileSync as writeFileSync5
|
|
1170
1386
|
} from "fs";
|
|
1171
|
-
import { dirname as dirname3, relative, resolve as
|
|
1387
|
+
import { dirname as dirname3, relative as relative2, resolve as resolve5 } from "path";
|
|
1172
1388
|
var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION = "1", CACHE_FINGERPRINT_SUFFIX = ".fingerprint", flagValue = (args, flag) => {
|
|
1173
1389
|
const assignment = args.find((arg) => arg.startsWith(`${flag}=`));
|
|
1174
1390
|
if (assignment)
|
|
@@ -1192,14 +1408,14 @@ var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION
|
|
|
1192
1408
|
return false;
|
|
1193
1409
|
}, findConfigPath = (cwd = process.cwd()) => {
|
|
1194
1410
|
for (const name of CONFIG_CANDIDATES) {
|
|
1195
|
-
const candidate =
|
|
1411
|
+
const candidate = resolve5(cwd, name);
|
|
1196
1412
|
if (existsSync6(candidate))
|
|
1197
1413
|
return candidate;
|
|
1198
1414
|
}
|
|
1199
1415
|
return null;
|
|
1200
1416
|
}, fingerprintLocation = (cacheLocation, cwd) => {
|
|
1201
|
-
const absolute =
|
|
1202
|
-
return /[\\/]$/.test(cacheLocation) ?
|
|
1417
|
+
const absolute = resolve5(cwd, cacheLocation);
|
|
1418
|
+
return /[\\/]$/.test(cacheLocation) ? resolve5(absolute, CACHE_FINGERPRINT_SUFFIX.slice(1)) : `${absolute}${CACHE_FINGERPRINT_SUFFIX}`;
|
|
1203
1419
|
}, addFileToFingerprint = (hash, path, label) => {
|
|
1204
1420
|
if (!existsSync6(path))
|
|
1205
1421
|
return;
|
|
@@ -1234,7 +1450,7 @@ var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION
|
|
|
1234
1450
|
return Object.keys(value);
|
|
1235
1451
|
});
|
|
1236
1452
|
}, lintDependencyNames = (cwd, configPath2) => {
|
|
1237
|
-
const manifestPath =
|
|
1453
|
+
const manifestPath = resolve5(cwd, "package.json");
|
|
1238
1454
|
if (!existsSync6(manifestPath))
|
|
1239
1455
|
return configPackageNames(configPath2);
|
|
1240
1456
|
try {
|
|
@@ -1249,7 +1465,7 @@ var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION
|
|
|
1249
1465
|
}, findInstalledManifest = (cwd, dependency) => {
|
|
1250
1466
|
let directory = cwd;
|
|
1251
1467
|
while (true) {
|
|
1252
|
-
const candidate =
|
|
1468
|
+
const candidate = resolve5(directory, "node_modules", dependency, "package.json");
|
|
1253
1469
|
if (existsSync6(candidate))
|
|
1254
1470
|
return candidate;
|
|
1255
1471
|
const parent = dirname3(directory);
|
|
@@ -1262,7 +1478,7 @@ var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION
|
|
|
1262
1478
|
hash.update(`absolute-eslint-cache:${CACHE_CONTRACT_VERSION}\x00`);
|
|
1263
1479
|
const configPath2 = findConfigPath(cwd);
|
|
1264
1480
|
if (configPath2)
|
|
1265
|
-
addFileToFingerprint(hash, configPath2,
|
|
1481
|
+
addFileToFingerprint(hash, configPath2, relative2(cwd, configPath2));
|
|
1266
1482
|
for (const dependency of lintDependencyNames(cwd, configPath2).sort()) {
|
|
1267
1483
|
const manifestPath = findInstalledManifest(cwd, dependency);
|
|
1268
1484
|
if (manifestPath)
|
|
@@ -1277,7 +1493,7 @@ var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION
|
|
|
1277
1493
|
renameSync(temporary, path);
|
|
1278
1494
|
}, prepareEslintCache = (options) => {
|
|
1279
1495
|
const cwd = options.cwd ?? process.cwd();
|
|
1280
|
-
const cachePath =
|
|
1496
|
+
const cachePath = resolve5(cwd, options.cacheLocation);
|
|
1281
1497
|
const metadataPath = fingerprintLocation(options.cacheLocation, cwd);
|
|
1282
1498
|
const fingerprint = options.fingerprint ?? createEslintCacheFingerprint(cwd);
|
|
1283
1499
|
const prior = existsSync6(metadataPath) ? readFileSync8(metadataPath, "utf-8").trim() : null;
|
|
@@ -1407,7 +1623,7 @@ Detected at: ${configPath2}${reset}`);
|
|
|
1407
1623
|
return `${minutes}m ${seconds}s`;
|
|
1408
1624
|
}, handleClearCache = (cacheLocation, cwd = process.cwd()) => {
|
|
1409
1625
|
try {
|
|
1410
|
-
const cachePath =
|
|
1626
|
+
const cachePath = resolve5(cwd, cacheLocation);
|
|
1411
1627
|
const metadataPath = fingerprintLocation(cacheLocation, cwd);
|
|
1412
1628
|
rmSync3(cachePath, { force: true, recursive: true });
|
|
1413
1629
|
rmSync3(metadataPath, { force: true, recursive: true });
|
|
@@ -1435,7 +1651,16 @@ Detected at: ${configPath2}${reset}`);
|
|
|
1435
1651
|
handleClearCache(cacheLocation);
|
|
1436
1652
|
return;
|
|
1437
1653
|
}
|
|
1438
|
-
if (
|
|
1654
|
+
if (args.includes("--chunked")) {
|
|
1655
|
+
if (!existsSync6(resolve5("node_modules", ".bin", "eslint"))) {
|
|
1656
|
+
console.error("\x1B[31m\u2717\x1B[0m ESLint is not installed in this project. Add it (and a flat `eslint.config.*`): bun add -d eslint");
|
|
1657
|
+
process.exit(1);
|
|
1658
|
+
}
|
|
1659
|
+
const { eslintChunked: eslintChunked2 } = await Promise.resolve().then(() => (init_eslintChunked(), exports_eslintChunked));
|
|
1660
|
+
await eslintChunked2(args);
|
|
1661
|
+
return;
|
|
1662
|
+
}
|
|
1663
|
+
if (!existsSync6(resolve5("node_modules", ".bin", "eslint"))) {
|
|
1439
1664
|
console.error("\x1B[31m\u2717\x1B[0m ESLint is not installed in this project. Add it (and a flat `eslint.config.*`): bun add -d eslint");
|
|
1440
1665
|
process.exit(1);
|
|
1441
1666
|
}
|
|
@@ -10472,11 +10697,11 @@ ${lanes.join(`
|
|
|
10472
10697
|
return toComponents;
|
|
10473
10698
|
}
|
|
10474
10699
|
const components = toComponents.slice(start);
|
|
10475
|
-
const
|
|
10700
|
+
const relative3 = [];
|
|
10476
10701
|
for (;start < fromComponents.length; start++) {
|
|
10477
|
-
|
|
10702
|
+
relative3.push("..");
|
|
10478
10703
|
}
|
|
10479
|
-
return ["", ...
|
|
10704
|
+
return ["", ...relative3, ...components];
|
|
10480
10705
|
}
|
|
10481
10706
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
10482
10707
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -47772,9 +47997,9 @@ ${lanes.join(`
|
|
|
47772
47997
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
47773
47998
|
return;
|
|
47774
47999
|
}
|
|
47775
|
-
const
|
|
48000
|
+
const relative3 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
47776
48001
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
47777
|
-
const option = resolvePath(symlinkDirectory,
|
|
48002
|
+
const option = resolvePath(symlinkDirectory, relative3);
|
|
47778
48003
|
const result2 = cb(option, target === referenceRedirect);
|
|
47779
48004
|
shouldFilterIgnoredPaths = true;
|
|
47780
48005
|
if (result2)
|
|
@@ -99890,14 +100115,14 @@ ${lanes.join(`
|
|
|
99890
100115
|
}
|
|
99891
100116
|
}
|
|
99892
100117
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
99893
|
-
const
|
|
100118
|
+
const resolve7 = factory2.createUniqueName("resolve");
|
|
99894
100119
|
const reject = factory2.createUniqueName("reject");
|
|
99895
100120
|
const parameters = [
|
|
99896
|
-
factory2.createParameterDeclaration(undefined, undefined,
|
|
100121
|
+
factory2.createParameterDeclaration(undefined, undefined, resolve7),
|
|
99897
100122
|
factory2.createParameterDeclaration(undefined, undefined, reject)
|
|
99898
100123
|
];
|
|
99899
100124
|
const body = factory2.createBlock([
|
|
99900
|
-
factory2.createExpressionStatement(factory2.createCallExpression(factory2.createIdentifier("require"), undefined, [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
100125
|
+
factory2.createExpressionStatement(factory2.createCallExpression(factory2.createIdentifier("require"), undefined, [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve7, reject]))
|
|
99901
100126
|
]);
|
|
99902
100127
|
let func;
|
|
99903
100128
|
if (languageVersion >= 2) {
|
|
@@ -170072,8 +170297,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
170072
170297
|
installPackage(options) {
|
|
170073
170298
|
this.packageInstallId++;
|
|
170074
170299
|
const request = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
170075
|
-
const promise = new Promise((
|
|
170076
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map)).set(this.packageInstallId, { resolve:
|
|
170300
|
+
const promise = new Promise((resolve7, reject) => {
|
|
170301
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map)).set(this.packageInstallId, { resolve: resolve7, reject });
|
|
170077
170302
|
});
|
|
170078
170303
|
this.installer.send(request);
|
|
170079
170304
|
return promise;
|
|
@@ -170347,7 +170572,7 @@ var isRecord = (value) => typeof value === "object" && value !== null, getIsland
|
|
|
170347
170572
|
var init_islands = () => {};
|
|
170348
170573
|
|
|
170349
170574
|
// src/build/islandEntries.ts
|
|
170350
|
-
import { dirname as dirname4, extname, join as join8, relative as
|
|
170575
|
+
import { dirname as dirname4, extname, join as join8, relative as relative3, resolve as resolve7 } from "path";
|
|
170351
170576
|
var import_typescript, frameworks, isRecord2 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
|
|
170352
170577
|
if (isRecord2(mod.islandRegistry))
|
|
170353
170578
|
return mod.islandRegistry;
|
|
@@ -170358,7 +170583,7 @@ var import_typescript, frameworks, isRecord2 = (value) => typeof value === "obje
|
|
|
170358
170583
|
if (sourcePath.startsWith("file://")) {
|
|
170359
170584
|
return new URL(sourcePath).pathname;
|
|
170360
170585
|
}
|
|
170361
|
-
return
|
|
170586
|
+
return resolve7(dirname4(registryPath), sourcePath);
|
|
170362
170587
|
}, getObjectPropertyName = (name) => {
|
|
170363
170588
|
if (import_typescript.default.isIdentifier(name) || import_typescript.default.isStringLiteral(name)) {
|
|
170364
170589
|
return name.text;
|
|
@@ -170515,7 +170740,7 @@ var import_typescript, frameworks, isRecord2 = (value) => typeof value === "obje
|
|
|
170515
170740
|
registry
|
|
170516
170741
|
};
|
|
170517
170742
|
}, loadIslandRegistryBuildInfo = async (registryPath) => {
|
|
170518
|
-
const resolvedRegistryPath =
|
|
170743
|
+
const resolvedRegistryPath = resolve7(registryPath);
|
|
170519
170744
|
const registrySource = Bun.file(resolvedRegistryPath);
|
|
170520
170745
|
const registrySourceText = await registrySource.text();
|
|
170521
170746
|
const parsedInfo = parseIslandRegistryBuildInfo(registrySourceText, resolvedRegistryPath);
|
|
@@ -171341,7 +171566,7 @@ var init_maskLiterals = __esm(() => {
|
|
|
171341
171566
|
// src/build/nativeRewrite.ts
|
|
171342
171567
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
171343
171568
|
import { platform as platform4, arch as arch3 } from "os";
|
|
171344
|
-
import { resolve as
|
|
171569
|
+
import { resolve as resolve8 } from "path";
|
|
171345
171570
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
171346
171571
|
if (nativeLib !== null)
|
|
171347
171572
|
return nativeLib;
|
|
@@ -171359,7 +171584,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
171359
171584
|
if (!libPath)
|
|
171360
171585
|
return null;
|
|
171361
171586
|
try {
|
|
171362
|
-
const fullPath =
|
|
171587
|
+
const fullPath = resolve8(import.meta.dir, "../../native/packages", libPath);
|
|
171363
171588
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
171364
171589
|
nativeLib = lib.symbols;
|
|
171365
171590
|
return nativeLib;
|
|
@@ -171633,7 +171858,7 @@ var ANSI_REGEX, trySetRawMode2 = () => {
|
|
|
171633
171858
|
return value;
|
|
171634
171859
|
}
|
|
171635
171860
|
return `${value}${" ".repeat(width - plainLength)}`;
|
|
171636
|
-
},
|
|
171861
|
+
}, stripAnsi2 = (value) => value.replace(ANSI_REGEX, ""), truncateText = (value, width) => {
|
|
171637
171862
|
if (width <= 0) {
|
|
171638
171863
|
return "";
|
|
171639
171864
|
}
|
|
@@ -171672,7 +171897,7 @@ __export(exports_build, {
|
|
|
171672
171897
|
build: () => build
|
|
171673
171898
|
});
|
|
171674
171899
|
import { existsSync as existsSync10, readdirSync as readdirSync3, readFileSync as readFileSync13 } from "fs";
|
|
171675
|
-
import { join as join12, resolve as
|
|
171900
|
+
import { join as join12, resolve as resolve11 } from "path";
|
|
171676
171901
|
var PROFILE_TOP = 15, PROFILE_COL = 8, FRAMEWORK_KEYS, cliTag3 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, printProfile = (buildDir) => {
|
|
171677
171902
|
const traceDir = join12(buildDir, ".absolute-trace");
|
|
171678
171903
|
if (!existsSync10(traceDir))
|
|
@@ -171718,7 +171943,7 @@ var PROFILE_TOP = 15, PROFILE_COL = 8, FRAMEWORK_KEYS, cliTag3 = (color, message
|
|
|
171718
171943
|
}
|
|
171719
171944
|
return resolveBuildModule2(remaining);
|
|
171720
171945
|
}, build = async (outdir, configPath2, profile = false) => {
|
|
171721
|
-
const resolvedOutdir =
|
|
171946
|
+
const resolvedOutdir = resolve11(outdir ?? "build");
|
|
171722
171947
|
const buildStart = performance.now();
|
|
171723
171948
|
if (profile)
|
|
171724
171949
|
process.env.ABSOLUTE_BUILD_TRACE = "1";
|
|
@@ -171728,8 +171953,8 @@ var PROFILE_TOP = 15, PROFILE_COL = 8, FRAMEWORK_KEYS, cliTag3 = (color, message
|
|
|
171728
171953
|
buildConfig.mode = "production";
|
|
171729
171954
|
try {
|
|
171730
171955
|
const buildApp = await resolveBuildModule2([
|
|
171731
|
-
|
|
171732
|
-
|
|
171956
|
+
resolve11(import.meta.dir, "..", "..", "core", "build"),
|
|
171957
|
+
resolve11(import.meta.dir, "..", "build")
|
|
171733
171958
|
]);
|
|
171734
171959
|
if (!buildApp)
|
|
171735
171960
|
throw new Error("Could not locate build module");
|
|
@@ -171785,7 +172010,7 @@ import {
|
|
|
171785
172010
|
writeFileSync as writeFileSync7
|
|
171786
172011
|
} from "fs";
|
|
171787
172012
|
import { tmpdir as tmpdir2 } from "os";
|
|
171788
|
-
import { delimiter, dirname as dirname5, relative as
|
|
172013
|
+
import { delimiter, dirname as dirname5, relative as relative4, resolve as resolve12 } from "path";
|
|
171789
172014
|
var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSION = 1, FLAG_NOT_FOUND = -1, runGit = (args, options) => {
|
|
171790
172015
|
const proc = Bun.spawnSync(["git", ...args], {
|
|
171791
172016
|
cwd: options.cwd,
|
|
@@ -171798,8 +172023,8 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
171798
172023
|
throw new Error(detail || `git ${args.join(" ")} failed`);
|
|
171799
172024
|
}
|
|
171800
172025
|
return proc.stdout.toString().trim();
|
|
171801
|
-
}, gitRoot = (cwd) =>
|
|
171802
|
-
const path =
|
|
172026
|
+
}, gitRoot = (cwd) => resolve12(runGit(["rev-parse", "--show-toplevel"], { cwd })), isInside = (parent, candidate) => {
|
|
172027
|
+
const path = relative4(parent, candidate);
|
|
171803
172028
|
return path === "" || !path.startsWith("../") && path !== "..";
|
|
171804
172029
|
}, attestationPayload = (proof) => Buffer.from([
|
|
171805
172030
|
"absolute-lint-proof-attestation:1",
|
|
@@ -171811,7 +172036,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
171811
172036
|
sourceTree: proof.sourceTree
|
|
171812
172037
|
})
|
|
171813
172038
|
].join("\x00")), publicKeyId = (key) => createHash2("sha256").update(key.export({ format: "der", type: "spki" })).digest("hex"), readEd25519PrivateKey = (cwd, location) => {
|
|
171814
|
-
const path =
|
|
172039
|
+
const path = resolve12(cwd, location);
|
|
171815
172040
|
if (isInside(realpathSync(gitRoot(cwd)), realpathSync(path))) {
|
|
171816
172041
|
throw new Error("lint proof signing key must live outside the Git working tree");
|
|
171817
172042
|
}
|
|
@@ -171821,7 +172046,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
171821
172046
|
}
|
|
171822
172047
|
return key;
|
|
171823
172048
|
}, readEd25519PublicKey = (cwd, location) => {
|
|
171824
|
-
const key = createPublicKey(readFileSync14(
|
|
172049
|
+
const key = createPublicKey(readFileSync14(resolve12(cwd, location)));
|
|
171825
172050
|
if (key.asymmetricKeyType !== "ed25519") {
|
|
171826
172051
|
throw new Error("trusted lint proof key must be an Ed25519 public key");
|
|
171827
172052
|
}
|
|
@@ -171836,17 +172061,17 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
171836
172061
|
}
|
|
171837
172062
|
}, createLintSourceTree = (cwd = process.cwd(), proofLocation = DEFAULT_PROOF_LOCATION) => {
|
|
171838
172063
|
const root = gitRoot(cwd);
|
|
171839
|
-
const proofPath =
|
|
171840
|
-
const proofRelative =
|
|
172064
|
+
const proofPath = resolve12(cwd, proofLocation);
|
|
172065
|
+
const proofRelative = relative4(root, proofPath).replaceAll("\\", "/");
|
|
171841
172066
|
if (proofRelative === ".." || proofRelative.startsWith("../") || proofRelative === "") {
|
|
171842
172067
|
throw new Error("lint proof must live inside the Git working tree");
|
|
171843
172068
|
}
|
|
171844
|
-
const temporaryDirectory = mkdtempSync(
|
|
171845
|
-
const temporaryIndex =
|
|
171846
|
-
const temporaryObjects =
|
|
172069
|
+
const temporaryDirectory = mkdtempSync(resolve12(tmpdir2(), "absolute-lint-proof-"));
|
|
172070
|
+
const temporaryIndex = resolve12(temporaryDirectory, "index");
|
|
172071
|
+
const temporaryObjects = resolve12(temporaryDirectory, "objects");
|
|
171847
172072
|
mkdirSync8(temporaryObjects, { recursive: true });
|
|
171848
172073
|
const repositoryObjectsPath = runGit(["rev-parse", "--git-path", "objects"], { cwd: root });
|
|
171849
|
-
const repositoryObjects =
|
|
172074
|
+
const repositoryObjects = resolve12(root, repositoryObjectsPath);
|
|
171850
172075
|
const existingAlternates = process.env.GIT_ALTERNATE_OBJECT_DIRECTORIES?.trim();
|
|
171851
172076
|
const env3 = {
|
|
171852
172077
|
GIT_ALTERNATE_OBJECT_DIRECTORIES: [
|
|
@@ -171862,7 +172087,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
171862
172087
|
if (!path || path === proofRelative)
|
|
171863
172088
|
return false;
|
|
171864
172089
|
try {
|
|
171865
|
-
lstatSync(
|
|
172090
|
+
lstatSync(resolve12(root, path));
|
|
171866
172091
|
return true;
|
|
171867
172092
|
} catch {
|
|
171868
172093
|
return false;
|
|
@@ -171886,7 +172111,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
171886
172111
|
}, writeLintProof = (command, options = {}) => {
|
|
171887
172112
|
const cwd = options.cwd ?? process.cwd();
|
|
171888
172113
|
const proofLocation = options.proofLocation ?? DEFAULT_PROOF_LOCATION;
|
|
171889
|
-
const path =
|
|
172114
|
+
const path = resolve12(cwd, proofLocation);
|
|
171890
172115
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
171891
172116
|
const proof = createLintProof(command, { cwd, proofLocation });
|
|
171892
172117
|
if (options.signingKeyLocation) {
|
|
@@ -171942,7 +172167,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
171942
172167
|
}, verifyLintProof = (command, options = {}) => {
|
|
171943
172168
|
const cwd = options.cwd ?? process.cwd();
|
|
171944
172169
|
const proofLocation = options.proofLocation ?? DEFAULT_PROOF_LOCATION;
|
|
171945
|
-
const path =
|
|
172170
|
+
const path = resolve12(cwd, proofLocation);
|
|
171946
172171
|
if (!existsSync11(path))
|
|
171947
172172
|
return { reason: `missing lint proof: ${proofLocation}`, valid: false };
|
|
171948
172173
|
let proof;
|
|
@@ -172118,7 +172343,7 @@ __export(exports_ls, {
|
|
|
172118
172343
|
runLs: () => runLs
|
|
172119
172344
|
});
|
|
172120
172345
|
import { existsSync as existsSync13, readFileSync as readFileSync15, statSync } from "fs";
|
|
172121
|
-
import { basename as basename5, extname as extname3, join as join13, relative as
|
|
172346
|
+
import { basename as basename5, extname as extname3, join as join13, relative as relative5 } from "path";
|
|
172122
172347
|
var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELDS, readStringField = (source, key) => {
|
|
172123
172348
|
const value = Reflect.get(source, key);
|
|
172124
172349
|
return typeof value === "string" ? value : undefined;
|
|
@@ -172133,7 +172358,7 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
|
|
|
172133
172358
|
} catch {
|
|
172134
172359
|
return null;
|
|
172135
172360
|
}
|
|
172136
|
-
}, relativeOrSelf = (target) =>
|
|
172361
|
+
}, relativeOrSelf = (target) => relative5(process.cwd(), target) || target, configCandidates = (raw) => isWorkspaceConfig(raw) ? Object.values(raw).map((service) => ({
|
|
172137
172362
|
baseDir: readStringField(service, "cwd") ?? ".",
|
|
172138
172363
|
source: service
|
|
172139
172364
|
})) : [{ baseDir: ".", source: raw }], specsFor = (source, baseDir) => FRAMEWORK_FIELDS.flatMap((framework) => {
|
|
@@ -172361,7 +172586,7 @@ var init_formatBytes = __esm(() => {
|
|
|
172361
172586
|
});
|
|
172362
172587
|
|
|
172363
172588
|
// src/cli/discoverInstances.ts
|
|
172364
|
-
var
|
|
172589
|
+
var MS_PER_SECOND2 = 1000, isJsRuntime = (command) => /\b(bun|deno|node)\b/.test(command), TOOLING_RE, isToolingProcess = (command) => TOOLING_RE.test(command), untrackedName = (command) => {
|
|
172365
172590
|
const entry = command.split(/\s+/).find((token) => /\.(cjs|js|mjs|ts)$/.test(token));
|
|
172366
172591
|
if (entry === undefined)
|
|
172367
172592
|
return "untracked";
|
|
@@ -172385,7 +172610,7 @@ var MS_PER_SECOND = 1000, isJsRuntime = (command) => /\b(bun|deno|node)\b/.test(
|
|
|
172385
172610
|
port: listener.port,
|
|
172386
172611
|
ppid: 0,
|
|
172387
172612
|
source: "untracked",
|
|
172388
|
-
startedAt: new Date(Date.now() - listener.etimes *
|
|
172613
|
+
startedAt: new Date(Date.now() - listener.etimes * MS_PER_SECOND2).toISOString()
|
|
172389
172614
|
}), compareInstances2 = (left, right) => {
|
|
172390
172615
|
const leftPort = left.port ?? Number.MAX_SAFE_INTEGER;
|
|
172391
172616
|
const rightPort = right.port ?? Number.MAX_SAFE_INTEGER;
|
|
@@ -172423,21 +172648,21 @@ var init_discoverInstances = __esm(() => {
|
|
|
172423
172648
|
import { createConnection as createConnection2 } from "net";
|
|
172424
172649
|
var {$: $4 } = globalThis.Bun;
|
|
172425
172650
|
var displayHost = (host) => host === "0.0.0.0" || host === "::" ? "localhost" : host, probePort = (host, port) => {
|
|
172426
|
-
const { promise, resolve:
|
|
172651
|
+
const { promise, resolve: resolve13 } = Promise.withResolvers();
|
|
172427
172652
|
const socket = createConnection2({ host: displayHost(host), port });
|
|
172428
172653
|
const timeout = setTimeout(() => {
|
|
172429
172654
|
socket.destroy();
|
|
172430
|
-
|
|
172655
|
+
resolve13(false);
|
|
172431
172656
|
}, INSTANCE_PROBE_TIMEOUT_MS);
|
|
172432
172657
|
socket.once("connect", () => {
|
|
172433
172658
|
clearTimeout(timeout);
|
|
172434
172659
|
socket.end();
|
|
172435
|
-
|
|
172660
|
+
resolve13(true);
|
|
172436
172661
|
});
|
|
172437
172662
|
socket.once("error", () => {
|
|
172438
172663
|
clearTimeout(timeout);
|
|
172439
172664
|
socket.destroy();
|
|
172440
|
-
|
|
172665
|
+
resolve13(false);
|
|
172441
172666
|
});
|
|
172442
172667
|
return promise;
|
|
172443
172668
|
}, probeStatus = async (record) => {
|
|
@@ -172938,7 +173163,7 @@ var TUI_HEADERS, STATUS_INDEX = 8, URL_INDEX = 9, MEM_HISTORY_MAX = 12, SPARK_CH
|
|
|
172938
173163
|
if (lines.length === 0) {
|
|
172939
173164
|
return [`${colors.dim}No output yet.${colors.reset}`];
|
|
172940
173165
|
}
|
|
172941
|
-
return lines.map((line) => truncateText(
|
|
173166
|
+
return lines.map((line) => truncateText(stripAnsi2(line), Math.max(1, width - 1)));
|
|
172942
173167
|
};
|
|
172943
173168
|
const pushLogRows = (rows, width, logHeight) => {
|
|
172944
173169
|
const contentLines = logContentLines(width);
|
|
@@ -173306,10 +173531,10 @@ import {
|
|
|
173306
173531
|
statSync as statSync2,
|
|
173307
173532
|
writeFileSync as writeFileSync8
|
|
173308
173533
|
} from "fs";
|
|
173309
|
-
import { resolve as
|
|
173534
|
+
import { resolve as resolve13 } from "path";
|
|
173310
173535
|
var import_typescript4, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DEPTH = 6, isFrameworkRepo = (cwd) => {
|
|
173311
173536
|
try {
|
|
173312
|
-
const pkg = JSON.parse(readFileSync17(
|
|
173537
|
+
const pkg = JSON.parse(readFileSync17(resolve13(cwd, "package.json"), "utf-8"));
|
|
173313
173538
|
return pkg?.name === "@absolutejs/absolute";
|
|
173314
173539
|
} catch {
|
|
173315
173540
|
return false;
|
|
@@ -173330,10 +173555,10 @@ var import_typescript4, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
173330
173555
|
};
|
|
173331
173556
|
}, SCHEMA_VERSION = 1, packageVersion = (cwd, specifier) => {
|
|
173332
173557
|
const candidates = specifier === "@absolutejs/absolute" ? [
|
|
173333
|
-
|
|
173334
|
-
|
|
173558
|
+
resolve13(cwd, "node_modules", "@absolutejs", "absolute", "package.json"),
|
|
173559
|
+
resolve13(cwd, "package.json")
|
|
173335
173560
|
] : [
|
|
173336
|
-
|
|
173561
|
+
resolve13(cwd, "node_modules", ...specifier.split("/"), "package.json")
|
|
173337
173562
|
];
|
|
173338
173563
|
for (const candidate of candidates) {
|
|
173339
173564
|
try {
|
|
@@ -173348,13 +173573,13 @@ var import_typescript4, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
173348
173573
|
if (local) {
|
|
173349
173574
|
const file = typeName === "PackageJson" ? "packageJson.ts" : "build.ts";
|
|
173350
173575
|
try {
|
|
173351
|
-
signature += `:${statSync2(
|
|
173576
|
+
signature += `:${statSync2(resolve13(cwd, "types", file)).mtimeMs}`;
|
|
173352
173577
|
} catch {}
|
|
173353
173578
|
}
|
|
173354
173579
|
return signature;
|
|
173355
173580
|
}, cacheSlug = (specifier) => specifier.replace("@", "").split("/").join("-"), cacheFile = (cwd, typeName, specifier) => {
|
|
173356
173581
|
const name = specifier === "@absolutejs/absolute" ? typeName : `${typeName}.${cacheSlug(specifier)}`;
|
|
173357
|
-
return
|
|
173582
|
+
return resolve13(cwd, ".absolutejs", "config-schema", `${name}.json`);
|
|
173358
173583
|
}, readDiskCache = (cwd, typeName, signature, specifier) => {
|
|
173359
173584
|
try {
|
|
173360
173585
|
const cached = JSON.parse(readFileSync17(cacheFile(cwd, typeName, specifier), "utf-8"));
|
|
@@ -173365,7 +173590,7 @@ var import_typescript4, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
173365
173590
|
return null;
|
|
173366
173591
|
}, writeDiskCache = (cwd, typeName, signature, fields, specifier) => {
|
|
173367
173592
|
try {
|
|
173368
|
-
mkdirSync9(
|
|
173593
|
+
mkdirSync9(resolve13(cwd, ".absolutejs", "config-schema"), {
|
|
173369
173594
|
recursive: true
|
|
173370
173595
|
});
|
|
173371
173596
|
writeFileSync8(cacheFile(cwd, typeName, specifier), JSON.stringify({ fields, signature }));
|
|
@@ -173452,7 +173677,7 @@ var import_typescript4, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
173452
173677
|
}
|
|
173453
173678
|
return opaque();
|
|
173454
173679
|
}, introspectFrom = (cwd, specifier, typeName, options, exclude) => {
|
|
173455
|
-
const virtualPath =
|
|
173680
|
+
const virtualPath = resolve13(cwd, VIRTUAL_NAME);
|
|
173456
173681
|
const source = `import type { ${typeName} } from '${specifier}';
|
|
173457
173682
|
declare const value: ${typeName};
|
|
173458
173683
|
export { value };
|
|
@@ -173495,7 +173720,7 @@ export { value };
|
|
|
173495
173720
|
const cached = cache.get(cacheKey);
|
|
173496
173721
|
if (cached)
|
|
173497
173722
|
return cached;
|
|
173498
|
-
const local = specifier === "@absolutejs/absolute" && isFrameworkRepo(cwd) && existsSync15(
|
|
173723
|
+
const local = specifier === "@absolutejs/absolute" && isFrameworkRepo(cwd) && existsSync15(resolve13(cwd, "types/index.ts"));
|
|
173499
173724
|
const signature = cacheSignature(cwd, typeName, local, specifier);
|
|
173500
173725
|
const fromDisk = readDiskCache(cwd, typeName, signature, specifier);
|
|
173501
173726
|
if (fromDisk) {
|
|
@@ -173524,14 +173749,14 @@ var init_fromType = __esm(() => {
|
|
|
173524
173749
|
|
|
173525
173750
|
// src/cli/config/absolute/resolveAbsoluteConfig.ts
|
|
173526
173751
|
import { existsSync as existsSync16, readFileSync as readFileSync18 } from "fs";
|
|
173527
|
-
import { resolve as
|
|
173752
|
+
import { resolve as resolve14 } from "path";
|
|
173528
173753
|
var import_typescript5, CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath2 = (cwd, override) => {
|
|
173529
173754
|
if (override) {
|
|
173530
|
-
const resolved =
|
|
173755
|
+
const resolved = resolve14(cwd, override);
|
|
173531
173756
|
return existsSync16(resolved) ? resolved : null;
|
|
173532
173757
|
}
|
|
173533
173758
|
for (const name of CONFIG_CANDIDATES2) {
|
|
173534
|
-
const candidate =
|
|
173759
|
+
const candidate = resolve14(cwd, name);
|
|
173535
173760
|
if (existsSync16(candidate))
|
|
173536
173761
|
return candidate;
|
|
173537
173762
|
}
|
|
@@ -173765,8 +173990,8 @@ var init_frameworks = __esm(() => {
|
|
|
173765
173990
|
});
|
|
173766
173991
|
|
|
173767
173992
|
// src/cli/generate/context.ts
|
|
173768
|
-
import { dirname as dirname6, isAbsolute, join as join14, relative as
|
|
173769
|
-
var asString = (value) => typeof value === "string" ? value : undefined, isRecord5 = (value) => typeof value === "object" && value !== null, resolveDir = (cwd, value) => isAbsolute(value) ? value :
|
|
173993
|
+
import { dirname as dirname6, isAbsolute, join as join14, relative as relative6, resolve as resolve15 } from "path";
|
|
173994
|
+
var asString = (value) => typeof value === "string" ? value : undefined, isRecord5 = (value) => typeof value === "object" && value !== null, resolveDir = (cwd, value) => isAbsolute(value) ? value : resolve15(cwd, value), resolveStylesDir = (cwd, config) => {
|
|
173770
173995
|
const styles = config.stylesConfig;
|
|
173771
173996
|
if (typeof styles === "string")
|
|
173772
173997
|
return resolveDir(cwd, styles);
|
|
@@ -173775,10 +174000,10 @@ var asString = (value) => typeof value === "string" ? value : undefined, isRecor
|
|
|
173775
174000
|
if (indexes)
|
|
173776
174001
|
return resolveDir(cwd, indexes);
|
|
173777
174002
|
}
|
|
173778
|
-
return
|
|
174003
|
+
return resolve15(cwd, "src/frontend/styles/indexes");
|
|
173779
174004
|
}, configuredFrameworks = (project) => FRAMEWORK_KEYS2.filter((key) => project.frameworkDirs[key] !== undefined), frontendRootFor = (project, framework) => {
|
|
173780
174005
|
const dir = project.frameworkDirs[framework];
|
|
173781
|
-
return dir ? dirname6(dir) :
|
|
174006
|
+
return dir ? dirname6(dir) : resolve15(project.cwd, "src/frontend");
|
|
173782
174007
|
}, resolveProject = async (cwd, configOverride) => {
|
|
173783
174008
|
const loaded = await loadConfig(configOverride);
|
|
173784
174009
|
const config = isRecord5(loaded) ? loaded : {};
|
|
@@ -173829,7 +174054,7 @@ var asString = (value) => typeof value === "string" ? value : undefined, isRecor
|
|
|
173829
174054
|
ok: false
|
|
173830
174055
|
};
|
|
173831
174056
|
}, sharedDirFor = (project, framework) => join14(frontendRootFor(project, framework), "shared"), toModuleSpecifier = (fromDir, toFileNoExt) => {
|
|
173832
|
-
const rel =
|
|
174057
|
+
const rel = relative6(fromDir, toFileNoExt).split("\\").join("/");
|
|
173833
174058
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
173834
174059
|
};
|
|
173835
174060
|
var init_context = __esm(() => {
|
|
@@ -174552,12 +174777,12 @@ import {
|
|
|
174552
174777
|
readdirSync as readdirSync5,
|
|
174553
174778
|
writeFileSync as writeFileSync13
|
|
174554
174779
|
} from "fs";
|
|
174555
|
-
import { dirname as dirname11, join as join19, relative as
|
|
174780
|
+
import { dirname as dirname11, join as join19, relative as relative7 } from "path";
|
|
174556
174781
|
var writeNew = (path, contents) => {
|
|
174557
174782
|
mkdirSync13(dirname11(path), { recursive: true });
|
|
174558
174783
|
writeFileSync13(path, contents, "utf-8");
|
|
174559
174784
|
}, toHref = (fromDir, toFile) => {
|
|
174560
|
-
const rel =
|
|
174785
|
+
const rel = relative7(fromDir, toFile).split("\\").join("/");
|
|
174561
174786
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
174562
174787
|
}, staticPageFiles = (project) => ["html", "htmx"].map((key) => project.frameworkDirs[key]).map((dir) => dir ? join19(dir, "pages") : null).filter((pagesDir) => pagesDir !== null && existsSync22(pagesDir)).flatMap((pagesDir) => readdirSync5(pagesDir).filter((name) => name.endsWith(".html")).map((name) => join19(pagesDir, name))), resyncPage = (file, items) => {
|
|
174563
174788
|
const html = readFileSync21(file, "utf-8");
|
|
@@ -174649,7 +174874,7 @@ var exports_generate = {};
|
|
|
174649
174874
|
__export(exports_generate, {
|
|
174650
174875
|
runGenerate: () => runGenerate
|
|
174651
174876
|
});
|
|
174652
|
-
import { relative as
|
|
174877
|
+
import { relative as relative8 } from "path";
|
|
174653
174878
|
var SUBCOMMANDS, write = (text) => process.stdout.write(`${text}
|
|
174654
174879
|
`), fail = (message) => {
|
|
174655
174880
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -174681,7 +174906,7 @@ var SUBCOMMANDS, write = (text) => process.stdout.write(`${text}
|
|
|
174681
174906
|
return;
|
|
174682
174907
|
write(` ${colors.dim}${label}${colors.reset}`);
|
|
174683
174908
|
for (const path of paths)
|
|
174684
|
-
write(` ${
|
|
174909
|
+
write(` ${relative8(cwd, path)}`);
|
|
174685
174910
|
}, printSummary = (title, outcome, cwd) => {
|
|
174686
174911
|
for (const note of outcome.notes) {
|
|
174687
174912
|
write(`${colors.yellow}!${colors.reset} ${note}`);
|
|
@@ -175473,14 +175698,14 @@ var init_authCatalog = __esm(() => {
|
|
|
175473
175698
|
|
|
175474
175699
|
// src/cli/config/auth/resolveAuthSettings.ts
|
|
175475
175700
|
import { existsSync as existsSync24, readFileSync as readFileSync24 } from "fs";
|
|
175476
|
-
import { resolve as
|
|
175701
|
+
import { resolve as resolve16 } from "path";
|
|
175477
175702
|
var import_typescript10, AUTH_PACKAGE = "@absolutejs/auth", CONFIG_CANDIDATES3, findAuthSettingsPath = (cwd, override) => {
|
|
175478
175703
|
if (override) {
|
|
175479
|
-
const resolved =
|
|
175704
|
+
const resolved = resolve16(cwd, override);
|
|
175480
175705
|
return existsSync24(resolved) ? resolved : null;
|
|
175481
175706
|
}
|
|
175482
175707
|
for (const name of CONFIG_CANDIDATES3) {
|
|
175483
|
-
const candidate =
|
|
175708
|
+
const candidate = resolve16(cwd, name);
|
|
175484
175709
|
if (existsSync24(candidate))
|
|
175485
175710
|
return candidate;
|
|
175486
175711
|
}
|
|
@@ -175578,7 +175803,7 @@ var init_resolveAuthSettings = __esm(() => {
|
|
|
175578
175803
|
|
|
175579
175804
|
// src/cli/config/auth/resolveAuthState.ts
|
|
175580
175805
|
import { existsSync as existsSync25, readdirSync as readdirSync6, readFileSync as readFileSync25 } from "fs";
|
|
175581
|
-
import { join as join21, relative as
|
|
175806
|
+
import { join as join21, relative as relative9, resolve as resolve17 } from "path";
|
|
175582
175807
|
var import_typescript11, AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https://github.com/absolutejs/absolute-auth", NPM_URL = "https://www.npmjs.com/package/@absolutejs/auth", SKIP_DIRS, MAX_FILES = 4000, SETUP_EXPORTS, isRecord7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
|
|
175583
175808
|
if (!existsSync25(path))
|
|
175584
175809
|
return null;
|
|
@@ -175717,7 +175942,7 @@ var import_typescript11, AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https:/
|
|
|
175717
175942
|
if (found === null)
|
|
175718
175943
|
continue;
|
|
175719
175944
|
match = found;
|
|
175720
|
-
setupPath =
|
|
175945
|
+
setupPath = relative9(cwd, resolve17(file));
|
|
175721
175946
|
break;
|
|
175722
175947
|
}
|
|
175723
175948
|
const keys = match?.keys ?? new Set;
|
|
@@ -175756,7 +175981,7 @@ var init_resolveAuthState = __esm(() => {
|
|
|
175756
175981
|
|
|
175757
175982
|
// src/cli/config/auth/scaffoldAuthFeature.ts
|
|
175758
175983
|
import { existsSync as existsSync26, writeFileSync as writeFileSync15 } from "fs";
|
|
175759
|
-
import { dirname as dirname12, join as join22, relative as
|
|
175984
|
+
import { dirname as dirname12, join as join22, relative as relative10, resolve as resolve18 } from "path";
|
|
175760
175985
|
var renderScaffold = (scaffold) => {
|
|
175761
175986
|
const importNames = [...scaffold.imports, `type ${scaffold.typeName}`];
|
|
175762
175987
|
const importLine = `import { ${importNames.join(", ")} } from '@absolutejs/auth';`;
|
|
@@ -175781,7 +176006,7 @@ ${body}
|
|
|
175781
176006
|
}, targetDir = (cwd) => {
|
|
175782
176007
|
const { setupPath } = resolveAuthState(cwd);
|
|
175783
176008
|
if (setupPath)
|
|
175784
|
-
return dirname12(
|
|
176009
|
+
return dirname12(resolve18(cwd, setupPath));
|
|
175785
176010
|
const src = join22(cwd, "src");
|
|
175786
176011
|
return existsSync26(src) ? src : cwd;
|
|
175787
176012
|
}, spreadFor = (scaffold) => `import { ${scaffold.exportName} } from './${scaffold.exportName}';
|
|
@@ -175797,7 +176022,7 @@ ${scaffold.configKey}: ${scaffold.exportName}`, failure2 = (message) => ({
|
|
|
175797
176022
|
if (!scaffold)
|
|
175798
176023
|
return failure2(`Unknown auth feature "${id}".`);
|
|
175799
176024
|
const filePath = join22(targetDir(cwd), `${scaffold.exportName}.ts`);
|
|
175800
|
-
const relPath =
|
|
176025
|
+
const relPath = relative10(cwd, filePath);
|
|
175801
176026
|
if (existsSync26(filePath)) {
|
|
175802
176027
|
return {
|
|
175803
176028
|
created: null,
|
|
@@ -175862,7 +176087,7 @@ var exports_add = {};
|
|
|
175862
176087
|
__export(exports_add, {
|
|
175863
176088
|
runAdd: () => runAdd
|
|
175864
176089
|
});
|
|
175865
|
-
import { dirname as dirname13, join as join24, relative as
|
|
176090
|
+
import { dirname as dirname13, join as join24, relative as relative11 } from "path";
|
|
175866
176091
|
var write2 = (text) => process.stdout.write(`${text}
|
|
175867
176092
|
`), fail2 = (message) => {
|
|
175868
176093
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -175873,7 +176098,7 @@ var write2 = (text) => process.stdout.write(`${text}
|
|
|
175873
176098
|
return;
|
|
175874
176099
|
write2(` ${colors.dim}${label}${colors.reset}`);
|
|
175875
176100
|
for (const path of paths)
|
|
175876
|
-
write2(` ${
|
|
176101
|
+
write2(` ${relative11(cwd, path)}`);
|
|
175877
176102
|
}, frontendRoot = (project, cwd) => {
|
|
175878
176103
|
const [firstKey] = configuredFrameworks(project);
|
|
175879
176104
|
const firstDir = firstKey ? project.frameworkDirs[firstKey] : undefined;
|
|
@@ -175942,7 +176167,7 @@ var write2 = (text) => process.stdout.write(`${text}
|
|
|
175942
176167
|
return;
|
|
175943
176168
|
}
|
|
175944
176169
|
const dirAbs = join24(frontendRoot(project, cwd), framework);
|
|
175945
|
-
const dirRel = `./${
|
|
176170
|
+
const dirRel = `./${relative11(cwd, dirAbs).split("\\").join("/")}`;
|
|
175946
176171
|
let depNote = "Skipped dependency install (--no-install).";
|
|
175947
176172
|
if (!noInstall) {
|
|
175948
176173
|
write2(`${colors.dim}Installing ${frameworks2[framework].label} dependencies\u2026${colors.reset}`);
|
|
@@ -176012,7 +176237,7 @@ __export(exports_analyze, {
|
|
|
176012
176237
|
runAnalyze: () => runAnalyze
|
|
176013
176238
|
});
|
|
176014
176239
|
import { existsSync as existsSync28, readFileSync as readFileSync27, statSync as statSync3, writeFileSync as writeFileSync17 } from "fs";
|
|
176015
|
-
import { join as join25, resolve as
|
|
176240
|
+
import { join as join25, resolve as resolve19 } from "path";
|
|
176016
176241
|
var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_WIDTH = 16, SIZE_WIDTH = 12, CHANGE_WIDTH = 10, CATEGORY_ORDER, categoryOf = (key) => {
|
|
176017
176242
|
if (key.startsWith("Island"))
|
|
176018
176243
|
return "Islands";
|
|
@@ -176124,7 +176349,7 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
|
|
|
176124
176349
|
const config = await loadConfig(configIndex >= 0 ? args[configIndex + 1] : undefined);
|
|
176125
176350
|
const outdirIndex = args.indexOf("--outdir");
|
|
176126
176351
|
const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
|
|
176127
|
-
const sizes = readSizes(
|
|
176352
|
+
const sizes = readSizes(resolve19(cwd, outdir ?? "build"));
|
|
176128
176353
|
if (sizes === null) {
|
|
176129
176354
|
process.stdout.write(`${colors.dim}No build found. Run \`absolute build\` first.${colors.reset}
|
|
176130
176355
|
`);
|
|
@@ -176378,7 +176603,7 @@ __export(exports_remove, {
|
|
|
176378
176603
|
runRemove: () => runRemove
|
|
176379
176604
|
});
|
|
176380
176605
|
import { existsSync as existsSync29, readFileSync as readFileSync28 } from "fs";
|
|
176381
|
-
import { relative as
|
|
176606
|
+
import { relative as relative12 } from "path";
|
|
176382
176607
|
var write3 = (text) => process.stdout.write(`${text}
|
|
176383
176608
|
`), fail3 = (message) => {
|
|
176384
176609
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -176427,10 +176652,10 @@ var write3 = (text) => process.stdout.write(`${text}
|
|
|
176427
176652
|
}
|
|
176428
176653
|
write3(`${colors.green}\u2713${colors.reset} Removed ${framework}Directory from absolute.config.ts
|
|
176429
176654
|
`);
|
|
176430
|
-
write3(` ${colors.dim}Kept${colors.reset} ${
|
|
176655
|
+
write3(` ${colors.dim}Kept${colors.reset} ${relative12(cwd, frameworkDir)} \u2014 delete its source manually if no longer needed.`);
|
|
176431
176656
|
const refs = referencingFiles(project.serverEntry, HANDLER_NAME[framework]);
|
|
176432
176657
|
for (const file of refs) {
|
|
176433
|
-
write3(` ${colors.yellow}Still references${colors.reset} ${
|
|
176658
|
+
write3(` ${colors.yellow}Still references${colors.reset} ${relative12(cwd, file)} (calls ${HANDLER_NAME[framework]})`);
|
|
176434
176659
|
}
|
|
176435
176660
|
const deps = frameworkDependencyNames(framework);
|
|
176436
176661
|
if (prune && deps.length > 0) {
|
|
@@ -176887,7 +177112,7 @@ import {
|
|
|
176887
177112
|
writeFileSync as writeFileSync19
|
|
176888
177113
|
} from "fs";
|
|
176889
177114
|
import { createRequire } from "module";
|
|
176890
|
-
import { dirname as dirname14, join as join28, resolve as
|
|
177115
|
+
import { dirname as dirname14, join as join28, resolve as resolve20, sep } from "path";
|
|
176891
177116
|
var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
176892
177117
|
try {
|
|
176893
177118
|
const parsed = JSON.parse(readFileSync31(path, "utf-8"));
|
|
@@ -176929,18 +177154,18 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176929
177154
|
}
|
|
176930
177155
|
}
|
|
176931
177156
|
}, findInstallRoot = (cwd) => {
|
|
176932
|
-
let directory =
|
|
177157
|
+
let directory = resolve20(cwd);
|
|
176933
177158
|
for (;; ) {
|
|
176934
177159
|
if (existsSync33(join28(directory, "bun.lock")) || existsSync33(join28(directory, "bun.lockb"))) {
|
|
176935
177160
|
return directory;
|
|
176936
177161
|
}
|
|
176937
177162
|
const parent = dirname14(directory);
|
|
176938
177163
|
if (parent === directory)
|
|
176939
|
-
return
|
|
177164
|
+
return resolve20(cwd);
|
|
176940
177165
|
directory = parent;
|
|
176941
177166
|
}
|
|
176942
177167
|
}, findProjectManifest = (cwd, installRoot) => {
|
|
176943
|
-
let directory =
|
|
177168
|
+
let directory = resolve20(cwd);
|
|
176944
177169
|
for (;; ) {
|
|
176945
177170
|
const candidate = join28(directory, "package.json");
|
|
176946
177171
|
if (existsSync33(candidate))
|
|
@@ -177386,7 +177611,7 @@ var CHROME_LINES = 6, MIN_LIST_HEIGHT = 3, driveInspectTui = async (terminal) =>
|
|
|
177386
177611
|
}
|
|
177387
177612
|
return rows;
|
|
177388
177613
|
};
|
|
177389
|
-
const fitLine = (line, width) => visibleLength(line) <= width ? padLine(line, width) : padLine(truncateText(
|
|
177614
|
+
const fitLine = (line, width) => visibleLength(line) <= width ? padLine(line, width) : padLine(truncateText(stripAnsi2(line), width), width);
|
|
177390
177615
|
const detailRows = (width, height, selected) => {
|
|
177391
177616
|
const record = records[selected];
|
|
177392
177617
|
const content = record ? requestDetail(record) : [`${colors.dim}No request selected.${colors.reset}`];
|
|
@@ -177655,7 +177880,7 @@ var init_sourceMetadata = __esm(() => {
|
|
|
177655
177880
|
|
|
177656
177881
|
// src/islands/pageMetadata.ts
|
|
177657
177882
|
import { readFileSync as readFileSync33 } from "fs";
|
|
177658
|
-
import { dirname as dirname15, resolve as
|
|
177883
|
+
import { dirname as dirname15, resolve as resolve21 } from "path";
|
|
177659
177884
|
var pagePatterns, getPageDirs = (config) => [
|
|
177660
177885
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
177661
177886
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -177675,8 +177900,8 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
177675
177900
|
const source = definition.buildReference?.source;
|
|
177676
177901
|
if (!source)
|
|
177677
177902
|
continue;
|
|
177678
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
177679
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
177903
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve21(dirname15(buildInfo.resolvedRegistryPath), source);
|
|
177904
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve21(resolvedSource));
|
|
177680
177905
|
}
|
|
177681
177906
|
return lookup;
|
|
177682
177907
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage2) => {
|
|
@@ -177689,13 +177914,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
177689
177914
|
const pattern = pagePatterns[entry.framework];
|
|
177690
177915
|
if (!pattern)
|
|
177691
177916
|
return;
|
|
177692
|
-
const files = await scanEntryPoints(
|
|
177917
|
+
const files = await scanEntryPoints(resolve21(entry.dir), pattern);
|
|
177693
177918
|
for (const filePath of files) {
|
|
177694
177919
|
const source = readFileSync33(filePath, "utf-8");
|
|
177695
177920
|
const islands = extractIslandUsagesFromSource(source);
|
|
177696
|
-
pageMetadata.set(
|
|
177921
|
+
pageMetadata.set(resolve21(filePath), {
|
|
177697
177922
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
177698
|
-
pagePath:
|
|
177923
|
+
pagePath: resolve21(filePath)
|
|
177699
177924
|
});
|
|
177700
177925
|
}
|
|
177701
177926
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -177725,13 +177950,13 @@ __export(exports_islands, {
|
|
|
177725
177950
|
runIslands: () => runIslands
|
|
177726
177951
|
});
|
|
177727
177952
|
import { existsSync as existsSync36, readFileSync as readFileSync34, statSync as statSync5 } from "fs";
|
|
177728
|
-
import { join as join30, relative as
|
|
177953
|
+
import { join as join30, relative as relative13, resolve as resolve22 } from "path";
|
|
177729
177954
|
var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
|
|
177730
177955
|
`), hostFrameworkOf = (pagePath, cwd, config) => {
|
|
177731
|
-
const resolved =
|
|
177956
|
+
const resolved = resolve22(cwd, pagePath);
|
|
177732
177957
|
for (const [framework, key] of Object.entries(FRAMEWORK_DIR_KEY)) {
|
|
177733
177958
|
const dir = config[key];
|
|
177734
|
-
if (typeof dir === "string" && resolved.startsWith(
|
|
177959
|
+
if (typeof dir === "string" && resolved.startsWith(resolve22(cwd, dir))) {
|
|
177735
177960
|
return framework;
|
|
177736
177961
|
}
|
|
177737
177962
|
}
|
|
@@ -177756,7 +177981,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177756
177981
|
const registryPath = config.islands?.registry;
|
|
177757
177982
|
if (typeof registryPath !== "string")
|
|
177758
177983
|
return null;
|
|
177759
|
-
const buildInfo = await loadIslandRegistryBuildInfo(
|
|
177984
|
+
const buildInfo = await loadIslandRegistryBuildInfo(resolve22(cwd, registryPath));
|
|
177760
177985
|
const pageMetadata = await loadPageIslandMetadata(config);
|
|
177761
177986
|
const usages = [...pageMetadata.values()].flatMap((meta) => meta.islands.map((island) => ({ ...island, page: meta.pagePath })));
|
|
177762
177987
|
return buildInfo.definitions.map((definition) => {
|
|
@@ -177766,7 +177991,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177766
177991
|
crossFramework: hostFramework !== null && hostFramework !== definition.framework,
|
|
177767
177992
|
hostFramework,
|
|
177768
177993
|
hydrate: usage2.hydrate ?? "load",
|
|
177769
|
-
page:
|
|
177994
|
+
page: relative13(cwd, resolve22(cwd, usage2.page))
|
|
177770
177995
|
};
|
|
177771
177996
|
});
|
|
177772
177997
|
const key = getIslandManifestKey(definition.framework, definition.component);
|
|
@@ -177805,7 +178030,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177805
178030
|
` ${color}\u2B21${colors.reset} ${colors.bold}${island.component}${colors.reset} ${meta}${sizeText}`
|
|
177806
178031
|
];
|
|
177807
178032
|
if (island.source) {
|
|
177808
|
-
lines.push(` ${colors.dim}${
|
|
178033
|
+
lines.push(` ${colors.dim}${relative13(cwd, island.source)}${colors.reset}`);
|
|
177809
178034
|
}
|
|
177810
178035
|
if (pages.length === 0) {
|
|
177811
178036
|
lines.push(` ${colors.dim}(registered but not mounted on any page)${colors.reset}`);
|
|
@@ -177835,7 +178060,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177835
178060
|
}
|
|
177836
178061
|
const outdirIndex = args.indexOf("--outdir");
|
|
177837
178062
|
const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
|
|
177838
|
-
const sizes = args.includes("--sizes") ? readManifestSizes2(
|
|
178063
|
+
const sizes = args.includes("--sizes") ? readManifestSizes2(resolve22(cwd, outdir ?? "build")) : null;
|
|
177839
178064
|
const islands = await collectIslands(cwd, config, sizes);
|
|
177840
178065
|
if (islands === null) {
|
|
177841
178066
|
printDim6('No island registry configured. Set `islands: { registry: "..." }` in absolute.config.ts.');
|
|
@@ -177885,12 +178110,12 @@ var init_islands2 = __esm(() => {
|
|
|
177885
178110
|
|
|
177886
178111
|
// src/build/externalAssetPlugin.ts
|
|
177887
178112
|
import { copyFileSync as copyFileSync2, existsSync as existsSync37, mkdirSync as mkdirSync17, statSync as statSync6 } from "fs";
|
|
177888
|
-
import { basename as basename6, dirname as dirname16, join as join31, resolve as
|
|
178113
|
+
import { basename as basename6, dirname as dirname16, join as join31, resolve as resolve23 } from "path";
|
|
177889
178114
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
177890
178115
|
name: "absolute-external-asset",
|
|
177891
178116
|
setup(bld) {
|
|
177892
178117
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
177893
|
-
const skipRoots = userSourceRoots.map((root) =>
|
|
178118
|
+
const skipRoots = userSourceRoots.map((root) => resolve23(root));
|
|
177894
178119
|
const isUserSource = (path) => skipRoots.some((root) => path.startsWith(`${root}/`));
|
|
177895
178120
|
bld.onLoad({ filter: /\.[mc]?[jt]sx?$/ }, async (args) => {
|
|
177896
178121
|
if (isUserSource(args.path))
|
|
@@ -177905,7 +178130,7 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
177905
178130
|
const relPath = match[1];
|
|
177906
178131
|
if (!relPath)
|
|
177907
178132
|
continue;
|
|
177908
|
-
const assetPath =
|
|
178133
|
+
const assetPath = resolve23(sourceDir, relPath);
|
|
177909
178134
|
if (!existsSync37(assetPath))
|
|
177910
178135
|
continue;
|
|
177911
178136
|
if (!statSync6(assetPath).isFile())
|
|
@@ -177946,8 +178171,8 @@ import {
|
|
|
177946
178171
|
dirname as dirname17,
|
|
177947
178172
|
isAbsolute as isAbsolute2,
|
|
177948
178173
|
join as join32,
|
|
177949
|
-
relative as
|
|
177950
|
-
resolve as
|
|
178174
|
+
relative as relative14,
|
|
178175
|
+
resolve as resolve24
|
|
177951
178176
|
} from "path";
|
|
177952
178177
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
177953
178178
|
const resolvedVersion = version2 || "unknown";
|
|
@@ -177989,7 +178214,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177989
178214
|
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(sourceRoot)) {
|
|
177990
178215
|
return new URL(entry, sourceRoot).href;
|
|
177991
178216
|
}
|
|
177992
|
-
return
|
|
178217
|
+
return resolve24(bundleDirectory, sourceRoot, entry);
|
|
177993
178218
|
});
|
|
177994
178219
|
delete map.sourceRoot;
|
|
177995
178220
|
const rebased = Buffer.from(JSON.stringify(map)).toString("base64");
|
|
@@ -178019,12 +178244,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178019
178244
|
return result;
|
|
178020
178245
|
}, copyServerRuntimeAssetReferences = (outdir) => {
|
|
178021
178246
|
const copied = new Set;
|
|
178022
|
-
const normalizedOutdir =
|
|
178247
|
+
const normalizedOutdir = resolve24(outdir);
|
|
178023
178248
|
const copyReference = (filePath, relPath) => {
|
|
178024
|
-
const assetSource =
|
|
178249
|
+
const assetSource = resolve24(dirname17(filePath), relPath);
|
|
178025
178250
|
if (!existsSync38(assetSource) || !statSync7(assetSource).isFile())
|
|
178026
178251
|
return;
|
|
178027
|
-
const assetTarget =
|
|
178252
|
+
const assetTarget = resolve24(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
178028
178253
|
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
178029
178254
|
return;
|
|
178030
178255
|
if (copied.has(assetTarget))
|
|
@@ -178098,18 +178323,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178098
178323
|
return resolveBuildModule3(remaining);
|
|
178099
178324
|
}, resolveJsxDevRuntimeCompatPath2 = () => {
|
|
178100
178325
|
const candidates = [
|
|
178101
|
-
|
|
178102
|
-
|
|
178103
|
-
|
|
178104
|
-
|
|
178105
|
-
|
|
178106
|
-
|
|
178326
|
+
resolve24(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
178327
|
+
resolve24(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
178328
|
+
resolve24(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
178329
|
+
resolve24(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
178330
|
+
resolve24(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
178331
|
+
resolve24(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
178107
178332
|
];
|
|
178108
178333
|
for (const candidate of candidates) {
|
|
178109
178334
|
if (existsSync38(candidate))
|
|
178110
178335
|
return candidate;
|
|
178111
178336
|
}
|
|
178112
|
-
return
|
|
178337
|
+
return resolve24(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
178113
178338
|
}, jsxDevRuntimeCompatPath2, shouldEmbedCompiledAsset = (relativePath, skip = new Set) => {
|
|
178114
178339
|
if (skip.has(relativePath))
|
|
178115
178340
|
return false;
|
|
@@ -178134,7 +178359,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178134
178359
|
return true;
|
|
178135
178360
|
}), requireForCompile, resolveNativeAssetForRuntime = (specifier) => {
|
|
178136
178361
|
if (specifier.startsWith("."))
|
|
178137
|
-
return
|
|
178362
|
+
return resolve24(process.cwd(), specifier);
|
|
178138
178363
|
if (specifier.startsWith("/"))
|
|
178139
178364
|
return specifier;
|
|
178140
178365
|
return requireForCompile.resolve(specifier, { paths: [process.cwd()] });
|
|
@@ -178150,7 +178375,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178150
178375
|
} catch {
|
|
178151
178376
|
return null;
|
|
178152
178377
|
}
|
|
178153
|
-
}, resolveProjectPackageDir = (specifier) =>
|
|
178378
|
+
}, resolveProjectPackageDir = (specifier) => resolve24(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
|
|
178154
178379
|
if (seen.has(specifier))
|
|
178155
178380
|
return;
|
|
178156
178381
|
const srcDir = resolveProjectPackageDir(specifier);
|
|
@@ -178164,7 +178389,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178164
178389
|
force: true,
|
|
178165
178390
|
recursive: true,
|
|
178166
178391
|
filter(source) {
|
|
178167
|
-
const rel =
|
|
178392
|
+
const rel = relative14(srcDir, source);
|
|
178168
178393
|
const [firstSegment] = rel.split(/[\\/]/);
|
|
178169
178394
|
return firstSegment !== "node_modules" && firstSegment !== ".git";
|
|
178170
178395
|
}
|
|
@@ -178180,7 +178405,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178180
178405
|
}, copyAngularRuntimePackages = (buildConfig, outdir) => {
|
|
178181
178406
|
if (!buildConfig.angularDirectory)
|
|
178182
178407
|
return;
|
|
178183
|
-
const angularScopeDir =
|
|
178408
|
+
const angularScopeDir = resolve24(process.cwd(), "node_modules", "@angular");
|
|
178184
178409
|
const angularPackages = existsSync38(angularScopeDir) ? readdirSync7(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
|
|
178185
178410
|
const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
|
|
178186
178411
|
const seen = new Set;
|
|
@@ -178221,7 +178446,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178221
178446
|
}
|
|
178222
178447
|
return specifiers.sort((firstSpecifier, secondSpecifier) => secondSpecifier.length - firstSpecifier.length);
|
|
178223
178448
|
}, ensureRelativeModuleSpecifier = (fromFile, toFile) => {
|
|
178224
|
-
const rel =
|
|
178449
|
+
const rel = relative14(dirname17(fromFile), toFile).replace(/\\/g, "/");
|
|
178225
178450
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
178226
178451
|
}, pickExportEntry = (value) => {
|
|
178227
178452
|
if (typeof value === "string")
|
|
@@ -178286,9 +178511,9 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178286
178511
|
return null;
|
|
178287
178512
|
return join32(packageDir, entry);
|
|
178288
178513
|
}, collectRuntimeRewriteRoots = (distDir) => collectFiles2(distDir).filter((filePath) => isRuntimeJsFile(filePath) && !isNodeModulesPath(filePath)), toTopLevelPackage = (specifier) => specifier.split("/").slice(0, specifier.startsWith("@") ? 2 : 1).join("/"), FRAMEWORK_PACKAGE_NAME = "@absolutejs/absolute", copyChunkReferencedPackages = (distDir, seen) => {
|
|
178289
|
-
const distRoot =
|
|
178514
|
+
const distRoot = resolve24(distDir);
|
|
178290
178515
|
for (const filePath of collectRuntimeRewriteRoots(distDir)) {
|
|
178291
|
-
if (
|
|
178516
|
+
if (resolve24(dirname17(filePath)) === distRoot)
|
|
178292
178517
|
continue;
|
|
178293
178518
|
const source = readFileSync35(filePath, "utf-8");
|
|
178294
178519
|
for (const match of source.matchAll(MODULE_SPECIFIER_RE)) {
|
|
@@ -178324,7 +178549,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178324
178549
|
const { masked, restore } = maskLiterals(source);
|
|
178325
178550
|
const rewrittenMasked = masked.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
|
|
178326
178551
|
if (typeof specifier === "string" && specifier.startsWith(".")) {
|
|
178327
|
-
enqueue(resolveRuntimeJsFile(
|
|
178552
|
+
enqueue(resolveRuntimeJsFile(resolve24(dirname17(filePath), specifier)));
|
|
178328
178553
|
return match;
|
|
178329
178554
|
}
|
|
178330
178555
|
const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
|
|
@@ -178353,12 +178578,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178353
178578
|
"_compile_entrypoint.ts"
|
|
178354
178579
|
]);
|
|
178355
178580
|
const embeddedFiles = allFiles.filter((file) => {
|
|
178356
|
-
const rel =
|
|
178581
|
+
const rel = relative14(distDir, file);
|
|
178357
178582
|
if (embeddedSkip.has(rel))
|
|
178358
178583
|
return false;
|
|
178359
178584
|
return true;
|
|
178360
178585
|
});
|
|
178361
|
-
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(
|
|
178586
|
+
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(relative14(distDir, file), assetSkip));
|
|
178362
178587
|
const imports = [];
|
|
178363
178588
|
const nativeImports = [];
|
|
178364
178589
|
const nativeMappings = [];
|
|
@@ -178368,19 +178593,19 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178368
178593
|
const nativeAssets = resolveCompileNativeAssets(buildConfig);
|
|
178369
178594
|
nativeAssets.forEach((asset, idx) => {
|
|
178370
178595
|
const varName = `__native${idx}`;
|
|
178371
|
-
const importSpecifier = asset.import.startsWith(".") ?
|
|
178596
|
+
const importSpecifier = asset.import.startsWith(".") ? resolve24(process.cwd(), asset.import) : asset.import;
|
|
178372
178597
|
nativeImports.push(`import ${varName} from ${JSON.stringify(importSpecifier)} with { type: "file" };`);
|
|
178373
178598
|
nativeMappings.push(` [${JSON.stringify(asset.env)}, resolveNativeAssetPath(${varName})],`);
|
|
178374
178599
|
});
|
|
178375
178600
|
embeddedFiles.forEach((filePath, idx) => {
|
|
178376
|
-
const rel =
|
|
178601
|
+
const rel = relative14(distDir, filePath).replace(/\\/g, "/");
|
|
178377
178602
|
const varName = `__a${idx}`;
|
|
178378
178603
|
embeddedVarMap.set(rel, varName);
|
|
178379
178604
|
imports.push(`import ${varName} from "./${rel}" with { type: "file" };`);
|
|
178380
178605
|
embeddedMappings.push(` ["${rel}", ${varName}],`);
|
|
178381
178606
|
});
|
|
178382
178607
|
clientFiles.forEach((filePath) => {
|
|
178383
|
-
const rel =
|
|
178608
|
+
const rel = relative14(distDir, filePath).replace(/\\/g, "/");
|
|
178384
178609
|
const varName = embeddedVarMap.get(rel);
|
|
178385
178610
|
if (!varName)
|
|
178386
178611
|
return;
|
|
@@ -178394,7 +178619,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
178394
178619
|
const pageVarMap = new Map;
|
|
178395
178620
|
const prerenderEntries = Array.from(prerenderMap.entries());
|
|
178396
178621
|
prerenderEntries.forEach(([route, filePath]) => {
|
|
178397
|
-
const rel =
|
|
178622
|
+
const rel = relative14(distDir, filePath).replace(/\\/g, "/");
|
|
178398
178623
|
const varName = embeddedVarMap.get(rel);
|
|
178399
178624
|
if (varName)
|
|
178400
178625
|
pageVarMap.set(route, varName);
|
|
@@ -178427,7 +178652,7 @@ import { websocket as elysiaWebsocket } from "elysia/ws";
|
|
|
178427
178652
|
const SERVER_MODULE = (runtimeDir: string) => import(pathToFileURL(join(runtimeDir, ${JSON.stringify(serverBundleName)})).href);
|
|
178428
178653
|
const RUNTIME_BUILD_ID = ${JSON.stringify(runtimeBuildId)};
|
|
178429
178654
|
const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
|
|
178430
|
-
const ORIGINAL_BUILD_DIR = ${JSON.stringify(
|
|
178655
|
+
const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve24(distDir))};
|
|
178431
178656
|
const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
|
|
178432
178657
|
|
|
178433
178658
|
const resolveNativeAssetPath = (assetPath: string) => {
|
|
@@ -178845,16 +179070,16 @@ console.log(\`
|
|
|
178845
179070
|
});
|
|
178846
179071
|
}
|
|
178847
179072
|
}), compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
178848
|
-
const resolvedOutdir =
|
|
179073
|
+
const resolvedOutdir = resolve24(outdir ?? "dist");
|
|
178849
179074
|
await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
|
|
178850
179075
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
178851
179076
|
const prerenderPort = Number(env5.COMPILE_PORT) || Number(env5.PORT) || findFreePort();
|
|
178852
179077
|
killStaleProcesses(prerenderPort);
|
|
178853
179078
|
const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
|
|
178854
|
-
const resolvedOutfile =
|
|
179079
|
+
const resolvedOutfile = resolve24(outfile ?? "compiled-server");
|
|
178855
179080
|
const absoluteVersion = resolvePackageVersion3([
|
|
178856
|
-
|
|
178857
|
-
|
|
179081
|
+
resolve24(import.meta.dir, "..", "..", "..", "package.json"),
|
|
179082
|
+
resolve24(import.meta.dir, "..", "..", "package.json")
|
|
178858
179083
|
]);
|
|
178859
179084
|
compileBanner(absoluteVersion);
|
|
178860
179085
|
const totalStart = performance.now();
|
|
@@ -178865,8 +179090,8 @@ console.log(\`
|
|
|
178865
179090
|
buildConfig.mode = "production";
|
|
178866
179091
|
try {
|
|
178867
179092
|
const build2 = await resolveBuildModule3([
|
|
178868
|
-
|
|
178869
|
-
|
|
179093
|
+
resolve24(import.meta.dir, "..", "..", "core", "build"),
|
|
179094
|
+
resolve24(import.meta.dir, "..", "build")
|
|
178870
179095
|
]);
|
|
178871
179096
|
if (!build2)
|
|
178872
179097
|
throw new Error("Could not locate build module");
|
|
@@ -178888,10 +179113,10 @@ console.log(\`
|
|
|
178888
179113
|
buildConfig.htmxDirectory
|
|
178889
179114
|
].filter((dir) => Boolean(dir));
|
|
178890
179115
|
const islandRegistrySpec = buildConfig.islands?.registry;
|
|
178891
|
-
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(
|
|
179116
|
+
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve24(islandRegistrySpec))) : undefined;
|
|
178892
179117
|
const serverBundle = await Bun.build({
|
|
178893
179118
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
178894
|
-
entrypoints: [
|
|
179119
|
+
entrypoints: [resolve24(serverEntry)],
|
|
178895
179120
|
external: resolveServerBundleExternals(buildConfig),
|
|
178896
179121
|
outdir: resolvedOutdir,
|
|
178897
179122
|
plugins: [
|
|
@@ -178915,13 +179140,13 @@ console.log(\`
|
|
|
178915
179140
|
console.error(cliTag4("\x1B[31m", "Server bundle failed."));
|
|
178916
179141
|
process.exit(1);
|
|
178917
179142
|
}
|
|
178918
|
-
const outputPath =
|
|
179143
|
+
const outputPath = resolve24(resolvedOutdir, `${entryName}.js`);
|
|
178919
179144
|
if (!existsSync38(outputPath)) {
|
|
178920
179145
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
178921
179146
|
process.exit(1);
|
|
178922
179147
|
}
|
|
178923
|
-
if (existsSync38(
|
|
178924
|
-
const vendorDir =
|
|
179148
|
+
if (existsSync38(resolve24(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
179149
|
+
const vendorDir = resolve24(resolvedOutdir, "angular", "vendor", "server");
|
|
178925
179150
|
const vendorEntries = readdirSync7(vendorDir).filter((fileName) => fileName.endsWith(".js"));
|
|
178926
179151
|
const angularServerVendorPaths = {};
|
|
178927
179152
|
for (const file of vendorEntries) {
|
|
@@ -178930,7 +179155,7 @@ console.log(\`
|
|
|
178930
179155
|
if (scope !== "angular" || rest.length === 0)
|
|
178931
179156
|
continue;
|
|
178932
179157
|
const specifier = `@angular/${rest.join("/")}`;
|
|
178933
|
-
const relPath =
|
|
179158
|
+
const relPath = relative14(dirname17(outputPath), resolve24(vendorDir, file));
|
|
178934
179159
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
178935
179160
|
}
|
|
178936
179161
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -179047,10 +179272,10 @@ var exports_typecheck = {};
|
|
|
179047
179272
|
__export(exports_typecheck, {
|
|
179048
179273
|
typecheck: () => typecheck
|
|
179049
179274
|
});
|
|
179050
|
-
import { resolve as
|
|
179275
|
+
import { resolve as resolve25, join as join33 } from "path";
|
|
179051
179276
|
import { existsSync as existsSync39, readFileSync as readFileSync36 } from "fs";
|
|
179052
179277
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
179053
|
-
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) =>
|
|
179278
|
+
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve25(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
|
|
179054
179279
|
if (!existsSync39(resolveConfigPath(configPath2))) {
|
|
179055
179280
|
const defaultService = {};
|
|
179056
179281
|
return [defaultService];
|
|
@@ -179072,19 +179297,19 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
179072
179297
|
const exitCode = await proc.exited;
|
|
179073
179298
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
179074
179299
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
179075
|
-
const local =
|
|
179300
|
+
const local = resolve25("node_modules", ".bin", name);
|
|
179076
179301
|
return existsSync39(local) ? local : null;
|
|
179077
|
-
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX,
|
|
179302
|
+
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi4 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
179078
179303
|
const cwd = `${process.cwd()}/`;
|
|
179079
|
-
const summaryMatch =
|
|
179304
|
+
const summaryMatch = stripAnsi4(output).match(/svelte-check found (\d+) error/);
|
|
179080
179305
|
const errorCount = summaryMatch ? parseInt(summaryMatch[1] ?? "0", 10) : 0;
|
|
179081
179306
|
const formatted = output.split(`
|
|
179082
179307
|
`).filter((line) => {
|
|
179083
|
-
const plain =
|
|
179308
|
+
const plain = stripAnsi4(line);
|
|
179084
179309
|
return !plain.startsWith("Loading svelte-check") && !plain.startsWith("Getting Svelte") && !plain.startsWith("====") && !plain.startsWith("svelte-check found") && !/^\d+ (START|COMPLETED)/.test(plain) && plain.trim() !== "";
|
|
179085
179310
|
}).flatMap((line) => {
|
|
179086
179311
|
const result = line.replaceAll(cwd, "");
|
|
179087
|
-
const plain =
|
|
179312
|
+
const plain = stripAnsi4(result);
|
|
179088
179313
|
const pathMatch = plain.match(/^(\S+\.svelte):(\d+:\d+)$/);
|
|
179089
179314
|
if (pathMatch) {
|
|
179090
179315
|
return [
|
|
@@ -179092,9 +179317,9 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
179092
179317
|
];
|
|
179093
179318
|
}
|
|
179094
179319
|
if (result.includes(ANSI_PURPLE_REGEX)) {
|
|
179095
|
-
const plainLine =
|
|
179096
|
-
const before =
|
|
179097
|
-
const token =
|
|
179320
|
+
const plainLine = stripAnsi4(result);
|
|
179321
|
+
const before = stripAnsi4(result.split(ANSI_PURPLE_REGEX)[0] ?? "");
|
|
179322
|
+
const token = stripAnsi4((result.split(ANSI_PURPLE_REGEX)[1] ?? "").split(ANSI_TOKEN_END_REGEX)[0] ?? "");
|
|
179098
179323
|
if (!token)
|
|
179099
179324
|
return [result];
|
|
179100
179325
|
const expanded = before.replace(/\t/g, " ");
|
|
@@ -179120,15 +179345,15 @@ Found ${errorCount} error${suffix}.`;
|
|
|
179120
179345
|
return formatted;
|
|
179121
179346
|
}, ABSOLUTE_INTERNAL_EXCLUDES, resolveAbsoluteTypeFile = (fileName) => {
|
|
179122
179347
|
const candidates = [
|
|
179123
|
-
|
|
179124
|
-
|
|
179125
|
-
|
|
179126
|
-
|
|
179348
|
+
resolve25("node_modules/@absolutejs/absolute/dist/types", fileName),
|
|
179349
|
+
resolve25(import.meta.dir, "../types", fileName),
|
|
179350
|
+
resolve25(import.meta.dir, "../../types", fileName),
|
|
179351
|
+
resolve25(import.meta.dir, "../../../types", fileName)
|
|
179127
179352
|
];
|
|
179128
179353
|
return candidates.find((candidate) => existsSync39(candidate)) ?? candidates[0];
|
|
179129
179354
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
179130
179355
|
try {
|
|
179131
|
-
return JSON.parse(readFileSync36(
|
|
179356
|
+
return JSON.parse(readFileSync36(resolve25("tsconfig.json"), "utf-8"));
|
|
179132
179357
|
} catch {
|
|
179133
179358
|
return {};
|
|
179134
179359
|
}
|
|
@@ -179162,13 +179387,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
179162
179387
|
rootDir: ".."
|
|
179163
179388
|
},
|
|
179164
179389
|
exclude: getProjectTypecheckExcludes(),
|
|
179165
|
-
extends:
|
|
179390
|
+
extends: resolve25("tsconfig.json"),
|
|
179166
179391
|
include: getProjectTypecheckIncludes()
|
|
179167
179392
|
}, null, "\t")).then(() => run("vue-tsc", [
|
|
179168
179393
|
vueTscBin,
|
|
179169
179394
|
"--noEmit",
|
|
179170
179395
|
"--project",
|
|
179171
|
-
|
|
179396
|
+
resolve25(vueTsconfigPath),
|
|
179172
179397
|
"--incremental",
|
|
179173
179398
|
"--tsBuildInfoFile",
|
|
179174
179399
|
join33(cacheDir, "vue-tsc.tsbuildinfo"),
|
|
@@ -179190,10 +179415,10 @@ Found ${errorCount} error${suffix}.`;
|
|
|
179190
179415
|
rootDir: ".."
|
|
179191
179416
|
},
|
|
179192
179417
|
exclude: ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
|
|
179193
|
-
extends:
|
|
179418
|
+
extends: resolve25("tsconfig.json"),
|
|
179194
179419
|
include: [`../${angularDir}/**/*`]
|
|
179195
179420
|
}, null, "\t"));
|
|
179196
|
-
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(
|
|
179421
|
+
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve25(angularTsconfigPath))}`);
|
|
179197
179422
|
}, buildTscCheck = (cacheDir) => {
|
|
179198
179423
|
const tscBin = findBin("tsc");
|
|
179199
179424
|
if (!tscBin) {
|
|
@@ -179206,13 +179431,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
179206
179431
|
rootDir: ".."
|
|
179207
179432
|
},
|
|
179208
179433
|
exclude: getProjectTypecheckExcludes(),
|
|
179209
|
-
extends:
|
|
179434
|
+
extends: resolve25("tsconfig.json"),
|
|
179210
179435
|
include: getProjectTypecheckIncludes()
|
|
179211
179436
|
}, null, "\t")).then(() => run("tsc", [
|
|
179212
179437
|
tscBin,
|
|
179213
179438
|
"--noEmit",
|
|
179214
179439
|
"--project",
|
|
179215
|
-
|
|
179440
|
+
resolve25(tscConfigPath),
|
|
179216
179441
|
"--incremental",
|
|
179217
179442
|
"--tsBuildInfoFile",
|
|
179218
179443
|
join33(cacheDir, "tsc.tsbuildinfo"),
|
|
@@ -179226,14 +179451,14 @@ Found ${errorCount} error${suffix}.`;
|
|
|
179226
179451
|
}
|
|
179227
179452
|
const svelteTsconfigPath = join33(cacheDir, "tsconfig.svelte-check.json");
|
|
179228
179453
|
await writeFile(svelteTsconfigPath, JSON.stringify({
|
|
179229
|
-
extends:
|
|
179454
|
+
extends: resolve25("tsconfig.json"),
|
|
179230
179455
|
files: ABSOLUTE_TYPECHECK_FILES,
|
|
179231
179456
|
include: [`../${svelteDir}/**/*`]
|
|
179232
179457
|
}, null, "\t"));
|
|
179233
179458
|
return run("svelte-check", [
|
|
179234
179459
|
svelteBin,
|
|
179235
179460
|
"--tsconfig",
|
|
179236
|
-
|
|
179461
|
+
resolve25(svelteTsconfigPath),
|
|
179237
179462
|
"--threshold",
|
|
179238
179463
|
"error",
|
|
179239
179464
|
"--compiler-warnings",
|
|
@@ -179427,11 +179652,11 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
|
|
|
179427
179652
|
url: url.pathname + url.search,
|
|
179428
179653
|
...bodyBytes && bodyBytes.length > 0 ? { bodyBase64: Buffer.from(bodyBytes).toString("base64") } : {}
|
|
179429
179654
|
};
|
|
179430
|
-
const responsePromise = new Promise((
|
|
179431
|
-
pending.set(id,
|
|
179655
|
+
const responsePromise = new Promise((resolve26) => {
|
|
179656
|
+
pending.set(id, resolve26);
|
|
179432
179657
|
});
|
|
179433
179658
|
client.send(encodeTunnelMessage(message));
|
|
179434
|
-
const timeout = new Promise((
|
|
179659
|
+
const timeout = new Promise((resolve26) => setTimeout(() => resolve26({ id, message: "timeout", type: "error" }), requestTimeoutMs));
|
|
179435
179660
|
const result = await Promise.race([responsePromise, timeout]);
|
|
179436
179661
|
pending.delete(id);
|
|
179437
179662
|
if (result.type === "error") {
|
|
@@ -180735,7 +180960,7 @@ init_utils();
|
|
|
180735
180960
|
import { execSync as execSync2 } from "child_process";
|
|
180736
180961
|
import { existsSync as existsSync7, readFileSync as readFileSync9 } from "fs";
|
|
180737
180962
|
import { arch as arch2, cpus, platform as platform3, totalmem, version } from "os";
|
|
180738
|
-
import { resolve as
|
|
180963
|
+
import { resolve as resolve6 } from "path";
|
|
180739
180964
|
var bold = (str) => `\x1B[1m${str}\x1B[0m`;
|
|
180740
180965
|
var getBinaryVersion = (binary, flag = "--version") => {
|
|
180741
180966
|
try {
|
|
@@ -180765,8 +180990,8 @@ var getPackageVersion = (packageName) => {
|
|
|
180765
180990
|
var getAbsoluteVersion = () => {
|
|
180766
180991
|
try {
|
|
180767
180992
|
const candidates = [
|
|
180768
|
-
|
|
180769
|
-
|
|
180993
|
+
resolve6(import.meta.dir, "..", "..", "package.json"),
|
|
180994
|
+
resolve6(import.meta.dir, "..", "..", "..", "package.json")
|
|
180770
180995
|
];
|
|
180771
180996
|
const pkgPath = candidates.find((candidate) => existsSync7(candidate));
|
|
180772
180997
|
if (pkgPath)
|
|
@@ -181075,7 +181300,7 @@ init_serverBundleExternals();
|
|
|
181075
181300
|
init_utils();
|
|
181076
181301
|
var {env: env2 } = globalThis.Bun;
|
|
181077
181302
|
import { existsSync as existsSync8, readFileSync as readFileSync11, rmSync as rmSync4 } from "fs";
|
|
181078
|
-
import { basename as basename3, join as join11, resolve as
|
|
181303
|
+
import { basename as basename3, join as join11, resolve as resolve9 } from "path";
|
|
181079
181304
|
var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`;
|
|
181080
181305
|
var resolvePackageVersion = (candidates) => {
|
|
181081
181306
|
for (const candidate of candidates) {
|
|
@@ -181130,18 +181355,18 @@ var handleBundleFailure = (serverBundle, bundleStart, serverEntry) => {
|
|
|
181130
181355
|
};
|
|
181131
181356
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
181132
181357
|
const candidates = [
|
|
181133
|
-
|
|
181134
|
-
|
|
181135
|
-
|
|
181136
|
-
|
|
181137
|
-
|
|
181138
|
-
|
|
181358
|
+
resolve9(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
181359
|
+
resolve9(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
181360
|
+
resolve9(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
181361
|
+
resolve9(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
181362
|
+
resolve9(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
181363
|
+
resolve9(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
181139
181364
|
];
|
|
181140
181365
|
for (const candidate of candidates) {
|
|
181141
181366
|
if (existsSync8(candidate))
|
|
181142
181367
|
return candidate;
|
|
181143
181368
|
}
|
|
181144
|
-
return
|
|
181369
|
+
return resolve9(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
181145
181370
|
};
|
|
181146
181371
|
var jsxDevRuntimeCompatPath = resolveJsxDevRuntimeCompatPath();
|
|
181147
181372
|
var prerenderStaticPages = async (outputPath, prerenderPort, resolvedOutdir, staticConfig, absoluteVersion, configPath2) => {
|
|
@@ -181178,7 +181403,7 @@ var runPreparedServer = async ({
|
|
|
181178
181403
|
serverEntry,
|
|
181179
181404
|
totalDuration
|
|
181180
181405
|
}) => {
|
|
181181
|
-
const usesDocker = existsSync8(
|
|
181406
|
+
const usesDocker = existsSync8(resolve9(COMPOSE_PATH));
|
|
181182
181407
|
const scripts = usesDocker ? await readDbScripts() : null;
|
|
181183
181408
|
if (scripts)
|
|
181184
181409
|
await startDatabase(scripts);
|
|
@@ -181270,10 +181495,10 @@ var start = async (serverEntry, outdir, configPath2, options = {}) => {
|
|
|
181270
181495
|
const port = Number(env2.PORT) || DEFAULT_PORT;
|
|
181271
181496
|
killStaleProcesses(port);
|
|
181272
181497
|
const entryName = basename3(serverEntry).replace(/\.[^.]+$/, "");
|
|
181273
|
-
const resolvedOutdir =
|
|
181498
|
+
const resolvedOutdir = resolve9(outdir ?? "dist");
|
|
181274
181499
|
const absoluteVersion = resolvePackageVersion([
|
|
181275
|
-
|
|
181276
|
-
|
|
181500
|
+
resolve9(import.meta.dir, "..", "..", "..", "package.json"),
|
|
181501
|
+
resolve9(import.meta.dir, "..", "..", "package.json")
|
|
181277
181502
|
]);
|
|
181278
181503
|
const buildConfig = await loadConfig(configPath2);
|
|
181279
181504
|
buildConfig.buildDirectory = resolvedOutdir;
|
|
@@ -181286,7 +181511,7 @@ var start = async (serverEntry, outdir, configPath2, options = {}) => {
|
|
|
181286
181511
|
buildConfig.vueDirectory && "vue",
|
|
181287
181512
|
buildConfig.angularDirectory && "angular"
|
|
181288
181513
|
].filter((val) => Boolean(val));
|
|
181289
|
-
const outputPath =
|
|
181514
|
+
const outputPath = resolve9(resolvedOutdir, `${entryName}.js`);
|
|
181290
181515
|
if (options.prebuilt) {
|
|
181291
181516
|
if (!existsSync8(outputPath)) {
|
|
181292
181517
|
throw new Error(`Prepared production server not found: ${outputPath}`);
|
|
@@ -181309,8 +181534,8 @@ var start = async (serverEntry, outdir, configPath2, options = {}) => {
|
|
|
181309
181534
|
process.stdout.write(cliTag2("\x1B[36m", `Building assets`));
|
|
181310
181535
|
try {
|
|
181311
181536
|
const build = await resolveBuildModule([
|
|
181312
|
-
|
|
181313
|
-
|
|
181537
|
+
resolve9(import.meta.dir, "..", "..", "core", "build"),
|
|
181538
|
+
resolve9(import.meta.dir, "..", "build")
|
|
181314
181539
|
]);
|
|
181315
181540
|
if (!build)
|
|
181316
181541
|
throw new Error("Could not locate build module");
|
|
@@ -181392,10 +181617,10 @@ var start = async (serverEntry, outdir, configPath2, options = {}) => {
|
|
|
181392
181617
|
}
|
|
181393
181618
|
};
|
|
181394
181619
|
const islandRegistrySpec = buildConfig.islands?.registry;
|
|
181395
|
-
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(
|
|
181620
|
+
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve9(islandRegistrySpec))) : undefined;
|
|
181396
181621
|
const serverBundle = await Bun.build({
|
|
181397
181622
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
181398
|
-
entrypoints: [
|
|
181623
|
+
entrypoints: [resolve9(serverEntry)],
|
|
181399
181624
|
external: resolveServerBundleExternals(buildConfig),
|
|
181400
181625
|
outdir: resolvedOutdir,
|
|
181401
181626
|
plugins: [
|
|
@@ -181413,9 +181638,9 @@ var start = async (serverEntry, outdir, configPath2, options = {}) => {
|
|
|
181413
181638
|
console.error(cliTag2("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
181414
181639
|
process.exit(1);
|
|
181415
181640
|
}
|
|
181416
|
-
if (existsSync8(
|
|
181641
|
+
if (existsSync8(resolve9(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
181417
181642
|
const { readdirSync: readdirSync2 } = await import("fs");
|
|
181418
|
-
const vendorDir =
|
|
181643
|
+
const vendorDir = resolve9(resolvedOutdir, "angular", "vendor", "server");
|
|
181419
181644
|
const vendorEntries = readdirSync2(vendorDir).filter((fileName) => fileName.endsWith(".js"));
|
|
181420
181645
|
const angularServerVendorPaths = {};
|
|
181421
181646
|
const { relative: pathRelative, dirname: pathDirname } = await import("path");
|
|
@@ -181425,7 +181650,7 @@ var start = async (serverEntry, outdir, configPath2, options = {}) => {
|
|
|
181425
181650
|
if (scope !== "angular" || rest.length === 0)
|
|
181426
181651
|
continue;
|
|
181427
181652
|
const specifier = `@angular/${rest.join("/")}`;
|
|
181428
|
-
const relPath = pathRelative(pathDirname(outputPath),
|
|
181653
|
+
const relPath = pathRelative(pathDirname(outputPath), resolve9(vendorDir, file));
|
|
181429
181654
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
181430
181655
|
}
|
|
181431
181656
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -181481,7 +181706,7 @@ import {
|
|
|
181481
181706
|
writeFileSync as writeFileSync6
|
|
181482
181707
|
} from "fs";
|
|
181483
181708
|
import { createConnection } from "net";
|
|
181484
|
-
import { resolve as
|
|
181709
|
+
import { resolve as resolve10 } from "path";
|
|
181485
181710
|
|
|
181486
181711
|
// src/cli/workspaceTui.ts
|
|
181487
181712
|
init_constants();
|
|
@@ -181757,7 +181982,7 @@ var createWorkspaceTui = ({
|
|
|
181757
181982
|
scheduleRender();
|
|
181758
181983
|
};
|
|
181759
181984
|
const addLog = (source, message, level = "info") => {
|
|
181760
|
-
const cleanMessage =
|
|
181985
|
+
const cleanMessage = stripAnsi2(message).trimEnd();
|
|
181761
181986
|
if (!cleanMessage) {
|
|
181762
181987
|
return;
|
|
181763
181988
|
}
|
|
@@ -182043,34 +182268,34 @@ var createWorkspaceTui = ({
|
|
|
182043
182268
|
|
|
182044
182269
|
// src/cli/scripts/workspace.ts
|
|
182045
182270
|
init_utils();
|
|
182046
|
-
var sourceServerBootstrap2 =
|
|
182047
|
-
var serverBootstrap2 = existsSync9(sourceServerBootstrap2) ? sourceServerBootstrap2 :
|
|
182271
|
+
var sourceServerBootstrap2 = resolve10(import.meta.dir, "../../dev/serverBootstrap.ts");
|
|
182272
|
+
var serverBootstrap2 = existsSync9(sourceServerBootstrap2) ? sourceServerBootstrap2 : resolve10(import.meta.dir, "../dev/serverBootstrap.js");
|
|
182048
182273
|
var ANSI_REGEX2 = new RegExp(`${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[[0-?]*[ -/]*[@-~]`, "g");
|
|
182049
182274
|
var sleep = (durationMs) => Bun.sleep(durationMs);
|
|
182050
|
-
var
|
|
182275
|
+
var stripAnsi3 = (value) => value.replace(ANSI_REGEX2, "");
|
|
182051
182276
|
var sanitizeLogFileName = (value) => value.replace(/[^a-zA-Z0-9._-]/g, "_") || "unknown";
|
|
182052
182277
|
var createWorkspaceLogSink = (appendLog) => {
|
|
182053
|
-
const logDirectory =
|
|
182278
|
+
const logDirectory = resolve10(".absolutejs", "workspace", "logs");
|
|
182054
182279
|
mkdirSync7(logDirectory, { recursive: true });
|
|
182055
|
-
readdirSync2(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync3(
|
|
182056
|
-
writeFileSync6(
|
|
182057
|
-
writeFileSync6(
|
|
182280
|
+
readdirSync2(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync3(resolve10(logDirectory, file)));
|
|
182281
|
+
writeFileSync6(resolve10(logDirectory, "all.log"), "");
|
|
182282
|
+
writeFileSync6(resolve10(logDirectory, "workspace.log"), "");
|
|
182058
182283
|
const initializedSources = new Set(["workspace"]);
|
|
182059
182284
|
const writeLog = (source, message, level) => {
|
|
182060
|
-
const cleanMessage =
|
|
182285
|
+
const cleanMessage = stripAnsi3(message).trimEnd();
|
|
182061
182286
|
if (!cleanMessage) {
|
|
182062
182287
|
return;
|
|
182063
182288
|
}
|
|
182064
182289
|
const timestamp = new Date().toISOString();
|
|
182065
182290
|
const line = `[${timestamp}] [${level}] [${source}] ${cleanMessage}
|
|
182066
182291
|
`;
|
|
182067
|
-
const sourceFile =
|
|
182292
|
+
const sourceFile = resolve10(logDirectory, `${sanitizeLogFileName(source)}.log`);
|
|
182068
182293
|
if (!initializedSources.has(source)) {
|
|
182069
182294
|
writeFileSync6(sourceFile, "");
|
|
182070
182295
|
initializedSources.add(source);
|
|
182071
182296
|
}
|
|
182072
182297
|
appendFileSync(sourceFile, line);
|
|
182073
|
-
appendFileSync(
|
|
182298
|
+
appendFileSync(resolve10(logDirectory, "all.log"), line);
|
|
182074
182299
|
};
|
|
182075
182300
|
return {
|
|
182076
182301
|
appendLog: (source, message, level = "info") => {
|
|
@@ -182094,9 +182319,9 @@ var readPackageVersion3 = (candidate) => {
|
|
|
182094
182319
|
};
|
|
182095
182320
|
var resolvePackageVersion2 = () => {
|
|
182096
182321
|
const candidates = [
|
|
182097
|
-
|
|
182098
|
-
|
|
182099
|
-
|
|
182322
|
+
resolve10(import.meta.dir, "..", "..", "package.json"),
|
|
182323
|
+
resolve10(import.meta.dir, "..", "..", "..", "package.json"),
|
|
182324
|
+
resolve10(import.meta.dir, "..", "..", "..", "..", "package.json")
|
|
182100
182325
|
];
|
|
182101
182326
|
for (const candidate of candidates) {
|
|
182102
182327
|
const version2 = readPackageVersion3(candidate);
|
|
@@ -182450,15 +182675,15 @@ var createWorkspaceServiceEnv = (services) => {
|
|
|
182450
182675
|
var getDefinedProcessEnv = () => Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string"));
|
|
182451
182676
|
var resolveAbsoluteServiceConfigPath = (service, cwd, options) => {
|
|
182452
182677
|
if (service.config)
|
|
182453
|
-
return
|
|
182678
|
+
return resolve10(cwd, service.config);
|
|
182454
182679
|
if (options.configPath)
|
|
182455
|
-
return
|
|
182680
|
+
return resolve10(options.configPath);
|
|
182456
182681
|
if (process.env.ABSOLUTE_CONFIG)
|
|
182457
|
-
return
|
|
182682
|
+
return resolve10(process.env.ABSOLUTE_CONFIG);
|
|
182458
182683
|
return;
|
|
182459
182684
|
};
|
|
182460
182685
|
var resolveService = (name, service, workspaceEnv, options) => {
|
|
182461
|
-
const cwd =
|
|
182686
|
+
const cwd = resolve10(service.cwd ?? ".");
|
|
182462
182687
|
const envVars = Object.assign(getDefinedProcessEnv(), workspaceEnv, service.port ? { PORT: String(service.port) } : {}, service.env, {
|
|
182463
182688
|
ABSOLUTE_INSTANCE_MANAGED: "1",
|
|
182464
182689
|
ABSOLUTE_WORKSPACE_MANAGED: "1",
|
|
@@ -182470,7 +182695,7 @@ var resolveService = (name, service, workspaceEnv, options) => {
|
|
|
182470
182695
|
if (isAbsoluteService(service)) {
|
|
182471
182696
|
const configPath2 = resolveAbsoluteServiceConfigPath(service, cwd, options);
|
|
182472
182697
|
Object.assign(envVars, configPath2 ? { ABSOLUTE_CONFIG: configPath2 } : {}, {
|
|
182473
|
-
ABSOLUTE_SERVER_ENTRY:
|
|
182698
|
+
ABSOLUTE_SERVER_ENTRY: resolve10(cwd, service.entry ?? DEFAULT_SERVER_ENTRY)
|
|
182474
182699
|
});
|
|
182475
182700
|
const command = [
|
|
182476
182701
|
process.execPath,
|
|
@@ -182500,8 +182725,8 @@ var resolveService = (name, service, workspaceEnv, options) => {
|
|
|
182500
182725
|
var resolveServiceBuildDirectory = (service) => {
|
|
182501
182726
|
if (!isAbsoluteService(service))
|
|
182502
182727
|
return null;
|
|
182503
|
-
const cwd =
|
|
182504
|
-
return
|
|
182728
|
+
const cwd = resolve10(service.cwd ?? ".");
|
|
182729
|
+
return resolve10(cwd, service.buildDirectory ?? "build");
|
|
182505
182730
|
};
|
|
182506
182731
|
var findSharedWorkspaceBuildDirectories = (services) => {
|
|
182507
182732
|
const byBuildDirectory = new Map;
|
|
@@ -182719,7 +182944,7 @@ var workspace = async (subcommand, options) => {
|
|
|
182719
182944
|
frameworks: [],
|
|
182720
182945
|
host: getServicePublicHost(resolved.service),
|
|
182721
182946
|
https: getServiceProtocol(resolved.service) === "https",
|
|
182722
|
-
logFile:
|
|
182947
|
+
logFile: resolve10(workspaceLogs.logDirectory, `${sanitizeLogFileName(name)}.log`),
|
|
182723
182948
|
name,
|
|
182724
182949
|
pid: processHandle.pid,
|
|
182725
182950
|
port: resolved.service.port ?? null,
|