unplugin-dingtalk 0.5.3 → 1000.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astro.cjs +5 -40
- package/dist/astro.js +1 -1
- package/dist/{chunk-FWMGAYMG.js → chunk-W5UIO4ZZ.js} +5 -41
- package/dist/{chunk-DTGQTH5S.js → chunk-WE6LHUBA.js} +1 -1
- package/dist/esbuild.cjs +5 -40
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +5 -42
- package/dist/index.d.cts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.js +1 -3
- package/dist/nuxt.cjs +5 -40
- package/dist/nuxt.js +2 -2
- package/dist/rollup.cjs +5 -40
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +5 -42
- package/dist/rspack.js +1 -4
- package/dist/types.d.cts +0 -7
- package/dist/types.d.ts +0 -7
- package/dist/vite.cjs +5 -40
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +5 -42
- package/dist/webpack.js +1 -4
- package/package.json +2 -6
package/dist/astro.cjs
CHANGED
|
@@ -5216,7 +5216,6 @@ __export(astro_exports, {
|
|
|
5216
5216
|
module.exports = __toCommonJS(astro_exports);
|
|
5217
5217
|
|
|
5218
5218
|
// src/index.ts
|
|
5219
|
-
var import_node_child_process = require("child_process");
|
|
5220
5219
|
var import_node_process = __toESM(require("process"), 1);
|
|
5221
5220
|
var import_node_http3 = require("http");
|
|
5222
5221
|
var import_node_net2 = require("net");
|
|
@@ -6525,25 +6524,10 @@ var cwd = import_node_process.default.cwd();
|
|
|
6525
6524
|
var config;
|
|
6526
6525
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
6527
6526
|
var resovedInfo = {
|
|
6528
|
-
devtoolsInstance: void 0,
|
|
6529
6527
|
dnsServerInstence: void 0,
|
|
6530
6528
|
availablePort: void 0,
|
|
6531
6529
|
targetURL: void 0
|
|
6532
6530
|
};
|
|
6533
|
-
function startVueDevtools(enable) {
|
|
6534
|
-
if (enable && !resovedInfo.devtoolsInstance) {
|
|
6535
|
-
resovedInfo.devtoolsInstance = (0, import_node_child_process.exec)("npx vue-devtools");
|
|
6536
|
-
console.log(` ${import_picocolors.default.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
|
|
6537
|
-
resovedInfo.devtoolsInstance.on("exit", () => {
|
|
6538
|
-
resovedInfo.devtoolsInstance = void 0;
|
|
6539
|
-
});
|
|
6540
|
-
import_node_process.default.on("exit", () => {
|
|
6541
|
-
if (resovedInfo.devtoolsInstance) {
|
|
6542
|
-
resovedInfo.devtoolsInstance.kill();
|
|
6543
|
-
}
|
|
6544
|
-
});
|
|
6545
|
-
}
|
|
6546
|
-
}
|
|
6547
6531
|
function startDnsServer(options) {
|
|
6548
6532
|
function debug(...args) {
|
|
6549
6533
|
if (options == null ? void 0 : options.debug) {
|
|
@@ -6617,7 +6601,6 @@ var unpluginFactory = (options) => {
|
|
|
6617
6601
|
return (id.endsWith("main.ts") || id.endsWith("main.js")) && !id.includes("node_modules");
|
|
6618
6602
|
},
|
|
6619
6603
|
async transform(_source) {
|
|
6620
|
-
var _a4, _b, _c;
|
|
6621
6604
|
if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
|
|
6622
6605
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6623
6606
|
(0, import_z_chii.start)({
|
|
@@ -6625,20 +6608,6 @@ var unpluginFactory = (options) => {
|
|
|
6625
6608
|
});
|
|
6626
6609
|
debug(`chii server port: ${resovedInfo.availablePort}`);
|
|
6627
6610
|
}
|
|
6628
|
-
if (options == null ? void 0 : options.enable) {
|
|
6629
|
-
const codes = [
|
|
6630
|
-
"/* eslint-disable */;",
|
|
6631
|
-
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
6632
|
-
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});` : "",
|
|
6633
|
-
"/* eslint-enable */",
|
|
6634
|
-
`${_source};`
|
|
6635
|
-
];
|
|
6636
|
-
return {
|
|
6637
|
-
code: codes.join("\n"),
|
|
6638
|
-
map: null
|
|
6639
|
-
// support source map
|
|
6640
|
-
};
|
|
6641
|
-
}
|
|
6642
6611
|
return {
|
|
6643
6612
|
code: _source,
|
|
6644
6613
|
map: null
|
|
@@ -6650,7 +6619,7 @@ var unpluginFactory = (options) => {
|
|
|
6650
6619
|
config = _config;
|
|
6651
6620
|
},
|
|
6652
6621
|
transformIndexHtml(html) {
|
|
6653
|
-
if (enableChii) {
|
|
6622
|
+
if ((options == null ? void 0 : options.enable) && enableChii) {
|
|
6654
6623
|
return html.replace(
|
|
6655
6624
|
"</body>",
|
|
6656
6625
|
`</body>
|
|
@@ -6680,10 +6649,9 @@ var unpluginFactory = (options) => {
|
|
|
6680
6649
|
const base = server.config.base || "/";
|
|
6681
6650
|
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
6682
6651
|
server.printUrls = () => {
|
|
6683
|
-
var _a5;
|
|
6684
6652
|
_printUrls();
|
|
6685
6653
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6686
|
-
|
|
6654
|
+
"Open in dingtalk"
|
|
6687
6655
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6688
6656
|
if (enableChii) {
|
|
6689
6657
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
@@ -6778,12 +6746,10 @@ var unpluginFactory = (options) => {
|
|
|
6778
6746
|
server.middlewares.use(proxyMiddleware(resovedInfo));
|
|
6779
6747
|
}
|
|
6780
6748
|
server.middlewares.use("/open-dingtalk", (req, res) => {
|
|
6781
|
-
var _a5;
|
|
6782
6749
|
debug(targetURL.toString());
|
|
6783
6750
|
res.writeHead(302, {
|
|
6784
6751
|
Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
|
|
6785
6752
|
});
|
|
6786
|
-
startVueDevtools((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable);
|
|
6787
6753
|
res.end();
|
|
6788
6754
|
});
|
|
6789
6755
|
startDnsServer(options);
|
|
@@ -6802,9 +6768,8 @@ var unpluginFactory = (options) => {
|
|
|
6802
6768
|
const base = compiler.options.output.publicPath || "/";
|
|
6803
6769
|
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
6804
6770
|
compiler.hooks.done.tap("unplugin-dingtalk", () => {
|
|
6805
|
-
var _a5;
|
|
6806
6771
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6807
|
-
|
|
6772
|
+
"Open in dingtalk"
|
|
6808
6773
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6809
6774
|
if (enableChii) {
|
|
6810
6775
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
@@ -6820,7 +6785,7 @@ var unpluginFactory = (options) => {
|
|
|
6820
6785
|
startDnsServer(options);
|
|
6821
6786
|
},
|
|
6822
6787
|
async rspack(compiler) {
|
|
6823
|
-
var _a4, _b, _c, _d2
|
|
6788
|
+
var _a4, _b, _c, _d2;
|
|
6824
6789
|
if (!(options == null ? void 0 : options.enable)) {
|
|
6825
6790
|
return;
|
|
6826
6791
|
}
|
|
@@ -6839,7 +6804,7 @@ var unpluginFactory = (options) => {
|
|
|
6839
6804
|
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6840
6805
|
}
|
|
6841
6806
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6842
|
-
|
|
6807
|
+
"Open in dingtalk"
|
|
6843
6808
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6844
6809
|
if (enableChii) {
|
|
6845
6810
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
package/dist/astro.js
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from "./chunk-ZEHXGFFH.js";
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
|
-
import { exec } from "node:child_process";
|
|
12
11
|
import process2 from "node:process";
|
|
13
12
|
import { ServerResponse } from "node:http";
|
|
14
13
|
import { Socket } from "node:net";
|
|
@@ -1313,25 +1312,10 @@ var cwd = process2.cwd();
|
|
|
1313
1312
|
var config;
|
|
1314
1313
|
var colorUrl = (url) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`));
|
|
1315
1314
|
var resovedInfo = {
|
|
1316
|
-
devtoolsInstance: void 0,
|
|
1317
1315
|
dnsServerInstence: void 0,
|
|
1318
1316
|
availablePort: void 0,
|
|
1319
1317
|
targetURL: void 0
|
|
1320
1318
|
};
|
|
1321
|
-
function startVueDevtools(enable) {
|
|
1322
|
-
if (enable && !resovedInfo.devtoolsInstance) {
|
|
1323
|
-
resovedInfo.devtoolsInstance = exec("npx vue-devtools");
|
|
1324
|
-
console.log(` ${c.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
|
|
1325
|
-
resovedInfo.devtoolsInstance.on("exit", () => {
|
|
1326
|
-
resovedInfo.devtoolsInstance = void 0;
|
|
1327
|
-
});
|
|
1328
|
-
process2.on("exit", () => {
|
|
1329
|
-
if (resovedInfo.devtoolsInstance) {
|
|
1330
|
-
resovedInfo.devtoolsInstance.kill();
|
|
1331
|
-
}
|
|
1332
|
-
});
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
1319
|
function startDnsServer(options) {
|
|
1336
1320
|
function debug(...args) {
|
|
1337
1321
|
if (options == null ? void 0 : options.debug) {
|
|
@@ -1405,7 +1389,6 @@ var unpluginFactory = (options) => {
|
|
|
1405
1389
|
return (id.endsWith("main.ts") || id.endsWith("main.js")) && !id.includes("node_modules");
|
|
1406
1390
|
},
|
|
1407
1391
|
async transform(_source) {
|
|
1408
|
-
var _a, _b, _c;
|
|
1409
1392
|
if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
|
|
1410
1393
|
resovedInfo.availablePort = await getRandomPort();
|
|
1411
1394
|
start({
|
|
@@ -1413,20 +1396,6 @@ var unpluginFactory = (options) => {
|
|
|
1413
1396
|
});
|
|
1414
1397
|
debug(`chii server port: ${resovedInfo.availablePort}`);
|
|
1415
1398
|
}
|
|
1416
|
-
if (options == null ? void 0 : options.enable) {
|
|
1417
|
-
const codes = [
|
|
1418
|
-
"/* eslint-disable */;",
|
|
1419
|
-
((_a = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a.enable) ? `import { devtools } from '@vue/devtools'
|
|
1420
|
-
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});` : "",
|
|
1421
|
-
"/* eslint-enable */",
|
|
1422
|
-
`${_source};`
|
|
1423
|
-
];
|
|
1424
|
-
return {
|
|
1425
|
-
code: codes.join("\n"),
|
|
1426
|
-
map: null
|
|
1427
|
-
// support source map
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
1399
|
return {
|
|
1431
1400
|
code: _source,
|
|
1432
1401
|
map: null
|
|
@@ -1438,7 +1407,7 @@ var unpluginFactory = (options) => {
|
|
|
1438
1407
|
config = _config;
|
|
1439
1408
|
},
|
|
1440
1409
|
transformIndexHtml(html) {
|
|
1441
|
-
if (enableChii) {
|
|
1410
|
+
if ((options == null ? void 0 : options.enable) && enableChii) {
|
|
1442
1411
|
return html.replace(
|
|
1443
1412
|
"</body>",
|
|
1444
1413
|
`</body>
|
|
@@ -1468,10 +1437,9 @@ var unpluginFactory = (options) => {
|
|
|
1468
1437
|
const base = server.config.base || "/";
|
|
1469
1438
|
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
1470
1439
|
server.printUrls = () => {
|
|
1471
|
-
var _a2;
|
|
1472
1440
|
_printUrls();
|
|
1473
1441
|
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
1474
|
-
|
|
1442
|
+
"Open in dingtalk"
|
|
1475
1443
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
1476
1444
|
if (enableChii) {
|
|
1477
1445
|
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
@@ -1566,12 +1534,10 @@ var unpluginFactory = (options) => {
|
|
|
1566
1534
|
server.middlewares.use(proxyMiddleware(resovedInfo));
|
|
1567
1535
|
}
|
|
1568
1536
|
server.middlewares.use("/open-dingtalk", (req, res) => {
|
|
1569
|
-
var _a2;
|
|
1570
1537
|
debug(targetURL.toString());
|
|
1571
1538
|
res.writeHead(302, {
|
|
1572
1539
|
Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
|
|
1573
1540
|
});
|
|
1574
|
-
startVueDevtools((_a2 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a2.enable);
|
|
1575
1541
|
res.end();
|
|
1576
1542
|
});
|
|
1577
1543
|
startDnsServer(options);
|
|
@@ -1590,9 +1556,8 @@ var unpluginFactory = (options) => {
|
|
|
1590
1556
|
const base = compiler.options.output.publicPath || "/";
|
|
1591
1557
|
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
1592
1558
|
compiler.hooks.done.tap("unplugin-dingtalk", () => {
|
|
1593
|
-
var _a2;
|
|
1594
1559
|
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
1595
|
-
|
|
1560
|
+
"Open in dingtalk"
|
|
1596
1561
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
1597
1562
|
if (enableChii) {
|
|
1598
1563
|
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
@@ -1608,7 +1573,7 @@ var unpluginFactory = (options) => {
|
|
|
1608
1573
|
startDnsServer(options);
|
|
1609
1574
|
},
|
|
1610
1575
|
async rspack(compiler) {
|
|
1611
|
-
var _a, _b, _c, _d
|
|
1576
|
+
var _a, _b, _c, _d;
|
|
1612
1577
|
if (!(options == null ? void 0 : options.enable)) {
|
|
1613
1578
|
return;
|
|
1614
1579
|
}
|
|
@@ -1627,7 +1592,7 @@ var unpluginFactory = (options) => {
|
|
|
1627
1592
|
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
1628
1593
|
}
|
|
1629
1594
|
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
1630
|
-
|
|
1595
|
+
"Open in dingtalk"
|
|
1631
1596
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
1632
1597
|
if (enableChii) {
|
|
1633
1598
|
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
@@ -1645,7 +1610,6 @@ var index_default = unplugin;
|
|
|
1645
1610
|
export {
|
|
1646
1611
|
fetch,
|
|
1647
1612
|
resovedInfo,
|
|
1648
|
-
startVueDevtools,
|
|
1649
1613
|
startDnsServer,
|
|
1650
1614
|
unpluginFactory,
|
|
1651
1615
|
unplugin,
|
package/dist/esbuild.cjs
CHANGED
|
@@ -5217,7 +5217,6 @@ module.exports = __toCommonJS(esbuild_exports);
|
|
|
5217
5217
|
var import_unplugin2 = require("unplugin");
|
|
5218
5218
|
|
|
5219
5219
|
// src/index.ts
|
|
5220
|
-
var import_node_child_process = require("child_process");
|
|
5221
5220
|
var import_node_process = __toESM(require("process"), 1);
|
|
5222
5221
|
var import_node_http3 = require("http");
|
|
5223
5222
|
var import_node_net2 = require("net");
|
|
@@ -6526,25 +6525,10 @@ var cwd = import_node_process.default.cwd();
|
|
|
6526
6525
|
var config;
|
|
6527
6526
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
6528
6527
|
var resovedInfo = {
|
|
6529
|
-
devtoolsInstance: void 0,
|
|
6530
6528
|
dnsServerInstence: void 0,
|
|
6531
6529
|
availablePort: void 0,
|
|
6532
6530
|
targetURL: void 0
|
|
6533
6531
|
};
|
|
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
6532
|
function startDnsServer(options) {
|
|
6549
6533
|
function debug(...args) {
|
|
6550
6534
|
if (options == null ? void 0 : options.debug) {
|
|
@@ -6618,7 +6602,6 @@ var unpluginFactory = (options) => {
|
|
|
6618
6602
|
return (id.endsWith("main.ts") || id.endsWith("main.js")) && !id.includes("node_modules");
|
|
6619
6603
|
},
|
|
6620
6604
|
async transform(_source) {
|
|
6621
|
-
var _a4, _b, _c;
|
|
6622
6605
|
if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
|
|
6623
6606
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6624
6607
|
(0, import_z_chii.start)({
|
|
@@ -6626,20 +6609,6 @@ var unpluginFactory = (options) => {
|
|
|
6626
6609
|
});
|
|
6627
6610
|
debug(`chii server port: ${resovedInfo.availablePort}`);
|
|
6628
6611
|
}
|
|
6629
|
-
if (options == null ? void 0 : options.enable) {
|
|
6630
|
-
const codes = [
|
|
6631
|
-
"/* eslint-disable */;",
|
|
6632
|
-
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
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});` : "",
|
|
6634
|
-
"/* eslint-enable */",
|
|
6635
|
-
`${_source};`
|
|
6636
|
-
];
|
|
6637
|
-
return {
|
|
6638
|
-
code: codes.join("\n"),
|
|
6639
|
-
map: null
|
|
6640
|
-
// support source map
|
|
6641
|
-
};
|
|
6642
|
-
}
|
|
6643
6612
|
return {
|
|
6644
6613
|
code: _source,
|
|
6645
6614
|
map: null
|
|
@@ -6651,7 +6620,7 @@ var unpluginFactory = (options) => {
|
|
|
6651
6620
|
config = _config;
|
|
6652
6621
|
},
|
|
6653
6622
|
transformIndexHtml(html) {
|
|
6654
|
-
if (enableChii) {
|
|
6623
|
+
if ((options == null ? void 0 : options.enable) && enableChii) {
|
|
6655
6624
|
return html.replace(
|
|
6656
6625
|
"</body>",
|
|
6657
6626
|
`</body>
|
|
@@ -6681,10 +6650,9 @@ var unpluginFactory = (options) => {
|
|
|
6681
6650
|
const base = server.config.base || "/";
|
|
6682
6651
|
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
6683
6652
|
server.printUrls = () => {
|
|
6684
|
-
var _a5;
|
|
6685
6653
|
_printUrls();
|
|
6686
6654
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6687
|
-
|
|
6655
|
+
"Open in dingtalk"
|
|
6688
6656
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6689
6657
|
if (enableChii) {
|
|
6690
6658
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
@@ -6779,12 +6747,10 @@ var unpluginFactory = (options) => {
|
|
|
6779
6747
|
server.middlewares.use(proxyMiddleware(resovedInfo));
|
|
6780
6748
|
}
|
|
6781
6749
|
server.middlewares.use("/open-dingtalk", (req, res) => {
|
|
6782
|
-
var _a5;
|
|
6783
6750
|
debug(targetURL.toString());
|
|
6784
6751
|
res.writeHead(302, {
|
|
6785
6752
|
Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
|
|
6786
6753
|
});
|
|
6787
|
-
startVueDevtools((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable);
|
|
6788
6754
|
res.end();
|
|
6789
6755
|
});
|
|
6790
6756
|
startDnsServer(options);
|
|
@@ -6803,9 +6769,8 @@ var unpluginFactory = (options) => {
|
|
|
6803
6769
|
const base = compiler.options.output.publicPath || "/";
|
|
6804
6770
|
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
6805
6771
|
compiler.hooks.done.tap("unplugin-dingtalk", () => {
|
|
6806
|
-
var _a5;
|
|
6807
6772
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6808
|
-
|
|
6773
|
+
"Open in dingtalk"
|
|
6809
6774
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6810
6775
|
if (enableChii) {
|
|
6811
6776
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
@@ -6821,7 +6786,7 @@ var unpluginFactory = (options) => {
|
|
|
6821
6786
|
startDnsServer(options);
|
|
6822
6787
|
},
|
|
6823
6788
|
async rspack(compiler) {
|
|
6824
|
-
var _a4, _b, _c, _d2
|
|
6789
|
+
var _a4, _b, _c, _d2;
|
|
6825
6790
|
if (!(options == null ? void 0 : options.enable)) {
|
|
6826
6791
|
return;
|
|
6827
6792
|
}
|
|
@@ -6840,7 +6805,7 @@ var unpluginFactory = (options) => {
|
|
|
6840
6805
|
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6841
6806
|
}
|
|
6842
6807
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6843
|
-
|
|
6808
|
+
"Open in dingtalk"
|
|
6844
6809
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6845
6810
|
if (enableChii) {
|
|
6846
6811
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -5214,12 +5214,10 @@ __export(index_exports, {
|
|
|
5214
5214
|
default: () => index_default,
|
|
5215
5215
|
resovedInfo: () => resovedInfo,
|
|
5216
5216
|
startDnsServer: () => startDnsServer,
|
|
5217
|
-
startVueDevtools: () => startVueDevtools,
|
|
5218
5217
|
unplugin: () => unplugin,
|
|
5219
5218
|
unpluginFactory: () => unpluginFactory
|
|
5220
5219
|
});
|
|
5221
5220
|
module.exports = __toCommonJS(index_exports);
|
|
5222
|
-
var import_node_child_process = require("child_process");
|
|
5223
5221
|
var import_node_process = __toESM(require("process"), 1);
|
|
5224
5222
|
var import_node_http3 = require("http");
|
|
5225
5223
|
var import_node_net2 = require("net");
|
|
@@ -6528,25 +6526,10 @@ var cwd = import_node_process.default.cwd();
|
|
|
6528
6526
|
var config;
|
|
6529
6527
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
6530
6528
|
var resovedInfo = {
|
|
6531
|
-
devtoolsInstance: void 0,
|
|
6532
6529
|
dnsServerInstence: void 0,
|
|
6533
6530
|
availablePort: void 0,
|
|
6534
6531
|
targetURL: void 0
|
|
6535
6532
|
};
|
|
6536
|
-
function startVueDevtools(enable) {
|
|
6537
|
-
if (enable && !resovedInfo.devtoolsInstance) {
|
|
6538
|
-
resovedInfo.devtoolsInstance = (0, import_node_child_process.exec)("npx vue-devtools");
|
|
6539
|
-
console.log(` ${import_picocolors.default.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
|
|
6540
|
-
resovedInfo.devtoolsInstance.on("exit", () => {
|
|
6541
|
-
resovedInfo.devtoolsInstance = void 0;
|
|
6542
|
-
});
|
|
6543
|
-
import_node_process.default.on("exit", () => {
|
|
6544
|
-
if (resovedInfo.devtoolsInstance) {
|
|
6545
|
-
resovedInfo.devtoolsInstance.kill();
|
|
6546
|
-
}
|
|
6547
|
-
});
|
|
6548
|
-
}
|
|
6549
|
-
}
|
|
6550
6533
|
function startDnsServer(options) {
|
|
6551
6534
|
function debug(...args) {
|
|
6552
6535
|
if (options == null ? void 0 : options.debug) {
|
|
@@ -6620,7 +6603,6 @@ var unpluginFactory = (options) => {
|
|
|
6620
6603
|
return (id.endsWith("main.ts") || id.endsWith("main.js")) && !id.includes("node_modules");
|
|
6621
6604
|
},
|
|
6622
6605
|
async transform(_source) {
|
|
6623
|
-
var _a4, _b, _c;
|
|
6624
6606
|
if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
|
|
6625
6607
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6626
6608
|
(0, import_z_chii.start)({
|
|
@@ -6628,20 +6610,6 @@ var unpluginFactory = (options) => {
|
|
|
6628
6610
|
});
|
|
6629
6611
|
debug(`chii server port: ${resovedInfo.availablePort}`);
|
|
6630
6612
|
}
|
|
6631
|
-
if (options == null ? void 0 : options.enable) {
|
|
6632
|
-
const codes = [
|
|
6633
|
-
"/* eslint-disable */;",
|
|
6634
|
-
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
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});` : "",
|
|
6636
|
-
"/* eslint-enable */",
|
|
6637
|
-
`${_source};`
|
|
6638
|
-
];
|
|
6639
|
-
return {
|
|
6640
|
-
code: codes.join("\n"),
|
|
6641
|
-
map: null
|
|
6642
|
-
// support source map
|
|
6643
|
-
};
|
|
6644
|
-
}
|
|
6645
6613
|
return {
|
|
6646
6614
|
code: _source,
|
|
6647
6615
|
map: null
|
|
@@ -6653,7 +6621,7 @@ var unpluginFactory = (options) => {
|
|
|
6653
6621
|
config = _config;
|
|
6654
6622
|
},
|
|
6655
6623
|
transformIndexHtml(html) {
|
|
6656
|
-
if (enableChii) {
|
|
6624
|
+
if ((options == null ? void 0 : options.enable) && enableChii) {
|
|
6657
6625
|
return html.replace(
|
|
6658
6626
|
"</body>",
|
|
6659
6627
|
`</body>
|
|
@@ -6683,10 +6651,9 @@ var unpluginFactory = (options) => {
|
|
|
6683
6651
|
const base = server.config.base || "/";
|
|
6684
6652
|
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
6685
6653
|
server.printUrls = () => {
|
|
6686
|
-
var _a5;
|
|
6687
6654
|
_printUrls();
|
|
6688
6655
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6689
|
-
|
|
6656
|
+
"Open in dingtalk"
|
|
6690
6657
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6691
6658
|
if (enableChii) {
|
|
6692
6659
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
@@ -6781,12 +6748,10 @@ var unpluginFactory = (options) => {
|
|
|
6781
6748
|
server.middlewares.use(proxyMiddleware(resovedInfo));
|
|
6782
6749
|
}
|
|
6783
6750
|
server.middlewares.use("/open-dingtalk", (req, res) => {
|
|
6784
|
-
var _a5;
|
|
6785
6751
|
debug(targetURL.toString());
|
|
6786
6752
|
res.writeHead(302, {
|
|
6787
6753
|
Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
|
|
6788
6754
|
});
|
|
6789
|
-
startVueDevtools((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable);
|
|
6790
6755
|
res.end();
|
|
6791
6756
|
});
|
|
6792
6757
|
startDnsServer(options);
|
|
@@ -6805,9 +6770,8 @@ var unpluginFactory = (options) => {
|
|
|
6805
6770
|
const base = compiler.options.output.publicPath || "/";
|
|
6806
6771
|
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
6807
6772
|
compiler.hooks.done.tap("unplugin-dingtalk", () => {
|
|
6808
|
-
var _a5;
|
|
6809
6773
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6810
|
-
|
|
6774
|
+
"Open in dingtalk"
|
|
6811
6775
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6812
6776
|
if (enableChii) {
|
|
6813
6777
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
@@ -6823,7 +6787,7 @@ var unpluginFactory = (options) => {
|
|
|
6823
6787
|
startDnsServer(options);
|
|
6824
6788
|
},
|
|
6825
6789
|
async rspack(compiler) {
|
|
6826
|
-
var _a4, _b, _c, _d2
|
|
6790
|
+
var _a4, _b, _c, _d2;
|
|
6827
6791
|
if (!(options == null ? void 0 : options.enable)) {
|
|
6828
6792
|
return;
|
|
6829
6793
|
}
|
|
@@ -6842,7 +6806,7 @@ var unpluginFactory = (options) => {
|
|
|
6842
6806
|
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6843
6807
|
}
|
|
6844
6808
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6845
|
-
|
|
6809
|
+
"Open in dingtalk"
|
|
6846
6810
|
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6847
6811
|
if (enableChii) {
|
|
6848
6812
|
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
@@ -6860,7 +6824,6 @@ var index_default = unplugin;
|
|
|
6860
6824
|
0 && (module.exports = {
|
|
6861
6825
|
resovedInfo,
|
|
6862
6826
|
startDnsServer,
|
|
6863
|
-
startVueDevtools,
|
|
6864
6827
|
unplugin,
|
|
6865
6828
|
unpluginFactory
|
|
6866
6829
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as _unplugin from 'unplugin';
|
|
2
2
|
import { UnpluginFactory } from 'unplugin';
|
|
3
|
-
import { ChildProcess } from 'node:child_process';
|
|
4
3
|
import dns2 from 'dns2';
|
|
5
4
|
import { Options } from './types.cjs';
|
|
6
5
|
import 'webpack-dev-server';
|
|
@@ -8,14 +7,12 @@ import 'node:http';
|
|
|
8
7
|
import 'vite-plugin-vconsole';
|
|
9
8
|
|
|
10
9
|
declare const resovedInfo: {
|
|
11
|
-
devtoolsInstance: ChildProcess | undefined;
|
|
12
10
|
dnsServerInstence: ReturnType<typeof dns2.createServer> | undefined;
|
|
13
11
|
availablePort: number | undefined;
|
|
14
12
|
targetURL: undefined | URL;
|
|
15
13
|
};
|
|
16
|
-
declare function startVueDevtools(enable?: boolean): void;
|
|
17
14
|
declare function startDnsServer(options?: Options): void;
|
|
18
15
|
declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
|
|
19
16
|
declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
|
|
20
17
|
|
|
21
|
-
export { unplugin as default, resovedInfo, startDnsServer,
|
|
18
|
+
export { unplugin as default, resovedInfo, startDnsServer, unplugin, unpluginFactory };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as _unplugin from 'unplugin';
|
|
2
2
|
import { UnpluginFactory } from 'unplugin';
|
|
3
|
-
import { ChildProcess } from 'node:child_process';
|
|
4
3
|
import dns2 from 'dns2';
|
|
5
4
|
import { Options } from './types.js';
|
|
6
5
|
import 'webpack-dev-server';
|
|
@@ -8,14 +7,12 @@ import 'node:http';
|
|
|
8
7
|
import 'vite-plugin-vconsole';
|
|
9
8
|
|
|
10
9
|
declare const resovedInfo: {
|
|
11
|
-
devtoolsInstance: ChildProcess | undefined;
|
|
12
10
|
dnsServerInstence: ReturnType<typeof dns2.createServer> | undefined;
|
|
13
11
|
availablePort: number | undefined;
|
|
14
12
|
targetURL: undefined | URL;
|
|
15
13
|
};
|
|
16
|
-
declare function startVueDevtools(enable?: boolean): void;
|
|
17
14
|
declare function startDnsServer(options?: Options): void;
|
|
18
15
|
declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
|
|
19
16
|
declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
|
|
20
17
|
|
|
21
|
-
export { unplugin as default, resovedInfo, startDnsServer,
|
|
18
|
+
export { unplugin as default, resovedInfo, startDnsServer, unplugin, unpluginFactory };
|
package/dist/index.js
CHANGED
|
@@ -2,16 +2,14 @@ import {
|
|
|
2
2
|
index_default,
|
|
3
3
|
resovedInfo,
|
|
4
4
|
startDnsServer,
|
|
5
|
-
startVueDevtools,
|
|
6
5
|
unplugin,
|
|
7
6
|
unpluginFactory
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-W5UIO4ZZ.js";
|
|
9
8
|
import "./chunk-ZEHXGFFH.js";
|
|
10
9
|
export {
|
|
11
10
|
index_default as default,
|
|
12
11
|
resovedInfo,
|
|
13
12
|
startDnsServer,
|
|
14
|
-
startVueDevtools,
|
|
15
13
|
unplugin,
|
|
16
14
|
unpluginFactory
|
|
17
15
|
};
|