unplugin-dingtalk 0.3.1 → 0.4.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/astro.cjs CHANGED
@@ -6514,6 +6514,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
6514
6514
  var import_cookie = __toESM(require("cookie"), 1);
6515
6515
  var import_chii = require("chii");
6516
6516
  var import_get_port_please = require("get-port-please");
6517
+ var cwd = import_node_process.default.cwd();
6517
6518
  var config;
6518
6519
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
6519
6520
  var resovedInfo = {
@@ -6546,17 +6547,18 @@ var unpluginFactory = (options) => {
6546
6547
  port: resovedInfo.availablePort
6547
6548
  });
6548
6549
  }
6549
- if ((options == null ? void 0 : options.enable) && ((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable)) {
6550
+ if (options == null ? void 0 : options.enable) {
6550
6551
  const codes = [
6551
- `/* eslint-disable */;
6552
- import { devtools } from '@vue/devtools'
6553
- 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});`,
6552
+ "/* eslint-disable */;",
6553
+ ((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
6554
+ 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});` : "",
6554
6555
  (options == null ? void 0 : options.enable) && enableChii ? `(() => {
6555
6556
  const script = document.createElement('script');
6556
6557
  script.src="http://localhost:${resovedInfo.availablePort}/target.js";
6557
6558
  document.body.appendChild(script);
6558
6559
  })()` : "",
6559
- `/* eslint-enable */${_source};`
6560
+ "/* eslint-enable */",
6561
+ `${_source};`
6560
6562
  ];
6561
6563
  return {
6562
6564
  code: codes.join("\n"),
@@ -6686,6 +6688,34 @@ var unpluginFactory = (options) => {
6686
6688
  if (options == null ? void 0 : options.corpId) {
6687
6689
  resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
6688
6690
  }
6691
+ },
6692
+ async rspack(compiler) {
6693
+ var _a4, _b, _c, _d2, _e;
6694
+ if (!(options == null ? void 0 : options.enable)) {
6695
+ return;
6696
+ }
6697
+ const devServerOptions = __spreadValues(__spreadValues({
6698
+ host: "localhost",
6699
+ port: 8080
6700
+ }, compiler.options.devServer), (_c = (_b = await ((_a4 = await import("@rsbuild/core")) == null ? void 0 : _a4.loadConfig({
6701
+ cwd
6702
+ }))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
6703
+ const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
6704
+ const base = compiler.options.output.publicPath || "/";
6705
+ const _targetUrl = (_d2 = options == null ? void 0 : options.targetUrl) != null ? _d2 : `http://${source}${base}`;
6706
+ resovedInfo.targetURL = new URL(_targetUrl);
6707
+ resovedInfo.targetURL.searchParams.append("ddtab", "true");
6708
+ if (options == null ? void 0 : options.corpId) {
6709
+ resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
6710
+ }
6711
+ console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6712
+ `Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
6713
+ )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6714
+ if (enableChii) {
6715
+ console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6716
+ "Click to open chrome devtools"
6717
+ )}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
6718
+ }
6689
6719
  }
6690
6720
  };
6691
6721
  return unpluginDing;
package/dist/astro.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Options } from './types.cjs';
2
2
  import 'webpack-dev-server';
3
+ import 'node:http';
3
4
  import 'vite-plugin-vconsole';
4
5
 
5
6
  declare const _default: (options: Options) => {
package/dist/astro.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Options } from './types.js';
2
2
  import 'webpack-dev-server';
3
+ import 'node:http';
3
4
  import 'vite-plugin-vconsole';
4
5
 
5
6
  declare const _default: (options: Options) => {
package/dist/astro.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  src_default
3
- } from "./chunk-E34H52KV.js";
3
+ } from "./chunk-RDTWBIQD.js";
4
4
  import "./chunk-PMOTCIQR.js";
5
5
 
6
6
  // src/astro.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-E34H52KV.js";
3
+ } from "./chunk-RDTWBIQD.js";
4
4
 
5
5
  // src/vite.ts
6
6
  import { createVitePlugin } from "unplugin";
@@ -1305,6 +1305,7 @@ import c from "picocolors";
1305
1305
  import cookie from "cookie";
1306
1306
  import { start } from "chii";
1307
1307
  import { getRandomPort } from "get-port-please";
1308
+ var cwd = process2.cwd();
1308
1309
  var config;
1309
1310
  var colorUrl = (url) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`));
1310
1311
  var resovedInfo = {
@@ -1337,17 +1338,18 @@ var unpluginFactory = (options) => {
1337
1338
  port: resovedInfo.availablePort
1338
1339
  });
1339
1340
  }
1340
- if ((options == null ? void 0 : options.enable) && ((_a = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a.enable)) {
1341
+ if (options == null ? void 0 : options.enable) {
1341
1342
  const codes = [
1342
- `/* eslint-disable */;
1343
- import { devtools } from '@vue/devtools'
1344
- 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});`,
1343
+ "/* eslint-disable */;",
1344
+ ((_a = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a.enable) ? `import { devtools } from '@vue/devtools'
1345
+ 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});` : "",
1345
1346
  (options == null ? void 0 : options.enable) && enableChii ? `(() => {
1346
1347
  const script = document.createElement('script');
1347
1348
  script.src="http://localhost:${resovedInfo.availablePort}/target.js";
1348
1349
  document.body.appendChild(script);
1349
1350
  })()` : "",
1350
- `/* eslint-enable */${_source};`
1351
+ "/* eslint-enable */",
1352
+ `${_source};`
1351
1353
  ];
1352
1354
  return {
1353
1355
  code: codes.join("\n"),
@@ -1477,6 +1479,34 @@ var unpluginFactory = (options) => {
1477
1479
  if (options == null ? void 0 : options.corpId) {
1478
1480
  resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
1479
1481
  }
1482
+ },
1483
+ async rspack(compiler) {
1484
+ var _a, _b, _c, _d, _e;
1485
+ if (!(options == null ? void 0 : options.enable)) {
1486
+ return;
1487
+ }
1488
+ const devServerOptions = __spreadValues(__spreadValues({
1489
+ host: "localhost",
1490
+ port: 8080
1491
+ }, compiler.options.devServer), (_c = (_b = await ((_a = await import("@rsbuild/core")) == null ? void 0 : _a.loadConfig({
1492
+ cwd
1493
+ }))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
1494
+ const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
1495
+ const base = compiler.options.output.publicPath || "/";
1496
+ const _targetUrl = (_d = options == null ? void 0 : options.targetUrl) != null ? _d : `http://${source}${base}`;
1497
+ resovedInfo.targetURL = new URL(_targetUrl);
1498
+ resovedInfo.targetURL.searchParams.append("ddtab", "true");
1499
+ if (options == null ? void 0 : options.corpId) {
1500
+ resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
1501
+ }
1502
+ console.log(` ${c.green("\u279C")} ${c.bold(
1503
+ `Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
1504
+ )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
1505
+ if (enableChii) {
1506
+ console.log(` ${c.green("\u279C")} ${c.bold(
1507
+ "Click to open chrome devtools"
1508
+ )}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
1509
+ }
1480
1510
  }
1481
1511
  };
1482
1512
  return unpluginDing;
package/dist/esbuild.cjs CHANGED
@@ -6515,6 +6515,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
6515
6515
  var import_cookie = __toESM(require("cookie"), 1);
6516
6516
  var import_chii = require("chii");
6517
6517
  var import_get_port_please = require("get-port-please");
6518
+ var cwd = import_node_process.default.cwd();
6518
6519
  var config;
6519
6520
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
6520
6521
  var resovedInfo = {
@@ -6547,17 +6548,18 @@ var unpluginFactory = (options) => {
6547
6548
  port: resovedInfo.availablePort
6548
6549
  });
6549
6550
  }
6550
- if ((options == null ? void 0 : options.enable) && ((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable)) {
6551
+ if (options == null ? void 0 : options.enable) {
6551
6552
  const codes = [
6552
- `/* eslint-disable */;
6553
- import { devtools } from '@vue/devtools'
6554
- 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});`,
6553
+ "/* eslint-disable */;",
6554
+ ((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
6555
+ 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});` : "",
6555
6556
  (options == null ? void 0 : options.enable) && enableChii ? `(() => {
6556
6557
  const script = document.createElement('script');
6557
6558
  script.src="http://localhost:${resovedInfo.availablePort}/target.js";
6558
6559
  document.body.appendChild(script);
6559
6560
  })()` : "",
6560
- `/* eslint-enable */${_source};`
6561
+ "/* eslint-enable */",
6562
+ `${_source};`
6561
6563
  ];
6562
6564
  return {
6563
6565
  code: codes.join("\n"),
@@ -6687,6 +6689,34 @@ var unpluginFactory = (options) => {
6687
6689
  if (options == null ? void 0 : options.corpId) {
6688
6690
  resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
6689
6691
  }
6692
+ },
6693
+ async rspack(compiler) {
6694
+ var _a4, _b, _c, _d2, _e;
6695
+ if (!(options == null ? void 0 : options.enable)) {
6696
+ return;
6697
+ }
6698
+ const devServerOptions = __spreadValues(__spreadValues({
6699
+ host: "localhost",
6700
+ port: 8080
6701
+ }, compiler.options.devServer), (_c = (_b = await ((_a4 = await import("@rsbuild/core")) == null ? void 0 : _a4.loadConfig({
6702
+ cwd
6703
+ }))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
6704
+ const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
6705
+ const base = compiler.options.output.publicPath || "/";
6706
+ const _targetUrl = (_d2 = options == null ? void 0 : options.targetUrl) != null ? _d2 : `http://${source}${base}`;
6707
+ resovedInfo.targetURL = new URL(_targetUrl);
6708
+ resovedInfo.targetURL.searchParams.append("ddtab", "true");
6709
+ if (options == null ? void 0 : options.corpId) {
6710
+ resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
6711
+ }
6712
+ console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6713
+ `Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
6714
+ )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6715
+ if (enableChii) {
6716
+ console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6717
+ "Click to open chrome devtools"
6718
+ )}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
6719
+ }
6690
6720
  }
6691
6721
  };
6692
6722
  return unpluginDing;
@@ -1,6 +1,7 @@
1
1
  import * as esbuild from 'esbuild';
2
2
  import { Options } from './types.cjs';
3
3
  import 'webpack-dev-server';
4
+ import 'node:http';
4
5
  import 'vite-plugin-vconsole';
5
6
 
6
7
  declare const _default: (options?: Options | undefined) => esbuild.Plugin;
package/dist/esbuild.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as esbuild from 'esbuild';
2
2
  import { Options } from './types.js';
3
3
  import 'webpack-dev-server';
4
+ import 'node:http';
4
5
  import 'vite-plugin-vconsole';
5
6
 
6
7
  declare const _default: (options?: Options | undefined) => esbuild.Plugin;
package/dist/esbuild.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-E34H52KV.js";
3
+ } from "./chunk-RDTWBIQD.js";
4
4
  import "./chunk-PMOTCIQR.js";
5
5
 
6
6
  // src/esbuild.ts
package/dist/index.cjs CHANGED
@@ -6515,6 +6515,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
6515
6515
  var import_cookie = __toESM(require("cookie"), 1);
6516
6516
  var import_chii = require("chii");
6517
6517
  var import_get_port_please = require("get-port-please");
6518
+ var cwd = import_node_process.default.cwd();
6518
6519
  var config;
6519
6520
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
6520
6521
  var resovedInfo = {
@@ -6547,17 +6548,18 @@ var unpluginFactory = (options) => {
6547
6548
  port: resovedInfo.availablePort
6548
6549
  });
6549
6550
  }
6550
- if ((options == null ? void 0 : options.enable) && ((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable)) {
6551
+ if (options == null ? void 0 : options.enable) {
6551
6552
  const codes = [
6552
- `/* eslint-disable */;
6553
- import { devtools } from '@vue/devtools'
6554
- 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});`,
6553
+ "/* eslint-disable */;",
6554
+ ((_a4 = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _a4.enable) ? `import { devtools } from '@vue/devtools'
6555
+ 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});` : "",
6555
6556
  (options == null ? void 0 : options.enable) && enableChii ? `(() => {
6556
6557
  const script = document.createElement('script');
6557
6558
  script.src="http://localhost:${resovedInfo.availablePort}/target.js";
6558
6559
  document.body.appendChild(script);
6559
6560
  })()` : "",
6560
- `/* eslint-enable */${_source};`
6561
+ "/* eslint-enable */",
6562
+ `${_source};`
6561
6563
  ];
6562
6564
  return {
6563
6565
  code: codes.join("\n"),
@@ -6687,6 +6689,34 @@ var unpluginFactory = (options) => {
6687
6689
  if (options == null ? void 0 : options.corpId) {
6688
6690
  resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
6689
6691
  }
6692
+ },
6693
+ async rspack(compiler) {
6694
+ var _a4, _b, _c, _d2, _e;
6695
+ if (!(options == null ? void 0 : options.enable)) {
6696
+ return;
6697
+ }
6698
+ const devServerOptions = __spreadValues(__spreadValues({
6699
+ host: "localhost",
6700
+ port: 8080
6701
+ }, compiler.options.devServer), (_c = (_b = await ((_a4 = await import("@rsbuild/core")) == null ? void 0 : _a4.loadConfig({
6702
+ cwd
6703
+ }))) == null ? void 0 : _b.content) == null ? void 0 : _c.server);
6704
+ const source = `${devServerOptions.host === "0.0.0.0" ? "127.0.0.1" : devServerOptions.host}:${devServerOptions.port}`;
6705
+ const base = compiler.options.output.publicPath || "/";
6706
+ const _targetUrl = (_d2 = options == null ? void 0 : options.targetUrl) != null ? _d2 : `http://${source}${base}`;
6707
+ resovedInfo.targetURL = new URL(_targetUrl);
6708
+ resovedInfo.targetURL.searchParams.append("ddtab", "true");
6709
+ if (options == null ? void 0 : options.corpId) {
6710
+ resovedInfo.targetURL.searchParams.append("corpId", options.corpId);
6711
+ }
6712
+ console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6713
+ `Open in dingtalk${((_e = options == null ? void 0 : options.vueDevtools) == null ? void 0 : _e.enable) ? " (with vue-devtools)" : ""}`
6714
+ )}: ${colorUrl(`http://${source}${base}open-dingtalk`)}`);
6715
+ if (enableChii) {
6716
+ console.log(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
6717
+ "Click to open chrome devtools"
6718
+ )}: ${colorUrl(`http://${source}${base}__chrome_devtools`)}`);
6719
+ }
6690
6720
  }
6691
6721
  };
6692
6722
  return unpluginDing;
package/dist/index.d.cts CHANGED
@@ -3,6 +3,7 @@ import { UnpluginFactory } from 'unplugin';
3
3
  import { ChildProcess } from 'node:child_process';
4
4
  import { Options } from './types.cjs';
5
5
  import 'webpack-dev-server';
6
+ import 'node:http';
6
7
  import 'vite-plugin-vconsole';
7
8
 
8
9
  declare const resovedInfo: {
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { UnpluginFactory } from 'unplugin';
3
3
  import { ChildProcess } from 'node:child_process';
4
4
  import { Options } from './types.js';
5
5
  import 'webpack-dev-server';
6
+ import 'node:http';
6
7
  import 'vite-plugin-vconsole';
7
8
 
8
9
  declare const resovedInfo: {
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  src_default,
4
4
  unplugin,
5
5
  unpluginFactory
6
- } from "./chunk-E34H52KV.js";
6
+ } from "./chunk-RDTWBIQD.js";
7
7
  import "./chunk-PMOTCIQR.js";
8
8
  export {
9
9
  src_default as default,