unplugin-https-reverse-proxy 0.0.11 → 0.0.12

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 CHANGED
@@ -16,6 +16,7 @@ UHRP_AUTO_INSTALL_CADDY=true npm i unplugin-https-reverse-proxy --save-dev
16
16
 
17
17
  ```ts
18
18
  interface Options {
19
+ enable?: boolean // <- default: true
19
20
  target: string // <- https target hostname
20
21
  showCaddyLog?: boolean // <- default: false
21
22
  }
@@ -26,11 +27,11 @@ interface Options {
26
27
 
27
28
  ```ts
28
29
  // vite.config.ts
29
- import Starter from 'unplugin-https-reverse-proxy/vite'
30
+ import HttpsReverseProxy from 'unplugin-https-reverse-proxy/vite'
30
31
 
31
32
  export default defineConfig({
32
33
  plugins: [
33
- Starter({ /* options */ }),
34
+ HttpsReverseProxy({ /* options */ }),
34
35
  ],
35
36
  })
36
37
  ```
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-5K6D2TTS.js";
3
+ } from "./chunk-WUSTJHAZ.js";
4
4
 
5
5
  // src/webpack.ts
6
6
  import { createWebpackPlugin } from "unplugin";
@@ -295,7 +295,7 @@ var CaddyInstant = class {
295
295
  const lines = data.toString().split("\n").map((line) => line.trim());
296
296
  for (const line of lines) {
297
297
  showCaddyLog && line && console.info(line);
298
- if (line && JSON.parse(line).level === "error") {
298
+ if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
299
299
  consola.error(line);
300
300
  return reject(line);
301
301
  }
@@ -329,8 +329,11 @@ var unpluginFactory = (options) => ({
329
329
  },
330
330
  configureServer(server) {
331
331
  const {
332
+ enable = true,
332
333
  target = ""
333
334
  } = options;
335
+ if (!enable)
336
+ return;
334
337
  if (!target) {
335
338
  consola.fail("please provide target");
336
339
  return;
@@ -359,6 +362,8 @@ var unpluginFactory = (options) => ({
359
362
  server.close();
360
363
  process3.exit();
361
364
  });
365
+ }).catch((e) => {
366
+ throw e;
362
367
  });
363
368
  } catch (e) {
364
369
  consola.error(e);
@@ -368,8 +373,11 @@ var unpluginFactory = (options) => ({
368
373
  },
369
374
  webpack(compiler) {
370
375
  const {
376
+ enable = true,
371
377
  target = ""
372
378
  } = options;
379
+ if (!enable)
380
+ return;
373
381
  if (!target) {
374
382
  consola.fail("please provide target");
375
383
  return;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-5K6D2TTS.js";
3
+ } from "./chunk-WUSTJHAZ.js";
4
4
 
5
5
  // src/vite.ts
6
6
  import { createVitePlugin } from "unplugin";
package/dist/esbuild.cjs CHANGED
@@ -334,7 +334,7 @@ var CaddyInstant = class {
334
334
  const lines = data.toString().split("\n").map((line) => line.trim());
335
335
  for (const line of lines) {
336
336
  showCaddyLog && line && console.info(line);
337
- if (line && JSON.parse(line).level === "error") {
337
+ if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
338
338
  consola.error(line);
339
339
  return reject(line);
340
340
  }
@@ -368,8 +368,11 @@ var unpluginFactory = (options) => ({
368
368
  },
369
369
  configureServer(server) {
370
370
  const {
371
+ enable = true,
371
372
  target = ""
372
373
  } = options;
374
+ if (!enable)
375
+ return;
373
376
  if (!target) {
374
377
  consola.fail("please provide target");
375
378
  return;
@@ -398,6 +401,8 @@ var unpluginFactory = (options) => ({
398
401
  server.close();
399
402
  import_node_process3.default.exit();
400
403
  });
404
+ }).catch((e) => {
405
+ throw e;
401
406
  });
402
407
  } catch (e) {
403
408
  consola.error(e);
@@ -407,8 +412,11 @@ var unpluginFactory = (options) => ({
407
412
  },
408
413
  webpack(compiler) {
409
414
  const {
415
+ enable = true,
410
416
  target = ""
411
417
  } = options;
418
+ if (!enable)
419
+ return;
412
420
  if (!target) {
413
421
  consola.fail("please provide target");
414
422
  return;
package/dist/esbuild.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-5K6D2TTS.js";
3
+ } from "./chunk-WUSTJHAZ.js";
4
4
  import "./chunk-3HKPYCSE.js";
5
5
 
6
6
  // src/esbuild.ts
package/dist/index.cjs CHANGED
@@ -333,7 +333,7 @@ var CaddyInstant = class {
333
333
  const lines = data.toString().split("\n").map((line) => line.trim());
334
334
  for (const line of lines) {
335
335
  showCaddyLog && line && console.info(line);
336
- if (line && JSON.parse(line).level === "error") {
336
+ if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
337
337
  consola.error(line);
338
338
  return reject(line);
339
339
  }
@@ -367,8 +367,11 @@ var unpluginFactory = (options) => ({
367
367
  },
368
368
  configureServer(server) {
369
369
  const {
370
+ enable = true,
370
371
  target = ""
371
372
  } = options;
373
+ if (!enable)
374
+ return;
372
375
  if (!target) {
373
376
  consola.fail("please provide target");
374
377
  return;
@@ -397,6 +400,8 @@ var unpluginFactory = (options) => ({
397
400
  server.close();
398
401
  import_node_process3.default.exit();
399
402
  });
403
+ }).catch((e) => {
404
+ throw e;
400
405
  });
401
406
  } catch (e) {
402
407
  consola.error(e);
@@ -406,8 +411,11 @@ var unpluginFactory = (options) => ({
406
411
  },
407
412
  webpack(compiler) {
408
413
  const {
414
+ enable = true,
409
415
  target = ""
410
416
  } = options;
417
+ if (!enable)
418
+ return;
411
419
  if (!target) {
412
420
  consola.fail("please provide target");
413
421
  return;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  src_default,
3
3
  unplugin,
4
4
  unpluginFactory
5
- } from "./chunk-5K6D2TTS.js";
5
+ } from "./chunk-WUSTJHAZ.js";
6
6
  import "./chunk-3HKPYCSE.js";
7
7
  export {
8
8
  src_default as default,
package/dist/nuxt.cjs CHANGED
@@ -337,7 +337,7 @@ var CaddyInstant = class {
337
337
  const lines = data.toString().split("\n").map((line) => line.trim());
338
338
  for (const line of lines) {
339
339
  showCaddyLog && line && console.info(line);
340
- if (line && JSON.parse(line).level === "error") {
340
+ if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
341
341
  consola.error(line);
342
342
  return reject(line);
343
343
  }
@@ -371,8 +371,11 @@ var unpluginFactory = (options) => ({
371
371
  },
372
372
  configureServer(server) {
373
373
  const {
374
+ enable = true,
374
375
  target = ""
375
376
  } = options;
377
+ if (!enable)
378
+ return;
376
379
  if (!target) {
377
380
  consola.fail("please provide target");
378
381
  return;
@@ -401,6 +404,8 @@ var unpluginFactory = (options) => ({
401
404
  server.close();
402
405
  import_node_process3.default.exit();
403
406
  });
407
+ }).catch((e) => {
408
+ throw e;
404
409
  });
405
410
  } catch (e) {
406
411
  consola.error(e);
@@ -410,8 +415,11 @@ var unpluginFactory = (options) => ({
410
415
  },
411
416
  webpack(compiler) {
412
417
  const {
418
+ enable = true,
413
419
  target = ""
414
420
  } = options;
421
+ if (!enable)
422
+ return;
415
423
  if (!target) {
416
424
  consola.fail("please provide target");
417
425
  return;
package/dist/nuxt.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-UGVWTB7L.js";
3
+ } from "./chunk-YP6CZ57A.js";
4
4
  import {
5
5
  webpack_default
6
- } from "./chunk-BFAT7WWW.js";
7
- import "./chunk-5K6D2TTS.js";
6
+ } from "./chunk-ARWX57QE.js";
7
+ import "./chunk-WUSTJHAZ.js";
8
8
  import "./chunk-3HKPYCSE.js";
9
9
 
10
10
  // src/nuxt.ts
package/dist/rollup.cjs CHANGED
@@ -334,7 +334,7 @@ var CaddyInstant = class {
334
334
  const lines = data.toString().split("\n").map((line) => line.trim());
335
335
  for (const line of lines) {
336
336
  showCaddyLog && line && console.info(line);
337
- if (line && JSON.parse(line).level === "error") {
337
+ if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
338
338
  consola.error(line);
339
339
  return reject(line);
340
340
  }
@@ -368,8 +368,11 @@ var unpluginFactory = (options) => ({
368
368
  },
369
369
  configureServer(server) {
370
370
  const {
371
+ enable = true,
371
372
  target = ""
372
373
  } = options;
374
+ if (!enable)
375
+ return;
373
376
  if (!target) {
374
377
  consola.fail("please provide target");
375
378
  return;
@@ -398,6 +401,8 @@ var unpluginFactory = (options) => ({
398
401
  server.close();
399
402
  import_node_process3.default.exit();
400
403
  });
404
+ }).catch((e) => {
405
+ throw e;
401
406
  });
402
407
  } catch (e) {
403
408
  consola.error(e);
@@ -407,8 +412,11 @@ var unpluginFactory = (options) => ({
407
412
  },
408
413
  webpack(compiler) {
409
414
  const {
415
+ enable = true,
410
416
  target = ""
411
417
  } = options;
418
+ if (!enable)
419
+ return;
412
420
  if (!target) {
413
421
  consola.fail("please provide target");
414
422
  return;
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-5K6D2TTS.js";
3
+ } from "./chunk-WUSTJHAZ.js";
4
4
  import "./chunk-3HKPYCSE.js";
5
5
 
6
6
  // src/rollup.ts
package/dist/types.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  interface Options {
2
+ enable?: boolean;
2
3
  target: string;
3
4
  showCaddyLog?: boolean;
4
5
  }
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  interface Options {
2
+ enable?: boolean;
2
3
  target: string;
3
4
  showCaddyLog?: boolean;
4
5
  }
package/dist/vite.cjs CHANGED
@@ -334,7 +334,7 @@ var CaddyInstant = class {
334
334
  const lines = data.toString().split("\n").map((line) => line.trim());
335
335
  for (const line of lines) {
336
336
  showCaddyLog && line && console.info(line);
337
- if (line && JSON.parse(line).level === "error") {
337
+ if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
338
338
  consola.error(line);
339
339
  return reject(line);
340
340
  }
@@ -368,8 +368,11 @@ var unpluginFactory = (options) => ({
368
368
  },
369
369
  configureServer(server) {
370
370
  const {
371
+ enable = true,
371
372
  target = ""
372
373
  } = options;
374
+ if (!enable)
375
+ return;
373
376
  if (!target) {
374
377
  consola.fail("please provide target");
375
378
  return;
@@ -398,6 +401,8 @@ var unpluginFactory = (options) => ({
398
401
  server.close();
399
402
  import_node_process3.default.exit();
400
403
  });
404
+ }).catch((e) => {
405
+ throw e;
401
406
  });
402
407
  } catch (e) {
403
408
  consola.error(e);
@@ -407,8 +412,11 @@ var unpluginFactory = (options) => ({
407
412
  },
408
413
  webpack(compiler) {
409
414
  const {
415
+ enable = true,
410
416
  target = ""
411
417
  } = options;
418
+ if (!enable)
419
+ return;
412
420
  if (!target) {
413
421
  consola.fail("please provide target");
414
422
  return;
package/dist/vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-UGVWTB7L.js";
4
- import "./chunk-5K6D2TTS.js";
3
+ } from "./chunk-YP6CZ57A.js";
4
+ import "./chunk-WUSTJHAZ.js";
5
5
  import "./chunk-3HKPYCSE.js";
6
6
  export {
7
7
  vite_default as default
package/dist/webpack.cjs CHANGED
@@ -334,7 +334,7 @@ var CaddyInstant = class {
334
334
  const lines = data.toString().split("\n").map((line) => line.trim());
335
335
  for (const line of lines) {
336
336
  showCaddyLog && line && console.info(line);
337
- if (line && JSON.parse(line).level === "error") {
337
+ if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
338
338
  consola.error(line);
339
339
  return reject(line);
340
340
  }
@@ -368,8 +368,11 @@ var unpluginFactory = (options) => ({
368
368
  },
369
369
  configureServer(server) {
370
370
  const {
371
+ enable = true,
371
372
  target = ""
372
373
  } = options;
374
+ if (!enable)
375
+ return;
373
376
  if (!target) {
374
377
  consola.fail("please provide target");
375
378
  return;
@@ -398,6 +401,8 @@ var unpluginFactory = (options) => ({
398
401
  server.close();
399
402
  import_node_process3.default.exit();
400
403
  });
404
+ }).catch((e) => {
405
+ throw e;
401
406
  });
402
407
  } catch (e) {
403
408
  consola.error(e);
@@ -407,8 +412,11 @@ var unpluginFactory = (options) => ({
407
412
  },
408
413
  webpack(compiler) {
409
414
  const {
415
+ enable = true,
410
416
  target = ""
411
417
  } = options;
418
+ if (!enable)
419
+ return;
412
420
  if (!target) {
413
421
  consola.fail("please provide target");
414
422
  return;
package/dist/webpack.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  webpack_default
3
- } from "./chunk-BFAT7WWW.js";
4
- import "./chunk-5K6D2TTS.js";
3
+ } from "./chunk-ARWX57QE.js";
4
+ import "./chunk-WUSTJHAZ.js";
5
5
  import "./chunk-3HKPYCSE.js";
6
6
  export {
7
7
  webpack_default as default
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-https-reverse-proxy",
3
3
  "type": "module",
4
- "version": "0.0.11",
4
+ "version": "0.0.12",
5
5
  "packageManager": "pnpm@8.6.12",
6
6
  "description": "",
7
7
  "license": "MIT",
@@ -192,7 +192,7 @@ export class CaddyInstant {
192
192
  // caddy log
193
193
  // eslint-disable-next-line no-console
194
194
  showCaddyLog && line && console.info(line)
195
- if (line && JSON.parse(line).level === 'error') {
195
+ if (line.includes('Error:') || (line && JSON.parse(line).level === 'error')) {
196
196
  consola.error(line)
197
197
  // child.kill()
198
198
  return reject(line)
package/src/index.ts CHANGED
@@ -20,8 +20,11 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
20
20
  },
21
21
  configureServer(server) {
22
22
  const {
23
+ enable = true,
23
24
  target = '',
24
25
  } = options
26
+ if (!enable)
27
+ return
25
28
  if (!target) {
26
29
  consola.fail('please provide target')
27
30
  return
@@ -50,6 +53,8 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
50
53
  server.close()
51
54
  process.exit()
52
55
  })
56
+ }).catch((e) => {
57
+ throw e
53
58
  })
54
59
  }
55
60
  catch (e) {
@@ -60,8 +65,11 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
60
65
  },
61
66
  webpack(compiler) {
62
67
  const {
68
+ enable = true,
63
69
  target = '',
64
70
  } = options
71
+ if (!enable)
72
+ return
65
73
  if (!target) {
66
74
  consola.fail('please provide target')
67
75
  return
package/src/types.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export interface Options {
2
2
  // define your plugin options here
3
+ enable?: boolean
3
4
  target: string
4
5
  showCaddyLog?: boolean
5
6
  }