@absolutejs/absolute 0.19.0-beta.812 → 0.19.0-beta.814
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/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +7 -7
- package/dist/build.js.map +3 -3
- package/dist/cli/index.js +254 -121
- package/dist/index.js +7 -7
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -631,7 +631,7 @@ __export(exports_prerender, {
|
|
|
631
631
|
prerender: () => prerender,
|
|
632
632
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
633
633
|
});
|
|
634
|
-
import { mkdirSync as mkdirSync3, readFileSync as
|
|
634
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync7 } from "fs";
|
|
635
635
|
import { join as join5 } from "path";
|
|
636
636
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
637
637
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
@@ -639,7 +639,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
639
639
|
}, readTimestamp = (htmlPath) => {
|
|
640
640
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
641
641
|
try {
|
|
642
|
-
const content =
|
|
642
|
+
const content = readFileSync7(metaPath, "utf-8");
|
|
643
643
|
return Number(content) || 0;
|
|
644
644
|
} catch {
|
|
645
645
|
return 0;
|
|
@@ -827,7 +827,7 @@ var init_prerender = () => {};
|
|
|
827
827
|
// src/build/nativeRewrite.ts
|
|
828
828
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
829
829
|
import { platform as platform4, arch as arch3 } from "os";
|
|
830
|
-
import { resolve as
|
|
830
|
+
import { resolve as resolve6 } from "path";
|
|
831
831
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
832
832
|
if (nativeLib !== null)
|
|
833
833
|
return nativeLib;
|
|
@@ -845,7 +845,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
845
845
|
if (!libPath)
|
|
846
846
|
return null;
|
|
847
847
|
try {
|
|
848
|
-
const fullPath =
|
|
848
|
+
const fullPath = resolve6(import.meta.dir, "../../native/packages", libPath);
|
|
849
849
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
850
850
|
nativeLib = lib.symbols;
|
|
851
851
|
return nativeLib;
|
|
@@ -994,7 +994,7 @@ var exports_build = {};
|
|
|
994
994
|
__export(exports_build, {
|
|
995
995
|
build: () => build
|
|
996
996
|
});
|
|
997
|
-
import { resolve as
|
|
997
|
+
import { resolve as resolve9 } from "path";
|
|
998
998
|
var cliTag3 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, tryImportBuild2 = async (candidate) => {
|
|
999
999
|
try {
|
|
1000
1000
|
const mod = await import(candidate);
|
|
@@ -1014,7 +1014,7 @@ var cliTag3 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1014
1014
|
}
|
|
1015
1015
|
return resolveBuildModule2(remaining);
|
|
1016
1016
|
}, build = async (outdir, configPath2) => {
|
|
1017
|
-
const resolvedOutdir =
|
|
1017
|
+
const resolvedOutdir = resolve9(outdir ?? "build");
|
|
1018
1018
|
const buildStart = performance.now();
|
|
1019
1019
|
process.stdout.write(cliTag3("\x1B[36m", "Building assets"));
|
|
1020
1020
|
const buildConfig = await loadConfig(configPath2);
|
|
@@ -1022,8 +1022,8 @@ var cliTag3 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1022
1022
|
buildConfig.mode = "production";
|
|
1023
1023
|
try {
|
|
1024
1024
|
const buildApp = await resolveBuildModule2([
|
|
1025
|
-
|
|
1026
|
-
|
|
1025
|
+
resolve9(import.meta.dir, "..", "..", "core", "build"),
|
|
1026
|
+
resolve9(import.meta.dir, "..", "build")
|
|
1027
1027
|
]);
|
|
1028
1028
|
if (!buildApp)
|
|
1029
1029
|
throw new Error("Could not locate build module");
|
|
@@ -1149,16 +1149,16 @@ __export(exports_compile, {
|
|
|
1149
1149
|
var {env: env3 } = globalThis.Bun;
|
|
1150
1150
|
import {
|
|
1151
1151
|
cpSync,
|
|
1152
|
-
existsSync as
|
|
1152
|
+
existsSync as existsSync10,
|
|
1153
1153
|
mkdirSync as mkdirSync5,
|
|
1154
1154
|
readdirSync as readdirSync2,
|
|
1155
|
-
readFileSync as
|
|
1155
|
+
readFileSync as readFileSync10,
|
|
1156
1156
|
rmSync as rmSync2,
|
|
1157
1157
|
statSync,
|
|
1158
1158
|
unlinkSync as unlinkSync2,
|
|
1159
1159
|
writeFileSync as writeFileSync3
|
|
1160
1160
|
} from "fs";
|
|
1161
|
-
import { basename as basename2, dirname as dirname3, join as join7, relative, resolve as
|
|
1161
|
+
import { basename as basename2, dirname as dirname3, join as join7, relative, resolve as resolve10 } from "path";
|
|
1162
1162
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
1163
1163
|
const resolvedVersion = version2 || "unknown";
|
|
1164
1164
|
console.log("");
|
|
@@ -1203,12 +1203,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1203
1203
|
return result;
|
|
1204
1204
|
}, copyServerRuntimeAssetReferences = (outdir) => {
|
|
1205
1205
|
const copied = new Set;
|
|
1206
|
-
const normalizedOutdir =
|
|
1206
|
+
const normalizedOutdir = resolve10(outdir);
|
|
1207
1207
|
const copyReference = (filePath, relPath) => {
|
|
1208
|
-
const assetSource =
|
|
1209
|
-
if (!
|
|
1208
|
+
const assetSource = resolve10(dirname3(filePath), relPath);
|
|
1209
|
+
if (!existsSync10(assetSource) || !statSync(assetSource).isFile())
|
|
1210
1210
|
return;
|
|
1211
|
-
const assetTarget =
|
|
1211
|
+
const assetTarget = resolve10(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
1212
1212
|
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
1213
1213
|
return;
|
|
1214
1214
|
if (copied.has(assetTarget))
|
|
@@ -1218,7 +1218,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1218
1218
|
cpSync(assetSource, assetTarget, { force: true });
|
|
1219
1219
|
};
|
|
1220
1220
|
for (const filePath of collectProjectSourceFiles(process.cwd())) {
|
|
1221
|
-
const source =
|
|
1221
|
+
const source = readFileSync10(filePath, "utf-8");
|
|
1222
1222
|
SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
|
|
1223
1223
|
let match;
|
|
1224
1224
|
while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
|
|
@@ -1247,7 +1247,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1247
1247
|
}
|
|
1248
1248
|
}, readPackageVersion4 = (candidate) => {
|
|
1249
1249
|
try {
|
|
1250
|
-
const pkg = JSON.parse(
|
|
1250
|
+
const pkg = JSON.parse(readFileSync10(candidate, "utf-8"));
|
|
1251
1251
|
if (pkg.name !== "@absolutejs/absolute")
|
|
1252
1252
|
return null;
|
|
1253
1253
|
const ver = pkg.version;
|
|
@@ -1282,18 +1282,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1282
1282
|
return resolveBuildModule3(remaining);
|
|
1283
1283
|
}, resolveJsxDevRuntimeCompatPath2 = () => {
|
|
1284
1284
|
const candidates = [
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1285
|
+
resolve10(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
1286
|
+
resolve10(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
1287
|
+
resolve10(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
1288
|
+
resolve10(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
1289
|
+
resolve10(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
1290
|
+
resolve10(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
1291
1291
|
];
|
|
1292
1292
|
for (const candidate of candidates) {
|
|
1293
|
-
if (
|
|
1293
|
+
if (existsSync10(candidate))
|
|
1294
1294
|
return candidate;
|
|
1295
1295
|
}
|
|
1296
|
-
return
|
|
1296
|
+
return resolve10(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
1297
1297
|
}, jsxDevRuntimeCompatPath2, shouldEmbedCompiledAsset = (relativePath, skip = new Set) => {
|
|
1298
1298
|
if (skip.has(relativePath))
|
|
1299
1299
|
return false;
|
|
@@ -1306,11 +1306,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1306
1306
|
return true;
|
|
1307
1307
|
}, tryReadNodePackageJson = (packageDir) => {
|
|
1308
1308
|
try {
|
|
1309
|
-
return JSON.parse(
|
|
1309
|
+
return JSON.parse(readFileSync10(join7(packageDir, "package.json"), "utf-8"));
|
|
1310
1310
|
} catch {
|
|
1311
1311
|
return null;
|
|
1312
1312
|
}
|
|
1313
|
-
}, resolveProjectPackageDir = (specifier) =>
|
|
1313
|
+
}, resolveProjectPackageDir = (specifier) => resolve10(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
|
|
1314
1314
|
if (seen.has(specifier))
|
|
1315
1315
|
return;
|
|
1316
1316
|
const srcDir = resolveProjectPackageDir(specifier);
|
|
@@ -1340,8 +1340,8 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1340
1340
|
}, copyAngularRuntimePackages = (buildConfig, outdir) => {
|
|
1341
1341
|
if (!buildConfig.angularDirectory)
|
|
1342
1342
|
return;
|
|
1343
|
-
const angularScopeDir =
|
|
1344
|
-
const angularPackages =
|
|
1343
|
+
const angularScopeDir = resolve10(process.cwd(), "node_modules", "@angular");
|
|
1344
|
+
const angularPackages = existsSync10(angularScopeDir) ? readdirSync2(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
|
|
1345
1345
|
const roots = new Set([
|
|
1346
1346
|
...angularPackages,
|
|
1347
1347
|
"rxjs",
|
|
@@ -1365,7 +1365,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1365
1365
|
copyAngularRuntimePackages(buildConfig, outdir);
|
|
1366
1366
|
}, collectRuntimePackageSpecifiers = (distDir) => {
|
|
1367
1367
|
const nodeModulesDir = join7(distDir, "node_modules");
|
|
1368
|
-
if (!
|
|
1368
|
+
if (!existsSync10(nodeModulesDir))
|
|
1369
1369
|
return [];
|
|
1370
1370
|
const specifiers = [];
|
|
1371
1371
|
for (const entry of readdirSync2(nodeModulesDir, { withFileTypes: true })) {
|
|
@@ -1407,11 +1407,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1407
1407
|
const packageDir = join7(distDir, "node_modules", ...packageSpecifier.split("/"));
|
|
1408
1408
|
const subpath = specifier.slice(packageSpecifier.length);
|
|
1409
1409
|
const subPackageDir = subpath ? join7(packageDir, ...subpath.slice(1).split("/")) : null;
|
|
1410
|
-
const resolvedPackageDir = subPackageDir &&
|
|
1410
|
+
const resolvedPackageDir = subPackageDir && existsSync10(join7(subPackageDir, "package.json")) ? subPackageDir : packageDir;
|
|
1411
1411
|
const packageJsonPath = join7(resolvedPackageDir, "package.json");
|
|
1412
|
-
if (!
|
|
1412
|
+
if (!existsSync10(packageJsonPath))
|
|
1413
1413
|
return null;
|
|
1414
|
-
const pkg = JSON.parse(
|
|
1414
|
+
const pkg = JSON.parse(readFileSync10(packageJsonPath, "utf-8"));
|
|
1415
1415
|
const exportKey = resolvedPackageDir === subPackageDir ? "." : subpath ? `.${subpath}` : ".";
|
|
1416
1416
|
const rootExport = pkg.exports?.[exportKey];
|
|
1417
1417
|
const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
|
|
@@ -1434,7 +1434,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1434
1434
|
}, findContainingRuntimePackageDir = (filePath) => {
|
|
1435
1435
|
let dir = dirname3(filePath);
|
|
1436
1436
|
while (dir !== dirname3(dir)) {
|
|
1437
|
-
if (isNodeModulesPath(dir) &&
|
|
1437
|
+
if (isNodeModulesPath(dir) && existsSync10(join7(dir, "package.json"))) {
|
|
1438
1438
|
return dir;
|
|
1439
1439
|
}
|
|
1440
1440
|
dir = dirname3(dir);
|
|
@@ -1469,10 +1469,10 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1469
1469
|
if (!filePath || seen.has(filePath))
|
|
1470
1470
|
continue;
|
|
1471
1471
|
seen.add(filePath);
|
|
1472
|
-
const source =
|
|
1472
|
+
const source = readFileSync10(filePath, "utf-8");
|
|
1473
1473
|
const rewritten = source.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
|
|
1474
1474
|
if (typeof specifier === "string" && specifier.startsWith(".")) {
|
|
1475
|
-
enqueue(resolveRuntimeJsFile(
|
|
1475
|
+
enqueue(resolveRuntimeJsFile(resolve10(dirname3(filePath), specifier)));
|
|
1476
1476
|
return match;
|
|
1477
1477
|
}
|
|
1478
1478
|
const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
|
|
@@ -1557,7 +1557,7 @@ import { pathToFileURL } from "node:url";
|
|
|
1557
1557
|
const SERVER_MODULE = (runtimeDir: string) => import(pathToFileURL(join(runtimeDir, ${JSON.stringify(serverBundleName)})).href);
|
|
1558
1558
|
const RUNTIME_BUILD_ID = ${JSON.stringify(runtimeBuildId)};
|
|
1559
1559
|
const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
|
|
1560
|
-
const ORIGINAL_BUILD_DIR = ${JSON.stringify(
|
|
1560
|
+
const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve10(distDir))};
|
|
1561
1561
|
const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
|
|
1562
1562
|
|
|
1563
1563
|
// \u2500\u2500 Asset URL \u2192 embedded path map \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
@@ -1854,16 +1854,16 @@ console.log(\`
|
|
|
1854
1854
|
return false;
|
|
1855
1855
|
return true;
|
|
1856
1856
|
}), compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
1857
|
-
const resolvedOutdir =
|
|
1857
|
+
const resolvedOutdir = resolve10(outdir ?? "dist");
|
|
1858
1858
|
await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
|
|
1859
1859
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
1860
1860
|
const prerenderPort = Number(env3.COMPILE_PORT) || Number(env3.PORT) || DEFAULT_PORT + 1;
|
|
1861
1861
|
killStaleProcesses(prerenderPort);
|
|
1862
1862
|
const entryName = basename2(serverEntry).replace(/\.[^.]+$/, "");
|
|
1863
|
-
const resolvedOutfile =
|
|
1863
|
+
const resolvedOutfile = resolve10(outfile ?? "compiled-server");
|
|
1864
1864
|
const absoluteVersion = resolvePackageVersion3([
|
|
1865
|
-
|
|
1866
|
-
|
|
1865
|
+
resolve10(import.meta.dir, "..", "..", "..", "package.json"),
|
|
1866
|
+
resolve10(import.meta.dir, "..", "..", "package.json")
|
|
1867
1867
|
]);
|
|
1868
1868
|
compileBanner(absoluteVersion);
|
|
1869
1869
|
const totalStart = performance.now();
|
|
@@ -1874,8 +1874,8 @@ console.log(\`
|
|
|
1874
1874
|
buildConfig.mode = "production";
|
|
1875
1875
|
try {
|
|
1876
1876
|
const build2 = await resolveBuildModule3([
|
|
1877
|
-
|
|
1878
|
-
|
|
1877
|
+
resolve10(import.meta.dir, "..", "..", "core", "build"),
|
|
1878
|
+
resolve10(import.meta.dir, "..", "build")
|
|
1879
1879
|
]);
|
|
1880
1880
|
if (!build2)
|
|
1881
1881
|
throw new Error("Could not locate build module");
|
|
@@ -1890,7 +1890,7 @@ console.log(\`
|
|
|
1890
1890
|
process.stdout.write(cliTag4("\x1B[36m", "Bundling production server"));
|
|
1891
1891
|
const serverBundle = await Bun.build({
|
|
1892
1892
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
1893
|
-
entrypoints: [
|
|
1893
|
+
entrypoints: [resolve10(serverEntry)],
|
|
1894
1894
|
external: resolveServerBundleExternals(buildConfig),
|
|
1895
1895
|
outdir: resolvedOutdir,
|
|
1896
1896
|
plugins: [
|
|
@@ -1908,13 +1908,13 @@ console.log(\`
|
|
|
1908
1908
|
console.error(cliTag4("\x1B[31m", "Server bundle failed."));
|
|
1909
1909
|
process.exit(1);
|
|
1910
1910
|
}
|
|
1911
|
-
const outputPath =
|
|
1912
|
-
if (!
|
|
1911
|
+
const outputPath = resolve10(resolvedOutdir, `${entryName}.js`);
|
|
1912
|
+
if (!existsSync10(outputPath)) {
|
|
1913
1913
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
1914
1914
|
process.exit(1);
|
|
1915
1915
|
}
|
|
1916
|
-
if (
|
|
1917
|
-
const vendorDir =
|
|
1916
|
+
if (existsSync10(resolve10(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
1917
|
+
const vendorDir = resolve10(resolvedOutdir, "angular", "vendor", "server");
|
|
1918
1918
|
const vendorEntries = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
1919
1919
|
const angularServerVendorPaths = {};
|
|
1920
1920
|
for (const file of vendorEntries) {
|
|
@@ -1923,7 +1923,7 @@ console.log(\`
|
|
|
1923
1923
|
if (scope !== "angular" || rest.length === 0)
|
|
1924
1924
|
continue;
|
|
1925
1925
|
const specifier = `@angular/${rest.join("/")}`;
|
|
1926
|
-
const relPath = relative(dirname3(outputPath),
|
|
1926
|
+
const relPath = relative(dirname3(outputPath), resolve10(vendorDir, file));
|
|
1927
1927
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
1928
1928
|
}
|
|
1929
1929
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -2047,8 +2047,8 @@ var exports_typecheck = {};
|
|
|
2047
2047
|
__export(exports_typecheck, {
|
|
2048
2048
|
typecheck: () => typecheck
|
|
2049
2049
|
});
|
|
2050
|
-
import { resolve as
|
|
2051
|
-
import { existsSync as
|
|
2050
|
+
import { resolve as resolve11, join as join8 } from "path";
|
|
2051
|
+
import { existsSync as existsSync11, readFileSync as readFileSync11 } from "fs";
|
|
2052
2052
|
import { mkdir as mkdir3, writeFile as writeFile2 } from "fs/promises";
|
|
2053
2053
|
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), getTypecheckTargets = async (configPath2) => {
|
|
2054
2054
|
const rawConfig = await loadRawConfig(configPath2);
|
|
@@ -2068,8 +2068,8 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
2068
2068
|
const exitCode = await proc.exited;
|
|
2069
2069
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
2070
2070
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
2071
|
-
const local =
|
|
2072
|
-
return
|
|
2071
|
+
const local = resolve11("node_modules", ".bin", name);
|
|
2072
|
+
return existsSync11(local) ? local : null;
|
|
2073
2073
|
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
2074
2074
|
const cwd = `${process.cwd()}/`;
|
|
2075
2075
|
const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
|
|
@@ -2116,15 +2116,15 @@ Found ${errorCount} error${suffix}.`;
|
|
|
2116
2116
|
return formatted;
|
|
2117
2117
|
}, ABSOLUTE_INTERNAL_EXCLUDES, resolveAbsoluteTypeFile = (fileName) => {
|
|
2118
2118
|
const candidates = [
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2119
|
+
resolve11("node_modules/@absolutejs/absolute/dist/types", fileName),
|
|
2120
|
+
resolve11(import.meta.dir, "../types", fileName),
|
|
2121
|
+
resolve11(import.meta.dir, "../../types", fileName),
|
|
2122
|
+
resolve11(import.meta.dir, "../../../types", fileName)
|
|
2123
2123
|
];
|
|
2124
|
-
return candidates.find((candidate) =>
|
|
2124
|
+
return candidates.find((candidate) => existsSync11(candidate)) ?? candidates[0];
|
|
2125
2125
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
2126
2126
|
try {
|
|
2127
|
-
return JSON.parse(
|
|
2127
|
+
return JSON.parse(readFileSync11(resolve11("tsconfig.json"), "utf-8"));
|
|
2128
2128
|
} catch {
|
|
2129
2129
|
return {};
|
|
2130
2130
|
}
|
|
@@ -2158,13 +2158,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
2158
2158
|
rootDir: ".."
|
|
2159
2159
|
},
|
|
2160
2160
|
exclude: getProjectTypecheckExcludes(),
|
|
2161
|
-
extends:
|
|
2161
|
+
extends: resolve11("tsconfig.json"),
|
|
2162
2162
|
include: getProjectTypecheckIncludes()
|
|
2163
2163
|
}, null, "\t")).then(() => run("vue-tsc", [
|
|
2164
2164
|
vueTscBin,
|
|
2165
2165
|
"--noEmit",
|
|
2166
2166
|
"--project",
|
|
2167
|
-
|
|
2167
|
+
resolve11(vueTsconfigPath),
|
|
2168
2168
|
"--incremental",
|
|
2169
2169
|
"--tsBuildInfoFile",
|
|
2170
2170
|
join8(cacheDir, "vue-tsc.tsbuildinfo"),
|
|
@@ -2186,10 +2186,10 @@ Found ${errorCount} error${suffix}.`;
|
|
|
2186
2186
|
rootDir: ".."
|
|
2187
2187
|
},
|
|
2188
2188
|
exclude: ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
|
|
2189
|
-
extends:
|
|
2189
|
+
extends: resolve11("tsconfig.json"),
|
|
2190
2190
|
include: [`../${angularDir}/**/*`]
|
|
2191
2191
|
}, null, "\t"));
|
|
2192
|
-
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(
|
|
2192
|
+
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve11(angularTsconfigPath))}`);
|
|
2193
2193
|
}, buildTscCheck = (cacheDir) => {
|
|
2194
2194
|
const tscBin = findBin("tsc");
|
|
2195
2195
|
if (!tscBin) {
|
|
@@ -2202,13 +2202,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
2202
2202
|
rootDir: ".."
|
|
2203
2203
|
},
|
|
2204
2204
|
exclude: getProjectTypecheckExcludes(),
|
|
2205
|
-
extends:
|
|
2205
|
+
extends: resolve11("tsconfig.json"),
|
|
2206
2206
|
include: getProjectTypecheckIncludes()
|
|
2207
2207
|
}, null, "\t")).then(() => run("tsc", [
|
|
2208
2208
|
tscBin,
|
|
2209
2209
|
"--noEmit",
|
|
2210
2210
|
"--project",
|
|
2211
|
-
|
|
2211
|
+
resolve11(tscConfigPath),
|
|
2212
2212
|
"--incremental",
|
|
2213
2213
|
"--tsBuildInfoFile",
|
|
2214
2214
|
join8(cacheDir, "tsc.tsbuildinfo"),
|
|
@@ -2222,14 +2222,14 @@ Found ${errorCount} error${suffix}.`;
|
|
|
2222
2222
|
}
|
|
2223
2223
|
const svelteTsconfigPath = join8(cacheDir, "tsconfig.svelte-check.json");
|
|
2224
2224
|
await writeFile2(svelteTsconfigPath, JSON.stringify({
|
|
2225
|
-
extends:
|
|
2225
|
+
extends: resolve11("tsconfig.json"),
|
|
2226
2226
|
files: ABSOLUTE_TYPECHECK_FILES,
|
|
2227
2227
|
include: [`../${svelteDir}/**/*`]
|
|
2228
2228
|
}, null, "\t"));
|
|
2229
2229
|
return run("svelte-check", [
|
|
2230
2230
|
svelteBin,
|
|
2231
2231
|
"--tsconfig",
|
|
2232
|
-
|
|
2232
|
+
resolve11(svelteTsconfigPath),
|
|
2233
2233
|
"--threshold",
|
|
2234
2234
|
"error",
|
|
2235
2235
|
"--compiler-warnings",
|
|
@@ -2852,33 +2852,166 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
2852
2852
|
};
|
|
2853
2853
|
|
|
2854
2854
|
// src/cli/scripts/eslint.ts
|
|
2855
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
|
|
2856
|
+
import { resolve as resolve4 } from "path";
|
|
2857
|
+
var CACHE_LOCATION = ".absolutejs/eslint-cache";
|
|
2858
|
+
var CONFIG_CANDIDATES = [
|
|
2859
|
+
"eslint.config.mjs",
|
|
2860
|
+
"eslint.config.js",
|
|
2861
|
+
"eslint.config.cjs",
|
|
2862
|
+
"eslint.config.ts"
|
|
2863
|
+
];
|
|
2864
|
+
var checkForMisplacedIgnores = () => {
|
|
2865
|
+
const cwd = process.cwd();
|
|
2866
|
+
const configPath2 = CONFIG_CANDIDATES.map((name) => resolve4(cwd, name)).find((candidate) => existsSync6(candidate));
|
|
2867
|
+
if (!configPath2)
|
|
2868
|
+
return;
|
|
2869
|
+
let source;
|
|
2870
|
+
try {
|
|
2871
|
+
source = readFileSync5(configPath2, "utf-8");
|
|
2872
|
+
} catch {
|
|
2873
|
+
return;
|
|
2874
|
+
}
|
|
2875
|
+
const blocks = extractTopLevelObjectLiterals(source);
|
|
2876
|
+
const offenders = [];
|
|
2877
|
+
for (const block of blocks) {
|
|
2878
|
+
if (hasKey(block, "ignores") && hasKey(block, "files")) {
|
|
2879
|
+
offenders.push(block.slice(0, 80).replace(/\s+/g, " "));
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
if (offenders.length === 0)
|
|
2883
|
+
return;
|
|
2884
|
+
const yellow = "\x1B[33m";
|
|
2885
|
+
const reset = "\x1B[0m";
|
|
2886
|
+
const bold = "\x1B[1m";
|
|
2887
|
+
console.warn(`${yellow}${bold}\u26A0 ESLint flat-config warning${reset}${yellow}: found ${offenders.length} 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.
|
|
2888
|
+
|
|
2889
|
+
Move ignores into a standalone block at the top of your config:
|
|
2890
|
+
|
|
2891
|
+
export default defineConfig([
|
|
2892
|
+
{ ignores: ['node_modules/**', 'dist/**', 'build/**', '.absolutejs/**'] },
|
|
2893
|
+
pluginJs.configs.recommended,
|
|
2894
|
+
...
|
|
2895
|
+
]);
|
|
2896
|
+
|
|
2897
|
+
Detected at: ${configPath2}${reset}`);
|
|
2898
|
+
};
|
|
2899
|
+
var hasKey = (objectLiteralSource, key) => {
|
|
2900
|
+
const pattern = new RegExp(`(^|[\\s,{])${key}\\s*:`, "m");
|
|
2901
|
+
return pattern.test(objectLiteralSource);
|
|
2902
|
+
};
|
|
2903
|
+
var extractTopLevelObjectLiterals = (source) => {
|
|
2904
|
+
const arrayStart = source.search(/defineConfig\s*\(\s*\[|export\s+default\s*\[/);
|
|
2905
|
+
if (arrayStart === -1)
|
|
2906
|
+
return [];
|
|
2907
|
+
const fromArray = source.slice(arrayStart);
|
|
2908
|
+
const openBracket = fromArray.indexOf("[");
|
|
2909
|
+
if (openBracket === -1)
|
|
2910
|
+
return [];
|
|
2911
|
+
const blocks = [];
|
|
2912
|
+
let depth = 0;
|
|
2913
|
+
let blockStart = -1;
|
|
2914
|
+
let inString = null;
|
|
2915
|
+
let inLineComment = false;
|
|
2916
|
+
let inBlockComment = false;
|
|
2917
|
+
for (let i = openBracket;i < fromArray.length; i++) {
|
|
2918
|
+
const char = fromArray[i];
|
|
2919
|
+
const next = fromArray[i + 1];
|
|
2920
|
+
if (inLineComment) {
|
|
2921
|
+
if (char === `
|
|
2922
|
+
`)
|
|
2923
|
+
inLineComment = false;
|
|
2924
|
+
continue;
|
|
2925
|
+
}
|
|
2926
|
+
if (inBlockComment) {
|
|
2927
|
+
if (char === "*" && next === "/") {
|
|
2928
|
+
inBlockComment = false;
|
|
2929
|
+
i++;
|
|
2930
|
+
}
|
|
2931
|
+
continue;
|
|
2932
|
+
}
|
|
2933
|
+
if (inString) {
|
|
2934
|
+
if (char === "\\") {
|
|
2935
|
+
i++;
|
|
2936
|
+
continue;
|
|
2937
|
+
}
|
|
2938
|
+
if (char === inString)
|
|
2939
|
+
inString = null;
|
|
2940
|
+
continue;
|
|
2941
|
+
}
|
|
2942
|
+
if (char === "/" && next === "/") {
|
|
2943
|
+
inLineComment = true;
|
|
2944
|
+
continue;
|
|
2945
|
+
}
|
|
2946
|
+
if (char === "/" && next === "*") {
|
|
2947
|
+
inBlockComment = true;
|
|
2948
|
+
i++;
|
|
2949
|
+
continue;
|
|
2950
|
+
}
|
|
2951
|
+
if (char === '"' || char === "'" || char === "`") {
|
|
2952
|
+
inString = char;
|
|
2953
|
+
continue;
|
|
2954
|
+
}
|
|
2955
|
+
if (char === "{") {
|
|
2956
|
+
if (depth === 0)
|
|
2957
|
+
blockStart = i;
|
|
2958
|
+
depth++;
|
|
2959
|
+
} else if (char === "}") {
|
|
2960
|
+
depth--;
|
|
2961
|
+
if (depth === 0 && blockStart !== -1) {
|
|
2962
|
+
blocks.push(fromArray.slice(blockStart, i + 1));
|
|
2963
|
+
blockStart = -1;
|
|
2964
|
+
}
|
|
2965
|
+
} else if (char === "]" && depth === 0) {
|
|
2966
|
+
break;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
return blocks;
|
|
2970
|
+
};
|
|
2971
|
+
var formatDuration = (ms) => {
|
|
2972
|
+
if (ms < 1000)
|
|
2973
|
+
return `${ms}ms`;
|
|
2974
|
+
if (ms < 60000)
|
|
2975
|
+
return `${(ms / 1000).toFixed(2)}s`;
|
|
2976
|
+
const minutes = Math.floor(ms / 60000);
|
|
2977
|
+
const seconds = Math.round(ms % 60000 / 1000);
|
|
2978
|
+
return `${minutes}m ${seconds}s`;
|
|
2979
|
+
};
|
|
2855
2980
|
var eslint = async (args) => {
|
|
2981
|
+
checkForMisplacedIgnores();
|
|
2856
2982
|
const command = [
|
|
2857
2983
|
"bun",
|
|
2858
2984
|
"eslint",
|
|
2859
2985
|
"--cache",
|
|
2860
2986
|
"--cache-location",
|
|
2861
|
-
|
|
2987
|
+
CACHE_LOCATION,
|
|
2862
2988
|
...args,
|
|
2863
2989
|
"."
|
|
2864
2990
|
];
|
|
2991
|
+
const dim = "\x1B[2m";
|
|
2992
|
+
const reset = "\x1B[0m";
|
|
2993
|
+
console.log(`${dim}cache: ${CACHE_LOCATION} (subsequent runs only re-lint changed files)${reset}`);
|
|
2994
|
+
const startedAt = Date.now();
|
|
2865
2995
|
const proc = Bun.spawn(command, {
|
|
2866
2996
|
stderr: "inherit",
|
|
2867
2997
|
stdout: "inherit"
|
|
2868
2998
|
});
|
|
2869
2999
|
const exitCode = await proc.exited;
|
|
2870
|
-
|
|
3000
|
+
const elapsed = formatDuration(Date.now() - startedAt);
|
|
3001
|
+
if (exitCode !== 0) {
|
|
3002
|
+
console.log(`${dim}elapsed: ${elapsed}${reset}`);
|
|
2871
3003
|
process.exit(exitCode);
|
|
2872
|
-
|
|
3004
|
+
}
|
|
3005
|
+
console.log(`\x1B[32m\u2713\x1B[0m Passed ${dim}(${elapsed})${reset}`);
|
|
2873
3006
|
};
|
|
2874
3007
|
|
|
2875
3008
|
// src/cli/scripts/info.ts
|
|
2876
3009
|
init_constants();
|
|
2877
3010
|
init_utils();
|
|
2878
3011
|
import { execSync as execSync2 } from "child_process";
|
|
2879
|
-
import { existsSync as
|
|
3012
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "fs";
|
|
2880
3013
|
import { arch as arch2, cpus, platform as platform3, totalmem, version } from "os";
|
|
2881
|
-
import { resolve as
|
|
3014
|
+
import { resolve as resolve5 } from "path";
|
|
2882
3015
|
var bold = (str) => `\x1B[1m${str}\x1B[0m`;
|
|
2883
3016
|
var getBinaryVersion = (binary, flag = "--version") => {
|
|
2884
3017
|
try {
|
|
@@ -2898,7 +3031,7 @@ var getPackageVersion = (packageName) => {
|
|
|
2898
3031
|
const pkgPath = __require.resolve(`${packageName}/package.json`, {
|
|
2899
3032
|
paths: [process.cwd()]
|
|
2900
3033
|
});
|
|
2901
|
-
const pkg = JSON.parse(
|
|
3034
|
+
const pkg = JSON.parse(readFileSync6(pkgPath, "utf-8"));
|
|
2902
3035
|
const ver = pkg.version;
|
|
2903
3036
|
return ver;
|
|
2904
3037
|
} catch {
|
|
@@ -2908,10 +3041,10 @@ var getPackageVersion = (packageName) => {
|
|
|
2908
3041
|
var getAbsoluteVersion = () => {
|
|
2909
3042
|
try {
|
|
2910
3043
|
const candidates = [
|
|
2911
|
-
|
|
2912
|
-
|
|
3044
|
+
resolve5(import.meta.dir, "..", "..", "package.json"),
|
|
3045
|
+
resolve5(import.meta.dir, "..", "..", "..", "package.json")
|
|
2913
3046
|
];
|
|
2914
|
-
const pkgPath = candidates.find((candidate) =>
|
|
3047
|
+
const pkgPath = candidates.find((candidate) => existsSync7(candidate));
|
|
2915
3048
|
if (pkgPath)
|
|
2916
3049
|
return readPackageVersion(pkgPath);
|
|
2917
3050
|
} catch {
|
|
@@ -2920,7 +3053,7 @@ var getAbsoluteVersion = () => {
|
|
|
2920
3053
|
return getPackageVersion("@absolutejs/absolute");
|
|
2921
3054
|
};
|
|
2922
3055
|
var readPackageVersion = (pkgPath) => {
|
|
2923
|
-
const pkg = JSON.parse(
|
|
3056
|
+
const pkg = JSON.parse(readFileSync6(pkgPath, "utf-8"));
|
|
2924
3057
|
const ver = pkg.version;
|
|
2925
3058
|
return ver;
|
|
2926
3059
|
};
|
|
@@ -2952,7 +3085,7 @@ var detectCI = () => {
|
|
|
2952
3085
|
};
|
|
2953
3086
|
var isDockerEnvironment = () => {
|
|
2954
3087
|
try {
|
|
2955
|
-
return
|
|
3088
|
+
return existsSync7("/.dockerenv");
|
|
2956
3089
|
} catch {
|
|
2957
3090
|
return false;
|
|
2958
3091
|
}
|
|
@@ -3163,8 +3296,8 @@ init_startupBanner();
|
|
|
3163
3296
|
init_telemetryEvent();
|
|
3164
3297
|
init_utils();
|
|
3165
3298
|
var {env: env2 } = globalThis.Bun;
|
|
3166
|
-
import { existsSync as
|
|
3167
|
-
import { basename, resolve as
|
|
3299
|
+
import { existsSync as existsSync8, readFileSync as readFileSync8 } from "fs";
|
|
3300
|
+
import { basename, resolve as resolve7 } from "path";
|
|
3168
3301
|
var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`;
|
|
3169
3302
|
var resolvePackageVersion = (candidates) => {
|
|
3170
3303
|
for (const candidate of candidates) {
|
|
@@ -3177,7 +3310,7 @@ var resolvePackageVersion = (candidates) => {
|
|
|
3177
3310
|
};
|
|
3178
3311
|
var readPackageVersion2 = (candidate) => {
|
|
3179
3312
|
try {
|
|
3180
|
-
const pkg = JSON.parse(
|
|
3313
|
+
const pkg = JSON.parse(readFileSync8(candidate, "utf-8"));
|
|
3181
3314
|
if (pkg.name !== "@absolutejs/absolute")
|
|
3182
3315
|
return null;
|
|
3183
3316
|
const ver = pkg.version;
|
|
@@ -3219,18 +3352,18 @@ var handleBundleFailure = (serverBundle, bundleStart, serverEntry) => {
|
|
|
3219
3352
|
};
|
|
3220
3353
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
3221
3354
|
const candidates = [
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3355
|
+
resolve7(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
3356
|
+
resolve7(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
3357
|
+
resolve7(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
3358
|
+
resolve7(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
3359
|
+
resolve7(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
3360
|
+
resolve7(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
3228
3361
|
];
|
|
3229
3362
|
for (const candidate of candidates) {
|
|
3230
|
-
if (
|
|
3363
|
+
if (existsSync8(candidate))
|
|
3231
3364
|
return candidate;
|
|
3232
3365
|
}
|
|
3233
|
-
return
|
|
3366
|
+
return resolve7(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
3234
3367
|
};
|
|
3235
3368
|
var jsxDevRuntimeCompatPath = resolveJsxDevRuntimeCompatPath();
|
|
3236
3369
|
var prerenderStaticPages = async (outputPath, prerenderPort, resolvedOutdir, staticConfig, absoluteVersion, configPath2) => {
|
|
@@ -3257,10 +3390,10 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
3257
3390
|
const port = Number(env2.PORT) || DEFAULT_PORT;
|
|
3258
3391
|
killStaleProcesses(port);
|
|
3259
3392
|
const entryName = basename(serverEntry).replace(/\.[^.]+$/, "");
|
|
3260
|
-
const resolvedOutdir =
|
|
3393
|
+
const resolvedOutdir = resolve7(outdir ?? "dist");
|
|
3261
3394
|
const absoluteVersion = resolvePackageVersion([
|
|
3262
|
-
|
|
3263
|
-
|
|
3395
|
+
resolve7(import.meta.dir, "..", "..", "..", "package.json"),
|
|
3396
|
+
resolve7(import.meta.dir, "..", "..", "package.json")
|
|
3264
3397
|
]);
|
|
3265
3398
|
const buildStepStart = performance.now();
|
|
3266
3399
|
process.stdout.write(cliTag2("\x1B[36m", `Building assets`));
|
|
@@ -3277,8 +3410,8 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
3277
3410
|
].filter((val) => Boolean(val));
|
|
3278
3411
|
try {
|
|
3279
3412
|
const build = await resolveBuildModule([
|
|
3280
|
-
|
|
3281
|
-
|
|
3413
|
+
resolve7(import.meta.dir, "..", "..", "core", "build"),
|
|
3414
|
+
resolve7(import.meta.dir, "..", "build")
|
|
3282
3415
|
]);
|
|
3283
3416
|
if (!build)
|
|
3284
3417
|
throw new Error("Could not locate build module");
|
|
@@ -3358,7 +3491,7 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
3358
3491
|
};
|
|
3359
3492
|
const serverBundle = await Bun.build({
|
|
3360
3493
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
3361
|
-
entrypoints: [
|
|
3494
|
+
entrypoints: [resolve7(serverEntry)],
|
|
3362
3495
|
external: [
|
|
3363
3496
|
"react",
|
|
3364
3497
|
"react/jsx-runtime",
|
|
@@ -3385,14 +3518,14 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
3385
3518
|
if (!serverBundle.success) {
|
|
3386
3519
|
handleBundleFailure(serverBundle, bundleStart, serverEntry);
|
|
3387
3520
|
}
|
|
3388
|
-
const outputPath =
|
|
3389
|
-
if (!
|
|
3521
|
+
const outputPath = resolve7(resolvedOutdir, `${entryName}.js`);
|
|
3522
|
+
if (!existsSync8(outputPath)) {
|
|
3390
3523
|
console.error(cliTag2("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
3391
3524
|
process.exit(1);
|
|
3392
3525
|
}
|
|
3393
|
-
if (
|
|
3526
|
+
if (existsSync8(resolve7(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
3394
3527
|
const { readdirSync } = await import("fs");
|
|
3395
|
-
const vendorDir =
|
|
3528
|
+
const vendorDir = resolve7(resolvedOutdir, "angular", "vendor", "server");
|
|
3396
3529
|
const vendorEntries = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
3397
3530
|
const angularServerVendorPaths = {};
|
|
3398
3531
|
const { relative: pathRelative, dirname: pathDirname } = await import("path");
|
|
@@ -3402,7 +3535,7 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
3402
3535
|
if (scope !== "angular" || rest.length === 0)
|
|
3403
3536
|
continue;
|
|
3404
3537
|
const specifier = `@angular/${rest.join("/")}`;
|
|
3405
|
-
const relPath = pathRelative(pathDirname(outputPath),
|
|
3538
|
+
const relPath = pathRelative(pathDirname(outputPath), resolve7(vendorDir, file));
|
|
3406
3539
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
3407
3540
|
}
|
|
3408
3541
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -3420,7 +3553,7 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
3420
3553
|
if (buildConfig.static) {
|
|
3421
3554
|
await prerenderStaticPages(outputPath, port + 1, resolvedOutdir, buildConfig.static, absoluteVersion, configPath2);
|
|
3422
3555
|
}
|
|
3423
|
-
const usesDocker =
|
|
3556
|
+
const usesDocker = existsSync8(resolve7(COMPOSE_PATH));
|
|
3424
3557
|
const scripts = usesDocker ? await readDbScripts() : null;
|
|
3425
3558
|
if (scripts)
|
|
3426
3559
|
await startDatabase(scripts);
|
|
@@ -3487,15 +3620,15 @@ init_loadConfig();
|
|
|
3487
3620
|
init_getDurationString();
|
|
3488
3621
|
import {
|
|
3489
3622
|
appendFileSync,
|
|
3490
|
-
existsSync as
|
|
3623
|
+
existsSync as existsSync9,
|
|
3491
3624
|
mkdirSync as mkdirSync4,
|
|
3492
3625
|
readdirSync,
|
|
3493
|
-
readFileSync as
|
|
3626
|
+
readFileSync as readFileSync9,
|
|
3494
3627
|
unlinkSync,
|
|
3495
3628
|
writeFileSync as writeFileSync2
|
|
3496
3629
|
} from "fs";
|
|
3497
3630
|
import { createConnection } from "net";
|
|
3498
|
-
import { resolve as
|
|
3631
|
+
import { resolve as resolve8 } from "path";
|
|
3499
3632
|
|
|
3500
3633
|
// src/cli/workspaceTui.ts
|
|
3501
3634
|
init_constants();
|
|
@@ -4157,11 +4290,11 @@ var sleep = (durationMs) => Bun.sleep(durationMs);
|
|
|
4157
4290
|
var stripAnsi2 = (value) => value.replace(ANSI_REGEX2, "");
|
|
4158
4291
|
var sanitizeLogFileName = (value) => value.replace(/[^a-zA-Z0-9._-]/g, "_") || "unknown";
|
|
4159
4292
|
var createWorkspaceLogSink = (appendLog) => {
|
|
4160
|
-
const logDirectory =
|
|
4293
|
+
const logDirectory = resolve8(".absolutejs", "workspace", "logs");
|
|
4161
4294
|
mkdirSync4(logDirectory, { recursive: true });
|
|
4162
|
-
readdirSync(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync(
|
|
4163
|
-
writeFileSync2(
|
|
4164
|
-
writeFileSync2(
|
|
4295
|
+
readdirSync(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync(resolve8(logDirectory, file)));
|
|
4296
|
+
writeFileSync2(resolve8(logDirectory, "all.log"), "");
|
|
4297
|
+
writeFileSync2(resolve8(logDirectory, "workspace.log"), "");
|
|
4165
4298
|
const initializedSources = new Set(["workspace"]);
|
|
4166
4299
|
const writeLog = (source, message, level) => {
|
|
4167
4300
|
const cleanMessage = stripAnsi2(message).trimEnd();
|
|
@@ -4171,13 +4304,13 @@ var createWorkspaceLogSink = (appendLog) => {
|
|
|
4171
4304
|
const timestamp = new Date().toISOString();
|
|
4172
4305
|
const line = `[${timestamp}] [${level}] [${source}] ${cleanMessage}
|
|
4173
4306
|
`;
|
|
4174
|
-
const sourceFile =
|
|
4307
|
+
const sourceFile = resolve8(logDirectory, `${sanitizeLogFileName(source)}.log`);
|
|
4175
4308
|
if (!initializedSources.has(source)) {
|
|
4176
4309
|
writeFileSync2(sourceFile, "");
|
|
4177
4310
|
initializedSources.add(source);
|
|
4178
4311
|
}
|
|
4179
4312
|
appendFileSync(sourceFile, line);
|
|
4180
|
-
appendFileSync(
|
|
4313
|
+
appendFileSync(resolve8(logDirectory, "all.log"), line);
|
|
4181
4314
|
};
|
|
4182
4315
|
return {
|
|
4183
4316
|
appendLog: (source, message, level = "info") => {
|
|
@@ -4189,7 +4322,7 @@ var createWorkspaceLogSink = (appendLog) => {
|
|
|
4189
4322
|
};
|
|
4190
4323
|
var readPackageVersion3 = (candidate) => {
|
|
4191
4324
|
try {
|
|
4192
|
-
const pkg = JSON.parse(
|
|
4325
|
+
const pkg = JSON.parse(readFileSync9(candidate, "utf-8"));
|
|
4193
4326
|
if (pkg.name !== "@absolutejs/absolute") {
|
|
4194
4327
|
return null;
|
|
4195
4328
|
}
|
|
@@ -4201,9 +4334,9 @@ var readPackageVersion3 = (candidate) => {
|
|
|
4201
4334
|
};
|
|
4202
4335
|
var resolvePackageVersion2 = () => {
|
|
4203
4336
|
const candidates = [
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4337
|
+
resolve8(import.meta.dir, "..", "..", "package.json"),
|
|
4338
|
+
resolve8(import.meta.dir, "..", "..", "..", "package.json"),
|
|
4339
|
+
resolve8(import.meta.dir, "..", "..", "..", "..", "package.json")
|
|
4207
4340
|
];
|
|
4208
4341
|
for (const candidate of candidates) {
|
|
4209
4342
|
const version2 = readPackageVersion3(candidate);
|
|
@@ -4551,15 +4684,15 @@ var createWorkspaceServiceEnv = (services) => {
|
|
|
4551
4684
|
var getDefinedProcessEnv = () => Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string"));
|
|
4552
4685
|
var resolveAbsoluteServiceConfigPath = (service, cwd, options) => {
|
|
4553
4686
|
if (service.config)
|
|
4554
|
-
return
|
|
4687
|
+
return resolve8(cwd, service.config);
|
|
4555
4688
|
if (options.configPath)
|
|
4556
|
-
return
|
|
4689
|
+
return resolve8(options.configPath);
|
|
4557
4690
|
if (process.env.ABSOLUTE_CONFIG)
|
|
4558
|
-
return
|
|
4691
|
+
return resolve8(process.env.ABSOLUTE_CONFIG);
|
|
4559
4692
|
return;
|
|
4560
4693
|
};
|
|
4561
4694
|
var resolveService = (name, service, workspaceEnv, options) => {
|
|
4562
|
-
const cwd =
|
|
4695
|
+
const cwd = resolve8(service.cwd ?? ".");
|
|
4563
4696
|
const envVars = Object.assign(getDefinedProcessEnv(), workspaceEnv, service.env, {
|
|
4564
4697
|
ABSOLUTE_WORKSPACE_MANAGED: "1",
|
|
4565
4698
|
ABSOLUTE_WORKSPACE_SERVICE_NAME: name,
|
|
@@ -4601,8 +4734,8 @@ var resolveService = (name, service, workspaceEnv, options) => {
|
|
|
4601
4734
|
var resolveServiceBuildDirectory = (service) => {
|
|
4602
4735
|
if (!isAbsoluteService(service))
|
|
4603
4736
|
return null;
|
|
4604
|
-
const cwd =
|
|
4605
|
-
return
|
|
4737
|
+
const cwd = resolve8(service.cwd ?? ".");
|
|
4738
|
+
return resolve8(cwd, service.buildDirectory ?? "build");
|
|
4606
4739
|
};
|
|
4607
4740
|
var findSharedWorkspaceBuildDirectories = (services) => {
|
|
4608
4741
|
const byBuildDirectory = new Map;
|
|
@@ -4790,7 +4923,7 @@ var workspace = async (subcommand, options) => {
|
|
|
4790
4923
|
const resolved = resolveService(name, service, workspaceEnv, options);
|
|
4791
4924
|
const port = (resolved.service.port ?? Number(resolved.env.PORT ?? "")) || DEFAULT_PORT;
|
|
4792
4925
|
killStaleServicePort(port);
|
|
4793
|
-
if (isAbsoluteService(resolved.service) && resolved.configPath && !
|
|
4926
|
+
if (isAbsoluteService(resolved.service) && resolved.configPath && !existsSync9(resolved.configPath)) {
|
|
4794
4927
|
throw new Error(`${name} references missing config "${resolved.configPath}"`);
|
|
4795
4928
|
}
|
|
4796
4929
|
serviceBootStartedAt.set(name, performance.now());
|