unplugin-dingtalk 1004.0.0 → 1006.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.
@@ -0,0 +1,9 @@
1
+ import * as _unplugin from 'unplugin';
2
+ import { Options, RspackSetupMiddlewares } from './types.cjs';
3
+ import 'webpack-dev-server';
4
+ import 'node:http';
5
+ import 'vite-plugin-vconsole';
6
+
7
+ declare const _default: (options: Options) => readonly [RspackSetupMiddlewares, _unplugin.RspackPluginInstance];
8
+
9
+ export { _default as default };
package/dist/rspack.d.ts CHANGED
@@ -1,8 +1,9 @@
1
+ import * as _unplugin from 'unplugin';
1
2
  import { Options, RspackSetupMiddlewares } from './types.js';
2
3
  import 'webpack-dev-server';
3
4
  import 'node:http';
4
5
  import 'vite-plugin-vconsole';
5
6
 
6
- declare const _default: (options: Options) => readonly [RspackSetupMiddlewares, _rspack_core_dist_config_types.RspackPluginInstance];
7
+ declare const _default: (options: Options) => readonly [RspackSetupMiddlewares, _unplugin.RspackPluginInstance];
7
8
 
8
9
  export { _default as default };
package/dist/rspack.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import {
2
+ createProxyMiddleware,
2
3
  resovedInfo,
3
4
  unpluginFactory
4
- } from "./chunk-5U7LETMH.js";
5
+ } from "./chunk-EG2ZYJ3S.js";
5
6
  import {
6
7
  getChromeDevtoolsHtml
7
- } from "./chunk-DZEMXGMI.js";
8
+ } from "./chunk-2YQKM4BX.js";
8
9
  import "./chunk-5JBD5THX.js";
9
10
 
10
11
  // src/rspack.ts
@@ -22,6 +23,9 @@ var rspack_default = (options) => {
22
23
  } = options || {};
23
24
  const enableChii = (chii == null ? void 0 : chii.enable) !== false;
24
25
  const injectSetupMiddlewares = (middlewares, _devServer) => {
26
+ if (!(options == null ? void 0 : options.enable)) {
27
+ return middlewares;
28
+ }
25
29
  if (options.debugCookies && options.debugCookies.length > 0) {
26
30
  middlewares.unshift((req, res, next) => {
27
31
  const cookies = cookie.parse(req.headers.cookie || "");
@@ -51,6 +55,8 @@ var rspack_default = (options) => {
51
55
  res.end();
52
56
  }
53
57
  });
58
+ const proxyMiddleware = createProxyMiddleware(debug);
59
+ middlewares.unshift(proxyMiddleware(resovedInfo));
54
60
  }
55
61
  middlewares.unshift((req, res, next) => {
56
62
  if (req.url !== "/open-dingtalk") {
package/dist/types.cjs ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ exports.default = module.exports;
@@ -0,0 +1,38 @@
1
+ import * as webpack_dev_server from 'webpack-dev-server';
2
+ import { IncomingMessage, ServerResponse } from 'node:http';
3
+ import { viteVConsoleOptions } from 'vite-plugin-vconsole';
4
+
5
+ interface Options {
6
+ enable?: boolean;
7
+ targetUrl?: string;
8
+ corpId?: string;
9
+ debug?: boolean;
10
+ /** only support vite */
11
+ vconsole?: viteVConsoleOptions;
12
+ chii?: {
13
+ /** default true */
14
+ enable?: boolean;
15
+ /**
16
+ * default false
17
+ * @link [chii embedded](https://chii.liriliri.io/docs/#usage)
18
+ */
19
+ embedded?: boolean;
20
+ };
21
+ debugCookies?: string[];
22
+ }
23
+ type SetupMiddlewares = (middlewares: webpack_dev_server.Middleware[], devServer: webpack_dev_server) => webpack_dev_server.Middleware[];
24
+ type NextFunction = () => void;
25
+ type RequestHandler = (req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
26
+ interface ServerAPIs {
27
+ sockWrite: (type: string, data?: string | boolean | Record<string, any>) => void;
28
+ }
29
+ type RspackSetupMiddlewares = (
30
+ /** Order: `unshift` => internal middlewares => `push` */
31
+ middlewares: {
32
+ /** Use the `unshift` method if you want to run a middleware before all other middlewares */
33
+ unshift: (...handlers: RequestHandler[]) => void;
34
+ /** Use the `push` method if you want to run a middleware after all other middlewares */
35
+ push: (...handlers: RequestHandler[]) => void;
36
+ }, server: ServerAPIs) => void;
37
+
38
+ export type { Options, RspackSetupMiddlewares, SetupMiddlewares };
package/dist/utils.cjs ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils.ts
21
+ var utils_exports = {};
22
+ __export(utils_exports, {
23
+ interopDefault: () => interopDefault
24
+ });
25
+ module.exports = __toCommonJS(utils_exports);
26
+ async function interopDefault(m) {
27
+ const resolved = await m;
28
+ return resolved.default || resolved;
29
+ }
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ interopDefault
33
+ });
34
+ exports.default = module.exports;
@@ -0,0 +1,6 @@
1
+ type Awaitable<T> = T | Promise<T>;
2
+ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
3
+ default: infer U;
4
+ } ? U : T>;
5
+
6
+ export { type Awaitable, interopDefault };