unplugin-https-reverse-proxy 0.0.19 → 0.0.20

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,10 +16,14 @@ 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
20
- target: string // <- https target hostname
21
- showCaddyLog?: boolean // <- default: false
22
- https?: boolean // <- default: false
19
+ /** default: true */
20
+ enable?: boolean
21
+ /** target hostname */
22
+ target: string
23
+ /** default: false */
24
+ showCaddyLog?: boolean
25
+ /** default: false */
26
+ https?: boolean
23
27
  }
24
28
  ```
25
29
 
@@ -44,24 +48,40 @@ Example: [`playground/`](./playground/)
44
48
  <details>
45
49
  <summary>Webpack</summary><br>
46
50
 
47
- ```ts
51
+ ```js
48
52
  // webpack.config.js
53
+
54
+ /** @type {Parameters<import('unplugin-https-reverse-proxy/webpack')['default']>[0]} */
55
+ const reverseProxyOptions = {
56
+ enable: false,
57
+ target: 'xxx',
58
+ https: false,
59
+ }
60
+
49
61
  module.exports = {
50
62
  /* ... */
51
63
  devServer: {
52
64
  client: {
53
65
  // ↓ for HMR
54
66
  webSocketURL: {
55
- // protocol: 'wss', // <- if you set options.https to `true`
56
- // port: 443, // <- if you set options.https to `true`
57
- hostname: 'xxx', // <- target hostname
58
- },
67
+ ...(reverseProxyOptions.enable
68
+ ? {
69
+ hostname: reverseProxyOptions.target,
70
+ }
71
+ : {}),
72
+ ...(reverseProxyOptions.enable && reverseProxyOptions.https
73
+ ? {
74
+ protocol: 'wss',
75
+ port: 443,
76
+ }
77
+ : {})
78
+ }
59
79
  },
60
80
  setupExitSignals: true,
61
81
  allowedHosts: 'all',
62
82
  },
63
83
  plugins: [
64
- require('unplugin-https-reverse-proxy/webpack')({ /* options */ })
84
+ require('unplugin-https-reverse-proxy/webpack')(reverseProxyOptions)
65
85
  ]
66
86
  }
67
87
  ```
@@ -71,7 +91,7 @@ module.exports = {
71
91
  <details>
72
92
  <summary>Nuxt</summary><br>
73
93
 
74
- ```ts
94
+ ```js
75
95
  // nuxt.config.js
76
96
  export default defineNuxtConfig({
77
97
  modules: [
@@ -87,24 +107,40 @@ export default defineNuxtConfig({
87
107
  <details>
88
108
  <summary>Vue CLI</summary><br>
89
109
 
90
- ```ts
110
+ ```js
91
111
  // vue.config.js
112
+
113
+ /** @type {Parameters<import('unplugin-https-reverse-proxy/webpack')['default']>[0]} */
114
+ const reverseProxyOptions = {
115
+ enable: false,
116
+ target: 'xxx',
117
+ https: false,
118
+ }
119
+
92
120
  module.exports = {
93
121
  devServer: {
94
122
  client: {
95
123
  // ↓ for HMR
96
124
  webSocketURL: {
97
- // protocol: 'wss', // <- if you set options.https to `true`
98
- // port: 443, // <- if you set options.https to `true`
99
- port: 443,
100
- },
125
+ ...(reverseProxyOptions.enable
126
+ ? {
127
+ hostname: reverseProxyOptions.target,
128
+ }
129
+ : {}),
130
+ ...(reverseProxyOptions.enable && reverseProxyOptions.https
131
+ ? {
132
+ protocol: 'wss',
133
+ port: 443,
134
+ }
135
+ : {})
136
+ }
101
137
  },
102
138
  setupExitSignals: true,
103
139
  allowedHosts: 'all',
104
140
  },
105
141
  configureWebpack: {
106
142
  plugins: [
107
- require('unplugin-https-reverse-proxy/webpack')({ /* options */ }),
143
+ require('unplugin-https-reverse-proxy/webpack')(reverseProxyOptions),
108
144
  ],
109
145
  },
110
146
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-URF2UORY.js";
3
+ } from "./chunk-KYPQLMHO.js";
4
4
 
5
5
  // src/vite.ts
6
6
  import { createVitePlugin } from "unplugin";
@@ -467,6 +467,8 @@ var unpluginFactory = (options) => ({
467
467
  }
468
468
  },
469
469
  webpack(compiler) {
470
+ if (process3.env.NODE_ENV !== "development")
471
+ return;
470
472
  const {
471
473
  enable = true,
472
474
  target = ""
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-URF2UORY.js";
3
+ } from "./chunk-KYPQLMHO.js";
4
4
 
5
5
  // src/webpack.ts
6
6
  import { createWebpackPlugin } from "unplugin";
package/dist/esbuild.cjs CHANGED
@@ -527,6 +527,8 @@ var unpluginFactory = (options) => ({
527
527
  }
528
528
  },
529
529
  webpack(compiler) {
530
+ if (import_node_process3.default.env.NODE_ENV !== "development")
531
+ return;
530
532
  const {
531
533
  enable = true,
532
534
  target = ""
package/dist/esbuild.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-URF2UORY.js";
3
+ } from "./chunk-KYPQLMHO.js";
4
4
  import "./chunk-CQC5SSJR.js";
5
5
 
6
6
  // src/esbuild.ts
package/dist/index.cjs CHANGED
@@ -526,6 +526,8 @@ var unpluginFactory = (options) => ({
526
526
  }
527
527
  },
528
528
  webpack(compiler) {
529
+ if (import_node_process3.default.env.NODE_ENV !== "development")
530
+ return;
529
531
  const {
530
532
  enable = true,
531
533
  target = ""
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  src_default,
3
3
  unplugin,
4
4
  unpluginFactory
5
- } from "./chunk-URF2UORY.js";
5
+ } from "./chunk-KYPQLMHO.js";
6
6
  import "./chunk-CQC5SSJR.js";
7
7
  export {
8
8
  src_default as default,
package/dist/nuxt.cjs CHANGED
@@ -530,6 +530,8 @@ var unpluginFactory = (options) => ({
530
530
  }
531
531
  },
532
532
  webpack(compiler) {
533
+ if (import_node_process3.default.env.NODE_ENV !== "development")
534
+ return;
533
535
  const {
534
536
  enable = true,
535
537
  target = ""
package/dist/nuxt.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-EAJJ2ZZG.js";
3
+ } from "./chunk-CVO5VP4I.js";
4
4
  import {
5
5
  webpack_default
6
- } from "./chunk-VOWRN6H5.js";
7
- import "./chunk-URF2UORY.js";
6
+ } from "./chunk-VXVYW4ZE.js";
7
+ import "./chunk-KYPQLMHO.js";
8
8
  import "./chunk-CQC5SSJR.js";
9
9
 
10
10
  // src/nuxt.ts
package/dist/rollup.cjs CHANGED
@@ -527,6 +527,8 @@ var unpluginFactory = (options) => ({
527
527
  }
528
528
  },
529
529
  webpack(compiler) {
530
+ if (import_node_process3.default.env.NODE_ENV !== "development")
531
+ return;
530
532
  const {
531
533
  enable = true,
532
534
  target = ""
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-URF2UORY.js";
3
+ } from "./chunk-KYPQLMHO.js";
4
4
  import "./chunk-CQC5SSJR.js";
5
5
 
6
6
  // src/rollup.ts
package/dist/vite.cjs CHANGED
@@ -527,6 +527,8 @@ var unpluginFactory = (options) => ({
527
527
  }
528
528
  },
529
529
  webpack(compiler) {
530
+ if (import_node_process3.default.env.NODE_ENV !== "development")
531
+ return;
530
532
  const {
531
533
  enable = true,
532
534
  target = ""
package/dist/vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-EAJJ2ZZG.js";
4
- import "./chunk-URF2UORY.js";
3
+ } from "./chunk-CVO5VP4I.js";
4
+ import "./chunk-KYPQLMHO.js";
5
5
  import "./chunk-CQC5SSJR.js";
6
6
  export {
7
7
  vite_default as default
package/dist/webpack.cjs CHANGED
@@ -527,6 +527,8 @@ var unpluginFactory = (options) => ({
527
527
  }
528
528
  },
529
529
  webpack(compiler) {
530
+ if (import_node_process3.default.env.NODE_ENV !== "development")
531
+ return;
530
532
  const {
531
533
  enable = true,
532
534
  target = ""
package/dist/webpack.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  webpack_default
3
- } from "./chunk-VOWRN6H5.js";
4
- import "./chunk-URF2UORY.js";
3
+ } from "./chunk-VXVYW4ZE.js";
4
+ import "./chunk-KYPQLMHO.js";
5
5
  import "./chunk-CQC5SSJR.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.19",
4
+ "version": "0.0.20",
5
5
  "packageManager": "pnpm@8.6.12",
6
6
  "description": "",
7
7
  "license": "MIT",
package/src/index.ts CHANGED
@@ -123,6 +123,9 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
123
123
  },
124
124
  },
125
125
  webpack(compiler) {
126
+ if (process.env.NODE_ENV !== 'development')
127
+ return
128
+
126
129
  const {
127
130
  enable = true,
128
131
  target = '',