unplugin-https-reverse-proxy 0.0.15 → 0.0.16
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/README.md +5 -4
- package/dist/{chunk-EI2YSLDH.js → chunk-G5VIL2MO.js} +14 -13
- package/dist/{chunk-6MTK7ADW.js → chunk-HWUN3C5Q.js} +1 -1
- package/dist/{chunk-EDUM4QD7.js → chunk-MPY62XIL.js} +1 -1
- package/dist/esbuild.cjs +14 -13
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +14 -13
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +14 -13
- package/dist/nuxt.js +3 -3
- package/dist/rollup.cjs +14 -13
- package/dist/rollup.js +1 -1
- package/dist/types.d.cts +2 -0
- package/dist/types.d.ts +2 -0
- package/dist/vite.cjs +14 -13
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +14 -13
- package/dist/webpack.js +2 -2
- package/package.json +1 -1
- package/src/caddy/index.ts +8 -3
- package/src/index.ts +4 -4
- package/src/types.ts +2 -0
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ interface Options {
|
|
|
19
19
|
enable?: boolean // <- default: true
|
|
20
20
|
target: string // <- https target hostname
|
|
21
21
|
showCaddyLog?: boolean // <- default: false
|
|
22
|
+
https?: boolean // <- default: false
|
|
22
23
|
}
|
|
23
24
|
```
|
|
24
25
|
|
|
@@ -51,9 +52,9 @@ module.exports = {
|
|
|
51
52
|
client: {
|
|
52
53
|
// ↓ for HMR
|
|
53
54
|
webSocketURL: {
|
|
54
|
-
protocol: 'wss',
|
|
55
|
+
// protocol: 'wss', // <- if you set options.https to `true`
|
|
56
|
+
// port: 443, // <- if you set options.https to `true`
|
|
55
57
|
hostname: 'xxx', // <- target hostname
|
|
56
|
-
port: 443,
|
|
57
58
|
},
|
|
58
59
|
},
|
|
59
60
|
setupExitSignals: true,
|
|
@@ -93,8 +94,8 @@ module.exports = {
|
|
|
93
94
|
client: {
|
|
94
95
|
// ↓ for HMR
|
|
95
96
|
webSocketURL: {
|
|
96
|
-
protocol: 'wss',
|
|
97
|
-
|
|
97
|
+
// protocol: 'wss', // <- if you set options.https to `true`
|
|
98
|
+
// port: 443, // <- if you set options.https to `true`
|
|
98
99
|
port: 443,
|
|
99
100
|
},
|
|
100
101
|
},
|
|
@@ -260,9 +260,11 @@ var CaddyInstant = class {
|
|
|
260
260
|
await download();
|
|
261
261
|
this.inited = true;
|
|
262
262
|
}
|
|
263
|
-
updateHost(ip, host) {
|
|
263
|
+
async updateHost(ip, host) {
|
|
264
264
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
265
|
+
this.host.add("127.0.0.1", "localhost");
|
|
265
266
|
this.host.add(ip, host);
|
|
267
|
+
await this.host.updateFinish();
|
|
266
268
|
return new Promise((resolve, reject) => {
|
|
267
269
|
if (process2.platform === "win32") {
|
|
268
270
|
spawn("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -281,9 +283,10 @@ var CaddyInstant = class {
|
|
|
281
283
|
}
|
|
282
284
|
});
|
|
283
285
|
}
|
|
284
|
-
restoreHost(ip, host) {
|
|
286
|
+
async restoreHost(ip, host) {
|
|
285
287
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
286
288
|
this.host.remove(ip, host);
|
|
289
|
+
await this.host.updateFinish();
|
|
287
290
|
return new Promise((resolve, reject) => {
|
|
288
291
|
if (process2.platform === "win32") {
|
|
289
292
|
spawn("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -312,7 +315,8 @@ var CaddyInstant = class {
|
|
|
312
315
|
const {
|
|
313
316
|
restore = true,
|
|
314
317
|
base = "/",
|
|
315
|
-
showCaddyLog = false
|
|
318
|
+
showCaddyLog = false,
|
|
319
|
+
https = false
|
|
316
320
|
} = options || {};
|
|
317
321
|
if (!this.inited)
|
|
318
322
|
await this.init();
|
|
@@ -324,7 +328,7 @@ var CaddyInstant = class {
|
|
|
324
328
|
throw new Error("update host failed");
|
|
325
329
|
consola.success("update host success\n");
|
|
326
330
|
return new Promise((resolve, reject) => {
|
|
327
|
-
const child = process2.platform !== "win32" ? spawn("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]) : spawn(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
331
|
+
const child = process2.platform !== "win32" ? spawn("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}${https ? "" : ":80"}`, "--to", `${source}`, "--internal-certs", "--insecure", "--disable-redirects"]) : spawn(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
328
332
|
child.on("error", (err) => {
|
|
329
333
|
return reject(err);
|
|
330
334
|
});
|
|
@@ -443,12 +447,11 @@ var unpluginFactory = (options) => ({
|
|
|
443
447
|
if (caddy)
|
|
444
448
|
return;
|
|
445
449
|
caddy = new CaddyInstant();
|
|
446
|
-
caddy.run(source, target, {
|
|
447
|
-
base
|
|
448
|
-
|
|
449
|
-
}).then((stop) => {
|
|
450
|
+
caddy.run(source, target, __spreadValues({
|
|
451
|
+
base
|
|
452
|
+
}, options)).then((stop) => {
|
|
450
453
|
const colorUrl = (url2) => c.green(url2.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`));
|
|
451
|
-
consola.success(` ${c.green("\u279C")} ${c.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
454
|
+
consola.success(` ${c.green("\u279C")} ${c.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
|
|
452
455
|
!_stop && (_stop = once(stop));
|
|
453
456
|
}).catch((e) => {
|
|
454
457
|
throw e;
|
|
@@ -490,12 +493,10 @@ var unpluginFactory = (options) => ({
|
|
|
490
493
|
}
|
|
491
494
|
};
|
|
492
495
|
caddy = new CaddyInstant();
|
|
493
|
-
caddy.run(source, target, {
|
|
494
|
-
showCaddyLog: options.showCaddyLog
|
|
495
|
-
}).then((stop) => {
|
|
496
|
+
caddy.run(source, target, __spreadValues({}, options)).then((stop) => {
|
|
496
497
|
const colorUrl = (url) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`));
|
|
497
498
|
compiler.hooks.done.tap("unplugin-https-reverse-proxy", () => {
|
|
498
|
-
consola.success(` ${c.green("\u279C")} ${c.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
499
|
+
consola.success(` ${c.green("\u279C")} ${c.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}`)}`);
|
|
499
500
|
!_stop && (_stop = once(stop));
|
|
500
501
|
});
|
|
501
502
|
}).catch((e) => {
|
package/dist/esbuild.cjs
CHANGED
|
@@ -320,9 +320,11 @@ var CaddyInstant = class {
|
|
|
320
320
|
await download();
|
|
321
321
|
this.inited = true;
|
|
322
322
|
}
|
|
323
|
-
updateHost(ip, host) {
|
|
323
|
+
async updateHost(ip, host) {
|
|
324
324
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
325
|
+
this.host.add("127.0.0.1", "localhost");
|
|
325
326
|
this.host.add(ip, host);
|
|
327
|
+
await this.host.updateFinish();
|
|
326
328
|
return new Promise((resolve, reject) => {
|
|
327
329
|
if (import_node_process2.default.platform === "win32") {
|
|
328
330
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -341,9 +343,10 @@ var CaddyInstant = class {
|
|
|
341
343
|
}
|
|
342
344
|
});
|
|
343
345
|
}
|
|
344
|
-
restoreHost(ip, host) {
|
|
346
|
+
async restoreHost(ip, host) {
|
|
345
347
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
346
348
|
this.host.remove(ip, host);
|
|
349
|
+
await this.host.updateFinish();
|
|
347
350
|
return new Promise((resolve, reject) => {
|
|
348
351
|
if (import_node_process2.default.platform === "win32") {
|
|
349
352
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -372,7 +375,8 @@ var CaddyInstant = class {
|
|
|
372
375
|
const {
|
|
373
376
|
restore = true,
|
|
374
377
|
base = "/",
|
|
375
|
-
showCaddyLog = false
|
|
378
|
+
showCaddyLog = false,
|
|
379
|
+
https = false
|
|
376
380
|
} = options || {};
|
|
377
381
|
if (!this.inited)
|
|
378
382
|
await this.init();
|
|
@@ -384,7 +388,7 @@ var CaddyInstant = class {
|
|
|
384
388
|
throw new Error("update host failed");
|
|
385
389
|
consola.success("update host success\n");
|
|
386
390
|
return new Promise((resolve, reject) => {
|
|
387
|
-
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
391
|
+
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}${https ? "" : ":80"}`, "--to", `${source}`, "--internal-certs", "--insecure", "--disable-redirects"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
388
392
|
child.on("error", (err) => {
|
|
389
393
|
return reject(err);
|
|
390
394
|
});
|
|
@@ -503,12 +507,11 @@ var unpluginFactory = (options) => ({
|
|
|
503
507
|
if (caddy)
|
|
504
508
|
return;
|
|
505
509
|
caddy = new CaddyInstant();
|
|
506
|
-
caddy.run(source, target, {
|
|
507
|
-
base
|
|
508
|
-
|
|
509
|
-
}).then((stop) => {
|
|
510
|
+
caddy.run(source, target, __spreadValues({
|
|
511
|
+
base
|
|
512
|
+
}, options)).then((stop) => {
|
|
510
513
|
const colorUrl = (url2) => import_picocolors.default.green(url2.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
511
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
514
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
|
|
512
515
|
!_stop && (_stop = once(stop));
|
|
513
516
|
}).catch((e) => {
|
|
514
517
|
throw e;
|
|
@@ -550,12 +553,10 @@ var unpluginFactory = (options) => ({
|
|
|
550
553
|
}
|
|
551
554
|
};
|
|
552
555
|
caddy = new CaddyInstant();
|
|
553
|
-
caddy.run(source, target, {
|
|
554
|
-
showCaddyLog: options.showCaddyLog
|
|
555
|
-
}).then((stop) => {
|
|
556
|
+
caddy.run(source, target, __spreadValues({}, options)).then((stop) => {
|
|
556
557
|
const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
557
558
|
compiler.hooks.done.tap("unplugin-https-reverse-proxy", () => {
|
|
558
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
559
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}`)}`);
|
|
559
560
|
!_stop && (_stop = once(stop));
|
|
560
561
|
});
|
|
561
562
|
}).catch((e) => {
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -319,9 +319,11 @@ var CaddyInstant = class {
|
|
|
319
319
|
await download();
|
|
320
320
|
this.inited = true;
|
|
321
321
|
}
|
|
322
|
-
updateHost(ip, host) {
|
|
322
|
+
async updateHost(ip, host) {
|
|
323
323
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
324
|
+
this.host.add("127.0.0.1", "localhost");
|
|
324
325
|
this.host.add(ip, host);
|
|
326
|
+
await this.host.updateFinish();
|
|
325
327
|
return new Promise((resolve, reject) => {
|
|
326
328
|
if (import_node_process2.default.platform === "win32") {
|
|
327
329
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -340,9 +342,10 @@ var CaddyInstant = class {
|
|
|
340
342
|
}
|
|
341
343
|
});
|
|
342
344
|
}
|
|
343
|
-
restoreHost(ip, host) {
|
|
345
|
+
async restoreHost(ip, host) {
|
|
344
346
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
345
347
|
this.host.remove(ip, host);
|
|
348
|
+
await this.host.updateFinish();
|
|
346
349
|
return new Promise((resolve, reject) => {
|
|
347
350
|
if (import_node_process2.default.platform === "win32") {
|
|
348
351
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -371,7 +374,8 @@ var CaddyInstant = class {
|
|
|
371
374
|
const {
|
|
372
375
|
restore = true,
|
|
373
376
|
base = "/",
|
|
374
|
-
showCaddyLog = false
|
|
377
|
+
showCaddyLog = false,
|
|
378
|
+
https = false
|
|
375
379
|
} = options || {};
|
|
376
380
|
if (!this.inited)
|
|
377
381
|
await this.init();
|
|
@@ -383,7 +387,7 @@ var CaddyInstant = class {
|
|
|
383
387
|
throw new Error("update host failed");
|
|
384
388
|
consola.success("update host success\n");
|
|
385
389
|
return new Promise((resolve, reject) => {
|
|
386
|
-
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
390
|
+
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}${https ? "" : ":80"}`, "--to", `${source}`, "--internal-certs", "--insecure", "--disable-redirects"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
387
391
|
child.on("error", (err) => {
|
|
388
392
|
return reject(err);
|
|
389
393
|
});
|
|
@@ -502,12 +506,11 @@ var unpluginFactory = (options) => ({
|
|
|
502
506
|
if (caddy)
|
|
503
507
|
return;
|
|
504
508
|
caddy = new CaddyInstant();
|
|
505
|
-
caddy.run(source, target, {
|
|
506
|
-
base
|
|
507
|
-
|
|
508
|
-
}).then((stop) => {
|
|
509
|
+
caddy.run(source, target, __spreadValues({
|
|
510
|
+
base
|
|
511
|
+
}, options)).then((stop) => {
|
|
509
512
|
const colorUrl = (url2) => import_picocolors.default.green(url2.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
510
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
513
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
|
|
511
514
|
!_stop && (_stop = once(stop));
|
|
512
515
|
}).catch((e) => {
|
|
513
516
|
throw e;
|
|
@@ -549,12 +552,10 @@ var unpluginFactory = (options) => ({
|
|
|
549
552
|
}
|
|
550
553
|
};
|
|
551
554
|
caddy = new CaddyInstant();
|
|
552
|
-
caddy.run(source, target, {
|
|
553
|
-
showCaddyLog: options.showCaddyLog
|
|
554
|
-
}).then((stop) => {
|
|
555
|
+
caddy.run(source, target, __spreadValues({}, options)).then((stop) => {
|
|
555
556
|
const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
556
557
|
compiler.hooks.done.tap("unplugin-https-reverse-proxy", () => {
|
|
557
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
558
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}`)}`);
|
|
558
559
|
!_stop && (_stop = once(stop));
|
|
559
560
|
});
|
|
560
561
|
}).catch((e) => {
|
package/dist/index.js
CHANGED
package/dist/nuxt.cjs
CHANGED
|
@@ -323,9 +323,11 @@ var CaddyInstant = class {
|
|
|
323
323
|
await download();
|
|
324
324
|
this.inited = true;
|
|
325
325
|
}
|
|
326
|
-
updateHost(ip, host) {
|
|
326
|
+
async updateHost(ip, host) {
|
|
327
327
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
328
|
+
this.host.add("127.0.0.1", "localhost");
|
|
328
329
|
this.host.add(ip, host);
|
|
330
|
+
await this.host.updateFinish();
|
|
329
331
|
return new Promise((resolve, reject) => {
|
|
330
332
|
if (import_node_process2.default.platform === "win32") {
|
|
331
333
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -344,9 +346,10 @@ var CaddyInstant = class {
|
|
|
344
346
|
}
|
|
345
347
|
});
|
|
346
348
|
}
|
|
347
|
-
restoreHost(ip, host) {
|
|
349
|
+
async restoreHost(ip, host) {
|
|
348
350
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
349
351
|
this.host.remove(ip, host);
|
|
352
|
+
await this.host.updateFinish();
|
|
350
353
|
return new Promise((resolve, reject) => {
|
|
351
354
|
if (import_node_process2.default.platform === "win32") {
|
|
352
355
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -375,7 +378,8 @@ var CaddyInstant = class {
|
|
|
375
378
|
const {
|
|
376
379
|
restore = true,
|
|
377
380
|
base = "/",
|
|
378
|
-
showCaddyLog = false
|
|
381
|
+
showCaddyLog = false,
|
|
382
|
+
https = false
|
|
379
383
|
} = options || {};
|
|
380
384
|
if (!this.inited)
|
|
381
385
|
await this.init();
|
|
@@ -387,7 +391,7 @@ var CaddyInstant = class {
|
|
|
387
391
|
throw new Error("update host failed");
|
|
388
392
|
consola.success("update host success\n");
|
|
389
393
|
return new Promise((resolve, reject) => {
|
|
390
|
-
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
394
|
+
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}${https ? "" : ":80"}`, "--to", `${source}`, "--internal-certs", "--insecure", "--disable-redirects"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
391
395
|
child.on("error", (err) => {
|
|
392
396
|
return reject(err);
|
|
393
397
|
});
|
|
@@ -506,12 +510,11 @@ var unpluginFactory = (options) => ({
|
|
|
506
510
|
if (caddy)
|
|
507
511
|
return;
|
|
508
512
|
caddy = new CaddyInstant();
|
|
509
|
-
caddy.run(source, target, {
|
|
510
|
-
base
|
|
511
|
-
|
|
512
|
-
}).then((stop) => {
|
|
513
|
+
caddy.run(source, target, __spreadValues({
|
|
514
|
+
base
|
|
515
|
+
}, options)).then((stop) => {
|
|
513
516
|
const colorUrl = (url2) => import_picocolors.default.green(url2.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
514
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
517
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
|
|
515
518
|
!_stop && (_stop = once(stop));
|
|
516
519
|
}).catch((e) => {
|
|
517
520
|
throw e;
|
|
@@ -553,12 +556,10 @@ var unpluginFactory = (options) => ({
|
|
|
553
556
|
}
|
|
554
557
|
};
|
|
555
558
|
caddy = new CaddyInstant();
|
|
556
|
-
caddy.run(source, target, {
|
|
557
|
-
showCaddyLog: options.showCaddyLog
|
|
558
|
-
}).then((stop) => {
|
|
559
|
+
caddy.run(source, target, __spreadValues({}, options)).then((stop) => {
|
|
559
560
|
const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
560
561
|
compiler.hooks.done.tap("unplugin-https-reverse-proxy", () => {
|
|
561
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
562
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}`)}`);
|
|
562
563
|
!_stop && (_stop = once(stop));
|
|
563
564
|
});
|
|
564
565
|
}).catch((e) => {
|
package/dist/nuxt.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
vite_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HWUN3C5Q.js";
|
|
4
4
|
import {
|
|
5
5
|
webpack_default
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-MPY62XIL.js";
|
|
7
|
+
import "./chunk-G5VIL2MO.js";
|
|
8
8
|
import "./chunk-CQC5SSJR.js";
|
|
9
9
|
|
|
10
10
|
// src/nuxt.ts
|
package/dist/rollup.cjs
CHANGED
|
@@ -320,9 +320,11 @@ var CaddyInstant = class {
|
|
|
320
320
|
await download();
|
|
321
321
|
this.inited = true;
|
|
322
322
|
}
|
|
323
|
-
updateHost(ip, host) {
|
|
323
|
+
async updateHost(ip, host) {
|
|
324
324
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
325
|
+
this.host.add("127.0.0.1", "localhost");
|
|
325
326
|
this.host.add(ip, host);
|
|
327
|
+
await this.host.updateFinish();
|
|
326
328
|
return new Promise((resolve, reject) => {
|
|
327
329
|
if (import_node_process2.default.platform === "win32") {
|
|
328
330
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -341,9 +343,10 @@ var CaddyInstant = class {
|
|
|
341
343
|
}
|
|
342
344
|
});
|
|
343
345
|
}
|
|
344
|
-
restoreHost(ip, host) {
|
|
346
|
+
async restoreHost(ip, host) {
|
|
345
347
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
346
348
|
this.host.remove(ip, host);
|
|
349
|
+
await this.host.updateFinish();
|
|
347
350
|
return new Promise((resolve, reject) => {
|
|
348
351
|
if (import_node_process2.default.platform === "win32") {
|
|
349
352
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -372,7 +375,8 @@ var CaddyInstant = class {
|
|
|
372
375
|
const {
|
|
373
376
|
restore = true,
|
|
374
377
|
base = "/",
|
|
375
|
-
showCaddyLog = false
|
|
378
|
+
showCaddyLog = false,
|
|
379
|
+
https = false
|
|
376
380
|
} = options || {};
|
|
377
381
|
if (!this.inited)
|
|
378
382
|
await this.init();
|
|
@@ -384,7 +388,7 @@ var CaddyInstant = class {
|
|
|
384
388
|
throw new Error("update host failed");
|
|
385
389
|
consola.success("update host success\n");
|
|
386
390
|
return new Promise((resolve, reject) => {
|
|
387
|
-
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
391
|
+
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}${https ? "" : ":80"}`, "--to", `${source}`, "--internal-certs", "--insecure", "--disable-redirects"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
388
392
|
child.on("error", (err) => {
|
|
389
393
|
return reject(err);
|
|
390
394
|
});
|
|
@@ -503,12 +507,11 @@ var unpluginFactory = (options) => ({
|
|
|
503
507
|
if (caddy)
|
|
504
508
|
return;
|
|
505
509
|
caddy = new CaddyInstant();
|
|
506
|
-
caddy.run(source, target, {
|
|
507
|
-
base
|
|
508
|
-
|
|
509
|
-
}).then((stop) => {
|
|
510
|
+
caddy.run(source, target, __spreadValues({
|
|
511
|
+
base
|
|
512
|
+
}, options)).then((stop) => {
|
|
510
513
|
const colorUrl = (url2) => import_picocolors.default.green(url2.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
511
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
514
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
|
|
512
515
|
!_stop && (_stop = once(stop));
|
|
513
516
|
}).catch((e) => {
|
|
514
517
|
throw e;
|
|
@@ -550,12 +553,10 @@ var unpluginFactory = (options) => ({
|
|
|
550
553
|
}
|
|
551
554
|
};
|
|
552
555
|
caddy = new CaddyInstant();
|
|
553
|
-
caddy.run(source, target, {
|
|
554
|
-
showCaddyLog: options.showCaddyLog
|
|
555
|
-
}).then((stop) => {
|
|
556
|
+
caddy.run(source, target, __spreadValues({}, options)).then((stop) => {
|
|
556
557
|
const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
557
558
|
compiler.hooks.done.tap("unplugin-https-reverse-proxy", () => {
|
|
558
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
559
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}`)}`);
|
|
559
560
|
!_stop && (_stop = once(stop));
|
|
560
561
|
});
|
|
561
562
|
}).catch((e) => {
|
package/dist/rollup.js
CHANGED
package/dist/types.d.cts
CHANGED
package/dist/types.d.ts
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -320,9 +320,11 @@ var CaddyInstant = class {
|
|
|
320
320
|
await download();
|
|
321
321
|
this.inited = true;
|
|
322
322
|
}
|
|
323
|
-
updateHost(ip, host) {
|
|
323
|
+
async updateHost(ip, host) {
|
|
324
324
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
325
|
+
this.host.add("127.0.0.1", "localhost");
|
|
325
326
|
this.host.add(ip, host);
|
|
327
|
+
await this.host.updateFinish();
|
|
326
328
|
return new Promise((resolve, reject) => {
|
|
327
329
|
if (import_node_process2.default.platform === "win32") {
|
|
328
330
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -341,9 +343,10 @@ var CaddyInstant = class {
|
|
|
341
343
|
}
|
|
342
344
|
});
|
|
343
345
|
}
|
|
344
|
-
restoreHost(ip, host) {
|
|
346
|
+
async restoreHost(ip, host) {
|
|
345
347
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
346
348
|
this.host.remove(ip, host);
|
|
349
|
+
await this.host.updateFinish();
|
|
347
350
|
return new Promise((resolve, reject) => {
|
|
348
351
|
if (import_node_process2.default.platform === "win32") {
|
|
349
352
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -372,7 +375,8 @@ var CaddyInstant = class {
|
|
|
372
375
|
const {
|
|
373
376
|
restore = true,
|
|
374
377
|
base = "/",
|
|
375
|
-
showCaddyLog = false
|
|
378
|
+
showCaddyLog = false,
|
|
379
|
+
https = false
|
|
376
380
|
} = options || {};
|
|
377
381
|
if (!this.inited)
|
|
378
382
|
await this.init();
|
|
@@ -384,7 +388,7 @@ var CaddyInstant = class {
|
|
|
384
388
|
throw new Error("update host failed");
|
|
385
389
|
consola.success("update host success\n");
|
|
386
390
|
return new Promise((resolve, reject) => {
|
|
387
|
-
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
391
|
+
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}${https ? "" : ":80"}`, "--to", `${source}`, "--internal-certs", "--insecure", "--disable-redirects"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
388
392
|
child.on("error", (err) => {
|
|
389
393
|
return reject(err);
|
|
390
394
|
});
|
|
@@ -503,12 +507,11 @@ var unpluginFactory = (options) => ({
|
|
|
503
507
|
if (caddy)
|
|
504
508
|
return;
|
|
505
509
|
caddy = new CaddyInstant();
|
|
506
|
-
caddy.run(source, target, {
|
|
507
|
-
base
|
|
508
|
-
|
|
509
|
-
}).then((stop) => {
|
|
510
|
+
caddy.run(source, target, __spreadValues({
|
|
511
|
+
base
|
|
512
|
+
}, options)).then((stop) => {
|
|
510
513
|
const colorUrl = (url2) => import_picocolors.default.green(url2.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
511
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
514
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
|
|
512
515
|
!_stop && (_stop = once(stop));
|
|
513
516
|
}).catch((e) => {
|
|
514
517
|
throw e;
|
|
@@ -550,12 +553,10 @@ var unpluginFactory = (options) => ({
|
|
|
550
553
|
}
|
|
551
554
|
};
|
|
552
555
|
caddy = new CaddyInstant();
|
|
553
|
-
caddy.run(source, target, {
|
|
554
|
-
showCaddyLog: options.showCaddyLog
|
|
555
|
-
}).then((stop) => {
|
|
556
|
+
caddy.run(source, target, __spreadValues({}, options)).then((stop) => {
|
|
556
557
|
const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
557
558
|
compiler.hooks.done.tap("unplugin-https-reverse-proxy", () => {
|
|
558
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
559
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}`)}`);
|
|
559
560
|
!_stop && (_stop = once(stop));
|
|
560
561
|
});
|
|
561
562
|
}).catch((e) => {
|
package/dist/vite.js
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -320,9 +320,11 @@ var CaddyInstant = class {
|
|
|
320
320
|
await download();
|
|
321
321
|
this.inited = true;
|
|
322
322
|
}
|
|
323
|
-
updateHost(ip, host) {
|
|
323
|
+
async updateHost(ip, host) {
|
|
324
324
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
325
|
+
this.host.add("127.0.0.1", "localhost");
|
|
325
326
|
this.host.add(ip, host);
|
|
327
|
+
await this.host.updateFinish();
|
|
326
328
|
return new Promise((resolve, reject) => {
|
|
327
329
|
if (import_node_process2.default.platform === "win32") {
|
|
328
330
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -341,9 +343,10 @@ var CaddyInstant = class {
|
|
|
341
343
|
}
|
|
342
344
|
});
|
|
343
345
|
}
|
|
344
|
-
restoreHost(ip, host) {
|
|
346
|
+
async restoreHost(ip, host) {
|
|
345
347
|
["localhost", "0.0.0.0"].includes(ip) && (ip = "127.0.0.1");
|
|
346
348
|
this.host.remove(ip, host);
|
|
349
|
+
await this.host.updateFinish();
|
|
347
350
|
return new Promise((resolve, reject) => {
|
|
348
351
|
if (import_node_process2.default.platform === "win32") {
|
|
349
352
|
(0, import_node_child_process.spawn)("ipconfig", ["/flushdns"]).on("error", (err) => {
|
|
@@ -372,7 +375,8 @@ var CaddyInstant = class {
|
|
|
372
375
|
const {
|
|
373
376
|
restore = true,
|
|
374
377
|
base = "/",
|
|
375
|
-
showCaddyLog = false
|
|
378
|
+
showCaddyLog = false,
|
|
379
|
+
https = false
|
|
376
380
|
} = options || {};
|
|
377
381
|
if (!this.inited)
|
|
378
382
|
await this.init();
|
|
@@ -384,7 +388,7 @@ var CaddyInstant = class {
|
|
|
384
388
|
throw new Error("update host failed");
|
|
385
389
|
consola.success("update host success\n");
|
|
386
390
|
return new Promise((resolve, reject) => {
|
|
387
|
-
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
391
|
+
const child = import_node_process2.default.platform !== "win32" ? (0, import_node_child_process.spawn)("sudo", ["-E", caddyPath, "reverse-proxy", "--from", `${target.split(":")[0]}${https ? "" : ":80"}`, "--to", `${source}`, "--internal-certs", "--insecure", "--disable-redirects"]) : (0, import_node_child_process.spawn)(caddyPath, ["reverse-proxy", "--from", `${target.split(":")[0]}`, "--to", `${source}`, "--internal-certs"]);
|
|
388
392
|
child.on("error", (err) => {
|
|
389
393
|
return reject(err);
|
|
390
394
|
});
|
|
@@ -503,12 +507,11 @@ var unpluginFactory = (options) => ({
|
|
|
503
507
|
if (caddy)
|
|
504
508
|
return;
|
|
505
509
|
caddy = new CaddyInstant();
|
|
506
|
-
caddy.run(source, target, {
|
|
507
|
-
base
|
|
508
|
-
|
|
509
|
-
}).then((stop) => {
|
|
510
|
+
caddy.run(source, target, __spreadValues({
|
|
511
|
+
base
|
|
512
|
+
}, options)).then((stop) => {
|
|
510
513
|
const colorUrl = (url2) => import_picocolors.default.green(url2.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
511
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
514
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
|
|
512
515
|
!_stop && (_stop = once(stop));
|
|
513
516
|
}).catch((e) => {
|
|
514
517
|
throw e;
|
|
@@ -550,12 +553,10 @@ var unpluginFactory = (options) => ({
|
|
|
550
553
|
}
|
|
551
554
|
};
|
|
552
555
|
caddy = new CaddyInstant();
|
|
553
|
-
caddy.run(source, target, {
|
|
554
|
-
showCaddyLog: options.showCaddyLog
|
|
555
|
-
}).then((stop) => {
|
|
556
|
+
caddy.run(source, target, __spreadValues({}, options)).then((stop) => {
|
|
556
557
|
const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
557
558
|
compiler.hooks.done.tap("unplugin-https-reverse-proxy", () => {
|
|
558
|
-
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(
|
|
559
|
+
consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}`)}`);
|
|
559
560
|
!_stop && (_stop = once(stop));
|
|
560
561
|
});
|
|
561
562
|
}).catch((e) => {
|
package/dist/webpack.js
CHANGED
package/package.json
CHANGED
package/src/caddy/index.ts
CHANGED
|
@@ -89,6 +89,7 @@ interface RunOptions {
|
|
|
89
89
|
restore: boolean
|
|
90
90
|
base: string
|
|
91
91
|
showCaddyLog: boolean
|
|
92
|
+
https: boolean
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
export class CaddyInstant {
|
|
@@ -108,9 +109,11 @@ export class CaddyInstant {
|
|
|
108
109
|
this.inited = true
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
private updateHost(ip: string, host: string) {
|
|
112
|
+
private async updateHost(ip: string, host: string) {
|
|
112
113
|
['localhost', '0.0.0.0'].includes(ip) && (ip = '127.0.0.1')
|
|
114
|
+
this.host.add('127.0.0.1', 'localhost')
|
|
113
115
|
this.host.add(ip, host)
|
|
116
|
+
await this.host.updateFinish()
|
|
114
117
|
return new Promise<boolean>((resolve, reject) => {
|
|
115
118
|
if (process.platform === 'win32') {
|
|
116
119
|
spawn('ipconfig', ['/flushdns']).on('error', (err) => {
|
|
@@ -131,9 +134,10 @@ export class CaddyInstant {
|
|
|
131
134
|
})
|
|
132
135
|
}
|
|
133
136
|
|
|
134
|
-
private restoreHost(ip: string, host: string) {
|
|
137
|
+
private async restoreHost(ip: string, host: string) {
|
|
135
138
|
['localhost', '0.0.0.0'].includes(ip) && (ip = '127.0.0.1')
|
|
136
139
|
this.host.remove(ip, host)
|
|
140
|
+
await this.host.updateFinish()
|
|
137
141
|
return new Promise<boolean>((resolve, reject) => {
|
|
138
142
|
if (process.platform === 'win32') {
|
|
139
143
|
spawn('ipconfig', ['/flushdns']).on('error', (err) => {
|
|
@@ -165,6 +169,7 @@ export class CaddyInstant {
|
|
|
165
169
|
restore = true,
|
|
166
170
|
base = '/',
|
|
167
171
|
showCaddyLog = false,
|
|
172
|
+
https = false,
|
|
168
173
|
} = options || {}
|
|
169
174
|
|
|
170
175
|
if (!this.inited)
|
|
@@ -182,7 +187,7 @@ export class CaddyInstant {
|
|
|
182
187
|
return new Promise<(callback?: () => any) => Promise<void>>((resolve, reject) => {
|
|
183
188
|
// caddy reverse-proxy --from target --to source --internal-certs
|
|
184
189
|
const child = process.platform !== 'win32'
|
|
185
|
-
? spawn('sudo', ['-E', caddyPath, 'reverse-proxy', '--from', `${target.split(':')[0]}`, '--to', `${source}`, '--internal-certs'])
|
|
190
|
+
? spawn('sudo', ['-E', caddyPath, 'reverse-proxy', '--from', `${target.split(':')[0]}${https ? '' : ':80'}`, '--to', `${source}`, '--internal-certs', '--insecure', '--disable-redirects'])
|
|
186
191
|
: spawn(caddyPath, ['reverse-proxy', '--from', `${target.split(':')[0]}`, '--to', `${source}`, '--internal-certs'])
|
|
187
192
|
|
|
188
193
|
child.on('error', (err) => {
|
package/src/index.ts
CHANGED
|
@@ -100,10 +100,10 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
|
|
|
100
100
|
caddy = new CaddyInstant()
|
|
101
101
|
caddy.run(source, target, {
|
|
102
102
|
base,
|
|
103
|
-
|
|
103
|
+
...options,
|
|
104
104
|
}).then((stop) => {
|
|
105
105
|
const colorUrl = (url: string) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`))
|
|
106
|
-
consola.success(` ${c.green('➜')} ${c.bold('run caddy reverse proxy success')}: ${colorUrl(
|
|
106
|
+
consola.success(` ${c.green('➜')} ${c.bold('run caddy reverse proxy success')}: ${colorUrl(`${options.https ? 'https' : 'http'}://${target}${base}`)}`)
|
|
107
107
|
!_stop && (_stop = once(stop))
|
|
108
108
|
}).catch((e) => {
|
|
109
109
|
throw e
|
|
@@ -166,12 +166,12 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
|
|
|
166
166
|
caddy = new CaddyInstant()
|
|
167
167
|
|
|
168
168
|
caddy.run(source, target, {
|
|
169
|
-
|
|
169
|
+
...options,
|
|
170
170
|
}).then((stop) => {
|
|
171
171
|
const colorUrl = (url: string) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`))
|
|
172
172
|
|
|
173
173
|
compiler.hooks.done.tap('unplugin-https-reverse-proxy', () => {
|
|
174
|
-
consola.success(` ${c.green('➜')} ${c.bold('run caddy reverse proxy success')}: ${colorUrl(
|
|
174
|
+
consola.success(` ${c.green('➜')} ${c.bold('run caddy reverse proxy success')}: ${colorUrl(`${options.https ? 'https' : 'http'}://${target}`)}`)
|
|
175
175
|
|
|
176
176
|
!_stop && (_stop = once(stop))
|
|
177
177
|
})
|