@stacksjs/rpx 0.4.0 → 0.5.0

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
@@ -16,80 +16,11 @@ var __toESM = (mod, isNodeMode, target) => {
16
16
  return to;
17
17
  };
18
18
 
19
- // src/config.ts
20
- import os from "os";
21
- import path from "path";
22
-
23
- // node_modules/bun-config/dist/index.js
24
- import { resolve } from "path";
25
- import process2 from "process";
26
- function deepMerge(target, source) {
27
- if (Array.isArray(source) && !Array.isArray(target)) {
28
- return source;
29
- }
30
- if (Array.isArray(source) && Array.isArray(target)) {
31
- return source.map((sourceItem, index) => {
32
- const targetItem = target[index];
33
- if (isObject(sourceItem) && isObject(targetItem)) {
34
- return deepMerge(targetItem, sourceItem);
35
- }
36
- return sourceItem;
37
- });
38
- }
39
- if (!isObject(source) || !isObject(target)) {
40
- return source;
41
- }
42
- const merged = { ...target };
43
- for (const key in source) {
44
- if (Object.prototype.hasOwnProperty.call(source, key)) {
45
- const sourceValue = source[key];
46
- const targetValue = merged[key];
47
- if (sourceValue === null || sourceValue === undefined) {
48
- merged[key] = sourceValue;
49
- } else if (isObject(sourceValue) && isObject(targetValue)) {
50
- merged[key] = deepMerge(targetValue, sourceValue);
51
- } else {
52
- merged[key] = sourceValue;
53
- }
54
- }
55
- }
56
- return merged;
57
- }
58
- function isObject(item) {
59
- return Boolean(item && typeof item === "object" && !Array.isArray(item));
60
- }
61
- async function loadConfig({ name, cwd, defaultConfig }) {
62
- const configPath = resolve(cwd || process2.cwd(), `${name}.config`);
63
- try {
64
- const importedConfig = await import(configPath);
65
- const loadedConfig = importedConfig.default || importedConfig;
66
- return deepMerge(defaultConfig, loadedConfig);
67
- } catch (error) {
68
- return defaultConfig;
69
- }
70
- }
71
-
72
- // src/config.ts
73
- var config = await loadConfig({
74
- name: "reverse-proxy",
75
- defaultConfig: {
76
- from: "localhost:5173",
77
- to: "stacks.localhost",
78
- https: {
79
- caCertPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
80
- certPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
81
- keyPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`)
82
- },
83
- etcHostsCleanup: true,
84
- verbose: true
85
- }
86
- });
87
- // src/hosts.ts
88
- import { spawn } from "child_process";
89
- import fs3 from "fs";
90
- import os7 from "os";
91
- import path6 from "path";
92
- import process3 from "process";
19
+ // src/start.ts
20
+ import * as http from "http";
21
+ import * as https from "https";
22
+ import * as net from "net";
23
+ import process9 from "process";
93
24
 
94
25
  // node_modules/@stacksjs/cli/dist/index.js
95
26
  import { formatWithOptions } from "util";
@@ -125,7 +56,7 @@ import p2 from "process";
125
56
  import process10 from "process";
126
57
  import process18 from "process";
127
58
  import process11 from "process";
128
- import os2 from "os";
59
+ import os from "os";
129
60
  import tty3 from "tty";
130
61
  import process14 from "process";
131
62
  import process13 from "process";
@@ -160,11 +91,11 @@ var __export = (target, all) => {
160
91
  });
161
92
  };
162
93
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
163
- function isObject2(value) {
94
+ function isObject(value) {
164
95
  return value !== null && typeof value === "object";
165
96
  }
166
97
  function _defu(baseObject, defaults, namespace = ".", merger) {
167
- if (!isObject2(defaults)) {
98
+ if (!isObject(defaults)) {
168
99
  return _defu(baseObject, {}, namespace, merger);
169
100
  }
170
101
  const object = Object.assign({}, defaults);
@@ -181,7 +112,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
181
112
  }
182
113
  if (Array.isArray(value) && Array.isArray(object[key])) {
183
114
  object[key] = [...value, ...object[key]];
184
- } else if (isObject2(value) && isObject2(object[key])) {
115
+ } else if (isObject(value) && isObject(object[key])) {
185
116
  object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
186
117
  } else {
187
118
  object[key] = value;
@@ -11060,10 +10991,10 @@ class CACError extends Error {
11060
10991
  }
11061
10992
 
11062
10993
  class Option {
11063
- constructor(rawName, description, config2) {
10994
+ constructor(rawName, description, config) {
11064
10995
  this.rawName = rawName;
11065
10996
  this.description = description;
11066
- this.config = Object.assign({}, config2);
10997
+ this.config = Object.assign({}, config);
11067
10998
  rawName = rawName.replace(/\.\*/g, "");
11068
10999
  this.negated = false;
11069
11000
  this.names = removeBrackets(rawName).split(",").map((v2) => {
@@ -11091,10 +11022,10 @@ var processArgs = process.argv;
11091
11022
  var platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
11092
11023
 
11093
11024
  class Command {
11094
- constructor(rawName, description, config2 = {}, cli) {
11025
+ constructor(rawName, description, config = {}, cli) {
11095
11026
  this.rawName = rawName;
11096
11027
  this.description = description;
11097
- this.config = config2;
11028
+ this.config = config;
11098
11029
  this.cli = cli;
11099
11030
  this.options = [];
11100
11031
  this.aliasNames = [];
@@ -11123,8 +11054,8 @@ class Command {
11123
11054
  this.examples.push(example);
11124
11055
  return this;
11125
11056
  }
11126
- option(rawName, description, config2) {
11127
- const option = new Option(rawName, description, config2);
11057
+ option(rawName, description, config) {
11058
+ const option = new Option(rawName, description, config);
11128
11059
  this.options.push(option);
11129
11060
  return this;
11130
11061
  }
@@ -11279,14 +11210,14 @@ class CAC extends EventEmitter {
11279
11210
  this.globalCommand.usage(text2);
11280
11211
  return this;
11281
11212
  }
11282
- command(rawName, description, config2) {
11283
- const command = new Command(rawName, description || "", config2, this);
11213
+ command(rawName, description, config) {
11214
+ const command = new Command(rawName, description || "", config, this);
11284
11215
  command.globalCommand = this.globalCommand;
11285
11216
  this.commands.push(command);
11286
11217
  return command;
11287
11218
  }
11288
- option(rawName, description, config2) {
11289
- this.globalCommand.option(rawName, description, config2);
11219
+ option(rawName, description, config) {
11220
+ this.globalCommand.option(rawName, description, config);
11290
11221
  return this;
11291
11222
  }
11292
11223
  help(callback) {
@@ -11864,7 +11795,7 @@ pluralize.addIrregularRule = (single, plural) => {
11864
11795
  /pox$/i,
11865
11796
  /sheep$/i
11866
11797
  ].forEach(pluralize.addUncountableRule);
11867
- var charMap = JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\u00FF":"y","\u0100":"A","\u0101":"a","\u0102":"A","\u0103":"a","\u0104":"A","\u0105":"a","\u0106":"C","\u0107":"c","\u010C":"C","\u010D":"c","\u010E":"D","\u010F":"d","\u0110":"DJ","\u0111":"dj","\u0112":"E","\u0113":"e","\u0116":"E","\u0117":"e","\u0118":"e","\u0119":"e","\u011A":"E","\u011B":"e","\u011E":"G","\u011F":"g","\u0122":"G","\u0123":"g","\u0128":"I","\u0129":"i","\u012A":"i","\u012B":"i","\u012E":"I","\u012F":"i","\u0130":"I","\u0131":"i","\u0136":"k","\u0137":"k","\u013B":"L","\u013C":"l","\u013D":"L","\u013E":"l","\u0141":"L","\u0142":"l","\u0143":"N","\u0144":"n","\u0145":"N","\u0146":"n","\u0147":"N","\u0148":"n","\u014C":"O","\u014D":"o","\u0150":"O","\u0151":"o","\u0152":"OE","\u0153":"oe","\u0154":"R","\u0155":"r","\u0158":"R","\u0159":"r","\u015A":"S","\u015B":"s","\u015E":"S","\u015F":"s","\u0160":"S","\u0161":"s","\u0162":"T","\u0163":"t","\u0164":"T","\u0165":"t","\u0168":"U","\u0169":"u","\u016A":"u","\u016B":"u","\u016E":"U","\u016F":"u","\u0170":"U","\u0171":"u","\u0172":"U","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017A":"z","\u017B":"Z","\u017C":"z","\u017D":"Z","\u017E":"z","\u018F":"E","\u0192":"f","\u01A0":"O","\u01A1":"o","\u01AF":"U","\u01B0":"u","\u01C8":"LJ","\u01C9":"lj","\u01CB":"NJ","\u01CC":"nj","\u0218":"S","\u0219":"s","\u021A":"T","\u021B":"t","\u0259":"e","\u02DA":"o","\u0386":"A","\u0388":"E","\u0389":"H","\u038A":"I","\u038C":"O","\u038E":"Y","\u038F":"W","\u0390":"i","\u0391":"A","\u0392":"B","\u0393":"G","\u0394":"D","\u0395":"E","\u0396":"Z","\u0397":"H","\u0398":"8","\u0399":"I","\u039A":"K","\u039B":"L","\u039C":"M","\u039D":"N","\u039E":"3","\u039F":"O","\u03A0":"P","\u03A1":"R","\u03A3":"S","\u03A4":"T","\u03A5":"Y","\u03A6":"F","\u03A7":"X","\u03A8":"PS","\u03A9":"W","\u03AA":"I","\u03AB":"Y","\u03AC":"a","\u03AD":"e","\u03AE":"h","\u03AF":"i","\u03B0":"y","\u03B1":"a","\u03B2":"b","\u03B3":"g","\u03B4":"d","\u03B5":"e","\u03B6":"z","\u03B7":"h","\u03B8":"8","\u03B9":"i","\u03BA":"k","\u03BB":"l","\u03BC":"m","\u03BD":"n","\u03BE":"3","\u03BF":"o","\u03C0":"p","\u03C1":"r","\u03C2":"s","\u03C3":"s","\u03C4":"t","\u03C5":"y","\u03C6":"f","\u03C7":"x","\u03C8":"ps","\u03C9":"w","\u03CA":"i","\u03CB":"y","\u03CC":"o","\u03CD":"y","\u03CE":"w","\u0401":"Yo","\u0402":"DJ","\u0404":"Ye","\u0406":"I","\u0407":"Yi","\u0408":"J","\u0409":"LJ","\u040A":"NJ","\u040B":"C","\u040F":"DZ","\u0410":"A","\u0411":"B","\u0412":"V","\u0413":"G","\u0414":"D","\u0415":"E","\u0416":"Zh","\u0417":"Z","\u0418":"I","\u0419":"J","\u041A":"K","\u041B":"L","\u041C":"M","\u041D":"N","\u041E":"O","\u041F":"P","\u0420":"R","\u0421":"S","\u0422":"T","\u0423":"U","\u0424":"F","\u0425":"H","\u0426":"C","\u0427":"Ch","\u0428":"Sh","\u0429":"Sh","\u042A":"U","\u042B":"Y","\u042C":"","\u042D":"E","\u042E":"Yu","\u042F":"Ya","\u0430":"a","\u0431":"b","\u0432":"v","\u0433":"g","\u0434":"d","\u0435":"e","\u0436":"zh","\u0437":"z","\u0438":"i","\u0439":"j","\u043A":"k","\u043B":"l","\u043C":"m","\u043D":"n","\u043E":"o","\u043F":"p","\u0440":"r","\u0441":"s","\u0442":"t","\u0443":"u","\u0444":"f","\u0445":"h","\u0446":"c","\u0447":"ch","\u0448":"sh","\u0449":"sh","\u044A":"u","\u044B":"y","\u044C":"","\u044D":"e","\u044E":"yu","\u044F":"ya","\u0451":"yo","\u0452":"dj","\u0454":"ye","\u0456":"i","\u0457":"yi","\u0458":"j","\u0459":"lj","\u045A":"nj","\u045B":"c","\u045D":"u","\u045F":"dz","\u0490":"G","\u0491":"g","\u0492":"GH","\u0493":"gh","\u049A":"KH","\u049B":"kh","\u04A2":"NG","\u04A3":"ng","\u04AE":"UE","\u04AF":"ue","\u04B0":"U","\u04B1":"u","\u04BA":"H","\u04BB":"h","\u04D8":"AE","\u04D9":"ae","\u04E8":"OE","\u04E9":"oe","\u0531":"A","\u0532":"B","\u0533":"G","\u0534":"D","\u0535":"E","\u0536":"Z","\u0537":"E'","\u0538":"Y'","\u0539":"T'","\u053A":"JH","\u053B":"I","\u053C":"L","\u053D":"X","\u053E":"C'","\u053F":"K","\u0540":"H","\u0541":"D'","\u0542":"GH","\u0543":"TW","\u0544":"M","\u0545":"Y","\u0546":"N","\u0547":"SH","\u0549":"CH","\u054A":"P","\u054B":"J","\u054C":"R'","\u054D":"S","\u054E":"V","\u054F":"T","\u0550":"R","\u0551":"C","\u0553":"P'","\u0554":"Q'","\u0555":"O''","\u0556":"F","\u0587":"EV","\u0621":"a","\u0622":"aa","\u0623":"a","\u0624":"u","\u0625":"i","\u0626":"e","\u0627":"a","\u0628":"b","\u0629":"h","\u062A":"t","\u062B":"th","\u062C":"j","\u062D":"h","\u062E":"kh","\u062F":"d","\u0630":"th","\u0631":"r","\u0632":"z","\u0633":"s","\u0634":"sh","\u0635":"s","\u0636":"dh","\u0637":"t","\u0638":"z","\u0639":"a","\u063A":"gh","\u0641":"f","\u0642":"q","\u0643":"k","\u0644":"l","\u0645":"m","\u0646":"n","\u0647":"h","\u0648":"w","\u0649":"a","\u064A":"y","\u064B":"an","\u064C":"on","\u064D":"en","\u064E":"a","\u064F":"u","\u0650":"e","\u0652":"","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u067E":"p","\u0686":"ch","\u0698":"zh","\u06A9":"k","\u06AF":"g","\u06CC":"y","\u06F0":"0","\u06F1":"1","\u06F2":"2","\u06F3":"3","\u06F4":"4","\u06F5":"5","\u06F6":"6","\u06F7":"7","\u06F8":"8","\u06F9":"9","\u0E3F":"baht","\u10D0":"a","\u10D1":"b","\u10D2":"g","\u10D3":"d","\u10D4":"e","\u10D5":"v","\u10D6":"z","\u10D7":"t","\u10D8":"i","\u10D9":"k","\u10DA":"l","\u10DB":"m","\u10DC":"n","\u10DD":"o","\u10DE":"p","\u10DF":"zh","\u10E0":"r","\u10E1":"s","\u10E2":"t","\u10E3":"u","\u10E4":"f","\u10E5":"k","\u10E6":"gh","\u10E7":"q","\u10E8":"sh","\u10E9":"ch","\u10EA":"ts","\u10EB":"dz","\u10EC":"ts","\u10ED":"ch","\u10EE":"kh","\u10EF":"j","\u10F0":"h","\u1E62":"S","\u1E63":"s","\u1E80":"W","\u1E81":"w","\u1E82":"W","\u1E83":"w","\u1E84":"W","\u1E85":"w","\u1E9E":"SS","\u1EA0":"A","\u1EA1":"a","\u1EA2":"A","\u1EA3":"a","\u1EA4":"A","\u1EA5":"a","\u1EA6":"A","\u1EA7":"a","\u1EA8":"A","\u1EA9":"a","\u1EAA":"A","\u1EAB":"a","\u1EAC":"A","\u1EAD":"a","\u1EAE":"A","\u1EAF":"a","\u1EB0":"A","\u1EB1":"a","\u1EB2":"A","\u1EB3":"a","\u1EB4":"A","\u1EB5":"a","\u1EB6":"A","\u1EB7":"a","\u1EB8":"E","\u1EB9":"e","\u1EBA":"E","\u1EBB":"e","\u1EBC":"E","\u1EBD":"e","\u1EBE":"E","\u1EBF":"e","\u1EC0":"E","\u1EC1":"e","\u1EC2":"E","\u1EC3":"e","\u1EC4":"E","\u1EC5":"e","\u1EC6":"E","\u1EC7":"e","\u1EC8":"I","\u1EC9":"i","\u1ECA":"I","\u1ECB":"i","\u1ECC":"O","\u1ECD":"o","\u1ECE":"O","\u1ECF":"o","\u1ED0":"O","\u1ED1":"o","\u1ED2":"O","\u1ED3":"o","\u1ED4":"O","\u1ED5":"o","\u1ED6":"O","\u1ED7":"o","\u1ED8":"O","\u1ED9":"o","\u1EDA":"O","\u1EDB":"o","\u1EDC":"O","\u1EDD":"o","\u1EDE":"O","\u1EDF":"o","\u1EE0":"O","\u1EE1":"o","\u1EE2":"O","\u1EE3":"o","\u1EE4":"U","\u1EE5":"u","\u1EE6":"U","\u1EE7":"u","\u1EE8":"U","\u1EE9":"u","\u1EEA":"U","\u1EEB":"u","\u1EEC":"U","\u1EED":"u","\u1EEE":"U","\u1EEF":"u","\u1EF0":"U","\u1EF1":"u","\u1EF2":"Y","\u1EF3":"y","\u1EF4":"Y","\u1EF5":"y","\u1EF6":"Y","\u1EF7":"y","\u1EF8":"Y","\u1EF9":"y","\u2013":"-","\u2018":"'","\u2019":"'","\u201C":"\\"","\u201D":"\\"","\u201E":"\\"","\u2020":"+","\u2022":"*","\u2026":"...","\u20A0":"ecu","\u20A2":"cruzeiro","\u20A3":"french franc","\u20A4":"lira","\u20A5":"mill","\u20A6":"naira","\u20A7":"peseta","\u20A8":"rupee","\u20A9":"won","\u20AA":"new shequel","\u20AB":"dong","\u20AC":"euro","\u20AD":"kip","\u20AE":"tugrik","\u20AF":"drachma","\u20B0":"penny","\u20B1":"peso","\u20B2":"guarani","\u20B3":"austral","\u20B4":"hryvnia","\u20B5":"cedi","\u20B8":"kazakhstani tenge","\u20B9":"indian rupee","\u20BA":"turkish lira","\u20BD":"russian ruble","\u20BF":"bitcoin","\u2120":"sm","\u2122":"tm","\u2202":"d","\u2206":"delta","\u2211":"sum","\u221E":"infinity","\u2665":"love","\u5143":"yuan","\u5186":"yen","\uFDFC":"rial","\uFEF5":"laa","\uFEF7":"laa","\uFEF9":"lai","\uFEFB":"la"}`);
11798
+ var charMap = JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\xFF":"y","\u0100":"A","\u0101":"a","\u0102":"A","\u0103":"a","\u0104":"A","\u0105":"a","\u0106":"C","\u0107":"c","\u010C":"C","\u010D":"c","\u010E":"D","\u010F":"d","\u0110":"DJ","\u0111":"dj","\u0112":"E","\u0113":"e","\u0116":"E","\u0117":"e","\u0118":"e","\u0119":"e","\u011A":"E","\u011B":"e","\u011E":"G","\u011F":"g","\u0122":"G","\u0123":"g","\u0128":"I","\u0129":"i","\u012A":"i","\u012B":"i","\u012E":"I","\u012F":"i","\u0130":"I","\u0131":"i","\u0136":"k","\u0137":"k","\u013B":"L","\u013C":"l","\u013D":"L","\u013E":"l","\u0141":"L","\u0142":"l","\u0143":"N","\u0144":"n","\u0145":"N","\u0146":"n","\u0147":"N","\u0148":"n","\u014C":"O","\u014D":"o","\u0150":"O","\u0151":"o","\u0152":"OE","\u0153":"oe","\u0154":"R","\u0155":"r","\u0158":"R","\u0159":"r","\u015A":"S","\u015B":"s","\u015E":"S","\u015F":"s","\u0160":"S","\u0161":"s","\u0162":"T","\u0163":"t","\u0164":"T","\u0165":"t","\u0168":"U","\u0169":"u","\u016A":"u","\u016B":"u","\u016E":"U","\u016F":"u","\u0170":"U","\u0171":"u","\u0172":"U","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017A":"z","\u017B":"Z","\u017C":"z","\u017D":"Z","\u017E":"z","\u018F":"E","\u0192":"f","\u01A0":"O","\u01A1":"o","\u01AF":"U","\u01B0":"u","\u01C8":"LJ","\u01C9":"lj","\u01CB":"NJ","\u01CC":"nj","\u0218":"S","\u0219":"s","\u021A":"T","\u021B":"t","\u0259":"e","\u02DA":"o","\u0386":"A","\u0388":"E","\u0389":"H","\u038A":"I","\u038C":"O","\u038E":"Y","\u038F":"W","\u0390":"i","\u0391":"A","\u0392":"B","\u0393":"G","\u0394":"D","\u0395":"E","\u0396":"Z","\u0397":"H","\u0398":"8","\u0399":"I","\u039A":"K","\u039B":"L","\u039C":"M","\u039D":"N","\u039E":"3","\u039F":"O","\u03A0":"P","\u03A1":"R","\u03A3":"S","\u03A4":"T","\u03A5":"Y","\u03A6":"F","\u03A7":"X","\u03A8":"PS","\u03A9":"W","\u03AA":"I","\u03AB":"Y","\u03AC":"a","\u03AD":"e","\u03AE":"h","\u03AF":"i","\u03B0":"y","\u03B1":"a","\u03B2":"b","\u03B3":"g","\u03B4":"d","\u03B5":"e","\u03B6":"z","\u03B7":"h","\u03B8":"8","\u03B9":"i","\u03BA":"k","\u03BB":"l","\u03BC":"m","\u03BD":"n","\u03BE":"3","\u03BF":"o","\u03C0":"p","\u03C1":"r","\u03C2":"s","\u03C3":"s","\u03C4":"t","\u03C5":"y","\u03C6":"f","\u03C7":"x","\u03C8":"ps","\u03C9":"w","\u03CA":"i","\u03CB":"y","\u03CC":"o","\u03CD":"y","\u03CE":"w","\u0401":"Yo","\u0402":"DJ","\u0404":"Ye","\u0406":"I","\u0407":"Yi","\u0408":"J","\u0409":"LJ","\u040A":"NJ","\u040B":"C","\u040F":"DZ","\u0410":"A","\u0411":"B","\u0412":"V","\u0413":"G","\u0414":"D","\u0415":"E","\u0416":"Zh","\u0417":"Z","\u0418":"I","\u0419":"J","\u041A":"K","\u041B":"L","\u041C":"M","\u041D":"N","\u041E":"O","\u041F":"P","\u0420":"R","\u0421":"S","\u0422":"T","\u0423":"U","\u0424":"F","\u0425":"H","\u0426":"C","\u0427":"Ch","\u0428":"Sh","\u0429":"Sh","\u042A":"U","\u042B":"Y","\u042C":"","\u042D":"E","\u042E":"Yu","\u042F":"Ya","\u0430":"a","\u0431":"b","\u0432":"v","\u0433":"g","\u0434":"d","\u0435":"e","\u0436":"zh","\u0437":"z","\u0438":"i","\u0439":"j","\u043A":"k","\u043B":"l","\u043C":"m","\u043D":"n","\u043E":"o","\u043F":"p","\u0440":"r","\u0441":"s","\u0442":"t","\u0443":"u","\u0444":"f","\u0445":"h","\u0446":"c","\u0447":"ch","\u0448":"sh","\u0449":"sh","\u044A":"u","\u044B":"y","\u044C":"","\u044D":"e","\u044E":"yu","\u044F":"ya","\u0451":"yo","\u0452":"dj","\u0454":"ye","\u0456":"i","\u0457":"yi","\u0458":"j","\u0459":"lj","\u045A":"nj","\u045B":"c","\u045D":"u","\u045F":"dz","\u0490":"G","\u0491":"g","\u0492":"GH","\u0493":"gh","\u049A":"KH","\u049B":"kh","\u04A2":"NG","\u04A3":"ng","\u04AE":"UE","\u04AF":"ue","\u04B0":"U","\u04B1":"u","\u04BA":"H","\u04BB":"h","\u04D8":"AE","\u04D9":"ae","\u04E8":"OE","\u04E9":"oe","\u0531":"A","\u0532":"B","\u0533":"G","\u0534":"D","\u0535":"E","\u0536":"Z","\u0537":"E'","\u0538":"Y'","\u0539":"T'","\u053A":"JH","\u053B":"I","\u053C":"L","\u053D":"X","\u053E":"C'","\u053F":"K","\u0540":"H","\u0541":"D'","\u0542":"GH","\u0543":"TW","\u0544":"M","\u0545":"Y","\u0546":"N","\u0547":"SH","\u0549":"CH","\u054A":"P","\u054B":"J","\u054C":"R'","\u054D":"S","\u054E":"V","\u054F":"T","\u0550":"R","\u0551":"C","\u0553":"P'","\u0554":"Q'","\u0555":"O''","\u0556":"F","\u0587":"EV","\u0621":"a","\u0622":"aa","\u0623":"a","\u0624":"u","\u0625":"i","\u0626":"e","\u0627":"a","\u0628":"b","\u0629":"h","\u062A":"t","\u062B":"th","\u062C":"j","\u062D":"h","\u062E":"kh","\u062F":"d","\u0630":"th","\u0631":"r","\u0632":"z","\u0633":"s","\u0634":"sh","\u0635":"s","\u0636":"dh","\u0637":"t","\u0638":"z","\u0639":"a","\u063A":"gh","\u0641":"f","\u0642":"q","\u0643":"k","\u0644":"l","\u0645":"m","\u0646":"n","\u0647":"h","\u0648":"w","\u0649":"a","\u064A":"y","\u064B":"an","\u064C":"on","\u064D":"en","\u064E":"a","\u064F":"u","\u0650":"e","\u0652":"","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u067E":"p","\u0686":"ch","\u0698":"zh","\u06A9":"k","\u06AF":"g","\u06CC":"y","\u06F0":"0","\u06F1":"1","\u06F2":"2","\u06F3":"3","\u06F4":"4","\u06F5":"5","\u06F6":"6","\u06F7":"7","\u06F8":"8","\u06F9":"9","\u0E3F":"baht","\u10D0":"a","\u10D1":"b","\u10D2":"g","\u10D3":"d","\u10D4":"e","\u10D5":"v","\u10D6":"z","\u10D7":"t","\u10D8":"i","\u10D9":"k","\u10DA":"l","\u10DB":"m","\u10DC":"n","\u10DD":"o","\u10DE":"p","\u10DF":"zh","\u10E0":"r","\u10E1":"s","\u10E2":"t","\u10E3":"u","\u10E4":"f","\u10E5":"k","\u10E6":"gh","\u10E7":"q","\u10E8":"sh","\u10E9":"ch","\u10EA":"ts","\u10EB":"dz","\u10EC":"ts","\u10ED":"ch","\u10EE":"kh","\u10EF":"j","\u10F0":"h","\u1E62":"S","\u1E63":"s","\u1E80":"W","\u1E81":"w","\u1E82":"W","\u1E83":"w","\u1E84":"W","\u1E85":"w","\u1E9E":"SS","\u1EA0":"A","\u1EA1":"a","\u1EA2":"A","\u1EA3":"a","\u1EA4":"A","\u1EA5":"a","\u1EA6":"A","\u1EA7":"a","\u1EA8":"A","\u1EA9":"a","\u1EAA":"A","\u1EAB":"a","\u1EAC":"A","\u1EAD":"a","\u1EAE":"A","\u1EAF":"a","\u1EB0":"A","\u1EB1":"a","\u1EB2":"A","\u1EB3":"a","\u1EB4":"A","\u1EB5":"a","\u1EB6":"A","\u1EB7":"a","\u1EB8":"E","\u1EB9":"e","\u1EBA":"E","\u1EBB":"e","\u1EBC":"E","\u1EBD":"e","\u1EBE":"E","\u1EBF":"e","\u1EC0":"E","\u1EC1":"e","\u1EC2":"E","\u1EC3":"e","\u1EC4":"E","\u1EC5":"e","\u1EC6":"E","\u1EC7":"e","\u1EC8":"I","\u1EC9":"i","\u1ECA":"I","\u1ECB":"i","\u1ECC":"O","\u1ECD":"o","\u1ECE":"O","\u1ECF":"o","\u1ED0":"O","\u1ED1":"o","\u1ED2":"O","\u1ED3":"o","\u1ED4":"O","\u1ED5":"o","\u1ED6":"O","\u1ED7":"o","\u1ED8":"O","\u1ED9":"o","\u1EDA":"O","\u1EDB":"o","\u1EDC":"O","\u1EDD":"o","\u1EDE":"O","\u1EDF":"o","\u1EE0":"O","\u1EE1":"o","\u1EE2":"O","\u1EE3":"o","\u1EE4":"U","\u1EE5":"u","\u1EE6":"U","\u1EE7":"u","\u1EE8":"U","\u1EE9":"u","\u1EEA":"U","\u1EEB":"u","\u1EEC":"U","\u1EED":"u","\u1EEE":"U","\u1EEF":"u","\u1EF0":"U","\u1EF1":"u","\u1EF2":"Y","\u1EF3":"y","\u1EF4":"Y","\u1EF5":"y","\u1EF6":"Y","\u1EF7":"y","\u1EF8":"Y","\u1EF9":"y","\u2013":"-","\u2018":"'","\u2019":"'","\u201C":"\\"","\u201D":"\\"","\u201E":"\\"","\u2020":"+","\u2022":"*","\u2026":"...","\u20A0":"ecu","\u20A2":"cruzeiro","\u20A3":"french franc","\u20A4":"lira","\u20A5":"mill","\u20A6":"naira","\u20A7":"peseta","\u20A8":"rupee","\u20A9":"won","\u20AA":"new shequel","\u20AB":"dong","\u20AC":"euro","\u20AD":"kip","\u20AE":"tugrik","\u20AF":"drachma","\u20B0":"penny","\u20B1":"peso","\u20B2":"guarani","\u20B3":"austral","\u20B4":"hryvnia","\u20B5":"cedi","\u20B8":"kazakhstani tenge","\u20B9":"indian rupee","\u20BA":"turkish lira","\u20BD":"russian ruble","\u20BF":"bitcoin","\u2120":"sm","\u2122":"tm","\u2202":"d","\u2206":"delta","\u2211":"sum","\u221E":"infinity","\u2665":"love","\u5143":"yuan","\u5186":"yen","\uFDFC":"rial","\uFEF5":"laa","\uFEF7":"laa","\uFEF9":"lai","\uFEFB":"la"}`);
11868
11799
  var locales = JSON.parse('{"bg":{"\u0419":"Y","\u0426":"Ts","\u0429":"Sht","\u042A":"A","\u042C":"Y","\u0439":"y","\u0446":"ts","\u0449":"sht","\u044A":"a","\u044C":"y"},"de":{"\xC4":"AE","\xE4":"ae","\xD6":"OE","\xF6":"oe","\xDC":"UE","\xFC":"ue","\xDF":"ss","%":"prozent","&":"und","|":"oder","\u2211":"summe","\u221E":"unendlich","\u2665":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","\xA2":"centavos","\xA3":"libras","\xA4":"moneda","\u20A3":"francos","\u2211":"suma","\u221E":"infinito","\u2665":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","\xA2":"centime","\xA3":"livre","\xA4":"devise","\u20A3":"franc","\u2211":"somme","\u221E":"infini","\u2665":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","\xA2":"centavo","\u2211":"soma","\xA3":"libra","\u221E":"infinito","\u2665":"amor"},"uk":{"\u0418":"Y","\u0438":"y","\u0419":"Y","\u0439":"y","\u0426":"Ts","\u0446":"ts","\u0425":"Kh","\u0445":"kh","\u0429":"Shch","\u0449":"shch","\u0413":"H","\u0433":"h"},"vi":{"\u0110":"D","\u0111":"d"},"da":{"\xD8":"OE","\xF8":"oe","\xC5":"AA","\xE5":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"st\xF8rre end"},"nb":{"&":"og","\xC5":"AA","\xC6":"AE","\xD8":"OE","\xE5":"aa","\xE6":"ae","\xF8":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","\xC5":"AA","\xC4":"AE","\xD6":"OE","\xE5":"aa","\xE4":"ae","\xF6":"oe"}}');
11869
11800
  init_consola_36c0034f();
11870
11801
  init_core();
@@ -11960,7 +11891,7 @@ function projectPath(filePath = "", options) {
11960
11891
  function storagePath(path2) {
11961
11892
  return projectPath(`storage/${path2 || ""}`);
11962
11893
  }
11963
- var config2 = {
11894
+ var config = {
11964
11895
  ai: {
11965
11896
  deploy: false,
11966
11897
  models: [
@@ -12537,7 +12468,7 @@ var config2 = {
12537
12468
  }
12538
12469
  }
12539
12470
  };
12540
- var defaults_default = config2;
12471
+ var defaults_default = config;
12541
12472
  var ai_default = {
12542
12473
  default: "meta.llama2-70b-chat-v1",
12543
12474
  models: [
@@ -16822,7 +16753,7 @@ var ui_default = {
16822
16753
  }
16823
16754
  }
16824
16755
  };
16825
- var config22 = {
16756
+ var config2 = {
16826
16757
  ai: ai_default,
16827
16758
  analytics: analytics_default,
16828
16759
  app: app_default,
@@ -16849,7 +16780,7 @@ var config22 = {
16849
16780
  team: team_default,
16850
16781
  ui: ui_default
16851
16782
  };
16852
- var overrides_default = config22;
16783
+ var overrides_default = config2;
16853
16784
  async function localTunnel(options) {
16854
16785
  const port = 3000;
16855
16786
  if (!options?.port)
@@ -17997,7 +17928,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
17997
17928
  return min;
17998
17929
  }
17999
17930
  if (process11.platform === "win32") {
18000
- const osRelease = os2.release().split(".");
17931
+ const osRelease = os.release().split(".");
18001
17932
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
18002
17933
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
18003
17934
  }
@@ -19013,7 +18944,7 @@ function deleteKeys(obj, ...keys) {
19013
18944
  });
19014
18945
  }
19015
18946
  var isArray = (item) => Array.isArray(item);
19016
- function isObject22(item) {
18947
+ function isObject2(item) {
19017
18948
  return typeof item === "object" && !Array.isArray(item) && item !== null;
19018
18949
  }
19019
18950
  var isFunction = (item) => typeof item === "function";
@@ -19794,7 +19725,7 @@ class Collection {
19794
19725
  }
19795
19726
  return new this.constructor(this.items.splice(-count));
19796
19727
  }
19797
- if (isObject22(this.items)) {
19728
+ if (isObject2(this.items)) {
19798
19729
  const keys = Object.keys(this.items);
19799
19730
  if (count === 1) {
19800
19731
  const key = keys[keys.length - 1];
@@ -19939,7 +19870,7 @@ class Collection {
19939
19870
  };
19940
19871
  if (isArray(this.items)) {
19941
19872
  result = this.items.findIndex(find);
19942
- } else if (isObject22(this.items)) {
19873
+ } else if (isObject2(this.items)) {
19943
19874
  result = Object.keys(this.items).find((key) => find(this.items[key], key));
19944
19875
  }
19945
19876
  if (result === undefined || result < 0) {
@@ -19957,7 +19888,7 @@ class Collection {
19957
19888
  }
19958
19889
  return new this.constructor(this.items.splice(0, count));
19959
19890
  }
19960
- if (isObject22(this.items)) {
19891
+ if (isObject2(this.items)) {
19961
19892
  if (count === 1) {
19962
19893
  const key = Object.keys(this.items)[0];
19963
19894
  const value = this.items[key];
@@ -19990,7 +19921,7 @@ class Collection {
19990
19921
  return this;
19991
19922
  }
19992
19923
  skip(number) {
19993
- if (isObject22(this.items)) {
19924
+ if (isObject2(this.items)) {
19994
19925
  return new this.constructor(Object.keys(this.items).reduce((accumulator, key, index) => {
19995
19926
  if (index + 1 > number) {
19996
19927
  accumulator[key] = this.items[key];
@@ -20015,7 +19946,7 @@ class Collection {
20015
19946
  return previous;
20016
19947
  });
20017
19948
  }
20018
- if (isObject22(this.items)) {
19949
+ if (isObject2(this.items)) {
20019
19950
  items = Object.keys(this.items).reduce((acc, key) => {
20020
19951
  if (previous !== true) {
20021
19952
  previous = callback(this.items[key]);
@@ -20043,7 +19974,7 @@ class Collection {
20043
19974
  return previous;
20044
19975
  });
20045
19976
  }
20046
- if (isObject22(this.items)) {
19977
+ if (isObject2(this.items)) {
20047
19978
  items = Object.keys(this.items).reduce((acc, key) => {
20048
19979
  if (previous !== true) {
20049
19980
  previous = !callback(this.items[key]);
@@ -20206,7 +20137,7 @@ class Collection {
20206
20137
  return previous;
20207
20138
  });
20208
20139
  }
20209
- if (isObject22(this.items)) {
20140
+ if (isObject2(this.items)) {
20210
20141
  items = Object.keys(this.items).reduce((acc, key) => {
20211
20142
  if (previous !== false) {
20212
20143
  previous = !callback(this.items[key]);
@@ -20234,7 +20165,7 @@ class Collection {
20234
20165
  return previous;
20235
20166
  });
20236
20167
  }
20237
- if (isObject22(this.items)) {
20168
+ if (isObject2(this.items)) {
20238
20169
  items = Object.keys(this.items).reduce((acc, key) => {
20239
20170
  if (previous !== false) {
20240
20171
  previous = callback(this.items[key]);
@@ -20489,7 +20420,7 @@ var buildKeyPathMap = function buildKeyPathMap2(items) {
20489
20420
  const keyPaths = {};
20490
20421
  items.forEach((item, index) => {
20491
20422
  function buildKeyPath(val, keyPath) {
20492
- if (isObject22(val)) {
20423
+ if (isObject2(val)) {
20493
20424
  Object.keys(val).forEach((prop) => {
20494
20425
  buildKeyPath(val[prop], `${keyPath}.${prop}`);
20495
20426
  });
@@ -20535,10 +20466,91 @@ var quotes = collect([
20535
20466
  "Security is mostly a superstition. Life is either a daring adventure or nothing."
20536
20467
  ]);
20537
20468
  var export_prompts = import_prompts.default;
20469
+ // package.json
20470
+ var version = "0.5.0";
20538
20471
 
20539
- // src/https.ts
20540
- import os5 from "os";
20472
+ // src/config.ts
20473
+ import { homedir } from "os";
20474
+ import { join as join2 } from "path";
20475
+
20476
+ // node_modules/bun-config/dist/index.js
20477
+ import { resolve } from "path";
20478
+ import process2 from "process";
20479
+ function deepMerge(target, source) {
20480
+ if (Array.isArray(source) && !Array.isArray(target)) {
20481
+ return source;
20482
+ }
20483
+ if (Array.isArray(source) && Array.isArray(target)) {
20484
+ return source.map((sourceItem, index) => {
20485
+ const targetItem = target[index];
20486
+ if (isObject3(sourceItem) && isObject3(targetItem)) {
20487
+ return deepMerge(targetItem, sourceItem);
20488
+ }
20489
+ return sourceItem;
20490
+ });
20491
+ }
20492
+ if (!isObject3(source) || !isObject3(target)) {
20493
+ return source;
20494
+ }
20495
+ const merged = { ...target };
20496
+ for (const key in source) {
20497
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
20498
+ const sourceValue = source[key];
20499
+ const targetValue = merged[key];
20500
+ if (sourceValue === null || sourceValue === undefined) {
20501
+ merged[key] = sourceValue;
20502
+ } else if (isObject3(sourceValue) && isObject3(targetValue)) {
20503
+ merged[key] = deepMerge(targetValue, sourceValue);
20504
+ } else {
20505
+ merged[key] = sourceValue;
20506
+ }
20507
+ }
20508
+ }
20509
+ return merged;
20510
+ }
20511
+ function isObject3(item) {
20512
+ return Boolean(item && typeof item === "object" && !Array.isArray(item));
20513
+ }
20514
+ async function loadConfig({ name, cwd, defaultConfig }) {
20515
+ const configPath = resolve(cwd || process2.cwd(), `${name}.config`);
20516
+ try {
20517
+ const importedConfig = await import(configPath);
20518
+ const loadedConfig = importedConfig.default || importedConfig;
20519
+ return deepMerge(defaultConfig, loadedConfig);
20520
+ } catch (error) {
20521
+ return defaultConfig;
20522
+ }
20523
+ }
20524
+
20525
+ // src/config.ts
20526
+ var defaultConfig = {
20527
+ from: "localhost:5173",
20528
+ to: "stacks.localhost",
20529
+ https: {
20530
+ basePath: "",
20531
+ caCertPath: join2(homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
20532
+ certPath: join2(homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
20533
+ keyPath: join2(homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`)
20534
+ },
20535
+ etcHostsCleanup: true,
20536
+ verbose: true
20537
+ };
20538
+ var config4 = await loadConfig({
20539
+ name: "reverse-proxy",
20540
+ defaultConfig
20541
+ });
20542
+
20543
+ // src/hosts.ts
20544
+ import { spawn } from "child_process";
20545
+ import fs5 from "fs";
20546
+ import os3 from "os";
20541
20547
  import path4 from "path";
20548
+ import process3 from "process";
20549
+
20550
+ // src/https.ts
20551
+ import fs3 from "fs/promises";
20552
+ import { homedir as homedir2 } from "os";
20553
+ import { join as join4 } from "path";
20542
20554
 
20543
20555
  // node_modules/@stacksjs/tlsx/dist/index.js
20544
20556
  import fs2 from "fs";
@@ -20562,7 +20574,7 @@ import {
20562
20574
  dirname as dirname3,
20563
20575
  extname as extname2,
20564
20576
  isAbsolute as isAbsolute2,
20565
- join as join2,
20577
+ join as join3,
20566
20578
  normalize as normalize2,
20567
20579
  parse as parse2,
20568
20580
  relative as relative2,
@@ -20577,7 +20589,7 @@ import process8 from "process";
20577
20589
  import process102 from "process";
20578
20590
  import process182 from "process";
20579
20591
  import process112 from "process";
20580
- import os3 from "os";
20592
+ import os2 from "os";
20581
20593
  import tty32 from "tty";
20582
20594
  import process142 from "process";
20583
20595
  import process132 from "process";
@@ -20586,11 +20598,11 @@ import process162 from "process";
20586
20598
  import process172 from "process";
20587
20599
  import process192 from "process";
20588
20600
  import os22 from "os";
20589
- import path2 from "path";
20601
+ import path from "path";
20590
20602
  import { resolve as resolve3 } from "path";
20591
20603
  import process22 from "process";
20592
20604
  import fs from "fs";
20593
- import path22 from "path";
20605
+ import path2 from "path";
20594
20606
  var __create3 = Object.create;
20595
20607
  var __getProtoOf3 = Object.getPrototypeOf;
20596
20608
  var __defProp3 = Object.defineProperty;
@@ -32652,14 +32664,14 @@ var require_tls = __commonJS2((exports, module) => {
32652
32664
  c2.version = c2.session.version = session.version;
32653
32665
  c2.session.sp = session.sp;
32654
32666
  } else {
32655
- var version;
32667
+ var version2;
32656
32668
  for (var i = 1;i < tls.SupportedVersions.length; ++i) {
32657
- version = tls.SupportedVersions[i];
32658
- if (version.minor <= msg.version.minor) {
32669
+ version2 = tls.SupportedVersions[i];
32670
+ if (version2.minor <= msg.version.minor) {
32659
32671
  break;
32660
32672
  }
32661
32673
  }
32662
- c2.version = { major: version.major, minor: version.minor };
32674
+ c2.version = { major: version2.major, minor: version2.minor };
32663
32675
  c2.session.version = c2.version;
32664
32676
  }
32665
32677
  if (session !== null) {
@@ -32830,8 +32842,8 @@ var require_tls = __commonJS2((exports, module) => {
32830
32842
  try {
32831
32843
  var sp = c2.session.sp;
32832
32844
  sp.pre_master_secret = privateKey.decrypt(msg.enc_pre_master_secret);
32833
- var version = c2.session.clientHelloVersion;
32834
- if (version.major !== sp.pre_master_secret.charCodeAt(0) || version.minor !== sp.pre_master_secret.charCodeAt(1)) {
32845
+ var version2 = c2.session.clientHelloVersion;
32846
+ if (version2.major !== sp.pre_master_secret.charCodeAt(0) || version2.minor !== sp.pre_master_secret.charCodeAt(1)) {
32835
32847
  throw new Error("TLS version rollback attack detected.");
32836
32848
  }
32837
32849
  } catch (ex) {
@@ -36933,11 +36945,11 @@ var __export3 = (target, all) => {
36933
36945
  });
36934
36946
  };
36935
36947
  var __esm2 = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
36936
- function isObject3(value) {
36948
+ function isObject5(value) {
36937
36949
  return value !== null && typeof value === "object";
36938
36950
  }
36939
36951
  function _defu2(baseObject, defaults, namespace = ".", merger) {
36940
- if (!isObject3(defaults)) {
36952
+ if (!isObject5(defaults)) {
36941
36953
  return _defu2(baseObject, {}, namespace, merger);
36942
36954
  }
36943
36955
  const object = Object.assign({}, defaults);
@@ -36954,7 +36966,7 @@ function _defu2(baseObject, defaults, namespace = ".", merger) {
36954
36966
  }
36955
36967
  if (Array.isArray(value) && Array.isArray(object[key])) {
36956
36968
  object[key] = [...value, ...object[key]];
36957
- } else if (isObject3(value) && isObject3(object[key])) {
36969
+ } else if (isObject5(value) && isObject5(object[key])) {
36958
36970
  object[key] = _defu2(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
36959
36971
  } else {
36960
36972
  object[key] = value;
@@ -38809,16 +38821,16 @@ var require_isIP2 = __commonJS22((exports, module) => {
38809
38821
  var IPv6SegmentFormat = "(?:[0-9a-fA-F]{1,4})";
38810
38822
  var IPv6AddressRegExp = new RegExp("^(" + "(?:".concat(IPv6SegmentFormat, ":){7}(?:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){6}(?:").concat(IPv4AddressFormat, "|:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){5}(?::").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,2}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){4}(?:(:").concat(IPv6SegmentFormat, "){0,1}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,3}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){3}(?:(:").concat(IPv6SegmentFormat, "){0,2}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,4}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){2}(?:(:").concat(IPv6SegmentFormat, "){0,3}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,5}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){1}(?:(:").concat(IPv6SegmentFormat, "){0,4}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,6}|:)|") + "(?::((?::".concat(IPv6SegmentFormat, "){0,5}:").concat(IPv4AddressFormat, "|(?::").concat(IPv6SegmentFormat, "){1,7}|:))") + ")(%[0-9a-zA-Z-.:]{1,})?$");
38811
38823
  function isIP(str) {
38812
- var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
38824
+ var version2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
38813
38825
  (0, _assertString.default)(str);
38814
- version = String(version);
38815
- if (!version) {
38826
+ version2 = String(version2);
38827
+ if (!version2) {
38816
38828
  return isIP(str, 4) || isIP(str, 6);
38817
38829
  }
38818
- if (version === "4") {
38830
+ if (version2 === "4") {
38819
38831
  return IPv4AddressRegExp.test(str);
38820
38832
  }
38821
- if (version === "6") {
38833
+ if (version2 === "6") {
38822
38834
  return IPv6AddressRegExp.test(str);
38823
38835
  }
38824
38836
  return false;
@@ -39341,9 +39353,9 @@ var require_isUUID2 = __commonJS22((exports, module) => {
39341
39353
  7: /^[0-9A-F]{8}-[0-9A-F]{4}-7[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
39342
39354
  all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i
39343
39355
  };
39344
- function isUUID(str, version) {
39356
+ function isUUID(str, version2) {
39345
39357
  (0, _assertString.default)(str);
39346
- var pattern = uuid[![undefined, null].includes(version) ? version : "all"];
39358
+ var pattern = uuid[![undefined, null].includes(version2) ? version2 : "all"];
39347
39359
  return !!pattern && pattern.test(str);
39348
39360
  }
39349
39361
  module.exports = exports.default;
@@ -48042,7 +48054,7 @@ pluralize2.addIrregularRule = (single, plural) => {
48042
48054
  /pox$/i,
48043
48055
  /sheep$/i
48044
48056
  ].forEach(pluralize2.addUncountableRule);
48045
- var charMap2 = JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\u00FF":"y","\u0100":"A","\u0101":"a","\u0102":"A","\u0103":"a","\u0104":"A","\u0105":"a","\u0106":"C","\u0107":"c","\u010C":"C","\u010D":"c","\u010E":"D","\u010F":"d","\u0110":"DJ","\u0111":"dj","\u0112":"E","\u0113":"e","\u0116":"E","\u0117":"e","\u0118":"e","\u0119":"e","\u011A":"E","\u011B":"e","\u011E":"G","\u011F":"g","\u0122":"G","\u0123":"g","\u0128":"I","\u0129":"i","\u012A":"i","\u012B":"i","\u012E":"I","\u012F":"i","\u0130":"I","\u0131":"i","\u0136":"k","\u0137":"k","\u013B":"L","\u013C":"l","\u013D":"L","\u013E":"l","\u0141":"L","\u0142":"l","\u0143":"N","\u0144":"n","\u0145":"N","\u0146":"n","\u0147":"N","\u0148":"n","\u014C":"O","\u014D":"o","\u0150":"O","\u0151":"o","\u0152":"OE","\u0153":"oe","\u0154":"R","\u0155":"r","\u0158":"R","\u0159":"r","\u015A":"S","\u015B":"s","\u015E":"S","\u015F":"s","\u0160":"S","\u0161":"s","\u0162":"T","\u0163":"t","\u0164":"T","\u0165":"t","\u0168":"U","\u0169":"u","\u016A":"u","\u016B":"u","\u016E":"U","\u016F":"u","\u0170":"U","\u0171":"u","\u0172":"U","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017A":"z","\u017B":"Z","\u017C":"z","\u017D":"Z","\u017E":"z","\u018F":"E","\u0192":"f","\u01A0":"O","\u01A1":"o","\u01AF":"U","\u01B0":"u","\u01C8":"LJ","\u01C9":"lj","\u01CB":"NJ","\u01CC":"nj","\u0218":"S","\u0219":"s","\u021A":"T","\u021B":"t","\u0259":"e","\u02DA":"o","\u0386":"A","\u0388":"E","\u0389":"H","\u038A":"I","\u038C":"O","\u038E":"Y","\u038F":"W","\u0390":"i","\u0391":"A","\u0392":"B","\u0393":"G","\u0394":"D","\u0395":"E","\u0396":"Z","\u0397":"H","\u0398":"8","\u0399":"I","\u039A":"K","\u039B":"L","\u039C":"M","\u039D":"N","\u039E":"3","\u039F":"O","\u03A0":"P","\u03A1":"R","\u03A3":"S","\u03A4":"T","\u03A5":"Y","\u03A6":"F","\u03A7":"X","\u03A8":"PS","\u03A9":"W","\u03AA":"I","\u03AB":"Y","\u03AC":"a","\u03AD":"e","\u03AE":"h","\u03AF":"i","\u03B0":"y","\u03B1":"a","\u03B2":"b","\u03B3":"g","\u03B4":"d","\u03B5":"e","\u03B6":"z","\u03B7":"h","\u03B8":"8","\u03B9":"i","\u03BA":"k","\u03BB":"l","\u03BC":"m","\u03BD":"n","\u03BE":"3","\u03BF":"o","\u03C0":"p","\u03C1":"r","\u03C2":"s","\u03C3":"s","\u03C4":"t","\u03C5":"y","\u03C6":"f","\u03C7":"x","\u03C8":"ps","\u03C9":"w","\u03CA":"i","\u03CB":"y","\u03CC":"o","\u03CD":"y","\u03CE":"w","\u0401":"Yo","\u0402":"DJ","\u0404":"Ye","\u0406":"I","\u0407":"Yi","\u0408":"J","\u0409":"LJ","\u040A":"NJ","\u040B":"C","\u040F":"DZ","\u0410":"A","\u0411":"B","\u0412":"V","\u0413":"G","\u0414":"D","\u0415":"E","\u0416":"Zh","\u0417":"Z","\u0418":"I","\u0419":"J","\u041A":"K","\u041B":"L","\u041C":"M","\u041D":"N","\u041E":"O","\u041F":"P","\u0420":"R","\u0421":"S","\u0422":"T","\u0423":"U","\u0424":"F","\u0425":"H","\u0426":"C","\u0427":"Ch","\u0428":"Sh","\u0429":"Sh","\u042A":"U","\u042B":"Y","\u042C":"","\u042D":"E","\u042E":"Yu","\u042F":"Ya","\u0430":"a","\u0431":"b","\u0432":"v","\u0433":"g","\u0434":"d","\u0435":"e","\u0436":"zh","\u0437":"z","\u0438":"i","\u0439":"j","\u043A":"k","\u043B":"l","\u043C":"m","\u043D":"n","\u043E":"o","\u043F":"p","\u0440":"r","\u0441":"s","\u0442":"t","\u0443":"u","\u0444":"f","\u0445":"h","\u0446":"c","\u0447":"ch","\u0448":"sh","\u0449":"sh","\u044A":"u","\u044B":"y","\u044C":"","\u044D":"e","\u044E":"yu","\u044F":"ya","\u0451":"yo","\u0452":"dj","\u0454":"ye","\u0456":"i","\u0457":"yi","\u0458":"j","\u0459":"lj","\u045A":"nj","\u045B":"c","\u045D":"u","\u045F":"dz","\u0490":"G","\u0491":"g","\u0492":"GH","\u0493":"gh","\u049A":"KH","\u049B":"kh","\u04A2":"NG","\u04A3":"ng","\u04AE":"UE","\u04AF":"ue","\u04B0":"U","\u04B1":"u","\u04BA":"H","\u04BB":"h","\u04D8":"AE","\u04D9":"ae","\u04E8":"OE","\u04E9":"oe","\u0531":"A","\u0532":"B","\u0533":"G","\u0534":"D","\u0535":"E","\u0536":"Z","\u0537":"E'","\u0538":"Y'","\u0539":"T'","\u053A":"JH","\u053B":"I","\u053C":"L","\u053D":"X","\u053E":"C'","\u053F":"K","\u0540":"H","\u0541":"D'","\u0542":"GH","\u0543":"TW","\u0544":"M","\u0545":"Y","\u0546":"N","\u0547":"SH","\u0549":"CH","\u054A":"P","\u054B":"J","\u054C":"R'","\u054D":"S","\u054E":"V","\u054F":"T","\u0550":"R","\u0551":"C","\u0553":"P'","\u0554":"Q'","\u0555":"O''","\u0556":"F","\u0587":"EV","\u0621":"a","\u0622":"aa","\u0623":"a","\u0624":"u","\u0625":"i","\u0626":"e","\u0627":"a","\u0628":"b","\u0629":"h","\u062A":"t","\u062B":"th","\u062C":"j","\u062D":"h","\u062E":"kh","\u062F":"d","\u0630":"th","\u0631":"r","\u0632":"z","\u0633":"s","\u0634":"sh","\u0635":"s","\u0636":"dh","\u0637":"t","\u0638":"z","\u0639":"a","\u063A":"gh","\u0641":"f","\u0642":"q","\u0643":"k","\u0644":"l","\u0645":"m","\u0646":"n","\u0647":"h","\u0648":"w","\u0649":"a","\u064A":"y","\u064B":"an","\u064C":"on","\u064D":"en","\u064E":"a","\u064F":"u","\u0650":"e","\u0652":"","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u067E":"p","\u0686":"ch","\u0698":"zh","\u06A9":"k","\u06AF":"g","\u06CC":"y","\u06F0":"0","\u06F1":"1","\u06F2":"2","\u06F3":"3","\u06F4":"4","\u06F5":"5","\u06F6":"6","\u06F7":"7","\u06F8":"8","\u06F9":"9","\u0E3F":"baht","\u10D0":"a","\u10D1":"b","\u10D2":"g","\u10D3":"d","\u10D4":"e","\u10D5":"v","\u10D6":"z","\u10D7":"t","\u10D8":"i","\u10D9":"k","\u10DA":"l","\u10DB":"m","\u10DC":"n","\u10DD":"o","\u10DE":"p","\u10DF":"zh","\u10E0":"r","\u10E1":"s","\u10E2":"t","\u10E3":"u","\u10E4":"f","\u10E5":"k","\u10E6":"gh","\u10E7":"q","\u10E8":"sh","\u10E9":"ch","\u10EA":"ts","\u10EB":"dz","\u10EC":"ts","\u10ED":"ch","\u10EE":"kh","\u10EF":"j","\u10F0":"h","\u1E62":"S","\u1E63":"s","\u1E80":"W","\u1E81":"w","\u1E82":"W","\u1E83":"w","\u1E84":"W","\u1E85":"w","\u1E9E":"SS","\u1EA0":"A","\u1EA1":"a","\u1EA2":"A","\u1EA3":"a","\u1EA4":"A","\u1EA5":"a","\u1EA6":"A","\u1EA7":"a","\u1EA8":"A","\u1EA9":"a","\u1EAA":"A","\u1EAB":"a","\u1EAC":"A","\u1EAD":"a","\u1EAE":"A","\u1EAF":"a","\u1EB0":"A","\u1EB1":"a","\u1EB2":"A","\u1EB3":"a","\u1EB4":"A","\u1EB5":"a","\u1EB6":"A","\u1EB7":"a","\u1EB8":"E","\u1EB9":"e","\u1EBA":"E","\u1EBB":"e","\u1EBC":"E","\u1EBD":"e","\u1EBE":"E","\u1EBF":"e","\u1EC0":"E","\u1EC1":"e","\u1EC2":"E","\u1EC3":"e","\u1EC4":"E","\u1EC5":"e","\u1EC6":"E","\u1EC7":"e","\u1EC8":"I","\u1EC9":"i","\u1ECA":"I","\u1ECB":"i","\u1ECC":"O","\u1ECD":"o","\u1ECE":"O","\u1ECF":"o","\u1ED0":"O","\u1ED1":"o","\u1ED2":"O","\u1ED3":"o","\u1ED4":"O","\u1ED5":"o","\u1ED6":"O","\u1ED7":"o","\u1ED8":"O","\u1ED9":"o","\u1EDA":"O","\u1EDB":"o","\u1EDC":"O","\u1EDD":"o","\u1EDE":"O","\u1EDF":"o","\u1EE0":"O","\u1EE1":"o","\u1EE2":"O","\u1EE3":"o","\u1EE4":"U","\u1EE5":"u","\u1EE6":"U","\u1EE7":"u","\u1EE8":"U","\u1EE9":"u","\u1EEA":"U","\u1EEB":"u","\u1EEC":"U","\u1EED":"u","\u1EEE":"U","\u1EEF":"u","\u1EF0":"U","\u1EF1":"u","\u1EF2":"Y","\u1EF3":"y","\u1EF4":"Y","\u1EF5":"y","\u1EF6":"Y","\u1EF7":"y","\u1EF8":"Y","\u1EF9":"y","\u2013":"-","\u2018":"'","\u2019":"'","\u201C":"\\"","\u201D":"\\"","\u201E":"\\"","\u2020":"+","\u2022":"*","\u2026":"...","\u20A0":"ecu","\u20A2":"cruzeiro","\u20A3":"french franc","\u20A4":"lira","\u20A5":"mill","\u20A6":"naira","\u20A7":"peseta","\u20A8":"rupee","\u20A9":"won","\u20AA":"new shequel","\u20AB":"dong","\u20AC":"euro","\u20AD":"kip","\u20AE":"tugrik","\u20AF":"drachma","\u20B0":"penny","\u20B1":"peso","\u20B2":"guarani","\u20B3":"austral","\u20B4":"hryvnia","\u20B5":"cedi","\u20B8":"kazakhstani tenge","\u20B9":"indian rupee","\u20BA":"turkish lira","\u20BD":"russian ruble","\u20BF":"bitcoin","\u2120":"sm","\u2122":"tm","\u2202":"d","\u2206":"delta","\u2211":"sum","\u221E":"infinity","\u2665":"love","\u5143":"yuan","\u5186":"yen","\uFDFC":"rial","\uFEF5":"laa","\uFEF7":"laa","\uFEF9":"lai","\uFEFB":"la"}`);
48057
+ var charMap2 = JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\xFF":"y","\u0100":"A","\u0101":"a","\u0102":"A","\u0103":"a","\u0104":"A","\u0105":"a","\u0106":"C","\u0107":"c","\u010C":"C","\u010D":"c","\u010E":"D","\u010F":"d","\u0110":"DJ","\u0111":"dj","\u0112":"E","\u0113":"e","\u0116":"E","\u0117":"e","\u0118":"e","\u0119":"e","\u011A":"E","\u011B":"e","\u011E":"G","\u011F":"g","\u0122":"G","\u0123":"g","\u0128":"I","\u0129":"i","\u012A":"i","\u012B":"i","\u012E":"I","\u012F":"i","\u0130":"I","\u0131":"i","\u0136":"k","\u0137":"k","\u013B":"L","\u013C":"l","\u013D":"L","\u013E":"l","\u0141":"L","\u0142":"l","\u0143":"N","\u0144":"n","\u0145":"N","\u0146":"n","\u0147":"N","\u0148":"n","\u014C":"O","\u014D":"o","\u0150":"O","\u0151":"o","\u0152":"OE","\u0153":"oe","\u0154":"R","\u0155":"r","\u0158":"R","\u0159":"r","\u015A":"S","\u015B":"s","\u015E":"S","\u015F":"s","\u0160":"S","\u0161":"s","\u0162":"T","\u0163":"t","\u0164":"T","\u0165":"t","\u0168":"U","\u0169":"u","\u016A":"u","\u016B":"u","\u016E":"U","\u016F":"u","\u0170":"U","\u0171":"u","\u0172":"U","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017A":"z","\u017B":"Z","\u017C":"z","\u017D":"Z","\u017E":"z","\u018F":"E","\u0192":"f","\u01A0":"O","\u01A1":"o","\u01AF":"U","\u01B0":"u","\u01C8":"LJ","\u01C9":"lj","\u01CB":"NJ","\u01CC":"nj","\u0218":"S","\u0219":"s","\u021A":"T","\u021B":"t","\u0259":"e","\u02DA":"o","\u0386":"A","\u0388":"E","\u0389":"H","\u038A":"I","\u038C":"O","\u038E":"Y","\u038F":"W","\u0390":"i","\u0391":"A","\u0392":"B","\u0393":"G","\u0394":"D","\u0395":"E","\u0396":"Z","\u0397":"H","\u0398":"8","\u0399":"I","\u039A":"K","\u039B":"L","\u039C":"M","\u039D":"N","\u039E":"3","\u039F":"O","\u03A0":"P","\u03A1":"R","\u03A3":"S","\u03A4":"T","\u03A5":"Y","\u03A6":"F","\u03A7":"X","\u03A8":"PS","\u03A9":"W","\u03AA":"I","\u03AB":"Y","\u03AC":"a","\u03AD":"e","\u03AE":"h","\u03AF":"i","\u03B0":"y","\u03B1":"a","\u03B2":"b","\u03B3":"g","\u03B4":"d","\u03B5":"e","\u03B6":"z","\u03B7":"h","\u03B8":"8","\u03B9":"i","\u03BA":"k","\u03BB":"l","\u03BC":"m","\u03BD":"n","\u03BE":"3","\u03BF":"o","\u03C0":"p","\u03C1":"r","\u03C2":"s","\u03C3":"s","\u03C4":"t","\u03C5":"y","\u03C6":"f","\u03C7":"x","\u03C8":"ps","\u03C9":"w","\u03CA":"i","\u03CB":"y","\u03CC":"o","\u03CD":"y","\u03CE":"w","\u0401":"Yo","\u0402":"DJ","\u0404":"Ye","\u0406":"I","\u0407":"Yi","\u0408":"J","\u0409":"LJ","\u040A":"NJ","\u040B":"C","\u040F":"DZ","\u0410":"A","\u0411":"B","\u0412":"V","\u0413":"G","\u0414":"D","\u0415":"E","\u0416":"Zh","\u0417":"Z","\u0418":"I","\u0419":"J","\u041A":"K","\u041B":"L","\u041C":"M","\u041D":"N","\u041E":"O","\u041F":"P","\u0420":"R","\u0421":"S","\u0422":"T","\u0423":"U","\u0424":"F","\u0425":"H","\u0426":"C","\u0427":"Ch","\u0428":"Sh","\u0429":"Sh","\u042A":"U","\u042B":"Y","\u042C":"","\u042D":"E","\u042E":"Yu","\u042F":"Ya","\u0430":"a","\u0431":"b","\u0432":"v","\u0433":"g","\u0434":"d","\u0435":"e","\u0436":"zh","\u0437":"z","\u0438":"i","\u0439":"j","\u043A":"k","\u043B":"l","\u043C":"m","\u043D":"n","\u043E":"o","\u043F":"p","\u0440":"r","\u0441":"s","\u0442":"t","\u0443":"u","\u0444":"f","\u0445":"h","\u0446":"c","\u0447":"ch","\u0448":"sh","\u0449":"sh","\u044A":"u","\u044B":"y","\u044C":"","\u044D":"e","\u044E":"yu","\u044F":"ya","\u0451":"yo","\u0452":"dj","\u0454":"ye","\u0456":"i","\u0457":"yi","\u0458":"j","\u0459":"lj","\u045A":"nj","\u045B":"c","\u045D":"u","\u045F":"dz","\u0490":"G","\u0491":"g","\u0492":"GH","\u0493":"gh","\u049A":"KH","\u049B":"kh","\u04A2":"NG","\u04A3":"ng","\u04AE":"UE","\u04AF":"ue","\u04B0":"U","\u04B1":"u","\u04BA":"H","\u04BB":"h","\u04D8":"AE","\u04D9":"ae","\u04E8":"OE","\u04E9":"oe","\u0531":"A","\u0532":"B","\u0533":"G","\u0534":"D","\u0535":"E","\u0536":"Z","\u0537":"E'","\u0538":"Y'","\u0539":"T'","\u053A":"JH","\u053B":"I","\u053C":"L","\u053D":"X","\u053E":"C'","\u053F":"K","\u0540":"H","\u0541":"D'","\u0542":"GH","\u0543":"TW","\u0544":"M","\u0545":"Y","\u0546":"N","\u0547":"SH","\u0549":"CH","\u054A":"P","\u054B":"J","\u054C":"R'","\u054D":"S","\u054E":"V","\u054F":"T","\u0550":"R","\u0551":"C","\u0553":"P'","\u0554":"Q'","\u0555":"O''","\u0556":"F","\u0587":"EV","\u0621":"a","\u0622":"aa","\u0623":"a","\u0624":"u","\u0625":"i","\u0626":"e","\u0627":"a","\u0628":"b","\u0629":"h","\u062A":"t","\u062B":"th","\u062C":"j","\u062D":"h","\u062E":"kh","\u062F":"d","\u0630":"th","\u0631":"r","\u0632":"z","\u0633":"s","\u0634":"sh","\u0635":"s","\u0636":"dh","\u0637":"t","\u0638":"z","\u0639":"a","\u063A":"gh","\u0641":"f","\u0642":"q","\u0643":"k","\u0644":"l","\u0645":"m","\u0646":"n","\u0647":"h","\u0648":"w","\u0649":"a","\u064A":"y","\u064B":"an","\u064C":"on","\u064D":"en","\u064E":"a","\u064F":"u","\u0650":"e","\u0652":"","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u067E":"p","\u0686":"ch","\u0698":"zh","\u06A9":"k","\u06AF":"g","\u06CC":"y","\u06F0":"0","\u06F1":"1","\u06F2":"2","\u06F3":"3","\u06F4":"4","\u06F5":"5","\u06F6":"6","\u06F7":"7","\u06F8":"8","\u06F9":"9","\u0E3F":"baht","\u10D0":"a","\u10D1":"b","\u10D2":"g","\u10D3":"d","\u10D4":"e","\u10D5":"v","\u10D6":"z","\u10D7":"t","\u10D8":"i","\u10D9":"k","\u10DA":"l","\u10DB":"m","\u10DC":"n","\u10DD":"o","\u10DE":"p","\u10DF":"zh","\u10E0":"r","\u10E1":"s","\u10E2":"t","\u10E3":"u","\u10E4":"f","\u10E5":"k","\u10E6":"gh","\u10E7":"q","\u10E8":"sh","\u10E9":"ch","\u10EA":"ts","\u10EB":"dz","\u10EC":"ts","\u10ED":"ch","\u10EE":"kh","\u10EF":"j","\u10F0":"h","\u1E62":"S","\u1E63":"s","\u1E80":"W","\u1E81":"w","\u1E82":"W","\u1E83":"w","\u1E84":"W","\u1E85":"w","\u1E9E":"SS","\u1EA0":"A","\u1EA1":"a","\u1EA2":"A","\u1EA3":"a","\u1EA4":"A","\u1EA5":"a","\u1EA6":"A","\u1EA7":"a","\u1EA8":"A","\u1EA9":"a","\u1EAA":"A","\u1EAB":"a","\u1EAC":"A","\u1EAD":"a","\u1EAE":"A","\u1EAF":"a","\u1EB0":"A","\u1EB1":"a","\u1EB2":"A","\u1EB3":"a","\u1EB4":"A","\u1EB5":"a","\u1EB6":"A","\u1EB7":"a","\u1EB8":"E","\u1EB9":"e","\u1EBA":"E","\u1EBB":"e","\u1EBC":"E","\u1EBD":"e","\u1EBE":"E","\u1EBF":"e","\u1EC0":"E","\u1EC1":"e","\u1EC2":"E","\u1EC3":"e","\u1EC4":"E","\u1EC5":"e","\u1EC6":"E","\u1EC7":"e","\u1EC8":"I","\u1EC9":"i","\u1ECA":"I","\u1ECB":"i","\u1ECC":"O","\u1ECD":"o","\u1ECE":"O","\u1ECF":"o","\u1ED0":"O","\u1ED1":"o","\u1ED2":"O","\u1ED3":"o","\u1ED4":"O","\u1ED5":"o","\u1ED6":"O","\u1ED7":"o","\u1ED8":"O","\u1ED9":"o","\u1EDA":"O","\u1EDB":"o","\u1EDC":"O","\u1EDD":"o","\u1EDE":"O","\u1EDF":"o","\u1EE0":"O","\u1EE1":"o","\u1EE2":"O","\u1EE3":"o","\u1EE4":"U","\u1EE5":"u","\u1EE6":"U","\u1EE7":"u","\u1EE8":"U","\u1EE9":"u","\u1EEA":"U","\u1EEB":"u","\u1EEC":"U","\u1EED":"u","\u1EEE":"U","\u1EEF":"u","\u1EF0":"U","\u1EF1":"u","\u1EF2":"Y","\u1EF3":"y","\u1EF4":"Y","\u1EF5":"y","\u1EF6":"Y","\u1EF7":"y","\u1EF8":"Y","\u1EF9":"y","\u2013":"-","\u2018":"'","\u2019":"'","\u201C":"\\"","\u201D":"\\"","\u201E":"\\"","\u2020":"+","\u2022":"*","\u2026":"...","\u20A0":"ecu","\u20A2":"cruzeiro","\u20A3":"french franc","\u20A4":"lira","\u20A5":"mill","\u20A6":"naira","\u20A7":"peseta","\u20A8":"rupee","\u20A9":"won","\u20AA":"new shequel","\u20AB":"dong","\u20AC":"euro","\u20AD":"kip","\u20AE":"tugrik","\u20AF":"drachma","\u20B0":"penny","\u20B1":"peso","\u20B2":"guarani","\u20B3":"austral","\u20B4":"hryvnia","\u20B5":"cedi","\u20B8":"kazakhstani tenge","\u20B9":"indian rupee","\u20BA":"turkish lira","\u20BD":"russian ruble","\u20BF":"bitcoin","\u2120":"sm","\u2122":"tm","\u2202":"d","\u2206":"delta","\u2211":"sum","\u221E":"infinity","\u2665":"love","\u5143":"yuan","\u5186":"yen","\uFDFC":"rial","\uFEF5":"laa","\uFEF7":"laa","\uFEF9":"lai","\uFEFB":"la"}`);
48046
48058
  var locales2 = JSON.parse('{"bg":{"\u0419":"Y","\u0426":"Ts","\u0429":"Sht","\u042A":"A","\u042C":"Y","\u0439":"y","\u0446":"ts","\u0449":"sht","\u044A":"a","\u044C":"y"},"de":{"\xC4":"AE","\xE4":"ae","\xD6":"OE","\xF6":"oe","\xDC":"UE","\xFC":"ue","\xDF":"ss","%":"prozent","&":"und","|":"oder","\u2211":"summe","\u221E":"unendlich","\u2665":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","\xA2":"centavos","\xA3":"libras","\xA4":"moneda","\u20A3":"francos","\u2211":"suma","\u221E":"infinito","\u2665":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","\xA2":"centime","\xA3":"livre","\xA4":"devise","\u20A3":"franc","\u2211":"somme","\u221E":"infini","\u2665":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","\xA2":"centavo","\u2211":"soma","\xA3":"libra","\u221E":"infinito","\u2665":"amor"},"uk":{"\u0418":"Y","\u0438":"y","\u0419":"Y","\u0439":"y","\u0426":"Ts","\u0446":"ts","\u0425":"Kh","\u0445":"kh","\u0429":"Shch","\u0449":"shch","\u0413":"H","\u0433":"h"},"vi":{"\u0110":"D","\u0111":"d"},"da":{"\xD8":"OE","\xF8":"oe","\xC5":"AA","\xE5":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"st\xF8rre end"},"nb":{"&":"og","\xC5":"AA","\xC6":"AE","\xD8":"OE","\xE5":"aa","\xE6":"ae","\xF8":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","\xC5":"AA","\xC4":"AE","\xD6":"OE","\xE5":"aa","\xE4":"ae","\xF6":"oe"}}');
48047
48059
  init_consola_36c0034f2();
48048
48060
  init_core2();
@@ -48114,31 +48126,31 @@ var log2 = {
48114
48126
  },
48115
48127
  echo: (...args) => console.log(...args)
48116
48128
  };
48117
- function userDatabasePath2(path23) {
48118
- return projectPath2(`database/${path23 || ""}`);
48129
+ function userDatabasePath2(path22) {
48130
+ return projectPath2(`database/${path22 || ""}`);
48119
48131
  }
48120
- function appPath2(path23) {
48121
- return projectPath2(`app/${path23 || ""}`);
48132
+ function appPath2(path22) {
48133
+ return projectPath2(`app/${path22 || ""}`);
48122
48134
  }
48123
- function commandsPath2(path23) {
48124
- return appPath2(`Commands/${path23 || ""}`);
48135
+ function commandsPath2(path22) {
48136
+ return appPath2(`Commands/${path22 || ""}`);
48125
48137
  }
48126
- function logsPath2(path23) {
48127
- return storagePath2(`logs/${path23 || ""}`);
48138
+ function logsPath2(path22) {
48139
+ return storagePath2(`logs/${path22 || ""}`);
48128
48140
  }
48129
48141
  function projectPath2(filePath = "", options2) {
48130
- let path23 = process52.cwd();
48131
- while (path23.includes("storage"))
48132
- path23 = resolve22(path23, "..");
48133
- const finalPath = resolve22(path23, filePath);
48142
+ let path22 = process52.cwd();
48143
+ while (path22.includes("storage"))
48144
+ path22 = resolve22(path22, "..");
48145
+ const finalPath = resolve22(path22, filePath);
48134
48146
  if (options2?.relative)
48135
48147
  return relative2(process52.cwd(), finalPath);
48136
48148
  return finalPath;
48137
48149
  }
48138
- function storagePath2(path23) {
48139
- return projectPath2(`storage/${path23 || ""}`);
48150
+ function storagePath2(path22) {
48151
+ return projectPath2(`storage/${path22 || ""}`);
48140
48152
  }
48141
- var config4 = {
48153
+ var config6 = {
48142
48154
  ai: {
48143
48155
  deploy: false,
48144
48156
  models: [
@@ -48715,7 +48727,7 @@ var config4 = {
48715
48727
  }
48716
48728
  }
48717
48729
  };
48718
- var defaults_default2 = config4;
48730
+ var defaults_default2 = config6;
48719
48731
  var ai_default2 = {
48720
48732
  default: "meta.llama2-70b-chat-v1",
48721
48733
  models: [
@@ -51608,7 +51620,7 @@ var uuidRule2 = createRule2((value, options2, field) => {
51608
51620
  field.report(messages2.uuid, "uuid", field);
51609
51621
  }
51610
51622
  } else {
51611
- const matchesAnyVersion = options2.version.find((version) => helpers32.isUUID(value, version));
51623
+ const matchesAnyVersion = options2.version.find((version2) => helpers32.isUUID(value, version2));
51612
51624
  if (!matchesAnyVersion) {
51613
51625
  field.report(messages2.uuid, "uuid", field, options2);
51614
51626
  }
@@ -51703,8 +51715,8 @@ var VineString2 = class _VineString2 extends BaseLiteralType2 {
51703
51715
  mobile(...args) {
51704
51716
  return this.use(mobileRule2(...args));
51705
51717
  }
51706
- ipAddress(version) {
51707
- return this.use(ipAddressRule2(version ? { version } : undefined));
51718
+ ipAddress(version2) {
51719
+ return this.use(ipAddressRule2(version2 ? { version: version2 } : undefined));
51708
51720
  }
51709
51721
  hexCode() {
51710
51722
  return this.use(hexCodeRule2());
@@ -53000,7 +53012,7 @@ var ui_default2 = {
53000
53012
  }
53001
53013
  }
53002
53014
  };
53003
- var config23 = {
53015
+ var config22 = {
53004
53016
  ai: ai_default2,
53005
53017
  analytics: analytics_default2,
53006
53018
  app: app_default2,
@@ -53027,7 +53039,7 @@ var config23 = {
53027
53039
  team: team_default2,
53028
53040
  ui: ui_default2
53029
53041
  };
53030
- var overrides_default2 = config23;
53042
+ var overrides_default2 = config22;
53031
53043
  async function localTunnel2(options2) {
53032
53044
  const port = 3000;
53033
53045
  if (!options2?.port)
@@ -54223,7 +54235,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
54223
54235
  return min;
54224
54236
  }
54225
54237
  if (process112.platform === "win32") {
54226
- const osRelease = os3.release().split(".");
54238
+ const osRelease = os2.release().split(".");
54227
54239
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
54228
54240
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
54229
54241
  }
@@ -55239,7 +55251,7 @@ function deleteKeys2(obj, ...keys) {
55239
55251
  });
55240
55252
  }
55241
55253
  var isArray2 = (item) => Array.isArray(item);
55242
- function isObject23(item) {
55254
+ function isObject22(item) {
55243
55255
  return typeof item === "object" && !Array.isArray(item) && item !== null;
55244
55256
  }
55245
55257
  var isFunction2 = (item) => typeof item === "function";
@@ -56020,7 +56032,7 @@ class Collection2 {
56020
56032
  }
56021
56033
  return new this.constructor(this.items.splice(-count));
56022
56034
  }
56023
- if (isObject23(this.items)) {
56035
+ if (isObject22(this.items)) {
56024
56036
  const keys = Object.keys(this.items);
56025
56037
  if (count === 1) {
56026
56038
  const key = keys[keys.length - 1];
@@ -56165,7 +56177,7 @@ class Collection2 {
56165
56177
  };
56166
56178
  if (isArray2(this.items)) {
56167
56179
  result = this.items.findIndex(find);
56168
- } else if (isObject23(this.items)) {
56180
+ } else if (isObject22(this.items)) {
56169
56181
  result = Object.keys(this.items).find((key) => find(this.items[key], key));
56170
56182
  }
56171
56183
  if (result === undefined || result < 0) {
@@ -56183,7 +56195,7 @@ class Collection2 {
56183
56195
  }
56184
56196
  return new this.constructor(this.items.splice(0, count));
56185
56197
  }
56186
- if (isObject23(this.items)) {
56198
+ if (isObject22(this.items)) {
56187
56199
  if (count === 1) {
56188
56200
  const key = Object.keys(this.items)[0];
56189
56201
  const value = this.items[key];
@@ -56216,7 +56228,7 @@ class Collection2 {
56216
56228
  return this;
56217
56229
  }
56218
56230
  skip(number) {
56219
- if (isObject23(this.items)) {
56231
+ if (isObject22(this.items)) {
56220
56232
  return new this.constructor(Object.keys(this.items).reduce((accumulator, key, index) => {
56221
56233
  if (index + 1 > number) {
56222
56234
  accumulator[key] = this.items[key];
@@ -56241,7 +56253,7 @@ class Collection2 {
56241
56253
  return previous;
56242
56254
  });
56243
56255
  }
56244
- if (isObject23(this.items)) {
56256
+ if (isObject22(this.items)) {
56245
56257
  items = Object.keys(this.items).reduce((acc, key) => {
56246
56258
  if (previous !== true) {
56247
56259
  previous = callback(this.items[key]);
@@ -56269,7 +56281,7 @@ class Collection2 {
56269
56281
  return previous;
56270
56282
  });
56271
56283
  }
56272
- if (isObject23(this.items)) {
56284
+ if (isObject22(this.items)) {
56273
56285
  items = Object.keys(this.items).reduce((acc, key) => {
56274
56286
  if (previous !== true) {
56275
56287
  previous = !callback(this.items[key]);
@@ -56432,7 +56444,7 @@ class Collection2 {
56432
56444
  return previous;
56433
56445
  });
56434
56446
  }
56435
- if (isObject23(this.items)) {
56447
+ if (isObject22(this.items)) {
56436
56448
  items = Object.keys(this.items).reduce((acc, key) => {
56437
56449
  if (previous !== false) {
56438
56450
  previous = !callback(this.items[key]);
@@ -56460,7 +56472,7 @@ class Collection2 {
56460
56472
  return previous;
56461
56473
  });
56462
56474
  }
56463
- if (isObject23(this.items)) {
56475
+ if (isObject22(this.items)) {
56464
56476
  items = Object.keys(this.items).reduce((acc, key) => {
56465
56477
  if (previous !== false) {
56466
56478
  previous = callback(this.items[key]);
@@ -56715,7 +56727,7 @@ var buildKeyPathMap3 = function buildKeyPathMap22(items) {
56715
56727
  const keyPaths = {};
56716
56728
  items.forEach((item, index) => {
56717
56729
  function buildKeyPath(val, keyPath) {
56718
- if (isObject23(val)) {
56730
+ if (isObject22(val)) {
56719
56731
  Object.keys(val).forEach((prop) => {
56720
56732
  buildKeyPath(val[prop], `${keyPath}.${prop}`);
56721
56733
  });
@@ -56797,35 +56809,37 @@ function deepMerge2(target, source) {
56797
56809
  function isObject32(item) {
56798
56810
  return Boolean(item && typeof item === "object" && !Array.isArray(item));
56799
56811
  }
56800
- async function loadConfig2({ name, cwd, defaultConfig }) {
56812
+ async function loadConfig2({ name, cwd, defaultConfig: defaultConfig2 }) {
56801
56813
  const configPath = resolve3(cwd || process22.cwd(), `${name}.config`);
56802
56814
  try {
56803
56815
  const importedConfig = await import(configPath);
56804
56816
  const loadedConfig = importedConfig.default || importedConfig;
56805
- return deepMerge2(defaultConfig, loadedConfig);
56817
+ return deepMerge2(defaultConfig2, loadedConfig);
56806
56818
  } catch (error) {
56807
- return defaultConfig;
56808
- }
56809
- }
56819
+ return defaultConfig2;
56820
+ }
56821
+ }
56822
+ var defaultConfig2 = {
56823
+ altNameIPs: ["127.0.0.1"],
56824
+ altNameURIs: ["localhost"],
56825
+ organizationName: "Local Development",
56826
+ countryName: "US",
56827
+ stateName: "California",
56828
+ localityName: "Playa Vista",
56829
+ commonName: "stacks.localhost",
56830
+ validityDays: 825,
56831
+ hostCertCN: "stacks.localhost",
56832
+ domain: "stacks.localhost",
56833
+ rootCA: { certificate: "", privateKey: "" },
56834
+ basePath: "",
56835
+ caCertPath: path.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
56836
+ certPath: path.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
56837
+ keyPath: path.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`),
56838
+ verbose: false
56839
+ };
56810
56840
  var config42 = await loadConfig2({
56811
56841
  name: "tls",
56812
- defaultConfig: {
56813
- altNameIPs: ["127.0.0.1"],
56814
- altNameURIs: ["localhost"],
56815
- organizationName: "Local Development",
56816
- countryName: "US",
56817
- stateName: "California",
56818
- localityName: "Playa Vista",
56819
- commonName: "stacks.localhost",
56820
- validityDays: 825,
56821
- hostCertCN: "stacks.localhost",
56822
- domain: "stacks.localhost",
56823
- rootCAObject: { certificate: "", privateKey: "" },
56824
- caCertPath: path2.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
56825
- certPath: path2.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
56826
- keyPath: path2.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`),
56827
- verbose: false
56828
- }
56842
+ defaultConfig: defaultConfig2
56829
56843
  });
56830
56844
  var import_node_forge = __toESM3(require_lib2(), 1);
56831
56845
  function makeNumberPositive(hexString) {
@@ -56841,7 +56855,7 @@ function findFoldersWithFile(rootDir, fileName) {
56841
56855
  try {
56842
56856
  const files = fs.readdirSync(dir);
56843
56857
  for (const file of files) {
56844
- const filePath = path22.join(dir, file);
56858
+ const filePath = path2.join(dir, file);
56845
56859
  const stats = fs.lstatSync(filePath);
56846
56860
  if (stats.isDirectory()) {
56847
56861
  search(filePath);
@@ -56959,12 +56973,12 @@ async function createRootCA(options22 = {}) {
56959
56973
  async function generateCertificate(options22) {
56960
56974
  debugLog("cert", "Generating new certificate", options22.verbose);
56961
56975
  debugLog("cert", `Options: ${JSON.stringify(options22)}`, options22.verbose);
56962
- if (!options22.rootCAObject?.certificate || !options22.rootCAObject?.privateKey) {
56976
+ if (!options22.rootCA?.certificate || !options22.rootCA?.privateKey) {
56963
56977
  throw new Error("Root CA certificate and private key are required");
56964
56978
  }
56965
- const caCert = import_node_forge2.pki.certificateFromPem(options22.rootCAObject.certificate);
56966
- const caKey = import_node_forge2.pki.privateKeyFromPem(options22.rootCAObject.privateKey);
56967
- debugLog("cert", "Generating 2048-bit RSA key pair for host certificate", options22?.verbose);
56979
+ const caCert = import_node_forge2.pki.certificateFromPem(options22.rootCA.certificate);
56980
+ const caKey = import_node_forge2.pki.privateKeyFromPem(options22.rootCA.privateKey);
56981
+ debugLog("cert", "Generating 2048-bit RSA key pair for host certificate", options22.verbose);
56968
56982
  const keySize = 2048;
56969
56983
  const { privateKey, publicKey } = import_node_forge2.pki.rsa.generateKeyPair(keySize);
56970
56984
  const attributes = options22.certificateAttributes || [
@@ -57037,8 +57051,8 @@ async function addCertToSystemTrustStoreAndSaveCert(cert, caCert, options22) {
57037
57051
  }
57038
57052
  function storeCertificate(cert, options22) {
57039
57053
  debugLog("storage", `Storing certificate and private key with options: ${JSON.stringify(options22)}`, options22?.verbose);
57040
- const certPath = options22?.certPath || config42.certPath;
57041
- const certKeyPath = options22?.keyPath || config42.keyPath;
57054
+ const certPath = path3.join(options22?.basePath || config42.basePath, options22?.certPath || config42.certPath);
57055
+ const certKeyPath = path3.join(options22?.basePath || config42.basePath, options22?.keyPath || config42.keyPath);
57042
57056
  debugLog("storage", `Certificate path: ${certPath}`, options22?.verbose);
57043
57057
  debugLog("storage", `Private key path: ${certKeyPath}`, options22?.verbose);
57044
57058
  const certDir = path3.dirname(certPath);
@@ -57060,7 +57074,7 @@ function storeCertificate(cert, options22) {
57060
57074
  }
57061
57075
  function storeCACertificate(caCert, options22) {
57062
57076
  debugLog("storage", "Storing CA certificate", options22?.verbose);
57063
- const caCertPath = options22?.caCertPath || config42.caCertPath;
57077
+ const caCertPath = path3.join(options22?.basePath || config42.basePath, options22?.caCertPath || config42.caCertPath);
57064
57078
  debugLog("storage", `CA certificate path: ${caCertPath}`, options22?.verbose);
57065
57079
  const caCertDir = path3.dirname(caCertPath);
57066
57080
  if (!fs2.existsSync(caCertDir)) {
@@ -57079,100 +57093,152 @@ var export_forge = import_node_forge2.default;
57079
57093
  // src/https.ts
57080
57094
  var cachedSSLConfig = null;
57081
57095
  function isMultiProxyConfig(options3) {
57082
- return "proxies" in options3;
57096
+ return "proxies" in options3 && Array.isArray(options3.proxies);
57097
+ }
57098
+ function isMultiProxyOptions(options3) {
57099
+ return "proxies" in options3 && Array.isArray(options3.proxies);
57100
+ }
57101
+ function isSingleProxyOptions(options3) {
57102
+ return "to" in options3 && typeof options3.to === "string";
57103
+ }
57104
+ function resolveSSLPaths(options3, defaultConfig3) {
57105
+ const domain = isMultiProxyConfig(options3) ? options3.proxies[0].to || "stacks.localhost" : options3.to || "stacks.localhost";
57106
+ if (typeof options3.https === "object" && typeof defaultConfig3.https === "object") {
57107
+ const hasAllPaths = options3.https.caCertPath && options3.https.certPath && options3.https.keyPath;
57108
+ if (hasAllPaths) {
57109
+ const baseConfig = httpsConfig({
57110
+ ...options3,
57111
+ to: domain,
57112
+ https: defaultConfig3.https
57113
+ });
57114
+ const altNameIPs = options3.https.altNameIPs?.filter((ip) => ip !== undefined) || baseConfig.altNameIPs;
57115
+ const altNameURIs = options3.https.altNameURIs?.filter((uri) => uri !== undefined) || baseConfig.altNameURIs;
57116
+ return {
57117
+ ...baseConfig,
57118
+ caCertPath: options3.https.caCertPath || baseConfig.caCertPath,
57119
+ certPath: options3.https.certPath || baseConfig.certPath,
57120
+ keyPath: options3.https.keyPath || baseConfig.keyPath,
57121
+ basePath: options3.https.basePath || baseConfig.basePath,
57122
+ commonName: options3.https.commonName || baseConfig.commonName,
57123
+ organizationName: options3.https.organizationName || baseConfig.organizationName,
57124
+ countryName: options3.https.countryName || baseConfig.countryName,
57125
+ stateName: options3.https.stateName || baseConfig.stateName,
57126
+ localityName: options3.https.localityName || baseConfig.localityName,
57127
+ validityDays: options3.https.validityDays || baseConfig.validityDays,
57128
+ altNameIPs,
57129
+ altNameURIs,
57130
+ verbose: options3.verbose || baseConfig.verbose
57131
+ };
57132
+ }
57133
+ }
57134
+ return httpsConfig({
57135
+ ...options3,
57136
+ to: domain
57137
+ });
57083
57138
  }
57084
57139
  function generateWildcardPatterns(domain) {
57085
57140
  const patterns = new Set;
57086
57141
  patterns.add(domain);
57087
57142
  const parts = domain.split(".");
57088
- if (parts.length >= 2) {
57143
+ if (parts.length >= 2)
57089
57144
  patterns.add(`*.${parts.slice(1).join(".")}`);
57090
- }
57091
57145
  return Array.from(patterns);
57092
57146
  }
57093
- function generateBaseConfig(options3, verbose) {
57094
- const domains = extractDomains(options3);
57095
- const sslBase = path4.join(os5.homedir(), ".stacks", "ssl");
57096
- const httpsConfig = options3.https === true ? {
57097
- caCertPath: path4.join(sslBase, "rpx-ca.crt"),
57098
- certPath: path4.join(sslBase, "rpx.crt"),
57099
- keyPath: path4.join(sslBase, "rpx.key")
57100
- } : typeof config.https === "object" ? {
57101
- ...options3.https,
57102
- ...config.https
57103
- } : {};
57104
- debugLog2("ssl", `Extracted domains: ${domains.join(", ")}`, verbose);
57105
- debugLog2("ssl", `Using SSL base path: ${sslBase}`, verbose);
57106
- debugLog2("ssl", `Using HTTPS config: ${JSON.stringify(httpsConfig)}`, verbose);
57107
- const allPatterns = new Set;
57108
- domains.forEach((domain) => {
57109
- allPatterns.add(domain);
57110
- generateWildcardPatterns(domain).forEach((pattern) => allPatterns.add(pattern));
57111
- });
57112
- allPatterns.add("localhost");
57113
- allPatterns.add("*.localhost");
57114
- const uniqueDomains = Array.from(allPatterns);
57115
- debugLog2("ssl", `Generated domain patterns: ${uniqueDomains.join(", ")}`, verbose);
57147
+ function getPrimaryDomain(options3) {
57148
+ if (!options3)
57149
+ return "stacks.localhost";
57150
+ if (isMultiProxyOptions(options3) && options3.proxies.length > 0)
57151
+ return options3.proxies[0].to || "stacks.localhost";
57152
+ if (isSingleProxyOptions(options3))
57153
+ return options3.to || "stacks.localhost";
57154
+ return "stacks.localhost";
57155
+ }
57156
+ function generateSSLPaths(options3) {
57157
+ const domain = getPrimaryDomain(options3);
57158
+ let basePath = "";
57159
+ if (typeof options3?.https === "object") {
57160
+ basePath = options3.https.basePath || "";
57161
+ return {
57162
+ caCertPath: options3.https.caCertPath || join4(basePath, `${domain}.ca.crt`),
57163
+ certPath: options3.https.certPath || join4(basePath, `${domain}.crt`),
57164
+ keyPath: options3.https.keyPath || join4(basePath, `${domain}.key`)
57165
+ };
57166
+ }
57167
+ const sslBase = basePath || join4(homedir2(), ".stacks", "ssl");
57168
+ const sanitizedDomain = domain.replace(/\*/g, "wildcard");
57116
57169
  return {
57117
- domain: domains[0],
57118
- hostCertCN: domains[0],
57119
- caCertPath: httpsConfig?.caCertPath ?? path4.join(sslBase, "rpx-ca.crt"),
57120
- certPath: httpsConfig?.certPath ?? path4.join(sslBase, "rpx.crt"),
57121
- keyPath: httpsConfig?.keyPath ?? path4.join(sslBase, "rpx.key"),
57122
- altNameIPs: httpsConfig?.altNameIPs ?? ["127.0.0.1", "::1"],
57123
- altNameURIs: httpsConfig?.altNameURIs ?? [],
57124
- commonName: httpsConfig?.commonName ?? domains[0],
57125
- organizationName: httpsConfig?.organizationName ?? "Local Development",
57126
- countryName: httpsConfig?.countryName ?? "US",
57127
- stateName: httpsConfig?.stateName ?? "California",
57128
- localityName: httpsConfig?.localityName ?? "Playa Vista",
57129
- validityDays: httpsConfig?.validityDays ?? 825,
57130
- verbose: verbose ?? false,
57131
- subjectAltNames: uniqueDomains.map((domain) => ({
57132
- type: 2,
57133
- value: domain
57134
- }))
57170
+ caCertPath: join4(sslBase, `${sanitizedDomain}.ca.crt`),
57171
+ certPath: join4(sslBase, `${sanitizedDomain}.crt`),
57172
+ keyPath: join4(sslBase, `${sanitizedDomain}.key`)
57135
57173
  };
57136
57174
  }
57137
- function generateRootCAConfig() {
57138
- const sslBase = path4.join(os5.homedir(), ".stacks", "ssl");
57139
- return {
57140
- domain: "stacks.localhost",
57141
- hostCertCN: "stacks.localhost",
57142
- caCertPath: path4.join(sslBase, "rpx-root-ca.crt"),
57143
- certPath: path4.join(sslBase, "rpx-certificate.crt"),
57144
- keyPath: path4.join(sslBase, "rpx-certificate.key"),
57145
- altNameIPs: ["127.0.0.1", "::1"],
57146
- altNameURIs: [],
57147
- organizationName: "Stacks Local Development",
57148
- countryName: "US",
57149
- stateName: "California",
57150
- localityName: "Playa Vista",
57151
- commonName: "stacks.localhost",
57152
- validityDays: 3650,
57153
- verbose: true
57154
- };
57175
+ function getAllDomains(options3) {
57176
+ const domains = new Set;
57177
+ if (isMultiProxyOptions(options3)) {
57178
+ options3.proxies.forEach((proxy) => {
57179
+ const domain = proxy.to || "stacks.localhost";
57180
+ generateWildcardPatterns(domain).forEach((pattern) => domains.add(pattern));
57181
+ });
57182
+ } else if (isSingleProxyOptions(options3)) {
57183
+ const domain = options3.to || "stacks.localhost";
57184
+ generateWildcardPatterns(domain).forEach((pattern) => domains.add(pattern));
57185
+ } else {
57186
+ domains.add("stacks.localhost");
57187
+ }
57188
+ domains.add("localhost");
57189
+ domains.add("*.localhost");
57190
+ return domains;
57155
57191
  }
57156
- function httpsConfig(options3) {
57157
- return generateBaseConfig(options3, options3.verbose);
57192
+ async function loadSSLConfig(options3) {
57193
+ debugLog2("ssl", `Loading SSL configuration`, options3.verbose);
57194
+ const mergedOptions = {
57195
+ ...config4,
57196
+ ...options3
57197
+ };
57198
+ options3.https = httpsConfig(mergedOptions);
57199
+ if (!options3.https?.keyPath && !options3.https?.certPath) {
57200
+ debugLog2("ssl", "No SSL configuration provided", options3.verbose);
57201
+ return null;
57202
+ }
57203
+ if (options3.https?.keyPath && !options3.https?.certPath || !options3.https?.keyPath && options3.https?.certPath) {
57204
+ const missing = !options3.https?.keyPath ? "keyPath" : "certPath";
57205
+ debugLog2("ssl", `Invalid SSL configuration - missing ${missing}`, options3.verbose);
57206
+ throw new Error(`SSL Configuration requires both keyPath and certPath. Missing: ${missing}`);
57207
+ }
57208
+ try {
57209
+ if (!options3.https?.keyPath || !options3.https?.certPath)
57210
+ return null;
57211
+ try {
57212
+ debugLog2("ssl", "Reading SSL certificate files", options3.verbose);
57213
+ const key = await fs3.readFile(options3.https?.keyPath, "utf8");
57214
+ const cert = await fs3.readFile(options3.https?.certPath, "utf8");
57215
+ debugLog2("ssl", "SSL configuration loaded successfully", options3.verbose);
57216
+ return { key, cert };
57217
+ } catch (error) {
57218
+ debugLog2("ssl", `Failed to read certificates: ${error}`, options3.verbose);
57219
+ return null;
57220
+ }
57221
+ } catch (err3) {
57222
+ debugLog2("ssl", `SSL configuration error: ${err3}`, options3.verbose);
57223
+ throw err3;
57224
+ }
57158
57225
  }
57159
57226
  async function generateCertificate2(options3) {
57160
57227
  if (cachedSSLConfig) {
57161
- const verbose2 = isMultiProxyConfig(options3) ? options3.verbose : options3.verbose;
57162
- debugLog2("ssl", "Using cached SSL configuration", verbose2);
57228
+ debugLog2("ssl", "Using cached SSL configuration", options3.verbose);
57163
57229
  return;
57164
57230
  }
57165
- const domains = isMultiProxyConfig(options3) ? [options3.proxies[0].to, ...options3.proxies.map((proxy) => proxy.to)] : [options3.to];
57166
- const verbose = isMultiProxyConfig(options3) ? options3.verbose : options3.verbose;
57167
- debugLog2("ssl", `Generating certificate for domains: ${domains.join(", ")}`, verbose);
57168
- const rootCAConfig = generateRootCAConfig();
57231
+ const domains = isMultiProxyOptions(options3) ? options3.proxies.map((proxy) => proxy.to) : [options3.to];
57232
+ debugLog2("ssl", `Generating certificate for domains: ${domains.join(", ")}`, options3.verbose);
57233
+ const rootCAConfig = httpsConfig(options3, options3.verbose);
57169
57234
  log.info("Generating Root CA certificate...");
57170
57235
  const caCert = await createRootCA(rootCAConfig);
57171
- const hostConfig = generateBaseConfig(options3, verbose);
57236
+ const hostConfig = httpsConfig(options3, options3.verbose);
57237
+ console.log("hostConfig", hostConfig);
57172
57238
  log.info(`Generating host certificate for: ${domains.join(", ")}`);
57173
57239
  const hostCert = await generateCertificate({
57174
57240
  ...hostConfig,
57175
- rootCAObject: {
57241
+ rootCA: {
57176
57242
  certificate: caCert.certificate,
57177
57243
  privateKey: caCert.privateKey
57178
57244
  }
@@ -57184,11 +57250,86 @@ async function generateCertificate2(options3) {
57184
57250
  ca: caCert.certificate
57185
57251
  };
57186
57252
  log.success(`Certificate generated successfully for ${domains.length} domain${domains.length > 1 ? "s" : ""}`);
57187
- debugLog2("ssl", `Certificate includes domains: ${domains.join(", ")}`, verbose);
57253
+ debugLog2("ssl", `Certificate includes domains: ${domains.join(", ")}`, options3.verbose);
57188
57254
  }
57189
57255
  function getSSLConfig() {
57190
57256
  return cachedSSLConfig;
57191
57257
  }
57258
+ async function checkExistingCertificates(options3) {
57259
+ const name = getPrimaryDomain(options3);
57260
+ const paths = generateSSLPaths(options3);
57261
+ try {
57262
+ debugLog2("ssl", `Checking certificates for ${name} at paths:`, options3?.verbose);
57263
+ debugLog2("ssl", `CA: ${paths.caCertPath}`, options3?.verbose);
57264
+ debugLog2("ssl", `Cert: ${paths.certPath}`, options3?.verbose);
57265
+ debugLog2("ssl", `Key: ${paths.keyPath}`, options3?.verbose);
57266
+ const key = await fs3.readFile(paths.keyPath, "utf8");
57267
+ const cert = await fs3.readFile(paths.certPath, "utf8");
57268
+ let ca;
57269
+ if (paths.caCertPath) {
57270
+ try {
57271
+ ca = await fs3.readFile(paths.caCertPath, "utf8");
57272
+ } catch (err3) {
57273
+ debugLog2("ssl", `Failed to read CA cert: ${err3}`, options3?.verbose);
57274
+ }
57275
+ }
57276
+ return { key, cert, ca };
57277
+ } catch (err3) {
57278
+ debugLog2("ssl", `Failed to read certificates: ${err3}`, options3?.verbose);
57279
+ return null;
57280
+ }
57281
+ }
57282
+ function httpsConfig(options3, verbose) {
57283
+ const primaryDomain = getPrimaryDomain(options3);
57284
+ debugLog2("ssl", `Primary domain: ${primaryDomain}`, verbose);
57285
+ const defaultPaths = generateSSLPaths(options3);
57286
+ if (typeof options3.https === "object") {
57287
+ const config5 = {
57288
+ domain: primaryDomain,
57289
+ hostCertCN: primaryDomain,
57290
+ basePath: options3.https.basePath || "",
57291
+ caCertPath: options3.https.caCertPath || defaultPaths.caCertPath,
57292
+ certPath: options3.https.certPath || defaultPaths.certPath,
57293
+ keyPath: options3.https.keyPath || defaultPaths.keyPath,
57294
+ altNameIPs: ["127.0.0.1", "::1"],
57295
+ altNameURIs: [],
57296
+ commonName: options3.https.commonName || primaryDomain,
57297
+ organizationName: options3.https.organizationName || "Local Development",
57298
+ countryName: options3.https.countryName || "US",
57299
+ stateName: options3.https.stateName || "California",
57300
+ localityName: options3.https.localityName || "Playa Vista",
57301
+ validityDays: options3.https.validityDays || 825,
57302
+ verbose: verbose || false,
57303
+ subjectAltNames: Array.from(getAllDomains(options3)).map((domain) => ({
57304
+ type: 2,
57305
+ value: domain
57306
+ }))
57307
+ };
57308
+ if (isValidRootCA(options3.https.rootCA)) {
57309
+ config5.rootCA = options3.https.rootCA;
57310
+ }
57311
+ return config5;
57312
+ }
57313
+ return {
57314
+ domain: primaryDomain,
57315
+ hostCertCN: primaryDomain,
57316
+ basePath: "",
57317
+ ...defaultPaths,
57318
+ altNameIPs: ["127.0.0.1", "::1"],
57319
+ altNameURIs: [],
57320
+ commonName: primaryDomain,
57321
+ organizationName: "Local Development",
57322
+ countryName: "US",
57323
+ stateName: "California",
57324
+ localityName: "Playa Vista",
57325
+ validityDays: 825,
57326
+ verbose: verbose || false,
57327
+ subjectAltNames: Array.from(getAllDomains(options3)).map((domain) => ({
57328
+ type: 2,
57329
+ value: domain
57330
+ }))
57331
+ };
57332
+ }
57192
57333
 
57193
57334
  // src/utils.ts
57194
57335
  function debugLog2(category, message, verbose) {
@@ -57196,37 +57337,43 @@ function debugLog2(category, message, verbose) {
57196
57337
  console.debug(`[rpx:${category}] ${message}`);
57197
57338
  }
57198
57339
  }
57199
- function extractDomains(options3) {
57200
- if (isMultiProxyConfig(options3)) {
57340
+ function extractHostname(options3) {
57341
+ if (isMultiProxyOptions(options3)) {
57201
57342
  return options3.proxies.map((proxy) => {
57202
- const domain2 = proxy.to || "stacks.localhost";
57203
- return domain2.startsWith("http") ? new URL(domain2).hostname : domain2;
57343
+ const domain = proxy.to || "stacks.localhost";
57344
+ return domain.startsWith("http") ? new URL(domain).hostname : domain;
57204
57345
  });
57205
57346
  }
57206
- const domain = options3.to || "stacks.localhost";
57207
- return [domain.startsWith("http") ? new URL(domain).hostname : domain];
57347
+ if (isSingleProxyOptions(options3)) {
57348
+ const domain = options3.to || "stacks.localhost";
57349
+ return [domain.startsWith("http") ? new URL(domain).hostname : domain];
57350
+ }
57351
+ return ["stacks.localhost"];
57352
+ }
57353
+ function isValidRootCA(value) {
57354
+ return typeof value === "object" && value !== null && "certificate" in value && "privateKey" in value && typeof value.certificate === "string" && typeof value.privateKey === "string";
57208
57355
  }
57209
57356
 
57210
57357
  // src/hosts.ts
57211
- var hostsFilePath = process3.platform === "win32" ? path6.join(process3.env.windir || "C:\\Windows", "System32", "drivers", "etc", "hosts") : "/etc/hosts";
57358
+ var hostsFilePath = process3.platform === "win32" ? path4.join(process3.env.windir || "C:\\Windows", "System32", "drivers", "etc", "hosts") : "/etc/hosts";
57212
57359
  async function sudoWrite(operation, content) {
57213
57360
  return new Promise((resolve4, reject) => {
57214
57361
  if (process3.platform === "win32") {
57215
57362
  reject(new Error("Administrator privileges required on Windows"));
57216
57363
  return;
57217
57364
  }
57218
- const tmpFile = path6.join(os7.tmpdir(), "hosts.tmp");
57365
+ const tmpFile = path4.join(os3.tmpdir(), "hosts.tmp");
57219
57366
  try {
57220
57367
  if (operation === "append") {
57221
- const currentContent = fs3.readFileSync(hostsFilePath, "utf8");
57222
- fs3.writeFileSync(tmpFile, currentContent + content, "utf8");
57368
+ const currentContent = fs5.readFileSync(hostsFilePath, "utf8");
57369
+ fs5.writeFileSync(tmpFile, currentContent + content, "utf8");
57223
57370
  } else {
57224
- fs3.writeFileSync(tmpFile, content, "utf8");
57371
+ fs5.writeFileSync(tmpFile, content, "utf8");
57225
57372
  }
57226
57373
  const sudo = spawn("sudo", ["cp", tmpFile, hostsFilePath]);
57227
57374
  sudo.on("close", (code) => {
57228
57375
  try {
57229
- fs3.unlinkSync(tmpFile);
57376
+ fs5.unlinkSync(tmpFile);
57230
57377
  if (code === 0)
57231
57378
  resolve4();
57232
57379
  else
@@ -57237,7 +57384,7 @@ async function sudoWrite(operation, content) {
57237
57384
  });
57238
57385
  sudo.on("error", (err3) => {
57239
57386
  try {
57240
- fs3.unlinkSync(tmpFile);
57387
+ fs5.unlinkSync(tmpFile);
57241
57388
  } catch {
57242
57389
  }
57243
57390
  reject(err3);
@@ -57251,7 +57398,7 @@ async function addHosts(hosts, verbose) {
57251
57398
  debugLog2("hosts", `Adding hosts: ${hosts.join(", ")}`, verbose);
57252
57399
  debugLog2("hosts", `Using hosts file at: ${hostsFilePath}`, verbose);
57253
57400
  try {
57254
- const existingContent = await fs3.promises.readFile(hostsFilePath, "utf-8");
57401
+ const existingContent = await fs5.promises.readFile(hostsFilePath, "utf-8");
57255
57402
  const newEntries = hosts.filter((host) => {
57256
57403
  const ipv4Entry = `127.0.0.1 ${host}`;
57257
57404
  const ipv6Entry = `::1 ${host}`;
@@ -57268,7 +57415,7 @@ async function addHosts(hosts, verbose) {
57268
57415
  ::1 ${host}`).join(`
57269
57416
  `);
57270
57417
  try {
57271
- await fs3.promises.appendFile(hostsFilePath, hostEntries, { flag: "a" });
57418
+ await fs5.promises.appendFile(hostsFilePath, hostEntries, { flag: "a" });
57272
57419
  log.success(`Added new hosts: ${newEntries.join(", ")}`);
57273
57420
  } catch (writeErr) {
57274
57421
  if (writeErr.code === "EACCES") {
@@ -57306,7 +57453,7 @@ On Unix systems:`);
57306
57453
  async function removeHosts(hosts, verbose) {
57307
57454
  debugLog2("hosts", `Removing hosts: ${hosts.join(", ")}`, verbose);
57308
57455
  try {
57309
- const content = await fs3.promises.readFile(hostsFilePath, "utf-8");
57456
+ const content = await fs5.promises.readFile(hostsFilePath, "utf-8");
57310
57457
  const lines = content.split(`
57311
57458
  `);
57312
57459
  const filteredLines = lines.filter((line, index) => {
@@ -57322,7 +57469,7 @@ async function removeHosts(hosts, verbose) {
57322
57469
  `)}
57323
57470
  `;
57324
57471
  try {
57325
- await fs3.promises.writeFile(hostsFilePath, newContent);
57472
+ await fs5.promises.writeFile(hostsFilePath, newContent);
57326
57473
  log.success("Hosts removed successfully");
57327
57474
  } catch (writeErr) {
57328
57475
  if (writeErr.code === "EACCES") {
@@ -57362,21 +57509,13 @@ On Unix systems:`);
57362
57509
  }
57363
57510
  async function checkHosts(hosts, verbose) {
57364
57511
  debugLog2("hosts", `Checking hosts: ${hosts}`, verbose);
57365
- const content = await fs3.promises.readFile(hostsFilePath, "utf-8");
57512
+ const content = await fs5.promises.readFile(hostsFilePath, "utf-8");
57366
57513
  return hosts.map((host) => {
57367
57514
  const ipv4Entry = `127.0.0.1 ${host}`;
57368
57515
  const ipv6Entry = `::1 ${host}`;
57369
57516
  return content.includes(ipv4Entry) || content.includes(ipv6Entry);
57370
57517
  });
57371
57518
  }
57372
- // src/start.ts
57373
- import * as fs5 from "fs";
57374
- import * as http from "http";
57375
- import * as https from "https";
57376
- import * as net from "net";
57377
- import process9 from "process";
57378
- // package.json
57379
- var version = "0.4.0";
57380
57519
 
57381
57520
  // src/start.ts
57382
57521
  var activeServers = new Set;
@@ -57424,39 +57563,6 @@ process9.on("uncaughtException", (err3) => {
57424
57563
  log.error("Uncaught exception:", err3);
57425
57564
  cleanup();
57426
57565
  });
57427
- async function loadSSLConfig(options3) {
57428
- debugLog2("ssl", `Loading SSL configuration`, options3.verbose);
57429
- if (options3.https === true)
57430
- options3.https = httpsConfig(options3);
57431
- else if (options3.https === false)
57432
- return null;
57433
- if (!options3.https?.keyPath && !options3.https?.certPath) {
57434
- debugLog2("ssl", "No SSL configuration provided", options3.verbose);
57435
- return null;
57436
- }
57437
- if (options3.https?.keyPath && !options3.https?.certPath || !options3.https?.keyPath && options3.https?.certPath) {
57438
- const missing = !options3.https?.keyPath ? "keyPath" : "certPath";
57439
- debugLog2("ssl", `Invalid SSL configuration - missing ${missing}`, options3.verbose);
57440
- throw new Error(`SSL Configuration requires both keyPath and certPath. Missing: ${missing}`);
57441
- }
57442
- try {
57443
- if (!options3.https?.keyPath || !options3.https?.certPath)
57444
- return null;
57445
- try {
57446
- debugLog2("ssl", "Reading SSL certificate files", options3.verbose);
57447
- const key = await fs5.promises.readFile(options3.https?.keyPath, "utf8");
57448
- const cert = await fs5.promises.readFile(options3.https?.certPath, "utf8");
57449
- debugLog2("ssl", "SSL configuration loaded successfully", options3.verbose);
57450
- return { key, cert };
57451
- } catch (error) {
57452
- debugLog2("ssl", `Failed to read certificates: ${error}`, options3.verbose);
57453
- return null;
57454
- }
57455
- } catch (err3) {
57456
- debugLog2("ssl", `SSL configuration error: ${err3}`, options3.verbose);
57457
- throw err3;
57458
- }
57459
- }
57460
57566
  function isPortInUse(port, hostname, verbose) {
57461
57567
  debugLog2("port", `Checking if port ${port} is in use on ${hostname}`, verbose);
57462
57568
  return new Promise((resolve4) => {
@@ -57512,8 +57618,8 @@ async function testConnection(hostname, port, verbose) {
57512
57618
  }
57513
57619
  async function startServer(options3) {
57514
57620
  debugLog2("server", `Starting server with options: ${JSON.stringify(options3)}`, options3.verbose);
57515
- const fromUrl = new URL(options3.from.startsWith("http") ? options3.from : `http://${options3.from}`);
57516
- const toUrl = new URL(options3.to.startsWith("http") ? options3.to : `http://${options3.to}`);
57621
+ const fromUrl = new URL((options3.from?.startsWith("http") ? options3.from : `http://${options3.from}`) || "localhost:5173");
57622
+ const toUrl = new URL((options3.to?.startsWith("http") ? options3.to : `http://${options3.to}`) || "stacks.localhost");
57517
57623
  const fromPort = Number.parseInt(fromUrl.port) || (fromUrl.protocol.includes("https:") ? 443 : 80);
57518
57624
  const hostsToCheck = [toUrl.hostname];
57519
57625
  if (!toUrl.hostname.includes("localhost") && !toUrl.hostname.includes("127.0.0.1")) {
@@ -57597,7 +57703,7 @@ async function startServer(options3) {
57597
57703
  debugLog2("server", `Setting up reverse proxy with SSL config for ${toUrl.hostname}`, options3.verbose);
57598
57704
  await setupReverseProxy({
57599
57705
  ...options3,
57600
- from: options3.from,
57706
+ from: options3.from || "localhost:5173",
57601
57707
  to: toUrl.hostname,
57602
57708
  fromPort,
57603
57709
  sourceUrl: {
@@ -57752,51 +57858,77 @@ function startHttpRedirectServer(verbose) {
57752
57858
  debugLog2("redirect", "HTTP redirect server started", verbose);
57753
57859
  }
57754
57860
  function startProxy(options3) {
57755
- debugLog2("proxy", `Starting proxy with options: ${JSON.stringify(options3)}`, options3?.verbose);
57861
+ const mergedOptions = {
57862
+ ...config4,
57863
+ ...options3
57864
+ };
57865
+ debugLog2("proxy", `Starting proxy with options: ${JSON.stringify(mergedOptions)}`, mergedOptions?.verbose);
57756
57866
  const serverOptions = {
57757
- from: options3?.from || "localhost:5173",
57758
- to: options3?.to || "stacks.localhost",
57759
- https: httpsConfig(options3),
57760
- etcHostsCleanup: options3?.etcHostsCleanup || false,
57761
- verbose: options3?.verbose || false
57867
+ from: mergedOptions.from,
57868
+ to: mergedOptions.to,
57869
+ https: httpsConfig(mergedOptions),
57870
+ etcHostsCleanup: mergedOptions.etcHostsCleanup,
57871
+ verbose: mergedOptions.verbose
57762
57872
  };
57763
57873
  console.log("serverOptions", serverOptions);
57764
57874
  startServer(serverOptions).catch((err3) => {
57765
- debugLog2("proxy", `Failed to start proxy: ${err3}`, options3.verbose);
57875
+ debugLog2("proxy", `Failed to start proxy: ${err3}`, mergedOptions.verbose);
57766
57876
  log.error(`Failed to start proxy: ${err3.message}`);
57767
57877
  cleanup({
57768
- domains: [options3.to],
57769
- etcHostsCleanup: options3.etcHostsCleanup,
57770
- verbose: options3.verbose
57878
+ domains: [mergedOptions.to],
57879
+ etcHostsCleanup: mergedOptions.etcHostsCleanup,
57880
+ verbose: mergedOptions.verbose
57771
57881
  });
57772
57882
  });
57773
57883
  }
57774
57884
  async function startProxies(options3) {
57775
- if (!options3)
57776
- return;
57777
- debugLog2("proxies", "Starting proxies setup", isMultiProxyConfig2(options3) ? options3.verbose : options3.verbose);
57778
- if (options3.https) {
57779
- await generateCertificate2(options3);
57885
+ debugLog2("proxies", "Starting proxy setup", options3?.verbose);
57886
+ const mergedOptions = {
57887
+ ...config4,
57888
+ ...options3
57889
+ };
57890
+ const primaryDomain = isMultiProxyConfig(mergedOptions) ? mergedOptions.proxies[0].to || "stacks.localhost" : mergedOptions.to || "stacks.localhost";
57891
+ if (mergedOptions.https) {
57892
+ const existingSSLConfig = await checkExistingCertificates(mergedOptions);
57893
+ if (existingSSLConfig) {
57894
+ debugLog2("ssl", `Using existing certificates for ${primaryDomain}`, mergedOptions.verbose);
57895
+ mergedOptions._cachedSSLConfig = existingSSLConfig;
57896
+ } else {
57897
+ debugLog2("ssl", `No valid certificates found for ${primaryDomain}, generating new ones`, mergedOptions.verbose);
57898
+ await generateCertificate2(mergedOptions);
57899
+ const sslConfig2 = await checkExistingCertificates(mergedOptions);
57900
+ if (!sslConfig2) {
57901
+ throw new Error(`Failed to load SSL certificates after generation for ${primaryDomain}. Please check file permissions and paths.`);
57902
+ }
57903
+ mergedOptions._cachedSSLConfig = sslConfig2;
57904
+ }
57780
57905
  }
57781
- const proxyOptions = isMultiProxyConfig2(options3) ? options3.proxies.map((proxy) => ({
57906
+ const proxyOptions = isMultiProxyConfig(mergedOptions) ? mergedOptions.proxies.map((proxy) => ({
57782
57907
  ...proxy,
57783
- https: options3.https,
57784
- etcHostsCleanup: options3.etcHostsCleanup,
57785
- verbose: options3.verbose,
57786
- _cachedSSLConfig: options3._cachedSSLConfig
57787
- })) : [options3];
57788
- const domains = extractDomains(options3);
57789
- const sslConfig = options3.https ? getSSLConfig() : null;
57908
+ https: mergedOptions.https,
57909
+ etcHostsCleanup: mergedOptions.etcHostsCleanup,
57910
+ verbose: mergedOptions.verbose,
57911
+ _cachedSSLConfig: mergedOptions._cachedSSLConfig
57912
+ })) : [{
57913
+ from: mergedOptions.from || "localhost:5173",
57914
+ to: mergedOptions.to || "stacks.localhost",
57915
+ https: mergedOptions.https,
57916
+ etcHostsCleanup: mergedOptions.etcHostsCleanup,
57917
+ verbose: mergedOptions.verbose,
57918
+ _cachedSSLConfig: mergedOptions._cachedSSLConfig
57919
+ }];
57920
+ const domains = proxyOptions.map((opt) => opt.to || "stacks.localhost");
57921
+ const sslConfig = mergedOptions._cachedSSLConfig;
57790
57922
  const cleanupHandler = () => cleanup({
57791
57923
  domains,
57792
- etcHostsCleanup: isMultiProxyConfig2(options3) ? options3.etcHostsCleanup : options3.etcHostsCleanup || false,
57793
- verbose: isMultiProxyConfig2(options3) ? options3.verbose : options3.verbose || false
57924
+ etcHostsCleanup: mergedOptions.etcHostsCleanup || false,
57925
+ verbose: mergedOptions.verbose || false
57794
57926
  });
57795
57927
  process9.on("SIGINT", cleanupHandler);
57796
57928
  process9.on("SIGTERM", cleanupHandler);
57797
57929
  process9.on("uncaughtException", (err3) => {
57798
57930
  debugLog2("process", `Uncaught exception: ${err3}`, true);
57799
- log.error("Uncaught exception:", err3);
57931
+ console.error("Uncaught exception:", err3);
57800
57932
  cleanupHandler();
57801
57933
  });
57802
57934
  for (const option of proxyOptions) {
@@ -57813,30 +57945,41 @@ async function startProxies(options3) {
57813
57945
  });
57814
57946
  } catch (err3) {
57815
57947
  debugLog2("proxies", `Failed to start proxy for ${option.to}: ${err3}`, option.verbose);
57816
- log.error(`Failed to start proxy for ${option.to}:`, err3);
57948
+ console.error(`Failed to start proxy for ${option.to}:`, err3);
57817
57949
  cleanupHandler();
57818
57950
  }
57819
57951
  }
57820
57952
  }
57821
- function isMultiProxyConfig2(options3) {
57822
- return "proxies" in options3;
57823
- }
57953
+
57954
+ // src/index.ts
57955
+ var src_default = startProxies;
57824
57956
  export {
57825
57957
  startServer,
57826
57958
  startProxy,
57827
57959
  startProxies,
57828
57960
  startHttpRedirectServer,
57829
57961
  setupReverseProxy,
57962
+ resolveSSLPaths,
57830
57963
  removeHosts,
57964
+ loadSSLConfig,
57965
+ isValidRootCA,
57966
+ isSingleProxyOptions,
57967
+ isMultiProxyOptions,
57831
57968
  isMultiProxyConfig,
57832
57969
  httpsConfig,
57833
57970
  hostsFilePath,
57834
57971
  getSSLConfig,
57972
+ getPrimaryDomain,
57973
+ getAllDomains,
57974
+ generateWildcardPatterns,
57975
+ generateSSLPaths,
57835
57976
  generateCertificate2 as generateCertificate,
57836
- extractDomains,
57977
+ extractHostname,
57978
+ src_default as default,
57837
57979
  debugLog2 as debugLog,
57838
- config,
57980
+ config4 as config,
57839
57981
  cleanup,
57840
57982
  checkHosts,
57983
+ checkExistingCertificates,
57841
57984
  addHosts
57842
57985
  };