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.
- package/dist/{chunk-2YQKM4BX.js → __chrome_devtools-CIQ5zFZx.js} +11 -12
- package/dist/__chrome_devtools-CJ3sXpVj.cjs +95 -0
- package/dist/__chrome_devtools.cjs +2 -114
- package/dist/__chrome_devtools.d.cts +3 -2
- package/dist/__chrome_devtools.d.ts +3 -2
- package/dist/__chrome_devtools.js +3 -7
- package/dist/astro.cjs +12 -676
- package/dist/astro.d.cts +7 -10
- package/dist/astro.d.ts +8 -10
- package/dist/astro.js +12 -17
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/esbuild.cjs +9 -667
- package/dist/esbuild.d.cts +5 -8
- package/dist/esbuild.d.ts +6 -8
- package/dist/esbuild.js +8 -10
- package/dist/index.cjs +10 -676
- package/dist/index.d.cts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +5 -16
- package/dist/inject-script.cjs +15 -0
- package/dist/inject-script.d.cts +3 -0
- package/dist/inject-script.d.ts +4 -0
- package/dist/inject-script.js +14 -0
- package/dist/main-BvTybYko.js +99 -0
- package/dist/main-DQgEHuwp.cjs +101 -0
- package/dist/nuxt.cjs +80 -842
- package/dist/nuxt.d.cts +7 -10
- package/dist/nuxt.d.ts +7 -10
- package/dist/nuxt.js +78 -24
- package/dist/rollup.cjs +9 -667
- package/dist/rollup.d.cts +5 -8
- package/dist/rollup.d.ts +6 -8
- package/dist/rollup.js +8 -10
- package/dist/rspack.cjs +54 -728
- package/dist/rspack.d.cts +5 -8
- package/dist/rspack.d.ts +6 -8
- package/dist/rspack.js +50 -74
- package/dist/src-CXHMJspk.cjs +393 -0
- package/dist/src-DJcUe9oP.js +363 -0
- package/dist/types-D6mfGNG_.d.ts +38 -0
- package/dist/types-DodDHiEA.d.cts +38 -0
- package/dist/types.cjs +0 -19
- package/dist/types.d.cts +2 -38
- package/dist/types.d.ts +2 -38
- package/dist/types.js +1 -0
- package/dist/utils-Chlbb6jf.js +23 -0
- package/dist/utils-CmfBxo4J.cjs +41 -0
- package/dist/utils.cjs +4 -33
- package/dist/utils.d.cts +6 -3
- package/dist/utils.d.ts +6 -3
- package/dist/utils.js +3 -7
- package/dist/vite-qeAmx9J4.js +18 -0
- package/dist/vite-ytxVicjL.cjs +24 -0
- package/dist/vite.cjs +5 -824
- package/dist/vite.d.cts +4 -7
- package/dist/vite.d.ts +5 -7
- package/dist/vite.js +6 -10
- package/dist/webpack.cjs +52 -722
- package/dist/webpack.d.cts +5 -8
- package/dist/webpack.d.ts +6 -8
- package/dist/webpack.js +48 -68
- package/package.json +13 -11
- package/dist/chunk-5JBD5THX.js +0 -20
- package/dist/chunk-EG2ZYJ3S.js +0 -542
- package/dist/chunk-KQOHODTC.js +0 -9
- package/dist/chunk-LMNMIIAV.js +0 -26
- package/dist/main-Q4R5NCQC.js +0 -129
package/dist/chunk-EG2ZYJ3S.js
DELETED
|
@@ -1,542 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getChromeDevtoolsHtml
|
|
3
|
-
} from "./chunk-2YQKM4BX.js";
|
|
4
|
-
import {
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "./chunk-5JBD5THX.js";
|
|
7
|
-
|
|
8
|
-
// src/index.ts
|
|
9
|
-
import process2 from "process";
|
|
10
|
-
import { ServerResponse } from "http";
|
|
11
|
-
import { Socket } from "net";
|
|
12
|
-
import { createUnplugin } from "unplugin";
|
|
13
|
-
import c from "picocolors";
|
|
14
|
-
import cookie from "cookie";
|
|
15
|
-
import { start } from "z-chii";
|
|
16
|
-
|
|
17
|
-
// node_modules/.pnpm/get-port-please@3.1.2/node_modules/get-port-please/dist/index.mjs
|
|
18
|
-
import { createServer } from "net";
|
|
19
|
-
import { networkInterfaces } from "os";
|
|
20
|
-
var unsafePorts = /* @__PURE__ */ new Set([
|
|
21
|
-
1,
|
|
22
|
-
// tcpmux
|
|
23
|
-
7,
|
|
24
|
-
// echo
|
|
25
|
-
9,
|
|
26
|
-
// discard
|
|
27
|
-
11,
|
|
28
|
-
// systat
|
|
29
|
-
13,
|
|
30
|
-
// daytime
|
|
31
|
-
15,
|
|
32
|
-
// netstat
|
|
33
|
-
17,
|
|
34
|
-
// qotd
|
|
35
|
-
19,
|
|
36
|
-
// chargen
|
|
37
|
-
20,
|
|
38
|
-
// ftp data
|
|
39
|
-
21,
|
|
40
|
-
// ftp access
|
|
41
|
-
22,
|
|
42
|
-
// ssh
|
|
43
|
-
23,
|
|
44
|
-
// telnet
|
|
45
|
-
25,
|
|
46
|
-
// smtp
|
|
47
|
-
37,
|
|
48
|
-
// time
|
|
49
|
-
42,
|
|
50
|
-
// name
|
|
51
|
-
43,
|
|
52
|
-
// nicname
|
|
53
|
-
53,
|
|
54
|
-
// domain
|
|
55
|
-
69,
|
|
56
|
-
// tftp
|
|
57
|
-
77,
|
|
58
|
-
// priv-rjs
|
|
59
|
-
79,
|
|
60
|
-
// finger
|
|
61
|
-
87,
|
|
62
|
-
// ttylink
|
|
63
|
-
95,
|
|
64
|
-
// supdup
|
|
65
|
-
101,
|
|
66
|
-
// hostriame
|
|
67
|
-
102,
|
|
68
|
-
// iso-tsap
|
|
69
|
-
103,
|
|
70
|
-
// gppitnp
|
|
71
|
-
104,
|
|
72
|
-
// acr-nema
|
|
73
|
-
109,
|
|
74
|
-
// pop2
|
|
75
|
-
110,
|
|
76
|
-
// pop3
|
|
77
|
-
111,
|
|
78
|
-
// sunrpc
|
|
79
|
-
113,
|
|
80
|
-
// auth
|
|
81
|
-
115,
|
|
82
|
-
// sftp
|
|
83
|
-
117,
|
|
84
|
-
// uucp-path
|
|
85
|
-
119,
|
|
86
|
-
// nntp
|
|
87
|
-
123,
|
|
88
|
-
// NTP
|
|
89
|
-
135,
|
|
90
|
-
// loc-srv /epmap
|
|
91
|
-
137,
|
|
92
|
-
// netbios
|
|
93
|
-
139,
|
|
94
|
-
// netbios
|
|
95
|
-
143,
|
|
96
|
-
// imap2
|
|
97
|
-
161,
|
|
98
|
-
// snmp
|
|
99
|
-
179,
|
|
100
|
-
// BGP
|
|
101
|
-
389,
|
|
102
|
-
// ldap
|
|
103
|
-
427,
|
|
104
|
-
// SLP (Also used by Apple Filing Protocol)
|
|
105
|
-
465,
|
|
106
|
-
// smtp+ssl
|
|
107
|
-
512,
|
|
108
|
-
// print / exec
|
|
109
|
-
513,
|
|
110
|
-
// login
|
|
111
|
-
514,
|
|
112
|
-
// shell
|
|
113
|
-
515,
|
|
114
|
-
// printer
|
|
115
|
-
526,
|
|
116
|
-
// tempo
|
|
117
|
-
530,
|
|
118
|
-
// courier
|
|
119
|
-
531,
|
|
120
|
-
// chat
|
|
121
|
-
532,
|
|
122
|
-
// netnews
|
|
123
|
-
540,
|
|
124
|
-
// uucp
|
|
125
|
-
548,
|
|
126
|
-
// AFP (Apple Filing Protocol)
|
|
127
|
-
554,
|
|
128
|
-
// rtsp
|
|
129
|
-
556,
|
|
130
|
-
// remotefs
|
|
131
|
-
563,
|
|
132
|
-
// nntp+ssl
|
|
133
|
-
587,
|
|
134
|
-
// smtp (rfc6409)
|
|
135
|
-
601,
|
|
136
|
-
// syslog-conn (rfc3195)
|
|
137
|
-
636,
|
|
138
|
-
// ldap+ssl
|
|
139
|
-
989,
|
|
140
|
-
// ftps-data
|
|
141
|
-
990,
|
|
142
|
-
// ftps
|
|
143
|
-
993,
|
|
144
|
-
// ldap+ssl
|
|
145
|
-
995,
|
|
146
|
-
// pop3+ssl
|
|
147
|
-
1719,
|
|
148
|
-
// h323gatestat
|
|
149
|
-
1720,
|
|
150
|
-
// h323hostcall
|
|
151
|
-
1723,
|
|
152
|
-
// pptp
|
|
153
|
-
2049,
|
|
154
|
-
// nfs
|
|
155
|
-
3659,
|
|
156
|
-
// apple-sasl / PasswordServer
|
|
157
|
-
4045,
|
|
158
|
-
// lockd
|
|
159
|
-
5060,
|
|
160
|
-
// sip
|
|
161
|
-
5061,
|
|
162
|
-
// sips
|
|
163
|
-
6e3,
|
|
164
|
-
// X11
|
|
165
|
-
6566,
|
|
166
|
-
// sane-port
|
|
167
|
-
6665,
|
|
168
|
-
// Alternate IRC [Apple addition]
|
|
169
|
-
6666,
|
|
170
|
-
// Alternate IRC [Apple addition]
|
|
171
|
-
6667,
|
|
172
|
-
// Standard IRC [Apple addition]
|
|
173
|
-
6668,
|
|
174
|
-
// Alternate IRC [Apple addition]
|
|
175
|
-
6669,
|
|
176
|
-
// Alternate IRC [Apple addition]
|
|
177
|
-
6697,
|
|
178
|
-
// IRC + TLS
|
|
179
|
-
10080
|
|
180
|
-
// Amanda
|
|
181
|
-
]);
|
|
182
|
-
function isUnsafePort(port) {
|
|
183
|
-
return unsafePorts.has(port);
|
|
184
|
-
}
|
|
185
|
-
function isSafePort(port) {
|
|
186
|
-
return !isUnsafePort(port);
|
|
187
|
-
}
|
|
188
|
-
var __defProp = Object.defineProperty;
|
|
189
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
190
|
-
var __publicField = (obj, key, value) => {
|
|
191
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
192
|
-
return value;
|
|
193
|
-
};
|
|
194
|
-
var GetPortError = class extends Error {
|
|
195
|
-
constructor(message, opts) {
|
|
196
|
-
super(message, opts);
|
|
197
|
-
this.message = message;
|
|
198
|
-
__publicField(this, "name", "GetPortError");
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
function _log(verbose, message) {
|
|
202
|
-
if (verbose) {
|
|
203
|
-
console.log(`[get-port] ${message}`);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
function _tryPort(port, host) {
|
|
207
|
-
return new Promise((resolve) => {
|
|
208
|
-
const server = createServer();
|
|
209
|
-
server.unref();
|
|
210
|
-
server.on("error", () => {
|
|
211
|
-
resolve(false);
|
|
212
|
-
});
|
|
213
|
-
server.listen({ port, host }, () => {
|
|
214
|
-
const { port: port2 } = server.address();
|
|
215
|
-
server.close(() => {
|
|
216
|
-
resolve(isSafePort(port2) && port2);
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
function _getLocalHosts(additional) {
|
|
222
|
-
const hosts = new Set(additional);
|
|
223
|
-
for (const _interface of Object.values(networkInterfaces())) {
|
|
224
|
-
for (const config2 of _interface || []) {
|
|
225
|
-
if (config2.address && !config2.internal && !config2.address.startsWith("fe80::")) {
|
|
226
|
-
hosts.add(config2.address);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return [...hosts];
|
|
231
|
-
}
|
|
232
|
-
function _fmtOnHost(hostname) {
|
|
233
|
-
return hostname ? `on host ${JSON.stringify(hostname)}` : "on any host";
|
|
234
|
-
}
|
|
235
|
-
var HOSTNAME_RE = new RegExp("^(?!-)[\\d.:A-Za-z-]{1,63}(?<!-)$");
|
|
236
|
-
async function getRandomPort(host) {
|
|
237
|
-
const port = await checkPort(0, host);
|
|
238
|
-
if (port === false) {
|
|
239
|
-
throw new GetPortError(`Unable to find a random port ${_fmtOnHost(host)}`);
|
|
240
|
-
}
|
|
241
|
-
return port;
|
|
242
|
-
}
|
|
243
|
-
async function checkPort(port, host = process.env.HOST, verbose) {
|
|
244
|
-
if (!host) {
|
|
245
|
-
host = _getLocalHosts([void 0, "0.0.0.0"]);
|
|
246
|
-
}
|
|
247
|
-
if (!Array.isArray(host)) {
|
|
248
|
-
return _tryPort(port, host);
|
|
249
|
-
}
|
|
250
|
-
for (const _host of host) {
|
|
251
|
-
const _port = await _tryPort(port, _host);
|
|
252
|
-
if (_port === false) {
|
|
253
|
-
if (port < 1024 && verbose) {
|
|
254
|
-
_log(
|
|
255
|
-
verbose,
|
|
256
|
-
`Unable to listen to the privileged port ${port} ${_fmtOnHost(
|
|
257
|
-
_host
|
|
258
|
-
)}`
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
return false;
|
|
262
|
-
}
|
|
263
|
-
if (port === 0 && _port !== 0) {
|
|
264
|
-
port = _port;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
return port;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// src/index.ts
|
|
271
|
-
import httpProxy from "http-proxy";
|
|
272
|
-
var cwd = process2.cwd();
|
|
273
|
-
var config;
|
|
274
|
-
var colorUrl = (url) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`));
|
|
275
|
-
var resovedInfo = {
|
|
276
|
-
availablePort: void 0,
|
|
277
|
-
targetURL: void 0
|
|
278
|
-
};
|
|
279
|
-
function createProxyMiddleware(debug) {
|
|
280
|
-
let proxy = null;
|
|
281
|
-
const handleUpgrade = (req, socket, head) => {
|
|
282
|
-
var _a;
|
|
283
|
-
if (proxy && ((_a = req.url) == null ? void 0 : _a.startsWith("/__chii_proxy"))) {
|
|
284
|
-
debug("WS upgrade:", req.url);
|
|
285
|
-
req.url = req.url.replace("/__chii_proxy", "");
|
|
286
|
-
proxy.ws(req, socket, head);
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
return (resolvedInfo) => {
|
|
290
|
-
return (req, res, next) => {
|
|
291
|
-
var _a;
|
|
292
|
-
if (!proxy && resolvedInfo.availablePort) {
|
|
293
|
-
proxy = httpProxy.createProxyServer({
|
|
294
|
-
target: `http://localhost:${resolvedInfo.availablePort}`,
|
|
295
|
-
ws: true
|
|
296
|
-
});
|
|
297
|
-
proxy.on("error", (err, req2, res2) => {
|
|
298
|
-
console.error("Proxy error:", err);
|
|
299
|
-
if (res2 instanceof ServerResponse) {
|
|
300
|
-
if (!res2.headersSent) {
|
|
301
|
-
res2.writeHead(500, { "Content-Type": "text/plain" });
|
|
302
|
-
}
|
|
303
|
-
res2.end(`Proxy error: ${err.message}`);
|
|
304
|
-
} else if (res2 instanceof Socket) {
|
|
305
|
-
res2.destroy();
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
if (req.socket.server) {
|
|
309
|
-
req.socket.server.on("upgrade", handleUpgrade);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
if (proxy && ((_a = req.url) == null ? void 0 : _a.startsWith("/__chii_proxy"))) {
|
|
313
|
-
debug(req.url);
|
|
314
|
-
req.url = req.url.replace("/__chii_proxy", "");
|
|
315
|
-
proxy.web(req, res);
|
|
316
|
-
} else {
|
|
317
|
-
next();
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
var unpluginFactory = (options) => {
|
|
323
|
-
const {
|
|
324
|
-
chii
|
|
325
|
-
} = options || {};
|
|
326
|
-
const enableChii = (chii == null ? void 0 : chii.enable) !== false;
|
|
327
|
-
function debug(...args) {
|
|
328
|
-
if (options == null ? void 0 : options.debug) {
|
|
329
|
-
console.log(` ${c.yellow("DEBUG")} `, ...args);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
const unpluginDing = {
|
|
333
|
-
name: "unplugin-dingtalk",
|
|
334
|
-
enforce: "pre",
|
|
335
|
-
resolveId(source) {
|
|
336
|
-
if (source === "chii-client") {
|
|
337
|
-
return source;
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
loadInclude(id) {
|
|
341
|
-
return id === "chii-client";
|
|
342
|
-
},
|
|
343
|
-
load(id) {
|
|
344
|
-
var _a, _b;
|
|
345
|
-
if (id === "chii-client") {
|
|
346
|
-
return `
|
|
347
|
-
;(function(){
|
|
348
|
-
if (document.getElementById('__chii_client')) return;
|
|
349
|
-
const script = document.createElement('script');
|
|
350
|
-
script.id = '__chii_client';
|
|
351
|
-
script.src="/__chii_proxy/target.js";
|
|
352
|
-
${((_a = options == null ? void 0 : options.chii) == null ? void 0 : _a.embedded) ? "script.setAttribute('embedded','true');" : ""}
|
|
353
|
-
document.body.appendChild(script);
|
|
354
|
-
})();
|
|
355
|
-
if (import.meta.hot) {
|
|
356
|
-
import.meta.hot.accept(() => {
|
|
357
|
-
const old = document.getElementById('__chii_client');
|
|
358
|
-
if (old) old.remove();
|
|
359
|
-
const script = document.createElement('script');
|
|
360
|
-
script.id = '__chii_client';
|
|
361
|
-
script.src="/__chii_proxy/target.js";
|
|
362
|
-
${((_b = options == null ? void 0 : options.chii) == null ? void 0 : _b.embedded) ? "script.setAttribute('embedded','true');" : ""}
|
|
363
|
-
document.body.appendChild(script);
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
`;
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
transformInclude(id) {
|
|
370
|
-
return !!id.split("?")[0].match(/\.[t|j]s$/);
|
|
371
|
-
},
|
|
372
|
-
async transform(source, id) {
|
|
373
|
-
if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
|
|
374
|
-
resovedInfo.availablePort = await getRandomPort();
|
|
375
|
-
start({ port: resovedInfo.availablePort });
|
|
376
|
-
debug(`chii server port: ${resovedInfo.availablePort}`);
|
|
377
|
-
}
|
|
378
|
-
if ((options == null ? void 0 : options.enable) && enableChii) {
|
|
379
|
-
const file = id.split("?")[0];
|
|
380
|
-
if (file.startsWith((config == null ? void 0 : config.root) || cwd) && !file.includes("node_modules") && file.match(/\.[t|j]s$/)) {
|
|
381
|
-
return {
|
|
382
|
-
code: `import 'chii-client';
|
|
383
|
-
${source}`,
|
|
384
|
-
map: null
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return { code: source, map: null };
|
|
389
|
-
},
|
|
390
|
-
vite: {
|
|
391
|
-
configResolved(_config) {
|
|
392
|
-
config = _config;
|
|
393
|
-
},
|
|
394
|
-
transformIndexHtml(html) {
|
|
395
|
-
if ((options == null ? void 0 : options.enable) && enableChii) {
|
|
396
|
-
const tag = `<script type="module">import 'chii-client';</script>`;
|
|
397
|
-
if (!html.includes(tag)) {
|
|
398
|
-
return html.replace(
|
|
399
|
-
"</body>",
|
|
400
|
-
`</body>${tag}
|
|
401
|
-
`
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return html;
|
|
406
|
-
},
|
|
407
|
-
async configureServer(server) {
|
|
408
|
-
var _a, _b;
|
|
409
|
-
if (!(options == null ? void 0 : options.enable)) {
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
const _printUrls = server.printUrls.bind(server);
|
|
413
|
-
let source = `localhost:${config.server.port || 5173}`;
|
|
414
|
-
const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
|
|
415
|
-
if (url) {
|
|
416
|
-
const u = new URL(url);
|
|
417
|
-
source = u.host;
|
|
418
|
-
}
|
|
419
|
-
const base = server.config.base || "/";
|
|
420
|
-
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
421
|
-
server.printUrls = () => {
|
|
422
|
-
_printUrls();
|
|
423
|
-
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
424
|
-
"Open in dingtalk"
|
|
425
|
-
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
426
|
-
if (enableChii) {
|
|
427
|
-
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
428
|
-
"Click to open chrome devtools"
|
|
429
|
-
)}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
const targetURL = new URL(_targetUrl);
|
|
433
|
-
targetURL.searchParams.append("ddtab", "true");
|
|
434
|
-
if (options == null ? void 0 : options.corpId) {
|
|
435
|
-
targetURL.searchParams.append("corpId", options.corpId);
|
|
436
|
-
}
|
|
437
|
-
if (options.debugCookies && options.debugCookies.length > 0) {
|
|
438
|
-
server.middlewares.use((req, res, next) => {
|
|
439
|
-
const cookies = cookie.parse(req.headers.cookie || "");
|
|
440
|
-
for (const [name, value] of Object.entries(cookies)) {
|
|
441
|
-
if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
|
|
442
|
-
const serializedCookie = cookie.serialize(name, value, {
|
|
443
|
-
httpOnly: false
|
|
444
|
-
});
|
|
445
|
-
res.setHeader("Set-Cookie", serializedCookie);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
next();
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
if (enableChii) {
|
|
452
|
-
server.middlewares.use("/__chrome_devtools", async (_req, res) => {
|
|
453
|
-
if (!resovedInfo.availablePort) {
|
|
454
|
-
res.writeHead(500, { "Content-Type": "text/plain" });
|
|
455
|
-
res.end("Server not started");
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
459
|
-
res.write(getChromeDevtoolsHtml(resovedInfo.availablePort));
|
|
460
|
-
res.end();
|
|
461
|
-
});
|
|
462
|
-
const proxyMiddleware = createProxyMiddleware(debug);
|
|
463
|
-
server.middlewares.use(proxyMiddleware(resovedInfo));
|
|
464
|
-
}
|
|
465
|
-
server.middlewares.use("/open-dingtalk", (req, res) => {
|
|
466
|
-
debug(targetURL.toString());
|
|
467
|
-
res.writeHead(302, {
|
|
468
|
-
Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
|
|
469
|
-
});
|
|
470
|
-
res.end();
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
},
|
|
474
|
-
webpack(compiler) {
|
|
475
|
-
var _a, _b;
|
|
476
|
-
if (!(options == null ? void 0 : options.enable)) {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
const devServerOptions = __spreadValues(__spreadValues({
|
|
480
|
-
host: "localhost",
|
|
481
|
-
port: 8080
|
|
482
|
-
}, compiler.options.devServer), (_a = process2.VUE_CLI_SERVICE) == null ? void 0 : _a.projectOptions.devServer);
|
|
483
|
-
const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
|
|
484
|
-
const base = compiler.options.output.publicPath || "/";
|
|
485
|
-
const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
|
|
486
|
-
compiler.hooks.done.tap("unplugin-dingtalk", () => {
|
|
487
|
-
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
488
|
-
"Open in dingtalk"
|
|
489
|
-
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
490
|
-
if (enableChii) {
|
|
491
|
-
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
492
|
-
"Click to open chrome devtools"
|
|
493
|
-
)}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
resovedInfo.targetURL = new URL(_targetUrl);
|
|
497
|
-
resovedInfo.targetURL.searchParams.append("ddtab", "true");
|
|
498
|
-
if (options == null ? void 0 : options.corpId) {
|
|
499
|
-
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
500
|
-
}
|
|
501
|
-
},
|
|
502
|
-
async rspack(compiler) {
|
|
503
|
-
var _a, _b, _c, _d;
|
|
504
|
-
if (!(options == null ? void 0 : options.enable)) {
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
|
-
const devServerOptions = __spreadValues(__spreadValues({
|
|
508
|
-
host: "localhost",
|
|
509
|
-
port: 8080
|
|
510
|
-
}, compiler.options.devServer), (_c = (_b = await ((_a = await import("@rsbuild/core")) == null ? void 0 : _a.loadConfig({
|
|
511
|
-
cwd
|
|
512
|
-
}))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
|
|
513
|
-
const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
|
|
514
|
-
const base = compiler.options.output.publicPath || "/";
|
|
515
|
-
const _targetUrl = (_d = options == null ? void 0 : options.targetUrl) != null ? _d : `http://${source}${base}`;
|
|
516
|
-
resovedInfo.targetURL = new URL(_targetUrl);
|
|
517
|
-
resovedInfo.targetURL.searchParams.append("ddtab", "true");
|
|
518
|
-
if (options == null ? void 0 : options.corpId) {
|
|
519
|
-
resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
|
|
520
|
-
}
|
|
521
|
-
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
522
|
-
"Open in dingtalk"
|
|
523
|
-
)}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
|
|
524
|
-
if (enableChii) {
|
|
525
|
-
console.log(` ${c.green("\u279C")} ${c.bold(
|
|
526
|
-
"Click to open chrome devtools"
|
|
527
|
-
)}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
return unpluginDing;
|
|
532
|
-
};
|
|
533
|
-
var unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
534
|
-
var index_default = unplugin;
|
|
535
|
-
|
|
536
|
-
export {
|
|
537
|
-
resovedInfo,
|
|
538
|
-
createProxyMiddleware,
|
|
539
|
-
unpluginFactory,
|
|
540
|
-
unplugin,
|
|
541
|
-
index_default
|
|
542
|
-
};
|
package/dist/chunk-KQOHODTC.js
DELETED
package/dist/chunk-LMNMIIAV.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interopDefault
|
|
3
|
-
} from "./chunk-KQOHODTC.js";
|
|
4
|
-
import {
|
|
5
|
-
unpluginFactory
|
|
6
|
-
} from "./chunk-EG2ZYJ3S.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("./main-Q4R5NCQC.js"));
|
|
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
|
-
};
|
package/dist/main-Q4R5NCQC.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import "./chunk-5JBD5THX.js";
|
|
2
|
-
|
|
3
|
-
// node_modules/.pnpm/vite-plugin-vconsole@2.1.1/node_modules/vite-plugin-vconsole/dist/main.mjs
|
|
4
|
-
var parseVConsoleOptions = (config) => Object.keys(config).reduce((code, key) => {
|
|
5
|
-
const value = config[key];
|
|
6
|
-
if (typeof value === "function") {
|
|
7
|
-
if (/^[(f]/.test(value.toString())) {
|
|
8
|
-
code += `${key}: ${value},`;
|
|
9
|
-
return code;
|
|
10
|
-
} else {
|
|
11
|
-
code += `${value},`;
|
|
12
|
-
return code;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
code += `${key}: ${JSON.stringify(config[key])},`;
|
|
16
|
-
return code;
|
|
17
|
-
}, "");
|
|
18
|
-
var getEventItems = (event, id) => {
|
|
19
|
-
return event.map(
|
|
20
|
-
(ele) => `
|
|
21
|
-
${id}.on('${ele.eventName}', ${ele.callback})
|
|
22
|
-
`
|
|
23
|
-
).join(";");
|
|
24
|
-
};
|
|
25
|
-
var getDynamicConfig = (dynamicConfig) => {
|
|
26
|
-
let configString = "";
|
|
27
|
-
if (!dynamicConfig) {
|
|
28
|
-
return configString;
|
|
29
|
-
}
|
|
30
|
-
for (const key in dynamicConfig) {
|
|
31
|
-
if (typeof dynamicConfig[key] === "string") {
|
|
32
|
-
configString += `${key}: ${dynamicConfig[key]},`;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return configString;
|
|
36
|
-
};
|
|
37
|
-
var getPlugins = (plugin) => {
|
|
38
|
-
let plugins = "";
|
|
39
|
-
if (plugin && plugin.length) {
|
|
40
|
-
plugins = plugin.map(
|
|
41
|
-
(e) => `
|
|
42
|
-
const ${e.id} = new VConsole.VConsolePlugin('${e.id}', '${e.name}');
|
|
43
|
-
${getEventItems(e.event, e.id)}
|
|
44
|
-
vConsole.addPlugin(${e.id})
|
|
45
|
-
`
|
|
46
|
-
).join(";");
|
|
47
|
-
}
|
|
48
|
-
return plugins;
|
|
49
|
-
};
|
|
50
|
-
function viteVConsole(opt) {
|
|
51
|
-
const {
|
|
52
|
-
entry,
|
|
53
|
-
enabled = true,
|
|
54
|
-
config = {},
|
|
55
|
-
plugin,
|
|
56
|
-
customHide = false,
|
|
57
|
-
dynamicConfig = {},
|
|
58
|
-
eventListener = ""
|
|
59
|
-
} = opt;
|
|
60
|
-
let entryPath = Array.isArray(entry) ? entry : [entry];
|
|
61
|
-
if (process.platform === "win32")
|
|
62
|
-
entryPath = entryPath.map((item) => item.replace(/\\/g, "/"));
|
|
63
|
-
const enabledTruly = enabled;
|
|
64
|
-
return {
|
|
65
|
-
name: "vite:vconsole",
|
|
66
|
-
enforce: "pre",
|
|
67
|
-
transform(_source, id) {
|
|
68
|
-
if (entryPath.includes(id) && enabledTruly) {
|
|
69
|
-
const code = `/* eslint-disable */;
|
|
70
|
-
import VConsole from 'vconsole';
|
|
71
|
-
// config
|
|
72
|
-
const vConsole = new VConsole({${parseVConsoleOptions(
|
|
73
|
-
config
|
|
74
|
-
)}});
|
|
75
|
-
window.vConsole = vConsole;
|
|
76
|
-
|
|
77
|
-
// plugins
|
|
78
|
-
${getPlugins(plugin)}
|
|
79
|
-
|
|
80
|
-
// dynamic config
|
|
81
|
-
window.vConsole.dynamicFunction = function() {
|
|
82
|
-
if (${getDynamicConfig(dynamicConfig).length > 0}) {
|
|
83
|
-
vConsole.setOption({${getDynamicConfig(dynamicConfig)}});
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
window.vConsole.dynamicChange = {
|
|
88
|
-
value: new Date().getTime()
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
window.vConsole.dynamicFunction();
|
|
92
|
-
|
|
93
|
-
if (${customHide}) {
|
|
94
|
-
vConsole.hideSwitch();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// In order to be compatible with old equipment, I used defineProperty. In the future, when proxy covers enough devices, proxy will be used.
|
|
98
|
-
Object.defineProperty(window.vConsole.dynamicChange, 'value', {
|
|
99
|
-
get: function() {
|
|
100
|
-
return this._value;
|
|
101
|
-
},
|
|
102
|
-
set: function(newValue) {
|
|
103
|
-
window.vConsole.dynamicFunction();
|
|
104
|
-
this._value = newValue;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// eventListener
|
|
109
|
-
${eventListener}
|
|
110
|
-
/* eslint-enable */${_source}`;
|
|
111
|
-
return {
|
|
112
|
-
code,
|
|
113
|
-
map: null
|
|
114
|
-
// support source map
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
code: _source,
|
|
119
|
-
map: null
|
|
120
|
-
// support source map
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
var main_default = viteVConsole;
|
|
126
|
-
export {
|
|
127
|
-
main_default as default,
|
|
128
|
-
viteVConsole
|
|
129
|
-
};
|