unplugin-dingtalk 0.1.5 → 0.1.8

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/vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-NRP2YPPZ.js";
4
- import "./chunk-I4UPMGWK.js";
3
+ } from "./chunk-GCW3A6BF.js";
4
+ import "./chunk-YU6RRDIU.js";
5
5
  export {
6
6
  vite_default as default
7
7
  };
package/dist/webpack.cjs CHANGED
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
8
  var __export = (target, all) => {
12
9
  for (var name in all)
13
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -30,64 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
27
  ));
31
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
29
 
33
- // node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js
34
- var require_picocolors = __commonJS({
35
- "node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js"(exports2, module2) {
36
- "use strict";
37
- var argv = process.argv || [];
38
- var env = process.env;
39
- var isColorSupported = !("NO_COLOR" in env || argv.includes("--no-color")) && ("FORCE_COLOR" in env || argv.includes("--color") || process.platform === "win32" || require != null && require("tty").isatty(1) && env.TERM !== "dumb" || "CI" in env);
40
- var formatter = (open, close, replace = open) => (input) => {
41
- let string = "" + input;
42
- let index = string.indexOf(close, open.length);
43
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
44
- };
45
- var replaceClose = (string, close, replace, index) => {
46
- let result = "";
47
- let cursor = 0;
48
- do {
49
- result += string.substring(cursor, index) + replace;
50
- cursor = index + close.length;
51
- index = string.indexOf(close, cursor);
52
- } while (~index);
53
- return result + string.substring(cursor);
54
- };
55
- var createColors = (enabled = isColorSupported) => {
56
- let init = enabled ? formatter : () => String;
57
- return {
58
- isColorSupported: enabled,
59
- reset: init("\x1B[0m", "\x1B[0m"),
60
- bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
61
- dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
62
- italic: init("\x1B[3m", "\x1B[23m"),
63
- underline: init("\x1B[4m", "\x1B[24m"),
64
- inverse: init("\x1B[7m", "\x1B[27m"),
65
- hidden: init("\x1B[8m", "\x1B[28m"),
66
- strikethrough: init("\x1B[9m", "\x1B[29m"),
67
- black: init("\x1B[30m", "\x1B[39m"),
68
- red: init("\x1B[31m", "\x1B[39m"),
69
- green: init("\x1B[32m", "\x1B[39m"),
70
- yellow: init("\x1B[33m", "\x1B[39m"),
71
- blue: init("\x1B[34m", "\x1B[39m"),
72
- magenta: init("\x1B[35m", "\x1B[39m"),
73
- cyan: init("\x1B[36m", "\x1B[39m"),
74
- white: init("\x1B[37m", "\x1B[39m"),
75
- gray: init("\x1B[90m", "\x1B[39m"),
76
- bgBlack: init("\x1B[40m", "\x1B[49m"),
77
- bgRed: init("\x1B[41m", "\x1B[49m"),
78
- bgGreen: init("\x1B[42m", "\x1B[49m"),
79
- bgYellow: init("\x1B[43m", "\x1B[49m"),
80
- bgBlue: init("\x1B[44m", "\x1B[49m"),
81
- bgMagenta: init("\x1B[45m", "\x1B[49m"),
82
- bgCyan: init("\x1B[46m", "\x1B[49m"),
83
- bgWhite: init("\x1B[47m", "\x1B[49m")
84
- };
85
- };
86
- module2.exports = createColors();
87
- module2.exports.createColors = createColors;
88
- }
89
- });
90
-
91
30
  // src/webpack.ts
92
31
  var webpack_exports = {};
93
32
  __export(webpack_exports, {
@@ -100,132 +39,8 @@ var import_unplugin2 = require("unplugin");
100
39
  var import_node_child_process = require("child_process");
101
40
  var import_node_process = __toESM(require("process"), 1);
102
41
  var import_unplugin = require("unplugin");
103
- var import_picocolors = __toESM(require_picocolors(), 1);
104
-
105
- // node_modules/.pnpm/vite-plugin-vconsole@2.1.1/node_modules/vite-plugin-vconsole/dist/main.mjs
106
- var parseVConsoleOptions = (config2) => Object.keys(config2).reduce((code, key) => {
107
- const value = config2[key];
108
- if (typeof value === "function") {
109
- if (/^[(f]/.test(value.toString())) {
110
- code += `${key}: ${value},`;
111
- return code;
112
- } else {
113
- code += `${value},`;
114
- return code;
115
- }
116
- }
117
- code += `${key}: ${JSON.stringify(config2[key])},`;
118
- return code;
119
- }, "");
120
- var getEventItems = (event, id) => {
121
- return event.map(
122
- (ele) => `
123
- ${id}.on('${ele.eventName}', ${ele.callback})
124
- `
125
- ).join(";");
126
- };
127
- var getDynamicConfig = (dynamicConfig) => {
128
- let configString = "";
129
- if (!dynamicConfig) {
130
- return configString;
131
- }
132
- for (const key in dynamicConfig) {
133
- if (typeof dynamicConfig[key] === "string") {
134
- configString += `${key}: ${dynamicConfig[key]},`;
135
- }
136
- }
137
- return configString;
138
- };
139
- var getPlugins = (plugin) => {
140
- let plugins = "";
141
- if (plugin && plugin.length) {
142
- plugins = plugin.map(
143
- (e) => `
144
- const ${e.id} = new VConsole.VConsolePlugin('${e.id}', '${e.name}');
145
- ${getEventItems(e.event, e.id)}
146
- vConsole.addPlugin(${e.id})
147
- `
148
- ).join(";");
149
- }
150
- return plugins;
151
- };
152
- function viteVConsole(opt) {
153
- const {
154
- entry,
155
- enabled = true,
156
- config: config2 = {},
157
- plugin,
158
- customHide = false,
159
- dynamicConfig = {},
160
- eventListener = ""
161
- } = opt;
162
- let entryPath = Array.isArray(entry) ? entry : [entry];
163
- if (process.platform === "win32")
164
- entryPath = entryPath.map((item) => item.replace(/\\/g, "/"));
165
- const enabledTruly = enabled;
166
- return {
167
- name: "vite:vconsole",
168
- enforce: "pre",
169
- transform(_source, id) {
170
- if (entryPath.includes(id) && enabledTruly) {
171
- const code = `/* eslint-disable */;
172
- import VConsole from 'vconsole';
173
- // config
174
- const vConsole = new VConsole({${parseVConsoleOptions(
175
- config2
176
- )}});
177
- window.vConsole = vConsole;
178
-
179
- // plugins
180
- ${getPlugins(plugin)}
181
-
182
- // dynamic config
183
- window.vConsole.dynamicFunction = function() {
184
- if (${getDynamicConfig(dynamicConfig).length > 0}) {
185
- vConsole.setOption({${getDynamicConfig(dynamicConfig)}});
186
- }
187
- };
188
-
189
- window.vConsole.dynamicChange = {
190
- value: new Date().getTime()
191
- };
192
-
193
- window.vConsole.dynamicFunction();
194
-
195
- if (${customHide}) {
196
- vConsole.hideSwitch();
197
- }
198
-
199
- // In order to be compatible with old equipment, I used defineProperty. In the future, when proxy covers enough devices, proxy will be used.
200
- Object.defineProperty(window.vConsole.dynamicChange, 'value', {
201
- get: function() {
202
- return this._value;
203
- },
204
- set: function(newValue) {
205
- window.vConsole.dynamicFunction();
206
- this._value = newValue;
207
- }
208
- });
209
-
210
- // eventListener
211
- ${eventListener}
212
- /* eslint-enable */${_source}`;
213
- return {
214
- code,
215
- map: null
216
- // support source map
217
- };
218
- }
219
- return {
220
- code: _source,
221
- map: null
222
- // support source map
223
- };
224
- }
225
- };
226
- }
227
-
228
- // src/index.ts
42
+ var import_picocolors = __toESM(require("picocolors"), 1);
43
+ var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
229
44
  var config;
230
45
  var devtoolsInstance;
231
46
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
@@ -239,7 +54,7 @@ var unpluginFactory = (options) => {
239
54
  },
240
55
  transform(_source) {
241
56
  var _a2, _b, _c;
242
- if ((_a2 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a2.enable) {
57
+ if ((options == null ? void 0 : options.enable) && ((_a2 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a2.enable)) {
243
58
  const code = `/* eslint-disable */;
244
59
  import { devtools } from '@vue/devtools'
245
60
  devtools.connect(${(_b = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _b.host}, ${(_c = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _c.port})
@@ -316,7 +131,7 @@ var unpluginFactory = (options) => {
316
131
  }
317
132
  };
318
133
  if ((options == null ? void 0 : options.enable) && ((_a = options == null ? void 0 : options.vconsole) == null ? void 0 : _a.enabled)) {
319
- return [viteVConsole(options == null ? void 0 : options.vconsole), unpluginDing];
134
+ return [(0, import_vite_plugin_vconsole.viteVConsole)(options == null ? void 0 : options.vconsole), unpluginDing];
320
135
  } else {
321
136
  return unpluginDing;
322
137
  }
package/dist/webpack.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  webpack_default
3
- } from "./chunk-KYZ5HD2N.js";
4
- import "./chunk-I4UPMGWK.js";
3
+ } from "./chunk-JVGHIAFT.js";
4
+ import "./chunk-YU6RRDIU.js";
5
5
  export {
6
6
  webpack_default as default
7
7
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-dingtalk",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.1.8",
5
5
  "description": "",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/zcf0508/unplugin-dingtalk#readme",
@@ -120,7 +120,9 @@
120
120
  "dependencies": {
121
121
  "@antfu/eslint-config": "^2.18.1",
122
122
  "eslint-plugin-security": "^3.0.0",
123
- "unplugin": "^1.5.1"
123
+ "unplugin": "^1.5.1",
124
+ "vite-plugin-vconsole": "^2.1.1",
125
+ "picocolors": "^1.0.1"
124
126
  },
125
127
  "devDependencies": {
126
128
  "@nuxt/kit": "^3.8.2",
@@ -132,12 +134,10 @@
132
134
  "esno": "^4.0.0",
133
135
  "fast-glob": "^3.3.2",
134
136
  "nodemon": "^3.0.2",
135
- "picocolors": "^1.0.1",
136
137
  "rimraf": "^5.0.5",
137
138
  "rollup": "^4.6.1",
138
139
  "tsup": "^8.0.1",
139
140
  "vite": "^5.0.4",
140
- "vite-plugin-vconsole": "^2.1.1",
141
141
  "vitest": "^0.34.6",
142
142
  "webpack": "^5.89.0"
143
143
  },
@@ -1,324 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined")
11
- return require.apply(this, arguments);
12
- throw Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __commonJS = (cb, mod) => function __require2() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
- };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") {
19
- for (let key of __getOwnPropNames(from))
20
- if (!__hasOwnProp.call(to, key) && key !== except)
21
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
- // If the importer is in node compatibility mode or this is not an ESM
27
- // file that has been converted to a CommonJS file using a Babel-
28
- // compatible transform (i.e. "__esModule" has not been set), then set
29
- // "default" to the CommonJS "module.exports" for node compatibility.
30
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
- mod
32
- ));
33
-
34
- // node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js
35
- var require_picocolors = __commonJS({
36
- "node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js"(exports, module) {
37
- "use strict";
38
- var argv = process.argv || [];
39
- var env = process.env;
40
- var isColorSupported = !("NO_COLOR" in env || argv.includes("--no-color")) && ("FORCE_COLOR" in env || argv.includes("--color") || process.platform === "win32" || __require != null && __require("tty").isatty(1) && env.TERM !== "dumb" || "CI" in env);
41
- var formatter = (open, close, replace = open) => (input) => {
42
- let string = "" + input;
43
- let index = string.indexOf(close, open.length);
44
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
45
- };
46
- var replaceClose = (string, close, replace, index) => {
47
- let result = "";
48
- let cursor = 0;
49
- do {
50
- result += string.substring(cursor, index) + replace;
51
- cursor = index + close.length;
52
- index = string.indexOf(close, cursor);
53
- } while (~index);
54
- return result + string.substring(cursor);
55
- };
56
- var createColors = (enabled = isColorSupported) => {
57
- let init = enabled ? formatter : () => String;
58
- return {
59
- isColorSupported: enabled,
60
- reset: init("\x1B[0m", "\x1B[0m"),
61
- bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
62
- dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
63
- italic: init("\x1B[3m", "\x1B[23m"),
64
- underline: init("\x1B[4m", "\x1B[24m"),
65
- inverse: init("\x1B[7m", "\x1B[27m"),
66
- hidden: init("\x1B[8m", "\x1B[28m"),
67
- strikethrough: init("\x1B[9m", "\x1B[29m"),
68
- black: init("\x1B[30m", "\x1B[39m"),
69
- red: init("\x1B[31m", "\x1B[39m"),
70
- green: init("\x1B[32m", "\x1B[39m"),
71
- yellow: init("\x1B[33m", "\x1B[39m"),
72
- blue: init("\x1B[34m", "\x1B[39m"),
73
- magenta: init("\x1B[35m", "\x1B[39m"),
74
- cyan: init("\x1B[36m", "\x1B[39m"),
75
- white: init("\x1B[37m", "\x1B[39m"),
76
- gray: init("\x1B[90m", "\x1B[39m"),
77
- bgBlack: init("\x1B[40m", "\x1B[49m"),
78
- bgRed: init("\x1B[41m", "\x1B[49m"),
79
- bgGreen: init("\x1B[42m", "\x1B[49m"),
80
- bgYellow: init("\x1B[43m", "\x1B[49m"),
81
- bgBlue: init("\x1B[44m", "\x1B[49m"),
82
- bgMagenta: init("\x1B[45m", "\x1B[49m"),
83
- bgCyan: init("\x1B[46m", "\x1B[49m"),
84
- bgWhite: init("\x1B[47m", "\x1B[49m")
85
- };
86
- };
87
- module.exports = createColors();
88
- module.exports.createColors = createColors;
89
- }
90
- });
91
-
92
- // src/index.ts
93
- var import_picocolors = __toESM(require_picocolors(), 1);
94
- import { exec } from "child_process";
95
- import process2 from "process";
96
- import { createUnplugin } from "unplugin";
97
-
98
- // node_modules/.pnpm/vite-plugin-vconsole@2.1.1/node_modules/vite-plugin-vconsole/dist/main.mjs
99
- var parseVConsoleOptions = (config2) => Object.keys(config2).reduce((code, key) => {
100
- const value = config2[key];
101
- if (typeof value === "function") {
102
- if (/^[(f]/.test(value.toString())) {
103
- code += `${key}: ${value},`;
104
- return code;
105
- } else {
106
- code += `${value},`;
107
- return code;
108
- }
109
- }
110
- code += `${key}: ${JSON.stringify(config2[key])},`;
111
- return code;
112
- }, "");
113
- var getEventItems = (event, id) => {
114
- return event.map(
115
- (ele) => `
116
- ${id}.on('${ele.eventName}', ${ele.callback})
117
- `
118
- ).join(";");
119
- };
120
- var getDynamicConfig = (dynamicConfig) => {
121
- let configString = "";
122
- if (!dynamicConfig) {
123
- return configString;
124
- }
125
- for (const key in dynamicConfig) {
126
- if (typeof dynamicConfig[key] === "string") {
127
- configString += `${key}: ${dynamicConfig[key]},`;
128
- }
129
- }
130
- return configString;
131
- };
132
- var getPlugins = (plugin) => {
133
- let plugins = "";
134
- if (plugin && plugin.length) {
135
- plugins = plugin.map(
136
- (e) => `
137
- const ${e.id} = new VConsole.VConsolePlugin('${e.id}', '${e.name}');
138
- ${getEventItems(e.event, e.id)}
139
- vConsole.addPlugin(${e.id})
140
- `
141
- ).join(";");
142
- }
143
- return plugins;
144
- };
145
- function viteVConsole(opt) {
146
- const {
147
- entry,
148
- enabled = true,
149
- config: config2 = {},
150
- plugin,
151
- customHide = false,
152
- dynamicConfig = {},
153
- eventListener = ""
154
- } = opt;
155
- let entryPath = Array.isArray(entry) ? entry : [entry];
156
- if (process.platform === "win32")
157
- entryPath = entryPath.map((item) => item.replace(/\\/g, "/"));
158
- const enabledTruly = enabled;
159
- return {
160
- name: "vite:vconsole",
161
- enforce: "pre",
162
- transform(_source, id) {
163
- if (entryPath.includes(id) && enabledTruly) {
164
- const code = `/* eslint-disable */;
165
- import VConsole from 'vconsole';
166
- // config
167
- const vConsole = new VConsole({${parseVConsoleOptions(
168
- config2
169
- )}});
170
- window.vConsole = vConsole;
171
-
172
- // plugins
173
- ${getPlugins(plugin)}
174
-
175
- // dynamic config
176
- window.vConsole.dynamicFunction = function() {
177
- if (${getDynamicConfig(dynamicConfig).length > 0}) {
178
- vConsole.setOption({${getDynamicConfig(dynamicConfig)}});
179
- }
180
- };
181
-
182
- window.vConsole.dynamicChange = {
183
- value: new Date().getTime()
184
- };
185
-
186
- window.vConsole.dynamicFunction();
187
-
188
- if (${customHide}) {
189
- vConsole.hideSwitch();
190
- }
191
-
192
- // In order to be compatible with old equipment, I used defineProperty. In the future, when proxy covers enough devices, proxy will be used.
193
- Object.defineProperty(window.vConsole.dynamicChange, 'value', {
194
- get: function() {
195
- return this._value;
196
- },
197
- set: function(newValue) {
198
- window.vConsole.dynamicFunction();
199
- this._value = newValue;
200
- }
201
- });
202
-
203
- // eventListener
204
- ${eventListener}
205
- /* eslint-enable */${_source}`;
206
- return {
207
- code,
208
- map: null
209
- // support source map
210
- };
211
- }
212
- return {
213
- code: _source,
214
- map: null
215
- // support source map
216
- };
217
- }
218
- };
219
- }
220
-
221
- // src/index.ts
222
- var config;
223
- var devtoolsInstance;
224
- var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
225
- var unpluginFactory = (options) => {
226
- var _a;
227
- const unpluginDing = {
228
- name: "unplugin-dingtalk",
229
- enforce: "pre",
230
- transformInclude(id) {
231
- return id.endsWith("main.ts") || id.endsWith("main.js");
232
- },
233
- transform(_source) {
234
- var _a2, _b, _c;
235
- if ((_a2 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a2.enable) {
236
- const code = `/* eslint-disable */;
237
- import { devtools } from '@vue/devtools'
238
- devtools.connect(${(_b = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _b.host}, ${(_c = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _c.port})
239
- /* eslint-enable */${_source};
240
- `;
241
- return {
242
- code,
243
- map: null
244
- // support source map
245
- };
246
- }
247
- return {
248
- code: _source,
249
- map: null
250
- // support source map
251
- };
252
- },
253
- vite: {
254
- configResolved(_config) {
255
- config = _config;
256
- },
257
- configureServer(server) {
258
- var _a2, _b;
259
- if (!(options == null ? void 0 : options.enable)) {
260
- return;
261
- }
262
- function debug(...args) {
263
- if (options == null ? void 0 : options.debug) {
264
- console.log(` ${import_picocolors.default.yellow("DEBUG")} `, ...args);
265
- }
266
- }
267
- const _printUrls = server.printUrls.bind(server);
268
- let source = `localhost:${config.server.port || 5173}`;
269
- const url = (_a2 = server.resolvedUrls) == null ? void 0 : _a2.local[0];
270
- if (url) {
271
- const u = new URL(url);
272
- source = u.host;
273
- }
274
- const base = server.config.base || "/";
275
- const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
276
- server.printUrls = () => {
277
- var _a3;
278
- _printUrls();
279
- console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
280
- `Open in dingtalk${((_a3 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a3.enable) ? " (with vue-devtools)" : ""}`
281
- )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
282
- };
283
- const targetURL = new URL(_targetUrl);
284
- targetURL.searchParams.append("ddtab", "true");
285
- if (options == null ? void 0 : options.corpId) {
286
- targetURL.searchParams.append("corpId", options.corpId);
287
- }
288
- server.middlewares.use("/open-dingtalk", (req, res) => {
289
- var _a3;
290
- debug(targetURL.toString());
291
- res.writeHead(302, {
292
- Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
293
- });
294
- if (((_a3 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a3.enable) && !devtoolsInstance) {
295
- devtoolsInstance = exec("npx vue-devtools");
296
- console.log(` ${import_picocolors.default.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
297
- devtoolsInstance.on("exit", () => {
298
- devtoolsInstance = void 0;
299
- });
300
- process2.on("exit", () => {
301
- if (devtoolsInstance) {
302
- devtoolsInstance.kill();
303
- }
304
- });
305
- }
306
- res.end();
307
- });
308
- }
309
- }
310
- };
311
- if ((options == null ? void 0 : options.enable) && ((_a = options == null ? void 0 : options.vconsole) == null ? void 0 : _a.enabled)) {
312
- return [viteVConsole(options == null ? void 0 : options.vconsole), unpluginDing];
313
- } else {
314
- return unpluginDing;
315
- }
316
- };
317
- var unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
318
- var src_default = unplugin;
319
-
320
- export {
321
- unpluginFactory,
322
- unplugin,
323
- src_default
324
- };