unplugin-https-reverse-proxy 1.0.0-beta.14 → 1.0.0-beta.15
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-SD5AGUG6.js → chunk-GV7Y22GZ.js} +14 -17
- package/dist/esbuild.cjs +14 -17
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +14 -17
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +14 -17
- package/dist/nuxt.js +1 -1
- package/dist/rollup.cjs +14 -17
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +14 -17
- package/dist/rspack.js +1 -1
- package/dist/vite.cjs +14 -17
- package/dist/vite.js +1 -1
- package/dist/webpack.cjs +14 -17
- package/dist/webpack.js +1 -1
- package/package.json +3 -3
- package/src/caddy/index.ts +17 -21
|
@@ -1952,6 +1952,7 @@ var CaddyInstant = class {
|
|
|
1952
1952
|
if (!existsSync(caddyFilePath))
|
|
1953
1953
|
await this.initCaddyfile();
|
|
1954
1954
|
this.caddyfile = await readFile(caddyFilePath, "utf-8");
|
|
1955
|
+
return this.caddyfile;
|
|
1955
1956
|
}
|
|
1956
1957
|
async initCaddyfile() {
|
|
1957
1958
|
const contet = `
|
|
@@ -2006,7 +2007,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2006
2007
|
if (!existsSync(caddyLockFilePath))
|
|
2007
2008
|
writeFileSync(caddyLockFilePath, "");
|
|
2008
2009
|
if (!this.locked) {
|
|
2009
|
-
if (
|
|
2010
|
+
if (await tryPort(443))
|
|
2010
2011
|
await kill(443, "tcp");
|
|
2011
2012
|
if ((process4.platform === "win32" || !https) && await tryPort(80))
|
|
2012
2013
|
await kill(80, "tcp");
|
|
@@ -2016,14 +2017,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2016
2017
|
process4.on("SIGINT", async () => {
|
|
2017
2018
|
if (!restore || this.stoped)
|
|
2018
2019
|
return;
|
|
2019
|
-
|
|
2020
|
-
try {
|
|
2021
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2022
|
-
await unlink(caddyFilePath);
|
|
2023
|
-
await unlink(caddyLockFilePath);
|
|
2024
|
-
} catch (e) {
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2020
|
+
await this.baseCleanup();
|
|
2027
2021
|
try {
|
|
2028
2022
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2029
2023
|
consola.success("Restore host success.\n");
|
|
@@ -2056,14 +2050,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2056
2050
|
chmodRecursive(webpackCacheDir, 511);
|
|
2057
2051
|
if (!restore || this.stoped)
|
|
2058
2052
|
return originalExit(code);
|
|
2059
|
-
|
|
2060
|
-
try {
|
|
2061
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2062
|
-
await unlink(caddyFilePath);
|
|
2063
|
-
await unlink(caddyLockFilePath);
|
|
2064
|
-
} catch (e) {
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2053
|
+
await this.baseCleanup();
|
|
2067
2054
|
try {
|
|
2068
2055
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2069
2056
|
consola.success("Restore host success.\n");
|
|
@@ -2113,6 +2100,16 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2113
2100
|
}
|
|
2114
2101
|
});
|
|
2115
2102
|
}
|
|
2103
|
+
async baseCleanup() {
|
|
2104
|
+
if (!this.locked) {
|
|
2105
|
+
try {
|
|
2106
|
+
await this.lockfile.unlock(caddyLockFilePath);
|
|
2107
|
+
await unlink(caddyFilePath);
|
|
2108
|
+
await unlink(caddyLockFilePath);
|
|
2109
|
+
} catch (e) {
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2116
2113
|
};
|
|
2117
2114
|
|
|
2118
2115
|
// src/index.ts
|
package/dist/esbuild.cjs
CHANGED
|
@@ -2037,6 +2037,7 @@ var CaddyInstant = class {
|
|
|
2037
2037
|
if (!(0, import_node_fs2.existsSync)(caddyFilePath))
|
|
2038
2038
|
await this.initCaddyfile();
|
|
2039
2039
|
this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
|
|
2040
|
+
return this.caddyfile;
|
|
2040
2041
|
}
|
|
2041
2042
|
async initCaddyfile() {
|
|
2042
2043
|
const contet = `
|
|
@@ -2091,7 +2092,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2091
2092
|
if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
|
|
2092
2093
|
(0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
|
|
2093
2094
|
if (!this.locked) {
|
|
2094
|
-
if (
|
|
2095
|
+
if (await tryPort(443))
|
|
2095
2096
|
await (0, import_kill_port.default)(443, "tcp");
|
|
2096
2097
|
if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
|
|
2097
2098
|
await (0, import_kill_port.default)(80, "tcp");
|
|
@@ -2101,14 +2102,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2101
2102
|
import_node_process4.default.on("SIGINT", async () => {
|
|
2102
2103
|
if (!restore || this.stoped)
|
|
2103
2104
|
return;
|
|
2104
|
-
|
|
2105
|
-
try {
|
|
2106
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2107
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2108
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2109
|
-
} catch (e) {
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2105
|
+
await this.baseCleanup();
|
|
2112
2106
|
try {
|
|
2113
2107
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2114
2108
|
consola.success("Restore host success.\n");
|
|
@@ -2141,14 +2135,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2141
2135
|
chmodRecursive(webpackCacheDir, 511);
|
|
2142
2136
|
if (!restore || this.stoped)
|
|
2143
2137
|
return originalExit(code);
|
|
2144
|
-
|
|
2145
|
-
try {
|
|
2146
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2147
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2148
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2149
|
-
} catch (e) {
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2138
|
+
await this.baseCleanup();
|
|
2152
2139
|
try {
|
|
2153
2140
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2154
2141
|
consola.success("Restore host success.\n");
|
|
@@ -2198,6 +2185,16 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2198
2185
|
}
|
|
2199
2186
|
});
|
|
2200
2187
|
}
|
|
2188
|
+
async baseCleanup() {
|
|
2189
|
+
if (!this.locked) {
|
|
2190
|
+
try {
|
|
2191
|
+
await this.lockfile.unlock(caddyLockFilePath);
|
|
2192
|
+
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2193
|
+
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2194
|
+
} catch (e) {
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2201
2198
|
};
|
|
2202
2199
|
|
|
2203
2200
|
// src/index.ts
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2037,6 +2037,7 @@ var CaddyInstant = class {
|
|
|
2037
2037
|
if (!(0, import_node_fs2.existsSync)(caddyFilePath))
|
|
2038
2038
|
await this.initCaddyfile();
|
|
2039
2039
|
this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
|
|
2040
|
+
return this.caddyfile;
|
|
2040
2041
|
}
|
|
2041
2042
|
async initCaddyfile() {
|
|
2042
2043
|
const contet = `
|
|
@@ -2091,7 +2092,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2091
2092
|
if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
|
|
2092
2093
|
(0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
|
|
2093
2094
|
if (!this.locked) {
|
|
2094
|
-
if (
|
|
2095
|
+
if (await tryPort(443))
|
|
2095
2096
|
await (0, import_kill_port.default)(443, "tcp");
|
|
2096
2097
|
if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
|
|
2097
2098
|
await (0, import_kill_port.default)(80, "tcp");
|
|
@@ -2101,14 +2102,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2101
2102
|
import_node_process4.default.on("SIGINT", async () => {
|
|
2102
2103
|
if (!restore || this.stoped)
|
|
2103
2104
|
return;
|
|
2104
|
-
|
|
2105
|
-
try {
|
|
2106
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2107
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2108
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2109
|
-
} catch (e) {
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2105
|
+
await this.baseCleanup();
|
|
2112
2106
|
try {
|
|
2113
2107
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2114
2108
|
consola.success("Restore host success.\n");
|
|
@@ -2141,14 +2135,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2141
2135
|
chmodRecursive(webpackCacheDir, 511);
|
|
2142
2136
|
if (!restore || this.stoped)
|
|
2143
2137
|
return originalExit(code);
|
|
2144
|
-
|
|
2145
|
-
try {
|
|
2146
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2147
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2148
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2149
|
-
} catch (e) {
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2138
|
+
await this.baseCleanup();
|
|
2152
2139
|
try {
|
|
2153
2140
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2154
2141
|
consola.success("Restore host success.\n");
|
|
@@ -2198,6 +2185,16 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2198
2185
|
}
|
|
2199
2186
|
});
|
|
2200
2187
|
}
|
|
2188
|
+
async baseCleanup() {
|
|
2189
|
+
if (!this.locked) {
|
|
2190
|
+
try {
|
|
2191
|
+
await this.lockfile.unlock(caddyLockFilePath);
|
|
2192
|
+
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2193
|
+
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2194
|
+
} catch (e) {
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2201
2198
|
};
|
|
2202
2199
|
|
|
2203
2200
|
// src/index.ts
|
package/dist/index.js
CHANGED
package/dist/nuxt.cjs
CHANGED
|
@@ -2039,6 +2039,7 @@ var CaddyInstant = class {
|
|
|
2039
2039
|
if (!(0, import_node_fs2.existsSync)(caddyFilePath))
|
|
2040
2040
|
await this.initCaddyfile();
|
|
2041
2041
|
this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
|
|
2042
|
+
return this.caddyfile;
|
|
2042
2043
|
}
|
|
2043
2044
|
async initCaddyfile() {
|
|
2044
2045
|
const contet = `
|
|
@@ -2093,7 +2094,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2093
2094
|
if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
|
|
2094
2095
|
(0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
|
|
2095
2096
|
if (!this.locked) {
|
|
2096
|
-
if (
|
|
2097
|
+
if (await tryPort(443))
|
|
2097
2098
|
await (0, import_kill_port.default)(443, "tcp");
|
|
2098
2099
|
if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
|
|
2099
2100
|
await (0, import_kill_port.default)(80, "tcp");
|
|
@@ -2103,14 +2104,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2103
2104
|
import_node_process4.default.on("SIGINT", async () => {
|
|
2104
2105
|
if (!restore || this.stoped)
|
|
2105
2106
|
return;
|
|
2106
|
-
|
|
2107
|
-
try {
|
|
2108
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2109
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2110
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2111
|
-
} catch (e) {
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2107
|
+
await this.baseCleanup();
|
|
2114
2108
|
try {
|
|
2115
2109
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2116
2110
|
consola.success("Restore host success.\n");
|
|
@@ -2143,14 +2137,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2143
2137
|
chmodRecursive(webpackCacheDir, 511);
|
|
2144
2138
|
if (!restore || this.stoped)
|
|
2145
2139
|
return originalExit(code);
|
|
2146
|
-
|
|
2147
|
-
try {
|
|
2148
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2149
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2150
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2151
|
-
} catch (e) {
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2140
|
+
await this.baseCleanup();
|
|
2154
2141
|
try {
|
|
2155
2142
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2156
2143
|
consola.success("Restore host success.\n");
|
|
@@ -2200,6 +2187,16 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2200
2187
|
}
|
|
2201
2188
|
});
|
|
2202
2189
|
}
|
|
2190
|
+
async baseCleanup() {
|
|
2191
|
+
if (!this.locked) {
|
|
2192
|
+
try {
|
|
2193
|
+
await this.lockfile.unlock(caddyLockFilePath);
|
|
2194
|
+
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2195
|
+
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2196
|
+
} catch (e) {
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2203
2200
|
};
|
|
2204
2201
|
|
|
2205
2202
|
// src/index.ts
|
package/dist/nuxt.js
CHANGED
package/dist/rollup.cjs
CHANGED
|
@@ -2037,6 +2037,7 @@ var CaddyInstant = class {
|
|
|
2037
2037
|
if (!(0, import_node_fs2.existsSync)(caddyFilePath))
|
|
2038
2038
|
await this.initCaddyfile();
|
|
2039
2039
|
this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
|
|
2040
|
+
return this.caddyfile;
|
|
2040
2041
|
}
|
|
2041
2042
|
async initCaddyfile() {
|
|
2042
2043
|
const contet = `
|
|
@@ -2091,7 +2092,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2091
2092
|
if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
|
|
2092
2093
|
(0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
|
|
2093
2094
|
if (!this.locked) {
|
|
2094
|
-
if (
|
|
2095
|
+
if (await tryPort(443))
|
|
2095
2096
|
await (0, import_kill_port.default)(443, "tcp");
|
|
2096
2097
|
if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
|
|
2097
2098
|
await (0, import_kill_port.default)(80, "tcp");
|
|
@@ -2101,14 +2102,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2101
2102
|
import_node_process4.default.on("SIGINT", async () => {
|
|
2102
2103
|
if (!restore || this.stoped)
|
|
2103
2104
|
return;
|
|
2104
|
-
|
|
2105
|
-
try {
|
|
2106
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2107
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2108
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2109
|
-
} catch (e) {
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2105
|
+
await this.baseCleanup();
|
|
2112
2106
|
try {
|
|
2113
2107
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2114
2108
|
consola.success("Restore host success.\n");
|
|
@@ -2141,14 +2135,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2141
2135
|
chmodRecursive(webpackCacheDir, 511);
|
|
2142
2136
|
if (!restore || this.stoped)
|
|
2143
2137
|
return originalExit(code);
|
|
2144
|
-
|
|
2145
|
-
try {
|
|
2146
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2147
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2148
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2149
|
-
} catch (e) {
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2138
|
+
await this.baseCleanup();
|
|
2152
2139
|
try {
|
|
2153
2140
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2154
2141
|
consola.success("Restore host success.\n");
|
|
@@ -2198,6 +2185,16 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2198
2185
|
}
|
|
2199
2186
|
});
|
|
2200
2187
|
}
|
|
2188
|
+
async baseCleanup() {
|
|
2189
|
+
if (!this.locked) {
|
|
2190
|
+
try {
|
|
2191
|
+
await this.lockfile.unlock(caddyLockFilePath);
|
|
2192
|
+
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2193
|
+
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2194
|
+
} catch (e) {
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2201
2198
|
};
|
|
2202
2199
|
|
|
2203
2200
|
// src/index.ts
|
package/dist/rollup.js
CHANGED
package/dist/rspack.cjs
CHANGED
|
@@ -2036,6 +2036,7 @@ var CaddyInstant = class {
|
|
|
2036
2036
|
if (!(0, import_node_fs2.existsSync)(caddyFilePath))
|
|
2037
2037
|
await this.initCaddyfile();
|
|
2038
2038
|
this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
|
|
2039
|
+
return this.caddyfile;
|
|
2039
2040
|
}
|
|
2040
2041
|
async initCaddyfile() {
|
|
2041
2042
|
const contet = `
|
|
@@ -2090,7 +2091,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2090
2091
|
if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
|
|
2091
2092
|
(0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
|
|
2092
2093
|
if (!this.locked) {
|
|
2093
|
-
if (
|
|
2094
|
+
if (await tryPort(443))
|
|
2094
2095
|
await (0, import_kill_port.default)(443, "tcp");
|
|
2095
2096
|
if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
|
|
2096
2097
|
await (0, import_kill_port.default)(80, "tcp");
|
|
@@ -2100,14 +2101,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2100
2101
|
import_node_process4.default.on("SIGINT", async () => {
|
|
2101
2102
|
if (!restore || this.stoped)
|
|
2102
2103
|
return;
|
|
2103
|
-
|
|
2104
|
-
try {
|
|
2105
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2106
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2107
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2108
|
-
} catch (e) {
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2104
|
+
await this.baseCleanup();
|
|
2111
2105
|
try {
|
|
2112
2106
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2113
2107
|
consola.success("Restore host success.\n");
|
|
@@ -2140,14 +2134,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2140
2134
|
chmodRecursive(webpackCacheDir, 511);
|
|
2141
2135
|
if (!restore || this.stoped)
|
|
2142
2136
|
return originalExit(code);
|
|
2143
|
-
|
|
2144
|
-
try {
|
|
2145
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2146
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2147
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2148
|
-
} catch (e) {
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2137
|
+
await this.baseCleanup();
|
|
2151
2138
|
try {
|
|
2152
2139
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2153
2140
|
consola.success("Restore host success.\n");
|
|
@@ -2197,6 +2184,16 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2197
2184
|
}
|
|
2198
2185
|
});
|
|
2199
2186
|
}
|
|
2187
|
+
async baseCleanup() {
|
|
2188
|
+
if (!this.locked) {
|
|
2189
|
+
try {
|
|
2190
|
+
await this.lockfile.unlock(caddyLockFilePath);
|
|
2191
|
+
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2192
|
+
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2193
|
+
} catch (e) {
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2200
2197
|
};
|
|
2201
2198
|
|
|
2202
2199
|
// src/index.ts
|
package/dist/rspack.js
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -2037,6 +2037,7 @@ var CaddyInstant = class {
|
|
|
2037
2037
|
if (!(0, import_node_fs2.existsSync)(caddyFilePath))
|
|
2038
2038
|
await this.initCaddyfile();
|
|
2039
2039
|
this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
|
|
2040
|
+
return this.caddyfile;
|
|
2040
2041
|
}
|
|
2041
2042
|
async initCaddyfile() {
|
|
2042
2043
|
const contet = `
|
|
@@ -2091,7 +2092,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2091
2092
|
if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
|
|
2092
2093
|
(0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
|
|
2093
2094
|
if (!this.locked) {
|
|
2094
|
-
if (
|
|
2095
|
+
if (await tryPort(443))
|
|
2095
2096
|
await (0, import_kill_port.default)(443, "tcp");
|
|
2096
2097
|
if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
|
|
2097
2098
|
await (0, import_kill_port.default)(80, "tcp");
|
|
@@ -2101,14 +2102,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2101
2102
|
import_node_process4.default.on("SIGINT", async () => {
|
|
2102
2103
|
if (!restore || this.stoped)
|
|
2103
2104
|
return;
|
|
2104
|
-
|
|
2105
|
-
try {
|
|
2106
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2107
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2108
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2109
|
-
} catch (e) {
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2105
|
+
await this.baseCleanup();
|
|
2112
2106
|
try {
|
|
2113
2107
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2114
2108
|
consola.success("Restore host success.\n");
|
|
@@ -2141,14 +2135,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2141
2135
|
chmodRecursive(webpackCacheDir, 511);
|
|
2142
2136
|
if (!restore || this.stoped)
|
|
2143
2137
|
return originalExit(code);
|
|
2144
|
-
|
|
2145
|
-
try {
|
|
2146
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2147
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2148
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2149
|
-
} catch (e) {
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2138
|
+
await this.baseCleanup();
|
|
2152
2139
|
try {
|
|
2153
2140
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2154
2141
|
consola.success("Restore host success.\n");
|
|
@@ -2198,6 +2185,16 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2198
2185
|
}
|
|
2199
2186
|
});
|
|
2200
2187
|
}
|
|
2188
|
+
async baseCleanup() {
|
|
2189
|
+
if (!this.locked) {
|
|
2190
|
+
try {
|
|
2191
|
+
await this.lockfile.unlock(caddyLockFilePath);
|
|
2192
|
+
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2193
|
+
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2194
|
+
} catch (e) {
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2201
2198
|
};
|
|
2202
2199
|
|
|
2203
2200
|
// src/index.ts
|
package/dist/vite.js
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -2037,6 +2037,7 @@ var CaddyInstant = class {
|
|
|
2037
2037
|
if (!(0, import_node_fs2.existsSync)(caddyFilePath))
|
|
2038
2038
|
await this.initCaddyfile();
|
|
2039
2039
|
this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
|
|
2040
|
+
return this.caddyfile;
|
|
2040
2041
|
}
|
|
2041
2042
|
async initCaddyfile() {
|
|
2042
2043
|
const contet = `
|
|
@@ -2091,7 +2092,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2091
2092
|
if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
|
|
2092
2093
|
(0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
|
|
2093
2094
|
if (!this.locked) {
|
|
2094
|
-
if (
|
|
2095
|
+
if (await tryPort(443))
|
|
2095
2096
|
await (0, import_kill_port.default)(443, "tcp");
|
|
2096
2097
|
if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
|
|
2097
2098
|
await (0, import_kill_port.default)(80, "tcp");
|
|
@@ -2101,14 +2102,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2101
2102
|
import_node_process4.default.on("SIGINT", async () => {
|
|
2102
2103
|
if (!restore || this.stoped)
|
|
2103
2104
|
return;
|
|
2104
|
-
|
|
2105
|
-
try {
|
|
2106
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2107
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2108
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2109
|
-
} catch (e) {
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2105
|
+
await this.baseCleanup();
|
|
2112
2106
|
try {
|
|
2113
2107
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2114
2108
|
consola.success("Restore host success.\n");
|
|
@@ -2141,14 +2135,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2141
2135
|
chmodRecursive(webpackCacheDir, 511);
|
|
2142
2136
|
if (!restore || this.stoped)
|
|
2143
2137
|
return originalExit(code);
|
|
2144
|
-
|
|
2145
|
-
try {
|
|
2146
|
-
await this.lockfile.unlock(caddyLockFilePath);
|
|
2147
|
-
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2148
|
-
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2149
|
-
} catch (e) {
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2138
|
+
await this.baseCleanup();
|
|
2152
2139
|
try {
|
|
2153
2140
|
if (await removeHost(source.split(":")[0], target.split(":")[0]))
|
|
2154
2141
|
consola.success("Restore host success.\n");
|
|
@@ -2198,6 +2185,16 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
2198
2185
|
}
|
|
2199
2186
|
});
|
|
2200
2187
|
}
|
|
2188
|
+
async baseCleanup() {
|
|
2189
|
+
if (!this.locked) {
|
|
2190
|
+
try {
|
|
2191
|
+
await this.lockfile.unlock(caddyLockFilePath);
|
|
2192
|
+
await (0, import_promises2.unlink)(caddyFilePath);
|
|
2193
|
+
await (0, import_promises2.unlink)(caddyLockFilePath);
|
|
2194
|
+
} catch (e) {
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2201
2198
|
};
|
|
2202
2199
|
|
|
2203
2200
|
// src/index.ts
|
package/dist/webpack.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-https-reverse-proxy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.15",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/zcf0508/unplugin-https-reverse-proxy#readme",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"tsup": "^7.3.0",
|
|
149
149
|
"typescript": "^5.3.3",
|
|
150
150
|
"vite": "^4.5.2",
|
|
151
|
-
"vitest": "^0.
|
|
151
|
+
"vitest": "^2.0.5",
|
|
152
152
|
"webpack": "^5.90.3"
|
|
153
153
|
},
|
|
154
154
|
"scripts": {
|
|
@@ -164,6 +164,6 @@
|
|
|
164
164
|
"play:vuecli4": "npm -C examples/vuecli4 run serve",
|
|
165
165
|
"release": "bumpp",
|
|
166
166
|
"start": "tsx src/index.ts",
|
|
167
|
-
"test": "vitest"
|
|
167
|
+
"test": "UHRP_CADDY_PATH='./test/.uhrp' vitest"
|
|
168
168
|
}
|
|
169
169
|
}
|
package/src/caddy/index.ts
CHANGED
|
@@ -134,6 +134,7 @@ export class CaddyInstant {
|
|
|
134
134
|
await this.initCaddyfile()
|
|
135
135
|
|
|
136
136
|
this.caddyfile = await readFile(caddyFilePath, 'utf-8')
|
|
137
|
+
return this.caddyfile
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
async initCaddyfile() {
|
|
@@ -199,7 +200,7 @@ ${target.split(':')[0]}${https ? '' : ':80'} {
|
|
|
199
200
|
writeFileSync(caddyLockFilePath, '')
|
|
200
201
|
|
|
201
202
|
if (!this.locked) {
|
|
202
|
-
if (
|
|
203
|
+
if (await tryPort(443))
|
|
203
204
|
await kill(443, 'tcp')
|
|
204
205
|
if ((process.platform === 'win32' || !https) && await tryPort(80))
|
|
205
206
|
await kill(80, 'tcp')
|
|
@@ -211,16 +212,7 @@ ${target.split(':')[0]}${https ? '' : ':80'} {
|
|
|
211
212
|
if (!restore || this.stoped)
|
|
212
213
|
return
|
|
213
214
|
|
|
214
|
-
|
|
215
|
-
try {
|
|
216
|
-
await this.lockfile.unlock(caddyLockFilePath)
|
|
217
|
-
await unlink(caddyFilePath)
|
|
218
|
-
await unlink(caddyLockFilePath)
|
|
219
|
-
}
|
|
220
|
-
catch (e) {
|
|
221
|
-
// consola.error(e)
|
|
222
|
-
}
|
|
223
|
-
}
|
|
215
|
+
await this.baseCleanup()
|
|
224
216
|
|
|
225
217
|
try {
|
|
226
218
|
if (await removeHost(source.split(':')[0], target.split(':')[0]))
|
|
@@ -264,16 +256,7 @@ ${target.split(':')[0]}${https ? '' : ':80'} {
|
|
|
264
256
|
if (!restore || this.stoped)
|
|
265
257
|
return originalExit(code)
|
|
266
258
|
|
|
267
|
-
|
|
268
|
-
try {
|
|
269
|
-
await this.lockfile.unlock(caddyLockFilePath)
|
|
270
|
-
await unlink(caddyFilePath)
|
|
271
|
-
await unlink(caddyLockFilePath)
|
|
272
|
-
}
|
|
273
|
-
catch (e) {
|
|
274
|
-
// consola.error(e)
|
|
275
|
-
}
|
|
276
|
-
}
|
|
259
|
+
await this.baseCleanup()
|
|
277
260
|
|
|
278
261
|
try {
|
|
279
262
|
if (await removeHost(source.split(':')[0], target.split(':')[0]))
|
|
@@ -341,4 +324,17 @@ ${target.split(':')[0]}${https ? '' : ':80'} {
|
|
|
341
324
|
}
|
|
342
325
|
})
|
|
343
326
|
}
|
|
327
|
+
|
|
328
|
+
async baseCleanup() {
|
|
329
|
+
if (!this.locked) {
|
|
330
|
+
try {
|
|
331
|
+
await this.lockfile.unlock(caddyLockFilePath)
|
|
332
|
+
await unlink(caddyFilePath)
|
|
333
|
+
await unlink(caddyLockFilePath)
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
// consola.error(e)
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
344
340
|
}
|