@absolutejs/absolute 0.19.0-beta.1116 → 0.19.0-beta.1117
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,356 @@ var init_devCert = __esm(() => {
|
|
|
1158
1158
|
KEY_PATH = join5(CERT_DIR, "key.pem");
|
|
1159
1159
|
});
|
|
1160
1160
|
|
|
1161
|
+
// src/cli/scripts/eslint.ts
|
|
1162
|
+
import { createHash } from "crypto";
|
|
1163
|
+
import {
|
|
1164
|
+
existsSync as existsSync6,
|
|
1165
|
+
mkdirSync as mkdirSync5,
|
|
1166
|
+
readFileSync as readFileSync8,
|
|
1167
|
+
renameSync,
|
|
1168
|
+
rmSync as rmSync3,
|
|
1169
|
+
writeFileSync as writeFileSync5
|
|
1170
|
+
} from "fs";
|
|
1171
|
+
import { dirname as dirname3, resolve as resolve4 } from "path";
|
|
1172
|
+
var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION = "1", CACHE_FINGERPRINT_SUFFIX = ".fingerprint", flagValue = (args, flag) => {
|
|
1173
|
+
const assignment = args.find((arg) => arg.startsWith(`${flag}=`));
|
|
1174
|
+
if (assignment)
|
|
1175
|
+
return assignment.slice(flag.length + 1);
|
|
1176
|
+
const index = args.indexOf(flag);
|
|
1177
|
+
return index < 0 ? undefined : args[index + 1];
|
|
1178
|
+
}, getCacheLocation = (args) => flagValue(args, "--cache-location")?.trim() || process.env.ABSOLUTE_ESLINT_CACHE?.trim() || DEFAULT_CACHE_LOCATION, CONFIG_CANDIDATES, FLAG_VALUE_FLAGS, hasUserPositional = (args) => {
|
|
1179
|
+
for (let index = 0;index < args.length; index++) {
|
|
1180
|
+
const arg = args[index];
|
|
1181
|
+
if (arg === undefined)
|
|
1182
|
+
continue;
|
|
1183
|
+
if (arg.startsWith("-")) {
|
|
1184
|
+
if (arg.includes("="))
|
|
1185
|
+
continue;
|
|
1186
|
+
if (FLAG_VALUE_FLAGS.has(arg))
|
|
1187
|
+
index++;
|
|
1188
|
+
continue;
|
|
1189
|
+
}
|
|
1190
|
+
return true;
|
|
1191
|
+
}
|
|
1192
|
+
return false;
|
|
1193
|
+
}, findConfigPath = (cwd = process.cwd()) => {
|
|
1194
|
+
for (const name of CONFIG_CANDIDATES) {
|
|
1195
|
+
const candidate = resolve4(cwd, name);
|
|
1196
|
+
if (existsSync6(candidate))
|
|
1197
|
+
return candidate;
|
|
1198
|
+
}
|
|
1199
|
+
return null;
|
|
1200
|
+
}, fingerprintLocation = (cacheLocation, cwd) => {
|
|
1201
|
+
const absolute = resolve4(cwd, cacheLocation);
|
|
1202
|
+
return /[\\/]$/.test(cacheLocation) ? resolve4(absolute, CACHE_FINGERPRINT_SUFFIX.slice(1)) : `${absolute}${CACHE_FINGERPRINT_SUFFIX}`;
|
|
1203
|
+
}, addFileToFingerprint = (hash, path, label) => {
|
|
1204
|
+
if (!existsSync6(path))
|
|
1205
|
+
return;
|
|
1206
|
+
hash.update(label);
|
|
1207
|
+
hash.update("\x00");
|
|
1208
|
+
hash.update(readFileSync8(path));
|
|
1209
|
+
hash.update("\x00");
|
|
1210
|
+
}, packageNameFor = (specifier) => {
|
|
1211
|
+
if (specifier.startsWith("@"))
|
|
1212
|
+
return specifier.split("/").slice(0, 2).join("/");
|
|
1213
|
+
const [name = specifier] = specifier.split("/");
|
|
1214
|
+
return name;
|
|
1215
|
+
}, configPackageNames = (configPath2) => {
|
|
1216
|
+
if (!configPath2)
|
|
1217
|
+
return [];
|
|
1218
|
+
const source = readFileSync8(configPath2, "utf-8");
|
|
1219
|
+
const names = new Set;
|
|
1220
|
+
for (const match of source.matchAll(/(?:from\s+|import\s*(?:\(\s*)?|require\s*\(\s*)(['"])([^'".][^'"]*)\1/g)) {
|
|
1221
|
+
const [, , specifier] = match;
|
|
1222
|
+
if (specifier)
|
|
1223
|
+
names.add(packageNameFor(specifier));
|
|
1224
|
+
}
|
|
1225
|
+
return [...names];
|
|
1226
|
+
}, manifestDependencyNames = (manifest) => {
|
|
1227
|
+
if (manifest === null || typeof manifest !== "object")
|
|
1228
|
+
return [];
|
|
1229
|
+
return Object.entries(manifest).flatMap(([key, value]) => {
|
|
1230
|
+
if (key !== "dependencies" && key !== "devDependencies")
|
|
1231
|
+
return [];
|
|
1232
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
1233
|
+
return [];
|
|
1234
|
+
return Object.keys(value);
|
|
1235
|
+
});
|
|
1236
|
+
}, lintDependencyNames = (cwd, configPath2) => {
|
|
1237
|
+
const manifestPath = resolve4(cwd, "package.json");
|
|
1238
|
+
if (!existsSync6(manifestPath))
|
|
1239
|
+
return configPackageNames(configPath2);
|
|
1240
|
+
try {
|
|
1241
|
+
const manifest = JSON.parse(readFileSync8(manifestPath, "utf-8"));
|
|
1242
|
+
const lintPackages = manifestDependencyNames(manifest).filter((name) => /eslint|typescript/.test(name));
|
|
1243
|
+
return [
|
|
1244
|
+
...new Set([...lintPackages, ...configPackageNames(configPath2)])
|
|
1245
|
+
];
|
|
1246
|
+
} catch {
|
|
1247
|
+
return configPackageNames(configPath2);
|
|
1248
|
+
}
|
|
1249
|
+
}, findInstalledManifest = (cwd, dependency) => {
|
|
1250
|
+
let directory = cwd;
|
|
1251
|
+
while (true) {
|
|
1252
|
+
const candidate = resolve4(directory, "node_modules", dependency, "package.json");
|
|
1253
|
+
if (existsSync6(candidate))
|
|
1254
|
+
return candidate;
|
|
1255
|
+
const parent = dirname3(directory);
|
|
1256
|
+
if (parent === directory)
|
|
1257
|
+
return null;
|
|
1258
|
+
directory = parent;
|
|
1259
|
+
}
|
|
1260
|
+
}, createEslintCacheFingerprint = (cwd = process.cwd()) => {
|
|
1261
|
+
const hash = createHash("sha256");
|
|
1262
|
+
hash.update(`absolute-eslint-cache:${CACHE_CONTRACT_VERSION}\x00`);
|
|
1263
|
+
const configPath2 = findConfigPath(cwd);
|
|
1264
|
+
if (configPath2)
|
|
1265
|
+
addFileToFingerprint(hash, configPath2, configPath2);
|
|
1266
|
+
for (const dependency of lintDependencyNames(cwd, configPath2).sort()) {
|
|
1267
|
+
const manifestPath = findInstalledManifest(cwd, dependency);
|
|
1268
|
+
if (manifestPath)
|
|
1269
|
+
addFileToFingerprint(hash, manifestPath, dependency);
|
|
1270
|
+
}
|
|
1271
|
+
return hash.digest("hex");
|
|
1272
|
+
}, writeFingerprint = (path, fingerprint) => {
|
|
1273
|
+
mkdirSync5(dirname3(path), { recursive: true });
|
|
1274
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
1275
|
+
writeFileSync5(temporary, `${fingerprint}
|
|
1276
|
+
`);
|
|
1277
|
+
renameSync(temporary, path);
|
|
1278
|
+
}, prepareEslintCache = (options) => {
|
|
1279
|
+
const cwd = options.cwd ?? process.cwd();
|
|
1280
|
+
const cachePath = resolve4(cwd, options.cacheLocation);
|
|
1281
|
+
const metadataPath = fingerprintLocation(options.cacheLocation, cwd);
|
|
1282
|
+
const fingerprint = options.fingerprint ?? createEslintCacheFingerprint(cwd);
|
|
1283
|
+
const prior = existsSync6(metadataPath) ? readFileSync8(metadataPath, "utf-8").trim() : null;
|
|
1284
|
+
if (prior === fingerprint)
|
|
1285
|
+
return false;
|
|
1286
|
+
rmSync3(cachePath, { force: true, recursive: true });
|
|
1287
|
+
if (metadataPath !== cachePath)
|
|
1288
|
+
rmSync3(metadataPath, { force: true, recursive: true });
|
|
1289
|
+
writeFingerprint(metadataPath, fingerprint);
|
|
1290
|
+
return true;
|
|
1291
|
+
}, hasKey = (objectLiteralSource, key) => {
|
|
1292
|
+
const pattern = new RegExp(`(^|[\\s,{])${key}\\s*:`, "m");
|
|
1293
|
+
return pattern.test(objectLiteralSource);
|
|
1294
|
+
}, NON_GLOBAL_IGNORE_KEYS, isGlobalIgnoresBlock = (block) => {
|
|
1295
|
+
if (!hasKey(block, "ignores"))
|
|
1296
|
+
return false;
|
|
1297
|
+
return !NON_GLOBAL_IGNORE_KEYS.some((key) => hasKey(block, key));
|
|
1298
|
+
}, extractTopLevelObjectLiterals = (source) => {
|
|
1299
|
+
const arrayStart = source.search(/defineConfig\s*\(\s*\[|export\s+default\s*\[/);
|
|
1300
|
+
if (arrayStart === -1)
|
|
1301
|
+
return [];
|
|
1302
|
+
const fromArray = source.slice(arrayStart);
|
|
1303
|
+
const openBracket = fromArray.indexOf("[");
|
|
1304
|
+
if (openBracket === -1)
|
|
1305
|
+
return [];
|
|
1306
|
+
const blocks = [];
|
|
1307
|
+
let depth = 0;
|
|
1308
|
+
let blockStart = -1;
|
|
1309
|
+
let inString = null;
|
|
1310
|
+
let inLineComment = false;
|
|
1311
|
+
let inBlockComment = false;
|
|
1312
|
+
for (let i = openBracket;i < fromArray.length; i++) {
|
|
1313
|
+
const char = fromArray[i];
|
|
1314
|
+
const next = fromArray[i + 1];
|
|
1315
|
+
if (inLineComment) {
|
|
1316
|
+
if (char === `
|
|
1317
|
+
`)
|
|
1318
|
+
inLineComment = false;
|
|
1319
|
+
continue;
|
|
1320
|
+
}
|
|
1321
|
+
if (inBlockComment) {
|
|
1322
|
+
if (char === "*" && next === "/") {
|
|
1323
|
+
inBlockComment = false;
|
|
1324
|
+
i++;
|
|
1325
|
+
}
|
|
1326
|
+
continue;
|
|
1327
|
+
}
|
|
1328
|
+
if (inString) {
|
|
1329
|
+
if (char === "\\") {
|
|
1330
|
+
i++;
|
|
1331
|
+
continue;
|
|
1332
|
+
}
|
|
1333
|
+
if (char === inString)
|
|
1334
|
+
inString = null;
|
|
1335
|
+
continue;
|
|
1336
|
+
}
|
|
1337
|
+
if (char === "/" && next === "/") {
|
|
1338
|
+
inLineComment = true;
|
|
1339
|
+
continue;
|
|
1340
|
+
}
|
|
1341
|
+
if (char === "/" && next === "*") {
|
|
1342
|
+
inBlockComment = true;
|
|
1343
|
+
i++;
|
|
1344
|
+
continue;
|
|
1345
|
+
}
|
|
1346
|
+
if (char === '"' || char === "'" || char === "`") {
|
|
1347
|
+
inString = char;
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
if (char === "{") {
|
|
1351
|
+
if (depth === 0)
|
|
1352
|
+
blockStart = i;
|
|
1353
|
+
depth++;
|
|
1354
|
+
} else if (char === "}") {
|
|
1355
|
+
depth--;
|
|
1356
|
+
if (depth === 0 && blockStart !== -1) {
|
|
1357
|
+
blocks.push(fromArray.slice(blockStart, i + 1));
|
|
1358
|
+
blockStart = -1;
|
|
1359
|
+
}
|
|
1360
|
+
} else if (char === "]" && depth === 0) {
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
return blocks;
|
|
1365
|
+
}, checkForMisplacedIgnores = () => {
|
|
1366
|
+
const configPath2 = findConfigPath();
|
|
1367
|
+
if (!configPath2)
|
|
1368
|
+
return;
|
|
1369
|
+
let source;
|
|
1370
|
+
try {
|
|
1371
|
+
source = readFileSync8(configPath2, "utf-8");
|
|
1372
|
+
} catch {
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
const blocks = extractTopLevelObjectLiterals(source);
|
|
1376
|
+
if (blocks.some(isGlobalIgnoresBlock))
|
|
1377
|
+
return;
|
|
1378
|
+
let offenderCount = 0;
|
|
1379
|
+
for (const block of blocks) {
|
|
1380
|
+
if (hasKey(block, "ignores") && hasKey(block, "files")) {
|
|
1381
|
+
offenderCount++;
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
if (offenderCount === 0)
|
|
1385
|
+
return;
|
|
1386
|
+
const yellow = "\x1B[33m";
|
|
1387
|
+
const reset = "\x1B[0m";
|
|
1388
|
+
const bold = "\x1B[1m";
|
|
1389
|
+
console.warn(`${yellow}${bold}\u26A0 ESLint flat-config warning${reset}${yellow}: found ${offenderCount} config block(s) where \`ignores\` lives alongside \`files\`. In ESLint v9, \`ignores\` is only a *global* ignore when it's the sole key in its config object \u2014 otherwise it just suppresses that block's own rules and ESLint still walks every other directory (including node_modules), making lint extremely slow.
|
|
1390
|
+
|
|
1391
|
+
Move ignores into a standalone block at the top of your config:
|
|
1392
|
+
|
|
1393
|
+
export default defineConfig([
|
|
1394
|
+
{ ignores: ['node_modules/**', 'dist/**', 'build/**', '.absolutejs/**'] },
|
|
1395
|
+
pluginJs.configs.recommended,
|
|
1396
|
+
...
|
|
1397
|
+
]);
|
|
1398
|
+
|
|
1399
|
+
Detected at: ${configPath2}${reset}`);
|
|
1400
|
+
}, formatDuration = (durationMs) => {
|
|
1401
|
+
if (durationMs < 1000)
|
|
1402
|
+
return `${durationMs}ms`;
|
|
1403
|
+
if (durationMs < 60000)
|
|
1404
|
+
return `${(durationMs / 1000).toFixed(2)}s`;
|
|
1405
|
+
const minutes = Math.floor(durationMs / 60000);
|
|
1406
|
+
const seconds = Math.round(durationMs % 60000 / 1000);
|
|
1407
|
+
return `${minutes}m ${seconds}s`;
|
|
1408
|
+
}, handleClearCache = (cacheLocation, cwd = process.cwd()) => {
|
|
1409
|
+
try {
|
|
1410
|
+
const cachePath = resolve4(cwd, cacheLocation);
|
|
1411
|
+
const metadataPath = fingerprintLocation(cacheLocation, cwd);
|
|
1412
|
+
rmSync3(cachePath, { force: true, recursive: true });
|
|
1413
|
+
rmSync3(metadataPath, { force: true, recursive: true });
|
|
1414
|
+
console.log(`\x1B[32m\u2713\x1B[0m Cleared cache: ${cacheLocation}`);
|
|
1415
|
+
} catch (err) {
|
|
1416
|
+
console.error(`\x1B[31m\u2717\x1B[0m Failed to clear cache at ${cacheLocation}:`, err);
|
|
1417
|
+
process.exit(1);
|
|
1418
|
+
}
|
|
1419
|
+
}, buildEslintCommand = (args, cacheLocation) => {
|
|
1420
|
+
const cacheEnabled = !args.includes("--no-cache");
|
|
1421
|
+
const hasCacheLocation = args.some((arg) => arg === "--cache-location" || arg.startsWith("--cache-location="));
|
|
1422
|
+
const hasCacheStrategy = args.some((arg) => arg === "--cache-strategy" || arg.startsWith("--cache-strategy="));
|
|
1423
|
+
return [
|
|
1424
|
+
"bun",
|
|
1425
|
+
"eslint",
|
|
1426
|
+
...cacheEnabled ? ["--cache"] : [],
|
|
1427
|
+
...cacheEnabled && !hasCacheLocation ? ["--cache-location", cacheLocation] : [],
|
|
1428
|
+
...cacheEnabled && !hasCacheStrategy ? ["--cache-strategy", "content"] : [],
|
|
1429
|
+
...args,
|
|
1430
|
+
...hasUserPositional(args) ? [] : ["."]
|
|
1431
|
+
];
|
|
1432
|
+
}, eslint = async (args) => {
|
|
1433
|
+
const cacheLocation = getCacheLocation(args);
|
|
1434
|
+
if (args.includes("--clear-cache")) {
|
|
1435
|
+
handleClearCache(cacheLocation);
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
if (!existsSync6(resolve4("node_modules", ".bin", "eslint"))) {
|
|
1439
|
+
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
|
+
process.exit(1);
|
|
1441
|
+
}
|
|
1442
|
+
checkForMisplacedIgnores();
|
|
1443
|
+
const cacheEnabled = !args.includes("--no-cache");
|
|
1444
|
+
if (cacheEnabled)
|
|
1445
|
+
prepareEslintCache({ cacheLocation });
|
|
1446
|
+
const command = buildEslintCommand(args, cacheLocation);
|
|
1447
|
+
const dim = "\x1B[2m";
|
|
1448
|
+
const reset = "\x1B[0m";
|
|
1449
|
+
console.log(cacheEnabled ? `${dim}cache: ${cacheLocation} (content-aware; lint-tool changes invalidate automatically)${reset}` : `${dim}cache: disabled${reset}`);
|
|
1450
|
+
const startedAt = Date.now();
|
|
1451
|
+
const proc = Bun.spawn(command, {
|
|
1452
|
+
stderr: "inherit",
|
|
1453
|
+
stdout: "inherit"
|
|
1454
|
+
});
|
|
1455
|
+
const exitCode = await proc.exited;
|
|
1456
|
+
const elapsed = formatDuration(Date.now() - startedAt);
|
|
1457
|
+
if (exitCode !== 0) {
|
|
1458
|
+
console.log(`${dim}elapsed: ${elapsed}${reset}`);
|
|
1459
|
+
process.exit(exitCode);
|
|
1460
|
+
}
|
|
1461
|
+
console.log(`\x1B[32m\u2713\x1B[0m Passed ${dim}(${elapsed})${reset}`);
|
|
1462
|
+
};
|
|
1463
|
+
var init_eslint = __esm(() => {
|
|
1464
|
+
CONFIG_CANDIDATES = [
|
|
1465
|
+
"eslint.config.js",
|
|
1466
|
+
"eslint.config.mjs",
|
|
1467
|
+
"eslint.config.cjs",
|
|
1468
|
+
"eslint.config.ts",
|
|
1469
|
+
"eslint.config.mts",
|
|
1470
|
+
"eslint.config.cts"
|
|
1471
|
+
];
|
|
1472
|
+
FLAG_VALUE_FLAGS = new Set([
|
|
1473
|
+
"-c",
|
|
1474
|
+
"--config",
|
|
1475
|
+
"--cache-location",
|
|
1476
|
+
"--cache-strategy",
|
|
1477
|
+
"--ignore-path",
|
|
1478
|
+
"--ignore-pattern",
|
|
1479
|
+
"--rule",
|
|
1480
|
+
"--rulesdir",
|
|
1481
|
+
"--ext",
|
|
1482
|
+
"-f",
|
|
1483
|
+
"--format",
|
|
1484
|
+
"--max-warnings",
|
|
1485
|
+
"--parser",
|
|
1486
|
+
"--parser-options",
|
|
1487
|
+
"--plugin",
|
|
1488
|
+
"--global",
|
|
1489
|
+
"--env",
|
|
1490
|
+
"--report-unused-disable-directives-severity",
|
|
1491
|
+
"--resolve-plugins-relative-to",
|
|
1492
|
+
"-o",
|
|
1493
|
+
"--output-file",
|
|
1494
|
+
"--flag",
|
|
1495
|
+
"--inspect-config",
|
|
1496
|
+
"--stats",
|
|
1497
|
+
"--concurrency"
|
|
1498
|
+
]);
|
|
1499
|
+
NON_GLOBAL_IGNORE_KEYS = [
|
|
1500
|
+
"files",
|
|
1501
|
+
"rules",
|
|
1502
|
+
"plugins",
|
|
1503
|
+
"languageOptions",
|
|
1504
|
+
"linterOptions",
|
|
1505
|
+
"processor",
|
|
1506
|
+
"settings",
|
|
1507
|
+
"extends"
|
|
1508
|
+
];
|
|
1509
|
+
});
|
|
1510
|
+
|
|
1161
1511
|
// src/utils/stripStringsAndComments.ts
|
|
1162
1512
|
var stripStringsAndComments = (source) => {
|
|
1163
1513
|
const { length } = source;
|
|
@@ -171289,10 +171639,186 @@ var init_build = __esm(() => {
|
|
|
171289
171639
|
FRAMEWORK_KEYS = ["react", "vue", "svelte", "angular", "html", "htmx"];
|
|
171290
171640
|
});
|
|
171291
171641
|
|
|
171642
|
+
// src/cli/scripts/lintProof.ts
|
|
171643
|
+
var exports_lintProof = {};
|
|
171644
|
+
__export(exports_lintProof, {
|
|
171645
|
+
writeLintProof: () => writeLintProof,
|
|
171646
|
+
verifyLintProof: () => verifyLintProof,
|
|
171647
|
+
runLintProof: () => runLintProof,
|
|
171648
|
+
createLintSourceTree: () => createLintSourceTree,
|
|
171649
|
+
createLintProof: () => createLintProof
|
|
171650
|
+
});
|
|
171651
|
+
import { createHash as createHash2 } from "crypto";
|
|
171652
|
+
import {
|
|
171653
|
+
existsSync as existsSync11,
|
|
171654
|
+
lstatSync,
|
|
171655
|
+
mkdirSync as mkdirSync8,
|
|
171656
|
+
mkdtempSync,
|
|
171657
|
+
readFileSync as readFileSync14,
|
|
171658
|
+
renameSync as renameSync2,
|
|
171659
|
+
rmSync as rmSync5,
|
|
171660
|
+
writeFileSync as writeFileSync7
|
|
171661
|
+
} from "fs";
|
|
171662
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
171663
|
+
import { dirname as dirname5, relative as relative2, resolve as resolve11 } from "path";
|
|
171664
|
+
var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSION = 1, runGit = (args, options) => {
|
|
171665
|
+
const proc = Bun.spawnSync(["git", ...args], {
|
|
171666
|
+
cwd: options.cwd,
|
|
171667
|
+
env: { ...process.env, ...options.env },
|
|
171668
|
+
stderr: "pipe",
|
|
171669
|
+
stdout: "pipe"
|
|
171670
|
+
});
|
|
171671
|
+
if (proc.exitCode !== 0) {
|
|
171672
|
+
const detail = proc.stderr.toString().trim();
|
|
171673
|
+
throw new Error(detail || `git ${args.join(" ")} failed`);
|
|
171674
|
+
}
|
|
171675
|
+
return proc.stdout.toString().trim();
|
|
171676
|
+
}, gitRoot = (cwd) => resolve11(runGit(["rev-parse", "--show-toplevel"], { cwd })), createLintSourceTree = (cwd = process.cwd(), proofLocation = DEFAULT_PROOF_LOCATION) => {
|
|
171677
|
+
const root = gitRoot(cwd);
|
|
171678
|
+
const proofPath = resolve11(cwd, proofLocation);
|
|
171679
|
+
const proofRelative = relative2(root, proofPath).replaceAll("\\", "/");
|
|
171680
|
+
if (proofRelative === ".." || proofRelative.startsWith("../") || proofRelative === "") {
|
|
171681
|
+
throw new Error("lint proof must live inside the Git working tree");
|
|
171682
|
+
}
|
|
171683
|
+
const temporaryDirectory = mkdtempSync(resolve11(tmpdir2(), "absolute-lint-proof-"));
|
|
171684
|
+
const temporaryIndex = resolve11(temporaryDirectory, "index");
|
|
171685
|
+
const env3 = { GIT_INDEX_FILE: temporaryIndex };
|
|
171686
|
+
try {
|
|
171687
|
+
runGit(["read-tree", "--empty"], { cwd: root, env: env3 });
|
|
171688
|
+
const files = runGit(["ls-files", "--cached", "--others", "--exclude-standard", "-z"], { cwd: root }).split("\x00").filter((path) => {
|
|
171689
|
+
if (!path || path === proofRelative)
|
|
171690
|
+
return false;
|
|
171691
|
+
try {
|
|
171692
|
+
lstatSync(resolve11(root, path));
|
|
171693
|
+
return true;
|
|
171694
|
+
} catch {
|
|
171695
|
+
return false;
|
|
171696
|
+
}
|
|
171697
|
+
});
|
|
171698
|
+
for (let index = 0;index < files.length; index += 200) {
|
|
171699
|
+
runGit(["add", "-f", "--", ...files.slice(index, index + 200)], {
|
|
171700
|
+
cwd: root,
|
|
171701
|
+
env: env3
|
|
171702
|
+
});
|
|
171703
|
+
}
|
|
171704
|
+
return runGit(["write-tree"], { cwd: root, env: env3 });
|
|
171705
|
+
} finally {
|
|
171706
|
+
rmSync5(temporaryDirectory, { force: true, recursive: true });
|
|
171707
|
+
}
|
|
171708
|
+
}, proofFingerprint = (cwd) => createHash2("sha256").update(`absolute-lint-proof:${PROOF_CONTRACT_VERSION}\x00`).update(createEslintCacheFingerprint(cwd)).digest("hex"), createLintProof = (command, options = {}) => {
|
|
171709
|
+
const cwd = options.cwd ?? process.cwd();
|
|
171710
|
+
const proofLocation = options.proofLocation ?? DEFAULT_PROOF_LOCATION;
|
|
171711
|
+
return {
|
|
171712
|
+
command,
|
|
171713
|
+
contractVersion: PROOF_CONTRACT_VERSION,
|
|
171714
|
+
createdAt: new Date().toISOString(),
|
|
171715
|
+
lintFingerprint: proofFingerprint(cwd),
|
|
171716
|
+
sourceTree: createLintSourceTree(cwd, proofLocation)
|
|
171717
|
+
};
|
|
171718
|
+
}, writeLintProof = (command, options = {}) => {
|
|
171719
|
+
const cwd = options.cwd ?? process.cwd();
|
|
171720
|
+
const proofLocation = options.proofLocation ?? DEFAULT_PROOF_LOCATION;
|
|
171721
|
+
const path = resolve11(cwd, proofLocation);
|
|
171722
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
171723
|
+
const proof = createLintProof(command, { cwd, proofLocation });
|
|
171724
|
+
mkdirSync8(dirname5(path), { recursive: true });
|
|
171725
|
+
writeFileSync7(temporary, `${JSON.stringify(proof, null, 2)}
|
|
171726
|
+
`);
|
|
171727
|
+
renameSync2(temporary, path);
|
|
171728
|
+
return proof;
|
|
171729
|
+
}, isLintProof = (value) => {
|
|
171730
|
+
if (value === null || typeof value !== "object")
|
|
171731
|
+
return false;
|
|
171732
|
+
const proof = value;
|
|
171733
|
+
return proof.contractVersion === PROOF_CONTRACT_VERSION && Array.isArray(proof.command) && proof.command.every((part) => typeof part === "string") && typeof proof.createdAt === "string" && typeof proof.lintFingerprint === "string" && typeof proof.sourceTree === "string";
|
|
171734
|
+
}, verifyLintProof = (command, options = {}) => {
|
|
171735
|
+
const cwd = options.cwd ?? process.cwd();
|
|
171736
|
+
const proofLocation = options.proofLocation ?? DEFAULT_PROOF_LOCATION;
|
|
171737
|
+
const path = resolve11(cwd, proofLocation);
|
|
171738
|
+
if (!existsSync11(path))
|
|
171739
|
+
return { reason: `missing lint proof: ${proofLocation}`, valid: false };
|
|
171740
|
+
let proof;
|
|
171741
|
+
try {
|
|
171742
|
+
proof = JSON.parse(readFileSync14(path, "utf-8"));
|
|
171743
|
+
} catch {
|
|
171744
|
+
return { reason: `invalid lint proof: ${proofLocation}`, valid: false };
|
|
171745
|
+
}
|
|
171746
|
+
if (!isLintProof(proof))
|
|
171747
|
+
return { reason: "unsupported lint proof contract", valid: false };
|
|
171748
|
+
if (JSON.stringify(proof.command) !== JSON.stringify(command))
|
|
171749
|
+
return {
|
|
171750
|
+
reason: "lint command differs from the recorded command",
|
|
171751
|
+
valid: false
|
|
171752
|
+
};
|
|
171753
|
+
if (proof.lintFingerprint !== proofFingerprint(cwd))
|
|
171754
|
+
return {
|
|
171755
|
+
reason: "ESLint configuration or toolchain changed",
|
|
171756
|
+
valid: false
|
|
171757
|
+
};
|
|
171758
|
+
if (proof.sourceTree !== createLintSourceTree(cwd, proofLocation))
|
|
171759
|
+
return {
|
|
171760
|
+
reason: "source tree changed since lint passed",
|
|
171761
|
+
valid: false
|
|
171762
|
+
};
|
|
171763
|
+
return { proof, valid: true };
|
|
171764
|
+
}, parseArgs = (args) => {
|
|
171765
|
+
const separator = args.indexOf("--");
|
|
171766
|
+
const controlArgs = separator === -1 ? args : args.slice(0, separator);
|
|
171767
|
+
const command = separator === -1 ? [] : args.slice(separator + 1);
|
|
171768
|
+
const proofFlag = controlArgs.indexOf("--proof");
|
|
171769
|
+
const proofLocation = proofFlag === -1 ? DEFAULT_PROOF_LOCATION : controlArgs[proofFlag + 1];
|
|
171770
|
+
if (!proofLocation)
|
|
171771
|
+
throw new Error("--proof requires a path");
|
|
171772
|
+
return { command, proofLocation };
|
|
171773
|
+
}, runLintProof = async (args) => {
|
|
171774
|
+
const [operation] = args;
|
|
171775
|
+
if (operation !== "run" && operation !== "verify") {
|
|
171776
|
+
console.error("Usage: absolute lint-proof <run|verify> [--proof path] -- <lint command>");
|
|
171777
|
+
return 2;
|
|
171778
|
+
}
|
|
171779
|
+
let parsed;
|
|
171780
|
+
try {
|
|
171781
|
+
parsed = parseArgs(args.slice(1));
|
|
171782
|
+
} catch (error) {
|
|
171783
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
171784
|
+
return 2;
|
|
171785
|
+
}
|
|
171786
|
+
if (parsed.command.length === 0) {
|
|
171787
|
+
console.error("A lint command is required after --");
|
|
171788
|
+
return 2;
|
|
171789
|
+
}
|
|
171790
|
+
if (operation === "verify") {
|
|
171791
|
+
const result = verifyLintProof(parsed.command, {
|
|
171792
|
+
proofLocation: parsed.proofLocation
|
|
171793
|
+
});
|
|
171794
|
+
if (!result.valid) {
|
|
171795
|
+
console.error(`\x1B[31m\u2717\x1B[0m ${result.reason}`);
|
|
171796
|
+
return 1;
|
|
171797
|
+
}
|
|
171798
|
+
console.log(`\x1B[32m\u2713\x1B[0m Lint proof matches the source tree, command, and lint toolchain`);
|
|
171799
|
+
return 0;
|
|
171800
|
+
}
|
|
171801
|
+
const proc = Bun.spawn(parsed.command, {
|
|
171802
|
+
stderr: "inherit",
|
|
171803
|
+
stdout: "inherit"
|
|
171804
|
+
});
|
|
171805
|
+
const exitCode = await proc.exited;
|
|
171806
|
+
if (exitCode !== 0) {
|
|
171807
|
+
console.error("\x1B[31m\u2717\x1B[0m Lint failed; proof was not updated");
|
|
171808
|
+
return exitCode;
|
|
171809
|
+
}
|
|
171810
|
+
writeLintProof(parsed.command, { proofLocation: parsed.proofLocation });
|
|
171811
|
+
console.log(`\x1B[32m\u2713\x1B[0m Wrote exact-source lint proof: ${parsed.proofLocation}`);
|
|
171812
|
+
return 0;
|
|
171813
|
+
};
|
|
171814
|
+
var init_lintProof = __esm(() => {
|
|
171815
|
+
init_eslint();
|
|
171816
|
+
});
|
|
171817
|
+
|
|
171292
171818
|
// src/build/scanConventions.ts
|
|
171293
171819
|
import { basename as basename4 } from "path";
|
|
171294
171820
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
171295
|
-
import { existsSync as
|
|
171821
|
+
import { existsSync as existsSync12 } from "fs";
|
|
171296
171822
|
var CONVENTION_RE, classifyFile = (file, pageFiles, defaults, pages) => {
|
|
171297
171823
|
const fileName = basename4(file);
|
|
171298
171824
|
const match = CONVENTION_RE.exec(fileName);
|
|
@@ -171317,7 +171843,7 @@ var CONVENTION_RE, classifyFile = (file, pageFiles, defaults, pages) => {
|
|
|
171317
171843
|
else if (kind === "loading")
|
|
171318
171844
|
pages[pageName].loading = file;
|
|
171319
171845
|
}, scanConventions = async (pagesDir, pattern) => {
|
|
171320
|
-
if (!
|
|
171846
|
+
if (!existsSync12(pagesDir)) {
|
|
171321
171847
|
const pageFiles2 = [];
|
|
171322
171848
|
return { conventions: undefined, pageFiles: pageFiles2 };
|
|
171323
171849
|
}
|
|
@@ -171352,8 +171878,8 @@ var exports_ls = {};
|
|
|
171352
171878
|
__export(exports_ls, {
|
|
171353
171879
|
runLs: () => runLs
|
|
171354
171880
|
});
|
|
171355
|
-
import { existsSync as
|
|
171356
|
-
import { basename as basename5, extname as extname2, join as join13, relative as
|
|
171881
|
+
import { existsSync as existsSync13, readFileSync as readFileSync15, statSync } from "fs";
|
|
171882
|
+
import { basename as basename5, extname as extname2, join as join13, relative as relative3 } from "path";
|
|
171357
171883
|
var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELDS, readStringField = (source, key) => {
|
|
171358
171884
|
const value = Reflect.get(source, key);
|
|
171359
171885
|
return typeof value === "string" ? value : undefined;
|
|
@@ -171368,7 +171894,7 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
|
|
|
171368
171894
|
} catch {
|
|
171369
171895
|
return null;
|
|
171370
171896
|
}
|
|
171371
|
-
}, relativeOrSelf = (target) =>
|
|
171897
|
+
}, relativeOrSelf = (target) => relative3(process.cwd(), target) || target, configCandidates = (raw) => isWorkspaceConfig(raw) ? Object.values(raw).map((service) => ({
|
|
171372
171898
|
baseDir: readStringField(service, "cwd") ?? ".",
|
|
171373
171899
|
source: service
|
|
171374
171900
|
})) : [{ baseDir: ".", source: raw }], specsFor = (source, baseDir) => FRAMEWORK_FIELDS.flatMap((framework) => {
|
|
@@ -171403,10 +171929,10 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
|
|
|
171403
171929
|
return pages ? [{ label, pages: sortPages(pages) }] : [];
|
|
171404
171930
|
});
|
|
171405
171931
|
}, resolveDiskPath = (buildDir, value) => {
|
|
171406
|
-
if (
|
|
171932
|
+
if (existsSync13(value))
|
|
171407
171933
|
return value;
|
|
171408
171934
|
const underBuild = join13(buildDir, value);
|
|
171409
|
-
if (
|
|
171935
|
+
if (existsSync13(underBuild))
|
|
171410
171936
|
return underBuild;
|
|
171411
171937
|
return join13(process.cwd(), value);
|
|
171412
171938
|
}, fileSize = (diskPath) => {
|
|
@@ -171416,7 +171942,7 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
|
|
|
171416
171942
|
return 0;
|
|
171417
171943
|
}
|
|
171418
171944
|
}, readManifestSizes = (manifestDir) => {
|
|
171419
|
-
const manifest = JSON.parse(
|
|
171945
|
+
const manifest = JSON.parse(readFileSync15(join13(manifestDir, "manifest.json"), "utf-8"));
|
|
171420
171946
|
const sizes = new Map;
|
|
171421
171947
|
Object.entries(manifest).forEach(([key, value]) => {
|
|
171422
171948
|
sizes.set(key, fileSize(resolveDiskPath(manifestDir, value)));
|
|
@@ -171534,7 +172060,7 @@ ${colors.dim}${frameworkCount} ${frameworkCount === 1 ? "framework" : "framework
|
|
|
171534
172060
|
}
|
|
171535
172061
|
const sizesDir = resolveSizesDir(args, candidates);
|
|
171536
172062
|
const manifestPath = join13(sizesDir, "manifest.json");
|
|
171537
|
-
if (!
|
|
172063
|
+
if (!existsSync13(manifestPath)) {
|
|
171538
172064
|
printDim(`No build at ${relativeOrSelf(manifestPath)}. Run \`absolute build\` first, or pass \`--outdir <dir>\`.`);
|
|
171539
172065
|
return;
|
|
171540
172066
|
}
|
|
@@ -171658,21 +172184,21 @@ var init_discoverInstances = __esm(() => {
|
|
|
171658
172184
|
import { createConnection as createConnection2 } from "net";
|
|
171659
172185
|
var {$: $4 } = globalThis.Bun;
|
|
171660
172186
|
var displayHost = (host) => host === "0.0.0.0" || host === "::" ? "localhost" : host, probePort = (host, port) => {
|
|
171661
|
-
const { promise, resolve:
|
|
172187
|
+
const { promise, resolve: resolve12 } = Promise.withResolvers();
|
|
171662
172188
|
const socket = createConnection2({ host: displayHost(host), port });
|
|
171663
172189
|
const timeout = setTimeout(() => {
|
|
171664
172190
|
socket.destroy();
|
|
171665
|
-
|
|
172191
|
+
resolve12(false);
|
|
171666
172192
|
}, INSTANCE_PROBE_TIMEOUT_MS);
|
|
171667
172193
|
socket.once("connect", () => {
|
|
171668
172194
|
clearTimeout(timeout);
|
|
171669
172195
|
socket.end();
|
|
171670
|
-
|
|
172196
|
+
resolve12(true);
|
|
171671
172197
|
});
|
|
171672
172198
|
socket.once("error", () => {
|
|
171673
172199
|
clearTimeout(timeout);
|
|
171674
172200
|
socket.destroy();
|
|
171675
|
-
|
|
172201
|
+
resolve12(false);
|
|
171676
172202
|
});
|
|
171677
172203
|
return promise;
|
|
171678
172204
|
}, probeStatus = async (record) => {
|
|
@@ -172384,9 +172910,9 @@ var exports_heapDiff = {};
|
|
|
172384
172910
|
__export(exports_heapDiff, {
|
|
172385
172911
|
runHeapDiff: () => runHeapDiff
|
|
172386
172912
|
});
|
|
172387
|
-
import { existsSync as
|
|
172913
|
+
import { existsSync as existsSync14, readFileSync as readFileSync16 } from "fs";
|
|
172388
172914
|
var TOP = 15, STRING_TYPES, aggregate = (path) => {
|
|
172389
|
-
const data = JSON.parse(
|
|
172915
|
+
const data = JSON.parse(readFileSync16(path, "utf-8"));
|
|
172390
172916
|
const { nodes, strings } = data;
|
|
172391
172917
|
const { node_fields: fields, node_types: nodeTypes } = data.snapshot.meta;
|
|
172392
172918
|
const [typeNames] = nodeTypes;
|
|
@@ -172415,7 +172941,7 @@ var TOP = 15, STRING_TYPES, aggregate = (path) => {
|
|
|
172415
172941
|
return;
|
|
172416
172942
|
}
|
|
172417
172943
|
for (const path of [beforePath, afterPath]) {
|
|
172418
|
-
if (
|
|
172944
|
+
if (existsSync14(path))
|
|
172419
172945
|
continue;
|
|
172420
172946
|
process.stdout.write(`${colors.red}No such file: ${path}${colors.reset}
|
|
172421
172947
|
`);
|
|
@@ -172535,16 +173061,16 @@ var isRecord3 = (value) => typeof value === "object" && value !== null && !Array
|
|
|
172535
173061
|
|
|
172536
173062
|
// src/cli/config/schema/fromType.ts
|
|
172537
173063
|
import {
|
|
172538
|
-
existsSync as
|
|
172539
|
-
mkdirSync as
|
|
172540
|
-
readFileSync as
|
|
173064
|
+
existsSync as existsSync15,
|
|
173065
|
+
mkdirSync as mkdirSync9,
|
|
173066
|
+
readFileSync as readFileSync17,
|
|
172541
173067
|
statSync as statSync2,
|
|
172542
|
-
writeFileSync as
|
|
173068
|
+
writeFileSync as writeFileSync8
|
|
172543
173069
|
} from "fs";
|
|
172544
|
-
import { resolve as
|
|
173070
|
+
import { resolve as resolve12 } from "path";
|
|
172545
173071
|
var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DEPTH = 6, isFrameworkRepo = (cwd) => {
|
|
172546
173072
|
try {
|
|
172547
|
-
const pkg = JSON.parse(
|
|
173073
|
+
const pkg = JSON.parse(readFileSync17(resolve12(cwd, "package.json"), "utf-8"));
|
|
172548
173074
|
return pkg?.name === "@absolutejs/absolute";
|
|
172549
173075
|
} catch {
|
|
172550
173076
|
return false;
|
|
@@ -172565,14 +173091,14 @@ var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
172565
173091
|
};
|
|
172566
173092
|
}, SCHEMA_VERSION = 1, packageVersion = (cwd, specifier) => {
|
|
172567
173093
|
const candidates = specifier === "@absolutejs/absolute" ? [
|
|
172568
|
-
|
|
172569
|
-
|
|
173094
|
+
resolve12(cwd, "node_modules", "@absolutejs", "absolute", "package.json"),
|
|
173095
|
+
resolve12(cwd, "package.json")
|
|
172570
173096
|
] : [
|
|
172571
|
-
|
|
173097
|
+
resolve12(cwd, "node_modules", ...specifier.split("/"), "package.json")
|
|
172572
173098
|
];
|
|
172573
173099
|
for (const candidate of candidates) {
|
|
172574
173100
|
try {
|
|
172575
|
-
const { version: version2 } = JSON.parse(
|
|
173101
|
+
const { version: version2 } = JSON.parse(readFileSync17(candidate, "utf-8"));
|
|
172576
173102
|
if (typeof version2 === "string")
|
|
172577
173103
|
return version2;
|
|
172578
173104
|
} catch {}
|
|
@@ -172583,16 +173109,16 @@ var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
172583
173109
|
if (local) {
|
|
172584
173110
|
const file = typeName === "PackageJson" ? "packageJson.ts" : "build.ts";
|
|
172585
173111
|
try {
|
|
172586
|
-
signature += `:${statSync2(
|
|
173112
|
+
signature += `:${statSync2(resolve12(cwd, "types", file)).mtimeMs}`;
|
|
172587
173113
|
} catch {}
|
|
172588
173114
|
}
|
|
172589
173115
|
return signature;
|
|
172590
173116
|
}, cacheSlug = (specifier) => specifier.replace("@", "").split("/").join("-"), cacheFile = (cwd, typeName, specifier) => {
|
|
172591
173117
|
const name = specifier === "@absolutejs/absolute" ? typeName : `${typeName}.${cacheSlug(specifier)}`;
|
|
172592
|
-
return
|
|
173118
|
+
return resolve12(cwd, ".absolutejs", "config-schema", `${name}.json`);
|
|
172593
173119
|
}, readDiskCache = (cwd, typeName, signature, specifier) => {
|
|
172594
173120
|
try {
|
|
172595
|
-
const cached = JSON.parse(
|
|
173121
|
+
const cached = JSON.parse(readFileSync17(cacheFile(cwd, typeName, specifier), "utf-8"));
|
|
172596
173122
|
if (isRecord3(cached) && cached.signature === signature && Array.isArray(cached.fields)) {
|
|
172597
173123
|
return cached.fields;
|
|
172598
173124
|
}
|
|
@@ -172600,10 +173126,10 @@ var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
172600
173126
|
return null;
|
|
172601
173127
|
}, writeDiskCache = (cwd, typeName, signature, fields, specifier) => {
|
|
172602
173128
|
try {
|
|
172603
|
-
|
|
173129
|
+
mkdirSync9(resolve12(cwd, ".absolutejs", "config-schema"), {
|
|
172604
173130
|
recursive: true
|
|
172605
173131
|
});
|
|
172606
|
-
|
|
173132
|
+
writeFileSync8(cacheFile(cwd, typeName, specifier), JSON.stringify({ fields, signature }));
|
|
172607
173133
|
} catch {}
|
|
172608
173134
|
}, docOf = (symbol, checker) => import_typescript3.default.displayPartsToString(symbol.getDocumentationComment(checker)).trim(), typeOfSymbol = (symbol, checker) => {
|
|
172609
173135
|
const declaration = symbol.valueDeclaration ?? symbol.declarations?.[0];
|
|
@@ -172687,7 +173213,7 @@ var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
172687
173213
|
}
|
|
172688
173214
|
return opaque();
|
|
172689
173215
|
}, introspectFrom = (cwd, specifier, typeName, options, exclude) => {
|
|
172690
|
-
const virtualPath =
|
|
173216
|
+
const virtualPath = resolve12(cwd, VIRTUAL_NAME);
|
|
172691
173217
|
const source = `import type { ${typeName} } from '${specifier}';
|
|
172692
173218
|
declare const value: ${typeName};
|
|
172693
173219
|
export { value };
|
|
@@ -172730,7 +173256,7 @@ export { value };
|
|
|
172730
173256
|
const cached = cache.get(cacheKey);
|
|
172731
173257
|
if (cached)
|
|
172732
173258
|
return cached;
|
|
172733
|
-
const local = specifier === "@absolutejs/absolute" && isFrameworkRepo(cwd) &&
|
|
173259
|
+
const local = specifier === "@absolutejs/absolute" && isFrameworkRepo(cwd) && existsSync15(resolve12(cwd, "types/index.ts"));
|
|
172734
173260
|
const signature = cacheSignature(cwd, typeName, local, specifier);
|
|
172735
173261
|
const fromDisk = readDiskCache(cwd, typeName, signature, specifier);
|
|
172736
173262
|
if (fromDisk) {
|
|
@@ -172758,16 +173284,16 @@ var init_fromType = __esm(() => {
|
|
|
172758
173284
|
});
|
|
172759
173285
|
|
|
172760
173286
|
// src/cli/config/absolute/resolveAbsoluteConfig.ts
|
|
172761
|
-
import { existsSync as
|
|
172762
|
-
import { resolve as
|
|
173287
|
+
import { existsSync as existsSync16, readFileSync as readFileSync18 } from "fs";
|
|
173288
|
+
import { resolve as resolve13 } from "path";
|
|
172763
173289
|
var import_typescript4, CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath2 = (cwd, override) => {
|
|
172764
173290
|
if (override) {
|
|
172765
|
-
const resolved =
|
|
172766
|
-
return
|
|
173291
|
+
const resolved = resolve13(cwd, override);
|
|
173292
|
+
return existsSync16(resolved) ? resolved : null;
|
|
172767
173293
|
}
|
|
172768
173294
|
for (const name of CONFIG_CANDIDATES2) {
|
|
172769
|
-
const candidate =
|
|
172770
|
-
if (
|
|
173295
|
+
const candidate = resolve13(cwd, name);
|
|
173296
|
+
if (existsSync16(candidate))
|
|
172771
173297
|
return candidate;
|
|
172772
173298
|
}
|
|
172773
173299
|
return null;
|
|
@@ -172788,7 +173314,7 @@ var import_typescript4, CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath2 = (c
|
|
|
172788
173314
|
}
|
|
172789
173315
|
return null;
|
|
172790
173316
|
}, parseConfigObject = (configPath2) => {
|
|
172791
|
-
const text =
|
|
173317
|
+
const text = readFileSync18(configPath2, "utf-8");
|
|
172792
173318
|
return { object: findConfigObject(parseSource(configPath2, text)), text };
|
|
172793
173319
|
}, evalLiteral = (node) => {
|
|
172794
173320
|
if (import_typescript4.default.isStringLiteralLike(node)) {
|
|
@@ -173000,8 +173526,8 @@ var init_frameworks = __esm(() => {
|
|
|
173000
173526
|
});
|
|
173001
173527
|
|
|
173002
173528
|
// src/cli/generate/context.ts
|
|
173003
|
-
import { dirname as
|
|
173004
|
-
var asString = (value) => typeof value === "string" ? value : undefined, isRecord4 = (value) => typeof value === "object" && value !== null, resolveDir = (cwd, value) => isAbsolute(value) ? value :
|
|
173529
|
+
import { dirname as dirname6, isAbsolute, join as join14, relative as relative4, resolve as resolve14 } from "path";
|
|
173530
|
+
var asString = (value) => typeof value === "string" ? value : undefined, isRecord4 = (value) => typeof value === "object" && value !== null, resolveDir = (cwd, value) => isAbsolute(value) ? value : resolve14(cwd, value), resolveStylesDir = (cwd, config) => {
|
|
173005
173531
|
const styles = config.stylesConfig;
|
|
173006
173532
|
if (typeof styles === "string")
|
|
173007
173533
|
return resolveDir(cwd, styles);
|
|
@@ -173010,10 +173536,10 @@ var asString = (value) => typeof value === "string" ? value : undefined, isRecor
|
|
|
173010
173536
|
if (indexes)
|
|
173011
173537
|
return resolveDir(cwd, indexes);
|
|
173012
173538
|
}
|
|
173013
|
-
return
|
|
173539
|
+
return resolve14(cwd, "src/frontend/styles/indexes");
|
|
173014
173540
|
}, configuredFrameworks = (project) => FRAMEWORK_KEYS2.filter((key) => project.frameworkDirs[key] !== undefined), frontendRootFor = (project, framework) => {
|
|
173015
173541
|
const dir = project.frameworkDirs[framework];
|
|
173016
|
-
return dir ?
|
|
173542
|
+
return dir ? dirname6(dir) : resolve14(project.cwd, "src/frontend");
|
|
173017
173543
|
}, resolveProject = async (cwd, configOverride) => {
|
|
173018
173544
|
const loaded = await loadConfig(configOverride);
|
|
173019
173545
|
const config = isRecord4(loaded) ? loaded : {};
|
|
@@ -173064,7 +173590,7 @@ var asString = (value) => typeof value === "string" ? value : undefined, isRecor
|
|
|
173064
173590
|
ok: false
|
|
173065
173591
|
};
|
|
173066
173592
|
}, sharedDirFor = (project, framework) => join14(frontendRootFor(project, framework), "shared"), toModuleSpecifier = (fromDir, toFileNoExt) => {
|
|
173067
|
-
const rel =
|
|
173593
|
+
const rel = relative4(fromDir, toFileNoExt).split("\\").join("/");
|
|
173068
173594
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
173069
173595
|
};
|
|
173070
173596
|
var init_context = __esm(() => {
|
|
@@ -173091,8 +173617,8 @@ var emptyOutcome = () => ({
|
|
|
173091
173617
|
});
|
|
173092
173618
|
|
|
173093
173619
|
// src/cli/generate/routeWiring.ts
|
|
173094
|
-
import { existsSync as
|
|
173095
|
-
import { dirname as
|
|
173620
|
+
import { existsSync as existsSync17, readFileSync as readFileSync19, readdirSync as readdirSync4, writeFileSync as writeFileSync9 } from "fs";
|
|
173621
|
+
import { dirname as dirname7, join as join15 } from "path";
|
|
173096
173622
|
var import_typescript5, DEFAULT_SEPARATOR = `
|
|
173097
173623
|
`, BOUNDARY_USE, applyEdits = (text, edits) => {
|
|
173098
173624
|
const ordered = [...edits].sort((first, second) => second.start - first.start);
|
|
@@ -173240,13 +173766,13 @@ ${newLines.join(`
|
|
|
173240
173766
|
return lines.join(`
|
|
173241
173767
|
`);
|
|
173242
173768
|
}, hasChain = (path) => {
|
|
173243
|
-
if (!
|
|
173769
|
+
if (!existsSync17(path))
|
|
173244
173770
|
return false;
|
|
173245
|
-
const sourceFile = parse2(path,
|
|
173771
|
+
const sourceFile = parse2(path, readFileSync19(path, "utf-8"));
|
|
173246
173772
|
const found = findElysiaNew(sourceFile);
|
|
173247
173773
|
return found !== null;
|
|
173248
173774
|
}, firstChainFile = (pluginsDir) => {
|
|
173249
|
-
if (!
|
|
173775
|
+
if (!existsSync17(pluginsDir))
|
|
173250
173776
|
return null;
|
|
173251
173777
|
for (const name of readdirSync4(pluginsDir)) {
|
|
173252
173778
|
if (!name.endsWith(".ts"))
|
|
@@ -173257,7 +173783,7 @@ ${newLines.join(`
|
|
|
173257
173783
|
}
|
|
173258
173784
|
return null;
|
|
173259
173785
|
}, findRoutingFile = (serverEntry) => {
|
|
173260
|
-
const pluginsDir = join15(
|
|
173786
|
+
const pluginsDir = join15(dirname7(serverEntry), "plugins");
|
|
173261
173787
|
const preferred = join15(pluginsDir, "pagesPlugin.ts");
|
|
173262
173788
|
if (hasChain(preferred))
|
|
173263
173789
|
return preferred;
|
|
@@ -173268,7 +173794,7 @@ ${newLines.join(`
|
|
|
173268
173794
|
return serverEntry;
|
|
173269
173795
|
return null;
|
|
173270
173796
|
}, buildRouteContext = (input, routingFile) => {
|
|
173271
|
-
const specifier = `${toModuleSpecifier(
|
|
173797
|
+
const specifier = `${toModuleSpecifier(dirname7(routingFile), stripExtension(input.pageFileAbs))}${input.def.pageImportExtension ?? ""}`;
|
|
173272
173798
|
return {
|
|
173273
173799
|
cssAssetKey: input.cssAssetKey,
|
|
173274
173800
|
indexKey: input.indexKey,
|
|
@@ -173291,7 +173817,7 @@ ${newLines.join(`
|
|
|
173291
173817
|
};
|
|
173292
173818
|
if (!hasChain(serverEntry))
|
|
173293
173819
|
return fallback;
|
|
173294
|
-
const text =
|
|
173820
|
+
const text = readFileSync19(serverEntry, "utf-8");
|
|
173295
173821
|
const sourceFile = parse2(serverEntry, text);
|
|
173296
173822
|
const newExpr = findElysiaNew(sourceFile);
|
|
173297
173823
|
if (!newExpr)
|
|
@@ -173304,7 +173830,7 @@ ${newLines.join(`
|
|
|
173304
173830
|
start: offset,
|
|
173305
173831
|
text: `${separator}.use(${pluginName})`
|
|
173306
173832
|
});
|
|
173307
|
-
|
|
173833
|
+
writeFileSync9(serverEntry, applyEdits(text, edits), "utf-8");
|
|
173308
173834
|
return { kind: "edited", routingFile: serverEntry };
|
|
173309
173835
|
}, wireRoute = (input) => {
|
|
173310
173836
|
const routingFile = findRoutingFile(input.serverEntry);
|
|
@@ -173320,7 +173846,7 @@ ${newLines.join(`
|
|
|
173320
173846
|
${routeExpr}`
|
|
173321
173847
|
};
|
|
173322
173848
|
}
|
|
173323
|
-
const text =
|
|
173849
|
+
const text = readFileSync19(routingFile, "utf-8");
|
|
173324
173850
|
const sourceFile = parse2(routingFile, text);
|
|
173325
173851
|
const newExpr = findElysiaNew(sourceFile);
|
|
173326
173852
|
if (!newExpr) {
|
|
@@ -173340,7 +173866,7 @@ ${routeExpr}`
|
|
|
173340
173866
|
start: offset,
|
|
173341
173867
|
text: `${separator}${routeExpr}`
|
|
173342
173868
|
});
|
|
173343
|
-
|
|
173869
|
+
writeFileSync9(routingFile, applyEdits(text, edits), "utf-8");
|
|
173344
173870
|
return { kind: "edited", routingFile };
|
|
173345
173871
|
};
|
|
173346
173872
|
var init_routeWiring = __esm(() => {
|
|
@@ -173350,8 +173876,8 @@ var init_routeWiring = __esm(() => {
|
|
|
173350
173876
|
});
|
|
173351
173877
|
|
|
173352
173878
|
// src/cli/generate/generateApi.ts
|
|
173353
|
-
import { existsSync as
|
|
173354
|
-
import { dirname as
|
|
173879
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync10, writeFileSync as writeFileSync10 } from "fs";
|
|
173880
|
+
import { dirname as dirname8, join as join16 } from "path";
|
|
173355
173881
|
var apiPluginTemplate = (pluginName, base) => `import { Elysia } from 'elysia';
|
|
173356
173882
|
|
|
173357
173883
|
export const ${pluginName} = new Elysia()
|
|
@@ -173363,16 +173889,16 @@ export const ${pluginName} = new Elysia()
|
|
|
173363
173889
|
const pluginName = `${camel}Plugin`;
|
|
173364
173890
|
const base = `/api/${kebab}`;
|
|
173365
173891
|
const outcome = { ...emptyOutcome(), route: base };
|
|
173366
|
-
const pluginsDir = join16(
|
|
173892
|
+
const pluginsDir = join16(dirname8(project.serverEntry), "plugins");
|
|
173367
173893
|
const fileAbs = join16(pluginsDir, `${pluginName}.ts`);
|
|
173368
|
-
if (
|
|
173894
|
+
if (existsSync18(fileAbs)) {
|
|
173369
173895
|
outcome.notes.push(`${pluginName} already exists at ${fileAbs} \u2014 skipped.`);
|
|
173370
173896
|
return outcome;
|
|
173371
173897
|
}
|
|
173372
|
-
|
|
173373
|
-
|
|
173898
|
+
mkdirSync10(pluginsDir, { recursive: true });
|
|
173899
|
+
writeFileSync10(fileAbs, apiPluginTemplate(pluginName, base), "utf-8");
|
|
173374
173900
|
outcome.created.push(fileAbs);
|
|
173375
|
-
const specifier = toModuleSpecifier(
|
|
173901
|
+
const specifier = toModuleSpecifier(dirname8(project.serverEntry), fileAbs.replace(/\.ts$/, ""));
|
|
173376
173902
|
const wired = wirePluginUse(project.serverEntry, pluginName, specifier);
|
|
173377
173903
|
if (wired.kind === "edited")
|
|
173378
173904
|
outcome.updated.push(wired.routingFile);
|
|
@@ -173438,8 +173964,8 @@ var init_componentTemplates = __esm(() => {
|
|
|
173438
173964
|
});
|
|
173439
173965
|
|
|
173440
173966
|
// src/cli/generate/generateComponent.ts
|
|
173441
|
-
import { existsSync as
|
|
173442
|
-
import { dirname as
|
|
173967
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync11, writeFileSync as writeFileSync11 } from "fs";
|
|
173968
|
+
import { dirname as dirname9, join as join17 } from "path";
|
|
173443
173969
|
var generateComponent = (project, framework, rawName) => {
|
|
173444
173970
|
const def = frameworks2[framework];
|
|
173445
173971
|
const pascal = toPascalCase(rawName);
|
|
@@ -173451,12 +173977,12 @@ var generateComponent = (project, framework, rawName) => {
|
|
|
173451
173977
|
return outcome;
|
|
173452
173978
|
}
|
|
173453
173979
|
const fileAbs = join17(frameworkDir, "components", def.componentFile({ kebab, pascal }));
|
|
173454
|
-
if (
|
|
173980
|
+
if (existsSync19(fileAbs)) {
|
|
173455
173981
|
outcome.notes.push(`${pascal} already exists at ${fileAbs} \u2014 skipped.`);
|
|
173456
173982
|
return outcome;
|
|
173457
173983
|
}
|
|
173458
|
-
|
|
173459
|
-
|
|
173984
|
+
mkdirSync11(dirname9(fileAbs), { recursive: true });
|
|
173985
|
+
writeFileSync11(fileAbs, componentTemplates[framework]({
|
|
173460
173986
|
kebab,
|
|
173461
173987
|
pascal,
|
|
173462
173988
|
title: toTitleCase(rawName)
|
|
@@ -173470,7 +173996,7 @@ var init_generateComponent = __esm(() => {
|
|
|
173470
173996
|
});
|
|
173471
173997
|
|
|
173472
173998
|
// src/cli/generate/cssStrategy.ts
|
|
173473
|
-
import { existsSync as
|
|
173999
|
+
import { existsSync as existsSync20 } from "fs";
|
|
173474
174000
|
import { join as join18 } from "path";
|
|
173475
174001
|
var import_typescript6, CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `main {
|
|
173476
174002
|
margin: 0 auto;
|
|
@@ -173518,7 +174044,7 @@ var import_typescript6, CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `
|
|
|
173518
174044
|
return {
|
|
173519
174045
|
assetKey: sharedKey,
|
|
173520
174046
|
contents: DEFAULT_CSS,
|
|
173521
|
-
create: !
|
|
174047
|
+
create: !existsSync20(cssFileAbs2),
|
|
173522
174048
|
cssFileAbs: cssFileAbs2,
|
|
173523
174049
|
shared: true
|
|
173524
174050
|
};
|
|
@@ -173527,7 +174053,7 @@ var import_typescript6, CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `
|
|
|
173527
174053
|
return {
|
|
173528
174054
|
assetKey: `${pascal}${CSS_SUFFIX}`,
|
|
173529
174055
|
contents: DEFAULT_CSS,
|
|
173530
|
-
create: !
|
|
174056
|
+
create: !existsSync20(cssFileAbs),
|
|
173531
174057
|
cssFileAbs,
|
|
173532
174058
|
shared: false
|
|
173533
174059
|
};
|
|
@@ -173537,8 +174063,8 @@ var init_cssStrategy = __esm(() => {
|
|
|
173537
174063
|
});
|
|
173538
174064
|
|
|
173539
174065
|
// src/cli/generate/navData.ts
|
|
173540
|
-
import { existsSync as
|
|
173541
|
-
import { dirname as
|
|
174066
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync12, readFileSync as readFileSync20, writeFileSync as writeFileSync12 } from "fs";
|
|
174067
|
+
import { dirname as dirname10 } from "path";
|
|
173542
174068
|
var import_typescript7, NAV_DATA_TEMPLATE = `type NavItem = {
|
|
173543
174069
|
href: string;
|
|
173544
174070
|
label: string;
|
|
@@ -173576,9 +174102,9 @@ export const navData: NavItem[] = [];
|
|
|
173576
174102
|
}
|
|
173577
174103
|
return items;
|
|
173578
174104
|
}, readNavItems = (navDataPath) => {
|
|
173579
|
-
if (!
|
|
174105
|
+
if (!existsSync21(navDataPath))
|
|
173580
174106
|
return [];
|
|
173581
|
-
const text =
|
|
174107
|
+
const text = readFileSync20(navDataPath, "utf-8");
|
|
173582
174108
|
const sourceFile = import_typescript7.default.createSourceFile(navDataPath, text, import_typescript7.default.ScriptTarget.Latest, true);
|
|
173583
174109
|
const array = findNavArray(sourceFile);
|
|
173584
174110
|
return array ? parseNavItems(array) : [];
|
|
@@ -173613,22 +174139,22 @@ ${indentOf(text, array.getStart(sourceFile))}`;
|
|
|
173613
174139
|
${indent}${entry}`;
|
|
173614
174140
|
return text.slice(0, insertAt) + insertion + text.slice(insertAt);
|
|
173615
174141
|
}, upsertNavItem = (navDataPath, item) => {
|
|
173616
|
-
const created = !
|
|
174142
|
+
const created = !existsSync21(navDataPath);
|
|
173617
174143
|
if (created) {
|
|
173618
|
-
|
|
173619
|
-
|
|
174144
|
+
mkdirSync12(dirname10(navDataPath), { recursive: true });
|
|
174145
|
+
writeFileSync12(navDataPath, NAV_DATA_TEMPLATE, "utf-8");
|
|
173620
174146
|
}
|
|
173621
174147
|
const existing = readNavItems(navDataPath);
|
|
173622
174148
|
if (existing.some((candidate) => candidate.href === item.href)) {
|
|
173623
174149
|
return { changed: created, created, items: existing };
|
|
173624
174150
|
}
|
|
173625
|
-
const text =
|
|
174151
|
+
const text = readFileSync20(navDataPath, "utf-8");
|
|
173626
174152
|
const sourceFile = import_typescript7.default.createSourceFile(navDataPath, text, import_typescript7.default.ScriptTarget.Latest, true);
|
|
173627
174153
|
const array = findNavArray(sourceFile);
|
|
173628
174154
|
if (!array)
|
|
173629
174155
|
return { changed: created, created, items: existing };
|
|
173630
174156
|
const entry = `{ href: '${item.href}', label: '${item.label}' }`;
|
|
173631
|
-
|
|
174157
|
+
writeFileSync12(navDataPath, insertElement(text, array, sourceFile, entry), "utf-8");
|
|
173632
174158
|
return { changed: true, created, items: [...existing, item] };
|
|
173633
174159
|
};
|
|
173634
174160
|
var init_navData = __esm(() => {
|
|
@@ -173781,25 +174307,25 @@ var init_pageTemplates = __esm(() => {
|
|
|
173781
174307
|
|
|
173782
174308
|
// src/cli/generate/generatePage.ts
|
|
173783
174309
|
import {
|
|
173784
|
-
existsSync as
|
|
173785
|
-
mkdirSync as
|
|
173786
|
-
readFileSync as
|
|
174310
|
+
existsSync as existsSync22,
|
|
174311
|
+
mkdirSync as mkdirSync13,
|
|
174312
|
+
readFileSync as readFileSync21,
|
|
173787
174313
|
readdirSync as readdirSync5,
|
|
173788
|
-
writeFileSync as
|
|
174314
|
+
writeFileSync as writeFileSync13
|
|
173789
174315
|
} from "fs";
|
|
173790
|
-
import { dirname as
|
|
174316
|
+
import { dirname as dirname11, join as join19, relative as relative5 } from "path";
|
|
173791
174317
|
var writeNew = (path, contents) => {
|
|
173792
|
-
|
|
173793
|
-
|
|
174318
|
+
mkdirSync13(dirname11(path), { recursive: true });
|
|
174319
|
+
writeFileSync13(path, contents, "utf-8");
|
|
173794
174320
|
}, toHref = (fromDir, toFile) => {
|
|
173795
|
-
const rel =
|
|
174321
|
+
const rel = relative5(fromDir, toFile).split("\\").join("/");
|
|
173796
174322
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
173797
|
-
}, staticPageFiles = (project) => ["html", "htmx"].map((key) => project.frameworkDirs[key]).map((dir) => dir ? join19(dir, "pages") : null).filter((pagesDir) => pagesDir !== null &&
|
|
173798
|
-
const html =
|
|
174323
|
+
}, 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) => {
|
|
174324
|
+
const html = readFileSync21(file, "utf-8");
|
|
173799
174325
|
const synced = syncStaticNav(html, items);
|
|
173800
174326
|
if (synced === null || synced === html)
|
|
173801
174327
|
return false;
|
|
173802
|
-
|
|
174328
|
+
writeFileSync13(file, synced, "utf-8");
|
|
173803
174329
|
return true;
|
|
173804
174330
|
}, resyncStaticPages = (project, items, skipFile) => {
|
|
173805
174331
|
const updated = [];
|
|
@@ -173823,18 +174349,18 @@ var writeNew = (path, contents) => {
|
|
|
173823
174349
|
return outcome;
|
|
173824
174350
|
}
|
|
173825
174351
|
const pageFileAbs = join19(frameworkDir, "pages", def.pageFile({ kebab, pascal }));
|
|
173826
|
-
if (
|
|
174352
|
+
if (existsSync22(pageFileAbs)) {
|
|
173827
174353
|
outcome.notes.push(`${pascal} already exists at ${pageFileAbs} \u2014 skipped.`);
|
|
173828
174354
|
return outcome;
|
|
173829
174355
|
}
|
|
173830
174356
|
const routingFile = findRoutingFile(project.serverEntry);
|
|
173831
|
-
const routingText = routingFile ?
|
|
174357
|
+
const routingText = routingFile ? readFileSync21(routingFile, "utf-8") : "";
|
|
173832
174358
|
const css = planCss(routingText, project.stylesDir, pascal, kebab);
|
|
173833
174359
|
const navDataPath = join19(sharedDirFor(project, framework), "navData.ts");
|
|
173834
174360
|
const nav = upsertNavItem(navDataPath, { href: route, label: title });
|
|
173835
|
-
const navImportPath = toModuleSpecifier(
|
|
174361
|
+
const navImportPath = toModuleSpecifier(dirname11(pageFileAbs), navDataPath.replace(/\.ts$/, ""));
|
|
173836
174362
|
writeNew(pageFileAbs, pageTemplates[framework]({
|
|
173837
|
-
cssHref: toHref(
|
|
174363
|
+
cssHref: toHref(dirname11(pageFileAbs), css.cssFileAbs),
|
|
173838
174364
|
kebab,
|
|
173839
174365
|
navImportPath,
|
|
173840
174366
|
navItems: nav.items,
|
|
@@ -173884,7 +174410,7 @@ var exports_generate = {};
|
|
|
173884
174410
|
__export(exports_generate, {
|
|
173885
174411
|
runGenerate: () => runGenerate
|
|
173886
174412
|
});
|
|
173887
|
-
import { relative as
|
|
174413
|
+
import { relative as relative6 } from "path";
|
|
173888
174414
|
var SUBCOMMANDS, write = (text) => process.stdout.write(`${text}
|
|
173889
174415
|
`), fail = (message) => {
|
|
173890
174416
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -173916,7 +174442,7 @@ var SUBCOMMANDS, write = (text) => process.stdout.write(`${text}
|
|
|
173916
174442
|
return;
|
|
173917
174443
|
write(` ${colors.dim}${label}${colors.reset}`);
|
|
173918
174444
|
for (const path of paths)
|
|
173919
|
-
write(` ${
|
|
174445
|
+
write(` ${relative6(cwd, path)}`);
|
|
173920
174446
|
}, printSummary = (title, outcome, cwd) => {
|
|
173921
174447
|
for (const note of outcome.notes) {
|
|
173922
174448
|
write(`${colors.yellow}!${colors.reset} ${note}`);
|
|
@@ -174016,7 +174542,7 @@ ${indent.repeat(level)}}`;
|
|
|
174016
174542
|
var init_serialize = () => {};
|
|
174017
174543
|
|
|
174018
174544
|
// src/cli/config/absolute/editAbsoluteConfig.ts
|
|
174019
|
-
import { readFileSync as
|
|
174545
|
+
import { readFileSync as readFileSync22, writeFileSync as writeFileSync14 } from "fs";
|
|
174020
174546
|
var import_typescript8, lineStartOffset = (text, position) => {
|
|
174021
174547
|
let index = position;
|
|
174022
174548
|
while (index > 0 && text[index - 1] !== `
|
|
@@ -174025,7 +174551,7 @@ var import_typescript8, lineStartOffset = (text, position) => {
|
|
|
174025
174551
|
return index;
|
|
174026
174552
|
}, indentBefore2 = (text, position) => text.slice(lineStartOffset(text, position), position), findProperty = (object, name) => object.properties.find((property) => import_typescript8.default.isPropertyAssignment(property) && (import_typescript8.default.isIdentifier(property.name) || import_typescript8.default.isStringLiteral(property.name)) && property.name.text === name), applyAbsoluteConfigEdit = (configPath2, request) => {
|
|
174027
174553
|
try {
|
|
174028
|
-
const text =
|
|
174554
|
+
const text = readFileSync22(configPath2, "utf-8");
|
|
174029
174555
|
const sourceFile = import_typescript8.default.createSourceFile(configPath2, text, import_typescript8.default.ScriptTarget.Latest, true);
|
|
174030
174556
|
const object = findConfigObject(sourceFile);
|
|
174031
174557
|
if (!object) {
|
|
@@ -174045,14 +174571,14 @@ var import_typescript8, lineStartOffset = (text, position) => {
|
|
|
174045
174571
|
if (text[end] === `
|
|
174046
174572
|
`)
|
|
174047
174573
|
end += 1;
|
|
174048
|
-
|
|
174574
|
+
writeFileSync14(configPath2, text.slice(0, start2) + text.slice(end), "utf-8");
|
|
174049
174575
|
return { message: `Removed ${request.name}`, ok: true };
|
|
174050
174576
|
}
|
|
174051
174577
|
const valueText = serializeValue(request.value);
|
|
174052
174578
|
if (existing) {
|
|
174053
174579
|
const start2 = existing.initializer.getStart(sourceFile);
|
|
174054
174580
|
const end = existing.initializer.getEnd();
|
|
174055
|
-
|
|
174581
|
+
writeFileSync14(configPath2, text.slice(0, start2) + valueText + text.slice(end), "utf-8");
|
|
174056
174582
|
return { message: `Updated ${request.name}`, ok: true };
|
|
174057
174583
|
}
|
|
174058
174584
|
const { properties } = object;
|
|
@@ -174072,14 +174598,14 @@ var import_typescript8, lineStartOffset = (text, position) => {
|
|
|
174072
174598
|
insertionIndex += 1;
|
|
174073
174599
|
const insertion = `${hasComma ? "" : ","}
|
|
174074
174600
|
${indent}${entry}`;
|
|
174075
|
-
|
|
174601
|
+
writeFileSync14(configPath2, text.slice(0, insertionIndex) + insertion + text.slice(insertionIndex), "utf-8");
|
|
174076
174602
|
} else {
|
|
174077
174603
|
const insertionIndex = object.getStart(sourceFile) + 1;
|
|
174078
174604
|
const indent = `${indentBefore2(text, object.getStart(sourceFile))} `;
|
|
174079
174605
|
const insertion = `
|
|
174080
174606
|
${indent}${entry}
|
|
174081
174607
|
${indentBefore2(text, object.getStart(sourceFile))}`;
|
|
174082
|
-
|
|
174608
|
+
writeFileSync14(configPath2, text.slice(0, insertionIndex) + insertion + text.slice(insertionIndex), "utf-8");
|
|
174083
174609
|
}
|
|
174084
174610
|
return { message: `Updated ${request.name}`, ok: true };
|
|
174085
174611
|
} catch (error) {
|
|
@@ -174209,14 +174735,14 @@ var init_catalog = __esm(() => {
|
|
|
174209
174735
|
});
|
|
174210
174736
|
|
|
174211
174737
|
// src/cli/integrations/addPlugin.ts
|
|
174212
|
-
import { existsSync as
|
|
174738
|
+
import { existsSync as existsSync23, readFileSync as readFileSync23 } from "fs";
|
|
174213
174739
|
import { join as join20 } from "path";
|
|
174214
174740
|
var isRecord5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readPackageJson = (cwd) => {
|
|
174215
174741
|
const path = join20(cwd, "package.json");
|
|
174216
|
-
if (!
|
|
174742
|
+
if (!existsSync23(path))
|
|
174217
174743
|
return null;
|
|
174218
174744
|
try {
|
|
174219
|
-
const parsed = JSON.parse(
|
|
174745
|
+
const parsed = JSON.parse(readFileSync23(path, "utf-8"));
|
|
174220
174746
|
return isRecord5(parsed) ? parsed : null;
|
|
174221
174747
|
} catch {
|
|
174222
174748
|
return null;
|
|
@@ -174707,16 +175233,16 @@ var init_authCatalog = __esm(() => {
|
|
|
174707
175233
|
});
|
|
174708
175234
|
|
|
174709
175235
|
// src/cli/config/auth/resolveAuthSettings.ts
|
|
174710
|
-
import { existsSync as
|
|
174711
|
-
import { resolve as
|
|
175236
|
+
import { existsSync as existsSync24, readFileSync as readFileSync24 } from "fs";
|
|
175237
|
+
import { resolve as resolve15 } from "path";
|
|
174712
175238
|
var import_typescript9, AUTH_PACKAGE = "@absolutejs/auth", CONFIG_CANDIDATES3, findAuthSettingsPath = (cwd, override) => {
|
|
174713
175239
|
if (override) {
|
|
174714
|
-
const resolved =
|
|
174715
|
-
return
|
|
175240
|
+
const resolved = resolve15(cwd, override);
|
|
175241
|
+
return existsSync24(resolved) ? resolved : null;
|
|
174716
175242
|
}
|
|
174717
175243
|
for (const name of CONFIG_CANDIDATES3) {
|
|
174718
|
-
const candidate =
|
|
174719
|
-
if (
|
|
175244
|
+
const candidate = resolve15(cwd, name);
|
|
175245
|
+
if (existsSync24(candidate))
|
|
174720
175246
|
return candidate;
|
|
174721
175247
|
}
|
|
174722
175248
|
return null;
|
|
@@ -174737,7 +175263,7 @@ var import_typescript9, AUTH_PACKAGE = "@absolutejs/auth", CONFIG_CANDIDATES3, f
|
|
|
174737
175263
|
}
|
|
174738
175264
|
return null;
|
|
174739
175265
|
}, parseAuthSettingsObject = (configPath2) => {
|
|
174740
|
-
const text =
|
|
175266
|
+
const text = readFileSync24(configPath2, "utf-8");
|
|
174741
175267
|
return {
|
|
174742
175268
|
object: findAuthSettingsObject(parseSource2(configPath2, text)),
|
|
174743
175269
|
text
|
|
@@ -174812,13 +175338,13 @@ var init_resolveAuthSettings = __esm(() => {
|
|
|
174812
175338
|
});
|
|
174813
175339
|
|
|
174814
175340
|
// src/cli/config/auth/resolveAuthState.ts
|
|
174815
|
-
import { existsSync as
|
|
174816
|
-
import { join as join21, relative as
|
|
175341
|
+
import { existsSync as existsSync25, readdirSync as readdirSync6, readFileSync as readFileSync25 } from "fs";
|
|
175342
|
+
import { join as join21, relative as relative7, resolve as resolve16 } from "path";
|
|
174817
175343
|
var import_typescript10, 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, isRecord6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
|
|
174818
|
-
if (!
|
|
175344
|
+
if (!existsSync25(path))
|
|
174819
175345
|
return null;
|
|
174820
175346
|
try {
|
|
174821
|
-
const parsed = JSON.parse(
|
|
175347
|
+
const parsed = JSON.parse(readFileSync25(path, "utf-8"));
|
|
174822
175348
|
return isRecord6(parsed) ? parsed : null;
|
|
174823
175349
|
} catch {
|
|
174824
175350
|
return null;
|
|
@@ -174911,7 +175437,7 @@ var import_typescript10, AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https:/
|
|
|
174911
175437
|
return { keys: new Set, providerCount: null, usesSpread: true };
|
|
174912
175438
|
}, readFileOrNull = (path) => {
|
|
174913
175439
|
try {
|
|
174914
|
-
return
|
|
175440
|
+
return readFileSync25(path, "utf-8");
|
|
174915
175441
|
} catch {
|
|
174916
175442
|
return null;
|
|
174917
175443
|
}
|
|
@@ -174944,7 +175470,7 @@ var import_typescript10, AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https:/
|
|
|
174944
175470
|
scaffoldable: isScaffoldableFeature(feature.id)
|
|
174945
175471
|
})), resolveAuthState = (cwd) => {
|
|
174946
175472
|
const installedVersion = installedVersionFor(cwd);
|
|
174947
|
-
const root =
|
|
175473
|
+
const root = existsSync25(join21(cwd, "src")) ? join21(cwd, "src") : cwd;
|
|
174948
175474
|
let match = null;
|
|
174949
175475
|
let setupPath = null;
|
|
174950
175476
|
for (const file of candidateFiles(root)) {
|
|
@@ -174952,7 +175478,7 @@ var import_typescript10, AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https:/
|
|
|
174952
175478
|
if (found === null)
|
|
174953
175479
|
continue;
|
|
174954
175480
|
match = found;
|
|
174955
|
-
setupPath =
|
|
175481
|
+
setupPath = relative7(cwd, resolve16(file));
|
|
174956
175482
|
break;
|
|
174957
175483
|
}
|
|
174958
175484
|
const keys = match?.keys ?? new Set;
|
|
@@ -174990,8 +175516,8 @@ var init_resolveAuthState = __esm(() => {
|
|
|
174990
175516
|
});
|
|
174991
175517
|
|
|
174992
175518
|
// src/cli/config/auth/scaffoldAuthFeature.ts
|
|
174993
|
-
import { existsSync as
|
|
174994
|
-
import { dirname as
|
|
175519
|
+
import { existsSync as existsSync26, writeFileSync as writeFileSync15 } from "fs";
|
|
175520
|
+
import { dirname as dirname12, join as join22, relative as relative8, resolve as resolve17 } from "path";
|
|
174995
175521
|
var renderScaffold = (scaffold) => {
|
|
174996
175522
|
const importNames = [...scaffold.imports, `type ${scaffold.typeName}`];
|
|
174997
175523
|
const importLine = `import { ${importNames.join(", ")} } from '@absolutejs/auth';`;
|
|
@@ -175016,9 +175542,9 @@ ${body}
|
|
|
175016
175542
|
}, targetDir = (cwd) => {
|
|
175017
175543
|
const { setupPath } = resolveAuthState(cwd);
|
|
175018
175544
|
if (setupPath)
|
|
175019
|
-
return
|
|
175545
|
+
return dirname12(resolve17(cwd, setupPath));
|
|
175020
175546
|
const src = join22(cwd, "src");
|
|
175021
|
-
return
|
|
175547
|
+
return existsSync26(src) ? src : cwd;
|
|
175022
175548
|
}, spreadFor = (scaffold) => `import { ${scaffold.exportName} } from './${scaffold.exportName}';
|
|
175023
175549
|
// add to your auth() call:
|
|
175024
175550
|
${scaffold.configKey}: ${scaffold.exportName}`, failure2 = (message) => ({
|
|
@@ -175032,8 +175558,8 @@ ${scaffold.configKey}: ${scaffold.exportName}`, failure2 = (message) => ({
|
|
|
175032
175558
|
if (!scaffold)
|
|
175033
175559
|
return failure2(`Unknown auth feature "${id}".`);
|
|
175034
175560
|
const filePath = join22(targetDir(cwd), `${scaffold.exportName}.ts`);
|
|
175035
|
-
const relPath =
|
|
175036
|
-
if (
|
|
175561
|
+
const relPath = relative8(cwd, filePath);
|
|
175562
|
+
if (existsSync26(filePath)) {
|
|
175037
175563
|
return {
|
|
175038
175564
|
created: null,
|
|
175039
175565
|
installed: false,
|
|
@@ -175044,7 +175570,7 @@ ${scaffold.configKey}: ${scaffold.exportName}`, failure2 = (message) => ({
|
|
|
175044
175570
|
}
|
|
175045
175571
|
const install = options.install ?? true;
|
|
175046
175572
|
const installOk = install && scaffold.packages.length > 0 ? installPackages(cwd, scaffold.packages) : true;
|
|
175047
|
-
|
|
175573
|
+
writeFileSync15(filePath, renderScaffold(scaffold));
|
|
175048
175574
|
return {
|
|
175049
175575
|
created: relPath,
|
|
175050
175576
|
installed: installOk,
|
|
@@ -175060,13 +175586,13 @@ var init_scaffoldAuthFeature = __esm(() => {
|
|
|
175060
175586
|
});
|
|
175061
175587
|
|
|
175062
175588
|
// src/cli/htmx/install.ts
|
|
175063
|
-
import { existsSync as
|
|
175589
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync14, readFileSync as readFileSync26, writeFileSync as writeFileSync16 } from "fs";
|
|
175064
175590
|
import { join as join23 } from "path";
|
|
175065
175591
|
var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
|
|
175066
175592
|
join23(import.meta.dir, "htmx.min.js"),
|
|
175067
175593
|
join23(import.meta.dir, "htmx", "htmx.min.js"),
|
|
175068
175594
|
join23(import.meta.dir, "..", "htmx", "htmx.min.js")
|
|
175069
|
-
].find((path) =>
|
|
175595
|
+
].find((path) => existsSync27(path)) ?? null, detectHtmxVersion = (content) => {
|
|
175070
175596
|
const match = content.match(/version:"([0-9.]+)"/);
|
|
175071
175597
|
return match ? match[1] : null;
|
|
175072
175598
|
}, fetchHtmx = async (version2) => {
|
|
@@ -175078,16 +175604,16 @@ var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
|
|
|
175078
175604
|
return response.text();
|
|
175079
175605
|
}, installedHtmxVersion = (htmxDir) => {
|
|
175080
175606
|
const file = join23(htmxDir, "htmx.min.js");
|
|
175081
|
-
if (!
|
|
175607
|
+
if (!existsSync27(file))
|
|
175082
175608
|
return null;
|
|
175083
|
-
return detectHtmxVersion(
|
|
175609
|
+
return detectHtmxVersion(readFileSync26(file, "utf-8"));
|
|
175084
175610
|
}, readVendoredHtmx = () => {
|
|
175085
175611
|
const file = vendoredHtmxFile();
|
|
175086
|
-
return file ?
|
|
175612
|
+
return file ? readFileSync26(file, "utf-8") : null;
|
|
175087
175613
|
}, writeHtmx = (htmxDir, content) => {
|
|
175088
|
-
|
|
175614
|
+
mkdirSync14(htmxDir, { recursive: true });
|
|
175089
175615
|
const file = join23(htmxDir, "htmx.min.js");
|
|
175090
|
-
|
|
175616
|
+
writeFileSync16(file, content, "utf-8");
|
|
175091
175617
|
return file;
|
|
175092
175618
|
};
|
|
175093
175619
|
var init_install = () => {};
|
|
@@ -175097,7 +175623,7 @@ var exports_add = {};
|
|
|
175097
175623
|
__export(exports_add, {
|
|
175098
175624
|
runAdd: () => runAdd
|
|
175099
175625
|
});
|
|
175100
|
-
import { dirname as
|
|
175626
|
+
import { dirname as dirname13, join as join24, relative as relative9 } from "path";
|
|
175101
175627
|
var write2 = (text) => process.stdout.write(`${text}
|
|
175102
175628
|
`), fail2 = (message) => {
|
|
175103
175629
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -175108,11 +175634,11 @@ var write2 = (text) => process.stdout.write(`${text}
|
|
|
175108
175634
|
return;
|
|
175109
175635
|
write2(` ${colors.dim}${label}${colors.reset}`);
|
|
175110
175636
|
for (const path of paths)
|
|
175111
|
-
write2(` ${
|
|
175637
|
+
write2(` ${relative9(cwd, path)}`);
|
|
175112
175638
|
}, frontendRoot = (project, cwd) => {
|
|
175113
175639
|
const [firstKey] = configuredFrameworks(project);
|
|
175114
175640
|
const firstDir = firstKey ? project.frameworkDirs[firstKey] : undefined;
|
|
175115
|
-
return firstDir ?
|
|
175641
|
+
return firstDir ? dirname13(firstDir) : join24(cwd, "src", "frontend");
|
|
175116
175642
|
}, addIntegrationCli = (id, install) => {
|
|
175117
175643
|
const result = addIntegration(process.cwd(), id, { install });
|
|
175118
175644
|
if (!result.ok) {
|
|
@@ -175177,7 +175703,7 @@ var write2 = (text) => process.stdout.write(`${text}
|
|
|
175177
175703
|
return;
|
|
175178
175704
|
}
|
|
175179
175705
|
const dirAbs = join24(frontendRoot(project, cwd), framework);
|
|
175180
|
-
const dirRel = `./${
|
|
175706
|
+
const dirRel = `./${relative9(cwd, dirAbs).split("\\").join("/")}`;
|
|
175181
175707
|
let depNote = "Skipped dependency install (--no-install).";
|
|
175182
175708
|
if (!noInstall) {
|
|
175183
175709
|
write2(`${colors.dim}Installing ${frameworks2[framework].label} dependencies\u2026${colors.reset}`);
|
|
@@ -175246,8 +175772,8 @@ var exports_analyze = {};
|
|
|
175246
175772
|
__export(exports_analyze, {
|
|
175247
175773
|
runAnalyze: () => runAnalyze
|
|
175248
175774
|
});
|
|
175249
|
-
import { existsSync as
|
|
175250
|
-
import { join as join25, resolve as
|
|
175775
|
+
import { existsSync as existsSync28, readFileSync as readFileSync27, statSync as statSync3, writeFileSync as writeFileSync17 } from "fs";
|
|
175776
|
+
import { join as join25, resolve as resolve18 } from "path";
|
|
175251
175777
|
var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_WIDTH = 16, SIZE_WIDTH = 12, CHANGE_WIDTH = 10, CATEGORY_ORDER, categoryOf = (key) => {
|
|
175252
175778
|
if (key.startsWith("Island"))
|
|
175253
175779
|
return "Islands";
|
|
@@ -175268,9 +175794,9 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
|
|
|
175268
175794
|
}
|
|
175269
175795
|
}, readSizes = (manifestDir) => {
|
|
175270
175796
|
const manifestPath = join25(manifestDir, "manifest.json");
|
|
175271
|
-
if (!
|
|
175797
|
+
if (!existsSync28(manifestPath))
|
|
175272
175798
|
return null;
|
|
175273
|
-
const manifest = JSON.parse(
|
|
175799
|
+
const manifest = JSON.parse(readFileSync27(manifestPath, "utf-8"));
|
|
175274
175800
|
const sizes = {};
|
|
175275
175801
|
for (const [key, value] of Object.entries(manifest)) {
|
|
175276
175802
|
sizes[key] = fileSize2(join25(manifestDir, value.replace(/^\//, "")));
|
|
@@ -175278,10 +175804,10 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
|
|
|
175278
175804
|
return sizes;
|
|
175279
175805
|
}, readBaseline = (cwd) => {
|
|
175280
175806
|
const path = join25(cwd, BASELINE_FILE);
|
|
175281
|
-
if (!
|
|
175807
|
+
if (!existsSync28(path))
|
|
175282
175808
|
return null;
|
|
175283
175809
|
try {
|
|
175284
|
-
const parsed = JSON.parse(
|
|
175810
|
+
const parsed = JSON.parse(readFileSync27(path, "utf-8"));
|
|
175285
175811
|
return parsed;
|
|
175286
175812
|
} catch {
|
|
175287
175813
|
return null;
|
|
@@ -175359,14 +175885,14 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
|
|
|
175359
175885
|
const config = await loadConfig(configIndex >= 0 ? args[configIndex + 1] : undefined);
|
|
175360
175886
|
const outdirIndex = args.indexOf("--outdir");
|
|
175361
175887
|
const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
|
|
175362
|
-
const sizes = readSizes(
|
|
175888
|
+
const sizes = readSizes(resolve18(cwd, outdir ?? "build"));
|
|
175363
175889
|
if (sizes === null) {
|
|
175364
175890
|
process.stdout.write(`${colors.dim}No build found. Run \`absolute build\` first.${colors.reset}
|
|
175365
175891
|
`);
|
|
175366
175892
|
return;
|
|
175367
175893
|
}
|
|
175368
175894
|
if (args.includes("--save")) {
|
|
175369
|
-
|
|
175895
|
+
writeFileSync17(join25(cwd, BASELINE_FILE), `${JSON.stringify(sizes, null, 2)}
|
|
175370
175896
|
`);
|
|
175371
175897
|
process.stdout.write(`${colors.green}\u2713${colors.reset} Saved size baseline (${Object.keys(sizes).length} entries) to ${BASELINE_FILE}
|
|
175372
175898
|
`);
|
|
@@ -175612,8 +176138,8 @@ var exports_remove = {};
|
|
|
175612
176138
|
__export(exports_remove, {
|
|
175613
176139
|
runRemove: () => runRemove
|
|
175614
176140
|
});
|
|
175615
|
-
import { existsSync as
|
|
175616
|
-
import { relative as
|
|
176141
|
+
import { existsSync as existsSync29, readFileSync as readFileSync28 } from "fs";
|
|
176142
|
+
import { relative as relative10 } from "path";
|
|
175617
176143
|
var write3 = (text) => process.stdout.write(`${text}
|
|
175618
176144
|
`), fail3 = (message) => {
|
|
175619
176145
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -175623,10 +176149,10 @@ var write3 = (text) => process.stdout.write(`${text}
|
|
|
175623
176149
|
const candidates = [findRoutingFile(serverEntry), serverEntry];
|
|
175624
176150
|
const seen = new Set;
|
|
175625
176151
|
return candidates.filter((file) => {
|
|
175626
|
-
if (file === null || seen.has(file) || !
|
|
176152
|
+
if (file === null || seen.has(file) || !existsSync29(file))
|
|
175627
176153
|
return false;
|
|
175628
176154
|
seen.add(file);
|
|
175629
|
-
return
|
|
176155
|
+
return readFileSync28(file, "utf-8").includes(handler);
|
|
175630
176156
|
});
|
|
175631
176157
|
}, runRemove = async (args) => {
|
|
175632
176158
|
const [framework] = args.filter((arg) => !arg.startsWith("--"));
|
|
@@ -175662,10 +176188,10 @@ var write3 = (text) => process.stdout.write(`${text}
|
|
|
175662
176188
|
}
|
|
175663
176189
|
write3(`${colors.green}\u2713${colors.reset} Removed ${framework}Directory from absolute.config.ts
|
|
175664
176190
|
`);
|
|
175665
|
-
write3(` ${colors.dim}Kept${colors.reset} ${
|
|
176191
|
+
write3(` ${colors.dim}Kept${colors.reset} ${relative10(cwd, frameworkDir)} \u2014 delete its source manually if no longer needed.`);
|
|
175666
176192
|
const refs = referencingFiles(project.serverEntry, HANDLER_NAME[framework]);
|
|
175667
176193
|
for (const file of refs) {
|
|
175668
|
-
write3(` ${colors.yellow}Still references${colors.reset} ${
|
|
176194
|
+
write3(` ${colors.yellow}Still references${colors.reset} ${relative10(cwd, file)} (calls ${HANDLER_NAME[framework]})`);
|
|
175669
176195
|
}
|
|
175670
176196
|
const deps = frameworkDependencyNames(framework);
|
|
175671
176197
|
if (prune && deps.length > 0) {
|
|
@@ -175753,15 +176279,15 @@ __export(exports_env, {
|
|
|
175753
176279
|
runEnv: () => runEnv,
|
|
175754
176280
|
collectEnvVars: () => collectEnvVars
|
|
175755
176281
|
});
|
|
175756
|
-
import { existsSync as
|
|
176282
|
+
import { existsSync as existsSync30, readFileSync as readFileSync29 } from "fs";
|
|
175757
176283
|
import { join as join26 } from "path";
|
|
175758
176284
|
var {env: env3, Glob: Glob3 } = globalThis.Bun;
|
|
175759
|
-
var EXTENSIONS = "ts,tsx,js,jsx,mjs,cjs,svelte,vue", STATUS_WIDTH2, keysInFile = (text) => [...text.matchAll(/getEnv\(\s*['"]([^'"]+)['"]\s*\)/g)].map((match) => match[1]).filter((key) => key !== undefined), scanPatterns = () =>
|
|
176285
|
+
var EXTENSIONS = "ts,tsx,js,jsx,mjs,cjs,svelte,vue", STATUS_WIDTH2, keysInFile = (text) => [...text.matchAll(/getEnv\(\s*['"]([^'"]+)['"]\s*\)/g)].map((match) => match[1]).filter((key) => key !== undefined), scanPatterns = () => existsSync30(join26(process.cwd(), "src")) ? [`src/**/*.{${EXTENSIONS}}`] : [`*.{${EXTENSIONS}}`], scanEnvUsage = async () => {
|
|
175760
176286
|
const scans = scanPatterns().map((pattern) => Array.fromAsync(new Glob3(pattern).scan({ cwd: process.cwd() })));
|
|
175761
176287
|
const files = (await Promise.all(scans)).flat();
|
|
175762
176288
|
const usage = new Map;
|
|
175763
176289
|
files.forEach((file) => {
|
|
175764
|
-
keysInFile(
|
|
176290
|
+
keysInFile(readFileSync29(file, "utf-8")).forEach((key) => {
|
|
175765
176291
|
usage.set(key, [...usage.get(key) ?? [], file]);
|
|
175766
176292
|
});
|
|
175767
176293
|
});
|
|
@@ -175822,7 +176348,7 @@ __export(exports_db, {
|
|
|
175822
176348
|
conflictClause: () => conflictClause,
|
|
175823
176349
|
chunkRows: () => chunkRows
|
|
175824
176350
|
});
|
|
175825
|
-
import { existsSync as
|
|
176351
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync15, readFileSync as readFileSync30, writeFileSync as writeFileSync18 } from "fs";
|
|
175826
176352
|
import { join as join27 } from "path";
|
|
175827
176353
|
var {env: env4, spawn: spawn2, SQL } = globalThis.Bun;
|
|
175828
176354
|
var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA_TYPES, SEED_CANDIDATES, VALUE_FLAGS, paint = (text, color) => `${color}${text}${colors.reset}`, chunkRows = (items, size) => Array.from({ length: Math.ceil(items.length / size) }, (_, idx) => items.slice(idx * size, idx * size + size)), quoteIdent = (name) => `"${name.replace(/"/g, '""')}"`, resolveUrl = (explicit) => {
|
|
@@ -175934,18 +176460,18 @@ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA
|
|
|
175934
176460
|
v: BACKUP_FORMAT_VERSION
|
|
175935
176461
|
};
|
|
175936
176462
|
const dir = options.out ?? join27(process.cwd(), "backups");
|
|
175937
|
-
|
|
176463
|
+
mkdirSync15(dir, { recursive: true });
|
|
175938
176464
|
const json = JSON.stringify(payload, (_, value) => typeof value === "bigint" ? value.toString() : value);
|
|
175939
176465
|
const file = join27(dir, `backup-${payload.at.replace(/[:.]/g, "-")}.json`);
|
|
175940
|
-
|
|
175941
|
-
|
|
176466
|
+
writeFileSync18(file, json);
|
|
176467
|
+
writeFileSync18(join27(dir, "latest.json"), json);
|
|
175942
176468
|
const total = chosen.reduce((sum, name) => sum + (tables[name]?.length ?? 0), 0);
|
|
175943
176469
|
console.log(paint(`\u2713 backup \u2192 ${file}`, colors.green));
|
|
175944
176470
|
console.log(paint(` ${chosen.length} tables, ${total} rows`, colors.dim));
|
|
175945
176471
|
}, runRestore = async (file, options) => {
|
|
175946
|
-
if (!
|
|
176472
|
+
if (!existsSync31(file))
|
|
175947
176473
|
throw new Error(`Backup not found: ${file}`);
|
|
175948
|
-
const payload = JSON.parse(
|
|
176474
|
+
const payload = JSON.parse(readFileSync30(file, "utf-8"));
|
|
175949
176475
|
const names = Object.keys(payload.tables).filter((name) => keepTable(name, options));
|
|
175950
176476
|
const sql = new SQL(options.url);
|
|
175951
176477
|
const order = dependencyOrder(names, await foreignLinks(sql));
|
|
@@ -175967,7 +176493,7 @@ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA
|
|
|
175967
176493
|
const total = order.reduce((sum, name) => sum + (payload.tables[name]?.length ?? 0), 0);
|
|
175968
176494
|
console.log(paint(`\u2713 restored ${order.length} tables, ${total} rows (idempotent upsert by primary key)`, colors.green));
|
|
175969
176495
|
}, runSeed = async (entry) => {
|
|
175970
|
-
const target = entry ?? SEED_CANDIDATES.find((candidate) =>
|
|
176496
|
+
const target = entry ?? SEED_CANDIDATES.find((candidate) => existsSync31(join27(process.cwd(), candidate)));
|
|
175971
176497
|
if (target === undefined)
|
|
175972
176498
|
throw new Error(`No seed script found (looked for ${SEED_CANDIDATES.join(", ")}). Pass a path: absolute db seed <file>.`);
|
|
175973
176499
|
console.log(paint(`seeding via ${target}\u2026`, colors.cyan));
|
|
@@ -176028,7 +176554,7 @@ __export(exports_logs, {
|
|
|
176028
176554
|
});
|
|
176029
176555
|
import {
|
|
176030
176556
|
closeSync as closeSync2,
|
|
176031
|
-
existsSync as
|
|
176557
|
+
existsSync as existsSync32,
|
|
176032
176558
|
openSync as openSync4,
|
|
176033
176559
|
readSync as readSync2,
|
|
176034
176560
|
statSync as statSync4,
|
|
@@ -176095,7 +176621,7 @@ var DEFAULT_LINES = 40, POLL_MS = 250, LINES_FLAG_SPAN = 2, readFrom = (path, st
|
|
|
176095
176621
|
printAvailable(instances);
|
|
176096
176622
|
return;
|
|
176097
176623
|
}
|
|
176098
|
-
if (match.logFile === null || !
|
|
176624
|
+
if (match.logFile === null || !existsSync32(match.logFile)) {
|
|
176099
176625
|
printDim3(`"${name}" has no captured log (untracked, or started outside the CLI).`);
|
|
176100
176626
|
return;
|
|
176101
176627
|
}
|
|
@@ -176115,17 +176641,17 @@ var init_logs = __esm(() => {
|
|
|
176115
176641
|
|
|
176116
176642
|
// src/cli/typeGraphCoherence.ts
|
|
176117
176643
|
import {
|
|
176118
|
-
existsSync as
|
|
176119
|
-
readFileSync as
|
|
176644
|
+
existsSync as existsSync33,
|
|
176645
|
+
readFileSync as readFileSync31,
|
|
176120
176646
|
realpathSync,
|
|
176121
|
-
rmSync as
|
|
176122
|
-
writeFileSync as
|
|
176647
|
+
rmSync as rmSync6,
|
|
176648
|
+
writeFileSync as writeFileSync19
|
|
176123
176649
|
} from "fs";
|
|
176124
176650
|
import { createRequire } from "module";
|
|
176125
|
-
import { dirname as
|
|
176651
|
+
import { dirname as dirname14, join as join28, resolve as resolve19, sep } from "path";
|
|
176126
176652
|
var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
176127
176653
|
try {
|
|
176128
|
-
const parsed = JSON.parse(
|
|
176654
|
+
const parsed = JSON.parse(readFileSync31(path, "utf-8"));
|
|
176129
176655
|
return isRecord3(parsed) ? parsed : null;
|
|
176130
176656
|
} catch {
|
|
176131
176657
|
return null;
|
|
@@ -176142,13 +176668,13 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176142
176668
|
const version2 = Reflect.get(manifest, "version");
|
|
176143
176669
|
return typeof version2 === "string" ? version2 : "unknown";
|
|
176144
176670
|
}, packageJsonFromEntry = (entry, expectedName) => {
|
|
176145
|
-
let directory =
|
|
176671
|
+
let directory = dirname14(entry);
|
|
176146
176672
|
for (;; ) {
|
|
176147
176673
|
const candidate = join28(directory, "package.json");
|
|
176148
176674
|
const manifest = readManifest(candidate);
|
|
176149
176675
|
if (manifest && manifestName(manifest, "") === expectedName)
|
|
176150
176676
|
return candidate;
|
|
176151
|
-
const parent =
|
|
176677
|
+
const parent = dirname14(directory);
|
|
176152
176678
|
if (parent === directory)
|
|
176153
176679
|
return null;
|
|
176154
176680
|
directory = parent;
|
|
@@ -176164,25 +176690,25 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176164
176690
|
}
|
|
176165
176691
|
}
|
|
176166
176692
|
}, findInstallRoot = (cwd) => {
|
|
176167
|
-
let directory =
|
|
176693
|
+
let directory = resolve19(cwd);
|
|
176168
176694
|
for (;; ) {
|
|
176169
|
-
if (
|
|
176695
|
+
if (existsSync33(join28(directory, "bun.lock")) || existsSync33(join28(directory, "bun.lockb"))) {
|
|
176170
176696
|
return directory;
|
|
176171
176697
|
}
|
|
176172
|
-
const parent =
|
|
176698
|
+
const parent = dirname14(directory);
|
|
176173
176699
|
if (parent === directory)
|
|
176174
|
-
return
|
|
176700
|
+
return resolve19(cwd);
|
|
176175
176701
|
directory = parent;
|
|
176176
176702
|
}
|
|
176177
176703
|
}, findProjectManifest = (cwd, installRoot) => {
|
|
176178
|
-
let directory =
|
|
176704
|
+
let directory = resolve19(cwd);
|
|
176179
176705
|
for (;; ) {
|
|
176180
176706
|
const candidate = join28(directory, "package.json");
|
|
176181
|
-
if (
|
|
176707
|
+
if (existsSync33(candidate))
|
|
176182
176708
|
return candidate;
|
|
176183
176709
|
if (directory === installRoot)
|
|
176184
176710
|
return join28(installRoot, "package.json");
|
|
176185
|
-
const parent =
|
|
176711
|
+
const parent = dirname14(directory);
|
|
176186
176712
|
if (parent === directory)
|
|
176187
176713
|
return join28(installRoot, "package.json");
|
|
176188
176714
|
directory = parent;
|
|
@@ -176275,7 +176801,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176275
176801
|
}
|
|
176276
176802
|
if (changes.length > 0) {
|
|
176277
176803
|
Reflect.set(manifest, "overrides", overrides);
|
|
176278
|
-
|
|
176804
|
+
writeFileSync19(manifestPath, `${JSON.stringify(manifest, null, "\t")}
|
|
176279
176805
|
`);
|
|
176280
176806
|
}
|
|
176281
176807
|
return changes;
|
|
@@ -176292,7 +176818,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176292
176818
|
for (const stalePath of stalePaths) {
|
|
176293
176819
|
if (!stalePath.startsWith(installPrefix) || !stalePath.includes(nodeModulesSegment))
|
|
176294
176820
|
continue;
|
|
176295
|
-
|
|
176821
|
+
rmSync6(dirname14(stalePath), { force: true, recursive: true });
|
|
176296
176822
|
removed.push(stalePath);
|
|
176297
176823
|
}
|
|
176298
176824
|
return removed;
|
|
@@ -176319,7 +176845,7 @@ var exports_doctor = {};
|
|
|
176319
176845
|
__export(exports_doctor, {
|
|
176320
176846
|
runDoctor: () => runDoctor
|
|
176321
176847
|
});
|
|
176322
|
-
import { existsSync as
|
|
176848
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync16, readFileSync as readFileSync32, writeFileSync as writeFileSync20 } from "fs";
|
|
176323
176849
|
import { createRequire as createRequire2 } from "module";
|
|
176324
176850
|
import { arch as arch4, platform as platform5 } from "os";
|
|
176325
176851
|
import { join as join29 } from "path";
|
|
@@ -176357,7 +176883,7 @@ var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
|
|
|
176357
176883
|
return [];
|
|
176358
176884
|
const label = `${field.replace("Directory", "")} pages`;
|
|
176359
176885
|
return [
|
|
176360
|
-
|
|
176886
|
+
existsSync34(join29(process.cwd(), dir)) ? check("ok", label, dir) : check("fail", label, `${dir} (missing)`)
|
|
176361
176887
|
];
|
|
176362
176888
|
}), envCheck = async () => {
|
|
176363
176889
|
const vars = await collectEnvVars();
|
|
@@ -176419,9 +176945,9 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
176419
176945
|
const fixes = [];
|
|
176420
176946
|
for (const field of FRAMEWORK_FIELDS2) {
|
|
176421
176947
|
const dir = readString(config, field);
|
|
176422
|
-
if (dir === undefined ||
|
|
176948
|
+
if (dir === undefined || existsSync34(join29(cwd, dir)))
|
|
176423
176949
|
continue;
|
|
176424
|
-
|
|
176950
|
+
mkdirSync16(join29(cwd, dir, "pages"), { recursive: true });
|
|
176425
176951
|
fixes.push(`created ${dir}/pages`);
|
|
176426
176952
|
}
|
|
176427
176953
|
return fixes;
|
|
@@ -176430,7 +176956,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
176430
176956
|
if (missing.length === 0)
|
|
176431
176957
|
return null;
|
|
176432
176958
|
const envExample = join29(cwd, ".env.example");
|
|
176433
|
-
const existing =
|
|
176959
|
+
const existing = existsSync34(envExample) ? readFileSync32(envExample, "utf-8") : "";
|
|
176434
176960
|
const existingKeys = new Set(existing.split(`
|
|
176435
176961
|
`).map((line) => line.split("=")[0]?.trim()));
|
|
176436
176962
|
const toAdd = missing.filter((entry) => !existingKeys.has(entry.key));
|
|
@@ -176439,7 +176965,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
176439
176965
|
const prefix = existing === "" || existing.endsWith(`
|
|
176440
176966
|
`) ? existing : `${existing}
|
|
176441
176967
|
`;
|
|
176442
|
-
|
|
176968
|
+
writeFileSync20(envExample, `${prefix}${toAdd.map((entry) => `${entry.key}=`).join(`
|
|
176443
176969
|
`)}
|
|
176444
176970
|
`);
|
|
176445
176971
|
return `added ${toAdd.length} key(s) to .env.example`;
|
|
@@ -176804,10 +177330,10 @@ var init_inspect = __esm(() => {
|
|
|
176804
177330
|
});
|
|
176805
177331
|
|
|
176806
177332
|
// src/build/scanEntryPoints.ts
|
|
176807
|
-
import { existsSync as
|
|
177333
|
+
import { existsSync as existsSync35 } from "fs";
|
|
176808
177334
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
176809
177335
|
var scanEntryPoints = async (dir, pattern) => {
|
|
176810
|
-
if (!
|
|
177336
|
+
if (!existsSync35(dir))
|
|
176811
177337
|
return [];
|
|
176812
177338
|
const entryPaths = [];
|
|
176813
177339
|
const glob = new Glob4(pattern);
|
|
@@ -176889,8 +177415,8 @@ var init_sourceMetadata = __esm(() => {
|
|
|
176889
177415
|
});
|
|
176890
177416
|
|
|
176891
177417
|
// src/islands/pageMetadata.ts
|
|
176892
|
-
import { readFileSync as
|
|
176893
|
-
import { dirname as
|
|
177418
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
177419
|
+
import { dirname as dirname15, resolve as resolve20 } from "path";
|
|
176894
177420
|
var pagePatterns, getPageDirs = (config) => [
|
|
176895
177421
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
176896
177422
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -176910,8 +177436,8 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
176910
177436
|
const source = definition.buildReference?.source;
|
|
176911
177437
|
if (!source)
|
|
176912
177438
|
continue;
|
|
176913
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
176914
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
177439
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve20(dirname15(buildInfo.resolvedRegistryPath), source);
|
|
177440
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve20(resolvedSource));
|
|
176915
177441
|
}
|
|
176916
177442
|
return lookup;
|
|
176917
177443
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage2) => {
|
|
@@ -176924,13 +177450,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
176924
177450
|
const pattern = pagePatterns[entry.framework];
|
|
176925
177451
|
if (!pattern)
|
|
176926
177452
|
return;
|
|
176927
|
-
const files = await scanEntryPoints(
|
|
177453
|
+
const files = await scanEntryPoints(resolve20(entry.dir), pattern);
|
|
176928
177454
|
for (const filePath of files) {
|
|
176929
|
-
const source =
|
|
177455
|
+
const source = readFileSync33(filePath, "utf-8");
|
|
176930
177456
|
const islands = extractIslandUsagesFromSource(source);
|
|
176931
|
-
pageMetadata.set(
|
|
177457
|
+
pageMetadata.set(resolve20(filePath), {
|
|
176932
177458
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
176933
|
-
pagePath:
|
|
177459
|
+
pagePath: resolve20(filePath)
|
|
176934
177460
|
});
|
|
176935
177461
|
}
|
|
176936
177462
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -176959,14 +177485,14 @@ var exports_islands = {};
|
|
|
176959
177485
|
__export(exports_islands, {
|
|
176960
177486
|
runIslands: () => runIslands
|
|
176961
177487
|
});
|
|
176962
|
-
import { existsSync as
|
|
176963
|
-
import { join as join30, relative as
|
|
177488
|
+
import { existsSync as existsSync36, readFileSync as readFileSync34, statSync as statSync5 } from "fs";
|
|
177489
|
+
import { join as join30, relative as relative11, resolve as resolve21 } from "path";
|
|
176964
177490
|
var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
|
|
176965
177491
|
`), hostFrameworkOf = (pagePath, cwd, config) => {
|
|
176966
|
-
const resolved =
|
|
177492
|
+
const resolved = resolve21(cwd, pagePath);
|
|
176967
177493
|
for (const [framework, key] of Object.entries(FRAMEWORK_DIR_KEY)) {
|
|
176968
177494
|
const dir = config[key];
|
|
176969
|
-
if (typeof dir === "string" && resolved.startsWith(
|
|
177495
|
+
if (typeof dir === "string" && resolved.startsWith(resolve21(cwd, dir))) {
|
|
176970
177496
|
return framework;
|
|
176971
177497
|
}
|
|
176972
177498
|
}
|
|
@@ -176979,9 +177505,9 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
176979
177505
|
}
|
|
176980
177506
|
}, readManifestSizes2 = (manifestDir) => {
|
|
176981
177507
|
const manifestPath = join30(manifestDir, "manifest.json");
|
|
176982
|
-
if (!
|
|
177508
|
+
if (!existsSync36(manifestPath))
|
|
176983
177509
|
return null;
|
|
176984
|
-
const manifest = JSON.parse(
|
|
177510
|
+
const manifest = JSON.parse(readFileSync34(manifestPath, "utf-8"));
|
|
176985
177511
|
const sizes = new Map;
|
|
176986
177512
|
for (const [key, value] of Object.entries(manifest)) {
|
|
176987
177513
|
sizes.set(key, fileSize3(join30(manifestDir, value.replace(/^\//, ""))));
|
|
@@ -176991,7 +177517,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
176991
177517
|
const registryPath = config.islands?.registry;
|
|
176992
177518
|
if (typeof registryPath !== "string")
|
|
176993
177519
|
return null;
|
|
176994
|
-
const buildInfo = await loadIslandRegistryBuildInfo(
|
|
177520
|
+
const buildInfo = await loadIslandRegistryBuildInfo(resolve21(cwd, registryPath));
|
|
176995
177521
|
const pageMetadata = await loadPageIslandMetadata(config);
|
|
176996
177522
|
const usages = [...pageMetadata.values()].flatMap((meta) => meta.islands.map((island) => ({ ...island, page: meta.pagePath })));
|
|
176997
177523
|
return buildInfo.definitions.map((definition) => {
|
|
@@ -177001,7 +177527,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177001
177527
|
crossFramework: hostFramework !== null && hostFramework !== definition.framework,
|
|
177002
177528
|
hostFramework,
|
|
177003
177529
|
hydrate: usage2.hydrate ?? "load",
|
|
177004
|
-
page:
|
|
177530
|
+
page: relative11(cwd, resolve21(cwd, usage2.page))
|
|
177005
177531
|
};
|
|
177006
177532
|
});
|
|
177007
177533
|
const key = getIslandManifestKey(definition.framework, definition.component);
|
|
@@ -177040,7 +177566,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177040
177566
|
` ${color}\u2B21${colors.reset} ${colors.bold}${island.component}${colors.reset} ${meta}${sizeText}`
|
|
177041
177567
|
];
|
|
177042
177568
|
if (island.source) {
|
|
177043
|
-
lines.push(` ${colors.dim}${
|
|
177569
|
+
lines.push(` ${colors.dim}${relative11(cwd, island.source)}${colors.reset}`);
|
|
177044
177570
|
}
|
|
177045
177571
|
if (pages.length === 0) {
|
|
177046
177572
|
lines.push(` ${colors.dim}(registered but not mounted on any page)${colors.reset}`);
|
|
@@ -177070,7 +177596,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177070
177596
|
}
|
|
177071
177597
|
const outdirIndex = args.indexOf("--outdir");
|
|
177072
177598
|
const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
|
|
177073
|
-
const sizes = args.includes("--sizes") ? readManifestSizes2(
|
|
177599
|
+
const sizes = args.includes("--sizes") ? readManifestSizes2(resolve21(cwd, outdir ?? "build")) : null;
|
|
177074
177600
|
const islands = await collectIslands(cwd, config, sizes);
|
|
177075
177601
|
if (islands === null) {
|
|
177076
177602
|
printDim6('No island registry configured. Set `islands: { registry: "..." }` in absolute.config.ts.');
|
|
@@ -177119,13 +177645,13 @@ var init_islands2 = __esm(() => {
|
|
|
177119
177645
|
});
|
|
177120
177646
|
|
|
177121
177647
|
// src/build/externalAssetPlugin.ts
|
|
177122
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
177123
|
-
import { basename as basename6, dirname as
|
|
177648
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync37, mkdirSync as mkdirSync17, statSync as statSync6 } from "fs";
|
|
177649
|
+
import { basename as basename6, dirname as dirname16, join as join31, resolve as resolve22 } from "path";
|
|
177124
177650
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
177125
177651
|
name: "absolute-external-asset",
|
|
177126
177652
|
setup(bld) {
|
|
177127
177653
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
177128
|
-
const skipRoots = userSourceRoots.map((root) =>
|
|
177654
|
+
const skipRoots = userSourceRoots.map((root) => resolve22(root));
|
|
177129
177655
|
const isUserSource = (path) => skipRoots.some((root) => path.startsWith(`${root}/`));
|
|
177130
177656
|
bld.onLoad({ filter: /\.[mc]?[jt]sx?$/ }, async (args) => {
|
|
177131
177657
|
if (isUserSource(args.path))
|
|
@@ -177135,20 +177661,20 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
177135
177661
|
return;
|
|
177136
177662
|
urlPattern.lastIndex = 0;
|
|
177137
177663
|
let match;
|
|
177138
|
-
const sourceDir =
|
|
177664
|
+
const sourceDir = dirname16(args.path);
|
|
177139
177665
|
while ((match = urlPattern.exec(source)) !== null) {
|
|
177140
177666
|
const relPath = match[1];
|
|
177141
177667
|
if (!relPath)
|
|
177142
177668
|
continue;
|
|
177143
|
-
const assetPath =
|
|
177144
|
-
if (!
|
|
177669
|
+
const assetPath = resolve22(sourceDir, relPath);
|
|
177670
|
+
if (!existsSync37(assetPath))
|
|
177145
177671
|
continue;
|
|
177146
177672
|
if (!statSync6(assetPath).isFile())
|
|
177147
177673
|
continue;
|
|
177148
177674
|
const targetPath = join31(outDir, basename6(assetPath));
|
|
177149
|
-
if (
|
|
177675
|
+
if (existsSync37(targetPath))
|
|
177150
177676
|
continue;
|
|
177151
|
-
|
|
177677
|
+
mkdirSync17(dirname16(targetPath), { recursive: true });
|
|
177152
177678
|
copyFileSync2(assetPath, targetPath);
|
|
177153
177679
|
}
|
|
177154
177680
|
return;
|
|
@@ -177166,23 +177692,23 @@ __export(exports_compile, {
|
|
|
177166
177692
|
var {env: env5 } = globalThis.Bun;
|
|
177167
177693
|
import {
|
|
177168
177694
|
cpSync,
|
|
177169
|
-
existsSync as
|
|
177170
|
-
mkdirSync as
|
|
177695
|
+
existsSync as existsSync38,
|
|
177696
|
+
mkdirSync as mkdirSync18,
|
|
177171
177697
|
readdirSync as readdirSync7,
|
|
177172
|
-
readFileSync as
|
|
177173
|
-
rmSync as
|
|
177698
|
+
readFileSync as readFileSync35,
|
|
177699
|
+
rmSync as rmSync7,
|
|
177174
177700
|
statSync as statSync7,
|
|
177175
177701
|
unlinkSync as unlinkSync4,
|
|
177176
|
-
writeFileSync as
|
|
177702
|
+
writeFileSync as writeFileSync21
|
|
177177
177703
|
} from "fs";
|
|
177178
177704
|
import { createRequire as createRequire3 } from "module";
|
|
177179
177705
|
import {
|
|
177180
177706
|
basename as basename7,
|
|
177181
|
-
dirname as
|
|
177707
|
+
dirname as dirname17,
|
|
177182
177708
|
isAbsolute as isAbsolute2,
|
|
177183
177709
|
join as join32,
|
|
177184
|
-
relative as
|
|
177185
|
-
resolve as
|
|
177710
|
+
relative as relative12,
|
|
177711
|
+
resolve as resolve23
|
|
177186
177712
|
} from "path";
|
|
177187
177713
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
177188
177714
|
const resolvedVersion = version2 || "unknown";
|
|
@@ -177204,7 +177730,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177204
177730
|
}
|
|
177205
177731
|
return result;
|
|
177206
177732
|
}, INLINE_SOURCE_MAP_RE, rebaseInlineSourceMap = (filePath) => {
|
|
177207
|
-
const source =
|
|
177733
|
+
const source = readFileSync35(filePath, "utf-8");
|
|
177208
177734
|
const match = source.match(INLINE_SOURCE_MAP_RE);
|
|
177209
177735
|
const encoded = match?.[1];
|
|
177210
177736
|
if (!encoded)
|
|
@@ -177215,7 +177741,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177215
177741
|
if (!Array.isArray(map.sources))
|
|
177216
177742
|
return;
|
|
177217
177743
|
const sourceRoot = typeof map.sourceRoot === "string" ? map.sourceRoot : "";
|
|
177218
|
-
const bundleDirectory =
|
|
177744
|
+
const bundleDirectory = dirname17(filePath);
|
|
177219
177745
|
map.sources = map.sources.map((entry) => {
|
|
177220
177746
|
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(entry))
|
|
177221
177747
|
return entry;
|
|
@@ -177224,11 +177750,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177224
177750
|
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(sourceRoot)) {
|
|
177225
177751
|
return new URL(entry, sourceRoot).href;
|
|
177226
177752
|
}
|
|
177227
|
-
return
|
|
177753
|
+
return resolve23(bundleDirectory, sourceRoot, entry);
|
|
177228
177754
|
});
|
|
177229
177755
|
delete map.sourceRoot;
|
|
177230
177756
|
const rebased = Buffer.from(JSON.stringify(map)).toString("base64");
|
|
177231
|
-
|
|
177757
|
+
writeFileSync21(filePath, source.replace(encoded, rebased));
|
|
177232
177758
|
}, SERVER_RUNTIME_ASSET_RE, SERVER_RUNTIME_IMPORT_META_DIR_JOIN_RE, SERVER_RUNTIME_STRING_ARG_RE, SERVER_RUNTIME_SOURCE_EXTENSIONS, SERVER_RUNTIME_SCAN_SKIP_DIRS, hasSourceExtension = (filePath) => SERVER_RUNTIME_SOURCE_EXTENSIONS.has(filePath.slice(filePath.lastIndexOf("."))), normalizeServerRuntimeAssetPath = (parts) => {
|
|
177233
177759
|
if (parts.length === 0)
|
|
177234
177760
|
return null;
|
|
@@ -177254,22 +177780,22 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177254
177780
|
return result;
|
|
177255
177781
|
}, copyServerRuntimeAssetReferences = (outdir) => {
|
|
177256
177782
|
const copied = new Set;
|
|
177257
|
-
const normalizedOutdir =
|
|
177783
|
+
const normalizedOutdir = resolve23(outdir);
|
|
177258
177784
|
const copyReference = (filePath, relPath) => {
|
|
177259
|
-
const assetSource =
|
|
177260
|
-
if (!
|
|
177785
|
+
const assetSource = resolve23(dirname17(filePath), relPath);
|
|
177786
|
+
if (!existsSync38(assetSource) || !statSync7(assetSource).isFile())
|
|
177261
177787
|
return;
|
|
177262
|
-
const assetTarget =
|
|
177788
|
+
const assetTarget = resolve23(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
177263
177789
|
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
177264
177790
|
return;
|
|
177265
177791
|
if (copied.has(assetTarget))
|
|
177266
177792
|
return;
|
|
177267
177793
|
copied.add(assetTarget);
|
|
177268
|
-
|
|
177794
|
+
mkdirSync18(dirname17(assetTarget), { recursive: true });
|
|
177269
177795
|
cpSync(assetSource, assetTarget, { force: true });
|
|
177270
177796
|
};
|
|
177271
177797
|
for (const filePath of collectProjectSourceFiles(process.cwd())) {
|
|
177272
|
-
const source =
|
|
177798
|
+
const source = readFileSync35(filePath, "utf-8");
|
|
177273
177799
|
SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
|
|
177274
177800
|
let match;
|
|
177275
177801
|
while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
|
|
@@ -177298,7 +177824,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177298
177824
|
}
|
|
177299
177825
|
}, readPackageVersion4 = (candidate) => {
|
|
177300
177826
|
try {
|
|
177301
|
-
const pkg = JSON.parse(
|
|
177827
|
+
const pkg = JSON.parse(readFileSync35(candidate, "utf-8"));
|
|
177302
177828
|
if (pkg.name !== "@absolutejs/absolute")
|
|
177303
177829
|
return null;
|
|
177304
177830
|
const ver = pkg.version;
|
|
@@ -177333,18 +177859,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177333
177859
|
return resolveBuildModule3(remaining);
|
|
177334
177860
|
}, resolveJsxDevRuntimeCompatPath2 = () => {
|
|
177335
177861
|
const candidates = [
|
|
177336
|
-
|
|
177337
|
-
|
|
177338
|
-
|
|
177339
|
-
|
|
177340
|
-
|
|
177341
|
-
|
|
177862
|
+
resolve23(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
177863
|
+
resolve23(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
177864
|
+
resolve23(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
177865
|
+
resolve23(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
177866
|
+
resolve23(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
177867
|
+
resolve23(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
177342
177868
|
];
|
|
177343
177869
|
for (const candidate of candidates) {
|
|
177344
|
-
if (
|
|
177870
|
+
if (existsSync38(candidate))
|
|
177345
177871
|
return candidate;
|
|
177346
177872
|
}
|
|
177347
|
-
return
|
|
177873
|
+
return resolve23(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
177348
177874
|
}, jsxDevRuntimeCompatPath2, shouldEmbedCompiledAsset = (relativePath, skip = new Set) => {
|
|
177349
177875
|
if (skip.has(relativePath))
|
|
177350
177876
|
return false;
|
|
@@ -177369,7 +177895,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177369
177895
|
return true;
|
|
177370
177896
|
}), requireForCompile, resolveNativeAssetForRuntime = (specifier) => {
|
|
177371
177897
|
if (specifier.startsWith("."))
|
|
177372
|
-
return
|
|
177898
|
+
return resolve23(process.cwd(), specifier);
|
|
177373
177899
|
if (specifier.startsWith("/"))
|
|
177374
177900
|
return specifier;
|
|
177375
177901
|
return requireForCompile.resolve(specifier, { paths: [process.cwd()] });
|
|
@@ -177381,11 +177907,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177381
177907
|
return nativeAssetEnv;
|
|
177382
177908
|
}, tryReadNodePackageJson = (packageDir) => {
|
|
177383
177909
|
try {
|
|
177384
|
-
return JSON.parse(
|
|
177910
|
+
return JSON.parse(readFileSync35(join32(packageDir, "package.json"), "utf-8"));
|
|
177385
177911
|
} catch {
|
|
177386
177912
|
return null;
|
|
177387
177913
|
}
|
|
177388
|
-
}, resolveProjectPackageDir = (specifier) =>
|
|
177914
|
+
}, resolveProjectPackageDir = (specifier) => resolve23(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
|
|
177389
177915
|
if (seen.has(specifier))
|
|
177390
177916
|
return;
|
|
177391
177917
|
const srcDir = resolveProjectPackageDir(specifier);
|
|
@@ -177394,12 +177920,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177394
177920
|
return;
|
|
177395
177921
|
seen.add(specifier);
|
|
177396
177922
|
const destDir = join32(outdir, "node_modules", ...specifier.split("/"));
|
|
177397
|
-
|
|
177923
|
+
rmSync7(destDir, { force: true, recursive: true });
|
|
177398
177924
|
cpSync(srcDir, destDir, {
|
|
177399
177925
|
force: true,
|
|
177400
177926
|
recursive: true,
|
|
177401
177927
|
filter(source) {
|
|
177402
|
-
const rel =
|
|
177928
|
+
const rel = relative12(srcDir, source);
|
|
177403
177929
|
const [firstSegment] = rel.split(/[\\/]/);
|
|
177404
177930
|
return firstSegment !== "node_modules" && firstSegment !== ".git";
|
|
177405
177931
|
}
|
|
@@ -177415,8 +177941,8 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177415
177941
|
}, copyAngularRuntimePackages = (buildConfig, outdir) => {
|
|
177416
177942
|
if (!buildConfig.angularDirectory)
|
|
177417
177943
|
return;
|
|
177418
|
-
const angularScopeDir =
|
|
177419
|
-
const angularPackages =
|
|
177944
|
+
const angularScopeDir = resolve23(process.cwd(), "node_modules", "@angular");
|
|
177945
|
+
const angularPackages = existsSync38(angularScopeDir) ? readdirSync7(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
|
|
177420
177946
|
const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
|
|
177421
177947
|
const seen = new Set;
|
|
177422
177948
|
for (const specifier of roots) {
|
|
@@ -177435,7 +177961,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177435
177961
|
copyChunkReferencedPackages(outdir, seen);
|
|
177436
177962
|
}, collectRuntimePackageSpecifiers = (distDir) => {
|
|
177437
177963
|
const nodeModulesDir = join32(distDir, "node_modules");
|
|
177438
|
-
if (!
|
|
177964
|
+
if (!existsSync38(nodeModulesDir))
|
|
177439
177965
|
return [];
|
|
177440
177966
|
const specifiers = [];
|
|
177441
177967
|
for (const entry of readdirSync7(nodeModulesDir, { withFileTypes: true })) {
|
|
@@ -177456,7 +177982,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177456
177982
|
}
|
|
177457
177983
|
return specifiers.sort((firstSpecifier, secondSpecifier) => secondSpecifier.length - firstSpecifier.length);
|
|
177458
177984
|
}, ensureRelativeModuleSpecifier = (fromFile, toFile) => {
|
|
177459
|
-
const rel =
|
|
177985
|
+
const rel = relative12(dirname17(fromFile), toFile).replace(/\\/g, "/");
|
|
177460
177986
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
177461
177987
|
}, pickExportEntry = (value) => {
|
|
177462
177988
|
if (typeof value === "string")
|
|
@@ -177476,11 +178002,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177476
178002
|
const packageDir = join32(distDir, "node_modules", ...packageSpecifier.split("/"));
|
|
177477
178003
|
const subpath = specifier.slice(packageSpecifier.length);
|
|
177478
178004
|
const subPackageDir = subpath ? join32(packageDir, ...subpath.slice(1).split("/")) : null;
|
|
177479
|
-
const resolvedPackageDir = subPackageDir &&
|
|
178005
|
+
const resolvedPackageDir = subPackageDir && existsSync38(join32(subPackageDir, "package.json")) ? subPackageDir : packageDir;
|
|
177480
178006
|
const packageJsonPath = join32(resolvedPackageDir, "package.json");
|
|
177481
|
-
if (!
|
|
178007
|
+
if (!existsSync38(packageJsonPath))
|
|
177482
178008
|
return null;
|
|
177483
|
-
const pkg = JSON.parse(
|
|
178009
|
+
const pkg = JSON.parse(readFileSync35(packageJsonPath, "utf-8"));
|
|
177484
178010
|
const exportKey = resolvedPackageDir !== subPackageDir && subpath ? `.${subpath}` : ".";
|
|
177485
178011
|
const rootExport = pkg.exports?.[exportKey];
|
|
177486
178012
|
const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
|
|
@@ -177501,12 +178027,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177501
178027
|
];
|
|
177502
178028
|
return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
|
|
177503
178029
|
}, findContainingRuntimePackageDir = (filePath) => {
|
|
177504
|
-
let dir =
|
|
177505
|
-
while (dir !==
|
|
177506
|
-
if (isNodeModulesPath(dir) &&
|
|
178030
|
+
let dir = dirname17(filePath);
|
|
178031
|
+
while (dir !== dirname17(dir)) {
|
|
178032
|
+
if (isNodeModulesPath(dir) && existsSync38(join32(dir, "package.json"))) {
|
|
177507
178033
|
return dir;
|
|
177508
178034
|
}
|
|
177509
|
-
dir =
|
|
178035
|
+
dir = dirname17(dir);
|
|
177510
178036
|
}
|
|
177511
178037
|
return null;
|
|
177512
178038
|
}, resolvePackageImportEntryFile = (fromFile, specifier) => {
|
|
@@ -177521,11 +178047,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177521
178047
|
return null;
|
|
177522
178048
|
return join32(packageDir, entry);
|
|
177523
178049
|
}, 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) => {
|
|
177524
|
-
const distRoot =
|
|
178050
|
+
const distRoot = resolve23(distDir);
|
|
177525
178051
|
for (const filePath of collectRuntimeRewriteRoots(distDir)) {
|
|
177526
|
-
if (
|
|
178052
|
+
if (resolve23(dirname17(filePath)) === distRoot)
|
|
177527
178053
|
continue;
|
|
177528
|
-
const source =
|
|
178054
|
+
const source = readFileSync35(filePath, "utf-8");
|
|
177529
178055
|
for (const match of source.matchAll(MODULE_SPECIFIER_RE)) {
|
|
177530
178056
|
const [, , , specifier] = match;
|
|
177531
178057
|
if (!specifier || specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("#") || specifier.startsWith("node:") || specifier.startsWith("bun:")) {
|
|
@@ -177555,11 +178081,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177555
178081
|
if (!filePath || seen.has(filePath))
|
|
177556
178082
|
continue;
|
|
177557
178083
|
seen.add(filePath);
|
|
177558
|
-
const source =
|
|
178084
|
+
const source = readFileSync35(filePath, "utf-8");
|
|
177559
178085
|
const { masked, restore } = maskLiterals(source);
|
|
177560
178086
|
const rewrittenMasked = masked.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
|
|
177561
178087
|
if (typeof specifier === "string" && specifier.startsWith(".")) {
|
|
177562
|
-
enqueue(resolveRuntimeJsFile(
|
|
178088
|
+
enqueue(resolveRuntimeJsFile(resolve23(dirname17(filePath), specifier)));
|
|
177563
178089
|
return match;
|
|
177564
178090
|
}
|
|
177565
178091
|
const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
|
|
@@ -177575,7 +178101,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177575
178101
|
});
|
|
177576
178102
|
const rewritten = restore(rewrittenMasked);
|
|
177577
178103
|
if (rewritten !== source) {
|
|
177578
|
-
|
|
178104
|
+
writeFileSync21(filePath, rewritten);
|
|
177579
178105
|
}
|
|
177580
178106
|
}
|
|
177581
178107
|
}, generateEntrypoint = (distDir, serverEntry, prerenderMap, version2, buildConfig) => {
|
|
@@ -177588,12 +178114,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177588
178114
|
"_compile_entrypoint.ts"
|
|
177589
178115
|
]);
|
|
177590
178116
|
const embeddedFiles = allFiles.filter((file) => {
|
|
177591
|
-
const rel =
|
|
178117
|
+
const rel = relative12(distDir, file);
|
|
177592
178118
|
if (embeddedSkip.has(rel))
|
|
177593
178119
|
return false;
|
|
177594
178120
|
return true;
|
|
177595
178121
|
});
|
|
177596
|
-
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(
|
|
178122
|
+
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(relative12(distDir, file), assetSkip));
|
|
177597
178123
|
const imports = [];
|
|
177598
178124
|
const nativeImports = [];
|
|
177599
178125
|
const nativeMappings = [];
|
|
@@ -177603,19 +178129,19 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177603
178129
|
const nativeAssets = resolveCompileNativeAssets(buildConfig);
|
|
177604
178130
|
nativeAssets.forEach((asset, idx) => {
|
|
177605
178131
|
const varName = `__native${idx}`;
|
|
177606
|
-
const importSpecifier = asset.import.startsWith(".") ?
|
|
178132
|
+
const importSpecifier = asset.import.startsWith(".") ? resolve23(process.cwd(), asset.import) : asset.import;
|
|
177607
178133
|
nativeImports.push(`import ${varName} from ${JSON.stringify(importSpecifier)} with { type: "file" };`);
|
|
177608
178134
|
nativeMappings.push(` [${JSON.stringify(asset.env)}, resolveNativeAssetPath(${varName})],`);
|
|
177609
178135
|
});
|
|
177610
178136
|
embeddedFiles.forEach((filePath, idx) => {
|
|
177611
|
-
const rel =
|
|
178137
|
+
const rel = relative12(distDir, filePath).replace(/\\/g, "/");
|
|
177612
178138
|
const varName = `__a${idx}`;
|
|
177613
178139
|
embeddedVarMap.set(rel, varName);
|
|
177614
178140
|
imports.push(`import ${varName} from "./${rel}" with { type: "file" };`);
|
|
177615
178141
|
embeddedMappings.push(` ["${rel}", ${varName}],`);
|
|
177616
178142
|
});
|
|
177617
178143
|
clientFiles.forEach((filePath) => {
|
|
177618
|
-
const rel =
|
|
178144
|
+
const rel = relative12(distDir, filePath).replace(/\\/g, "/");
|
|
177619
178145
|
const varName = embeddedVarMap.get(rel);
|
|
177620
178146
|
if (!varName)
|
|
177621
178147
|
return;
|
|
@@ -177629,7 +178155,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177629
178155
|
const pageVarMap = new Map;
|
|
177630
178156
|
const prerenderEntries = Array.from(prerenderMap.entries());
|
|
177631
178157
|
prerenderEntries.forEach(([route, filePath]) => {
|
|
177632
|
-
const rel =
|
|
178158
|
+
const rel = relative12(distDir, filePath).replace(/\\/g, "/");
|
|
177633
178159
|
const varName = embeddedVarMap.get(rel);
|
|
177634
178160
|
if (varName)
|
|
177635
178161
|
pageVarMap.set(route, varName);
|
|
@@ -177662,7 +178188,7 @@ import { websocket as elysiaWebsocket } from "elysia/ws";
|
|
|
177662
178188
|
const SERVER_MODULE = (runtimeDir: string) => import(pathToFileURL(join(runtimeDir, ${JSON.stringify(serverBundleName)})).href);
|
|
177663
178189
|
const RUNTIME_BUILD_ID = ${JSON.stringify(runtimeBuildId)};
|
|
177664
178190
|
const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
|
|
177665
|
-
const ORIGINAL_BUILD_DIR = ${JSON.stringify(
|
|
178191
|
+
const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve23(distDir))};
|
|
177666
178192
|
const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
|
|
177667
178193
|
|
|
177668
178194
|
const resolveNativeAssetPath = (assetPath: string) => {
|
|
@@ -178094,16 +178620,16 @@ console.log(\`
|
|
|
178094
178620
|
}),
|
|
178095
178621
|
...collectUserServerExternals(buildConfig)
|
|
178096
178622
|
], compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
178097
|
-
const resolvedOutdir =
|
|
178623
|
+
const resolvedOutdir = resolve23(outdir ?? "dist");
|
|
178098
178624
|
await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
|
|
178099
178625
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
178100
178626
|
const prerenderPort = Number(env5.COMPILE_PORT) || Number(env5.PORT) || findFreePort();
|
|
178101
178627
|
killStaleProcesses(prerenderPort);
|
|
178102
178628
|
const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
|
|
178103
|
-
const resolvedOutfile =
|
|
178629
|
+
const resolvedOutfile = resolve23(outfile ?? "compiled-server");
|
|
178104
178630
|
const absoluteVersion = resolvePackageVersion3([
|
|
178105
|
-
|
|
178106
|
-
|
|
178631
|
+
resolve23(import.meta.dir, "..", "..", "..", "package.json"),
|
|
178632
|
+
resolve23(import.meta.dir, "..", "..", "package.json")
|
|
178107
178633
|
]);
|
|
178108
178634
|
compileBanner(absoluteVersion);
|
|
178109
178635
|
const totalStart = performance.now();
|
|
@@ -178114,8 +178640,8 @@ console.log(\`
|
|
|
178114
178640
|
buildConfig.mode = "production";
|
|
178115
178641
|
try {
|
|
178116
178642
|
const build2 = await resolveBuildModule3([
|
|
178117
|
-
|
|
178118
|
-
|
|
178643
|
+
resolve23(import.meta.dir, "..", "..", "core", "build"),
|
|
178644
|
+
resolve23(import.meta.dir, "..", "build")
|
|
178119
178645
|
]);
|
|
178120
178646
|
if (!build2)
|
|
178121
178647
|
throw new Error("Could not locate build module");
|
|
@@ -178137,10 +178663,10 @@ console.log(\`
|
|
|
178137
178663
|
buildConfig.htmxDirectory
|
|
178138
178664
|
].filter((dir) => Boolean(dir));
|
|
178139
178665
|
const islandRegistrySpec = buildConfig.islands?.registry;
|
|
178140
|
-
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(
|
|
178666
|
+
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve23(islandRegistrySpec))) : undefined;
|
|
178141
178667
|
const serverBundle = await Bun.build({
|
|
178142
178668
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
178143
|
-
entrypoints: [
|
|
178669
|
+
entrypoints: [resolve23(serverEntry)],
|
|
178144
178670
|
external: resolveServerBundleExternals(buildConfig),
|
|
178145
178671
|
outdir: resolvedOutdir,
|
|
178146
178672
|
plugins: [
|
|
@@ -178163,13 +178689,13 @@ console.log(\`
|
|
|
178163
178689
|
console.error(cliTag4("\x1B[31m", "Server bundle failed."));
|
|
178164
178690
|
process.exit(1);
|
|
178165
178691
|
}
|
|
178166
|
-
const outputPath =
|
|
178167
|
-
if (!
|
|
178692
|
+
const outputPath = resolve23(resolvedOutdir, `${entryName}.js`);
|
|
178693
|
+
if (!existsSync38(outputPath)) {
|
|
178168
178694
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
178169
178695
|
process.exit(1);
|
|
178170
178696
|
}
|
|
178171
|
-
if (
|
|
178172
|
-
const vendorDir =
|
|
178697
|
+
if (existsSync38(resolve23(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
178698
|
+
const vendorDir = resolve23(resolvedOutdir, "angular", "vendor", "server");
|
|
178173
178699
|
const vendorEntries = readdirSync7(vendorDir).filter((fileName) => fileName.endsWith(".js"));
|
|
178174
178700
|
const angularServerVendorPaths = {};
|
|
178175
178701
|
for (const file of vendorEntries) {
|
|
@@ -178178,7 +178704,7 @@ console.log(\`
|
|
|
178178
178704
|
if (scope !== "angular" || rest.length === 0)
|
|
178179
178705
|
continue;
|
|
178180
178706
|
const specifier = `@angular/${rest.join("/")}`;
|
|
178181
|
-
const relPath =
|
|
178707
|
+
const relPath = relative12(dirname17(outputPath), resolve23(vendorDir, file));
|
|
178182
178708
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
178183
178709
|
}
|
|
178184
178710
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -178190,7 +178716,7 @@ console.log(\`
|
|
|
178190
178716
|
copyServerRuntimeAssetReferences(resolvedOutdir);
|
|
178191
178717
|
const prerenderStart = performance.now();
|
|
178192
178718
|
process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
|
|
178193
|
-
|
|
178719
|
+
rmSync7(join32(resolvedOutdir, "_prerendered"), {
|
|
178194
178720
|
force: true,
|
|
178195
178721
|
recursive: true
|
|
178196
178722
|
});
|
|
@@ -178213,7 +178739,7 @@ console.log(\`
|
|
|
178213
178739
|
const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
|
|
178214
178740
|
const entrypointPath = join32(resolvedOutdir, "_compile_entrypoint.ts");
|
|
178215
178741
|
await Bun.write(entrypointPath, entrypointCode);
|
|
178216
|
-
|
|
178742
|
+
mkdirSync18(dirname17(resolvedOutfile), { recursive: true });
|
|
178217
178743
|
const result = await Bun.build({
|
|
178218
178744
|
compile: { outfile: resolvedOutfile },
|
|
178219
178745
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
@@ -178311,11 +178837,11 @@ var exports_typecheck = {};
|
|
|
178311
178837
|
__export(exports_typecheck, {
|
|
178312
178838
|
typecheck: () => typecheck
|
|
178313
178839
|
});
|
|
178314
|
-
import { resolve as
|
|
178315
|
-
import { existsSync as
|
|
178840
|
+
import { resolve as resolve24, join as join33 } from "path";
|
|
178841
|
+
import { existsSync as existsSync39, readFileSync as readFileSync36 } from "fs";
|
|
178316
178842
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
178317
|
-
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) =>
|
|
178318
|
-
if (!
|
|
178843
|
+
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve24(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
|
|
178844
|
+
if (!existsSync39(resolveConfigPath(configPath2))) {
|
|
178319
178845
|
const defaultService = {};
|
|
178320
178846
|
return [defaultService];
|
|
178321
178847
|
}
|
|
@@ -178336,8 +178862,8 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
178336
178862
|
const exitCode = await proc.exited;
|
|
178337
178863
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
178338
178864
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
178339
|
-
const local =
|
|
178340
|
-
return
|
|
178865
|
+
const local = resolve24("node_modules", ".bin", name);
|
|
178866
|
+
return existsSync39(local) ? local : null;
|
|
178341
178867
|
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
178342
178868
|
const cwd = `${process.cwd()}/`;
|
|
178343
178869
|
const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
|
|
@@ -178384,15 +178910,15 @@ Found ${errorCount} error${suffix}.`;
|
|
|
178384
178910
|
return formatted;
|
|
178385
178911
|
}, ABSOLUTE_INTERNAL_EXCLUDES, resolveAbsoluteTypeFile = (fileName) => {
|
|
178386
178912
|
const candidates = [
|
|
178387
|
-
|
|
178388
|
-
|
|
178389
|
-
|
|
178390
|
-
|
|
178913
|
+
resolve24("node_modules/@absolutejs/absolute/dist/types", fileName),
|
|
178914
|
+
resolve24(import.meta.dir, "../types", fileName),
|
|
178915
|
+
resolve24(import.meta.dir, "../../types", fileName),
|
|
178916
|
+
resolve24(import.meta.dir, "../../../types", fileName)
|
|
178391
178917
|
];
|
|
178392
|
-
return candidates.find((candidate) =>
|
|
178918
|
+
return candidates.find((candidate) => existsSync39(candidate)) ?? candidates[0];
|
|
178393
178919
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
178394
178920
|
try {
|
|
178395
|
-
return JSON.parse(
|
|
178921
|
+
return JSON.parse(readFileSync36(resolve24("tsconfig.json"), "utf-8"));
|
|
178396
178922
|
} catch {
|
|
178397
178923
|
return {};
|
|
178398
178924
|
}
|
|
@@ -178426,13 +178952,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
178426
178952
|
rootDir: ".."
|
|
178427
178953
|
},
|
|
178428
178954
|
exclude: getProjectTypecheckExcludes(),
|
|
178429
|
-
extends:
|
|
178955
|
+
extends: resolve24("tsconfig.json"),
|
|
178430
178956
|
include: getProjectTypecheckIncludes()
|
|
178431
178957
|
}, null, "\t")).then(() => run("vue-tsc", [
|
|
178432
178958
|
vueTscBin,
|
|
178433
178959
|
"--noEmit",
|
|
178434
178960
|
"--project",
|
|
178435
|
-
|
|
178961
|
+
resolve24(vueTsconfigPath),
|
|
178436
178962
|
"--incremental",
|
|
178437
178963
|
"--tsBuildInfoFile",
|
|
178438
178964
|
join33(cacheDir, "vue-tsc.tsbuildinfo"),
|
|
@@ -178454,10 +178980,10 @@ Found ${errorCount} error${suffix}.`;
|
|
|
178454
178980
|
rootDir: ".."
|
|
178455
178981
|
},
|
|
178456
178982
|
exclude: ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
|
|
178457
|
-
extends:
|
|
178983
|
+
extends: resolve24("tsconfig.json"),
|
|
178458
178984
|
include: [`../${angularDir}/**/*`]
|
|
178459
178985
|
}, null, "\t"));
|
|
178460
|
-
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(
|
|
178986
|
+
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve24(angularTsconfigPath))}`);
|
|
178461
178987
|
}, buildTscCheck = (cacheDir) => {
|
|
178462
178988
|
const tscBin = findBin("tsc");
|
|
178463
178989
|
if (!tscBin) {
|
|
@@ -178470,13 +178996,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
178470
178996
|
rootDir: ".."
|
|
178471
178997
|
},
|
|
178472
178998
|
exclude: getProjectTypecheckExcludes(),
|
|
178473
|
-
extends:
|
|
178999
|
+
extends: resolve24("tsconfig.json"),
|
|
178474
179000
|
include: getProjectTypecheckIncludes()
|
|
178475
179001
|
}, null, "\t")).then(() => run("tsc", [
|
|
178476
179002
|
tscBin,
|
|
178477
179003
|
"--noEmit",
|
|
178478
179004
|
"--project",
|
|
178479
|
-
|
|
179005
|
+
resolve24(tscConfigPath),
|
|
178480
179006
|
"--incremental",
|
|
178481
179007
|
"--tsBuildInfoFile",
|
|
178482
179008
|
join33(cacheDir, "tsc.tsbuildinfo"),
|
|
@@ -178490,14 +179016,14 @@ Found ${errorCount} error${suffix}.`;
|
|
|
178490
179016
|
}
|
|
178491
179017
|
const svelteTsconfigPath = join33(cacheDir, "tsconfig.svelte-check.json");
|
|
178492
179018
|
await writeFile(svelteTsconfigPath, JSON.stringify({
|
|
178493
|
-
extends:
|
|
179019
|
+
extends: resolve24("tsconfig.json"),
|
|
178494
179020
|
files: ABSOLUTE_TYPECHECK_FILES,
|
|
178495
179021
|
include: [`../${svelteDir}/**/*`]
|
|
178496
179022
|
}, null, "\t"));
|
|
178497
179023
|
return run("svelte-check", [
|
|
178498
179024
|
svelteBin,
|
|
178499
179025
|
"--tsconfig",
|
|
178500
|
-
|
|
179026
|
+
resolve24(svelteTsconfigPath),
|
|
178501
179027
|
"--threshold",
|
|
178502
179028
|
"error",
|
|
178503
179029
|
"--compiler-warnings",
|
|
@@ -178691,11 +179217,11 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
|
|
|
178691
179217
|
url: url.pathname + url.search,
|
|
178692
179218
|
...bodyBytes && bodyBytes.length > 0 ? { bodyBase64: Buffer.from(bodyBytes).toString("base64") } : {}
|
|
178693
179219
|
};
|
|
178694
|
-
const responsePromise = new Promise((
|
|
178695
|
-
pending.set(id,
|
|
179220
|
+
const responsePromise = new Promise((resolve25) => {
|
|
179221
|
+
pending.set(id, resolve25);
|
|
178696
179222
|
});
|
|
178697
179223
|
client.send(encodeTunnelMessage(message));
|
|
178698
|
-
const timeout = new Promise((
|
|
179224
|
+
const timeout = new Promise((resolve25) => setTimeout(() => resolve25({ id, message: "timeout", type: "error" }), requestTimeoutMs));
|
|
178699
179225
|
const result = await Promise.race([responsePromise, timeout]);
|
|
178700
179226
|
pending.delete(id);
|
|
178701
179227
|
if (result.type === "error") {
|
|
@@ -179990,377 +180516,8 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179990
180516
|
await monitorServer();
|
|
179991
180517
|
};
|
|
179992
180518
|
|
|
179993
|
-
// src/cli/
|
|
179994
|
-
|
|
179995
|
-
import {
|
|
179996
|
-
existsSync as existsSync6,
|
|
179997
|
-
mkdirSync as mkdirSync5,
|
|
179998
|
-
readFileSync as readFileSync8,
|
|
179999
|
-
renameSync,
|
|
180000
|
-
rmSync as rmSync3,
|
|
180001
|
-
writeFileSync as writeFileSync5
|
|
180002
|
-
} from "fs";
|
|
180003
|
-
import { dirname as dirname3, resolve as resolve4 } from "path";
|
|
180004
|
-
var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache";
|
|
180005
|
-
var CACHE_CONTRACT_VERSION = "1";
|
|
180006
|
-
var CACHE_FINGERPRINT_SUFFIX = ".fingerprint";
|
|
180007
|
-
var flagValue = (args, flag) => {
|
|
180008
|
-
const assignment = args.find((arg) => arg.startsWith(`${flag}=`));
|
|
180009
|
-
if (assignment)
|
|
180010
|
-
return assignment.slice(flag.length + 1);
|
|
180011
|
-
const index = args.indexOf(flag);
|
|
180012
|
-
return index < 0 ? undefined : args[index + 1];
|
|
180013
|
-
};
|
|
180014
|
-
var getCacheLocation = (args) => flagValue(args, "--cache-location")?.trim() || process.env.ABSOLUTE_ESLINT_CACHE?.trim() || DEFAULT_CACHE_LOCATION;
|
|
180015
|
-
var CONFIG_CANDIDATES = [
|
|
180016
|
-
"eslint.config.js",
|
|
180017
|
-
"eslint.config.mjs",
|
|
180018
|
-
"eslint.config.cjs",
|
|
180019
|
-
"eslint.config.ts",
|
|
180020
|
-
"eslint.config.mts",
|
|
180021
|
-
"eslint.config.cts"
|
|
180022
|
-
];
|
|
180023
|
-
var FLAG_VALUE_FLAGS = new Set([
|
|
180024
|
-
"-c",
|
|
180025
|
-
"--config",
|
|
180026
|
-
"--cache-location",
|
|
180027
|
-
"--cache-strategy",
|
|
180028
|
-
"--ignore-path",
|
|
180029
|
-
"--ignore-pattern",
|
|
180030
|
-
"--rule",
|
|
180031
|
-
"--rulesdir",
|
|
180032
|
-
"--ext",
|
|
180033
|
-
"-f",
|
|
180034
|
-
"--format",
|
|
180035
|
-
"--max-warnings",
|
|
180036
|
-
"--parser",
|
|
180037
|
-
"--parser-options",
|
|
180038
|
-
"--plugin",
|
|
180039
|
-
"--global",
|
|
180040
|
-
"--env",
|
|
180041
|
-
"--report-unused-disable-directives-severity",
|
|
180042
|
-
"--resolve-plugins-relative-to",
|
|
180043
|
-
"-o",
|
|
180044
|
-
"--output-file",
|
|
180045
|
-
"--flag",
|
|
180046
|
-
"--inspect-config",
|
|
180047
|
-
"--stats",
|
|
180048
|
-
"--concurrency"
|
|
180049
|
-
]);
|
|
180050
|
-
var hasUserPositional = (args) => {
|
|
180051
|
-
for (let index = 0;index < args.length; index++) {
|
|
180052
|
-
const arg = args[index];
|
|
180053
|
-
if (arg === undefined)
|
|
180054
|
-
continue;
|
|
180055
|
-
if (arg.startsWith("-")) {
|
|
180056
|
-
if (arg.includes("="))
|
|
180057
|
-
continue;
|
|
180058
|
-
if (FLAG_VALUE_FLAGS.has(arg))
|
|
180059
|
-
index++;
|
|
180060
|
-
continue;
|
|
180061
|
-
}
|
|
180062
|
-
return true;
|
|
180063
|
-
}
|
|
180064
|
-
return false;
|
|
180065
|
-
};
|
|
180066
|
-
var findConfigPath = (cwd = process.cwd()) => {
|
|
180067
|
-
for (const name of CONFIG_CANDIDATES) {
|
|
180068
|
-
const candidate = resolve4(cwd, name);
|
|
180069
|
-
if (existsSync6(candidate))
|
|
180070
|
-
return candidate;
|
|
180071
|
-
}
|
|
180072
|
-
return null;
|
|
180073
|
-
};
|
|
180074
|
-
var fingerprintLocation = (cacheLocation, cwd) => {
|
|
180075
|
-
const absolute = resolve4(cwd, cacheLocation);
|
|
180076
|
-
return /[\\/]$/.test(cacheLocation) ? resolve4(absolute, CACHE_FINGERPRINT_SUFFIX.slice(1)) : `${absolute}${CACHE_FINGERPRINT_SUFFIX}`;
|
|
180077
|
-
};
|
|
180078
|
-
var addFileToFingerprint = (hash, path, label) => {
|
|
180079
|
-
if (!existsSync6(path))
|
|
180080
|
-
return;
|
|
180081
|
-
hash.update(label);
|
|
180082
|
-
hash.update("\x00");
|
|
180083
|
-
hash.update(readFileSync8(path));
|
|
180084
|
-
hash.update("\x00");
|
|
180085
|
-
};
|
|
180086
|
-
var packageNameFor = (specifier) => {
|
|
180087
|
-
if (specifier.startsWith("@"))
|
|
180088
|
-
return specifier.split("/").slice(0, 2).join("/");
|
|
180089
|
-
const [name = specifier] = specifier.split("/");
|
|
180090
|
-
return name;
|
|
180091
|
-
};
|
|
180092
|
-
var configPackageNames = (configPath2) => {
|
|
180093
|
-
if (!configPath2)
|
|
180094
|
-
return [];
|
|
180095
|
-
const source = readFileSync8(configPath2, "utf-8");
|
|
180096
|
-
const names = new Set;
|
|
180097
|
-
for (const match of source.matchAll(/(?:from\s+|import\s*(?:\(\s*)?|require\s*\(\s*)(['"])([^'".][^'"]*)\1/g)) {
|
|
180098
|
-
const [, , specifier] = match;
|
|
180099
|
-
if (specifier)
|
|
180100
|
-
names.add(packageNameFor(specifier));
|
|
180101
|
-
}
|
|
180102
|
-
return [...names];
|
|
180103
|
-
};
|
|
180104
|
-
var manifestDependencyNames = (manifest) => {
|
|
180105
|
-
if (manifest === null || typeof manifest !== "object")
|
|
180106
|
-
return [];
|
|
180107
|
-
return Object.entries(manifest).flatMap(([key, value]) => {
|
|
180108
|
-
if (key !== "dependencies" && key !== "devDependencies")
|
|
180109
|
-
return [];
|
|
180110
|
-
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
180111
|
-
return [];
|
|
180112
|
-
return Object.keys(value);
|
|
180113
|
-
});
|
|
180114
|
-
};
|
|
180115
|
-
var lintDependencyNames = (cwd, configPath2) => {
|
|
180116
|
-
const manifestPath = resolve4(cwd, "package.json");
|
|
180117
|
-
if (!existsSync6(manifestPath))
|
|
180118
|
-
return configPackageNames(configPath2);
|
|
180119
|
-
try {
|
|
180120
|
-
const manifest = JSON.parse(readFileSync8(manifestPath, "utf-8"));
|
|
180121
|
-
const lintPackages = manifestDependencyNames(manifest).filter((name) => /eslint|typescript/.test(name));
|
|
180122
|
-
return [
|
|
180123
|
-
...new Set([...lintPackages, ...configPackageNames(configPath2)])
|
|
180124
|
-
];
|
|
180125
|
-
} catch {
|
|
180126
|
-
return configPackageNames(configPath2);
|
|
180127
|
-
}
|
|
180128
|
-
};
|
|
180129
|
-
var findInstalledManifest = (cwd, dependency) => {
|
|
180130
|
-
let directory = cwd;
|
|
180131
|
-
while (true) {
|
|
180132
|
-
const candidate = resolve4(directory, "node_modules", dependency, "package.json");
|
|
180133
|
-
if (existsSync6(candidate))
|
|
180134
|
-
return candidate;
|
|
180135
|
-
const parent = dirname3(directory);
|
|
180136
|
-
if (parent === directory)
|
|
180137
|
-
return null;
|
|
180138
|
-
directory = parent;
|
|
180139
|
-
}
|
|
180140
|
-
};
|
|
180141
|
-
var createEslintCacheFingerprint = (cwd = process.cwd()) => {
|
|
180142
|
-
const hash = createHash("sha256");
|
|
180143
|
-
hash.update(`absolute-eslint-cache:${CACHE_CONTRACT_VERSION}\x00`);
|
|
180144
|
-
const configPath2 = findConfigPath(cwd);
|
|
180145
|
-
if (configPath2)
|
|
180146
|
-
addFileToFingerprint(hash, configPath2, configPath2);
|
|
180147
|
-
for (const dependency of lintDependencyNames(cwd, configPath2).sort()) {
|
|
180148
|
-
const manifestPath = findInstalledManifest(cwd, dependency);
|
|
180149
|
-
if (manifestPath)
|
|
180150
|
-
addFileToFingerprint(hash, manifestPath, dependency);
|
|
180151
|
-
}
|
|
180152
|
-
return hash.digest("hex");
|
|
180153
|
-
};
|
|
180154
|
-
var writeFingerprint = (path, fingerprint) => {
|
|
180155
|
-
mkdirSync5(dirname3(path), { recursive: true });
|
|
180156
|
-
const temporary = `${path}.${process.pid}.tmp`;
|
|
180157
|
-
writeFileSync5(temporary, `${fingerprint}
|
|
180158
|
-
`);
|
|
180159
|
-
renameSync(temporary, path);
|
|
180160
|
-
};
|
|
180161
|
-
var prepareEslintCache = (options) => {
|
|
180162
|
-
const cwd = options.cwd ?? process.cwd();
|
|
180163
|
-
const cachePath = resolve4(cwd, options.cacheLocation);
|
|
180164
|
-
const metadataPath = fingerprintLocation(options.cacheLocation, cwd);
|
|
180165
|
-
const fingerprint = options.fingerprint ?? createEslintCacheFingerprint(cwd);
|
|
180166
|
-
const prior = existsSync6(metadataPath) ? readFileSync8(metadataPath, "utf-8").trim() : null;
|
|
180167
|
-
if (prior === fingerprint)
|
|
180168
|
-
return false;
|
|
180169
|
-
rmSync3(cachePath, { force: true, recursive: true });
|
|
180170
|
-
if (metadataPath !== cachePath)
|
|
180171
|
-
rmSync3(metadataPath, { force: true, recursive: true });
|
|
180172
|
-
writeFingerprint(metadataPath, fingerprint);
|
|
180173
|
-
return true;
|
|
180174
|
-
};
|
|
180175
|
-
var hasKey = (objectLiteralSource, key) => {
|
|
180176
|
-
const pattern = new RegExp(`(^|[\\s,{])${key}\\s*:`, "m");
|
|
180177
|
-
return pattern.test(objectLiteralSource);
|
|
180178
|
-
};
|
|
180179
|
-
var NON_GLOBAL_IGNORE_KEYS = [
|
|
180180
|
-
"files",
|
|
180181
|
-
"rules",
|
|
180182
|
-
"plugins",
|
|
180183
|
-
"languageOptions",
|
|
180184
|
-
"linterOptions",
|
|
180185
|
-
"processor",
|
|
180186
|
-
"settings",
|
|
180187
|
-
"extends"
|
|
180188
|
-
];
|
|
180189
|
-
var isGlobalIgnoresBlock = (block) => {
|
|
180190
|
-
if (!hasKey(block, "ignores"))
|
|
180191
|
-
return false;
|
|
180192
|
-
return !NON_GLOBAL_IGNORE_KEYS.some((key) => hasKey(block, key));
|
|
180193
|
-
};
|
|
180194
|
-
var extractTopLevelObjectLiterals = (source) => {
|
|
180195
|
-
const arrayStart = source.search(/defineConfig\s*\(\s*\[|export\s+default\s*\[/);
|
|
180196
|
-
if (arrayStart === -1)
|
|
180197
|
-
return [];
|
|
180198
|
-
const fromArray = source.slice(arrayStart);
|
|
180199
|
-
const openBracket = fromArray.indexOf("[");
|
|
180200
|
-
if (openBracket === -1)
|
|
180201
|
-
return [];
|
|
180202
|
-
const blocks = [];
|
|
180203
|
-
let depth = 0;
|
|
180204
|
-
let blockStart = -1;
|
|
180205
|
-
let inString = null;
|
|
180206
|
-
let inLineComment = false;
|
|
180207
|
-
let inBlockComment = false;
|
|
180208
|
-
for (let i = openBracket;i < fromArray.length; i++) {
|
|
180209
|
-
const char = fromArray[i];
|
|
180210
|
-
const next = fromArray[i + 1];
|
|
180211
|
-
if (inLineComment) {
|
|
180212
|
-
if (char === `
|
|
180213
|
-
`)
|
|
180214
|
-
inLineComment = false;
|
|
180215
|
-
continue;
|
|
180216
|
-
}
|
|
180217
|
-
if (inBlockComment) {
|
|
180218
|
-
if (char === "*" && next === "/") {
|
|
180219
|
-
inBlockComment = false;
|
|
180220
|
-
i++;
|
|
180221
|
-
}
|
|
180222
|
-
continue;
|
|
180223
|
-
}
|
|
180224
|
-
if (inString) {
|
|
180225
|
-
if (char === "\\") {
|
|
180226
|
-
i++;
|
|
180227
|
-
continue;
|
|
180228
|
-
}
|
|
180229
|
-
if (char === inString)
|
|
180230
|
-
inString = null;
|
|
180231
|
-
continue;
|
|
180232
|
-
}
|
|
180233
|
-
if (char === "/" && next === "/") {
|
|
180234
|
-
inLineComment = true;
|
|
180235
|
-
continue;
|
|
180236
|
-
}
|
|
180237
|
-
if (char === "/" && next === "*") {
|
|
180238
|
-
inBlockComment = true;
|
|
180239
|
-
i++;
|
|
180240
|
-
continue;
|
|
180241
|
-
}
|
|
180242
|
-
if (char === '"' || char === "'" || char === "`") {
|
|
180243
|
-
inString = char;
|
|
180244
|
-
continue;
|
|
180245
|
-
}
|
|
180246
|
-
if (char === "{") {
|
|
180247
|
-
if (depth === 0)
|
|
180248
|
-
blockStart = i;
|
|
180249
|
-
depth++;
|
|
180250
|
-
} else if (char === "}") {
|
|
180251
|
-
depth--;
|
|
180252
|
-
if (depth === 0 && blockStart !== -1) {
|
|
180253
|
-
blocks.push(fromArray.slice(blockStart, i + 1));
|
|
180254
|
-
blockStart = -1;
|
|
180255
|
-
}
|
|
180256
|
-
} else if (char === "]" && depth === 0) {
|
|
180257
|
-
break;
|
|
180258
|
-
}
|
|
180259
|
-
}
|
|
180260
|
-
return blocks;
|
|
180261
|
-
};
|
|
180262
|
-
var checkForMisplacedIgnores = () => {
|
|
180263
|
-
const configPath2 = findConfigPath();
|
|
180264
|
-
if (!configPath2)
|
|
180265
|
-
return;
|
|
180266
|
-
let source;
|
|
180267
|
-
try {
|
|
180268
|
-
source = readFileSync8(configPath2, "utf-8");
|
|
180269
|
-
} catch {
|
|
180270
|
-
return;
|
|
180271
|
-
}
|
|
180272
|
-
const blocks = extractTopLevelObjectLiterals(source);
|
|
180273
|
-
if (blocks.some(isGlobalIgnoresBlock))
|
|
180274
|
-
return;
|
|
180275
|
-
let offenderCount = 0;
|
|
180276
|
-
for (const block of blocks) {
|
|
180277
|
-
if (hasKey(block, "ignores") && hasKey(block, "files")) {
|
|
180278
|
-
offenderCount++;
|
|
180279
|
-
}
|
|
180280
|
-
}
|
|
180281
|
-
if (offenderCount === 0)
|
|
180282
|
-
return;
|
|
180283
|
-
const yellow = "\x1B[33m";
|
|
180284
|
-
const reset = "\x1B[0m";
|
|
180285
|
-
const bold = "\x1B[1m";
|
|
180286
|
-
console.warn(`${yellow}${bold}\u26A0 ESLint flat-config warning${reset}${yellow}: found ${offenderCount} config block(s) where \`ignores\` lives alongside \`files\`. In ESLint v9, \`ignores\` is only a *global* ignore when it's the sole key in its config object \u2014 otherwise it just suppresses that block's own rules and ESLint still walks every other directory (including node_modules), making lint extremely slow.
|
|
180287
|
-
|
|
180288
|
-
Move ignores into a standalone block at the top of your config:
|
|
180289
|
-
|
|
180290
|
-
export default defineConfig([
|
|
180291
|
-
{ ignores: ['node_modules/**', 'dist/**', 'build/**', '.absolutejs/**'] },
|
|
180292
|
-
pluginJs.configs.recommended,
|
|
180293
|
-
...
|
|
180294
|
-
]);
|
|
180295
|
-
|
|
180296
|
-
Detected at: ${configPath2}${reset}`);
|
|
180297
|
-
};
|
|
180298
|
-
var formatDuration = (durationMs) => {
|
|
180299
|
-
if (durationMs < 1000)
|
|
180300
|
-
return `${durationMs}ms`;
|
|
180301
|
-
if (durationMs < 60000)
|
|
180302
|
-
return `${(durationMs / 1000).toFixed(2)}s`;
|
|
180303
|
-
const minutes = Math.floor(durationMs / 60000);
|
|
180304
|
-
const seconds = Math.round(durationMs % 60000 / 1000);
|
|
180305
|
-
return `${minutes}m ${seconds}s`;
|
|
180306
|
-
};
|
|
180307
|
-
var handleClearCache = (cacheLocation, cwd = process.cwd()) => {
|
|
180308
|
-
try {
|
|
180309
|
-
const cachePath = resolve4(cwd, cacheLocation);
|
|
180310
|
-
const metadataPath = fingerprintLocation(cacheLocation, cwd);
|
|
180311
|
-
rmSync3(cachePath, { force: true, recursive: true });
|
|
180312
|
-
rmSync3(metadataPath, { force: true, recursive: true });
|
|
180313
|
-
console.log(`\x1B[32m\u2713\x1B[0m Cleared cache: ${cacheLocation}`);
|
|
180314
|
-
} catch (err) {
|
|
180315
|
-
console.error(`\x1B[31m\u2717\x1B[0m Failed to clear cache at ${cacheLocation}:`, err);
|
|
180316
|
-
process.exit(1);
|
|
180317
|
-
}
|
|
180318
|
-
};
|
|
180319
|
-
var buildEslintCommand = (args, cacheLocation) => {
|
|
180320
|
-
const cacheEnabled = !args.includes("--no-cache");
|
|
180321
|
-
const hasCacheLocation = args.some((arg) => arg === "--cache-location" || arg.startsWith("--cache-location="));
|
|
180322
|
-
const hasCacheStrategy = args.some((arg) => arg === "--cache-strategy" || arg.startsWith("--cache-strategy="));
|
|
180323
|
-
return [
|
|
180324
|
-
"bun",
|
|
180325
|
-
"eslint",
|
|
180326
|
-
...cacheEnabled ? ["--cache"] : [],
|
|
180327
|
-
...cacheEnabled && !hasCacheLocation ? ["--cache-location", cacheLocation] : [],
|
|
180328
|
-
...cacheEnabled && !hasCacheStrategy ? ["--cache-strategy", "content"] : [],
|
|
180329
|
-
...args,
|
|
180330
|
-
...hasUserPositional(args) ? [] : ["."]
|
|
180331
|
-
];
|
|
180332
|
-
};
|
|
180333
|
-
var eslint = async (args) => {
|
|
180334
|
-
const cacheLocation = getCacheLocation(args);
|
|
180335
|
-
if (args.includes("--clear-cache")) {
|
|
180336
|
-
handleClearCache(cacheLocation);
|
|
180337
|
-
return;
|
|
180338
|
-
}
|
|
180339
|
-
if (!existsSync6(resolve4("node_modules", ".bin", "eslint"))) {
|
|
180340
|
-
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");
|
|
180341
|
-
process.exit(1);
|
|
180342
|
-
}
|
|
180343
|
-
checkForMisplacedIgnores();
|
|
180344
|
-
const cacheEnabled = !args.includes("--no-cache");
|
|
180345
|
-
if (cacheEnabled)
|
|
180346
|
-
prepareEslintCache({ cacheLocation });
|
|
180347
|
-
const command = buildEslintCommand(args, cacheLocation);
|
|
180348
|
-
const dim = "\x1B[2m";
|
|
180349
|
-
const reset = "\x1B[0m";
|
|
180350
|
-
console.log(cacheEnabled ? `${dim}cache: ${cacheLocation} (content-aware; lint-tool changes invalidate automatically)${reset}` : `${dim}cache: disabled${reset}`);
|
|
180351
|
-
const startedAt = Date.now();
|
|
180352
|
-
const proc = Bun.spawn(command, {
|
|
180353
|
-
stderr: "inherit",
|
|
180354
|
-
stdout: "inherit"
|
|
180355
|
-
});
|
|
180356
|
-
const exitCode = await proc.exited;
|
|
180357
|
-
const elapsed = formatDuration(Date.now() - startedAt);
|
|
180358
|
-
if (exitCode !== 0) {
|
|
180359
|
-
console.log(`${dim}elapsed: ${elapsed}${reset}`);
|
|
180360
|
-
process.exit(exitCode);
|
|
180361
|
-
}
|
|
180362
|
-
console.log(`\x1B[32m\u2713\x1B[0m Passed ${dim}(${elapsed})${reset}`);
|
|
180363
|
-
};
|
|
180519
|
+
// src/cli/index.ts
|
|
180520
|
+
init_eslint();
|
|
180364
180521
|
|
|
180365
180522
|
// src/cli/scripts/info.ts
|
|
180366
180523
|
init_constants();
|
|
@@ -182470,6 +182627,10 @@ if (command === "dev") {
|
|
|
182470
182627
|
} else if (command === "eslint") {
|
|
182471
182628
|
sendTelemetryEvent("cli:command", { command });
|
|
182472
182629
|
await eslint(args);
|
|
182630
|
+
} else if (command === "lint-proof") {
|
|
182631
|
+
sendTelemetryEvent("cli:command", { command });
|
|
182632
|
+
const { runLintProof: runLintProof2 } = await Promise.resolve().then(() => (init_lintProof(), exports_lintProof));
|
|
182633
|
+
process.exitCode = await runLintProof2(args);
|
|
182473
182634
|
} else if (command === "prettier") {
|
|
182474
182635
|
sendTelemetryEvent("cli:command", { command });
|
|
182475
182636
|
await prettier(args);
|
|
@@ -182585,6 +182746,7 @@ if (command === "dev") {
|
|
|
182585
182746
|
console.error(" analyze [--save] [--json] Bundle size breakdown + diff vs a saved baseline");
|
|
182586
182747
|
console.error(" api [--open] [--json] Show the API surface or open the OpenAPI UI (@elysiajs/openapi)");
|
|
182587
182748
|
console.error(" eslint Run ESLint (cached)");
|
|
182749
|
+
console.error(" lint-proof <run|verify> -- <command> Record or verify an exact-source local lint pass");
|
|
182588
182750
|
console.error(" generate <page|api|component> <name> [--framework <fw>] Scaffold a page, API plugin, or component");
|
|
182589
182751
|
console.error(" htmx [version] Self-host htmx \u2014 report or install/upgrade the pinned copy");
|
|
182590
182752
|
console.error(" info Print system info for bug reports");
|