@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/dist/index.js CHANGED
@@ -3,6 +3,7 @@ var __create = Object.create;
3
3
  var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  function __accessProp(key) {
8
9
  return this[key];
@@ -29,6 +30,23 @@ var __toESM = (mod, isNodeMode, target) => {
29
30
  cache.set(mod, to);
30
31
  return to;
31
32
  };
33
+ var __toCommonJS = (from) => {
34
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
35
+ if (entry)
36
+ return entry;
37
+ entry = __defProp({}, "__esModule", { value: true });
38
+ if (from && typeof from === "object" || typeof from === "function") {
39
+ for (var key of __getOwnPropNames(from))
40
+ if (!__hasOwnProp.call(entry, key))
41
+ __defProp(entry, key, {
42
+ get: __accessProp.bind(from, key),
43
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
+ });
45
+ }
46
+ __moduleCache.set(from, entry);
47
+ return entry;
48
+ };
49
+ var __moduleCache;
32
50
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
51
  var __returnValue = (v) => v;
34
52
  function __exportSetter(name, newValue) {
@@ -1151,14 +1169,14 @@ var colors, MONTHS, formatTimestamp = () => {
1151
1169
  hours = hours % HOURS_IN_HALF_DAY || HOURS_IN_HALF_DAY;
1152
1170
  return `${month} ${day} ${hours}:${minutes}:${seconds} ${ampm}`;
1153
1171
  }, startupBanner = (options) => {
1154
- const { version, duration, port, host, networkUrl } = options;
1172
+ const { version, duration, port, host, networkUrl, protocol = "http" } = options;
1155
1173
  const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
1156
1174
  const ver = `${colors.dim}v${version}${colors.reset}`;
1157
1175
  const time = `${colors.dim}ready in${colors.reset} ${colors.bold}${getDurationString(duration)}${colors.reset}`;
1158
1176
  console.log("");
1159
1177
  console.log(` ${name} ${ver} ${time}`);
1160
1178
  console.log("");
1161
- console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Local:${colors.reset} http://${host === "0.0.0.0" ? "localhost" : host}:${port}/`);
1179
+ console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Local:${colors.reset} ${protocol}://${host === "0.0.0.0" ? "localhost" : host}:${port}/`);
1162
1180
  if (networkUrl) {
1163
1181
  console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
1164
1182
  }
@@ -1221,6 +1239,8 @@ var colors2, frameworkColors, formatPath = (filePath) => {
1221
1239
  console.error(`${timestamp} ${tag} ${fullMessage}`);
1222
1240
  }, logHmrUpdate = (path, framework, duration) => {
1223
1241
  log("hmr update", { duration, framework, path });
1242
+ }, logInfo = (message) => {
1243
+ log(message);
1224
1244
  }, logScriptUpdate = (path, framework, duration) => {
1225
1245
  log("script update", { duration, framework, path });
1226
1246
  }, logServerReload = () => {
@@ -1827,7 +1847,7 @@ var require_typescript = __commonJS((exports, module) => {
1827
1847
  var ts = {};
1828
1848
  ((module2) => {
1829
1849
  var __defProp2 = Object.defineProperty;
1830
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1850
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1831
1851
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
1832
1852
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1833
1853
  var __export2 = (target, all) => {
@@ -1838,11 +1858,11 @@ var require_typescript = __commonJS((exports, module) => {
1838
1858
  if (from && typeof from === "object" || typeof from === "function") {
1839
1859
  for (let key of __getOwnPropNames2(from))
1840
1860
  if (!__hasOwnProp2.call(to, key) && key !== except)
1841
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
1861
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1842
1862
  }
1843
1863
  return to;
1844
1864
  };
1845
- var __toCommonJS = (mod) => (__copyProps, mod);
1865
+ var __toCommonJS2 = (mod) => (__copyProps, mod);
1846
1866
  var typescript_exports = {};
1847
1867
  __export2(typescript_exports, {
1848
1868
  ANONYMOUS: () => ANONYMOUS,
@@ -4090,7 +4110,7 @@ var require_typescript = __commonJS((exports, module) => {
4090
4110
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
4091
4111
  zipWith: () => zipWith
4092
4112
  });
4093
- module2.exports = __toCommonJS(typescript_exports);
4113
+ module2.exports = __toCommonJS2(typescript_exports);
4094
4114
  var versionMajorMinor = "5.9";
4095
4115
  var version = "5.9.3";
4096
4116
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
@@ -205016,6 +205036,120 @@ var init_hmr = __esm(() => {
205016
205036
  init_bridgeInternals();
205017
205037
  init_webSocket();
205018
205038
  });
205039
+
205040
+ // src/dev/devCert.ts
205041
+ var exports_devCert = {};
205042
+ __export(exports_devCert, {
205043
+ loadDevCert: () => loadDevCert,
205044
+ ensureDevCert: () => ensureDevCert
205045
+ });
205046
+ import { existsSync as existsSync15, mkdirSync as mkdirSync10, readFileSync as readFileSync11 } from "fs";
205047
+ import { join as join17 } from "path";
205048
+ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, certFilesExist = () => existsSync15(CERT_PATH) && existsSync15(KEY_PATH), isCertExpired = () => {
205049
+ try {
205050
+ const certPem = readFileSync11(CERT_PATH, "utf-8");
205051
+ const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
205052
+ stdin: new TextEncoder().encode(certPem)
205053
+ });
205054
+ const output = new TextDecoder().decode(proc.stdout).trim();
205055
+ const dateStr = output.replace("notAfter=", "");
205056
+ const expiryDate = new Date(dateStr);
205057
+ return expiryDate.getTime() < Date.now();
205058
+ } catch {
205059
+ return true;
205060
+ }
205061
+ }, hasMkcert = () => {
205062
+ try {
205063
+ const result = Bun.spawnSync(["mkcert", "-version"], {
205064
+ stderr: "pipe",
205065
+ stdout: "pipe"
205066
+ });
205067
+ return result.exitCode === 0;
205068
+ } catch {
205069
+ return false;
205070
+ }
205071
+ }, generateWithMkcert = () => {
205072
+ logInfo("Generating locally-trusted certificate with mkcert...");
205073
+ const result = Bun.spawnSync([
205074
+ "mkcert",
205075
+ "-cert-file",
205076
+ CERT_PATH,
205077
+ "-key-file",
205078
+ KEY_PATH,
205079
+ "localhost",
205080
+ "127.0.0.1",
205081
+ "::1"
205082
+ ], { stderr: "pipe", stdout: "pipe" });
205083
+ if (result.exitCode !== 0) {
205084
+ const err = new TextDecoder().decode(result.stderr);
205085
+ throw new Error(`mkcert failed: ${err}`);
205086
+ }
205087
+ logInfo("Certificate generated with mkcert (locally trusted, no browser warning)");
205088
+ }, generateSelfSigned = () => {
205089
+ logInfo("Generating self-signed certificate for HTTPS dev server...");
205090
+ const proc = Bun.spawnSync([
205091
+ "openssl",
205092
+ "req",
205093
+ "-x509",
205094
+ "-newkey",
205095
+ "ec",
205096
+ "-pkeyopt",
205097
+ "ec_paramgen_curve:prime256v1",
205098
+ "-days",
205099
+ String(CERT_VALIDITY_DAYS),
205100
+ "-nodes",
205101
+ "-keyout",
205102
+ KEY_PATH,
205103
+ "-out",
205104
+ CERT_PATH,
205105
+ "-subj",
205106
+ "/CN=localhost",
205107
+ "-addext",
205108
+ "subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1"
205109
+ ], { stderr: "pipe", stdout: "pipe" });
205110
+ if (proc.exitCode !== 0) {
205111
+ const err = new TextDecoder().decode(proc.stderr);
205112
+ throw new Error(`openssl failed: ${err}`);
205113
+ }
205114
+ logInfo("Self-signed certificate generated (one-time browser warning on first visit)");
205115
+ }, ensureDevCert = () => {
205116
+ mkdirSync10(CERT_DIR, { recursive: true });
205117
+ if (certFilesExist() && !isCertExpired()) {
205118
+ return { cert: CERT_PATH, key: KEY_PATH };
205119
+ }
205120
+ if (certFilesExist()) {
205121
+ logWarn("Dev certificate expired, regenerating...");
205122
+ }
205123
+ try {
205124
+ if (hasMkcert()) {
205125
+ generateWithMkcert();
205126
+ } else {
205127
+ generateSelfSigned();
205128
+ }
205129
+ } catch (err) {
205130
+ logWarn(`Failed to generate HTTPS certificate: ${err instanceof Error ? err.message : err}`);
205131
+ return null;
205132
+ }
205133
+ return { cert: CERT_PATH, key: KEY_PATH };
205134
+ }, loadDevCert = () => {
205135
+ const paths = ensureDevCert();
205136
+ if (!paths)
205137
+ return null;
205138
+ try {
205139
+ return {
205140
+ cert: readFileSync11(paths.cert, "utf-8"),
205141
+ key: readFileSync11(paths.key, "utf-8")
205142
+ };
205143
+ } catch {
205144
+ return null;
205145
+ }
205146
+ };
205147
+ var init_devCert = __esm(() => {
205148
+ init_logger();
205149
+ CERT_DIR = join17(process.cwd(), ".absolutejs");
205150
+ CERT_PATH = join17(CERT_DIR, "cert.pem");
205151
+ KEY_PATH = join17(CERT_DIR, "key.pem");
205152
+ });
205019
205153
  // types/client.ts
205020
205154
  var hmrState = {
205021
205155
  isConnected: false,
@@ -205212,9 +205346,28 @@ if (hostFlag) {
205212
205346
  localIP = getLocalIPAddress();
205213
205347
  host = "0.0.0.0";
205214
205348
  }
205349
+ var tls = (() => {
205350
+ if (env3.NODE_ENV !== "development")
205351
+ return;
205352
+ if (env3.ABSOLUTE_HTTPS !== "true")
205353
+ return;
205354
+ try {
205355
+ const { loadDevCert: loadDevCert2 } = (init_devCert(), __toCommonJS(exports_devCert));
205356
+ return loadDevCert2();
205357
+ } catch {
205358
+ return;
205359
+ }
205360
+ })();
205361
+ var protocol = tls ? "https" : "http";
205215
205362
  var networking = (app) => app.listen({
205216
205363
  hostname: host,
205217
- port
205364
+ port,
205365
+ ...tls ? {
205366
+ tls: {
205367
+ cert: tls.cert,
205368
+ key: tls.key
205369
+ }
205370
+ } : {}
205218
205371
  }, () => {
205219
205372
  const isHotReload = Boolean(globalThis.__hmrServerStartup);
205220
205373
  globalThis.__hmrServerStartup = true;
@@ -205226,8 +205379,9 @@ var networking = (app) => app.listen({
205226
205379
  startupBanner({
205227
205380
  duration: buildDuration,
205228
205381
  host,
205229
- networkUrl: hostFlag ? `http://${localIP}:${port}/` : undefined,
205382
+ networkUrl: hostFlag ? `${protocol}://${localIP}:${port}/` : undefined,
205230
205383
  port,
205384
+ protocol,
205231
205385
  version
205232
205386
  });
205233
205387
  });
@@ -205330,5 +205484,5 @@ export {
205330
205484
  ANGULAR_INIT_TIMEOUT_MS
205331
205485
  };
205332
205486
 
205333
- //# debugId=794680ED9EC0256F64756E2164756E21
205487
+ //# debugId=721F3E062986F6F364756E2164756E21
205334
205488
  //# sourceMappingURL=index.js.map