unplugin-dingtalk 1005.0.0 → 1007.0.0
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 +3 -0
- package/dist/__chrome_devtools.d.cts +4 -0
- package/dist/__chrome_devtools.d.ts +3 -2
- package/dist/__chrome_devtools.js +3 -7
- package/dist/astro.cjs +15 -0
- package/dist/astro.d.cts +10 -0
- package/dist/astro.d.ts +8 -10
- package/dist/astro.js +12 -17
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/esbuild.cjs +11 -0
- package/dist/esbuild.d.cts +6 -0
- package/dist/esbuild.d.ts +6 -8
- package/dist/esbuild.js +8 -10
- package/dist/index.cjs +10 -0
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +13 -11
- package/dist/index.js +5 -14
- 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 +478 -0
- package/dist/nuxt.d.cts +8 -0
- package/dist/nuxt.d.ts +7 -10
- package/dist/nuxt.js +474 -24
- package/dist/rollup.cjs +11 -0
- package/dist/rollup.d.cts +6 -0
- package/dist/rollup.d.ts +6 -8
- package/dist/rollup.js +8 -10
- package/dist/rspack.cjs +55 -0
- package/dist/rspack.d.cts +6 -0
- package/dist/rspack.d.ts +6 -7
- package/dist/rspack.js +50 -68
- package/dist/src-BVX_Roo9.js +364 -0
- package/dist/src-hLDO4Q22.cjs +394 -0
- package/dist/types-D6mfGNG_.d.ts +38 -0
- package/dist/types-DodDHiEA.d.cts +38 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +2 -0
- 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 +5 -0
- package/dist/utils.d.cts +9 -0
- package/dist/utils.d.ts +6 -3
- package/dist/utils.js +3 -7
- package/dist/vite-CKIDsKJ-.cjs +24 -0
- package/dist/vite-DoBUfGyY.js +18 -0
- package/dist/vite.cjs +6 -0
- package/dist/vite.d.cts +6 -0
- package/dist/vite.d.ts +5 -7
- package/dist/vite.js +6 -10
- package/dist/webpack.cjs +53 -0
- package/dist/webpack.d.cts +6 -0
- package/dist/webpack.d.ts +6 -8
- package/dist/webpack.js +48 -62
- package/package.json +64 -21
- package/dist/chunk-5JBD5THX.js +0 -20
- package/dist/chunk-D63IDACA.js +0 -26
- package/dist/chunk-KQOHODTC.js +0 -9
- package/dist/chunk-ZLK5HLCO.js +0 -537
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/__chrome_devtools.ts
|
|
2
2
|
function getChromeDevtoolsHtml(targetPort) {
|
|
3
|
-
|
|
3
|
+
return `<!DOCTYPE html>
|
|
4
4
|
<html>
|
|
5
5
|
|
|
6
6
|
<head>
|
|
@@ -44,20 +44,20 @@ function getChromeDevtoolsHtml(targetPort) {
|
|
|
44
44
|
</head>
|
|
45
45
|
|
|
46
46
|
<body>
|
|
47
|
-
<h2
|
|
47
|
+
<h2>可用 DevTools Targets</h2><button id="refresh">刷新</button>
|
|
48
48
|
<ul id="target-list">
|
|
49
|
-
<li
|
|
49
|
+
<li>加载中...</li>
|
|
50
50
|
</ul>
|
|
51
51
|
<script>
|
|
52
52
|
async function fetchTargets() {
|
|
53
53
|
const list = document.getElementById("target-list");
|
|
54
|
-
list.innerHTML = "<li
|
|
54
|
+
list.innerHTML = "<li>加载中...</li>";
|
|
55
55
|
try {
|
|
56
56
|
const resp = await fetch("/__chii_proxy/targets");
|
|
57
57
|
const data = await resp.json();
|
|
58
58
|
const targets = data.targets || [];
|
|
59
59
|
if (targets.length === 0) {
|
|
60
|
-
list.innerHTML = "<li
|
|
60
|
+
list.innerHTML = "<li>暂无可用的调试目标。</li>";
|
|
61
61
|
} else {
|
|
62
62
|
list.innerHTML = "";
|
|
63
63
|
for (const target of targets) {
|
|
@@ -68,23 +68,22 @@ function getChromeDevtoolsHtml(targetPort) {
|
|
|
68
68
|
"<div><strong>" + (target.title) + "</strong></div>" +
|
|
69
69
|
"<div>URL: " + (target.url || "") + "</div>" +
|
|
70
70
|
"<div>UA: <code>" + (target.userAgent || "unknown") + "</code></div>" +
|
|
71
|
-
"<a href='" + devToolsUrl + "' target='_blank' class='button'
|
|
71
|
+
"<a href='" + devToolsUrl + "' target='_blank' class='button'>打开调试</a>";
|
|
72
72
|
list.appendChild(item);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
} catch (e) {
|
|
76
|
-
list.innerHTML = "<li
|
|
76
|
+
list.innerHTML = "<li>获取调试目标失败</li>";
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
document.getElementById("refresh").onclick = () => window.location.reload();
|
|
80
80
|
window.onload = fetchTargets;
|
|
81
81
|
document.addEventListener('visibilitychange', window.location.reload);
|
|
82
|
-
|
|
82
|
+
<\/script>
|
|
83
83
|
</body>
|
|
84
84
|
|
|
85
85
|
</html>`;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
};
|
|
88
|
+
//#endregion
|
|
89
|
+
export { getChromeDevtoolsHtml };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/__chrome_devtools.ts
|
|
3
|
+
function getChromeDevtoolsHtml(targetPort) {
|
|
4
|
+
return `<!DOCTYPE html>
|
|
5
|
+
<html>
|
|
6
|
+
|
|
7
|
+
<head>
|
|
8
|
+
<meta charset="utf-8">
|
|
9
|
+
<title>DevTools Targets</title>
|
|
10
|
+
<style>
|
|
11
|
+
body {
|
|
12
|
+
font-family: sans-serif;
|
|
13
|
+
padding: 2em;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
ul {
|
|
17
|
+
padding: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
li {
|
|
21
|
+
margin-bottom: 1.2em;
|
|
22
|
+
list-style: none;
|
|
23
|
+
line-height: 1.5;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
a.button {
|
|
27
|
+
display: inline-block;
|
|
28
|
+
background: #409eff;
|
|
29
|
+
color: #fff;
|
|
30
|
+
padding: 0.2em 0.5em;
|
|
31
|
+
text-decoration: none;
|
|
32
|
+
border-radius: 4px;
|
|
33
|
+
margin-top: 0.5em;
|
|
34
|
+
font-size: 14px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
a.button:hover {
|
|
38
|
+
background: #66b1ff;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#refresh {
|
|
42
|
+
margin-bottom: 1.5em;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
45
|
+
</head>
|
|
46
|
+
|
|
47
|
+
<body>
|
|
48
|
+
<h2>可用 DevTools Targets</h2><button id="refresh">刷新</button>
|
|
49
|
+
<ul id="target-list">
|
|
50
|
+
<li>加载中...</li>
|
|
51
|
+
</ul>
|
|
52
|
+
<script>
|
|
53
|
+
async function fetchTargets() {
|
|
54
|
+
const list = document.getElementById("target-list");
|
|
55
|
+
list.innerHTML = "<li>加载中...</li>";
|
|
56
|
+
try {
|
|
57
|
+
const resp = await fetch("/__chii_proxy/targets");
|
|
58
|
+
const data = await resp.json();
|
|
59
|
+
const targets = data.targets || [];
|
|
60
|
+
if (targets.length === 0) {
|
|
61
|
+
list.innerHTML = "<li>暂无可用的调试目标。</li>";
|
|
62
|
+
} else {
|
|
63
|
+
list.innerHTML = "";
|
|
64
|
+
for (const target of targets) {
|
|
65
|
+
console.log(target)
|
|
66
|
+
const devToolsUrl = "http://localhost:${targetPort}/front_end/chii_app.html?ws=localhost:${targetPort}/client/" + Math.random().toString(20).substring(2, 8) + "?target=" + encodeURIComponent(target.id) + "&rtc=false";
|
|
67
|
+
const item = document.createElement("li");
|
|
68
|
+
item.innerHTML =
|
|
69
|
+
"<div><strong>" + (target.title) + "</strong></div>" +
|
|
70
|
+
"<div>URL: " + (target.url || "") + "</div>" +
|
|
71
|
+
"<div>UA: <code>" + (target.userAgent || "unknown") + "</code></div>" +
|
|
72
|
+
"<a href='" + devToolsUrl + "' target='_blank' class='button'>打开调试</a>";
|
|
73
|
+
list.appendChild(item);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (e) {
|
|
77
|
+
list.innerHTML = "<li>获取调试目标失败</li>";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
document.getElementById("refresh").onclick = () => window.location.reload();
|
|
81
|
+
window.onload = fetchTargets;
|
|
82
|
+
document.addEventListener('visibilitychange', window.location.reload);
|
|
83
|
+
<\/script>
|
|
84
|
+
</body>
|
|
85
|
+
|
|
86
|
+
</html>`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
Object.defineProperty(exports, 'getChromeDevtoolsHtml', {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return getChromeDevtoolsHtml;
|
|
94
|
+
}
|
|
95
|
+
});
|
package/dist/astro.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require('./__chrome_devtools-CJ3sXpVj.cjs');
|
|
2
|
+
const require_src = require('./src-hLDO4Q22.cjs');
|
|
3
|
+
require('./utils-CmfBxo4J.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/astro.ts
|
|
6
|
+
var astro_default = (options) => ({
|
|
7
|
+
name: "unplugin-dingtalk",
|
|
8
|
+
hooks: { "astro:config:setup": async (astro) => {
|
|
9
|
+
astro.config.vite.plugins ||= [];
|
|
10
|
+
astro.config.vite.plugins.push(require_src.src_default.vite(options));
|
|
11
|
+
} }
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
module.exports = astro_default;
|
package/dist/astro.d.cts
ADDED
package/dist/astro.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { Options } from
|
|
2
|
-
import 'webpack-dev-server';
|
|
3
|
-
import 'node:http';
|
|
4
|
-
import 'vite-plugin-vconsole';
|
|
1
|
+
import { Options } from "./types-D6mfGNG_.js";
|
|
5
2
|
|
|
3
|
+
//#region src/astro.d.ts
|
|
6
4
|
declare const _default: (options: Options) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
name: string;
|
|
6
|
+
hooks: {
|
|
7
|
+
'astro:config:setup': (astro: any) => Promise<void>;
|
|
8
|
+
};
|
|
11
9
|
};
|
|
12
|
-
|
|
13
|
-
export { _default as default };
|
|
10
|
+
//#endregion
|
|
11
|
+
export { _default as default };
|
package/dist/astro.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import "./chunk-2YQKM4BX.js";
|
|
5
|
-
import "./chunk-5JBD5THX.js";
|
|
1
|
+
import "./__chrome_devtools-CIQ5zFZx.js";
|
|
2
|
+
import { src_default } from "./src-BVX_Roo9.js";
|
|
3
|
+
import "./utils-Chlbb6jf.js";
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
//#region src/astro.ts
|
|
8
6
|
var astro_default = (options) => ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
astro.config.vite.plugins.push(index_default.vite(options));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
7
|
+
name: "unplugin-dingtalk",
|
|
8
|
+
hooks: { "astro:config:setup": async (astro) => {
|
|
9
|
+
astro.config.vite.plugins ||= [];
|
|
10
|
+
astro.config.vite.plugins.push(src_default.vite(options));
|
|
11
|
+
} }
|
|
17
12
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { astro_default as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|
package/dist/esbuild.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
require('./__chrome_devtools-CJ3sXpVj.cjs');
|
|
3
|
+
const require_src = require('./src-hLDO4Q22.cjs');
|
|
4
|
+
require('./utils-CmfBxo4J.cjs');
|
|
5
|
+
const unplugin = require_chunk.__toESM(require("unplugin"));
|
|
6
|
+
|
|
7
|
+
//#region src/esbuild.ts
|
|
8
|
+
var esbuild_default = (0, unplugin.createEsbuildPlugin)(require_src.unpluginFactory);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
module.exports = esbuild_default;
|
package/dist/esbuild.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import 'webpack-dev-server';
|
|
4
|
-
import 'node:http';
|
|
5
|
-
import 'vite-plugin-vconsole';
|
|
1
|
+
import { Options } from "./types-D6mfGNG_.js";
|
|
2
|
+
import * as esbuild0 from "esbuild";
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
//#region src/esbuild.d.ts
|
|
5
|
+
declare const _default: (options?: Options | undefined) => esbuild0.Plugin;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default as default };
|
package/dist/esbuild.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import "./chunk-2YQKM4BX.js";
|
|
5
|
-
import "./chunk-5JBD5THX.js";
|
|
6
|
-
|
|
7
|
-
// src/esbuild.ts
|
|
1
|
+
import "./__chrome_devtools-CIQ5zFZx.js";
|
|
2
|
+
import { unpluginFactory } from "./src-BVX_Roo9.js";
|
|
3
|
+
import "./utils-Chlbb6jf.js";
|
|
8
4
|
import { createEsbuildPlugin } from "unplugin";
|
|
5
|
+
|
|
6
|
+
//#region src/esbuild.ts
|
|
9
7
|
var esbuild_default = createEsbuildPlugin(unpluginFactory);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { esbuild_default as default };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
require('./__chrome_devtools-CJ3sXpVj.cjs');
|
|
3
|
+
const require_src = require('./src-hLDO4Q22.cjs');
|
|
4
|
+
require('./utils-CmfBxo4J.cjs');
|
|
5
|
+
|
|
6
|
+
exports.createProxyMiddleware = require_src.createProxyMiddleware;
|
|
7
|
+
exports.default = require_src.src_default;
|
|
8
|
+
exports.resovedInfo = require_src.resovedInfo;
|
|
9
|
+
exports.unplugin = require_src.unplugin;
|
|
10
|
+
exports.unpluginFactory = require_src.unpluginFactory;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Options } from "./types-DodDHiEA.cjs";
|
|
2
|
+
import * as unplugin0 from "unplugin";
|
|
3
|
+
import { UnpluginFactory } from "unplugin";
|
|
4
|
+
import { Connect } from "vite";
|
|
5
|
+
|
|
6
|
+
//#region src/index.d.ts
|
|
7
|
+
declare const resovedInfo: {
|
|
8
|
+
availablePort: number | undefined;
|
|
9
|
+
targetURL: undefined | URL;
|
|
10
|
+
};
|
|
11
|
+
declare function createProxyMiddleware(debug: typeof console.debug): (resolvedInfo: {
|
|
12
|
+
availablePort?: number;
|
|
13
|
+
}) => Connect.NextHandleFunction;
|
|
14
|
+
declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
|
|
15
|
+
declare const unplugin: unplugin0.UnpluginInstance<Options | undefined, boolean>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { createProxyMiddleware, unplugin as default, unplugin, resovedInfo, unpluginFactory };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import 'node:http';
|
|
6
|
-
import 'vite-plugin-vconsole';
|
|
1
|
+
import { Options } from "./types-D6mfGNG_.js";
|
|
2
|
+
import * as unplugin0 from "unplugin";
|
|
3
|
+
import { UnpluginFactory } from "unplugin";
|
|
4
|
+
import { Connect } from "vite";
|
|
7
5
|
|
|
6
|
+
//#region src/index.d.ts
|
|
8
7
|
declare const resovedInfo: {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
availablePort: number | undefined;
|
|
9
|
+
targetURL: undefined | URL;
|
|
11
10
|
};
|
|
11
|
+
declare function createProxyMiddleware(debug: typeof console.debug): (resolvedInfo: {
|
|
12
|
+
availablePort?: number;
|
|
13
|
+
}) => Connect.NextHandleFunction;
|
|
12
14
|
declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
|
|
13
|
-
declare const unplugin:
|
|
14
|
-
|
|
15
|
-
export { unplugin as default,
|
|
15
|
+
declare const unplugin: unplugin0.UnpluginInstance<Options | undefined, boolean>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { createProxyMiddleware, unplugin as default, unplugin, resovedInfo, unpluginFactory };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "./chunk-ZLK5HLCO.js";
|
|
7
|
-
import "./chunk-2YQKM4BX.js";
|
|
8
|
-
import "./chunk-5JBD5THX.js";
|
|
9
|
-
export {
|
|
10
|
-
index_default as default,
|
|
11
|
-
resovedInfo,
|
|
12
|
-
unplugin,
|
|
13
|
-
unpluginFactory
|
|
14
|
-
};
|
|
1
|
+
import "./__chrome_devtools-CIQ5zFZx.js";
|
|
2
|
+
import { createProxyMiddleware, resovedInfo, src_default, unplugin, unpluginFactory } from "./src-BVX_Roo9.js";
|
|
3
|
+
import "./utils-Chlbb6jf.js";
|
|
4
|
+
|
|
5
|
+
export { createProxyMiddleware, src_default as default, resovedInfo, unplugin, unpluginFactory };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const __imports = require_chunk.__toESM(require("#imports"));
|
|
3
|
+
|
|
4
|
+
//#region src/inject-script.ts
|
|
5
|
+
var inject_script_default = (0, __imports.defineNitroPlugin)((nitroApp) => {
|
|
6
|
+
nitroApp.hooks.hook("render:html", (html) => {
|
|
7
|
+
const config = (0, __imports.useRuntimeConfig)();
|
|
8
|
+
const embedded = config.unpluginDingtalk?.chiiEmbedded ?? false;
|
|
9
|
+
const scriptTag = embedded ? "<script src=\"/__chii_proxy/target.js\" embedded=\"true\"><\/script>" : "<script src=\"/__chii_proxy/target.js\"><\/script>";
|
|
10
|
+
html.bodyAppend.push(scriptTag);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
module.exports = inject_script_default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineNitroPlugin, useRuntimeConfig } from "#imports";
|
|
2
|
+
|
|
3
|
+
//#region src/inject-script.ts
|
|
4
|
+
var inject_script_default = defineNitroPlugin((nitroApp) => {
|
|
5
|
+
nitroApp.hooks.hook("render:html", (html) => {
|
|
6
|
+
const config = useRuntimeConfig();
|
|
7
|
+
const embedded = config.unpluginDingtalk?.chiiEmbedded ?? false;
|
|
8
|
+
const scriptTag = embedded ? "<script src=\"/__chii_proxy/target.js\" embedded=\"true\"><\/script>" : "<script src=\"/__chii_proxy/target.js\"><\/script>";
|
|
9
|
+
html.bodyAppend.push(scriptTag);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { inject_script_default as default };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/vite-plugin-vconsole@2.1.1/node_modules/vite-plugin-vconsole/dist/main.mjs
|
|
2
|
+
var parseVConsoleOptions = (config) => Object.keys(config).reduce((code, key) => {
|
|
3
|
+
const value = config[key];
|
|
4
|
+
if (typeof value === "function") if (/^[(f]/.test(value.toString())) {
|
|
5
|
+
code += `${key}: ${value},`;
|
|
6
|
+
return code;
|
|
7
|
+
} else {
|
|
8
|
+
code += `${value},`;
|
|
9
|
+
return code;
|
|
10
|
+
}
|
|
11
|
+
code += `${key}: ${JSON.stringify(config[key])},`;
|
|
12
|
+
return code;
|
|
13
|
+
}, "");
|
|
14
|
+
var getEventItems = (event, id) => {
|
|
15
|
+
return event.map((ele) => `
|
|
16
|
+
${id}.on('${ele.eventName}', ${ele.callback})
|
|
17
|
+
`).join(";");
|
|
18
|
+
};
|
|
19
|
+
var getDynamicConfig = (dynamicConfig) => {
|
|
20
|
+
let configString = "";
|
|
21
|
+
if (!dynamicConfig) return configString;
|
|
22
|
+
for (const key in dynamicConfig) if (typeof dynamicConfig[key] === "string") configString += `${key}: ${dynamicConfig[key]},`;
|
|
23
|
+
return configString;
|
|
24
|
+
};
|
|
25
|
+
var getPlugins = (plugin) => {
|
|
26
|
+
let plugins = "";
|
|
27
|
+
if (plugin && plugin.length) plugins = plugin.map((e) => `
|
|
28
|
+
const ${e.id} = new VConsole.VConsolePlugin('${e.id}', '${e.name}');
|
|
29
|
+
${getEventItems(e.event, e.id)}
|
|
30
|
+
vConsole.addPlugin(${e.id})
|
|
31
|
+
`).join(";");
|
|
32
|
+
return plugins;
|
|
33
|
+
};
|
|
34
|
+
function viteVConsole(opt) {
|
|
35
|
+
const { entry, enabled = true, config = {}, plugin, customHide = false, dynamicConfig = {}, eventListener = "" } = opt;
|
|
36
|
+
let entryPath = Array.isArray(entry) ? entry : [entry];
|
|
37
|
+
if (process.platform === "win32") entryPath = entryPath.map((item) => item.replace(/\\/g, "/"));
|
|
38
|
+
const enabledTruly = enabled;
|
|
39
|
+
return {
|
|
40
|
+
name: "vite:vconsole",
|
|
41
|
+
enforce: "pre",
|
|
42
|
+
transform(_source, id) {
|
|
43
|
+
if (entryPath.includes(id) && enabledTruly) {
|
|
44
|
+
const code = `/* eslint-disable */;
|
|
45
|
+
import VConsole from 'vconsole';
|
|
46
|
+
// config
|
|
47
|
+
const vConsole = new VConsole({${parseVConsoleOptions(config)}});
|
|
48
|
+
window.vConsole = vConsole;
|
|
49
|
+
|
|
50
|
+
// plugins
|
|
51
|
+
${getPlugins(plugin)}
|
|
52
|
+
|
|
53
|
+
// dynamic config
|
|
54
|
+
window.vConsole.dynamicFunction = function() {
|
|
55
|
+
if (${getDynamicConfig(dynamicConfig).length > 0}) {
|
|
56
|
+
vConsole.setOption({${getDynamicConfig(dynamicConfig)}});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
window.vConsole.dynamicChange = {
|
|
61
|
+
value: new Date().getTime()
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
window.vConsole.dynamicFunction();
|
|
65
|
+
|
|
66
|
+
if (${customHide}) {
|
|
67
|
+
vConsole.hideSwitch();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// In order to be compatible with old equipment, I used defineProperty. In the future, when proxy covers enough devices, proxy will be used.
|
|
71
|
+
Object.defineProperty(window.vConsole.dynamicChange, 'value', {
|
|
72
|
+
get: function() {
|
|
73
|
+
return this._value;
|
|
74
|
+
},
|
|
75
|
+
set: function(newValue) {
|
|
76
|
+
window.vConsole.dynamicFunction();
|
|
77
|
+
this._value = newValue;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// eventListener
|
|
82
|
+
${eventListener}
|
|
83
|
+
/* eslint-enable */${_source}`;
|
|
84
|
+
return {
|
|
85
|
+
code,
|
|
86
|
+
map: null
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
code: _source,
|
|
91
|
+
map: null
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
var main_default = viteVConsole;
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
export { main_default as default, viteVConsole };
|