unplugin-dingtalk 1006.0.0 → 1007.0.1

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.
Files changed (67) hide show
  1. package/dist/{chunk-2YQKM4BX.js → __chrome_devtools-CIQ5zFZx.js} +11 -12
  2. package/dist/__chrome_devtools-CJ3sXpVj.cjs +95 -0
  3. package/dist/__chrome_devtools.cjs +2 -114
  4. package/dist/__chrome_devtools.d.cts +3 -2
  5. package/dist/__chrome_devtools.d.ts +3 -2
  6. package/dist/__chrome_devtools.js +3 -7
  7. package/dist/astro.cjs +12 -676
  8. package/dist/astro.d.cts +7 -10
  9. package/dist/astro.d.ts +8 -10
  10. package/dist/astro.js +12 -17
  11. package/dist/chunk-CUT6urMc.cjs +30 -0
  12. package/dist/esbuild.cjs +9 -667
  13. package/dist/esbuild.d.cts +5 -8
  14. package/dist/esbuild.d.ts +6 -8
  15. package/dist/esbuild.js +8 -10
  16. package/dist/index.cjs +10 -676
  17. package/dist/index.d.cts +11 -13
  18. package/dist/index.d.ts +11 -13
  19. package/dist/index.js +5 -16
  20. package/dist/inject-script.cjs +15 -0
  21. package/dist/inject-script.d.cts +3 -0
  22. package/dist/inject-script.d.ts +4 -0
  23. package/dist/inject-script.js +14 -0
  24. package/dist/main-BvTybYko.js +99 -0
  25. package/dist/main-DQgEHuwp.cjs +101 -0
  26. package/dist/nuxt.cjs +80 -842
  27. package/dist/nuxt.d.cts +7 -10
  28. package/dist/nuxt.d.ts +7 -10
  29. package/dist/nuxt.js +78 -24
  30. package/dist/rollup.cjs +9 -667
  31. package/dist/rollup.d.cts +5 -8
  32. package/dist/rollup.d.ts +6 -8
  33. package/dist/rollup.js +8 -10
  34. package/dist/rspack.cjs +54 -728
  35. package/dist/rspack.d.cts +5 -8
  36. package/dist/rspack.d.ts +6 -8
  37. package/dist/rspack.js +50 -74
  38. package/dist/src-CXHMJspk.cjs +393 -0
  39. package/dist/src-DJcUe9oP.js +363 -0
  40. package/dist/types-D6mfGNG_.d.ts +38 -0
  41. package/dist/types-DodDHiEA.d.cts +38 -0
  42. package/dist/types.cjs +0 -19
  43. package/dist/types.d.cts +2 -38
  44. package/dist/types.d.ts +2 -38
  45. package/dist/types.js +1 -0
  46. package/dist/utils-Chlbb6jf.js +23 -0
  47. package/dist/utils-CmfBxo4J.cjs +41 -0
  48. package/dist/utils.cjs +4 -33
  49. package/dist/utils.d.cts +6 -3
  50. package/dist/utils.d.ts +6 -3
  51. package/dist/utils.js +3 -7
  52. package/dist/vite-qeAmx9J4.js +18 -0
  53. package/dist/vite-ytxVicjL.cjs +24 -0
  54. package/dist/vite.cjs +5 -824
  55. package/dist/vite.d.cts +4 -7
  56. package/dist/vite.d.ts +5 -7
  57. package/dist/vite.js +6 -10
  58. package/dist/webpack.cjs +52 -722
  59. package/dist/webpack.d.cts +5 -8
  60. package/dist/webpack.d.ts +6 -8
  61. package/dist/webpack.js +48 -68
  62. package/package.json +13 -11
  63. package/dist/chunk-5JBD5THX.js +0 -20
  64. package/dist/chunk-EG2ZYJ3S.js +0 -542
  65. package/dist/chunk-KQOHODTC.js +0 -9
  66. package/dist/chunk-LMNMIIAV.js +0 -26
  67. package/dist/main-Q4R5NCQC.js +0 -129
package/dist/esbuild.cjs CHANGED
@@ -1,669 +1,11 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __export = (target, all) => {
23
- for (var name in all)
24
- __defProp(target, name, { get: all[name], enumerable: true });
25
- };
26
- var __copyProps = (to, from, except, desc) => {
27
- if (from && typeof from === "object" || typeof from === "function") {
28
- for (let key of __getOwnPropNames(from))
29
- if (!__hasOwnProp.call(to, key) && key !== except)
30
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
- }
32
- return to;
33
- };
34
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
35
- // If the importer is in node compatibility mode or this is not an ESM
36
- // file that has been converted to a CommonJS file using a Babel-
37
- // compatible transform (i.e. "__esModule" has not been set), then set
38
- // "default" to the CommonJS "module.exports" for node compatibility.
39
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
40
- mod
41
- ));
42
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ require('./__chrome_devtools-CJ3sXpVj.cjs');
3
+ const require_src = require('./src-CXHMJspk.cjs');
4
+ require('./utils-CmfBxo4J.cjs');
5
+ const unplugin = require_chunk.__toESM(require("unplugin"));
43
6
 
44
- // src/esbuild.ts
45
- var esbuild_exports = {};
46
- __export(esbuild_exports, {
47
- default: () => esbuild_default
48
- });
49
- module.exports = __toCommonJS(esbuild_exports);
50
- var import_unplugin2 = require("unplugin");
7
+ //#region src/esbuild.ts
8
+ var esbuild_default = (0, unplugin.createEsbuildPlugin)(require_src.unpluginFactory);
51
9
 
52
- // src/index.ts
53
- var import_node_process = __toESM(require("process"), 1);
54
- var import_node_http = require("http");
55
- var import_node_net2 = require("net");
56
- var import_unplugin = require("unplugin");
57
- var import_picocolors = __toESM(require("picocolors"), 1);
58
- var import_cookie = __toESM(require("cookie"), 1);
59
- var import_z_chii = require("z-chii");
60
-
61
- // node_modules/.pnpm/get-port-please@3.1.2/node_modules/get-port-please/dist/index.mjs
62
- var import_node_net = require("net");
63
- var import_node_os = require("os");
64
- var unsafePorts = /* @__PURE__ */ new Set([
65
- 1,
66
- // tcpmux
67
- 7,
68
- // echo
69
- 9,
70
- // discard
71
- 11,
72
- // systat
73
- 13,
74
- // daytime
75
- 15,
76
- // netstat
77
- 17,
78
- // qotd
79
- 19,
80
- // chargen
81
- 20,
82
- // ftp data
83
- 21,
84
- // ftp access
85
- 22,
86
- // ssh
87
- 23,
88
- // telnet
89
- 25,
90
- // smtp
91
- 37,
92
- // time
93
- 42,
94
- // name
95
- 43,
96
- // nicname
97
- 53,
98
- // domain
99
- 69,
100
- // tftp
101
- 77,
102
- // priv-rjs
103
- 79,
104
- // finger
105
- 87,
106
- // ttylink
107
- 95,
108
- // supdup
109
- 101,
110
- // hostriame
111
- 102,
112
- // iso-tsap
113
- 103,
114
- // gppitnp
115
- 104,
116
- // acr-nema
117
- 109,
118
- // pop2
119
- 110,
120
- // pop3
121
- 111,
122
- // sunrpc
123
- 113,
124
- // auth
125
- 115,
126
- // sftp
127
- 117,
128
- // uucp-path
129
- 119,
130
- // nntp
131
- 123,
132
- // NTP
133
- 135,
134
- // loc-srv /epmap
135
- 137,
136
- // netbios
137
- 139,
138
- // netbios
139
- 143,
140
- // imap2
141
- 161,
142
- // snmp
143
- 179,
144
- // BGP
145
- 389,
146
- // ldap
147
- 427,
148
- // SLP (Also used by Apple Filing Protocol)
149
- 465,
150
- // smtp+ssl
151
- 512,
152
- // print / exec
153
- 513,
154
- // login
155
- 514,
156
- // shell
157
- 515,
158
- // printer
159
- 526,
160
- // tempo
161
- 530,
162
- // courier
163
- 531,
164
- // chat
165
- 532,
166
- // netnews
167
- 540,
168
- // uucp
169
- 548,
170
- // AFP (Apple Filing Protocol)
171
- 554,
172
- // rtsp
173
- 556,
174
- // remotefs
175
- 563,
176
- // nntp+ssl
177
- 587,
178
- // smtp (rfc6409)
179
- 601,
180
- // syslog-conn (rfc3195)
181
- 636,
182
- // ldap+ssl
183
- 989,
184
- // ftps-data
185
- 990,
186
- // ftps
187
- 993,
188
- // ldap+ssl
189
- 995,
190
- // pop3+ssl
191
- 1719,
192
- // h323gatestat
193
- 1720,
194
- // h323hostcall
195
- 1723,
196
- // pptp
197
- 2049,
198
- // nfs
199
- 3659,
200
- // apple-sasl / PasswordServer
201
- 4045,
202
- // lockd
203
- 5060,
204
- // sip
205
- 5061,
206
- // sips
207
- 6e3,
208
- // X11
209
- 6566,
210
- // sane-port
211
- 6665,
212
- // Alternate IRC [Apple addition]
213
- 6666,
214
- // Alternate IRC [Apple addition]
215
- 6667,
216
- // Standard IRC [Apple addition]
217
- 6668,
218
- // Alternate IRC [Apple addition]
219
- 6669,
220
- // Alternate IRC [Apple addition]
221
- 6697,
222
- // IRC + TLS
223
- 10080
224
- // Amanda
225
- ]);
226
- function isUnsafePort(port) {
227
- return unsafePorts.has(port);
228
- }
229
- function isSafePort(port) {
230
- return !isUnsafePort(port);
231
- }
232
- var __defProp2 = Object.defineProperty;
233
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
234
- var __publicField = (obj, key, value) => {
235
- __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
236
- return value;
237
- };
238
- var GetPortError = class extends Error {
239
- constructor(message, opts) {
240
- super(message, opts);
241
- this.message = message;
242
- __publicField(this, "name", "GetPortError");
243
- }
244
- };
245
- function _log(verbose, message) {
246
- if (verbose) {
247
- console.log(`[get-port] ${message}`);
248
- }
249
- }
250
- function _tryPort(port, host) {
251
- return new Promise((resolve) => {
252
- const server = (0, import_node_net.createServer)();
253
- server.unref();
254
- server.on("error", () => {
255
- resolve(false);
256
- });
257
- server.listen({ port, host }, () => {
258
- const { port: port2 } = server.address();
259
- server.close(() => {
260
- resolve(isSafePort(port2) && port2);
261
- });
262
- });
263
- });
264
- }
265
- function _getLocalHosts(additional) {
266
- const hosts = new Set(additional);
267
- for (const _interface of Object.values((0, import_node_os.networkInterfaces)())) {
268
- for (const config2 of _interface || []) {
269
- if (config2.address && !config2.internal && !config2.address.startsWith("fe80::")) {
270
- hosts.add(config2.address);
271
- }
272
- }
273
- }
274
- return [...hosts];
275
- }
276
- function _fmtOnHost(hostname) {
277
- return hostname ? `on host ${JSON.stringify(hostname)}` : "on any host";
278
- }
279
- var HOSTNAME_RE = new RegExp("^(?!-)[\\d.:A-Za-z-]{1,63}(?<!-)$");
280
- async function getRandomPort(host) {
281
- const port = await checkPort(0, host);
282
- if (port === false) {
283
- throw new GetPortError(`Unable to find a random port ${_fmtOnHost(host)}`);
284
- }
285
- return port;
286
- }
287
- async function checkPort(port, host = process.env.HOST, verbose) {
288
- if (!host) {
289
- host = _getLocalHosts([void 0, "0.0.0.0"]);
290
- }
291
- if (!Array.isArray(host)) {
292
- return _tryPort(port, host);
293
- }
294
- for (const _host of host) {
295
- const _port = await _tryPort(port, _host);
296
- if (_port === false) {
297
- if (port < 1024 && verbose) {
298
- _log(
299
- verbose,
300
- `Unable to listen to the privileged port ${port} ${_fmtOnHost(
301
- _host
302
- )}`
303
- );
304
- }
305
- return false;
306
- }
307
- if (port === 0 && _port !== 0) {
308
- port = _port;
309
- }
310
- }
311
- return port;
312
- }
313
-
314
- // src/index.ts
315
- var import_http_proxy = __toESM(require("http-proxy"), 1);
316
-
317
- // src/__chrome_devtools.ts
318
- function getChromeDevtoolsHtml(targetPort) {
319
- return `<!DOCTYPE html>
320
- <html>
321
-
322
- <head>
323
- <meta charset="utf-8">
324
- <title>DevTools Targets</title>
325
- <style>
326
- body {
327
- font-family: sans-serif;
328
- padding: 2em;
329
- }
330
-
331
- ul {
332
- padding: 0;
333
- }
334
-
335
- li {
336
- margin-bottom: 1.2em;
337
- list-style: none;
338
- line-height: 1.5;
339
- }
340
-
341
- a.button {
342
- display: inline-block;
343
- background: #409eff;
344
- color: #fff;
345
- padding: 0.2em 0.5em;
346
- text-decoration: none;
347
- border-radius: 4px;
348
- margin-top: 0.5em;
349
- font-size: 14px;
350
- }
351
-
352
- a.button:hover {
353
- background: #66b1ff;
354
- }
355
-
356
- #refresh {
357
- margin-bottom: 1.5em;
358
- }
359
- </style>
360
- </head>
361
-
362
- <body>
363
- <h2>\u53EF\u7528 DevTools Targets</h2><button id="refresh">\u5237\u65B0</button>
364
- <ul id="target-list">
365
- <li>\u52A0\u8F7D\u4E2D...</li>
366
- </ul>
367
- <script>
368
- async function fetchTargets() {
369
- const list = document.getElementById("target-list");
370
- list.innerHTML = "<li>\u52A0\u8F7D\u4E2D...</li>";
371
- try {
372
- const resp = await fetch("/__chii_proxy/targets");
373
- const data = await resp.json();
374
- const targets = data.targets || [];
375
- if (targets.length === 0) {
376
- list.innerHTML = "<li>\u6682\u65E0\u53EF\u7528\u7684\u8C03\u8BD5\u76EE\u6807\u3002</li>";
377
- } else {
378
- list.innerHTML = "";
379
- for (const target of targets) {
380
- console.log(target)
381
- const devToolsUrl = "http://localhost:${targetPort}/front_end/chii_app.html?ws=localhost:${targetPort}/client/" + Math.random().toString(20).substring(2, 8) + "?target=" + encodeURIComponent(target.id) + "&rtc=false";
382
- const item = document.createElement("li");
383
- item.innerHTML =
384
- "<div><strong>" + (target.title) + "</strong></div>" +
385
- "<div>URL: " + (target.url || "") + "</div>" +
386
- "<div>UA: <code>" + (target.userAgent || "unknown") + "</code></div>" +
387
- "<a href='" + devToolsUrl + "' target='_blank' class='button'>\u6253\u5F00\u8C03\u8BD5</a>";
388
- list.appendChild(item);
389
- }
390
- }
391
- } catch (e) {
392
- list.innerHTML = "<li>\u83B7\u53D6\u8C03\u8BD5\u76EE\u6807\u5931\u8D25</li>";
393
- }
394
- }
395
- document.getElementById("refresh").onclick = () => window.location.reload();
396
- window.onload = fetchTargets;
397
- document.addEventListener('visibilitychange', window.location.reload);
398
- </script>
399
- </body>
400
-
401
- </html>`;
402
- }
403
-
404
- // src/index.ts
405
- var cwd = import_node_process.default.cwd();
406
- var config;
407
- var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
408
- var resovedInfo = {
409
- availablePort: void 0,
410
- targetURL: void 0
411
- };
412
- function createProxyMiddleware(debug) {
413
- let proxy = null;
414
- const handleUpgrade = (req, socket, head) => {
415
- var _a;
416
- if (proxy && ((_a = req.url) == null ? void 0 : _a.startsWith("/__chii_proxy"))) {
417
- debug("WS upgrade:", req.url);
418
- req.url = req.url.replace("/__chii_proxy", "");
419
- proxy.ws(req, socket, head);
420
- }
421
- };
422
- return (resolvedInfo) => {
423
- return (req, res, next) => {
424
- var _a;
425
- if (!proxy && resolvedInfo.availablePort) {
426
- proxy = import_http_proxy.default.createProxyServer({
427
- target: `http://localhost:${resolvedInfo.availablePort}`,
428
- ws: true
429
- });
430
- proxy.on("error", (err, req2, res2) => {
431
- console.error("Proxy error:", err);
432
- if (res2 instanceof import_node_http.ServerResponse) {
433
- if (!res2.headersSent) {
434
- res2.writeHead(500, { "Content-Type": "text/plain" });
435
- }
436
- res2.end(`Proxy error: ${err.message}`);
437
- } else if (res2 instanceof import_node_net2.Socket) {
438
- res2.destroy();
439
- }
440
- });
441
- if (req.socket.server) {
442
- req.socket.server.on("upgrade", handleUpgrade);
443
- }
444
- }
445
- if (proxy && ((_a = req.url) == null ? void 0 : _a.startsWith("/__chii_proxy"))) {
446
- debug(req.url);
447
- req.url = req.url.replace("/__chii_proxy", "");
448
- proxy.web(req, res);
449
- } else {
450
- next();
451
- }
452
- };
453
- };
454
- }
455
- var unpluginFactory = (options) => {
456
- const {
457
- chii
458
- } = options || {};
459
- const enableChii = (chii == null ? void 0 : chii.enable) !== false;
460
- function debug(...args) {
461
- if (options == null ? void 0 : options.debug) {
462
- console.log(` ${import_picocolors.default.yellow("DEBUG")} `, ...args);
463
- }
464
- }
465
- const unpluginDing = {
466
- name: "unplugin-dingtalk",
467
- enforce: "pre",
468
- resolveId(source) {
469
- if (source === "chii-client") {
470
- return source;
471
- }
472
- },
473
- loadInclude(id) {
474
- return id === "chii-client";
475
- },
476
- load(id) {
477
- var _a, _b;
478
- if (id === "chii-client") {
479
- return `
480
- ;(function(){
481
- if (document.getElementById('__chii_client')) return;
482
- const script = document.createElement('script');
483
- script.id = '__chii_client';
484
- script.src="/__chii_proxy/target.js";
485
- ${((_a = options == null ? void 0 : options.chii) == null ? void 0 : _a.embedded) ? "script.setAttribute('embedded','true');" : ""}
486
- document.body.appendChild(script);
487
- })();
488
- if (import.meta.hot) {
489
- import.meta.hot.accept(() => {
490
- const old = document.getElementById('__chii_client');
491
- if (old) old.remove();
492
- const script = document.createElement('script');
493
- script.id = '__chii_client';
494
- script.src="/__chii_proxy/target.js";
495
- ${((_b = options == null ? void 0 : options.chii) == null ? void 0 : _b.embedded) ? "script.setAttribute('embedded','true');" : ""}
496
- document.body.appendChild(script);
497
- });
498
- }
499
- `;
500
- }
501
- },
502
- transformInclude(id) {
503
- return !!id.split("?")[0].match(/\.[t|j]s$/);
504
- },
505
- async transform(source, id) {
506
- if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
507
- resovedInfo.availablePort = await getRandomPort();
508
- (0, import_z_chii.start)({ port: resovedInfo.availablePort });
509
- debug(`chii server port: ${resovedInfo.availablePort}`);
510
- }
511
- if ((options == null ? void 0 : options.enable) && enableChii) {
512
- const file = id.split("?")[0];
513
- if (file.startsWith((config == null ? void 0 : config.root) || cwd) && !file.includes("node_modules") && file.match(/\.[t|j]s$/)) {
514
- return {
515
- code: `import 'chii-client';
516
- ${source}`,
517
- map: null
518
- };
519
- }
520
- }
521
- return { code: source, map: null };
522
- },
523
- vite: {
524
- configResolved(_config) {
525
- config = _config;
526
- },
527
- transformIndexHtml(html) {
528
- if ((options == null ? void 0 : options.enable) && enableChii) {
529
- const tag = `<script type="module">import 'chii-client';</script>`;
530
- if (!html.includes(tag)) {
531
- return html.replace(
532
- "</body>",
533
- `</body>${tag}
534
- `
535
- );
536
- }
537
- }
538
- return html;
539
- },
540
- async configureServer(server) {
541
- var _a, _b;
542
- if (!(options == null ? void 0 : options.enable)) {
543
- return;
544
- }
545
- const _printUrls = server.printUrls.bind(server);
546
- let source = `localhost:${config.server.port || 5173}`;
547
- const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
548
- if (url) {
549
- const u = new URL(url);
550
- source = u.host;
551
- }
552
- const base = server.config.base || "/";
553
- const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
554
- server.printUrls = () => {
555
- _printUrls();
556
- console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
557
- "Open in dingtalk"
558
- )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
559
- if (enableChii) {
560
- console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
561
- "Click to open chrome devtools"
562
- )}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
563
- }
564
- };
565
- const targetURL = new URL(_targetUrl);
566
- targetURL.searchParams.append("ddtab", "true");
567
- if (options == null ? void 0 : options.corpId) {
568
- targetURL.searchParams.append("corpId", options.corpId);
569
- }
570
- if (options.debugCookies && options.debugCookies.length > 0) {
571
- server.middlewares.use((req, res, next) => {
572
- const cookies = import_cookie.default.parse(req.headers.cookie || "");
573
- for (const [name, value] of Object.entries(cookies)) {
574
- if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
575
- const serializedCookie = import_cookie.default.serialize(name, value, {
576
- httpOnly: false
577
- });
578
- res.setHeader("Set-Cookie", serializedCookie);
579
- }
580
- }
581
- next();
582
- });
583
- }
584
- if (enableChii) {
585
- server.middlewares.use("/__chrome_devtools", async (_req, res) => {
586
- if (!resovedInfo.availablePort) {
587
- res.writeHead(500, { "Content-Type": "text/plain" });
588
- res.end("Server not started");
589
- return;
590
- }
591
- res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
592
- res.write(getChromeDevtoolsHtml(resovedInfo.availablePort));
593
- res.end();
594
- });
595
- const proxyMiddleware = createProxyMiddleware(debug);
596
- server.middlewares.use(proxyMiddleware(resovedInfo));
597
- }
598
- server.middlewares.use("/open-dingtalk", (req, res) => {
599
- debug(targetURL.toString());
600
- res.writeHead(302, {
601
- Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
602
- });
603
- res.end();
604
- });
605
- }
606
- },
607
- webpack(compiler) {
608
- var _a, _b;
609
- if (!(options == null ? void 0 : options.enable)) {
610
- return;
611
- }
612
- const devServerOptions = __spreadValues(__spreadValues({
613
- host: "localhost",
614
- port: 8080
615
- }, compiler.options.devServer), (_a = import_node_process.default.VUE_CLI_SERVICE) == null ? void 0 : _a.projectOptions.devServer);
616
- const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
617
- const base = compiler.options.output.publicPath || "/";
618
- const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
619
- compiler.hooks.done.tap("unplugin-dingtalk", () => {
620
- console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
621
- "Open in dingtalk"
622
- )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
623
- if (enableChii) {
624
- console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
625
- "Click to open chrome devtools"
626
- )}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
627
- }
628
- });
629
- resovedInfo.targetURL = new URL(_targetUrl);
630
- resovedInfo.targetURL.searchParams.append("ddtab", "true");
631
- if (options == null ? void 0 : options.corpId) {
632
- resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
633
- }
634
- },
635
- async rspack(compiler) {
636
- var _a, _b, _c, _d;
637
- if (!(options == null ? void 0 : options.enable)) {
638
- return;
639
- }
640
- const devServerOptions = __spreadValues(__spreadValues({
641
- host: "localhost",
642
- port: 8080
643
- }, compiler.options.devServer), (_c = (_b = await ((_a = await import("@rsbuild/core")) == null ? void 0 : _a.loadConfig({
644
- cwd
645
- }))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
646
- const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
647
- const base = compiler.options.output.publicPath || "/";
648
- const _targetUrl = (_d = options == null ? void 0 : options.targetUrl) != null ? _d : `http://${source}${base}`;
649
- resovedInfo.targetURL = new URL(_targetUrl);
650
- resovedInfo.targetURL.searchParams.append("ddtab", "true");
651
- if (options == null ? void 0 : options.corpId) {
652
- resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
653
- }
654
- console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
655
- "Open in dingtalk"
656
- )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
657
- if (enableChii) {
658
- console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
659
- "Click to open chrome devtools"
660
- )}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
661
- }
662
- }
663
- };
664
- return unpluginDing;
665
- };
666
-
667
- // src/esbuild.ts
668
- var esbuild_default = (0, import_unplugin2.createEsbuildPlugin)(unpluginFactory);
669
- exports.default = module.exports;
10
+ //#endregion
11
+ module.exports = esbuild_default;
@@ -1,9 +1,6 @@
1
- import * as esbuild from 'esbuild';
2
- import { Options } from './types.cjs';
3
- import 'webpack-dev-server';
4
- import 'node:http';
5
- import 'vite-plugin-vconsole';
1
+ import { Options } from "./types-DodDHiEA.cjs";
2
+ import * as esbuild0 from "esbuild";
6
3
 
7
- declare const _default: (options?: Options | undefined) => esbuild.Plugin;
8
-
9
- export { _default as default };
4
+ //#region src/esbuild.d.ts
5
+ declare const _default: (options?: Options | undefined) => esbuild0.Plugin;
6
+ export = _default;
package/dist/esbuild.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- import * as esbuild from 'esbuild';
2
- import { Options } from './types.js';
3
- import 'webpack-dev-server';
4
- import 'node:http';
5
- import 'vite-plugin-vconsole';
1
+ import { Options } from "./types-D6mfGNG_.js";
2
+ import * as esbuild0 from "esbuild";
6
3
 
7
- declare const _default: (options?: Options | undefined) => esbuild.Plugin;
8
-
9
- export { _default as default };
4
+ //#region src/esbuild.d.ts
5
+ declare const _default: (options?: Options | undefined) => esbuild0.Plugin;
6
+ //#endregion
7
+ export { _default as default };