@absolutejs/absolute 0.19.0-beta.811 → 0.19.0-beta.812

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -1048,6 +1048,98 @@ var init_build = __esm(() => {
1048
1048
  init_telemetryEvent();
1049
1049
  });
1050
1050
 
1051
+ // src/utils/buildDirectoryLock.ts
1052
+ import { mkdir as mkdir2, rm, stat, writeFile } from "fs/promises";
1053
+ import { dirname as dirname2, join as join6 } from "path";
1054
+ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250, heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join6(dirname2(buildDirectory), `.${buildDirectory.split(/[\\/]/).pop()}.lock`), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
1055
+ `).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
1056
+ if (locks.size === 0) {
1057
+ delete process.env[HELD_LOCKS_ENV];
1058
+ return;
1059
+ }
1060
+ process.env[HELD_LOCKS_ENV] = Array.from(locks).join(`
1061
+ `);
1062
+ }, markHeldLock = (buildDirectory) => {
1063
+ const locks = readHeldLockEnv();
1064
+ locks.add(buildDirectory);
1065
+ writeHeldLockEnv(locks);
1066
+ }, unmarkHeldLock = (buildDirectory) => {
1067
+ const locks = readHeldLockEnv();
1068
+ locks.delete(buildDirectory);
1069
+ writeHeldLockEnv(locks);
1070
+ }, acquireBuildDirectoryLock = async (buildDirectory, options = {}) => {
1071
+ if (readHeldLockEnv().has(buildDirectory)) {
1072
+ return async () => {};
1073
+ }
1074
+ const heldLock = heldLocks.get(buildDirectory);
1075
+ if (heldLock) {
1076
+ heldLock.count += 1;
1077
+ return async () => {
1078
+ heldLock.count -= 1;
1079
+ if (heldLock.count === 0) {
1080
+ heldLocks.delete(buildDirectory);
1081
+ await heldLock.release();
1082
+ }
1083
+ };
1084
+ }
1085
+ const lockPath = lockPathForBuildDirectory(buildDirectory);
1086
+ const staleLockMs = options.staleLockMs ?? DEFAULT_STALE_LOCK_MS;
1087
+ const timeoutMs = options.timeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS;
1088
+ const start2 = Date.now();
1089
+ while (true) {
1090
+ try {
1091
+ await mkdir2(dirname2(lockPath), { recursive: true });
1092
+ await mkdir2(lockPath);
1093
+ await writeFile(join6(lockPath, "owner"), JSON.stringify({
1094
+ buildDirectory,
1095
+ createdAt: new Date().toISOString(),
1096
+ pid: process.pid
1097
+ }, null, 2));
1098
+ const release = async () => {
1099
+ await rm(lockPath, { force: true, recursive: true }).catch(() => {});
1100
+ };
1101
+ heldLocks.set(buildDirectory, { count: 1, release });
1102
+ markHeldLock(buildDirectory);
1103
+ return async () => {
1104
+ const current = heldLocks.get(buildDirectory);
1105
+ if (!current)
1106
+ return;
1107
+ current.count -= 1;
1108
+ if (current.count > 0)
1109
+ return;
1110
+ heldLocks.delete(buildDirectory);
1111
+ unmarkHeldLock(buildDirectory);
1112
+ await current.release();
1113
+ };
1114
+ } catch (error) {
1115
+ if (!isAlreadyExistsError(error))
1116
+ throw error;
1117
+ try {
1118
+ const lockStat = await stat(lockPath);
1119
+ if (Date.now() - lockStat.mtimeMs > staleLockMs) {
1120
+ await rm(lockPath, { force: true, recursive: true });
1121
+ continue;
1122
+ }
1123
+ } catch {}
1124
+ if (Date.now() - start2 > timeoutMs) {
1125
+ throw new Error(`Timed out waiting for AbsoluteJS build directory lock: ${buildDirectory}`);
1126
+ }
1127
+ await Bun.sleep(LOCK_POLL_MS);
1128
+ }
1129
+ }
1130
+ }, withBuildDirectoryLock = async (buildDirectory, action) => {
1131
+ const release = await acquireBuildDirectoryLock(buildDirectory);
1132
+ try {
1133
+ return await action();
1134
+ } finally {
1135
+ await release();
1136
+ }
1137
+ };
1138
+ var init_buildDirectoryLock = __esm(() => {
1139
+ DEFAULT_STALE_LOCK_MS = 10 * 60000;
1140
+ heldLocks = new Map;
1141
+ });
1142
+
1051
1143
  // src/cli/scripts/compile.ts
1052
1144
  var exports_compile = {};
1053
1145
  __export(exports_compile, {
@@ -1066,7 +1158,7 @@ import {
1066
1158
  unlinkSync as unlinkSync2,
1067
1159
  writeFileSync as writeFileSync3
1068
1160
  } from "fs";
1069
- import { basename as basename2, dirname as dirname2, join as join6, relative, resolve as resolve9 } from "path";
1161
+ import { basename as basename2, dirname as dirname3, join as join7, relative, resolve as resolve9 } from "path";
1070
1162
  var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
1071
1163
  const resolvedVersion = version2 || "unknown";
1072
1164
  console.log("");
@@ -1079,7 +1171,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1079
1171
  const entry = pending.pop();
1080
1172
  if (!entry)
1081
1173
  continue;
1082
- const fullPath = join6(entry.parentPath, entry.name);
1174
+ const fullPath = join7(entry.parentPath, entry.name);
1083
1175
  if (entry.isDirectory())
1084
1176
  pending = pending.concat(readdirSync2(fullPath, { withFileTypes: true }));
1085
1177
  else
@@ -1099,7 +1191,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1099
1191
  const entry = pending.pop();
1100
1192
  if (!entry)
1101
1193
  continue;
1102
- const fullPath = join6(entry.parentPath, entry.name);
1194
+ const fullPath = join7(entry.parentPath, entry.name);
1103
1195
  if (entry.isDirectory()) {
1104
1196
  if (SERVER_RUNTIME_SCAN_SKIP_DIRS.has(entry.name))
1105
1197
  continue;
@@ -1113,7 +1205,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1113
1205
  const copied = new Set;
1114
1206
  const normalizedOutdir = resolve9(outdir);
1115
1207
  const copyReference = (filePath, relPath) => {
1116
- const assetSource = resolve9(dirname2(filePath), relPath);
1208
+ const assetSource = resolve9(dirname3(filePath), relPath);
1117
1209
  if (!existsSync9(assetSource) || !statSync(assetSource).isFile())
1118
1210
  return;
1119
1211
  const assetTarget = resolve9(normalizedOutdir, relPath.replace(/^\.\//, ""));
@@ -1122,7 +1214,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1122
1214
  if (copied.has(assetTarget))
1123
1215
  return;
1124
1216
  copied.add(assetTarget);
1125
- mkdirSync5(dirname2(assetTarget), { recursive: true });
1217
+ mkdirSync5(dirname3(assetTarget), { recursive: true });
1126
1218
  cpSync(assetSource, assetTarget, { force: true });
1127
1219
  };
1128
1220
  for (const filePath of collectProjectSourceFiles(process.cwd())) {
@@ -1214,7 +1306,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1214
1306
  return true;
1215
1307
  }, tryReadNodePackageJson = (packageDir) => {
1216
1308
  try {
1217
- return JSON.parse(readFileSync9(join6(packageDir, "package.json"), "utf-8"));
1309
+ return JSON.parse(readFileSync9(join7(packageDir, "package.json"), "utf-8"));
1218
1310
  } catch {
1219
1311
  return null;
1220
1312
  }
@@ -1226,7 +1318,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1226
1318
  if (!pkg)
1227
1319
  return;
1228
1320
  seen.add(specifier);
1229
- const destDir = join6(outdir, "node_modules", ...specifier.split("/"));
1321
+ const destDir = join7(outdir, "node_modules", ...specifier.split("/"));
1230
1322
  rmSync2(destDir, { force: true, recursive: true });
1231
1323
  cpSync(srcDir, destDir, {
1232
1324
  filter(source) {
@@ -1272,7 +1364,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1272
1364
  }
1273
1365
  copyAngularRuntimePackages(buildConfig, outdir);
1274
1366
  }, collectRuntimePackageSpecifiers = (distDir) => {
1275
- const nodeModulesDir = join6(distDir, "node_modules");
1367
+ const nodeModulesDir = join7(distDir, "node_modules");
1276
1368
  if (!existsSync9(nodeModulesDir))
1277
1369
  return [];
1278
1370
  const specifiers = [];
@@ -1280,7 +1372,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1280
1372
  if (!entry.isDirectory())
1281
1373
  continue;
1282
1374
  if (entry.name.startsWith("@")) {
1283
- const scopeDir = join6(nodeModulesDir, entry.name);
1375
+ const scopeDir = join7(nodeModulesDir, entry.name);
1284
1376
  for (const scopedEntry of readdirSync2(scopeDir, {
1285
1377
  withFileTypes: true
1286
1378
  })) {
@@ -1294,7 +1386,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1294
1386
  }
1295
1387
  return specifiers.sort((a, b) => b.length - a.length);
1296
1388
  }, ensureRelativeModuleSpecifier = (fromFile, toFile) => {
1297
- const rel = relative(dirname2(fromFile), toFile).replace(/\\/g, "/");
1389
+ const rel = relative(dirname3(fromFile), toFile).replace(/\\/g, "/");
1298
1390
  return rel.startsWith(".") ? rel : `./${rel}`;
1299
1391
  }, pickExportEntry = (value) => {
1300
1392
  if (typeof value === "string")
@@ -1312,18 +1404,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1312
1404
  const packageSpecifier = packageSpecifiers.find((root) => specifier === root || specifier.startsWith(`${root}/`));
1313
1405
  if (!packageSpecifier)
1314
1406
  return null;
1315
- const packageDir = join6(distDir, "node_modules", ...packageSpecifier.split("/"));
1407
+ const packageDir = join7(distDir, "node_modules", ...packageSpecifier.split("/"));
1316
1408
  const subpath = specifier.slice(packageSpecifier.length);
1317
- const subPackageDir = subpath ? join6(packageDir, ...subpath.slice(1).split("/")) : null;
1318
- const resolvedPackageDir = subPackageDir && existsSync9(join6(subPackageDir, "package.json")) ? subPackageDir : packageDir;
1319
- const packageJsonPath = join6(resolvedPackageDir, "package.json");
1409
+ const subPackageDir = subpath ? join7(packageDir, ...subpath.slice(1).split("/")) : null;
1410
+ const resolvedPackageDir = subPackageDir && existsSync9(join7(subPackageDir, "package.json")) ? subPackageDir : packageDir;
1411
+ const packageJsonPath = join7(resolvedPackageDir, "package.json");
1320
1412
  if (!existsSync9(packageJsonPath))
1321
1413
  return null;
1322
1414
  const pkg = JSON.parse(readFileSync9(packageJsonPath, "utf-8"));
1323
1415
  const exportKey = resolvedPackageDir === subPackageDir ? "." : subpath ? `.${subpath}` : ".";
1324
1416
  const rootExport = pkg.exports?.[exportKey];
1325
1417
  const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
1326
- return join6(resolvedPackageDir, entry);
1418
+ return join7(resolvedPackageDir, entry);
1327
1419
  }, RUNTIME_JS_EXTENSIONS, MODULE_SPECIFIER_RE, isRuntimeJsFile = (filePath) => RUNTIME_JS_EXTENSIONS.some((extension) => filePath.endsWith(extension)), isNodeModulesPath = (filePath) => filePath.split(/[\\/]/).includes("node_modules"), isFile = (filePath) => {
1328
1420
  try {
1329
1421
  return statSync(filePath).isFile();
@@ -1336,16 +1428,16 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1336
1428
  const candidates = [
1337
1429
  candidate,
1338
1430
  ...RUNTIME_JS_EXTENSIONS.map((extension) => `${candidate}${extension}`),
1339
- ...RUNTIME_JS_EXTENSIONS.map((extension) => join6(candidate, `index${extension}`))
1431
+ ...RUNTIME_JS_EXTENSIONS.map((extension) => join7(candidate, `index${extension}`))
1340
1432
  ];
1341
1433
  return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
1342
1434
  }, findContainingRuntimePackageDir = (filePath) => {
1343
- let dir = dirname2(filePath);
1344
- while (dir !== dirname2(dir)) {
1345
- if (isNodeModulesPath(dir) && existsSync9(join6(dir, "package.json"))) {
1435
+ let dir = dirname3(filePath);
1436
+ while (dir !== dirname3(dir)) {
1437
+ if (isNodeModulesPath(dir) && existsSync9(join7(dir, "package.json"))) {
1346
1438
  return dir;
1347
1439
  }
1348
- dir = dirname2(dir);
1440
+ dir = dirname3(dir);
1349
1441
  }
1350
1442
  return null;
1351
1443
  }, resolvePackageImportEntryFile = (fromFile, specifier) => {
@@ -1358,7 +1450,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1358
1450
  const entry = pickExportEntry(pkg?.imports?.[specifier]);
1359
1451
  if (!entry)
1360
1452
  return null;
1361
- return join6(packageDir, entry);
1453
+ return join7(packageDir, entry);
1362
1454
  }, collectRuntimeRewriteRoots = (distDir) => collectFiles2(distDir).filter((filePath) => isRuntimeJsFile(filePath) && !isNodeModulesPath(filePath)), rewriteRuntimeModuleSpecifiers = (distDir) => {
1363
1455
  const packageSpecifiers = collectRuntimePackageSpecifiers(distDir);
1364
1456
  if (packageSpecifiers.length === 0)
@@ -1380,7 +1472,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1380
1472
  const source = readFileSync9(filePath, "utf-8");
1381
1473
  const rewritten = source.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
1382
1474
  if (typeof specifier === "string" && specifier.startsWith(".")) {
1383
- enqueue(resolveRuntimeJsFile(resolve9(dirname2(filePath), specifier)));
1475
+ enqueue(resolveRuntimeJsFile(resolve9(dirname3(filePath), specifier)));
1384
1476
  return match;
1385
1477
  }
1386
1478
  const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
@@ -1762,10 +1854,12 @@ console.log(\`
1762
1854
  return false;
1763
1855
  return true;
1764
1856
  }), compile = async (serverEntry, outdir, outfile, configPath2) => {
1857
+ const resolvedOutdir = resolve9(outdir ?? "dist");
1858
+ await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
1859
+ }, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
1765
1860
  const prerenderPort = Number(env3.COMPILE_PORT) || Number(env3.PORT) || DEFAULT_PORT + 1;
1766
1861
  killStaleProcesses(prerenderPort);
1767
1862
  const entryName = basename2(serverEntry).replace(/\.[^.]+$/, "");
1768
- const resolvedOutdir = resolve9(outdir ?? "dist");
1769
1863
  const resolvedOutfile = resolve9(outfile ?? "compiled-server");
1770
1864
  const absoluteVersion = resolvePackageVersion3([
1771
1865
  resolve9(import.meta.dir, "..", "..", "..", "package.json"),
@@ -1829,7 +1923,7 @@ console.log(\`
1829
1923
  if (scope !== "angular" || rest.length === 0)
1830
1924
  continue;
1831
1925
  const specifier = `@angular/${rest.join("/")}`;
1832
- const relPath = relative(dirname2(outputPath), resolve9(vendorDir, file));
1926
+ const relPath = relative(dirname3(outputPath), resolve9(vendorDir, file));
1833
1927
  angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
1834
1928
  }
1835
1929
  if (Object.keys(angularServerVendorPaths).length > 0) {
@@ -1841,7 +1935,7 @@ console.log(\`
1841
1935
  copyServerRuntimeAssetReferences(resolvedOutdir);
1842
1936
  const prerenderStart = performance.now();
1843
1937
  process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
1844
- rmSync2(join6(resolvedOutdir, "_prerendered"), {
1938
+ rmSync2(join7(resolvedOutdir, "_prerendered"), {
1845
1939
  force: true,
1846
1940
  recursive: true
1847
1941
  });
@@ -1860,8 +1954,9 @@ console.log(\`
1860
1954
  const compileStart = performance.now();
1861
1955
  process.stdout.write(cliTag4("\x1B[36m", "Compiling standalone executable"));
1862
1956
  const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
1863
- const entrypointPath = join6(resolvedOutdir, "_compile_entrypoint.ts");
1957
+ const entrypointPath = join7(resolvedOutdir, "_compile_entrypoint.ts");
1864
1958
  await Bun.write(entrypointPath, entrypointCode);
1959
+ mkdirSync5(dirname3(resolvedOutfile), { recursive: true });
1865
1960
  const result = await Bun.build({
1866
1961
  compile: { outfile: resolvedOutfile },
1867
1962
  define: { "process.env.NODE_ENV": '"production"' },
@@ -1900,6 +1995,7 @@ var init_compile = __esm(() => {
1900
1995
  init_constants();
1901
1996
  init_prerender();
1902
1997
  init_getDurationString();
1998
+ init_buildDirectoryLock();
1903
1999
  init_loadConfig();
1904
2000
  init_startupBanner();
1905
2001
  init_telemetryEvent();
@@ -1951,9 +2047,9 @@ var exports_typecheck = {};
1951
2047
  __export(exports_typecheck, {
1952
2048
  typecheck: () => typecheck
1953
2049
  });
1954
- import { resolve as resolve10, join as join7 } from "path";
2050
+ import { resolve as resolve10, join as join8 } from "path";
1955
2051
  import { existsSync as existsSync10, readFileSync as readFileSync10 } from "fs";
1956
- import { mkdir as mkdir2, writeFile } from "fs/promises";
2052
+ import { mkdir as mkdir3, writeFile as writeFile2 } from "fs/promises";
1957
2053
  var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), getTypecheckTargets = async (configPath2) => {
1958
2054
  const rawConfig = await loadRawConfig(configPath2);
1959
2055
  if (!isWorkspaceConfig(rawConfig)) {
@@ -2018,7 +2114,7 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
2018
2114
  Found ${errorCount} error${suffix}.`;
2019
2115
  }
2020
2116
  return formatted;
2021
- }, TYPECHECK_EXCLUDE, TYPECHECK_INCLUDE, resolveAbsoluteTypeFile = (fileName) => {
2117
+ }, ABSOLUTE_INTERNAL_EXCLUDES, resolveAbsoluteTypeFile = (fileName) => {
2022
2118
  const candidates = [
2023
2119
  resolve10("node_modules/@absolutejs/absolute/dist/types", fileName),
2024
2120
  resolve10(import.meta.dir, "../types", fileName),
@@ -2034,7 +2130,7 @@ Found ${errorCount} error${suffix}.`;
2034
2130
  }
2035
2131
  }, toGeneratedConfigPath = (path) => path.startsWith("/") ? path : `../${path}`, getProjectTypecheckIncludes = () => {
2036
2132
  const config = readProjectTsconfig();
2037
- const includes = Array.isArray(config.include) && config.include.length > 0 ? config.include : TYPECHECK_INCLUDE;
2133
+ const includes = Array.isArray(config.include) && config.include.length > 0 ? config.include : ["**/*"];
2038
2134
  const files = Array.isArray(config.files) ? config.files : [];
2039
2135
  return [
2040
2136
  ...includes.map(toGeneratedConfigPath),
@@ -2046,7 +2142,7 @@ Found ${errorCount} error${suffix}.`;
2046
2142
  const excludes = Array.isArray(config.exclude) ? config.exclude : [];
2047
2143
  return [
2048
2144
  ...new Set([
2049
- ...TYPECHECK_EXCLUDE,
2145
+ ...ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
2050
2146
  ...excludes.map(toGeneratedConfigPath)
2051
2147
  ])
2052
2148
  ];
@@ -2056,8 +2152,8 @@ Found ${errorCount} error${suffix}.`;
2056
2152
  console.error("\x1B[31m\u2717\x1B[0m vue-tsc is required for Vue type checking. Install it: bun add -d vue-tsc");
2057
2153
  process.exit(1);
2058
2154
  }
2059
- const vueTsconfigPath = join7(cacheDir, "tsconfig.vue-check.json");
2060
- return writeFile(vueTsconfigPath, JSON.stringify({
2155
+ const vueTsconfigPath = join8(cacheDir, "tsconfig.vue-check.json");
2156
+ return writeFile2(vueTsconfigPath, JSON.stringify({
2061
2157
  compilerOptions: {
2062
2158
  rootDir: ".."
2063
2159
  },
@@ -2071,7 +2167,7 @@ Found ${errorCount} error${suffix}.`;
2071
2167
  resolve10(vueTsconfigPath),
2072
2168
  "--incremental",
2073
2169
  "--tsBuildInfoFile",
2074
- join7(cacheDir, "vue-tsc.tsbuildinfo"),
2170
+ join8(cacheDir, "vue-tsc.tsbuildinfo"),
2075
2171
  "--pretty"
2076
2172
  ]));
2077
2173
  }, buildAngularCheck = async (cacheDir, angularDir) => {
@@ -2080,8 +2176,8 @@ Found ${errorCount} error${suffix}.`;
2080
2176
  console.error("\x1B[31m\u2717\x1B[0m @angular/compiler-cli is required for Angular type checking. Install it: bun add -d @angular/compiler-cli");
2081
2177
  process.exit(1);
2082
2178
  }
2083
- const angularTsconfigPath = join7(cacheDir, "tsconfig.angular-check.json");
2084
- await writeFile(angularTsconfigPath, JSON.stringify({
2179
+ const angularTsconfigPath = join8(cacheDir, "tsconfig.angular-check.json");
2180
+ await writeFile2(angularTsconfigPath, JSON.stringify({
2085
2181
  angularCompilerOptions: {
2086
2182
  strictTemplates: true
2087
2183
  },
@@ -2089,7 +2185,7 @@ Found ${errorCount} error${suffix}.`;
2089
2185
  noEmit: true,
2090
2186
  rootDir: ".."
2091
2187
  },
2092
- exclude: TYPECHECK_EXCLUDE,
2188
+ exclude: ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
2093
2189
  extends: resolve10("tsconfig.json"),
2094
2190
  include: [`../${angularDir}/**/*`]
2095
2191
  }, null, "\t"));
@@ -2100,8 +2196,8 @@ Found ${errorCount} error${suffix}.`;
2100
2196
  console.error("\x1B[31m\u2717\x1B[0m typescript is required for type checking. Install it: bun add -d typescript");
2101
2197
  process.exit(1);
2102
2198
  }
2103
- const tscConfigPath = join7(cacheDir, "tsconfig.typecheck.json");
2104
- return writeFile(tscConfigPath, JSON.stringify({
2199
+ const tscConfigPath = join8(cacheDir, "tsconfig.typecheck.json");
2200
+ return writeFile2(tscConfigPath, JSON.stringify({
2105
2201
  compilerOptions: {
2106
2202
  rootDir: ".."
2107
2203
  },
@@ -2115,7 +2211,7 @@ Found ${errorCount} error${suffix}.`;
2115
2211
  resolve10(tscConfigPath),
2116
2212
  "--incremental",
2117
2213
  "--tsBuildInfoFile",
2118
- join7(cacheDir, "tsc.tsbuildinfo"),
2214
+ join8(cacheDir, "tsc.tsbuildinfo"),
2119
2215
  "--pretty"
2120
2216
  ]));
2121
2217
  }, buildSvelteCheck = async (cacheDir, svelteDir) => {
@@ -2124,8 +2220,8 @@ Found ${errorCount} error${suffix}.`;
2124
2220
  console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
2125
2221
  process.exit(1);
2126
2222
  }
2127
- const svelteTsconfigPath = join7(cacheDir, "tsconfig.svelte-check.json");
2128
- await writeFile(svelteTsconfigPath, JSON.stringify({
2223
+ const svelteTsconfigPath = join8(cacheDir, "tsconfig.svelte-check.json");
2224
+ await writeFile2(svelteTsconfigPath, JSON.stringify({
2129
2225
  extends: resolve10("tsconfig.json"),
2130
2226
  files: ABSOLUTE_TYPECHECK_FILES,
2131
2227
  include: [`../${svelteDir}/**/*`]
@@ -2154,7 +2250,7 @@ Found ${errorCount} error${suffix}.`;
2154
2250
  ...new Set(targets.map((config) => config.angularDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
2155
2251
  ];
2156
2252
  const cacheDir = ".absolutejs";
2157
- await mkdir2(cacheDir, { recursive: true });
2253
+ await mkdir3(cacheDir, { recursive: true });
2158
2254
  const checks = [];
2159
2255
  checks.push(hasVue ? buildVueTscCheck(cacheDir) : buildTscCheck(cacheDir));
2160
2256
  for (const svelteDir of hasSvelte ? svelteDirs : []) {
@@ -2186,20 +2282,10 @@ var init_typecheck = __esm(() => {
2186
2282
  ANSI_PURPLE_REGEX = `${String.fromCharCode(ANSI_ESCAPE_CODE)}[35m`;
2187
2283
  ANSI_CYAN_REGEX = new RegExp(`^${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[36m|\\t`);
2188
2284
  ANSI_TOKEN_END_REGEX = new RegExp(`${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[3[69]m`);
2189
- TYPECHECK_EXCLUDE = [
2190
- "../node_modules/**/*",
2191
- "../**/.absolutejs/**/*",
2192
- "../**/build/**/*",
2193
- "../**/dist/**/*",
2194
- "../**/generated/**/*"
2195
- ];
2196
- TYPECHECK_INCLUDE = [
2197
- "../src/**/*",
2198
- "../types/**/*",
2199
- "../example/**/*",
2200
- "../tests/**/*",
2201
- "../test/**/*",
2202
- "../scripts/**/*"
2285
+ ABSOLUTE_INTERNAL_EXCLUDES = [
2286
+ ".absolutejs/**/*",
2287
+ "**/build/**/*",
2288
+ "**/generated/**/*"
2203
2289
  ];
2204
2290
  ABSOLUTE_TYPECHECK_FILES = [
2205
2291
  resolveAbsoluteTypeFile("style-module-shim.d.ts")
package/dist/index.js CHANGED
@@ -9844,22 +9844,66 @@ var init_commonAncestor = () => {};
9844
9844
  // src/utils/buildDirectoryLock.ts
9845
9845
  import { mkdir as mkdir3, rm as rm4, stat as stat2, writeFile as writeFile4 } from "fs/promises";
9846
9846
  import { dirname as dirname10, join as join14 } from "path";
9847
- var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join14(dirname10(buildDirectory), `.${buildDirectory.split(/[\\/]/).pop()}.lock`), acquireBuildDirectoryLock = async (buildDirectory, options = {}) => {
9847
+ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250, heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join14(dirname10(buildDirectory), `.${buildDirectory.split(/[\\/]/).pop()}.lock`), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
9848
+ `).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
9849
+ if (locks.size === 0) {
9850
+ delete process.env[HELD_LOCKS_ENV];
9851
+ return;
9852
+ }
9853
+ process.env[HELD_LOCKS_ENV] = Array.from(locks).join(`
9854
+ `);
9855
+ }, markHeldLock = (buildDirectory) => {
9856
+ const locks = readHeldLockEnv();
9857
+ locks.add(buildDirectory);
9858
+ writeHeldLockEnv(locks);
9859
+ }, unmarkHeldLock = (buildDirectory) => {
9860
+ const locks = readHeldLockEnv();
9861
+ locks.delete(buildDirectory);
9862
+ writeHeldLockEnv(locks);
9863
+ }, acquireBuildDirectoryLock = async (buildDirectory, options = {}) => {
9864
+ if (readHeldLockEnv().has(buildDirectory)) {
9865
+ return async () => {};
9866
+ }
9867
+ const heldLock = heldLocks.get(buildDirectory);
9868
+ if (heldLock) {
9869
+ heldLock.count += 1;
9870
+ return async () => {
9871
+ heldLock.count -= 1;
9872
+ if (heldLock.count === 0) {
9873
+ heldLocks.delete(buildDirectory);
9874
+ await heldLock.release();
9875
+ }
9876
+ };
9877
+ }
9848
9878
  const lockPath = lockPathForBuildDirectory(buildDirectory);
9849
9879
  const staleLockMs = options.staleLockMs ?? DEFAULT_STALE_LOCK_MS;
9850
9880
  const timeoutMs = options.timeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS;
9851
9881
  const start = Date.now();
9852
9882
  while (true) {
9853
9883
  try {
9884
+ await mkdir3(dirname10(lockPath), { recursive: true });
9854
9885
  await mkdir3(lockPath);
9855
9886
  await writeFile4(join14(lockPath, "owner"), JSON.stringify({
9856
9887
  buildDirectory,
9857
9888
  createdAt: new Date().toISOString(),
9858
9889
  pid: process.pid
9859
9890
  }, null, 2));
9860
- return async () => {
9891
+ const release = async () => {
9861
9892
  await rm4(lockPath, { force: true, recursive: true }).catch(() => {});
9862
9893
  };
9894
+ heldLocks.set(buildDirectory, { count: 1, release });
9895
+ markHeldLock(buildDirectory);
9896
+ return async () => {
9897
+ const current = heldLocks.get(buildDirectory);
9898
+ if (!current)
9899
+ return;
9900
+ current.count -= 1;
9901
+ if (current.count > 0)
9902
+ return;
9903
+ heldLocks.delete(buildDirectory);
9904
+ unmarkHeldLock(buildDirectory);
9905
+ await current.release();
9906
+ };
9863
9907
  } catch (error) {
9864
9908
  if (!isAlreadyExistsError(error))
9865
9909
  throw error;
@@ -9886,6 +9930,7 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
9886
9930
  };
9887
9931
  var init_buildDirectoryLock = __esm(() => {
9888
9932
  DEFAULT_STALE_LOCK_MS = 10 * 60000;
9933
+ heldLocks = new Map;
9889
9934
  });
9890
9935
 
9891
9936
  // src/utils/validateSafePath.ts
@@ -17786,7 +17831,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
17786
17831
  minify: false,
17787
17832
  naming: "[name].[ext]",
17788
17833
  outdir: vendorDir,
17789
- splitting: true,
17834
+ splitting: false,
17790
17835
  target: "browser",
17791
17836
  throw: false
17792
17837
  });
@@ -26744,5 +26789,5 @@ export {
26744
26789
  ANGULAR_INIT_TIMEOUT_MS
26745
26790
  };
26746
26791
 
26747
- //# debugId=270B1E92C68497DC64756E2164756E21
26792
+ //# debugId=FC99BA502BCA36FC64756E2164756E21
26748
26793
  //# sourceMappingURL=index.js.map