unplugin-dingtalk 0.4.2 → 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 +157 -26
- package/dist/astro.js +4 -4
- package/dist/{chunk-RDTWBIQD.js → chunk-QU7HLXVD.js} +172 -42
- package/dist/{chunk-2OB7UBRW.js → chunk-VQXY6FXR.js} +1 -1
- package/dist/{chunk-PMOTCIQR.js → chunk-ZEHXGFFH.js} +3 -3
- package/dist/esbuild.cjs +155 -24
- package/dist/esbuild.js +2 -2
- package/dist/index.cjs +164 -29
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +8 -4
- package/dist/{multipart-parser-HI4LNJC5.js → multipart-parser-VO5TIRQZ.js} +4 -1
- package/dist/nuxt.cjs +155 -24
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +3 -3
- package/dist/rollup.cjs +155 -24
- package/dist/rollup.js +2 -2
- package/dist/rspack.cjs +167 -45
- package/dist/rspack.d.cts +1 -2
- package/dist/rspack.d.ts +1 -2
- package/dist/rspack.js +10 -18
- package/dist/types.d.cts +13 -2
- package/dist/types.d.ts +13 -2
- package/dist/vite.cjs +155 -24
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +167 -45
- package/dist/webpack.js +10 -18
- package/package.json +8 -5
package/dist/webpack.cjs
CHANGED
|
@@ -4389,15 +4389,15 @@ var require_streams = __commonJS({
|
|
|
4389
4389
|
var POOL_SIZE2 = 65536;
|
|
4390
4390
|
if (!globalThis.ReadableStream) {
|
|
4391
4391
|
try {
|
|
4392
|
-
const
|
|
4393
|
-
const { emitWarning } =
|
|
4392
|
+
const process3 = require("process");
|
|
4393
|
+
const { emitWarning } = process3;
|
|
4394
4394
|
try {
|
|
4395
|
-
|
|
4395
|
+
process3.emitWarning = () => {
|
|
4396
4396
|
};
|
|
4397
4397
|
Object.assign(globalThis, require("stream/web"));
|
|
4398
|
-
|
|
4398
|
+
process3.emitWarning = emitWarning;
|
|
4399
4399
|
} catch (error) {
|
|
4400
|
-
|
|
4400
|
+
process3.emitWarning = emitWarning;
|
|
4401
4401
|
throw error;
|
|
4402
4402
|
}
|
|
4403
4403
|
} catch (error) {
|
|
@@ -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 (c3 === 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 (c3 === 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) {
|
|
@@ -5211,8 +5214,6 @@ __export(webpack_exports, {
|
|
|
5211
5214
|
default: () => webpack_default
|
|
5212
5215
|
});
|
|
5213
5216
|
module.exports = __toCommonJS(webpack_exports);
|
|
5214
|
-
var import_node_child_process2 = require("child_process");
|
|
5215
|
-
var import_node_process2 = __toESM(require("process"), 1);
|
|
5216
5217
|
var import_unplugin2 = require("unplugin");
|
|
5217
5218
|
var import_cookie2 = __toESM(require("cookie"), 1);
|
|
5218
5219
|
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
@@ -6512,23 +6513,99 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6512
6513
|
// src/index.ts
|
|
6513
6514
|
var import_node_child_process = require("child_process");
|
|
6514
6515
|
var import_node_process = __toESM(require("process"), 1);
|
|
6516
|
+
var import_node_http3 = require("http");
|
|
6517
|
+
var import_node_net2 = require("net");
|
|
6515
6518
|
var import_unplugin = require("unplugin");
|
|
6516
6519
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
6517
6520
|
var import_cookie = __toESM(require("cookie"), 1);
|
|
6518
|
-
var
|
|
6521
|
+
var import_z_chii = require("z-chii");
|
|
6522
|
+
var import_dns2 = __toESM(require("dns2"), 1);
|
|
6519
6523
|
var import_get_port_please = require("get-port-please");
|
|
6524
|
+
var import_http_proxy = __toESM(require("http-proxy"), 1);
|
|
6520
6525
|
var cwd = import_node_process.default.cwd();
|
|
6521
6526
|
var config;
|
|
6522
6527
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
6523
6528
|
var resovedInfo = {
|
|
6524
6529
|
devtoolsInstance: void 0,
|
|
6530
|
+
dnsServerInstence: void 0,
|
|
6525
6531
|
availablePort: void 0,
|
|
6526
6532
|
targetURL: void 0
|
|
6527
6533
|
};
|
|
6534
|
+
function startVueDevtools(enable) {
|
|
6535
|
+
if (enable && !resovedInfo.devtoolsInstance) {
|
|
6536
|
+
resovedInfo.devtoolsInstance = (0, import_node_child_process.exec)("npx vue-devtools");
|
|
6537
|
+
console.log(` ${import_picocolors.default.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
|
|
6538
|
+
resovedInfo.devtoolsInstance.on("exit", () => {
|
|
6539
|
+
resovedInfo.devtoolsInstance = void 0;
|
|
6540
|
+
});
|
|
6541
|
+
import_node_process.default.on("exit", () => {
|
|
6542
|
+
if (resovedInfo.devtoolsInstance) {
|
|
6543
|
+
resovedInfo.devtoolsInstance.kill();
|
|
6544
|
+
}
|
|
6545
|
+
});
|
|
6546
|
+
}
|
|
6547
|
+
}
|
|
6548
|
+
function startDnsServer(options) {
|
|
6549
|
+
function debug(...args) {
|
|
6550
|
+
if (options == null ? void 0 : options.debug) {
|
|
6551
|
+
console.log(` ${import_picocolors.default.yellow("DEBUG")} `, ...args);
|
|
6552
|
+
}
|
|
6553
|
+
}
|
|
6554
|
+
if ((options == null ? void 0 : options.enable) && (options == null ? void 0 : options.dns) && !resovedInfo.dnsServerInstence) {
|
|
6555
|
+
const { Packet } = import_dns2.default;
|
|
6556
|
+
resovedInfo.dnsServerInstence = import_dns2.default.createServer({
|
|
6557
|
+
tcp: true,
|
|
6558
|
+
udp: true,
|
|
6559
|
+
handle: (request, send, rinfo) => {
|
|
6560
|
+
var _a4;
|
|
6561
|
+
const response = Packet.createResponseFromRequest(request);
|
|
6562
|
+
const [question] = request.questions;
|
|
6563
|
+
const { name } = question;
|
|
6564
|
+
if (name === options.dns.host) {
|
|
6565
|
+
response.answers.push({
|
|
6566
|
+
name,
|
|
6567
|
+
type: Packet.TYPE.A,
|
|
6568
|
+
class: Packet.CLASS.IN,
|
|
6569
|
+
ttl: 300,
|
|
6570
|
+
address: (_a4 = options.dns) == null ? void 0 : _a4.ip
|
|
6571
|
+
});
|
|
6572
|
+
debug(`dns request from ${rinfo.address}:${rinfo.port} for ${name} => ${options.dns.ip}`);
|
|
6573
|
+
}
|
|
6574
|
+
send(response);
|
|
6575
|
+
}
|
|
6576
|
+
});
|
|
6577
|
+
resovedInfo.dnsServerInstence.listen({
|
|
6578
|
+
udp: { address: "0.0.0.0", port: 53 },
|
|
6579
|
+
tcp: { address: "0.0.0.0", port: 53 }
|
|
6580
|
+
}).then(() => {
|
|
6581
|
+
debug("DNS server is running.");
|
|
6582
|
+
const dns = new import_dns2.default({
|
|
6583
|
+
port: 53,
|
|
6584
|
+
nameServers: ["127.0.0.1", "8.8.8.8"]
|
|
6585
|
+
});
|
|
6586
|
+
dns.resolveA(options.dns.host).then((addresses) => {
|
|
6587
|
+
var _a4;
|
|
6588
|
+
if (((_a4 = addresses.answers[0]) == null ? void 0 : _a4.address) === options.dns.ip) {
|
|
6589
|
+
startDnsServer(options);
|
|
6590
|
+
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(`DNS server is started, please modify the DNS of the remote device to ${options.dns.ip}`)}`);
|
|
6591
|
+
} else {
|
|
6592
|
+
debug(addresses.answers[0].address);
|
|
6593
|
+
throw new Error("DNS server started failed");
|
|
6594
|
+
}
|
|
6595
|
+
}).catch((e2) => {
|
|
6596
|
+
throw e2;
|
|
6597
|
+
});
|
|
6598
|
+
}).catch((e2) => {
|
|
6599
|
+
debug(e2);
|
|
6600
|
+
console.log(` ${import_picocolors.default.red("\u279C")} ${import_picocolors.default.bold((e2 == null ? void 0 : e2.message) || e2)}`);
|
|
6601
|
+
});
|
|
6602
|
+
}
|
|
6603
|
+
}
|
|
6528
6604
|
var unpluginFactory = (options) => {
|
|
6529
6605
|
const {
|
|
6530
|
-
chii
|
|
6606
|
+
chii
|
|
6531
6607
|
} = options || {};
|
|
6608
|
+
const enableChii = (chii == null ? void 0 : chii.enable) !== false;
|
|
6532
6609
|
function debug(...args) {
|
|
6533
6610
|
if (options == null ? void 0 : options.debug) {
|
|
6534
6611
|
console.log(` ${import_picocolors.default.yellow("DEBUG")} `, ...args);
|
|
@@ -6544,22 +6621,16 @@ var unpluginFactory = (options) => {
|
|
|
6544
6621
|
var _a4, _b, _c;
|
|
6545
6622
|
if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
|
|
6546
6623
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6547
|
-
|
|
6548
|
-
(0, import_chii.start)({
|
|
6549
|
-
host: "0.0.0.0",
|
|
6624
|
+
(0, import_z_chii.start)({
|
|
6550
6625
|
port: resovedInfo.availablePort
|
|
6551
6626
|
});
|
|
6627
|
+
debug(`chii server port: ${resovedInfo.availablePort}`);
|
|
6552
6628
|
}
|
|
6553
6629
|
if (options == null ? void 0 : options.enable) {
|
|
6554
6630
|
const codes = [
|
|
6555
6631
|
"/* eslint-disable */;",
|
|
6556
6632
|
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
6557
|
-
devtools.connect(${(_b = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _b.host}, ${(_c = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _c.port});` : "",
|
|
6558
|
-
(options == null ? void 0 : options.enable) && enableChii ? `(() => {
|
|
6559
|
-
const script = document.createElement('script');
|
|
6560
|
-
script.src="http://localhost:${resovedInfo.availablePort}/target.js";
|
|
6561
|
-
document.body.appendChild(script);
|
|
6562
|
-
})()` : "",
|
|
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});` : "",
|
|
6563
6634
|
"/* eslint-enable */",
|
|
6564
6635
|
`${_source};`
|
|
6565
6636
|
];
|
|
@@ -6579,6 +6650,22 @@ var unpluginFactory = (options) => {
|
|
|
6579
6650
|
configResolved(_config) {
|
|
6580
6651
|
config = _config;
|
|
6581
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
|
+
},
|
|
6582
6669
|
async configureServer(server) {
|
|
6583
6670
|
var _a4, _b;
|
|
6584
6671
|
if (!(options == null ? void 0 : options.enable)) {
|
|
@@ -6614,7 +6701,7 @@ var unpluginFactory = (options) => {
|
|
|
6614
6701
|
server.middlewares.use((req, res, next) => {
|
|
6615
6702
|
const cookies = import_cookie.default.parse(req.headers.cookie || "");
|
|
6616
6703
|
for (const [name, value] of Object.entries(cookies)) {
|
|
6617
|
-
if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6704
|
+
if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6618
6705
|
const serializedCookie = import_cookie.default.serialize(name, value, {
|
|
6619
6706
|
httpOnly: false
|
|
6620
6707
|
});
|
|
@@ -6625,6 +6712,51 @@ var unpluginFactory = (options) => {
|
|
|
6625
6712
|
});
|
|
6626
6713
|
}
|
|
6627
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;
|
|
6628
6760
|
server.middlewares.use("/__chrome_devtools", async (_req, res) => {
|
|
6629
6761
|
try {
|
|
6630
6762
|
const raw = await fetch(`http://localhost:${resovedInfo.availablePort}/targets`);
|
|
@@ -6633,6 +6765,9 @@ var unpluginFactory = (options) => {
|
|
|
6633
6765
|
const devToolsUrl = `http://localhost:${resovedInfo.availablePort}/front_end/chii_app.html?ws=localhost:${resovedInfo.availablePort}/client/${Math.random().toString(20).substring(2, 8)}?target=${data.targets[0].id}&rtc=false`;
|
|
6634
6766
|
res.writeHead(302, { Location: devToolsUrl });
|
|
6635
6767
|
res.end();
|
|
6768
|
+
} else {
|
|
6769
|
+
res.writeHead(404);
|
|
6770
|
+
res.end();
|
|
6636
6771
|
}
|
|
6637
6772
|
} catch (error) {
|
|
6638
6773
|
debug(`${error}`);
|
|
@@ -6640,6 +6775,8 @@ var unpluginFactory = (options) => {
|
|
|
6640
6775
|
res.end();
|
|
6641
6776
|
}
|
|
6642
6777
|
});
|
|
6778
|
+
const proxyMiddleware = createProxyMiddleware2();
|
|
6779
|
+
server.middlewares.use(proxyMiddleware(resovedInfo));
|
|
6643
6780
|
}
|
|
6644
6781
|
server.middlewares.use("/open-dingtalk", (req, res) => {
|
|
6645
6782
|
var _a5;
|
|
@@ -6647,20 +6784,10 @@ var unpluginFactory = (options) => {
|
|
|
6647
6784
|
res.writeHead(302, {
|
|
6648
6785
|
Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
|
|
6649
6786
|
});
|
|
6650
|
-
|
|
6651
|
-
resovedInfo.devtoolsInstance = (0, import_node_child_process.exec)("npx vue-devtools");
|
|
6652
|
-
console.log(` ${import_picocolors.default.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
|
|
6653
|
-
resovedInfo.devtoolsInstance.on("exit", () => {
|
|
6654
|
-
resovedInfo.devtoolsInstance = void 0;
|
|
6655
|
-
});
|
|
6656
|
-
import_node_process.default.on("exit", () => {
|
|
6657
|
-
if (resovedInfo.devtoolsInstance) {
|
|
6658
|
-
resovedInfo.devtoolsInstance.kill();
|
|
6659
|
-
}
|
|
6660
|
-
});
|
|
6661
|
-
}
|
|
6787
|
+
startVueDevtools((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable);
|
|
6662
6788
|
res.end();
|
|
6663
6789
|
});
|
|
6790
|
+
startDnsServer(options);
|
|
6664
6791
|
}
|
|
6665
6792
|
},
|
|
6666
6793
|
webpack(compiler) {
|
|
@@ -6691,6 +6818,7 @@ var unpluginFactory = (options) => {
|
|
|
6691
6818
|
if (options == null ? void 0 : options.corpId) {
|
|
6692
6819
|
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6693
6820
|
}
|
|
6821
|
+
startDnsServer(options);
|
|
6694
6822
|
},
|
|
6695
6823
|
async rspack(compiler) {
|
|
6696
6824
|
var _a4, _b, _c, _d2, _e;
|
|
@@ -6719,6 +6847,7 @@ var unpluginFactory = (options) => {
|
|
|
6719
6847
|
"Click to open chrome devtools"
|
|
6720
6848
|
)}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
|
|
6721
6849
|
}
|
|
6850
|
+
startDnsServer(options);
|
|
6722
6851
|
}
|
|
6723
6852
|
};
|
|
6724
6853
|
return unpluginDing;
|
|
@@ -6732,14 +6861,15 @@ var webpack_default = (options) => {
|
|
|
6732
6861
|
}
|
|
6733
6862
|
}
|
|
6734
6863
|
const {
|
|
6735
|
-
chii
|
|
6864
|
+
chii
|
|
6736
6865
|
} = options || {};
|
|
6866
|
+
const enableChii = (chii == null ? void 0 : chii.enable) !== false;
|
|
6737
6867
|
const injectSetupMiddlewares = (middlewares, devServer) => {
|
|
6738
6868
|
if (options.debugCookies && options.debugCookies.length > 0) {
|
|
6739
6869
|
devServer.app.use((req, res, next) => {
|
|
6740
6870
|
const cookies = import_cookie2.default.parse(req.headers.cookie || "");
|
|
6741
6871
|
for (const [name, value] of Object.entries(cookies)) {
|
|
6742
|
-
if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6872
|
+
if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
6743
6873
|
const serializedCookie = import_cookie2.default.serialize(name, value, {
|
|
6744
6874
|
httpOnly: false
|
|
6745
6875
|
});
|
|
@@ -6759,6 +6889,9 @@ var webpack_default = (options) => {
|
|
|
6759
6889
|
const devToolsUrl = `http://localhost:${availablePort}/front_end/chii_app.html?ws=localhost:${availablePort}/client/${Math.random().toString(20).substring(2, 8)}?target=${data.targets[0].id}&rtc=false`;
|
|
6760
6890
|
res.writeHead(302, { Location: devToolsUrl });
|
|
6761
6891
|
res.end();
|
|
6892
|
+
} else {
|
|
6893
|
+
res.writeHead(404);
|
|
6894
|
+
res.end();
|
|
6762
6895
|
}
|
|
6763
6896
|
} catch (error) {
|
|
6764
6897
|
debug(`${error}`);
|
|
@@ -6774,18 +6907,7 @@ var webpack_default = (options) => {
|
|
|
6774
6907
|
res.writeHead(302, {
|
|
6775
6908
|
Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
|
|
6776
6909
|
});
|
|
6777
|
-
|
|
6778
|
-
resovedInfo.devtoolsInstance = (0, import_node_child_process2.exec)("npx vue-devtools");
|
|
6779
|
-
console.log(` ${import_picocolors2.default.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
|
|
6780
|
-
resovedInfo.devtoolsInstance.on("exit", () => {
|
|
6781
|
-
resovedInfo.devtoolsInstance = void 0;
|
|
6782
|
-
});
|
|
6783
|
-
import_node_process2.default.on("exit", () => {
|
|
6784
|
-
if (resovedInfo.devtoolsInstance) {
|
|
6785
|
-
resovedInfo.devtoolsInstance.kill();
|
|
6786
|
-
}
|
|
6787
|
-
});
|
|
6788
|
-
}
|
|
6910
|
+
startVueDevtools((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable);
|
|
6789
6911
|
res.end();
|
|
6790
6912
|
});
|
|
6791
6913
|
return middlewares;
|
package/dist/webpack.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetch,
|
|
3
3
|
resovedInfo,
|
|
4
|
+
startVueDevtools,
|
|
4
5
|
unpluginFactory
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-QU7HLXVD.js";
|
|
7
|
+
import "./chunk-ZEHXGFFH.js";
|
|
7
8
|
|
|
8
9
|
// src/webpack.ts
|
|
9
|
-
import { exec } from "child_process";
|
|
10
|
-
import process from "process";
|
|
11
10
|
import { createWebpackPlugin } from "unplugin";
|
|
12
11
|
import cookie from "cookie";
|
|
13
12
|
import c from "picocolors";
|
|
@@ -18,14 +17,15 @@ var webpack_default = (options) => {
|
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
const {
|
|
21
|
-
chii
|
|
20
|
+
chii
|
|
22
21
|
} = options || {};
|
|
22
|
+
const enableChii = (chii == null ? void 0 : chii.enable) !== false;
|
|
23
23
|
const injectSetupMiddlewares = (middlewares, devServer) => {
|
|
24
24
|
if (options.debugCookies && options.debugCookies.length > 0) {
|
|
25
25
|
devServer.app.use((req, res, next) => {
|
|
26
26
|
const cookies = cookie.parse(req.headers.cookie || "");
|
|
27
27
|
for (const [name, value] of Object.entries(cookies)) {
|
|
28
|
-
if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
28
|
+
if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
29
29
|
const serializedCookie = cookie.serialize(name, value, {
|
|
30
30
|
httpOnly: false
|
|
31
31
|
});
|
|
@@ -45,6 +45,9 @@ var webpack_default = (options) => {
|
|
|
45
45
|
const devToolsUrl = `http://localhost:${availablePort}/front_end/chii_app.html?ws=localhost:${availablePort}/client/${Math.random().toString(20).substring(2, 8)}?target=${data.targets[0].id}&rtc=false`;
|
|
46
46
|
res.writeHead(302, { Location: devToolsUrl });
|
|
47
47
|
res.end();
|
|
48
|
+
} else {
|
|
49
|
+
res.writeHead(404);
|
|
50
|
+
res.end();
|
|
48
51
|
}
|
|
49
52
|
} catch (error) {
|
|
50
53
|
debug(`${error}`);
|
|
@@ -60,18 +63,7 @@ var webpack_default = (options) => {
|
|
|
60
63
|
res.writeHead(302, {
|
|
61
64
|
Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
|
|
62
65
|
});
|
|
63
|
-
|
|
64
|
-
resovedInfo.devtoolsInstance = exec("npx vue-devtools");
|
|
65
|
-
console.log(` ${c.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
|
|
66
|
-
resovedInfo.devtoolsInstance.on("exit", () => {
|
|
67
|
-
resovedInfo.devtoolsInstance = void 0;
|
|
68
|
-
});
|
|
69
|
-
process.on("exit", () => {
|
|
70
|
-
if (resovedInfo.devtoolsInstance) {
|
|
71
|
-
resovedInfo.devtoolsInstance.kill();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
66
|
+
startVueDevtools((_a = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a.enable);
|
|
75
67
|
res.end();
|
|
76
68
|
});
|
|
77
69
|
return middlewares;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-dingtalk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/zcf0508/unplugin-dingtalk#readme",
|
|
@@ -123,17 +123,20 @@
|
|
|
123
123
|
},
|
|
124
124
|
"dependencies": {
|
|
125
125
|
"@antfu/eslint-config": "^2.18.1",
|
|
126
|
-
"
|
|
127
|
-
"
|
|
126
|
+
"cookie": "^1.0.2",
|
|
127
|
+
"dns2": "^2.1.0",
|
|
128
128
|
"eslint-plugin-security": "^3.0.0",
|
|
129
129
|
"get-port-please": "^3.1.2",
|
|
130
|
+
"http-proxy": "^1.18.1",
|
|
130
131
|
"picocolors": "^1.0.1",
|
|
131
132
|
"unplugin": "^1.5.1",
|
|
132
|
-
"vite-plugin-vconsole": "^2.1.1"
|
|
133
|
+
"vite-plugin-vconsole": "^2.1.1",
|
|
134
|
+
"z-chii": "1.15.5-beta.1"
|
|
133
135
|
},
|
|
134
136
|
"devDependencies": {
|
|
135
137
|
"@nuxt/kit": "^3.8.2",
|
|
136
138
|
"@nuxt/schema": "^3.8.2",
|
|
139
|
+
"@types/dns2": "^2.0.9",
|
|
137
140
|
"@types/node": "^20.10.3",
|
|
138
141
|
"bumpp": "^9.2.0",
|
|
139
142
|
"chalk": "^5.3.0",
|
|
@@ -146,7 +149,7 @@
|
|
|
146
149
|
"rollup": "^4.6.1",
|
|
147
150
|
"tsup": "^8.0.1",
|
|
148
151
|
"vite": "^5.0.4",
|
|
149
|
-
"vitest": "^
|
|
152
|
+
"vitest": "^1.6.0",
|
|
150
153
|
"webpack": "^5.89.0",
|
|
151
154
|
"webpack-dev-server": "^5.0.4"
|
|
152
155
|
},
|