@absolutejs/absolute 0.19.0-beta.1115 → 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/angular/browser.js +53 -47
- package/dist/angular/browser.js.map +5 -5
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/hmrPreserveCore.ts +73 -34
- package/dist/angular/index.js +63 -58
- package/dist/angular/index.js.map +10 -10
- package/dist/angular/server.js +20 -38
- package/dist/angular/server.js.map +8 -8
- package/dist/build.js +601 -547
- package/dist/build.js.map +32 -32
- package/dist/cli/config/client.js +8 -8
- package/dist/cli/config/server.js +87 -75
- package/dist/cli/index.js +975 -794
- package/dist/client/index.js +1 -19
- package/dist/client/index.js.map +3 -3
- package/dist/core/streamingSlotRegistrar.js +1 -19
- package/dist/core/streamingSlotRegistrar.js.map +2 -2
- package/dist/core/streamingSlotRegistry.js +1 -19
- package/dist/core/streamingSlotRegistry.js.map +2 -2
- package/dist/dev/client/errorOverlay.ts +11 -10
- package/dist/dev/client/handlers/angularHmrShim.ts +6 -6
- package/dist/dev/client/handlers/angularRemount.ts +64 -44
- package/dist/dev/client/hmrClient.ts +31 -26
- package/dist/dev/client/hmrToast.ts +2 -4
- package/dist/dev/serverBootstrap.js +36 -0
- package/dist/index.js +742 -615
- package/dist/index.js.map +39 -38
- package/dist/islands/browser.js +1 -19
- package/dist/islands/browser.js.map +2 -2
- package/dist/islands/index.js +1 -19
- package/dist/islands/index.js.map +3 -3
- package/dist/react/browser.js +1 -19
- package/dist/react/browser.js.map +2 -2
- package/dist/react/components/index.js +1 -19
- package/dist/react/components/index.js.map +2 -2
- package/dist/react/hooks/index.js +1 -19
- package/dist/react/hooks/index.js.map +2 -2
- package/dist/react/index.js +15 -37
- package/dist/react/index.js.map +7 -7
- package/dist/react/jsxDevRuntimeCompat.js +1 -19
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/router/browser.js +1 -19
- package/dist/react/router/browser.js.map +2 -2
- package/dist/react/router/index.js +1 -19
- package/dist/react/router/index.js.map +2 -2
- package/dist/react/server.js +15 -37
- package/dist/react/server.js.map +6 -6
- package/dist/src/angular/hmrPreserveCore.d.ts +2 -2
- package/dist/src/cli/config/absolute/resolveAbsoluteConfig.d.ts +1 -1
- package/dist/src/cli/config/auth/resolveAuthSettings.d.ts +1 -1
- package/dist/src/cli/config/packageJson/resolvePackageJson.d.ts +1 -2
- package/dist/src/cli/config/schema/fromType.d.ts +1 -2
- package/dist/src/cli/config/server.d.ts +2 -2
- package/dist/src/cli/scripts/lintProof.d.ts +34 -0
- package/dist/src/core/build.d.ts +3 -2
- package/dist/src/core/prepare.d.ts +1 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +4 -2
- package/dist/src/dev/serverBootstrap.d.ts +1 -0
- package/dist/src/dev/serverEntryWatcher.d.ts +3 -3
- package/dist/src/dev/webSocket.d.ts +1 -1
- package/dist/src/plugins/hmr.d.ts +1 -0
- package/dist/src/svelte/router/matchPath.d.ts +2 -2
- package/dist/src/utils/defineConvention.d.ts +2 -2
- package/dist/src/utils/inlinePageCss.d.ts +1 -1
- package/dist/src/utils/isTestSourcePath.d.ts +1 -0
- package/dist/svelte/browser.js +1 -19
- package/dist/svelte/browser.js.map +2 -2
- package/dist/svelte/index.js +15 -36
- package/dist/svelte/index.js.map +8 -8
- package/dist/svelte/router/Link.svelte.d.ts +3 -3
- package/dist/svelte/router/Route.svelte.d.ts +5 -5
- package/dist/svelte/router/Router.svelte.d.ts +3 -3
- package/dist/svelte/router/matchPath.ts +25 -20
- package/dist/svelte/router/prefetchCache.ts +6 -4
- package/dist/svelte/router/viewTransitions.ts +22 -12
- package/dist/svelte/server.js +15 -36
- package/dist/svelte/server.js.map +7 -7
- package/dist/types/angular.d.ts +1 -1
- package/dist/types/globals.d.ts +5 -0
- package/dist/vue/browser.js +1 -19
- package/dist/vue/browser.js.map +2 -2
- package/dist/vue/components/Image.js +1 -19
- package/dist/vue/components/Image.js.map +2 -2
- package/dist/vue/components/index.js +1 -19
- package/dist/vue/components/index.js.map +2 -2
- package/dist/vue/index.js +41 -55
- package/dist/vue/index.js.map +10 -10
- package/dist/vue/server.js +32 -48
- package/dist/vue/server.js.map +8 -8
- package/package.json +90 -31
package/dist/cli/index.js
CHANGED
|
@@ -279,7 +279,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
279
279
|
releaseAllSync();
|
|
280
280
|
throw err;
|
|
281
281
|
});
|
|
282
|
-
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error
|
|
282
|
+
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && Reflect.get(error, "code") === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join3(dirname2(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
|
|
283
283
|
`).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
|
|
284
284
|
if (locks.size === 0) {
|
|
285
285
|
delete process.env[HELD_LOCKS_ENV];
|
|
@@ -316,7 +316,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
316
316
|
process.kill(pid, 0);
|
|
317
317
|
return true;
|
|
318
318
|
} catch (err) {
|
|
319
|
-
const
|
|
319
|
+
const code = typeof err === "object" && err !== null ? Reflect.get(err, "code") : undefined;
|
|
320
320
|
if (code === "ESRCH")
|
|
321
321
|
return false;
|
|
322
322
|
if (code === "EPERM")
|
|
@@ -395,7 +395,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
395
395
|
}
|
|
396
396
|
const portInfo = existing.port ? ` on port ${existing.port}` : "";
|
|
397
397
|
const elapsedNote = wait ? ` Waited ${Math.round((Date.now() - start) / 1000)}s.` : "";
|
|
398
|
-
throw new Error(`AbsoluteJS build lock is held by PID ${existing.pid}${portInfo} (started ${existing.startedAt}).${elapsedNote} ` + `Another process owns ${buildDirectory}. ` + `Run \`kill ${existing.pid}\` (or wait for it to finish) and try again
|
|
398
|
+
throw new Error(`AbsoluteJS build lock is held by PID ${existing.pid}${portInfo} (started ${existing.startedAt}).${elapsedNote} ` + `Another process owns ${buildDirectory}. ` + `Run \`kill ${existing.pid}\` (or wait for it to finish) and try again.`, { cause: error });
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
const releaseSync = () => {
|
|
@@ -760,7 +760,7 @@ var COMPOSE_PATH = "db/docker-compose.db.yml", DEFAULT_SERVER_ENTRY = "src/backe
|
|
|
760
760
|
process.kill(pid, "SIGTERM");
|
|
761
761
|
} catch {}
|
|
762
762
|
}, findFreePort = () => {
|
|
763
|
-
const server2 = Bun.serve({ fetch: () => new Response
|
|
763
|
+
const server2 = Bun.serve({ port: 0, fetch: () => new Response });
|
|
764
764
|
const { port } = server2;
|
|
765
765
|
server2.stop(true);
|
|
766
766
|
if (port === undefined) {
|
|
@@ -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
|
`);
|
|
@@ -172530,28 +173056,32 @@ var init_mem = __esm(() => {
|
|
|
172530
173056
|
HEADERS = ["NAME", "SOURCE", "PORT", "RSS", "% SYS"];
|
|
172531
173057
|
});
|
|
172532
173058
|
|
|
173059
|
+
// src/cli/config/guards.ts
|
|
173060
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
173061
|
+
|
|
172533
173062
|
// src/cli/config/schema/fromType.ts
|
|
172534
173063
|
import {
|
|
172535
|
-
existsSync as
|
|
172536
|
-
mkdirSync as
|
|
172537
|
-
readFileSync as
|
|
173064
|
+
existsSync as existsSync15,
|
|
173065
|
+
mkdirSync as mkdirSync9,
|
|
173066
|
+
readFileSync as readFileSync17,
|
|
172538
173067
|
statSync as statSync2,
|
|
172539
|
-
writeFileSync as
|
|
173068
|
+
writeFileSync as writeFileSync8
|
|
172540
173069
|
} from "fs";
|
|
172541
|
-
import { resolve as
|
|
173070
|
+
import { resolve as resolve12 } from "path";
|
|
172542
173071
|
var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DEPTH = 6, isFrameworkRepo = (cwd) => {
|
|
172543
173072
|
try {
|
|
172544
|
-
const pkg = JSON.parse(
|
|
173073
|
+
const pkg = JSON.parse(readFileSync17(resolve12(cwd, "package.json"), "utf-8"));
|
|
172545
173074
|
return pkg?.name === "@absolutejs/absolute";
|
|
172546
173075
|
} catch {
|
|
172547
173076
|
return false;
|
|
172548
173077
|
}
|
|
172549
173078
|
}, compilerOptionsFor = (cwd) => {
|
|
172550
173079
|
const tsconfigPath = import_typescript3.default.findConfigFile(cwd, import_typescript3.default.sys.fileExists, "tsconfig.json");
|
|
172551
|
-
const
|
|
173080
|
+
const parseConfigHost = {
|
|
172552
173081
|
...import_typescript3.default.sys,
|
|
172553
173082
|
onUnRecoverableConfigFileDiagnostic: () => {}
|
|
172554
|
-
}
|
|
173083
|
+
};
|
|
173084
|
+
const base = tsconfigPath && import_typescript3.default.getParsedCommandLineOfConfigFile(tsconfigPath, {}, parseConfigHost)?.options;
|
|
172555
173085
|
return {
|
|
172556
173086
|
...base ?? import_typescript3.default.getDefaultCompilerOptions(),
|
|
172557
173087
|
noEmit: true,
|
|
@@ -172561,14 +173091,14 @@ var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
172561
173091
|
};
|
|
172562
173092
|
}, SCHEMA_VERSION = 1, packageVersion = (cwd, specifier) => {
|
|
172563
173093
|
const candidates = specifier === "@absolutejs/absolute" ? [
|
|
172564
|
-
|
|
172565
|
-
|
|
173094
|
+
resolve12(cwd, "node_modules", "@absolutejs", "absolute", "package.json"),
|
|
173095
|
+
resolve12(cwd, "package.json")
|
|
172566
173096
|
] : [
|
|
172567
|
-
|
|
173097
|
+
resolve12(cwd, "node_modules", ...specifier.split("/"), "package.json")
|
|
172568
173098
|
];
|
|
172569
173099
|
for (const candidate of candidates) {
|
|
172570
173100
|
try {
|
|
172571
|
-
const { version: version2 } = JSON.parse(
|
|
173101
|
+
const { version: version2 } = JSON.parse(readFileSync17(candidate, "utf-8"));
|
|
172572
173102
|
if (typeof version2 === "string")
|
|
172573
173103
|
return version2;
|
|
172574
173104
|
} catch {}
|
|
@@ -172579,27 +173109,27 @@ var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
172579
173109
|
if (local) {
|
|
172580
173110
|
const file = typeName === "PackageJson" ? "packageJson.ts" : "build.ts";
|
|
172581
173111
|
try {
|
|
172582
|
-
signature += `:${statSync2(
|
|
173112
|
+
signature += `:${statSync2(resolve12(cwd, "types", file)).mtimeMs}`;
|
|
172583
173113
|
} catch {}
|
|
172584
173114
|
}
|
|
172585
173115
|
return signature;
|
|
172586
173116
|
}, cacheSlug = (specifier) => specifier.replace("@", "").split("/").join("-"), cacheFile = (cwd, typeName, specifier) => {
|
|
172587
173117
|
const name = specifier === "@absolutejs/absolute" ? typeName : `${typeName}.${cacheSlug(specifier)}`;
|
|
172588
|
-
return
|
|
173118
|
+
return resolve12(cwd, ".absolutejs", "config-schema", `${name}.json`);
|
|
172589
173119
|
}, readDiskCache = (cwd, typeName, signature, specifier) => {
|
|
172590
173120
|
try {
|
|
172591
|
-
const cached = JSON.parse(
|
|
172592
|
-
if (cached
|
|
173121
|
+
const cached = JSON.parse(readFileSync17(cacheFile(cwd, typeName, specifier), "utf-8"));
|
|
173122
|
+
if (isRecord3(cached) && cached.signature === signature && Array.isArray(cached.fields)) {
|
|
172593
173123
|
return cached.fields;
|
|
172594
173124
|
}
|
|
172595
173125
|
} catch {}
|
|
172596
173126
|
return null;
|
|
172597
173127
|
}, writeDiskCache = (cwd, typeName, signature, fields, specifier) => {
|
|
172598
173128
|
try {
|
|
172599
|
-
|
|
173129
|
+
mkdirSync9(resolve12(cwd, ".absolutejs", "config-schema"), {
|
|
172600
173130
|
recursive: true
|
|
172601
173131
|
});
|
|
172602
|
-
|
|
173132
|
+
writeFileSync8(cacheFile(cwd, typeName, specifier), JSON.stringify({ fields, signature }));
|
|
172603
173133
|
} catch {}
|
|
172604
173134
|
}, docOf = (symbol, checker) => import_typescript3.default.displayPartsToString(symbol.getDocumentationComment(checker)).trim(), typeOfSymbol = (symbol, checker) => {
|
|
172605
173135
|
const declaration = symbol.valueDeclaration ?? symbol.declarations?.[0];
|
|
@@ -172683,7 +173213,7 @@ var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
172683
173213
|
}
|
|
172684
173214
|
return opaque();
|
|
172685
173215
|
}, introspectFrom = (cwd, specifier, typeName, options, exclude) => {
|
|
172686
|
-
const virtualPath =
|
|
173216
|
+
const virtualPath = resolve12(cwd, VIRTUAL_NAME);
|
|
172687
173217
|
const source = `import type { ${typeName} } from '${specifier}';
|
|
172688
173218
|
declare const value: ${typeName};
|
|
172689
173219
|
export { value };
|
|
@@ -172704,7 +173234,7 @@ export { value };
|
|
|
172704
173234
|
sourceFile.forEachChild((node) => {
|
|
172705
173235
|
if (!import_typescript3.default.isVariableStatement(node))
|
|
172706
173236
|
return;
|
|
172707
|
-
const declaration = node.declarationList.declarations
|
|
173237
|
+
const [declaration] = node.declarationList.declarations;
|
|
172708
173238
|
if (!declaration)
|
|
172709
173239
|
return;
|
|
172710
173240
|
const type = checker.getTypeAtLocation(declaration);
|
|
@@ -172726,7 +173256,7 @@ export { value };
|
|
|
172726
173256
|
const cached = cache.get(cacheKey);
|
|
172727
173257
|
if (cached)
|
|
172728
173258
|
return cached;
|
|
172729
|
-
const local = specifier === "@absolutejs/absolute" && isFrameworkRepo(cwd) &&
|
|
173259
|
+
const local = specifier === "@absolutejs/absolute" && isFrameworkRepo(cwd) && existsSync15(resolve12(cwd, "types/index.ts"));
|
|
172730
173260
|
const signature = cacheSignature(cwd, typeName, local, specifier);
|
|
172731
173261
|
const fromDisk = readDiskCache(cwd, typeName, signature, specifier);
|
|
172732
173262
|
if (fromDisk) {
|
|
@@ -172754,38 +173284,37 @@ var init_fromType = __esm(() => {
|
|
|
172754
173284
|
});
|
|
172755
173285
|
|
|
172756
173286
|
// src/cli/config/absolute/resolveAbsoluteConfig.ts
|
|
172757
|
-
import { existsSync as
|
|
172758
|
-
import { resolve as
|
|
173287
|
+
import { existsSync as existsSync16, readFileSync as readFileSync18 } from "fs";
|
|
173288
|
+
import { resolve as resolve13 } from "path";
|
|
172759
173289
|
var import_typescript4, CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath2 = (cwd, override) => {
|
|
172760
173290
|
if (override) {
|
|
172761
|
-
const resolved =
|
|
172762
|
-
return
|
|
173291
|
+
const resolved = resolve13(cwd, override);
|
|
173292
|
+
return existsSync16(resolved) ? resolved : null;
|
|
172763
173293
|
}
|
|
172764
173294
|
for (const name of CONFIG_CANDIDATES2) {
|
|
172765
|
-
const candidate =
|
|
172766
|
-
if (
|
|
173295
|
+
const candidate = resolve13(cwd, name);
|
|
173296
|
+
if (existsSync16(candidate))
|
|
172767
173297
|
return candidate;
|
|
172768
173298
|
}
|
|
172769
173299
|
return null;
|
|
172770
173300
|
}, parseSource = (configPath2, text) => import_typescript4.default.createSourceFile(configPath2, text, import_typescript4.default.ScriptTarget.Latest, true), findConfigObject = (sourceFile) => {
|
|
172771
|
-
|
|
172772
|
-
|
|
172773
|
-
|
|
172774
|
-
|
|
172775
|
-
|
|
172776
|
-
|
|
172777
|
-
|
|
173301
|
+
const pending = [sourceFile];
|
|
173302
|
+
while (pending.length > 0) {
|
|
173303
|
+
const node = pending.pop();
|
|
173304
|
+
if (!node)
|
|
173305
|
+
continue;
|
|
173306
|
+
const [firstArgument] = import_typescript4.default.isCallExpression(node) ? node.arguments : [];
|
|
173307
|
+
if (import_typescript4.default.isCallExpression(node) && import_typescript4.default.isIdentifier(node.expression) && node.expression.text === "defineConfig" && firstArgument && import_typescript4.default.isObjectLiteralExpression(firstArgument)) {
|
|
173308
|
+
return firstArgument;
|
|
172778
173309
|
}
|
|
172779
173310
|
if (import_typescript4.default.isExportAssignment(node) && import_typescript4.default.isObjectLiteralExpression(node.expression)) {
|
|
172780
|
-
|
|
172781
|
-
return;
|
|
173311
|
+
return node.expression;
|
|
172782
173312
|
}
|
|
172783
|
-
|
|
172784
|
-
}
|
|
172785
|
-
|
|
172786
|
-
return found;
|
|
173313
|
+
node.forEachChild((child) => pending.push(child));
|
|
173314
|
+
}
|
|
173315
|
+
return null;
|
|
172787
173316
|
}, parseConfigObject = (configPath2) => {
|
|
172788
|
-
const text =
|
|
173317
|
+
const text = readFileSync18(configPath2, "utf-8");
|
|
172789
173318
|
return { object: findConfigObject(parseSource(configPath2, text)), text };
|
|
172790
173319
|
}, evalLiteral = (node) => {
|
|
172791
173320
|
if (import_typescript4.default.isStringLiteralLike(node)) {
|
|
@@ -172997,23 +173526,23 @@ var init_frameworks = __esm(() => {
|
|
|
172997
173526
|
});
|
|
172998
173527
|
|
|
172999
173528
|
// src/cli/generate/context.ts
|
|
173000
|
-
import { dirname as
|
|
173001
|
-
var asString = (value) => typeof value === "string" ? value : undefined,
|
|
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) => {
|
|
173002
173531
|
const styles = config.stylesConfig;
|
|
173003
173532
|
if (typeof styles === "string")
|
|
173004
173533
|
return resolveDir(cwd, styles);
|
|
173005
|
-
if (
|
|
173534
|
+
if (isRecord4(styles)) {
|
|
173006
173535
|
const indexes = asString(styles.indexes);
|
|
173007
173536
|
if (indexes)
|
|
173008
173537
|
return resolveDir(cwd, indexes);
|
|
173009
173538
|
}
|
|
173010
|
-
return
|
|
173539
|
+
return resolve14(cwd, "src/frontend/styles/indexes");
|
|
173011
173540
|
}, configuredFrameworks = (project) => FRAMEWORK_KEYS2.filter((key) => project.frameworkDirs[key] !== undefined), frontendRootFor = (project, framework) => {
|
|
173012
173541
|
const dir = project.frameworkDirs[framework];
|
|
173013
|
-
return dir ?
|
|
173542
|
+
return dir ? dirname6(dir) : resolve14(project.cwd, "src/frontend");
|
|
173014
173543
|
}, resolveProject = async (cwd, configOverride) => {
|
|
173015
173544
|
const loaded = await loadConfig(configOverride);
|
|
173016
|
-
const config =
|
|
173545
|
+
const config = isRecord4(loaded) ? loaded : {};
|
|
173017
173546
|
const frameworkDirs = {};
|
|
173018
173547
|
for (const key of FRAMEWORK_KEYS2) {
|
|
173019
173548
|
const dir = asString(config[frameworks2[key].configDirKey]);
|
|
@@ -173061,7 +173590,7 @@ var asString = (value) => typeof value === "string" ? value : undefined, isRecor
|
|
|
173061
173590
|
ok: false
|
|
173062
173591
|
};
|
|
173063
173592
|
}, sharedDirFor = (project, framework) => join14(frontendRootFor(project, framework), "shared"), toModuleSpecifier = (fromDir, toFileNoExt) => {
|
|
173064
|
-
const rel =
|
|
173593
|
+
const rel = relative4(fromDir, toFileNoExt).split("\\").join("/");
|
|
173065
173594
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
173066
173595
|
};
|
|
173067
173596
|
var init_context = __esm(() => {
|
|
@@ -173088,8 +173617,8 @@ var emptyOutcome = () => ({
|
|
|
173088
173617
|
});
|
|
173089
173618
|
|
|
173090
173619
|
// src/cli/generate/routeWiring.ts
|
|
173091
|
-
import { existsSync as
|
|
173092
|
-
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";
|
|
173093
173622
|
var import_typescript5, DEFAULT_SEPARATOR = `
|
|
173094
173623
|
`, BOUNDARY_USE, applyEdits = (text, edits) => {
|
|
173095
173624
|
const ordered = [...edits].sort((first, second) => second.start - first.start);
|
|
@@ -173237,13 +173766,13 @@ ${newLines.join(`
|
|
|
173237
173766
|
return lines.join(`
|
|
173238
173767
|
`);
|
|
173239
173768
|
}, hasChain = (path) => {
|
|
173240
|
-
if (!
|
|
173769
|
+
if (!existsSync17(path))
|
|
173241
173770
|
return false;
|
|
173242
|
-
const sourceFile = parse2(path,
|
|
173771
|
+
const sourceFile = parse2(path, readFileSync19(path, "utf-8"));
|
|
173243
173772
|
const found = findElysiaNew(sourceFile);
|
|
173244
173773
|
return found !== null;
|
|
173245
173774
|
}, firstChainFile = (pluginsDir) => {
|
|
173246
|
-
if (!
|
|
173775
|
+
if (!existsSync17(pluginsDir))
|
|
173247
173776
|
return null;
|
|
173248
173777
|
for (const name of readdirSync4(pluginsDir)) {
|
|
173249
173778
|
if (!name.endsWith(".ts"))
|
|
@@ -173254,7 +173783,7 @@ ${newLines.join(`
|
|
|
173254
173783
|
}
|
|
173255
173784
|
return null;
|
|
173256
173785
|
}, findRoutingFile = (serverEntry) => {
|
|
173257
|
-
const pluginsDir = join15(
|
|
173786
|
+
const pluginsDir = join15(dirname7(serverEntry), "plugins");
|
|
173258
173787
|
const preferred = join15(pluginsDir, "pagesPlugin.ts");
|
|
173259
173788
|
if (hasChain(preferred))
|
|
173260
173789
|
return preferred;
|
|
@@ -173265,7 +173794,7 @@ ${newLines.join(`
|
|
|
173265
173794
|
return serverEntry;
|
|
173266
173795
|
return null;
|
|
173267
173796
|
}, buildRouteContext = (input, routingFile) => {
|
|
173268
|
-
const specifier = `${toModuleSpecifier(
|
|
173797
|
+
const specifier = `${toModuleSpecifier(dirname7(routingFile), stripExtension(input.pageFileAbs))}${input.def.pageImportExtension ?? ""}`;
|
|
173269
173798
|
return {
|
|
173270
173799
|
cssAssetKey: input.cssAssetKey,
|
|
173271
173800
|
indexKey: input.indexKey,
|
|
@@ -173288,7 +173817,7 @@ ${newLines.join(`
|
|
|
173288
173817
|
};
|
|
173289
173818
|
if (!hasChain(serverEntry))
|
|
173290
173819
|
return fallback;
|
|
173291
|
-
const text =
|
|
173820
|
+
const text = readFileSync19(serverEntry, "utf-8");
|
|
173292
173821
|
const sourceFile = parse2(serverEntry, text);
|
|
173293
173822
|
const newExpr = findElysiaNew(sourceFile);
|
|
173294
173823
|
if (!newExpr)
|
|
@@ -173301,7 +173830,7 @@ ${newLines.join(`
|
|
|
173301
173830
|
start: offset,
|
|
173302
173831
|
text: `${separator}.use(${pluginName})`
|
|
173303
173832
|
});
|
|
173304
|
-
|
|
173833
|
+
writeFileSync9(serverEntry, applyEdits(text, edits), "utf-8");
|
|
173305
173834
|
return { kind: "edited", routingFile: serverEntry };
|
|
173306
173835
|
}, wireRoute = (input) => {
|
|
173307
173836
|
const routingFile = findRoutingFile(input.serverEntry);
|
|
@@ -173317,7 +173846,7 @@ ${newLines.join(`
|
|
|
173317
173846
|
${routeExpr}`
|
|
173318
173847
|
};
|
|
173319
173848
|
}
|
|
173320
|
-
const text =
|
|
173849
|
+
const text = readFileSync19(routingFile, "utf-8");
|
|
173321
173850
|
const sourceFile = parse2(routingFile, text);
|
|
173322
173851
|
const newExpr = findElysiaNew(sourceFile);
|
|
173323
173852
|
if (!newExpr) {
|
|
@@ -173337,7 +173866,7 @@ ${routeExpr}`
|
|
|
173337
173866
|
start: offset,
|
|
173338
173867
|
text: `${separator}${routeExpr}`
|
|
173339
173868
|
});
|
|
173340
|
-
|
|
173869
|
+
writeFileSync9(routingFile, applyEdits(text, edits), "utf-8");
|
|
173341
173870
|
return { kind: "edited", routingFile };
|
|
173342
173871
|
};
|
|
173343
173872
|
var init_routeWiring = __esm(() => {
|
|
@@ -173347,8 +173876,8 @@ var init_routeWiring = __esm(() => {
|
|
|
173347
173876
|
});
|
|
173348
173877
|
|
|
173349
173878
|
// src/cli/generate/generateApi.ts
|
|
173350
|
-
import { existsSync as
|
|
173351
|
-
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";
|
|
173352
173881
|
var apiPluginTemplate = (pluginName, base) => `import { Elysia } from 'elysia';
|
|
173353
173882
|
|
|
173354
173883
|
export const ${pluginName} = new Elysia()
|
|
@@ -173360,16 +173889,16 @@ export const ${pluginName} = new Elysia()
|
|
|
173360
173889
|
const pluginName = `${camel}Plugin`;
|
|
173361
173890
|
const base = `/api/${kebab}`;
|
|
173362
173891
|
const outcome = { ...emptyOutcome(), route: base };
|
|
173363
|
-
const pluginsDir = join16(
|
|
173892
|
+
const pluginsDir = join16(dirname8(project.serverEntry), "plugins");
|
|
173364
173893
|
const fileAbs = join16(pluginsDir, `${pluginName}.ts`);
|
|
173365
|
-
if (
|
|
173894
|
+
if (existsSync18(fileAbs)) {
|
|
173366
173895
|
outcome.notes.push(`${pluginName} already exists at ${fileAbs} \u2014 skipped.`);
|
|
173367
173896
|
return outcome;
|
|
173368
173897
|
}
|
|
173369
|
-
|
|
173370
|
-
|
|
173898
|
+
mkdirSync10(pluginsDir, { recursive: true });
|
|
173899
|
+
writeFileSync10(fileAbs, apiPluginTemplate(pluginName, base), "utf-8");
|
|
173371
173900
|
outcome.created.push(fileAbs);
|
|
173372
|
-
const specifier = toModuleSpecifier(
|
|
173901
|
+
const specifier = toModuleSpecifier(dirname8(project.serverEntry), fileAbs.replace(/\.ts$/, ""));
|
|
173373
173902
|
const wired = wirePluginUse(project.serverEntry, pluginName, specifier);
|
|
173374
173903
|
if (wired.kind === "edited")
|
|
173375
173904
|
outcome.updated.push(wired.routingFile);
|
|
@@ -173435,8 +173964,8 @@ var init_componentTemplates = __esm(() => {
|
|
|
173435
173964
|
});
|
|
173436
173965
|
|
|
173437
173966
|
// src/cli/generate/generateComponent.ts
|
|
173438
|
-
import { existsSync as
|
|
173439
|
-
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";
|
|
173440
173969
|
var generateComponent = (project, framework, rawName) => {
|
|
173441
173970
|
const def = frameworks2[framework];
|
|
173442
173971
|
const pascal = toPascalCase(rawName);
|
|
@@ -173448,12 +173977,12 @@ var generateComponent = (project, framework, rawName) => {
|
|
|
173448
173977
|
return outcome;
|
|
173449
173978
|
}
|
|
173450
173979
|
const fileAbs = join17(frameworkDir, "components", def.componentFile({ kebab, pascal }));
|
|
173451
|
-
if (
|
|
173980
|
+
if (existsSync19(fileAbs)) {
|
|
173452
173981
|
outcome.notes.push(`${pascal} already exists at ${fileAbs} \u2014 skipped.`);
|
|
173453
173982
|
return outcome;
|
|
173454
173983
|
}
|
|
173455
|
-
|
|
173456
|
-
|
|
173984
|
+
mkdirSync11(dirname9(fileAbs), { recursive: true });
|
|
173985
|
+
writeFileSync11(fileAbs, componentTemplates[framework]({
|
|
173457
173986
|
kebab,
|
|
173458
173987
|
pascal,
|
|
173459
173988
|
title: toTitleCase(rawName)
|
|
@@ -173467,7 +173996,7 @@ var init_generateComponent = __esm(() => {
|
|
|
173467
173996
|
});
|
|
173468
173997
|
|
|
173469
173998
|
// src/cli/generate/cssStrategy.ts
|
|
173470
|
-
import { existsSync as
|
|
173999
|
+
import { existsSync as existsSync20 } from "fs";
|
|
173471
174000
|
import { join as join18 } from "path";
|
|
173472
174001
|
var import_typescript6, CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `main {
|
|
173473
174002
|
margin: 0 auto;
|
|
@@ -173515,7 +174044,7 @@ var import_typescript6, CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `
|
|
|
173515
174044
|
return {
|
|
173516
174045
|
assetKey: sharedKey,
|
|
173517
174046
|
contents: DEFAULT_CSS,
|
|
173518
|
-
create: !
|
|
174047
|
+
create: !existsSync20(cssFileAbs2),
|
|
173519
174048
|
cssFileAbs: cssFileAbs2,
|
|
173520
174049
|
shared: true
|
|
173521
174050
|
};
|
|
@@ -173524,7 +174053,7 @@ var import_typescript6, CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `
|
|
|
173524
174053
|
return {
|
|
173525
174054
|
assetKey: `${pascal}${CSS_SUFFIX}`,
|
|
173526
174055
|
contents: DEFAULT_CSS,
|
|
173527
|
-
create: !
|
|
174056
|
+
create: !existsSync20(cssFileAbs),
|
|
173528
174057
|
cssFileAbs,
|
|
173529
174058
|
shared: false
|
|
173530
174059
|
};
|
|
@@ -173534,8 +174063,8 @@ var init_cssStrategy = __esm(() => {
|
|
|
173534
174063
|
});
|
|
173535
174064
|
|
|
173536
174065
|
// src/cli/generate/navData.ts
|
|
173537
|
-
import { existsSync as
|
|
173538
|
-
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";
|
|
173539
174068
|
var import_typescript7, NAV_DATA_TEMPLATE = `type NavItem = {
|
|
173540
174069
|
href: string;
|
|
173541
174070
|
label: string;
|
|
@@ -173573,9 +174102,9 @@ export const navData: NavItem[] = [];
|
|
|
173573
174102
|
}
|
|
173574
174103
|
return items;
|
|
173575
174104
|
}, readNavItems = (navDataPath) => {
|
|
173576
|
-
if (!
|
|
174105
|
+
if (!existsSync21(navDataPath))
|
|
173577
174106
|
return [];
|
|
173578
|
-
const text =
|
|
174107
|
+
const text = readFileSync20(navDataPath, "utf-8");
|
|
173579
174108
|
const sourceFile = import_typescript7.default.createSourceFile(navDataPath, text, import_typescript7.default.ScriptTarget.Latest, true);
|
|
173580
174109
|
const array = findNavArray(sourceFile);
|
|
173581
174110
|
return array ? parseNavItems(array) : [];
|
|
@@ -173610,22 +174139,22 @@ ${indentOf(text, array.getStart(sourceFile))}`;
|
|
|
173610
174139
|
${indent}${entry}`;
|
|
173611
174140
|
return text.slice(0, insertAt) + insertion + text.slice(insertAt);
|
|
173612
174141
|
}, upsertNavItem = (navDataPath, item) => {
|
|
173613
|
-
const created = !
|
|
174142
|
+
const created = !existsSync21(navDataPath);
|
|
173614
174143
|
if (created) {
|
|
173615
|
-
|
|
173616
|
-
|
|
174144
|
+
mkdirSync12(dirname10(navDataPath), { recursive: true });
|
|
174145
|
+
writeFileSync12(navDataPath, NAV_DATA_TEMPLATE, "utf-8");
|
|
173617
174146
|
}
|
|
173618
174147
|
const existing = readNavItems(navDataPath);
|
|
173619
174148
|
if (existing.some((candidate) => candidate.href === item.href)) {
|
|
173620
174149
|
return { changed: created, created, items: existing };
|
|
173621
174150
|
}
|
|
173622
|
-
const text =
|
|
174151
|
+
const text = readFileSync20(navDataPath, "utf-8");
|
|
173623
174152
|
const sourceFile = import_typescript7.default.createSourceFile(navDataPath, text, import_typescript7.default.ScriptTarget.Latest, true);
|
|
173624
174153
|
const array = findNavArray(sourceFile);
|
|
173625
174154
|
if (!array)
|
|
173626
174155
|
return { changed: created, created, items: existing };
|
|
173627
174156
|
const entry = `{ href: '${item.href}', label: '${item.label}' }`;
|
|
173628
|
-
|
|
174157
|
+
writeFileSync12(navDataPath, insertElement(text, array, sourceFile, entry), "utf-8");
|
|
173629
174158
|
return { changed: true, created, items: [...existing, item] };
|
|
173630
174159
|
};
|
|
173631
174160
|
var init_navData = __esm(() => {
|
|
@@ -173778,25 +174307,25 @@ var init_pageTemplates = __esm(() => {
|
|
|
173778
174307
|
|
|
173779
174308
|
// src/cli/generate/generatePage.ts
|
|
173780
174309
|
import {
|
|
173781
|
-
existsSync as
|
|
173782
|
-
mkdirSync as
|
|
173783
|
-
readFileSync as
|
|
174310
|
+
existsSync as existsSync22,
|
|
174311
|
+
mkdirSync as mkdirSync13,
|
|
174312
|
+
readFileSync as readFileSync21,
|
|
173784
174313
|
readdirSync as readdirSync5,
|
|
173785
|
-
writeFileSync as
|
|
174314
|
+
writeFileSync as writeFileSync13
|
|
173786
174315
|
} from "fs";
|
|
173787
|
-
import { dirname as
|
|
174316
|
+
import { dirname as dirname11, join as join19, relative as relative5 } from "path";
|
|
173788
174317
|
var writeNew = (path, contents) => {
|
|
173789
|
-
|
|
173790
|
-
|
|
174318
|
+
mkdirSync13(dirname11(path), { recursive: true });
|
|
174319
|
+
writeFileSync13(path, contents, "utf-8");
|
|
173791
174320
|
}, toHref = (fromDir, toFile) => {
|
|
173792
|
-
const rel =
|
|
174321
|
+
const rel = relative5(fromDir, toFile).split("\\").join("/");
|
|
173793
174322
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
173794
|
-
}, staticPageFiles = (project) => ["html", "htmx"].map((key) => project.frameworkDirs[key]).map((dir) => dir ? join19(dir, "pages") : null).filter((pagesDir) => pagesDir !== null &&
|
|
173795
|
-
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");
|
|
173796
174325
|
const synced = syncStaticNav(html, items);
|
|
173797
174326
|
if (synced === null || synced === html)
|
|
173798
174327
|
return false;
|
|
173799
|
-
|
|
174328
|
+
writeFileSync13(file, synced, "utf-8");
|
|
173800
174329
|
return true;
|
|
173801
174330
|
}, resyncStaticPages = (project, items, skipFile) => {
|
|
173802
174331
|
const updated = [];
|
|
@@ -173820,18 +174349,18 @@ var writeNew = (path, contents) => {
|
|
|
173820
174349
|
return outcome;
|
|
173821
174350
|
}
|
|
173822
174351
|
const pageFileAbs = join19(frameworkDir, "pages", def.pageFile({ kebab, pascal }));
|
|
173823
|
-
if (
|
|
174352
|
+
if (existsSync22(pageFileAbs)) {
|
|
173824
174353
|
outcome.notes.push(`${pascal} already exists at ${pageFileAbs} \u2014 skipped.`);
|
|
173825
174354
|
return outcome;
|
|
173826
174355
|
}
|
|
173827
174356
|
const routingFile = findRoutingFile(project.serverEntry);
|
|
173828
|
-
const routingText = routingFile ?
|
|
174357
|
+
const routingText = routingFile ? readFileSync21(routingFile, "utf-8") : "";
|
|
173829
174358
|
const css = planCss(routingText, project.stylesDir, pascal, kebab);
|
|
173830
174359
|
const navDataPath = join19(sharedDirFor(project, framework), "navData.ts");
|
|
173831
174360
|
const nav = upsertNavItem(navDataPath, { href: route, label: title });
|
|
173832
|
-
const navImportPath = toModuleSpecifier(
|
|
174361
|
+
const navImportPath = toModuleSpecifier(dirname11(pageFileAbs), navDataPath.replace(/\.ts$/, ""));
|
|
173833
174362
|
writeNew(pageFileAbs, pageTemplates[framework]({
|
|
173834
|
-
cssHref: toHref(
|
|
174363
|
+
cssHref: toHref(dirname11(pageFileAbs), css.cssFileAbs),
|
|
173835
174364
|
kebab,
|
|
173836
174365
|
navImportPath,
|
|
173837
174366
|
navItems: nav.items,
|
|
@@ -173881,7 +174410,7 @@ var exports_generate = {};
|
|
|
173881
174410
|
__export(exports_generate, {
|
|
173882
174411
|
runGenerate: () => runGenerate
|
|
173883
174412
|
});
|
|
173884
|
-
import { relative as
|
|
174413
|
+
import { relative as relative6 } from "path";
|
|
173885
174414
|
var SUBCOMMANDS, write = (text) => process.stdout.write(`${text}
|
|
173886
174415
|
`), fail = (message) => {
|
|
173887
174416
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -173913,7 +174442,7 @@ var SUBCOMMANDS, write = (text) => process.stdout.write(`${text}
|
|
|
173913
174442
|
return;
|
|
173914
174443
|
write(` ${colors.dim}${label}${colors.reset}`);
|
|
173915
174444
|
for (const path of paths)
|
|
173916
|
-
write(` ${
|
|
174445
|
+
write(` ${relative6(cwd, path)}`);
|
|
173917
174446
|
}, printSummary = (title, outcome, cwd) => {
|
|
173918
174447
|
for (const note of outcome.notes) {
|
|
173919
174448
|
write(`${colors.yellow}!${colors.reset} ${note}`);
|
|
@@ -173976,9 +174505,6 @@ var init_generate = __esm(() => {
|
|
|
173976
174505
|
SUBCOMMANDS = new Set(["api", "component", "page"]);
|
|
173977
174506
|
});
|
|
173978
174507
|
|
|
173979
|
-
// src/cli/config/guards.ts
|
|
173980
|
-
var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
173981
|
-
|
|
173982
174508
|
// src/cli/config/schema/serialize.ts
|
|
173983
174509
|
var isIdentifier = (key) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key), serializeValue = (value, level = 1, indent = "\t") => {
|
|
173984
174510
|
if (value === null)
|
|
@@ -173998,7 +174524,7 @@ ${value.map((item) => `${pad}${serializeValue(item, level + 1, indent)}`).join(`
|
|
|
173998
174524
|
`)}
|
|
173999
174525
|
${indent.repeat(level)}]`;
|
|
174000
174526
|
}
|
|
174001
|
-
if (
|
|
174527
|
+
if (isRecord3(value)) {
|
|
174002
174528
|
const keys = Object.keys(value);
|
|
174003
174529
|
if (keys.length === 0)
|
|
174004
174530
|
return "{}";
|
|
@@ -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;
|
|
@@ -174066,20 +174592,20 @@ var import_typescript8, lineStartOffset = (text, position) => {
|
|
|
174066
174592
|
};
|
|
174067
174593
|
}
|
|
174068
174594
|
const indent = indentBefore2(text, last.getStart(sourceFile));
|
|
174069
|
-
let
|
|
174070
|
-
const hasComma = text[
|
|
174595
|
+
let insertionIndex = last.getEnd();
|
|
174596
|
+
const hasComma = text[insertionIndex] === ",";
|
|
174071
174597
|
if (hasComma)
|
|
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
|
-
const
|
|
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,39 +175233,37 @@ 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;
|
|
174723
175249
|
}, parseSource2 = (configPath2, text) => import_typescript9.default.createSourceFile(configPath2, text, import_typescript9.default.ScriptTarget.Latest, true), findAuthSettingsObject = (sourceFile) => {
|
|
174724
|
-
|
|
174725
|
-
|
|
174726
|
-
|
|
174727
|
-
|
|
175250
|
+
const pending = [sourceFile];
|
|
175251
|
+
while (pending.length > 0) {
|
|
175252
|
+
const node = pending.pop();
|
|
175253
|
+
if (!node)
|
|
175254
|
+
continue;
|
|
174728
175255
|
const [firstArgument] = import_typescript9.default.isCallExpression(node) ? node.arguments : [];
|
|
174729
175256
|
if (import_typescript9.default.isCallExpression(node) && import_typescript9.default.isIdentifier(node.expression) && node.expression.text === "defineAuthSettings" && firstArgument && import_typescript9.default.isObjectLiteralExpression(firstArgument)) {
|
|
174730
|
-
|
|
174731
|
-
return;
|
|
175257
|
+
return firstArgument;
|
|
174732
175258
|
}
|
|
174733
175259
|
if (import_typescript9.default.isExportAssignment(node) && import_typescript9.default.isObjectLiteralExpression(node.expression)) {
|
|
174734
|
-
|
|
174735
|
-
return;
|
|
175260
|
+
return node.expression;
|
|
174736
175261
|
}
|
|
174737
|
-
|
|
174738
|
-
}
|
|
174739
|
-
|
|
174740
|
-
return found;
|
|
175262
|
+
node.forEachChild((child) => pending.push(child));
|
|
175263
|
+
}
|
|
175264
|
+
return null;
|
|
174741
175265
|
}, parseAuthSettingsObject = (configPath2) => {
|
|
174742
|
-
const text =
|
|
175266
|
+
const text = readFileSync24(configPath2, "utf-8");
|
|
174743
175267
|
return {
|
|
174744
175268
|
object: findAuthSettingsObject(parseSource2(configPath2, text)),
|
|
174745
175269
|
text
|
|
@@ -174814,13 +175338,13 @@ var init_resolveAuthSettings = __esm(() => {
|
|
|
174814
175338
|
});
|
|
174815
175339
|
|
|
174816
175340
|
// src/cli/config/auth/resolveAuthState.ts
|
|
174817
|
-
import { existsSync as
|
|
174818
|
-
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";
|
|
174819
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) => {
|
|
174820
|
-
if (!
|
|
175344
|
+
if (!existsSync25(path))
|
|
174821
175345
|
return null;
|
|
174822
175346
|
try {
|
|
174823
|
-
const parsed = JSON.parse(
|
|
175347
|
+
const parsed = JSON.parse(readFileSync25(path, "utf-8"));
|
|
174824
175348
|
return isRecord6(parsed) ? parsed : null;
|
|
174825
175349
|
} catch {
|
|
174826
175350
|
return null;
|
|
@@ -174913,7 +175437,7 @@ var import_typescript10, AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https:/
|
|
|
174913
175437
|
return { keys: new Set, providerCount: null, usesSpread: true };
|
|
174914
175438
|
}, readFileOrNull = (path) => {
|
|
174915
175439
|
try {
|
|
174916
|
-
return
|
|
175440
|
+
return readFileSync25(path, "utf-8");
|
|
174917
175441
|
} catch {
|
|
174918
175442
|
return null;
|
|
174919
175443
|
}
|
|
@@ -174925,18 +175449,17 @@ var import_typescript10, AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https:/
|
|
|
174925
175449
|
const bindings = authBindings(sourceFile);
|
|
174926
175450
|
if (bindings.size === 0)
|
|
174927
175451
|
return null;
|
|
174928
|
-
|
|
174929
|
-
|
|
174930
|
-
|
|
174931
|
-
|
|
175452
|
+
const pending = [sourceFile];
|
|
175453
|
+
while (pending.length > 0) {
|
|
175454
|
+
const node = pending.pop();
|
|
175455
|
+
if (!node)
|
|
175456
|
+
continue;
|
|
174932
175457
|
if (import_typescript10.default.isCallExpression(node) && isAuthCall(node, bindings)) {
|
|
174933
|
-
|
|
174934
|
-
return;
|
|
175458
|
+
return matchFromCall(node);
|
|
174935
175459
|
}
|
|
174936
|
-
|
|
174937
|
-
}
|
|
174938
|
-
|
|
174939
|
-
return match;
|
|
175460
|
+
node.forEachChild((child) => pending.push(child));
|
|
175461
|
+
}
|
|
175462
|
+
return null;
|
|
174940
175463
|
}, featureStatuses = (keys) => AUTH_FEATURES.map((feature) => ({
|
|
174941
175464
|
blurb: feature.blurb,
|
|
174942
175465
|
configKey: feature.configKey,
|
|
@@ -174947,7 +175470,7 @@ var import_typescript10, AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https:/
|
|
|
174947
175470
|
scaffoldable: isScaffoldableFeature(feature.id)
|
|
174948
175471
|
})), resolveAuthState = (cwd) => {
|
|
174949
175472
|
const installedVersion = installedVersionFor(cwd);
|
|
174950
|
-
const root =
|
|
175473
|
+
const root = existsSync25(join21(cwd, "src")) ? join21(cwd, "src") : cwd;
|
|
174951
175474
|
let match = null;
|
|
174952
175475
|
let setupPath = null;
|
|
174953
175476
|
for (const file of candidateFiles(root)) {
|
|
@@ -174955,7 +175478,7 @@ var import_typescript10, AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https:/
|
|
|
174955
175478
|
if (found === null)
|
|
174956
175479
|
continue;
|
|
174957
175480
|
match = found;
|
|
174958
|
-
setupPath =
|
|
175481
|
+
setupPath = relative7(cwd, resolve16(file));
|
|
174959
175482
|
break;
|
|
174960
175483
|
}
|
|
174961
175484
|
const keys = match?.keys ?? new Set;
|
|
@@ -174993,8 +175516,8 @@ var init_resolveAuthState = __esm(() => {
|
|
|
174993
175516
|
});
|
|
174994
175517
|
|
|
174995
175518
|
// src/cli/config/auth/scaffoldAuthFeature.ts
|
|
174996
|
-
import { existsSync as
|
|
174997
|
-
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";
|
|
174998
175521
|
var renderScaffold = (scaffold) => {
|
|
174999
175522
|
const importNames = [...scaffold.imports, `type ${scaffold.typeName}`];
|
|
175000
175523
|
const importLine = `import { ${importNames.join(", ")} } from '@absolutejs/auth';`;
|
|
@@ -175019,9 +175542,9 @@ ${body}
|
|
|
175019
175542
|
}, targetDir = (cwd) => {
|
|
175020
175543
|
const { setupPath } = resolveAuthState(cwd);
|
|
175021
175544
|
if (setupPath)
|
|
175022
|
-
return
|
|
175545
|
+
return dirname12(resolve17(cwd, setupPath));
|
|
175023
175546
|
const src = join22(cwd, "src");
|
|
175024
|
-
return
|
|
175547
|
+
return existsSync26(src) ? src : cwd;
|
|
175025
175548
|
}, spreadFor = (scaffold) => `import { ${scaffold.exportName} } from './${scaffold.exportName}';
|
|
175026
175549
|
// add to your auth() call:
|
|
175027
175550
|
${scaffold.configKey}: ${scaffold.exportName}`, failure2 = (message) => ({
|
|
@@ -175035,8 +175558,8 @@ ${scaffold.configKey}: ${scaffold.exportName}`, failure2 = (message) => ({
|
|
|
175035
175558
|
if (!scaffold)
|
|
175036
175559
|
return failure2(`Unknown auth feature "${id}".`);
|
|
175037
175560
|
const filePath = join22(targetDir(cwd), `${scaffold.exportName}.ts`);
|
|
175038
|
-
const relPath =
|
|
175039
|
-
if (
|
|
175561
|
+
const relPath = relative8(cwd, filePath);
|
|
175562
|
+
if (existsSync26(filePath)) {
|
|
175040
175563
|
return {
|
|
175041
175564
|
created: null,
|
|
175042
175565
|
installed: false,
|
|
@@ -175047,7 +175570,7 @@ ${scaffold.configKey}: ${scaffold.exportName}`, failure2 = (message) => ({
|
|
|
175047
175570
|
}
|
|
175048
175571
|
const install = options.install ?? true;
|
|
175049
175572
|
const installOk = install && scaffold.packages.length > 0 ? installPackages(cwd, scaffold.packages) : true;
|
|
175050
|
-
|
|
175573
|
+
writeFileSync15(filePath, renderScaffold(scaffold));
|
|
175051
175574
|
return {
|
|
175052
175575
|
created: relPath,
|
|
175053
175576
|
installed: installOk,
|
|
@@ -175063,13 +175586,13 @@ var init_scaffoldAuthFeature = __esm(() => {
|
|
|
175063
175586
|
});
|
|
175064
175587
|
|
|
175065
175588
|
// src/cli/htmx/install.ts
|
|
175066
|
-
import { existsSync as
|
|
175589
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync14, readFileSync as readFileSync26, writeFileSync as writeFileSync16 } from "fs";
|
|
175067
175590
|
import { join as join23 } from "path";
|
|
175068
175591
|
var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
|
|
175069
175592
|
join23(import.meta.dir, "htmx.min.js"),
|
|
175070
175593
|
join23(import.meta.dir, "htmx", "htmx.min.js"),
|
|
175071
175594
|
join23(import.meta.dir, "..", "htmx", "htmx.min.js")
|
|
175072
|
-
].find((path) =>
|
|
175595
|
+
].find((path) => existsSync27(path)) ?? null, detectHtmxVersion = (content) => {
|
|
175073
175596
|
const match = content.match(/version:"([0-9.]+)"/);
|
|
175074
175597
|
return match ? match[1] : null;
|
|
175075
175598
|
}, fetchHtmx = async (version2) => {
|
|
@@ -175081,16 +175604,16 @@ var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
|
|
|
175081
175604
|
return response.text();
|
|
175082
175605
|
}, installedHtmxVersion = (htmxDir) => {
|
|
175083
175606
|
const file = join23(htmxDir, "htmx.min.js");
|
|
175084
|
-
if (!
|
|
175607
|
+
if (!existsSync27(file))
|
|
175085
175608
|
return null;
|
|
175086
|
-
return detectHtmxVersion(
|
|
175609
|
+
return detectHtmxVersion(readFileSync26(file, "utf-8"));
|
|
175087
175610
|
}, readVendoredHtmx = () => {
|
|
175088
175611
|
const file = vendoredHtmxFile();
|
|
175089
|
-
return file ?
|
|
175612
|
+
return file ? readFileSync26(file, "utf-8") : null;
|
|
175090
175613
|
}, writeHtmx = (htmxDir, content) => {
|
|
175091
|
-
|
|
175614
|
+
mkdirSync14(htmxDir, { recursive: true });
|
|
175092
175615
|
const file = join23(htmxDir, "htmx.min.js");
|
|
175093
|
-
|
|
175616
|
+
writeFileSync16(file, content, "utf-8");
|
|
175094
175617
|
return file;
|
|
175095
175618
|
};
|
|
175096
175619
|
var init_install = () => {};
|
|
@@ -175100,7 +175623,7 @@ var exports_add = {};
|
|
|
175100
175623
|
__export(exports_add, {
|
|
175101
175624
|
runAdd: () => runAdd
|
|
175102
175625
|
});
|
|
175103
|
-
import { dirname as
|
|
175626
|
+
import { dirname as dirname13, join as join24, relative as relative9 } from "path";
|
|
175104
175627
|
var write2 = (text) => process.stdout.write(`${text}
|
|
175105
175628
|
`), fail2 = (message) => {
|
|
175106
175629
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -175111,11 +175634,11 @@ var write2 = (text) => process.stdout.write(`${text}
|
|
|
175111
175634
|
return;
|
|
175112
175635
|
write2(` ${colors.dim}${label}${colors.reset}`);
|
|
175113
175636
|
for (const path of paths)
|
|
175114
|
-
write2(` ${
|
|
175637
|
+
write2(` ${relative9(cwd, path)}`);
|
|
175115
175638
|
}, frontendRoot = (project, cwd) => {
|
|
175116
175639
|
const [firstKey] = configuredFrameworks(project);
|
|
175117
175640
|
const firstDir = firstKey ? project.frameworkDirs[firstKey] : undefined;
|
|
175118
|
-
return firstDir ?
|
|
175641
|
+
return firstDir ? dirname13(firstDir) : join24(cwd, "src", "frontend");
|
|
175119
175642
|
}, addIntegrationCli = (id, install) => {
|
|
175120
175643
|
const result = addIntegration(process.cwd(), id, { install });
|
|
175121
175644
|
if (!result.ok) {
|
|
@@ -175180,7 +175703,7 @@ var write2 = (text) => process.stdout.write(`${text}
|
|
|
175180
175703
|
return;
|
|
175181
175704
|
}
|
|
175182
175705
|
const dirAbs = join24(frontendRoot(project, cwd), framework);
|
|
175183
|
-
const dirRel = `./${
|
|
175706
|
+
const dirRel = `./${relative9(cwd, dirAbs).split("\\").join("/")}`;
|
|
175184
175707
|
let depNote = "Skipped dependency install (--no-install).";
|
|
175185
175708
|
if (!noInstall) {
|
|
175186
175709
|
write2(`${colors.dim}Installing ${frameworks2[framework].label} dependencies\u2026${colors.reset}`);
|
|
@@ -175249,8 +175772,8 @@ var exports_analyze = {};
|
|
|
175249
175772
|
__export(exports_analyze, {
|
|
175250
175773
|
runAnalyze: () => runAnalyze
|
|
175251
175774
|
});
|
|
175252
|
-
import { existsSync as
|
|
175253
|
-
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";
|
|
175254
175777
|
var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_WIDTH = 16, SIZE_WIDTH = 12, CHANGE_WIDTH = 10, CATEGORY_ORDER, categoryOf = (key) => {
|
|
175255
175778
|
if (key.startsWith("Island"))
|
|
175256
175779
|
return "Islands";
|
|
@@ -175271,9 +175794,9 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
|
|
|
175271
175794
|
}
|
|
175272
175795
|
}, readSizes = (manifestDir) => {
|
|
175273
175796
|
const manifestPath = join25(manifestDir, "manifest.json");
|
|
175274
|
-
if (!
|
|
175797
|
+
if (!existsSync28(manifestPath))
|
|
175275
175798
|
return null;
|
|
175276
|
-
const manifest = JSON.parse(
|
|
175799
|
+
const manifest = JSON.parse(readFileSync27(manifestPath, "utf-8"));
|
|
175277
175800
|
const sizes = {};
|
|
175278
175801
|
for (const [key, value] of Object.entries(manifest)) {
|
|
175279
175802
|
sizes[key] = fileSize2(join25(manifestDir, value.replace(/^\//, "")));
|
|
@@ -175281,10 +175804,10 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
|
|
|
175281
175804
|
return sizes;
|
|
175282
175805
|
}, readBaseline = (cwd) => {
|
|
175283
175806
|
const path = join25(cwd, BASELINE_FILE);
|
|
175284
|
-
if (!
|
|
175807
|
+
if (!existsSync28(path))
|
|
175285
175808
|
return null;
|
|
175286
175809
|
try {
|
|
175287
|
-
const parsed = JSON.parse(
|
|
175810
|
+
const parsed = JSON.parse(readFileSync27(path, "utf-8"));
|
|
175288
175811
|
return parsed;
|
|
175289
175812
|
} catch {
|
|
175290
175813
|
return null;
|
|
@@ -175362,14 +175885,14 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
|
|
|
175362
175885
|
const config = await loadConfig(configIndex >= 0 ? args[configIndex + 1] : undefined);
|
|
175363
175886
|
const outdirIndex = args.indexOf("--outdir");
|
|
175364
175887
|
const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
|
|
175365
|
-
const sizes = readSizes(
|
|
175888
|
+
const sizes = readSizes(resolve18(cwd, outdir ?? "build"));
|
|
175366
175889
|
if (sizes === null) {
|
|
175367
175890
|
process.stdout.write(`${colors.dim}No build found. Run \`absolute build\` first.${colors.reset}
|
|
175368
175891
|
`);
|
|
175369
175892
|
return;
|
|
175370
175893
|
}
|
|
175371
175894
|
if (args.includes("--save")) {
|
|
175372
|
-
|
|
175895
|
+
writeFileSync17(join25(cwd, BASELINE_FILE), `${JSON.stringify(sizes, null, 2)}
|
|
175373
175896
|
`);
|
|
175374
175897
|
process.stdout.write(`${colors.green}\u2713${colors.reset} Saved size baseline (${Object.keys(sizes).length} entries) to ${BASELINE_FILE}
|
|
175375
175898
|
`);
|
|
@@ -175615,8 +176138,8 @@ var exports_remove = {};
|
|
|
175615
176138
|
__export(exports_remove, {
|
|
175616
176139
|
runRemove: () => runRemove
|
|
175617
176140
|
});
|
|
175618
|
-
import { existsSync as
|
|
175619
|
-
import { relative as
|
|
176141
|
+
import { existsSync as existsSync29, readFileSync as readFileSync28 } from "fs";
|
|
176142
|
+
import { relative as relative10 } from "path";
|
|
175620
176143
|
var write3 = (text) => process.stdout.write(`${text}
|
|
175621
176144
|
`), fail3 = (message) => {
|
|
175622
176145
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -175626,10 +176149,10 @@ var write3 = (text) => process.stdout.write(`${text}
|
|
|
175626
176149
|
const candidates = [findRoutingFile(serverEntry), serverEntry];
|
|
175627
176150
|
const seen = new Set;
|
|
175628
176151
|
return candidates.filter((file) => {
|
|
175629
|
-
if (file === null || seen.has(file) || !
|
|
176152
|
+
if (file === null || seen.has(file) || !existsSync29(file))
|
|
175630
176153
|
return false;
|
|
175631
176154
|
seen.add(file);
|
|
175632
|
-
return
|
|
176155
|
+
return readFileSync28(file, "utf-8").includes(handler);
|
|
175633
176156
|
});
|
|
175634
176157
|
}, runRemove = async (args) => {
|
|
175635
176158
|
const [framework] = args.filter((arg) => !arg.startsWith("--"));
|
|
@@ -175665,10 +176188,10 @@ var write3 = (text) => process.stdout.write(`${text}
|
|
|
175665
176188
|
}
|
|
175666
176189
|
write3(`${colors.green}\u2713${colors.reset} Removed ${framework}Directory from absolute.config.ts
|
|
175667
176190
|
`);
|
|
175668
|
-
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.`);
|
|
175669
176192
|
const refs = referencingFiles(project.serverEntry, HANDLER_NAME[framework]);
|
|
175670
176193
|
for (const file of refs) {
|
|
175671
|
-
write3(` ${colors.yellow}Still references${colors.reset} ${
|
|
176194
|
+
write3(` ${colors.yellow}Still references${colors.reset} ${relative10(cwd, file)} (calls ${HANDLER_NAME[framework]})`);
|
|
175672
176195
|
}
|
|
175673
176196
|
const deps = frameworkDependencyNames(framework);
|
|
175674
176197
|
if (prune && deps.length > 0) {
|
|
@@ -175756,15 +176279,15 @@ __export(exports_env, {
|
|
|
175756
176279
|
runEnv: () => runEnv,
|
|
175757
176280
|
collectEnvVars: () => collectEnvVars
|
|
175758
176281
|
});
|
|
175759
|
-
import { existsSync as
|
|
176282
|
+
import { existsSync as existsSync30, readFileSync as readFileSync29 } from "fs";
|
|
175760
176283
|
import { join as join26 } from "path";
|
|
175761
176284
|
var {env: env3, Glob: Glob3 } = globalThis.Bun;
|
|
175762
|
-
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 () => {
|
|
175763
176286
|
const scans = scanPatterns().map((pattern) => Array.fromAsync(new Glob3(pattern).scan({ cwd: process.cwd() })));
|
|
175764
176287
|
const files = (await Promise.all(scans)).flat();
|
|
175765
176288
|
const usage = new Map;
|
|
175766
176289
|
files.forEach((file) => {
|
|
175767
|
-
keysInFile(
|
|
176290
|
+
keysInFile(readFileSync29(file, "utf-8")).forEach((key) => {
|
|
175768
176291
|
usage.set(key, [...usage.get(key) ?? [], file]);
|
|
175769
176292
|
});
|
|
175770
176293
|
});
|
|
@@ -175825,7 +176348,7 @@ __export(exports_db, {
|
|
|
175825
176348
|
conflictClause: () => conflictClause,
|
|
175826
176349
|
chunkRows: () => chunkRows
|
|
175827
176350
|
});
|
|
175828
|
-
import { existsSync as
|
|
176351
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync15, readFileSync as readFileSync30, writeFileSync as writeFileSync18 } from "fs";
|
|
175829
176352
|
import { join as join27 } from "path";
|
|
175830
176353
|
var {env: env4, spawn: spawn2, SQL } = globalThis.Bun;
|
|
175831
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) => {
|
|
@@ -175937,18 +176460,18 @@ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA
|
|
|
175937
176460
|
v: BACKUP_FORMAT_VERSION
|
|
175938
176461
|
};
|
|
175939
176462
|
const dir = options.out ?? join27(process.cwd(), "backups");
|
|
175940
|
-
|
|
176463
|
+
mkdirSync15(dir, { recursive: true });
|
|
175941
176464
|
const json = JSON.stringify(payload, (_, value) => typeof value === "bigint" ? value.toString() : value);
|
|
175942
176465
|
const file = join27(dir, `backup-${payload.at.replace(/[:.]/g, "-")}.json`);
|
|
175943
|
-
|
|
175944
|
-
|
|
176466
|
+
writeFileSync18(file, json);
|
|
176467
|
+
writeFileSync18(join27(dir, "latest.json"), json);
|
|
175945
176468
|
const total = chosen.reduce((sum, name) => sum + (tables[name]?.length ?? 0), 0);
|
|
175946
176469
|
console.log(paint(`\u2713 backup \u2192 ${file}`, colors.green));
|
|
175947
176470
|
console.log(paint(` ${chosen.length} tables, ${total} rows`, colors.dim));
|
|
175948
176471
|
}, runRestore = async (file, options) => {
|
|
175949
|
-
if (!
|
|
176472
|
+
if (!existsSync31(file))
|
|
175950
176473
|
throw new Error(`Backup not found: ${file}`);
|
|
175951
|
-
const payload = JSON.parse(
|
|
176474
|
+
const payload = JSON.parse(readFileSync30(file, "utf-8"));
|
|
175952
176475
|
const names = Object.keys(payload.tables).filter((name) => keepTable(name, options));
|
|
175953
176476
|
const sql = new SQL(options.url);
|
|
175954
176477
|
const order = dependencyOrder(names, await foreignLinks(sql));
|
|
@@ -175970,7 +176493,7 @@ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA
|
|
|
175970
176493
|
const total = order.reduce((sum, name) => sum + (payload.tables[name]?.length ?? 0), 0);
|
|
175971
176494
|
console.log(paint(`\u2713 restored ${order.length} tables, ${total} rows (idempotent upsert by primary key)`, colors.green));
|
|
175972
176495
|
}, runSeed = async (entry) => {
|
|
175973
|
-
const target = entry ?? SEED_CANDIDATES.find((candidate) =>
|
|
176496
|
+
const target = entry ?? SEED_CANDIDATES.find((candidate) => existsSync31(join27(process.cwd(), candidate)));
|
|
175974
176497
|
if (target === undefined)
|
|
175975
176498
|
throw new Error(`No seed script found (looked for ${SEED_CANDIDATES.join(", ")}). Pass a path: absolute db seed <file>.`);
|
|
175976
176499
|
console.log(paint(`seeding via ${target}\u2026`, colors.cyan));
|
|
@@ -176031,7 +176554,7 @@ __export(exports_logs, {
|
|
|
176031
176554
|
});
|
|
176032
176555
|
import {
|
|
176033
176556
|
closeSync as closeSync2,
|
|
176034
|
-
existsSync as
|
|
176557
|
+
existsSync as existsSync32,
|
|
176035
176558
|
openSync as openSync4,
|
|
176036
176559
|
readSync as readSync2,
|
|
176037
176560
|
statSync as statSync4,
|
|
@@ -176098,7 +176621,7 @@ var DEFAULT_LINES = 40, POLL_MS = 250, LINES_FLAG_SPAN = 2, readFrom = (path, st
|
|
|
176098
176621
|
printAvailable(instances);
|
|
176099
176622
|
return;
|
|
176100
176623
|
}
|
|
176101
|
-
if (match.logFile === null || !
|
|
176624
|
+
if (match.logFile === null || !existsSync32(match.logFile)) {
|
|
176102
176625
|
printDim3(`"${name}" has no captured log (untracked, or started outside the CLI).`);
|
|
176103
176626
|
return;
|
|
176104
176627
|
}
|
|
@@ -176118,24 +176641,24 @@ var init_logs = __esm(() => {
|
|
|
176118
176641
|
|
|
176119
176642
|
// src/cli/typeGraphCoherence.ts
|
|
176120
176643
|
import {
|
|
176121
|
-
existsSync as
|
|
176122
|
-
readFileSync as
|
|
176644
|
+
existsSync as existsSync33,
|
|
176645
|
+
readFileSync as readFileSync31,
|
|
176123
176646
|
realpathSync,
|
|
176124
|
-
rmSync as
|
|
176125
|
-
writeFileSync as
|
|
176647
|
+
rmSync as rmSync6,
|
|
176648
|
+
writeFileSync as writeFileSync19
|
|
176126
176649
|
} from "fs";
|
|
176127
176650
|
import { createRequire } from "module";
|
|
176128
|
-
import { dirname as
|
|
176651
|
+
import { dirname as dirname14, join as join28, resolve as resolve19, sep } from "path";
|
|
176129
176652
|
var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
176130
176653
|
try {
|
|
176131
|
-
const parsed = JSON.parse(
|
|
176132
|
-
return
|
|
176654
|
+
const parsed = JSON.parse(readFileSync31(path, "utf-8"));
|
|
176655
|
+
return isRecord3(parsed) ? parsed : null;
|
|
176133
176656
|
} catch {
|
|
176134
176657
|
return null;
|
|
176135
176658
|
}
|
|
176136
176659
|
}, dependencyRecord = (manifest, field) => {
|
|
176137
176660
|
const value = Reflect.get(manifest, field);
|
|
176138
|
-
return
|
|
176661
|
+
return isRecord3(value) ? value : {};
|
|
176139
176662
|
}, dependencyNames = (manifest) => [
|
|
176140
176663
|
...new Set(DEPENDENCY_FIELDS.flatMap((field) => Object.keys(dependencyRecord(manifest, field))))
|
|
176141
176664
|
], declaresPackage = (manifest, name) => DEPENDENCY_FIELDS.some((field) => Object.hasOwn(dependencyRecord(manifest, field), name)), manifestName = (manifest, fallback) => {
|
|
@@ -176145,13 +176668,13 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176145
176668
|
const version2 = Reflect.get(manifest, "version");
|
|
176146
176669
|
return typeof version2 === "string" ? version2 : "unknown";
|
|
176147
176670
|
}, packageJsonFromEntry = (entry, expectedName) => {
|
|
176148
|
-
let directory =
|
|
176671
|
+
let directory = dirname14(entry);
|
|
176149
176672
|
for (;; ) {
|
|
176150
176673
|
const candidate = join28(directory, "package.json");
|
|
176151
176674
|
const manifest = readManifest(candidate);
|
|
176152
176675
|
if (manifest && manifestName(manifest, "") === expectedName)
|
|
176153
176676
|
return candidate;
|
|
176154
|
-
const parent =
|
|
176677
|
+
const parent = dirname14(directory);
|
|
176155
176678
|
if (parent === directory)
|
|
176156
176679
|
return null;
|
|
176157
176680
|
directory = parent;
|
|
@@ -176167,25 +176690,25 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176167
176690
|
}
|
|
176168
176691
|
}
|
|
176169
176692
|
}, findInstallRoot = (cwd) => {
|
|
176170
|
-
let directory =
|
|
176693
|
+
let directory = resolve19(cwd);
|
|
176171
176694
|
for (;; ) {
|
|
176172
|
-
if (
|
|
176695
|
+
if (existsSync33(join28(directory, "bun.lock")) || existsSync33(join28(directory, "bun.lockb"))) {
|
|
176173
176696
|
return directory;
|
|
176174
176697
|
}
|
|
176175
|
-
const parent =
|
|
176698
|
+
const parent = dirname14(directory);
|
|
176176
176699
|
if (parent === directory)
|
|
176177
|
-
return
|
|
176700
|
+
return resolve19(cwd);
|
|
176178
176701
|
directory = parent;
|
|
176179
176702
|
}
|
|
176180
176703
|
}, findProjectManifest = (cwd, installRoot) => {
|
|
176181
|
-
let directory =
|
|
176704
|
+
let directory = resolve19(cwd);
|
|
176182
176705
|
for (;; ) {
|
|
176183
176706
|
const candidate = join28(directory, "package.json");
|
|
176184
|
-
if (
|
|
176707
|
+
if (existsSync33(candidate))
|
|
176185
176708
|
return candidate;
|
|
176186
176709
|
if (directory === installRoot)
|
|
176187
176710
|
return join28(installRoot, "package.json");
|
|
176188
|
-
const parent =
|
|
176711
|
+
const parent = dirname14(directory);
|
|
176189
176712
|
if (parent === directory)
|
|
176190
176713
|
return join28(installRoot, "package.json");
|
|
176191
176714
|
directory = parent;
|
|
@@ -176266,7 +176789,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176266
176789
|
if (!manifest)
|
|
176267
176790
|
return [];
|
|
176268
176791
|
const existing = Reflect.get(manifest, "overrides");
|
|
176269
|
-
const overrides =
|
|
176792
|
+
const overrides = isRecord3(existing) ? existing : {};
|
|
176270
176793
|
const changes = [];
|
|
176271
176794
|
const rootName = manifestName(manifest, "<workspace>");
|
|
176272
176795
|
for (const duplicate of duplicates) {
|
|
@@ -176278,7 +176801,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176278
176801
|
}
|
|
176279
176802
|
if (changes.length > 0) {
|
|
176280
176803
|
Reflect.set(manifest, "overrides", overrides);
|
|
176281
|
-
|
|
176804
|
+
writeFileSync19(manifestPath, `${JSON.stringify(manifest, null, "\t")}
|
|
176282
176805
|
`);
|
|
176283
176806
|
}
|
|
176284
176807
|
return changes;
|
|
@@ -176295,7 +176818,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
176295
176818
|
for (const stalePath of stalePaths) {
|
|
176296
176819
|
if (!stalePath.startsWith(installPrefix) || !stalePath.includes(nodeModulesSegment))
|
|
176297
176820
|
continue;
|
|
176298
|
-
|
|
176821
|
+
rmSync6(dirname14(stalePath), { force: true, recursive: true });
|
|
176299
176822
|
removed.push(stalePath);
|
|
176300
176823
|
}
|
|
176301
176824
|
return removed;
|
|
@@ -176322,7 +176845,7 @@ var exports_doctor = {};
|
|
|
176322
176845
|
__export(exports_doctor, {
|
|
176323
176846
|
runDoctor: () => runDoctor
|
|
176324
176847
|
});
|
|
176325
|
-
import { existsSync as
|
|
176848
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync16, readFileSync as readFileSync32, writeFileSync as writeFileSync20 } from "fs";
|
|
176326
176849
|
import { createRequire as createRequire2 } from "module";
|
|
176327
176850
|
import { arch as arch4, platform as platform5 } from "os";
|
|
176328
176851
|
import { join as join29 } from "path";
|
|
@@ -176360,7 +176883,7 @@ var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
|
|
|
176360
176883
|
return [];
|
|
176361
176884
|
const label = `${field.replace("Directory", "")} pages`;
|
|
176362
176885
|
return [
|
|
176363
|
-
|
|
176886
|
+
existsSync34(join29(process.cwd(), dir)) ? check("ok", label, dir) : check("fail", label, `${dir} (missing)`)
|
|
176364
176887
|
];
|
|
176365
176888
|
}), envCheck = async () => {
|
|
176366
176889
|
const vars = await collectEnvVars();
|
|
@@ -176422,9 +176945,9 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
176422
176945
|
const fixes = [];
|
|
176423
176946
|
for (const field of FRAMEWORK_FIELDS2) {
|
|
176424
176947
|
const dir = readString(config, field);
|
|
176425
|
-
if (dir === undefined ||
|
|
176948
|
+
if (dir === undefined || existsSync34(join29(cwd, dir)))
|
|
176426
176949
|
continue;
|
|
176427
|
-
|
|
176950
|
+
mkdirSync16(join29(cwd, dir, "pages"), { recursive: true });
|
|
176428
176951
|
fixes.push(`created ${dir}/pages`);
|
|
176429
176952
|
}
|
|
176430
176953
|
return fixes;
|
|
@@ -176433,7 +176956,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
176433
176956
|
if (missing.length === 0)
|
|
176434
176957
|
return null;
|
|
176435
176958
|
const envExample = join29(cwd, ".env.example");
|
|
176436
|
-
const existing =
|
|
176959
|
+
const existing = existsSync34(envExample) ? readFileSync32(envExample, "utf-8") : "";
|
|
176437
176960
|
const existingKeys = new Set(existing.split(`
|
|
176438
176961
|
`).map((line) => line.split("=")[0]?.trim()));
|
|
176439
176962
|
const toAdd = missing.filter((entry) => !existingKeys.has(entry.key));
|
|
@@ -176442,7 +176965,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
176442
176965
|
const prefix = existing === "" || existing.endsWith(`
|
|
176443
176966
|
`) ? existing : `${existing}
|
|
176444
176967
|
`;
|
|
176445
|
-
|
|
176968
|
+
writeFileSync20(envExample, `${prefix}${toAdd.map((entry) => `${entry.key}=`).join(`
|
|
176446
176969
|
`)}
|
|
176447
176970
|
`);
|
|
176448
176971
|
return `added ${toAdd.length} key(s) to .env.example`;
|
|
@@ -176807,10 +177330,10 @@ var init_inspect = __esm(() => {
|
|
|
176807
177330
|
});
|
|
176808
177331
|
|
|
176809
177332
|
// src/build/scanEntryPoints.ts
|
|
176810
|
-
import { existsSync as
|
|
177333
|
+
import { existsSync as existsSync35 } from "fs";
|
|
176811
177334
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
176812
177335
|
var scanEntryPoints = async (dir, pattern) => {
|
|
176813
|
-
if (!
|
|
177336
|
+
if (!existsSync35(dir))
|
|
176814
177337
|
return [];
|
|
176815
177338
|
const entryPaths = [];
|
|
176816
177339
|
const glob = new Glob4(pattern);
|
|
@@ -176892,8 +177415,8 @@ var init_sourceMetadata = __esm(() => {
|
|
|
176892
177415
|
});
|
|
176893
177416
|
|
|
176894
177417
|
// src/islands/pageMetadata.ts
|
|
176895
|
-
import { readFileSync as
|
|
176896
|
-
import { dirname as
|
|
177418
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
177419
|
+
import { dirname as dirname15, resolve as resolve20 } from "path";
|
|
176897
177420
|
var pagePatterns, getPageDirs = (config) => [
|
|
176898
177421
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
176899
177422
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -176913,8 +177436,8 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
176913
177436
|
const source = definition.buildReference?.source;
|
|
176914
177437
|
if (!source)
|
|
176915
177438
|
continue;
|
|
176916
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
176917
|
-
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));
|
|
176918
177441
|
}
|
|
176919
177442
|
return lookup;
|
|
176920
177443
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage2) => {
|
|
@@ -176927,13 +177450,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
176927
177450
|
const pattern = pagePatterns[entry.framework];
|
|
176928
177451
|
if (!pattern)
|
|
176929
177452
|
return;
|
|
176930
|
-
const files = await scanEntryPoints(
|
|
177453
|
+
const files = await scanEntryPoints(resolve20(entry.dir), pattern);
|
|
176931
177454
|
for (const filePath of files) {
|
|
176932
|
-
const source =
|
|
177455
|
+
const source = readFileSync33(filePath, "utf-8");
|
|
176933
177456
|
const islands = extractIslandUsagesFromSource(source);
|
|
176934
|
-
pageMetadata.set(
|
|
177457
|
+
pageMetadata.set(resolve20(filePath), {
|
|
176935
177458
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
176936
|
-
pagePath:
|
|
177459
|
+
pagePath: resolve20(filePath)
|
|
176937
177460
|
});
|
|
176938
177461
|
}
|
|
176939
177462
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -176962,14 +177485,14 @@ var exports_islands = {};
|
|
|
176962
177485
|
__export(exports_islands, {
|
|
176963
177486
|
runIslands: () => runIslands
|
|
176964
177487
|
});
|
|
176965
|
-
import { existsSync as
|
|
176966
|
-
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";
|
|
176967
177490
|
var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
|
|
176968
177491
|
`), hostFrameworkOf = (pagePath, cwd, config) => {
|
|
176969
|
-
const resolved =
|
|
177492
|
+
const resolved = resolve21(cwd, pagePath);
|
|
176970
177493
|
for (const [framework, key] of Object.entries(FRAMEWORK_DIR_KEY)) {
|
|
176971
177494
|
const dir = config[key];
|
|
176972
|
-
if (typeof dir === "string" && resolved.startsWith(
|
|
177495
|
+
if (typeof dir === "string" && resolved.startsWith(resolve21(cwd, dir))) {
|
|
176973
177496
|
return framework;
|
|
176974
177497
|
}
|
|
176975
177498
|
}
|
|
@@ -176982,9 +177505,9 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
176982
177505
|
}
|
|
176983
177506
|
}, readManifestSizes2 = (manifestDir) => {
|
|
176984
177507
|
const manifestPath = join30(manifestDir, "manifest.json");
|
|
176985
|
-
if (!
|
|
177508
|
+
if (!existsSync36(manifestPath))
|
|
176986
177509
|
return null;
|
|
176987
|
-
const manifest = JSON.parse(
|
|
177510
|
+
const manifest = JSON.parse(readFileSync34(manifestPath, "utf-8"));
|
|
176988
177511
|
const sizes = new Map;
|
|
176989
177512
|
for (const [key, value] of Object.entries(manifest)) {
|
|
176990
177513
|
sizes.set(key, fileSize3(join30(manifestDir, value.replace(/^\//, ""))));
|
|
@@ -176994,7 +177517,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
176994
177517
|
const registryPath = config.islands?.registry;
|
|
176995
177518
|
if (typeof registryPath !== "string")
|
|
176996
177519
|
return null;
|
|
176997
|
-
const buildInfo = await loadIslandRegistryBuildInfo(
|
|
177520
|
+
const buildInfo = await loadIslandRegistryBuildInfo(resolve21(cwd, registryPath));
|
|
176998
177521
|
const pageMetadata = await loadPageIslandMetadata(config);
|
|
176999
177522
|
const usages = [...pageMetadata.values()].flatMap((meta) => meta.islands.map((island) => ({ ...island, page: meta.pagePath })));
|
|
177000
177523
|
return buildInfo.definitions.map((definition) => {
|
|
@@ -177004,7 +177527,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177004
177527
|
crossFramework: hostFramework !== null && hostFramework !== definition.framework,
|
|
177005
177528
|
hostFramework,
|
|
177006
177529
|
hydrate: usage2.hydrate ?? "load",
|
|
177007
|
-
page:
|
|
177530
|
+
page: relative11(cwd, resolve21(cwd, usage2.page))
|
|
177008
177531
|
};
|
|
177009
177532
|
});
|
|
177010
177533
|
const key = getIslandManifestKey(definition.framework, definition.component);
|
|
@@ -177043,7 +177566,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177043
177566
|
` ${color}\u2B21${colors.reset} ${colors.bold}${island.component}${colors.reset} ${meta}${sizeText}`
|
|
177044
177567
|
];
|
|
177045
177568
|
if (island.source) {
|
|
177046
|
-
lines.push(` ${colors.dim}${
|
|
177569
|
+
lines.push(` ${colors.dim}${relative11(cwd, island.source)}${colors.reset}`);
|
|
177047
177570
|
}
|
|
177048
177571
|
if (pages.length === 0) {
|
|
177049
177572
|
lines.push(` ${colors.dim}(registered but not mounted on any page)${colors.reset}`);
|
|
@@ -177073,7 +177596,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
177073
177596
|
}
|
|
177074
177597
|
const outdirIndex = args.indexOf("--outdir");
|
|
177075
177598
|
const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
|
|
177076
|
-
const sizes = args.includes("--sizes") ? readManifestSizes2(
|
|
177599
|
+
const sizes = args.includes("--sizes") ? readManifestSizes2(resolve21(cwd, outdir ?? "build")) : null;
|
|
177077
177600
|
const islands = await collectIslands(cwd, config, sizes);
|
|
177078
177601
|
if (islands === null) {
|
|
177079
177602
|
printDim6('No island registry configured. Set `islands: { registry: "..." }` in absolute.config.ts.');
|
|
@@ -177122,13 +177645,13 @@ var init_islands2 = __esm(() => {
|
|
|
177122
177645
|
});
|
|
177123
177646
|
|
|
177124
177647
|
// src/build/externalAssetPlugin.ts
|
|
177125
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
177126
|
-
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";
|
|
177127
177650
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
177128
177651
|
name: "absolute-external-asset",
|
|
177129
177652
|
setup(bld) {
|
|
177130
177653
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
177131
|
-
const skipRoots = userSourceRoots.map((root) =>
|
|
177654
|
+
const skipRoots = userSourceRoots.map((root) => resolve22(root));
|
|
177132
177655
|
const isUserSource = (path) => skipRoots.some((root) => path.startsWith(`${root}/`));
|
|
177133
177656
|
bld.onLoad({ filter: /\.[mc]?[jt]sx?$/ }, async (args) => {
|
|
177134
177657
|
if (isUserSource(args.path))
|
|
@@ -177138,20 +177661,20 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
177138
177661
|
return;
|
|
177139
177662
|
urlPattern.lastIndex = 0;
|
|
177140
177663
|
let match;
|
|
177141
|
-
const sourceDir =
|
|
177664
|
+
const sourceDir = dirname16(args.path);
|
|
177142
177665
|
while ((match = urlPattern.exec(source)) !== null) {
|
|
177143
177666
|
const relPath = match[1];
|
|
177144
177667
|
if (!relPath)
|
|
177145
177668
|
continue;
|
|
177146
|
-
const assetPath =
|
|
177147
|
-
if (!
|
|
177669
|
+
const assetPath = resolve22(sourceDir, relPath);
|
|
177670
|
+
if (!existsSync37(assetPath))
|
|
177148
177671
|
continue;
|
|
177149
177672
|
if (!statSync6(assetPath).isFile())
|
|
177150
177673
|
continue;
|
|
177151
177674
|
const targetPath = join31(outDir, basename6(assetPath));
|
|
177152
|
-
if (
|
|
177675
|
+
if (existsSync37(targetPath))
|
|
177153
177676
|
continue;
|
|
177154
|
-
|
|
177677
|
+
mkdirSync17(dirname16(targetPath), { recursive: true });
|
|
177155
177678
|
copyFileSync2(assetPath, targetPath);
|
|
177156
177679
|
}
|
|
177157
177680
|
return;
|
|
@@ -177169,23 +177692,23 @@ __export(exports_compile, {
|
|
|
177169
177692
|
var {env: env5 } = globalThis.Bun;
|
|
177170
177693
|
import {
|
|
177171
177694
|
cpSync,
|
|
177172
|
-
existsSync as
|
|
177173
|
-
mkdirSync as
|
|
177695
|
+
existsSync as existsSync38,
|
|
177696
|
+
mkdirSync as mkdirSync18,
|
|
177174
177697
|
readdirSync as readdirSync7,
|
|
177175
|
-
readFileSync as
|
|
177176
|
-
rmSync as
|
|
177698
|
+
readFileSync as readFileSync35,
|
|
177699
|
+
rmSync as rmSync7,
|
|
177177
177700
|
statSync as statSync7,
|
|
177178
177701
|
unlinkSync as unlinkSync4,
|
|
177179
|
-
writeFileSync as
|
|
177702
|
+
writeFileSync as writeFileSync21
|
|
177180
177703
|
} from "fs";
|
|
177181
177704
|
import { createRequire as createRequire3 } from "module";
|
|
177182
177705
|
import {
|
|
177183
177706
|
basename as basename7,
|
|
177184
|
-
dirname as
|
|
177707
|
+
dirname as dirname17,
|
|
177185
177708
|
isAbsolute as isAbsolute2,
|
|
177186
177709
|
join as join32,
|
|
177187
|
-
relative as
|
|
177188
|
-
resolve as
|
|
177710
|
+
relative as relative12,
|
|
177711
|
+
resolve as resolve23
|
|
177189
177712
|
} from "path";
|
|
177190
177713
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
177191
177714
|
const resolvedVersion = version2 || "unknown";
|
|
@@ -177207,16 +177730,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177207
177730
|
}
|
|
177208
177731
|
return result;
|
|
177209
177732
|
}, INLINE_SOURCE_MAP_RE, rebaseInlineSourceMap = (filePath) => {
|
|
177210
|
-
const source =
|
|
177733
|
+
const source = readFileSync35(filePath, "utf-8");
|
|
177211
177734
|
const match = source.match(INLINE_SOURCE_MAP_RE);
|
|
177212
177735
|
const encoded = match?.[1];
|
|
177213
177736
|
if (!encoded)
|
|
177214
177737
|
return;
|
|
177215
177738
|
const map = JSON.parse(Buffer.from(encoded, "base64").toString("utf-8"));
|
|
177739
|
+
if (!isRecord3(map))
|
|
177740
|
+
return;
|
|
177216
177741
|
if (!Array.isArray(map.sources))
|
|
177217
177742
|
return;
|
|
177218
|
-
const sourceRoot = map.sourceRoot
|
|
177219
|
-
const bundleDirectory =
|
|
177743
|
+
const sourceRoot = typeof map.sourceRoot === "string" ? map.sourceRoot : "";
|
|
177744
|
+
const bundleDirectory = dirname17(filePath);
|
|
177220
177745
|
map.sources = map.sources.map((entry) => {
|
|
177221
177746
|
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(entry))
|
|
177222
177747
|
return entry;
|
|
@@ -177225,11 +177750,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177225
177750
|
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(sourceRoot)) {
|
|
177226
177751
|
return new URL(entry, sourceRoot).href;
|
|
177227
177752
|
}
|
|
177228
|
-
return
|
|
177753
|
+
return resolve23(bundleDirectory, sourceRoot, entry);
|
|
177229
177754
|
});
|
|
177230
177755
|
delete map.sourceRoot;
|
|
177231
177756
|
const rebased = Buffer.from(JSON.stringify(map)).toString("base64");
|
|
177232
|
-
|
|
177757
|
+
writeFileSync21(filePath, source.replace(encoded, rebased));
|
|
177233
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) => {
|
|
177234
177759
|
if (parts.length === 0)
|
|
177235
177760
|
return null;
|
|
@@ -177255,39 +177780,39 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177255
177780
|
return result;
|
|
177256
177781
|
}, copyServerRuntimeAssetReferences = (outdir) => {
|
|
177257
177782
|
const copied = new Set;
|
|
177258
|
-
const normalizedOutdir =
|
|
177783
|
+
const normalizedOutdir = resolve23(outdir);
|
|
177259
177784
|
const copyReference = (filePath, relPath) => {
|
|
177260
|
-
const assetSource =
|
|
177261
|
-
if (!
|
|
177785
|
+
const assetSource = resolve23(dirname17(filePath), relPath);
|
|
177786
|
+
if (!existsSync38(assetSource) || !statSync7(assetSource).isFile())
|
|
177262
177787
|
return;
|
|
177263
|
-
const assetTarget =
|
|
177788
|
+
const assetTarget = resolve23(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
177264
177789
|
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
177265
177790
|
return;
|
|
177266
177791
|
if (copied.has(assetTarget))
|
|
177267
177792
|
return;
|
|
177268
177793
|
copied.add(assetTarget);
|
|
177269
|
-
|
|
177794
|
+
mkdirSync18(dirname17(assetTarget), { recursive: true });
|
|
177270
177795
|
cpSync(assetSource, assetTarget, { force: true });
|
|
177271
177796
|
};
|
|
177272
177797
|
for (const filePath of collectProjectSourceFiles(process.cwd())) {
|
|
177273
|
-
const source =
|
|
177798
|
+
const source = readFileSync35(filePath, "utf-8");
|
|
177274
177799
|
SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
|
|
177275
177800
|
let match;
|
|
177276
177801
|
while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
|
|
177277
|
-
const relPath = match
|
|
177802
|
+
const [, relPath] = match;
|
|
177278
177803
|
if (!relPath)
|
|
177279
177804
|
continue;
|
|
177280
177805
|
copyReference(filePath, relPath);
|
|
177281
177806
|
}
|
|
177282
177807
|
SERVER_RUNTIME_IMPORT_META_DIR_JOIN_RE.lastIndex = 0;
|
|
177283
177808
|
while ((match = SERVER_RUNTIME_IMPORT_META_DIR_JOIN_RE.exec(source)) !== null) {
|
|
177284
|
-
const args = match
|
|
177809
|
+
const [, args] = match;
|
|
177285
177810
|
if (!args)
|
|
177286
177811
|
continue;
|
|
177287
177812
|
SERVER_RUNTIME_STRING_ARG_RE.lastIndex = 0;
|
|
177288
177813
|
const parts = [];
|
|
177289
177814
|
for (const partMatch of args.matchAll(SERVER_RUNTIME_STRING_ARG_RE)) {
|
|
177290
|
-
const part = partMatch
|
|
177815
|
+
const [, part] = partMatch;
|
|
177291
177816
|
if (part)
|
|
177292
177817
|
parts.push(part);
|
|
177293
177818
|
}
|
|
@@ -177299,7 +177824,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177299
177824
|
}
|
|
177300
177825
|
}, readPackageVersion4 = (candidate) => {
|
|
177301
177826
|
try {
|
|
177302
|
-
const pkg = JSON.parse(
|
|
177827
|
+
const pkg = JSON.parse(readFileSync35(candidate, "utf-8"));
|
|
177303
177828
|
if (pkg.name !== "@absolutejs/absolute")
|
|
177304
177829
|
return null;
|
|
177305
177830
|
const ver = pkg.version;
|
|
@@ -177334,18 +177859,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177334
177859
|
return resolveBuildModule3(remaining);
|
|
177335
177860
|
}, resolveJsxDevRuntimeCompatPath2 = () => {
|
|
177336
177861
|
const candidates = [
|
|
177337
|
-
|
|
177338
|
-
|
|
177339
|
-
|
|
177340
|
-
|
|
177341
|
-
|
|
177342
|
-
|
|
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")
|
|
177343
177868
|
];
|
|
177344
177869
|
for (const candidate of candidates) {
|
|
177345
|
-
if (
|
|
177870
|
+
if (existsSync38(candidate))
|
|
177346
177871
|
return candidate;
|
|
177347
177872
|
}
|
|
177348
|
-
return
|
|
177873
|
+
return resolve23(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
177349
177874
|
}, jsxDevRuntimeCompatPath2, shouldEmbedCompiledAsset = (relativePath, skip = new Set) => {
|
|
177350
177875
|
if (skip.has(relativePath))
|
|
177351
177876
|
return false;
|
|
@@ -177370,23 +177895,23 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177370
177895
|
return true;
|
|
177371
177896
|
}), requireForCompile, resolveNativeAssetForRuntime = (specifier) => {
|
|
177372
177897
|
if (specifier.startsWith("."))
|
|
177373
|
-
return
|
|
177898
|
+
return resolve23(process.cwd(), specifier);
|
|
177374
177899
|
if (specifier.startsWith("/"))
|
|
177375
177900
|
return specifier;
|
|
177376
177901
|
return requireForCompile.resolve(specifier, { paths: [process.cwd()] });
|
|
177377
177902
|
}, resolveCompileNativeAssetEnv = (buildConfig) => {
|
|
177378
|
-
const
|
|
177903
|
+
const nativeAssetEnv = {};
|
|
177379
177904
|
for (const asset of resolveCompileNativeAssets(buildConfig)) {
|
|
177380
|
-
|
|
177905
|
+
nativeAssetEnv[asset.env] = resolveNativeAssetForRuntime(asset.import);
|
|
177381
177906
|
}
|
|
177382
|
-
return
|
|
177907
|
+
return nativeAssetEnv;
|
|
177383
177908
|
}, tryReadNodePackageJson = (packageDir) => {
|
|
177384
177909
|
try {
|
|
177385
|
-
return JSON.parse(
|
|
177910
|
+
return JSON.parse(readFileSync35(join32(packageDir, "package.json"), "utf-8"));
|
|
177386
177911
|
} catch {
|
|
177387
177912
|
return null;
|
|
177388
177913
|
}
|
|
177389
|
-
}, resolveProjectPackageDir = (specifier) =>
|
|
177914
|
+
}, resolveProjectPackageDir = (specifier) => resolve23(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
|
|
177390
177915
|
if (seen.has(specifier))
|
|
177391
177916
|
return;
|
|
177392
177917
|
const srcDir = resolveProjectPackageDir(specifier);
|
|
@@ -177395,12 +177920,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177395
177920
|
return;
|
|
177396
177921
|
seen.add(specifier);
|
|
177397
177922
|
const destDir = join32(outdir, "node_modules", ...specifier.split("/"));
|
|
177398
|
-
|
|
177923
|
+
rmSync7(destDir, { force: true, recursive: true });
|
|
177399
177924
|
cpSync(srcDir, destDir, {
|
|
177400
177925
|
force: true,
|
|
177401
177926
|
recursive: true,
|
|
177402
177927
|
filter(source) {
|
|
177403
|
-
const rel =
|
|
177928
|
+
const rel = relative12(srcDir, source);
|
|
177404
177929
|
const [firstSegment] = rel.split(/[\\/]/);
|
|
177405
177930
|
return firstSegment !== "node_modules" && firstSegment !== ".git";
|
|
177406
177931
|
}
|
|
@@ -177416,8 +177941,8 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177416
177941
|
}, copyAngularRuntimePackages = (buildConfig, outdir) => {
|
|
177417
177942
|
if (!buildConfig.angularDirectory)
|
|
177418
177943
|
return;
|
|
177419
|
-
const angularScopeDir =
|
|
177420
|
-
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}`) : [];
|
|
177421
177946
|
const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
|
|
177422
177947
|
const seen = new Set;
|
|
177423
177948
|
for (const specifier of roots) {
|
|
@@ -177436,7 +177961,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177436
177961
|
copyChunkReferencedPackages(outdir, seen);
|
|
177437
177962
|
}, collectRuntimePackageSpecifiers = (distDir) => {
|
|
177438
177963
|
const nodeModulesDir = join32(distDir, "node_modules");
|
|
177439
|
-
if (!
|
|
177964
|
+
if (!existsSync38(nodeModulesDir))
|
|
177440
177965
|
return [];
|
|
177441
177966
|
const specifiers = [];
|
|
177442
177967
|
for (const entry of readdirSync7(nodeModulesDir, { withFileTypes: true })) {
|
|
@@ -177455,18 +177980,17 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177455
177980
|
}
|
|
177456
177981
|
specifiers.push(entry.name);
|
|
177457
177982
|
}
|
|
177458
|
-
return specifiers.sort((
|
|
177983
|
+
return specifiers.sort((firstSpecifier, secondSpecifier) => secondSpecifier.length - firstSpecifier.length);
|
|
177459
177984
|
}, ensureRelativeModuleSpecifier = (fromFile, toFile) => {
|
|
177460
|
-
const rel =
|
|
177985
|
+
const rel = relative12(dirname17(fromFile), toFile).replace(/\\/g, "/");
|
|
177461
177986
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
177462
177987
|
}, pickExportEntry = (value) => {
|
|
177463
177988
|
if (typeof value === "string")
|
|
177464
177989
|
return value;
|
|
177465
|
-
if (!value
|
|
177990
|
+
if (!isRecord3(value))
|
|
177466
177991
|
return;
|
|
177467
|
-
const record = value;
|
|
177468
177992
|
for (const key of ["bun", "node", "import", "module", "default"]) {
|
|
177469
|
-
const entry = pickExportEntry(
|
|
177993
|
+
const entry = pickExportEntry(value[key]);
|
|
177470
177994
|
if (entry)
|
|
177471
177995
|
return entry;
|
|
177472
177996
|
}
|
|
@@ -177478,11 +178002,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177478
178002
|
const packageDir = join32(distDir, "node_modules", ...packageSpecifier.split("/"));
|
|
177479
178003
|
const subpath = specifier.slice(packageSpecifier.length);
|
|
177480
178004
|
const subPackageDir = subpath ? join32(packageDir, ...subpath.slice(1).split("/")) : null;
|
|
177481
|
-
const resolvedPackageDir = subPackageDir &&
|
|
178005
|
+
const resolvedPackageDir = subPackageDir && existsSync38(join32(subPackageDir, "package.json")) ? subPackageDir : packageDir;
|
|
177482
178006
|
const packageJsonPath = join32(resolvedPackageDir, "package.json");
|
|
177483
|
-
if (!
|
|
178007
|
+
if (!existsSync38(packageJsonPath))
|
|
177484
178008
|
return null;
|
|
177485
|
-
const pkg = JSON.parse(
|
|
178009
|
+
const pkg = JSON.parse(readFileSync35(packageJsonPath, "utf-8"));
|
|
177486
178010
|
const exportKey = resolvedPackageDir !== subPackageDir && subpath ? `.${subpath}` : ".";
|
|
177487
178011
|
const rootExport = pkg.exports?.[exportKey];
|
|
177488
178012
|
const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
|
|
@@ -177503,12 +178027,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177503
178027
|
];
|
|
177504
178028
|
return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
|
|
177505
178029
|
}, findContainingRuntimePackageDir = (filePath) => {
|
|
177506
|
-
let dir =
|
|
177507
|
-
while (dir !==
|
|
177508
|
-
if (isNodeModulesPath(dir) &&
|
|
178030
|
+
let dir = dirname17(filePath);
|
|
178031
|
+
while (dir !== dirname17(dir)) {
|
|
178032
|
+
if (isNodeModulesPath(dir) && existsSync38(join32(dir, "package.json"))) {
|
|
177509
178033
|
return dir;
|
|
177510
178034
|
}
|
|
177511
|
-
dir =
|
|
178035
|
+
dir = dirname17(dir);
|
|
177512
178036
|
}
|
|
177513
178037
|
return null;
|
|
177514
178038
|
}, resolvePackageImportEntryFile = (fromFile, specifier) => {
|
|
@@ -177523,13 +178047,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177523
178047
|
return null;
|
|
177524
178048
|
return join32(packageDir, entry);
|
|
177525
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) => {
|
|
177526
|
-
const distRoot =
|
|
178050
|
+
const distRoot = resolve23(distDir);
|
|
177527
178051
|
for (const filePath of collectRuntimeRewriteRoots(distDir)) {
|
|
177528
|
-
if (
|
|
178052
|
+
if (resolve23(dirname17(filePath)) === distRoot)
|
|
177529
178053
|
continue;
|
|
177530
|
-
const source =
|
|
178054
|
+
const source = readFileSync35(filePath, "utf-8");
|
|
177531
178055
|
for (const match of source.matchAll(MODULE_SPECIFIER_RE)) {
|
|
177532
|
-
const specifier = match
|
|
178056
|
+
const [, , , specifier] = match;
|
|
177533
178057
|
if (!specifier || specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("#") || specifier.startsWith("node:") || specifier.startsWith("bun:")) {
|
|
177534
178058
|
continue;
|
|
177535
178059
|
}
|
|
@@ -177557,11 +178081,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177557
178081
|
if (!filePath || seen.has(filePath))
|
|
177558
178082
|
continue;
|
|
177559
178083
|
seen.add(filePath);
|
|
177560
|
-
const source =
|
|
178084
|
+
const source = readFileSync35(filePath, "utf-8");
|
|
177561
178085
|
const { masked, restore } = maskLiterals(source);
|
|
177562
178086
|
const rewrittenMasked = masked.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
|
|
177563
178087
|
if (typeof specifier === "string" && specifier.startsWith(".")) {
|
|
177564
|
-
enqueue(resolveRuntimeJsFile(
|
|
178088
|
+
enqueue(resolveRuntimeJsFile(resolve23(dirname17(filePath), specifier)));
|
|
177565
178089
|
return match;
|
|
177566
178090
|
}
|
|
177567
178091
|
const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
|
|
@@ -177577,7 +178101,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177577
178101
|
});
|
|
177578
178102
|
const rewritten = restore(rewrittenMasked);
|
|
177579
178103
|
if (rewritten !== source) {
|
|
177580
|
-
|
|
178104
|
+
writeFileSync21(filePath, rewritten);
|
|
177581
178105
|
}
|
|
177582
178106
|
}
|
|
177583
178107
|
}, generateEntrypoint = (distDir, serverEntry, prerenderMap, version2, buildConfig) => {
|
|
@@ -177590,12 +178114,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177590
178114
|
"_compile_entrypoint.ts"
|
|
177591
178115
|
]);
|
|
177592
178116
|
const embeddedFiles = allFiles.filter((file) => {
|
|
177593
|
-
const rel =
|
|
178117
|
+
const rel = relative12(distDir, file);
|
|
177594
178118
|
if (embeddedSkip.has(rel))
|
|
177595
178119
|
return false;
|
|
177596
178120
|
return true;
|
|
177597
178121
|
});
|
|
177598
|
-
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(
|
|
178122
|
+
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(relative12(distDir, file), assetSkip));
|
|
177599
178123
|
const imports = [];
|
|
177600
178124
|
const nativeImports = [];
|
|
177601
178125
|
const nativeMappings = [];
|
|
@@ -177605,19 +178129,19 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177605
178129
|
const nativeAssets = resolveCompileNativeAssets(buildConfig);
|
|
177606
178130
|
nativeAssets.forEach((asset, idx) => {
|
|
177607
178131
|
const varName = `__native${idx}`;
|
|
177608
|
-
const importSpecifier = asset.import.startsWith(".") ?
|
|
178132
|
+
const importSpecifier = asset.import.startsWith(".") ? resolve23(process.cwd(), asset.import) : asset.import;
|
|
177609
178133
|
nativeImports.push(`import ${varName} from ${JSON.stringify(importSpecifier)} with { type: "file" };`);
|
|
177610
178134
|
nativeMappings.push(` [${JSON.stringify(asset.env)}, resolveNativeAssetPath(${varName})],`);
|
|
177611
178135
|
});
|
|
177612
178136
|
embeddedFiles.forEach((filePath, idx) => {
|
|
177613
|
-
const rel =
|
|
178137
|
+
const rel = relative12(distDir, filePath).replace(/\\/g, "/");
|
|
177614
178138
|
const varName = `__a${idx}`;
|
|
177615
178139
|
embeddedVarMap.set(rel, varName);
|
|
177616
178140
|
imports.push(`import ${varName} from "./${rel}" with { type: "file" };`);
|
|
177617
178141
|
embeddedMappings.push(` ["${rel}", ${varName}],`);
|
|
177618
178142
|
});
|
|
177619
178143
|
clientFiles.forEach((filePath) => {
|
|
177620
|
-
const rel =
|
|
178144
|
+
const rel = relative12(distDir, filePath).replace(/\\/g, "/");
|
|
177621
178145
|
const varName = embeddedVarMap.get(rel);
|
|
177622
178146
|
if (!varName)
|
|
177623
178147
|
return;
|
|
@@ -177631,7 +178155,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
177631
178155
|
const pageVarMap = new Map;
|
|
177632
178156
|
const prerenderEntries = Array.from(prerenderMap.entries());
|
|
177633
178157
|
prerenderEntries.forEach(([route, filePath]) => {
|
|
177634
|
-
const rel =
|
|
178158
|
+
const rel = relative12(distDir, filePath).replace(/\\/g, "/");
|
|
177635
178159
|
const varName = embeddedVarMap.get(rel);
|
|
177636
178160
|
if (varName)
|
|
177637
178161
|
pageVarMap.set(route, varName);
|
|
@@ -177664,7 +178188,7 @@ import { websocket as elysiaWebsocket } from "elysia/ws";
|
|
|
177664
178188
|
const SERVER_MODULE = (runtimeDir: string) => import(pathToFileURL(join(runtimeDir, ${JSON.stringify(serverBundleName)})).href);
|
|
177665
178189
|
const RUNTIME_BUILD_ID = ${JSON.stringify(runtimeBuildId)};
|
|
177666
178190
|
const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
|
|
177667
|
-
const ORIGINAL_BUILD_DIR = ${JSON.stringify(
|
|
178191
|
+
const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve23(distDir))};
|
|
177668
178192
|
const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
|
|
177669
178193
|
|
|
177670
178194
|
const resolveNativeAssetPath = (assetPath: string) => {
|
|
@@ -178077,11 +178601,12 @@ console.log(\`
|
|
|
178077
178601
|
});
|
|
178078
178602
|
}
|
|
178079
178603
|
}), FRAMEWORK_EXTERNALS, collectUserServerExternals = (buildConfig) => {
|
|
178080
|
-
const bunBuild = buildConfig
|
|
178604
|
+
const { bunBuild } = buildConfig;
|
|
178081
178605
|
if (!bunBuild)
|
|
178082
178606
|
return [];
|
|
178083
|
-
const override = Array.isArray(bunBuild.external) ? bunBuild.external : [];
|
|
178084
|
-
const
|
|
178607
|
+
const override = "external" in bunBuild && Array.isArray(bunBuild.external) ? bunBuild.external : [];
|
|
178608
|
+
const defaultBuild = "default" in bunBuild ? bunBuild.default : undefined;
|
|
178609
|
+
const fromDefault = Array.isArray(defaultBuild?.external) ? defaultBuild.external : [];
|
|
178085
178610
|
return [...override, ...fromDefault];
|
|
178086
178611
|
}, resolveServerBundleExternals = (buildConfig) => [
|
|
178087
178612
|
...FRAMEWORK_EXTERNALS.filter((specifier) => {
|
|
@@ -178095,16 +178620,16 @@ console.log(\`
|
|
|
178095
178620
|
}),
|
|
178096
178621
|
...collectUserServerExternals(buildConfig)
|
|
178097
178622
|
], compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
178098
|
-
const resolvedOutdir =
|
|
178623
|
+
const resolvedOutdir = resolve23(outdir ?? "dist");
|
|
178099
178624
|
await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
|
|
178100
178625
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
178101
178626
|
const prerenderPort = Number(env5.COMPILE_PORT) || Number(env5.PORT) || findFreePort();
|
|
178102
178627
|
killStaleProcesses(prerenderPort);
|
|
178103
178628
|
const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
|
|
178104
|
-
const resolvedOutfile =
|
|
178629
|
+
const resolvedOutfile = resolve23(outfile ?? "compiled-server");
|
|
178105
178630
|
const absoluteVersion = resolvePackageVersion3([
|
|
178106
|
-
|
|
178107
|
-
|
|
178631
|
+
resolve23(import.meta.dir, "..", "..", "..", "package.json"),
|
|
178632
|
+
resolve23(import.meta.dir, "..", "..", "package.json")
|
|
178108
178633
|
]);
|
|
178109
178634
|
compileBanner(absoluteVersion);
|
|
178110
178635
|
const totalStart = performance.now();
|
|
@@ -178115,8 +178640,8 @@ console.log(\`
|
|
|
178115
178640
|
buildConfig.mode = "production";
|
|
178116
178641
|
try {
|
|
178117
178642
|
const build2 = await resolveBuildModule3([
|
|
178118
|
-
|
|
178119
|
-
|
|
178643
|
+
resolve23(import.meta.dir, "..", "..", "core", "build"),
|
|
178644
|
+
resolve23(import.meta.dir, "..", "build")
|
|
178120
178645
|
]);
|
|
178121
178646
|
if (!build2)
|
|
178122
178647
|
throw new Error("Could not locate build module");
|
|
@@ -178138,13 +178663,12 @@ console.log(\`
|
|
|
178138
178663
|
buildConfig.htmxDirectory
|
|
178139
178664
|
].filter((dir) => Boolean(dir));
|
|
178140
178665
|
const islandRegistrySpec = buildConfig.islands?.registry;
|
|
178141
|
-
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(
|
|
178666
|
+
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve23(islandRegistrySpec))) : undefined;
|
|
178142
178667
|
const serverBundle = await Bun.build({
|
|
178143
178668
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
178144
|
-
entrypoints: [
|
|
178669
|
+
entrypoints: [resolve23(serverEntry)],
|
|
178145
178670
|
external: resolveServerBundleExternals(buildConfig),
|
|
178146
178671
|
outdir: resolvedOutdir,
|
|
178147
|
-
sourcemap: "inline",
|
|
178148
178672
|
plugins: [
|
|
178149
178673
|
...islandRegistryPlugin ? [islandRegistryPlugin] : [],
|
|
178150
178674
|
createStubPlugin({
|
|
@@ -178156,6 +178680,7 @@ console.log(\`
|
|
|
178156
178680
|
createExternalAssetPlugin(resolvedOutdir, userSourceRoots),
|
|
178157
178681
|
...buildConfig.compile?.plugins ?? []
|
|
178158
178682
|
],
|
|
178683
|
+
sourcemap: "inline",
|
|
178159
178684
|
target: "bun",
|
|
178160
178685
|
throw: false
|
|
178161
178686
|
});
|
|
@@ -178164,14 +178689,14 @@ console.log(\`
|
|
|
178164
178689
|
console.error(cliTag4("\x1B[31m", "Server bundle failed."));
|
|
178165
178690
|
process.exit(1);
|
|
178166
178691
|
}
|
|
178167
|
-
const outputPath =
|
|
178168
|
-
if (!
|
|
178692
|
+
const outputPath = resolve23(resolvedOutdir, `${entryName}.js`);
|
|
178693
|
+
if (!existsSync38(outputPath)) {
|
|
178169
178694
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
178170
178695
|
process.exit(1);
|
|
178171
178696
|
}
|
|
178172
|
-
if (
|
|
178173
|
-
const vendorDir =
|
|
178174
|
-
const vendorEntries = readdirSync7(vendorDir).filter((
|
|
178697
|
+
if (existsSync38(resolve23(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
178698
|
+
const vendorDir = resolve23(resolvedOutdir, "angular", "vendor", "server");
|
|
178699
|
+
const vendorEntries = readdirSync7(vendorDir).filter((fileName) => fileName.endsWith(".js"));
|
|
178175
178700
|
const angularServerVendorPaths = {};
|
|
178176
178701
|
for (const file of vendorEntries) {
|
|
178177
178702
|
const stem = file.replace(/\.js$/, "");
|
|
@@ -178179,7 +178704,7 @@ console.log(\`
|
|
|
178179
178704
|
if (scope !== "angular" || rest.length === 0)
|
|
178180
178705
|
continue;
|
|
178181
178706
|
const specifier = `@angular/${rest.join("/")}`;
|
|
178182
|
-
const relPath =
|
|
178707
|
+
const relPath = relative12(dirname17(outputPath), resolve23(vendorDir, file));
|
|
178183
178708
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
178184
178709
|
}
|
|
178185
178710
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -178191,7 +178716,7 @@ console.log(\`
|
|
|
178191
178716
|
copyServerRuntimeAssetReferences(resolvedOutdir);
|
|
178192
178717
|
const prerenderStart = performance.now();
|
|
178193
178718
|
process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
|
|
178194
|
-
|
|
178719
|
+
rmSync7(join32(resolvedOutdir, "_prerendered"), {
|
|
178195
178720
|
force: true,
|
|
178196
178721
|
recursive: true
|
|
178197
178722
|
});
|
|
@@ -178214,7 +178739,7 @@ console.log(\`
|
|
|
178214
178739
|
const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
|
|
178215
178740
|
const entrypointPath = join32(resolvedOutdir, "_compile_entrypoint.ts");
|
|
178216
178741
|
await Bun.write(entrypointPath, entrypointCode);
|
|
178217
|
-
|
|
178742
|
+
mkdirSync18(dirname17(resolvedOutfile), { recursive: true });
|
|
178218
178743
|
const result = await Bun.build({
|
|
178219
178744
|
compile: { outfile: resolvedOutfile },
|
|
178220
178745
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
@@ -178312,12 +178837,13 @@ var exports_typecheck = {};
|
|
|
178312
178837
|
__export(exports_typecheck, {
|
|
178313
178838
|
typecheck: () => typecheck
|
|
178314
178839
|
});
|
|
178315
|
-
import { resolve as
|
|
178316
|
-
import { existsSync as
|
|
178840
|
+
import { resolve as resolve24, join as join33 } from "path";
|
|
178841
|
+
import { existsSync as existsSync39, readFileSync as readFileSync36 } from "fs";
|
|
178317
178842
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
178318
|
-
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) =>
|
|
178319
|
-
if (!
|
|
178320
|
-
|
|
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))) {
|
|
178845
|
+
const defaultService = {};
|
|
178846
|
+
return [defaultService];
|
|
178321
178847
|
}
|
|
178322
178848
|
const rawConfig = await loadRawConfig(configPath2);
|
|
178323
178849
|
if (!isWorkspaceConfig(rawConfig)) {
|
|
@@ -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") {
|
|
@@ -179194,18 +179720,18 @@ init_portScan();
|
|
|
179194
179720
|
|
|
179195
179721
|
// src/utils/resolveDevPort.ts
|
|
179196
179722
|
import { createServer } from "net";
|
|
179197
|
-
var isPortFree = (port, host = "localhost") => new Promise((
|
|
179723
|
+
var isPortFree = (port, host = "localhost") => new Promise((resolve2) => {
|
|
179198
179724
|
const server2 = createServer();
|
|
179199
179725
|
server2.unref();
|
|
179200
179726
|
server2.once("error", (err) => {
|
|
179201
179727
|
if (err.code === "EADDRINUSE") {
|
|
179202
|
-
|
|
179728
|
+
resolve2(false);
|
|
179203
179729
|
return;
|
|
179204
179730
|
}
|
|
179205
|
-
|
|
179731
|
+
resolve2(false);
|
|
179206
179732
|
});
|
|
179207
179733
|
server2.listen(port, host, () => {
|
|
179208
|
-
server2.close(() =>
|
|
179734
|
+
server2.close(() => resolve2(true));
|
|
179209
179735
|
});
|
|
179210
179736
|
});
|
|
179211
179737
|
var resolveDevPort = async (requestedPort, options = {}) => {
|
|
@@ -179234,6 +179760,8 @@ var cliTag = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cl
|
|
|
179234
179760
|
var DEFAULT_PORT_RANGE = 10;
|
|
179235
179761
|
var RESTART_PARK_POLL_MS = 20;
|
|
179236
179762
|
var NODE_API_IMPORT_ERROR = "To load Node-API modules, use require() or process.dlopen instead of import.";
|
|
179763
|
+
var sourceServerBootstrap = resolve3(import.meta.dir, "../../dev/serverBootstrap.ts");
|
|
179764
|
+
var serverBootstrap = existsSync5(sourceServerBootstrap) ? sourceServerBootstrap : resolve3(import.meta.dir, "../dev/serverBootstrap.js");
|
|
179237
179765
|
var formatServerBootDiagnostic = (output, serverEntry) => {
|
|
179238
179766
|
if (!output.includes(NODE_API_IMPORT_ERROR))
|
|
179239
179767
|
return null;
|
|
@@ -179433,6 +179961,8 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179433
179961
|
interactive?.showPrompt();
|
|
179434
179962
|
};
|
|
179435
179963
|
const RESTART_MARKER = "[abs:restart]";
|
|
179964
|
+
const ANSI_ESCAPE = String.fromCharCode(27);
|
|
179965
|
+
const ANSI_COLOR_SEQUENCE_RE = new RegExp(`${ANSI_ESCAPE}\\[[0-9;]*m`, "g");
|
|
179436
179966
|
let restartScanBuffer = "";
|
|
179437
179967
|
const handleChunk = (value) => {
|
|
179438
179968
|
const text = value.toString("utf8");
|
|
@@ -179445,7 +179975,7 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179445
179975
|
const markerIdx = line.indexOf(RESTART_MARKER);
|
|
179446
179976
|
if (markerIdx === -1)
|
|
179447
179977
|
continue;
|
|
179448
|
-
const path = line.slice(markerIdx + RESTART_MARKER.length).replace(
|
|
179978
|
+
const path = line.slice(markerIdx + RESTART_MARKER.length).replace(ANSI_COLOR_SEQUENCE_RE, "").trim();
|
|
179449
179979
|
scheduleServerRestart(path);
|
|
179450
179980
|
}
|
|
179451
179981
|
if (restartScanBuffer.length > 4096) {
|
|
@@ -179470,29 +180000,31 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179470
180000
|
} catch {
|
|
179471
180001
|
return;
|
|
179472
180002
|
}
|
|
179473
|
-
const
|
|
180003
|
+
const refreshedDevConfig = resolveDevConfig(cfg?.dev);
|
|
179474
180004
|
const desiredBuildDir = cfg?.buildDirectory ? resolve3(process.cwd(), cfg.buildDirectory) : resolve3(process.cwd(), "build");
|
|
179475
180005
|
if (desiredBuildDir !== buildDirectory && desiredBuildDir !== lastBuildDirectoryWarned) {
|
|
179476
180006
|
lastBuildDirectoryWarned = desiredBuildDir;
|
|
179477
180007
|
console.log(cliTag("\x1B[33m", `buildDirectory changed in config (${buildDirectory} \u2192 ${desiredBuildDir}) \u2014 restart \`absolute dev\` to apply (the parent CLI holds a directory lock at the original path).`));
|
|
179478
180008
|
}
|
|
179479
|
-
if (
|
|
179480
|
-
const probe = await resolveDevPort(
|
|
179481
|
-
host:
|
|
179482
|
-
portRange:
|
|
179483
|
-
strictPort:
|
|
180009
|
+
if (refreshedDevConfig.port !== resolvedDev.port || refreshedDevConfig.host !== resolvedDev.host || refreshedDevConfig.portRange !== resolvedDev.portRange || refreshedDevConfig.strictPort !== resolvedDev.strictPort) {
|
|
180010
|
+
const probe = await resolveDevPort(refreshedDevConfig.port, {
|
|
180011
|
+
host: refreshedDevConfig.host,
|
|
180012
|
+
portRange: refreshedDevConfig.portRange,
|
|
180013
|
+
strictPort: refreshedDevConfig.strictPort
|
|
179484
180014
|
}).catch((err) => {
|
|
179485
180015
|
console.error(cliTag("\x1B[31m", String(err.message ?? err)));
|
|
179486
180016
|
return;
|
|
179487
180017
|
});
|
|
179488
180018
|
if (probe && probe.port !== port) {
|
|
179489
|
-
const
|
|
179490
|
-
|
|
179491
|
-
|
|
180019
|
+
const { port: nextPort } = probe;
|
|
180020
|
+
const { host } = refreshedDevConfig;
|
|
180021
|
+
const displayHost = host === "0.0.0.0" ? "localhost" : host;
|
|
180022
|
+
console.log(cliTag("\x1B[36m", `Port changed in config \u2014 switching to http://${displayHost}:${nextPort}/`));
|
|
180023
|
+
port = nextPort;
|
|
179492
180024
|
updateLockMetadata(buildDirectory, { port });
|
|
179493
180025
|
updateInstance(instancePid, { port });
|
|
179494
180026
|
}
|
|
179495
|
-
resolvedDev =
|
|
180027
|
+
resolvedDev = refreshedDevConfig;
|
|
179496
180028
|
}
|
|
179497
180029
|
};
|
|
179498
180030
|
const readDotenvFiles = () => {
|
|
@@ -179510,11 +180042,11 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179510
180042
|
const line = rawLine.trim();
|
|
179511
180043
|
if (!line || line.startsWith("#"))
|
|
179512
180044
|
continue;
|
|
179513
|
-
const
|
|
179514
|
-
if (
|
|
180045
|
+
const equalsIndex = line.indexOf("=");
|
|
180046
|
+
if (equalsIndex === -1)
|
|
179515
180047
|
continue;
|
|
179516
|
-
const key = line.slice(0,
|
|
179517
|
-
let val = line.slice(
|
|
180048
|
+
const key = line.slice(0, equalsIndex).trim();
|
|
180049
|
+
let val = line.slice(equalsIndex + 1).trim();
|
|
179518
180050
|
if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
|
|
179519
180051
|
val = val.slice(1, -1);
|
|
179520
180052
|
}
|
|
@@ -179544,7 +180076,7 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179544
180076
|
"--hot",
|
|
179545
180077
|
"--no-clear-screen",
|
|
179546
180078
|
...heapSnapshotEnabled ? ["--preload", heapPreloadPath] : [],
|
|
179547
|
-
|
|
180079
|
+
serverBootstrap
|
|
179548
180080
|
], {
|
|
179549
180081
|
cwd: process.cwd(),
|
|
179550
180082
|
detached: true,
|
|
@@ -179552,9 +180084,10 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179552
180084
|
...process.env,
|
|
179553
180085
|
...readDotenvFiles(),
|
|
179554
180086
|
ABSOLUTE_INSTANCE_MANAGED: "1",
|
|
180087
|
+
ABSOLUTE_PORT: String(port),
|
|
180088
|
+
ABSOLUTE_SERVER_ENTRY: resolve3(serverEntry),
|
|
179555
180089
|
FORCE_COLOR: "1",
|
|
179556
180090
|
NODE_ENV: "development",
|
|
179557
|
-
ABSOLUTE_PORT: String(port),
|
|
179558
180091
|
PORT: String(port),
|
|
179559
180092
|
...configPath2 ? { ABSOLUTE_CONFIG: configPath2 } : {},
|
|
179560
180093
|
...httpsEnabled ? { ABSOLUTE_HTTPS: "true" } : {}
|
|
@@ -179619,7 +180152,7 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179619
180152
|
};
|
|
179620
180153
|
try {
|
|
179621
180154
|
const { watch } = await import("fs");
|
|
179622
|
-
const { dirname: dirname3
|
|
180155
|
+
const { dirname: dirname3 } = await import("path");
|
|
179623
180156
|
const absServerEntry = resolve3(serverEntry);
|
|
179624
180157
|
const serverEntryDir = dirname3(absServerEntry);
|
|
179625
180158
|
const ROOT_RESTART_DENY = new Set([
|
|
@@ -179652,7 +180185,7 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179652
180185
|
if (now - last < 100)
|
|
179653
180186
|
return;
|
|
179654
180187
|
recentlyHandled.set(filename, now);
|
|
179655
|
-
scheduleServerRestart(
|
|
180188
|
+
scheduleServerRestart(join6(serverEntryDir, filename));
|
|
179656
180189
|
};
|
|
179657
180190
|
const recoveryScan = async () => {
|
|
179658
180191
|
let entries;
|
|
@@ -179669,13 +180202,13 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179669
180202
|
continue;
|
|
179670
180203
|
if (isAtomicWriteTemp(entry.name))
|
|
179671
180204
|
continue;
|
|
179672
|
-
let
|
|
180205
|
+
let fileStat;
|
|
179673
180206
|
try {
|
|
179674
|
-
|
|
180207
|
+
fileStat = statSync(join6(serverEntryDir, entry.name));
|
|
179675
180208
|
} catch {
|
|
179676
180209
|
continue;
|
|
179677
180210
|
}
|
|
179678
|
-
if (now -
|
|
180211
|
+
if (now - fileStat.ctimeMs > ATOMIC_RECOVERY_WINDOW_MS)
|
|
179679
180212
|
continue;
|
|
179680
180213
|
handleCandidate(entry.name);
|
|
179681
180214
|
}
|
|
@@ -179730,9 +180263,9 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179730
180263
|
};
|
|
179731
180264
|
const killChildTree = (signal) => signalChildTree(serverProcess, signal);
|
|
179732
180265
|
const FORCE_KILL_GRACE_MS = 2 * MILLISECONDS_IN_A_SECOND;
|
|
179733
|
-
const terminateChild = (proc) => new Promise((
|
|
180266
|
+
const terminateChild = (proc) => new Promise((_resolve) => {
|
|
179734
180267
|
if (proc.exitCode !== null || typeof proc.pid !== "number") {
|
|
179735
|
-
|
|
180268
|
+
_resolve();
|
|
179736
180269
|
return;
|
|
179737
180270
|
}
|
|
179738
180271
|
let settled = false;
|
|
@@ -179741,7 +180274,7 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179741
180274
|
return;
|
|
179742
180275
|
settled = true;
|
|
179743
180276
|
clearTimeout(killTimer);
|
|
179744
|
-
|
|
180277
|
+
_resolve();
|
|
179745
180278
|
};
|
|
179746
180279
|
proc.once("exit", finish);
|
|
179747
180280
|
signalChildTree(proc, "SIGTERM");
|
|
@@ -179764,12 +180297,12 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179764
180297
|
if (paused)
|
|
179765
180298
|
sendSignal("SIGCONT");
|
|
179766
180299
|
killChildTree("SIGTERM");
|
|
179767
|
-
await new Promise((
|
|
180300
|
+
await new Promise((_resolve) => {
|
|
179768
180301
|
if (serverProcess.exitCode !== null) {
|
|
179769
|
-
|
|
180302
|
+
_resolve();
|
|
179770
180303
|
return;
|
|
179771
180304
|
}
|
|
179772
|
-
serverProcess.once("exit", () =>
|
|
180305
|
+
serverProcess.once("exit", () => _resolve());
|
|
179773
180306
|
setTimeout(() => {
|
|
179774
180307
|
killChildTree("SIGKILL");
|
|
179775
180308
|
}, 2000).unref();
|
|
@@ -179923,8 +180456,10 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179923
180456
|
return false;
|
|
179924
180457
|
}
|
|
179925
180458
|
const now = Date.now();
|
|
179926
|
-
|
|
180459
|
+
let [oldestCrash] = recentCrashes;
|
|
180460
|
+
while (oldestCrash !== undefined && now - oldestCrash > CRASH_WINDOW_MS) {
|
|
179927
180461
|
recentCrashes.shift();
|
|
180462
|
+
[oldestCrash] = recentCrashes;
|
|
179928
180463
|
}
|
|
179929
180464
|
recentCrashes.push(now);
|
|
179930
180465
|
if (recentCrashes.length > MAX_CRASHES_PER_WINDOW) {
|
|
@@ -179956,12 +180491,12 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179956
180491
|
return;
|
|
179957
180492
|
}
|
|
179958
180493
|
const current = serverProcess;
|
|
179959
|
-
const exitCode = await new Promise((
|
|
180494
|
+
const exitCode = await new Promise((_resolve) => {
|
|
179960
180495
|
if (current.exitCode !== null) {
|
|
179961
|
-
|
|
180496
|
+
_resolve(current.exitCode);
|
|
179962
180497
|
return;
|
|
179963
180498
|
}
|
|
179964
|
-
current.once("exit", (code) =>
|
|
180499
|
+
current.once("exit", (code) => _resolve(code));
|
|
179965
180500
|
});
|
|
179966
180501
|
if (intentionalRestart) {
|
|
179967
180502
|
await waitForIntentionalRestart();
|
|
@@ -179981,377 +180516,8 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
179981
180516
|
await monitorServer();
|
|
179982
180517
|
};
|
|
179983
180518
|
|
|
179984
|
-
// src/cli/
|
|
179985
|
-
|
|
179986
|
-
import {
|
|
179987
|
-
existsSync as existsSync6,
|
|
179988
|
-
mkdirSync as mkdirSync5,
|
|
179989
|
-
readFileSync as readFileSync8,
|
|
179990
|
-
renameSync,
|
|
179991
|
-
rmSync as rmSync3,
|
|
179992
|
-
writeFileSync as writeFileSync5
|
|
179993
|
-
} from "fs";
|
|
179994
|
-
import { dirname as dirname3, resolve as resolve4 } from "path";
|
|
179995
|
-
var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache";
|
|
179996
|
-
var CACHE_CONTRACT_VERSION = "1";
|
|
179997
|
-
var CACHE_FINGERPRINT_SUFFIX = ".fingerprint";
|
|
179998
|
-
var flagValue = (args, flag) => {
|
|
179999
|
-
const assignment = args.find((arg) => arg.startsWith(`${flag}=`));
|
|
180000
|
-
if (assignment)
|
|
180001
|
-
return assignment.slice(flag.length + 1);
|
|
180002
|
-
const index = args.indexOf(flag);
|
|
180003
|
-
return index < 0 ? undefined : args[index + 1];
|
|
180004
|
-
};
|
|
180005
|
-
var getCacheLocation = (args) => flagValue(args, "--cache-location")?.trim() || process.env.ABSOLUTE_ESLINT_CACHE?.trim() || DEFAULT_CACHE_LOCATION;
|
|
180006
|
-
var CONFIG_CANDIDATES = [
|
|
180007
|
-
"eslint.config.js",
|
|
180008
|
-
"eslint.config.mjs",
|
|
180009
|
-
"eslint.config.cjs",
|
|
180010
|
-
"eslint.config.ts",
|
|
180011
|
-
"eslint.config.mts",
|
|
180012
|
-
"eslint.config.cts"
|
|
180013
|
-
];
|
|
180014
|
-
var FLAG_VALUE_FLAGS = new Set([
|
|
180015
|
-
"-c",
|
|
180016
|
-
"--config",
|
|
180017
|
-
"--cache-location",
|
|
180018
|
-
"--cache-strategy",
|
|
180019
|
-
"--ignore-path",
|
|
180020
|
-
"--ignore-pattern",
|
|
180021
|
-
"--rule",
|
|
180022
|
-
"--rulesdir",
|
|
180023
|
-
"--ext",
|
|
180024
|
-
"-f",
|
|
180025
|
-
"--format",
|
|
180026
|
-
"--max-warnings",
|
|
180027
|
-
"--parser",
|
|
180028
|
-
"--parser-options",
|
|
180029
|
-
"--plugin",
|
|
180030
|
-
"--global",
|
|
180031
|
-
"--env",
|
|
180032
|
-
"--report-unused-disable-directives-severity",
|
|
180033
|
-
"--resolve-plugins-relative-to",
|
|
180034
|
-
"-o",
|
|
180035
|
-
"--output-file",
|
|
180036
|
-
"--flag",
|
|
180037
|
-
"--inspect-config",
|
|
180038
|
-
"--stats",
|
|
180039
|
-
"--concurrency"
|
|
180040
|
-
]);
|
|
180041
|
-
var hasUserPositional = (args) => {
|
|
180042
|
-
for (let i = 0;i < args.length; i++) {
|
|
180043
|
-
const arg = args[i];
|
|
180044
|
-
if (arg === undefined)
|
|
180045
|
-
continue;
|
|
180046
|
-
if (arg.startsWith("-")) {
|
|
180047
|
-
if (arg.includes("="))
|
|
180048
|
-
continue;
|
|
180049
|
-
if (FLAG_VALUE_FLAGS.has(arg))
|
|
180050
|
-
i++;
|
|
180051
|
-
continue;
|
|
180052
|
-
}
|
|
180053
|
-
return true;
|
|
180054
|
-
}
|
|
180055
|
-
return false;
|
|
180056
|
-
};
|
|
180057
|
-
var findConfigPath = (cwd = process.cwd()) => {
|
|
180058
|
-
for (const name of CONFIG_CANDIDATES) {
|
|
180059
|
-
const candidate = resolve4(cwd, name);
|
|
180060
|
-
if (existsSync6(candidate))
|
|
180061
|
-
return candidate;
|
|
180062
|
-
}
|
|
180063
|
-
return null;
|
|
180064
|
-
};
|
|
180065
|
-
var fingerprintLocation = (cacheLocation, cwd) => {
|
|
180066
|
-
const absolute = resolve4(cwd, cacheLocation);
|
|
180067
|
-
return /[\\/]$/.test(cacheLocation) ? resolve4(absolute, CACHE_FINGERPRINT_SUFFIX.slice(1)) : `${absolute}${CACHE_FINGERPRINT_SUFFIX}`;
|
|
180068
|
-
};
|
|
180069
|
-
var addFileToFingerprint = (hash, path, label) => {
|
|
180070
|
-
if (!existsSync6(path))
|
|
180071
|
-
return;
|
|
180072
|
-
hash.update(label);
|
|
180073
|
-
hash.update("\x00");
|
|
180074
|
-
hash.update(readFileSync8(path));
|
|
180075
|
-
hash.update("\x00");
|
|
180076
|
-
};
|
|
180077
|
-
var packageNameFor = (specifier) => {
|
|
180078
|
-
if (specifier.startsWith("@"))
|
|
180079
|
-
return specifier.split("/").slice(0, 2).join("/");
|
|
180080
|
-
const [name = specifier] = specifier.split("/");
|
|
180081
|
-
return name;
|
|
180082
|
-
};
|
|
180083
|
-
var configPackageNames = (configPath2) => {
|
|
180084
|
-
if (!configPath2)
|
|
180085
|
-
return [];
|
|
180086
|
-
const source = readFileSync8(configPath2, "utf-8");
|
|
180087
|
-
const names = new Set;
|
|
180088
|
-
for (const match of source.matchAll(/(?:from\s+|import\s*(?:\(\s*)?|require\s*\(\s*)(['"])([^'".][^'"]*)\1/g)) {
|
|
180089
|
-
const [, , specifier] = match;
|
|
180090
|
-
if (specifier)
|
|
180091
|
-
names.add(packageNameFor(specifier));
|
|
180092
|
-
}
|
|
180093
|
-
return [...names];
|
|
180094
|
-
};
|
|
180095
|
-
var manifestDependencyNames = (manifest) => {
|
|
180096
|
-
if (manifest === null || typeof manifest !== "object")
|
|
180097
|
-
return [];
|
|
180098
|
-
return Object.entries(manifest).flatMap(([key, value]) => {
|
|
180099
|
-
if (key !== "dependencies" && key !== "devDependencies")
|
|
180100
|
-
return [];
|
|
180101
|
-
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
180102
|
-
return [];
|
|
180103
|
-
return Object.keys(value);
|
|
180104
|
-
});
|
|
180105
|
-
};
|
|
180106
|
-
var lintDependencyNames = (cwd, configPath2) => {
|
|
180107
|
-
const manifestPath = resolve4(cwd, "package.json");
|
|
180108
|
-
if (!existsSync6(manifestPath))
|
|
180109
|
-
return configPackageNames(configPath2);
|
|
180110
|
-
try {
|
|
180111
|
-
const manifest = JSON.parse(readFileSync8(manifestPath, "utf-8"));
|
|
180112
|
-
const lintPackages = manifestDependencyNames(manifest).filter((name) => /eslint|typescript/.test(name));
|
|
180113
|
-
return [
|
|
180114
|
-
...new Set([...lintPackages, ...configPackageNames(configPath2)])
|
|
180115
|
-
];
|
|
180116
|
-
} catch {
|
|
180117
|
-
return configPackageNames(configPath2);
|
|
180118
|
-
}
|
|
180119
|
-
};
|
|
180120
|
-
var findInstalledManifest = (cwd, dependency) => {
|
|
180121
|
-
let directory = cwd;
|
|
180122
|
-
while (true) {
|
|
180123
|
-
const candidate = resolve4(directory, "node_modules", dependency, "package.json");
|
|
180124
|
-
if (existsSync6(candidate))
|
|
180125
|
-
return candidate;
|
|
180126
|
-
const parent = dirname3(directory);
|
|
180127
|
-
if (parent === directory)
|
|
180128
|
-
return null;
|
|
180129
|
-
directory = parent;
|
|
180130
|
-
}
|
|
180131
|
-
};
|
|
180132
|
-
var createEslintCacheFingerprint = (cwd = process.cwd()) => {
|
|
180133
|
-
const hash = createHash("sha256");
|
|
180134
|
-
hash.update(`absolute-eslint-cache:${CACHE_CONTRACT_VERSION}\x00`);
|
|
180135
|
-
const configPath2 = findConfigPath(cwd);
|
|
180136
|
-
if (configPath2)
|
|
180137
|
-
addFileToFingerprint(hash, configPath2, configPath2);
|
|
180138
|
-
for (const dependency of lintDependencyNames(cwd, configPath2).sort()) {
|
|
180139
|
-
const manifestPath = findInstalledManifest(cwd, dependency);
|
|
180140
|
-
if (manifestPath)
|
|
180141
|
-
addFileToFingerprint(hash, manifestPath, dependency);
|
|
180142
|
-
}
|
|
180143
|
-
return hash.digest("hex");
|
|
180144
|
-
};
|
|
180145
|
-
var writeFingerprint = (path, fingerprint) => {
|
|
180146
|
-
mkdirSync5(dirname3(path), { recursive: true });
|
|
180147
|
-
const temporary = `${path}.${process.pid}.tmp`;
|
|
180148
|
-
writeFileSync5(temporary, `${fingerprint}
|
|
180149
|
-
`);
|
|
180150
|
-
renameSync(temporary, path);
|
|
180151
|
-
};
|
|
180152
|
-
var prepareEslintCache = (options) => {
|
|
180153
|
-
const cwd = options.cwd ?? process.cwd();
|
|
180154
|
-
const cachePath = resolve4(cwd, options.cacheLocation);
|
|
180155
|
-
const metadataPath = fingerprintLocation(options.cacheLocation, cwd);
|
|
180156
|
-
const fingerprint = options.fingerprint ?? createEslintCacheFingerprint(cwd);
|
|
180157
|
-
const prior = existsSync6(metadataPath) ? readFileSync8(metadataPath, "utf-8").trim() : null;
|
|
180158
|
-
if (prior === fingerprint)
|
|
180159
|
-
return false;
|
|
180160
|
-
rmSync3(cachePath, { force: true, recursive: true });
|
|
180161
|
-
if (metadataPath !== cachePath)
|
|
180162
|
-
rmSync3(metadataPath, { force: true, recursive: true });
|
|
180163
|
-
writeFingerprint(metadataPath, fingerprint);
|
|
180164
|
-
return true;
|
|
180165
|
-
};
|
|
180166
|
-
var hasKey = (objectLiteralSource, key) => {
|
|
180167
|
-
const pattern = new RegExp(`(^|[\\s,{])${key}\\s*:`, "m");
|
|
180168
|
-
return pattern.test(objectLiteralSource);
|
|
180169
|
-
};
|
|
180170
|
-
var NON_GLOBAL_IGNORE_KEYS = [
|
|
180171
|
-
"files",
|
|
180172
|
-
"rules",
|
|
180173
|
-
"plugins",
|
|
180174
|
-
"languageOptions",
|
|
180175
|
-
"linterOptions",
|
|
180176
|
-
"processor",
|
|
180177
|
-
"settings",
|
|
180178
|
-
"extends"
|
|
180179
|
-
];
|
|
180180
|
-
var isGlobalIgnoresBlock = (block) => {
|
|
180181
|
-
if (!hasKey(block, "ignores"))
|
|
180182
|
-
return false;
|
|
180183
|
-
return !NON_GLOBAL_IGNORE_KEYS.some((key) => hasKey(block, key));
|
|
180184
|
-
};
|
|
180185
|
-
var extractTopLevelObjectLiterals = (source) => {
|
|
180186
|
-
const arrayStart = source.search(/defineConfig\s*\(\s*\[|export\s+default\s*\[/);
|
|
180187
|
-
if (arrayStart === -1)
|
|
180188
|
-
return [];
|
|
180189
|
-
const fromArray = source.slice(arrayStart);
|
|
180190
|
-
const openBracket = fromArray.indexOf("[");
|
|
180191
|
-
if (openBracket === -1)
|
|
180192
|
-
return [];
|
|
180193
|
-
const blocks = [];
|
|
180194
|
-
let depth = 0;
|
|
180195
|
-
let blockStart = -1;
|
|
180196
|
-
let inString = null;
|
|
180197
|
-
let inLineComment = false;
|
|
180198
|
-
let inBlockComment = false;
|
|
180199
|
-
for (let i = openBracket;i < fromArray.length; i++) {
|
|
180200
|
-
const char = fromArray[i];
|
|
180201
|
-
const next = fromArray[i + 1];
|
|
180202
|
-
if (inLineComment) {
|
|
180203
|
-
if (char === `
|
|
180204
|
-
`)
|
|
180205
|
-
inLineComment = false;
|
|
180206
|
-
continue;
|
|
180207
|
-
}
|
|
180208
|
-
if (inBlockComment) {
|
|
180209
|
-
if (char === "*" && next === "/") {
|
|
180210
|
-
inBlockComment = false;
|
|
180211
|
-
i++;
|
|
180212
|
-
}
|
|
180213
|
-
continue;
|
|
180214
|
-
}
|
|
180215
|
-
if (inString) {
|
|
180216
|
-
if (char === "\\") {
|
|
180217
|
-
i++;
|
|
180218
|
-
continue;
|
|
180219
|
-
}
|
|
180220
|
-
if (char === inString)
|
|
180221
|
-
inString = null;
|
|
180222
|
-
continue;
|
|
180223
|
-
}
|
|
180224
|
-
if (char === "/" && next === "/") {
|
|
180225
|
-
inLineComment = true;
|
|
180226
|
-
continue;
|
|
180227
|
-
}
|
|
180228
|
-
if (char === "/" && next === "*") {
|
|
180229
|
-
inBlockComment = true;
|
|
180230
|
-
i++;
|
|
180231
|
-
continue;
|
|
180232
|
-
}
|
|
180233
|
-
if (char === '"' || char === "'" || char === "`") {
|
|
180234
|
-
inString = char;
|
|
180235
|
-
continue;
|
|
180236
|
-
}
|
|
180237
|
-
if (char === "{") {
|
|
180238
|
-
if (depth === 0)
|
|
180239
|
-
blockStart = i;
|
|
180240
|
-
depth++;
|
|
180241
|
-
} else if (char === "}") {
|
|
180242
|
-
depth--;
|
|
180243
|
-
if (depth === 0 && blockStart !== -1) {
|
|
180244
|
-
blocks.push(fromArray.slice(blockStart, i + 1));
|
|
180245
|
-
blockStart = -1;
|
|
180246
|
-
}
|
|
180247
|
-
} else if (char === "]" && depth === 0) {
|
|
180248
|
-
break;
|
|
180249
|
-
}
|
|
180250
|
-
}
|
|
180251
|
-
return blocks;
|
|
180252
|
-
};
|
|
180253
|
-
var checkForMisplacedIgnores = () => {
|
|
180254
|
-
const configPath2 = findConfigPath();
|
|
180255
|
-
if (!configPath2)
|
|
180256
|
-
return;
|
|
180257
|
-
let source;
|
|
180258
|
-
try {
|
|
180259
|
-
source = readFileSync8(configPath2, "utf-8");
|
|
180260
|
-
} catch {
|
|
180261
|
-
return;
|
|
180262
|
-
}
|
|
180263
|
-
const blocks = extractTopLevelObjectLiterals(source);
|
|
180264
|
-
if (blocks.some(isGlobalIgnoresBlock))
|
|
180265
|
-
return;
|
|
180266
|
-
let offenderCount = 0;
|
|
180267
|
-
for (const block of blocks) {
|
|
180268
|
-
if (hasKey(block, "ignores") && hasKey(block, "files")) {
|
|
180269
|
-
offenderCount++;
|
|
180270
|
-
}
|
|
180271
|
-
}
|
|
180272
|
-
if (offenderCount === 0)
|
|
180273
|
-
return;
|
|
180274
|
-
const yellow = "\x1B[33m";
|
|
180275
|
-
const reset = "\x1B[0m";
|
|
180276
|
-
const bold = "\x1B[1m";
|
|
180277
|
-
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.
|
|
180278
|
-
|
|
180279
|
-
Move ignores into a standalone block at the top of your config:
|
|
180280
|
-
|
|
180281
|
-
export default defineConfig([
|
|
180282
|
-
{ ignores: ['node_modules/**', 'dist/**', 'build/**', '.absolutejs/**'] },
|
|
180283
|
-
pluginJs.configs.recommended,
|
|
180284
|
-
...
|
|
180285
|
-
]);
|
|
180286
|
-
|
|
180287
|
-
Detected at: ${configPath2}${reset}`);
|
|
180288
|
-
};
|
|
180289
|
-
var formatDuration = (ms) => {
|
|
180290
|
-
if (ms < 1000)
|
|
180291
|
-
return `${ms}ms`;
|
|
180292
|
-
if (ms < 60000)
|
|
180293
|
-
return `${(ms / 1000).toFixed(2)}s`;
|
|
180294
|
-
const minutes = Math.floor(ms / 60000);
|
|
180295
|
-
const seconds = Math.round(ms % 60000 / 1000);
|
|
180296
|
-
return `${minutes}m ${seconds}s`;
|
|
180297
|
-
};
|
|
180298
|
-
var handleClearCache = (cacheLocation, cwd = process.cwd()) => {
|
|
180299
|
-
try {
|
|
180300
|
-
const cachePath = resolve4(cwd, cacheLocation);
|
|
180301
|
-
const metadataPath = fingerprintLocation(cacheLocation, cwd);
|
|
180302
|
-
rmSync3(cachePath, { force: true, recursive: true });
|
|
180303
|
-
rmSync3(metadataPath, { force: true, recursive: true });
|
|
180304
|
-
console.log(`\x1B[32m\u2713\x1B[0m Cleared cache: ${cacheLocation}`);
|
|
180305
|
-
} catch (err) {
|
|
180306
|
-
console.error(`\x1B[31m\u2717\x1B[0m Failed to clear cache at ${cacheLocation}:`, err);
|
|
180307
|
-
process.exit(1);
|
|
180308
|
-
}
|
|
180309
|
-
};
|
|
180310
|
-
var buildEslintCommand = (args, cacheLocation) => {
|
|
180311
|
-
const cacheEnabled = !args.includes("--no-cache");
|
|
180312
|
-
const hasCacheLocation = args.some((arg) => arg === "--cache-location" || arg.startsWith("--cache-location="));
|
|
180313
|
-
const hasCacheStrategy = args.some((arg) => arg === "--cache-strategy" || arg.startsWith("--cache-strategy="));
|
|
180314
|
-
return [
|
|
180315
|
-
"bun",
|
|
180316
|
-
"eslint",
|
|
180317
|
-
...cacheEnabled ? ["--cache"] : [],
|
|
180318
|
-
...cacheEnabled && !hasCacheLocation ? ["--cache-location", cacheLocation] : [],
|
|
180319
|
-
...cacheEnabled && !hasCacheStrategy ? ["--cache-strategy", "content"] : [],
|
|
180320
|
-
...args,
|
|
180321
|
-
...hasUserPositional(args) ? [] : ["."]
|
|
180322
|
-
];
|
|
180323
|
-
};
|
|
180324
|
-
var eslint = async (args) => {
|
|
180325
|
-
const cacheLocation = getCacheLocation(args);
|
|
180326
|
-
if (args.includes("--clear-cache")) {
|
|
180327
|
-
handleClearCache(cacheLocation);
|
|
180328
|
-
return;
|
|
180329
|
-
}
|
|
180330
|
-
if (!existsSync6(resolve4("node_modules", ".bin", "eslint"))) {
|
|
180331
|
-
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");
|
|
180332
|
-
process.exit(1);
|
|
180333
|
-
}
|
|
180334
|
-
checkForMisplacedIgnores();
|
|
180335
|
-
const cacheEnabled = !args.includes("--no-cache");
|
|
180336
|
-
if (cacheEnabled)
|
|
180337
|
-
prepareEslintCache({ cacheLocation });
|
|
180338
|
-
const command = buildEslintCommand(args, cacheLocation);
|
|
180339
|
-
const dim = "\x1B[2m";
|
|
180340
|
-
const reset = "\x1B[0m";
|
|
180341
|
-
console.log(cacheEnabled ? `${dim}cache: ${cacheLocation} (content-aware; lint-tool changes invalidate automatically)${reset}` : `${dim}cache: disabled${reset}`);
|
|
180342
|
-
const startedAt = Date.now();
|
|
180343
|
-
const proc = Bun.spawn(command, {
|
|
180344
|
-
stderr: "inherit",
|
|
180345
|
-
stdout: "inherit"
|
|
180346
|
-
});
|
|
180347
|
-
const exitCode = await proc.exited;
|
|
180348
|
-
const elapsed = formatDuration(Date.now() - startedAt);
|
|
180349
|
-
if (exitCode !== 0) {
|
|
180350
|
-
console.log(`${dim}elapsed: ${elapsed}${reset}`);
|
|
180351
|
-
process.exit(exitCode);
|
|
180352
|
-
}
|
|
180353
|
-
console.log(`\x1B[32m\u2713\x1B[0m Passed ${dim}(${elapsed})${reset}`);
|
|
180354
|
-
};
|
|
180519
|
+
// src/cli/index.ts
|
|
180520
|
+
init_eslint();
|
|
180355
180521
|
|
|
180356
180522
|
// src/cli/scripts/info.ts
|
|
180357
180523
|
init_constants();
|
|
@@ -180933,7 +181099,7 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
180933
181099
|
if (existsSync8(resolve8(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
180934
181100
|
const { readdirSync: readdirSync2 } = await import("fs");
|
|
180935
181101
|
const vendorDir = resolve8(resolvedOutdir, "angular", "vendor", "server");
|
|
180936
|
-
const vendorEntries = readdirSync2(vendorDir).filter((
|
|
181102
|
+
const vendorEntries = readdirSync2(vendorDir).filter((fileName) => fileName.endsWith(".js"));
|
|
180937
181103
|
const angularServerVendorPaths = {};
|
|
180938
181104
|
const { relative: pathRelative, dirname: pathDirname } = await import("path");
|
|
180939
181105
|
for (const file of vendorEntries) {
|
|
@@ -181347,7 +181513,13 @@ var createWorkspaceTui = ({
|
|
|
181347
181513
|
const timestamp = formatTimestamp2();
|
|
181348
181514
|
logEntries.push({ level, message: line, source, timestamp });
|
|
181349
181515
|
if (headless) {
|
|
181350
|
-
const
|
|
181516
|
+
const levelColors = {
|
|
181517
|
+
error: colors.red,
|
|
181518
|
+
info: colors.dim,
|
|
181519
|
+
success: colors.green,
|
|
181520
|
+
warn: colors.yellow
|
|
181521
|
+
};
|
|
181522
|
+
const levelColor = levelColors[level];
|
|
181351
181523
|
process.stdout.write(`${colors.dim}${timestamp}${colors.reset} ${levelColor}${source}${colors.reset} ${line}
|
|
181352
181524
|
`);
|
|
181353
181525
|
}
|
|
@@ -181618,6 +181790,8 @@ var createWorkspaceTui = ({
|
|
|
181618
181790
|
|
|
181619
181791
|
// src/cli/scripts/workspace.ts
|
|
181620
181792
|
init_utils();
|
|
181793
|
+
var sourceServerBootstrap2 = resolve9(import.meta.dir, "../../dev/serverBootstrap.ts");
|
|
181794
|
+
var serverBootstrap2 = existsSync9(sourceServerBootstrap2) ? sourceServerBootstrap2 : resolve9(import.meta.dir, "../dev/serverBootstrap.js");
|
|
181621
181795
|
var ANSI_REGEX2 = new RegExp(`${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[[0-?]*[ -/]*[@-~]`, "g");
|
|
181622
181796
|
var sleep = (durationMs) => Bun.sleep(durationMs);
|
|
181623
181797
|
var stripAnsi2 = (value) => value.replace(ANSI_REGEX2, "");
|
|
@@ -182042,12 +182216,14 @@ var resolveService = (name, service, workspaceEnv, options) => {
|
|
|
182042
182216
|
});
|
|
182043
182217
|
if (isAbsoluteService(service)) {
|
|
182044
182218
|
const configPath2 = resolveAbsoluteServiceConfigPath(service, cwd, options);
|
|
182045
|
-
Object.assign(envVars, configPath2 ? { ABSOLUTE_CONFIG: configPath2 } : {}
|
|
182219
|
+
Object.assign(envVars, configPath2 ? { ABSOLUTE_CONFIG: configPath2 } : {}, {
|
|
182220
|
+
ABSOLUTE_SERVER_ENTRY: resolve9(cwd, service.entry ?? DEFAULT_SERVER_ENTRY)
|
|
182221
|
+
});
|
|
182046
182222
|
const command = [
|
|
182047
182223
|
process.execPath,
|
|
182048
182224
|
"--hot",
|
|
182049
182225
|
"--no-clear-screen",
|
|
182050
|
-
|
|
182226
|
+
serverBootstrap2
|
|
182051
182227
|
];
|
|
182052
182228
|
return {
|
|
182053
182229
|
command,
|
|
@@ -182451,6 +182627,10 @@ if (command === "dev") {
|
|
|
182451
182627
|
} else if (command === "eslint") {
|
|
182452
182628
|
sendTelemetryEvent("cli:command", { command });
|
|
182453
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);
|
|
182454
182634
|
} else if (command === "prettier") {
|
|
182455
182635
|
sendTelemetryEvent("cli:command", { command });
|
|
182456
182636
|
await prettier(args);
|
|
@@ -182566,6 +182746,7 @@ if (command === "dev") {
|
|
|
182566
182746
|
console.error(" analyze [--save] [--json] Bundle size breakdown + diff vs a saved baseline");
|
|
182567
182747
|
console.error(" api [--open] [--json] Show the API surface or open the OpenAPI UI (@elysiajs/openapi)");
|
|
182568
182748
|
console.error(" eslint Run ESLint (cached)");
|
|
182749
|
+
console.error(" lint-proof <run|verify> -- <command> Record or verify an exact-source local lint pass");
|
|
182569
182750
|
console.error(" generate <page|api|component> <name> [--framework <fw>] Scaffold a page, API plugin, or component");
|
|
182570
182751
|
console.error(" htmx [version] Self-host htmx \u2014 report or install/upgrade the pinned copy");
|
|
182571
182752
|
console.error(" info Print system info for bug reports");
|