unplugin-dingtalk 0.5.3 → 1000.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/webpack.cjs CHANGED
@@ -6511,7 +6511,6 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
6511
6511
  }
6512
6512
 
6513
6513
  // src/index.ts
6514
- var import_node_child_process = require("child_process");
6515
6514
  var import_node_process = __toESM(require("process"), 1);
6516
6515
  var import_node_http3 = require("http");
6517
6516
  var import_node_net2 = require("net");
@@ -6526,25 +6525,10 @@ var cwd = import_node_process.default.cwd();
6526
6525
  var config;
6527
6526
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
6528
6527
  var resovedInfo = {
6529
- devtoolsInstance: void 0,
6530
6528
  dnsServerInstence: void 0,
6531
6529
  availablePort: void 0,
6532
6530
  targetURL: void 0
6533
6531
  };
6534
- function startVueDevtools(enable) {
6535
- if (enable && !resovedInfo.devtoolsInstance) {
6536
- resovedInfo.devtoolsInstance = (0, import_node_child_process.exec)("npx vue-devtools");
6537
- console.log(` ${import_picocolors.default.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
6538
- resovedInfo.devtoolsInstance.on("exit", () => {
6539
- resovedInfo.devtoolsInstance = void 0;
6540
- });
6541
- import_node_process.default.on("exit", () => {
6542
- if (resovedInfo.devtoolsInstance) {
6543
- resovedInfo.devtoolsInstance.kill();
6544
- }
6545
- });
6546
- }
6547
- }
6548
6532
  function startDnsServer(options) {
6549
6533
  function debug(...args) {
6550
6534
  if (options == null ? void 0 : options.debug) {
@@ -6618,7 +6602,6 @@ var unpluginFactory = (options) => {
6618
6602
  return (id.endsWith("main.ts") || id.endsWith("main.js")) && !id.includes("node_modules");
6619
6603
  },
6620
6604
  async transform(_source) {
6621
- var _a4, _b, _c;
6622
6605
  if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
6623
6606
  resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
6624
6607
  (0, import_z_chii.start)({
@@ -6626,20 +6609,6 @@ var unpluginFactory = (options) => {
6626
6609
  });
6627
6610
  debug(`chii server port: ${resovedInfo.availablePort}`);
6628
6611
  }
6629
- if (options == null ? void 0 : options.enable) {
6630
- const codes = [
6631
- "/* eslint-disable */;",
6632
- ((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
6633
- 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});` : "",
6634
- "/* eslint-enable */",
6635
- `${_source};`
6636
- ];
6637
- return {
6638
- code: codes.join("\n"),
6639
- map: null
6640
- // support source map
6641
- };
6642
- }
6643
6612
  return {
6644
6613
  code: _source,
6645
6614
  map: null
@@ -6651,7 +6620,7 @@ var unpluginFactory = (options) => {
6651
6620
  config = _config;
6652
6621
  },
6653
6622
  transformIndexHtml(html) {
6654
- if (enableChii) {
6623
+ if ((options == null ? void 0 : options.enable) && enableChii) {
6655
6624
  return html.replace(
6656
6625
  "</body>",
6657
6626
  `</body>
@@ -6681,10 +6650,9 @@ var unpluginFactory = (options) => {
6681
6650
  const base = server.config.base || "/";
6682
6651
  const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
6683
6652
  server.printUrls = () => {
6684
- var _a5;
6685
6653
  _printUrls();
6686
6654
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6687
- `Open in dingtalk${((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable) ? " (with vue-devtools)" : ""}`
6655
+ "Open in dingtalk"
6688
6656
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6689
6657
  if (enableChii) {
6690
6658
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
@@ -6779,12 +6747,10 @@ var unpluginFactory = (options) => {
6779
6747
  server.middlewares.use(proxyMiddleware(resovedInfo));
6780
6748
  }
6781
6749
  server.middlewares.use("/open-dingtalk", (req, res) => {
6782
- var _a5;
6783
6750
  debug(targetURL.toString());
6784
6751
  res.writeHead(302, {
6785
6752
  Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
6786
6753
  });
6787
- startVueDevtools((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable);
6788
6754
  res.end();
6789
6755
  });
6790
6756
  startDnsServer(options);
@@ -6803,9 +6769,8 @@ var unpluginFactory = (options) => {
6803
6769
  const base = compiler.options.output.publicPath || "/";
6804
6770
  const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
6805
6771
  compiler.hooks.done.tap("unplugin-dingtalk", () => {
6806
- var _a5;
6807
6772
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6808
- `Open in dingtalk${((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable) ? " (with vue-devtools)" : ""}`
6773
+ "Open in dingtalk"
6809
6774
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6810
6775
  if (enableChii) {
6811
6776
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
@@ -6821,7 +6786,7 @@ var unpluginFactory = (options) => {
6821
6786
  startDnsServer(options);
6822
6787
  },
6823
6788
  async rspack(compiler) {
6824
- var _a4, _b, _c, _d2, _e;
6789
+ var _a4, _b, _c, _d2;
6825
6790
  if (!(options == null ? void 0 : options.enable)) {
6826
6791
  return;
6827
6792
  }
@@ -6840,7 +6805,7 @@ var unpluginFactory = (options) => {
6840
6805
  resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
6841
6806
  }
6842
6807
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6843
- `Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
6808
+ "Open in dingtalk"
6844
6809
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6845
6810
  if (enableChii) {
6846
6811
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
@@ -6901,13 +6866,11 @@ var webpack_default = (options) => {
6901
6866
  });
6902
6867
  }
6903
6868
  devServer.app.get("/open-dingtalk", (req, res) => {
6904
- var _a4;
6905
6869
  const targetURL = resovedInfo.targetURL;
6906
6870
  debug(targetURL.toString());
6907
6871
  res.writeHead(302, {
6908
6872
  Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
6909
6873
  });
6910
- startVueDevtools((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable);
6911
6874
  res.end();
6912
6875
  });
6913
6876
  return middlewares;
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-FWMGAYMG.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.3",
4
+ "version": "1000.0.0",
5
5
  "description": "",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/zcf0508/unplugin-dingtalk#readme",
@@ -85,7 +85,6 @@
85
85
  "@nuxt/kit": "^3",
86
86
  "@nuxt/schema": "^3",
87
87
  "@rsbuild/core": "^0.7.9",
88
- "@vue/devtools": "^7.2.1",
89
88
  "esbuild": "*",
90
89
  "rollup": "^3",
91
90
  "vconsole": "^3.15.1",
@@ -102,9 +101,6 @@
102
101
  "@rsbuild/core": {
103
102
  "optional": true
104
103
  },
105
- "@vue/devtools": {
106
- "optional": true
107
- },
108
104
  "esbuild": {
109
105
  "optional": true
110
106
  },
@@ -160,7 +156,7 @@
160
156
  "lint": "eslint .",
161
157
  "play": "npm -C playground run dev",
162
158
  "release": "bumpp",
163
- "start": "esno src/index.ts",
159
+ "typecheck": "tsc --noEmit --project tsconfig.json",
164
160
  "test": "vitest"
165
161
  }
166
162
  }