unplugin-dingtalk 1007.0.2 → 1007.0.4
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/astro.cjs +1 -1
- package/dist/astro.js +1 -1
- package/dist/esbuild.cjs +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -2
- package/dist/inject-script.cjs +4 -1
- package/dist/inject-script.js +4 -1
- package/dist/nuxt.cjs +10 -3
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +10 -3
- package/dist/rollup.cjs +1 -1
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +8 -1
- package/dist/rspack.js +8 -1
- package/dist/{src-DD2TG884.js → src-A2d59vC1.js} +53 -43
- package/dist/{src-7U04DWRB.cjs → src-BLZWmyh2.cjs} +64 -42
- package/dist/{vite-Ds1Kt2Lk.cjs → vite-DQmwOfnq.cjs} +1 -1
- package/dist/{vite-BqXPfqlC.js → vite-DfU_xlRr.js} +1 -1
- package/dist/vite.cjs +2 -2
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +7 -1
- package/dist/webpack.js +7 -1
- package/package.json +1 -1
package/dist/astro.cjs
CHANGED
package/dist/astro.js
CHANGED
package/dist/esbuild.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
2
|
require('./__chrome_devtools-DXNY3hbb.cjs');
|
|
3
|
-
const require_src = require('./src-
|
|
3
|
+
const require_src = require('./src-BLZWmyh2.cjs');
|
|
4
4
|
require('./utils-3gBRwB2B.cjs');
|
|
5
5
|
const unplugin = require_chunk.__toESM(require("unplugin"));
|
|
6
6
|
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
require('./__chrome_devtools-DXNY3hbb.cjs');
|
|
3
|
-
const require_src = require('./src-
|
|
3
|
+
const require_src = require('./src-BLZWmyh2.cjs');
|
|
4
4
|
require('./utils-3gBRwB2B.cjs');
|
|
5
5
|
|
|
6
6
|
exports.CHII_DEVTOOLS_PATH = require_src.CHII_DEVTOOLS_PATH;
|
|
7
7
|
exports.CHII_PROXY_PATH = require_src.CHII_PROXY_PATH;
|
|
8
|
+
exports.VIRTUAL_CHII_CLIENT = require_src.VIRTUAL_CHII_CLIENT;
|
|
8
9
|
exports.createProxyMiddleware = require_src.createProxyMiddleware;
|
|
9
10
|
exports.default = require_src.src_default;
|
|
11
|
+
exports.getChiiClientModuleCode = require_src.getChiiClientModuleCode;
|
|
10
12
|
exports.resovedInfo = require_src.resovedInfo;
|
|
11
13
|
exports.unplugin = require_src.unplugin;
|
|
12
14
|
exports.unpluginFactory = require_src.unpluginFactory;
|
package/dist/index.d.cts
CHANGED
|
@@ -6,6 +6,7 @@ import { Connect } from "vite";
|
|
|
6
6
|
//#region src/index.d.ts
|
|
7
7
|
declare const CHII_PROXY_PATH: string;
|
|
8
8
|
declare const CHII_DEVTOOLS_PATH: string;
|
|
9
|
+
declare const VIRTUAL_CHII_CLIENT: string;
|
|
9
10
|
declare const resovedInfo: {
|
|
10
11
|
availablePort: number | undefined;
|
|
11
12
|
targetURL: undefined | URL;
|
|
@@ -13,7 +14,8 @@ declare const resovedInfo: {
|
|
|
13
14
|
declare function createProxyMiddleware(debug: typeof console.debug, proxyPath: string): (resolvedInfo: {
|
|
14
15
|
availablePort?: number;
|
|
15
16
|
}) => Connect.NextHandleFunction;
|
|
17
|
+
declare function getChiiClientModuleCode(embedded: boolean): string;
|
|
16
18
|
declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
|
|
17
19
|
declare const unplugin: unplugin0.UnpluginInstance<Options | undefined, boolean>;
|
|
18
20
|
//#endregion
|
|
19
|
-
export { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, createProxyMiddleware, unplugin as default, unplugin, resovedInfo, unpluginFactory };
|
|
21
|
+
export { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, VIRTUAL_CHII_CLIENT, createProxyMiddleware, unplugin as default, unplugin, getChiiClientModuleCode, resovedInfo, unpluginFactory };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Connect } from "vite";
|
|
|
6
6
|
//#region src/index.d.ts
|
|
7
7
|
declare const CHII_PROXY_PATH: string;
|
|
8
8
|
declare const CHII_DEVTOOLS_PATH: string;
|
|
9
|
+
declare const VIRTUAL_CHII_CLIENT: string;
|
|
9
10
|
declare const resovedInfo: {
|
|
10
11
|
availablePort: number | undefined;
|
|
11
12
|
targetURL: undefined | URL;
|
|
@@ -13,7 +14,8 @@ declare const resovedInfo: {
|
|
|
13
14
|
declare function createProxyMiddleware(debug: typeof console.debug, proxyPath: string): (resolvedInfo: {
|
|
14
15
|
availablePort?: number;
|
|
15
16
|
}) => Connect.NextHandleFunction;
|
|
17
|
+
declare function getChiiClientModuleCode(embedded: boolean): string;
|
|
16
18
|
declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
|
|
17
19
|
declare const unplugin: unplugin0.UnpluginInstance<Options | undefined, boolean>;
|
|
18
20
|
//#endregion
|
|
19
|
-
export { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, createProxyMiddleware, unplugin as default, unplugin, resovedInfo, unpluginFactory };
|
|
21
|
+
export { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, VIRTUAL_CHII_CLIENT, createProxyMiddleware, unplugin as default, unplugin, getChiiClientModuleCode, resovedInfo, unpluginFactory };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./__chrome_devtools-DtQ6IXAu.js";
|
|
2
|
-
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, createProxyMiddleware, resovedInfo, src_default, unplugin, unpluginFactory } from "./src-
|
|
2
|
+
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, VIRTUAL_CHII_CLIENT, createProxyMiddleware, getChiiClientModuleCode, resovedInfo, src_default, unplugin, unpluginFactory } from "./src-A2d59vC1.js";
|
|
3
3
|
import "./utils-DORRNjr1.js";
|
|
4
4
|
|
|
5
|
-
export { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, createProxyMiddleware, src_default as default, resovedInfo, unplugin, unpluginFactory };
|
|
5
|
+
export { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, VIRTUAL_CHII_CLIENT, createProxyMiddleware, src_default as default, getChiiClientModuleCode, resovedInfo, unplugin, unpluginFactory };
|
package/dist/inject-script.cjs
CHANGED
|
@@ -7,7 +7,10 @@ var inject_script_default = (0, __imports.defineNitroPlugin)((nitroApp) => {
|
|
|
7
7
|
const config = (0, __imports.useRuntimeConfig)();
|
|
8
8
|
const embedded = config.unpluginDingtalk?.chiiEmbedded ?? false;
|
|
9
9
|
const proxyPath = config.unpluginDingtalk?.chiiProxyPath || "/__chii_proxy";
|
|
10
|
-
const
|
|
10
|
+
const clientPath = config.unpluginDingtalk?.chiiClientPath;
|
|
11
|
+
let scriptTag = "";
|
|
12
|
+
if (clientPath) scriptTag = `<script type="module">import '${clientPath}';<\/script>`;
|
|
13
|
+
else scriptTag = embedded ? `<script src="${proxyPath}/target.js" embedded="true"><\/script>` : `<script src="${proxyPath}/target.js"><\/script>`;
|
|
11
14
|
html.bodyAppend.push(scriptTag);
|
|
12
15
|
});
|
|
13
16
|
});
|
package/dist/inject-script.js
CHANGED
|
@@ -6,7 +6,10 @@ var inject_script_default = defineNitroPlugin((nitroApp) => {
|
|
|
6
6
|
const config = useRuntimeConfig();
|
|
7
7
|
const embedded = config.unpluginDingtalk?.chiiEmbedded ?? false;
|
|
8
8
|
const proxyPath = config.unpluginDingtalk?.chiiProxyPath || "/__chii_proxy";
|
|
9
|
-
const
|
|
9
|
+
const clientPath = config.unpluginDingtalk?.chiiClientPath;
|
|
10
|
+
let scriptTag = "";
|
|
11
|
+
if (clientPath) scriptTag = `<script type="module">import '${clientPath}';<\/script>`;
|
|
12
|
+
else scriptTag = embedded ? `<script src="${proxyPath}/target.js" embedded="true"><\/script>` : `<script src="${proxyPath}/target.js"><\/script>`;
|
|
10
13
|
html.bodyAppend.push(scriptTag);
|
|
11
14
|
});
|
|
12
15
|
});
|
package/dist/nuxt.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
2
|
require('./__chrome_devtools-DXNY3hbb.cjs');
|
|
3
|
-
const require_src = require('./src-
|
|
3
|
+
const require_src = require('./src-BLZWmyh2.cjs');
|
|
4
4
|
const require_utils = require('./utils-3gBRwB2B.cjs');
|
|
5
|
-
const require_vite = require('./vite-
|
|
5
|
+
const require_vite = require('./vite-DQmwOfnq.cjs');
|
|
6
6
|
const http_proxy = require_chunk.__toESM(require("http-proxy"));
|
|
7
7
|
const picocolors = require_chunk.__toESM(require("picocolors"));
|
|
8
8
|
const __nuxt_kit = require_chunk.__toESM(require("@nuxt/kit"));
|
|
@@ -26,7 +26,8 @@ var nuxt_default = (0, __nuxt_kit.defineNuxtModule)({
|
|
|
26
26
|
const enableChii = chii?.enable !== false;
|
|
27
27
|
_nuxt.options.runtimeConfig.unpluginDingtalk = {
|
|
28
28
|
chiiEmbedded: chii?.embedded ?? false,
|
|
29
|
-
chiiProxyPath: require_src.CHII_PROXY_PATH
|
|
29
|
+
chiiProxyPath: require_src.CHII_PROXY_PATH,
|
|
30
|
+
chiiClientPath: require_src.VIRTUAL_CHII_CLIENT
|
|
30
31
|
};
|
|
31
32
|
if (enableChii) {
|
|
32
33
|
const resolver = (0, __nuxt_kit.createResolver)(require("url").pathToFileURL(__filename).href);
|
|
@@ -70,6 +71,12 @@ var nuxt_default = (0, __nuxt_kit.defineNuxtModule)({
|
|
|
70
71
|
for (const listener of originalUpgradeListeners) listener.call(server, req, socket, head);
|
|
71
72
|
});
|
|
72
73
|
});
|
|
74
|
+
(0, __nuxt_kit.addDevServerHandler)({
|
|
75
|
+
route: require_src.VIRTUAL_CHII_CLIENT,
|
|
76
|
+
handler: defineEventHandler(async () => {
|
|
77
|
+
return require_src.getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
78
|
+
})
|
|
79
|
+
});
|
|
73
80
|
(0, __nuxt_kit.addDevServerHandler)({
|
|
74
81
|
route: require_src.CHII_DEVTOOLS_PATH,
|
|
75
82
|
handler: defineEventHandler(async (event) => {
|
package/dist/nuxt.d.cts
CHANGED
|
@@ -3,6 +3,6 @@ import * as _nuxt_schema0 from "@nuxt/schema";
|
|
|
3
3
|
|
|
4
4
|
//#region src/nuxt.d.ts
|
|
5
5
|
interface ModuleOptions extends Options {}
|
|
6
|
-
declare const _default: _nuxt_schema0.NuxtModule<ModuleOptions>;
|
|
6
|
+
declare const _default: _nuxt_schema0.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { ModuleOptions, _default as default };
|
package/dist/nuxt.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import * as _nuxt_schema0 from "@nuxt/schema";
|
|
|
3
3
|
|
|
4
4
|
//#region src/nuxt.d.ts
|
|
5
5
|
interface ModuleOptions extends Options {}
|
|
6
|
-
declare const _default: _nuxt_schema0.NuxtModule<ModuleOptions>;
|
|
6
|
+
declare const _default: _nuxt_schema0.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { ModuleOptions, _default as default };
|
package/dist/nuxt.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./__chrome_devtools-DtQ6IXAu.js";
|
|
2
|
-
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, resovedInfo } from "./src-
|
|
2
|
+
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, VIRTUAL_CHII_CLIENT, getChiiClientModuleCode, resovedInfo } from "./src-A2d59vC1.js";
|
|
3
3
|
import { colorUrl, interopDefault } from "./utils-DORRNjr1.js";
|
|
4
|
-
import { vite_default } from "./vite-
|
|
4
|
+
import { vite_default } from "./vite-DfU_xlRr.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";
|
|
@@ -25,7 +25,8 @@ var nuxt_default = defineNuxtModule({
|
|
|
25
25
|
const enableChii = chii?.enable !== false;
|
|
26
26
|
_nuxt.options.runtimeConfig.unpluginDingtalk = {
|
|
27
27
|
chiiEmbedded: chii?.embedded ?? false,
|
|
28
|
-
chiiProxyPath: CHII_PROXY_PATH
|
|
28
|
+
chiiProxyPath: CHII_PROXY_PATH,
|
|
29
|
+
chiiClientPath: VIRTUAL_CHII_CLIENT
|
|
29
30
|
};
|
|
30
31
|
if (enableChii) {
|
|
31
32
|
const resolver = createResolver(import.meta.url);
|
|
@@ -69,6 +70,12 @@ var nuxt_default = defineNuxtModule({
|
|
|
69
70
|
for (const listener of originalUpgradeListeners) listener.call(server, req, socket, head);
|
|
70
71
|
});
|
|
71
72
|
});
|
|
73
|
+
addDevServerHandler({
|
|
74
|
+
route: VIRTUAL_CHII_CLIENT,
|
|
75
|
+
handler: defineEventHandler(async () => {
|
|
76
|
+
return getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
77
|
+
})
|
|
78
|
+
});
|
|
72
79
|
addDevServerHandler({
|
|
73
80
|
route: CHII_DEVTOOLS_PATH,
|
|
74
81
|
handler: defineEventHandler(async (event) => {
|
package/dist/rollup.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
2
|
require('./__chrome_devtools-DXNY3hbb.cjs');
|
|
3
|
-
const require_src = require('./src-
|
|
3
|
+
const require_src = require('./src-BLZWmyh2.cjs');
|
|
4
4
|
require('./utils-3gBRwB2B.cjs');
|
|
5
5
|
const unplugin = require_chunk.__toESM(require("unplugin"));
|
|
6
6
|
|
package/dist/rollup.js
CHANGED
package/dist/rspack.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
2
|
const require___chrome_devtools = require('./__chrome_devtools-DXNY3hbb.cjs');
|
|
3
|
-
const require_src = require('./src-
|
|
3
|
+
const require_src = require('./src-BLZWmyh2.cjs');
|
|
4
4
|
require('./utils-3gBRwB2B.cjs');
|
|
5
5
|
const cookie = require_chunk.__toESM(require("cookie"));
|
|
6
6
|
const picocolors = require_chunk.__toESM(require("picocolors"));
|
|
@@ -24,6 +24,13 @@ var rspack_default = (options) => {
|
|
|
24
24
|
next();
|
|
25
25
|
});
|
|
26
26
|
if (enableChii) {
|
|
27
|
+
middlewares.unshift(async (req, res, next) => {
|
|
28
|
+
if (req.url !== require_src.VIRTUAL_CHII_CLIENT) return next();
|
|
29
|
+
const content = require_src.getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
30
|
+
res.writeHead(200, { "Content-Type": "application/javascript; charset=utf-8" });
|
|
31
|
+
res.write(content);
|
|
32
|
+
res.end();
|
|
33
|
+
});
|
|
27
34
|
middlewares.unshift(async (req, res, next) => {
|
|
28
35
|
if (req.url !== require_src.CHII_DEVTOOLS_PATH) return next();
|
|
29
36
|
try {
|
package/dist/rspack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getChromeDevtoolsHtml } from "./__chrome_devtools-DtQ6IXAu.js";
|
|
2
|
-
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, createProxyMiddleware, resovedInfo, unpluginFactory } from "./src-
|
|
2
|
+
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, VIRTUAL_CHII_CLIENT, createProxyMiddleware, getChiiClientModuleCode, resovedInfo, unpluginFactory } from "./src-A2d59vC1.js";
|
|
3
3
|
import "./utils-DORRNjr1.js";
|
|
4
4
|
import cookie from "cookie";
|
|
5
5
|
import c from "picocolors";
|
|
@@ -23,6 +23,13 @@ var rspack_default = (options) => {
|
|
|
23
23
|
next();
|
|
24
24
|
});
|
|
25
25
|
if (enableChii) {
|
|
26
|
+
middlewares.unshift(async (req, res, next) => {
|
|
27
|
+
if (req.url !== VIRTUAL_CHII_CLIENT) return next();
|
|
28
|
+
const content = getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
29
|
+
res.writeHead(200, { "Content-Type": "application/javascript; charset=utf-8" });
|
|
30
|
+
res.write(content);
|
|
31
|
+
res.end();
|
|
32
|
+
});
|
|
26
33
|
middlewares.unshift(async (req, res, next) => {
|
|
27
34
|
if (req.url !== CHII_DEVTOOLS_PATH) return next();
|
|
28
35
|
try {
|
|
@@ -10,7 +10,7 @@ import c from "picocolors";
|
|
|
10
10
|
import { createUnplugin } from "unplugin";
|
|
11
11
|
import { start } from "z-chii";
|
|
12
12
|
|
|
13
|
-
//#region node_modules/.pnpm/get-port-please@3.
|
|
13
|
+
//#region node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs
|
|
14
14
|
const unsafePorts = /* @__PURE__ */ new Set([
|
|
15
15
|
1,
|
|
16
16
|
7,
|
|
@@ -99,23 +99,12 @@ function isUnsafePort(port) {
|
|
|
99
99
|
function isSafePort(port) {
|
|
100
100
|
return !isUnsafePort(port);
|
|
101
101
|
}
|
|
102
|
-
var __defProp = Object.defineProperty;
|
|
103
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
104
|
-
enumerable: true,
|
|
105
|
-
configurable: true,
|
|
106
|
-
writable: true,
|
|
107
|
-
value
|
|
108
|
-
}) : obj[key] = value;
|
|
109
|
-
var __publicField = (obj, key, value) => {
|
|
110
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
111
|
-
return value;
|
|
112
|
-
};
|
|
113
102
|
var GetPortError = class extends Error {
|
|
114
103
|
constructor(message, opts) {
|
|
115
104
|
super(message, opts);
|
|
116
105
|
this.message = message;
|
|
117
|
-
__publicField(this, "name", "GetPortError");
|
|
118
106
|
}
|
|
107
|
+
name = "GetPortError";
|
|
119
108
|
};
|
|
120
109
|
function _log(verbose, message) {
|
|
121
110
|
if (verbose) console.log(`[get-port] ${message}`);
|
|
@@ -140,7 +129,7 @@ function _tryPort(port, host) {
|
|
|
140
129
|
}
|
|
141
130
|
function _getLocalHosts(additional) {
|
|
142
131
|
const hosts = new Set(additional);
|
|
143
|
-
for (const _interface of Object.values(networkInterfaces())) for (const config$1 of _interface || []) if (config$1.address && !config$1.internal && !config$1.address.startsWith("fe80::")) hosts.add(config$1.address);
|
|
132
|
+
for (const _interface of Object.values(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);
|
|
144
133
|
return [...hosts];
|
|
145
134
|
}
|
|
146
135
|
function _fmtOnHost(hostname) {
|
|
@@ -169,9 +158,9 @@ async function checkPort(port, host = process.env.HOST, verbose) {
|
|
|
169
158
|
//#region src/index.ts
|
|
170
159
|
const cwd = process$1.cwd();
|
|
171
160
|
const projectHash = getProjectHash();
|
|
172
|
-
const CHII_PROXY_PATH =
|
|
173
|
-
const CHII_DEVTOOLS_PATH =
|
|
174
|
-
const VIRTUAL_CHII_CLIENT =
|
|
161
|
+
const CHII_PROXY_PATH = `/${projectHash}/__chii_proxy`;
|
|
162
|
+
const CHII_DEVTOOLS_PATH = `/${projectHash}/__chrome_devtools`;
|
|
163
|
+
const VIRTUAL_CHII_CLIENT = `/${projectHash}/__chii_client.js`;
|
|
175
164
|
let config;
|
|
176
165
|
const resovedInfo = {
|
|
177
166
|
availablePort: void 0,
|
|
@@ -203,38 +192,28 @@ function createProxyMiddleware(debug, proxyPath) {
|
|
|
203
192
|
});
|
|
204
193
|
if (req.socket.server) req.socket.server.on("upgrade", handleUpgrade);
|
|
205
194
|
}
|
|
206
|
-
if (proxy && req.url
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
if (proxy && req.url) {
|
|
196
|
+
const url = new URL(req.url, "http://localhost");
|
|
197
|
+
if (url.pathname.startsWith(proxyPath)) {
|
|
198
|
+
debug("Proxying request:", req.url);
|
|
199
|
+
req.url = req.url.replace(proxyPath, "");
|
|
200
|
+
proxy.web(req, res);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
next();
|
|
211
205
|
};
|
|
212
206
|
};
|
|
213
207
|
}
|
|
214
208
|
const isNuxt = isNuxtProject();
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const enableChii = chii?.enable !== false;
|
|
218
|
-
function debug(...args) {
|
|
219
|
-
if (options?.debug) console.log(` ${c.yellow("DEBUG")} `, ...args);
|
|
220
|
-
}
|
|
221
|
-
const unpluginDing = {
|
|
222
|
-
name: "unplugin-dingtalk",
|
|
223
|
-
enforce: "pre",
|
|
224
|
-
resolveId(source) {
|
|
225
|
-
if (source === "chii-client" || source === VIRTUAL_CHII_CLIENT) return VIRTUAL_CHII_CLIENT;
|
|
226
|
-
},
|
|
227
|
-
loadInclude(id) {
|
|
228
|
-
return id === VIRTUAL_CHII_CLIENT;
|
|
229
|
-
},
|
|
230
|
-
load(id) {
|
|
231
|
-
if (id === VIRTUAL_CHII_CLIENT) return `
|
|
209
|
+
function getChiiClientModuleCode(embedded) {
|
|
210
|
+
return `
|
|
232
211
|
;(function(){
|
|
233
212
|
if (document.getElementById('__chii_client')) return;
|
|
234
213
|
const script = document.createElement('script');
|
|
235
214
|
script.id = '__chii_client';
|
|
236
215
|
script.src="${CHII_PROXY_PATH}/target.js";
|
|
237
|
-
${
|
|
216
|
+
${embedded ? "script.setAttribute('embedded','true');" : ""}
|
|
238
217
|
document.body.appendChild(script);
|
|
239
218
|
})();
|
|
240
219
|
if (import.meta.hot) {
|
|
@@ -244,11 +223,29 @@ if (import.meta.hot) {
|
|
|
244
223
|
const script = document.createElement('script');
|
|
245
224
|
script.id = '__chii_client';
|
|
246
225
|
script.src="${CHII_PROXY_PATH}/target.js";
|
|
247
|
-
${
|
|
226
|
+
${embedded ? "script.setAttribute('embedded','true');" : ""}
|
|
248
227
|
document.body.appendChild(script);
|
|
249
228
|
});
|
|
250
229
|
}
|
|
251
|
-
|
|
230
|
+
`;
|
|
231
|
+
}
|
|
232
|
+
const unpluginFactory = (options) => {
|
|
233
|
+
const { chii } = options || {};
|
|
234
|
+
const enableChii = chii?.enable !== false;
|
|
235
|
+
function debug(...args) {
|
|
236
|
+
if (options?.debug) console.log(` ${c.yellow("DEBUG")} `, ...args);
|
|
237
|
+
}
|
|
238
|
+
const unpluginDing = {
|
|
239
|
+
name: "unplugin-dingtalk",
|
|
240
|
+
enforce: "pre",
|
|
241
|
+
resolveId(source) {
|
|
242
|
+
if (source === "chii-client" || source === VIRTUAL_CHII_CLIENT) return VIRTUAL_CHII_CLIENT;
|
|
243
|
+
},
|
|
244
|
+
loadInclude(id) {
|
|
245
|
+
return id === VIRTUAL_CHII_CLIENT;
|
|
246
|
+
},
|
|
247
|
+
load(id) {
|
|
248
|
+
if (id === VIRTUAL_CHII_CLIENT || id.endsWith(VIRTUAL_CHII_CLIENT)) return getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
252
249
|
},
|
|
253
250
|
transformInclude(id) {
|
|
254
251
|
return !!id.split("?")[0].match(/\.[t|j]s$/);
|
|
@@ -310,6 +307,19 @@ if (import.meta.hot) {
|
|
|
310
307
|
next();
|
|
311
308
|
});
|
|
312
309
|
if (enableChii) {
|
|
310
|
+
server.middlewares.use(VIRTUAL_CHII_CLIENT, async (_req, res) => {
|
|
311
|
+
const code = unpluginDing.load?.call(unpluginDing, VIRTUAL_CHII_CLIENT);
|
|
312
|
+
debug("load virtual chii client:", VIRTUAL_CHII_CLIENT, !!code);
|
|
313
|
+
if (code) {
|
|
314
|
+
const content = typeof code === "string" ? code : code.code ?? getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
315
|
+
res.writeHead(200, { "Content-Type": "application/javascript; charset=utf-8" });
|
|
316
|
+
res.write(content || "");
|
|
317
|
+
res.end();
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
res.writeHead(404);
|
|
321
|
+
res.end();
|
|
322
|
+
});
|
|
313
323
|
server.middlewares.use(CHII_DEVTOOLS_PATH, async (_req, res) => {
|
|
314
324
|
if (!resovedInfo.availablePort) {
|
|
315
325
|
res.writeHead(500, { "Content-Type": "text/plain" });
|
|
@@ -375,4 +385,4 @@ const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
|
375
385
|
var src_default = unplugin;
|
|
376
386
|
|
|
377
387
|
//#endregion
|
|
378
|
-
export { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, createProxyMiddleware, resovedInfo, src_default, unplugin, unpluginFactory };
|
|
388
|
+
export { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, VIRTUAL_CHII_CLIENT, createProxyMiddleware, getChiiClientModuleCode, resovedInfo, src_default, unplugin, unpluginFactory };
|
|
@@ -11,7 +11,7 @@ const picocolors = require_chunk.__toESM(require("picocolors"));
|
|
|
11
11
|
const unplugin = require_chunk.__toESM(require("unplugin"));
|
|
12
12
|
const z_chii = require_chunk.__toESM(require("z-chii"));
|
|
13
13
|
|
|
14
|
-
//#region node_modules/.pnpm/get-port-please@3.
|
|
14
|
+
//#region node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs
|
|
15
15
|
const unsafePorts = /* @__PURE__ */ new Set([
|
|
16
16
|
1,
|
|
17
17
|
7,
|
|
@@ -100,23 +100,12 @@ function isUnsafePort(port) {
|
|
|
100
100
|
function isSafePort(port) {
|
|
101
101
|
return !isUnsafePort(port);
|
|
102
102
|
}
|
|
103
|
-
var __defProp = Object.defineProperty;
|
|
104
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
105
|
-
enumerable: true,
|
|
106
|
-
configurable: true,
|
|
107
|
-
writable: true,
|
|
108
|
-
value
|
|
109
|
-
}) : obj[key] = value;
|
|
110
|
-
var __publicField = (obj, key, value) => {
|
|
111
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
112
|
-
return value;
|
|
113
|
-
};
|
|
114
103
|
var GetPortError = class extends Error {
|
|
115
104
|
constructor(message, opts) {
|
|
116
105
|
super(message, opts);
|
|
117
106
|
this.message = message;
|
|
118
|
-
__publicField(this, "name", "GetPortError");
|
|
119
107
|
}
|
|
108
|
+
name = "GetPortError";
|
|
120
109
|
};
|
|
121
110
|
function _log(verbose, message) {
|
|
122
111
|
if (verbose) console.log(`[get-port] ${message}`);
|
|
@@ -141,7 +130,7 @@ function _tryPort(port, host) {
|
|
|
141
130
|
}
|
|
142
131
|
function _getLocalHosts(additional) {
|
|
143
132
|
const hosts = new Set(additional);
|
|
144
|
-
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::")) hosts.add(config$1.address);
|
|
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);
|
|
145
134
|
return [...hosts];
|
|
146
135
|
}
|
|
147
136
|
function _fmtOnHost(hostname) {
|
|
@@ -170,9 +159,9 @@ async function checkPort(port, host = process.env.HOST, verbose) {
|
|
|
170
159
|
//#region src/index.ts
|
|
171
160
|
const cwd = node_process.default.cwd();
|
|
172
161
|
const projectHash = require_utils.getProjectHash();
|
|
173
|
-
const CHII_PROXY_PATH =
|
|
174
|
-
const CHII_DEVTOOLS_PATH =
|
|
175
|
-
const VIRTUAL_CHII_CLIENT =
|
|
162
|
+
const CHII_PROXY_PATH = `/${projectHash}/__chii_proxy`;
|
|
163
|
+
const CHII_DEVTOOLS_PATH = `/${projectHash}/__chrome_devtools`;
|
|
164
|
+
const VIRTUAL_CHII_CLIENT = `/${projectHash}/__chii_client.js`;
|
|
176
165
|
let config;
|
|
177
166
|
const resovedInfo = {
|
|
178
167
|
availablePort: void 0,
|
|
@@ -204,38 +193,28 @@ function createProxyMiddleware(debug, proxyPath) {
|
|
|
204
193
|
});
|
|
205
194
|
if (req.socket.server) req.socket.server.on("upgrade", handleUpgrade);
|
|
206
195
|
}
|
|
207
|
-
if (proxy && req.url
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
196
|
+
if (proxy && req.url) {
|
|
197
|
+
const url = new URL(req.url, "http://localhost");
|
|
198
|
+
if (url.pathname.startsWith(proxyPath)) {
|
|
199
|
+
debug("Proxying request:", req.url);
|
|
200
|
+
req.url = req.url.replace(proxyPath, "");
|
|
201
|
+
proxy.web(req, res);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
next();
|
|
212
206
|
};
|
|
213
207
|
};
|
|
214
208
|
}
|
|
215
209
|
const isNuxt = require_utils.isNuxtProject();
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const enableChii = chii?.enable !== false;
|
|
219
|
-
function debug(...args) {
|
|
220
|
-
if (options?.debug) console.log(` ${picocolors.default.yellow("DEBUG")} `, ...args);
|
|
221
|
-
}
|
|
222
|
-
const unpluginDing = {
|
|
223
|
-
name: "unplugin-dingtalk",
|
|
224
|
-
enforce: "pre",
|
|
225
|
-
resolveId(source) {
|
|
226
|
-
if (source === "chii-client" || source === VIRTUAL_CHII_CLIENT) return VIRTUAL_CHII_CLIENT;
|
|
227
|
-
},
|
|
228
|
-
loadInclude(id) {
|
|
229
|
-
return id === VIRTUAL_CHII_CLIENT;
|
|
230
|
-
},
|
|
231
|
-
load(id) {
|
|
232
|
-
if (id === VIRTUAL_CHII_CLIENT) return `
|
|
210
|
+
function getChiiClientModuleCode(embedded) {
|
|
211
|
+
return `
|
|
233
212
|
;(function(){
|
|
234
213
|
if (document.getElementById('__chii_client')) return;
|
|
235
214
|
const script = document.createElement('script');
|
|
236
215
|
script.id = '__chii_client';
|
|
237
216
|
script.src="${CHII_PROXY_PATH}/target.js";
|
|
238
|
-
${
|
|
217
|
+
${embedded ? "script.setAttribute('embedded','true');" : ""}
|
|
239
218
|
document.body.appendChild(script);
|
|
240
219
|
})();
|
|
241
220
|
if (import.meta.hot) {
|
|
@@ -245,11 +224,29 @@ if (import.meta.hot) {
|
|
|
245
224
|
const script = document.createElement('script');
|
|
246
225
|
script.id = '__chii_client';
|
|
247
226
|
script.src="${CHII_PROXY_PATH}/target.js";
|
|
248
|
-
${
|
|
227
|
+
${embedded ? "script.setAttribute('embedded','true');" : ""}
|
|
249
228
|
document.body.appendChild(script);
|
|
250
229
|
});
|
|
251
230
|
}
|
|
252
|
-
|
|
231
|
+
`;
|
|
232
|
+
}
|
|
233
|
+
const unpluginFactory = (options) => {
|
|
234
|
+
const { chii } = options || {};
|
|
235
|
+
const enableChii = chii?.enable !== false;
|
|
236
|
+
function debug(...args) {
|
|
237
|
+
if (options?.debug) console.log(` ${picocolors.default.yellow("DEBUG")} `, ...args);
|
|
238
|
+
}
|
|
239
|
+
const unpluginDing = {
|
|
240
|
+
name: "unplugin-dingtalk",
|
|
241
|
+
enforce: "pre",
|
|
242
|
+
resolveId(source) {
|
|
243
|
+
if (source === "chii-client" || source === VIRTUAL_CHII_CLIENT) return VIRTUAL_CHII_CLIENT;
|
|
244
|
+
},
|
|
245
|
+
loadInclude(id) {
|
|
246
|
+
return id === VIRTUAL_CHII_CLIENT;
|
|
247
|
+
},
|
|
248
|
+
load(id) {
|
|
249
|
+
if (id === VIRTUAL_CHII_CLIENT || id.endsWith(VIRTUAL_CHII_CLIENT)) return getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
253
250
|
},
|
|
254
251
|
transformInclude(id) {
|
|
255
252
|
return !!id.split("?")[0].match(/\.[t|j]s$/);
|
|
@@ -311,6 +308,19 @@ if (import.meta.hot) {
|
|
|
311
308
|
next();
|
|
312
309
|
});
|
|
313
310
|
if (enableChii) {
|
|
311
|
+
server.middlewares.use(VIRTUAL_CHII_CLIENT, async (_req, res) => {
|
|
312
|
+
const code = unpluginDing.load?.call(unpluginDing, VIRTUAL_CHII_CLIENT);
|
|
313
|
+
debug("load virtual chii client:", VIRTUAL_CHII_CLIENT, !!code);
|
|
314
|
+
if (code) {
|
|
315
|
+
const content = typeof code === "string" ? code : code.code ?? getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
316
|
+
res.writeHead(200, { "Content-Type": "application/javascript; charset=utf-8" });
|
|
317
|
+
res.write(content || "");
|
|
318
|
+
res.end();
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
res.writeHead(404);
|
|
322
|
+
res.end();
|
|
323
|
+
});
|
|
314
324
|
server.middlewares.use(CHII_DEVTOOLS_PATH, async (_req, res) => {
|
|
315
325
|
if (!resovedInfo.availablePort) {
|
|
316
326
|
res.writeHead(500, { "Content-Type": "text/plain" });
|
|
@@ -388,12 +398,24 @@ Object.defineProperty(exports, 'CHII_PROXY_PATH', {
|
|
|
388
398
|
return CHII_PROXY_PATH;
|
|
389
399
|
}
|
|
390
400
|
});
|
|
401
|
+
Object.defineProperty(exports, 'VIRTUAL_CHII_CLIENT', {
|
|
402
|
+
enumerable: true,
|
|
403
|
+
get: function () {
|
|
404
|
+
return VIRTUAL_CHII_CLIENT;
|
|
405
|
+
}
|
|
406
|
+
});
|
|
391
407
|
Object.defineProperty(exports, 'createProxyMiddleware', {
|
|
392
408
|
enumerable: true,
|
|
393
409
|
get: function () {
|
|
394
410
|
return createProxyMiddleware;
|
|
395
411
|
}
|
|
396
412
|
});
|
|
413
|
+
Object.defineProperty(exports, 'getChiiClientModuleCode', {
|
|
414
|
+
enumerable: true,
|
|
415
|
+
get: function () {
|
|
416
|
+
return getChiiClientModuleCode;
|
|
417
|
+
}
|
|
418
|
+
});
|
|
397
419
|
Object.defineProperty(exports, 'resovedInfo', {
|
|
398
420
|
enumerable: true,
|
|
399
421
|
get: function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-BLZWmyh2.cjs');
|
|
3
3
|
const require_utils = require('./utils-3gBRwB2B.cjs');
|
|
4
4
|
const unplugin = require_chunk.__toESM(require("unplugin"));
|
|
5
5
|
|
package/dist/vite.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require('./__chrome_devtools-DXNY3hbb.cjs');
|
|
2
|
-
require('./src-
|
|
2
|
+
require('./src-BLZWmyh2.cjs');
|
|
3
3
|
require('./utils-3gBRwB2B.cjs');
|
|
4
|
-
const require_vite = require('./vite-
|
|
4
|
+
const require_vite = require('./vite-DQmwOfnq.cjs');
|
|
5
5
|
|
|
6
6
|
module.exports = require_vite.vite_default;
|
package/dist/vite.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./__chrome_devtools-DtQ6IXAu.js";
|
|
2
|
-
import "./src-
|
|
2
|
+
import "./src-A2d59vC1.js";
|
|
3
3
|
import "./utils-DORRNjr1.js";
|
|
4
|
-
import { vite_default } from "./vite-
|
|
4
|
+
import { vite_default } from "./vite-DfU_xlRr.js";
|
|
5
5
|
|
|
6
6
|
export { vite_default as default };
|
package/dist/webpack.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
2
|
const require___chrome_devtools = require('./__chrome_devtools-DXNY3hbb.cjs');
|
|
3
|
-
const require_src = require('./src-
|
|
3
|
+
const require_src = require('./src-BLZWmyh2.cjs');
|
|
4
4
|
require('./utils-3gBRwB2B.cjs');
|
|
5
5
|
const cookie = require_chunk.__toESM(require("cookie"));
|
|
6
6
|
const picocolors = require_chunk.__toESM(require("picocolors"));
|
|
@@ -24,6 +24,12 @@ var webpack_default = (options) => {
|
|
|
24
24
|
next();
|
|
25
25
|
});
|
|
26
26
|
if (enableChii) {
|
|
27
|
+
devServer.app.get(require_src.VIRTUAL_CHII_CLIENT, async (_req, res) => {
|
|
28
|
+
const content = require_src.getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
29
|
+
res.writeHead(200, { "Content-Type": "application/javascript; charset=utf-8" });
|
|
30
|
+
res.write(content);
|
|
31
|
+
res.end();
|
|
32
|
+
});
|
|
27
33
|
devServer.app.get(require_src.CHII_DEVTOOLS_PATH, async (_req, res) => {
|
|
28
34
|
try {
|
|
29
35
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
package/dist/webpack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getChromeDevtoolsHtml } from "./__chrome_devtools-DtQ6IXAu.js";
|
|
2
|
-
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, createProxyMiddleware, resovedInfo, unpluginFactory } from "./src-
|
|
2
|
+
import { CHII_DEVTOOLS_PATH, CHII_PROXY_PATH, VIRTUAL_CHII_CLIENT, createProxyMiddleware, getChiiClientModuleCode, resovedInfo, unpluginFactory } from "./src-A2d59vC1.js";
|
|
3
3
|
import "./utils-DORRNjr1.js";
|
|
4
4
|
import cookie from "cookie";
|
|
5
5
|
import c from "picocolors";
|
|
@@ -23,6 +23,12 @@ var webpack_default = (options) => {
|
|
|
23
23
|
next();
|
|
24
24
|
});
|
|
25
25
|
if (enableChii) {
|
|
26
|
+
devServer.app.get(VIRTUAL_CHII_CLIENT, async (_req, res) => {
|
|
27
|
+
const content = getChiiClientModuleCode(!!options?.chii?.embedded);
|
|
28
|
+
res.writeHead(200, { "Content-Type": "application/javascript; charset=utf-8" });
|
|
29
|
+
res.write(content);
|
|
30
|
+
res.end();
|
|
31
|
+
});
|
|
26
32
|
devServer.app.get(CHII_DEVTOOLS_PATH, async (_req, res) => {
|
|
27
33
|
try {
|
|
28
34
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|