unplugin-dingtalk 1001.0.0 → 1003.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/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/unplugin-dingtalk?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-dingtalk)
4
4
 
5
- 一键启动钉钉内调试。支持 `vite`、`vue-cli`、`rebuild`。
5
+ 一键启动钉钉内调试。支持 `vite`、`vue-cli`、`rsbuild`。
6
6
 
7
7
  ## 功能
8
8
  - [x] 在钉钉内打开调试链接
9
9
  - [x] 可选注入 [vConsole](https://github.com/Tencent/vConsole) 用于调试 (仅支持 vite )
10
10
  - [x] 可选注入 [chii](https://github.com/liriliri/chii) 用于调试
11
- - [x] ~~可选打开 [vue-devtools](https://github.com/vuejs/devtools) 用于调试~~ 已移除
11
+ - [x] ~~可选打开 [vue-devtools](https://github.com/vuejs/devtools) 用于调试~~ 已移除,如有需要请使用 [vue-devtools](https://devtools.vuejs.org/guide/standalone)
12
12
  - [x] 支持调试 `HttpOnly` cookies
13
13
 
14
14
  ![images](https://github.com/zcf0508/unplugin-dingtalk/raw/main/images/Snipaste_2024-05-22_11-25-35.png)
package/dist/astro.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-W5UIO4ZZ.js";
4
- import "./chunk-ZEHXGFFH.js";
3
+ } from "./chunk-W3PXXTYA.js";
4
+ import "./chunk-A2RZ6ACY.js";
5
+ import "./chunk-MCTMMV5B.js";
5
6
 
6
7
  // src/astro.ts
7
8
  var astro_default = (options) => ({
@@ -0,0 +1,26 @@
1
+ import {
2
+ unpluginFactory
3
+ } from "./chunk-W3PXXTYA.js";
4
+ import {
5
+ interopDefault
6
+ } from "./chunk-KQOHODTC.js";
7
+
8
+ // src/vite.ts
9
+ import { createVitePlugin } from "unplugin";
10
+ var vite_default = async (options) => {
11
+ var _a;
12
+ const plugins = [createVitePlugin(unpluginFactory)(options)];
13
+ if ((options == null ? void 0 : options.enable) && ((_a = options == null ? void 0 : options.vconsole) == null ? void 0 : _a.enabled)) {
14
+ try {
15
+ const viteVConsilePlugin = await interopDefault(import("vite-plugin-vconsole"));
16
+ plugins.push(viteVConsilePlugin(options == null ? void 0 : options.vconsole));
17
+ } catch (e) {
18
+ console.error("vite-plugin-vconsole not found");
19
+ }
20
+ }
21
+ return plugins;
22
+ };
23
+
24
+ export {
25
+ vite_default
26
+ };
@@ -1,103 +1,15 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
12
- var __typeError = (msg) => {
13
- throw TypeError(msg);
14
- };
15
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
- var __spreadValues = (a, b) => {
17
- for (var prop in b || (b = {}))
18
- if (__hasOwnProp.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- if (__getOwnPropSymbols)
21
- for (var prop of __getOwnPropSymbols(b)) {
22
- if (__propIsEnum.call(b, prop))
23
- __defNormalProp(a, prop, b[prop]);
24
- }
25
- return a;
26
- };
27
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
- var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
29
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
30
- }) : x2)(function(x2) {
31
- if (typeof require !== "undefined") return require.apply(this, arguments);
32
- throw Error('Dynamic require of "' + x2 + '" is not supported');
33
- });
34
- var __commonJS = (cb, mod) => function __require2() {
35
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
36
- };
37
- var __copyProps = (to, from, except, desc) => {
38
- if (from && typeof from === "object" || typeof from === "function") {
39
- for (let key of __getOwnPropNames(from))
40
- if (!__hasOwnProp.call(to, key) && key !== except)
41
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
42
- }
43
- return to;
44
- };
45
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
46
- // If the importer is in node compatibility mode or this is not an ESM
47
- // file that has been converted to a CommonJS file using a Babel-
48
- // compatible transform (i.e. "__esModule" has not been set), then set
49
- // "default" to the CommonJS "module.exports" for node compatibility.
50
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
51
- mod
52
- ));
53
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
54
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
55
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
56
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
57
- var __await = function(promise, isYieldStar) {
58
- this[0] = promise;
59
- this[1] = isYieldStar;
60
- };
61
- var __asyncGenerator = (__this, __arguments, generator) => {
62
- var resume = (k, v, yes, no) => {
63
- try {
64
- var x2 = generator[k](v), isAwait = (v = x2.value) instanceof __await, done = x2.done;
65
- Promise.resolve(isAwait ? v[0] : v).then((y) => isAwait ? resume(k === "return" ? k : "next", v[1] ? { done: y.done, value: y.value } : y, yes, no) : yes({ value: y, done })).catch((e2) => resume("throw", e2, yes, no));
66
- } catch (e2) {
67
- no(e2);
68
- }
69
- }, method = (k) => it[k] = (x2) => new Promise((yes, no) => resume(k, x2, yes, no)), it = {};
70
- return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
71
- };
72
- var __yieldStar = (value) => {
73
- var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
74
- if (obj == null) {
75
- obj = value[__knownSymbol("iterator")]();
76
- method = (k) => it[k] = (x2) => obj[k](x2);
77
- } else {
78
- obj = obj.call(value);
79
- method = (k) => it[k] = (v) => {
80
- if (isAwait) {
81
- isAwait = false;
82
- if (k === "throw") throw v;
83
- return v;
84
- }
85
- isAwait = true;
86
- return {
87
- done: false,
88
- value: new __await(new Promise((resolve) => {
89
- var x2 = obj[k](v);
90
- if (!(x2 instanceof Object)) __typeError("Object expected");
91
- resolve(x2);
92
- }), 1)
93
- };
94
- };
95
- }
96
- return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x2) => {
97
- throw x2;
98
- }, "return" in obj && method("return"), it;
99
- };
100
- var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
1
+ import {
2
+ __asyncGenerator,
3
+ __await,
4
+ __commonJS,
5
+ __forAwait,
6
+ __privateAdd,
7
+ __privateGet,
8
+ __privateSet,
9
+ __require,
10
+ __toESM,
11
+ __yieldStar
12
+ } from "./chunk-MCTMMV5B.js";
101
13
 
102
14
  // node_modules/.pnpm/web-streams-polyfill@3.3.3/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js
103
15
  var require_ponyfill_es2018 = __commonJS({
@@ -4804,9 +4716,6 @@ var import_node_domexception = __toESM(require_node_domexception(), 1);
4804
4716
  var { stat } = fs;
4805
4717
 
4806
4718
  export {
4807
- __spreadValues,
4808
- __spreadProps,
4809
- __forAwait,
4810
4719
  fetch_blob_default,
4811
4720
  file_default,
4812
4721
  FormData,
@@ -0,0 +1,9 @@
1
+ // src/utils.ts
2
+ async function interopDefault(m) {
3
+ const resolved = await m;
4
+ return resolved.default || resolved;
5
+ }
6
+
7
+ export {
8
+ interopDefault
9
+ };
@@ -0,0 +1,115 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
12
+ var __typeError = (msg) => {
13
+ throw TypeError(msg);
14
+ };
15
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
+ var __spreadValues = (a, b) => {
17
+ for (var prop in b || (b = {}))
18
+ if (__hasOwnProp.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ if (__getOwnPropSymbols)
21
+ for (var prop of __getOwnPropSymbols(b)) {
22
+ if (__propIsEnum.call(b, prop))
23
+ __defNormalProp(a, prop, b[prop]);
24
+ }
25
+ return a;
26
+ };
27
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
29
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
30
+ }) : x)(function(x) {
31
+ if (typeof require !== "undefined") return require.apply(this, arguments);
32
+ throw Error('Dynamic require of "' + x + '" is not supported');
33
+ });
34
+ var __commonJS = (cb, mod) => function __require2() {
35
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
36
+ };
37
+ var __copyProps = (to, from, except, desc) => {
38
+ if (from && typeof from === "object" || typeof from === "function") {
39
+ for (let key of __getOwnPropNames(from))
40
+ if (!__hasOwnProp.call(to, key) && key !== except)
41
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
42
+ }
43
+ return to;
44
+ };
45
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
46
+ // If the importer is in node compatibility mode or this is not an ESM
47
+ // file that has been converted to a CommonJS file using a Babel-
48
+ // compatible transform (i.e. "__esModule" has not been set), then set
49
+ // "default" to the CommonJS "module.exports" for node compatibility.
50
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
51
+ mod
52
+ ));
53
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
54
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
55
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
56
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
57
+ var __await = function(promise, isYieldStar) {
58
+ this[0] = promise;
59
+ this[1] = isYieldStar;
60
+ };
61
+ var __asyncGenerator = (__this, __arguments, generator) => {
62
+ var resume = (k, v, yes, no) => {
63
+ try {
64
+ var x = generator[k](v), isAwait = (v = x.value) instanceof __await, done = x.done;
65
+ Promise.resolve(isAwait ? v[0] : v).then((y) => isAwait ? resume(k === "return" ? k : "next", v[1] ? { done: y.done, value: y.value } : y, yes, no) : yes({ value: y, done })).catch((e) => resume("throw", e, yes, no));
66
+ } catch (e) {
67
+ no(e);
68
+ }
69
+ }, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
70
+ return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
71
+ };
72
+ var __yieldStar = (value) => {
73
+ var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
74
+ if (obj == null) {
75
+ obj = value[__knownSymbol("iterator")]();
76
+ method = (k) => it[k] = (x) => obj[k](x);
77
+ } else {
78
+ obj = obj.call(value);
79
+ method = (k) => it[k] = (v) => {
80
+ if (isAwait) {
81
+ isAwait = false;
82
+ if (k === "throw") throw v;
83
+ return v;
84
+ }
85
+ isAwait = true;
86
+ return {
87
+ done: false,
88
+ value: new __await(new Promise((resolve) => {
89
+ var x = obj[k](v);
90
+ if (!(x instanceof Object)) __typeError("Object expected");
91
+ resolve(x);
92
+ }), 1)
93
+ };
94
+ };
95
+ }
96
+ return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
97
+ throw x;
98
+ }, "return" in obj && method("return"), it;
99
+ };
100
+ var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
101
+
102
+ export {
103
+ __spreadValues,
104
+ __spreadProps,
105
+ __require,
106
+ __commonJS,
107
+ __toESM,
108
+ __privateGet,
109
+ __privateAdd,
110
+ __privateSet,
111
+ __await,
112
+ __asyncGenerator,
113
+ __yieldStar,
114
+ __forAwait
115
+ };
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  FormData,
3
- __forAwait,
4
- __spreadProps,
5
- __spreadValues,
6
3
  fetch_blob_default,
7
4
  formDataToBlob
8
- } from "./chunk-ZEHXGFFH.js";
5
+ } from "./chunk-A2RZ6ACY.js";
6
+ import {
7
+ __forAwait,
8
+ __spreadProps,
9
+ __spreadValues
10
+ } from "./chunk-MCTMMV5B.js";
9
11
 
10
12
  // src/index.ts
11
13
  import process2 from "node:process";
@@ -187,7 +189,7 @@ var Body = class {
187
189
  }
188
190
  return formData;
189
191
  }
190
- const { toFormData } = await import("./multipart-parser-VO5TIRQZ.js");
192
+ const { toFormData } = await import("./multipart-parser-WSPU7YI5.js");
191
193
  return toFormData(this.body, ct);
192
194
  }
193
195
  /**
@@ -1305,73 +1307,269 @@ import { createUnplugin } from "unplugin";
1305
1307
  import c from "picocolors";
1306
1308
  import cookie from "cookie";
1307
1309
  import { start } from "z-chii";
1308
- import dns2 from "dns2";
1309
- import { getRandomPort } from "get-port-please";
1310
+
1311
+ // node_modules/.pnpm/get-port-please@3.1.2/node_modules/get-port-please/dist/index.mjs
1312
+ import { createServer } from "node:net";
1313
+ import { networkInterfaces } from "node:os";
1314
+ var unsafePorts = /* @__PURE__ */ new Set([
1315
+ 1,
1316
+ // tcpmux
1317
+ 7,
1318
+ // echo
1319
+ 9,
1320
+ // discard
1321
+ 11,
1322
+ // systat
1323
+ 13,
1324
+ // daytime
1325
+ 15,
1326
+ // netstat
1327
+ 17,
1328
+ // qotd
1329
+ 19,
1330
+ // chargen
1331
+ 20,
1332
+ // ftp data
1333
+ 21,
1334
+ // ftp access
1335
+ 22,
1336
+ // ssh
1337
+ 23,
1338
+ // telnet
1339
+ 25,
1340
+ // smtp
1341
+ 37,
1342
+ // time
1343
+ 42,
1344
+ // name
1345
+ 43,
1346
+ // nicname
1347
+ 53,
1348
+ // domain
1349
+ 69,
1350
+ // tftp
1351
+ 77,
1352
+ // priv-rjs
1353
+ 79,
1354
+ // finger
1355
+ 87,
1356
+ // ttylink
1357
+ 95,
1358
+ // supdup
1359
+ 101,
1360
+ // hostriame
1361
+ 102,
1362
+ // iso-tsap
1363
+ 103,
1364
+ // gppitnp
1365
+ 104,
1366
+ // acr-nema
1367
+ 109,
1368
+ // pop2
1369
+ 110,
1370
+ // pop3
1371
+ 111,
1372
+ // sunrpc
1373
+ 113,
1374
+ // auth
1375
+ 115,
1376
+ // sftp
1377
+ 117,
1378
+ // uucp-path
1379
+ 119,
1380
+ // nntp
1381
+ 123,
1382
+ // NTP
1383
+ 135,
1384
+ // loc-srv /epmap
1385
+ 137,
1386
+ // netbios
1387
+ 139,
1388
+ // netbios
1389
+ 143,
1390
+ // imap2
1391
+ 161,
1392
+ // snmp
1393
+ 179,
1394
+ // BGP
1395
+ 389,
1396
+ // ldap
1397
+ 427,
1398
+ // SLP (Also used by Apple Filing Protocol)
1399
+ 465,
1400
+ // smtp+ssl
1401
+ 512,
1402
+ // print / exec
1403
+ 513,
1404
+ // login
1405
+ 514,
1406
+ // shell
1407
+ 515,
1408
+ // printer
1409
+ 526,
1410
+ // tempo
1411
+ 530,
1412
+ // courier
1413
+ 531,
1414
+ // chat
1415
+ 532,
1416
+ // netnews
1417
+ 540,
1418
+ // uucp
1419
+ 548,
1420
+ // AFP (Apple Filing Protocol)
1421
+ 554,
1422
+ // rtsp
1423
+ 556,
1424
+ // remotefs
1425
+ 563,
1426
+ // nntp+ssl
1427
+ 587,
1428
+ // smtp (rfc6409)
1429
+ 601,
1430
+ // syslog-conn (rfc3195)
1431
+ 636,
1432
+ // ldap+ssl
1433
+ 989,
1434
+ // ftps-data
1435
+ 990,
1436
+ // ftps
1437
+ 993,
1438
+ // ldap+ssl
1439
+ 995,
1440
+ // pop3+ssl
1441
+ 1719,
1442
+ // h323gatestat
1443
+ 1720,
1444
+ // h323hostcall
1445
+ 1723,
1446
+ // pptp
1447
+ 2049,
1448
+ // nfs
1449
+ 3659,
1450
+ // apple-sasl / PasswordServer
1451
+ 4045,
1452
+ // lockd
1453
+ 5060,
1454
+ // sip
1455
+ 5061,
1456
+ // sips
1457
+ 6e3,
1458
+ // X11
1459
+ 6566,
1460
+ // sane-port
1461
+ 6665,
1462
+ // Alternate IRC [Apple addition]
1463
+ 6666,
1464
+ // Alternate IRC [Apple addition]
1465
+ 6667,
1466
+ // Standard IRC [Apple addition]
1467
+ 6668,
1468
+ // Alternate IRC [Apple addition]
1469
+ 6669,
1470
+ // Alternate IRC [Apple addition]
1471
+ 6697,
1472
+ // IRC + TLS
1473
+ 10080
1474
+ // Amanda
1475
+ ]);
1476
+ function isUnsafePort(port) {
1477
+ return unsafePorts.has(port);
1478
+ }
1479
+ function isSafePort(port) {
1480
+ return !isUnsafePort(port);
1481
+ }
1482
+ var __defProp = Object.defineProperty;
1483
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1484
+ var __publicField = (obj, key, value) => {
1485
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1486
+ return value;
1487
+ };
1488
+ var GetPortError = class extends Error {
1489
+ constructor(message, opts) {
1490
+ super(message, opts);
1491
+ this.message = message;
1492
+ __publicField(this, "name", "GetPortError");
1493
+ }
1494
+ };
1495
+ function _log(verbose, message) {
1496
+ if (verbose) {
1497
+ console.log(`[get-port] ${message}`);
1498
+ }
1499
+ }
1500
+ function _tryPort(port, host) {
1501
+ return new Promise((resolve) => {
1502
+ const server = createServer();
1503
+ server.unref();
1504
+ server.on("error", () => {
1505
+ resolve(false);
1506
+ });
1507
+ server.listen({ port, host }, () => {
1508
+ const { port: port2 } = server.address();
1509
+ server.close(() => {
1510
+ resolve(isSafePort(port2) && port2);
1511
+ });
1512
+ });
1513
+ });
1514
+ }
1515
+ function _getLocalHosts(additional) {
1516
+ const hosts = new Set(additional);
1517
+ for (const _interface of Object.values(networkInterfaces())) {
1518
+ for (const config2 of _interface || []) {
1519
+ if (config2.address && !config2.internal && !config2.address.startsWith("fe80::")) {
1520
+ hosts.add(config2.address);
1521
+ }
1522
+ }
1523
+ }
1524
+ return [...hosts];
1525
+ }
1526
+ function _fmtOnHost(hostname) {
1527
+ return hostname ? `on host ${JSON.stringify(hostname)}` : "on any host";
1528
+ }
1529
+ var HOSTNAME_RE = new RegExp("^(?!-)[\\d.:A-Za-z-]{1,63}(?<!-)$");
1530
+ async function getRandomPort(host) {
1531
+ const port = await checkPort(0, host);
1532
+ if (port === false) {
1533
+ throw new GetPortError(`Unable to find a random port ${_fmtOnHost(host)}`);
1534
+ }
1535
+ return port;
1536
+ }
1537
+ async function checkPort(port, host = process.env.HOST, verbose) {
1538
+ if (!host) {
1539
+ host = _getLocalHosts([void 0, "0.0.0.0"]);
1540
+ }
1541
+ if (!Array.isArray(host)) {
1542
+ return _tryPort(port, host);
1543
+ }
1544
+ for (const _host of host) {
1545
+ const _port = await _tryPort(port, _host);
1546
+ if (_port === false) {
1547
+ if (port < 1024 && verbose) {
1548
+ _log(
1549
+ verbose,
1550
+ `Unable to listen to the privileged port ${port} ${_fmtOnHost(
1551
+ _host
1552
+ )}`
1553
+ );
1554
+ }
1555
+ return false;
1556
+ }
1557
+ if (port === 0 && _port !== 0) {
1558
+ port = _port;
1559
+ }
1560
+ }
1561
+ return port;
1562
+ }
1563
+
1564
+ // src/index.ts
1310
1565
  import httpProxy from "http-proxy";
1311
1566
  var cwd = process2.cwd();
1312
1567
  var config;
1313
1568
  var colorUrl = (url) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`));
1314
1569
  var resovedInfo = {
1315
- dnsServerInstence: void 0,
1316
1570
  availablePort: void 0,
1317
1571
  targetURL: void 0
1318
1572
  };
1319
- function startDnsServer(options) {
1320
- function debug(...args) {
1321
- if (options == null ? void 0 : options.debug) {
1322
- console.log(` ${c.yellow("DEBUG")} `, ...args);
1323
- }
1324
- }
1325
- if ((options == null ? void 0 : options.enable) && (options == null ? void 0 : options.dns) && !resovedInfo.dnsServerInstence) {
1326
- const { Packet } = dns2;
1327
- resovedInfo.dnsServerInstence = dns2.createServer({
1328
- tcp: true,
1329
- udp: true,
1330
- handle: (request, send, rinfo) => {
1331
- var _a;
1332
- const response = Packet.createResponseFromRequest(request);
1333
- const [question] = request.questions;
1334
- const { name } = question;
1335
- if (name === options.dns.host) {
1336
- response.answers.push({
1337
- name,
1338
- type: Packet.TYPE.A,
1339
- class: Packet.CLASS.IN,
1340
- ttl: 300,
1341
- address: (_a = options.dns) == null ? void 0 : _a.ip
1342
- });
1343
- debug(`dns request from ${rinfo.address}:${rinfo.port} for ${name} => ${options.dns.ip}`);
1344
- }
1345
- send(response);
1346
- }
1347
- });
1348
- resovedInfo.dnsServerInstence.listen({
1349
- udp: { address: "0.0.0.0", port: 53 },
1350
- tcp: { address: "0.0.0.0", port: 53 }
1351
- }).then(() => {
1352
- debug("DNS server is running.");
1353
- const dns = new dns2({
1354
- port: 53,
1355
- nameServers: ["127.0.0.1", "8.8.8.8"]
1356
- });
1357
- dns.resolveA(options.dns.host).then((addresses) => {
1358
- var _a;
1359
- if (((_a = addresses.answers[0]) == null ? void 0 : _a.address) === options.dns.ip) {
1360
- startDnsServer(options);
1361
- console.log(` ${c.green("\u279C")} ${c.bold(`DNS server is started, please modify the DNS of the remote device to ${options.dns.ip}`)}`);
1362
- } else {
1363
- debug(addresses.answers[0].address);
1364
- throw new Error("DNS server started failed");
1365
- }
1366
- }).catch((e) => {
1367
- throw e;
1368
- });
1369
- }).catch((e) => {
1370
- debug(e);
1371
- console.log(` ${c.red("\u279C")} ${c.bold((e == null ? void 0 : e.message) || e)}`);
1372
- });
1373
- }
1374
- }
1375
1573
  var unpluginFactory = (options) => {
1376
1574
  const {
1377
1575
  chii
@@ -1540,7 +1738,6 @@ var unpluginFactory = (options) => {
1540
1738
  });
1541
1739
  res.end();
1542
1740
  });
1543
- startDnsServer(options);
1544
1741
  }
1545
1742
  },
1546
1743
  webpack(compiler) {
@@ -1570,7 +1767,6 @@ var unpluginFactory = (options) => {
1570
1767
  if (options == null ? void 0 : options.corpId) {
1571
1768
  resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
1572
1769
  }
1573
- startDnsServer(options);
1574
1770
  },
1575
1771
  async rspack(compiler) {
1576
1772
  var _a, _b, _c, _d;
@@ -1599,7 +1795,6 @@ var unpluginFactory = (options) => {
1599
1795
  "Click to open chrome devtools"
1600
1796
  )}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
1601
1797
  }
1602
- startDnsServer(options);
1603
1798
  }
1604
1799
  };
1605
1800
  return unpluginDing;
@@ -1610,7 +1805,6 @@ var index_default = unplugin;
1610
1805
  export {
1611
1806
  fetch,
1612
1807
  resovedInfo,
1613
- startDnsServer,
1614
1808
  unpluginFactory,
1615
1809
  unplugin,
1616
1810
  index_default
package/dist/esbuild.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-W5UIO4ZZ.js";
4
- import "./chunk-ZEHXGFFH.js";
3
+ } from "./chunk-W3PXXTYA.js";
4
+ import "./chunk-A2RZ6ACY.js";
5
+ import "./chunk-MCTMMV5B.js";
5
6
 
6
7
  // src/esbuild.ts
7
8
  import { createEsbuildPlugin } from "unplugin";
package/dist/index.d.ts CHANGED
@@ -1,18 +1,15 @@
1
1
  import * as _unplugin from 'unplugin';
2
2
  import { UnpluginFactory } from 'unplugin';
3
- import dns2 from 'dns2';
4
3
  import { Options } from './types.js';
5
4
  import 'webpack-dev-server';
6
5
  import 'node:http';
7
6
  import 'vite-plugin-vconsole';
8
7
 
9
8
  declare const resovedInfo: {
10
- dnsServerInstence: ReturnType<typeof dns2.createServer> | undefined;
11
9
  availablePort: number | undefined;
12
10
  targetURL: undefined | URL;
13
11
  };
14
- declare function startDnsServer(options?: Options): void;
15
12
  declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
16
13
  declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
17
14
 
18
- export { unplugin as default, resovedInfo, startDnsServer, unplugin, unpluginFactory };
15
+ export { unplugin as default, resovedInfo, unplugin, unpluginFactory };
package/dist/index.js CHANGED
@@ -1,15 +1,14 @@
1
1
  import {
2
2
  index_default,
3
3
  resovedInfo,
4
- startDnsServer,
5
4
  unplugin,
6
5
  unpluginFactory
7
- } from "./chunk-W5UIO4ZZ.js";
8
- import "./chunk-ZEHXGFFH.js";
6
+ } from "./chunk-W3PXXTYA.js";
7
+ import "./chunk-A2RZ6ACY.js";
8
+ import "./chunk-MCTMMV5B.js";
9
9
  export {
10
10
  index_default as default,
11
11
  resovedInfo,
12
- startDnsServer,
13
12
  unplugin,
14
13
  unpluginFactory
15
14
  };
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  FormData,
3
- __forAwait,
4
3
  file_default
5
- } from "./chunk-ZEHXGFFH.js";
4
+ } from "./chunk-A2RZ6ACY.js";
5
+ import {
6
+ __forAwait
7
+ } from "./chunk-MCTMMV5B.js";
6
8
 
7
9
  // node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/multipart-parser.js
8
10
  var s = 0;
package/dist/nuxt.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-WE6LHUBA.js";
4
- import "./chunk-W5UIO4ZZ.js";
5
- import "./chunk-ZEHXGFFH.js";
3
+ } from "./chunk-552KT7KH.js";
4
+ import "./chunk-W3PXXTYA.js";
5
+ import "./chunk-A2RZ6ACY.js";
6
+ import "./chunk-KQOHODTC.js";
7
+ import "./chunk-MCTMMV5B.js";
6
8
 
7
9
  // src/nuxt.ts
8
10
  import { addVitePlugin, defineNuxtModule } from "@nuxt/kit";
@@ -15,8 +17,9 @@ var nuxt_default = defineNuxtModule({
15
17
  defaults: {
16
18
  // ...default options
17
19
  },
18
- setup(options, _nuxt) {
19
- addVitePlugin(() => vite_default(options));
20
+ async setup(options, _nuxt) {
21
+ const vitePlugins = await vite_default(options);
22
+ addVitePlugin(vitePlugins);
20
23
  }
21
24
  });
22
25
  export {
package/dist/rollup.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-W5UIO4ZZ.js";
4
- import "./chunk-ZEHXGFFH.js";
3
+ } from "./chunk-W3PXXTYA.js";
4
+ import "./chunk-A2RZ6ACY.js";
5
+ import "./chunk-MCTMMV5B.js";
5
6
 
6
7
  // src/rollup.ts
7
8
  import { createRollupPlugin } from "unplugin";
package/dist/rspack.js CHANGED
@@ -2,8 +2,9 @@ import {
2
2
  fetch,
3
3
  resovedInfo,
4
4
  unpluginFactory
5
- } from "./chunk-W5UIO4ZZ.js";
6
- import "./chunk-ZEHXGFFH.js";
5
+ } from "./chunk-W3PXXTYA.js";
6
+ import "./chunk-A2RZ6ACY.js";
7
+ import "./chunk-MCTMMV5B.js";
7
8
 
8
9
  // src/rspack.ts
9
10
  import { createRspackPlugin } from "unplugin";
package/dist/types.d.ts CHANGED
@@ -5,11 +5,6 @@ import { viteVConsoleOptions } from 'vite-plugin-vconsole';
5
5
  interface Options {
6
6
  enable?: boolean;
7
7
  targetUrl?: string;
8
- /** 是否启动dns服务器 */
9
- dns?: {
10
- host: string;
11
- ip: string;
12
- };
13
8
  corpId?: string;
14
9
  debug?: boolean;
15
10
  /** only support vite */
@@ -0,0 +1,6 @@
1
+ type Awaitable<T> = T | Promise<T>;
2
+ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
3
+ default: infer U;
4
+ } ? U : T>;
5
+
6
+ export { type Awaitable, interopDefault };
package/dist/utils.js ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ interopDefault
3
+ } from "./chunk-KQOHODTC.js";
4
+ import "./chunk-MCTMMV5B.js";
5
+ export {
6
+ interopDefault
7
+ };
package/dist/vite.d.ts CHANGED
@@ -4,6 +4,6 @@ import 'webpack-dev-server';
4
4
  import 'node:http';
5
5
  import 'vite-plugin-vconsole';
6
6
 
7
- declare const _default: (options: Options) => Plugin<any>[];
7
+ declare const _default: (options: Options) => Promise<Plugin<any>[]>;
8
8
 
9
9
  export { _default as default };
package/dist/vite.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-WE6LHUBA.js";
4
- import "./chunk-W5UIO4ZZ.js";
5
- import "./chunk-ZEHXGFFH.js";
3
+ } from "./chunk-552KT7KH.js";
4
+ import "./chunk-W3PXXTYA.js";
5
+ import "./chunk-A2RZ6ACY.js";
6
+ import "./chunk-KQOHODTC.js";
7
+ import "./chunk-MCTMMV5B.js";
6
8
  export {
7
9
  vite_default as default
8
10
  };
package/dist/webpack.js CHANGED
@@ -2,8 +2,9 @@ import {
2
2
  fetch,
3
3
  resovedInfo,
4
4
  unpluginFactory
5
- } from "./chunk-W5UIO4ZZ.js";
6
- import "./chunk-ZEHXGFFH.js";
5
+ } from "./chunk-W3PXXTYA.js";
6
+ import "./chunk-A2RZ6ACY.js";
7
+ import "./chunk-MCTMMV5B.js";
7
8
 
8
9
  // src/webpack.ts
9
10
  import { createWebpackPlugin } from "unplugin";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-dingtalk",
3
3
  "type": "module",
4
- "version": "1001.0.0",
4
+ "version": "1003.0.0",
5
5
  "description": "",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/zcf0508/unplugin-dingtalk#readme",
@@ -51,8 +51,8 @@
51
51
  "@rsbuild/core": "^0.7.9",
52
52
  "esbuild": "*",
53
53
  "rollup": "^3",
54
- "vconsole": "^3.15.1",
55
54
  "vite": ">=3",
55
+ "vite-plugin-vconsole": "^2.1.1",
56
56
  "webpack": "^4 || ^5"
57
57
  },
58
58
  "peerDependenciesMeta": {
@@ -71,10 +71,10 @@
71
71
  "rollup": {
72
72
  "optional": true
73
73
  },
74
- "vconsole": {
74
+ "vite": {
75
75
  "optional": true
76
76
  },
77
- "vite": {
77
+ "vite-plugin-vconsole": {
78
78
  "optional": true
79
79
  },
80
80
  "webpack": {
@@ -82,32 +82,30 @@
82
82
  }
83
83
  },
84
84
  "dependencies": {
85
- "@antfu/eslint-config": "^2.18.1",
86
85
  "cookie": "^1.0.2",
87
- "dns2": "^2.1.0",
88
- "eslint-plugin-security": "^3.0.0",
89
- "get-port-please": "^3.1.2",
90
86
  "http-proxy": "^1.18.1",
91
87
  "picocolors": "^1.0.1",
92
88
  "unplugin": "^1.5.1",
93
- "vite-plugin-vconsole": "^2.1.1",
94
89
  "z-chii": "1.15.5-beta.1"
95
90
  },
96
91
  "devDependencies": {
92
+ "@antfu/eslint-config": "^2.18.1",
97
93
  "@nuxt/kit": "^3.8.2",
98
94
  "@nuxt/schema": "^3.8.2",
99
- "@types/dns2": "^2.0.9",
100
95
  "@types/node": "^20.10.3",
101
96
  "bumpp": "^9.2.0",
102
97
  "chalk": "^5.3.0",
103
98
  "eslint": "^8.55.0",
99
+ "eslint-plugin-security": "^3.0.0",
104
100
  "fast-glob": "^3.3.2",
101
+ "get-port-please": "^3.1.2",
105
102
  "node-fetch": "^3.3.2",
106
103
  "nodemon": "^3.0.2",
107
104
  "rimraf": "^5.0.5",
108
105
  "rollup": "^4.6.1",
109
106
  "tsup": "^8.0.1",
110
107
  "vite": "^5.0.4",
108
+ "vite-plugin-vconsole": "^2.1.1",
111
109
  "vitest": "^1.6.0",
112
110
  "webpack": "^5.89.0",
113
111
  "webpack-dev-server": "^5.0.4"
@@ -1,19 +0,0 @@
1
- import {
2
- unpluginFactory
3
- } from "./chunk-W5UIO4ZZ.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
- };