unplugin-dingtalk 0.5.5 → 1001.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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  - [x] 在钉钉内打开调试链接
9
9
  - [x] 可选注入 [vConsole](https://github.com/Tencent/vConsole) 用于调试 (仅支持 vite )
10
10
  - [x] 可选注入 [chii](https://github.com/liriliri/chii) 用于调试
11
- - [x] 可选打开 [vue-devtools](https://github.com/vuejs/devtools) 用于调试
11
+ - [x] ~~可选打开 [vue-devtools](https://github.com/vuejs/devtools) 用于调试~~ 已移除
12
12
  - [x] 支持调试 `HttpOnly` cookies
13
13
 
14
14
  ![images](https://github.com/zcf0508/unplugin-dingtalk/raw/main/images/Snipaste_2024-05-22_11-25-35.png)
@@ -35,11 +35,6 @@ interface Options {
35
35
  debugCookies?: string[]
36
36
  /** 默认值 `true` */
37
37
  chii?: boolean
38
- vueDevtools?: {
39
- enable?: boolean
40
- host?: string
41
- port?: number
42
- }
43
38
  }
44
39
  ```
45
40
 
package/dist/astro.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-2MTCPWWF.js";
3
+ } from "./chunk-W5UIO4ZZ.js";
4
4
  import "./chunk-ZEHXGFFH.js";
5
5
 
6
6
  // src/astro.ts
@@ -8,7 +8,6 @@ import {
8
8
  } from "./chunk-ZEHXGFFH.js";
9
9
 
10
10
  // src/index.ts
11
- import { exec } from "node:child_process";
12
11
  import process2 from "node:process";
13
12
  import { ServerResponse } from "node:http";
14
13
  import { Socket } from "node:net";
@@ -1313,25 +1312,10 @@ var cwd = process2.cwd();
1313
1312
  var config;
1314
1313
  var colorUrl = (url) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`));
1315
1314
  var resovedInfo = {
1316
- devtoolsInstance: void 0,
1317
1315
  dnsServerInstence: void 0,
1318
1316
  availablePort: void 0,
1319
1317
  targetURL: void 0
1320
1318
  };
1321
- function startVueDevtools(enable) {
1322
- if (enable && !resovedInfo.devtoolsInstance) {
1323
- resovedInfo.devtoolsInstance = exec("npx vue-devtools");
1324
- console.log(` ${c.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
1325
- resovedInfo.devtoolsInstance.on("exit", () => {
1326
- resovedInfo.devtoolsInstance = void 0;
1327
- });
1328
- process2.on("exit", () => {
1329
- if (resovedInfo.devtoolsInstance) {
1330
- resovedInfo.devtoolsInstance.kill();
1331
- }
1332
- });
1333
- }
1334
- }
1335
1319
  function startDnsServer(options) {
1336
1320
  function debug(...args) {
1337
1321
  if (options == null ? void 0 : options.debug) {
@@ -1405,7 +1389,6 @@ var unpluginFactory = (options) => {
1405
1389
  return (id.endsWith("main.ts") || id.endsWith("main.js")) && !id.includes("node_modules");
1406
1390
  },
1407
1391
  async transform(_source) {
1408
- var _a, _b, _c;
1409
1392
  if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
1410
1393
  resovedInfo.availablePort = await getRandomPort();
1411
1394
  start({
@@ -1413,20 +1396,6 @@ var unpluginFactory = (options) => {
1413
1396
  });
1414
1397
  debug(`chii server port: ${resovedInfo.availablePort}`);
1415
1398
  }
1416
- if (options == null ? void 0 : options.enable) {
1417
- const codes = [
1418
- "/* eslint-disable */;",
1419
- ((_a = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a.enable) ? `import { devtools } from '@vue/devtools'
1420
- devtools.connect(${((_b = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _b.host) ? `"${options.vueDevtools.host}"` : void 0}, ${((_c = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _c.port) ? `${options.vueDevtools.port}` : void 0});` : "",
1421
- "/* eslint-enable */",
1422
- `${_source};`
1423
- ];
1424
- return {
1425
- code: codes.join("\n"),
1426
- map: null
1427
- // support source map
1428
- };
1429
- }
1430
1399
  return {
1431
1400
  code: _source,
1432
1401
  map: null
@@ -1468,10 +1437,9 @@ var unpluginFactory = (options) => {
1468
1437
  const base = server.config.base || "/";
1469
1438
  const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
1470
1439
  server.printUrls = () => {
1471
- var _a2;
1472
1440
  _printUrls();
1473
1441
  console.log(` ${c.green("\u279C")} ${c.bold(
1474
- `Open in dingtalk${((_a2 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a2.enable) ? " (with vue-devtools)" : ""}`
1442
+ "Open in dingtalk"
1475
1443
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
1476
1444
  if (enableChii) {
1477
1445
  console.log(` ${c.green("\u279C")} ${c.bold(
@@ -1566,12 +1534,10 @@ var unpluginFactory = (options) => {
1566
1534
  server.middlewares.use(proxyMiddleware(resovedInfo));
1567
1535
  }
1568
1536
  server.middlewares.use("/open-dingtalk", (req, res) => {
1569
- var _a2;
1570
1537
  debug(targetURL.toString());
1571
1538
  res.writeHead(302, {
1572
1539
  Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
1573
1540
  });
1574
- startVueDevtools((_a2 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a2.enable);
1575
1541
  res.end();
1576
1542
  });
1577
1543
  startDnsServer(options);
@@ -1590,9 +1556,8 @@ var unpluginFactory = (options) => {
1590
1556
  const base = compiler.options.output.publicPath || "/";
1591
1557
  const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
1592
1558
  compiler.hooks.done.tap("unplugin-dingtalk", () => {
1593
- var _a2;
1594
1559
  console.log(` ${c.green("\u279C")} ${c.bold(
1595
- `Open in dingtalk${((_a2 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a2.enable) ? " (with vue-devtools)" : ""}`
1560
+ "Open in dingtalk"
1596
1561
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
1597
1562
  if (enableChii) {
1598
1563
  console.log(` ${c.green("\u279C")} ${c.bold(
@@ -1608,7 +1573,7 @@ var unpluginFactory = (options) => {
1608
1573
  startDnsServer(options);
1609
1574
  },
1610
1575
  async rspack(compiler) {
1611
- var _a, _b, _c, _d, _e;
1576
+ var _a, _b, _c, _d;
1612
1577
  if (!(options == null ? void 0 : options.enable)) {
1613
1578
  return;
1614
1579
  }
@@ -1627,7 +1592,7 @@ var unpluginFactory = (options) => {
1627
1592
  resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
1628
1593
  }
1629
1594
  console.log(` ${c.green("\u279C")} ${c.bold(
1630
- `Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
1595
+ "Open in dingtalk"
1631
1596
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
1632
1597
  if (enableChii) {
1633
1598
  console.log(` ${c.green("\u279C")} ${c.bold(
@@ -1645,7 +1610,6 @@ var index_default = unplugin;
1645
1610
  export {
1646
1611
  fetch,
1647
1612
  resovedInfo,
1648
- startVueDevtools,
1649
1613
  startDnsServer,
1650
1614
  unpluginFactory,
1651
1615
  unplugin,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-2MTCPWWF.js";
3
+ } from "./chunk-W5UIO4ZZ.js";
4
4
 
5
5
  // src/vite.ts
6
6
  import { createVitePlugin } from "unplugin";
package/dist/esbuild.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-2MTCPWWF.js";
3
+ } from "./chunk-W5UIO4ZZ.js";
4
4
  import "./chunk-ZEHXGFFH.js";
5
5
 
6
6
  // src/esbuild.ts
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as _unplugin from 'unplugin';
2
2
  import { UnpluginFactory } from 'unplugin';
3
- import { ChildProcess } from 'node:child_process';
4
3
  import dns2 from 'dns2';
5
4
  import { Options } from './types.js';
6
5
  import 'webpack-dev-server';
@@ -8,14 +7,12 @@ import 'node:http';
8
7
  import 'vite-plugin-vconsole';
9
8
 
10
9
  declare const resovedInfo: {
11
- devtoolsInstance: ChildProcess | undefined;
12
10
  dnsServerInstence: ReturnType<typeof dns2.createServer> | undefined;
13
11
  availablePort: number | undefined;
14
12
  targetURL: undefined | URL;
15
13
  };
16
- declare function startVueDevtools(enable?: boolean): void;
17
14
  declare function startDnsServer(options?: Options): void;
18
15
  declare const unpluginFactory: UnpluginFactory<Options | undefined, boolean>;
19
16
  declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
20
17
 
21
- export { unplugin as default, resovedInfo, startDnsServer, startVueDevtools, unplugin, unpluginFactory };
18
+ export { unplugin as default, resovedInfo, startDnsServer, unplugin, unpluginFactory };
package/dist/index.js CHANGED
@@ -2,16 +2,14 @@ import {
2
2
  index_default,
3
3
  resovedInfo,
4
4
  startDnsServer,
5
- startVueDevtools,
6
5
  unplugin,
7
6
  unpluginFactory
8
- } from "./chunk-2MTCPWWF.js";
7
+ } from "./chunk-W5UIO4ZZ.js";
9
8
  import "./chunk-ZEHXGFFH.js";
10
9
  export {
11
10
  index_default as default,
12
11
  resovedInfo,
13
12
  startDnsServer,
14
- startVueDevtools,
15
13
  unplugin,
16
14
  unpluginFactory
17
15
  };
package/dist/nuxt.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-JXEH4EKT.js";
4
- import "./chunk-2MTCPWWF.js";
3
+ } from "./chunk-WE6LHUBA.js";
4
+ import "./chunk-W5UIO4ZZ.js";
5
5
  import "./chunk-ZEHXGFFH.js";
6
6
 
7
7
  // src/nuxt.ts
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-2MTCPWWF.js";
3
+ } from "./chunk-W5UIO4ZZ.js";
4
4
  import "./chunk-ZEHXGFFH.js";
5
5
 
6
6
  // src/rollup.ts
package/dist/rspack.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  fetch,
3
3
  resovedInfo,
4
- startVueDevtools,
5
4
  unpluginFactory
6
- } from "./chunk-2MTCPWWF.js";
5
+ } from "./chunk-W5UIO4ZZ.js";
7
6
  import "./chunk-ZEHXGFFH.js";
8
7
 
9
8
  // src/rspack.ts
@@ -60,7 +59,6 @@ var rspack_default = (options) => {
60
59
  });
61
60
  }
62
61
  middlewares.unshift((req, res, next) => {
63
- var _a;
64
62
  if (req.url !== "/open-dingtalk") {
65
63
  return next();
66
64
  }
@@ -69,7 +67,6 @@ var rspack_default = (options) => {
69
67
  res.writeHead(302, {
70
68
  Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
71
69
  });
72
- startVueDevtools((_a = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a.enable);
73
70
  res.end();
74
71
  });
75
72
  return middlewares;
package/dist/types.d.ts CHANGED
@@ -21,13 +21,6 @@ interface Options {
21
21
  host: string;
22
22
  };
23
23
  debugCookies?: string[];
24
- vueDevtools?: {
25
- enable?: boolean;
26
- /** default 127.0.0.1 */
27
- host?: string;
28
- /** default 8098 */
29
- port?: number;
30
- };
31
24
  }
32
25
  type SetupMiddlewares = (middlewares: webpack_dev_server.Middleware[], devServer: webpack_dev_server) => webpack_dev_server.Middleware[];
33
26
  type NextFunction = () => void;
package/dist/vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-JXEH4EKT.js";
4
- import "./chunk-2MTCPWWF.js";
3
+ } from "./chunk-WE6LHUBA.js";
4
+ import "./chunk-W5UIO4ZZ.js";
5
5
  import "./chunk-ZEHXGFFH.js";
6
6
  export {
7
7
  vite_default as default
package/dist/webpack.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  fetch,
3
3
  resovedInfo,
4
- startVueDevtools,
5
4
  unpluginFactory
6
- } from "./chunk-2MTCPWWF.js";
5
+ } from "./chunk-W5UIO4ZZ.js";
7
6
  import "./chunk-ZEHXGFFH.js";
8
7
 
9
8
  // src/webpack.ts
@@ -57,13 +56,11 @@ var webpack_default = (options) => {
57
56
  });
58
57
  }
59
58
  devServer.app.get("/open-dingtalk", (req, res) => {
60
- var _a;
61
59
  const targetURL = resovedInfo.targetURL;
62
60
  debug(targetURL.toString());
63
61
  res.writeHead(302, {
64
62
  Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
65
63
  });
66
- startVueDevtools((_a = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a.enable);
67
64
  res.end();
68
65
  });
69
66
  return middlewares;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-dingtalk",
3
3
  "type": "module",
4
- "version": "0.5.5",
4
+ "version": "1001.0.0",
5
5
  "description": "",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/zcf0508/unplugin-dingtalk#readme",
@@ -20,54 +20,18 @@
20
20
  "transform"
21
21
  ],
22
22
  "exports": {
23
- ".": {
24
- "types": "./dist/index.d.ts",
25
- "import": "./dist/index.js",
26
- "require": "./dist/index.cjs"
27
- },
28
- "./astro": {
29
- "types": "./dist/astro.d.ts",
30
- "import": "./dist/astro.js",
31
- "require": "./dist/astro.cjs"
32
- },
33
- "./rspack": {
34
- "types": "./dist/rspack.d.ts",
35
- "import": "./dist/rspack.js",
36
- "require": "./dist/rspack.cjs"
37
- },
38
- "./vite": {
39
- "types": "./dist/vite.d.ts",
40
- "import": "./dist/vite.js",
41
- "require": "./dist/vite.cjs"
42
- },
43
- "./webpack": {
44
- "types": "./dist/webpack.d.ts",
45
- "import": "./dist/webpack.js",
46
- "require": "./dist/webpack.cjs"
47
- },
48
- "./rollup": {
49
- "types": "./dist/rollup.d.ts",
50
- "import": "./dist/rollup.js",
51
- "require": "./dist/rollup.cjs"
52
- },
53
- "./esbuild": {
54
- "types": "./dist/esbuild.d.ts",
55
- "import": "./dist/esbuild.js",
56
- "require": "./dist/esbuild.cjs"
57
- },
58
- "./nuxt": {
59
- "types": "./dist/nuxt.d.ts",
60
- "import": "./dist/nuxt.js",
61
- "require": "./dist/nuxt.cjs"
62
- },
63
- "./types": {
64
- "types": "./dist/types.d.ts",
65
- "import": "./dist/types.js",
66
- "require": "./dist/types.cjs"
67
- },
23
+ ".": "./dist/index.js",
24
+ "./astro": "./dist/astro.js",
25
+ "./rspack": "./dist/rspack.js",
26
+ "./vite": "./dist/vite.js",
27
+ "./webpack": "./dist/webpack.js",
28
+ "./rollup": "./dist/rollup.js",
29
+ "./esbuild": "./dist/esbuild.js",
30
+ "./nuxt": "./dist/nuxt.js",
31
+ "./types": "./dist/types.js",
68
32
  "./*": "./*"
69
33
  },
70
- "main": "dist/index.cjs",
34
+ "main": "dist/index.js",
71
35
  "module": "dist/index.js",
72
36
  "types": "dist/index.d.ts",
73
37
  "typesVersions": {
@@ -85,7 +49,6 @@
85
49
  "@nuxt/kit": "^3",
86
50
  "@nuxt/schema": "^3",
87
51
  "@rsbuild/core": "^0.7.9",
88
- "@vue/devtools": "^7.2.1",
89
52
  "esbuild": "*",
90
53
  "rollup": "^3",
91
54
  "vconsole": "^3.15.1",
@@ -102,9 +65,6 @@
102
65
  "@rsbuild/core": {
103
66
  "optional": true
104
67
  },
105
- "@vue/devtools": {
106
- "optional": true
107
- },
108
68
  "esbuild": {
109
69
  "optional": true
110
70
  },
@@ -141,7 +101,6 @@
141
101
  "bumpp": "^9.2.0",
142
102
  "chalk": "^5.3.0",
143
103
  "eslint": "^8.55.0",
144
- "esno": "^4.0.0",
145
104
  "fast-glob": "^3.3.2",
146
105
  "node-fetch": "^3.3.2",
147
106
  "nodemon": "^3.0.2",
@@ -156,11 +115,10 @@
156
115
  "scripts": {
157
116
  "build": "tsup",
158
117
  "dev": "tsup --watch src",
159
- "build:fix": "esno scripts/postbuild.ts",
160
118
  "lint": "eslint .",
161
119
  "play": "npm -C playground run dev",
162
120
  "release": "bumpp",
163
- "start": "esno src/index.ts",
121
+ "typecheck": "tsc --noEmit --project tsconfig.json",
164
122
  "test": "vitest"
165
123
  }
166
124
  }