unplugin-dingtalk 1007.0.0 → 1007.0.2
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 +1 -0
- package/dist/{__chrome_devtools-CJ3sXpVj.cjs → __chrome_devtools-DXNY3hbb.cjs} +2 -2
- package/dist/{__chrome_devtools-CIQ5zFZx.js → __chrome_devtools-DtQ6IXAu.js} +2 -2
- package/dist/__chrome_devtools.cjs +1 -1
- package/dist/__chrome_devtools.d.cts +1 -1
- package/dist/__chrome_devtools.d.ts +1 -1
- package/dist/__chrome_devtools.js +1 -1
- package/dist/astro.cjs +3 -3
- package/dist/astro.js +3 -3
- package/dist/esbuild.cjs +3 -3
- package/dist/esbuild.js +3 -3
- package/dist/index.cjs +5 -3
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -4
- package/dist/inject-script.cjs +2 -1
- package/dist/inject-script.js +2 -1
- package/dist/nuxt.cjs +22 -407
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +22 -407
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.js +3 -3
- package/dist/rspack.cjs +6 -6
- package/dist/rspack.js +6 -6
- package/dist/{src-hLDO4Q22.cjs → src-7U04DWRB.cjs} +54 -28
- package/dist/{src-BVX_Roo9.js → src-DD2TG884.js} +43 -29
- package/dist/{utils-CmfBxo4J.cjs → utils-3gBRwB2B.cjs} +10 -0
- package/dist/{utils-Chlbb6jf.js → utils-DORRNjr1.js} +5 -1
- package/dist/utils.cjs +2 -1
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +2 -2
- package/dist/{vite-DoBUfGyY.js → vite-BqXPfqlC.js} +2 -2
- package/dist/{vite-CKIDsKJ-.cjs → vite-Ds1Kt2Lk.cjs} +2 -2
- package/dist/vite.cjs +4 -4
- package/dist/vite.js +4 -4
- package/dist/webpack.cjs +6 -6
- package/dist/webpack.js +6 -6
- package/package.json +3 -3
package/dist/nuxt.js
CHANGED
|
@@ -1,408 +1,12 @@
|
|
|
1
|
-
import "./__chrome_devtools-
|
|
2
|
-
import { resovedInfo } from "./src-
|
|
3
|
-
import { colorUrl } from "./utils-
|
|
4
|
-
import { vite_default } from "./vite-
|
|
1
|
+
import "./__chrome_devtools-DtQ6IXAu.js";
|
|
2
|
+
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, resovedInfo } from "./src-DD2TG884.js";
|
|
3
|
+
import { colorUrl, interopDefault } from "./utils-DORRNjr1.js";
|
|
4
|
+
import { vite_default } from "./vite-BqXPfqlC.js";
|
|
5
5
|
import httpProxy from "http-proxy";
|
|
6
6
|
import c from "picocolors";
|
|
7
7
|
import { addDevServerHandler, addServerPlugin, addVitePlugin, createResolver, defineNuxtModule } from "@nuxt/kit";
|
|
8
8
|
import "@nuxt/schema";
|
|
9
9
|
|
|
10
|
-
//#region node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
11
|
-
function isPlainObject(value) {
|
|
12
|
-
if (value === null || typeof value !== "object") return false;
|
|
13
|
-
const prototype = Object.getPrototypeOf(value);
|
|
14
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
15
|
-
if (Symbol.iterator in value) return false;
|
|
16
|
-
if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
20
|
-
if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
21
|
-
const object = Object.assign({}, defaults);
|
|
22
|
-
for (const key in baseObject) {
|
|
23
|
-
if (key === "__proto__" || key === "constructor") continue;
|
|
24
|
-
const value = baseObject[key];
|
|
25
|
-
if (value === null || value === void 0) continue;
|
|
26
|
-
if (merger && merger(object, key, value, namespace)) continue;
|
|
27
|
-
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
28
|
-
else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
29
|
-
else object[key] = value;
|
|
30
|
-
}
|
|
31
|
-
return object;
|
|
32
|
-
}
|
|
33
|
-
function createDefu(merger) {
|
|
34
|
-
return (...arguments_) => arguments_.reduce((p, c$1) => _defu(p, c$1, "", merger), {});
|
|
35
|
-
}
|
|
36
|
-
const defu = createDefu();
|
|
37
|
-
const defuFn = createDefu((object, key, currentValue) => {
|
|
38
|
-
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
39
|
-
object[key] = currentValue(object[key]);
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
const defuArrayFn = createDefu((object, key, currentValue) => {
|
|
44
|
-
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
45
|
-
object[key] = currentValue(object[key]);
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region node_modules/.pnpm/h3@1.15.4/node_modules/h3/dist/index.mjs
|
|
52
|
-
function hasProp(obj, prop) {
|
|
53
|
-
try {
|
|
54
|
-
return prop in obj;
|
|
55
|
-
} catch {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
var H3Error = class extends Error {
|
|
60
|
-
static __h3_error__ = true;
|
|
61
|
-
statusCode = 500;
|
|
62
|
-
fatal = false;
|
|
63
|
-
unhandled = false;
|
|
64
|
-
statusMessage;
|
|
65
|
-
data;
|
|
66
|
-
cause;
|
|
67
|
-
constructor(message, opts = {}) {
|
|
68
|
-
super(message, opts);
|
|
69
|
-
if (opts.cause && !this.cause) this.cause = opts.cause;
|
|
70
|
-
}
|
|
71
|
-
toJSON() {
|
|
72
|
-
const obj = {
|
|
73
|
-
message: this.message,
|
|
74
|
-
statusCode: sanitizeStatusCode(this.statusCode, 500)
|
|
75
|
-
};
|
|
76
|
-
if (this.statusMessage) obj.statusMessage = sanitizeStatusMessage(this.statusMessage);
|
|
77
|
-
if (this.data !== void 0) obj.data = this.data;
|
|
78
|
-
return obj;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
function createError(input) {
|
|
82
|
-
if (typeof input === "string") return new H3Error(input);
|
|
83
|
-
if (isError(input)) return input;
|
|
84
|
-
const err = new H3Error(input.message ?? input.statusMessage ?? "", { cause: input.cause || input });
|
|
85
|
-
if (hasProp(input, "stack")) try {
|
|
86
|
-
Object.defineProperty(err, "stack", { get() {
|
|
87
|
-
return input.stack;
|
|
88
|
-
} });
|
|
89
|
-
} catch {
|
|
90
|
-
try {
|
|
91
|
-
err.stack = input.stack;
|
|
92
|
-
} catch {}
|
|
93
|
-
}
|
|
94
|
-
if (input.data) err.data = input.data;
|
|
95
|
-
if (input.statusCode) err.statusCode = sanitizeStatusCode(input.statusCode, err.statusCode);
|
|
96
|
-
else if (input.status) err.statusCode = sanitizeStatusCode(input.status, err.statusCode);
|
|
97
|
-
if (input.statusMessage) err.statusMessage = input.statusMessage;
|
|
98
|
-
else if (input.statusText) err.statusMessage = input.statusText;
|
|
99
|
-
if (err.statusMessage) {
|
|
100
|
-
const originalMessage = err.statusMessage;
|
|
101
|
-
const sanitizedMessage = sanitizeStatusMessage(err.statusMessage);
|
|
102
|
-
if (sanitizedMessage !== originalMessage) console.warn("[h3] Please prefer using `message` for longer error messages instead of `statusMessage`. In the future, `statusMessage` will be sanitized by default.");
|
|
103
|
-
}
|
|
104
|
-
if (input.fatal !== void 0) err.fatal = input.fatal;
|
|
105
|
-
if (input.unhandled !== void 0) err.unhandled = input.unhandled;
|
|
106
|
-
return err;
|
|
107
|
-
}
|
|
108
|
-
function isError(input) {
|
|
109
|
-
return input?.constructor?.__h3_error__ === true;
|
|
110
|
-
}
|
|
111
|
-
function isMethod(event, expected, allowHead) {
|
|
112
|
-
if (allowHead && event.method === "HEAD") return true;
|
|
113
|
-
if (typeof expected === "string") {
|
|
114
|
-
if (event.method === expected) return true;
|
|
115
|
-
} else if (expected.includes(event.method)) return true;
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
function assertMethod(event, expected, allowHead) {
|
|
119
|
-
if (!isMethod(event, expected, allowHead)) throw createError({
|
|
120
|
-
statusCode: 405,
|
|
121
|
-
statusMessage: "HTTP method is not allowed."
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
function getRequestHeaders(event) {
|
|
125
|
-
const _headers = {};
|
|
126
|
-
for (const key in event.node.req.headers) {
|
|
127
|
-
const val = event.node.req.headers[key];
|
|
128
|
-
_headers[key] = Array.isArray(val) ? val.filter(Boolean).join(", ") : val;
|
|
129
|
-
}
|
|
130
|
-
return _headers;
|
|
131
|
-
}
|
|
132
|
-
const RawBodySymbol = Symbol.for("h3RawBody");
|
|
133
|
-
const ParsedBodySymbol = Symbol.for("h3ParsedBody");
|
|
134
|
-
const PayloadMethods$1 = [
|
|
135
|
-
"PATCH",
|
|
136
|
-
"POST",
|
|
137
|
-
"PUT",
|
|
138
|
-
"DELETE"
|
|
139
|
-
];
|
|
140
|
-
function readRawBody(event, encoding = "utf8") {
|
|
141
|
-
assertMethod(event, PayloadMethods$1);
|
|
142
|
-
const _rawBody = event._requestBody || event.web?.request?.body || event.node.req[RawBodySymbol] || event.node.req.rawBody || event.node.req.body;
|
|
143
|
-
if (_rawBody) {
|
|
144
|
-
const promise2 = Promise.resolve(_rawBody).then((_resolved) => {
|
|
145
|
-
if (Buffer.isBuffer(_resolved)) return _resolved;
|
|
146
|
-
if (typeof _resolved.pipeTo === "function") return new Promise((resolve, reject) => {
|
|
147
|
-
const chunks = [];
|
|
148
|
-
_resolved.pipeTo(new WritableStream({
|
|
149
|
-
write(chunk) {
|
|
150
|
-
chunks.push(chunk);
|
|
151
|
-
},
|
|
152
|
-
close() {
|
|
153
|
-
resolve(Buffer.concat(chunks));
|
|
154
|
-
},
|
|
155
|
-
abort(reason) {
|
|
156
|
-
reject(reason);
|
|
157
|
-
}
|
|
158
|
-
})).catch(reject);
|
|
159
|
-
});
|
|
160
|
-
else if (typeof _resolved.pipe === "function") return new Promise((resolve, reject) => {
|
|
161
|
-
const chunks = [];
|
|
162
|
-
_resolved.on("data", (chunk) => {
|
|
163
|
-
chunks.push(chunk);
|
|
164
|
-
}).on("end", () => {
|
|
165
|
-
resolve(Buffer.concat(chunks));
|
|
166
|
-
}).on("error", reject);
|
|
167
|
-
});
|
|
168
|
-
if (_resolved.constructor === Object) return Buffer.from(JSON.stringify(_resolved));
|
|
169
|
-
if (_resolved instanceof URLSearchParams) return Buffer.from(_resolved.toString());
|
|
170
|
-
if (_resolved instanceof FormData) return new Response(_resolved).bytes().then((uint8arr) => Buffer.from(uint8arr));
|
|
171
|
-
return Buffer.from(_resolved);
|
|
172
|
-
});
|
|
173
|
-
return encoding ? promise2.then((buff) => buff.toString(encoding)) : promise2;
|
|
174
|
-
}
|
|
175
|
-
if (!Number.parseInt(event.node.req.headers["content-length"] || "") && !String(event.node.req.headers["transfer-encoding"] ?? "").split(",").map((e) => e.trim()).filter(Boolean).includes("chunked")) return Promise.resolve(void 0);
|
|
176
|
-
const promise = event.node.req[RawBodySymbol] = new Promise((resolve, reject) => {
|
|
177
|
-
const bodyData = [];
|
|
178
|
-
event.node.req.on("error", (err) => {
|
|
179
|
-
reject(err);
|
|
180
|
-
}).on("data", (chunk) => {
|
|
181
|
-
bodyData.push(chunk);
|
|
182
|
-
}).on("end", () => {
|
|
183
|
-
resolve(Buffer.concat(bodyData));
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
const result = encoding ? promise.then((buff) => buff.toString(encoding)) : promise;
|
|
187
|
-
return result;
|
|
188
|
-
}
|
|
189
|
-
function getRequestWebStream(event) {
|
|
190
|
-
if (!PayloadMethods$1.includes(event.method)) return;
|
|
191
|
-
const bodyStream = event.web?.request?.body || event._requestBody;
|
|
192
|
-
if (bodyStream) return bodyStream;
|
|
193
|
-
const _hasRawBody = RawBodySymbol in event.node.req || "rawBody" in event.node.req || "body" in event.node.req || "__unenv__" in event.node.req;
|
|
194
|
-
if (_hasRawBody) return new ReadableStream({ async start(controller) {
|
|
195
|
-
const _rawBody = await readRawBody(event, false);
|
|
196
|
-
if (_rawBody) controller.enqueue(_rawBody);
|
|
197
|
-
controller.close();
|
|
198
|
-
} });
|
|
199
|
-
return new ReadableStream({ start: (controller) => {
|
|
200
|
-
event.node.req.on("data", (chunk) => {
|
|
201
|
-
controller.enqueue(chunk);
|
|
202
|
-
});
|
|
203
|
-
event.node.req.on("end", () => {
|
|
204
|
-
controller.close();
|
|
205
|
-
});
|
|
206
|
-
event.node.req.on("error", (err) => {
|
|
207
|
-
controller.error(err);
|
|
208
|
-
});
|
|
209
|
-
} });
|
|
210
|
-
}
|
|
211
|
-
const DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
|
|
212
|
-
function sanitizeStatusMessage(statusMessage = "") {
|
|
213
|
-
return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
|
|
214
|
-
}
|
|
215
|
-
function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
|
|
216
|
-
if (!statusCode) return defaultStatusCode;
|
|
217
|
-
if (typeof statusCode === "string") statusCode = Number.parseInt(statusCode, 10);
|
|
218
|
-
if (statusCode < 100 || statusCode > 999) return defaultStatusCode;
|
|
219
|
-
return statusCode;
|
|
220
|
-
}
|
|
221
|
-
function splitCookiesString(cookiesString) {
|
|
222
|
-
if (Array.isArray(cookiesString)) return cookiesString.flatMap((c$1) => splitCookiesString(c$1));
|
|
223
|
-
if (typeof cookiesString !== "string") return [];
|
|
224
|
-
const cookiesStrings = [];
|
|
225
|
-
let pos = 0;
|
|
226
|
-
let start;
|
|
227
|
-
let ch;
|
|
228
|
-
let lastComma;
|
|
229
|
-
let nextStart;
|
|
230
|
-
let cookiesSeparatorFound;
|
|
231
|
-
const skipWhitespace = () => {
|
|
232
|
-
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) pos += 1;
|
|
233
|
-
return pos < cookiesString.length;
|
|
234
|
-
};
|
|
235
|
-
const notSpecialChar = () => {
|
|
236
|
-
ch = cookiesString.charAt(pos);
|
|
237
|
-
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
238
|
-
};
|
|
239
|
-
while (pos < cookiesString.length) {
|
|
240
|
-
start = pos;
|
|
241
|
-
cookiesSeparatorFound = false;
|
|
242
|
-
while (skipWhitespace()) {
|
|
243
|
-
ch = cookiesString.charAt(pos);
|
|
244
|
-
if (ch === ",") {
|
|
245
|
-
lastComma = pos;
|
|
246
|
-
pos += 1;
|
|
247
|
-
skipWhitespace();
|
|
248
|
-
nextStart = pos;
|
|
249
|
-
while (pos < cookiesString.length && notSpecialChar()) pos += 1;
|
|
250
|
-
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
251
|
-
cookiesSeparatorFound = true;
|
|
252
|
-
pos = nextStart;
|
|
253
|
-
cookiesStrings.push(cookiesString.slice(start, lastComma));
|
|
254
|
-
start = pos;
|
|
255
|
-
} else pos = lastComma + 1;
|
|
256
|
-
} else pos += 1;
|
|
257
|
-
}
|
|
258
|
-
if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.slice(start));
|
|
259
|
-
}
|
|
260
|
-
return cookiesStrings;
|
|
261
|
-
}
|
|
262
|
-
const PayloadMethods = /* @__PURE__ */ new Set([
|
|
263
|
-
"PATCH",
|
|
264
|
-
"POST",
|
|
265
|
-
"PUT",
|
|
266
|
-
"DELETE"
|
|
267
|
-
]);
|
|
268
|
-
const ignoredHeaders = /* @__PURE__ */ new Set([
|
|
269
|
-
"transfer-encoding",
|
|
270
|
-
"accept-encoding",
|
|
271
|
-
"connection",
|
|
272
|
-
"keep-alive",
|
|
273
|
-
"upgrade",
|
|
274
|
-
"expect",
|
|
275
|
-
"host",
|
|
276
|
-
"accept"
|
|
277
|
-
]);
|
|
278
|
-
async function proxyRequest(event, target, opts = {}) {
|
|
279
|
-
let body;
|
|
280
|
-
let duplex;
|
|
281
|
-
if (PayloadMethods.has(event.method)) if (opts.streamRequest) {
|
|
282
|
-
body = getRequestWebStream(event);
|
|
283
|
-
duplex = "half";
|
|
284
|
-
} else body = await readRawBody(event, false).catch(() => void 0);
|
|
285
|
-
const method = opts.fetchOptions?.method || event.method;
|
|
286
|
-
const fetchHeaders = mergeHeaders(getProxyRequestHeaders(event, { host: target.startsWith("/") }), opts.fetchOptions?.headers, opts.headers);
|
|
287
|
-
return sendProxy(event, target, {
|
|
288
|
-
...opts,
|
|
289
|
-
fetchOptions: {
|
|
290
|
-
method,
|
|
291
|
-
body,
|
|
292
|
-
duplex,
|
|
293
|
-
...opts.fetchOptions,
|
|
294
|
-
headers: fetchHeaders
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
async function sendProxy(event, target, opts = {}) {
|
|
299
|
-
let response;
|
|
300
|
-
try {
|
|
301
|
-
response = await _getFetch(opts.fetch)(target, {
|
|
302
|
-
headers: opts.headers,
|
|
303
|
-
ignoreResponseError: true,
|
|
304
|
-
...opts.fetchOptions
|
|
305
|
-
});
|
|
306
|
-
} catch (error) {
|
|
307
|
-
throw createError({
|
|
308
|
-
status: 502,
|
|
309
|
-
statusMessage: "Bad Gateway",
|
|
310
|
-
cause: error
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
event.node.res.statusCode = sanitizeStatusCode(response.status, event.node.res.statusCode);
|
|
314
|
-
event.node.res.statusMessage = sanitizeStatusMessage(response.statusText);
|
|
315
|
-
const cookies = [];
|
|
316
|
-
for (const [key, value] of response.headers.entries()) {
|
|
317
|
-
if (key === "content-encoding") continue;
|
|
318
|
-
if (key === "content-length") continue;
|
|
319
|
-
if (key === "set-cookie") {
|
|
320
|
-
cookies.push(...splitCookiesString(value));
|
|
321
|
-
continue;
|
|
322
|
-
}
|
|
323
|
-
event.node.res.setHeader(key, value);
|
|
324
|
-
}
|
|
325
|
-
if (cookies.length > 0) event.node.res.setHeader("set-cookie", cookies.map((cookie) => {
|
|
326
|
-
if (opts.cookieDomainRewrite) cookie = rewriteCookieProperty(cookie, opts.cookieDomainRewrite, "domain");
|
|
327
|
-
if (opts.cookiePathRewrite) cookie = rewriteCookieProperty(cookie, opts.cookiePathRewrite, "path");
|
|
328
|
-
return cookie;
|
|
329
|
-
}));
|
|
330
|
-
if (opts.onResponse) await opts.onResponse(event, response);
|
|
331
|
-
if (response._data !== void 0) return response._data;
|
|
332
|
-
if (event.handled) return;
|
|
333
|
-
if (opts.sendStream === false) {
|
|
334
|
-
const data = new Uint8Array(await response.arrayBuffer());
|
|
335
|
-
return event.node.res.end(data);
|
|
336
|
-
}
|
|
337
|
-
if (response.body) for await (const chunk of response.body) event.node.res.write(chunk);
|
|
338
|
-
return event.node.res.end();
|
|
339
|
-
}
|
|
340
|
-
function getProxyRequestHeaders(event, opts) {
|
|
341
|
-
const headers = /* @__PURE__ */ Object.create(null);
|
|
342
|
-
const reqHeaders = getRequestHeaders(event);
|
|
343
|
-
for (const name in reqHeaders) if (!ignoredHeaders.has(name) || name === "host" && opts?.host) headers[name] = reqHeaders[name];
|
|
344
|
-
return headers;
|
|
345
|
-
}
|
|
346
|
-
function _getFetch(_fetch) {
|
|
347
|
-
if (_fetch) return _fetch;
|
|
348
|
-
if (globalThis.fetch) return globalThis.fetch;
|
|
349
|
-
throw new Error("fetch is not available. Try importing `node-fetch-native/polyfill` for Node.js.");
|
|
350
|
-
}
|
|
351
|
-
function rewriteCookieProperty(header, map, property) {
|
|
352
|
-
const _map = typeof map === "string" ? { "*": map } : map;
|
|
353
|
-
return header.replace(new RegExp(`(;\\s*${property}=)([^;]+)`, "gi"), (match, prefix, previousValue) => {
|
|
354
|
-
let newValue;
|
|
355
|
-
if (previousValue in _map) newValue = _map[previousValue];
|
|
356
|
-
else if ("*" in _map) newValue = _map["*"];
|
|
357
|
-
else return match;
|
|
358
|
-
return newValue ? prefix + newValue : "";
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
function mergeHeaders(defaults, ...inputs) {
|
|
362
|
-
const _inputs = inputs.filter(Boolean);
|
|
363
|
-
if (_inputs.length === 0) return defaults;
|
|
364
|
-
const merged = new Headers(defaults);
|
|
365
|
-
for (const input of _inputs) {
|
|
366
|
-
const entries = Array.isArray(input) ? input : typeof input.entries === "function" ? input.entries() : Object.entries(input);
|
|
367
|
-
for (const [key, value] of entries) if (value !== void 0) merged.set(key, value);
|
|
368
|
-
}
|
|
369
|
-
return merged;
|
|
370
|
-
}
|
|
371
|
-
const getSessionPromise = Symbol("getSession");
|
|
372
|
-
function defineEventHandler(handler) {
|
|
373
|
-
if (typeof handler === "function") {
|
|
374
|
-
handler.__is_handler__ = true;
|
|
375
|
-
return handler;
|
|
376
|
-
}
|
|
377
|
-
const _hooks = {
|
|
378
|
-
onRequest: _normalizeArray(handler.onRequest),
|
|
379
|
-
onBeforeResponse: _normalizeArray(handler.onBeforeResponse)
|
|
380
|
-
};
|
|
381
|
-
const _handler = (event) => {
|
|
382
|
-
return _callHandler(event, handler.handler, _hooks);
|
|
383
|
-
};
|
|
384
|
-
_handler.__is_handler__ = true;
|
|
385
|
-
_handler.__resolve__ = handler.handler.__resolve__;
|
|
386
|
-
_handler.__websocket__ = handler.websocket;
|
|
387
|
-
return _handler;
|
|
388
|
-
}
|
|
389
|
-
function _normalizeArray(input) {
|
|
390
|
-
return input ? Array.isArray(input) ? input : [input] : void 0;
|
|
391
|
-
}
|
|
392
|
-
async function _callHandler(event, handler, hooks) {
|
|
393
|
-
if (hooks.onRequest) for (const hook of hooks.onRequest) {
|
|
394
|
-
await hook(event);
|
|
395
|
-
if (event.handled) return;
|
|
396
|
-
}
|
|
397
|
-
const body = await handler(event);
|
|
398
|
-
const response = { body };
|
|
399
|
-
if (hooks.onBeforeResponse) for (const hook of hooks.onBeforeResponse) await hook(event, response);
|
|
400
|
-
return response.body;
|
|
401
|
-
}
|
|
402
|
-
const H3Headers = globalThis.Headers;
|
|
403
|
-
const H3Response = globalThis.Response;
|
|
404
|
-
|
|
405
|
-
//#endregion
|
|
406
10
|
//#region src/nuxt.ts
|
|
407
11
|
var nuxt_default = defineNuxtModule({
|
|
408
12
|
meta: {
|
|
@@ -413,27 +17,31 @@ var nuxt_default = defineNuxtModule({
|
|
|
413
17
|
async setup(options, _nuxt) {
|
|
414
18
|
if (!_nuxt.options.dev) return;
|
|
415
19
|
if (!options.enable) return;
|
|
20
|
+
const { defineEventHandler, proxyRequest } = await interopDefault(await import("h3"));
|
|
416
21
|
function debug(...args) {
|
|
417
22
|
if (options?.debug) console.log(` ${c.yellow("DEBUG")} `, ...args);
|
|
418
23
|
}
|
|
419
24
|
const { chii } = options || {};
|
|
420
25
|
const enableChii = chii?.enable !== false;
|
|
421
|
-
_nuxt.options.runtimeConfig.unpluginDingtalk = {
|
|
26
|
+
_nuxt.options.runtimeConfig.unpluginDingtalk = {
|
|
27
|
+
chiiEmbedded: chii?.embedded ?? false,
|
|
28
|
+
chiiProxyPath: CHII_PROXY_PATH
|
|
29
|
+
};
|
|
422
30
|
if (enableChii) {
|
|
423
31
|
const resolver = createResolver(import.meta.url);
|
|
424
32
|
addServerPlugin(resolver.resolve("./inject-script"));
|
|
425
33
|
let proxy = null;
|
|
426
34
|
addDevServerHandler({
|
|
427
|
-
route:
|
|
35
|
+
route: CHII_PROXY_PATH,
|
|
428
36
|
handler: defineEventHandler(async (event) => {
|
|
429
|
-
if (resovedInfo.availablePort) return proxyRequest(event, `http://localhost:${resovedInfo.availablePort}${event.path}`);
|
|
37
|
+
if (resovedInfo.availablePort) return proxyRequest(event, `http://localhost:${resovedInfo.availablePort}${event.path.replace(CHII_PROXY_PATH, "")}`);
|
|
430
38
|
})
|
|
431
39
|
});
|
|
432
40
|
_nuxt.hook("listen", (server) => {
|
|
433
41
|
const originalUpgradeListeners = server.listeners("upgrade").slice();
|
|
434
42
|
server.removeAllListeners("upgrade");
|
|
435
43
|
server.on("upgrade", (req, socket, head) => {
|
|
436
|
-
if (req.url?.startsWith(
|
|
44
|
+
if (req.url?.startsWith(CHII_PROXY_PATH)) {
|
|
437
45
|
debug("WS upgrade:", req.url);
|
|
438
46
|
if (!proxy && resovedInfo.availablePort) {
|
|
439
47
|
proxy = httpProxy.createProxyServer({
|
|
@@ -445,7 +53,7 @@ var nuxt_default = defineNuxtModule({
|
|
|
445
53
|
});
|
|
446
54
|
}
|
|
447
55
|
if (proxy) {
|
|
448
|
-
req.url = req.url.replace(
|
|
56
|
+
req.url = req.url.replace(CHII_PROXY_PATH, "");
|
|
449
57
|
socket.on("error", (err) => {
|
|
450
58
|
debug("Socket error:", err.message);
|
|
451
59
|
});
|
|
@@ -461,14 +69,21 @@ var nuxt_default = defineNuxtModule({
|
|
|
461
69
|
for (const listener of originalUpgradeListeners) listener.call(server, req, socket, head);
|
|
462
70
|
});
|
|
463
71
|
});
|
|
72
|
+
addDevServerHandler({
|
|
73
|
+
route: CHII_DEVTOOLS_PATH,
|
|
74
|
+
handler: defineEventHandler(async (event) => {
|
|
75
|
+
if (!resovedInfo.availablePort) return "Server not started";
|
|
76
|
+
const { getChromeDevtoolsHtml } = await import("./__chrome_devtools.js");
|
|
77
|
+
return getChromeDevtoolsHtml(resovedInfo.availablePort, CHII_PROXY_PATH);
|
|
78
|
+
})
|
|
79
|
+
});
|
|
464
80
|
}
|
|
465
81
|
const vitePlugins = await vite_default(options);
|
|
466
82
|
addVitePlugin(vitePlugins);
|
|
467
83
|
_nuxt.hook("listen", (_, listener) => {
|
|
468
84
|
const url = listener.url;
|
|
469
85
|
const source = new URL(url).host;
|
|
470
|
-
|
|
471
|
-
if (enableChii) console.log(` ${c.green("➜")} ${c.bold("Click to open chrome devtools")}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
|
|
86
|
+
if (enableChii) console.log(` ${c.green("➜")} ${c.bold("Click to open chrome devtools")}: ${colorUrl(`http://${source.replace("0.0.0.0", "localhost")}${CHII_DEVTOOLS_PATH}`)}`);
|
|
472
87
|
});
|
|
473
88
|
}
|
|
474
89
|
});
|
package/dist/rollup.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
require('./__chrome_devtools-
|
|
3
|
-
const require_src = require('./src-
|
|
4
|
-
require('./utils-
|
|
2
|
+
require('./__chrome_devtools-DXNY3hbb.cjs');
|
|
3
|
+
const require_src = require('./src-7U04DWRB.cjs');
|
|
4
|
+
require('./utils-3gBRwB2B.cjs');
|
|
5
5
|
const unplugin = require_chunk.__toESM(require("unplugin"));
|
|
6
6
|
|
|
7
7
|
//#region src/rollup.ts
|
package/dist/rollup.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./__chrome_devtools-
|
|
2
|
-
import { unpluginFactory } from "./src-
|
|
3
|
-
import "./utils-
|
|
1
|
+
import "./__chrome_devtools-DtQ6IXAu.js";
|
|
2
|
+
import { unpluginFactory } from "./src-DD2TG884.js";
|
|
3
|
+
import "./utils-DORRNjr1.js";
|
|
4
4
|
import { createRollupPlugin } from "unplugin";
|
|
5
5
|
|
|
6
6
|
//#region src/rollup.ts
|
package/dist/rspack.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require___chrome_devtools = require('./__chrome_devtools-
|
|
3
|
-
const require_src = require('./src-
|
|
4
|
-
require('./utils-
|
|
2
|
+
const require___chrome_devtools = require('./__chrome_devtools-DXNY3hbb.cjs');
|
|
3
|
+
const require_src = require('./src-7U04DWRB.cjs');
|
|
4
|
+
require('./utils-3gBRwB2B.cjs');
|
|
5
5
|
const cookie = require_chunk.__toESM(require("cookie"));
|
|
6
6
|
const picocolors = require_chunk.__toESM(require("picocolors"));
|
|
7
7
|
const unplugin = require_chunk.__toESM(require("unplugin"));
|
|
@@ -25,10 +25,10 @@ var rspack_default = (options) => {
|
|
|
25
25
|
});
|
|
26
26
|
if (enableChii) {
|
|
27
27
|
middlewares.unshift(async (req, res, next) => {
|
|
28
|
-
if (req.url !==
|
|
28
|
+
if (req.url !== require_src.CHII_DEVTOOLS_PATH) return next();
|
|
29
29
|
try {
|
|
30
30
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
31
|
-
res.write(require___chrome_devtools.getChromeDevtoolsHtml(require_src.resovedInfo.availablePort));
|
|
31
|
+
res.write(require___chrome_devtools.getChromeDevtoolsHtml(require_src.resovedInfo.availablePort, require_src.CHII_PROXY_PATH));
|
|
32
32
|
res.end();
|
|
33
33
|
} catch (error) {
|
|
34
34
|
debug(`${error}`);
|
|
@@ -36,7 +36,7 @@ var rspack_default = (options) => {
|
|
|
36
36
|
res.end();
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
const proxyMiddleware = require_src.createProxyMiddleware(debug);
|
|
39
|
+
const proxyMiddleware = require_src.createProxyMiddleware(debug, require_src.CHII_PROXY_PATH);
|
|
40
40
|
middlewares.unshift(proxyMiddleware(require_src.resovedInfo));
|
|
41
41
|
}
|
|
42
42
|
middlewares.unshift((req, res, next) => {
|
package/dist/rspack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getChromeDevtoolsHtml } from "./__chrome_devtools-
|
|
2
|
-
import { createProxyMiddleware, resovedInfo, unpluginFactory } from "./src-
|
|
3
|
-
import "./utils-
|
|
1
|
+
import { getChromeDevtoolsHtml } from "./__chrome_devtools-DtQ6IXAu.js";
|
|
2
|
+
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, createProxyMiddleware, resovedInfo, unpluginFactory } from "./src-DD2TG884.js";
|
|
3
|
+
import "./utils-DORRNjr1.js";
|
|
4
4
|
import cookie from "cookie";
|
|
5
5
|
import c from "picocolors";
|
|
6
6
|
import { createRspackPlugin } from "unplugin";
|
|
@@ -24,10 +24,10 @@ var rspack_default = (options) => {
|
|
|
24
24
|
});
|
|
25
25
|
if (enableChii) {
|
|
26
26
|
middlewares.unshift(async (req, res, next) => {
|
|
27
|
-
if (req.url !==
|
|
27
|
+
if (req.url !== CHII_DEVTOOLS_PATH) return next();
|
|
28
28
|
try {
|
|
29
29
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
30
|
-
res.write(getChromeDevtoolsHtml(resovedInfo.availablePort));
|
|
30
|
+
res.write(getChromeDevtoolsHtml(resovedInfo.availablePort, CHII_PROXY_PATH));
|
|
31
31
|
res.end();
|
|
32
32
|
} catch (error) {
|
|
33
33
|
debug(`${error}`);
|
|
@@ -35,7 +35,7 @@ var rspack_default = (options) => {
|
|
|
35
35
|
res.end();
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
const proxyMiddleware = createProxyMiddleware(debug);
|
|
38
|
+
const proxyMiddleware = createProxyMiddleware(debug, CHII_PROXY_PATH);
|
|
39
39
|
middlewares.unshift(proxyMiddleware(resovedInfo));
|
|
40
40
|
}
|
|
41
41
|
middlewares.unshift((req, res, next) => {
|