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/nuxt.cjs CHANGED
@@ -5221,7 +5221,6 @@ var import_unplugin2 = require("unplugin");
5221
5221
  var import_vite_plugin_vconsole = __toESM(require("vite-plugin-vconsole"), 1);
5222
5222
 
5223
5223
  // src/index.ts
5224
- var import_node_child_process = require("child_process");
5225
5224
  var import_node_process = __toESM(require("process"), 1);
5226
5225
  var import_node_http3 = require("http");
5227
5226
  var import_node_net2 = require("net");
@@ -6530,25 +6529,10 @@ var cwd = import_node_process.default.cwd();
6530
6529
  var config;
6531
6530
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
6532
6531
  var resovedInfo = {
6533
- devtoolsInstance: void 0,
6534
6532
  dnsServerInstence: void 0,
6535
6533
  availablePort: void 0,
6536
6534
  targetURL: void 0
6537
6535
  };
6538
- function startVueDevtools(enable) {
6539
- if (enable && !resovedInfo.devtoolsInstance) {
6540
- resovedInfo.devtoolsInstance = (0, import_node_child_process.exec)("npx vue-devtools");
6541
- console.log(` ${import_picocolors.default.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
6542
- resovedInfo.devtoolsInstance.on("exit", () => {
6543
- resovedInfo.devtoolsInstance = void 0;
6544
- });
6545
- import_node_process.default.on("exit", () => {
6546
- if (resovedInfo.devtoolsInstance) {
6547
- resovedInfo.devtoolsInstance.kill();
6548
- }
6549
- });
6550
- }
6551
- }
6552
6536
  function startDnsServer(options) {
6553
6537
  function debug(...args) {
6554
6538
  if (options == null ? void 0 : options.debug) {
@@ -6622,7 +6606,6 @@ var unpluginFactory = (options) => {
6622
6606
  return (id.endsWith("main.ts") || id.endsWith("main.js")) && !id.includes("node_modules");
6623
6607
  },
6624
6608
  async transform(_source) {
6625
- var _a4, _b, _c;
6626
6609
  if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
6627
6610
  resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
6628
6611
  (0, import_z_chii.start)({
@@ -6630,20 +6613,6 @@ var unpluginFactory = (options) => {
6630
6613
  });
6631
6614
  debug(`chii server port: ${resovedInfo.availablePort}`);
6632
6615
  }
6633
- if (options == null ? void 0 : options.enable) {
6634
- const codes = [
6635
- "/* eslint-disable */;",
6636
- ((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
6637
- 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});` : "",
6638
- "/* eslint-enable */",
6639
- `${_source};`
6640
- ];
6641
- return {
6642
- code: codes.join("\n"),
6643
- map: null
6644
- // support source map
6645
- };
6646
- }
6647
6616
  return {
6648
6617
  code: _source,
6649
6618
  map: null
@@ -6655,7 +6624,7 @@ var unpluginFactory = (options) => {
6655
6624
  config = _config;
6656
6625
  },
6657
6626
  transformIndexHtml(html) {
6658
- if (enableChii) {
6627
+ if ((options == null ? void 0 : options.enable) && enableChii) {
6659
6628
  return html.replace(
6660
6629
  "</body>",
6661
6630
  `</body>
@@ -6685,10 +6654,9 @@ var unpluginFactory = (options) => {
6685
6654
  const base = server.config.base || "/";
6686
6655
  const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
6687
6656
  server.printUrls = () => {
6688
- var _a5;
6689
6657
  _printUrls();
6690
6658
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6691
- `Open in dingtalk${((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable) ? " (with vue-devtools)" : ""}`
6659
+ "Open in dingtalk"
6692
6660
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6693
6661
  if (enableChii) {
6694
6662
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
@@ -6783,12 +6751,10 @@ var unpluginFactory = (options) => {
6783
6751
  server.middlewares.use(proxyMiddleware(resovedInfo));
6784
6752
  }
6785
6753
  server.middlewares.use("/open-dingtalk", (req, res) => {
6786
- var _a5;
6787
6754
  debug(targetURL.toString());
6788
6755
  res.writeHead(302, {
6789
6756
  Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
6790
6757
  });
6791
- startVueDevtools((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable);
6792
6758
  res.end();
6793
6759
  });
6794
6760
  startDnsServer(options);
@@ -6807,9 +6773,8 @@ var unpluginFactory = (options) => {
6807
6773
  const base = compiler.options.output.publicPath || "/";
6808
6774
  const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
6809
6775
  compiler.hooks.done.tap("unplugin-dingtalk", () => {
6810
- var _a5;
6811
6776
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6812
- `Open in dingtalk${((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable) ? " (with vue-devtools)" : ""}`
6777
+ "Open in dingtalk"
6813
6778
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6814
6779
  if (enableChii) {
6815
6780
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
@@ -6825,7 +6790,7 @@ var unpluginFactory = (options) => {
6825
6790
  startDnsServer(options);
6826
6791
  },
6827
6792
  async rspack(compiler) {
6828
- var _a4, _b, _c, _d2, _e;
6793
+ var _a4, _b, _c, _d2;
6829
6794
  if (!(options == null ? void 0 : options.enable)) {
6830
6795
  return;
6831
6796
  }
@@ -6844,7 +6809,7 @@ var unpluginFactory = (options) => {
6844
6809
  resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
6845
6810
  }
6846
6811
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6847
- `Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
6812
+ "Open in dingtalk"
6848
6813
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6849
6814
  if (enableChii) {
6850
6815
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
package/dist/nuxt.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-DTGQTH5S.js";
4
- import "./chunk-FWMGAYMG.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.cjs CHANGED
@@ -5217,7 +5217,6 @@ module.exports = __toCommonJS(rollup_exports);
5217
5217
  var import_unplugin2 = require("unplugin");
5218
5218
 
5219
5219
  // src/index.ts
5220
- var import_node_child_process = require("child_process");
5221
5220
  var import_node_process = __toESM(require("process"), 1);
5222
5221
  var import_node_http3 = require("http");
5223
5222
  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(
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-FWMGAYMG.js";
3
+ } from "./chunk-W5UIO4ZZ.js";
4
4
  import "./chunk-ZEHXGFFH.js";
5
5
 
6
6
  // src/rollup.ts
package/dist/rspack.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(
@@ -6904,7 +6869,6 @@ var rspack_default = (options) => {
6904
6869
  });
6905
6870
  }
6906
6871
  middlewares.unshift((req, res, next) => {
6907
- var _a4;
6908
6872
  if (req.url !== "/open-dingtalk") {
6909
6873
  return next();
6910
6874
  }
@@ -6913,7 +6877,6 @@ var rspack_default = (options) => {
6913
6877
  res.writeHead(302, {
6914
6878
  Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
6915
6879
  });
6916
- startVueDevtools((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable);
6917
6880
  res.end();
6918
6881
  });
6919
6882
  return middlewares;
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-FWMGAYMG.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.cts 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/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.cjs CHANGED
@@ -5218,7 +5218,6 @@ var import_unplugin2 = require("unplugin");
5218
5218
  var import_vite_plugin_vconsole = __toESM(require("vite-plugin-vconsole"), 1);
5219
5219
 
5220
5220
  // src/index.ts
5221
- var import_node_child_process = require("child_process");
5222
5221
  var import_node_process = __toESM(require("process"), 1);
5223
5222
  var import_node_http3 = require("http");
5224
5223
  var import_node_net2 = require("net");
@@ -6527,25 +6526,10 @@ var cwd = import_node_process.default.cwd();
6527
6526
  var config;
6528
6527
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
6529
6528
  var resovedInfo = {
6530
- devtoolsInstance: void 0,
6531
6529
  dnsServerInstence: void 0,
6532
6530
  availablePort: void 0,
6533
6531
  targetURL: void 0
6534
6532
  };
6535
- function startVueDevtools(enable) {
6536
- if (enable && !resovedInfo.devtoolsInstance) {
6537
- resovedInfo.devtoolsInstance = (0, import_node_child_process.exec)("npx vue-devtools");
6538
- console.log(` ${import_picocolors.default.green("\u279C")} vue-devtools is running. If the devtools has no data, please refresh the page in dingtalk.`);
6539
- resovedInfo.devtoolsInstance.on("exit", () => {
6540
- resovedInfo.devtoolsInstance = void 0;
6541
- });
6542
- import_node_process.default.on("exit", () => {
6543
- if (resovedInfo.devtoolsInstance) {
6544
- resovedInfo.devtoolsInstance.kill();
6545
- }
6546
- });
6547
- }
6548
- }
6549
6533
  function startDnsServer(options) {
6550
6534
  function debug(...args) {
6551
6535
  if (options == null ? void 0 : options.debug) {
@@ -6619,7 +6603,6 @@ var unpluginFactory = (options) => {
6619
6603
  return (id.endsWith("main.ts") || id.endsWith("main.js")) && !id.includes("node_modules");
6620
6604
  },
6621
6605
  async transform(_source) {
6622
- var _a4, _b, _c;
6623
6606
  if ((options == null ? void 0 : options.enable) && enableChii && !resovedInfo.availablePort) {
6624
6607
  resovedInfo.availablePort = await (0, import_get_port_please.getRandomPort)();
6625
6608
  (0, import_z_chii.start)({
@@ -6627,20 +6610,6 @@ var unpluginFactory = (options) => {
6627
6610
  });
6628
6611
  debug(`chii server port: ${resovedInfo.availablePort}`);
6629
6612
  }
6630
- if (options == null ? void 0 : options.enable) {
6631
- const codes = [
6632
- "/* eslint-disable */;",
6633
- ((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
6634
- 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});` : "",
6635
- "/* eslint-enable */",
6636
- `${_source};`
6637
- ];
6638
- return {
6639
- code: codes.join("\n"),
6640
- map: null
6641
- // support source map
6642
- };
6643
- }
6644
6613
  return {
6645
6614
  code: _source,
6646
6615
  map: null
@@ -6652,7 +6621,7 @@ var unpluginFactory = (options) => {
6652
6621
  config = _config;
6653
6622
  },
6654
6623
  transformIndexHtml(html) {
6655
- if (enableChii) {
6624
+ if ((options == null ? void 0 : options.enable) && enableChii) {
6656
6625
  return html.replace(
6657
6626
  "</body>",
6658
6627
  `</body>
@@ -6682,10 +6651,9 @@ var unpluginFactory = (options) => {
6682
6651
  const base = server.config.base || "/";
6683
6652
  const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
6684
6653
  server.printUrls = () => {
6685
- var _a5;
6686
6654
  _printUrls();
6687
6655
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6688
- `Open in dingtalk${((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable) ? " (with vue-devtools)" : ""}`
6656
+ "Open in dingtalk"
6689
6657
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6690
6658
  if (enableChii) {
6691
6659
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
@@ -6780,12 +6748,10 @@ var unpluginFactory = (options) => {
6780
6748
  server.middlewares.use(proxyMiddleware(resovedInfo));
6781
6749
  }
6782
6750
  server.middlewares.use("/open-dingtalk", (req, res) => {
6783
- var _a5;
6784
6751
  debug(targetURL.toString());
6785
6752
  res.writeHead(302, {
6786
6753
  Location: `dingtalk://dingtalkclient/page/link?url=${encodeURIComponent(targetURL.toString())}`
6787
6754
  });
6788
- startVueDevtools((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable);
6789
6755
  res.end();
6790
6756
  });
6791
6757
  startDnsServer(options);
@@ -6804,9 +6770,8 @@ var unpluginFactory = (options) => {
6804
6770
  const base = compiler.options.output.publicPath || "/";
6805
6771
  const _targetUrl = (_b = options == null ? void 0 : options.targetUrl) != null ? _b : `http://${source}${base}`;
6806
6772
  compiler.hooks.done.tap("unplugin-dingtalk", () => {
6807
- var _a5;
6808
6773
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6809
- `Open in dingtalk${((_a5 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a5.enable) ? " (with vue-devtools)" : ""}`
6774
+ "Open in dingtalk"
6810
6775
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6811
6776
  if (enableChii) {
6812
6777
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
@@ -6822,7 +6787,7 @@ var unpluginFactory = (options) => {
6822
6787
  startDnsServer(options);
6823
6788
  },
6824
6789
  async rspack(compiler) {
6825
- var _a4, _b, _c, _d2, _e;
6790
+ var _a4, _b, _c, _d2;
6826
6791
  if (!(options == null ? void 0 : options.enable)) {
6827
6792
  return;
6828
6793
  }
@@ -6841,7 +6806,7 @@ var unpluginFactory = (options) => {
6841
6806
  resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
6842
6807
  }
6843
6808
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6844
- `Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
6809
+ "Open in dingtalk"
6845
6810
  )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6846
6811
  if (enableChii) {
6847
6812
  console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
package/dist/vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-DTGQTH5S.js";
4
- import "./chunk-FWMGAYMG.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