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/rspack.d.cts CHANGED
@@ -1,9 +1,6 @@
1
- import * as _unplugin from 'unplugin';
2
- import { Options, RspackSetupMiddlewares } from './types.cjs';
3
- import 'webpack-dev-server';
4
- import 'node:http';
5
- import 'vite-plugin-vconsole';
1
+ import { Options, RspackSetupMiddlewares } from "./types-DodDHiEA.cjs";
2
+ import * as unplugin0 from "unplugin";
6
3
 
7
- declare const _default: (options: Options) => readonly [RspackSetupMiddlewares, _unplugin.RspackPluginInstance];
8
-
9
- export { _default as default };
4
+ //#region src/rspack.d.ts
5
+ declare const _default: (options: Options) => readonly [RspackSetupMiddlewares, unplugin0.RspackPluginInstance];
6
+ export = _default;
package/dist/rspack.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- import * as _unplugin from 'unplugin';
2
- import { Options, RspackSetupMiddlewares } from './types.js';
3
- import 'webpack-dev-server';
4
- import 'node:http';
5
- import 'vite-plugin-vconsole';
1
+ import { Options, RspackSetupMiddlewares } from "./types-D6mfGNG_.js";
2
+ import * as unplugin0 from "unplugin";
6
3
 
7
- declare const _default: (options: Options) => readonly [RspackSetupMiddlewares, _unplugin.RspackPluginInstance];
8
-
9
- export { _default as default };
4
+ //#region src/rspack.d.ts
5
+ declare const _default: (options: Options) => readonly [RspackSetupMiddlewares, unplugin0.RspackPluginInstance];
6
+ //#endregion
7
+ export { _default as default };
package/dist/rspack.js CHANGED
@@ -1,78 +1,54 @@
1
- import {
2
- createProxyMiddleware,
3
- resovedInfo,
4
- unpluginFactory
5
- } from "./chunk-EG2ZYJ3S.js";
6
- import {
7
- getChromeDevtoolsHtml
8
- } from "./chunk-2YQKM4BX.js";
9
- import "./chunk-5JBD5THX.js";
10
-
11
- // src/rspack.ts
12
- import { createRspackPlugin } from "unplugin";
1
+ import { getChromeDevtoolsHtml } from "./__chrome_devtools-CIQ5zFZx.js";
2
+ import { createProxyMiddleware, resovedInfo, unpluginFactory } from "./src-DJcUe9oP.js";
3
+ import "./utils-Chlbb6jf.js";
13
4
  import cookie from "cookie";
14
5
  import c from "picocolors";
6
+ import { createRspackPlugin } from "unplugin";
7
+
8
+ //#region src/rspack.ts
15
9
  var rspack_default = (options) => {
16
- function debug(...args) {
17
- if (options == null ? void 0 : options.debug) {
18
- console.log(` ${c.yellow("DEBUG")} `, ...args);
19
- }
20
- }
21
- const {
22
- chii
23
- } = options || {};
24
- const enableChii = (chii == null ? void 0 : chii.enable) !== false;
25
- const injectSetupMiddlewares = (middlewares, _devServer) => {
26
- if (!(options == null ? void 0 : options.enable)) {
27
- return middlewares;
28
- }
29
- if (options.debugCookies && options.debugCookies.length > 0) {
30
- middlewares.unshift((req, res, next) => {
31
- const cookies = cookie.parse(req.headers.cookie || "");
32
- for (const [name, value] of Object.entries(cookies)) {
33
- if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
34
- const serializedCookie = cookie.serialize(name, value, {
35
- httpOnly: false
36
- });
37
- res.setHeader("Set-Cookie", serializedCookie);
38
- }
39
- }
40
- next();
41
- });
42
- }
43
- if (enableChii) {
44
- middlewares.unshift(async (req, res, next) => {
45
- if (req.url !== "/__chrome_devtools") {
46
- return next();
47
- }
48
- try {
49
- res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
50
- res.write(getChromeDevtoolsHtml(resovedInfo.availablePort));
51
- res.end();
52
- } catch (error) {
53
- debug(`${error}`);
54
- res.writeHead(502);
55
- res.end();
56
- }
57
- });
58
- const proxyMiddleware = createProxyMiddleware(debug);
59
- middlewares.unshift(proxyMiddleware(resovedInfo));
60
- }
61
- middlewares.unshift((req, res, next) => {
62
- if (req.url !== "/open-dingtalk") {
63
- return next();
64
- }
65
- const targetURL = resovedInfo.targetURL;
66
- debug(targetURL.toString());
67
- res.writeHead(302, {
68
- Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
69
- });
70
- res.end();
71
- });
72
- return middlewares;
73
- };
74
- return [injectSetupMiddlewares, createRspackPlugin(unpluginFactory)(options)];
75
- };
76
- export {
77
- rspack_default as default
10
+ function debug(...args) {
11
+ if (options?.debug) console.log(` ${c.yellow("DEBUG")} `, ...args);
12
+ }
13
+ const { chii } = options || {};
14
+ const enableChii = chii?.enable !== false;
15
+ const injectSetupMiddlewares = (middlewares, _devServer) => {
16
+ if (!options?.enable) return middlewares;
17
+ if (options.debugCookies && options.debugCookies.length > 0) middlewares.unshift((req, res, next) => {
18
+ const cookies = cookie.parse(req.headers.cookie || "");
19
+ for (const [name, value] of Object.entries(cookies)) if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
20
+ const serializedCookie = cookie.serialize(name, value, { httpOnly: false });
21
+ res.setHeader("Set-Cookie", serializedCookie);
22
+ }
23
+ next();
24
+ });
25
+ if (enableChii) {
26
+ middlewares.unshift(async (req, res, next) => {
27
+ if (req.url !== "/__chrome_devtools") return next();
28
+ try {
29
+ res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
30
+ res.write(getChromeDevtoolsHtml(resovedInfo.availablePort));
31
+ res.end();
32
+ } catch (error) {
33
+ debug(`${error}`);
34
+ res.writeHead(502);
35
+ res.end();
36
+ }
37
+ });
38
+ const proxyMiddleware = createProxyMiddleware(debug);
39
+ middlewares.unshift(proxyMiddleware(resovedInfo));
40
+ }
41
+ middlewares.unshift((req, res, next) => {
42
+ if (req.url !== "/open-dingtalk") return next();
43
+ const targetURL = resovedInfo.targetURL;
44
+ debug(targetURL.toString());
45
+ res.writeHead(302, { Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}` });
46
+ res.end();
47
+ });
48
+ return middlewares;
49
+ };
50
+ return [injectSetupMiddlewares, createRspackPlugin(unpluginFactory)(options)];
78
51
  };
52
+
53
+ //#endregion
54
+ export { rspack_default as default };
@@ -0,0 +1,393 @@
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const require___chrome_devtools = require('./__chrome_devtools-CJ3sXpVj.cjs');
3
+ const require_utils = require('./utils-CmfBxo4J.cjs');
4
+ const node_http = require_chunk.__toESM(require("node:http"));
5
+ const node_net = require_chunk.__toESM(require("node:net"));
6
+ const node_process = require_chunk.__toESM(require("node:process"));
7
+ const cookie = require_chunk.__toESM(require("cookie"));
8
+ const node_os = require_chunk.__toESM(require("node:os"));
9
+ const http_proxy = require_chunk.__toESM(require("http-proxy"));
10
+ const picocolors = require_chunk.__toESM(require("picocolors"));
11
+ const unplugin = require_chunk.__toESM(require("unplugin"));
12
+ const z_chii = require_chunk.__toESM(require("z-chii"));
13
+
14
+ //#region node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs
15
+ const unsafePorts = /* @__PURE__ */ new Set([
16
+ 1,
17
+ 7,
18
+ 9,
19
+ 11,
20
+ 13,
21
+ 15,
22
+ 17,
23
+ 19,
24
+ 20,
25
+ 21,
26
+ 22,
27
+ 23,
28
+ 25,
29
+ 37,
30
+ 42,
31
+ 43,
32
+ 53,
33
+ 69,
34
+ 77,
35
+ 79,
36
+ 87,
37
+ 95,
38
+ 101,
39
+ 102,
40
+ 103,
41
+ 104,
42
+ 109,
43
+ 110,
44
+ 111,
45
+ 113,
46
+ 115,
47
+ 117,
48
+ 119,
49
+ 123,
50
+ 135,
51
+ 137,
52
+ 139,
53
+ 143,
54
+ 161,
55
+ 179,
56
+ 389,
57
+ 427,
58
+ 465,
59
+ 512,
60
+ 513,
61
+ 514,
62
+ 515,
63
+ 526,
64
+ 530,
65
+ 531,
66
+ 532,
67
+ 540,
68
+ 548,
69
+ 554,
70
+ 556,
71
+ 563,
72
+ 587,
73
+ 601,
74
+ 636,
75
+ 989,
76
+ 990,
77
+ 993,
78
+ 995,
79
+ 1719,
80
+ 1720,
81
+ 1723,
82
+ 2049,
83
+ 3659,
84
+ 4045,
85
+ 5060,
86
+ 5061,
87
+ 6e3,
88
+ 6566,
89
+ 6665,
90
+ 6666,
91
+ 6667,
92
+ 6668,
93
+ 6669,
94
+ 6697,
95
+ 10080
96
+ ]);
97
+ function isUnsafePort(port) {
98
+ return unsafePorts.has(port);
99
+ }
100
+ function isSafePort(port) {
101
+ return !isUnsafePort(port);
102
+ }
103
+ var GetPortError = class extends Error {
104
+ constructor(message, opts) {
105
+ super(message, opts);
106
+ this.message = message;
107
+ }
108
+ name = "GetPortError";
109
+ };
110
+ function _log(verbose, message) {
111
+ if (verbose) console.log(`[get-port] ${message}`);
112
+ }
113
+ function _tryPort(port, host) {
114
+ return new Promise((resolve) => {
115
+ const server = (0, node_net.createServer)();
116
+ server.unref();
117
+ server.on("error", () => {
118
+ resolve(false);
119
+ });
120
+ server.listen({
121
+ port,
122
+ host
123
+ }, () => {
124
+ const { port: port2 } = server.address();
125
+ server.close(() => {
126
+ resolve(isSafePort(port2) && port2);
127
+ });
128
+ });
129
+ });
130
+ }
131
+ function _getLocalHosts(additional) {
132
+ const hosts = new Set(additional);
133
+ for (const _interface of Object.values((0, node_os.networkInterfaces)())) for (const config$1 of _interface || []) if (config$1.address && !config$1.internal && !config$1.address.startsWith("fe80::") && !config$1.address.startsWith("169.254")) hosts.add(config$1.address);
134
+ return [...hosts];
135
+ }
136
+ function _fmtOnHost(hostname) {
137
+ return hostname ? `on host ${JSON.stringify(hostname)}` : "on any host";
138
+ }
139
+ async function getRandomPort(host) {
140
+ const port = await checkPort(0, host);
141
+ if (port === false) throw new GetPortError(`Unable to find a random port ${_fmtOnHost(host)}`);
142
+ return port;
143
+ }
144
+ async function checkPort(port, host = process.env.HOST, verbose) {
145
+ if (!host) host = _getLocalHosts([void 0, "0.0.0.0"]);
146
+ if (!Array.isArray(host)) return _tryPort(port, host);
147
+ for (const _host of host) {
148
+ const _port = await _tryPort(port, _host);
149
+ if (_port === false) {
150
+ if (port < 1024 && verbose) _log(verbose, `Unable to listen to the privileged port ${port} ${_fmtOnHost(_host)}`);
151
+ return false;
152
+ }
153
+ if (port === 0 && _port !== 0) port = _port;
154
+ }
155
+ return port;
156
+ }
157
+
158
+ //#endregion
159
+ //#region src/index.ts
160
+ const cwd = node_process.default.cwd();
161
+ let config;
162
+ const resovedInfo = {
163
+ availablePort: void 0,
164
+ targetURL: void 0
165
+ };
166
+ function createProxyMiddleware(debug) {
167
+ let proxy = null;
168
+ const handleUpgrade = (req, socket, head) => {
169
+ if (proxy && req.url?.startsWith("/__chii_proxy")) {
170
+ debug("WS upgrade:", req.url);
171
+ req.url = req.url.replace("/__chii_proxy", "");
172
+ proxy.ws(req, socket, head);
173
+ }
174
+ };
175
+ return (resolvedInfo) => {
176
+ return (req, res, next) => {
177
+ if (req.url?.startsWith("/__chii_proxy")) req._skip_transform = true;
178
+ if (!proxy && resolvedInfo.availablePort) {
179
+ proxy = http_proxy.default.createProxyServer({
180
+ target: `http://localhost:${resolvedInfo.availablePort}`,
181
+ ws: true
182
+ });
183
+ proxy.on("error", (err, req$1, res$1) => {
184
+ console.error("Proxy error:", err);
185
+ if (res$1 instanceof node_http.ServerResponse) {
186
+ if (!res$1.headersSent) res$1.writeHead(500, { "Content-Type": "text/plain" });
187
+ res$1.end(`Proxy error: ${err.message}`);
188
+ } else if (res$1 instanceof node_net.Socket) res$1.destroy();
189
+ });
190
+ if (req.socket.server) req.socket.server.on("upgrade", handleUpgrade);
191
+ }
192
+ if (proxy && req.url?.startsWith("/__chii_proxy")) {
193
+ debug(req.url);
194
+ req.url = req.url.replace("/__chii_proxy", "");
195
+ proxy.web(req, res);
196
+ } else next();
197
+ };
198
+ };
199
+ }
200
+ const isNuxt = require_utils.isNuxtProject();
201
+ const unpluginFactory = (options) => {
202
+ const { chii } = options || {};
203
+ const enableChii = chii?.enable !== false;
204
+ function debug(...args) {
205
+ if (options?.debug) console.log(` ${picocolors.default.yellow("DEBUG")} `, ...args);
206
+ }
207
+ const unpluginDing = {
208
+ name: "unplugin-dingtalk",
209
+ enforce: "pre",
210
+ resolveId(source) {
211
+ if (source === "chii-client") return source;
212
+ },
213
+ loadInclude(id) {
214
+ return id === "chii-client";
215
+ },
216
+ load(id) {
217
+ if (id === "chii-client") return `
218
+ ;(function(){
219
+ if (document.getElementById('__chii_client')) return;
220
+ const script = document.createElement('script');
221
+ script.id = '__chii_client';
222
+ script.src="/__chii_proxy/target.js";
223
+ ${options?.chii?.embedded ? "script.setAttribute('embedded','true');" : ""}
224
+ document.body.appendChild(script);
225
+ })();
226
+ if (import.meta.hot) {
227
+ import.meta.hot.accept(() => {
228
+ const old = document.getElementById('__chii_client');
229
+ if (old) old.remove();
230
+ const script = document.createElement('script');
231
+ script.id = '__chii_client';
232
+ script.src="/__chii_proxy/target.js";
233
+ ${options?.chii?.embedded ? "script.setAttribute('embedded','true');" : ""}
234
+ document.body.appendChild(script);
235
+ });
236
+ }
237
+ `;
238
+ },
239
+ transformInclude(id) {
240
+ return !!id.split("?")[0].match(/\.[t|j]s$/);
241
+ },
242
+ async transform(source, id) {
243
+ if (options?.enable && enableChii && !resovedInfo.availablePort) {
244
+ resovedInfo.availablePort = await getRandomPort();
245
+ (0, z_chii.start)({ port: resovedInfo.availablePort });
246
+ debug(`chii server port: ${resovedInfo.availablePort}`);
247
+ }
248
+ if (options?.enable && enableChii) {
249
+ const file = id.split("?")[0];
250
+ if (file.startsWith(config?.root || cwd) && !file.includes("node_modules") && file.match(/\.[t|j]s$/) && !isNuxt) return {
251
+ code: `import 'chii-client';\n${source}`,
252
+ map: null
253
+ };
254
+ }
255
+ return {
256
+ code: source,
257
+ map: null
258
+ };
259
+ },
260
+ vite: {
261
+ configResolved(_config) {
262
+ config = _config;
263
+ },
264
+ transformIndexHtml(html) {
265
+ if (options?.enable && enableChii && !isNuxt) {
266
+ const tag = "<script type=\"module\">import 'chii-client';<\/script>";
267
+ if (!html.includes(tag)) return html.replace("</body>", `</body>${tag}\n`);
268
+ }
269
+ return html;
270
+ },
271
+ async configureServer(server) {
272
+ if (!options?.enable) return;
273
+ const _printUrls = server.printUrls.bind(server);
274
+ let source = `localhost:${config.server.port || 5173}`;
275
+ const url = server.resolvedUrls?.local[0];
276
+ if (url) {
277
+ const u = new URL(url);
278
+ source = u.host;
279
+ }
280
+ const base = server.config.base || "/";
281
+ const _targetUrl = options?.targetUrl ?? `http://${source}${base}`;
282
+ server.printUrls = () => {
283
+ _printUrls();
284
+ console.log(` ${picocolors.default.green("➜")} ${picocolors.default.bold("Open in dingtalk")}: ${require_utils.colorUrl(`http://${source}${base}open-dingtalk`)}`);
285
+ if (enableChii) console.log(` ${picocolors.default.green("➜")} ${picocolors.default.bold("Click to open chrome devtools")}: ${require_utils.colorUrl(`http://${source}${base}__chrome_devtools`)}`);
286
+ };
287
+ const targetURL = new URL(_targetUrl);
288
+ targetURL.searchParams.append("ddtab", "true");
289
+ if (options?.corpId) targetURL.searchParams.append("corpId", options.corpId);
290
+ if (options.debugCookies && options.debugCookies.length > 0) server.middlewares.use((req, res, next) => {
291
+ const cookies = cookie.default.parse(req.headers.cookie || "");
292
+ for (const [name, value] of Object.entries(cookies)) if (value && options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
293
+ const serializedCookie = cookie.default.serialize(name, value, { httpOnly: false });
294
+ res.setHeader("Set-Cookie", serializedCookie);
295
+ }
296
+ next();
297
+ });
298
+ if (enableChii) {
299
+ server.middlewares.use("/__chrome_devtools", async (_req, res) => {
300
+ if (!resovedInfo.availablePort) {
301
+ res.writeHead(500, { "Content-Type": "text/plain" });
302
+ res.end("Server not started");
303
+ return;
304
+ }
305
+ res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
306
+ res.write(require___chrome_devtools.getChromeDevtoolsHtml(resovedInfo.availablePort));
307
+ res.end();
308
+ });
309
+ if (!isNuxt) {
310
+ const proxyMiddleware = createProxyMiddleware(debug);
311
+ server.middlewares.use(proxyMiddleware(resovedInfo));
312
+ }
313
+ }
314
+ server.middlewares.use("/open-dingtalk", (req, res) => {
315
+ debug(targetURL.toString());
316
+ res.writeHead(302, { Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}` });
317
+ res.end();
318
+ });
319
+ }
320
+ },
321
+ webpack(compiler) {
322
+ if (!options?.enable) return;
323
+ const devServerOptions = {
324
+ host: "localhost",
325
+ port: 8080,
326
+ ...compiler.options.devServer,
327
+ ...node_process.default.VUE_CLI_SERVICE?.projectOptions.devServer
328
+ };
329
+ const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
330
+ const base = compiler.options.output.publicPath || "/";
331
+ const _targetUrl = options?.targetUrl ?? `http://${source}${base}`;
332
+ compiler.hooks.done.tap("unplugin-dingtalk", () => {
333
+ console.log(` ${picocolors.default.green("➜")} ${picocolors.default.bold("Open in dingtalk")}: ${require_utils.colorUrl(`http://${source}${base}open-dingtalk`)}`);
334
+ if (enableChii) console.log(` ${picocolors.default.green("➜")} ${picocolors.default.bold("Click to open chrome devtools")}: ${require_utils.colorUrl(`http://${source}${base}__chrome_devtools`)}`);
335
+ });
336
+ resovedInfo.targetURL = new URL(_targetUrl);
337
+ resovedInfo.targetURL.searchParams.append("ddtab", "true");
338
+ if (options?.corpId) resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
339
+ },
340
+ async rspack(compiler) {
341
+ if (!options?.enable) return;
342
+ const devServerOptions = {
343
+ host: "localhost",
344
+ port: 8080,
345
+ ...compiler.options.devServer,
346
+ ...(await (await import("@rsbuild/core"))?.loadConfig({ cwd }))?.content?.server
347
+ };
348
+ const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
349
+ const base = compiler.options.output.publicPath || "/";
350
+ const _targetUrl = options?.targetUrl ?? `http://${source}${base}`;
351
+ resovedInfo.targetURL = new URL(_targetUrl);
352
+ resovedInfo.targetURL.searchParams.append("ddtab", "true");
353
+ if (options?.corpId) resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
354
+ console.log(` ${picocolors.default.green("➜")} ${picocolors.default.bold("Open in dingtalk")}: ${require_utils.colorUrl(`http://${source}${base}open-dingtalk`)}`);
355
+ if (enableChii) console.log(` ${picocolors.default.green("➜")} ${picocolors.default.bold("Click to open chrome devtools")}: ${require_utils.colorUrl(`http://${source}${base}__chrome_devtools`)}`);
356
+ }
357
+ };
358
+ return unpluginDing;
359
+ };
360
+ const unplugin$1 = /* @__PURE__ */ (0, unplugin.createUnplugin)(unpluginFactory);
361
+ var src_default = unplugin$1;
362
+
363
+ //#endregion
364
+ Object.defineProperty(exports, 'createProxyMiddleware', {
365
+ enumerable: true,
366
+ get: function () {
367
+ return createProxyMiddleware;
368
+ }
369
+ });
370
+ Object.defineProperty(exports, 'resovedInfo', {
371
+ enumerable: true,
372
+ get: function () {
373
+ return resovedInfo;
374
+ }
375
+ });
376
+ Object.defineProperty(exports, 'src_default', {
377
+ enumerable: true,
378
+ get: function () {
379
+ return src_default;
380
+ }
381
+ });
382
+ Object.defineProperty(exports, 'unplugin', {
383
+ enumerable: true,
384
+ get: function () {
385
+ return unplugin$1;
386
+ }
387
+ });
388
+ Object.defineProperty(exports, 'unpluginFactory', {
389
+ enumerable: true,
390
+ get: function () {
391
+ return unpluginFactory;
392
+ }
393
+ });