unplugin-https-reverse-proxy 4.1.0-beta.3 → 4.1.0-beta.4

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/nuxt.cjs CHANGED
@@ -33,11 +33,11 @@ __export(nuxt_exports, {
33
33
  default: () => nuxt_default
34
34
  });
35
35
  module.exports = __toCommonJS(nuxt_exports);
36
- var import_node_process9 = __toESM(require("process"), 1);
36
+ var import_node_process10 = __toESM(require("process"), 1);
37
37
  var import_kit = require("@nuxt/kit");
38
38
 
39
39
  // src/index.ts
40
- var import_node_process8 = __toESM(require("process"), 1);
40
+ var import_node_process9 = __toESM(require("process"), 1);
41
41
  var import_console_table_printer = require("console-table-printer");
42
42
  var import_picocolors2 = __toESM(require("picocolors"), 1);
43
43
  var import_unplugin = require("unplugin");
@@ -45,450 +45,13 @@ var import_unplugin = require("unplugin");
45
45
  // src/caddy/index.ts
46
46
  var import_node_child_process3 = require("child_process");
47
47
  var import_node_fs4 = require("fs");
48
- var import_promises3 = require("fs/promises");
48
+ var import_promises2 = require("fs/promises");
49
49
  var import_node_os5 = require("os");
50
50
  var import_node_path5 = require("path");
51
- var import_node_process7 = __toESM(require("process"), 1);
52
-
53
- // node_modules/.pnpm/alien-signals@2.0.7/node_modules/alien-signals/esm/system.mjs
54
- var ReactiveFlags;
55
- (function(ReactiveFlags2) {
56
- ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
57
- ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
58
- ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
59
- ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
60
- ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
61
- ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
62
- ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
63
- })(ReactiveFlags || (ReactiveFlags = {}));
64
- function createReactiveSystem({ update, notify: notify2, unwatched }) {
65
- let currentVersion = 0;
66
- return {
67
- link: link2,
68
- unlink: unlink4,
69
- propagate: propagate2,
70
- checkDirty: checkDirty2,
71
- endTracking: endTracking2,
72
- startTracking: startTracking2,
73
- shallowPropagate: shallowPropagate2
74
- };
75
- function link2(dep, sub) {
76
- const prevDep = sub.depsTail;
77
- if (prevDep !== void 0 && prevDep.dep === dep) {
78
- return;
79
- }
80
- const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
81
- if (nextDep !== void 0 && nextDep.dep === dep) {
82
- nextDep.version = currentVersion;
83
- sub.depsTail = nextDep;
84
- return;
85
- }
86
- const prevSub = dep.subsTail;
87
- if (prevSub !== void 0 && prevSub.version === currentVersion && prevSub.sub === sub) {
88
- return;
89
- }
90
- const newLink = sub.depsTail = dep.subsTail = {
91
- version: currentVersion,
92
- dep,
93
- sub,
94
- prevDep,
95
- nextDep,
96
- prevSub,
97
- nextSub: void 0
98
- };
99
- if (nextDep !== void 0) {
100
- nextDep.prevDep = newLink;
101
- }
102
- if (prevDep !== void 0) {
103
- prevDep.nextDep = newLink;
104
- } else {
105
- sub.deps = newLink;
106
- }
107
- if (prevSub !== void 0) {
108
- prevSub.nextSub = newLink;
109
- } else {
110
- dep.subs = newLink;
111
- }
112
- }
113
- function unlink4(link3, sub = link3.sub) {
114
- const dep = link3.dep;
115
- const prevDep = link3.prevDep;
116
- const nextDep = link3.nextDep;
117
- const nextSub = link3.nextSub;
118
- const prevSub = link3.prevSub;
119
- if (nextDep !== void 0) {
120
- nextDep.prevDep = prevDep;
121
- } else {
122
- sub.depsTail = prevDep;
123
- }
124
- if (prevDep !== void 0) {
125
- prevDep.nextDep = nextDep;
126
- } else {
127
- sub.deps = nextDep;
128
- }
129
- if (nextSub !== void 0) {
130
- nextSub.prevSub = prevSub;
131
- } else {
132
- dep.subsTail = prevSub;
133
- }
134
- if (prevSub !== void 0) {
135
- prevSub.nextSub = nextSub;
136
- } else if ((dep.subs = nextSub) === void 0) {
137
- unwatched(dep);
138
- }
139
- return nextDep;
140
- }
141
- function propagate2(link3) {
142
- let next2 = link3.nextSub;
143
- let stack;
144
- top:
145
- do {
146
- const sub = link3.sub;
147
- let flags = sub.flags;
148
- if (!(flags & 60)) {
149
- sub.flags = flags | 32;
150
- } else if (!(flags & 12)) {
151
- flags = 0;
152
- } else if (!(flags & 4)) {
153
- sub.flags = flags & ~8 | 32;
154
- } else if (!(flags & 48) && isValidLink(link3, sub)) {
155
- sub.flags = flags | 40;
156
- flags &= 1;
157
- } else {
158
- flags = 0;
159
- }
160
- if (flags & 2) {
161
- notify2(sub);
162
- }
163
- if (flags & 1) {
164
- const subSubs = sub.subs;
165
- if (subSubs !== void 0) {
166
- const nextSub = (link3 = subSubs).nextSub;
167
- if (nextSub !== void 0) {
168
- stack = { value: next2, prev: stack };
169
- next2 = nextSub;
170
- }
171
- continue;
172
- }
173
- }
174
- if ((link3 = next2) !== void 0) {
175
- next2 = link3.nextSub;
176
- continue;
177
- }
178
- while (stack !== void 0) {
179
- link3 = stack.value;
180
- stack = stack.prev;
181
- if (link3 !== void 0) {
182
- next2 = link3.nextSub;
183
- continue top;
184
- }
185
- }
186
- break;
187
- } while (true);
188
- }
189
- function startTracking2(sub) {
190
- ++currentVersion;
191
- sub.depsTail = void 0;
192
- sub.flags = sub.flags & ~56 | 4;
193
- }
194
- function endTracking2(sub) {
195
- const depsTail = sub.depsTail;
196
- let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
197
- while (toRemove !== void 0) {
198
- toRemove = unlink4(toRemove, sub);
199
- }
200
- sub.flags &= ~4;
201
- }
202
- function checkDirty2(link3, sub) {
203
- let stack;
204
- let checkDepth = 0;
205
- top:
206
- do {
207
- const dep = link3.dep;
208
- const flags = dep.flags;
209
- let dirty = false;
210
- if (sub.flags & 16) {
211
- dirty = true;
212
- } else if ((flags & 17) === 17) {
213
- if (update(dep)) {
214
- const subs = dep.subs;
215
- if (subs.nextSub !== void 0) {
216
- shallowPropagate2(subs);
217
- }
218
- dirty = true;
219
- }
220
- } else if ((flags & 33) === 33) {
221
- if (link3.nextSub !== void 0 || link3.prevSub !== void 0) {
222
- stack = { value: link3, prev: stack };
223
- }
224
- link3 = dep.deps;
225
- sub = dep;
226
- ++checkDepth;
227
- continue;
228
- }
229
- if (!dirty) {
230
- const nextDep = link3.nextDep;
231
- if (nextDep !== void 0) {
232
- link3 = nextDep;
233
- continue;
234
- }
235
- }
236
- while (checkDepth--) {
237
- const firstSub = sub.subs;
238
- const hasMultipleSubs = firstSub.nextSub !== void 0;
239
- if (hasMultipleSubs) {
240
- link3 = stack.value;
241
- stack = stack.prev;
242
- } else {
243
- link3 = firstSub;
244
- }
245
- if (dirty) {
246
- if (update(sub)) {
247
- if (hasMultipleSubs) {
248
- shallowPropagate2(firstSub);
249
- }
250
- sub = link3.sub;
251
- continue;
252
- }
253
- } else {
254
- sub.flags &= ~32;
255
- }
256
- sub = link3.sub;
257
- const nextDep = link3.nextDep;
258
- if (nextDep !== void 0) {
259
- link3 = nextDep;
260
- continue top;
261
- }
262
- dirty = false;
263
- }
264
- return dirty;
265
- } while (true);
266
- }
267
- function shallowPropagate2(link3) {
268
- do {
269
- const sub = link3.sub;
270
- const flags = sub.flags;
271
- if ((flags & 48) === 32) {
272
- sub.flags = flags | 16;
273
- if (flags & 2) {
274
- notify2(sub);
275
- }
276
- }
277
- } while ((link3 = link3.nextSub) !== void 0);
278
- }
279
- function isValidLink(checkLink, sub) {
280
- let link3 = sub.depsTail;
281
- while (link3 !== void 0) {
282
- if (link3 === checkLink) {
283
- return true;
284
- }
285
- link3 = link3.prevDep;
286
- }
287
- return false;
288
- }
289
- }
290
-
291
- // node_modules/.pnpm/alien-signals@2.0.7/node_modules/alien-signals/esm/index.mjs
292
- var queuedEffects = [];
293
- var { link, unlink, propagate, checkDirty, endTracking, startTracking, shallowPropagate } = createReactiveSystem({
294
- update(signal2) {
295
- if ("getter" in signal2) {
296
- return updateComputed(signal2);
297
- } else {
298
- return updateSignal(signal2, signal2.value);
299
- }
300
- },
301
- notify,
302
- unwatched(node2) {
303
- if ("getter" in node2) {
304
- let toRemove = node2.deps;
305
- if (toRemove !== void 0) {
306
- node2.flags = 17;
307
- do {
308
- toRemove = unlink(toRemove, node2);
309
- } while (toRemove !== void 0);
310
- }
311
- } else if (!("previousValue" in node2)) {
312
- effectOper.call(node2);
313
- }
314
- }
315
- });
316
- var batchDepth = 0;
317
- var notifyIndex = 0;
318
- var queuedEffectsLength = 0;
319
- var activeSub;
320
- var activeScope;
321
- function setCurrentSub(sub) {
322
- const prevSub = activeSub;
323
- activeSub = sub;
324
- return prevSub;
325
- }
326
- function signal(initialValue) {
327
- return signalOper.bind({
328
- previousValue: initialValue,
329
- value: initialValue,
330
- subs: void 0,
331
- subsTail: void 0,
332
- flags: 1
333
- });
334
- }
335
- function computed(getter) {
336
- return computedOper.bind({
337
- value: void 0,
338
- subs: void 0,
339
- subsTail: void 0,
340
- deps: void 0,
341
- depsTail: void 0,
342
- flags: 17,
343
- getter
344
- });
345
- }
346
- function effect(fn) {
347
- const e = {
348
- fn,
349
- subs: void 0,
350
- subsTail: void 0,
351
- deps: void 0,
352
- depsTail: void 0,
353
- flags: 2
354
- };
355
- if (activeSub !== void 0) {
356
- link(e, activeSub);
357
- } else if (activeScope !== void 0) {
358
- link(e, activeScope);
359
- }
360
- const prev = setCurrentSub(e);
361
- try {
362
- e.fn();
363
- } finally {
364
- setCurrentSub(prev);
365
- }
366
- return effectOper.bind(e);
367
- }
368
- function updateComputed(c3) {
369
- const prevSub = setCurrentSub(c3);
370
- startTracking(c3);
371
- try {
372
- const oldValue = c3.value;
373
- return oldValue !== (c3.value = c3.getter(oldValue));
374
- } finally {
375
- setCurrentSub(prevSub);
376
- endTracking(c3);
377
- }
378
- }
379
- function updateSignal(s, value2) {
380
- s.flags = 1;
381
- return s.previousValue !== (s.previousValue = value2);
382
- }
383
- function notify(e) {
384
- const flags = e.flags;
385
- if (!(flags & 64)) {
386
- e.flags = flags | 64;
387
- const subs = e.subs;
388
- if (subs !== void 0) {
389
- notify(subs.sub);
390
- } else {
391
- queuedEffects[queuedEffectsLength++] = e;
392
- }
393
- }
394
- }
395
- function run(e, flags) {
396
- if (flags & 16 || flags & 32 && checkDirty(e.deps, e)) {
397
- const prev = setCurrentSub(e);
398
- startTracking(e);
399
- try {
400
- e.fn();
401
- } finally {
402
- setCurrentSub(prev);
403
- endTracking(e);
404
- }
405
- return;
406
- } else if (flags & 32) {
407
- e.flags = flags & ~32;
408
- }
409
- let link2 = e.deps;
410
- while (link2 !== void 0) {
411
- const dep = link2.dep;
412
- const depFlags = dep.flags;
413
- if (depFlags & 64) {
414
- run(dep, dep.flags = depFlags & ~64);
415
- }
416
- link2 = link2.nextDep;
417
- }
418
- }
419
- function flush() {
420
- while (notifyIndex < queuedEffectsLength) {
421
- const effect2 = queuedEffects[notifyIndex];
422
- queuedEffects[notifyIndex++] = void 0;
423
- run(effect2, effect2.flags &= ~64);
424
- }
425
- notifyIndex = 0;
426
- queuedEffectsLength = 0;
427
- }
428
- function computedOper() {
429
- const flags = this.flags;
430
- if (flags & 16 || flags & 32 && checkDirty(this.deps, this)) {
431
- if (updateComputed(this)) {
432
- const subs = this.subs;
433
- if (subs !== void 0) {
434
- shallowPropagate(subs);
435
- }
436
- }
437
- } else if (flags & 32) {
438
- this.flags = flags & ~32;
439
- }
440
- if (activeSub !== void 0) {
441
- link(this, activeSub);
442
- } else if (activeScope !== void 0) {
443
- link(this, activeScope);
444
- }
445
- return this.value;
446
- }
447
- function signalOper(...value2) {
448
- if (value2.length) {
449
- if (this.value !== (this.value = value2[0])) {
450
- this.flags = 17;
451
- const subs = this.subs;
452
- if (subs !== void 0) {
453
- propagate(subs);
454
- if (!batchDepth) {
455
- flush();
456
- }
457
- }
458
- }
459
- } else {
460
- const value3 = this.value;
461
- if (this.flags & 16) {
462
- if (updateSignal(this, value3)) {
463
- const subs = this.subs;
464
- if (subs !== void 0) {
465
- shallowPropagate(subs);
466
- }
467
- }
468
- }
469
- if (activeSub !== void 0) {
470
- link(this, activeSub);
471
- }
472
- return value3;
473
- }
474
- }
475
- function effectOper() {
476
- let dep = this.deps;
477
- while (dep !== void 0) {
478
- dep = unlink(dep, this);
479
- }
480
- const sub = this.subs;
481
- if (sub !== void 0) {
482
- unlink(sub);
483
- }
484
- this.flags = 0;
485
- }
486
-
487
- // src/caddy/index.ts
51
+ var import_node_process8 = __toESM(require("process"), 1);
488
52
  var import_got_cjs = require("got-cjs");
489
53
  var import_http_proxy_agent = require("http-proxy-agent");
490
54
  var import_https_proxy_agent = require("https-proxy-agent");
491
- var lockfile = __toESM(require("proper-lockfile"), 1);
492
55
 
493
56
  // src/utils.ts
494
57
  var import_node_os = require("os");
@@ -13470,7 +13033,8 @@ async function genCaddyfile(ctx) {
13470
13033
 
13471
13034
  // src/caddy/config.ts
13472
13035
  var import_node_fs = require("fs");
13473
- var import_promises = require("fs/promises");
13036
+ var import_node_process2 = __toESM(require("process"), 1);
13037
+ var lockfile = __toESM(require("proper-lockfile"), 1);
13474
13038
 
13475
13039
  // src/caddy/constants.ts
13476
13040
  var import_node_os2 = __toESM(require("os"), 1);
@@ -13602,56 +13166,108 @@ var supportList = [
13602
13166
  ];
13603
13167
 
13604
13168
  // src/caddy/config.ts
13605
- function useCaddyConfig() {
13606
- const configContentRef = signal("{}");
13607
- const configJsonRef = computed(() => {
13608
- try {
13609
- return JSON.parse(configContentRef());
13610
- } catch {
13611
- return void 0;
13612
- }
13613
- });
13614
- function setConfigContent() {
13615
- if (!(0, import_node_fs.existsSync)(caddyConfigPath)) {
13616
- (0, import_node_fs.writeFileSync)(caddyConfigPath, "{}");
13617
- }
13618
- try {
13619
- configContentRef((0, import_node_fs.readFileSync)(caddyConfigPath, "utf-8"));
13620
- } catch {
13621
- configContentRef("");
13622
- }
13169
+ function isAlive(pid) {
13170
+ if (pid === void 0)
13171
+ return true;
13172
+ try {
13173
+ import_node_process2.default.kill(pid, 0);
13174
+ return true;
13175
+ } catch {
13176
+ return false;
13623
13177
  }
13624
- if (!(0, import_node_fs.existsSync)(caddyConfigPath)) {
13625
- (0, import_node_fs.writeFileSync)(caddyConfigPath, "{}");
13178
+ }
13179
+ function readConfig() {
13180
+ if (!(0, import_node_fs.existsSync)(caddyConfigPath))
13181
+ return {};
13182
+ let parsed2;
13183
+ try {
13184
+ parsed2 = JSON.parse((0, import_node_fs.readFileSync)(caddyConfigPath, "utf-8"));
13185
+ } catch {
13186
+ return {};
13626
13187
  }
13627
- const watchCaddyConfig = (0, import_node_fs.watch)(caddyConfigPath, () => {
13628
- setConfigContent();
13629
- });
13630
- function writeCaddyConfig(_proxies) {
13631
- const proxies = configJsonRef() || {};
13632
- _proxies.forEach((p) => {
13633
- let base = p.base || "/";
13634
- if (!base.startsWith("/"))
13635
- base = `/${base}`;
13636
- if (base !== "/" && !base.endsWith("/"))
13637
- base = `${base}/`;
13638
- const index = `${p.target}${p.portSuffix}${base}`;
13639
- proxies[index] = { ...p, base };
13640
- });
13641
- const content = JSON.stringify(proxies, null, 2);
13642
- configContentRef(content);
13643
- return (0, import_node_fs.writeFileSync)(caddyConfigPath, content);
13188
+ const alive = {};
13189
+ for (const [key, entry] of Object.entries(parsed2)) {
13190
+ if (isAlive(entry == null ? void 0 : entry.ownerPid))
13191
+ alive[key] = entry;
13644
13192
  }
13645
- async function cleanUp() {
13646
- await (0, import_promises.unlink)(caddyConfigPath).catch(() => {
13647
- });
13648
- configContentRef("{}");
13649
- watchCaddyConfig.close();
13193
+ return alive;
13194
+ }
13195
+ function writeConfig(proxies) {
13196
+ const content = JSON.stringify(proxies, null, 2);
13197
+ const temp = `${caddyConfigPath}.${import_node_process2.default.pid}.tmp`;
13198
+ (0, import_node_fs.writeFileSync)(temp, content);
13199
+ (0, import_node_fs.renameSync)(temp, caddyConfigPath);
13200
+ }
13201
+ async function mutateConfig(lock3, mutate) {
13202
+ const release = await lock3.acquire();
13203
+ try {
13204
+ const proxies = readConfig();
13205
+ mutate(proxies);
13206
+ writeConfig(proxies);
13207
+ return proxies;
13208
+ } finally {
13209
+ release();
13650
13210
  }
13211
+ }
13212
+ function useCaddyConfig(options = {}) {
13213
+ const lock3 = options.lock ?? createFileLock();
13651
13214
  return {
13652
- configJsonRef,
13653
- writeCaddyConfig,
13654
- cleanUp
13215
+ configJsonRef: () => (0, import_node_fs.existsSync)(caddyConfigPath) ? readConfig() : void 0,
13216
+ async writeCaddyConfig(_proxies, key) {
13217
+ await mutateConfig(lock3, (proxies) => {
13218
+ for (const p of _proxies)
13219
+ proxies[routeKey(p, key)] = { ...p, base: normalizeBase(p.base), ownerPid: import_node_process2.default.pid };
13220
+ });
13221
+ },
13222
+ async removeProxy(key) {
13223
+ const proxies = await mutateConfig(lock3, (current) => {
13224
+ for (const route of Object.keys(current)) {
13225
+ if (route.endsWith(`#${key}`))
13226
+ delete current[route];
13227
+ }
13228
+ });
13229
+ if (Object.keys(proxies).length === 0)
13230
+ removeConfigFile();
13231
+ },
13232
+ readProxies: () => readConfig(),
13233
+ async cleanUp() {
13234
+ removeConfigFile();
13235
+ }
13236
+ };
13237
+ }
13238
+ function removeConfigFile() {
13239
+ try {
13240
+ if ((0, import_node_fs.existsSync)(caddyConfigPath))
13241
+ (0, import_node_fs.unlinkSync)(caddyConfigPath);
13242
+ } catch {
13243
+ }
13244
+ }
13245
+ function normalizeBase(base) {
13246
+ let out = base || "/";
13247
+ if (!out.startsWith("/"))
13248
+ out = `/${out}`;
13249
+ if (out !== "/" && !out.endsWith("/"))
13250
+ out = `${out}/`;
13251
+ return out;
13252
+ }
13253
+ function routeKey(proxy, ownerKey) {
13254
+ return `${proxy.target}${proxy.portSuffix}${normalizeBase(proxy.base)}#${ownerKey}`;
13255
+ }
13256
+ function createFileLock() {
13257
+ return {
13258
+ async acquire() {
13259
+ if (!(0, import_node_fs.existsSync)(caddyConfigPath))
13260
+ (0, import_node_fs.writeFileSync)(caddyConfigPath, "{}");
13261
+ const release = await lockfile.lock(caddyConfigPath, {
13262
+ realpath: false,
13263
+ stale: 1e4,
13264
+ retries: { retries: 20, minTimeout: 10, maxTimeout: 100 }
13265
+ });
13266
+ return () => {
13267
+ void release().catch(() => {
13268
+ });
13269
+ };
13270
+ }
13655
13271
  };
13656
13272
  }
13657
13273
 
@@ -13669,15 +13285,15 @@ function isCaddyReloadCancellation(line) {
13669
13285
  var import_node_buffer2 = require("buffer");
13670
13286
  var import_node_events = require("events");
13671
13287
  var import_node_path4 = require("path");
13672
- var import_node_process6 = __toESM(require("process"), 1);
13288
+ var import_node_process7 = __toESM(require("process"), 1);
13673
13289
  var import_node_url = require("url");
13674
13290
 
13675
13291
  // src/privileged/entry.ts
13676
13292
  var import_node_fs2 = require("fs");
13677
13293
  var import_node_path2 = require("path");
13678
- var import_node_process2 = __toESM(require("process"), 1);
13294
+ var import_node_process3 = __toESM(require("process"), 1);
13679
13295
  function resolveHelperEntry(options) {
13680
- const { moduleDir, nodeBin = import_node_process2.default.execPath, exists: exists2 = import_node_fs2.existsSync } = options;
13296
+ const { moduleDir, nodeBin = import_node_process3.default.execPath, exists: exists2 = import_node_fs2.existsSync } = options;
13681
13297
  for (const name of ["privileged-helper.js", "privileged-helper.cjs", "privileged-helper.mjs"]) {
13682
13298
  const candidate = findUp(moduleDir, name, exists2);
13683
13299
  if (candidate)
@@ -13705,19 +13321,20 @@ function findUp(from, relative, exists2) {
13705
13321
  // src/privileged/session.ts
13706
13322
  var import_node_buffer = require("buffer");
13707
13323
  var import_node_fs3 = require("fs");
13708
- var import_promises2 = require("fs/promises");
13324
+ var import_promises = require("fs/promises");
13709
13325
  var import_node_os4 = require("os");
13710
13326
  var import_node_path3 = require("path");
13327
+ var lockfile2 = __toESM(require("proper-lockfile"), 1);
13711
13328
 
13712
13329
  // src/privileged/launch.ts
13713
13330
  var import_node_child_process2 = require("child_process");
13714
13331
  var import_node_crypto = require("crypto");
13715
13332
  var import_node_os3 = require("os");
13716
- var import_node_process5 = __toESM(require("process"), 1);
13333
+ var import_node_process6 = __toESM(require("process"), 1);
13717
13334
 
13718
13335
  // src/privileged/client.ts
13719
13336
  var import_node_net = require("net");
13720
- var import_node_process3 = __toESM(require("process"), 1);
13337
+ var import_node_process4 = __toESM(require("process"), 1);
13721
13338
 
13722
13339
  // src/privileged/protocol.ts
13723
13340
  function serializeMessage(message) {
@@ -13780,7 +13397,7 @@ var FORWARDED_ENV_KEYS = [
13780
13397
  "NO_PROXY",
13781
13398
  "no_proxy"
13782
13399
  ];
13783
- function collectForwardedEnv(source = import_node_process3.default.env) {
13400
+ function collectForwardedEnv(source = import_node_process4.default.env) {
13784
13401
  const result = {};
13785
13402
  for (const key of FORWARDED_ENV_KEYS) {
13786
13403
  const value2 = source[key];
@@ -13957,7 +13574,7 @@ function createClient(socket, initialBuffer, callTimeoutMs) {
13957
13574
 
13958
13575
  // src/privileged/windows-elevation.ts
13959
13576
  var import_node_child_process = require("child_process");
13960
- var import_node_process4 = __toESM(require("process"), 1);
13577
+ var import_node_process5 = __toESM(require("process"), 1);
13961
13578
  function quotePowerShell(value2) {
13962
13579
  return `'${value2.replace(/'/g, "''")}'`;
13963
13580
  }
@@ -14017,9 +13634,9 @@ function authenticateSudo(sudoCommand = "sudo", options = {}) {
14017
13634
  return { ok: true };
14018
13635
  if (options.target) {
14019
13636
  for (const line of describePasswordReason(options.target, options.https ?? false))
14020
- import_node_process5.default.stderr.write(`${line}
13637
+ import_node_process6.default.stderr.write(`${line}
14021
13638
  `);
14022
- import_node_process5.default.stderr.write("\n");
13639
+ import_node_process6.default.stderr.write("\n");
14023
13640
  }
14024
13641
  if ((0, import_node_child_process2.spawnSync)(sudoCommand, ["-v"], { stdio: "inherit" }).status === 0)
14025
13642
  return { ok: true };
@@ -14045,7 +13662,7 @@ async function startPrivilegedHelper(options) {
14045
13662
  sudoCommand = "sudo",
14046
13663
  skipAuth = false,
14047
13664
  direct = false,
14048
- env: env2 = import_node_process5.default.env,
13665
+ env: env2 = import_node_process6.default.env,
14049
13666
  log,
14050
13667
  connectTimeoutMs = 12e4
14051
13668
  } = options;
@@ -14064,8 +13681,8 @@ async function startPrivilegedHelper(options) {
14064
13681
  socketPath,
14065
13682
  "--token",
14066
13683
  token,
14067
- ...typeof import_node_process5.default.getuid === "function" ? ["--owner-uid", String(import_node_process5.default.getuid())] : [],
14068
- ...typeof import_node_process5.default.getgid === "function" ? ["--owner-gid", String(import_node_process5.default.getgid())] : [],
13684
+ ...typeof import_node_process6.default.getuid === "function" ? ["--owner-uid", String(import_node_process6.default.getuid())] : [],
13685
+ ...typeof import_node_process6.default.getgid === "function" ? ["--owner-gid", String(import_node_process6.default.getgid())] : [],
14069
13686
  ...options.caddyStoragePath ? ["--caddy-storage", options.caddyStoragePath] : [],
14070
13687
  "--caddy",
14071
13688
  options.caddyBin,
@@ -14074,7 +13691,7 @@ async function startPrivilegedHelper(options) {
14074
13691
  ];
14075
13692
  let child;
14076
13693
  if (!direct && (0, import_node_os3.platform)() === "win32") {
14077
- await spawnElevatedOnWindows({ file: helperEntry, args: childArgv, cwd: import_node_process5.default.cwd() });
13694
+ await spawnElevatedOnWindows({ file: helperEntry, args: childArgv, cwd: import_node_process6.default.cwd() });
14078
13695
  } else {
14079
13696
  const command = direct ? helperEntry : sudoCommand;
14080
13697
  const spawnArgs = direct ? childArgv : ["-n", "env", ...forwardedArgs, helperEntry, ...childArgv];
@@ -14131,21 +13748,34 @@ function sessionSocketPath(runtimeDir) {
14131
13748
  }
14132
13749
  async function openHelperSession(scope2) {
14133
13750
  const socketPath = sessionSocketPath(scope2.runtimeDir);
14134
- if ((0, import_node_fs3.existsSync)(socketPath) || (0, import_node_os4.platform)() === "win32") {
14135
- const token2 = await readToken(scope2.runtimeDir);
14136
- if (token2) {
14137
- const reused = await connectExistingHelper(socketPath, token2);
14138
- if (reused) {
14139
- return {
14140
- client: reused,
14141
- reused: true,
14142
- close: async () => {
14143
- await reused.close();
14144
- }
14145
- };
14146
- }
14147
- }
13751
+ const release = await acquireStartLock(scope2.runtimeDir);
13752
+ try {
13753
+ const reused = await tryReuse(socketPath, scope2);
13754
+ if (reused)
13755
+ return reused;
13756
+ return await startNew(socketPath, scope2);
13757
+ } finally {
13758
+ release();
14148
13759
  }
13760
+ }
13761
+ async function tryReuse(socketPath, scope2) {
13762
+ if (!(0, import_node_fs3.existsSync)(socketPath) && (0, import_node_os4.platform)() !== "win32")
13763
+ return void 0;
13764
+ const token = await readToken(scope2.runtimeDir);
13765
+ if (!token)
13766
+ return void 0;
13767
+ const reused = await connectExistingHelper(socketPath, token);
13768
+ if (!reused)
13769
+ return void 0;
13770
+ return {
13771
+ client: reused,
13772
+ reused: true,
13773
+ close: async () => {
13774
+ await reused.close();
13775
+ }
13776
+ };
13777
+ }
13778
+ async function startNew(socketPath, scope2) {
14149
13779
  const token = createHelperToken();
14150
13780
  const started = await startPrivilegedHelper({
14151
13781
  socketPath,
@@ -14171,9 +13801,25 @@ async function openHelperSession(scope2) {
14171
13801
  }
14172
13802
  };
14173
13803
  }
13804
+ async function acquireStartLock(runtimeDir) {
13805
+ const lockPath = (0, import_node_path3.join)(runtimeDir, "helper.start.lock");
13806
+ try {
13807
+ await (0, import_promises.writeFile)(lockPath, "", { flag: "a" });
13808
+ } catch {
13809
+ }
13810
+ const release = await lockfile2.lock(lockPath, {
13811
+ realpath: false,
13812
+ stale: 3e4,
13813
+ retries: { retries: 100, minTimeout: 50, maxTimeout: 200 }
13814
+ });
13815
+ return () => {
13816
+ void release().catch(() => {
13817
+ });
13818
+ };
13819
+ }
14174
13820
  async function readToken(runtimeDir) {
14175
13821
  try {
14176
- const content = await (0, import_promises2.readFile)(tokenPath(runtimeDir), "utf8");
13822
+ const content = await (0, import_promises.readFile)(tokenPath(runtimeDir), "utf8");
14177
13823
  const token = content.trim();
14178
13824
  return token === "" ? void 0 : token;
14179
13825
  } catch {
@@ -14182,7 +13828,7 @@ async function readToken(runtimeDir) {
14182
13828
  }
14183
13829
  async function writeToken(runtimeDir, token) {
14184
13830
  try {
14185
- await (0, import_promises2.writeFile)(tokenPath(runtimeDir), token, { mode: 384 });
13831
+ await (0, import_promises.writeFile)(tokenPath(runtimeDir), token, { mode: 384 });
14186
13832
  } catch {
14187
13833
  }
14188
13834
  }
@@ -14230,7 +13876,7 @@ var HelperCaddyProcess = class extends import_node_events.EventEmitter {
14230
13876
  }
14231
13877
  };
14232
13878
  function caddyStoragePath() {
14233
- return import_node_process6.default.platform === "win32" ? (0, import_node_path4.join)(import_node_process6.default.env.AppData ?? "", "Caddy") : (0, import_node_path4.join)(import_node_process6.default.env.HOME ?? "", "Library/Application Support/Caddy");
13879
+ return import_node_process7.default.platform === "win32" ? (0, import_node_path4.join)(import_node_process7.default.env.AppData ?? "", "Caddy") : (0, import_node_path4.join)(import_node_process7.default.env.HOME ?? "", "Library/Application Support/Caddy");
14234
13880
  }
14235
13881
  function openPrivilegedSession(runtimeDir, options) {
14236
13882
  const env2 = resolvePrivilegedEnv();
@@ -14380,15 +14026,15 @@ async function download() {
14380
14026
  const file = (0, import_node_fs4.createWriteStream)(caddyPath);
14381
14027
  let _platform = (0, import_node_os5.platform)().toString();
14382
14028
  _platform === "win32" && (_platform = "windows");
14383
- let _arch = import_node_process7.default.arch.toString();
14029
+ let _arch = import_node_process8.default.arch.toString();
14384
14030
  _arch === "x64" && (_arch = "amd64");
14385
14031
  const support = supportList.find((item) => item.platform === _platform && item.arch === _arch);
14386
14032
  if (!support)
14387
14033
  return reject2(new Error("not support"));
14388
14034
  const dowmloadLink = `https://caddyserver.com/api/download?os=${support.platform}&arch=${support.arch}&p=github.com%2Fcaddyserver%2Fforwardproxy`;
14389
14035
  (0, import_node_fs4.existsSync)(caddyPath) && (0, import_node_fs4.unlinkSync)(caddyPath);
14390
- const httpProxy = import_node_process7.default.env.HTTP_PROXY || import_node_process7.default.env.http_proxy;
14391
- const httpsProxy = import_node_process7.default.env.HTTPS_PROXY || import_node_process7.default.env.https_proxy;
14036
+ const httpProxy = import_node_process8.default.env.HTTP_PROXY || import_node_process8.default.env.http_proxy;
14037
+ const httpsProxy = import_node_process8.default.env.HTTPS_PROXY || import_node_process8.default.env.https_proxy;
14392
14038
  const httpAgent = httpProxy ? new import_http_proxy_agent.HttpProxyAgent(httpProxy) : void 0;
14393
14039
  const httpsAgent = httpsProxy ? new import_https_proxy_agent.HttpsProxyAgent(httpsProxy) : void 0;
14394
14040
  const chmodCaddyOnce = once(() => {
@@ -14404,7 +14050,7 @@ async function download() {
14404
14050
  chmodCaddyOnce();
14405
14051
  }).pipe(file).on("finish", () => {
14406
14052
  logProgressOver();
14407
- if (import_node_process7.default.platform === "win32")
14053
+ if (import_node_process8.default.platform === "win32")
14408
14054
  return resolve2(caddyPath);
14409
14055
  (0, import_node_fs4.chmodSync)(caddyPath, 493);
14410
14056
  resolve2(caddyPath);
@@ -14454,26 +14100,17 @@ var defaultDependencies = {
14454
14100
  caddyBin: caddyPath,
14455
14101
  caddyConfigPath: caddyFilePath,
14456
14102
  reason
14457
- })
14103
+ }),
14104
+ config: () => getCaddyConfig()
14458
14105
  };
14459
14106
  var CaddyInstant = class {
14460
14107
  constructor(deps = {}) {
14461
14108
  this.inited = false;
14462
14109
  this.stoped = false;
14463
- /** has locked when start */
14464
- this.locked = false;
14465
14110
  this._stopEffects = [];
14111
+ /** Identifies this instance's routes in the shared config. */
14112
+ this.proxyKey = `${import_node_process8.default.pid}-${Math.random().toString(36).slice(2, 8)}`;
14466
14113
  this.deps = { ...defaultDependencies, ...deps };
14467
- this.locked = this.checkLock();
14468
- }
14469
- checkLock() {
14470
- if (!(0, import_node_fs4.existsSync)(caddyLockFilePath))
14471
- (0, import_node_fs4.writeFileSync)(caddyLockFilePath, "");
14472
- try {
14473
- return lockfile.checkSync(caddyLockFilePath);
14474
- } catch {
14475
- return false;
14476
- }
14477
14114
  }
14478
14115
  /**
14479
14116
  * Connects to the privileged helper, starting it once if needed. It is
@@ -14492,20 +14129,20 @@ var CaddyInstant = class {
14492
14129
  this.caddyfile = "";
14493
14130
  return "";
14494
14131
  }
14495
- this.caddyfile = await (0, import_promises3.readFile)(caddyFilePath, "utf-8");
14132
+ this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
14496
14133
  return this.caddyfile;
14497
14134
  }
14498
14135
  get caddyRoot() {
14499
14136
  return (0, import_node_path5.join)(
14500
- import_node_process7.default.platform === "win32" ? `${import_node_process7.default.env.AppData}/Caddy` : `${import_node_process7.default.env.HOME}/Library/Application Support/Caddy`,
14137
+ import_node_process8.default.platform === "win32" ? `${import_node_process8.default.env.AppData}/Caddy` : `${import_node_process8.default.env.HOME}/Library/Application Support/Caddy`,
14501
14138
  "./pki/authorities/local"
14502
14139
  );
14503
14140
  }
14504
14141
  async writeCaddyfile() {
14505
- return await (0, import_promises3.writeFile)(caddyFilePath, this.caddyfile || "");
14142
+ return await (0, import_promises2.writeFile)(caddyFilePath, this.caddyfile || "");
14506
14143
  }
14507
14144
  async deleteCaddyfile() {
14508
- return await (0, import_promises3.unlink)(caddyFilePath);
14145
+ return await (0, import_promises2.unlink)(caddyFilePath);
14509
14146
  }
14510
14147
  async init() {
14511
14148
  await download();
@@ -14543,9 +14180,15 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14543
14180
  if (!health.healthy)
14544
14181
  throw new Error(formatTlsHealthFailure(targetHost, health));
14545
14182
  }
14183
+ /**
14184
+ * Regenerates the Caddyfile from the config on disk.
14185
+ *
14186
+ * Reading the file rather than a cached view matters here: another project
14187
+ * may have added its route since this instance last looked.
14188
+ */
14546
14189
  async updateCaddyfile() {
14547
- const { configJsonRef } = getCaddyConfig();
14548
- const proxies = Object.values(configJsonRef() || {});
14190
+ const { readProxies } = this.deps.config();
14191
+ const proxies = Object.values(readProxies());
14549
14192
  const ctx = validateTemplateContext({
14550
14193
  caddy_root: this.caddyRoot,
14551
14194
  proxies
@@ -14594,7 +14237,7 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14594
14237
  const session = await this.session({ target: targetHost, https });
14595
14238
  await session.client.call("hosts.add", { ip: sourceHost, host: targetHost });
14596
14239
  consola.success("update host success\n");
14597
- const normalizeBase = (b) => {
14240
+ const normalizeBase2 = (b) => {
14598
14241
  let out = b || "/";
14599
14242
  if (!out.startsWith("/"))
14600
14243
  out = `/${out}`;
@@ -14602,7 +14245,7 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14602
14245
  out = `${out}/`;
14603
14246
  return out;
14604
14247
  };
14605
- const baseNormalized = normalizeBase(base);
14248
+ const baseNormalized = normalizeBase2(base);
14606
14249
  const proxies = [
14607
14250
  {
14608
14251
  target: targetHost,
@@ -14613,27 +14256,12 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14613
14256
  healthCheck
14614
14257
  }
14615
14258
  ];
14616
- const { writeCaddyConfig } = getCaddyConfig();
14617
- writeCaddyConfig(proxies);
14259
+ const { writeCaddyConfig } = this.deps.config();
14260
+ await writeCaddyConfig(proxies, this.proxyKey);
14618
14261
  await this.updateCaddyfile();
14619
- let skipInitialCaddyfileEffect = true;
14620
- this._stopEffects.push(
14621
- effect(() => {
14622
- getCaddyConfig().configJsonRef();
14623
- if (skipInitialCaddyfileEffect) {
14624
- skipInitialCaddyfileEffect = false;
14625
- return;
14626
- }
14627
- void this.updateCaddyfile();
14628
- })
14629
- );
14630
- if (!(0, import_node_fs4.existsSync)(caddyLockFilePath))
14631
- (0, import_node_fs4.writeFileSync)(caddyLockFilePath, "");
14632
- if (!this.locked) {
14633
- await session.client.call("port.free", { port: 443 });
14634
- if (import_node_process7.default.platform === "win32" || !https)
14635
- await session.client.call("port.free", { port: 80 });
14636
- }
14262
+ await session.client.call("port.free", { port: 443 });
14263
+ if (import_node_process8.default.platform === "win32" || !https)
14264
+ await session.client.call("port.free", { port: 80 });
14637
14265
  return new Promise((resolve2, reject2) => {
14638
14266
  let startupCheckStarted = false;
14639
14267
  const resolveWhenReady = async () => {
@@ -14647,106 +14275,89 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14647
14275
  }
14648
14276
  resolve2();
14649
14277
  } catch (error) {
14650
- if (!this.locked)
14651
- await this.baseCleanup(restore);
14278
+ await this.baseCleanup(restore);
14652
14279
  reject2(error);
14653
14280
  }
14654
14281
  };
14655
14282
  const setupCleanup = () => {
14656
- import_node_process7.default.on("SIGINT", async () => {
14283
+ import_node_process8.default.on("SIGINT", async () => {
14657
14284
  if (this.stoped)
14658
14285
  return;
14659
- import_node_process7.default.stdin.resume();
14286
+ import_node_process8.default.stdin.resume();
14660
14287
  try {
14661
14288
  await this.baseCleanup(restore);
14662
14289
  } finally {
14663
14290
  this.stoped = true;
14664
- import_node_process7.default.nextTick(() => {
14665
- import_node_process7.default.exit();
14291
+ import_node_process8.default.nextTick(() => {
14292
+ import_node_process8.default.exit();
14666
14293
  });
14667
14294
  }
14668
14295
  });
14669
- const originalExit = import_node_process7.default.exit.bind(import_node_process7.default);
14670
- import_node_process7.default.exit = async (code) => {
14296
+ const originalExit = import_node_process8.default.exit.bind(import_node_process8.default);
14297
+ import_node_process8.default.exit = async (code) => {
14671
14298
  if (this.stoped)
14672
14299
  return originalExit(code);
14673
- import_node_process7.default.stdin.resume();
14300
+ import_node_process8.default.stdin.resume();
14674
14301
  try {
14675
14302
  await this.baseCleanup();
14676
14303
  } finally {
14677
14304
  this.stoped = true;
14678
- import_node_process7.default.nextTick(() => {
14305
+ import_node_process8.default.nextTick(() => {
14679
14306
  originalExit(code);
14680
14307
  });
14681
14308
  }
14682
14309
  };
14683
14310
  };
14684
- if (!this.locked) {
14685
- lockfile.lockSync(caddyLockFilePath);
14686
- setupCleanup();
14687
- void (async () => {
14688
- try {
14689
- const child = new HelperCaddyProcess(session.client);
14690
- this._caddyChild = child;
14691
- await session.client.call("caddy.start");
14692
- child.on("exit", (code) => {
14693
- if (code !== null && code !== 0)
14694
- reject2(new Error(`Caddy exited with code ${code}`));
14695
- });
14696
- child.stderr.on("data", async (data) => {
14697
- const lines = data.toString().split("\n").map((line) => line.trim());
14698
- for (const line of lines) {
14699
- showCaddyLog && line && console.info(line);
14700
- if (isCaddyReloadCancellation(line)) {
14701
- consola.info("Caddy restarted before TLS issuance completed; retrying.\n");
14702
- continue;
14703
- }
14704
- try {
14705
- if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
14706
- if (line.includes("parsing caddyfile tokens")) {
14707
- consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
14311
+ setupCleanup();
14312
+ void (async () => {
14313
+ try {
14314
+ const child = new HelperCaddyProcess(session.client);
14315
+ this._caddyChild = child;
14316
+ await session.client.call("caddy.start");
14317
+ child.on("exit", (code) => {
14318
+ if (code !== null && code !== 0)
14319
+ reject2(new Error(`Caddy exited with code ${code}`));
14320
+ });
14321
+ child.stderr.on("data", async (data) => {
14322
+ const lines = data.toString().split("\n").map((line) => line.trim());
14323
+ for (const line of lines) {
14324
+ showCaddyLog && line && console.info(line);
14325
+ if (isCaddyReloadCancellation(line)) {
14326
+ consola.info("Caddy restarted before TLS issuance completed; retrying.\n");
14327
+ continue;
14328
+ }
14329
+ try {
14330
+ if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
14331
+ if (line.includes("parsing caddyfile tokens")) {
14332
+ consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
14708
14333
 
14709
14334
  ${line}
14710
14335
  `);
14711
- await this.baseCleanup();
14712
- import_node_process7.default.exit();
14713
- } else {
14714
- consola.error(`${line}
14336
+ await this.baseCleanup();
14337
+ import_node_process8.default.exit();
14338
+ } else {
14339
+ consola.error(`${line}
14715
14340
  `);
14716
- return reject2(line);
14717
- }
14341
+ return reject2(line);
14718
14342
  }
14719
- } catch {
14720
14343
  }
14721
- if (line.includes("config file changed"))
14722
- consola.success("Detect added a new reverse proxy config, restarted.\n");
14723
- if (line.includes("caddy proxying") || line.includes("serving initial"))
14724
- void resolveWhenReady();
14344
+ } catch {
14725
14345
  }
14726
- });
14727
- child.stdout.on("data", (data) => {
14728
- consola.info(data.toString());
14729
- void resolveWhenReady();
14730
- });
14731
- } catch (error) {
14732
- if (!this.locked)
14733
- await this.baseCleanup(restore);
14734
- reject2(error);
14735
- }
14736
- })();
14737
- } else {
14738
- consola.info("Caddy is running in another process.");
14739
- void (async () => {
14740
- try {
14741
- if (https)
14742
- await this.ensureTlsReady(targetHost);
14743
- setupCleanup();
14744
- resolve2();
14745
- } catch (error) {
14746
- reject2(error);
14747
- }
14748
- })();
14749
- }
14346
+ if (line.includes("config file changed"))
14347
+ consola.success("Detect added a new reverse proxy config, restarted.\n");
14348
+ if (line.includes("caddy proxying") || line.includes("serving initial"))
14349
+ void resolveWhenReady();
14350
+ }
14351
+ });
14352
+ child.stdout.on("data", (data) => {
14353
+ consola.info(data.toString());
14354
+ void resolveWhenReady();
14355
+ });
14356
+ } catch (error) {
14357
+ await this.baseCleanup(restore);
14358
+ reject2(error);
14359
+ }
14360
+ })();
14750
14361
  });
14751
14362
  }
14752
14363
  async baseCleanup(restore = true) {
@@ -14770,18 +14381,9 @@ ${line}
14770
14381
  consola.fail("Restore host failed.\n");
14771
14382
  }
14772
14383
  }
14773
- if (!this.locked && !this.stoped) {
14774
- await this.stopCaddy();
14384
+ if (!this.stoped) {
14775
14385
  try {
14776
- await lockfile.unlock(caddyLockFilePath).catch(() => {
14777
- });
14778
- await (0, import_promises3.unlink)(caddyFilePath).catch(() => {
14779
- });
14780
- await (0, import_promises3.unlink)(caddyLockFilePath).catch(() => {
14781
- });
14782
- if (caddyConfig) {
14783
- await caddyConfig.cleanUp();
14784
- }
14386
+ await this.deps.config().removeProxy(this.proxyKey);
14785
14387
  } catch (e) {
14786
14388
  consola.error(e);
14787
14389
  }
@@ -14937,7 +14539,7 @@ function isPrivilegeDenied() {
14937
14539
 
14938
14540
  // src/index.ts
14939
14541
  var caddy;
14940
- var cwd = import_node_process8.default.cwd();
14542
+ var cwd = import_node_process9.default.cwd();
14941
14543
  function colorUrl(url2) {
14942
14544
  return import_picocolors2.default.green(url2.replace(/:(\d+)\//, (_, port) => `:${import_picocolors2.default.bold(port)}/`));
14943
14545
  }
@@ -15005,7 +14607,7 @@ var nuxt_default = (0, import_kit.defineNuxtModule)({
15005
14607
  configKey: "unpluginHttpsReverseProxy"
15006
14608
  },
15007
14609
  setup(options, _nuxt) {
15008
- if (import_node_process9.default.env.NODE_ENV !== "development")
14610
+ if (import_node_process10.default.env.NODE_ENV !== "development")
15009
14611
  return;
15010
14612
  const {
15011
14613
  enable = true,