@absolutejs/absolute 0.19.0-beta.111 → 0.19.0-beta.112

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
@@ -43,7 +43,8 @@ __export(exports_devCert, {
43
43
  hasMkcert: () => hasMkcert,
44
44
  ensureDevCert: () => ensureDevCert
45
45
  });
46
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4 } from "fs";
46
+ import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4, rmSync } from "fs";
47
+ import { platform as platform2 } from "os";
47
48
  import { join as join3 } from "path";
48
49
  var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`), devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`), certFilesExist = () => existsSync4(CERT_PATH) && existsSync4(KEY_PATH), isCertExpired = () => {
49
50
  try {
@@ -152,18 +153,96 @@ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => c
152
153
  } catch {
153
154
  return null;
154
155
  }
156
+ }, commandExists = (cmd) => {
157
+ try {
158
+ const check = platform2() === "win32" ? ["where", cmd] : ["command", "-v", cmd];
159
+ const result = Bun.spawnSync(check, {
160
+ stderr: "pipe",
161
+ stdout: "pipe"
162
+ });
163
+ return result.exitCode === 0;
164
+ } catch {
165
+ return false;
166
+ }
167
+ }, installMkcert = () => {
168
+ const os = platform2();
169
+ if (os === "darwin") {
170
+ if (commandExists("brew")) {
171
+ devLog("Installing mkcert with Homebrew...");
172
+ const r = Bun.spawnSync(["brew", "install", "mkcert"], {
173
+ stderr: "pipe",
174
+ stdout: "pipe"
175
+ });
176
+ if (r.exitCode === 0)
177
+ return true;
178
+ }
179
+ devWarn("Install Homebrew first: https://brew.sh");
180
+ return false;
181
+ }
182
+ if (os === "linux") {
183
+ if (commandExists("apt-get")) {
184
+ devLog("Installing mkcert with apt...");
185
+ const r = Bun.spawnSync(["sudo", "apt-get", "install", "-y", "mkcert"], { stderr: "pipe", stdout: "pipe" });
186
+ if (r.exitCode === 0)
187
+ return true;
188
+ }
189
+ if (commandExists("dnf")) {
190
+ devLog("Installing mkcert with dnf...");
191
+ const r = Bun.spawnSync(["sudo", "dnf", "install", "-y", "mkcert"], { stderr: "pipe", stdout: "pipe" });
192
+ if (r.exitCode === 0)
193
+ return true;
194
+ }
195
+ if (commandExists("pacman")) {
196
+ devLog("Installing mkcert with pacman...");
197
+ const r = Bun.spawnSync(["sudo", "pacman", "-S", "--noconfirm", "mkcert"], { stderr: "pipe", stdout: "pipe" });
198
+ if (r.exitCode === 0)
199
+ return true;
200
+ }
201
+ if (commandExists("go")) {
202
+ devLog("Installing mkcert with go install...");
203
+ const r = Bun.spawnSync([
204
+ "go",
205
+ "install",
206
+ "filippo.io/mkcert@latest"
207
+ ], { stderr: "pipe", stdout: "pipe" });
208
+ if (r.exitCode === 0)
209
+ return true;
210
+ }
211
+ devWarn("Could not install mkcert automatically.");
212
+ console.log(" See: https://github.com/FiloSottile/mkcert#installation");
213
+ return false;
214
+ }
215
+ if (os === "win32") {
216
+ if (commandExists("choco")) {
217
+ devLog("Installing mkcert with Chocolatey...");
218
+ const r = Bun.spawnSync(["choco", "install", "-y", "mkcert"], {
219
+ stderr: "pipe",
220
+ stdout: "pipe"
221
+ });
222
+ if (r.exitCode === 0)
223
+ return true;
224
+ }
225
+ if (commandExists("winget")) {
226
+ devLog("Installing mkcert with winget...");
227
+ const r = Bun.spawnSync(["winget", "install", "--id", "FiloSottile.mkcert", "-e"], { stderr: "pipe", stdout: "pipe" });
228
+ if (r.exitCode === 0)
229
+ return true;
230
+ }
231
+ devWarn("Could not install mkcert automatically.");
232
+ console.log(" See: https://github.com/FiloSottile/mkcert#installation");
233
+ return false;
234
+ }
235
+ return false;
155
236
  }, setupMkcert = () => {
156
237
  devLog("Setting up mkcert for locally-trusted HTTPS...");
157
238
  if (!hasMkcert()) {
158
- devWarn("mkcert is not installed.");
159
- console.log("");
160
- console.log(" Install it first:");
161
- console.log(" macOS: brew install mkcert");
162
- console.log(" Linux: sudo apt install mkcert");
163
- console.log(" Windows: choco install mkcert");
164
- console.log("");
165
- console.log(" Then run: absolute mkcert");
166
- return false;
239
+ devLog("mkcert not found \u2014 installing...");
240
+ if (!installMkcert())
241
+ return false;
242
+ if (!hasMkcert()) {
243
+ devWarn("mkcert installed but not found in PATH. Restart your terminal and try again.");
244
+ return false;
245
+ }
167
246
  }
168
247
  devLog("Installing local certificate authority...");
169
248
  const installResult = Bun.spawnSync(["mkcert", "-install"], {
@@ -174,11 +253,8 @@ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => c
174
253
  devWarn("Failed to install CA: " + new TextDecoder().decode(installResult.stderr));
175
254
  return false;
176
255
  }
177
- try {
178
- const { rmSync } = __require("fs");
179
- rmSync(CERT_PATH, { force: true });
180
- rmSync(KEY_PATH, { force: true });
181
- } catch {}
256
+ rmSync(CERT_PATH, { force: true });
257
+ rmSync(KEY_PATH, { force: true });
182
258
  mkdirSync2(CERT_DIR, { recursive: true });
183
259
  generateWithMkcert();
184
260
  console.log("");
@@ -940,14 +1016,14 @@ var dev = async (serverEntry, configPath2) => {
940
1016
  };
941
1017
  const openInBrowser = async () => {
942
1018
  const url = `http://localhost:${port}`;
943
- const { platform: platform2 } = process;
944
- const isWSL = platform2 === "linux" && isWSLEnvironment();
1019
+ const { platform: platform3 } = process;
1020
+ const isWSL = platform3 === "linux" && isWSLEnvironment();
945
1021
  let cmd;
946
1022
  if (isWSL) {
947
1023
  cmd = "cmd.exe";
948
- } else if (platform2 === "darwin") {
1024
+ } else if (platform3 === "darwin") {
949
1025
  cmd = "open";
950
- } else if (platform2 === "win32") {
1026
+ } else if (platform3 === "win32") {
951
1027
  cmd = "start";
952
1028
  } else {
953
1029
  cmd = "xdg-open";
@@ -1034,7 +1110,7 @@ var eslint = async (args) => {
1034
1110
  // src/cli/scripts/info.ts
1035
1111
  import { execSync as execSync2 } from "child_process";
1036
1112
  import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
1037
- import { arch as arch2, cpus, platform as platform2, totalmem, version } from "os";
1113
+ import { arch as arch2, cpus, platform as platform3, totalmem, version } from "os";
1038
1114
  import { resolve as resolve4 } from "path";
1039
1115
  var __dirname = "/home/alexkahn/abs/absolutejs/src/cli/scripts";
1040
1116
  var bold = (str) => `\x1B[1m${str}\x1B[0m`;
@@ -1108,7 +1184,7 @@ var isDockerEnvironment = () => {
1108
1184
  };
1109
1185
  var getMemoryMB = () => Math.round(totalmem() / BYTES_PER_KILOBYTE / BYTES_PER_KILOBYTE);
1110
1186
  var getGlibcVersion = () => {
1111
- if (platform2() !== "linux")
1187
+ if (platform3() !== "linux")
1112
1188
  return null;
1113
1189
  try {
1114
1190
  const output = execSync2("ldd --version 2>&1 || true", {
@@ -1130,7 +1206,7 @@ var info = () => {
1130
1206
  lines.push(` ${key}: ${val}`);
1131
1207
  };
1132
1208
  section("Operating System:");
1133
- field("Platform", platform2());
1209
+ field("Platform", platform3());
1134
1210
  field("Arch", arch2());
1135
1211
  field("Version", version());
1136
1212
  field("Available memory (MB)", String(getMemoryMB()));
package/dist/index.js CHANGED
@@ -205043,7 +205043,8 @@ __export(exports_devCert, {
205043
205043
  hasMkcert: () => hasMkcert,
205044
205044
  ensureDevCert: () => ensureDevCert
205045
205045
  });
205046
- import { existsSync as existsSync15, mkdirSync as mkdirSync10, readFileSync as readFileSync11 } from "fs";
205046
+ import { existsSync as existsSync15, mkdirSync as mkdirSync10, readFileSync as readFileSync11, rmSync as rmSync2 } from "fs";
205047
+ import { platform as platform3 } from "os";
205047
205048
  import { join as join17 } from "path";
205048
205049
  var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`), devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`), certFilesExist = () => existsSync15(CERT_PATH) && existsSync15(KEY_PATH), isCertExpired = () => {
205049
205050
  try {
@@ -205152,18 +205153,96 @@ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => c
205152
205153
  } catch {
205153
205154
  return null;
205154
205155
  }
205156
+ }, commandExists = (cmd) => {
205157
+ try {
205158
+ const check = platform3() === "win32" ? ["where", cmd] : ["command", "-v", cmd];
205159
+ const result = Bun.spawnSync(check, {
205160
+ stderr: "pipe",
205161
+ stdout: "pipe"
205162
+ });
205163
+ return result.exitCode === 0;
205164
+ } catch {
205165
+ return false;
205166
+ }
205167
+ }, installMkcert = () => {
205168
+ const os2 = platform3();
205169
+ if (os2 === "darwin") {
205170
+ if (commandExists("brew")) {
205171
+ devLog("Installing mkcert with Homebrew...");
205172
+ const r = Bun.spawnSync(["brew", "install", "mkcert"], {
205173
+ stderr: "pipe",
205174
+ stdout: "pipe"
205175
+ });
205176
+ if (r.exitCode === 0)
205177
+ return true;
205178
+ }
205179
+ devWarn("Install Homebrew first: https://brew.sh");
205180
+ return false;
205181
+ }
205182
+ if (os2 === "linux") {
205183
+ if (commandExists("apt-get")) {
205184
+ devLog("Installing mkcert with apt...");
205185
+ const r = Bun.spawnSync(["sudo", "apt-get", "install", "-y", "mkcert"], { stderr: "pipe", stdout: "pipe" });
205186
+ if (r.exitCode === 0)
205187
+ return true;
205188
+ }
205189
+ if (commandExists("dnf")) {
205190
+ devLog("Installing mkcert with dnf...");
205191
+ const r = Bun.spawnSync(["sudo", "dnf", "install", "-y", "mkcert"], { stderr: "pipe", stdout: "pipe" });
205192
+ if (r.exitCode === 0)
205193
+ return true;
205194
+ }
205195
+ if (commandExists("pacman")) {
205196
+ devLog("Installing mkcert with pacman...");
205197
+ const r = Bun.spawnSync(["sudo", "pacman", "-S", "--noconfirm", "mkcert"], { stderr: "pipe", stdout: "pipe" });
205198
+ if (r.exitCode === 0)
205199
+ return true;
205200
+ }
205201
+ if (commandExists("go")) {
205202
+ devLog("Installing mkcert with go install...");
205203
+ const r = Bun.spawnSync([
205204
+ "go",
205205
+ "install",
205206
+ "filippo.io/mkcert@latest"
205207
+ ], { stderr: "pipe", stdout: "pipe" });
205208
+ if (r.exitCode === 0)
205209
+ return true;
205210
+ }
205211
+ devWarn("Could not install mkcert automatically.");
205212
+ console.log(" See: https://github.com/FiloSottile/mkcert#installation");
205213
+ return false;
205214
+ }
205215
+ if (os2 === "win32") {
205216
+ if (commandExists("choco")) {
205217
+ devLog("Installing mkcert with Chocolatey...");
205218
+ const r = Bun.spawnSync(["choco", "install", "-y", "mkcert"], {
205219
+ stderr: "pipe",
205220
+ stdout: "pipe"
205221
+ });
205222
+ if (r.exitCode === 0)
205223
+ return true;
205224
+ }
205225
+ if (commandExists("winget")) {
205226
+ devLog("Installing mkcert with winget...");
205227
+ const r = Bun.spawnSync(["winget", "install", "--id", "FiloSottile.mkcert", "-e"], { stderr: "pipe", stdout: "pipe" });
205228
+ if (r.exitCode === 0)
205229
+ return true;
205230
+ }
205231
+ devWarn("Could not install mkcert automatically.");
205232
+ console.log(" See: https://github.com/FiloSottile/mkcert#installation");
205233
+ return false;
205234
+ }
205235
+ return false;
205155
205236
  }, setupMkcert = () => {
205156
205237
  devLog("Setting up mkcert for locally-trusted HTTPS...");
205157
205238
  if (!hasMkcert()) {
205158
- devWarn("mkcert is not installed.");
205159
- console.log("");
205160
- console.log(" Install it first:");
205161
- console.log(" macOS: brew install mkcert");
205162
- console.log(" Linux: sudo apt install mkcert");
205163
- console.log(" Windows: choco install mkcert");
205164
- console.log("");
205165
- console.log(" Then run: absolute mkcert");
205166
- return false;
205239
+ devLog("mkcert not found \u2014 installing...");
205240
+ if (!installMkcert())
205241
+ return false;
205242
+ if (!hasMkcert()) {
205243
+ devWarn("mkcert installed but not found in PATH. Restart your terminal and try again.");
205244
+ return false;
205245
+ }
205167
205246
  }
205168
205247
  devLog("Installing local certificate authority...");
205169
205248
  const installResult = Bun.spawnSync(["mkcert", "-install"], {
@@ -205174,11 +205253,8 @@ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => c
205174
205253
  devWarn("Failed to install CA: " + new TextDecoder().decode(installResult.stderr));
205175
205254
  return false;
205176
205255
  }
205177
- try {
205178
- const { rmSync: rmSync2 } = __require("fs");
205179
- rmSync2(CERT_PATH, { force: true });
205180
- rmSync2(KEY_PATH, { force: true });
205181
- } catch {}
205256
+ rmSync2(CERT_PATH, { force: true });
205257
+ rmSync2(KEY_PATH, { force: true });
205182
205258
  mkdirSync10(CERT_DIR, { recursive: true });
205183
205259
  generateWithMkcert();
205184
205260
  console.log("");
@@ -205524,5 +205600,5 @@ export {
205524
205600
  ANGULAR_INIT_TIMEOUT_MS
205525
205601
  };
205526
205602
 
205527
- //# debugId=97674176A38B7A0F64756E2164756E21
205603
+ //# debugId=61B35047FE13FE4D64756E2164756E21
205528
205604
  //# sourceMappingURL=index.js.map