unplugin-dingtalk 0.3.0 → 0.4.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 +42 -18
- package/dist/astro.d.cts +1 -0
- package/dist/astro.d.ts +1 -0
- package/dist/astro.js +1 -1
- package/dist/chunk-2OB7UBRW.js +19 -0
- package/dist/{chunk-XTDXIGYG.js → chunk-RDTWBIQD.js} +42 -18
- package/dist/esbuild.cjs +42 -18
- package/dist/esbuild.d.cts +1 -0
- package/dist/esbuild.d.ts +1 -0
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +42 -18
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +92 -135
- package/dist/nuxt.d.cts +1 -0
- package/dist/nuxt.d.ts +1 -0
- package/dist/nuxt.js +3 -7
- package/dist/rollup.cjs +42 -18
- package/dist/rollup.d.cts +1 -0
- package/dist/rollup.d.ts +1 -0
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +164 -66
- package/dist/rspack.d.cts +4 -2
- package/dist/rspack.d.ts +4 -2
- package/dist/rspack.js +80 -2
- package/dist/types.d.cts +15 -1
- package/dist/types.d.ts +15 -1
- package/dist/vite.cjs +51 -19
- package/dist/vite.d.cts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +43 -19
- package/dist/webpack.d.cts +1 -0
- package/dist/webpack.d.ts +1 -0
- package/dist/webpack.js +78 -3
- package/package.json +5 -1
- package/dist/chunk-FMGOYX4F.js +0 -83
- package/dist/chunk-ZV272SZK.js +0 -11
package/dist/astro.cjs
CHANGED
|
@@ -6511,10 +6511,10 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6511
6511
|
// src/index.ts
|
|
6512
6512
|
var import_unplugin = require("unplugin");
|
|
6513
6513
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
6514
|
-
var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
|
|
6515
6514
|
var import_cookie = __toESM(require("cookie"), 1);
|
|
6516
6515
|
var import_chii = require("chii");
|
|
6517
6516
|
var import_get_port_please = require("get-port-please");
|
|
6517
|
+
var cwd = import_node_process.default.cwd();
|
|
6518
6518
|
var config;
|
|
6519
6519
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
6520
6520
|
var resovedInfo = {
|
|
@@ -6531,7 +6531,6 @@ var unpluginFactory = (options) => {
|
|
|
6531
6531
|
console.log(` ${import_picocolors.default.yellow("DEBUG")} `, ...args);
|
|
6532
6532
|
}
|
|
6533
6533
|
}
|
|
6534
|
-
const plugins = [];
|
|
6535
6534
|
const unpluginDing = {
|
|
6536
6535
|
name: "unplugin-dingtalk",
|
|
6537
6536
|
enforce: "pre",
|
|
@@ -6544,20 +6543,22 @@ var unpluginFactory = (options) => {
|
|
|
6544
6543
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6545
6544
|
debug(`chii server port: ${JSON.stringify({ availablePort: resovedInfo.availablePort })}`);
|
|
6546
6545
|
(0, import_chii.start)({
|
|
6546
|
+
host: "0.0.0.0",
|
|
6547
6547
|
port: resovedInfo.availablePort
|
|
6548
6548
|
});
|
|
6549
6549
|
}
|
|
6550
|
-
if (
|
|
6550
|
+
if (options == null ? void 0 : options.enable) {
|
|
6551
6551
|
const codes = [
|
|
6552
|
-
|
|
6553
|
-
import { devtools } from '@vue/devtools'
|
|
6554
|
-
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})
|
|
6552
|
+
"/* eslint-disable */;",
|
|
6553
|
+
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
6554
|
+
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});` : "",
|
|
6555
6555
|
(options == null ? void 0 : options.enable) && enableChii ? `(() => {
|
|
6556
6556
|
const script = document.createElement('script');
|
|
6557
6557
|
script.src="http://localhost:${resovedInfo.availablePort}/target.js";
|
|
6558
6558
|
document.body.appendChild(script);
|
|
6559
6559
|
})()` : "",
|
|
6560
|
-
|
|
6560
|
+
"/* eslint-enable */",
|
|
6561
|
+
`${_source};`
|
|
6561
6562
|
];
|
|
6562
6563
|
return {
|
|
6563
6564
|
code: codes.join("\n"),
|
|
@@ -6576,23 +6577,19 @@ var unpluginFactory = (options) => {
|
|
|
6576
6577
|
config = _config;
|
|
6577
6578
|
},
|
|
6578
6579
|
async configureServer(server) {
|
|
6579
|
-
var _a4, _b
|
|
6580
|
+
var _a4, _b;
|
|
6580
6581
|
if (!(options == null ? void 0 : options.enable)) {
|
|
6581
6582
|
return;
|
|
6582
6583
|
}
|
|
6583
|
-
const availablePort = resovedInfo.availablePort;
|
|
6584
|
-
if ((options == null ? void 0 : options.enable) && ((_a4 = options == null ? void 0 : options.vconsole) == null ? void 0 : _a4.enabled)) {
|
|
6585
|
-
plugins.push((0, import_vite_plugin_vconsole.viteVConsole)(options == null ? void 0 : options.vconsole));
|
|
6586
|
-
}
|
|
6587
6584
|
const _printUrls = server.printUrls.bind(server);
|
|
6588
6585
|
let source = `localhost:${config.server.port || 5173}`;
|
|
6589
|
-
const url = (
|
|
6586
|
+
const url = (_a4 = server.resolvedUrls) == null ? void 0 : _a4.local[0];
|
|
6590
6587
|
if (url) {
|
|
6591
6588
|
const u = new URL(url);
|
|
6592
6589
|
source = u.host;
|
|
6593
6590
|
}
|
|
6594
6591
|
const base = server.config.base || "/";
|
|
6595
|
-
const _targetUrl = (
|
|
6592
|
+
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
6596
6593
|
server.printUrls = () => {
|
|
6597
6594
|
var _a5;
|
|
6598
6595
|
_printUrls();
|
|
@@ -6627,10 +6624,10 @@ var unpluginFactory = (options) => {
|
|
|
6627
6624
|
if (enableChii) {
|
|
6628
6625
|
server.middlewares.use("/__chrome_devtools", async (_req, res) => {
|
|
6629
6626
|
try {
|
|
6630
|
-
const raw = await fetch(`http://localhost:${availablePort}/targets`);
|
|
6627
|
+
const raw = await fetch(`http://localhost:${resovedInfo.availablePort}/targets`);
|
|
6631
6628
|
const data = await raw.json();
|
|
6632
6629
|
if ((data == null ? void 0 : data.targets.length) > 0) {
|
|
6633
|
-
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`;
|
|
6630
|
+
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
6631
|
res.writeHead(302, { Location: devToolsUrl });
|
|
6635
6632
|
res.end();
|
|
6636
6633
|
}
|
|
@@ -6691,10 +6688,37 @@ var unpluginFactory = (options) => {
|
|
|
6691
6688
|
if (options == null ? void 0 : options.corpId) {
|
|
6692
6689
|
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6693
6690
|
}
|
|
6691
|
+
},
|
|
6692
|
+
async rspack(compiler) {
|
|
6693
|
+
var _a4, _b, _c, _d2, _e;
|
|
6694
|
+
if (!(options == null ? void 0 : options.enable)) {
|
|
6695
|
+
return;
|
|
6696
|
+
}
|
|
6697
|
+
const devServerOptions = __spreadValues(__spreadValues({
|
|
6698
|
+
host: "localhost",
|
|
6699
|
+
port: 8080
|
|
6700
|
+
}, compiler.options.devServer), (_c = (_b = await ((_a4 = await import("@rsbuild/core")) == null ? void 0 : _a4.loadConfig({
|
|
6701
|
+
cwd
|
|
6702
|
+
}))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
|
|
6703
|
+
const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
|
|
6704
|
+
const base = compiler.options.output.publicPath || "/";
|
|
6705
|
+
const _targetUrl = (_d2 = options == null ? void 0 : options.targetUrl) != null ? _d2 : `http://${source}${base}`;
|
|
6706
|
+
resovedInfo.targetURL = new URL(_targetUrl);
|
|
6707
|
+
resovedInfo.targetURL.searchParams.append("ddtab", "true");
|
|
6708
|
+
if (options == null ? void 0 : options.corpId) {
|
|
6709
|
+
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6710
|
+
}
|
|
6711
|
+
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6712
|
+
`Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
|
|
6713
|
+
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6714
|
+
if (enableChii) {
|
|
6715
|
+
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6716
|
+
"Click to open chrome devtools"
|
|
6717
|
+
)}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
|
|
6718
|
+
}
|
|
6694
6719
|
}
|
|
6695
6720
|
};
|
|
6696
|
-
|
|
6697
|
-
return plugins;
|
|
6721
|
+
return unpluginDing;
|
|
6698
6722
|
};
|
|
6699
6723
|
var unplugin = /* @__PURE__ */ (0, import_unplugin.createUnplugin)(unpluginFactory);
|
|
6700
6724
|
var src_default = unplugin;
|
package/dist/astro.d.cts
CHANGED
package/dist/astro.d.ts
CHANGED
package/dist/astro.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-RDTWBIQD.js";
|
|
4
|
+
|
|
5
|
+
// src/vite.ts
|
|
6
|
+
import { createVitePlugin } from "unplugin";
|
|
7
|
+
import viteVConsole from "vite-plugin-vconsole";
|
|
8
|
+
var vite_default = (options) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const plugins = [createVitePlugin(unpluginFactory)(options)];
|
|
11
|
+
if ((options == null ? void 0 : options.enable) && ((_a = options == null ? void 0 : options.vconsole) == null ? void 0 : _a.enabled)) {
|
|
12
|
+
plugins.push(viteVConsole(options == null ? void 0 : options.vconsole));
|
|
13
|
+
}
|
|
14
|
+
return plugins;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
vite_default
|
|
19
|
+
};
|
|
@@ -1302,10 +1302,10 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
1302
1302
|
// src/index.ts
|
|
1303
1303
|
import { createUnplugin } from "unplugin";
|
|
1304
1304
|
import c from "picocolors";
|
|
1305
|
-
import { viteVConsole } from "vite-plugin-vconsole";
|
|
1306
1305
|
import cookie from "cookie";
|
|
1307
1306
|
import { start } from "chii";
|
|
1308
1307
|
import { getRandomPort } from "get-port-please";
|
|
1308
|
+
var cwd = process2.cwd();
|
|
1309
1309
|
var config;
|
|
1310
1310
|
var colorUrl = (url) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`));
|
|
1311
1311
|
var resovedInfo = {
|
|
@@ -1322,7 +1322,6 @@ var unpluginFactory = (options) => {
|
|
|
1322
1322
|
console.log(` ${c.yellow("DEBUG")} `, ...args);
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
|
-
const plugins = [];
|
|
1326
1325
|
const unpluginDing = {
|
|
1327
1326
|
name: "unplugin-dingtalk",
|
|
1328
1327
|
enforce: "pre",
|
|
@@ -1335,20 +1334,22 @@ var unpluginFactory = (options) => {
|
|
|
1335
1334
|
resovedInfo.availablePort = await getRandomPort();
|
|
1336
1335
|
debug(`chii server port: ${JSON.stringify({ availablePort: resovedInfo.availablePort })}`);
|
|
1337
1336
|
start({
|
|
1337
|
+
host: "0.0.0.0",
|
|
1338
1338
|
port: resovedInfo.availablePort
|
|
1339
1339
|
});
|
|
1340
1340
|
}
|
|
1341
|
-
if (
|
|
1341
|
+
if (options == null ? void 0 : options.enable) {
|
|
1342
1342
|
const codes = [
|
|
1343
|
-
|
|
1344
|
-
import { devtools } from '@vue/devtools'
|
|
1345
|
-
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})
|
|
1343
|
+
"/* eslint-disable */;",
|
|
1344
|
+
((_a = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a.enable) ? `import { devtools } from '@vue/devtools'
|
|
1345
|
+
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});` : "",
|
|
1346
1346
|
(options == null ? void 0 : options.enable) && enableChii ? `(() => {
|
|
1347
1347
|
const script = document.createElement('script');
|
|
1348
1348
|
script.src="http://localhost:${resovedInfo.availablePort}/target.js";
|
|
1349
1349
|
document.body.appendChild(script);
|
|
1350
1350
|
})()` : "",
|
|
1351
|
-
|
|
1351
|
+
"/* eslint-enable */",
|
|
1352
|
+
`${_source};`
|
|
1352
1353
|
];
|
|
1353
1354
|
return {
|
|
1354
1355
|
code: codes.join("\n"),
|
|
@@ -1367,23 +1368,19 @@ var unpluginFactory = (options) => {
|
|
|
1367
1368
|
config = _config;
|
|
1368
1369
|
},
|
|
1369
1370
|
async configureServer(server) {
|
|
1370
|
-
var _a, _b
|
|
1371
|
+
var _a, _b;
|
|
1371
1372
|
if (!(options == null ? void 0 : options.enable)) {
|
|
1372
1373
|
return;
|
|
1373
1374
|
}
|
|
1374
|
-
const availablePort = resovedInfo.availablePort;
|
|
1375
|
-
if ((options == null ? void 0 : options.enable) && ((_a = options == null ? void 0 : options.vconsole) == null ? void 0 : _a.enabled)) {
|
|
1376
|
-
plugins.push(viteVConsole(options == null ? void 0 : options.vconsole));
|
|
1377
|
-
}
|
|
1378
1375
|
const _printUrls = server.printUrls.bind(server);
|
|
1379
1376
|
let source = `localhost:${config.server.port || 5173}`;
|
|
1380
|
-
const url = (
|
|
1377
|
+
const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
|
|
1381
1378
|
if (url) {
|
|
1382
1379
|
const u = new URL(url);
|
|
1383
1380
|
source = u.host;
|
|
1384
1381
|
}
|
|
1385
1382
|
const base = server.config.base || "/";
|
|
1386
|
-
const _targetUrl = (
|
|
1383
|
+
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
1387
1384
|
server.printUrls = () => {
|
|
1388
1385
|
var _a2;
|
|
1389
1386
|
_printUrls();
|
|
@@ -1418,10 +1415,10 @@ var unpluginFactory = (options) => {
|
|
|
1418
1415
|
if (enableChii) {
|
|
1419
1416
|
server.middlewares.use("/__chrome_devtools", async (_req, res) => {
|
|
1420
1417
|
try {
|
|
1421
|
-
const raw = await fetch(`http://localhost:${availablePort}/targets`);
|
|
1418
|
+
const raw = await fetch(`http://localhost:${resovedInfo.availablePort}/targets`);
|
|
1422
1419
|
const data = await raw.json();
|
|
1423
1420
|
if ((data == null ? void 0 : data.targets.length) > 0) {
|
|
1424
|
-
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`;
|
|
1421
|
+
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`;
|
|
1425
1422
|
res.writeHead(302, { Location: devToolsUrl });
|
|
1426
1423
|
res.end();
|
|
1427
1424
|
}
|
|
@@ -1482,10 +1479,37 @@ var unpluginFactory = (options) => {
|
|
|
1482
1479
|
if (options == null ? void 0 : options.corpId) {
|
|
1483
1480
|
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
1484
1481
|
}
|
|
1482
|
+
},
|
|
1483
|
+
async rspack(compiler) {
|
|
1484
|
+
var _a, _b, _c, _d, _e;
|
|
1485
|
+
if (!(options == null ? void 0 : options.enable)) {
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
const devServerOptions = __spreadValues(__spreadValues({
|
|
1489
|
+
host: "localhost",
|
|
1490
|
+
port: 8080
|
|
1491
|
+
}, compiler.options.devServer), (_c = (_b = await ((_a = await import("@rsbuild/core")) == null ? void 0 : _a.loadConfig({
|
|
1492
|
+
cwd
|
|
1493
|
+
}))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
|
|
1494
|
+
const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
|
|
1495
|
+
const base = compiler.options.output.publicPath || "/";
|
|
1496
|
+
const _targetUrl = (_d = options == null ? void 0 : options.targetUrl) != null ? _d : `http://${source}${base}`;
|
|
1497
|
+
resovedInfo.targetURL = new URL(_targetUrl);
|
|
1498
|
+
resovedInfo.targetURL.searchParams.append("ddtab", "true");
|
|
1499
|
+
if (options == null ? void 0 : options.corpId) {
|
|
1500
|
+
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
1501
|
+
}
|
|
1502
|
+
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
1503
|
+
`Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
|
|
1504
|
+
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
1505
|
+
if (enableChii) {
|
|
1506
|
+
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
1507
|
+
"Click to open chrome devtools"
|
|
1508
|
+
)}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
|
|
1509
|
+
}
|
|
1485
1510
|
}
|
|
1486
1511
|
};
|
|
1487
|
-
|
|
1488
|
-
return plugins;
|
|
1512
|
+
return unpluginDing;
|
|
1489
1513
|
};
|
|
1490
1514
|
var unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
1491
1515
|
var src_default = unplugin;
|
package/dist/esbuild.cjs
CHANGED
|
@@ -6512,10 +6512,10 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6512
6512
|
// src/index.ts
|
|
6513
6513
|
var import_unplugin = require("unplugin");
|
|
6514
6514
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
6515
|
-
var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
|
|
6516
6515
|
var import_cookie = __toESM(require("cookie"), 1);
|
|
6517
6516
|
var import_chii = require("chii");
|
|
6518
6517
|
var import_get_port_please = require("get-port-please");
|
|
6518
|
+
var cwd = import_node_process.default.cwd();
|
|
6519
6519
|
var config;
|
|
6520
6520
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
6521
6521
|
var resovedInfo = {
|
|
@@ -6532,7 +6532,6 @@ var unpluginFactory = (options) => {
|
|
|
6532
6532
|
console.log(` ${import_picocolors.default.yellow("DEBUG")} `, ...args);
|
|
6533
6533
|
}
|
|
6534
6534
|
}
|
|
6535
|
-
const plugins = [];
|
|
6536
6535
|
const unpluginDing = {
|
|
6537
6536
|
name: "unplugin-dingtalk",
|
|
6538
6537
|
enforce: "pre",
|
|
@@ -6545,20 +6544,22 @@ var unpluginFactory = (options) => {
|
|
|
6545
6544
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6546
6545
|
debug(`chii server port: ${JSON.stringify({ availablePort: resovedInfo.availablePort })}`);
|
|
6547
6546
|
(0, import_chii.start)({
|
|
6547
|
+
host: "0.0.0.0",
|
|
6548
6548
|
port: resovedInfo.availablePort
|
|
6549
6549
|
});
|
|
6550
6550
|
}
|
|
6551
|
-
if (
|
|
6551
|
+
if (options == null ? void 0 : options.enable) {
|
|
6552
6552
|
const codes = [
|
|
6553
|
-
|
|
6554
|
-
import { devtools } from '@vue/devtools'
|
|
6555
|
-
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})
|
|
6553
|
+
"/* eslint-disable */;",
|
|
6554
|
+
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
6555
|
+
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});` : "",
|
|
6556
6556
|
(options == null ? void 0 : options.enable) && enableChii ? `(() => {
|
|
6557
6557
|
const script = document.createElement('script');
|
|
6558
6558
|
script.src="http://localhost:${resovedInfo.availablePort}/target.js";
|
|
6559
6559
|
document.body.appendChild(script);
|
|
6560
6560
|
})()` : "",
|
|
6561
|
-
|
|
6561
|
+
"/* eslint-enable */",
|
|
6562
|
+
`${_source};`
|
|
6562
6563
|
];
|
|
6563
6564
|
return {
|
|
6564
6565
|
code: codes.join("\n"),
|
|
@@ -6577,23 +6578,19 @@ var unpluginFactory = (options) => {
|
|
|
6577
6578
|
config = _config;
|
|
6578
6579
|
},
|
|
6579
6580
|
async configureServer(server) {
|
|
6580
|
-
var _a4, _b
|
|
6581
|
+
var _a4, _b;
|
|
6581
6582
|
if (!(options == null ? void 0 : options.enable)) {
|
|
6582
6583
|
return;
|
|
6583
6584
|
}
|
|
6584
|
-
const availablePort = resovedInfo.availablePort;
|
|
6585
|
-
if ((options == null ? void 0 : options.enable) && ((_a4 = options == null ? void 0 : options.vconsole) == null ? void 0 : _a4.enabled)) {
|
|
6586
|
-
plugins.push((0, import_vite_plugin_vconsole.viteVConsole)(options == null ? void 0 : options.vconsole));
|
|
6587
|
-
}
|
|
6588
6585
|
const _printUrls = server.printUrls.bind(server);
|
|
6589
6586
|
let source = `localhost:${config.server.port || 5173}`;
|
|
6590
|
-
const url = (
|
|
6587
|
+
const url = (_a4 = server.resolvedUrls) == null ? void 0 : _a4.local[0];
|
|
6591
6588
|
if (url) {
|
|
6592
6589
|
const u = new URL(url);
|
|
6593
6590
|
source = u.host;
|
|
6594
6591
|
}
|
|
6595
6592
|
const base = server.config.base || "/";
|
|
6596
|
-
const _targetUrl = (
|
|
6593
|
+
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
6597
6594
|
server.printUrls = () => {
|
|
6598
6595
|
var _a5;
|
|
6599
6596
|
_printUrls();
|
|
@@ -6628,10 +6625,10 @@ var unpluginFactory = (options) => {
|
|
|
6628
6625
|
if (enableChii) {
|
|
6629
6626
|
server.middlewares.use("/__chrome_devtools", async (_req, res) => {
|
|
6630
6627
|
try {
|
|
6631
|
-
const raw = await fetch(`http://localhost:${availablePort}/targets`);
|
|
6628
|
+
const raw = await fetch(`http://localhost:${resovedInfo.availablePort}/targets`);
|
|
6632
6629
|
const data = await raw.json();
|
|
6633
6630
|
if ((data == null ? void 0 : data.targets.length) > 0) {
|
|
6634
|
-
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`;
|
|
6631
|
+
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`;
|
|
6635
6632
|
res.writeHead(302, { Location: devToolsUrl });
|
|
6636
6633
|
res.end();
|
|
6637
6634
|
}
|
|
@@ -6692,10 +6689,37 @@ var unpluginFactory = (options) => {
|
|
|
6692
6689
|
if (options == null ? void 0 : options.corpId) {
|
|
6693
6690
|
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6694
6691
|
}
|
|
6692
|
+
},
|
|
6693
|
+
async rspack(compiler) {
|
|
6694
|
+
var _a4, _b, _c, _d2, _e;
|
|
6695
|
+
if (!(options == null ? void 0 : options.enable)) {
|
|
6696
|
+
return;
|
|
6697
|
+
}
|
|
6698
|
+
const devServerOptions = __spreadValues(__spreadValues({
|
|
6699
|
+
host: "localhost",
|
|
6700
|
+
port: 8080
|
|
6701
|
+
}, compiler.options.devServer), (_c = (_b = await ((_a4 = await import("@rsbuild/core")) == null ? void 0 : _a4.loadConfig({
|
|
6702
|
+
cwd
|
|
6703
|
+
}))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
|
|
6704
|
+
const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
|
|
6705
|
+
const base = compiler.options.output.publicPath || "/";
|
|
6706
|
+
const _targetUrl = (_d2 = options == null ? void 0 : options.targetUrl) != null ? _d2 : `http://${source}${base}`;
|
|
6707
|
+
resovedInfo.targetURL = new URL(_targetUrl);
|
|
6708
|
+
resovedInfo.targetURL.searchParams.append("ddtab", "true");
|
|
6709
|
+
if (options == null ? void 0 : options.corpId) {
|
|
6710
|
+
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6711
|
+
}
|
|
6712
|
+
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6713
|
+
`Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
|
|
6714
|
+
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6715
|
+
if (enableChii) {
|
|
6716
|
+
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6717
|
+
"Click to open chrome devtools"
|
|
6718
|
+
)}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
|
|
6719
|
+
}
|
|
6695
6720
|
}
|
|
6696
6721
|
};
|
|
6697
|
-
|
|
6698
|
-
return plugins;
|
|
6722
|
+
return unpluginDing;
|
|
6699
6723
|
};
|
|
6700
6724
|
|
|
6701
6725
|
// src/esbuild.ts
|
package/dist/esbuild.d.cts
CHANGED
package/dist/esbuild.d.ts
CHANGED
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -6512,10 +6512,10 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6512
6512
|
// src/index.ts
|
|
6513
6513
|
var import_unplugin = require("unplugin");
|
|
6514
6514
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
6515
|
-
var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
|
|
6516
6515
|
var import_cookie = __toESM(require("cookie"), 1);
|
|
6517
6516
|
var import_chii = require("chii");
|
|
6518
6517
|
var import_get_port_please = require("get-port-please");
|
|
6518
|
+
var cwd = import_node_process.default.cwd();
|
|
6519
6519
|
var config;
|
|
6520
6520
|
var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
6521
6521
|
var resovedInfo = {
|
|
@@ -6532,7 +6532,6 @@ var unpluginFactory = (options) => {
|
|
|
6532
6532
|
console.log(` ${import_picocolors.default.yellow("DEBUG")} `, ...args);
|
|
6533
6533
|
}
|
|
6534
6534
|
}
|
|
6535
|
-
const plugins = [];
|
|
6536
6535
|
const unpluginDing = {
|
|
6537
6536
|
name: "unplugin-dingtalk",
|
|
6538
6537
|
enforce: "pre",
|
|
@@ -6545,20 +6544,22 @@ var unpluginFactory = (options) => {
|
|
|
6545
6544
|
resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
|
|
6546
6545
|
debug(`chii server port: ${JSON.stringify({ availablePort: resovedInfo.availablePort })}`);
|
|
6547
6546
|
(0, import_chii.start)({
|
|
6547
|
+
host: "0.0.0.0",
|
|
6548
6548
|
port: resovedInfo.availablePort
|
|
6549
6549
|
});
|
|
6550
6550
|
}
|
|
6551
|
-
if (
|
|
6551
|
+
if (options == null ? void 0 : options.enable) {
|
|
6552
6552
|
const codes = [
|
|
6553
|
-
|
|
6554
|
-
import { devtools } from '@vue/devtools'
|
|
6555
|
-
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})
|
|
6553
|
+
"/* eslint-disable */;",
|
|
6554
|
+
((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
|
|
6555
|
+
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});` : "",
|
|
6556
6556
|
(options == null ? void 0 : options.enable) && enableChii ? `(() => {
|
|
6557
6557
|
const script = document.createElement('script');
|
|
6558
6558
|
script.src="http://localhost:${resovedInfo.availablePort}/target.js";
|
|
6559
6559
|
document.body.appendChild(script);
|
|
6560
6560
|
})()` : "",
|
|
6561
|
-
|
|
6561
|
+
"/* eslint-enable */",
|
|
6562
|
+
`${_source};`
|
|
6562
6563
|
];
|
|
6563
6564
|
return {
|
|
6564
6565
|
code: codes.join("\n"),
|
|
@@ -6577,23 +6578,19 @@ var unpluginFactory = (options) => {
|
|
|
6577
6578
|
config = _config;
|
|
6578
6579
|
},
|
|
6579
6580
|
async configureServer(server) {
|
|
6580
|
-
var _a4, _b
|
|
6581
|
+
var _a4, _b;
|
|
6581
6582
|
if (!(options == null ? void 0 : options.enable)) {
|
|
6582
6583
|
return;
|
|
6583
6584
|
}
|
|
6584
|
-
const availablePort = resovedInfo.availablePort;
|
|
6585
|
-
if ((options == null ? void 0 : options.enable) && ((_a4 = options == null ? void 0 : options.vconsole) == null ? void 0 : _a4.enabled)) {
|
|
6586
|
-
plugins.push((0, import_vite_plugin_vconsole.viteVConsole)(options == null ? void 0 : options.vconsole));
|
|
6587
|
-
}
|
|
6588
6585
|
const _printUrls = server.printUrls.bind(server);
|
|
6589
6586
|
let source = `localhost:${config.server.port || 5173}`;
|
|
6590
|
-
const url = (
|
|
6587
|
+
const url = (_a4 = server.resolvedUrls) == null ? void 0 : _a4.local[0];
|
|
6591
6588
|
if (url) {
|
|
6592
6589
|
const u = new URL(url);
|
|
6593
6590
|
source = u.host;
|
|
6594
6591
|
}
|
|
6595
6592
|
const base = server.config.base || "/";
|
|
6596
|
-
const _targetUrl = (
|
|
6593
|
+
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
6597
6594
|
server.printUrls = () => {
|
|
6598
6595
|
var _a5;
|
|
6599
6596
|
_printUrls();
|
|
@@ -6628,10 +6625,10 @@ var unpluginFactory = (options) => {
|
|
|
6628
6625
|
if (enableChii) {
|
|
6629
6626
|
server.middlewares.use("/__chrome_devtools", async (_req, res) => {
|
|
6630
6627
|
try {
|
|
6631
|
-
const raw = await fetch(`http://localhost:${availablePort}/targets`);
|
|
6628
|
+
const raw = await fetch(`http://localhost:${resovedInfo.availablePort}/targets`);
|
|
6632
6629
|
const data = await raw.json();
|
|
6633
6630
|
if ((data == null ? void 0 : data.targets.length) > 0) {
|
|
6634
|
-
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`;
|
|
6631
|
+
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`;
|
|
6635
6632
|
res.writeHead(302, { Location: devToolsUrl });
|
|
6636
6633
|
res.end();
|
|
6637
6634
|
}
|
|
@@ -6692,10 +6689,37 @@ var unpluginFactory = (options) => {
|
|
|
6692
6689
|
if (options == null ? void 0 : options.corpId) {
|
|
6693
6690
|
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6694
6691
|
}
|
|
6692
|
+
},
|
|
6693
|
+
async rspack(compiler) {
|
|
6694
|
+
var _a4, _b, _c, _d2, _e;
|
|
6695
|
+
if (!(options == null ? void 0 : options.enable)) {
|
|
6696
|
+
return;
|
|
6697
|
+
}
|
|
6698
|
+
const devServerOptions = __spreadValues(__spreadValues({
|
|
6699
|
+
host: "localhost",
|
|
6700
|
+
port: 8080
|
|
6701
|
+
}, compiler.options.devServer), (_c = (_b = await ((_a4 = await import("@rsbuild/core")) == null ? void 0 : _a4.loadConfig({
|
|
6702
|
+
cwd
|
|
6703
|
+
}))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
|
|
6704
|
+
const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
|
|
6705
|
+
const base = compiler.options.output.publicPath || "/";
|
|
6706
|
+
const _targetUrl = (_d2 = options == null ? void 0 : options.targetUrl) != null ? _d2 : `http://${source}${base}`;
|
|
6707
|
+
resovedInfo.targetURL = new URL(_targetUrl);
|
|
6708
|
+
resovedInfo.targetURL.searchParams.append("ddtab", "true");
|
|
6709
|
+
if (options == null ? void 0 : options.corpId) {
|
|
6710
|
+
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
6711
|
+
}
|
|
6712
|
+
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6713
|
+
`Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
|
|
6714
|
+
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
6715
|
+
if (enableChii) {
|
|
6716
|
+
console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
6717
|
+
"Click to open chrome devtools"
|
|
6718
|
+
)}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
|
|
6719
|
+
}
|
|
6695
6720
|
}
|
|
6696
6721
|
};
|
|
6697
|
-
|
|
6698
|
-
return plugins;
|
|
6722
|
+
return unpluginDing;
|
|
6699
6723
|
};
|
|
6700
6724
|
var unplugin = /* @__PURE__ */ (0, import_unplugin.createUnplugin)(unpluginFactory);
|
|
6701
6725
|
var src_default = unplugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -3,12 +3,13 @@ import { UnpluginFactory } from 'unplugin';
|
|
|
3
3
|
import { ChildProcess } from 'node:child_process';
|
|
4
4
|
import { Options } from './types.cjs';
|
|
5
5
|
import 'webpack-dev-server';
|
|
6
|
+
import 'node:http';
|
|
6
7
|
import 'vite-plugin-vconsole';
|
|
7
8
|
|
|
8
9
|
declare const resovedInfo: {
|
|
9
10
|
devtoolsInstance: ChildProcess | undefined;
|
|
10
11
|
availablePort: number | undefined;
|
|
11
|
-
targetURL:
|
|
12
|
+
targetURL: undefined | URL;
|
|
12
13
|
};
|
|
13
14
|
declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
|
|
14
15
|
declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { UnpluginFactory } from 'unplugin';
|
|
|
3
3
|
import { ChildProcess } from 'node:child_process';
|
|
4
4
|
import { Options } from './types.js';
|
|
5
5
|
import 'webpack-dev-server';
|
|
6
|
+
import 'node:http';
|
|
6
7
|
import 'vite-plugin-vconsole';
|
|
7
8
|
|
|
8
9
|
declare const resovedInfo: {
|
|
9
10
|
devtoolsInstance: ChildProcess | undefined;
|
|
10
11
|
availablePort: number | undefined;
|
|
11
|
-
targetURL:
|
|
12
|
+
targetURL: undefined | URL;
|
|
12
13
|
};
|
|
13
14
|
declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
|
|
14
15
|
declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
|