unplugin-https-reverse-proxy 1.0.0-beta.8 → 1.0.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/esbuild.cjs CHANGED
@@ -3,22 +3,8 @@ var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
6
  var __getProtoOf = Object.getPrototypeOf;
8
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
8
  var __export = (target, all) => {
23
9
  for (var name in all)
24
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -85,7 +71,7 @@ function isAdmin() {
85
71
  try {
86
72
  (0, import_node_child_process.execSync)("net session", { stdio: "ignore" });
87
73
  return true;
88
- } catch (e) {
74
+ } catch {
89
75
  return false;
90
76
  }
91
77
  } else {
@@ -97,22 +83,21 @@ function isAdmin() {
97
83
  var import_node_os2 = require("os");
98
84
  var import_node_process4 = __toESM(require("process"), 1);
99
85
  var import_node_fs2 = require("fs");
100
- var import_node_child_process3 = require("child_process");
86
+ var import_node_child_process4 = require("child_process");
87
+ var import_promises2 = require("fs/promises");
101
88
  var import_got_cjs = require("got-cjs");
102
89
  var import_http_proxy_agent = require("http-proxy-agent");
103
90
  var import_https_proxy_agent = require("https-proxy-agent");
104
- var import_kill_port = __toESM(require("kill-port"), 1);
91
+ var lockfile = __toESM(require("proper-lockfile"), 1);
105
92
 
106
93
  // src/host/index.ts
107
94
  var import_node_process2 = __toESM(require("process"), 1);
108
95
  var import_node_child_process2 = require("child_process");
109
96
  var import_node_fs = require("fs");
110
- var import_hosts_so_easy = __toESM(require("hosts-so-easy"), 1);
111
- var Hosts = import_hosts_so_easy.default.default || import_hosts_so_easy.default;
112
- var hostInstance = new Hosts({
113
- debounceTime: 50,
114
- hostsFile: getPathOfSystemHostsPath()
115
- });
97
+ var import_node_util = require("util");
98
+ var import_hostile = __toESM(require("hostile"), 1);
99
+ var _setHost = (0, import_node_util.promisify)(import_hostile.default.set);
100
+ var _removeHost = (0, import_node_util.promisify)(import_hostile.default.remove);
116
101
  function getPathOfSystemHostsPath() {
117
102
  return import_node_process2.default.platform === "win32" ? `${import_node_process2.default.env.windir || "C:\\WINDOWS"}\\system32\\drivers\\etc\\hosts` : "/etc/hosts";
118
103
  }
@@ -133,20 +118,18 @@ async function syncHost() {
133
118
  async function addHost(ip, host) {
134
119
  if (import_node_process2.default.platform !== "win32")
135
120
  (0, import_node_fs.chmodSync)(getPathOfSystemHostsPath(), 511);
136
- hostInstance.add("127.0.0.1", "localhost");
137
- hostInstance.add(ip, host);
121
+ await _setHost("127.0.0.1", "localhost");
122
+ await _setHost(ip, host);
138
123
  if (ip === "localhost")
139
- hostInstance.add("127.0.0.1", host);
140
- await hostInstance.updateFinish();
124
+ await _setHost("127.0.0.1", host);
141
125
  return await syncHost();
142
126
  }
143
127
  async function removeHost(ip, host) {
144
128
  if (import_node_process2.default.platform !== "win32")
145
129
  (0, import_node_fs.chmodSync)(getPathOfSystemHostsPath(), 511);
146
- hostInstance.remove(ip, host);
130
+ await _removeHost(ip, host);
147
131
  if (ip === "localhost")
148
- hostInstance.remove("127.0.0.1", host);
149
- await hostInstance.updateFinish();
132
+ await _removeHost("127.0.0.1", host);
150
133
  return await syncHost();
151
134
  }
152
135
 
@@ -166,6 +149,7 @@ function resolvePath(path2) {
166
149
  var TEMP_DIR = resolvePath(import_node_process3.default.env.UHRP_CADDY_PATH || import_node_process3.default.env.TEMP || import_node_process3.default.env.TMPDIR || "/tmp");
167
150
  var caddyPath = (0, import_node_path2.join)(TEMP_DIR, `caddy${import_node_process3.default.platform === "win32" ? ".exe" : ""}`);
168
151
  var caddyFilePath = (0, import_node_path2.join)(TEMP_DIR, "CADDYFILE");
152
+ var caddyLockFilePath = (0, import_node_path2.join)(TEMP_DIR, "caddylock");
169
153
  var supportList = [
170
154
  {
171
155
  platform: "dragonfly",
@@ -279,6 +263,7 @@ var supportList = [
279
263
 
280
264
  // src/caddy/utils.ts
281
265
  var import_node_net = require("net");
266
+ var import_node_child_process3 = require("child_process");
282
267
  var import_ora = __toESM(require("ora"), 1);
283
268
  var spinner;
284
269
  function tryPort(port) {
@@ -299,6 +284,18 @@ function tryPort(port) {
299
284
  }
300
285
  });
301
286
  }
287
+ async function kill(port) {
288
+ return new Promise((resolve, reject) => {
289
+ (0, import_node_child_process3.exec)(`npx @maxbo/free-port ${port} -s`, (err, stdout, stderr) => {
290
+ if (err) {
291
+ reject(err);
292
+ } else {
293
+ consola.log(stdout);
294
+ resolve();
295
+ }
296
+ });
297
+ });
298
+ }
302
299
  function getNumber(number) {
303
300
  if (number <= 0)
304
301
  return "0%";
@@ -382,7 +379,7 @@ function testCaddy() {
382
379
  if (!(0, import_node_fs2.existsSync)(caddyPath))
383
380
  return resolve(false);
384
381
  (0, import_node_fs2.chmodSync)(caddyPath, 511);
385
- const child = import_node_process4.default.platform === "win32" ? (0, import_node_child_process3.spawn)(caddyPath, []) : (0, import_node_child_process3.spawn)("sudo", ["-E", caddyPath]);
382
+ const child = import_node_process4.default.platform === "win32" ? (0, import_node_child_process4.spawn)(caddyPath, []) : (0, import_node_child_process4.spawn)("sudo", ["-E", caddyPath]);
386
383
  child.on("close", () => {
387
384
  return resolve(false);
388
385
  });
@@ -398,9 +395,41 @@ var CaddyInstant = class {
398
395
  constructor() {
399
396
  this.inited = false;
400
397
  this.stoped = false;
401
- testCaddy().then(() => {
398
+ /** has locked */
399
+ this.locked = false;
400
+ testCaddy().then(async () => {
401
+ await this.getCaddyfile();
402
402
  this.inited = true;
403
403
  });
404
+ this.locked = this.checkLock();
405
+ }
406
+ checkLock() {
407
+ if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
408
+ (0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
409
+ return lockfile.checkSync(caddyLockFilePath);
410
+ }
411
+ async getCaddyfile() {
412
+ if (!(0, import_node_fs2.existsSync)(caddyFilePath))
413
+ await this.initCaddyfile();
414
+ this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
415
+ return this.caddyfile;
416
+ }
417
+ async initCaddyfile() {
418
+ const contet = `
419
+ {
420
+ debug
421
+ auto_https disable_redirects
422
+ }
423
+
424
+ `;
425
+ await (0, import_promises2.writeFile)(caddyFilePath, contet);
426
+ this.caddyfile = contet;
427
+ }
428
+ async writeCaddyfile() {
429
+ return await (0, import_promises2.writeFile)(caddyFilePath, this.caddyfile || "");
430
+ }
431
+ async deleteCaddyfile() {
432
+ return await (0, import_promises2.unlink)(caddyFilePath);
404
433
  }
405
434
  async init() {
406
435
  await download();
@@ -419,100 +448,184 @@ var CaddyInstant = class {
419
448
  showCaddyLog = false,
420
449
  https = false
421
450
  } = options || {};
451
+ this._source = source;
452
+ this._target = target;
422
453
  if (!this.inited)
423
454
  await this.init();
424
- if (https && await tryPort(443))
425
- await (0, import_kill_port.default)(443, "tcp");
426
- if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
427
- await (0, import_kill_port.default)(80, "tcp");
428
455
  if (!await addHost(source.split(":")[0], target.split(":")[0]))
429
456
  throw new Error("update host failed");
430
457
  consola.success("update host success\n");
458
+ await this.getCaddyfile();
459
+ if (!(this.caddyfile || "").includes(`${target.split(":")[0]}${https ? "" : ":80"}`)) {
460
+ this.caddyfile = `${this.caddyfile}
461
+ ${target.split(":")[0]}${https ? "" : ":80"} {
462
+ ${https ? "tls internal" : ""}
463
+ reverse_proxy http://${source} {
464
+ health_uri ${base}
465
+ health_interval 2s
466
+ health_timeout 5s
467
+ fail_duration 2s
468
+ unhealthy_status 502 503 504 404
469
+ lb_try_duration 3s
470
+ lb_try_interval 300ms
471
+ health_headers {
472
+ Accept text/html
473
+ Accept-Encoding gzip, deflate, br
474
+ User-Agent Caddy-Health-Check
475
+ }
476
+
477
+ @error status 502 503 504 404
478
+ handle_response @error {
479
+ respond * 503 {
480
+ body "Service Unavailable"
481
+ close
482
+ }
483
+ }
484
+ }
485
+ }
486
+
487
+ `;
488
+ await this.writeCaddyfile();
489
+ }
490
+ if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
491
+ (0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
492
+ if (!this.locked) {
493
+ if (await tryPort(443))
494
+ await kill(443);
495
+ if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
496
+ await kill(80);
497
+ }
431
498
  return new Promise((resolve, reject) => {
432
- const child = import_node_process4.default.platform !== "win32" ? (0, import_node_child_process3.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}${https ? "" : ":80"}`, "--to", `${source}`, "--internal-certs", "--insecure", "--disable-redirects"]) : (0, import_node_child_process3.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
433
- child.on("error", (err) => {
434
- return reject(err);
435
- });
436
- import_node_process4.default.on("SIGINT", async () => {
437
- if (!restore || this.stoped)
438
- return;
439
- try {
440
- if (await removeHost(source.split(":")[0], target.split(":")[0]))
441
- consola.success("restore host success\n");
442
- else
443
- consola.fail("restore host failed\n");
444
- } catch (e) {
445
- consola.error(e);
446
- consola.fail("restore host failed\n");
447
- } finally {
448
- this.stoped = true;
449
- import_node_process4.default.nextTick(() => {
450
- import_node_process4.default.exit();
451
- });
452
- }
453
- });
454
- const originalExit = import_node_process4.default.exit.bind(import_node_process4.default);
455
- import_node_process4.default.exit = async (code) => {
456
- const port = Number(source.split(":")[1]);
457
- if (!Number.isNaN(port) && await tryPort(port))
458
- await (0, import_kill_port.default)(port, "tcp");
459
- const pwd2 = import_node_process4.default.cwd();
460
- const viteCacheDir = `${pwd2}/node_modules/.vite`;
461
- if ((0, import_node_fs2.existsSync)(viteCacheDir))
462
- chmodRecursive(viteCacheDir, 511);
463
- const nuxtCacheDir = `${pwd2}/.nuxt`;
464
- if ((0, import_node_fs2.existsSync)(nuxtCacheDir))
465
- await chmodRecursive(nuxtCacheDir, 511);
466
- const webpackCacheDir = `${pwd2}/node_modules/.cache`;
467
- if ((0, import_node_fs2.existsSync)(webpackCacheDir))
468
- chmodRecursive(webpackCacheDir, 511);
469
- if (!restore || this.stoped)
470
- return originalExit(code);
471
- try {
472
- if (await removeHost(source.split(":")[0], target.split(":")[0]))
473
- consola.success("restore host success\n");
474
- else
475
- consola.fail("restore host failed\n");
476
- } catch (e) {
477
- consola.error(e);
478
- consola.fail("restore host failed\n");
479
- } finally {
480
- this.stoped = true;
481
- import_node_process4.default.nextTick(() => {
482
- originalExit(code);
483
- });
484
- }
499
+ var _a, _b;
500
+ const setupCleanup = () => {
501
+ import_node_process4.default.on("SIGINT", async () => {
502
+ if (this.stoped)
503
+ return;
504
+ import_node_process4.default.stdin.resume();
505
+ try {
506
+ await this.baseCleanup(restore);
507
+ } finally {
508
+ this.stoped = true;
509
+ import_node_process4.default.nextTick(() => {
510
+ import_node_process4.default.exit();
511
+ });
512
+ }
513
+ });
514
+ const originalExit = import_node_process4.default.exit.bind(import_node_process4.default);
515
+ import_node_process4.default.exit = async (code) => {
516
+ const port = Number(source.split(":")[1]);
517
+ if (!Number.isNaN(port) && await tryPort(port))
518
+ await kill(port);
519
+ const pwd = import_node_process4.default.cwd();
520
+ const viteCacheDir = `${pwd}/node_modules/.vite`;
521
+ if ((0, import_node_fs2.existsSync)(viteCacheDir))
522
+ await chmodRecursive(viteCacheDir, 511).catch(() => {
523
+ });
524
+ const nuxtCacheDir = `${pwd}/.nuxt`;
525
+ if ((0, import_node_fs2.existsSync)(nuxtCacheDir))
526
+ await chmodRecursive(nuxtCacheDir, 511).catch(() => {
527
+ });
528
+ const webpackCacheDir = `${pwd}/node_modules/.cache`;
529
+ if ((0, import_node_fs2.existsSync)(webpackCacheDir))
530
+ await chmodRecursive(webpackCacheDir, 511).catch(() => {
531
+ });
532
+ if (this.stoped)
533
+ return originalExit(code);
534
+ import_node_process4.default.stdin.resume();
535
+ try {
536
+ await this.baseCleanup();
537
+ } finally {
538
+ this.stoped = true;
539
+ import_node_process4.default.nextTick(() => {
540
+ originalExit(code);
541
+ });
542
+ }
543
+ };
485
544
  };
486
- child.stderr.on("data", (data) => {
487
- const lines = data.toString().split("\n").map((line) => line.trim());
488
- for (const line of lines) {
489
- showCaddyLog && line && console.info(line);
490
- if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
491
- consola.error(line);
492
- return reject(line);
545
+ if (!this.locked) {
546
+ this._caddyChild = import_node_process4.default.platform !== "win32" ? (0, import_node_child_process4.spawn)("sudo", ["-E", caddyPath, "run", "--config", caddyFilePath, "--watch"]) : (0, import_node_child_process4.spawn)(caddyPath, ["run", "--config", caddyFilePath, "--watch"]);
547
+ lockfile.lockSync(caddyLockFilePath);
548
+ this._caddyChild.on("error", (err) => {
549
+ return reject(err);
550
+ });
551
+ (_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", async (data) => {
552
+ const lines = data.toString().split("\n").map((line) => line.trim());
553
+ for (const line of lines) {
554
+ showCaddyLog && line && console.info(line);
555
+ if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
556
+ if (line.includes("parsing caddyfile tokens")) {
557
+ consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
558
+
559
+ ${line}
560
+ `);
561
+ await this.baseCleanup();
562
+ import_node_process4.default.exit();
563
+ } else {
564
+ consola.error(`${line}
565
+ `);
566
+ return reject(line);
567
+ }
568
+ }
569
+ if (line.includes("config file changed"))
570
+ consola.success("Detect added a new reverse proxy config, restarted.\n");
571
+ if (line.includes("caddy proxying") || line.includes("serving initial"))
572
+ return resolve();
493
573
  }
494
- }
495
- });
496
- child.stdout.on("data", (_data) => {
497
- consola.info(_data.toString());
498
- resolve();
499
- });
574
+ });
575
+ (_b = this._caddyChild.stdout) == null ? void 0 : _b.on("data", (_data) => {
576
+ consola.info(_data.toString());
577
+ resolve();
578
+ });
579
+ setupCleanup();
580
+ } else {
581
+ consola.info("Caddy is running in another process.");
582
+ setupCleanup();
583
+ return resolve();
584
+ }
500
585
  });
501
586
  }
587
+ async baseCleanup(restore = true) {
588
+ var _a;
589
+ try {
590
+ if (restore && this._source && this._target) {
591
+ if (await removeHost(this._source.split(":")[0], this._target.split(":")[0]))
592
+ consola.success("Restore host success.\n");
593
+ else
594
+ consola.fail("Restore host failed.\n");
595
+ }
596
+ } catch (e) {
597
+ consola.error(e);
598
+ consola.fail("Restore host failed.\n");
599
+ }
600
+ if (!this.locked && !this.stoped) {
601
+ (_a = this._caddyChild) == null ? void 0 : _a.kill();
602
+ try {
603
+ await lockfile.unlock(caddyLockFilePath).catch(() => {
604
+ });
605
+ await (0, import_promises2.unlink)(caddyFilePath).catch(() => {
606
+ });
607
+ await (0, import_promises2.unlink)(caddyLockFilePath).catch(() => {
608
+ });
609
+ } catch (e) {
610
+ consola.error(e);
611
+ }
612
+ }
613
+ }
502
614
  };
503
615
 
504
616
  // src/index.ts
505
617
  var config;
506
618
  var caddy;
507
- var pwd = import_node_process5.default.cwd();
619
+ var cwd = import_node_process5.default.cwd();
508
620
  var vitePrintUrls = once((options, source, target, base = "/", _printUrls) => {
509
621
  _printUrls == null ? void 0 : _printUrls();
510
622
  if (caddy)
511
623
  return;
512
624
  caddy = new CaddyInstant();
513
- caddy.run(source, target, __spreadValues({
514
- base
515
- }, options)).then(() => {
625
+ caddy.run(source, target, {
626
+ base,
627
+ ...options
628
+ }).then(() => {
516
629
  const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
517
630
  consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
518
631
  }).catch((e) => {
@@ -530,16 +643,16 @@ var unpluginFactory = (options) => ({
530
643
  var _a;
531
644
  if (config.command !== "serve")
532
645
  return;
533
- if (!isAdmin()) {
534
- consola.warn("please run as administrator");
535
- return;
536
- }
537
646
  const {
538
647
  enable = true,
539
648
  target = ""
540
649
  } = options;
541
650
  if (!enable)
542
651
  return;
652
+ if (!isAdmin()) {
653
+ consola.warn("please run as administrator");
654
+ return;
655
+ }
543
656
  if (!target) {
544
657
  consola.fail("please provide target");
545
658
  return;
@@ -556,31 +669,34 @@ var unpluginFactory = (options) => ({
556
669
  }
557
670
  },
558
671
  webpack(compiler) {
559
- var _a;
672
+ var _a, _b;
560
673
  if (import_node_process5.default.env.NODE_ENV !== "development")
561
674
  return;
562
- if (!isAdmin()) {
563
- consola.warn("please run as administrator");
564
- return;
565
- }
566
675
  const {
567
676
  enable = true,
568
677
  target = ""
569
678
  } = options;
570
679
  if (!enable)
571
680
  return;
681
+ if (!isAdmin()) {
682
+ consola.warn("please run as administrator");
683
+ return;
684
+ }
572
685
  if (!target) {
573
686
  consola.fail("please provide target");
574
687
  return;
575
688
  }
576
- const devServer = __spreadValues(__spreadValues({
689
+ const devServer = {
577
690
  host: "localhost",
578
- port: 8080
579
- }, compiler.options.devServer), import_node_process5.default.VUE_CLI_SERVICE.projectOptions.devServer);
691
+ port: 8080,
692
+ ...compiler.options.devServer,
693
+ // @ts-expect-error vuecli
694
+ ...(_a = import_node_process5.default.VUE_CLI_SERVICE) == null ? void 0 : _a.projectOptions.devServer
695
+ };
580
696
  const source = `${devServer.host}:${devServer.port}`;
581
697
  if (caddy)
582
698
  return;
583
- const _close = (_a = compiler.close) == null ? void 0 : _a.bind(compiler);
699
+ const _close = (_b = compiler.close) == null ? void 0 : _b.bind(compiler);
584
700
  if (_close) {
585
701
  compiler.close = async (callback) => {
586
702
  import_node_process5.default.on("exit", () => {
@@ -591,7 +707,9 @@ var unpluginFactory = (options) => ({
591
707
  options.https = false;
592
708
  }
593
709
  caddy = new CaddyInstant();
594
- caddy.run(source, target, __spreadValues({}, options)).then(() => {
710
+ caddy.run(source, target, {
711
+ ...options
712
+ }).then(() => {
595
713
  const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
596
714
  compiler.hooks.done.tap("unplugin-https-reverse-proxy", () => {
597
715
  consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}`)}`);
@@ -599,9 +717,48 @@ var unpluginFactory = (options) => ({
599
717
  }).catch((e) => {
600
718
  throw e;
601
719
  });
720
+ },
721
+ async rspack(compiler) {
722
+ var _a, _b, _c;
723
+ if (import_node_process5.default.env.NODE_ENV !== "development")
724
+ return;
725
+ const {
726
+ enable = true,
727
+ target = ""
728
+ } = options;
729
+ if (!enable)
730
+ return;
731
+ if (!isAdmin()) {
732
+ consola.warn("please run as administrator");
733
+ return;
734
+ }
735
+ if (!target) {
736
+ consola.fail("please provide target");
737
+ return;
738
+ }
739
+ const devServer = {
740
+ host: "localhost",
741
+ port: 8080,
742
+ ...compiler.options.devServer,
743
+ ...(_c = (_b = await ((_a = await import("@rsbuild/core")) == null ? void 0 : _a.loadConfig({
744
+ cwd
745
+ }))) == null ? void 0 : _b.content) == null ? void 0 : _c.server
746
+ };
747
+ const source = `${devServer.host}:${devServer.port}`;
748
+ if (caddy)
749
+ return;
750
+ caddy = new CaddyInstant();
751
+ caddy.run(source, target, {
752
+ ...options
753
+ }).then(() => {
754
+ const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
755
+ consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}`)}`);
756
+ }).catch((e) => {
757
+ throw e;
758
+ });
602
759
  }
603
760
  });
604
761
 
605
762
  // src/esbuild.ts
606
763
  var esbuild_default = (0, import_unplugin2.createEsbuildPlugin)(unpluginFactory);
607
- exports.default = module.exports;
764
+ module.exports = module.exports;exports.default = module.exports;
package/dist/esbuild.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-AYUGOY4B.js";
4
- import "./chunk-RUJE3YFB.js";
3
+ } from "./chunk-KVE7AVSI.js";
4
+ import "./chunk-2VGRJ3QS.js";
5
5
 
6
6
  // src/esbuild.ts
7
7
  import { createEsbuildPlugin } from "unplugin";