unplugin-https-reverse-proxy 4.1.0-beta.5 → 4.1.0-beta.6

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.
@@ -14230,11 +14230,16 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14230
14230
  try {
14231
14231
  const child = new HelperCaddyProcess(session.client);
14232
14232
  this._caddyChild = child;
14233
- await session.client.call("caddy.start");
14233
+ const started = await session.client.call("caddy.start");
14234
14234
  child.on("exit", (code) => {
14235
14235
  if (code !== null && code !== 0)
14236
14236
  reject2(new Error(`Caddy exited with code ${code}`));
14237
14237
  });
14238
+ if ((started == null ? void 0 : started.started) === false) {
14239
+ consola.info("Caddy is already running; added this route to it.");
14240
+ void resolveWhenReady();
14241
+ return;
14242
+ }
14238
14243
  child.stderr.on("data", async (data) => {
14239
14244
  const lines = data.toString().split("\n").map((line) => line.trim());
14240
14245
  for (const line of lines) {
package/dist/esbuild.cjs CHANGED
@@ -14330,11 +14330,16 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14330
14330
  try {
14331
14331
  const child = new HelperCaddyProcess(session.client);
14332
14332
  this._caddyChild = child;
14333
- await session.client.call("caddy.start");
14333
+ const started = await session.client.call("caddy.start");
14334
14334
  child.on("exit", (code) => {
14335
14335
  if (code !== null && code !== 0)
14336
14336
  reject2(new Error(`Caddy exited with code ${code}`));
14337
14337
  });
14338
+ if ((started == null ? void 0 : started.started) === false) {
14339
+ consola.info("Caddy is already running; added this route to it.");
14340
+ void resolveWhenReady();
14341
+ return;
14342
+ }
14338
14343
  child.stderr.on("data", async (data) => {
14339
14344
  const lines = data.toString().split("\n").map((line) => line.trim());
14340
14345
  for (const line of lines) {
package/dist/esbuild.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-A3KSOGWY.js";
3
+ } from "./chunk-Y4TJZ6XZ.js";
4
4
  import "./chunk-EY3HXBJ4.js";
5
5
  import "./chunk-C5A7XLKL.js";
6
6
  import "./chunk-WOMR3ZLM.js";
package/dist/index.cjs CHANGED
@@ -14330,11 +14330,16 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14330
14330
  try {
14331
14331
  const child = new HelperCaddyProcess(session.client);
14332
14332
  this._caddyChild = child;
14333
- await session.client.call("caddy.start");
14333
+ const started = await session.client.call("caddy.start");
14334
14334
  child.on("exit", (code) => {
14335
14335
  if (code !== null && code !== 0)
14336
14336
  reject2(new Error(`Caddy exited with code ${code}`));
14337
14337
  });
14338
+ if ((started == null ? void 0 : started.started) === false) {
14339
+ consola.info("Caddy is already running; added this route to it.");
14340
+ void resolveWhenReady();
14341
+ return;
14342
+ }
14338
14343
  child.stderr.on("data", async (data) => {
14339
14344
  const lines = data.toString().split("\n").map((line) => line.trim());
14340
14345
  for (const line of lines) {
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  unplugin,
4
4
  unpluginFactory,
5
5
  vitePrintUrls
6
- } from "./chunk-A3KSOGWY.js";
6
+ } from "./chunk-Y4TJZ6XZ.js";
7
7
  import "./chunk-EY3HXBJ4.js";
8
8
  import "./chunk-C5A7XLKL.js";
9
9
  import "./chunk-WOMR3ZLM.js";
package/dist/nuxt.cjs CHANGED
@@ -14331,11 +14331,16 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14331
14331
  try {
14332
14332
  const child = new HelperCaddyProcess(session.client);
14333
14333
  this._caddyChild = child;
14334
- await session.client.call("caddy.start");
14334
+ const started = await session.client.call("caddy.start");
14335
14335
  child.on("exit", (code) => {
14336
14336
  if (code !== null && code !== 0)
14337
14337
  reject2(new Error(`Caddy exited with code ${code}`));
14338
14338
  });
14339
+ if ((started == null ? void 0 : started.started) === false) {
14340
+ consola.info("Caddy is already running; added this route to it.");
14341
+ void resolveWhenReady();
14342
+ return;
14343
+ }
14339
14344
  child.stderr.on("data", async (data) => {
14340
14345
  const lines = data.toString().split("\n").map((line) => line.trim());
14341
14346
  for (const line of lines) {
package/dist/nuxt.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  vitePrintUrls
3
- } from "./chunk-A3KSOGWY.js";
3
+ } from "./chunk-Y4TJZ6XZ.js";
4
4
  import {
5
5
  consola
6
6
  } from "./chunk-EY3HXBJ4.js";
package/dist/rollup.cjs CHANGED
@@ -14330,11 +14330,16 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14330
14330
  try {
14331
14331
  const child = new HelperCaddyProcess(session.client);
14332
14332
  this._caddyChild = child;
14333
- await session.client.call("caddy.start");
14333
+ const started = await session.client.call("caddy.start");
14334
14334
  child.on("exit", (code) => {
14335
14335
  if (code !== null && code !== 0)
14336
14336
  reject2(new Error(`Caddy exited with code ${code}`));
14337
14337
  });
14338
+ if ((started == null ? void 0 : started.started) === false) {
14339
+ consola.info("Caddy is already running; added this route to it.");
14340
+ void resolveWhenReady();
14341
+ return;
14342
+ }
14338
14343
  child.stderr.on("data", async (data) => {
14339
14344
  const lines = data.toString().split("\n").map((line) => line.trim());
14340
14345
  for (const line of lines) {
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-A3KSOGWY.js";
3
+ } from "./chunk-Y4TJZ6XZ.js";
4
4
  import "./chunk-EY3HXBJ4.js";
5
5
  import "./chunk-C5A7XLKL.js";
6
6
  import "./chunk-WOMR3ZLM.js";
package/dist/rspack.cjs CHANGED
@@ -14329,11 +14329,16 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14329
14329
  try {
14330
14330
  const child = new HelperCaddyProcess(session.client);
14331
14331
  this._caddyChild = child;
14332
- await session.client.call("caddy.start");
14332
+ const started = await session.client.call("caddy.start");
14333
14333
  child.on("exit", (code) => {
14334
14334
  if (code !== null && code !== 0)
14335
14335
  reject2(new Error(`Caddy exited with code ${code}`));
14336
14336
  });
14337
+ if ((started == null ? void 0 : started.started) === false) {
14338
+ consola.info("Caddy is already running; added this route to it.");
14339
+ void resolveWhenReady();
14340
+ return;
14341
+ }
14337
14342
  child.stderr.on("data", async (data) => {
14338
14343
  const lines = data.toString().split("\n").map((line) => line.trim());
14339
14344
  for (const line of lines) {
package/dist/rspack.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  src_default
3
- } from "./chunk-A3KSOGWY.js";
3
+ } from "./chunk-Y4TJZ6XZ.js";
4
4
  import "./chunk-EY3HXBJ4.js";
5
5
  import "./chunk-C5A7XLKL.js";
6
6
  import "./chunk-WOMR3ZLM.js";
package/dist/vite.cjs CHANGED
@@ -14330,11 +14330,16 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14330
14330
  try {
14331
14331
  const child = new HelperCaddyProcess(session.client);
14332
14332
  this._caddyChild = child;
14333
- await session.client.call("caddy.start");
14333
+ const started = await session.client.call("caddy.start");
14334
14334
  child.on("exit", (code) => {
14335
14335
  if (code !== null && code !== 0)
14336
14336
  reject2(new Error(`Caddy exited with code ${code}`));
14337
14337
  });
14338
+ if ((started == null ? void 0 : started.started) === false) {
14339
+ consola.info("Caddy is already running; added this route to it.");
14340
+ void resolveWhenReady();
14341
+ return;
14342
+ }
14338
14343
  child.stderr.on("data", async (data) => {
14339
14344
  const lines = data.toString().split("\n").map((line) => line.trim());
14340
14345
  for (const line of lines) {
package/dist/vite.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-A3KSOGWY.js";
3
+ } from "./chunk-Y4TJZ6XZ.js";
4
4
  import "./chunk-EY3HXBJ4.js";
5
5
  import "./chunk-C5A7XLKL.js";
6
6
  import "./chunk-WOMR3ZLM.js";
package/dist/webpack.cjs CHANGED
@@ -14330,11 +14330,16 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14330
14330
  try {
14331
14331
  const child = new HelperCaddyProcess(session.client);
14332
14332
  this._caddyChild = child;
14333
- await session.client.call("caddy.start");
14333
+ const started = await session.client.call("caddy.start");
14334
14334
  child.on("exit", (code) => {
14335
14335
  if (code !== null && code !== 0)
14336
14336
  reject2(new Error(`Caddy exited with code ${code}`));
14337
14337
  });
14338
+ if ((started == null ? void 0 : started.started) === false) {
14339
+ consola.info("Caddy is already running; added this route to it.");
14340
+ void resolveWhenReady();
14341
+ return;
14342
+ }
14338
14343
  child.stderr.on("data", async (data) => {
14339
14344
  const lines = data.toString().split("\n").map((line) => line.trim());
14340
14345
  for (const line of lines) {
package/dist/webpack.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-A3KSOGWY.js";
3
+ } from "./chunk-Y4TJZ6XZ.js";
4
4
  import "./chunk-EY3HXBJ4.js";
5
5
  import "./chunk-C5A7XLKL.js";
6
6
  import "./chunk-WOMR3ZLM.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-https-reverse-proxy",
3
3
  "type": "module",
4
- "version": "4.1.0-beta.5",
4
+ "version": "4.1.0-beta.6",
5
5
  "description": "",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/zcf0508/unplugin-https-reverse-proxy#readme",
@@ -420,13 +420,22 @@ export class CaddyInstant {
420
420
  const child = new HelperCaddyProcess(session.client)
421
421
  this._caddyChild = child
422
422
 
423
- await session.client.call('caddy.start')
423
+ const started = await session.client.call('caddy.start')
424
424
 
425
425
  child.on('exit', (code: number | null) => {
426
426
  if (code !== null && code !== 0)
427
427
  reject(new Error(`Caddy exited with code ${code}`))
428
428
  })
429
429
 
430
+ // Caddy was already serving: its "serving initial" line was emitted
431
+ // when the first project started it, so waiting for it again would
432
+ // hang this instance forever.
433
+ if (started?.started === false) {
434
+ consola.info('Caddy is already running; added this route to it.')
435
+ void resolveWhenReady()
436
+ return
437
+ }
438
+
430
439
  child.stderr.on('data', async (data: Buffer) => {
431
440
  const lines = data.toString().split('\n').map((line: string) => line.trim())
432
441
  for (const line of lines) {
@@ -44,7 +44,8 @@ export interface HelperResults {
44
44
  'hosts.add': void
45
45
  'hosts.remove': void
46
46
  'port.free': { killed: number[] }
47
- 'caddy.start': { pid?: number }
47
+ /** `started: false` means Caddy was already running and was reused. */
48
+ 'caddy.start': { pid?: number, started?: boolean }
48
49
  'caddy.stop': void
49
50
  'ca.trust': { trusted: boolean, output: string }
50
51
  }