unplugin-dingtalk 0.5.0 → 0.5.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/astro.cjs +74 -10
- package/dist/astro.js +4 -4
- package/dist/{chunk-OSHJOAQB.js → chunk-QU7HLXVD.js} +87 -26
- package/dist/{chunk-TZDLEHKX.js → chunk-VQXY6FXR.js} +1 -1
- package/dist/{chunk-PMOTCIQR.js → chunk-ZEHXGFFH.js} +3 -3
- package/dist/esbuild.cjs +72 -8
- package/dist/esbuild.js +2 -2
- package/dist/index.cjs +77 -13
- package/dist/index.js +4 -4
- package/dist/{multipart-parser-HI4LNJC5.js → multipart-parser-VO5TIRQZ.js} +4 -1
- package/dist/nuxt.cjs +72 -8
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +3 -3
- package/dist/rollup.cjs +72 -8
- package/dist/rollup.js +2 -2
- package/dist/rspack.cjs +73 -9
- package/dist/rspack.d.cts +1 -2
- package/dist/rspack.d.ts +1 -2
- package/dist/rspack.js +3 -3
- package/dist/vite.cjs +72 -8
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +73 -9
- package/dist/webpack.js +3 -3
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -5069,6 +5069,7 @@ var init_multipart_parser = __esm({
|
|
|
5069
5069
|
state = S.HEADER_FIELD;
|
|
5070
5070
|
mark("onHeaderField");
|
|
5071
5071
|
index = 0;
|
|
5072
|
+
// falls through
|
|
5072
5073
|
case S.HEADER_FIELD:
|
|
5073
5074
|
if (c2 === CR) {
|
|
5074
5075
|
clear("onHeaderField");
|
|
@@ -5098,6 +5099,7 @@ var init_multipart_parser = __esm({
|
|
|
5098
5099
|
}
|
|
5099
5100
|
mark("onHeaderValue");
|
|
5100
5101
|
state = S.HEADER_VALUE;
|
|
5102
|
+
// falls through
|
|
5101
5103
|
case S.HEADER_VALUE:
|
|
5102
5104
|
if (c2 === CR) {
|
|
5103
5105
|
dataCallback("onHeaderValue", true);
|
|
@@ -5121,6 +5123,7 @@ var init_multipart_parser = __esm({
|
|
|
5121
5123
|
case S.PART_DATA_START:
|
|
5122
5124
|
state = S.PART_DATA;
|
|
5123
5125
|
mark("onPartData");
|
|
5126
|
+
// falls through
|
|
5124
5127
|
case S.PART_DATA:
|
|
5125
5128
|
previousIndex = index;
|
|
5126
5129
|
if (index === 0) {
|
|
@@ -5206,18 +5209,20 @@ var init_multipart_parser = __esm({
|
|
|
5206
5209
|
});
|
|
5207
5210
|
|
|
5208
5211
|
// src/index.ts
|
|
5209
|
-
var
|
|
5210
|
-
__export(
|
|
5211
|
-
default: () =>
|
|
5212
|
+
var index_exports = {};
|
|
5213
|
+
__export(index_exports, {
|
|
5214
|
+
default: () => index_default,
|
|
5212
5215
|
resovedInfo: () => resovedInfo,
|
|
5213
5216
|
startDnsServer: () => startDnsServer,
|
|
5214
5217
|
startVueDevtools: () => startVueDevtools,
|
|
5215
5218
|
unplugin: () => unplugin,
|
|
5216
5219
|
unpluginFactory: () => unpluginFactory
|
|
5217
5220
|
});
|
|
5218
|
-
module.exports = __toCommonJS(
|
|
5221
|
+
module.exports = __toCommonJS(index_exports);
|
|
5219
5222
|
var import_node_child_process = require("child_process");
|
|
5220
5223
|
var import_node_process = __toESM(require("process"), 1);
|
|
5224
|
+
var import_node_http3 = require("http");
|
|
5225
|
+
var import_node_net2 = require("net");
|
|
5221
5226
|
|
|
5222
5227
|
// node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/index.js
|
|
5223
5228
|
var import_node_http2 = __toESM(require("http"), 1);
|
|
@@ -6515,9 +6520,10 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6515
6520
|
var import_unplugin = require("unplugin");
|
|
6516
6521
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
6517
6522
|
var import_cookie = __toESM(require("cookie"), 1);
|
|
6518
|
-
var
|
|
6523
|
+
var import_z_chii = require("z-chii");
|
|
6519
6524
|
var import_dns2 = __toESM(require("dns2"), 1);
|
|
6520
6525
|
var import_get_port_please = require("get-port-please");
|
|
6526
|
+
var import_http_proxy = __toESM(require("http-proxy"), 1);
|
|
6521
6527
|
var cwd = import_node_process.default.cwd();
|
|
6522
6528
|
var config;
|
|
6523
6529
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
@@ -6617,7 +6623,7 @@ var unpluginFactory = (options) => {
|
|
|
6617
6623
|
var _a4, _b, _c;
|
|
6618
6624
|
if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
|
|
6619
6625
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6620
|
-
(0,
|
|
6626
|
+
(0, import_z_chii.start)({
|
|
6621
6627
|
port: resovedInfo.availablePort
|
|
6622
6628
|
});
|
|
6623
6629
|
debug(`chii server port: ${resovedInfo.availablePort}`);
|
|
@@ -6627,11 +6633,6 @@ var unpluginFactory = (options) => {
|
|
|
6627
6633
|
"/* eslint-disable */;",
|
|
6628
6634
|
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
6629
6635
|
devtools.connect(${((_b = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _b.host) ? `"${options.vueDevtools.host}"` : void 0}, ${((_c = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _c.port) ? `${options.vueDevtools.port}` : void 0});` : "",
|
|
6630
|
-
(options == null ? void 0 : options.enable) && enableChii ? `(() => {
|
|
6631
|
-
const script = document.createElement('script');
|
|
6632
|
-
script.src="http://${(chii == null ? void 0 : chii.host) || "127.0.0.1"}:${resovedInfo.availablePort}/target.js";
|
|
6633
|
-
document.body.appendChild(script);
|
|
6634
|
-
})()` : "",
|
|
6635
6636
|
"/* eslint-enable */",
|
|
6636
6637
|
`${_source};`
|
|
6637
6638
|
];
|
|
@@ -6651,6 +6652,22 @@ var unpluginFactory = (options) => {
|
|
|
6651
6652
|
configResolved(_config) {
|
|
6652
6653
|
config = _config;
|
|
6653
6654
|
},
|
|
6655
|
+
transformIndexHtml(html) {
|
|
6656
|
+
if (enableChii) {
|
|
6657
|
+
return html.replace(
|
|
6658
|
+
"</body>",
|
|
6659
|
+
`</body>
|
|
6660
|
+
<script>
|
|
6661
|
+
(() => {
|
|
6662
|
+
const script = document.createElement('script');
|
|
6663
|
+
script.src="./__chii_proxy/target.js";
|
|
6664
|
+
document.body.appendChild(script);
|
|
6665
|
+
})()
|
|
6666
|
+
</script>
|
|
6667
|
+
`
|
|
6668
|
+
);
|
|
6669
|
+
}
|
|
6670
|
+
},
|
|
6654
6671
|
async configureServer(server) {
|
|
6655
6672
|
var _a4, _b;
|
|
6656
6673
|
if (!(options == null ? void 0 : options.enable)) {
|
|
@@ -6686,7 +6703,7 @@ var unpluginFactory = (options) => {
|
|
|
6686
6703
|
server.middlewares.use((req, res, next) => {
|
|
6687
6704
|
const cookies = import_cookie.default.parse(req.headers.cookie || "");
|
|
6688
6705
|
for (const [name, value] of Object.entries(cookies)) {
|
|
6689
|
-
if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6706
|
+
if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6690
6707
|
const serializedCookie = import_cookie.default.serialize(name, value, {
|
|
6691
6708
|
httpOnly: false
|
|
6692
6709
|
});
|
|
@@ -6697,6 +6714,51 @@ var unpluginFactory = (options) => {
|
|
|
6697
6714
|
});
|
|
6698
6715
|
}
|
|
6699
6716
|
if (enableChii) {
|
|
6717
|
+
let createProxyMiddleware2 = function() {
|
|
6718
|
+
let proxy = null;
|
|
6719
|
+
const handleUpgrade = (req, socket, head) => {
|
|
6720
|
+
var _a5;
|
|
6721
|
+
if (proxy && ((_a5 = req.url) == null ? void 0 : _a5.startsWith("/__chii_proxy"))) {
|
|
6722
|
+
debug("WS upgrade:", req.url);
|
|
6723
|
+
req.url = req.url.replace("/__chii_proxy", "");
|
|
6724
|
+
proxy.ws(req, socket, head);
|
|
6725
|
+
}
|
|
6726
|
+
};
|
|
6727
|
+
return (resolvedInfo) => {
|
|
6728
|
+
return (req, res, next) => {
|
|
6729
|
+
var _a5;
|
|
6730
|
+
if (!proxy && resolvedInfo.availablePort) {
|
|
6731
|
+
proxy = import_http_proxy.default.createProxyServer({
|
|
6732
|
+
target: `http://localhost:${resolvedInfo.availablePort}`,
|
|
6733
|
+
ws: true
|
|
6734
|
+
// changeOrigin: true, // Consider if you need this
|
|
6735
|
+
});
|
|
6736
|
+
proxy.on("error", (err, req2, res2) => {
|
|
6737
|
+
console.error("Proxy error:", err);
|
|
6738
|
+
if (res2 instanceof import_node_http3.ServerResponse) {
|
|
6739
|
+
if (!res2.headersSent) {
|
|
6740
|
+
res2.writeHead(500, { "Content-Type": "text/plain" });
|
|
6741
|
+
}
|
|
6742
|
+
res2.end(`Proxy error: ${err.message}`);
|
|
6743
|
+
} else if (res2 instanceof import_node_net2.Socket) {
|
|
6744
|
+
res2.destroy();
|
|
6745
|
+
}
|
|
6746
|
+
});
|
|
6747
|
+
if (req.socket.server) {
|
|
6748
|
+
req.socket.server.on("upgrade", handleUpgrade);
|
|
6749
|
+
}
|
|
6750
|
+
}
|
|
6751
|
+
if (proxy && ((_a5 = req.url) == null ? void 0 : _a5.startsWith("/__chii_proxy"))) {
|
|
6752
|
+
debug(req.url);
|
|
6753
|
+
req.url = req.url.replace("/__chii_proxy", "");
|
|
6754
|
+
proxy.web(req, res);
|
|
6755
|
+
} else {
|
|
6756
|
+
next();
|
|
6757
|
+
}
|
|
6758
|
+
};
|
|
6759
|
+
};
|
|
6760
|
+
};
|
|
6761
|
+
var createProxyMiddleware = createProxyMiddleware2;
|
|
6700
6762
|
server.middlewares.use("/__chrome_devtools", async (_req, res) => {
|
|
6701
6763
|
try {
|
|
6702
6764
|
const raw = await fetch(`http://localhost:${resovedInfo.availablePort}/targets`);
|
|
@@ -6715,6 +6777,8 @@ var unpluginFactory = (options) => {
|
|
|
6715
6777
|
res.end();
|
|
6716
6778
|
}
|
|
6717
6779
|
});
|
|
6780
|
+
const proxyMiddleware = createProxyMiddleware2();
|
|
6781
|
+
server.middlewares.use(proxyMiddleware(resovedInfo));
|
|
6718
6782
|
}
|
|
6719
6783
|
server.middlewares.use("/open-dingtalk", (req, res) => {
|
|
6720
6784
|
var _a5;
|
|
@@ -6791,7 +6855,7 @@ var unpluginFactory = (options) => {
|
|
|
6791
6855
|
return unpluginDing;
|
|
6792
6856
|
};
|
|
6793
6857
|
var unplugin = /* @__PURE__ */ (0, import_unplugin.createUnplugin)(unpluginFactory);
|
|
6794
|
-
var
|
|
6858
|
+
var index_default = unplugin;
|
|
6795
6859
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6796
6860
|
0 && (module.exports = {
|
|
6797
6861
|
resovedInfo,
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
index_default,
|
|
2
3
|
resovedInfo,
|
|
3
|
-
src_default,
|
|
4
4
|
startDnsServer,
|
|
5
5
|
startVueDevtools,
|
|
6
6
|
unplugin,
|
|
7
7
|
unpluginFactory
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-QU7HLXVD.js";
|
|
9
|
+
import "./chunk-ZEHXGFFH.js";
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
index_default as default,
|
|
12
12
|
resovedInfo,
|
|
13
13
|
startDnsServer,
|
|
14
14
|
startVueDevtools,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
FormData,
|
|
3
3
|
__forAwait,
|
|
4
4
|
file_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZEHXGFFH.js";
|
|
6
6
|
|
|
7
7
|
// node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/multipart-parser.js
|
|
8
8
|
var s = 0;
|
|
@@ -131,6 +131,7 @@ var MultipartParser = class {
|
|
|
131
131
|
state = S.HEADER_FIELD;
|
|
132
132
|
mark("onHeaderField");
|
|
133
133
|
index = 0;
|
|
134
|
+
// falls through
|
|
134
135
|
case S.HEADER_FIELD:
|
|
135
136
|
if (c === CR) {
|
|
136
137
|
clear("onHeaderField");
|
|
@@ -160,6 +161,7 @@ var MultipartParser = class {
|
|
|
160
161
|
}
|
|
161
162
|
mark("onHeaderValue");
|
|
162
163
|
state = S.HEADER_VALUE;
|
|
164
|
+
// falls through
|
|
163
165
|
case S.HEADER_VALUE:
|
|
164
166
|
if (c === CR) {
|
|
165
167
|
dataCallback("onHeaderValue", true);
|
|
@@ -183,6 +185,7 @@ var MultipartParser = class {
|
|
|
183
185
|
case S.PART_DATA_START:
|
|
184
186
|
state = S.PART_DATA;
|
|
185
187
|
mark("onPartData");
|
|
188
|
+
// falls through
|
|
186
189
|
case S.PART_DATA:
|
|
187
190
|
previousIndex = index;
|
|
188
191
|
if (index === 0) {
|
package/dist/nuxt.cjs
CHANGED
|
@@ -5069,6 +5069,7 @@ var init_multipart_parser = __esm({
|
|
|
5069
5069
|
state = S.HEADER_FIELD;
|
|
5070
5070
|
mark("onHeaderField");
|
|
5071
5071
|
index = 0;
|
|
5072
|
+
// falls through
|
|
5072
5073
|
case S.HEADER_FIELD:
|
|
5073
5074
|
if (c2 === CR) {
|
|
5074
5075
|
clear("onHeaderField");
|
|
@@ -5098,6 +5099,7 @@ var init_multipart_parser = __esm({
|
|
|
5098
5099
|
}
|
|
5099
5100
|
mark("onHeaderValue");
|
|
5100
5101
|
state = S.HEADER_VALUE;
|
|
5102
|
+
// falls through
|
|
5101
5103
|
case S.HEADER_VALUE:
|
|
5102
5104
|
if (c2 === CR) {
|
|
5103
5105
|
dataCallback("onHeaderValue", true);
|
|
@@ -5121,6 +5123,7 @@ var init_multipart_parser = __esm({
|
|
|
5121
5123
|
case S.PART_DATA_START:
|
|
5122
5124
|
state = S.PART_DATA;
|
|
5123
5125
|
mark("onPartData");
|
|
5126
|
+
// falls through
|
|
5124
5127
|
case S.PART_DATA:
|
|
5125
5128
|
previousIndex = index;
|
|
5126
5129
|
if (index === 0) {
|
|
@@ -5220,6 +5223,8 @@ var import_vite_plugin_vconsole = __toESM(require("vite-plugin-vconsole"), 1);
|
|
|
5220
5223
|
// src/index.ts
|
|
5221
5224
|
var import_node_child_process = require("child_process");
|
|
5222
5225
|
var import_node_process = __toESM(require("process"), 1);
|
|
5226
|
+
var import_node_http3 = require("http");
|
|
5227
|
+
var import_node_net2 = require("net");
|
|
5223
5228
|
|
|
5224
5229
|
// node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/index.js
|
|
5225
5230
|
var import_node_http2 = __toESM(require("http"), 1);
|
|
@@ -6517,9 +6522,10 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6517
6522
|
var import_unplugin = require("unplugin");
|
|
6518
6523
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
6519
6524
|
var import_cookie = __toESM(require("cookie"), 1);
|
|
6520
|
-
var
|
|
6525
|
+
var import_z_chii = require("z-chii");
|
|
6521
6526
|
var import_dns2 = __toESM(require("dns2"), 1);
|
|
6522
6527
|
var import_get_port_please = require("get-port-please");
|
|
6528
|
+
var import_http_proxy = __toESM(require("http-proxy"), 1);
|
|
6523
6529
|
var cwd = import_node_process.default.cwd();
|
|
6524
6530
|
var config;
|
|
6525
6531
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
@@ -6619,7 +6625,7 @@ var unpluginFactory = (options) => {
|
|
|
6619
6625
|
var _a4, _b, _c;
|
|
6620
6626
|
if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
|
|
6621
6627
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6622
|
-
(0,
|
|
6628
|
+
(0, import_z_chii.start)({
|
|
6623
6629
|
port: resovedInfo.availablePort
|
|
6624
6630
|
});
|
|
6625
6631
|
debug(`chii server port: ${resovedInfo.availablePort}`);
|
|
@@ -6629,11 +6635,6 @@ var unpluginFactory = (options) => {
|
|
|
6629
6635
|
"/* eslint-disable */;",
|
|
6630
6636
|
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
6631
6637
|
devtools.connect(${((_b = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _b.host) ? `"${options.vueDevtools.host}"` : void 0}, ${((_c = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _c.port) ? `${options.vueDevtools.port}` : void 0});` : "",
|
|
6632
|
-
(options == null ? void 0 : options.enable) && enableChii ? `(() => {
|
|
6633
|
-
const script = document.createElement('script');
|
|
6634
|
-
script.src="http://${(chii == null ? void 0 : chii.host) || "127.0.0.1"}:${resovedInfo.availablePort}/target.js";
|
|
6635
|
-
document.body.appendChild(script);
|
|
6636
|
-
})()` : "",
|
|
6637
6638
|
"/* eslint-enable */",
|
|
6638
6639
|
`${_source};`
|
|
6639
6640
|
];
|
|
@@ -6653,6 +6654,22 @@ var unpluginFactory = (options) => {
|
|
|
6653
6654
|
configResolved(_config) {
|
|
6654
6655
|
config = _config;
|
|
6655
6656
|
},
|
|
6657
|
+
transformIndexHtml(html) {
|
|
6658
|
+
if (enableChii) {
|
|
6659
|
+
return html.replace(
|
|
6660
|
+
"</body>",
|
|
6661
|
+
`</body>
|
|
6662
|
+
<script>
|
|
6663
|
+
(() => {
|
|
6664
|
+
const script = document.createElement('script');
|
|
6665
|
+
script.src="./__chii_proxy/target.js";
|
|
6666
|
+
document.body.appendChild(script);
|
|
6667
|
+
})()
|
|
6668
|
+
</script>
|
|
6669
|
+
`
|
|
6670
|
+
);
|
|
6671
|
+
}
|
|
6672
|
+
},
|
|
6656
6673
|
async configureServer(server) {
|
|
6657
6674
|
var _a4, _b;
|
|
6658
6675
|
if (!(options == null ? void 0 : options.enable)) {
|
|
@@ -6688,7 +6705,7 @@ var unpluginFactory = (options) => {
|
|
|
6688
6705
|
server.middlewares.use((req, res, next) => {
|
|
6689
6706
|
const cookies = import_cookie.default.parse(req.headers.cookie || "");
|
|
6690
6707
|
for (const [name, value] of Object.entries(cookies)) {
|
|
6691
|
-
if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6708
|
+
if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6692
6709
|
const serializedCookie = import_cookie.default.serialize(name, value, {
|
|
6693
6710
|
httpOnly: false
|
|
6694
6711
|
});
|
|
@@ -6699,6 +6716,51 @@ var unpluginFactory = (options) => {
|
|
|
6699
6716
|
});
|
|
6700
6717
|
}
|
|
6701
6718
|
if (enableChii) {
|
|
6719
|
+
let createProxyMiddleware2 = function() {
|
|
6720
|
+
let proxy = null;
|
|
6721
|
+
const handleUpgrade = (req, socket, head) => {
|
|
6722
|
+
var _a5;
|
|
6723
|
+
if (proxy && ((_a5 = req.url) == null ? void 0 : _a5.startsWith("/__chii_proxy"))) {
|
|
6724
|
+
debug("WS upgrade:", req.url);
|
|
6725
|
+
req.url = req.url.replace("/__chii_proxy", "");
|
|
6726
|
+
proxy.ws(req, socket, head);
|
|
6727
|
+
}
|
|
6728
|
+
};
|
|
6729
|
+
return (resolvedInfo) => {
|
|
6730
|
+
return (req, res, next) => {
|
|
6731
|
+
var _a5;
|
|
6732
|
+
if (!proxy && resolvedInfo.availablePort) {
|
|
6733
|
+
proxy = import_http_proxy.default.createProxyServer({
|
|
6734
|
+
target: `http://localhost:${resolvedInfo.availablePort}`,
|
|
6735
|
+
ws: true
|
|
6736
|
+
// changeOrigin: true, // Consider if you need this
|
|
6737
|
+
});
|
|
6738
|
+
proxy.on("error", (err, req2, res2) => {
|
|
6739
|
+
console.error("Proxy error:", err);
|
|
6740
|
+
if (res2 instanceof import_node_http3.ServerResponse) {
|
|
6741
|
+
if (!res2.headersSent) {
|
|
6742
|
+
res2.writeHead(500, { "Content-Type": "text/plain" });
|
|
6743
|
+
}
|
|
6744
|
+
res2.end(`Proxy error: ${err.message}`);
|
|
6745
|
+
} else if (res2 instanceof import_node_net2.Socket) {
|
|
6746
|
+
res2.destroy();
|
|
6747
|
+
}
|
|
6748
|
+
});
|
|
6749
|
+
if (req.socket.server) {
|
|
6750
|
+
req.socket.server.on("upgrade", handleUpgrade);
|
|
6751
|
+
}
|
|
6752
|
+
}
|
|
6753
|
+
if (proxy && ((_a5 = req.url) == null ? void 0 : _a5.startsWith("/__chii_proxy"))) {
|
|
6754
|
+
debug(req.url);
|
|
6755
|
+
req.url = req.url.replace("/__chii_proxy", "");
|
|
6756
|
+
proxy.web(req, res);
|
|
6757
|
+
} else {
|
|
6758
|
+
next();
|
|
6759
|
+
}
|
|
6760
|
+
};
|
|
6761
|
+
};
|
|
6762
|
+
};
|
|
6763
|
+
var createProxyMiddleware = createProxyMiddleware2;
|
|
6702
6764
|
server.middlewares.use("/__chrome_devtools", async (_req, res) => {
|
|
6703
6765
|
try {
|
|
6704
6766
|
const raw = await fetch(`http://localhost:${resovedInfo.availablePort}/targets`);
|
|
@@ -6717,6 +6779,8 @@ var unpluginFactory = (options) => {
|
|
|
6717
6779
|
res.end();
|
|
6718
6780
|
}
|
|
6719
6781
|
});
|
|
6782
|
+
const proxyMiddleware = createProxyMiddleware2();
|
|
6783
|
+
server.middlewares.use(proxyMiddleware(resovedInfo));
|
|
6720
6784
|
}
|
|
6721
6785
|
server.middlewares.use("/open-dingtalk", (req, res) => {
|
|
6722
6786
|
var _a5;
|
package/dist/nuxt.d.cts
CHANGED
|
@@ -6,6 +6,6 @@ import 'vite-plugin-vconsole';
|
|
|
6
6
|
|
|
7
7
|
interface ModuleOptions extends Options {
|
|
8
8
|
}
|
|
9
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
9
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
10
10
|
|
|
11
11
|
export { type ModuleOptions, _default as default };
|
package/dist/nuxt.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ import 'vite-plugin-vconsole';
|
|
|
6
6
|
|
|
7
7
|
interface ModuleOptions extends Options {
|
|
8
8
|
}
|
|
9
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
9
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
10
10
|
|
|
11
11
|
export { type ModuleOptions, _default as default };
|
package/dist/nuxt.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
vite_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-VQXY6FXR.js";
|
|
4
|
+
import "./chunk-QU7HLXVD.js";
|
|
5
|
+
import "./chunk-ZEHXGFFH.js";
|
|
6
6
|
|
|
7
7
|
// src/nuxt.ts
|
|
8
8
|
import { addVitePlugin, defineNuxtModule } from "@nuxt/kit";
|
package/dist/rollup.cjs
CHANGED
|
@@ -5069,6 +5069,7 @@ var init_multipart_parser = __esm({
|
|
|
5069
5069
|
state = S.HEADER_FIELD;
|
|
5070
5070
|
mark("onHeaderField");
|
|
5071
5071
|
index = 0;
|
|
5072
|
+
// falls through
|
|
5072
5073
|
case S.HEADER_FIELD:
|
|
5073
5074
|
if (c2 === CR) {
|
|
5074
5075
|
clear("onHeaderField");
|
|
@@ -5098,6 +5099,7 @@ var init_multipart_parser = __esm({
|
|
|
5098
5099
|
}
|
|
5099
5100
|
mark("onHeaderValue");
|
|
5100
5101
|
state = S.HEADER_VALUE;
|
|
5102
|
+
// falls through
|
|
5101
5103
|
case S.HEADER_VALUE:
|
|
5102
5104
|
if (c2 === CR) {
|
|
5103
5105
|
dataCallback("onHeaderValue", true);
|
|
@@ -5121,6 +5123,7 @@ var init_multipart_parser = __esm({
|
|
|
5121
5123
|
case S.PART_DATA_START:
|
|
5122
5124
|
state = S.PART_DATA;
|
|
5123
5125
|
mark("onPartData");
|
|
5126
|
+
// falls through
|
|
5124
5127
|
case S.PART_DATA:
|
|
5125
5128
|
previousIndex = index;
|
|
5126
5129
|
if (index === 0) {
|
|
@@ -5216,6 +5219,8 @@ var import_unplugin2 = require("unplugin");
|
|
|
5216
5219
|
// src/index.ts
|
|
5217
5220
|
var import_node_child_process = require("child_process");
|
|
5218
5221
|
var import_node_process = __toESM(require("process"), 1);
|
|
5222
|
+
var import_node_http3 = require("http");
|
|
5223
|
+
var import_node_net2 = require("net");
|
|
5219
5224
|
|
|
5220
5225
|
// node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/index.js
|
|
5221
5226
|
var import_node_http2 = __toESM(require("http"), 1);
|
|
@@ -6513,9 +6518,10 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6513
6518
|
var import_unplugin = require("unplugin");
|
|
6514
6519
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
6515
6520
|
var import_cookie = __toESM(require("cookie"), 1);
|
|
6516
|
-
var
|
|
6521
|
+
var import_z_chii = require("z-chii");
|
|
6517
6522
|
var import_dns2 = __toESM(require("dns2"), 1);
|
|
6518
6523
|
var import_get_port_please = require("get-port-please");
|
|
6524
|
+
var import_http_proxy = __toESM(require("http-proxy"), 1);
|
|
6519
6525
|
var cwd = import_node_process.default.cwd();
|
|
6520
6526
|
var config;
|
|
6521
6527
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
@@ -6615,7 +6621,7 @@ var unpluginFactory = (options) => {
|
|
|
6615
6621
|
var _a4, _b, _c;
|
|
6616
6622
|
if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
|
|
6617
6623
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6618
|
-
(0,
|
|
6624
|
+
(0, import_z_chii.start)({
|
|
6619
6625
|
port: resovedInfo.availablePort
|
|
6620
6626
|
});
|
|
6621
6627
|
debug(`chii server port: ${resovedInfo.availablePort}`);
|
|
@@ -6625,11 +6631,6 @@ var unpluginFactory = (options) => {
|
|
|
6625
6631
|
"/* eslint-disable */;",
|
|
6626
6632
|
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
6627
6633
|
devtools.connect(${((_b = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _b.host) ? `"${options.vueDevtools.host}"` : void 0}, ${((_c = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _c.port) ? `${options.vueDevtools.port}` : void 0});` : "",
|
|
6628
|
-
(options == null ? void 0 : options.enable) && enableChii ? `(() => {
|
|
6629
|
-
const script = document.createElement('script');
|
|
6630
|
-
script.src="http://${(chii == null ? void 0 : chii.host) || "127.0.0.1"}:${resovedInfo.availablePort}/target.js";
|
|
6631
|
-
document.body.appendChild(script);
|
|
6632
|
-
})()` : "",
|
|
6633
6634
|
"/* eslint-enable */",
|
|
6634
6635
|
`${_source};`
|
|
6635
6636
|
];
|
|
@@ -6649,6 +6650,22 @@ var unpluginFactory = (options) => {
|
|
|
6649
6650
|
configResolved(_config) {
|
|
6650
6651
|
config = _config;
|
|
6651
6652
|
},
|
|
6653
|
+
transformIndexHtml(html) {
|
|
6654
|
+
if (enableChii) {
|
|
6655
|
+
return html.replace(
|
|
6656
|
+
"</body>",
|
|
6657
|
+
`</body>
|
|
6658
|
+
<script>
|
|
6659
|
+
(() => {
|
|
6660
|
+
const script = document.createElement('script');
|
|
6661
|
+
script.src="./__chii_proxy/target.js";
|
|
6662
|
+
document.body.appendChild(script);
|
|
6663
|
+
})()
|
|
6664
|
+
</script>
|
|
6665
|
+
`
|
|
6666
|
+
);
|
|
6667
|
+
}
|
|
6668
|
+
},
|
|
6652
6669
|
async configureServer(server) {
|
|
6653
6670
|
var _a4, _b;
|
|
6654
6671
|
if (!(options == null ? void 0 : options.enable)) {
|
|
@@ -6684,7 +6701,7 @@ var unpluginFactory = (options) => {
|
|
|
6684
6701
|
server.middlewares.use((req, res, next) => {
|
|
6685
6702
|
const cookies = import_cookie.default.parse(req.headers.cookie || "");
|
|
6686
6703
|
for (const [name, value] of Object.entries(cookies)) {
|
|
6687
|
-
if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6704
|
+
if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6688
6705
|
const serializedCookie = import_cookie.default.serialize(name, value, {
|
|
6689
6706
|
httpOnly: false
|
|
6690
6707
|
});
|
|
@@ -6695,6 +6712,51 @@ var unpluginFactory = (options) => {
|
|
|
6695
6712
|
});
|
|
6696
6713
|
}
|
|
6697
6714
|
if (enableChii) {
|
|
6715
|
+
let createProxyMiddleware2 = function() {
|
|
6716
|
+
let proxy = null;
|
|
6717
|
+
const handleUpgrade = (req, socket, head) => {
|
|
6718
|
+
var _a5;
|
|
6719
|
+
if (proxy && ((_a5 = req.url) == null ? void 0 : _a5.startsWith("/__chii_proxy"))) {
|
|
6720
|
+
debug("WS upgrade:", req.url);
|
|
6721
|
+
req.url = req.url.replace("/__chii_proxy", "");
|
|
6722
|
+
proxy.ws(req, socket, head);
|
|
6723
|
+
}
|
|
6724
|
+
};
|
|
6725
|
+
return (resolvedInfo) => {
|
|
6726
|
+
return (req, res, next) => {
|
|
6727
|
+
var _a5;
|
|
6728
|
+
if (!proxy && resolvedInfo.availablePort) {
|
|
6729
|
+
proxy = import_http_proxy.default.createProxyServer({
|
|
6730
|
+
target: `http://localhost:${resolvedInfo.availablePort}`,
|
|
6731
|
+
ws: true
|
|
6732
|
+
// changeOrigin: true, // Consider if you need this
|
|
6733
|
+
});
|
|
6734
|
+
proxy.on("error", (err, req2, res2) => {
|
|
6735
|
+
console.error("Proxy error:", err);
|
|
6736
|
+
if (res2 instanceof import_node_http3.ServerResponse) {
|
|
6737
|
+
if (!res2.headersSent) {
|
|
6738
|
+
res2.writeHead(500, { "Content-Type": "text/plain" });
|
|
6739
|
+
}
|
|
6740
|
+
res2.end(`Proxy error: ${err.message}`);
|
|
6741
|
+
} else if (res2 instanceof import_node_net2.Socket) {
|
|
6742
|
+
res2.destroy();
|
|
6743
|
+
}
|
|
6744
|
+
});
|
|
6745
|
+
if (req.socket.server) {
|
|
6746
|
+
req.socket.server.on("upgrade", handleUpgrade);
|
|
6747
|
+
}
|
|
6748
|
+
}
|
|
6749
|
+
if (proxy && ((_a5 = req.url) == null ? void 0 : _a5.startsWith("/__chii_proxy"))) {
|
|
6750
|
+
debug(req.url);
|
|
6751
|
+
req.url = req.url.replace("/__chii_proxy", "");
|
|
6752
|
+
proxy.web(req, res);
|
|
6753
|
+
} else {
|
|
6754
|
+
next();
|
|
6755
|
+
}
|
|
6756
|
+
};
|
|
6757
|
+
};
|
|
6758
|
+
};
|
|
6759
|
+
var createProxyMiddleware = createProxyMiddleware2;
|
|
6698
6760
|
server.middlewares.use("/__chrome_devtools", async (_req, res) => {
|
|
6699
6761
|
try {
|
|
6700
6762
|
const raw = await fetch(`http://localhost:${resovedInfo.availablePort}/targets`);
|
|
@@ -6713,6 +6775,8 @@ var unpluginFactory = (options) => {
|
|
|
6713
6775
|
res.end();
|
|
6714
6776
|
}
|
|
6715
6777
|
});
|
|
6778
|
+
const proxyMiddleware = createProxyMiddleware2();
|
|
6779
|
+
server.middlewares.use(proxyMiddleware(resovedInfo));
|
|
6716
6780
|
}
|
|
6717
6781
|
server.middlewares.use("/open-dingtalk", (req, res) => {
|
|
6718
6782
|
var _a5;
|