unplugin-https-reverse-proxy 2.0.3-beta.1 → 3.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/{chunk-6ESO3Y2K.js → chunk-5MC5SB7O.js} +31 -22
- package/dist/esbuild.cjs +31 -22
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +31 -22
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +31 -22
- package/dist/nuxt.js +1 -1
- package/dist/rollup.cjs +31 -22
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +31 -22
- package/dist/rspack.js +1 -1
- package/dist/types.d.cts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/vite.cjs +31 -22
- package/dist/vite.js +1 -1
- package/dist/webpack.cjs +31 -22
- package/dist/webpack.js +1 -1
- package/package.json +2 -1
- package/src/caddy/caddyfile.ts +5 -8
- package/src/caddy/config.ts +1 -1
- package/src/caddy/index.ts +17 -3
- package/src/types.ts +1 -0
package/src/caddy/config.ts
CHANGED
package/src/caddy/index.ts
CHANGED
|
@@ -102,9 +102,17 @@ interface RunOptions {
|
|
|
102
102
|
base: string
|
|
103
103
|
showCaddyLog: boolean
|
|
104
104
|
https: boolean
|
|
105
|
+
healthCheck?: boolean
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
let caddyConfig: ReturnType<typeof useCaddyConfig> | undefined
|
|
109
|
+
|
|
110
|
+
function getCaddyConfig(): ReturnType<typeof useCaddyConfig> {
|
|
111
|
+
if (!caddyConfig) {
|
|
112
|
+
caddyConfig = useCaddyConfig()
|
|
113
|
+
}
|
|
114
|
+
return caddyConfig
|
|
115
|
+
}
|
|
108
116
|
|
|
109
117
|
export class CaddyInstant {
|
|
110
118
|
private inited = false
|
|
@@ -177,6 +185,7 @@ export class CaddyInstant {
|
|
|
177
185
|
base = '/',
|
|
178
186
|
showCaddyLog = false,
|
|
179
187
|
https = false,
|
|
188
|
+
healthCheck = true,
|
|
180
189
|
} = options || {}
|
|
181
190
|
|
|
182
191
|
this._source = source
|
|
@@ -194,17 +203,20 @@ export class CaddyInstant {
|
|
|
194
203
|
const proxies = [
|
|
195
204
|
{
|
|
196
205
|
target: targetHost,
|
|
197
|
-
|
|
206
|
+
portSuffix: https ? '' : ':80',
|
|
198
207
|
tls: https ? 'tls internal' : '',
|
|
199
208
|
source,
|
|
200
209
|
base,
|
|
210
|
+
healthCheck,
|
|
201
211
|
},
|
|
202
212
|
]
|
|
203
213
|
|
|
214
|
+
const { writeCaddyConfig } = getCaddyConfig()
|
|
204
215
|
writeCaddyConfig(proxies)
|
|
205
216
|
|
|
206
217
|
this._stopEffects.push(
|
|
207
218
|
effect(async () => {
|
|
219
|
+
const { configJsonRef } = getCaddyConfig()
|
|
208
220
|
const proxies = Object.values(configJsonRef() || {})
|
|
209
221
|
if (!(this.caddyfile || '').includes(`${target.split(':')[0]}${https ? '' : ':80'}`)) {
|
|
210
222
|
const ctx = validateTemplateContext({
|
|
@@ -365,7 +377,9 @@ export class CaddyInstant {
|
|
|
365
377
|
await lockfile.unlock(caddyLockFilePath).catch(() => { })
|
|
366
378
|
await unlink(caddyFilePath).catch(() => { })
|
|
367
379
|
await unlink(caddyLockFilePath).catch(() => { })
|
|
368
|
-
|
|
380
|
+
if (caddyConfig) {
|
|
381
|
+
await caddyConfig.cleanUp()
|
|
382
|
+
}
|
|
369
383
|
}
|
|
370
384
|
catch (e) {
|
|
371
385
|
consola.error(e)
|