@absolutejs/absolute 0.19.0-beta.1051 → 0.19.0-beta.1052

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-xV2GIQ/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-aDAogF/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-xV2GIQ/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-aDAogF/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
48
48
  getWarningController()?.maybeWarn(primitiveName);
49
49
  };
50
50
 
51
- // .angular-partial-tmp-xV2GIQ/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-aDAogF/src/core/streamingSlotRegistry.ts
52
52
  var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
53
  var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
54
  var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
package/dist/cli/index.js CHANGED
@@ -175465,6 +175465,215 @@ var init_env = __esm(() => {
175465
175465
  STATUS_WIDTH2 = "missing".length;
175466
175466
  });
175467
175467
 
175468
+ // src/cli/scripts/db.ts
175469
+ var exports_db = {};
175470
+ __export(exports_db, {
175471
+ runDb: () => runDb,
175472
+ quoteIdent: () => quoteIdent,
175473
+ encodeValue: () => encodeValue,
175474
+ dependencyOrder: () => dependencyOrder,
175475
+ conflictClause: () => conflictClause,
175476
+ chunkRows: () => chunkRows
175477
+ });
175478
+ import { existsSync as existsSync30, mkdirSync as mkdirSync13, readFileSync as readFileSync29, writeFileSync as writeFileSync16 } from "fs";
175479
+ import { join as join27 } from "path";
175480
+ var {env: env4, spawn: spawn2, SQL } = globalThis.Bun;
175481
+ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA_TYPES, SEED_CANDIDATES, VALUE_FLAGS, paint = (text, color) => `${color}${text}${colors.reset}`, chunkRows = (items, size) => Array.from({ length: Math.ceil(items.length / size) }, (_, idx) => items.slice(idx * size, idx * size + size)), quoteIdent = (name) => `"${name.replace(/"/g, '""')}"`, resolveUrl = (explicit) => {
175482
+ const found = explicit ?? URL_ENV_KEYS.map((key) => env4[key]).find((value) => typeof value === "string" && value !== "");
175483
+ if (found === undefined || found === "")
175484
+ throw new Error(`No database URL found. Set ${URL_ENV_KEYS.join(" or ")}, or pass --url <url>.`);
175485
+ return found;
175486
+ }, keepTable = (name, options) => (options.only.length === 0 || options.only.includes(name)) && !options.exclude.includes(name), listTables = async (sql) => {
175487
+ const rows = await sql`select table_name from information_schema.tables where table_schema = ${"public"} and table_type = ${"BASE TABLE"} order by table_name`;
175488
+ return rows.map((row) => row.table_name);
175489
+ }, columnsFor = async (sql, name) => {
175490
+ const rows = await sql.unsafe(`select column_name, data_type from information_schema.columns where table_schema = $1 and table_name = $2 order by ordinal_position`, ["public", name]);
175491
+ return rows.map((row) => ({
175492
+ isJson: JSON_DATA_TYPES.includes(row.data_type),
175493
+ name: row.column_name
175494
+ }));
175495
+ }, primaryKeyFor = async (sql, name) => {
175496
+ const rows = await sql.unsafe(`select a.attname as col from pg_index i join pg_attribute a on a.attrelid = i.indrelid and a.attnum = any(i.indkey) where i.indrelid = $1::regclass and i.indisprimary order by a.attnum`, [`public.${quoteIdent(name)}`]);
175497
+ return rows.map((row) => row.col);
175498
+ }, tableMeta = async (sql, name) => {
175499
+ const [columns, primaryKey] = await Promise.all([
175500
+ columnsFor(sql, name),
175501
+ primaryKeyFor(sql, name)
175502
+ ]);
175503
+ return { columns, name, primaryKey };
175504
+ }, foreignLinks = async (sql) => {
175505
+ const rows = await sql.unsafe(`select tc.table_name as child, ccu.table_name as parent from information_schema.table_constraints tc join information_schema.constraint_column_usage ccu on ccu.constraint_name = tc.constraint_name and ccu.table_schema = tc.table_schema where tc.constraint_type = 'FOREIGN KEY' and tc.table_schema = $1`, ["public"]);
175506
+ return rows.map((row) => ({
175507
+ from: row.child,
175508
+ to: row.parent
175509
+ }));
175510
+ }, conflictClause = (meta) => {
175511
+ if (meta.primaryKey.length === 0)
175512
+ return "on conflict do nothing";
175513
+ const target = meta.primaryKey.map(quoteIdent).join(", ");
175514
+ const updatable = meta.columns.map((col) => col.name).filter((name) => !meta.primaryKey.includes(name));
175515
+ if (updatable.length === 0)
175516
+ return `on conflict (${target}) do nothing`;
175517
+ const sets = updatable.map((name) => `${quoteIdent(name)} = excluded.${quoteIdent(name)}`).join(", ");
175518
+ return `on conflict (${target}) do update set ${sets}`;
175519
+ }, dependencyOrder = (names, links) => {
175520
+ const present = new Set(names);
175521
+ const edges = links.filter((link) => present.has(link.from) && present.has(link.to) && link.from !== link.to);
175522
+ const indegree = new Map(names.map((name) => [name, 0]));
175523
+ edges.forEach((link) => indegree.set(link.from, (indegree.get(link.from) ?? 0) + 1));
175524
+ const ready = names.filter((name) => (indegree.get(name) ?? 0) === 0);
175525
+ const ordered = [];
175526
+ const release = (parent) => edges.filter((link) => link.to === parent).forEach((link) => {
175527
+ const next = (indegree.get(link.from) ?? 0) - 1;
175528
+ indegree.set(link.from, next);
175529
+ if (next === 0)
175530
+ ready.push(link.from);
175531
+ });
175532
+ const drain = () => {
175533
+ const head = ready.shift();
175534
+ if (head === undefined)
175535
+ return;
175536
+ ordered.push(head);
175537
+ release(head);
175538
+ drain();
175539
+ };
175540
+ drain();
175541
+ names.forEach((name) => {
175542
+ if (!ordered.includes(name))
175543
+ ordered.push(name);
175544
+ });
175545
+ return ordered;
175546
+ }, encodeValue = (col, value) => {
175547
+ if (value === null || value === undefined)
175548
+ return null;
175549
+ if (col.isJson)
175550
+ return JSON.stringify(value);
175551
+ return value;
175552
+ }, insertChunk = async (sql, meta, rows) => {
175553
+ const colNames = meta.columns.map((col) => col.name);
175554
+ const groups = rows.map((_, rowIdx) => {
175555
+ const base = rowIdx * colNames.length;
175556
+ const slots = [...colNames.keys()].map((colIdx) => `$${base + colIdx + 1}`);
175557
+ return `(${slots.join(", ")})`;
175558
+ });
175559
+ const params = rows.flatMap((row) => meta.columns.map((col) => encodeValue(col, row[col.name])));
175560
+ const columnList = colNames.map(quoteIdent).join(", ");
175561
+ const query = `insert into ${quoteIdent(meta.name)} (${columnList}) values ${groups.join(", ")} ${conflictClause(meta)}`;
175562
+ await sql.unsafe(query, params);
175563
+ }, restoreTable = async (sql, meta, rows) => {
175564
+ if (meta === undefined || rows.length === 0)
175565
+ return;
175566
+ await chunkRows(rows, RESTORE_CHUNK_ROWS).reduce(async (prev, part) => {
175567
+ await prev;
175568
+ return insertChunk(sql, meta, part);
175569
+ }, Promise.resolve());
175570
+ }, truncateAll = async (sql, names) => {
175571
+ if (names.length === 0)
175572
+ return;
175573
+ const list = names.map(quoteIdent).join(", ");
175574
+ await sql.unsafe(`truncate ${list} restart identity cascade`);
175575
+ }, runBackup = async (options) => {
175576
+ const sql = new SQL(options.url);
175577
+ const chosen = (await listTables(sql)).filter((name) => keepTable(name, options));
175578
+ const dumps = await Promise.all(chosen.map(async (name) => {
175579
+ const rows = await sql.unsafe(`select * from ${quoteIdent(name)}`);
175580
+ return [name, rows];
175581
+ }));
175582
+ await sql.end();
175583
+ const tables = Object.fromEntries(dumps);
175584
+ const payload = {
175585
+ at: new Date().toISOString(),
175586
+ tables,
175587
+ v: BACKUP_FORMAT_VERSION
175588
+ };
175589
+ const dir = options.out ?? join27(process.cwd(), "backups");
175590
+ mkdirSync13(dir, { recursive: true });
175591
+ const json = JSON.stringify(payload, (_, value) => typeof value === "bigint" ? value.toString() : value);
175592
+ const file = join27(dir, `backup-${payload.at.replace(/[:.]/g, "-")}.json`);
175593
+ writeFileSync16(file, json);
175594
+ writeFileSync16(join27(dir, "latest.json"), json);
175595
+ const total = chosen.reduce((sum, name) => sum + (tables[name]?.length ?? 0), 0);
175596
+ console.log(paint(`\u2713 backup \u2192 ${file}`, colors.green));
175597
+ console.log(paint(` ${chosen.length} tables, ${total} rows`, colors.dim));
175598
+ }, runRestore = async (file, options) => {
175599
+ if (!existsSync30(file))
175600
+ throw new Error(`Backup not found: ${file}`);
175601
+ const payload = JSON.parse(readFileSync29(file, "utf-8"));
175602
+ const names = Object.keys(payload.tables).filter((name) => keepTable(name, options));
175603
+ const sql = new SQL(options.url);
175604
+ const order = dependencyOrder(names, await foreignLinks(sql));
175605
+ const metas = await Promise.all(order.map((name) => tableMeta(sql, name)));
175606
+ const metaByName = new Map(metas.map((meta) => [meta.name, meta]));
175607
+ const aborted = options.truncate && !options.yes && prompt(paint(`\u26A0 TRUNCATE ${order.length} tables before restore? type "yes": `, colors.yellow)) !== "yes";
175608
+ if (aborted) {
175609
+ await sql.end();
175610
+ console.log(paint("aborted", colors.yellow));
175611
+ return;
175612
+ }
175613
+ if (options.truncate)
175614
+ await truncateAll(sql, [...order].reverse());
175615
+ await order.reduce(async (prev, name) => {
175616
+ await prev;
175617
+ return restoreTable(sql, metaByName.get(name), payload.tables[name] ?? []);
175618
+ }, Promise.resolve());
175619
+ await sql.end();
175620
+ const total = order.reduce((sum, name) => sum + (payload.tables[name]?.length ?? 0), 0);
175621
+ console.log(paint(`\u2713 restored ${order.length} tables, ${total} rows (idempotent upsert by primary key)`, colors.green));
175622
+ }, runSeed = async (entry) => {
175623
+ const target = entry ?? SEED_CANDIDATES.find((candidate) => existsSync30(join27(process.cwd(), candidate)));
175624
+ if (target === undefined)
175625
+ throw new Error(`No seed script found (looked for ${SEED_CANDIDATES.join(", ")}). Pass a path: absolute db seed <file>.`);
175626
+ console.log(paint(`seeding via ${target}\u2026`, colors.cyan));
175627
+ const proc = spawn2(["bun", "run", target], {
175628
+ stderr: "inherit",
175629
+ stdin: "inherit",
175630
+ stdout: "inherit"
175631
+ });
175632
+ const code = await proc.exited;
175633
+ if (code !== 0)
175634
+ throw new Error(`Seed failed (exit ${code}).`);
175635
+ }, flagValue = (rest, flag) => {
175636
+ const idx = rest.indexOf(flag);
175637
+ return idx === UNFOUND_INDEX ? undefined : rest[idx + 1];
175638
+ }, listValue = (rest, flag) => (flagValue(rest, flag) ?? "").split(",").map((part) => part.trim()).filter((part) => part !== ""), parseOptions = (rest) => ({
175639
+ exclude: listValue(rest, "--exclude"),
175640
+ only: listValue(rest, "--only"),
175641
+ out: flagValue(rest, "--out"),
175642
+ truncate: rest.includes("--truncate"),
175643
+ url: resolveUrl(flagValue(rest, "--url")),
175644
+ yes: rest.includes("--yes") || rest.includes("-y")
175645
+ }), positionalArgs = (rest) => rest.filter((arg, idx) => !arg.startsWith("-") && !VALUE_FLAGS.includes(rest[idx - 1] ?? "")), usage = () => {
175646
+ console.error("Usage: absolute db <backup|restore|seed> [options]");
175647
+ console.error(" backup [--out <dir>] [--only a,b] [--exclude a,b] [--url <url>] Dump tables \u2192 JSON (+ latest.json)");
175648
+ console.error(" restore [file] [--truncate] [--only a,b] [--exclude a,b] [-y] Idempotent upsert by primary key");
175649
+ console.error(" seed [file] Run the project\u2019s seed script");
175650
+ process.exit(1);
175651
+ }, runDb = async (args) => {
175652
+ const [sub, ...rest] = args;
175653
+ if (sub === "backup") {
175654
+ await runBackup(parseOptions(rest));
175655
+ return;
175656
+ }
175657
+ if (sub === "restore") {
175658
+ const file = positionalArgs(rest)[0] ?? join27(process.cwd(), "backups", "latest.json");
175659
+ await runRestore(file, parseOptions(rest));
175660
+ return;
175661
+ }
175662
+ if (sub === "seed") {
175663
+ await runSeed(positionalArgs(rest)[0]);
175664
+ return;
175665
+ }
175666
+ usage();
175667
+ };
175668
+ var init_db = __esm(() => {
175669
+ init_constants();
175670
+ init_tuiPrimitives();
175671
+ URL_ENV_KEYS = ["DATABASE_URL", "POSTGRES_URL", "DATABASE_URL_UNPOOLED"];
175672
+ JSON_DATA_TYPES = ["json", "jsonb"];
175673
+ SEED_CANDIDATES = ["db/seed.ts", "src/db/seed.ts", "seed.ts"];
175674
+ VALUE_FLAGS = ["--out", "--url", "--only", "--exclude"];
175675
+ });
175676
+
175468
175677
  // src/cli/scripts/logs.ts
175469
175678
  var exports_logs = {};
175470
175679
  __export(exports_logs, {
@@ -175472,7 +175681,7 @@ __export(exports_logs, {
175472
175681
  });
175473
175682
  import {
175474
175683
  closeSync as closeSync2,
175475
- existsSync as existsSync30,
175684
+ existsSync as existsSync31,
175476
175685
  openSync as openSync4,
175477
175686
  readSync as readSync2,
175478
175687
  statSync as statSync4,
@@ -175539,7 +175748,7 @@ var DEFAULT_LINES = 40, POLL_MS = 250, LINES_FLAG_SPAN = 2, readFrom = (path, st
175539
175748
  printAvailable(instances);
175540
175749
  return;
175541
175750
  }
175542
- if (match.logFile === null || !existsSync30(match.logFile)) {
175751
+ if (match.logFile === null || !existsSync31(match.logFile)) {
175543
175752
  printDim3(`"${name}" has no captured log (untracked, or started outside the CLI).`);
175544
175753
  return;
175545
175754
  }
@@ -175562,10 +175771,10 @@ var exports_doctor = {};
175562
175771
  __export(exports_doctor, {
175563
175772
  runDoctor: () => runDoctor
175564
175773
  });
175565
- import { existsSync as existsSync31, mkdirSync as mkdirSync13, readFileSync as readFileSync29, writeFileSync as writeFileSync16 } from "fs";
175774
+ import { existsSync as existsSync32, mkdirSync as mkdirSync14, readFileSync as readFileSync30, writeFileSync as writeFileSync17 } from "fs";
175566
175775
  import { createRequire } from "module";
175567
175776
  import { arch as arch4, platform as platform5 } from "os";
175568
- import { join as join27 } from "path";
175777
+ import { join as join28 } from "path";
175569
175778
  var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
175570
175779
  detail,
175571
175780
  label,
@@ -175600,7 +175809,7 @@ var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
175600
175809
  return [];
175601
175810
  const label = `${field.replace("Directory", "")} pages`;
175602
175811
  return [
175603
- existsSync31(join27(process.cwd(), dir)) ? check("ok", label, dir) : check("fail", label, `${dir} (missing)`)
175812
+ existsSync32(join28(process.cwd(), dir)) ? check("ok", label, dir) : check("fail", label, `${dir} (missing)`)
175604
175813
  ];
175605
175814
  }), envCheck = async () => {
175606
175815
  const vars = await collectEnvVars();
@@ -175633,7 +175842,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
175633
175842
  }, gatherChecks = async () => {
175634
175843
  const config = await loadConfigOrNull();
175635
175844
  const configCheck = config === null ? check("fail", "Config", "absolute.config.ts not found or invalid") : check("ok", "Config", "absolute.config.ts loaded");
175636
- const [env4, port] = await Promise.all([
175845
+ const [env5, port] = await Promise.all([
175637
175846
  envCheck(),
175638
175847
  config === null ? check("warn", "Dev port", "skipped (no config)") : portCheck(config)
175639
175848
  ]);
@@ -175643,16 +175852,16 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
175643
175852
  checkNative(),
175644
175853
  configCheck,
175645
175854
  ...config === null ? [] : frameworkChecks(config),
175646
- env4,
175855
+ env5,
175647
175856
  port
175648
175857
  ];
175649
175858
  }, fixFrameworkDirs = (cwd, config) => {
175650
175859
  const fixes = [];
175651
175860
  for (const field of FRAMEWORK_FIELDS2) {
175652
175861
  const dir = readString(config, field);
175653
- if (dir === undefined || existsSync31(join27(cwd, dir)))
175862
+ if (dir === undefined || existsSync32(join28(cwd, dir)))
175654
175863
  continue;
175655
- mkdirSync13(join27(cwd, dir, "pages"), { recursive: true });
175864
+ mkdirSync14(join28(cwd, dir, "pages"), { recursive: true });
175656
175865
  fixes.push(`created ${dir}/pages`);
175657
175866
  }
175658
175867
  return fixes;
@@ -175660,8 +175869,8 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
175660
175869
  const missing = (await collectEnvVars()).filter((entry) => !entry.set);
175661
175870
  if (missing.length === 0)
175662
175871
  return null;
175663
- const envExample = join27(cwd, ".env.example");
175664
- const existing = existsSync31(envExample) ? readFileSync29(envExample, "utf-8") : "";
175872
+ const envExample = join28(cwd, ".env.example");
175873
+ const existing = existsSync32(envExample) ? readFileSync30(envExample, "utf-8") : "";
175665
175874
  const existingKeys = new Set(existing.split(`
175666
175875
  `).map((line) => line.split("=")[0]?.trim()));
175667
175876
  const toAdd = missing.filter((entry) => !existingKeys.has(entry.key));
@@ -175670,7 +175879,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
175670
175879
  const prefix = existing === "" || existing.endsWith(`
175671
175880
  `) ? existing : `${existing}
175672
175881
  `;
175673
- writeFileSync16(envExample, `${prefix}${toAdd.map((entry) => `${entry.key}=`).join(`
175882
+ writeFileSync17(envExample, `${prefix}${toAdd.map((entry) => `${entry.key}=`).join(`
175674
175883
  `)}
175675
175884
  `);
175676
175885
  return `added ${toAdd.length} key(s) to .env.example`;
@@ -175716,7 +175925,7 @@ var init_doctor = __esm(() => {
175716
175925
  "htmlDirectory",
175717
175926
  "htmxDirectory"
175718
175927
  ];
175719
- projectRequire = createRequire(join27(process.cwd(), "package.json"));
175928
+ projectRequire = createRequire(join28(process.cwd(), "package.json"));
175720
175929
  STATUS_MARK = {
175721
175930
  fail: `${colors.red}\u2717${colors.reset}`,
175722
175931
  ok: `${colors.green}\u2713${colors.reset}`,
@@ -176020,10 +176229,10 @@ var init_inspect = __esm(() => {
176020
176229
  });
176021
176230
 
176022
176231
  // src/build/scanEntryPoints.ts
176023
- import { existsSync as existsSync32 } from "fs";
176232
+ import { existsSync as existsSync33 } from "fs";
176024
176233
  var {Glob: Glob4 } = globalThis.Bun;
176025
176234
  var scanEntryPoints = async (dir, pattern) => {
176026
- if (!existsSync32(dir))
176235
+ if (!existsSync33(dir))
176027
176236
  return [];
176028
176237
  const entryPaths = [];
176029
176238
  const glob = new Glob4(pattern);
@@ -176053,10 +176262,10 @@ var islandFrameworks, islandHydrationModes, isIslandFramework = (value) => islan
176053
176262
  framework,
176054
176263
  hydrate: hydrateCandidate && isIslandHydrate(hydrateCandidate) ? hydrateCandidate : undefined
176055
176264
  };
176056
- }, normalizeUsage = (usage) => `${usage.framework}:${usage.component}:${usage.hydrate ?? ""}`, addUsage = (usageMap, usage) => {
176057
- if (!usage)
176265
+ }, normalizeUsage = (usage2) => `${usage2.framework}:${usage2.component}:${usage2.hydrate ?? ""}`, addUsage = (usageMap, usage2) => {
176266
+ if (!usage2)
176058
176267
  return;
176059
- usageMap.set(normalizeUsage(usage), usage);
176268
+ usageMap.set(normalizeUsage(usage2), usage2);
176060
176269
  }, addRenderCallUsage = (usageMap, match) => {
176061
176270
  const [, framework, component, hydrate] = match;
176062
176271
  if (!framework || !component || !isIslandFramework(framework)) {
@@ -176105,7 +176314,7 @@ var init_sourceMetadata = __esm(() => {
176105
176314
  });
176106
176315
 
176107
176316
  // src/islands/pageMetadata.ts
176108
- import { readFileSync as readFileSync30 } from "fs";
176317
+ import { readFileSync as readFileSync31 } from "fs";
176109
176318
  import { dirname as dirname12, resolve as resolve18 } from "path";
176110
176319
  var pagePatterns, getPageDirs = (config) => [
176111
176320
  { dir: config.angularDirectory, framework: "angular" },
@@ -176130,19 +176339,19 @@ var pagePatterns, getPageDirs = (config) => [
176130
176339
  lookup.set(`${definition.framework}:${definition.component}`, resolve18(resolvedSource));
176131
176340
  }
176132
176341
  return lookup;
176133
- }, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
176134
- const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
176342
+ }, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage2) => {
176343
+ const sourcePath = islandSourceLookup.get(`${usage2.framework}:${usage2.component}`);
176135
176344
  return sourcePath ? {
176136
- ...usage,
176345
+ ...usage2,
176137
176346
  source: sourcePath
176138
- } : usage;
176347
+ } : usage2;
176139
176348
  }), loadPageIslandFiles = async (entry, islandSourceLookup, pageMetadata) => {
176140
176349
  const pattern = pagePatterns[entry.framework];
176141
176350
  if (!pattern)
176142
176351
  return;
176143
176352
  const files = await scanEntryPoints(resolve18(entry.dir), pattern);
176144
176353
  for (const filePath of files) {
176145
- const source = readFileSync30(filePath, "utf-8");
176354
+ const source = readFileSync31(filePath, "utf-8");
176146
176355
  const islands = extractIslandUsagesFromSource(source);
176147
176356
  pageMetadata.set(resolve18(filePath), {
176148
176357
  islands: resolveIslandUsages(islands, islandSourceLookup),
@@ -176175,8 +176384,8 @@ var exports_islands = {};
176175
176384
  __export(exports_islands, {
176176
176385
  runIslands: () => runIslands
176177
176386
  });
176178
- import { existsSync as existsSync33, readFileSync as readFileSync31, statSync as statSync5 } from "fs";
176179
- import { join as join28, relative as relative10, resolve as resolve19 } from "path";
176387
+ import { existsSync as existsSync34, readFileSync as readFileSync32, statSync as statSync5 } from "fs";
176388
+ import { join as join29, relative as relative10, resolve as resolve19 } from "path";
176180
176389
  var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
176181
176390
  `), hostFrameworkOf = (pagePath, cwd, config) => {
176182
176391
  const resolved = resolve19(cwd, pagePath);
@@ -176194,13 +176403,13 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
176194
176403
  return 0;
176195
176404
  }
176196
176405
  }, readManifestSizes2 = (manifestDir) => {
176197
- const manifestPath = join28(manifestDir, "manifest.json");
176198
- if (!existsSync33(manifestPath))
176406
+ const manifestPath = join29(manifestDir, "manifest.json");
176407
+ if (!existsSync34(manifestPath))
176199
176408
  return null;
176200
- const manifest = JSON.parse(readFileSync31(manifestPath, "utf-8"));
176409
+ const manifest = JSON.parse(readFileSync32(manifestPath, "utf-8"));
176201
176410
  const sizes = new Map;
176202
176411
  for (const [key, value] of Object.entries(manifest)) {
176203
- sizes.set(key, fileSize3(join28(manifestDir, value.replace(/^\//, ""))));
176412
+ sizes.set(key, fileSize3(join29(manifestDir, value.replace(/^\//, ""))));
176204
176413
  }
176205
176414
  return sizes;
176206
176415
  }, collectIslands = async (cwd, config, sizes) => {
@@ -176211,13 +176420,13 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
176211
176420
  const pageMetadata = await loadPageIslandMetadata(config);
176212
176421
  const usages = [...pageMetadata.values()].flatMap((meta) => meta.islands.map((island) => ({ ...island, page: meta.pagePath })));
176213
176422
  return buildInfo.definitions.map((definition) => {
176214
- const mounts = usages.filter((usage) => usage.framework === definition.framework && usage.component === definition.component).map((usage) => {
176215
- const hostFramework = hostFrameworkOf(usage.page, cwd, config);
176423
+ const mounts = usages.filter((usage2) => usage2.framework === definition.framework && usage2.component === definition.component).map((usage2) => {
176424
+ const hostFramework = hostFrameworkOf(usage2.page, cwd, config);
176216
176425
  return {
176217
176426
  crossFramework: hostFramework !== null && hostFramework !== definition.framework,
176218
176427
  hostFramework,
176219
- hydrate: usage.hydrate ?? "load",
176220
- page: relative10(cwd, resolve19(cwd, usage.page))
176428
+ hydrate: usage2.hydrate ?? "load",
176429
+ page: relative10(cwd, resolve19(cwd, usage2.page))
176221
176430
  };
176222
176431
  });
176223
176432
  const key = getIslandManifestKey(definition.framework, definition.component);
@@ -176335,8 +176544,8 @@ var init_islands2 = __esm(() => {
176335
176544
  });
176336
176545
 
176337
176546
  // src/build/externalAssetPlugin.ts
176338
- import { copyFileSync as copyFileSync2, existsSync as existsSync34, mkdirSync as mkdirSync14, statSync as statSync6 } from "fs";
176339
- import { basename as basename6, dirname as dirname13, join as join29, resolve as resolve20 } from "path";
176547
+ import { copyFileSync as copyFileSync2, existsSync as existsSync35, mkdirSync as mkdirSync15, statSync as statSync6 } from "fs";
176548
+ import { basename as basename6, dirname as dirname13, join as join30, resolve as resolve20 } from "path";
176340
176549
  var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
176341
176550
  name: "absolute-external-asset",
176342
176551
  setup(bld) {
@@ -176357,14 +176566,14 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
176357
176566
  if (!relPath)
176358
176567
  continue;
176359
176568
  const assetPath = resolve20(sourceDir, relPath);
176360
- if (!existsSync34(assetPath))
176569
+ if (!existsSync35(assetPath))
176361
176570
  continue;
176362
176571
  if (!statSync6(assetPath).isFile())
176363
176572
  continue;
176364
- const targetPath = join29(outDir, basename6(assetPath));
176365
- if (existsSync34(targetPath))
176573
+ const targetPath = join30(outDir, basename6(assetPath));
176574
+ if (existsSync35(targetPath))
176366
176575
  continue;
176367
- mkdirSync14(dirname13(targetPath), { recursive: true });
176576
+ mkdirSync15(dirname13(targetPath), { recursive: true });
176368
176577
  copyFileSync2(assetPath, targetPath);
176369
176578
  }
176370
176579
  return;
@@ -176379,19 +176588,19 @@ __export(exports_compile, {
176379
176588
  shouldEmbedCompiledAsset: () => shouldEmbedCompiledAsset,
176380
176589
  compile: () => compile
176381
176590
  });
176382
- var {env: env4 } = globalThis.Bun;
176591
+ var {env: env5 } = globalThis.Bun;
176383
176592
  import {
176384
176593
  cpSync,
176385
- existsSync as existsSync35,
176386
- mkdirSync as mkdirSync15,
176594
+ existsSync as existsSync36,
176595
+ mkdirSync as mkdirSync16,
176387
176596
  readdirSync as readdirSync7,
176388
- readFileSync as readFileSync32,
176597
+ readFileSync as readFileSync33,
176389
176598
  rmSync as rmSync5,
176390
176599
  statSync as statSync7,
176391
176600
  unlinkSync as unlinkSync4,
176392
- writeFileSync as writeFileSync17
176601
+ writeFileSync as writeFileSync18
176393
176602
  } from "fs";
176394
- import { basename as basename7, dirname as dirname14, join as join30, relative as relative11, resolve as resolve21 } from "path";
176603
+ import { basename as basename7, dirname as dirname14, join as join31, relative as relative11, resolve as resolve21 } from "path";
176395
176604
  var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
176396
176605
  const resolvedVersion = version2 || "unknown";
176397
176606
  console.log("");
@@ -176404,7 +176613,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176404
176613
  const entry = pending.pop();
176405
176614
  if (!entry)
176406
176615
  continue;
176407
- const fullPath = join30(entry.parentPath, entry.name);
176616
+ const fullPath = join31(entry.parentPath, entry.name);
176408
176617
  if (entry.isDirectory())
176409
176618
  pending = pending.concat(readdirSync7(fullPath, { withFileTypes: true }));
176410
176619
  else
@@ -176424,7 +176633,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176424
176633
  const entry = pending.pop();
176425
176634
  if (!entry)
176426
176635
  continue;
176427
- const fullPath = join30(entry.parentPath, entry.name);
176636
+ const fullPath = join31(entry.parentPath, entry.name);
176428
176637
  if (entry.isDirectory()) {
176429
176638
  if (SERVER_RUNTIME_SCAN_SKIP_DIRS.has(entry.name))
176430
176639
  continue;
@@ -176439,7 +176648,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176439
176648
  const normalizedOutdir = resolve21(outdir);
176440
176649
  const copyReference = (filePath, relPath) => {
176441
176650
  const assetSource = resolve21(dirname14(filePath), relPath);
176442
- if (!existsSync35(assetSource) || !statSync7(assetSource).isFile())
176651
+ if (!existsSync36(assetSource) || !statSync7(assetSource).isFile())
176443
176652
  return;
176444
176653
  const assetTarget = resolve21(normalizedOutdir, relPath.replace(/^\.\//, ""));
176445
176654
  if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
@@ -176447,11 +176656,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176447
176656
  if (copied.has(assetTarget))
176448
176657
  return;
176449
176658
  copied.add(assetTarget);
176450
- mkdirSync15(dirname14(assetTarget), { recursive: true });
176659
+ mkdirSync16(dirname14(assetTarget), { recursive: true });
176451
176660
  cpSync(assetSource, assetTarget, { force: true });
176452
176661
  };
176453
176662
  for (const filePath of collectProjectSourceFiles(process.cwd())) {
176454
- const source = readFileSync32(filePath, "utf-8");
176663
+ const source = readFileSync33(filePath, "utf-8");
176455
176664
  SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
176456
176665
  let match;
176457
176666
  while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
@@ -176480,7 +176689,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176480
176689
  }
176481
176690
  }, readPackageVersion4 = (candidate) => {
176482
176691
  try {
176483
- const pkg = JSON.parse(readFileSync32(candidate, "utf-8"));
176692
+ const pkg = JSON.parse(readFileSync33(candidate, "utf-8"));
176484
176693
  if (pkg.name !== "@absolutejs/absolute")
176485
176694
  return null;
176486
176695
  const ver = pkg.version;
@@ -176523,7 +176732,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176523
176732
  resolve21(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
176524
176733
  ];
176525
176734
  for (const candidate of candidates) {
176526
- if (existsSync35(candidate))
176735
+ if (existsSync36(candidate))
176527
176736
  return candidate;
176528
176737
  }
176529
176738
  return resolve21(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
@@ -176539,7 +176748,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176539
176748
  return true;
176540
176749
  }, tryReadNodePackageJson = (packageDir) => {
176541
176750
  try {
176542
- return JSON.parse(readFileSync32(join30(packageDir, "package.json"), "utf-8"));
176751
+ return JSON.parse(readFileSync33(join31(packageDir, "package.json"), "utf-8"));
176543
176752
  } catch {
176544
176753
  return null;
176545
176754
  }
@@ -176551,7 +176760,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176551
176760
  if (!pkg)
176552
176761
  return;
176553
176762
  seen.add(specifier);
176554
- const destDir = join30(outdir, "node_modules", ...specifier.split("/"));
176763
+ const destDir = join31(outdir, "node_modules", ...specifier.split("/"));
176555
176764
  rmSync5(destDir, { force: true, recursive: true });
176556
176765
  cpSync(srcDir, destDir, {
176557
176766
  force: true,
@@ -176574,7 +176783,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176574
176783
  if (!buildConfig.angularDirectory)
176575
176784
  return;
176576
176785
  const angularScopeDir = resolve21(process.cwd(), "node_modules", "@angular");
176577
- const angularPackages = existsSync35(angularScopeDir) ? readdirSync7(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
176786
+ const angularPackages = existsSync36(angularScopeDir) ? readdirSync7(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
176578
176787
  const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
176579
176788
  const seen = new Set;
176580
176789
  for (const specifier of roots) {
@@ -176592,15 +176801,15 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176592
176801
  copyAngularRuntimePackages(buildConfig, outdir);
176593
176802
  copyChunkReferencedPackages(outdir, seen);
176594
176803
  }, collectRuntimePackageSpecifiers = (distDir) => {
176595
- const nodeModulesDir = join30(distDir, "node_modules");
176596
- if (!existsSync35(nodeModulesDir))
176804
+ const nodeModulesDir = join31(distDir, "node_modules");
176805
+ if (!existsSync36(nodeModulesDir))
176597
176806
  return [];
176598
176807
  const specifiers = [];
176599
176808
  for (const entry of readdirSync7(nodeModulesDir, { withFileTypes: true })) {
176600
176809
  if (!entry.isDirectory())
176601
176810
  continue;
176602
176811
  if (entry.name.startsWith("@")) {
176603
- const scopeDir = join30(nodeModulesDir, entry.name);
176812
+ const scopeDir = join31(nodeModulesDir, entry.name);
176604
176813
  for (const scopedEntry of readdirSync7(scopeDir, {
176605
176814
  withFileTypes: true
176606
176815
  })) {
@@ -176632,18 +176841,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176632
176841
  const packageSpecifier = packageSpecifiers.find((root) => specifier === root || specifier.startsWith(`${root}/`));
176633
176842
  if (!packageSpecifier)
176634
176843
  return null;
176635
- const packageDir = join30(distDir, "node_modules", ...packageSpecifier.split("/"));
176844
+ const packageDir = join31(distDir, "node_modules", ...packageSpecifier.split("/"));
176636
176845
  const subpath = specifier.slice(packageSpecifier.length);
176637
- const subPackageDir = subpath ? join30(packageDir, ...subpath.slice(1).split("/")) : null;
176638
- const resolvedPackageDir = subPackageDir && existsSync35(join30(subPackageDir, "package.json")) ? subPackageDir : packageDir;
176639
- const packageJsonPath = join30(resolvedPackageDir, "package.json");
176640
- if (!existsSync35(packageJsonPath))
176846
+ const subPackageDir = subpath ? join31(packageDir, ...subpath.slice(1).split("/")) : null;
176847
+ const resolvedPackageDir = subPackageDir && existsSync36(join31(subPackageDir, "package.json")) ? subPackageDir : packageDir;
176848
+ const packageJsonPath = join31(resolvedPackageDir, "package.json");
176849
+ if (!existsSync36(packageJsonPath))
176641
176850
  return null;
176642
- const pkg = JSON.parse(readFileSync32(packageJsonPath, "utf-8"));
176851
+ const pkg = JSON.parse(readFileSync33(packageJsonPath, "utf-8"));
176643
176852
  const exportKey = resolvedPackageDir !== subPackageDir && subpath ? `.${subpath}` : ".";
176644
176853
  const rootExport = pkg.exports?.[exportKey];
176645
176854
  const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
176646
- return join30(resolvedPackageDir, entry);
176855
+ return join31(resolvedPackageDir, entry);
176647
176856
  }, 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) => {
176648
176857
  try {
176649
176858
  return statSync7(filePath).isFile();
@@ -176656,13 +176865,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176656
176865
  const candidates = [
176657
176866
  candidate,
176658
176867
  ...RUNTIME_JS_EXTENSIONS.map((extension) => `${candidate}${extension}`),
176659
- ...RUNTIME_JS_EXTENSIONS.map((extension) => join30(candidate, `index${extension}`))
176868
+ ...RUNTIME_JS_EXTENSIONS.map((extension) => join31(candidate, `index${extension}`))
176660
176869
  ];
176661
176870
  return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
176662
176871
  }, findContainingRuntimePackageDir = (filePath) => {
176663
176872
  let dir = dirname14(filePath);
176664
176873
  while (dir !== dirname14(dir)) {
176665
- if (isNodeModulesPath(dir) && existsSync35(join30(dir, "package.json"))) {
176874
+ if (isNodeModulesPath(dir) && existsSync36(join31(dir, "package.json"))) {
176666
176875
  return dir;
176667
176876
  }
176668
176877
  dir = dirname14(dir);
@@ -176678,13 +176887,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176678
176887
  const entry = pickExportEntry(pkg?.imports?.[specifier]);
176679
176888
  if (!entry)
176680
176889
  return null;
176681
- return join30(packageDir, entry);
176890
+ return join31(packageDir, entry);
176682
176891
  }, collectRuntimeRewriteRoots = (distDir) => collectFiles2(distDir).filter((filePath) => isRuntimeJsFile(filePath) && !isNodeModulesPath(filePath)), toTopLevelPackage = (specifier) => specifier.split("/").slice(0, specifier.startsWith("@") ? 2 : 1).join("/"), FRAMEWORK_PACKAGE_NAME = "@absolutejs/absolute", copyChunkReferencedPackages = (distDir, seen) => {
176683
176892
  const distRoot = resolve21(distDir);
176684
176893
  for (const filePath of collectRuntimeRewriteRoots(distDir)) {
176685
176894
  if (resolve21(dirname14(filePath)) === distRoot)
176686
176895
  continue;
176687
- const source = readFileSync32(filePath, "utf-8");
176896
+ const source = readFileSync33(filePath, "utf-8");
176688
176897
  for (const match of source.matchAll(MODULE_SPECIFIER_RE)) {
176689
176898
  const specifier = match[3];
176690
176899
  if (!specifier || specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("#") || specifier.startsWith("node:") || specifier.startsWith("bun:")) {
@@ -176714,7 +176923,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176714
176923
  if (!filePath || seen.has(filePath))
176715
176924
  continue;
176716
176925
  seen.add(filePath);
176717
- const source = readFileSync32(filePath, "utf-8");
176926
+ const source = readFileSync33(filePath, "utf-8");
176718
176927
  const rewritten = source.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
176719
176928
  if (typeof specifier === "string" && specifier.startsWith(".")) {
176720
176929
  enqueue(resolveRuntimeJsFile(resolve21(dirname14(filePath), specifier)));
@@ -176732,7 +176941,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176732
176941
  return `${prefix}${quote}${ensureRelativeModuleSpecifier(filePath, target)}${quote}`;
176733
176942
  });
176734
176943
  if (rewritten !== source) {
176735
- writeFileSync17(filePath, rewritten);
176944
+ writeFileSync18(filePath, rewritten);
176736
176945
  }
176737
176946
  }
176738
176947
  }, generateEntrypoint = (distDir, serverEntry, prerenderMap, version2, buildConfig) => {
@@ -177186,7 +177395,7 @@ console.log(\`
177186
177395
  const resolvedOutdir = resolve21(outdir ?? "dist");
177187
177396
  await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
177188
177397
  }, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
177189
- const prerenderPort = Number(env4.COMPILE_PORT) || Number(env4.PORT) || DEFAULT_PORT + 1;
177398
+ const prerenderPort = Number(env5.COMPILE_PORT) || Number(env5.PORT) || DEFAULT_PORT + 1;
177190
177399
  killStaleProcesses(prerenderPort);
177191
177400
  const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
177192
177401
  const resolvedOutfile = resolve21(outfile ?? "compiled-server");
@@ -177251,11 +177460,11 @@ console.log(\`
177251
177460
  process.exit(1);
177252
177461
  }
177253
177462
  const outputPath = resolve21(resolvedOutdir, `${entryName}.js`);
177254
- if (!existsSync35(outputPath)) {
177463
+ if (!existsSync36(outputPath)) {
177255
177464
  console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
177256
177465
  process.exit(1);
177257
177466
  }
177258
- if (existsSync35(resolve21(resolvedOutdir, "angular", "vendor", "server"))) {
177467
+ if (existsSync36(resolve21(resolvedOutdir, "angular", "vendor", "server"))) {
177259
177468
  const vendorDir = resolve21(resolvedOutdir, "angular", "vendor", "server");
177260
177469
  const vendorEntries = readdirSync7(vendorDir).filter((f) => f.endsWith(".js"));
177261
177470
  const angularServerVendorPaths = {};
@@ -177277,7 +177486,7 @@ console.log(\`
177277
177486
  copyServerRuntimeAssetReferences(resolvedOutdir);
177278
177487
  const prerenderStart = performance.now();
177279
177488
  process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
177280
- rmSync5(join30(resolvedOutdir, "_prerendered"), {
177489
+ rmSync5(join31(resolvedOutdir, "_prerendered"), {
177281
177490
  force: true,
177282
177491
  recursive: true
177283
177492
  });
@@ -177296,9 +177505,9 @@ console.log(\`
177296
177505
  const compileStart = performance.now();
177297
177506
  process.stdout.write(cliTag4("\x1B[36m", "Compiling standalone executable"));
177298
177507
  const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
177299
- const entrypointPath = join30(resolvedOutdir, "_compile_entrypoint.ts");
177508
+ const entrypointPath = join31(resolvedOutdir, "_compile_entrypoint.ts");
177300
177509
  await Bun.write(entrypointPath, entrypointCode);
177301
- mkdirSync15(dirname14(resolvedOutfile), { recursive: true });
177510
+ mkdirSync16(dirname14(resolvedOutfile), { recursive: true });
177302
177511
  const result = await Bun.build({
177303
177512
  compile: { outfile: resolvedOutfile },
177304
177513
  define: { "process.env.NODE_ENV": '"production"' },
@@ -177392,11 +177601,11 @@ var exports_typecheck = {};
177392
177601
  __export(exports_typecheck, {
177393
177602
  typecheck: () => typecheck
177394
177603
  });
177395
- import { resolve as resolve22, join as join31 } from "path";
177396
- import { existsSync as existsSync36, readFileSync as readFileSync33 } from "fs";
177604
+ import { resolve as resolve22, join as join32 } from "path";
177605
+ import { existsSync as existsSync37, readFileSync as readFileSync34 } from "fs";
177397
177606
  import { mkdir as mkdir2, writeFile } from "fs/promises";
177398
177607
  var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve22(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
177399
- if (!existsSync36(resolveConfigPath(configPath2))) {
177608
+ if (!existsSync37(resolveConfigPath(configPath2))) {
177400
177609
  return [{}];
177401
177610
  }
177402
177611
  const rawConfig = await loadRawConfig(configPath2);
@@ -177417,7 +177626,7 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
177417
177626
  return { exitCode, name, output: (stdout + stderr).trim() };
177418
177627
  }, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
177419
177628
  const local = resolve22("node_modules", ".bin", name);
177420
- return existsSync36(local) ? local : null;
177629
+ return existsSync37(local) ? local : null;
177421
177630
  }, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
177422
177631
  const cwd = `${process.cwd()}/`;
177423
177632
  const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
@@ -177469,10 +177678,10 @@ Found ${errorCount} error${suffix}.`;
177469
177678
  resolve22(import.meta.dir, "../../types", fileName),
177470
177679
  resolve22(import.meta.dir, "../../../types", fileName)
177471
177680
  ];
177472
- return candidates.find((candidate) => existsSync36(candidate)) ?? candidates[0];
177681
+ return candidates.find((candidate) => existsSync37(candidate)) ?? candidates[0];
177473
177682
  }, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
177474
177683
  try {
177475
- return JSON.parse(readFileSync33(resolve22("tsconfig.json"), "utf-8"));
177684
+ return JSON.parse(readFileSync34(resolve22("tsconfig.json"), "utf-8"));
177476
177685
  } catch {
177477
177686
  return {};
177478
177687
  }
@@ -177500,7 +177709,7 @@ Found ${errorCount} error${suffix}.`;
177500
177709
  console.error("\x1B[31m\u2717\x1B[0m vue-tsc is required for Vue type checking. Install it: bun add -d vue-tsc");
177501
177710
  process.exit(1);
177502
177711
  }
177503
- const vueTsconfigPath = join31(cacheDir, "tsconfig.vue-check.json");
177712
+ const vueTsconfigPath = join32(cacheDir, "tsconfig.vue-check.json");
177504
177713
  return writeFile(vueTsconfigPath, JSON.stringify({
177505
177714
  compilerOptions: {
177506
177715
  rootDir: ".."
@@ -177515,7 +177724,7 @@ Found ${errorCount} error${suffix}.`;
177515
177724
  resolve22(vueTsconfigPath),
177516
177725
  "--incremental",
177517
177726
  "--tsBuildInfoFile",
177518
- join31(cacheDir, "vue-tsc.tsbuildinfo"),
177727
+ join32(cacheDir, "vue-tsc.tsbuildinfo"),
177519
177728
  "--pretty"
177520
177729
  ]));
177521
177730
  }, buildAngularCheck = async (cacheDir, angularDir) => {
@@ -177524,7 +177733,7 @@ Found ${errorCount} error${suffix}.`;
177524
177733
  console.error("\x1B[31m\u2717\x1B[0m @angular/compiler-cli is required for Angular type checking. Install it: bun add -d @angular/compiler-cli");
177525
177734
  process.exit(1);
177526
177735
  }
177527
- const angularTsconfigPath = join31(cacheDir, "tsconfig.angular-check.json");
177736
+ const angularTsconfigPath = join32(cacheDir, "tsconfig.angular-check.json");
177528
177737
  await writeFile(angularTsconfigPath, JSON.stringify({
177529
177738
  angularCompilerOptions: {
177530
177739
  strictTemplates: true
@@ -177544,7 +177753,7 @@ Found ${errorCount} error${suffix}.`;
177544
177753
  console.error("\x1B[31m\u2717\x1B[0m typescript is required for type checking. Install it: bun add -d typescript");
177545
177754
  process.exit(1);
177546
177755
  }
177547
- const tscConfigPath = join31(cacheDir, "tsconfig.typecheck.json");
177756
+ const tscConfigPath = join32(cacheDir, "tsconfig.typecheck.json");
177548
177757
  return writeFile(tscConfigPath, JSON.stringify({
177549
177758
  compilerOptions: {
177550
177759
  rootDir: ".."
@@ -177559,7 +177768,7 @@ Found ${errorCount} error${suffix}.`;
177559
177768
  resolve22(tscConfigPath),
177560
177769
  "--incremental",
177561
177770
  "--tsBuildInfoFile",
177562
- join31(cacheDir, "tsc.tsbuildinfo"),
177771
+ join32(cacheDir, "tsc.tsbuildinfo"),
177563
177772
  "--pretty"
177564
177773
  ]));
177565
177774
  }, buildSvelteCheck = async (cacheDir, svelteDir) => {
@@ -177568,7 +177777,7 @@ Found ${errorCount} error${suffix}.`;
177568
177777
  console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
177569
177778
  process.exit(1);
177570
177779
  }
177571
- const svelteTsconfigPath = join31(cacheDir, "tsconfig.svelte-check.json");
177780
+ const svelteTsconfigPath = join32(cacheDir, "tsconfig.svelte-check.json");
177572
177781
  await writeFile(svelteTsconfigPath, JSON.stringify({
177573
177782
  extends: resolve22("tsconfig.json"),
177574
177783
  files: ABSOLUTE_TYPECHECK_FILES,
@@ -181226,15 +181435,15 @@ var stripNamedArgs = (...flags) => args.filter((_, idx) => flags.every((flag) =>
181226
181435
  if (command === "dev") {
181227
181436
  sendTelemetryEvent("cli:command", { command });
181228
181437
  const configPath2 = parseNamedArg("--config");
181229
- const positionalArgs = stripNamedArgs("--config");
181230
- const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
181438
+ const positionalArgs2 = stripNamedArgs("--config");
181439
+ const serverEntry = positionalArgs2[0] ?? DEFAULT_SERVER_ENTRY;
181231
181440
  await dev(serverEntry, configPath2);
181232
181441
  } else if (command === "start") {
181233
181442
  sendTelemetryEvent("cli:command", { command });
181234
181443
  const outdir = parseNamedArg("--outdir");
181235
181444
  const configPath2 = parseNamedArg("--config");
181236
- const positionalArgs = stripNamedArgs("--outdir", "--config");
181237
- const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
181445
+ const positionalArgs2 = stripNamedArgs("--outdir", "--config");
181446
+ const serverEntry = positionalArgs2[0] ?? DEFAULT_SERVER_ENTRY;
181238
181447
  await start(serverEntry, outdir, configPath2);
181239
181448
  } else if (command === "build") {
181240
181449
  sendTelemetryEvent("cli:command", { command });
@@ -181302,6 +181511,12 @@ if (command === "dev") {
181302
181511
  sendTelemetryEvent("cli:command", { command: "env" });
181303
181512
  const { runEnv: runEnv2 } = await Promise.resolve().then(() => (init_env(), exports_env));
181304
181513
  await runEnv2(args);
181514
+ } else if (command === "db") {
181515
+ sendTelemetryEvent("cli:command", {
181516
+ command: `db:${workspaceCommand ?? "unknown"}`
181517
+ });
181518
+ const { runDb: runDb2 } = await Promise.resolve().then(() => (init_db(), exports_db));
181519
+ await runDb2(args);
181305
181520
  } else if (command === "logs") {
181306
181521
  sendTelemetryEvent("cli:command", { command: "logs" });
181307
181522
  const { runLogs: runLogs2 } = await Promise.resolve().then(() => (init_logs(), exports_logs));
@@ -181333,8 +181548,8 @@ if (command === "dev") {
181333
181548
  const outdir = parseNamedArg("--outdir");
181334
181549
  const outfile = parseNamedArg("--outfile");
181335
181550
  const configPath2 = parseNamedArg("--config");
181336
- const positionalArgs = stripNamedArgs("--outdir", "--outfile", "--config");
181337
- const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
181551
+ const positionalArgs2 = stripNamedArgs("--outdir", "--outfile", "--config");
181552
+ const serverEntry = positionalArgs2[0] ?? DEFAULT_SERVER_ENTRY;
181338
181553
  const { compile: compile2 } = await Promise.resolve().then(() => (init_compile(), exports_compile));
181339
181554
  await compile2(serverEntry, outdir, outfile, configPath2);
181340
181555
  } else if (command === "typecheck") {
@@ -181361,6 +181576,7 @@ if (command === "dev") {
181361
181576
  console.error(" start [entry] [--outdir dir] Start production server");
181362
181577
  console.error(" compile [entry] [--outdir dir] [--outfile path] Compile standalone executable");
181363
181578
  console.error(" config [--port n] Open the unified config UI (ESLint, tsconfig, Prettier)");
181579
+ console.error(" db <backup|restore|seed> Backup/restore any Postgres DB (ORM-agnostic, upsert by PK) or run the seed script");
181364
181580
  console.error(" doctor [--fix] [--json] Diagnose the project (bun, config, framework dirs, env, port)");
181365
181581
  console.error(" env [--check] [--json] Report env vars the app reads (getEnv) and which are missing");
181366
181582
  console.error(" add <framework> [--no-install] Add a framework (deps, config, starter page)");
@@ -0,0 +1,20 @@
1
+ type ColumnMeta = {
2
+ isJson: boolean;
3
+ name: string;
4
+ };
5
+ type TableMeta = {
6
+ columns: ColumnMeta[];
7
+ name: string;
8
+ primaryKey: string[];
9
+ };
10
+ type ForeignLink = {
11
+ from: string;
12
+ to: string;
13
+ };
14
+ export declare const chunkRows: <Item>(items: Item[], size: number) => Item[][];
15
+ export declare const quoteIdent: (name: string) => string;
16
+ export declare const conflictClause: (meta: TableMeta) => string;
17
+ export declare const dependencyOrder: (names: string[], links: ForeignLink[]) => string[];
18
+ export declare const encodeValue: (col: ColumnMeta, value: unknown) => {} | null;
19
+ export declare const runDb: (args: string[]) => Promise<void>;
20
+ export {};
package/package.json CHANGED
@@ -359,6 +359,7 @@
359
359
  "bd": "bun run scripts/build.ts && bun",
360
360
  "build": "bun run scripts/build.ts",
361
361
  "build:native": "./native/build.sh",
362
+ "config": "bun run src/cli/index.ts config",
362
363
  "config:studio": "bun run src/cli/index.ts config --config example/absolute.config.ts",
363
364
  "db:push": "drizzle-kit push",
364
365
  "db:studio": "drizzle-kit studio",
@@ -413,7 +414,7 @@
413
414
  ]
414
415
  }
415
416
  },
416
- "version": "0.19.0-beta.1051",
417
+ "version": "0.19.0-beta.1052",
417
418
  "workspaces": [
418
419
  "tests/fixtures/*",
419
420
  "tests/fixtures/_packages/*"