@absolutejs/absolute 0.19.0-beta.1035 → 0.19.0-beta.1037

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.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-MABBir/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-DCqFru/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-MABBir/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-DCqFru/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
48
48
  getWarningController()?.maybeWarn(primitiveName);
49
49
  };
50
50
 
51
- // .angular-partial-tmp-MABBir/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-DCqFru/src/core/streamingSlotRegistry.ts
52
52
  var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
53
  var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
54
  var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
package/dist/cli/index.js CHANGED
@@ -817,6 +817,7 @@ var COMPOSE_PATH = "db/docker-compose.db.yml", DEFAULT_SERVER_ENTRY = "src/backe
817
817
  console.log(` \x1B[36mp\x1B[0m / pause \u2014 Pause/resume ${title}`);
818
818
  console.log(" \x1B[36mo\x1B[0m / open \u2014 Open in browser");
819
819
  console.log(" \x1B[36mc\x1B[0m / clear \u2014 Clear terminal");
820
+ console.log(" \x1B[36mm\x1B[0m / heap \u2014 Write a heap snapshot");
820
821
  console.log(" \x1B[36mq\x1B[0m / quit \u2014 Graceful shutdown");
821
822
  console.log(" \x1B[36mh\x1B[0m / help \u2014 Show this help");
822
823
  console.log(" \x1B[36m$\x1B[0m \u2014 Run a shell command");
@@ -169881,7 +169882,7 @@ var isRecord = (value) => typeof value === "object" && value !== null, getIsland
169881
169882
  var init_islands = () => {};
169882
169883
 
169883
169884
  // src/build/islandEntries.ts
169884
- import { dirname as dirname3, extname, join as join7, relative, resolve as resolve6 } from "path";
169885
+ import { dirname as dirname3, extname, join as join8, relative, resolve as resolve6 } from "path";
169885
169886
  var import_typescript, frameworks, isRecord2 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
169886
169887
  if (isRecord2(mod.islandRegistry))
169887
169888
  return mod.islandRegistry;
@@ -170281,7 +170282,7 @@ __export(exports_prerender, {
170281
170282
  PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
170282
170283
  });
170283
170284
  import { mkdirSync as mkdirSync5, readFileSync as readFileSync10 } from "fs";
170284
- import { join as join8 } from "path";
170285
+ import { join as join9 } from "path";
170285
170286
  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) => {
170286
170287
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
170287
170288
  await Bun.write(metaPath, String(Date.now()));
@@ -170347,7 +170348,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
170347
170348
  return false;
170348
170349
  const html = await res.text();
170349
170350
  const fileName = routeToFilename(route);
170350
- const filePath = join8(prerenderDir, fileName);
170351
+ const filePath = join9(prerenderDir, fileName);
170351
170352
  await Bun.write(filePath, html);
170352
170353
  await writeTimestamp(filePath);
170353
170354
  return true;
@@ -170373,13 +170374,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
170373
170374
  }
170374
170375
  const html = await res.text();
170375
170376
  const fileName = routeToFilename(route);
170376
- const filePath = join8(prerenderDir, fileName);
170377
+ const filePath = join9(prerenderDir, fileName);
170377
170378
  await Bun.write(filePath, html);
170378
170379
  await writeTimestamp(filePath);
170379
170380
  result.routes.set(route, filePath);
170380
170381
  log?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
170381
170382
  }, prerender = async (port, outDir, staticConfig, log) => {
170382
- const prerenderDir = join8(outDir, "_prerendered");
170383
+ const prerenderDir = join9(outDir, "_prerendered");
170383
170384
  mkdirSync5(prerenderDir, { recursive: true });
170384
170385
  const baseUrl = `http://localhost:${port}`;
170385
170386
  let routes;
@@ -170536,7 +170537,7 @@ var init_nativeRewrite = __esm(() => {
170536
170537
 
170537
170538
  // src/build/rewriteImportsPlugin.ts
170538
170539
  import { readdir } from "fs/promises";
170539
- import { join as join9 } from "path";
170540
+ import { join as join10 } from "path";
170540
170541
  var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
170541
170542
  let result = content;
170542
170543
  for (const [specifier, webPath] of replacements) {
@@ -170614,7 +170615,7 @@ ${content}`;
170614
170615
  const entries = await readdir(dir);
170615
170616
  for (const entry of entries) {
170616
170617
  if (entry.endsWith(".js"))
170617
- allFiles.push(join9(dir, entry));
170618
+ allFiles.push(join10(dir, entry));
170618
170619
  }
170619
170620
  } catch {}
170620
170621
  }
@@ -170922,7 +170923,7 @@ __export(exports_ls, {
170922
170923
  runLs: () => runLs
170923
170924
  });
170924
170925
  import { existsSync as existsSync11, readFileSync as readFileSync13, statSync } from "fs";
170925
- import { basename as basename5, extname as extname2, join as join11, relative as relative2 } from "path";
170926
+ import { basename as basename5, extname as extname2, join as join12, relative as relative2 } from "path";
170926
170927
  var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELDS, readStringField = (source, key) => {
170927
170928
  const value = Reflect.get(source, key);
170928
170929
  return typeof value === "string" ? value : undefined;
@@ -170944,13 +170945,13 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
170944
170945
  const dir = readStringField(source, framework.field);
170945
170946
  return dir === undefined ? [] : [
170946
170947
  {
170947
- dir: join11(baseDir, dir),
170948
+ dir: join12(baseDir, dir),
170948
170949
  label: framework.label,
170949
170950
  pattern: framework.pattern
170950
170951
  }
170951
170952
  ];
170952
170953
  }), scanFramework = async (spec) => {
170953
- const { pageFiles } = await scanConventions(join11(spec.dir, "pages"), spec.pattern);
170954
+ const { pageFiles } = await scanConventions(join12(spec.dir, "pages"), spec.pattern);
170954
170955
  if (pageFiles.length === 0)
170955
170956
  return null;
170956
170957
  const pages = pageFiles.map((file) => ({
@@ -170974,10 +170975,10 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
170974
170975
  }, resolveDiskPath = (buildDir, value) => {
170975
170976
  if (existsSync11(value))
170976
170977
  return value;
170977
- const underBuild = join11(buildDir, value);
170978
+ const underBuild = join12(buildDir, value);
170978
170979
  if (existsSync11(underBuild))
170979
170980
  return underBuild;
170980
- return join11(process.cwd(), value);
170981
+ return join12(process.cwd(), value);
170981
170982
  }, fileSize = (diskPath) => {
170982
170983
  try {
170983
170984
  return statSync(diskPath).size;
@@ -170985,7 +170986,7 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
170985
170986
  return 0;
170986
170987
  }
170987
170988
  }, readManifestSizes = (manifestDir) => {
170988
- const manifest = JSON.parse(readFileSync13(join11(manifestDir, "manifest.json"), "utf-8"));
170989
+ const manifest = JSON.parse(readFileSync13(join12(manifestDir, "manifest.json"), "utf-8"));
170989
170990
  const sizes = new Map;
170990
170991
  Object.entries(manifest).forEach(([key, value]) => {
170991
170992
  sizes.set(key, fileSize(resolveDiskPath(manifestDir, value)));
@@ -171004,7 +171005,7 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
171004
171005
  }))
171005
171006
  })), manifestAge = (manifestPath) => getDurationString(Date.now() - statSync(manifestPath).mtimeMs), firstBuildDir = (candidates) => candidates.map((candidate) => {
171006
171007
  const dir = readStringField(candidate.source, "buildDirectory");
171007
- return dir === undefined ? undefined : join11(candidate.baseDir, dir);
171008
+ return dir === undefined ? undefined : join12(candidate.baseDir, dir);
171008
171009
  }).find((dir) => dir !== undefined), resolveSizesDir = (args, candidates) => parseFlagValue(args, "--outdir") ?? firstBuildDir(candidates) ?? DEFAULT_BUILD_DIR, formatSize = (bytes) => {
171009
171010
  if (bytes === null || bytes === 0)
171010
171011
  return "-";
@@ -171083,7 +171084,7 @@ ${colors.dim}${frameworkCount} ${frameworkCount === 1 ? "framework" : "framework
171083
171084
  return;
171084
171085
  }
171085
171086
  const sizesDir = resolveSizesDir(args, candidates);
171086
- const manifestPath = join11(sizesDir, "manifest.json");
171087
+ const manifestPath = join12(sizesDir, "manifest.json");
171087
171088
  if (!existsSync11(manifestPath)) {
171088
171089
  printDim(`No build at ${relativeOrSelf(manifestPath)}. Run \`absolute build\` first, or pass \`--outdir <dir>\`.`);
171089
171090
  return;
@@ -171127,7 +171128,10 @@ var formatBytes = (bytes) => {
171127
171128
  const kilobytes = bytes / BYTES_PER_KILOBYTE;
171128
171129
  if (kilobytes < BYTES_PER_KILOBYTE)
171129
171130
  return `${Math.round(kilobytes)} KB`;
171130
- return `${(kilobytes / BYTES_PER_KILOBYTE).toFixed(1)} MB`;
171131
+ const megabytes = kilobytes / BYTES_PER_KILOBYTE;
171132
+ if (megabytes < BYTES_PER_KILOBYTE)
171133
+ return `${megabytes.toFixed(1)} MB`;
171134
+ return `${(megabytes / BYTES_PER_KILOBYTE).toFixed(1)} GB`;
171131
171135
  };
171132
171136
  var init_formatBytes = __esm(() => {
171133
171137
  init_constants();
@@ -171261,7 +171265,7 @@ __export(exports_psTui, {
171261
171265
  });
171262
171266
  import { spawn } from "child_process";
171263
171267
  import { closeSync, fstatSync, openSync as openSync3, readSync } from "fs";
171264
- var TUI_HEADERS, STATUS_INDEX = 6, URL_INDEX = 7, helpLines2, statusLevelColor = (level) => {
171268
+ var TUI_HEADERS, STATUS_INDEX = 8, URL_INDEX = 9, MEM_HISTORY_MAX = 12, SPARK_CHARS = "\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588", helpLines2, statusLevelColor = (level) => {
171265
171269
  if (level === "error")
171266
171270
  return colors.red;
171267
171271
  if (level === "warn")
@@ -171275,16 +171279,17 @@ var TUI_HEADERS, STATUS_INDEX = 6, URL_INDEX = 7, helpLines2, statusLevelColor =
171275
171279
  if (status2 === "starting")
171276
171280
  return colors.yellow;
171277
171281
  return colors.dim;
171278
- }, instanceRowCells = (instance) => [
171279
- instance.name,
171280
- instance.source,
171281
- instance.port === null ? "-" : String(instance.port),
171282
- String(instance.pid),
171283
- getDurationString(instance.uptimeMs),
171284
- formatBytes(instance.memoryBytes),
171285
- instance.status,
171286
- instance.url ?? "-"
171287
- ], columnWidths2 = (allCells) => TUI_HEADERS.map((header, index) => Math.max(visibleLength(header), ...allCells.map((cells) => visibleLength(cells[index] ?? "")))), layoutWidths = (allCells, width) => {
171282
+ }, sparkline = (samples) => {
171283
+ if (samples.length === 0)
171284
+ return "";
171285
+ const max = Math.max(...samples);
171286
+ const min = Math.min(...samples);
171287
+ const range = max - min;
171288
+ return samples.map((value) => {
171289
+ const level = range === 0 ? 0 : Math.round((value - min) / range * (SPARK_CHARS.length - 1));
171290
+ return SPARK_CHARS[level] ?? SPARK_CHARS[0];
171291
+ }).join("");
171292
+ }, columnWidths2 = (allCells) => TUI_HEADERS.map((header, index) => Math.max(visibleLength(header), ...allCells.map((cells) => visibleLength(cells[index] ?? "")))), layoutWidths = (allCells, width) => {
171288
171293
  const natural = columnWidths2(allCells);
171289
171294
  const gaps = (TUI_HEADERS.length - 1) * LIST_TUI_COLUMN_GAP;
171290
171295
  const available = width - LIST_TUI_MARKER_WIDTH - gaps;
@@ -171317,6 +171322,7 @@ var TUI_HEADERS, STATUS_INDEX = 6, URL_INDEX = 7, helpLines2, statusLevelColor =
171317
171322
  }, driveListTui = async (terminal) => {
171318
171323
  const { promise, resolve: resolveExit } = Promise.withResolvers();
171319
171324
  let instances = [];
171325
+ const memoryHistory = new Map;
171320
171326
  let selectedIndex = 0;
171321
171327
  let mode = "list";
171322
171328
  let helpVisible = false;
@@ -171350,9 +171356,24 @@ var TUI_HEADERS, STATUS_INDEX = 6, URL_INDEX = 7, helpLines2, statusLevelColor =
171350
171356
  }, LIST_TUI_STATUS_MESSAGE_TIMEOUT_MS);
171351
171357
  scheduleRender();
171352
171358
  };
171359
+ const recordMemory = () => {
171360
+ const livePids = new Set(instances.map((entry) => entry.pid));
171361
+ instances.forEach((entry) => {
171362
+ const samples = memoryHistory.get(entry.pid) ?? [];
171363
+ samples.push(entry.memoryBytes ?? 0);
171364
+ if (samples.length > MEM_HISTORY_MAX)
171365
+ samples.shift();
171366
+ memoryHistory.set(entry.pid, samples);
171367
+ });
171368
+ [...memoryHistory.keys()].forEach((pid) => {
171369
+ if (!livePids.has(pid))
171370
+ memoryHistory.delete(pid);
171371
+ });
171372
+ };
171353
171373
  const refresh = async () => {
171354
171374
  const previousPid = selectedInstance()?.pid;
171355
171375
  instances = await enrichInstances(await discoverInstances());
171376
+ recordMemory();
171356
171377
  const foundIndex = previousPid === undefined ? 0 : instances.findIndex((instance) => instance.pid === previousPid);
171357
171378
  selectedIndex = foundIndex >= 0 ? foundIndex : Math.min(selectedIndex, Math.max(0, instances.length - 1));
171358
171379
  scheduleRender();
@@ -171649,8 +171670,24 @@ var TUI_HEADERS, STATUS_INDEX = 6, URL_INDEX = 7, helpLines2, statusLevelColor =
171649
171670
  }
171650
171671
  return padded;
171651
171672
  };
171673
+ const cellsFor = (instance) => {
171674
+ const history = memoryHistory.get(instance.pid) ?? [];
171675
+ const peak = history.length > 0 ? Math.max(...history) : instance.memoryBytes ?? 0;
171676
+ return [
171677
+ instance.name,
171678
+ instance.source,
171679
+ instance.port === null ? "-" : String(instance.port),
171680
+ String(instance.pid),
171681
+ getDurationString(instance.uptimeMs),
171682
+ formatBytes(instance.memoryBytes),
171683
+ formatBytes(peak),
171684
+ sparkline(history),
171685
+ instance.status,
171686
+ instance.url ?? "-"
171687
+ ];
171688
+ };
171652
171689
  const renderInstanceRow = (instance, widths, isSelected) => {
171653
- const body = instanceRowCells(instance).map((cell, index) => colorizeCell(cell, index, instance.status, isSelected, widths)).join(" ".repeat(LIST_TUI_COLUMN_GAP));
171690
+ const body = cellsFor(instance).map((cell, index) => colorizeCell(cell, index, instance.status, isSelected, widths)).join(" ".repeat(LIST_TUI_COLUMN_GAP));
171654
171691
  const marker = isSelected ? `${colors.cyan}\u276F${colors.reset}` : " ";
171655
171692
  return `${marker} ${body}`;
171656
171693
  };
@@ -171659,7 +171696,7 @@ var TUI_HEADERS, STATUS_INDEX = 6, URL_INDEX = 7, helpLines2, statusLevelColor =
171659
171696
  rows.push(padLine(`${colors.dim}No running servers found. Start one with \`absolute dev\`, \`start\`, or \`workspace dev\`.${colors.reset}`, width));
171660
171697
  return;
171661
171698
  }
171662
- const allCells = instances.map(instanceRowCells);
171699
+ const allCells = instances.map(cellsFor);
171663
171700
  const widths = layoutWidths(allCells, width);
171664
171701
  const header = TUI_HEADERS.map((label, index) => padLine(label, widths[index] ?? 0)).join(" ".repeat(LIST_TUI_COLUMN_GAP));
171665
171702
  rows.push(padLine(` ${colors.dim}${header}${colors.reset}`, width));
@@ -171769,6 +171806,8 @@ var init_psTui = __esm(() => {
171769
171806
  "PID",
171770
171807
  "UPTIME",
171771
171808
  "MEM",
171809
+ "PEAK",
171810
+ "TREND",
171772
171811
  "STATUS",
171773
171812
  "URL"
171774
171813
  ];
@@ -171882,9 +171921,353 @@ var init_ps = __esm(() => {
171882
171921
  ];
171883
171922
  });
171884
171923
 
171924
+ // src/cli/scripts/mem.ts
171925
+ var exports_mem = {};
171926
+ __export(exports_mem, {
171927
+ runMem: () => runMem
171928
+ });
171929
+ import { freemem, totalmem as totalmem2 } from "os";
171930
+ var BAR_WIDTH = 12, PERCENT = 100, HEADERS, sumMemory = (instances) => instances.reduce((total, instance) => total + (instance.memoryBytes ?? 0), 0), memBar = (fraction) => {
171931
+ const filled = Math.max(0, Math.min(BAR_WIDTH, Math.round(fraction * BAR_WIDTH)));
171932
+ return `${"\u2588".repeat(filled)}${colors.dim}${"\u2591".repeat(BAR_WIDTH - filled)}${colors.reset}`;
171933
+ }, instanceCells2 = (instance, systemTotal) => {
171934
+ const rss = instance.memoryBytes ?? 0;
171935
+ const fraction = systemTotal > 0 ? rss / systemTotal : 0;
171936
+ return [
171937
+ instance.name,
171938
+ instance.source,
171939
+ instance.port === null ? "-" : String(instance.port),
171940
+ formatBytes(instance.memoryBytes),
171941
+ `${memBar(fraction)} ${(fraction * PERCENT).toFixed(1)}%`
171942
+ ];
171943
+ }, columnWidths4 = (rows) => HEADERS.map((header, index) => Math.max(visibleLength(header), ...rows.map((cells) => visibleLength(cells[index] ?? "")))), renderRow2 = (cells, widths) => cells.map((cell, index) => padLine(cell, widths[index] ?? 0)).join(" ".repeat(LIST_TUI_COLUMN_GAP)), printReport = (instances) => {
171944
+ const systemTotal = totalmem2();
171945
+ const used = systemTotal - freemem();
171946
+ const rows = instances.map((instance) => instanceCells2(instance, systemTotal));
171947
+ const widths = columnWidths4(rows);
171948
+ const count = instances.length;
171949
+ const lines = [
171950
+ `${colors.dim}${renderRow2(HEADERS, widths)}${colors.reset}`,
171951
+ ...rows.map((cells) => renderRow2(cells, widths)),
171952
+ "",
171953
+ `${colors.dim}${count} server${count === 1 ? "" : "s"} \xB7 ${formatBytes(sumMemory(instances))} resident total${colors.reset}`,
171954
+ `${colors.dim}system ${formatBytes(used)} / ${formatBytes(systemTotal)} used \xB7 ${formatBytes(freemem())} free${colors.reset}`
171955
+ ];
171956
+ process.stdout.write(`${lines.join(`
171957
+ `)}
171958
+ `);
171959
+ }, runMem = async (args) => {
171960
+ const instances = (await enrichInstances(await discoverInstances())).sort((left, right) => (right.memoryBytes ?? 0) - (left.memoryBytes ?? 0));
171961
+ if (args.includes("--json")) {
171962
+ process.stdout.write(`${JSON.stringify({
171963
+ instances,
171964
+ system: {
171965
+ freeBytes: freemem(),
171966
+ totalBytes: totalmem2(),
171967
+ usedBytes: totalmem2() - freemem()
171968
+ }
171969
+ }, null, 2)}
171970
+ `);
171971
+ return;
171972
+ }
171973
+ if (instances.length === 0) {
171974
+ process.stdout.write(`${colors.dim}No running servers found.${colors.reset}
171975
+ `);
171976
+ return;
171977
+ }
171978
+ printReport(instances);
171979
+ };
171980
+ var init_mem = __esm(() => {
171981
+ init_constants();
171982
+ init_formatBytes();
171983
+ init_discoverInstances();
171984
+ init_instanceStatus();
171985
+ init_tuiPrimitives();
171986
+ HEADERS = ["NAME", "SOURCE", "PORT", "RSS", "% SYS"];
171987
+ });
171988
+
171989
+ // src/cli/scripts/env.ts
171990
+ var exports_env = {};
171991
+ __export(exports_env, {
171992
+ scanEnvUsage: () => scanEnvUsage,
171993
+ runEnv: () => runEnv,
171994
+ collectEnvVars: () => collectEnvVars
171995
+ });
171996
+ import { existsSync as existsSync12, readFileSync as readFileSync14 } from "fs";
171997
+ import { join as join13 } from "path";
171998
+ var {env: env3, Glob: Glob3 } = globalThis.Bun;
171999
+ var EXTENSIONS = "ts,tsx,js,jsx,mjs,cjs,svelte,vue", STATUS_WIDTH, keysInFile = (text) => [...text.matchAll(/getEnv\(\s*['"]([^'"]+)['"]\s*\)/g)].map((match) => match[1]).filter((key) => key !== undefined), scanPatterns = () => existsSync12(join13(process.cwd(), "src")) ? [`src/**/*.{${EXTENSIONS}}`] : [`*.{${EXTENSIONS}}`], scanEnvUsage = async () => {
172000
+ const scans = scanPatterns().map((pattern) => Array.fromAsync(new Glob3(pattern).scan({ cwd: process.cwd() })));
172001
+ const files = (await Promise.all(scans)).flat();
172002
+ const usage = new Map;
172003
+ files.forEach((file) => {
172004
+ keysInFile(readFileSync14(file, "utf-8")).forEach((key) => {
172005
+ usage.set(key, [...usage.get(key) ?? [], file]);
172006
+ });
172007
+ });
172008
+ return usage;
172009
+ }, isSet = (key) => typeof env3[key] === "string" && env3[key] !== "", collectEnvVars = async () => {
172010
+ const usage = await scanEnvUsage();
172011
+ return [...usage.keys()].sort().map((key) => ({
172012
+ files: usage.get(key) ?? [],
172013
+ key,
172014
+ set: isSet(key)
172015
+ }));
172016
+ }, printTable = (vars) => {
172017
+ const keyWidth = Math.max(...vars.map((entry) => entry.key.length));
172018
+ const lines = vars.map((entry) => {
172019
+ const mark = entry.set ? `${colors.green}\u2713${colors.reset}` : `${colors.red}\u2717${colors.reset}`;
172020
+ const status2 = entry.set ? "set" : `${colors.red}missing${colors.reset}`;
172021
+ const count = `${colors.dim}${entry.files.length} file${entry.files.length === 1 ? "" : "s"}${colors.reset}`;
172022
+ return ` ${mark} ${padLine(entry.key, keyWidth)}${" ".repeat(LIST_TUI_COLUMN_GAP)}${padLine(status2, STATUS_WIDTH)}${" ".repeat(LIST_TUI_COLUMN_GAP)}${count}`;
172023
+ });
172024
+ process.stdout.write(`${lines.join(`
172025
+ `)}
172026
+ `);
172027
+ }, runEnv = async (args) => {
172028
+ const vars = await collectEnvVars();
172029
+ if (vars.length === 0) {
172030
+ process.stdout.write(`${colors.dim}No getEnv() usage found under src/.${colors.reset}
172031
+ `);
172032
+ return;
172033
+ }
172034
+ const missing = vars.filter((entry) => !entry.set);
172035
+ if (args.includes("--json")) {
172036
+ process.stdout.write(`${JSON.stringify({ missing, vars }, null, 2)}
172037
+ `);
172038
+ return;
172039
+ }
172040
+ printTable(vars);
172041
+ const summary = missing.length === 0 ? `${colors.green}all ${vars.length} set${colors.reset}` : `${colors.red}${missing.length} missing${colors.reset}`;
172042
+ process.stdout.write(`
172043
+ ${colors.dim}${vars.length} referenced \xB7 ${colors.reset}${summary}
172044
+ `);
172045
+ if (args.includes("--check") && missing.length > 0) {
172046
+ process.exitCode = 1;
172047
+ }
172048
+ };
172049
+ var init_env = __esm(() => {
172050
+ init_constants();
172051
+ init_tuiPrimitives();
172052
+ STATUS_WIDTH = "missing".length;
172053
+ });
172054
+
172055
+ // src/cli/scripts/logs.ts
172056
+ var exports_logs = {};
172057
+ __export(exports_logs, {
172058
+ runLogs: () => runLogs
172059
+ });
172060
+ import {
172061
+ closeSync as closeSync2,
172062
+ existsSync as existsSync13,
172063
+ openSync as openSync4,
172064
+ readSync as readSync2,
172065
+ statSync as statSync2,
172066
+ watchFile
172067
+ } from "fs";
172068
+ var DEFAULT_LINES = 40, POLL_MS = 250, LINES_FLAG_SPAN = 2, readFrom = (path, start2, length) => {
172069
+ if (length <= 0)
172070
+ return "";
172071
+ const descriptor = openSync4(path, "r");
172072
+ try {
172073
+ const buffer = Buffer.alloc(length);
172074
+ readSync2(descriptor, buffer, 0, length, start2);
172075
+ return buffer.toString("utf-8");
172076
+ } finally {
172077
+ closeSync2(descriptor);
172078
+ }
172079
+ }, tailLines = (path, maxLines) => {
172080
+ const { size } = statSync2(path);
172081
+ const start2 = Math.max(0, size - LIST_LOG_TAIL_MAX_BYTES);
172082
+ const lines = readFrom(path, start2, size - start2).split(`
172083
+ `);
172084
+ return lines.slice(Math.max(0, lines.length - maxLines)).join(`
172085
+ `);
172086
+ }, parseLines = (args) => {
172087
+ const index = args.findIndex((arg) => arg === "-n" || arg === "--lines");
172088
+ if (index === UNFOUND_INDEX)
172089
+ return DEFAULT_LINES;
172090
+ const value = Number(args[index + 1]);
172091
+ return Number.isInteger(value) && value > 0 ? value : DEFAULT_LINES;
172092
+ }, targetName = (args) => {
172093
+ const index = args.findIndex((arg) => arg === "-n" || arg === "--lines");
172094
+ const cleaned = index === UNFOUND_INDEX ? args : [...args.slice(0, index), ...args.slice(index + LINES_FLAG_SPAN)];
172095
+ return cleaned.find((arg) => !arg.startsWith("-"));
172096
+ }, followFile = (path) => {
172097
+ let offset = statSync2(path).size;
172098
+ watchFile(path, { interval: POLL_MS }, (current) => {
172099
+ if (current.size > offset) {
172100
+ process.stdout.write(readFrom(path, offset, current.size - offset));
172101
+ }
172102
+ offset = current.size;
172103
+ });
172104
+ }, printDim2 = (message) => {
172105
+ process.stdout.write(`${colors.dim}${message}${colors.reset}
172106
+ `);
172107
+ }, printAvailable = (instances) => {
172108
+ const named = instances.filter((instance) => instance.logFile !== null);
172109
+ if (named.length === 0) {
172110
+ printDim2("No running servers have a captured log.");
172111
+ return;
172112
+ }
172113
+ printDim2("Servers with logs:");
172114
+ named.forEach((instance) => printDim2(` ${instance.name}`));
172115
+ }, runLogs = async (args) => {
172116
+ const instances = await enrichInstances(await discoverInstances());
172117
+ const name = targetName(args);
172118
+ if (name === undefined) {
172119
+ printDim2("Usage: absolute logs <name> [-f] [-n <lines>]");
172120
+ printAvailable(instances);
172121
+ return;
172122
+ }
172123
+ const match = instances.find((instance) => instance.name === name);
172124
+ if (!match) {
172125
+ printDim2(`No running server named "${name}".`);
172126
+ printAvailable(instances);
172127
+ return;
172128
+ }
172129
+ if (match.logFile === null || !existsSync13(match.logFile)) {
172130
+ printDim2(`"${name}" has no captured log (untracked, or started outside the CLI).`);
172131
+ return;
172132
+ }
172133
+ process.stdout.write(`${tailLines(match.logFile, parseLines(args))}
172134
+ `);
172135
+ if (args.includes("-f") || args.includes("--follow")) {
172136
+ printDim2(`\u2014 following ${match.name} \xB7 ctrl+c to stop \u2014`);
172137
+ followFile(match.logFile);
172138
+ }
172139
+ };
172140
+ var init_logs = __esm(() => {
172141
+ init_constants();
172142
+ init_discoverInstances();
172143
+ init_instanceStatus();
172144
+ init_tuiPrimitives();
172145
+ });
172146
+
172147
+ // src/cli/scripts/doctor.ts
172148
+ var exports_doctor = {};
172149
+ __export(exports_doctor, {
172150
+ runDoctor: () => runDoctor
172151
+ });
172152
+ import { existsSync as existsSync14 } from "fs";
172153
+ import { createRequire } from "module";
172154
+ import { arch as arch4, platform as platform5 } from "os";
172155
+ import { join as join14 } from "path";
172156
+ var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
172157
+ detail,
172158
+ label,
172159
+ status: status2
172160
+ }), readString = (source, key) => {
172161
+ const value = Reflect.get(source, key);
172162
+ return typeof value === "string" ? value : undefined;
172163
+ }, resolveVersion = (specifier) => {
172164
+ try {
172165
+ const pkg = projectRequire(`${specifier}/package.json`);
172166
+ const version2 = pkg && typeof pkg === "object" ? Reflect.get(pkg, "version") : null;
172167
+ return typeof version2 === "string" ? version2 : null;
172168
+ } catch {
172169
+ return null;
172170
+ }
172171
+ }, checkBun = () => check("ok", "Bun runtime", `v${Bun.version}`), checkAbsolute = () => {
172172
+ const version2 = resolveVersion("@absolutejs/absolute");
172173
+ return version2 === null ? check("fail", "@absolutejs/absolute", "not resolvable here") : check("ok", "@absolutejs/absolute", `v${version2}`);
172174
+ }, checkNative = () => {
172175
+ const target = `@absolutejs/native-${platform5()}-${arch4()}`;
172176
+ const version2 = resolveVersion(target);
172177
+ return version2 === null ? check("warn", "Native binary", `${target} not installed`) : check("ok", "Native binary", `v${version2}`);
172178
+ }, loadConfigOrNull = async () => {
172179
+ try {
172180
+ return await loadRawConfig();
172181
+ } catch {
172182
+ return null;
172183
+ }
172184
+ }, frameworkChecks = (config) => FRAMEWORK_FIELDS2.flatMap((field) => {
172185
+ const dir = readString(config, field);
172186
+ if (dir === undefined)
172187
+ return [];
172188
+ const label = `${field.replace("Directory", "")} pages`;
172189
+ return [
172190
+ existsSync14(join14(process.cwd(), dir)) ? check("ok", label, dir) : check("fail", label, `${dir} (missing)`)
172191
+ ];
172192
+ }), envCheck = async () => {
172193
+ const vars = await collectEnvVars();
172194
+ const missing = vars.filter((entry) => !entry.set);
172195
+ if (vars.length === 0)
172196
+ return check("ok", "Env vars", "no getEnv() usage");
172197
+ if (missing.length === 0) {
172198
+ return check("ok", "Env vars", `all ${vars.length} set`);
172199
+ }
172200
+ return check("fail", "Env vars", `missing ${missing.map((entry) => entry.key).join(", ")}`);
172201
+ }, devPort = (config) => {
172202
+ const dev2 = Reflect.get(config, "dev");
172203
+ const port = dev2 && typeof dev2 === "object" ? Reflect.get(dev2, "port") : undefined;
172204
+ return typeof port === "number" ? port : DEFAULT_PORT;
172205
+ }, portCheck = async (config) => {
172206
+ const port = devPort(config);
172207
+ const holder = (await scanListeners()).find((listener) => listener.port === port);
172208
+ return holder ? check("warn", "Dev port", `${port} in use by pid ${holder.pid}`) : check("ok", "Dev port", `${port} free`);
172209
+ }, STATUS_MARK, renderCheck = (entry, labelWidth) => ` ${STATUS_MARK[entry.status]} ${entry.label.padEnd(labelWidth)} ${colors.dim}${entry.detail}${colors.reset}`, printReport2 = (checks) => {
172210
+ const labelWidth = Math.max(...checks.map((entry) => entry.label.length));
172211
+ const failed = checks.filter((entry) => entry.status === "fail").length;
172212
+ const warned = checks.filter((entry) => entry.status === "warn").length;
172213
+ const summary = failed > 0 ? `${colors.red}${failed} failed${colors.reset}` : `${colors.green}all good${colors.reset}`;
172214
+ const lines = checks.map((entry) => renderCheck(entry, labelWidth));
172215
+ process.stdout.write(`${lines.join(`
172216
+ `)}
172217
+
172218
+ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim} \xB7 ${warned} warning${warned === 1 ? "" : "s"}${colors.reset}
172219
+ `);
172220
+ }, runDoctor = async (args) => {
172221
+ const config = await loadConfigOrNull();
172222
+ const configCheck = config === null ? check("fail", "Config", "absolute.config.ts not found or invalid") : check("ok", "Config", "absolute.config.ts loaded");
172223
+ const [env4, port] = await Promise.all([
172224
+ envCheck(),
172225
+ config === null ? check("warn", "Dev port", "skipped (no config)") : portCheck(config)
172226
+ ]);
172227
+ const checks = [
172228
+ checkBun(),
172229
+ checkAbsolute(),
172230
+ checkNative(),
172231
+ configCheck,
172232
+ ...config === null ? [] : frameworkChecks(config),
172233
+ env4,
172234
+ port
172235
+ ];
172236
+ if (args.includes("--json")) {
172237
+ process.stdout.write(`${JSON.stringify(checks, null, 2)}
172238
+ `);
172239
+ } else {
172240
+ printReport2(checks);
172241
+ }
172242
+ if (checks.some((entry) => entry.status === "fail")) {
172243
+ process.exitCode = 1;
172244
+ }
172245
+ };
172246
+ var init_doctor = __esm(() => {
172247
+ init_constants();
172248
+ init_loadConfig();
172249
+ init_portScan();
172250
+ init_tuiPrimitives();
172251
+ init_env();
172252
+ FRAMEWORK_FIELDS2 = [
172253
+ "reactDirectory",
172254
+ "vueDirectory",
172255
+ "svelteDirectory",
172256
+ "angularDirectory",
172257
+ "htmlDirectory",
172258
+ "htmxDirectory"
172259
+ ];
172260
+ projectRequire = createRequire(join14(process.cwd(), "package.json"));
172261
+ STATUS_MARK = {
172262
+ fail: `${colors.red}\u2717${colors.reset}`,
172263
+ ok: `${colors.green}\u2713${colors.reset}`,
172264
+ warn: `${colors.yellow}\u26A0${colors.reset}`
172265
+ };
172266
+ });
172267
+
171885
172268
  // src/build/externalAssetPlugin.ts
171886
- import { copyFileSync as copyFileSync2, existsSync as existsSync12, mkdirSync as mkdirSync7, statSync as statSync2 } from "fs";
171887
- import { basename as basename6, dirname as dirname4, join as join12, resolve as resolve11 } from "path";
172269
+ import { copyFileSync as copyFileSync2, existsSync as existsSync15, mkdirSync as mkdirSync7, statSync as statSync3 } from "fs";
172270
+ import { basename as basename6, dirname as dirname4, join as join15, resolve as resolve11 } from "path";
171888
172271
  var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
171889
172272
  name: "absolute-external-asset",
171890
172273
  setup(bld) {
@@ -171905,12 +172288,12 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
171905
172288
  if (!relPath)
171906
172289
  continue;
171907
172290
  const assetPath = resolve11(sourceDir, relPath);
171908
- if (!existsSync12(assetPath))
172291
+ if (!existsSync15(assetPath))
171909
172292
  continue;
171910
- if (!statSync2(assetPath).isFile())
172293
+ if (!statSync3(assetPath).isFile())
171911
172294
  continue;
171912
- const targetPath = join12(outDir, basename6(assetPath));
171913
- if (existsSync12(targetPath))
172295
+ const targetPath = join15(outDir, basename6(assetPath));
172296
+ if (existsSync15(targetPath))
171914
172297
  continue;
171915
172298
  mkdirSync7(dirname4(targetPath), { recursive: true });
171916
172299
  copyFileSync2(assetPath, targetPath);
@@ -171927,19 +172310,19 @@ __export(exports_compile, {
171927
172310
  shouldEmbedCompiledAsset: () => shouldEmbedCompiledAsset,
171928
172311
  compile: () => compile
171929
172312
  });
171930
- var {env: env3 } = globalThis.Bun;
172313
+ var {env: env4 } = globalThis.Bun;
171931
172314
  import {
171932
172315
  cpSync,
171933
- existsSync as existsSync13,
172316
+ existsSync as existsSync16,
171934
172317
  mkdirSync as mkdirSync8,
171935
172318
  readdirSync as readdirSync3,
171936
- readFileSync as readFileSync14,
171937
- rmSync as rmSync4,
171938
- statSync as statSync3,
172319
+ readFileSync as readFileSync15,
172320
+ rmSync as rmSync5,
172321
+ statSync as statSync4,
171939
172322
  unlinkSync as unlinkSync4,
171940
- writeFileSync as writeFileSync5
172323
+ writeFileSync as writeFileSync6
171941
172324
  } from "fs";
171942
- import { basename as basename7, dirname as dirname5, join as join13, relative as relative3, resolve as resolve12 } from "path";
172325
+ import { basename as basename7, dirname as dirname5, join as join16, relative as relative3, resolve as resolve12 } from "path";
171943
172326
  var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
171944
172327
  const resolvedVersion = version2 || "unknown";
171945
172328
  console.log("");
@@ -171952,7 +172335,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
171952
172335
  const entry = pending.pop();
171953
172336
  if (!entry)
171954
172337
  continue;
171955
- const fullPath = join13(entry.parentPath, entry.name);
172338
+ const fullPath = join16(entry.parentPath, entry.name);
171956
172339
  if (entry.isDirectory())
171957
172340
  pending = pending.concat(readdirSync3(fullPath, { withFileTypes: true }));
171958
172341
  else
@@ -171972,7 +172355,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
171972
172355
  const entry = pending.pop();
171973
172356
  if (!entry)
171974
172357
  continue;
171975
- const fullPath = join13(entry.parentPath, entry.name);
172358
+ const fullPath = join16(entry.parentPath, entry.name);
171976
172359
  if (entry.isDirectory()) {
171977
172360
  if (SERVER_RUNTIME_SCAN_SKIP_DIRS.has(entry.name))
171978
172361
  continue;
@@ -171987,7 +172370,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
171987
172370
  const normalizedOutdir = resolve12(outdir);
171988
172371
  const copyReference = (filePath, relPath) => {
171989
172372
  const assetSource = resolve12(dirname5(filePath), relPath);
171990
- if (!existsSync13(assetSource) || !statSync3(assetSource).isFile())
172373
+ if (!existsSync16(assetSource) || !statSync4(assetSource).isFile())
171991
172374
  return;
171992
172375
  const assetTarget = resolve12(normalizedOutdir, relPath.replace(/^\.\//, ""));
171993
172376
  if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
@@ -171999,7 +172382,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
171999
172382
  cpSync(assetSource, assetTarget, { force: true });
172000
172383
  };
172001
172384
  for (const filePath of collectProjectSourceFiles(process.cwd())) {
172002
- const source = readFileSync14(filePath, "utf-8");
172385
+ const source = readFileSync15(filePath, "utf-8");
172003
172386
  SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
172004
172387
  let match;
172005
172388
  while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
@@ -172028,7 +172411,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172028
172411
  }
172029
172412
  }, readPackageVersion4 = (candidate) => {
172030
172413
  try {
172031
- const pkg = JSON.parse(readFileSync14(candidate, "utf-8"));
172414
+ const pkg = JSON.parse(readFileSync15(candidate, "utf-8"));
172032
172415
  if (pkg.name !== "@absolutejs/absolute")
172033
172416
  return null;
172034
172417
  const ver = pkg.version;
@@ -172071,7 +172454,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172071
172454
  resolve12(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
172072
172455
  ];
172073
172456
  for (const candidate of candidates) {
172074
- if (existsSync13(candidate))
172457
+ if (existsSync16(candidate))
172075
172458
  return candidate;
172076
172459
  }
172077
172460
  return resolve12(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
@@ -172087,7 +172470,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172087
172470
  return true;
172088
172471
  }, tryReadNodePackageJson = (packageDir) => {
172089
172472
  try {
172090
- return JSON.parse(readFileSync14(join13(packageDir, "package.json"), "utf-8"));
172473
+ return JSON.parse(readFileSync15(join16(packageDir, "package.json"), "utf-8"));
172091
172474
  } catch {
172092
172475
  return null;
172093
172476
  }
@@ -172099,8 +172482,8 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172099
172482
  if (!pkg)
172100
172483
  return;
172101
172484
  seen.add(specifier);
172102
- const destDir = join13(outdir, "node_modules", ...specifier.split("/"));
172103
- rmSync4(destDir, { force: true, recursive: true });
172485
+ const destDir = join16(outdir, "node_modules", ...specifier.split("/"));
172486
+ rmSync5(destDir, { force: true, recursive: true });
172104
172487
  cpSync(srcDir, destDir, {
172105
172488
  force: true,
172106
172489
  recursive: true,
@@ -172122,7 +172505,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172122
172505
  if (!buildConfig.angularDirectory)
172123
172506
  return;
172124
172507
  const angularScopeDir = resolve12(process.cwd(), "node_modules", "@angular");
172125
- const angularPackages = existsSync13(angularScopeDir) ? readdirSync3(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
172508
+ const angularPackages = existsSync16(angularScopeDir) ? readdirSync3(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
172126
172509
  const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
172127
172510
  const seen = new Set;
172128
172511
  for (const specifier of roots) {
@@ -172139,15 +172522,15 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172139
172522
  }
172140
172523
  copyAngularRuntimePackages(buildConfig, outdir);
172141
172524
  }, collectRuntimePackageSpecifiers = (distDir) => {
172142
- const nodeModulesDir = join13(distDir, "node_modules");
172143
- if (!existsSync13(nodeModulesDir))
172525
+ const nodeModulesDir = join16(distDir, "node_modules");
172526
+ if (!existsSync16(nodeModulesDir))
172144
172527
  return [];
172145
172528
  const specifiers = [];
172146
172529
  for (const entry of readdirSync3(nodeModulesDir, { withFileTypes: true })) {
172147
172530
  if (!entry.isDirectory())
172148
172531
  continue;
172149
172532
  if (entry.name.startsWith("@")) {
172150
- const scopeDir = join13(nodeModulesDir, entry.name);
172533
+ const scopeDir = join16(nodeModulesDir, entry.name);
172151
172534
  for (const scopedEntry of readdirSync3(scopeDir, {
172152
172535
  withFileTypes: true
172153
172536
  })) {
@@ -172179,21 +172562,21 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172179
172562
  const packageSpecifier = packageSpecifiers.find((root) => specifier === root || specifier.startsWith(`${root}/`));
172180
172563
  if (!packageSpecifier)
172181
172564
  return null;
172182
- const packageDir = join13(distDir, "node_modules", ...packageSpecifier.split("/"));
172565
+ const packageDir = join16(distDir, "node_modules", ...packageSpecifier.split("/"));
172183
172566
  const subpath = specifier.slice(packageSpecifier.length);
172184
- const subPackageDir = subpath ? join13(packageDir, ...subpath.slice(1).split("/")) : null;
172185
- const resolvedPackageDir = subPackageDir && existsSync13(join13(subPackageDir, "package.json")) ? subPackageDir : packageDir;
172186
- const packageJsonPath = join13(resolvedPackageDir, "package.json");
172187
- if (!existsSync13(packageJsonPath))
172567
+ const subPackageDir = subpath ? join16(packageDir, ...subpath.slice(1).split("/")) : null;
172568
+ const resolvedPackageDir = subPackageDir && existsSync16(join16(subPackageDir, "package.json")) ? subPackageDir : packageDir;
172569
+ const packageJsonPath = join16(resolvedPackageDir, "package.json");
172570
+ if (!existsSync16(packageJsonPath))
172188
172571
  return null;
172189
- const pkg = JSON.parse(readFileSync14(packageJsonPath, "utf-8"));
172572
+ const pkg = JSON.parse(readFileSync15(packageJsonPath, "utf-8"));
172190
172573
  const exportKey = resolvedPackageDir !== subPackageDir && subpath ? `.${subpath}` : ".";
172191
172574
  const rootExport = pkg.exports?.[exportKey];
172192
172575
  const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
172193
- return join13(resolvedPackageDir, entry);
172576
+ return join16(resolvedPackageDir, entry);
172194
172577
  }, 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) => {
172195
172578
  try {
172196
- return statSync3(filePath).isFile();
172579
+ return statSync4(filePath).isFile();
172197
172580
  } catch {
172198
172581
  return false;
172199
172582
  }
@@ -172203,13 +172586,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172203
172586
  const candidates = [
172204
172587
  candidate,
172205
172588
  ...RUNTIME_JS_EXTENSIONS.map((extension) => `${candidate}${extension}`),
172206
- ...RUNTIME_JS_EXTENSIONS.map((extension) => join13(candidate, `index${extension}`))
172589
+ ...RUNTIME_JS_EXTENSIONS.map((extension) => join16(candidate, `index${extension}`))
172207
172590
  ];
172208
172591
  return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
172209
172592
  }, findContainingRuntimePackageDir = (filePath) => {
172210
172593
  let dir = dirname5(filePath);
172211
172594
  while (dir !== dirname5(dir)) {
172212
- if (isNodeModulesPath(dir) && existsSync13(join13(dir, "package.json"))) {
172595
+ if (isNodeModulesPath(dir) && existsSync16(join16(dir, "package.json"))) {
172213
172596
  return dir;
172214
172597
  }
172215
172598
  dir = dirname5(dir);
@@ -172225,7 +172608,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172225
172608
  const entry = pickExportEntry(pkg?.imports?.[specifier]);
172226
172609
  if (!entry)
172227
172610
  return null;
172228
- return join13(packageDir, entry);
172611
+ return join16(packageDir, entry);
172229
172612
  }, collectRuntimeRewriteRoots = (distDir) => collectFiles2(distDir).filter((filePath) => isRuntimeJsFile(filePath) && !isNodeModulesPath(filePath)), rewriteRuntimeModuleSpecifiers = (distDir) => {
172230
172613
  const packageSpecifiers = collectRuntimePackageSpecifiers(distDir);
172231
172614
  if (packageSpecifiers.length === 0)
@@ -172244,7 +172627,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172244
172627
  if (!filePath || seen.has(filePath))
172245
172628
  continue;
172246
172629
  seen.add(filePath);
172247
- const source = readFileSync14(filePath, "utf-8");
172630
+ const source = readFileSync15(filePath, "utf-8");
172248
172631
  const rewritten = source.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
172249
172632
  if (typeof specifier === "string" && specifier.startsWith(".")) {
172250
172633
  enqueue(resolveRuntimeJsFile(resolve12(dirname5(filePath), specifier)));
@@ -172262,7 +172645,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
172262
172645
  return `${prefix}${quote}${ensureRelativeModuleSpecifier(filePath, target)}${quote}`;
172263
172646
  });
172264
172647
  if (rewritten !== source) {
172265
- writeFileSync5(filePath, rewritten);
172648
+ writeFileSync6(filePath, rewritten);
172266
172649
  }
172267
172650
  }
172268
172651
  }, generateEntrypoint = (distDir, serverEntry, prerenderMap, version2, buildConfig) => {
@@ -172717,7 +173100,7 @@ console.log(\`
172717
173100
  const resolvedOutdir = resolve12(outdir ?? "dist");
172718
173101
  await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
172719
173102
  }, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
172720
- const prerenderPort = Number(env3.COMPILE_PORT) || Number(env3.PORT) || DEFAULT_PORT + 1;
173103
+ const prerenderPort = Number(env4.COMPILE_PORT) || Number(env4.PORT) || DEFAULT_PORT + 1;
172721
173104
  killStaleProcesses(prerenderPort);
172722
173105
  const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
172723
173106
  const resolvedOutfile = resolve12(outfile ?? "compiled-server");
@@ -172782,11 +173165,11 @@ console.log(\`
172782
173165
  process.exit(1);
172783
173166
  }
172784
173167
  const outputPath = resolve12(resolvedOutdir, `${entryName}.js`);
172785
- if (!existsSync13(outputPath)) {
173168
+ if (!existsSync16(outputPath)) {
172786
173169
  console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
172787
173170
  process.exit(1);
172788
173171
  }
172789
- if (existsSync13(resolve12(resolvedOutdir, "angular", "vendor", "server"))) {
173172
+ if (existsSync16(resolve12(resolvedOutdir, "angular", "vendor", "server"))) {
172790
173173
  const vendorDir = resolve12(resolvedOutdir, "angular", "vendor", "server");
172791
173174
  const vendorEntries = readdirSync3(vendorDir).filter((f) => f.endsWith(".js"));
172792
173175
  const angularServerVendorPaths = {};
@@ -172808,7 +173191,7 @@ console.log(\`
172808
173191
  copyServerRuntimeAssetReferences(resolvedOutdir);
172809
173192
  const prerenderStart = performance.now();
172810
173193
  process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
172811
- rmSync4(join13(resolvedOutdir, "_prerendered"), {
173194
+ rmSync5(join16(resolvedOutdir, "_prerendered"), {
172812
173195
  force: true,
172813
173196
  recursive: true
172814
173197
  });
@@ -172827,7 +173210,7 @@ console.log(\`
172827
173210
  const compileStart = performance.now();
172828
173211
  process.stdout.write(cliTag4("\x1B[36m", "Compiling standalone executable"));
172829
173212
  const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
172830
- const entrypointPath = join13(resolvedOutdir, "_compile_entrypoint.ts");
173213
+ const entrypointPath = join16(resolvedOutdir, "_compile_entrypoint.ts");
172831
173214
  await Bun.write(entrypointPath, entrypointCode);
172832
173215
  mkdirSync8(dirname5(resolvedOutfile), { recursive: true });
172833
173216
  const result = await Bun.build({
@@ -172923,11 +173306,11 @@ var exports_typecheck = {};
172923
173306
  __export(exports_typecheck, {
172924
173307
  typecheck: () => typecheck
172925
173308
  });
172926
- import { resolve as resolve13, join as join14 } from "path";
172927
- import { existsSync as existsSync14, readFileSync as readFileSync15 } from "fs";
173309
+ import { resolve as resolve13, join as join17 } from "path";
173310
+ import { existsSync as existsSync17, readFileSync as readFileSync16 } from "fs";
172928
173311
  import { mkdir as mkdir2, writeFile } from "fs/promises";
172929
173312
  var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve13(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
172930
- if (!existsSync14(resolveConfigPath(configPath2))) {
173313
+ if (!existsSync17(resolveConfigPath(configPath2))) {
172931
173314
  return [{}];
172932
173315
  }
172933
173316
  const rawConfig = await loadRawConfig(configPath2);
@@ -172948,7 +173331,7 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
172948
173331
  return { exitCode, name, output: (stdout + stderr).trim() };
172949
173332
  }, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
172950
173333
  const local = resolve13("node_modules", ".bin", name);
172951
- return existsSync14(local) ? local : null;
173334
+ return existsSync17(local) ? local : null;
172952
173335
  }, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
172953
173336
  const cwd = `${process.cwd()}/`;
172954
173337
  const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
@@ -173000,10 +173383,10 @@ Found ${errorCount} error${suffix}.`;
173000
173383
  resolve13(import.meta.dir, "../../types", fileName),
173001
173384
  resolve13(import.meta.dir, "../../../types", fileName)
173002
173385
  ];
173003
- return candidates.find((candidate) => existsSync14(candidate)) ?? candidates[0];
173386
+ return candidates.find((candidate) => existsSync17(candidate)) ?? candidates[0];
173004
173387
  }, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
173005
173388
  try {
173006
- return JSON.parse(readFileSync15(resolve13("tsconfig.json"), "utf-8"));
173389
+ return JSON.parse(readFileSync16(resolve13("tsconfig.json"), "utf-8"));
173007
173390
  } catch {
173008
173391
  return {};
173009
173392
  }
@@ -173031,7 +173414,7 @@ Found ${errorCount} error${suffix}.`;
173031
173414
  console.error("\x1B[31m\u2717\x1B[0m vue-tsc is required for Vue type checking. Install it: bun add -d vue-tsc");
173032
173415
  process.exit(1);
173033
173416
  }
173034
- const vueTsconfigPath = join14(cacheDir, "tsconfig.vue-check.json");
173417
+ const vueTsconfigPath = join17(cacheDir, "tsconfig.vue-check.json");
173035
173418
  return writeFile(vueTsconfigPath, JSON.stringify({
173036
173419
  compilerOptions: {
173037
173420
  rootDir: ".."
@@ -173046,7 +173429,7 @@ Found ${errorCount} error${suffix}.`;
173046
173429
  resolve13(vueTsconfigPath),
173047
173430
  "--incremental",
173048
173431
  "--tsBuildInfoFile",
173049
- join14(cacheDir, "vue-tsc.tsbuildinfo"),
173432
+ join17(cacheDir, "vue-tsc.tsbuildinfo"),
173050
173433
  "--pretty"
173051
173434
  ]));
173052
173435
  }, buildAngularCheck = async (cacheDir, angularDir) => {
@@ -173055,7 +173438,7 @@ Found ${errorCount} error${suffix}.`;
173055
173438
  console.error("\x1B[31m\u2717\x1B[0m @angular/compiler-cli is required for Angular type checking. Install it: bun add -d @angular/compiler-cli");
173056
173439
  process.exit(1);
173057
173440
  }
173058
- const angularTsconfigPath = join14(cacheDir, "tsconfig.angular-check.json");
173441
+ const angularTsconfigPath = join17(cacheDir, "tsconfig.angular-check.json");
173059
173442
  await writeFile(angularTsconfigPath, JSON.stringify({
173060
173443
  angularCompilerOptions: {
173061
173444
  strictTemplates: true
@@ -173075,7 +173458,7 @@ Found ${errorCount} error${suffix}.`;
173075
173458
  console.error("\x1B[31m\u2717\x1B[0m typescript is required for type checking. Install it: bun add -d typescript");
173076
173459
  process.exit(1);
173077
173460
  }
173078
- const tscConfigPath = join14(cacheDir, "tsconfig.typecheck.json");
173461
+ const tscConfigPath = join17(cacheDir, "tsconfig.typecheck.json");
173079
173462
  return writeFile(tscConfigPath, JSON.stringify({
173080
173463
  compilerOptions: {
173081
173464
  rootDir: ".."
@@ -173090,7 +173473,7 @@ Found ${errorCount} error${suffix}.`;
173090
173473
  resolve13(tscConfigPath),
173091
173474
  "--incremental",
173092
173475
  "--tsBuildInfoFile",
173093
- join14(cacheDir, "tsc.tsbuildinfo"),
173476
+ join17(cacheDir, "tsc.tsbuildinfo"),
173094
173477
  "--pretty"
173095
173478
  ]));
173096
173479
  }, buildSvelteCheck = async (cacheDir, svelteDir) => {
@@ -173099,7 +173482,7 @@ Found ${errorCount} error${suffix}.`;
173099
173482
  console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
173100
173483
  process.exit(1);
173101
173484
  }
173102
- const svelteTsconfigPath = join14(cacheDir, "tsconfig.svelte-check.json");
173485
+ const svelteTsconfigPath = join17(cacheDir, "tsconfig.svelte-check.json");
173103
173486
  await writeFile(svelteTsconfigPath, JSON.stringify({
173104
173487
  extends: resolve13("tsconfig.json"),
173105
173488
  files: ABSOLUTE_TYPECHECK_FILES,
@@ -173343,8 +173726,15 @@ var init_tunnelRelay = __esm(() => {
173343
173726
  init_constants();
173344
173727
  var {$: $3, env } = globalThis.Bun;
173345
173728
  import { spawn as nodeSpawn } from "child_process";
173346
- import { createWriteStream, existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
173347
- import { resolve as resolve3 } from "path";
173729
+ import {
173730
+ createWriteStream,
173731
+ existsSync as existsSync5,
173732
+ readFileSync as readFileSync7,
173733
+ rmSync as rmSync2,
173734
+ writeFileSync as writeFileSync4
173735
+ } from "fs";
173736
+ import { tmpdir } from "os";
173737
+ import { join as join6, resolve as resolve3 } from "path";
173348
173738
 
173349
173739
  // src/dev/tunnel/client.ts
173350
173740
  var RECONNECT_DELAY_MS = 2000;
@@ -173509,6 +173899,7 @@ import { ReadStream } from "tty";
173509
173899
  var SHORTCUTS = {
173510
173900
  c: "clear",
173511
173901
  h: "help",
173902
+ m: "heapSnapshot",
173512
173903
  o: "open",
173513
173904
  p: "pause",
173514
173905
  q: "quit",
@@ -173516,12 +173907,14 @@ var SHORTCUTS = {
173516
173907
  };
173517
173908
  var WORD_COMMANDS = {
173518
173909
  clear: "clear",
173910
+ heap: "heapSnapshot",
173519
173911
  help: "help",
173520
173912
  open: "open",
173521
173913
  pause: "pause",
173522
173914
  quit: "quit",
173523
173915
  restart: "restart",
173524
- resume: "pause"
173916
+ resume: "pause",
173917
+ snapshot: "heapSnapshot"
173525
173918
  };
173526
173919
  var trySetRawMode = () => {
173527
173920
  if (typeof process.stdin.setRawMode !== "function") {
@@ -173816,6 +174209,16 @@ var resolveDevPort = async (requestedPort, options = {}) => {
173816
174209
  init_utils();
173817
174210
  var cliTag = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`;
173818
174211
  var DEFAULT_PORT_RANGE = 10;
174212
+ var HEAP_SNAPSHOT_PRELOAD = `process.on('SIGUSR2', () => {
174213
+ try {
174214
+ const file = 'heap-' + process.pid + '-' + Date.now() + '.heapsnapshot';
174215
+ Bun.write(file, Bun.generateHeapSnapshot('v8'));
174216
+ console.log('[absolute] heap snapshot written: ' + file + ' (open in DevTools Memory tab)');
174217
+ } catch (error) {
174218
+ console.error('[absolute] heap snapshot failed:', error);
174219
+ }
174220
+ });
174221
+ `;
173819
174222
  var ANSI_LOG_REGEX = new RegExp(`${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[[0-?]*[ -/]*[@-~]`, "g");
173820
174223
  var confirmPrompt = (message, defaultYes = true) => {
173821
174224
  const { promise, resolve: resolvePrompt } = Promise.withResolvers();
@@ -174078,9 +174481,29 @@ var dev = async (serverEntry, configPath2) => {
174078
174481
  }
174079
174482
  return merged;
174080
174483
  };
174484
+ const heapPreloadPath = join6(tmpdir(), `absolute-heap-${process.pid}.ts`);
174485
+ let heapSnapshotEnabled = false;
174486
+ try {
174487
+ writeFileSync4(heapPreloadPath, HEAP_SNAPSHOT_PRELOAD);
174488
+ heapSnapshotEnabled = true;
174489
+ } catch {
174490
+ heapSnapshotEnabled = false;
174491
+ }
174492
+ const removeHeapPreload = () => {
174493
+ if (!heapSnapshotEnabled)
174494
+ return;
174495
+ try {
174496
+ rmSync2(heapPreloadPath, { force: true });
174497
+ } catch {}
174498
+ };
174081
174499
  const spawnServer = async () => {
174082
174500
  await refreshDevConfigForSpawn();
174083
- const proc = nodeSpawn("bun", ["--hot", "--no-clear-screen", serverEntry], {
174501
+ const proc = nodeSpawn("bun", [
174502
+ "--hot",
174503
+ "--no-clear-screen",
174504
+ ...heapSnapshotEnabled ? ["--preload", heapPreloadPath] : [],
174505
+ serverEntry
174506
+ ], {
174084
174507
  cwd: process.cwd(),
174085
174508
  detached: true,
174086
174509
  env: {
@@ -174129,7 +174552,7 @@ var dev = async (serverEntry, configPath2) => {
174129
174552
  };
174130
174553
  try {
174131
174554
  const { watch } = await import("fs");
174132
- const { dirname: dirname3, join: join6 } = await import("path");
174555
+ const { dirname: dirname3, join: join7 } = await import("path");
174133
174556
  const absServerEntry = resolve3(serverEntry);
174134
174557
  const serverEntryDir = dirname3(absServerEntry);
174135
174558
  const ROOT_RESTART_DENY = new Set([
@@ -174162,7 +174585,7 @@ var dev = async (serverEntry, configPath2) => {
174162
174585
  if (now - last < 100)
174163
174586
  return;
174164
174587
  recentlyHandled.set(filename, now);
174165
- scheduleServerRestart(join6(serverEntryDir, filename));
174588
+ scheduleServerRestart(join7(serverEntryDir, filename));
174166
174589
  };
174167
174590
  const recoveryScan = async () => {
174168
174591
  let entries;
@@ -174181,7 +174604,7 @@ var dev = async (serverEntry, configPath2) => {
174181
174604
  continue;
174182
174605
  let st;
174183
174606
  try {
174184
- st = statSync(join6(serverEntryDir, entry.name));
174607
+ st = statSync(join7(serverEntryDir, entry.name));
174185
174608
  } catch {
174186
174609
  continue;
174187
174610
  }
@@ -174268,6 +174691,7 @@ var dev = async (serverEntry, configPath2) => {
174268
174691
  instanceLog.end();
174269
174692
  } catch {}
174270
174693
  deregisterInstance(instancePid);
174694
+ removeHeapPreload();
174271
174695
  process.exit(exitCode);
174272
174696
  };
174273
174697
  const restartServer = async () => {
@@ -174352,11 +174776,29 @@ var dev = async (serverEntry, configPath2) => {
174352
174776
  console.log(cliTag("\x1B[33m", `Could not open browser. Visit ${url}`));
174353
174777
  }
174354
174778
  };
174779
+ const triggerHeapSnapshot = () => {
174780
+ if (!heapSnapshotEnabled) {
174781
+ console.log(cliTag("\x1B[33m", "Heap snapshot unavailable (no preload)."));
174782
+ return;
174783
+ }
174784
+ const childPid = serverProcess.pid;
174785
+ if (childPid === undefined)
174786
+ return;
174787
+ try {
174788
+ process.kill(childPid, "SIGUSR2");
174789
+ console.log(cliTag("\x1B[36m", "Capturing heap snapshot..."));
174790
+ } catch {
174791
+ console.log(cliTag("\x1B[33m", "Could not signal the server for a snapshot."));
174792
+ }
174793
+ };
174355
174794
  interactive = createInteractiveHandler({
174356
174795
  shell: runShellCommand2,
174357
174796
  clear: () => {
174358
174797
  process.stdout.write("\x1Bc");
174359
174798
  },
174799
+ heapSnapshot: () => {
174800
+ triggerHeapSnapshot();
174801
+ },
174360
174802
  help: () => {
174361
174803
  printHelp();
174362
174804
  },
@@ -174446,7 +174888,7 @@ var dev = async (serverEntry, configPath2) => {
174446
174888
  };
174447
174889
 
174448
174890
  // src/cli/scripts/eslint.ts
174449
- import { existsSync as existsSync6, readFileSync as readFileSync8, rmSync as rmSync2 } from "fs";
174891
+ import { existsSync as existsSync6, readFileSync as readFileSync8, rmSync as rmSync3 } from "fs";
174450
174892
  import { resolve as resolve4 } from "path";
174451
174893
  var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache";
174452
174894
  var getCacheLocation = () => process.env.ABSOLUTE_ESLINT_CACHE?.trim() || DEFAULT_CACHE_LOCATION;
@@ -174644,7 +175086,7 @@ var formatDuration = (ms) => {
174644
175086
  };
174645
175087
  var handleClearCache = (cacheLocation) => {
174646
175088
  try {
174647
- rmSync2(cacheLocation, { force: true });
175089
+ rmSync3(cacheLocation, { force: true });
174648
175090
  console.log(`\x1B[32m\u2713\x1B[0m Cleared cache: ${cacheLocation}`);
174649
175091
  } catch (err) {
174650
175092
  console.error(`\x1B[31m\u2717\x1B[0m Failed to clear cache at ${cacheLocation}:`, err);
@@ -174838,7 +175280,7 @@ var info = () => {
174838
175280
  // src/cli/cache.ts
174839
175281
  init_constants();
174840
175282
  import { mkdir } from "fs/promises";
174841
- import { join as join6 } from "path";
175283
+ import { join as join7 } from "path";
174842
175284
  var {Glob } = globalThis.Bun;
174843
175285
  var CACHE_DIR = ".absolutejs";
174844
175286
  var MAX_FILES_PER_BATCH = 200;
@@ -174890,7 +175332,7 @@ var hashFiles = async (paths) => {
174890
175332
  };
174891
175333
  var loadCache = async (tool) => {
174892
175334
  try {
174893
- const path = join6(CACHE_DIR, `${tool}.cache.json`);
175335
+ const path = join7(CACHE_DIR, `${tool}.cache.json`);
174894
175336
  const data = await Bun.file(path).json();
174895
175337
  const result = data;
174896
175338
  return result;
@@ -174937,7 +175379,7 @@ var runTool = async (adapter, args) => {
174937
175379
  };
174938
175380
  var saveCache = async (tool, data) => {
174939
175381
  await mkdir(CACHE_DIR, { recursive: true });
174940
- const path = join6(CACHE_DIR, `${tool}.cache.json`);
175382
+ const path = join7(CACHE_DIR, `${tool}.cache.json`);
174941
175383
  await Bun.write(path, JSON.stringify(data, null, "\t"));
174942
175384
  };
174943
175385
 
@@ -174982,8 +175424,8 @@ init_startupBanner();
174982
175424
  init_telemetryEvent();
174983
175425
  init_utils();
174984
175426
  var {env: env2 } = globalThis.Bun;
174985
- import { existsSync as existsSync8, readFileSync as readFileSync11, rmSync as rmSync3 } from "fs";
174986
- import { basename as basename3, join as join10, resolve as resolve8 } from "path";
175427
+ import { existsSync as existsSync8, readFileSync as readFileSync11, rmSync as rmSync4 } from "fs";
175428
+ import { basename as basename3, join as join11, resolve as resolve8 } from "path";
174987
175429
  var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`;
174988
175430
  var resolvePackageVersion = (candidates) => {
174989
175431
  for (const candidate of candidates) {
@@ -175103,7 +175545,7 @@ var start = async (serverEntry, outdir, configPath2) => {
175103
175545
  if (!build)
175104
175546
  throw new Error("Could not locate build module");
175105
175547
  await build(buildConfig);
175106
- rmSync3(join10(resolvedOutdir, "_prerendered"), {
175548
+ rmSync4(join11(resolvedOutdir, "_prerendered"), {
175107
175549
  force: true,
175108
175550
  recursive: true
175109
175551
  });
@@ -175346,7 +175788,7 @@ import {
175346
175788
  readdirSync as readdirSync2,
175347
175789
  readFileSync as readFileSync12,
175348
175790
  unlinkSync as unlinkSync3,
175349
- writeFileSync as writeFileSync4
175791
+ writeFileSync as writeFileSync5
175350
175792
  } from "fs";
175351
175793
  import { createConnection } from "net";
175352
175794
  import { resolve as resolve9 } from "path";
@@ -175913,8 +176355,8 @@ var createWorkspaceLogSink = (appendLog) => {
175913
176355
  const logDirectory = resolve9(".absolutejs", "workspace", "logs");
175914
176356
  mkdirSync6(logDirectory, { recursive: true });
175915
176357
  readdirSync2(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync3(resolve9(logDirectory, file)));
175916
- writeFileSync4(resolve9(logDirectory, "all.log"), "");
175917
- writeFileSync4(resolve9(logDirectory, "workspace.log"), "");
176358
+ writeFileSync5(resolve9(logDirectory, "all.log"), "");
176359
+ writeFileSync5(resolve9(logDirectory, "workspace.log"), "");
175918
176360
  const initializedSources = new Set(["workspace"]);
175919
176361
  const writeLog = (source, message, level) => {
175920
176362
  const cleanMessage = stripAnsi2(message).trimEnd();
@@ -175926,7 +176368,7 @@ var createWorkspaceLogSink = (appendLog) => {
175926
176368
  `;
175927
176369
  const sourceFile = resolve9(logDirectory, `${sanitizeLogFileName(source)}.log`);
175928
176370
  if (!initializedSources.has(source)) {
175929
- writeFileSync4(sourceFile, "");
176371
+ writeFileSync5(sourceFile, "");
175930
176372
  initializedSources.add(source);
175931
176373
  }
175932
176374
  appendFileSync(sourceFile, line);
@@ -176743,6 +177185,22 @@ if (command === "dev") {
176743
177185
  sendTelemetryEvent("cli:command", { command: "ps" });
176744
177186
  const { runPs: runPs2 } = await Promise.resolve().then(() => (init_ps(), exports_ps));
176745
177187
  await runPs2(args);
177188
+ } else if (command === "mem") {
177189
+ sendTelemetryEvent("cli:command", { command: "mem" });
177190
+ const { runMem: runMem2 } = await Promise.resolve().then(() => (init_mem(), exports_mem));
177191
+ await runMem2(args);
177192
+ } else if (command === "env") {
177193
+ sendTelemetryEvent("cli:command", { command: "env" });
177194
+ const { runEnv: runEnv2 } = await Promise.resolve().then(() => (init_env(), exports_env));
177195
+ await runEnv2(args);
177196
+ } else if (command === "logs") {
177197
+ sendTelemetryEvent("cli:command", { command: "logs" });
177198
+ const { runLogs: runLogs2 } = await Promise.resolve().then(() => (init_logs(), exports_logs));
177199
+ await runLogs2(args);
177200
+ } else if (command === "doctor") {
177201
+ sendTelemetryEvent("cli:command", { command: "doctor" });
177202
+ const { runDoctor: runDoctor2 } = await Promise.resolve().then(() => (init_doctor(), exports_doctor));
177203
+ await runDoctor2(args);
176746
177204
  } else if (command === "info") {
176747
177205
  sendTelemetryEvent("cli:command", { command });
176748
177206
  info();
@@ -176782,9 +177240,13 @@ if (command === "dev") {
176782
177240
  console.error(" start [entry] [--outdir dir] Start production server");
176783
177241
  console.error(" compile [entry] [--outdir dir] [--outfile path] Compile standalone executable");
176784
177242
  console.error(" config [--port n] Open the unified config UI (ESLint, tsconfig, Prettier)");
177243
+ console.error(" doctor [--json] Diagnose the project (bun, config, framework dirs, env, port)");
177244
+ console.error(" env [--check] [--json] Report env vars the app reads (getEnv) and which are missing");
176785
177245
  console.error(" eslint Run ESLint (cached)");
176786
177246
  console.error(" info Print system info for bug reports");
176787
- console.error(" ls [--all] [--json] List the project's built pages, islands, and assets");
177247
+ console.error(" logs <name> [-f] [-n <lines>] Tail a running server's log by name");
177248
+ console.error(" ls [--sizes] [--json] List the project's pages by framework (from source)");
177249
+ console.error(" mem [--json] Memory report (RSS) for running servers, plus system usage");
176788
177250
  console.error(" ps [--watch] [--json] [--kill <pid|port>] [--kill-all] List/manage running servers");
176789
177251
  console.error(" prettier Run Prettier check (cached)");
176790
177252
  console.error(" typecheck Run type checkers for all frameworks");
@@ -0,0 +1 @@
1
+ export declare const runDoctor: (args: string[]) => Promise<void>;
@@ -0,0 +1,7 @@
1
+ export declare const scanEnvUsage: () => Promise<Map<string, string[]>>;
2
+ export declare const collectEnvVars: () => Promise<{
3
+ files: string[];
4
+ key: string;
5
+ set: boolean;
6
+ }[]>;
7
+ export declare const runEnv: (args: string[]) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const runLogs: (args: string[]) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const runMem: (args: string[]) => Promise<void>;
@@ -1,6 +1,7 @@
1
1
  export type Action = () => void | Promise<void>;
2
2
  export type Actions = {
3
3
  clear: Action;
4
+ heapSnapshot: Action;
4
5
  help: Action;
5
6
  open: Action;
6
7
  pause: Action;
package/package.json CHANGED
@@ -411,7 +411,7 @@
411
411
  ]
412
412
  }
413
413
  },
414
- "version": "0.19.0-beta.1035",
414
+ "version": "0.19.0-beta.1037",
415
415
  "workspaces": [
416
416
  "tests/fixtures/*",
417
417
  "tests/fixtures/_packages/*"