unplugin-https-reverse-proxy 4.0.1 → 4.0.2
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-QURDG7SD.js → chunk-JA3D5AWS.js} +21 -4
- package/dist/esbuild.cjs +21 -4
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +21 -4
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +21 -4
- package/dist/nuxt.js +1 -1
- package/dist/rollup.cjs +21 -4
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +21 -4
- package/dist/rspack.js +1 -1
- package/dist/vite.cjs +21 -4
- package/dist/vite.js +1 -1
- package/dist/webpack.cjs +21 -4
- package/dist/webpack.js +1 -1
- package/package.json +1 -1
- package/src/caddy/index.ts +24 -5
|
@@ -13778,6 +13778,17 @@ function getCaddyConfig() {
|
|
|
13778
13778
|
}
|
|
13779
13779
|
return caddyConfig;
|
|
13780
13780
|
}
|
|
13781
|
+
function splitHostPort(addr) {
|
|
13782
|
+
const lastColon = addr.lastIndexOf(":");
|
|
13783
|
+
if (lastColon === -1)
|
|
13784
|
+
return { host: addr, port: "" };
|
|
13785
|
+
if (addr.startsWith("[")) {
|
|
13786
|
+
const end = addr.indexOf("]");
|
|
13787
|
+
if (end !== -1 && addr[end + 1] === ":")
|
|
13788
|
+
return { host: addr.slice(1, end), port: addr.slice(end + 2) };
|
|
13789
|
+
}
|
|
13790
|
+
return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
|
|
13791
|
+
}
|
|
13781
13792
|
var CaddyInstant = class {
|
|
13782
13793
|
constructor() {
|
|
13783
13794
|
this.inited = false;
|
|
@@ -13825,6 +13836,7 @@ var CaddyInstant = class {
|
|
|
13825
13836
|
*/
|
|
13826
13837
|
async run(source, target, options) {
|
|
13827
13838
|
source = source.replace("0.0.0.0", "127.0.0.1");
|
|
13839
|
+
source = source.replace(/^localhost(?=:)/i, "127.0.0.1");
|
|
13828
13840
|
const {
|
|
13829
13841
|
restore = true,
|
|
13830
13842
|
base = "/",
|
|
@@ -13836,10 +13848,11 @@ var CaddyInstant = class {
|
|
|
13836
13848
|
this._target = target;
|
|
13837
13849
|
if (!this.inited)
|
|
13838
13850
|
await this.init();
|
|
13839
|
-
|
|
13851
|
+
const sourceHost = splitHostPort(source).host;
|
|
13852
|
+
const targetHost = splitHostPort(target).host;
|
|
13853
|
+
if (!await addHost(sourceHost, targetHost))
|
|
13840
13854
|
throw new Error("update host failed");
|
|
13841
13855
|
consola.success("update host success\n");
|
|
13842
|
-
const targetHost = target.split(":")[0];
|
|
13843
13856
|
const normalizeBase = (b) => {
|
|
13844
13857
|
let out = b || "/";
|
|
13845
13858
|
if (!out.startsWith("/"))
|
|
@@ -13899,7 +13912,7 @@ var CaddyInstant = class {
|
|
|
13899
13912
|
});
|
|
13900
13913
|
const originalExit = process4.exit.bind(process4);
|
|
13901
13914
|
process4.exit = async (code) => {
|
|
13902
|
-
const port = Number(source.
|
|
13915
|
+
const port = Number(splitHostPort(source).port);
|
|
13903
13916
|
if (!Number.isNaN(port) && await tryPort(port))
|
|
13904
13917
|
await kill(port);
|
|
13905
13918
|
const pwd = process4.cwd();
|
|
@@ -13907,6 +13920,10 @@ var CaddyInstant = class {
|
|
|
13907
13920
|
if (existsSync3(viteCacheDir))
|
|
13908
13921
|
await chmodRecursive(viteCacheDir, 511).catch(() => {
|
|
13909
13922
|
});
|
|
13923
|
+
const viteTempCacheDir = `${pwd}/node_modules/.vite-temp`;
|
|
13924
|
+
if (existsSync3(viteTempCacheDir))
|
|
13925
|
+
await chmodRecursive(viteTempCacheDir, 511).catch(() => {
|
|
13926
|
+
});
|
|
13910
13927
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
13911
13928
|
if (existsSync3(nuxtCacheDir))
|
|
13912
13929
|
await chmodRecursive(nuxtCacheDir, 511).catch(() => {
|
|
@@ -13978,7 +13995,7 @@ ${line}
|
|
|
13978
13995
|
this._stopEffects.forEach((fn) => fn());
|
|
13979
13996
|
try {
|
|
13980
13997
|
if (restore && this._source && this._target) {
|
|
13981
|
-
if (await removeHost(this._source.
|
|
13998
|
+
if (await removeHost(splitHostPort(this._source).host, splitHostPort(this._target).host))
|
|
13982
13999
|
consola.success("Restore host success.\n");
|
|
13983
14000
|
else
|
|
13984
14001
|
consola.fail("Restore host failed.\n");
|
package/dist/esbuild.cjs
CHANGED
|
@@ -13859,6 +13859,17 @@ function getCaddyConfig() {
|
|
|
13859
13859
|
}
|
|
13860
13860
|
return caddyConfig;
|
|
13861
13861
|
}
|
|
13862
|
+
function splitHostPort(addr) {
|
|
13863
|
+
const lastColon = addr.lastIndexOf(":");
|
|
13864
|
+
if (lastColon === -1)
|
|
13865
|
+
return { host: addr, port: "" };
|
|
13866
|
+
if (addr.startsWith("[")) {
|
|
13867
|
+
const end = addr.indexOf("]");
|
|
13868
|
+
if (end !== -1 && addr[end + 1] === ":")
|
|
13869
|
+
return { host: addr.slice(1, end), port: addr.slice(end + 2) };
|
|
13870
|
+
}
|
|
13871
|
+
return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
|
|
13872
|
+
}
|
|
13862
13873
|
var CaddyInstant = class {
|
|
13863
13874
|
constructor() {
|
|
13864
13875
|
this.inited = false;
|
|
@@ -13906,6 +13917,7 @@ var CaddyInstant = class {
|
|
|
13906
13917
|
*/
|
|
13907
13918
|
async run(source, target, options) {
|
|
13908
13919
|
source = source.replace("0.0.0.0", "127.0.0.1");
|
|
13920
|
+
source = source.replace(/^localhost(?=:)/i, "127.0.0.1");
|
|
13909
13921
|
const {
|
|
13910
13922
|
restore = true,
|
|
13911
13923
|
base = "/",
|
|
@@ -13917,10 +13929,11 @@ var CaddyInstant = class {
|
|
|
13917
13929
|
this._target = target;
|
|
13918
13930
|
if (!this.inited)
|
|
13919
13931
|
await this.init();
|
|
13920
|
-
|
|
13932
|
+
const sourceHost = splitHostPort(source).host;
|
|
13933
|
+
const targetHost = splitHostPort(target).host;
|
|
13934
|
+
if (!await addHost(sourceHost, targetHost))
|
|
13921
13935
|
throw new Error("update host failed");
|
|
13922
13936
|
consola.success("update host success\n");
|
|
13923
|
-
const targetHost = target.split(":")[0];
|
|
13924
13937
|
const normalizeBase = (b) => {
|
|
13925
13938
|
let out = b || "/";
|
|
13926
13939
|
if (!out.startsWith("/"))
|
|
@@ -13980,7 +13993,7 @@ var CaddyInstant = class {
|
|
|
13980
13993
|
});
|
|
13981
13994
|
const originalExit = import_node_process4.default.exit.bind(import_node_process4.default);
|
|
13982
13995
|
import_node_process4.default.exit = async (code) => {
|
|
13983
|
-
const port = Number(source.
|
|
13996
|
+
const port = Number(splitHostPort(source).port);
|
|
13984
13997
|
if (!Number.isNaN(port) && await tryPort(port))
|
|
13985
13998
|
await kill(port);
|
|
13986
13999
|
const pwd = import_node_process4.default.cwd();
|
|
@@ -13988,6 +14001,10 @@ var CaddyInstant = class {
|
|
|
13988
14001
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
13989
14002
|
await chmodRecursive(viteCacheDir, 511).catch(() => {
|
|
13990
14003
|
});
|
|
14004
|
+
const viteTempCacheDir = `${pwd}/node_modules/.vite-temp`;
|
|
14005
|
+
if ((0, import_node_fs3.existsSync)(viteTempCacheDir))
|
|
14006
|
+
await chmodRecursive(viteTempCacheDir, 511).catch(() => {
|
|
14007
|
+
});
|
|
13991
14008
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
13992
14009
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
13993
14010
|
await chmodRecursive(nuxtCacheDir, 511).catch(() => {
|
|
@@ -14059,7 +14076,7 @@ ${line}
|
|
|
14059
14076
|
this._stopEffects.forEach((fn) => fn());
|
|
14060
14077
|
try {
|
|
14061
14078
|
if (restore && this._source && this._target) {
|
|
14062
|
-
if (await removeHost(this._source.
|
|
14079
|
+
if (await removeHost(splitHostPort(this._source).host, splitHostPort(this._target).host))
|
|
14063
14080
|
consola.success("Restore host success.\n");
|
|
14064
14081
|
else
|
|
14065
14082
|
consola.fail("Restore host failed.\n");
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -13859,6 +13859,17 @@ function getCaddyConfig() {
|
|
|
13859
13859
|
}
|
|
13860
13860
|
return caddyConfig;
|
|
13861
13861
|
}
|
|
13862
|
+
function splitHostPort(addr) {
|
|
13863
|
+
const lastColon = addr.lastIndexOf(":");
|
|
13864
|
+
if (lastColon === -1)
|
|
13865
|
+
return { host: addr, port: "" };
|
|
13866
|
+
if (addr.startsWith("[")) {
|
|
13867
|
+
const end = addr.indexOf("]");
|
|
13868
|
+
if (end !== -1 && addr[end + 1] === ":")
|
|
13869
|
+
return { host: addr.slice(1, end), port: addr.slice(end + 2) };
|
|
13870
|
+
}
|
|
13871
|
+
return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
|
|
13872
|
+
}
|
|
13862
13873
|
var CaddyInstant = class {
|
|
13863
13874
|
constructor() {
|
|
13864
13875
|
this.inited = false;
|
|
@@ -13906,6 +13917,7 @@ var CaddyInstant = class {
|
|
|
13906
13917
|
*/
|
|
13907
13918
|
async run(source, target, options) {
|
|
13908
13919
|
source = source.replace("0.0.0.0", "127.0.0.1");
|
|
13920
|
+
source = source.replace(/^localhost(?=:)/i, "127.0.0.1");
|
|
13909
13921
|
const {
|
|
13910
13922
|
restore = true,
|
|
13911
13923
|
base = "/",
|
|
@@ -13917,10 +13929,11 @@ var CaddyInstant = class {
|
|
|
13917
13929
|
this._target = target;
|
|
13918
13930
|
if (!this.inited)
|
|
13919
13931
|
await this.init();
|
|
13920
|
-
|
|
13932
|
+
const sourceHost = splitHostPort(source).host;
|
|
13933
|
+
const targetHost = splitHostPort(target).host;
|
|
13934
|
+
if (!await addHost(sourceHost, targetHost))
|
|
13921
13935
|
throw new Error("update host failed");
|
|
13922
13936
|
consola.success("update host success\n");
|
|
13923
|
-
const targetHost = target.split(":")[0];
|
|
13924
13937
|
const normalizeBase = (b) => {
|
|
13925
13938
|
let out = b || "/";
|
|
13926
13939
|
if (!out.startsWith("/"))
|
|
@@ -13980,7 +13993,7 @@ var CaddyInstant = class {
|
|
|
13980
13993
|
});
|
|
13981
13994
|
const originalExit = import_node_process4.default.exit.bind(import_node_process4.default);
|
|
13982
13995
|
import_node_process4.default.exit = async (code) => {
|
|
13983
|
-
const port = Number(source.
|
|
13996
|
+
const port = Number(splitHostPort(source).port);
|
|
13984
13997
|
if (!Number.isNaN(port) && await tryPort(port))
|
|
13985
13998
|
await kill(port);
|
|
13986
13999
|
const pwd = import_node_process4.default.cwd();
|
|
@@ -13988,6 +14001,10 @@ var CaddyInstant = class {
|
|
|
13988
14001
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
13989
14002
|
await chmodRecursive(viteCacheDir, 511).catch(() => {
|
|
13990
14003
|
});
|
|
14004
|
+
const viteTempCacheDir = `${pwd}/node_modules/.vite-temp`;
|
|
14005
|
+
if ((0, import_node_fs3.existsSync)(viteTempCacheDir))
|
|
14006
|
+
await chmodRecursive(viteTempCacheDir, 511).catch(() => {
|
|
14007
|
+
});
|
|
13991
14008
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
13992
14009
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
13993
14010
|
await chmodRecursive(nuxtCacheDir, 511).catch(() => {
|
|
@@ -14059,7 +14076,7 @@ ${line}
|
|
|
14059
14076
|
this._stopEffects.forEach((fn) => fn());
|
|
14060
14077
|
try {
|
|
14061
14078
|
if (restore && this._source && this._target) {
|
|
14062
|
-
if (await removeHost(this._source.
|
|
14079
|
+
if (await removeHost(splitHostPort(this._source).host, splitHostPort(this._target).host))
|
|
14063
14080
|
consola.success("Restore host success.\n");
|
|
14064
14081
|
else
|
|
14065
14082
|
consola.fail("Restore host failed.\n");
|
package/dist/index.js
CHANGED
package/dist/nuxt.cjs
CHANGED
|
@@ -13860,6 +13860,17 @@ function getCaddyConfig() {
|
|
|
13860
13860
|
}
|
|
13861
13861
|
return caddyConfig;
|
|
13862
13862
|
}
|
|
13863
|
+
function splitHostPort(addr) {
|
|
13864
|
+
const lastColon = addr.lastIndexOf(":");
|
|
13865
|
+
if (lastColon === -1)
|
|
13866
|
+
return { host: addr, port: "" };
|
|
13867
|
+
if (addr.startsWith("[")) {
|
|
13868
|
+
const end = addr.indexOf("]");
|
|
13869
|
+
if (end !== -1 && addr[end + 1] === ":")
|
|
13870
|
+
return { host: addr.slice(1, end), port: addr.slice(end + 2) };
|
|
13871
|
+
}
|
|
13872
|
+
return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
|
|
13873
|
+
}
|
|
13863
13874
|
var CaddyInstant = class {
|
|
13864
13875
|
constructor() {
|
|
13865
13876
|
this.inited = false;
|
|
@@ -13907,6 +13918,7 @@ var CaddyInstant = class {
|
|
|
13907
13918
|
*/
|
|
13908
13919
|
async run(source, target, options) {
|
|
13909
13920
|
source = source.replace("0.0.0.0", "127.0.0.1");
|
|
13921
|
+
source = source.replace(/^localhost(?=:)/i, "127.0.0.1");
|
|
13910
13922
|
const {
|
|
13911
13923
|
restore = true,
|
|
13912
13924
|
base = "/",
|
|
@@ -13918,10 +13930,11 @@ var CaddyInstant = class {
|
|
|
13918
13930
|
this._target = target;
|
|
13919
13931
|
if (!this.inited)
|
|
13920
13932
|
await this.init();
|
|
13921
|
-
|
|
13933
|
+
const sourceHost = splitHostPort(source).host;
|
|
13934
|
+
const targetHost = splitHostPort(target).host;
|
|
13935
|
+
if (!await addHost(sourceHost, targetHost))
|
|
13922
13936
|
throw new Error("update host failed");
|
|
13923
13937
|
consola.success("update host success\n");
|
|
13924
|
-
const targetHost = target.split(":")[0];
|
|
13925
13938
|
const normalizeBase = (b) => {
|
|
13926
13939
|
let out = b || "/";
|
|
13927
13940
|
if (!out.startsWith("/"))
|
|
@@ -13981,7 +13994,7 @@ var CaddyInstant = class {
|
|
|
13981
13994
|
});
|
|
13982
13995
|
const originalExit = import_node_process4.default.exit.bind(import_node_process4.default);
|
|
13983
13996
|
import_node_process4.default.exit = async (code) => {
|
|
13984
|
-
const port = Number(source.
|
|
13997
|
+
const port = Number(splitHostPort(source).port);
|
|
13985
13998
|
if (!Number.isNaN(port) && await tryPort(port))
|
|
13986
13999
|
await kill(port);
|
|
13987
14000
|
const pwd = import_node_process4.default.cwd();
|
|
@@ -13989,6 +14002,10 @@ var CaddyInstant = class {
|
|
|
13989
14002
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
13990
14003
|
await chmodRecursive(viteCacheDir, 511).catch(() => {
|
|
13991
14004
|
});
|
|
14005
|
+
const viteTempCacheDir = `${pwd}/node_modules/.vite-temp`;
|
|
14006
|
+
if ((0, import_node_fs3.existsSync)(viteTempCacheDir))
|
|
14007
|
+
await chmodRecursive(viteTempCacheDir, 511).catch(() => {
|
|
14008
|
+
});
|
|
13992
14009
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
13993
14010
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
13994
14011
|
await chmodRecursive(nuxtCacheDir, 511).catch(() => {
|
|
@@ -14060,7 +14077,7 @@ ${line}
|
|
|
14060
14077
|
this._stopEffects.forEach((fn) => fn());
|
|
14061
14078
|
try {
|
|
14062
14079
|
if (restore && this._source && this._target) {
|
|
14063
|
-
if (await removeHost(this._source.
|
|
14080
|
+
if (await removeHost(splitHostPort(this._source).host, splitHostPort(this._target).host))
|
|
14064
14081
|
consola.success("Restore host success.\n");
|
|
14065
14082
|
else
|
|
14066
14083
|
consola.fail("Restore host failed.\n");
|
package/dist/nuxt.js
CHANGED
package/dist/rollup.cjs
CHANGED
|
@@ -13859,6 +13859,17 @@ function getCaddyConfig() {
|
|
|
13859
13859
|
}
|
|
13860
13860
|
return caddyConfig;
|
|
13861
13861
|
}
|
|
13862
|
+
function splitHostPort(addr) {
|
|
13863
|
+
const lastColon = addr.lastIndexOf(":");
|
|
13864
|
+
if (lastColon === -1)
|
|
13865
|
+
return { host: addr, port: "" };
|
|
13866
|
+
if (addr.startsWith("[")) {
|
|
13867
|
+
const end = addr.indexOf("]");
|
|
13868
|
+
if (end !== -1 && addr[end + 1] === ":")
|
|
13869
|
+
return { host: addr.slice(1, end), port: addr.slice(end + 2) };
|
|
13870
|
+
}
|
|
13871
|
+
return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
|
|
13872
|
+
}
|
|
13862
13873
|
var CaddyInstant = class {
|
|
13863
13874
|
constructor() {
|
|
13864
13875
|
this.inited = false;
|
|
@@ -13906,6 +13917,7 @@ var CaddyInstant = class {
|
|
|
13906
13917
|
*/
|
|
13907
13918
|
async run(source, target, options) {
|
|
13908
13919
|
source = source.replace("0.0.0.0", "127.0.0.1");
|
|
13920
|
+
source = source.replace(/^localhost(?=:)/i, "127.0.0.1");
|
|
13909
13921
|
const {
|
|
13910
13922
|
restore = true,
|
|
13911
13923
|
base = "/",
|
|
@@ -13917,10 +13929,11 @@ var CaddyInstant = class {
|
|
|
13917
13929
|
this._target = target;
|
|
13918
13930
|
if (!this.inited)
|
|
13919
13931
|
await this.init();
|
|
13920
|
-
|
|
13932
|
+
const sourceHost = splitHostPort(source).host;
|
|
13933
|
+
const targetHost = splitHostPort(target).host;
|
|
13934
|
+
if (!await addHost(sourceHost, targetHost))
|
|
13921
13935
|
throw new Error("update host failed");
|
|
13922
13936
|
consola.success("update host success\n");
|
|
13923
|
-
const targetHost = target.split(":")[0];
|
|
13924
13937
|
const normalizeBase = (b) => {
|
|
13925
13938
|
let out = b || "/";
|
|
13926
13939
|
if (!out.startsWith("/"))
|
|
@@ -13980,7 +13993,7 @@ var CaddyInstant = class {
|
|
|
13980
13993
|
});
|
|
13981
13994
|
const originalExit = import_node_process4.default.exit.bind(import_node_process4.default);
|
|
13982
13995
|
import_node_process4.default.exit = async (code) => {
|
|
13983
|
-
const port = Number(source.
|
|
13996
|
+
const port = Number(splitHostPort(source).port);
|
|
13984
13997
|
if (!Number.isNaN(port) && await tryPort(port))
|
|
13985
13998
|
await kill(port);
|
|
13986
13999
|
const pwd = import_node_process4.default.cwd();
|
|
@@ -13988,6 +14001,10 @@ var CaddyInstant = class {
|
|
|
13988
14001
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
13989
14002
|
await chmodRecursive(viteCacheDir, 511).catch(() => {
|
|
13990
14003
|
});
|
|
14004
|
+
const viteTempCacheDir = `${pwd}/node_modules/.vite-temp`;
|
|
14005
|
+
if ((0, import_node_fs3.existsSync)(viteTempCacheDir))
|
|
14006
|
+
await chmodRecursive(viteTempCacheDir, 511).catch(() => {
|
|
14007
|
+
});
|
|
13991
14008
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
13992
14009
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
13993
14010
|
await chmodRecursive(nuxtCacheDir, 511).catch(() => {
|
|
@@ -14059,7 +14076,7 @@ ${line}
|
|
|
14059
14076
|
this._stopEffects.forEach((fn) => fn());
|
|
14060
14077
|
try {
|
|
14061
14078
|
if (restore && this._source && this._target) {
|
|
14062
|
-
if (await removeHost(this._source.
|
|
14079
|
+
if (await removeHost(splitHostPort(this._source).host, splitHostPort(this._target).host))
|
|
14063
14080
|
consola.success("Restore host success.\n");
|
|
14064
14081
|
else
|
|
14065
14082
|
consola.fail("Restore host failed.\n");
|
package/dist/rollup.js
CHANGED
package/dist/rspack.cjs
CHANGED
|
@@ -13858,6 +13858,17 @@ function getCaddyConfig() {
|
|
|
13858
13858
|
}
|
|
13859
13859
|
return caddyConfig;
|
|
13860
13860
|
}
|
|
13861
|
+
function splitHostPort(addr) {
|
|
13862
|
+
const lastColon = addr.lastIndexOf(":");
|
|
13863
|
+
if (lastColon === -1)
|
|
13864
|
+
return { host: addr, port: "" };
|
|
13865
|
+
if (addr.startsWith("[")) {
|
|
13866
|
+
const end = addr.indexOf("]");
|
|
13867
|
+
if (end !== -1 && addr[end + 1] === ":")
|
|
13868
|
+
return { host: addr.slice(1, end), port: addr.slice(end + 2) };
|
|
13869
|
+
}
|
|
13870
|
+
return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
|
|
13871
|
+
}
|
|
13861
13872
|
var CaddyInstant = class {
|
|
13862
13873
|
constructor() {
|
|
13863
13874
|
this.inited = false;
|
|
@@ -13905,6 +13916,7 @@ var CaddyInstant = class {
|
|
|
13905
13916
|
*/
|
|
13906
13917
|
async run(source, target, options) {
|
|
13907
13918
|
source = source.replace("0.0.0.0", "127.0.0.1");
|
|
13919
|
+
source = source.replace(/^localhost(?=:)/i, "127.0.0.1");
|
|
13908
13920
|
const {
|
|
13909
13921
|
restore = true,
|
|
13910
13922
|
base = "/",
|
|
@@ -13916,10 +13928,11 @@ var CaddyInstant = class {
|
|
|
13916
13928
|
this._target = target;
|
|
13917
13929
|
if (!this.inited)
|
|
13918
13930
|
await this.init();
|
|
13919
|
-
|
|
13931
|
+
const sourceHost = splitHostPort(source).host;
|
|
13932
|
+
const targetHost = splitHostPort(target).host;
|
|
13933
|
+
if (!await addHost(sourceHost, targetHost))
|
|
13920
13934
|
throw new Error("update host failed");
|
|
13921
13935
|
consola.success("update host success\n");
|
|
13922
|
-
const targetHost = target.split(":")[0];
|
|
13923
13936
|
const normalizeBase = (b) => {
|
|
13924
13937
|
let out = b || "/";
|
|
13925
13938
|
if (!out.startsWith("/"))
|
|
@@ -13979,7 +13992,7 @@ var CaddyInstant = class {
|
|
|
13979
13992
|
});
|
|
13980
13993
|
const originalExit = import_node_process4.default.exit.bind(import_node_process4.default);
|
|
13981
13994
|
import_node_process4.default.exit = async (code) => {
|
|
13982
|
-
const port = Number(source.
|
|
13995
|
+
const port = Number(splitHostPort(source).port);
|
|
13983
13996
|
if (!Number.isNaN(port) && await tryPort(port))
|
|
13984
13997
|
await kill(port);
|
|
13985
13998
|
const pwd = import_node_process4.default.cwd();
|
|
@@ -13987,6 +14000,10 @@ var CaddyInstant = class {
|
|
|
13987
14000
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
13988
14001
|
await chmodRecursive(viteCacheDir, 511).catch(() => {
|
|
13989
14002
|
});
|
|
14003
|
+
const viteTempCacheDir = `${pwd}/node_modules/.vite-temp`;
|
|
14004
|
+
if ((0, import_node_fs3.existsSync)(viteTempCacheDir))
|
|
14005
|
+
await chmodRecursive(viteTempCacheDir, 511).catch(() => {
|
|
14006
|
+
});
|
|
13990
14007
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
13991
14008
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
13992
14009
|
await chmodRecursive(nuxtCacheDir, 511).catch(() => {
|
|
@@ -14058,7 +14075,7 @@ ${line}
|
|
|
14058
14075
|
this._stopEffects.forEach((fn) => fn());
|
|
14059
14076
|
try {
|
|
14060
14077
|
if (restore && this._source && this._target) {
|
|
14061
|
-
if (await removeHost(this._source.
|
|
14078
|
+
if (await removeHost(splitHostPort(this._source).host, splitHostPort(this._target).host))
|
|
14062
14079
|
consola.success("Restore host success.\n");
|
|
14063
14080
|
else
|
|
14064
14081
|
consola.fail("Restore host failed.\n");
|
package/dist/rspack.js
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -13859,6 +13859,17 @@ function getCaddyConfig() {
|
|
|
13859
13859
|
}
|
|
13860
13860
|
return caddyConfig;
|
|
13861
13861
|
}
|
|
13862
|
+
function splitHostPort(addr) {
|
|
13863
|
+
const lastColon = addr.lastIndexOf(":");
|
|
13864
|
+
if (lastColon === -1)
|
|
13865
|
+
return { host: addr, port: "" };
|
|
13866
|
+
if (addr.startsWith("[")) {
|
|
13867
|
+
const end = addr.indexOf("]");
|
|
13868
|
+
if (end !== -1 && addr[end + 1] === ":")
|
|
13869
|
+
return { host: addr.slice(1, end), port: addr.slice(end + 2) };
|
|
13870
|
+
}
|
|
13871
|
+
return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
|
|
13872
|
+
}
|
|
13862
13873
|
var CaddyInstant = class {
|
|
13863
13874
|
constructor() {
|
|
13864
13875
|
this.inited = false;
|
|
@@ -13906,6 +13917,7 @@ var CaddyInstant = class {
|
|
|
13906
13917
|
*/
|
|
13907
13918
|
async run(source, target, options) {
|
|
13908
13919
|
source = source.replace("0.0.0.0", "127.0.0.1");
|
|
13920
|
+
source = source.replace(/^localhost(?=:)/i, "127.0.0.1");
|
|
13909
13921
|
const {
|
|
13910
13922
|
restore = true,
|
|
13911
13923
|
base = "/",
|
|
@@ -13917,10 +13929,11 @@ var CaddyInstant = class {
|
|
|
13917
13929
|
this._target = target;
|
|
13918
13930
|
if (!this.inited)
|
|
13919
13931
|
await this.init();
|
|
13920
|
-
|
|
13932
|
+
const sourceHost = splitHostPort(source).host;
|
|
13933
|
+
const targetHost = splitHostPort(target).host;
|
|
13934
|
+
if (!await addHost(sourceHost, targetHost))
|
|
13921
13935
|
throw new Error("update host failed");
|
|
13922
13936
|
consola.success("update host success\n");
|
|
13923
|
-
const targetHost = target.split(":")[0];
|
|
13924
13937
|
const normalizeBase = (b) => {
|
|
13925
13938
|
let out = b || "/";
|
|
13926
13939
|
if (!out.startsWith("/"))
|
|
@@ -13980,7 +13993,7 @@ var CaddyInstant = class {
|
|
|
13980
13993
|
});
|
|
13981
13994
|
const originalExit = import_node_process4.default.exit.bind(import_node_process4.default);
|
|
13982
13995
|
import_node_process4.default.exit = async (code) => {
|
|
13983
|
-
const port = Number(source.
|
|
13996
|
+
const port = Number(splitHostPort(source).port);
|
|
13984
13997
|
if (!Number.isNaN(port) && await tryPort(port))
|
|
13985
13998
|
await kill(port);
|
|
13986
13999
|
const pwd = import_node_process4.default.cwd();
|
|
@@ -13988,6 +14001,10 @@ var CaddyInstant = class {
|
|
|
13988
14001
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
13989
14002
|
await chmodRecursive(viteCacheDir, 511).catch(() => {
|
|
13990
14003
|
});
|
|
14004
|
+
const viteTempCacheDir = `${pwd}/node_modules/.vite-temp`;
|
|
14005
|
+
if ((0, import_node_fs3.existsSync)(viteTempCacheDir))
|
|
14006
|
+
await chmodRecursive(viteTempCacheDir, 511).catch(() => {
|
|
14007
|
+
});
|
|
13991
14008
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
13992
14009
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
13993
14010
|
await chmodRecursive(nuxtCacheDir, 511).catch(() => {
|
|
@@ -14059,7 +14076,7 @@ ${line}
|
|
|
14059
14076
|
this._stopEffects.forEach((fn) => fn());
|
|
14060
14077
|
try {
|
|
14061
14078
|
if (restore && this._source && this._target) {
|
|
14062
|
-
if (await removeHost(this._source.
|
|
14079
|
+
if (await removeHost(splitHostPort(this._source).host, splitHostPort(this._target).host))
|
|
14063
14080
|
consola.success("Restore host success.\n");
|
|
14064
14081
|
else
|
|
14065
14082
|
consola.fail("Restore host failed.\n");
|
package/dist/vite.js
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -13859,6 +13859,17 @@ function getCaddyConfig() {
|
|
|
13859
13859
|
}
|
|
13860
13860
|
return caddyConfig;
|
|
13861
13861
|
}
|
|
13862
|
+
function splitHostPort(addr) {
|
|
13863
|
+
const lastColon = addr.lastIndexOf(":");
|
|
13864
|
+
if (lastColon === -1)
|
|
13865
|
+
return { host: addr, port: "" };
|
|
13866
|
+
if (addr.startsWith("[")) {
|
|
13867
|
+
const end = addr.indexOf("]");
|
|
13868
|
+
if (end !== -1 && addr[end + 1] === ":")
|
|
13869
|
+
return { host: addr.slice(1, end), port: addr.slice(end + 2) };
|
|
13870
|
+
}
|
|
13871
|
+
return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
|
|
13872
|
+
}
|
|
13862
13873
|
var CaddyInstant = class {
|
|
13863
13874
|
constructor() {
|
|
13864
13875
|
this.inited = false;
|
|
@@ -13906,6 +13917,7 @@ var CaddyInstant = class {
|
|
|
13906
13917
|
*/
|
|
13907
13918
|
async run(source, target, options) {
|
|
13908
13919
|
source = source.replace("0.0.0.0", "127.0.0.1");
|
|
13920
|
+
source = source.replace(/^localhost(?=:)/i, "127.0.0.1");
|
|
13909
13921
|
const {
|
|
13910
13922
|
restore = true,
|
|
13911
13923
|
base = "/",
|
|
@@ -13917,10 +13929,11 @@ var CaddyInstant = class {
|
|
|
13917
13929
|
this._target = target;
|
|
13918
13930
|
if (!this.inited)
|
|
13919
13931
|
await this.init();
|
|
13920
|
-
|
|
13932
|
+
const sourceHost = splitHostPort(source).host;
|
|
13933
|
+
const targetHost = splitHostPort(target).host;
|
|
13934
|
+
if (!await addHost(sourceHost, targetHost))
|
|
13921
13935
|
throw new Error("update host failed");
|
|
13922
13936
|
consola.success("update host success\n");
|
|
13923
|
-
const targetHost = target.split(":")[0];
|
|
13924
13937
|
const normalizeBase = (b) => {
|
|
13925
13938
|
let out = b || "/";
|
|
13926
13939
|
if (!out.startsWith("/"))
|
|
@@ -13980,7 +13993,7 @@ var CaddyInstant = class {
|
|
|
13980
13993
|
});
|
|
13981
13994
|
const originalExit = import_node_process4.default.exit.bind(import_node_process4.default);
|
|
13982
13995
|
import_node_process4.default.exit = async (code) => {
|
|
13983
|
-
const port = Number(source.
|
|
13996
|
+
const port = Number(splitHostPort(source).port);
|
|
13984
13997
|
if (!Number.isNaN(port) && await tryPort(port))
|
|
13985
13998
|
await kill(port);
|
|
13986
13999
|
const pwd = import_node_process4.default.cwd();
|
|
@@ -13988,6 +14001,10 @@ var CaddyInstant = class {
|
|
|
13988
14001
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
13989
14002
|
await chmodRecursive(viteCacheDir, 511).catch(() => {
|
|
13990
14003
|
});
|
|
14004
|
+
const viteTempCacheDir = `${pwd}/node_modules/.vite-temp`;
|
|
14005
|
+
if ((0, import_node_fs3.existsSync)(viteTempCacheDir))
|
|
14006
|
+
await chmodRecursive(viteTempCacheDir, 511).catch(() => {
|
|
14007
|
+
});
|
|
13991
14008
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
13992
14009
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
13993
14010
|
await chmodRecursive(nuxtCacheDir, 511).catch(() => {
|
|
@@ -14059,7 +14076,7 @@ ${line}
|
|
|
14059
14076
|
this._stopEffects.forEach((fn) => fn());
|
|
14060
14077
|
try {
|
|
14061
14078
|
if (restore && this._source && this._target) {
|
|
14062
|
-
if (await removeHost(this._source.
|
|
14079
|
+
if (await removeHost(splitHostPort(this._source).host, splitHostPort(this._target).host))
|
|
14063
14080
|
consola.success("Restore host success.\n");
|
|
14064
14081
|
else
|
|
14065
14082
|
consola.fail("Restore host failed.\n");
|
package/dist/webpack.js
CHANGED
package/package.json
CHANGED
package/src/caddy/index.ts
CHANGED
|
@@ -114,6 +114,19 @@ function getCaddyConfig(): ReturnType<typeof useCaddyConfig> {
|
|
|
114
114
|
return caddyConfig
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/** Split `host:port` (IPv4 or hostname); supports `[::1]:port`. */
|
|
118
|
+
function splitHostPort(addr: string): { host: string, port: string } {
|
|
119
|
+
const lastColon = addr.lastIndexOf(':')
|
|
120
|
+
if (lastColon === -1)
|
|
121
|
+
return { host: addr, port: '' }
|
|
122
|
+
if (addr.startsWith('[')) {
|
|
123
|
+
const end = addr.indexOf(']')
|
|
124
|
+
if (end !== -1 && addr[end + 1] === ':')
|
|
125
|
+
return { host: addr.slice(1, end), port: addr.slice(end + 2) }
|
|
126
|
+
}
|
|
127
|
+
return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) }
|
|
128
|
+
}
|
|
129
|
+
|
|
117
130
|
export class CaddyInstant {
|
|
118
131
|
private inited = false
|
|
119
132
|
private stoped = false
|
|
@@ -180,6 +193,9 @@ export class CaddyInstant {
|
|
|
180
193
|
*/
|
|
181
194
|
async run(source: string, target: string, options?: Partial<RunOptions>): Promise<void> {
|
|
182
195
|
source = source.replace('0.0.0.0', '127.0.0.1')
|
|
196
|
+
// Caddy dials the upstream host via DNS; `localhost` can hit lookup timeouts (VPN/DNS).
|
|
197
|
+
// Use loopback IP so the proxy never depends on resolving "localhost".
|
|
198
|
+
source = source.replace(/^localhost(?=:)/i, '127.0.0.1')
|
|
183
199
|
const {
|
|
184
200
|
restore = true,
|
|
185
201
|
base = '/',
|
|
@@ -194,11 +210,11 @@ export class CaddyInstant {
|
|
|
194
210
|
if (!this.inited)
|
|
195
211
|
await this.init()
|
|
196
212
|
|
|
197
|
-
|
|
213
|
+
const sourceHost = splitHostPort(source).host
|
|
214
|
+
const targetHost = splitHostPort(target).host
|
|
215
|
+
if (!await addHost(sourceHost, targetHost))
|
|
198
216
|
throw new Error('update host failed')
|
|
199
217
|
consola.success('update host success\n')
|
|
200
|
-
|
|
201
|
-
const targetHost = target.split(':')[0]
|
|
202
218
|
const normalizeBase = (b: string): string => {
|
|
203
219
|
let out = b || '/'
|
|
204
220
|
if (!out.startsWith('/'))
|
|
@@ -270,7 +286,7 @@ export class CaddyInstant {
|
|
|
270
286
|
|
|
271
287
|
// @ts-expect-error override
|
|
272
288
|
process.exit = async (code?: number) => {
|
|
273
|
-
const port = Number(source.
|
|
289
|
+
const port = Number(splitHostPort(source).port)
|
|
274
290
|
if (!Number.isNaN(port) && await tryPort(port))
|
|
275
291
|
await kill(port)
|
|
276
292
|
|
|
@@ -279,6 +295,9 @@ export class CaddyInstant {
|
|
|
279
295
|
const viteCacheDir = `${pwd}/node_modules/.vite`
|
|
280
296
|
if (existsSync(viteCacheDir))
|
|
281
297
|
await chmodRecursive(viteCacheDir, 0o777).catch(() => { })
|
|
298
|
+
const viteTempCacheDir = `${pwd}/node_modules/.vite-temp`
|
|
299
|
+
if (existsSync(viteTempCacheDir))
|
|
300
|
+
await chmodRecursive(viteTempCacheDir, 0o777).catch(() => { })
|
|
282
301
|
const nuxtCacheDir = `${pwd}/.nuxt`
|
|
283
302
|
if (existsSync(nuxtCacheDir))
|
|
284
303
|
await chmodRecursive(nuxtCacheDir, 0o777).catch(() => { })
|
|
@@ -367,7 +386,7 @@ export class CaddyInstant {
|
|
|
367
386
|
|
|
368
387
|
try {
|
|
369
388
|
if (restore && this._source && this._target) {
|
|
370
|
-
if (await removeHost(this._source.
|
|
389
|
+
if (await removeHost(splitHostPort(this._source).host, splitHostPort(this._target).host))
|
|
371
390
|
consola.success('Restore host success.\n')
|
|
372
391
|
|
|
373
392
|
else
|