@absolutejs/absolute 0.17.10 → 0.17.11

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
@@ -5,8 +5,8 @@ var __require = import.meta.require;
5
5
  // src/cli/scripts/dev.ts
6
6
  var {$: $2 } = globalThis.Bun;
7
7
  var {env } = globalThis.Bun;
8
- import { existsSync as existsSync3 } from "fs";
9
- import { resolve as resolve4 } from "path";
8
+ import { existsSync as existsSync4 } from "fs";
9
+ import { resolve as resolve3 } from "path";
10
10
 
11
11
  // src/constants.ts
12
12
  var SECONDS_IN_A_MINUTE = 60;
@@ -289,9 +289,9 @@ var createInteractiveHandler = (actions) => {
289
289
  };
290
290
 
291
291
  // src/cli/telemetryEvent.ts
292
- import { readFileSync as readFileSync2 } from "fs";
292
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
293
293
  import { arch, platform } from "os";
294
- import { resolve } from "path";
294
+ import { dirname, join as join2, parse } from "path";
295
295
 
296
296
  // src/cli/scripts/telemetry.ts
297
297
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -367,9 +367,18 @@ var telemetry = (args) => {
367
367
  // src/cli/telemetryEvent.ts
368
368
  var getVersion = () => {
369
369
  try {
370
- const pkgPath = resolve(import.meta.dir, "../../package.json");
371
- const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
372
- return pkg.version;
370
+ let dir = import.meta.dir;
371
+ while (dir !== parse(dir).root) {
372
+ const candidate = join2(dir, "package.json");
373
+ if (existsSync2(candidate)) {
374
+ const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
375
+ if (pkg.name === "@absolutejs/absolute") {
376
+ return pkg.version;
377
+ }
378
+ }
379
+ dir = dirname(dir);
380
+ }
381
+ return "unknown";
373
382
  } catch {
374
383
  return "unknown";
375
384
  }
@@ -400,9 +409,9 @@ var sendTelemetryEvent = (event, payload) => {
400
409
  };
401
410
 
402
411
  // src/utils/loadConfig.ts
403
- import { resolve as resolve2 } from "path";
412
+ import { resolve } from "path";
404
413
  var loadConfig = async (configPath2) => {
405
- const resolved = resolve2(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
414
+ const resolved = resolve(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
406
415
  const mod = await import(resolved);
407
416
  const config = mod.default ?? mod.config;
408
417
  if (!config) {
@@ -415,8 +424,8 @@ Expected: export default defineConfig({ ... })`);
415
424
  // src/cli/utils.ts
416
425
  var {$ } = globalThis.Bun;
417
426
  import { execSync } from "child_process";
418
- import { existsSync as existsSync2, readFileSync as readFileSync3 } from "fs";
419
- import { resolve as resolve3 } from "path";
427
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
428
+ import { resolve as resolve2 } from "path";
420
429
  var isWSLEnvironment = () => {
421
430
  try {
422
431
  const release = readFileSync3("/proc/version", "utf-8");
@@ -428,8 +437,8 @@ var isWSLEnvironment = () => {
428
437
  var COMPOSE_PATH = "db/docker-compose.db.yml";
429
438
  var DEFAULT_SERVER_ENTRY = "src/backend/server.ts";
430
439
  var readDbScripts = async () => {
431
- const pkgPath = resolve3("package.json");
432
- if (!existsSync2(pkgPath))
440
+ const pkgPath = resolve2("package.json");
441
+ if (!existsSync3(pkgPath))
433
442
  return null;
434
443
  const pkg = await Bun.file(pkgPath).json();
435
444
  const upCommand = pkg.scripts?.["db:up"];
@@ -497,7 +506,7 @@ var cliTag = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cl
497
506
  var dev = async (serverEntry, configPath2) => {
498
507
  const port = Number(env.PORT) || DEFAULT_PORT;
499
508
  killStaleProcesses(port);
500
- const usesDocker = existsSync3(resolve4(COMPOSE_PATH));
509
+ const usesDocker = existsSync4(resolve3(COMPOSE_PATH));
501
510
  const scripts = usesDocker ? await readDbScripts() : null;
502
511
  if (scripts)
503
512
  await startDatabase(scripts);
@@ -678,7 +687,7 @@ var dev = async (serverEntry, configPath2) => {
678
687
 
679
688
  // src/cli/cache.ts
680
689
  import { mkdir } from "fs/promises";
681
- import { join as join2 } from "path";
690
+ import { join as join3 } from "path";
682
691
  var {Glob } = globalThis.Bun;
683
692
  var CACHE_DIR = ".absolutejs";
684
693
  var MAX_FILES_PER_BATCH = 200;
@@ -702,7 +711,7 @@ var hashConfigs = async (configFiles) => {
702
711
  };
703
712
  var loadCache = async (tool) => {
704
713
  try {
705
- const path = join2(CACHE_DIR, `${tool}.cache.json`);
714
+ const path = join3(CACHE_DIR, `${tool}.cache.json`);
706
715
  const data = await Bun.file(path).json();
707
716
  return data;
708
717
  } catch {
@@ -711,7 +720,7 @@ var loadCache = async (tool) => {
711
720
  };
712
721
  var saveCache = async (tool, data) => {
713
722
  await mkdir(CACHE_DIR, { recursive: true });
714
- const path = join2(CACHE_DIR, `${tool}.cache.json`);
723
+ const path = join3(CACHE_DIR, `${tool}.cache.json`);
715
724
  await Bun.write(path, JSON.stringify(data, null, "\t"));
716
725
  };
717
726
  var getChangedFiles = async (adapter) => {
@@ -806,9 +815,9 @@ var eslint = async (args) => {
806
815
 
807
816
  // src/cli/scripts/info.ts
808
817
  import { execSync as execSync2 } from "child_process";
809
- import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
818
+ import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
810
819
  import { arch as arch2, cpus, platform as platform2, totalmem, version } from "os";
811
- import { resolve as resolve5 } from "path";
820
+ import { resolve as resolve4 } from "path";
812
821
  var __dirname = "/home/alexkahn/abs/absolutejs/src/cli/scripts";
813
822
  var bold = (str) => `\x1B[1m${str}\x1B[0m`;
814
823
  var getBinaryVersion = (binary, flag = "--version") => {
@@ -837,7 +846,7 @@ var getPackageVersion = (packageName) => {
837
846
  };
838
847
  var getAbsoluteVersion = () => {
839
848
  try {
840
- const pkgPath = resolve5(__dirname, "../../../package.json");
849
+ const pkgPath = resolve4(__dirname, "../../../package.json");
841
850
  const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
842
851
  return pkg.version;
843
852
  } catch {
@@ -872,7 +881,7 @@ var detectCI = () => {
872
881
  };
873
882
  var isDockerEnvironment = () => {
874
883
  try {
875
- return existsSync4("/.dockerenv");
884
+ return existsSync5("/.dockerenv");
876
885
  } catch {
877
886
  return false;
878
887
  }
@@ -970,18 +979,18 @@ var prettier = async (args) => {
970
979
 
971
980
  // src/cli/scripts/start.ts
972
981
  var {env: env2 } = globalThis.Bun;
973
- import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
974
- import { basename, resolve as resolve6 } from "path";
982
+ import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
983
+ import { basename, resolve as resolve5 } from "path";
975
984
  var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`;
976
985
  var start = async (serverEntry, outdir, configPath2) => {
977
986
  const port = Number(env2.PORT) || DEFAULT_PORT;
978
987
  killStaleProcesses(port);
979
988
  const entryName = basename(serverEntry).replace(/\.[^.]+$/, "");
980
- const resolvedOutdir = resolve6(outdir ?? "dist");
989
+ const resolvedOutdir = resolve5(outdir ?? "dist");
981
990
  let absoluteVersion = "";
982
991
  const versionCandidates = [
983
- resolve6(import.meta.dir, "..", "..", "..", "package.json"),
984
- resolve6(import.meta.dir, "..", "..", "package.json")
992
+ resolve5(import.meta.dir, "..", "..", "..", "package.json"),
993
+ resolve5(import.meta.dir, "..", "..", "package.json")
985
994
  ];
986
995
  for (const candidate of versionCandidates) {
987
996
  try {
@@ -1007,8 +1016,8 @@ var start = async (serverEntry, outdir, configPath2) => {
1007
1016
  ].filter(Boolean);
1008
1017
  try {
1009
1018
  const candidates = [
1010
- resolve6(import.meta.dir, "..", "..", "core", "build"),
1011
- resolve6(import.meta.dir, "..", "build")
1019
+ resolve5(import.meta.dir, "..", "..", "core", "build"),
1020
+ resolve5(import.meta.dir, "..", "build")
1012
1021
  ];
1013
1022
  let build;
1014
1023
  for (const candidate of candidates) {
@@ -1087,7 +1096,7 @@ var start = async (serverEntry, outdir, configPath2) => {
1087
1096
  }
1088
1097
  };
1089
1098
  const serverBundle = await Bun.build({
1090
- entrypoints: [resolve6(serverEntry)],
1099
+ entrypoints: [resolve5(serverEntry)],
1091
1100
  define: { "process.env.NODE_ENV": '"production"' },
1092
1101
  external: [
1093
1102
  "vue",
@@ -1119,8 +1128,8 @@ var start = async (serverEntry, outdir, configPath2) => {
1119
1128
  console.error(cliTag2("\x1B[31m", "Server bundle failed."));
1120
1129
  process.exit(1);
1121
1130
  }
1122
- const outputPath = resolve6(resolvedOutdir, `${entryName}.js`);
1123
- if (!existsSync5(outputPath)) {
1131
+ const outputPath = resolve5(resolvedOutdir, `${entryName}.js`);
1132
+ if (!existsSync6(outputPath)) {
1124
1133
  console.error(cliTag2("\x1B[31m", `Expected output not found: ${outputPath}`));
1125
1134
  process.exit(1);
1126
1135
  }
@@ -1131,7 +1140,7 @@ var start = async (serverEntry, outdir, configPath2) => {
1131
1140
  entry: serverEntry,
1132
1141
  durationMs: bundleDurationMs
1133
1142
  });
1134
- const usesDocker = existsSync5(resolve6(COMPOSE_PATH));
1143
+ const usesDocker = existsSync6(resolve5(COMPOSE_PATH));
1135
1144
  const scripts = usesDocker ? await readDbScripts() : null;
1136
1145
  if (scripts)
1137
1146
  await startDatabase(scripts);