@absolutejs/absolute 0.19.0-beta.1042 → 0.19.0-beta.1044

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
@@ -171985,6 +171985,87 @@ var init_ps = __esm(() => {
171985
171985
  ];
171986
171986
  });
171987
171987
 
171988
+ // src/cli/heapDiff.ts
171989
+ var exports_heapDiff = {};
171990
+ __export(exports_heapDiff, {
171991
+ runHeapDiff: () => runHeapDiff
171992
+ });
171993
+ import { existsSync as existsSync13, readFileSync as readFileSync15 } from "fs";
171994
+ var TOP = 15, STRING_TYPES, aggregate = (path) => {
171995
+ const data = JSON.parse(readFileSync15(path, "utf-8"));
171996
+ const { nodes, strings } = data;
171997
+ const { node_fields: fields, node_types: nodeTypes } = data.snapshot.meta;
171998
+ const [typeNames] = nodeTypes;
171999
+ const stride = fields.length;
172000
+ const nameIdx = fields.indexOf("name");
172001
+ const sizeIdx = fields.indexOf("self_size");
172002
+ const typeIdx = fields.indexOf("type");
172003
+ const buckets = new Map;
172004
+ let total = 0;
172005
+ for (let offset = 0;offset < nodes.length; offset += stride) {
172006
+ const typeName = typeNames[nodes[offset + typeIdx] ?? 0] ?? "object";
172007
+ const size = nodes[offset + sizeIdx] ?? 0;
172008
+ const key = STRING_TYPES.has(typeName) ? "(string)" : strings[nodes[offset + nameIdx] ?? 0] || `(${typeName})`;
172009
+ total += size;
172010
+ const bucket = buckets.get(key) ?? { count: 0, size: 0 };
172011
+ bucket.size += size;
172012
+ bucket.count += 1;
172013
+ buckets.set(key, bucket);
172014
+ }
172015
+ return { buckets, total };
172016
+ }, signed = (value) => value >= 0 ? `+${value}` : `${value}`, signedBytes = (value) => value >= 0 ? `+${formatBytes(value)}` : `-${formatBytes(-value)}`, NAME_WIDTH = 28, DELTA_WIDTH = 12, runHeapDiff = (beforePath, afterPath) => {
172017
+ if (!beforePath || !afterPath) {
172018
+ process.stdout.write(`${colors.red}Usage: absolute mem diff <before.heapsnapshot> <after.heapsnapshot>${colors.reset}
172019
+ `);
172020
+ process.exitCode = 1;
172021
+ return;
172022
+ }
172023
+ for (const path of [beforePath, afterPath]) {
172024
+ if (existsSync13(path))
172025
+ continue;
172026
+ process.stdout.write(`${colors.red}No such file: ${path}${colors.reset}
172027
+ `);
172028
+ process.exitCode = 1;
172029
+ return;
172030
+ }
172031
+ const before = aggregate(beforePath);
172032
+ const after = aggregate(afterPath);
172033
+ const keys = new Set([...before.buckets.keys(), ...after.buckets.keys()]);
172034
+ const rows = [...keys].map((key) => {
172035
+ const a = before.buckets.get(key) ?? { count: 0, size: 0 };
172036
+ const b = after.buckets.get(key) ?? { count: 0, size: 0 };
172037
+ return {
172038
+ deltaCount: b.count - a.count,
172039
+ deltaSize: b.size - a.size,
172040
+ key
172041
+ };
172042
+ }).filter((row) => row.deltaSize !== 0).sort((left, right) => right.deltaSize - left.deltaSize).slice(0, TOP);
172043
+ const totalDelta = after.total - before.total;
172044
+ const header = ` ${colors.dim}heap ${formatBytes(before.total)} \u2192 ${formatBytes(after.total)} ${totalDelta >= 0 ? colors.red : colors.green}${signedBytes(totalDelta)}${colors.reset}
172045
+ `;
172046
+ const tableHead = ` ${colors.dim}${padLine("GROWTH", DELTA_WIDTH)}${padLine("COUNT", DELTA_WIDTH)}TYPE${colors.reset}`;
172047
+ const lines = rows.map((row) => {
172048
+ const color = row.deltaSize > 0 ? colors.red : colors.green;
172049
+ return ` ${color}${padLine(signedBytes(row.deltaSize), DELTA_WIDTH)}${colors.reset}${colors.dim}${padLine(signed(row.deltaCount), DELTA_WIDTH)}${colors.reset}${padLine(row.key, NAME_WIDTH)}`;
172050
+ });
172051
+ process.stdout.write(`${header}
172052
+ ${tableHead}
172053
+ ${lines.join(`
172054
+ `)}
172055
+
172056
+ ${colors.dim}top ${rows.length} object types by growth${colors.reset}
172057
+ `);
172058
+ };
172059
+ var init_heapDiff = __esm(() => {
172060
+ init_formatBytes();
172061
+ init_tuiPrimitives();
172062
+ STRING_TYPES = new Set([
172063
+ "concatenated string",
172064
+ "sliced string",
172065
+ "string"
172066
+ ]);
172067
+ });
172068
+
171988
172069
  // src/cli/scripts/mem.ts
171989
172070
  var exports_mem = {};
171990
172071
  __export(exports_mem, {
@@ -172021,6 +172102,11 @@ var BAR_WIDTH = 12, PERCENT = 100, HEADERS, sumMemory = (instances) => instances
172021
172102
  `)}
172022
172103
  `);
172023
172104
  }, runMem = async (args) => {
172105
+ if (args[0] === "diff") {
172106
+ const { runHeapDiff: runHeapDiff2 } = await Promise.resolve().then(() => (init_heapDiff(), exports_heapDiff));
172107
+ runHeapDiff2(args[1], args[2]);
172108
+ return;
172109
+ }
172024
172110
  const instances = (await enrichInstances(await discoverInstances())).sort((left, right) => (right.memoryBytes ?? 0) - (left.memoryBytes ?? 0));
172025
172111
  if (args.includes("--json")) {
172026
172112
  process.stdout.write(`${JSON.stringify({
@@ -172058,16 +172144,16 @@ var init_fromType = __esm(() => {
172058
172144
  });
172059
172145
 
172060
172146
  // src/cli/config/absolute/resolveAbsoluteConfig.ts
172061
- import { existsSync as existsSync13, readFileSync as readFileSync15 } from "fs";
172147
+ import { existsSync as existsSync14, readFileSync as readFileSync16 } from "fs";
172062
172148
  import { resolve as resolve11 } from "path";
172063
172149
  var import_typescript4, CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath2 = (cwd, override) => {
172064
172150
  if (override) {
172065
172151
  const resolved = resolve11(cwd, override);
172066
- return existsSync13(resolved) ? resolved : null;
172152
+ return existsSync14(resolved) ? resolved : null;
172067
172153
  }
172068
172154
  for (const name of CONFIG_CANDIDATES2) {
172069
172155
  const candidate = resolve11(cwd, name);
172070
- if (existsSync13(candidate))
172156
+ if (existsSync14(candidate))
172071
172157
  return candidate;
172072
172158
  }
172073
172159
  return null;
@@ -172324,7 +172410,7 @@ var emptyOutcome = () => ({
172324
172410
  });
172325
172411
 
172326
172412
  // src/cli/generate/routeWiring.ts
172327
- import { existsSync as existsSync14, readFileSync as readFileSync16, readdirSync as readdirSync4, writeFileSync as writeFileSync6 } from "fs";
172413
+ import { existsSync as existsSync15, readFileSync as readFileSync17, readdirSync as readdirSync4, writeFileSync as writeFileSync6 } from "fs";
172328
172414
  import { dirname as dirname5, join as join15 } from "path";
172329
172415
  var import_typescript5, DEFAULT_SEPARATOR = `
172330
172416
  `, BOUNDARY_USE, applyEdits = (text, edits) => {
@@ -172473,13 +172559,13 @@ ${newLines.join(`
172473
172559
  return lines.join(`
172474
172560
  `);
172475
172561
  }, hasChain = (path) => {
172476
- if (!existsSync14(path))
172562
+ if (!existsSync15(path))
172477
172563
  return false;
172478
- const sourceFile = parse2(path, readFileSync16(path, "utf-8"));
172564
+ const sourceFile = parse2(path, readFileSync17(path, "utf-8"));
172479
172565
  const found = findElysiaNew(sourceFile);
172480
172566
  return found !== null;
172481
172567
  }, firstChainFile = (pluginsDir) => {
172482
- if (!existsSync14(pluginsDir))
172568
+ if (!existsSync15(pluginsDir))
172483
172569
  return null;
172484
172570
  for (const name of readdirSync4(pluginsDir)) {
172485
172571
  if (!name.endsWith(".ts"))
@@ -172524,7 +172610,7 @@ ${newLines.join(`
172524
172610
  };
172525
172611
  if (!hasChain(serverEntry))
172526
172612
  return fallback;
172527
- const text = readFileSync16(serverEntry, "utf-8");
172613
+ const text = readFileSync17(serverEntry, "utf-8");
172528
172614
  const sourceFile = parse2(serverEntry, text);
172529
172615
  const newExpr = findElysiaNew(sourceFile);
172530
172616
  if (!newExpr)
@@ -172553,7 +172639,7 @@ ${newLines.join(`
172553
172639
  ${routeExpr}`
172554
172640
  };
172555
172641
  }
172556
- const text = readFileSync16(routingFile, "utf-8");
172642
+ const text = readFileSync17(routingFile, "utf-8");
172557
172643
  const sourceFile = parse2(routingFile, text);
172558
172644
  const newExpr = findElysiaNew(sourceFile);
172559
172645
  if (!newExpr) {
@@ -172583,7 +172669,7 @@ var init_routeWiring = __esm(() => {
172583
172669
  });
172584
172670
 
172585
172671
  // src/cli/generate/generateApi.ts
172586
- import { existsSync as existsSync15, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "fs";
172672
+ import { existsSync as existsSync16, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "fs";
172587
172673
  import { dirname as dirname6, join as join16 } from "path";
172588
172674
  var apiPluginTemplate = (pluginName, base) => `import { Elysia } from 'elysia';
172589
172675
 
@@ -172598,7 +172684,7 @@ export const ${pluginName} = new Elysia()
172598
172684
  const outcome = { ...emptyOutcome(), route: base };
172599
172685
  const pluginsDir = join16(dirname6(project.serverEntry), "plugins");
172600
172686
  const fileAbs = join16(pluginsDir, `${pluginName}.ts`);
172601
- if (existsSync15(fileAbs)) {
172687
+ if (existsSync16(fileAbs)) {
172602
172688
  outcome.notes.push(`${pluginName} already exists at ${fileAbs} \u2014 skipped.`);
172603
172689
  return outcome;
172604
172690
  }
@@ -172671,7 +172757,7 @@ var init_componentTemplates = __esm(() => {
172671
172757
  });
172672
172758
 
172673
172759
  // src/cli/generate/generateComponent.ts
172674
- import { existsSync as existsSync16, mkdirSync as mkdirSync8, writeFileSync as writeFileSync8 } from "fs";
172760
+ import { existsSync as existsSync17, mkdirSync as mkdirSync8, writeFileSync as writeFileSync8 } from "fs";
172675
172761
  import { dirname as dirname7, join as join17 } from "path";
172676
172762
  var generateComponent = (project, framework, rawName) => {
172677
172763
  const def = frameworks2[framework];
@@ -172684,7 +172770,7 @@ var generateComponent = (project, framework, rawName) => {
172684
172770
  return outcome;
172685
172771
  }
172686
172772
  const fileAbs = join17(frameworkDir, "components", def.componentFile({ kebab, pascal }));
172687
- if (existsSync16(fileAbs)) {
172773
+ if (existsSync17(fileAbs)) {
172688
172774
  outcome.notes.push(`${pascal} already exists at ${fileAbs} \u2014 skipped.`);
172689
172775
  return outcome;
172690
172776
  }
@@ -172703,7 +172789,7 @@ var init_generateComponent = __esm(() => {
172703
172789
  });
172704
172790
 
172705
172791
  // src/cli/generate/cssStrategy.ts
172706
- import { existsSync as existsSync17 } from "fs";
172792
+ import { existsSync as existsSync18 } from "fs";
172707
172793
  import { join as join18 } from "path";
172708
172794
  var import_typescript6, CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `main {
172709
172795
  margin: 0 auto;
@@ -172751,7 +172837,7 @@ var import_typescript6, CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `
172751
172837
  return {
172752
172838
  assetKey: sharedKey,
172753
172839
  contents: DEFAULT_CSS,
172754
- create: !existsSync17(cssFileAbs2),
172840
+ create: !existsSync18(cssFileAbs2),
172755
172841
  cssFileAbs: cssFileAbs2,
172756
172842
  shared: true
172757
172843
  };
@@ -172760,7 +172846,7 @@ var import_typescript6, CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `
172760
172846
  return {
172761
172847
  assetKey: `${pascal}${CSS_SUFFIX}`,
172762
172848
  contents: DEFAULT_CSS,
172763
- create: !existsSync17(cssFileAbs),
172849
+ create: !existsSync18(cssFileAbs),
172764
172850
  cssFileAbs,
172765
172851
  shared: false
172766
172852
  };
@@ -172770,7 +172856,7 @@ var init_cssStrategy = __esm(() => {
172770
172856
  });
172771
172857
 
172772
172858
  // src/cli/generate/navData.ts
172773
- import { existsSync as existsSync18, mkdirSync as mkdirSync9, readFileSync as readFileSync17, writeFileSync as writeFileSync9 } from "fs";
172859
+ import { existsSync as existsSync19, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync9 } from "fs";
172774
172860
  import { dirname as dirname8 } from "path";
172775
172861
  var import_typescript7, NAV_DATA_TEMPLATE = `type NavItem = {
172776
172862
  href: string;
@@ -172809,9 +172895,9 @@ export const navData: NavItem[] = [];
172809
172895
  }
172810
172896
  return items;
172811
172897
  }, readNavItems = (navDataPath) => {
172812
- if (!existsSync18(navDataPath))
172898
+ if (!existsSync19(navDataPath))
172813
172899
  return [];
172814
- const text = readFileSync17(navDataPath, "utf-8");
172900
+ const text = readFileSync18(navDataPath, "utf-8");
172815
172901
  const sourceFile = import_typescript7.default.createSourceFile(navDataPath, text, import_typescript7.default.ScriptTarget.Latest, true);
172816
172902
  const array = findNavArray(sourceFile);
172817
172903
  return array ? parseNavItems(array) : [];
@@ -172846,7 +172932,7 @@ ${indentOf(text, array.getStart(sourceFile))}`;
172846
172932
  ${indent}${entry}`;
172847
172933
  return text.slice(0, insertAt) + insertion + text.slice(insertAt);
172848
172934
  }, upsertNavItem = (navDataPath, item) => {
172849
- const created = !existsSync18(navDataPath);
172935
+ const created = !existsSync19(navDataPath);
172850
172936
  if (created) {
172851
172937
  mkdirSync9(dirname8(navDataPath), { recursive: true });
172852
172938
  writeFileSync9(navDataPath, NAV_DATA_TEMPLATE, "utf-8");
@@ -172855,7 +172941,7 @@ ${indent}${entry}`;
172855
172941
  if (existing.some((candidate) => candidate.href === item.href)) {
172856
172942
  return { changed: created, created, items: existing };
172857
172943
  }
172858
- const text = readFileSync17(navDataPath, "utf-8");
172944
+ const text = readFileSync18(navDataPath, "utf-8");
172859
172945
  const sourceFile = import_typescript7.default.createSourceFile(navDataPath, text, import_typescript7.default.ScriptTarget.Latest, true);
172860
172946
  const array = findNavArray(sourceFile);
172861
172947
  if (!array)
@@ -173014,9 +173100,9 @@ var init_pageTemplates = __esm(() => {
173014
173100
 
173015
173101
  // src/cli/generate/generatePage.ts
173016
173102
  import {
173017
- existsSync as existsSync19,
173103
+ existsSync as existsSync20,
173018
173104
  mkdirSync as mkdirSync10,
173019
- readFileSync as readFileSync18,
173105
+ readFileSync as readFileSync19,
173020
173106
  readdirSync as readdirSync5,
173021
173107
  writeFileSync as writeFileSync10
173022
173108
  } from "fs";
@@ -173027,8 +173113,8 @@ var writeNew = (path, contents) => {
173027
173113
  }, toHref = (fromDir, toFile) => {
173028
173114
  const rel = relative4(fromDir, toFile).split("\\").join("/");
173029
173115
  return rel.startsWith(".") ? rel : `./${rel}`;
173030
- }, staticPageFiles = (project) => ["html", "htmx"].map((key) => project.frameworkDirs[key]).map((dir) => dir ? join19(dir, "pages") : null).filter((pagesDir) => pagesDir !== null && existsSync19(pagesDir)).flatMap((pagesDir) => readdirSync5(pagesDir).filter((name) => name.endsWith(".html")).map((name) => join19(pagesDir, name))), resyncPage = (file, items) => {
173031
- const html = readFileSync18(file, "utf-8");
173116
+ }, staticPageFiles = (project) => ["html", "htmx"].map((key) => project.frameworkDirs[key]).map((dir) => dir ? join19(dir, "pages") : null).filter((pagesDir) => pagesDir !== null && existsSync20(pagesDir)).flatMap((pagesDir) => readdirSync5(pagesDir).filter((name) => name.endsWith(".html")).map((name) => join19(pagesDir, name))), resyncPage = (file, items) => {
173117
+ const html = readFileSync19(file, "utf-8");
173032
173118
  const synced = syncStaticNav(html, items);
173033
173119
  if (synced === null || synced === html)
173034
173120
  return false;
@@ -173056,12 +173142,12 @@ var writeNew = (path, contents) => {
173056
173142
  return outcome;
173057
173143
  }
173058
173144
  const pageFileAbs = join19(frameworkDir, "pages", def.pageFile({ kebab, pascal }));
173059
- if (existsSync19(pageFileAbs)) {
173145
+ if (existsSync20(pageFileAbs)) {
173060
173146
  outcome.notes.push(`${pascal} already exists at ${pageFileAbs} \u2014 skipped.`);
173061
173147
  return outcome;
173062
173148
  }
173063
173149
  const routingFile = findRoutingFile(project.serverEntry);
173064
- const routingText = routingFile ? readFileSync18(routingFile, "utf-8") : "";
173150
+ const routingText = routingFile ? readFileSync19(routingFile, "utf-8") : "";
173065
173151
  const css = planCss(routingText, project.stylesDir, pascal, kebab);
173066
173152
  const navDataPath = join19(sharedDirFor(project, framework), "navData.ts");
173067
173153
  const nav = upsertNavItem(navDataPath, { href: route, label: title });
@@ -173252,7 +173338,7 @@ ${indent.repeat(level)}}`;
173252
173338
  var init_serialize = () => {};
173253
173339
 
173254
173340
  // src/cli/config/absolute/editAbsoluteConfig.ts
173255
- import { readFileSync as readFileSync19, writeFileSync as writeFileSync11 } from "fs";
173341
+ import { readFileSync as readFileSync20, writeFileSync as writeFileSync11 } from "fs";
173256
173342
  var import_typescript8, lineStartOffset = (text, position) => {
173257
173343
  let index = position;
173258
173344
  while (index > 0 && text[index - 1] !== `
@@ -173261,7 +173347,7 @@ var import_typescript8, lineStartOffset = (text, position) => {
173261
173347
  return index;
173262
173348
  }, indentBefore2 = (text, position) => text.slice(lineStartOffset(text, position), position), findProperty = (object, name) => object.properties.find((property) => import_typescript8.default.isPropertyAssignment(property) && (import_typescript8.default.isIdentifier(property.name) || import_typescript8.default.isStringLiteral(property.name)) && property.name.text === name), applyAbsoluteConfigEdit = (configPath2, request) => {
173263
173349
  try {
173264
- const text = readFileSync19(configPath2, "utf-8");
173350
+ const text = readFileSync20(configPath2, "utf-8");
173265
173351
  const sourceFile = import_typescript8.default.createSourceFile(configPath2, text, import_typescript8.default.ScriptTarget.Latest, true);
173266
173352
  const object = findConfigObject(sourceFile);
173267
173353
  if (!object) {
@@ -173390,13 +173476,13 @@ var init_dependencies = __esm(() => {
173390
173476
  });
173391
173477
 
173392
173478
  // src/cli/htmx/install.ts
173393
- import { existsSync as existsSync20, mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync12 } from "fs";
173479
+ import { existsSync as existsSync21, mkdirSync as mkdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync12 } from "fs";
173394
173480
  import { join as join20 } from "path";
173395
173481
  var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
173396
173482
  join20(import.meta.dir, "htmx.min.js"),
173397
173483
  join20(import.meta.dir, "htmx", "htmx.min.js"),
173398
173484
  join20(import.meta.dir, "..", "htmx", "htmx.min.js")
173399
- ].find((path) => existsSync20(path)) ?? null, detectHtmxVersion = (content) => {
173485
+ ].find((path) => existsSync21(path)) ?? null, detectHtmxVersion = (content) => {
173400
173486
  const match = content.match(/version:"([0-9.]+)"/);
173401
173487
  return match ? match[1] : null;
173402
173488
  }, fetchHtmx = async (version2) => {
@@ -173408,12 +173494,12 @@ var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
173408
173494
  return response.text();
173409
173495
  }, installedHtmxVersion = (htmxDir) => {
173410
173496
  const file = join20(htmxDir, "htmx.min.js");
173411
- if (!existsSync20(file))
173497
+ if (!existsSync21(file))
173412
173498
  return null;
173413
- return detectHtmxVersion(readFileSync20(file, "utf-8"));
173499
+ return detectHtmxVersion(readFileSync21(file, "utf-8"));
173414
173500
  }, readVendoredHtmx = () => {
173415
173501
  const file = vendoredHtmxFile();
173416
- return file ? readFileSync20(file, "utf-8") : null;
173502
+ return file ? readFileSync21(file, "utf-8") : null;
173417
173503
  }, writeHtmx = (htmxDir, content) => {
173418
173504
  mkdirSync11(htmxDir, { recursive: true });
173419
173505
  const file = join20(htmxDir, "htmx.min.js");
@@ -173528,12 +173614,417 @@ var init_add = __esm(() => {
173528
173614
  init_tuiPrimitives();
173529
173615
  });
173530
173616
 
173617
+ // src/cli/scripts/analyze.ts
173618
+ var exports_analyze = {};
173619
+ __export(exports_analyze, {
173620
+ runAnalyze: () => runAnalyze
173621
+ });
173622
+ import { existsSync as existsSync22, readFileSync as readFileSync22, statSync as statSync2, writeFileSync as writeFileSync13 } from "fs";
173623
+ import { join as join22, resolve as resolve13 } from "path";
173624
+ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_WIDTH = 16, SIZE_WIDTH = 12, CHANGE_WIDTH = 10, CATEGORY_ORDER, categoryOf = (key) => {
173625
+ if (key.startsWith("Island"))
173626
+ return "Islands";
173627
+ if (key.startsWith("Chunk"))
173628
+ return "Shared chunks";
173629
+ if (key.endsWith("CSS"))
173630
+ return "CSS";
173631
+ if (key.endsWith("Index"))
173632
+ return "Hydration";
173633
+ if (key.endsWith("Client"))
173634
+ return "Client";
173635
+ return "Pages";
173636
+ }, fileSize2 = (path) => {
173637
+ try {
173638
+ return statSync2(path).size;
173639
+ } catch {
173640
+ return 0;
173641
+ }
173642
+ }, readSizes = (manifestDir) => {
173643
+ const manifestPath = join22(manifestDir, "manifest.json");
173644
+ if (!existsSync22(manifestPath))
173645
+ return null;
173646
+ const manifest = JSON.parse(readFileSync22(manifestPath, "utf-8"));
173647
+ const sizes = {};
173648
+ for (const [key, value] of Object.entries(manifest)) {
173649
+ sizes[key] = fileSize2(join22(manifestDir, value.replace(/^\//, "")));
173650
+ }
173651
+ return sizes;
173652
+ }, readBaseline = (cwd) => {
173653
+ const path = join22(cwd, BASELINE_FILE);
173654
+ if (!existsSync22(path))
173655
+ return null;
173656
+ try {
173657
+ const parsed = JSON.parse(readFileSync22(path, "utf-8"));
173658
+ return parsed;
173659
+ } catch {
173660
+ return null;
173661
+ }
173662
+ }, signedBytes2 = (value) => {
173663
+ if (value > 0)
173664
+ return `+${formatBytes(value)}`;
173665
+ if (value < 0)
173666
+ return `-${formatBytes(-value)}`;
173667
+ return "\u2014";
173668
+ }, deltaColor = (value) => {
173669
+ if (value > 0)
173670
+ return colors.red;
173671
+ if (value < 0)
173672
+ return colors.green;
173673
+ return colors.dim;
173674
+ }, categoryTotals = (sizes) => {
173675
+ const totals = new Map(CATEGORY_ORDER.map((category) => [category, 0]));
173676
+ for (const [key, size] of Object.entries(sizes)) {
173677
+ const category = categoryOf(key);
173678
+ totals.set(category, (totals.get(category) ?? 0) + size);
173679
+ }
173680
+ return totals;
173681
+ }, deltaFor = (category, sizes, baseline) => {
173682
+ if (!baseline)
173683
+ return null;
173684
+ const keys = new Set([...Object.keys(sizes), ...Object.keys(baseline)]);
173685
+ let delta = 0;
173686
+ for (const key of keys) {
173687
+ if (categoryOf(key) !== category)
173688
+ continue;
173689
+ delta += (sizes[key] ?? 0) - (baseline[key] ?? 0);
173690
+ }
173691
+ return delta;
173692
+ }, biggestChanges = (sizes, baseline) => {
173693
+ const keys = new Set([...Object.keys(sizes), ...Object.keys(baseline)]);
173694
+ return [...keys].map((key) => ({
173695
+ delta: (sizes[key] ?? 0) - (baseline[key] ?? 0),
173696
+ key
173697
+ })).filter((entry) => entry.delta !== 0).sort((left, right) => Math.abs(right.delta) - Math.abs(left.delta)).slice(0, TOP_CHANGES);
173698
+ }, changeLines = (sizes, baseline) => {
173699
+ const changes = biggestChanges(sizes, baseline);
173700
+ if (changes.length === 0)
173701
+ return [];
173702
+ return [
173703
+ `
173704
+ ${colors.dim}Biggest changes${colors.reset}`,
173705
+ ...changes.map((change) => ` ${deltaColor(change.delta)}${padLine(signedBytes2(change.delta), CHANGE_WIDTH)}${colors.reset}${change.key}`)
173706
+ ];
173707
+ }, renderRow3 = (label, size, delta) => {
173708
+ const deltaText = delta === null ? "" : ` ${deltaColor(delta)}${signedBytes2(delta)}${colors.reset}`;
173709
+ return ` ${padLine(label, CATEGORY_WIDTH)}${colors.dim}${padLine(formatBytes(size), SIZE_WIDTH)}${colors.reset}${deltaText}`;
173710
+ }, printReport2 = (sizes, baseline) => {
173711
+ const totals = categoryTotals(sizes);
173712
+ const total = [...totals.values()].reduce((sum, value) => sum + value, 0);
173713
+ const lines = CATEGORY_ORDER.filter((category) => (totals.get(category) ?? 0) > 0).map((category) => renderRow3(category, totals.get(category) ?? 0, deltaFor(category, sizes, baseline)));
173714
+ const totalDelta = baseline ? Object.keys({ ...sizes, ...baseline }).reduce((sum, key) => sum + ((sizes[key] ?? 0) - (baseline[key] ?? 0)), 0) : null;
173715
+ const parts = [
173716
+ lines.join(`
173717
+ `),
173718
+ ` ${colors.dim}${"\u2500".repeat(CATEGORY_WIDTH + SIZE_WIDTH)}${colors.reset}`,
173719
+ renderRow3("Total", total, totalDelta)
173720
+ ];
173721
+ if (baseline)
173722
+ parts.push(...changeLines(sizes, baseline));
173723
+ const footer = baseline ? `${colors.dim}vs baseline ${BASELINE_FILE} \xB7 run \`absolute analyze --save\` to update${colors.reset}` : `${colors.dim}no baseline yet \u2014 run \`absolute analyze --save\` to record one${colors.reset}`;
173724
+ process.stdout.write(`${parts.join(`
173725
+ `)}
173726
+
173727
+ ${footer}
173728
+ `);
173729
+ }, runAnalyze = async (args) => {
173730
+ const cwd = process.cwd();
173731
+ const configIndex = args.indexOf("--config");
173732
+ const config = await loadConfig(configIndex >= 0 ? args[configIndex + 1] : undefined);
173733
+ const outdirIndex = args.indexOf("--outdir");
173734
+ const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
173735
+ const sizes = readSizes(resolve13(cwd, outdir ?? "build"));
173736
+ if (sizes === null) {
173737
+ process.stdout.write(`${colors.dim}No build found. Run \`absolute build\` first.${colors.reset}
173738
+ `);
173739
+ return;
173740
+ }
173741
+ if (args.includes("--save")) {
173742
+ writeFileSync13(join22(cwd, BASELINE_FILE), `${JSON.stringify(sizes, null, 2)}
173743
+ `);
173744
+ process.stdout.write(`${colors.green}\u2713${colors.reset} Saved size baseline (${Object.keys(sizes).length} entries) to ${BASELINE_FILE}
173745
+ `);
173746
+ return;
173747
+ }
173748
+ if (args.includes("--json")) {
173749
+ process.stdout.write(`${JSON.stringify(sizes, null, 2)}
173750
+ `);
173751
+ return;
173752
+ }
173753
+ printReport2(sizes, readBaseline(cwd));
173754
+ };
173755
+ var init_analyze = __esm(() => {
173756
+ init_loadConfig();
173757
+ init_formatBytes();
173758
+ init_tuiPrimitives();
173759
+ CATEGORY_ORDER = [
173760
+ "Pages",
173761
+ "Hydration",
173762
+ "Client",
173763
+ "Islands",
173764
+ "Shared chunks",
173765
+ "CSS"
173766
+ ];
173767
+ });
173768
+
173769
+ // src/cli/inspectData.ts
173770
+ var SLOW_MS = 100, VERY_SLOW_MS = 500, HTTP_SERVER_ERROR = 500, HTTP_CLIENT_ERROR = 400, HTTP_REDIRECT = 300, P95 = 0.95, TIME_WIDTH = 8, METHOD_WIDTH = 6, STATUS_WIDTH = 6, MS_WIDTH = 7, SIZE_WIDTH2 = 8, MIN_PATH_WIDTH = 12, COLUMN_GAP = " ", COLUMN_COUNT = 6, METHOD_COLOR, statusColor3 = (status2) => {
173771
+ if (status2 >= HTTP_SERVER_ERROR)
173772
+ return colors.red;
173773
+ if (status2 >= HTTP_CLIENT_ERROR)
173774
+ return colors.yellow;
173775
+ if (status2 >= HTTP_REDIRECT)
173776
+ return colors.cyan;
173777
+ return colors.green;
173778
+ }, durationColor = (durationMs) => {
173779
+ if (durationMs >= VERY_SLOW_MS)
173780
+ return colors.red;
173781
+ if (durationMs >= SLOW_MS)
173782
+ return colors.yellow;
173783
+ return colors.dim;
173784
+ }, isDim = (kind) => kind !== "api" && kind !== "page", pickServer = (instances) => {
173785
+ const withUrl = instances.filter((instance) => instance.url !== null);
173786
+ return withUrl.find((instance) => instance.source === "dev") ?? withUrl.find((instance) => instance.source !== "untracked") ?? withUrl[0] ?? null;
173787
+ }, clock = (epochMs) => new Date(epochMs).toLocaleTimeString([], { hour12: false }), tint = (text, color, dim) => `${dim ? colors.dim : color}${text}${colors.reset}`, aggregates = (records) => {
173788
+ const durations = records.filter((record) => !isDim(record.kind)).map((record) => record.durationMs).sort((left, right) => left - right);
173789
+ const total = durations.reduce((sum, value) => sum + value, 0);
173790
+ const avgMs = durations.length ? Math.round(total / durations.length) : 0;
173791
+ const p95Index = Math.min(durations.length - 1, Math.floor(durations.length * P95));
173792
+ const p95Ms = durations.length ? Math.round(durations[p95Index] ?? 0) : 0;
173793
+ return { avgMs, count: records.length, p95Ms };
173794
+ }, fetchRequests = async (url) => {
173795
+ try {
173796
+ const response = await fetch(`${url}__absolute/requests`);
173797
+ if (!response.ok)
173798
+ return null;
173799
+ const data = await response.json();
173800
+ if (!Array.isArray(data))
173801
+ return null;
173802
+ return data.map((entry) => ({
173803
+ at: Number(entry.at) || 0,
173804
+ durationMs: Number(entry.durationMs) || 0,
173805
+ kind: entry.kind,
173806
+ method: String(entry.method ?? ""),
173807
+ path: String(entry.path ?? ""),
173808
+ query: String(entry.query ?? ""),
173809
+ requestHeaders: entry.requestHeaders ?? {},
173810
+ responseHeaders: entry.responseHeaders ?? {},
173811
+ size: entry.size === null || entry.size === undefined ? null : Number(entry.size),
173812
+ status: Number(entry.status) || 0
173813
+ }));
173814
+ } catch {
173815
+ return null;
173816
+ }
173817
+ }, findServer = async () => pickServer(await enrichInstances(await discoverInstances())), formatRequestRow = (record, pathWidth) => {
173818
+ const dim = isDim(record.kind);
173819
+ const size = record.size === null ? "\u2014" : formatBytes(record.size);
173820
+ return [
173821
+ tint(padLine(clock(record.at), TIME_WIDTH), colors.dim, true),
173822
+ tint(padLine(record.method, METHOD_WIDTH), METHOD_COLOR[record.method] ?? colors.reset, dim),
173823
+ tint(padLine(truncateText(record.path, pathWidth), pathWidth), colors.reset, dim),
173824
+ tint(padLine(String(record.status), STATUS_WIDTH), statusColor3(record.status), dim),
173825
+ tint(padLine(`${Math.round(record.durationMs)}ms`, MS_WIDTH), durationColor(record.durationMs), dim),
173826
+ tint(padLine(size, SIZE_WIDTH2), colors.dim, true)
173827
+ ].join(COLUMN_GAP);
173828
+ }, pathColumnWidth = (totalWidth) => {
173829
+ const fixed = TIME_WIDTH + METHOD_WIDTH + STATUS_WIDTH + MS_WIDTH + SIZE_WIDTH2;
173830
+ const gaps = COLUMN_GAP.length * (COLUMN_COUNT - 1);
173831
+ return Math.max(MIN_PATH_WIDTH, totalWidth - fixed - gaps);
173832
+ }, requestDetail = (record) => {
173833
+ const size = record.size === null ? "\u2014" : formatBytes(record.size);
173834
+ const lines = [
173835
+ `${colors.bold}${record.method} ${record.path}${record.query}${colors.reset}`,
173836
+ `${colors.dim}status${colors.reset} ${statusColor3(record.status)}${record.status}${colors.reset} ${colors.dim}took${colors.reset} ${Math.round(record.durationMs)}ms ${colors.dim}size${colors.reset} ${size} ${colors.dim}kind${colors.reset} ${record.kind}`,
173837
+ `${colors.dim}request headers${colors.reset}`
173838
+ ];
173839
+ for (const [key, value] of Object.entries(record.requestHeaders)) {
173840
+ lines.push(` ${colors.cyan}${key}${colors.reset} ${value}`);
173841
+ }
173842
+ lines.push(`${colors.dim}response headers${colors.reset}`);
173843
+ for (const [key, value] of Object.entries(record.responseHeaders)) {
173844
+ lines.push(` ${colors.cyan}${key}${colors.reset} ${value}`);
173845
+ }
173846
+ return lines;
173847
+ }, requestHeader = (pathWidth) => `${colors.dim}${[
173848
+ padLine("TIME", TIME_WIDTH),
173849
+ padLine("METHOD", METHOD_WIDTH),
173850
+ padLine("PATH", pathWidth),
173851
+ padLine("STATUS", STATUS_WIDTH),
173852
+ padLine("TOOK", MS_WIDTH),
173853
+ padLine("SIZE", SIZE_WIDTH2)
173854
+ ].join(COLUMN_GAP)}${colors.reset}`;
173855
+ var init_inspectData = __esm(() => {
173856
+ init_formatBytes();
173857
+ init_discoverInstances();
173858
+ init_instanceStatus();
173859
+ init_tuiPrimitives();
173860
+ METHOD_COLOR = {
173861
+ DELETE: colors.red,
173862
+ GET: colors.green,
173863
+ PATCH: colors.yellow,
173864
+ POST: colors.cyan,
173865
+ PUT: colors.yellow
173866
+ };
173867
+ });
173868
+
173869
+ // src/cli/scripts/api.ts
173870
+ var exports_api = {};
173871
+ __export(exports_api, {
173872
+ runApi: () => runApi
173873
+ });
173874
+ var METHOD_COLOR2, printDim2 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
173875
+ `), fetchRoutes = async (url) => {
173876
+ try {
173877
+ const response = await fetch(`${url}__absolute/routes`);
173878
+ if (!response.ok)
173879
+ return null;
173880
+ const data = await response.json();
173881
+ if (!Array.isArray(data))
173882
+ return null;
173883
+ return data.map((entry) => ({
173884
+ method: String(entry.method ?? "").toUpperCase(),
173885
+ path: String(entry.path ?? ""),
173886
+ schema: {
173887
+ body: entry.schema?.body ?? null,
173888
+ params: entry.schema?.params ?? null,
173889
+ query: entry.schema?.query ?? null,
173890
+ response: entry.schema?.response ?? null
173891
+ }
173892
+ }));
173893
+ } catch {
173894
+ return null;
173895
+ }
173896
+ }, ASSET_PATH, isInternal = (path) => path === "*" || path.startsWith("/_") || path.startsWith("/.") || path.startsWith("/@") || path.startsWith("/chunk-") || path.startsWith("/node_modules") || path.startsWith("/hmr") || ASSET_PATH.test(path), getProp = (value, key) => typeof value === "object" && value !== null ? Reflect.get(value, key) : undefined, propertyNames = (schema) => {
173897
+ const properties = getProp(schema, "properties");
173898
+ return typeof properties === "object" && properties !== null ? Object.keys(properties) : [];
173899
+ }, schemaHint = (route) => {
173900
+ const parts = [];
173901
+ const params = propertyNames(route.schema.params);
173902
+ const body = propertyNames(route.schema.body);
173903
+ const query = propertyNames(route.schema.query);
173904
+ if (params.length > 0)
173905
+ parts.push(`params: ${params.join(", ")}`);
173906
+ if (query.length > 0)
173907
+ parts.push(`query: ${query.join(", ")}`);
173908
+ if (body.length > 0)
173909
+ parts.push(`body: ${body.join(", ")}`);
173910
+ return parts.length > 0 ? ` ${colors.dim}${parts.join(" \xB7 ")}${colors.reset}` : "";
173911
+ }, toOpenApiPath = (path) => path.replace(/:([A-Za-z0-9_]+)/g, "{$1}"), paramObjects = (schema, location) => {
173912
+ const properties = getProp(schema, "properties");
173913
+ if (typeof properties !== "object" || properties === null)
173914
+ return [];
173915
+ const required = getProp(schema, "required");
173916
+ const requiredList = Array.isArray(required) ? required : [];
173917
+ return Object.entries(properties).map(([name, propSchema]) => ({
173918
+ in: location,
173919
+ name,
173920
+ required: requiredList.includes(name),
173921
+ schema: propSchema
173922
+ }));
173923
+ }, buildResponses = (response) => {
173924
+ if (typeof response !== "object" || response === null) {
173925
+ return { "200": { description: "OK" } };
173926
+ }
173927
+ if (typeof getProp(response, "type") === "string") {
173928
+ return {
173929
+ "200": {
173930
+ content: { "application/json": { schema: response } },
173931
+ description: "OK"
173932
+ }
173933
+ };
173934
+ }
173935
+ const responses = {};
173936
+ for (const [status2, schema] of Object.entries(response)) {
173937
+ responses[status2] = {
173938
+ content: { "application/json": { schema } },
173939
+ description: "Response"
173940
+ };
173941
+ }
173942
+ return responses;
173943
+ }, operationFor = (route) => {
173944
+ const operation = {
173945
+ operationId: `${route.method.toLowerCase()}${route.path.replace(/[^a-zA-Z0-9]+/g, "_")}`,
173946
+ parameters: [
173947
+ ...paramObjects(route.schema.params, "path"),
173948
+ ...paramObjects(route.schema.query, "query")
173949
+ ],
173950
+ responses: buildResponses(route.schema.response)
173951
+ };
173952
+ if (route.schema.body !== null) {
173953
+ operation.requestBody = {
173954
+ content: { "application/json": { schema: route.schema.body } }
173955
+ };
173956
+ }
173957
+ return operation;
173958
+ }, buildOpenApi = (routes) => {
173959
+ const paths = {};
173960
+ for (const route of routes) {
173961
+ const openApiPath = toOpenApiPath(route.path);
173962
+ paths[openApiPath] = paths[openApiPath] ?? {};
173963
+ paths[openApiPath][route.method.toLowerCase()] = operationFor(route);
173964
+ }
173965
+ return {
173966
+ info: { title: "AbsoluteJS API", version: "1.0.0" },
173967
+ openapi: "3.0.3",
173968
+ paths
173969
+ };
173970
+ }, printSurface = (routes, serverName) => {
173971
+ const sorted = [...routes].sort((left, right) => left.path.localeCompare(right.path) || left.method.localeCompare(right.method));
173972
+ const methodWidth = Math.max(...sorted.map((route) => route.method.length));
173973
+ const lines = sorted.map((route) => {
173974
+ const color = METHOD_COLOR2[route.method] ?? colors.dim;
173975
+ return ` ${color}${padLine(route.method, methodWidth)}${colors.reset} ${route.path}${schemaHint(route)}`;
173976
+ });
173977
+ process.stdout.write(`${lines.join(`
173978
+ `)}
173979
+
173980
+ ${colors.dim}${sorted.length} routes \xB7 ${serverName} \xB7 \`absolute api --openapi\` for a spec${colors.reset}
173981
+ `);
173982
+ }, runApi = async (args) => {
173983
+ const server2 = await findServer();
173984
+ if (!server2 || server2.url === null) {
173985
+ printDim2("No running server found. Start one with `absolute dev`, then run `absolute api`.");
173986
+ return;
173987
+ }
173988
+ const routes = (await fetchRoutes(server2.url))?.filter((route) => !isInternal(route.path));
173989
+ if (!routes) {
173990
+ printDim2(`Could not read routes from ${server2.name} \u2014 the API surface needs a dev server.`);
173991
+ return;
173992
+ }
173993
+ if (args.includes("--openapi")) {
173994
+ process.stdout.write(`${JSON.stringify(buildOpenApi(routes), null, 2)}
173995
+ `);
173996
+ return;
173997
+ }
173998
+ if (args.includes("--json")) {
173999
+ process.stdout.write(`${JSON.stringify(routes, null, 2)}
174000
+ `);
174001
+ return;
174002
+ }
174003
+ if (routes.length === 0) {
174004
+ printDim2("No routes registered.");
174005
+ return;
174006
+ }
174007
+ printSurface(routes, server2.name);
174008
+ };
174009
+ var init_api = __esm(() => {
174010
+ init_inspectData();
174011
+ init_tuiPrimitives();
174012
+ METHOD_COLOR2 = {
174013
+ DELETE: colors.red,
174014
+ GET: colors.green,
174015
+ PATCH: colors.yellow,
174016
+ POST: colors.cyan,
174017
+ PUT: colors.yellow
174018
+ };
174019
+ ASSET_PATH = /\.[a-z0-9]+$/i;
174020
+ });
174021
+
173531
174022
  // src/cli/scripts/remove.ts
173532
174023
  var exports_remove = {};
173533
174024
  __export(exports_remove, {
173534
174025
  runRemove: () => runRemove
173535
174026
  });
173536
- import { existsSync as existsSync21, readFileSync as readFileSync21 } from "fs";
174027
+ import { existsSync as existsSync23, readFileSync as readFileSync23 } from "fs";
173537
174028
  import { relative as relative7 } from "path";
173538
174029
  var write3 = (text) => process.stdout.write(`${text}
173539
174030
  `), fail3 = (message) => {
@@ -173544,10 +174035,10 @@ var write3 = (text) => process.stdout.write(`${text}
173544
174035
  const candidates = [findRoutingFile(serverEntry), serverEntry];
173545
174036
  const seen = new Set;
173546
174037
  return candidates.filter((file) => {
173547
- if (file === null || seen.has(file) || !existsSync21(file))
174038
+ if (file === null || seen.has(file) || !existsSync23(file))
173548
174039
  return false;
173549
174040
  seen.add(file);
173550
- return readFileSync21(file, "utf-8").includes(handler);
174041
+ return readFileSync23(file, "utf-8").includes(handler);
173551
174042
  });
173552
174043
  }, runRemove = async (args) => {
173553
174044
  const [framework] = args.filter((arg) => !arg.startsWith("--"));
@@ -173674,15 +174165,15 @@ __export(exports_env, {
173674
174165
  runEnv: () => runEnv,
173675
174166
  collectEnvVars: () => collectEnvVars
173676
174167
  });
173677
- import { existsSync as existsSync22, readFileSync as readFileSync22 } from "fs";
173678
- import { join as join22 } from "path";
174168
+ import { existsSync as existsSync24, readFileSync as readFileSync24 } from "fs";
174169
+ import { join as join23 } from "path";
173679
174170
  var {env: env3, Glob: Glob3 } = globalThis.Bun;
173680
- 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 = () => existsSync22(join22(process.cwd(), "src")) ? [`src/**/*.{${EXTENSIONS}}`] : [`*.{${EXTENSIONS}}`], scanEnvUsage = async () => {
174171
+ var EXTENSIONS = "ts,tsx,js,jsx,mjs,cjs,svelte,vue", STATUS_WIDTH2, keysInFile = (text) => [...text.matchAll(/getEnv\(\s*['"]([^'"]+)['"]\s*\)/g)].map((match) => match[1]).filter((key) => key !== undefined), scanPatterns = () => existsSync24(join23(process.cwd(), "src")) ? [`src/**/*.{${EXTENSIONS}}`] : [`*.{${EXTENSIONS}}`], scanEnvUsage = async () => {
173681
174172
  const scans = scanPatterns().map((pattern) => Array.fromAsync(new Glob3(pattern).scan({ cwd: process.cwd() })));
173682
174173
  const files = (await Promise.all(scans)).flat();
173683
174174
  const usage = new Map;
173684
174175
  files.forEach((file) => {
173685
- keysInFile(readFileSync22(file, "utf-8")).forEach((key) => {
174176
+ keysInFile(readFileSync24(file, "utf-8")).forEach((key) => {
173686
174177
  usage.set(key, [...usage.get(key) ?? [], file]);
173687
174178
  });
173688
174179
  });
@@ -173700,7 +174191,7 @@ var EXTENSIONS = "ts,tsx,js,jsx,mjs,cjs,svelte,vue", STATUS_WIDTH, keysInFile =
173700
174191
  const mark = entry.set ? `${colors.green}\u2713${colors.reset}` : `${colors.red}\u2717${colors.reset}`;
173701
174192
  const status2 = entry.set ? "set" : `${colors.red}missing${colors.reset}`;
173702
174193
  const count = `${colors.dim}${entry.files.length} file${entry.files.length === 1 ? "" : "s"}${colors.reset}`;
173703
- return ` ${mark} ${padLine(entry.key, keyWidth)}${" ".repeat(LIST_TUI_COLUMN_GAP)}${padLine(status2, STATUS_WIDTH)}${" ".repeat(LIST_TUI_COLUMN_GAP)}${count}`;
174194
+ return ` ${mark} ${padLine(entry.key, keyWidth)}${" ".repeat(LIST_TUI_COLUMN_GAP)}${padLine(status2, STATUS_WIDTH2)}${" ".repeat(LIST_TUI_COLUMN_GAP)}${count}`;
173704
174195
  });
173705
174196
  process.stdout.write(`${lines.join(`
173706
174197
  `)}
@@ -173730,7 +174221,7 @@ ${colors.dim}${vars.length} referenced \xB7 ${colors.reset}${summary}
173730
174221
  var init_env = __esm(() => {
173731
174222
  init_constants();
173732
174223
  init_tuiPrimitives();
173733
- STATUS_WIDTH = "missing".length;
174224
+ STATUS_WIDTH2 = "missing".length;
173734
174225
  });
173735
174226
 
173736
174227
  // src/cli/scripts/logs.ts
@@ -173740,10 +174231,10 @@ __export(exports_logs, {
173740
174231
  });
173741
174232
  import {
173742
174233
  closeSync as closeSync2,
173743
- existsSync as existsSync23,
174234
+ existsSync as existsSync25,
173744
174235
  openSync as openSync4,
173745
174236
  readSync as readSync2,
173746
- statSync as statSync2,
174237
+ statSync as statSync3,
173747
174238
  watchFile
173748
174239
  } from "fs";
173749
174240
  var DEFAULT_LINES = 40, POLL_MS = 250, LINES_FLAG_SPAN = 2, readFrom = (path, start2, length) => {
@@ -173758,7 +174249,7 @@ var DEFAULT_LINES = 40, POLL_MS = 250, LINES_FLAG_SPAN = 2, readFrom = (path, st
173758
174249
  closeSync2(descriptor);
173759
174250
  }
173760
174251
  }, tailLines = (path, maxLines) => {
173761
- const { size } = statSync2(path);
174252
+ const { size } = statSync3(path);
173762
174253
  const start2 = Math.max(0, size - LIST_LOG_TAIL_MAX_BYTES);
173763
174254
  const lines = readFrom(path, start2, size - start2).split(`
173764
174255
  `);
@@ -173775,46 +174266,46 @@ var DEFAULT_LINES = 40, POLL_MS = 250, LINES_FLAG_SPAN = 2, readFrom = (path, st
173775
174266
  const cleaned = index === UNFOUND_INDEX ? args : [...args.slice(0, index), ...args.slice(index + LINES_FLAG_SPAN)];
173776
174267
  return cleaned.find((arg) => !arg.startsWith("-"));
173777
174268
  }, followFile = (path) => {
173778
- let offset = statSync2(path).size;
174269
+ let offset = statSync3(path).size;
173779
174270
  watchFile(path, { interval: POLL_MS }, (current) => {
173780
174271
  if (current.size > offset) {
173781
174272
  process.stdout.write(readFrom(path, offset, current.size - offset));
173782
174273
  }
173783
174274
  offset = current.size;
173784
174275
  });
173785
- }, printDim2 = (message) => {
174276
+ }, printDim3 = (message) => {
173786
174277
  process.stdout.write(`${colors.dim}${message}${colors.reset}
173787
174278
  `);
173788
174279
  }, printAvailable = (instances) => {
173789
174280
  const named = instances.filter((instance) => instance.logFile !== null);
173790
174281
  if (named.length === 0) {
173791
- printDim2("No running servers have a captured log.");
174282
+ printDim3("No running servers have a captured log.");
173792
174283
  return;
173793
174284
  }
173794
- printDim2("Servers with logs:");
173795
- named.forEach((instance) => printDim2(` ${instance.name}`));
174285
+ printDim3("Servers with logs:");
174286
+ named.forEach((instance) => printDim3(` ${instance.name}`));
173796
174287
  }, runLogs = async (args) => {
173797
174288
  const instances = await enrichInstances(await discoverInstances());
173798
174289
  const name = targetName(args);
173799
174290
  if (name === undefined) {
173800
- printDim2("Usage: absolute logs <name> [-f] [-n <lines>]");
174291
+ printDim3("Usage: absolute logs <name> [-f] [-n <lines>]");
173801
174292
  printAvailable(instances);
173802
174293
  return;
173803
174294
  }
173804
174295
  const match = instances.find((instance) => instance.name === name);
173805
174296
  if (!match) {
173806
- printDim2(`No running server named "${name}".`);
174297
+ printDim3(`No running server named "${name}".`);
173807
174298
  printAvailable(instances);
173808
174299
  return;
173809
174300
  }
173810
- if (match.logFile === null || !existsSync23(match.logFile)) {
173811
- printDim2(`"${name}" has no captured log (untracked, or started outside the CLI).`);
174301
+ if (match.logFile === null || !existsSync25(match.logFile)) {
174302
+ printDim3(`"${name}" has no captured log (untracked, or started outside the CLI).`);
173812
174303
  return;
173813
174304
  }
173814
174305
  process.stdout.write(`${tailLines(match.logFile, parseLines(args))}
173815
174306
  `);
173816
174307
  if (args.includes("-f") || args.includes("--follow")) {
173817
- printDim2(`\u2014 following ${match.name} \xB7 ctrl+c to stop \u2014`);
174308
+ printDim3(`\u2014 following ${match.name} \xB7 ctrl+c to stop \u2014`);
173818
174309
  followFile(match.logFile);
173819
174310
  }
173820
174311
  };
@@ -173830,10 +174321,10 @@ var exports_doctor = {};
173830
174321
  __export(exports_doctor, {
173831
174322
  runDoctor: () => runDoctor
173832
174323
  });
173833
- import { existsSync as existsSync24 } from "fs";
174324
+ import { existsSync as existsSync26, mkdirSync as mkdirSync12, readFileSync as readFileSync25, writeFileSync as writeFileSync14 } from "fs";
173834
174325
  import { createRequire } from "module";
173835
174326
  import { arch as arch4, platform as platform5 } from "os";
173836
- import { join as join23 } from "path";
174327
+ import { join as join24 } from "path";
173837
174328
  var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
173838
174329
  detail,
173839
174330
  label,
@@ -173868,7 +174359,7 @@ var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
173868
174359
  return [];
173869
174360
  const label = `${field.replace("Directory", "")} pages`;
173870
174361
  return [
173871
- existsSync24(join23(process.cwd(), dir)) ? check("ok", label, dir) : check("fail", label, `${dir} (missing)`)
174362
+ existsSync26(join24(process.cwd(), dir)) ? check("ok", label, dir) : check("fail", label, `${dir} (missing)`)
173872
174363
  ];
173873
174364
  }), envCheck = async () => {
173874
174365
  const vars = await collectEnvVars();
@@ -173887,7 +174378,7 @@ var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
173887
174378
  const port = devPort(config);
173888
174379
  const holder = (await scanListeners()).find((listener) => listener.port === port);
173889
174380
  return holder ? check("warn", "Dev port", `${port} in use by pid ${holder.pid}`) : check("ok", "Dev port", `${port} free`);
173890
- }, STATUS_MARK, renderCheck = (entry, labelWidth) => ` ${STATUS_MARK[entry.status]} ${entry.label.padEnd(labelWidth)} ${colors.dim}${entry.detail}${colors.reset}`, printReport2 = (checks) => {
174381
+ }, STATUS_MARK, renderCheck = (entry, labelWidth) => ` ${STATUS_MARK[entry.status]} ${entry.label.padEnd(labelWidth)} ${colors.dim}${entry.detail}${colors.reset}`, printReport3 = (checks) => {
173891
174382
  const labelWidth = Math.max(...checks.map((entry) => entry.label.length));
173892
174383
  const failed = checks.filter((entry) => entry.status === "fail").length;
173893
174384
  const warned = checks.filter((entry) => entry.status === "warn").length;
@@ -173898,14 +174389,14 @@ var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
173898
174389
 
173899
174390
  ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim} \xB7 ${warned} warning${warned === 1 ? "" : "s"}${colors.reset}
173900
174391
  `);
173901
- }, runDoctor = async (args) => {
174392
+ }, gatherChecks = async () => {
173902
174393
  const config = await loadConfigOrNull();
173903
174394
  const configCheck = config === null ? check("fail", "Config", "absolute.config.ts not found or invalid") : check("ok", "Config", "absolute.config.ts loaded");
173904
174395
  const [env4, port] = await Promise.all([
173905
174396
  envCheck(),
173906
174397
  config === null ? check("warn", "Dev port", "skipped (no config)") : portCheck(config)
173907
174398
  ]);
173908
- const checks = [
174399
+ return [
173909
174400
  checkBun(),
173910
174401
  checkAbsolute(),
173911
174402
  checkNative(),
@@ -173914,11 +174405,57 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
173914
174405
  env4,
173915
174406
  port
173916
174407
  ];
174408
+ }, fixFrameworkDirs = (cwd, config) => {
174409
+ const fixes = [];
174410
+ for (const field of FRAMEWORK_FIELDS2) {
174411
+ const dir = readString(config, field);
174412
+ if (dir === undefined || existsSync26(join24(cwd, dir)))
174413
+ continue;
174414
+ mkdirSync12(join24(cwd, dir, "pages"), { recursive: true });
174415
+ fixes.push(`created ${dir}/pages`);
174416
+ }
174417
+ return fixes;
174418
+ }, fixEnvExample = async (cwd) => {
174419
+ const missing = (await collectEnvVars()).filter((entry) => !entry.set);
174420
+ if (missing.length === 0)
174421
+ return null;
174422
+ const envExample = join24(cwd, ".env.example");
174423
+ const existing = existsSync26(envExample) ? readFileSync25(envExample, "utf-8") : "";
174424
+ const existingKeys = new Set(existing.split(`
174425
+ `).map((line) => line.split("=")[0]?.trim()));
174426
+ const toAdd = missing.filter((entry) => !existingKeys.has(entry.key));
174427
+ if (toAdd.length === 0)
174428
+ return null;
174429
+ const prefix = existing === "" || existing.endsWith(`
174430
+ `) ? existing : `${existing}
174431
+ `;
174432
+ writeFileSync14(envExample, `${prefix}${toAdd.map((entry) => `${entry.key}=`).join(`
174433
+ `)}
174434
+ `);
174435
+ return `added ${toAdd.length} key(s) to .env.example`;
174436
+ }, applyFixes = async () => {
174437
+ const cwd = process.cwd();
174438
+ const config = await loadConfigOrNull();
174439
+ const fixes = config ? fixFrameworkDirs(cwd, config) : [];
174440
+ const envFix = await fixEnvExample(cwd);
174441
+ if (envFix)
174442
+ fixes.push(envFix);
174443
+ return fixes;
174444
+ }, runDoctor = async (args) => {
174445
+ const fixes = args.includes("--fix") ? await applyFixes() : null;
174446
+ if (fixes && !args.includes("--json")) {
174447
+ const head = fixes.length ? fixes.map((fix) => ` ${colors.green}fixed${colors.reset} ${fix}`).join(`
174448
+ `) : ` ${colors.dim}nothing to fix${colors.reset}`;
174449
+ process.stdout.write(`${head}
174450
+
174451
+ `);
174452
+ }
174453
+ const checks = await gatherChecks();
173917
174454
  if (args.includes("--json")) {
173918
- process.stdout.write(`${JSON.stringify(checks, null, 2)}
174455
+ process.stdout.write(`${JSON.stringify({ checks, fixes }, null, 2)}
173919
174456
  `);
173920
174457
  } else {
173921
- printReport2(checks);
174458
+ printReport3(checks);
173922
174459
  }
173923
174460
  if (checks.some((entry) => entry.status === "fail")) {
173924
174461
  process.exitCode = 1;
@@ -173938,7 +174475,7 @@ var init_doctor = __esm(() => {
173938
174475
  "htmlDirectory",
173939
174476
  "htmxDirectory"
173940
174477
  ];
173941
- projectRequire = createRequire(join23(process.cwd(), "package.json"));
174478
+ projectRequire = createRequire(join24(process.cwd(), "package.json"));
173942
174479
  STATUS_MARK = {
173943
174480
  fail: `${colors.red}\u2717${colors.reset}`,
173944
174481
  ok: `${colors.green}\u2713${colors.reset}`,
@@ -173951,13 +174488,13 @@ var exports_routes = {};
173951
174488
  __export(exports_routes, {
173952
174489
  runRoutes: () => runRoutes
173953
174490
  });
173954
- var METHOD_COLOR, printDim3 = (message) => {
174491
+ var METHOD_COLOR3, printDim4 = (message) => {
173955
174492
  process.stdout.write(`${colors.dim}${message}${colors.reset}
173956
174493
  `);
173957
- }, pickServer = (instances) => {
174494
+ }, pickServer2 = (instances) => {
173958
174495
  const withUrl = instances.filter((instance) => instance.url !== null);
173959
174496
  return withUrl.find((instance) => instance.source === "dev") ?? withUrl.find((instance) => instance.source !== "untracked") ?? withUrl[0];
173960
- }, fetchRoutes = async (url) => {
174497
+ }, fetchRoutes2 = async (url) => {
173961
174498
  try {
173962
174499
  const response = await fetch(`${url}__absolute/routes`);
173963
174500
  if (!response.ok)
@@ -173974,14 +174511,14 @@ var METHOD_COLOR, printDim3 = (message) => {
173974
174511
  }
173975
174512
  }, runRoutes = async (args) => {
173976
174513
  const instances = await enrichInstances(await discoverInstances());
173977
- const server2 = pickServer(instances);
174514
+ const server2 = pickServer2(instances);
173978
174515
  if (!server2 || server2.url === null) {
173979
- printDim3("No running server found. Start one with `absolute dev`, then run `absolute routes`.");
174516
+ printDim4("No running server found. Start one with `absolute dev`, then run `absolute routes`.");
173980
174517
  return;
173981
174518
  }
173982
- const routes = await fetchRoutes(server2.url);
174519
+ const routes = await fetchRoutes2(server2.url);
173983
174520
  if (!routes) {
173984
- printDim3(`Could not read routes from ${server2.name} \u2014 route introspection needs a dev server.`);
174521
+ printDim4(`Could not read routes from ${server2.name} \u2014 route introspection needs a dev server.`);
173985
174522
  return;
173986
174523
  }
173987
174524
  const sorted = routes.filter((route) => route.path !== "/__absolute/routes").sort((left, right) => left.path.localeCompare(right.path) || left.method.localeCompare(right.method));
@@ -173991,12 +174528,12 @@ var METHOD_COLOR, printDim3 = (message) => {
173991
174528
  return;
173992
174529
  }
173993
174530
  if (sorted.length === 0) {
173994
- printDim3("No routes registered.");
174531
+ printDim4("No routes registered.");
173995
174532
  return;
173996
174533
  }
173997
174534
  const methodWidth = Math.max(...sorted.map((route) => route.method.length));
173998
174535
  const lines = sorted.map((route) => {
173999
- const color = METHOD_COLOR[route.method] ?? colors.dim;
174536
+ const color = METHOD_COLOR3[route.method] ?? colors.dim;
174000
174537
  return ` ${color}${padLine(route.method, methodWidth)}${colors.reset} ${route.path}`;
174001
174538
  });
174002
174539
  process.stdout.write(`${lines.join(`
@@ -174009,89 +174546,7 @@ var init_routes = __esm(() => {
174009
174546
  init_discoverInstances();
174010
174547
  init_instanceStatus();
174011
174548
  init_tuiPrimitives();
174012
- METHOD_COLOR = {
174013
- DELETE: colors.red,
174014
- GET: colors.green,
174015
- PATCH: colors.yellow,
174016
- POST: colors.cyan,
174017
- PUT: colors.yellow
174018
- };
174019
- });
174020
-
174021
- // src/cli/inspectData.ts
174022
- var SLOW_MS = 100, VERY_SLOW_MS = 500, HTTP_SERVER_ERROR = 500, HTTP_CLIENT_ERROR = 400, HTTP_REDIRECT = 300, P95 = 0.95, TIME_WIDTH = 8, METHOD_WIDTH = 6, STATUS_WIDTH2 = 6, MS_WIDTH = 7, SIZE_WIDTH = 8, MIN_PATH_WIDTH = 12, COLUMN_GAP = " ", COLUMN_COUNT = 6, METHOD_COLOR2, statusColor3 = (status2) => {
174023
- if (status2 >= HTTP_SERVER_ERROR)
174024
- return colors.red;
174025
- if (status2 >= HTTP_CLIENT_ERROR)
174026
- return colors.yellow;
174027
- if (status2 >= HTTP_REDIRECT)
174028
- return colors.cyan;
174029
- return colors.green;
174030
- }, durationColor = (durationMs) => {
174031
- if (durationMs >= VERY_SLOW_MS)
174032
- return colors.red;
174033
- if (durationMs >= SLOW_MS)
174034
- return colors.yellow;
174035
- return colors.dim;
174036
- }, isDim = (kind) => kind !== "api" && kind !== "page", pickServer2 = (instances) => {
174037
- const withUrl = instances.filter((instance) => instance.url !== null);
174038
- return withUrl.find((instance) => instance.source === "dev") ?? withUrl.find((instance) => instance.source !== "untracked") ?? withUrl[0] ?? null;
174039
- }, clock = (epochMs) => new Date(epochMs).toLocaleTimeString([], { hour12: false }), tint = (text, color, dim) => `${dim ? colors.dim : color}${text}${colors.reset}`, aggregates = (records) => {
174040
- const durations = records.filter((record) => !isDim(record.kind)).map((record) => record.durationMs).sort((left, right) => left - right);
174041
- const total = durations.reduce((sum, value) => sum + value, 0);
174042
- const avgMs = durations.length ? Math.round(total / durations.length) : 0;
174043
- const p95Index = Math.min(durations.length - 1, Math.floor(durations.length * P95));
174044
- const p95Ms = durations.length ? Math.round(durations[p95Index] ?? 0) : 0;
174045
- return { avgMs, count: records.length, p95Ms };
174046
- }, fetchRequests = async (url) => {
174047
- try {
174048
- const response = await fetch(`${url}__absolute/requests`);
174049
- if (!response.ok)
174050
- return null;
174051
- const data = await response.json();
174052
- if (!Array.isArray(data))
174053
- return null;
174054
- return data.map((entry) => ({
174055
- at: Number(entry.at) || 0,
174056
- durationMs: Number(entry.durationMs) || 0,
174057
- kind: entry.kind,
174058
- method: String(entry.method ?? ""),
174059
- path: String(entry.path ?? ""),
174060
- size: entry.size === null || entry.size === undefined ? null : Number(entry.size),
174061
- status: Number(entry.status) || 0
174062
- }));
174063
- } catch {
174064
- return null;
174065
- }
174066
- }, findServer = async () => pickServer2(await enrichInstances(await discoverInstances())), formatRequestRow = (record, pathWidth) => {
174067
- const dim = isDim(record.kind);
174068
- const size = record.size === null ? "\u2014" : formatBytes(record.size);
174069
- return [
174070
- tint(padLine(clock(record.at), TIME_WIDTH), colors.dim, true),
174071
- tint(padLine(record.method, METHOD_WIDTH), METHOD_COLOR2[record.method] ?? colors.reset, dim),
174072
- tint(padLine(truncateText(record.path, pathWidth), pathWidth), colors.reset, dim),
174073
- tint(padLine(String(record.status), STATUS_WIDTH2), statusColor3(record.status), dim),
174074
- tint(padLine(`${Math.round(record.durationMs)}ms`, MS_WIDTH), durationColor(record.durationMs), dim),
174075
- tint(padLine(size, SIZE_WIDTH), colors.dim, true)
174076
- ].join(COLUMN_GAP);
174077
- }, pathColumnWidth = (totalWidth) => {
174078
- const fixed = TIME_WIDTH + METHOD_WIDTH + STATUS_WIDTH2 + MS_WIDTH + SIZE_WIDTH;
174079
- const gaps = COLUMN_GAP.length * (COLUMN_COUNT - 1);
174080
- return Math.max(MIN_PATH_WIDTH, totalWidth - fixed - gaps);
174081
- }, requestHeader = (pathWidth) => `${colors.dim}${[
174082
- padLine("TIME", TIME_WIDTH),
174083
- padLine("METHOD", METHOD_WIDTH),
174084
- padLine("PATH", pathWidth),
174085
- padLine("STATUS", STATUS_WIDTH2),
174086
- padLine("TOOK", MS_WIDTH),
174087
- padLine("SIZE", SIZE_WIDTH)
174088
- ].join(COLUMN_GAP)}${colors.reset}`;
174089
- var init_inspectData = __esm(() => {
174090
- init_formatBytes();
174091
- init_discoverInstances();
174092
- init_instanceStatus();
174093
- init_tuiPrimitives();
174094
- METHOD_COLOR2 = {
174549
+ METHOD_COLOR3 = {
174095
174550
  DELETE: colors.red,
174096
174551
  GET: colors.green,
174097
174552
  PATCH: colors.yellow,
@@ -174101,12 +174556,22 @@ var init_inspectData = __esm(() => {
174101
174556
  });
174102
174557
 
174103
174558
  // src/cli/inspectTui.ts
174104
- var HEADER_LINES = 3, FOOTER_LINES = 2, driveInspectTui = async (terminal) => {
174559
+ var CHROME_LINES = 6, MIN_LIST_HEIGHT = 3, driveInspectTui = async (terminal) => {
174105
174560
  const { promise, resolve: resolveExit } = Promise.withResolvers();
174106
174561
  let records = [];
174107
174562
  let serverName = null;
174563
+ let selectedAt = null;
174108
174564
  let disposed = false;
174109
174565
  let refreshTimer = null;
174566
+ let escapeBuffer = "";
174567
+ const selectedIndex = () => {
174568
+ if (records.length === 0)
174569
+ return UNFOUND_INDEX;
174570
+ if (selectedAt === null)
174571
+ return records.length - 1;
174572
+ const found = records.findIndex((record) => record.at === selectedAt);
174573
+ return found >= 0 ? found : records.length - 1;
174574
+ };
174110
174575
  const divider = (width) => `${colors.dim}${"\u2500".repeat(Math.max(width, 1))}${colors.reset}`;
174111
174576
  const titleLine = (width) => {
174112
174577
  const name = serverName ? ` ${colors.bold}${serverName}${colors.reset}` : "";
@@ -174115,31 +174580,51 @@ var HEADER_LINES = 3, FOOTER_LINES = 2, driveInspectTui = async (terminal) => {
174115
174580
  const gap = Math.max(1, width - visibleLength(left) - visibleLength(right));
174116
174581
  return `${left}${" ".repeat(gap)}${right}`;
174117
174582
  };
174118
- const emptyMessage = () => serverName === null ? ` ${colors.dim}No running dev server \u2014 start one with \`absolute dev\`.${colors.reset}` : ` ${colors.dim}No requests yet \u2014 hit your app to see them here.${colors.reset}`;
174583
+ const listRows = (width, height, selected) => {
174584
+ const pathWidth = pathColumnWidth(width);
174585
+ const rows = [padLine(` ${requestHeader(pathWidth)}`, width)];
174586
+ const bodyHeight = height - 1;
174587
+ const start2 = Math.max(0, Math.min(records.length - bodyHeight, selected - bodyHeight + 1));
174588
+ const visible = records.slice(start2, start2 + bodyHeight);
174589
+ visible.forEach((record, index) => {
174590
+ const isSelected = start2 + index === selected;
174591
+ const marker = isSelected ? `${colors.cyan}\u276F${colors.reset} ` : " ";
174592
+ rows.push(padLine(`${marker}${formatRequestRow(record, pathWidth)}`, width));
174593
+ });
174594
+ for (let index = visible.length;index < bodyHeight; index += 1) {
174595
+ rows.push(" ".repeat(width));
174596
+ }
174597
+ return rows;
174598
+ };
174599
+ const fitLine = (line, width) => visibleLength(line) <= width ? padLine(line, width) : padLine(truncateText(stripAnsi(line), width), width);
174600
+ const detailRows = (width, height, selected) => {
174601
+ const record = records[selected];
174602
+ const content = record ? requestDetail(record) : [`${colors.dim}No request selected.${colors.reset}`];
174603
+ const rows = content.slice(0, height).map((line) => fitLine(line, width));
174604
+ for (let index = rows.length;index < height; index += 1) {
174605
+ rows.push(" ".repeat(width));
174606
+ }
174607
+ return rows;
174608
+ };
174119
174609
  const render = () => {
174120
174610
  if (disposed)
174121
174611
  return;
174122
174612
  const width = process.stdout.columns ?? LIST_TUI_DEFAULT_WIDTH;
174123
174613
  const height = process.stdout.rows ?? LIST_TUI_DEFAULT_HEIGHT;
174124
- const pathWidth = pathColumnWidth(width);
174125
- const bodyHeight = Math.max(1, height - HEADER_LINES - FOOTER_LINES);
174126
- const visible = records.slice(-bodyHeight);
174614
+ const selected = selectedIndex();
174615
+ const available = Math.max(MIN_LIST_HEIGHT * 2, height - CHROME_LINES);
174616
+ const listHeight = Math.max(MIN_LIST_HEIGHT, Math.ceil(available / 2));
174617
+ const detailHeight = Math.max(MIN_LIST_HEIGHT, available - listHeight);
174618
+ const { avgMs, count, p95Ms } = aggregates(records);
174127
174619
  const rows = [
174128
174620
  padLine(titleLine(width), width),
174129
174621
  divider(width),
174130
- padLine(` ${requestHeader(pathWidth)}`, width)
174622
+ ...listRows(width, listHeight, selected),
174623
+ divider(width),
174624
+ ...detailRows(width, detailHeight, selected),
174625
+ divider(width),
174626
+ padLine(`${colors.dim}${count} requests \xB7 ${avgMs}ms avg \xB7 ${p95Ms}ms p95 \xB7 \u2191\u2193 select \xB7 q quit${colors.reset}`, width)
174131
174627
  ];
174132
- if (visible.length === 0)
174133
- rows.push(padLine(emptyMessage(), width));
174134
- for (const record of visible) {
174135
- rows.push(padLine(` ${formatRequestRow(record, pathWidth)}`, width));
174136
- }
174137
- for (let index = visible.length;index < bodyHeight; index += 1) {
174138
- rows.push(" ".repeat(width));
174139
- }
174140
- rows.push(divider(width));
174141
- const { avgMs, count, p95Ms } = aggregates(records);
174142
- rows.push(padLine(`${colors.dim}${count} requests \xB7 ${avgMs}ms avg \xB7 ${p95Ms}ms p95 \xB7 live \xB7 q quit${colors.reset}`, width));
174143
174628
  const screen = rows.slice(0, height).map((line) => `\x1B[2K${line}`).join(`
174144
174629
  `);
174145
174630
  process.stdout.write(`\x1B[H${screen}\x1B[?25l`);
@@ -174158,6 +174643,13 @@ var HEADER_LINES = 3, FOOTER_LINES = 2, driveInspectTui = async (terminal) => {
174158
174643
  records = fetched;
174159
174644
  render();
174160
174645
  };
174646
+ const move = (delta) => {
174647
+ if (records.length === 0)
174648
+ return;
174649
+ const next = Math.max(0, Math.min(records.length - 1, selectedIndex() + delta));
174650
+ selectedAt = next === records.length - 1 ? null : records[next]?.at ?? null;
174651
+ render();
174652
+ };
174161
174653
  const dispose = () => {
174162
174654
  if (disposed)
174163
174655
  return;
@@ -174179,12 +174671,40 @@ var HEADER_LINES = 3, FOOTER_LINES = 2, driveInspectTui = async (terminal) => {
174179
174671
  dispose();
174180
174672
  resolveExit();
174181
174673
  };
174182
- const onData = (chunk) => {
174183
- for (const char of chunk.toString()) {
174184
- if (char === "q" || char === "\x03")
174185
- quit();
174674
+ const handleEscapeSequence = (char) => {
174675
+ escapeBuffer += char;
174676
+ if (escapeBuffer === `${ESCAPE}[A`) {
174677
+ escapeBuffer = "";
174678
+ move(UNFOUND_INDEX);
174679
+ return;
174680
+ }
174681
+ if (escapeBuffer === `${ESCAPE}[B`) {
174682
+ escapeBuffer = "";
174683
+ move(1);
174684
+ return;
174685
+ }
174686
+ if (escapeBuffer !== ESCAPE && escapeBuffer !== `${ESCAPE}[`) {
174687
+ escapeBuffer = "";
174186
174688
  }
174187
174689
  };
174690
+ const handleChar = (char) => {
174691
+ if (char === "q" || char === "\x03") {
174692
+ quit();
174693
+ return;
174694
+ }
174695
+ if (escapeBuffer || char === ESCAPE) {
174696
+ handleEscapeSequence(char);
174697
+ return;
174698
+ }
174699
+ if (char === "k")
174700
+ move(UNFOUND_INDEX);
174701
+ if (char === "j")
174702
+ move(1);
174703
+ };
174704
+ const onData = (chunk) => {
174705
+ for (const char of chunk.toString())
174706
+ handleChar(char);
174707
+ };
174188
174708
  process.on("SIGINT", quit);
174189
174709
  process.on("SIGTERM", quit);
174190
174710
  process.stdout.write("\x1B[?1049h\x1B[2J\x1B[H\x1B[?25l");
@@ -174215,7 +174735,7 @@ var exports_inspect = {};
174215
174735
  __export(exports_inspect, {
174216
174736
  runInspect: () => runInspect
174217
174737
  });
174218
- var SNAPSHOT_ROWS = 30, printDim4 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
174738
+ var SNAPSHOT_ROWS = 30, printDim5 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
174219
174739
  `), runInspect = async (args) => {
174220
174740
  if (!args.includes("--json") && process.stdout.isTTY) {
174221
174741
  await runInspectTui();
@@ -174223,12 +174743,12 @@ var SNAPSHOT_ROWS = 30, printDim4 = (message) => process.stdout.write(`${colors.
174223
174743
  }
174224
174744
  const server2 = await findServer();
174225
174745
  if (!server2 || server2.url === null) {
174226
- printDim4("No running server found. Start one with `absolute dev`, then run `absolute inspect`.");
174746
+ printDim5("No running server found. Start one with `absolute dev`, then run `absolute inspect`.");
174227
174747
  return;
174228
174748
  }
174229
174749
  const records = await fetchRequests(server2.url);
174230
174750
  if (!records) {
174231
- printDim4(`Could not read requests from ${server2.name} \u2014 the inspector needs a dev server.`);
174751
+ printDim5(`Could not read requests from ${server2.name} \u2014 the inspector needs a dev server.`);
174232
174752
  return;
174233
174753
  }
174234
174754
  if (args.includes("--json")) {
@@ -174237,7 +174757,7 @@ var SNAPSHOT_ROWS = 30, printDim4 = (message) => process.stdout.write(`${colors.
174237
174757
  return;
174238
174758
  }
174239
174759
  if (records.length === 0) {
174240
- printDim4("No requests captured yet \u2014 hit your app, then run it again.");
174760
+ printDim5("No requests captured yet \u2014 hit your app, then run it again.");
174241
174761
  return;
174242
174762
  }
174243
174763
  const width = process.stdout.columns ?? LIST_TUI_DEFAULT_WIDTH;
@@ -174259,10 +174779,10 @@ var init_inspect = __esm(() => {
174259
174779
  });
174260
174780
 
174261
174781
  // src/build/scanEntryPoints.ts
174262
- import { existsSync as existsSync25 } from "fs";
174782
+ import { existsSync as existsSync27 } from "fs";
174263
174783
  var {Glob: Glob4 } = globalThis.Bun;
174264
174784
  var scanEntryPoints = async (dir, pattern) => {
174265
- if (!existsSync25(dir))
174785
+ if (!existsSync27(dir))
174266
174786
  return [];
174267
174787
  const entryPaths = [];
174268
174788
  const glob = new Glob4(pattern);
@@ -174344,8 +174864,8 @@ var init_sourceMetadata = __esm(() => {
174344
174864
  });
174345
174865
 
174346
174866
  // src/islands/pageMetadata.ts
174347
- import { readFileSync as readFileSync23 } from "fs";
174348
- import { dirname as dirname11, resolve as resolve13 } from "path";
174867
+ import { readFileSync as readFileSync26 } from "fs";
174868
+ import { dirname as dirname11, resolve as resolve14 } from "path";
174349
174869
  var pagePatterns, getPageDirs = (config) => [
174350
174870
  { dir: config.angularDirectory, framework: "angular" },
174351
174871
  { dir: config.emberDirectory, framework: "ember" },
@@ -174365,8 +174885,8 @@ var pagePatterns, getPageDirs = (config) => [
174365
174885
  const source = definition.buildReference?.source;
174366
174886
  if (!source)
174367
174887
  continue;
174368
- const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve13(dirname11(buildInfo.resolvedRegistryPath), source);
174369
- lookup.set(`${definition.framework}:${definition.component}`, resolve13(resolvedSource));
174888
+ const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve14(dirname11(buildInfo.resolvedRegistryPath), source);
174889
+ lookup.set(`${definition.framework}:${definition.component}`, resolve14(resolvedSource));
174370
174890
  }
174371
174891
  return lookup;
174372
174892
  }, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
@@ -174379,13 +174899,13 @@ var pagePatterns, getPageDirs = (config) => [
174379
174899
  const pattern = pagePatterns[entry.framework];
174380
174900
  if (!pattern)
174381
174901
  return;
174382
- const files = await scanEntryPoints(resolve13(entry.dir), pattern);
174902
+ const files = await scanEntryPoints(resolve14(entry.dir), pattern);
174383
174903
  for (const filePath of files) {
174384
- const source = readFileSync23(filePath, "utf-8");
174904
+ const source = readFileSync26(filePath, "utf-8");
174385
174905
  const islands = extractIslandUsagesFromSource(source);
174386
- pageMetadata.set(resolve13(filePath), {
174906
+ pageMetadata.set(resolve14(filePath), {
174387
174907
  islands: resolveIslandUsages(islands, islandSourceLookup),
174388
- pagePath: resolve13(filePath)
174908
+ pagePath: resolve14(filePath)
174389
174909
  });
174390
174910
  }
174391
174911
  }, loadPageIslandMetadata = async (config) => {
@@ -174414,39 +174934,39 @@ var exports_islands = {};
174414
174934
  __export(exports_islands, {
174415
174935
  runIslands: () => runIslands
174416
174936
  });
174417
- import { existsSync as existsSync26, readFileSync as readFileSync24, statSync as statSync3 } from "fs";
174418
- import { join as join24, relative as relative8, resolve as resolve14 } from "path";
174419
- var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim5 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
174937
+ import { existsSync as existsSync28, readFileSync as readFileSync27, statSync as statSync4 } from "fs";
174938
+ import { join as join25, relative as relative8, resolve as resolve15 } from "path";
174939
+ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
174420
174940
  `), hostFrameworkOf = (pagePath, cwd, config) => {
174421
- const resolved = resolve14(cwd, pagePath);
174941
+ const resolved = resolve15(cwd, pagePath);
174422
174942
  for (const [framework, key] of Object.entries(FRAMEWORK_DIR_KEY)) {
174423
174943
  const dir = config[key];
174424
- if (typeof dir === "string" && resolved.startsWith(resolve14(cwd, dir))) {
174944
+ if (typeof dir === "string" && resolved.startsWith(resolve15(cwd, dir))) {
174425
174945
  return framework;
174426
174946
  }
174427
174947
  }
174428
174948
  return null;
174429
- }, fileSize2 = (path) => {
174949
+ }, fileSize3 = (path) => {
174430
174950
  try {
174431
- return statSync3(path).size;
174951
+ return statSync4(path).size;
174432
174952
  } catch {
174433
174953
  return 0;
174434
174954
  }
174435
174955
  }, readManifestSizes2 = (manifestDir) => {
174436
- const manifestPath = join24(manifestDir, "manifest.json");
174437
- if (!existsSync26(manifestPath))
174956
+ const manifestPath = join25(manifestDir, "manifest.json");
174957
+ if (!existsSync28(manifestPath))
174438
174958
  return null;
174439
- const manifest = JSON.parse(readFileSync24(manifestPath, "utf-8"));
174959
+ const manifest = JSON.parse(readFileSync27(manifestPath, "utf-8"));
174440
174960
  const sizes = new Map;
174441
174961
  for (const [key, value] of Object.entries(manifest)) {
174442
- sizes.set(key, fileSize2(join24(manifestDir, value.replace(/^\//, ""))));
174962
+ sizes.set(key, fileSize3(join25(manifestDir, value.replace(/^\//, ""))));
174443
174963
  }
174444
174964
  return sizes;
174445
174965
  }, collectIslands = async (cwd, config, sizes) => {
174446
174966
  const registryPath = config.islands?.registry;
174447
174967
  if (typeof registryPath !== "string")
174448
174968
  return null;
174449
- const buildInfo = await loadIslandRegistryBuildInfo(resolve14(cwd, registryPath));
174969
+ const buildInfo = await loadIslandRegistryBuildInfo(resolve15(cwd, registryPath));
174450
174970
  const pageMetadata = await loadPageIslandMetadata(config);
174451
174971
  const usages = [...pageMetadata.values()].flatMap((meta) => meta.islands.map((island) => ({ ...island, page: meta.pagePath })));
174452
174972
  return buildInfo.definitions.map((definition) => {
@@ -174456,7 +174976,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim5 = (message) => process.stdout.
174456
174976
  crossFramework: hostFramework !== null && hostFramework !== definition.framework,
174457
174977
  hostFramework,
174458
174978
  hydrate: usage.hydrate ?? "load",
174459
- page: relative8(cwd, resolve14(cwd, usage.page))
174979
+ page: relative8(cwd, resolve15(cwd, usage.page))
174460
174980
  };
174461
174981
  });
174462
174982
  const key = getIslandManifestKey(definition.framework, definition.component);
@@ -174520,15 +175040,15 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim5 = (message) => process.stdout.
174520
175040
  try {
174521
175041
  config = await loadConfig(configPath2);
174522
175042
  } catch (error) {
174523
- printDim5(error instanceof Error ? error.message : String(error));
175043
+ printDim6(error instanceof Error ? error.message : String(error));
174524
175044
  return;
174525
175045
  }
174526
175046
  const outdirIndex = args.indexOf("--outdir");
174527
175047
  const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
174528
- const sizes = args.includes("--sizes") ? readManifestSizes2(resolve14(cwd, outdir ?? "build")) : null;
175048
+ const sizes = args.includes("--sizes") ? readManifestSizes2(resolve15(cwd, outdir ?? "build")) : null;
174529
175049
  const islands = await collectIslands(cwd, config, sizes);
174530
175050
  if (islands === null) {
174531
- printDim5('No island registry configured. Set `islands: { registry: "..." }` in absolute.config.ts.');
175051
+ printDim6('No island registry configured. Set `islands: { registry: "..." }` in absolute.config.ts.');
174532
175052
  return;
174533
175053
  }
174534
175054
  if (args.includes("--json")) {
@@ -174537,7 +175057,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim5 = (message) => process.stdout.
174537
175057
  return;
174538
175058
  }
174539
175059
  if (islands.length === 0) {
174540
- printDim5("No islands found in the registry.");
175060
+ printDim6("No islands found in the registry.");
174541
175061
  return;
174542
175062
  }
174543
175063
  const sorted = [...islands].sort((left, right) => left.framework.localeCompare(right.framework) || left.component.localeCompare(right.component));
@@ -174574,13 +175094,13 @@ var init_islands2 = __esm(() => {
174574
175094
  });
174575
175095
 
174576
175096
  // src/build/externalAssetPlugin.ts
174577
- import { copyFileSync as copyFileSync2, existsSync as existsSync27, mkdirSync as mkdirSync12, statSync as statSync4 } from "fs";
174578
- import { basename as basename6, dirname as dirname12, join as join25, resolve as resolve15 } from "path";
175097
+ import { copyFileSync as copyFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync13, statSync as statSync5 } from "fs";
175098
+ import { basename as basename6, dirname as dirname12, join as join26, resolve as resolve16 } from "path";
174579
175099
  var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
174580
175100
  name: "absolute-external-asset",
174581
175101
  setup(bld) {
174582
175102
  const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
174583
- const skipRoots = userSourceRoots.map((root) => resolve15(root));
175103
+ const skipRoots = userSourceRoots.map((root) => resolve16(root));
174584
175104
  const isUserSource = (path) => skipRoots.some((root) => path.startsWith(`${root}/`));
174585
175105
  bld.onLoad({ filter: /\.[mc]?[jt]sx?$/ }, async (args) => {
174586
175106
  if (isUserSource(args.path))
@@ -174595,15 +175115,15 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
174595
175115
  const relPath = match[1];
174596
175116
  if (!relPath)
174597
175117
  continue;
174598
- const assetPath = resolve15(sourceDir, relPath);
174599
- if (!existsSync27(assetPath))
175118
+ const assetPath = resolve16(sourceDir, relPath);
175119
+ if (!existsSync29(assetPath))
174600
175120
  continue;
174601
- if (!statSync4(assetPath).isFile())
175121
+ if (!statSync5(assetPath).isFile())
174602
175122
  continue;
174603
- const targetPath = join25(outDir, basename6(assetPath));
174604
- if (existsSync27(targetPath))
175123
+ const targetPath = join26(outDir, basename6(assetPath));
175124
+ if (existsSync29(targetPath))
174605
175125
  continue;
174606
- mkdirSync12(dirname12(targetPath), { recursive: true });
175126
+ mkdirSync13(dirname12(targetPath), { recursive: true });
174607
175127
  copyFileSync2(assetPath, targetPath);
174608
175128
  }
174609
175129
  return;
@@ -174621,16 +175141,16 @@ __export(exports_compile, {
174621
175141
  var {env: env4 } = globalThis.Bun;
174622
175142
  import {
174623
175143
  cpSync,
174624
- existsSync as existsSync28,
174625
- mkdirSync as mkdirSync13,
175144
+ existsSync as existsSync30,
175145
+ mkdirSync as mkdirSync14,
174626
175146
  readdirSync as readdirSync6,
174627
- readFileSync as readFileSync25,
175147
+ readFileSync as readFileSync28,
174628
175148
  rmSync as rmSync5,
174629
- statSync as statSync5,
175149
+ statSync as statSync6,
174630
175150
  unlinkSync as unlinkSync4,
174631
- writeFileSync as writeFileSync13
175151
+ writeFileSync as writeFileSync15
174632
175152
  } from "fs";
174633
- import { basename as basename7, dirname as dirname13, join as join26, relative as relative9, resolve as resolve16 } from "path";
175153
+ import { basename as basename7, dirname as dirname13, join as join27, relative as relative9, resolve as resolve17 } from "path";
174634
175154
  var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
174635
175155
  const resolvedVersion = version2 || "unknown";
174636
175156
  console.log("");
@@ -174643,7 +175163,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174643
175163
  const entry = pending.pop();
174644
175164
  if (!entry)
174645
175165
  continue;
174646
- const fullPath = join26(entry.parentPath, entry.name);
175166
+ const fullPath = join27(entry.parentPath, entry.name);
174647
175167
  if (entry.isDirectory())
174648
175168
  pending = pending.concat(readdirSync6(fullPath, { withFileTypes: true }));
174649
175169
  else
@@ -174663,7 +175183,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174663
175183
  const entry = pending.pop();
174664
175184
  if (!entry)
174665
175185
  continue;
174666
- const fullPath = join26(entry.parentPath, entry.name);
175186
+ const fullPath = join27(entry.parentPath, entry.name);
174667
175187
  if (entry.isDirectory()) {
174668
175188
  if (SERVER_RUNTIME_SCAN_SKIP_DIRS.has(entry.name))
174669
175189
  continue;
@@ -174675,22 +175195,22 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174675
175195
  return result;
174676
175196
  }, copyServerRuntimeAssetReferences = (outdir) => {
174677
175197
  const copied = new Set;
174678
- const normalizedOutdir = resolve16(outdir);
175198
+ const normalizedOutdir = resolve17(outdir);
174679
175199
  const copyReference = (filePath, relPath) => {
174680
- const assetSource = resolve16(dirname13(filePath), relPath);
174681
- if (!existsSync28(assetSource) || !statSync5(assetSource).isFile())
175200
+ const assetSource = resolve17(dirname13(filePath), relPath);
175201
+ if (!existsSync30(assetSource) || !statSync6(assetSource).isFile())
174682
175202
  return;
174683
- const assetTarget = resolve16(normalizedOutdir, relPath.replace(/^\.\//, ""));
175203
+ const assetTarget = resolve17(normalizedOutdir, relPath.replace(/^\.\//, ""));
174684
175204
  if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
174685
175205
  return;
174686
175206
  if (copied.has(assetTarget))
174687
175207
  return;
174688
175208
  copied.add(assetTarget);
174689
- mkdirSync13(dirname13(assetTarget), { recursive: true });
175209
+ mkdirSync14(dirname13(assetTarget), { recursive: true });
174690
175210
  cpSync(assetSource, assetTarget, { force: true });
174691
175211
  };
174692
175212
  for (const filePath of collectProjectSourceFiles(process.cwd())) {
174693
- const source = readFileSync25(filePath, "utf-8");
175213
+ const source = readFileSync28(filePath, "utf-8");
174694
175214
  SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
174695
175215
  let match;
174696
175216
  while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
@@ -174719,7 +175239,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174719
175239
  }
174720
175240
  }, readPackageVersion4 = (candidate) => {
174721
175241
  try {
174722
- const pkg = JSON.parse(readFileSync25(candidate, "utf-8"));
175242
+ const pkg = JSON.parse(readFileSync28(candidate, "utf-8"));
174723
175243
  if (pkg.name !== "@absolutejs/absolute")
174724
175244
  return null;
174725
175245
  const ver = pkg.version;
@@ -174754,18 +175274,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174754
175274
  return resolveBuildModule3(remaining);
174755
175275
  }, resolveJsxDevRuntimeCompatPath2 = () => {
174756
175276
  const candidates = [
174757
- resolve16(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
174758
- resolve16(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
174759
- resolve16(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
174760
- resolve16(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
174761
- resolve16(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
174762
- resolve16(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
175277
+ resolve17(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
175278
+ resolve17(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
175279
+ resolve17(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
175280
+ resolve17(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
175281
+ resolve17(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
175282
+ resolve17(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
174763
175283
  ];
174764
175284
  for (const candidate of candidates) {
174765
- if (existsSync28(candidate))
175285
+ if (existsSync30(candidate))
174766
175286
  return candidate;
174767
175287
  }
174768
- return resolve16(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
175288
+ return resolve17(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
174769
175289
  }, jsxDevRuntimeCompatPath2, shouldEmbedCompiledAsset = (relativePath, skip = new Set) => {
174770
175290
  if (skip.has(relativePath))
174771
175291
  return false;
@@ -174778,11 +175298,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174778
175298
  return true;
174779
175299
  }, tryReadNodePackageJson = (packageDir) => {
174780
175300
  try {
174781
- return JSON.parse(readFileSync25(join26(packageDir, "package.json"), "utf-8"));
175301
+ return JSON.parse(readFileSync28(join27(packageDir, "package.json"), "utf-8"));
174782
175302
  } catch {
174783
175303
  return null;
174784
175304
  }
174785
- }, resolveProjectPackageDir = (specifier) => resolve16(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
175305
+ }, resolveProjectPackageDir = (specifier) => resolve17(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
174786
175306
  if (seen.has(specifier))
174787
175307
  return;
174788
175308
  const srcDir = resolveProjectPackageDir(specifier);
@@ -174790,7 +175310,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174790
175310
  if (!pkg)
174791
175311
  return;
174792
175312
  seen.add(specifier);
174793
- const destDir = join26(outdir, "node_modules", ...specifier.split("/"));
175313
+ const destDir = join27(outdir, "node_modules", ...specifier.split("/"));
174794
175314
  rmSync5(destDir, { force: true, recursive: true });
174795
175315
  cpSync(srcDir, destDir, {
174796
175316
  force: true,
@@ -174812,8 +175332,8 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174812
175332
  }, copyAngularRuntimePackages = (buildConfig, outdir) => {
174813
175333
  if (!buildConfig.angularDirectory)
174814
175334
  return;
174815
- const angularScopeDir = resolve16(process.cwd(), "node_modules", "@angular");
174816
- const angularPackages = existsSync28(angularScopeDir) ? readdirSync6(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
175335
+ const angularScopeDir = resolve17(process.cwd(), "node_modules", "@angular");
175336
+ const angularPackages = existsSync30(angularScopeDir) ? readdirSync6(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
174817
175337
  const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
174818
175338
  const seen = new Set;
174819
175339
  for (const specifier of roots) {
@@ -174827,18 +175347,19 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174827
175347
  if (buildConfig.vueDirectory) {
174828
175348
  copyPackageToBuild("vue", outdir, seen);
174829
175349
  copyPackageToBuild("@vue/server-renderer", outdir, seen);
175350
+ copyPackageToBuild("vue-demi", outdir, seen);
174830
175351
  }
174831
175352
  copyAngularRuntimePackages(buildConfig, outdir);
174832
175353
  }, collectRuntimePackageSpecifiers = (distDir) => {
174833
- const nodeModulesDir = join26(distDir, "node_modules");
174834
- if (!existsSync28(nodeModulesDir))
175354
+ const nodeModulesDir = join27(distDir, "node_modules");
175355
+ if (!existsSync30(nodeModulesDir))
174835
175356
  return [];
174836
175357
  const specifiers = [];
174837
175358
  for (const entry of readdirSync6(nodeModulesDir, { withFileTypes: true })) {
174838
175359
  if (!entry.isDirectory())
174839
175360
  continue;
174840
175361
  if (entry.name.startsWith("@")) {
174841
- const scopeDir = join26(nodeModulesDir, entry.name);
175362
+ const scopeDir = join27(nodeModulesDir, entry.name);
174842
175363
  for (const scopedEntry of readdirSync6(scopeDir, {
174843
175364
  withFileTypes: true
174844
175365
  })) {
@@ -174870,21 +175391,21 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174870
175391
  const packageSpecifier = packageSpecifiers.find((root) => specifier === root || specifier.startsWith(`${root}/`));
174871
175392
  if (!packageSpecifier)
174872
175393
  return null;
174873
- const packageDir = join26(distDir, "node_modules", ...packageSpecifier.split("/"));
175394
+ const packageDir = join27(distDir, "node_modules", ...packageSpecifier.split("/"));
174874
175395
  const subpath = specifier.slice(packageSpecifier.length);
174875
- const subPackageDir = subpath ? join26(packageDir, ...subpath.slice(1).split("/")) : null;
174876
- const resolvedPackageDir = subPackageDir && existsSync28(join26(subPackageDir, "package.json")) ? subPackageDir : packageDir;
174877
- const packageJsonPath = join26(resolvedPackageDir, "package.json");
174878
- if (!existsSync28(packageJsonPath))
175396
+ const subPackageDir = subpath ? join27(packageDir, ...subpath.slice(1).split("/")) : null;
175397
+ const resolvedPackageDir = subPackageDir && existsSync30(join27(subPackageDir, "package.json")) ? subPackageDir : packageDir;
175398
+ const packageJsonPath = join27(resolvedPackageDir, "package.json");
175399
+ if (!existsSync30(packageJsonPath))
174879
175400
  return null;
174880
- const pkg = JSON.parse(readFileSync25(packageJsonPath, "utf-8"));
175401
+ const pkg = JSON.parse(readFileSync28(packageJsonPath, "utf-8"));
174881
175402
  const exportKey = resolvedPackageDir !== subPackageDir && subpath ? `.${subpath}` : ".";
174882
175403
  const rootExport = pkg.exports?.[exportKey];
174883
175404
  const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
174884
- return join26(resolvedPackageDir, entry);
175405
+ return join27(resolvedPackageDir, entry);
174885
175406
  }, 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) => {
174886
175407
  try {
174887
- return statSync5(filePath).isFile();
175408
+ return statSync6(filePath).isFile();
174888
175409
  } catch {
174889
175410
  return false;
174890
175411
  }
@@ -174894,13 +175415,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174894
175415
  const candidates = [
174895
175416
  candidate,
174896
175417
  ...RUNTIME_JS_EXTENSIONS.map((extension) => `${candidate}${extension}`),
174897
- ...RUNTIME_JS_EXTENSIONS.map((extension) => join26(candidate, `index${extension}`))
175418
+ ...RUNTIME_JS_EXTENSIONS.map((extension) => join27(candidate, `index${extension}`))
174898
175419
  ];
174899
175420
  return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
174900
175421
  }, findContainingRuntimePackageDir = (filePath) => {
174901
175422
  let dir = dirname13(filePath);
174902
175423
  while (dir !== dirname13(dir)) {
174903
- if (isNodeModulesPath(dir) && existsSync28(join26(dir, "package.json"))) {
175424
+ if (isNodeModulesPath(dir) && existsSync30(join27(dir, "package.json"))) {
174904
175425
  return dir;
174905
175426
  }
174906
175427
  dir = dirname13(dir);
@@ -174916,7 +175437,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174916
175437
  const entry = pickExportEntry(pkg?.imports?.[specifier]);
174917
175438
  if (!entry)
174918
175439
  return null;
174919
- return join26(packageDir, entry);
175440
+ return join27(packageDir, entry);
174920
175441
  }, collectRuntimeRewriteRoots = (distDir) => collectFiles2(distDir).filter((filePath) => isRuntimeJsFile(filePath) && !isNodeModulesPath(filePath)), rewriteRuntimeModuleSpecifiers = (distDir) => {
174921
175442
  const packageSpecifiers = collectRuntimePackageSpecifiers(distDir);
174922
175443
  if (packageSpecifiers.length === 0)
@@ -174935,10 +175456,10 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174935
175456
  if (!filePath || seen.has(filePath))
174936
175457
  continue;
174937
175458
  seen.add(filePath);
174938
- const source = readFileSync25(filePath, "utf-8");
175459
+ const source = readFileSync28(filePath, "utf-8");
174939
175460
  const rewritten = source.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
174940
175461
  if (typeof specifier === "string" && specifier.startsWith(".")) {
174941
- enqueue(resolveRuntimeJsFile(resolve16(dirname13(filePath), specifier)));
175462
+ enqueue(resolveRuntimeJsFile(resolve17(dirname13(filePath), specifier)));
174942
175463
  return match;
174943
175464
  }
174944
175465
  const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
@@ -174953,7 +175474,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
174953
175474
  return `${prefix}${quote}${ensureRelativeModuleSpecifier(filePath, target)}${quote}`;
174954
175475
  });
174955
175476
  if (rewritten !== source) {
174956
- writeFileSync13(filePath, rewritten);
175477
+ writeFileSync15(filePath, rewritten);
174957
175478
  }
174958
175479
  }
174959
175480
  }, generateEntrypoint = (distDir, serverEntry, prerenderMap, version2, buildConfig) => {
@@ -175027,7 +175548,7 @@ import { websocket as elysiaWebsocket } from "elysia/ws";
175027
175548
  const SERVER_MODULE = (runtimeDir: string) => import(pathToFileURL(join(runtimeDir, ${JSON.stringify(serverBundleName)})).href);
175028
175549
  const RUNTIME_BUILD_ID = ${JSON.stringify(runtimeBuildId)};
175029
175550
  const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
175030
- const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve16(distDir))};
175551
+ const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve17(distDir))};
175031
175552
  const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
175032
175553
 
175033
175554
  // \u2500\u2500 Asset URL \u2192 embedded path map \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
@@ -175405,16 +175926,16 @@ console.log(\`
175405
175926
  }),
175406
175927
  ...collectUserServerExternals(buildConfig)
175407
175928
  ], compile = async (serverEntry, outdir, outfile, configPath2) => {
175408
- const resolvedOutdir = resolve16(outdir ?? "dist");
175929
+ const resolvedOutdir = resolve17(outdir ?? "dist");
175409
175930
  await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
175410
175931
  }, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
175411
175932
  const prerenderPort = Number(env4.COMPILE_PORT) || Number(env4.PORT) || DEFAULT_PORT + 1;
175412
175933
  killStaleProcesses(prerenderPort);
175413
175934
  const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
175414
- const resolvedOutfile = resolve16(outfile ?? "compiled-server");
175935
+ const resolvedOutfile = resolve17(outfile ?? "compiled-server");
175415
175936
  const absoluteVersion = resolvePackageVersion3([
175416
- resolve16(import.meta.dir, "..", "..", "..", "package.json"),
175417
- resolve16(import.meta.dir, "..", "..", "package.json")
175937
+ resolve17(import.meta.dir, "..", "..", "..", "package.json"),
175938
+ resolve17(import.meta.dir, "..", "..", "package.json")
175418
175939
  ]);
175419
175940
  compileBanner(absoluteVersion);
175420
175941
  const totalStart = performance.now();
@@ -175425,8 +175946,8 @@ console.log(\`
175425
175946
  buildConfig.mode = "production";
175426
175947
  try {
175427
175948
  const build2 = await resolveBuildModule3([
175428
- resolve16(import.meta.dir, "..", "..", "core", "build"),
175429
- resolve16(import.meta.dir, "..", "build")
175949
+ resolve17(import.meta.dir, "..", "..", "core", "build"),
175950
+ resolve17(import.meta.dir, "..", "build")
175430
175951
  ]);
175431
175952
  if (!build2)
175432
175953
  throw new Error("Could not locate build module");
@@ -175448,10 +175969,10 @@ console.log(\`
175448
175969
  buildConfig.htmxDirectory
175449
175970
  ].filter((dir) => Boolean(dir));
175450
175971
  const islandRegistrySpec = buildConfig.islands?.registry;
175451
- const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve16(islandRegistrySpec))) : undefined;
175972
+ const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve17(islandRegistrySpec))) : undefined;
175452
175973
  const serverBundle = await Bun.build({
175453
175974
  define: { "process.env.NODE_ENV": '"production"' },
175454
- entrypoints: [resolve16(serverEntry)],
175975
+ entrypoints: [resolve17(serverEntry)],
175455
175976
  external: resolveServerBundleExternals(buildConfig),
175456
175977
  outdir: resolvedOutdir,
175457
175978
  plugins: [
@@ -175472,13 +175993,13 @@ console.log(\`
175472
175993
  console.error(cliTag4("\x1B[31m", "Server bundle failed."));
175473
175994
  process.exit(1);
175474
175995
  }
175475
- const outputPath = resolve16(resolvedOutdir, `${entryName}.js`);
175476
- if (!existsSync28(outputPath)) {
175996
+ const outputPath = resolve17(resolvedOutdir, `${entryName}.js`);
175997
+ if (!existsSync30(outputPath)) {
175477
175998
  console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
175478
175999
  process.exit(1);
175479
176000
  }
175480
- if (existsSync28(resolve16(resolvedOutdir, "angular", "vendor", "server"))) {
175481
- const vendorDir = resolve16(resolvedOutdir, "angular", "vendor", "server");
176001
+ if (existsSync30(resolve17(resolvedOutdir, "angular", "vendor", "server"))) {
176002
+ const vendorDir = resolve17(resolvedOutdir, "angular", "vendor", "server");
175482
176003
  const vendorEntries = readdirSync6(vendorDir).filter((f) => f.endsWith(".js"));
175483
176004
  const angularServerVendorPaths = {};
175484
176005
  for (const file of vendorEntries) {
@@ -175487,7 +176008,7 @@ console.log(\`
175487
176008
  if (scope !== "angular" || rest.length === 0)
175488
176009
  continue;
175489
176010
  const specifier = `@angular/${rest.join("/")}`;
175490
- const relPath = relative9(dirname13(outputPath), resolve16(vendorDir, file));
176011
+ const relPath = relative9(dirname13(outputPath), resolve17(vendorDir, file));
175491
176012
  angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
175492
176013
  }
175493
176014
  if (Object.keys(angularServerVendorPaths).length > 0) {
@@ -175499,7 +176020,7 @@ console.log(\`
175499
176020
  copyServerRuntimeAssetReferences(resolvedOutdir);
175500
176021
  const prerenderStart = performance.now();
175501
176022
  process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
175502
- rmSync5(join26(resolvedOutdir, "_prerendered"), {
176023
+ rmSync5(join27(resolvedOutdir, "_prerendered"), {
175503
176024
  force: true,
175504
176025
  recursive: true
175505
176026
  });
@@ -175518,9 +176039,9 @@ console.log(\`
175518
176039
  const compileStart = performance.now();
175519
176040
  process.stdout.write(cliTag4("\x1B[36m", "Compiling standalone executable"));
175520
176041
  const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
175521
- const entrypointPath = join26(resolvedOutdir, "_compile_entrypoint.ts");
176042
+ const entrypointPath = join27(resolvedOutdir, "_compile_entrypoint.ts");
175522
176043
  await Bun.write(entrypointPath, entrypointCode);
175523
- mkdirSync13(dirname13(resolvedOutfile), { recursive: true });
176044
+ mkdirSync14(dirname13(resolvedOutfile), { recursive: true });
175524
176045
  const result = await Bun.build({
175525
176046
  compile: { outfile: resolvedOutfile },
175526
176047
  define: { "process.env.NODE_ENV": '"production"' },
@@ -175614,11 +176135,11 @@ var exports_typecheck = {};
175614
176135
  __export(exports_typecheck, {
175615
176136
  typecheck: () => typecheck
175616
176137
  });
175617
- import { resolve as resolve17, join as join27 } from "path";
175618
- import { existsSync as existsSync29, readFileSync as readFileSync26 } from "fs";
176138
+ import { resolve as resolve18, join as join28 } from "path";
176139
+ import { existsSync as existsSync31, readFileSync as readFileSync29 } from "fs";
175619
176140
  import { mkdir as mkdir2, writeFile } from "fs/promises";
175620
- var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve17(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
175621
- if (!existsSync29(resolveConfigPath(configPath2))) {
176141
+ var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve18(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
176142
+ if (!existsSync31(resolveConfigPath(configPath2))) {
175622
176143
  return [{}];
175623
176144
  }
175624
176145
  const rawConfig = await loadRawConfig(configPath2);
@@ -175638,8 +176159,8 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
175638
176159
  const exitCode = await proc.exited;
175639
176160
  return { exitCode, name, output: (stdout + stderr).trim() };
175640
176161
  }, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
175641
- const local = resolve17("node_modules", ".bin", name);
175642
- return existsSync29(local) ? local : null;
176162
+ const local = resolve18("node_modules", ".bin", name);
176163
+ return existsSync31(local) ? local : null;
175643
176164
  }, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
175644
176165
  const cwd = `${process.cwd()}/`;
175645
176166
  const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
@@ -175686,15 +176207,15 @@ Found ${errorCount} error${suffix}.`;
175686
176207
  return formatted;
175687
176208
  }, ABSOLUTE_INTERNAL_EXCLUDES, resolveAbsoluteTypeFile = (fileName) => {
175688
176209
  const candidates = [
175689
- resolve17("node_modules/@absolutejs/absolute/dist/types", fileName),
175690
- resolve17(import.meta.dir, "../types", fileName),
175691
- resolve17(import.meta.dir, "../../types", fileName),
175692
- resolve17(import.meta.dir, "../../../types", fileName)
176210
+ resolve18("node_modules/@absolutejs/absolute/dist/types", fileName),
176211
+ resolve18(import.meta.dir, "../types", fileName),
176212
+ resolve18(import.meta.dir, "../../types", fileName),
176213
+ resolve18(import.meta.dir, "../../../types", fileName)
175693
176214
  ];
175694
- return candidates.find((candidate) => existsSync29(candidate)) ?? candidates[0];
176215
+ return candidates.find((candidate) => existsSync31(candidate)) ?? candidates[0];
175695
176216
  }, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
175696
176217
  try {
175697
- return JSON.parse(readFileSync26(resolve17("tsconfig.json"), "utf-8"));
176218
+ return JSON.parse(readFileSync29(resolve18("tsconfig.json"), "utf-8"));
175698
176219
  } catch {
175699
176220
  return {};
175700
176221
  }
@@ -175722,22 +176243,22 @@ Found ${errorCount} error${suffix}.`;
175722
176243
  console.error("\x1B[31m\u2717\x1B[0m vue-tsc is required for Vue type checking. Install it: bun add -d vue-tsc");
175723
176244
  process.exit(1);
175724
176245
  }
175725
- const vueTsconfigPath = join27(cacheDir, "tsconfig.vue-check.json");
176246
+ const vueTsconfigPath = join28(cacheDir, "tsconfig.vue-check.json");
175726
176247
  return writeFile(vueTsconfigPath, JSON.stringify({
175727
176248
  compilerOptions: {
175728
176249
  rootDir: ".."
175729
176250
  },
175730
176251
  exclude: getProjectTypecheckExcludes(),
175731
- extends: resolve17("tsconfig.json"),
176252
+ extends: resolve18("tsconfig.json"),
175732
176253
  include: getProjectTypecheckIncludes()
175733
176254
  }, null, "\t")).then(() => run("vue-tsc", [
175734
176255
  vueTscBin,
175735
176256
  "--noEmit",
175736
176257
  "--project",
175737
- resolve17(vueTsconfigPath),
176258
+ resolve18(vueTsconfigPath),
175738
176259
  "--incremental",
175739
176260
  "--tsBuildInfoFile",
175740
- join27(cacheDir, "vue-tsc.tsbuildinfo"),
176261
+ join28(cacheDir, "vue-tsc.tsbuildinfo"),
175741
176262
  "--pretty"
175742
176263
  ]));
175743
176264
  }, buildAngularCheck = async (cacheDir, angularDir) => {
@@ -175746,7 +176267,7 @@ Found ${errorCount} error${suffix}.`;
175746
176267
  console.error("\x1B[31m\u2717\x1B[0m @angular/compiler-cli is required for Angular type checking. Install it: bun add -d @angular/compiler-cli");
175747
176268
  process.exit(1);
175748
176269
  }
175749
- const angularTsconfigPath = join27(cacheDir, "tsconfig.angular-check.json");
176270
+ const angularTsconfigPath = join28(cacheDir, "tsconfig.angular-check.json");
175750
176271
  await writeFile(angularTsconfigPath, JSON.stringify({
175751
176272
  angularCompilerOptions: {
175752
176273
  strictTemplates: true
@@ -175756,32 +176277,32 @@ Found ${errorCount} error${suffix}.`;
175756
176277
  rootDir: ".."
175757
176278
  },
175758
176279
  exclude: ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
175759
- extends: resolve17("tsconfig.json"),
176280
+ extends: resolve18("tsconfig.json"),
175760
176281
  include: [`../${angularDir}/**/*`]
175761
176282
  }, null, "\t"));
175762
- return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve17(angularTsconfigPath))}`);
176283
+ return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve18(angularTsconfigPath))}`);
175763
176284
  }, buildTscCheck = (cacheDir) => {
175764
176285
  const tscBin = findBin("tsc");
175765
176286
  if (!tscBin) {
175766
176287
  console.error("\x1B[31m\u2717\x1B[0m typescript is required for type checking. Install it: bun add -d typescript");
175767
176288
  process.exit(1);
175768
176289
  }
175769
- const tscConfigPath = join27(cacheDir, "tsconfig.typecheck.json");
176290
+ const tscConfigPath = join28(cacheDir, "tsconfig.typecheck.json");
175770
176291
  return writeFile(tscConfigPath, JSON.stringify({
175771
176292
  compilerOptions: {
175772
176293
  rootDir: ".."
175773
176294
  },
175774
176295
  exclude: getProjectTypecheckExcludes(),
175775
- extends: resolve17("tsconfig.json"),
176296
+ extends: resolve18("tsconfig.json"),
175776
176297
  include: getProjectTypecheckIncludes()
175777
176298
  }, null, "\t")).then(() => run("tsc", [
175778
176299
  tscBin,
175779
176300
  "--noEmit",
175780
176301
  "--project",
175781
- resolve17(tscConfigPath),
176302
+ resolve18(tscConfigPath),
175782
176303
  "--incremental",
175783
176304
  "--tsBuildInfoFile",
175784
- join27(cacheDir, "tsc.tsbuildinfo"),
176305
+ join28(cacheDir, "tsc.tsbuildinfo"),
175785
176306
  "--pretty"
175786
176307
  ]));
175787
176308
  }, buildSvelteCheck = async (cacheDir, svelteDir) => {
@@ -175790,16 +176311,16 @@ Found ${errorCount} error${suffix}.`;
175790
176311
  console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
175791
176312
  process.exit(1);
175792
176313
  }
175793
- const svelteTsconfigPath = join27(cacheDir, "tsconfig.svelte-check.json");
176314
+ const svelteTsconfigPath = join28(cacheDir, "tsconfig.svelte-check.json");
175794
176315
  await writeFile(svelteTsconfigPath, JSON.stringify({
175795
- extends: resolve17("tsconfig.json"),
176316
+ extends: resolve18("tsconfig.json"),
175796
176317
  files: ABSOLUTE_TYPECHECK_FILES,
175797
176318
  include: [`../${svelteDir}/**/*`]
175798
176319
  }, null, "\t"));
175799
176320
  return run("svelte-check", [
175800
176321
  svelteBin,
175801
176322
  "--tsconfig",
175802
- resolve17(svelteTsconfigPath),
176323
+ resolve18(svelteTsconfigPath),
175803
176324
  "--threshold",
175804
176325
  "error",
175805
176326
  "--compiler-warnings",
@@ -175988,11 +176509,11 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
175988
176509
  url: url.pathname + url.search,
175989
176510
  ...bodyBytes && bodyBytes.length > 0 ? { bodyBase64: Buffer.from(bodyBytes).toString("base64") } : {}
175990
176511
  };
175991
- const responsePromise = new Promise((resolve18) => {
175992
- pending.set(id, resolve18);
176512
+ const responsePromise = new Promise((resolve19) => {
176513
+ pending.set(id, resolve19);
175993
176514
  });
175994
176515
  client.send(encodeTunnelMessage(message));
175995
- const timeout = new Promise((resolve18) => setTimeout(() => resolve18({ id, message: "timeout", type: "error" }), requestTimeoutMs));
176516
+ const timeout = new Promise((resolve19) => setTimeout(() => resolve19({ id, message: "timeout", type: "error" }), requestTimeoutMs));
175996
176517
  const result = await Promise.race([responsePromise, timeout]);
175997
176518
  pending.delete(id);
175998
176519
  if (result.type === "error") {
@@ -179505,6 +180026,14 @@ if (command === "dev") {
179505
180026
  sendTelemetryEvent("cli:command", { command: "add" });
179506
180027
  const { runAdd: runAdd2 } = await Promise.resolve().then(() => (init_add(), exports_add));
179507
180028
  await runAdd2(args);
180029
+ } else if (command === "analyze") {
180030
+ sendTelemetryEvent("cli:command", { command: "analyze" });
180031
+ const { runAnalyze: runAnalyze2 } = await Promise.resolve().then(() => (init_analyze(), exports_analyze));
180032
+ await runAnalyze2(args);
180033
+ } else if (command === "api") {
180034
+ sendTelemetryEvent("cli:command", { command: "api" });
180035
+ const { runApi: runApi2 } = await Promise.resolve().then(() => (init_api(), exports_api));
180036
+ await runApi2(args);
179508
180037
  } else if (command === "remove") {
179509
180038
  sendTelemetryEvent("cli:command", { command: "remove" });
179510
180039
  const { runRemove: runRemove2 } = await Promise.resolve().then(() => (init_remove(), exports_remove));
@@ -179576,9 +180105,11 @@ if (command === "dev") {
179576
180105
  console.error(" start [entry] [--outdir dir] Start production server");
179577
180106
  console.error(" compile [entry] [--outdir dir] [--outfile path] Compile standalone executable");
179578
180107
  console.error(" config [--port n] Open the unified config UI (ESLint, tsconfig, Prettier)");
179579
- console.error(" doctor [--json] Diagnose the project (bun, config, framework dirs, env, port)");
180108
+ console.error(" doctor [--fix] [--json] Diagnose the project (bun, config, framework dirs, env, port)");
179580
180109
  console.error(" env [--check] [--json] Report env vars the app reads (getEnv) and which are missing");
179581
180110
  console.error(" add <framework> [--no-install] Add a framework (deps, config, starter page)");
180111
+ console.error(" analyze [--save] [--json] Bundle size breakdown + diff vs a saved baseline");
180112
+ console.error(" api [--openapi] [--json] Show the API surface (or emit OpenAPI) from a running dev server");
179582
180113
  console.error(" eslint Run ESLint (cached)");
179583
180114
  console.error(" generate <page|api|component> <name> [--framework <fw>] Scaffold a page, API plugin, or component");
179584
180115
  console.error(" htmx [version] Self-host htmx \u2014 report or install/upgrade the pinned copy");
@@ -179588,7 +180119,7 @@ if (command === "dev") {
179588
180119
  console.error(" remove <framework> [--prune] Remove a framework from config (keeps source)");
179589
180120
  console.error(" logs <name> [-f] [-n <lines>] Tail a running server's log by name");
179590
180121
  console.error(" ls [--sizes] [--budget <size>] [--json] List the project's pages by framework");
179591
- console.error(" mem [--json] Memory report (RSS) for running servers, plus system usage");
180122
+ console.error(" mem [--json] | mem diff <a> <b> Memory report (RSS), or diff two heap snapshots");
179592
180123
  console.error(" ps [--watch] [--json] [--kill <pid|port>] [--kill-all] List/manage running servers");
179593
180124
  console.error(" prettier Run Prettier check (cached)");
179594
180125
  console.error(" routes [--json] List every route (pages + API) of a running dev server");