@absolutejs/absolute 0.19.0-beta.109 → 0.19.0-beta.110
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/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/dist/angular/index.js +19 -1
- package/dist/angular/index.js.map +2 -2
- package/dist/build.js +27 -7
- package/dist/build.js.map +3 -3
- package/dist/cli/index.js +275 -67
- package/dist/index.js +163 -9
- package/dist/index.js.map +6 -5
- package/dist/react/hooks/index.js +19 -1
- package/dist/react/hooks/index.js.map +2 -2
- package/dist/react/index.js +19 -1
- package/dist/react/index.js.map +2 -2
- package/dist/src/dev/devCert.d.ts +8 -0
- package/dist/src/utils/logger.d.ts +1 -0
- package/dist/src/utils/startupBanner.d.ts +1 -0
- package/dist/svelte/index.js +19 -1
- package/dist/svelte/index.js.map +2 -2
- package/dist/types/build.d.ts +3 -0
- package/dist/vue/index.js +19 -1
- package/dist/vue/index.js.map +2 -2
- package/package.json +1 -1
- package/types/build.ts +5 -0
package/dist/cli/index.js
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __returnValue = (v) => v;
|
|
5
|
+
function __exportSetter(name, newValue) {
|
|
6
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
7
|
+
}
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
set: __exportSetter.bind(all, name)
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
3
18
|
var __require = import.meta.require;
|
|
4
19
|
|
|
5
|
-
// src/cli/scripts/dev.ts
|
|
6
|
-
var {$: $2, env } = globalThis.Bun;
|
|
7
|
-
import { existsSync as existsSync4 } from "fs";
|
|
8
|
-
import { resolve as resolve3 } from "path";
|
|
9
|
-
|
|
10
20
|
// src/constants.ts
|
|
11
|
-
var ANSI_ESCAPE_LENGTH = 3;
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var HOURS_IN_DAY = 24;
|
|
18
|
-
var HOURS_IN_HALF_DAY = 12;
|
|
19
|
-
var MAX_ERROR_LENGTH = 200;
|
|
20
|
-
var MILLISECONDS_IN_A_SECOND = 1000;
|
|
21
|
-
var MINUTES_IN_AN_HOUR = 60;
|
|
22
|
-
var SECONDS_IN_A_MINUTE = 60;
|
|
23
|
-
var MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
|
|
24
|
-
var MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
|
|
25
|
-
var SIGINT_EXIT_CODE = 130;
|
|
26
|
-
var SIGTERM_EXIT_CODE = 143;
|
|
27
|
-
var TIME_PRECISION = 2;
|
|
28
|
-
var TWO_THIRDS = 2 / 3;
|
|
29
|
-
var UNFOUND_INDEX = -1;
|
|
21
|
+
var ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, DEFAULT_PORT = 3000, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, MAX_ERROR_LENGTH = 200, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1;
|
|
22
|
+
var init_constants = __esm(() => {
|
|
23
|
+
MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
|
|
24
|
+
MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
|
|
25
|
+
TWO_THIRDS = 2 / 3;
|
|
26
|
+
});
|
|
30
27
|
|
|
31
28
|
// src/utils/getDurationString.ts
|
|
32
29
|
var getDurationString = (duration) => {
|
|
@@ -40,23 +37,12 @@ var getDurationString = (duration) => {
|
|
|
40
37
|
}
|
|
41
38
|
return durationString;
|
|
42
39
|
};
|
|
40
|
+
var init_getDurationString = __esm(() => {
|
|
41
|
+
init_constants();
|
|
42
|
+
});
|
|
43
43
|
|
|
44
44
|
// src/utils/startupBanner.ts
|
|
45
|
-
var MONTHS =
|
|
46
|
-
"Jan",
|
|
47
|
-
"Feb",
|
|
48
|
-
"Mar",
|
|
49
|
-
"Apr",
|
|
50
|
-
"May",
|
|
51
|
-
"Jun",
|
|
52
|
-
"Jul",
|
|
53
|
-
"Aug",
|
|
54
|
-
"Sep",
|
|
55
|
-
"Oct",
|
|
56
|
-
"Nov",
|
|
57
|
-
"Dec"
|
|
58
|
-
];
|
|
59
|
-
var formatTimestamp = () => {
|
|
45
|
+
var MONTHS, formatTimestamp = () => {
|
|
60
46
|
const now = new Date;
|
|
61
47
|
const month = MONTHS[now.getMonth()];
|
|
62
48
|
const day = now.getDate().toString().padStart(2, "0");
|
|
@@ -67,8 +53,220 @@ var formatTimestamp = () => {
|
|
|
67
53
|
hours = hours % HOURS_IN_HALF_DAY || HOURS_IN_HALF_DAY;
|
|
68
54
|
return `${month} ${day} ${hours}:${minutes}:${seconds} ${ampm}`;
|
|
69
55
|
};
|
|
56
|
+
var init_startupBanner = __esm(() => {
|
|
57
|
+
init_constants();
|
|
58
|
+
init_getDurationString();
|
|
59
|
+
MONTHS = [
|
|
60
|
+
"Jan",
|
|
61
|
+
"Feb",
|
|
62
|
+
"Mar",
|
|
63
|
+
"Apr",
|
|
64
|
+
"May",
|
|
65
|
+
"Jun",
|
|
66
|
+
"Jul",
|
|
67
|
+
"Aug",
|
|
68
|
+
"Sep",
|
|
69
|
+
"Oct",
|
|
70
|
+
"Nov",
|
|
71
|
+
"Dec"
|
|
72
|
+
];
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// src/utils/loadConfig.ts
|
|
76
|
+
var exports_loadConfig = {};
|
|
77
|
+
__export(exports_loadConfig, {
|
|
78
|
+
loadConfig: () => loadConfig
|
|
79
|
+
});
|
|
80
|
+
import { resolve } from "path";
|
|
81
|
+
var loadConfig = async (configPath2) => {
|
|
82
|
+
const resolved = resolve(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
83
|
+
const mod = await import(resolved);
|
|
84
|
+
const config = mod.default ?? mod.config;
|
|
85
|
+
if (!config) {
|
|
86
|
+
throw new Error(`Config file "${resolved}" does not export a valid configuration.
|
|
87
|
+
Expected: export default defineConfig({ ... })`);
|
|
88
|
+
}
|
|
89
|
+
return config;
|
|
90
|
+
};
|
|
91
|
+
var init_loadConfig = () => {};
|
|
92
|
+
|
|
93
|
+
// src/utils/logger.ts
|
|
94
|
+
var colors, frameworkColors, formatPath = (filePath) => {
|
|
95
|
+
const cwd = process.cwd();
|
|
96
|
+
let relative = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
97
|
+
relative = relative.replace(/\\/g, "/");
|
|
98
|
+
if (!relative.startsWith("/")) {
|
|
99
|
+
relative = `/${relative}`;
|
|
100
|
+
}
|
|
101
|
+
return relative;
|
|
102
|
+
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors.white, log = (action, options) => {
|
|
103
|
+
const timestamp = `${colors.dim}${formatTimestamp()}${colors.reset}`;
|
|
104
|
+
const tag = `${colors.cyan}[hmr]${colors.reset}`;
|
|
105
|
+
let message = action;
|
|
106
|
+
if (options?.path) {
|
|
107
|
+
const pathColor = options.framework ? getFrameworkColor(options.framework) : colors.white;
|
|
108
|
+
message += ` ${pathColor}${formatPath(options.path)}${colors.reset}`;
|
|
109
|
+
}
|
|
110
|
+
if (options?.duration !== undefined) {
|
|
111
|
+
message += ` ${colors.dim}(${options.duration}ms)${colors.reset}`;
|
|
112
|
+
}
|
|
113
|
+
console.log(`${timestamp} ${tag} ${message}`);
|
|
114
|
+
}, logInfo = (message) => {
|
|
115
|
+
log(message);
|
|
116
|
+
}, logWarn = (message) => {
|
|
117
|
+
const timestamp = `${colors.dim}${formatTimestamp()}${colors.reset}`;
|
|
118
|
+
const tag = `${colors.yellow}[hmr]${colors.reset}`;
|
|
119
|
+
console.warn(`${timestamp} ${tag} ${colors.yellow}warning${colors.reset} ${message}`);
|
|
120
|
+
};
|
|
121
|
+
var init_logger = __esm(() => {
|
|
122
|
+
init_startupBanner();
|
|
123
|
+
colors = {
|
|
124
|
+
blue: "\x1B[34m",
|
|
125
|
+
bold: "\x1B[1m",
|
|
126
|
+
cyan: "\x1B[36m",
|
|
127
|
+
dim: "\x1B[2m",
|
|
128
|
+
green: "\x1B[32m",
|
|
129
|
+
magenta: "\x1B[35m",
|
|
130
|
+
red: "\x1B[31m",
|
|
131
|
+
reset: "\x1B[0m",
|
|
132
|
+
white: "\x1B[37m",
|
|
133
|
+
yellow: "\x1B[33m"
|
|
134
|
+
};
|
|
135
|
+
frameworkColors = {
|
|
136
|
+
angular: colors.magenta,
|
|
137
|
+
assets: colors.dim,
|
|
138
|
+
css: colors.cyan,
|
|
139
|
+
html: colors.white,
|
|
140
|
+
htmx: colors.white,
|
|
141
|
+
react: colors.blue,
|
|
142
|
+
svelte: colors.yellow,
|
|
143
|
+
vue: colors.green
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// src/dev/devCert.ts
|
|
148
|
+
var exports_devCert = {};
|
|
149
|
+
__export(exports_devCert, {
|
|
150
|
+
loadDevCert: () => loadDevCert,
|
|
151
|
+
ensureDevCert: () => ensureDevCert
|
|
152
|
+
});
|
|
153
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4 } from "fs";
|
|
154
|
+
import { join as join3 } from "path";
|
|
155
|
+
var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, certFilesExist = () => existsSync4(CERT_PATH) && existsSync4(KEY_PATH), isCertExpired = () => {
|
|
156
|
+
try {
|
|
157
|
+
const certPem = readFileSync4(CERT_PATH, "utf-8");
|
|
158
|
+
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
159
|
+
stdin: new TextEncoder().encode(certPem)
|
|
160
|
+
});
|
|
161
|
+
const output = new TextDecoder().decode(proc.stdout).trim();
|
|
162
|
+
const dateStr = output.replace("notAfter=", "");
|
|
163
|
+
const expiryDate = new Date(dateStr);
|
|
164
|
+
return expiryDate.getTime() < Date.now();
|
|
165
|
+
} catch {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
}, hasMkcert = () => {
|
|
169
|
+
try {
|
|
170
|
+
const result = Bun.spawnSync(["mkcert", "-version"], {
|
|
171
|
+
stderr: "pipe",
|
|
172
|
+
stdout: "pipe"
|
|
173
|
+
});
|
|
174
|
+
return result.exitCode === 0;
|
|
175
|
+
} catch {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
}, generateWithMkcert = () => {
|
|
179
|
+
logInfo("Generating locally-trusted certificate with mkcert...");
|
|
180
|
+
const result = Bun.spawnSync([
|
|
181
|
+
"mkcert",
|
|
182
|
+
"-cert-file",
|
|
183
|
+
CERT_PATH,
|
|
184
|
+
"-key-file",
|
|
185
|
+
KEY_PATH,
|
|
186
|
+
"localhost",
|
|
187
|
+
"127.0.0.1",
|
|
188
|
+
"::1"
|
|
189
|
+
], { stderr: "pipe", stdout: "pipe" });
|
|
190
|
+
if (result.exitCode !== 0) {
|
|
191
|
+
const err = new TextDecoder().decode(result.stderr);
|
|
192
|
+
throw new Error(`mkcert failed: ${err}`);
|
|
193
|
+
}
|
|
194
|
+
logInfo("Certificate generated with mkcert (locally trusted, no browser warning)");
|
|
195
|
+
}, generateSelfSigned = () => {
|
|
196
|
+
logInfo("Generating self-signed certificate for HTTPS dev server...");
|
|
197
|
+
const proc = Bun.spawnSync([
|
|
198
|
+
"openssl",
|
|
199
|
+
"req",
|
|
200
|
+
"-x509",
|
|
201
|
+
"-newkey",
|
|
202
|
+
"ec",
|
|
203
|
+
"-pkeyopt",
|
|
204
|
+
"ec_paramgen_curve:prime256v1",
|
|
205
|
+
"-days",
|
|
206
|
+
String(CERT_VALIDITY_DAYS),
|
|
207
|
+
"-nodes",
|
|
208
|
+
"-keyout",
|
|
209
|
+
KEY_PATH,
|
|
210
|
+
"-out",
|
|
211
|
+
CERT_PATH,
|
|
212
|
+
"-subj",
|
|
213
|
+
"/CN=localhost",
|
|
214
|
+
"-addext",
|
|
215
|
+
"subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1"
|
|
216
|
+
], { stderr: "pipe", stdout: "pipe" });
|
|
217
|
+
if (proc.exitCode !== 0) {
|
|
218
|
+
const err = new TextDecoder().decode(proc.stderr);
|
|
219
|
+
throw new Error(`openssl failed: ${err}`);
|
|
220
|
+
}
|
|
221
|
+
logInfo("Self-signed certificate generated (one-time browser warning on first visit)");
|
|
222
|
+
}, ensureDevCert = () => {
|
|
223
|
+
mkdirSync2(CERT_DIR, { recursive: true });
|
|
224
|
+
if (certFilesExist() && !isCertExpired()) {
|
|
225
|
+
return { cert: CERT_PATH, key: KEY_PATH };
|
|
226
|
+
}
|
|
227
|
+
if (certFilesExist()) {
|
|
228
|
+
logWarn("Dev certificate expired, regenerating...");
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
if (hasMkcert()) {
|
|
232
|
+
generateWithMkcert();
|
|
233
|
+
} else {
|
|
234
|
+
generateSelfSigned();
|
|
235
|
+
}
|
|
236
|
+
} catch (err) {
|
|
237
|
+
logWarn(`Failed to generate HTTPS certificate: ${err instanceof Error ? err.message : err}`);
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
return { cert: CERT_PATH, key: KEY_PATH };
|
|
241
|
+
}, loadDevCert = () => {
|
|
242
|
+
const paths = ensureDevCert();
|
|
243
|
+
if (!paths)
|
|
244
|
+
return null;
|
|
245
|
+
try {
|
|
246
|
+
return {
|
|
247
|
+
cert: readFileSync4(paths.cert, "utf-8"),
|
|
248
|
+
key: readFileSync4(paths.key, "utf-8")
|
|
249
|
+
};
|
|
250
|
+
} catch {
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var init_devCert = __esm(() => {
|
|
255
|
+
init_logger();
|
|
256
|
+
CERT_DIR = join3(process.cwd(), ".absolutejs");
|
|
257
|
+
CERT_PATH = join3(CERT_DIR, "cert.pem");
|
|
258
|
+
KEY_PATH = join3(CERT_DIR, "key.pem");
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// src/cli/scripts/dev.ts
|
|
262
|
+
init_constants();
|
|
263
|
+
init_startupBanner();
|
|
264
|
+
var {$: $2, env } = globalThis.Bun;
|
|
265
|
+
import { existsSync as existsSync5 } from "fs";
|
|
266
|
+
import { resolve as resolve3 } from "path";
|
|
70
267
|
|
|
71
268
|
// src/cli/interactive.ts
|
|
269
|
+
init_constants();
|
|
72
270
|
import { openSync } from "fs";
|
|
73
271
|
import { ReadStream } from "tty";
|
|
74
272
|
var SHORTCUTS = {
|
|
@@ -469,20 +667,12 @@ var sendTelemetryEvent = (event, payload) => {
|
|
|
469
667
|
} catch {}
|
|
470
668
|
};
|
|
471
669
|
|
|
472
|
-
// src/
|
|
473
|
-
|
|
474
|
-
var loadConfig = async (configPath2) => {
|
|
475
|
-
const resolved = resolve(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
476
|
-
const mod = await import(resolved);
|
|
477
|
-
const config = mod.default ?? mod.config;
|
|
478
|
-
if (!config) {
|
|
479
|
-
throw new Error(`Config file "${resolved}" does not export a valid configuration.
|
|
480
|
-
Expected: export default defineConfig({ ... })`);
|
|
481
|
-
}
|
|
482
|
-
return config;
|
|
483
|
-
};
|
|
670
|
+
// src/cli/scripts/dev.ts
|
|
671
|
+
init_loadConfig();
|
|
484
672
|
|
|
485
673
|
// src/cli/utils.ts
|
|
674
|
+
init_constants();
|
|
675
|
+
init_startupBanner();
|
|
486
676
|
var {$ } = globalThis.Bun;
|
|
487
677
|
import { execSync } from "child_process";
|
|
488
678
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
@@ -575,7 +765,17 @@ var cliTag = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cl
|
|
|
575
765
|
var dev = async (serverEntry, configPath2) => {
|
|
576
766
|
const port = Number(env.PORT) || DEFAULT_PORT;
|
|
577
767
|
killStaleProcesses(port);
|
|
578
|
-
|
|
768
|
+
let httpsEnabled = false;
|
|
769
|
+
try {
|
|
770
|
+
const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_loadConfig(), exports_loadConfig));
|
|
771
|
+
const config = await loadConfig2(configPath2);
|
|
772
|
+
httpsEnabled = config?.dev?.https === true;
|
|
773
|
+
if (httpsEnabled) {
|
|
774
|
+
const { ensureDevCert: ensureDevCert2 } = await Promise.resolve().then(() => (init_devCert(), exports_devCert));
|
|
775
|
+
ensureDevCert2();
|
|
776
|
+
}
|
|
777
|
+
} catch {}
|
|
778
|
+
const usesDocker = existsSync5(resolve3(COMPOSE_PATH));
|
|
579
779
|
const scripts = usesDocker ? await readDbScripts() : null;
|
|
580
780
|
if (scripts)
|
|
581
781
|
await startDatabase(scripts);
|
|
@@ -604,7 +804,8 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
604
804
|
...process.env,
|
|
605
805
|
FORCE_COLOR: "1",
|
|
606
806
|
NODE_ENV: "development",
|
|
607
|
-
...configPath2 ? { ABSOLUTE_CONFIG: configPath2 } : {}
|
|
807
|
+
...configPath2 ? { ABSOLUTE_CONFIG: configPath2 } : {},
|
|
808
|
+
...httpsEnabled ? { ABSOLUTE_HTTPS: "true" } : {}
|
|
608
809
|
},
|
|
609
810
|
stderr: "pipe",
|
|
610
811
|
stdin: "ignore",
|
|
@@ -842,8 +1043,9 @@ var eslint = async (args) => {
|
|
|
842
1043
|
};
|
|
843
1044
|
|
|
844
1045
|
// src/cli/scripts/info.ts
|
|
1046
|
+
init_constants();
|
|
845
1047
|
import { execSync as execSync2 } from "child_process";
|
|
846
|
-
import { existsSync as
|
|
1048
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
|
|
847
1049
|
import { arch as arch2, cpus, platform as platform2, totalmem, version } from "os";
|
|
848
1050
|
import { resolve as resolve4 } from "path";
|
|
849
1051
|
var __dirname = "/home/alexkahn/abs/absolutejs/src/cli/scripts";
|
|
@@ -866,7 +1068,7 @@ var getPackageVersion = (packageName) => {
|
|
|
866
1068
|
const pkgPath = __require.resolve(`${packageName}/package.json`, {
|
|
867
1069
|
paths: [process.cwd()]
|
|
868
1070
|
});
|
|
869
|
-
const pkg = JSON.parse(
|
|
1071
|
+
const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
|
|
870
1072
|
const ver = pkg.version;
|
|
871
1073
|
return ver;
|
|
872
1074
|
} catch {
|
|
@@ -876,7 +1078,7 @@ var getPackageVersion = (packageName) => {
|
|
|
876
1078
|
var getAbsoluteVersion = () => {
|
|
877
1079
|
try {
|
|
878
1080
|
const pkgPath = resolve4(__dirname, "../../../package.json");
|
|
879
|
-
const pkg = JSON.parse(
|
|
1081
|
+
const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
|
|
880
1082
|
const ver = pkg.version;
|
|
881
1083
|
return ver;
|
|
882
1084
|
} catch {
|
|
@@ -911,7 +1113,7 @@ var detectCI = () => {
|
|
|
911
1113
|
};
|
|
912
1114
|
var isDockerEnvironment = () => {
|
|
913
1115
|
try {
|
|
914
|
-
return
|
|
1116
|
+
return existsSync6("/.dockerenv");
|
|
915
1117
|
} catch {
|
|
916
1118
|
return false;
|
|
917
1119
|
}
|
|
@@ -980,8 +1182,9 @@ var info = () => {
|
|
|
980
1182
|
};
|
|
981
1183
|
|
|
982
1184
|
// src/cli/cache.ts
|
|
1185
|
+
init_constants();
|
|
983
1186
|
import { mkdir } from "fs/promises";
|
|
984
|
-
import { join as
|
|
1187
|
+
import { join as join4 } from "path";
|
|
985
1188
|
var {Glob } = globalThis.Bun;
|
|
986
1189
|
var CACHE_DIR = ".absolutejs";
|
|
987
1190
|
var MAX_FILES_PER_BATCH = 200;
|
|
@@ -1033,7 +1236,7 @@ var hashFiles = async (paths) => {
|
|
|
1033
1236
|
};
|
|
1034
1237
|
var loadCache = async (tool) => {
|
|
1035
1238
|
try {
|
|
1036
|
-
const path =
|
|
1239
|
+
const path = join4(CACHE_DIR, `${tool}.cache.json`);
|
|
1037
1240
|
const data = await Bun.file(path).json();
|
|
1038
1241
|
const result = data;
|
|
1039
1242
|
return result;
|
|
@@ -1082,7 +1285,7 @@ var runTool = async (adapter, args) => {
|
|
|
1082
1285
|
};
|
|
1083
1286
|
var saveCache = async (tool, data) => {
|
|
1084
1287
|
await mkdir(CACHE_DIR, { recursive: true });
|
|
1085
|
-
const path =
|
|
1288
|
+
const path = join4(CACHE_DIR, `${tool}.cache.json`);
|
|
1086
1289
|
await Bun.write(path, JSON.stringify(data, null, "\t"));
|
|
1087
1290
|
};
|
|
1088
1291
|
|
|
@@ -1115,8 +1318,12 @@ var prettier = async (args) => {
|
|
|
1115
1318
|
};
|
|
1116
1319
|
|
|
1117
1320
|
// src/cli/scripts/start.ts
|
|
1321
|
+
init_constants();
|
|
1322
|
+
init_getDurationString();
|
|
1323
|
+
init_loadConfig();
|
|
1324
|
+
init_startupBanner();
|
|
1118
1325
|
var {env: env2 } = globalThis.Bun;
|
|
1119
|
-
import { existsSync as
|
|
1326
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "fs";
|
|
1120
1327
|
import { basename, resolve as resolve5 } from "path";
|
|
1121
1328
|
var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`;
|
|
1122
1329
|
var resolvePackageVersion = (candidates) => {
|
|
@@ -1130,7 +1337,7 @@ var resolvePackageVersion = (candidates) => {
|
|
|
1130
1337
|
};
|
|
1131
1338
|
var readPackageVersion = (candidate) => {
|
|
1132
1339
|
try {
|
|
1133
|
-
const pkg = JSON.parse(
|
|
1340
|
+
const pkg = JSON.parse(readFileSync6(candidate, "utf-8"));
|
|
1134
1341
|
if (pkg.name !== "@absolutejs/absolute")
|
|
1135
1342
|
return null;
|
|
1136
1343
|
const ver = pkg.version;
|
|
@@ -1157,13 +1364,13 @@ var tryImportBuild = async (candidate) => {
|
|
|
1157
1364
|
}
|
|
1158
1365
|
};
|
|
1159
1366
|
var handleBundleFailure = (serverBundle, bundleStart, serverEntry) => {
|
|
1160
|
-
serverBundle.logs.forEach((
|
|
1161
|
-
console.error(
|
|
1367
|
+
serverBundle.logs.forEach((log2) => {
|
|
1368
|
+
console.error(log2);
|
|
1162
1369
|
});
|
|
1163
1370
|
sendTelemetryEvent("start:bundle-error", {
|
|
1164
1371
|
durationMs: Math.round(performance.now() - bundleStart),
|
|
1165
1372
|
entry: serverEntry,
|
|
1166
|
-
message: serverBundle.logs.find((
|
|
1373
|
+
message: serverBundle.logs.find((log2) => log2.level === "error")?.message?.toString().slice(0, MAX_ERROR_LENGTH) ?? "Unknown error"
|
|
1167
1374
|
});
|
|
1168
1375
|
console.error(cliTag2("\x1B[31m", "Server bundle failed."));
|
|
1169
1376
|
process.exit(1);
|
|
@@ -1290,7 +1497,7 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
1290
1497
|
handleBundleFailure(serverBundle, bundleStart, serverEntry);
|
|
1291
1498
|
}
|
|
1292
1499
|
const outputPath = resolve5(resolvedOutdir, `${entryName}.js`);
|
|
1293
|
-
if (!
|
|
1500
|
+
if (!existsSync7(outputPath)) {
|
|
1294
1501
|
console.error(cliTag2("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
1295
1502
|
process.exit(1);
|
|
1296
1503
|
}
|
|
@@ -1301,7 +1508,7 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
1301
1508
|
durationMs: bundleDurationMs,
|
|
1302
1509
|
entry: serverEntry
|
|
1303
1510
|
});
|
|
1304
|
-
const usesDocker =
|
|
1511
|
+
const usesDocker = existsSync7(resolve5(COMPOSE_PATH));
|
|
1305
1512
|
const scripts = usesDocker ? await readDbScripts() : null;
|
|
1306
1513
|
if (scripts)
|
|
1307
1514
|
await startDatabase(scripts);
|
|
@@ -1363,6 +1570,7 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
1363
1570
|
};
|
|
1364
1571
|
|
|
1365
1572
|
// src/cli/index.ts
|
|
1573
|
+
init_constants();
|
|
1366
1574
|
var [command] = process.argv.slice(2);
|
|
1367
1575
|
var args = process.argv.slice(CLI_ARGS_OFFSET);
|
|
1368
1576
|
var parseNamedArg = (flag) => {
|