unplugin-dingtalk 0.1.8 → 0.1.9

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
@@ -25,6 +25,8 @@ interface Options {
25
25
  debug?: boolean
26
26
  /** @link https://github.com/vadxq/vite-plugin-vconsole#vitevconsole-options */
27
27
  vconsole?: viteVConsoleOptions
28
+ /** 需要调试的 cookies, 避免无法调试 HttpOnly 的 cookie */
29
+ debugCookies?: string[]
28
30
  vueDevtools?: {
29
31
  enable?: boolean
30
32
  host?: string
package/dist/astro.cjs CHANGED
@@ -40,6 +40,7 @@ var import_node_process = __toESM(require("process"), 1);
40
40
  var import_unplugin = require("unplugin");
41
41
  var import_picocolors = __toESM(require("picocolors"), 1);
42
42
  var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
43
+ var import_cookie = __toESM(require("cookie"), 1);
43
44
  var config;
44
45
  var devtoolsInstance;
45
46
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
@@ -106,6 +107,20 @@ var unpluginFactory = (options) => {
106
107
  if (options == null ? void 0 : options.corpId) {
107
108
  targetURL.searchParams.append("corpId", options.corpId);
108
109
  }
110
+ if (options.debugCookies && options.debugCookies.length > 0) {
111
+ server.middlewares.use((req, res, next) => {
112
+ const cookies = import_cookie.default.parse(req.headers.cookie || "");
113
+ for (const [name, value] of Object.entries(cookies)) {
114
+ if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
115
+ const serializedCookie = import_cookie.default.serialize(name, value, {
116
+ httpOnly: false
117
+ });
118
+ res.setHeader("Set-Cookie", serializedCookie);
119
+ }
120
+ }
121
+ next();
122
+ });
123
+ }
109
124
  server.middlewares.use("/open-dingtalk", (req, res) => {
110
125
  var _a3;
111
126
  debug(targetURL.toString());
package/dist/astro.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  src_default
3
- } from "./chunk-YU6RRDIU.js";
3
+ } from "./chunk-PSBADVC6.js";
4
4
 
5
5
  // src/astro.ts
6
6
  var astro_default = (options) => ({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-YU6RRDIU.js";
3
+ } from "./chunk-PSBADVC6.js";
4
4
 
5
5
  // src/webpack.ts
6
6
  import { createWebpackPlugin } from "unplugin";
@@ -4,6 +4,7 @@ import process from "process";
4
4
  import { createUnplugin } from "unplugin";
5
5
  import c from "picocolors";
6
6
  import { viteVConsole } from "vite-plugin-vconsole";
7
+ import cookie from "cookie";
7
8
  var config;
8
9
  var devtoolsInstance;
9
10
  var colorUrl = (url) => c.green(url.replace(/:(\d+)\//, (_, port) => `:${c.bold(port)}/`));
@@ -70,6 +71,20 @@ var unpluginFactory = (options) => {
70
71
  if (options == null ? void 0 : options.corpId) {
71
72
  targetURL.searchParams.append("corpId", options.corpId);
72
73
  }
74
+ if (options.debugCookies && options.debugCookies.length > 0) {
75
+ server.middlewares.use((req, res, next) => {
76
+ const cookies = cookie.parse(req.headers.cookie || "");
77
+ for (const [name, value] of Object.entries(cookies)) {
78
+ if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
79
+ const serializedCookie = cookie.serialize(name, value, {
80
+ httpOnly: false
81
+ });
82
+ res.setHeader("Set-Cookie", serializedCookie);
83
+ }
84
+ }
85
+ next();
86
+ });
87
+ }
73
88
  server.middlewares.use("/open-dingtalk", (req, res) => {
74
89
  var _a3;
75
90
  debug(targetURL.toString());
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-YU6RRDIU.js";
3
+ } from "./chunk-PSBADVC6.js";
4
4
 
5
5
  // src/vite.ts
6
6
  import { createVitePlugin } from "unplugin";
package/dist/esbuild.cjs CHANGED
@@ -41,6 +41,7 @@ var import_node_process = __toESM(require("process"), 1);
41
41
  var import_unplugin = require("unplugin");
42
42
  var import_picocolors = __toESM(require("picocolors"), 1);
43
43
  var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
44
+ var import_cookie = __toESM(require("cookie"), 1);
44
45
  var config;
45
46
  var devtoolsInstance;
46
47
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
@@ -107,6 +108,20 @@ var unpluginFactory = (options) => {
107
108
  if (options == null ? void 0 : options.corpId) {
108
109
  targetURL.searchParams.append("corpId", options.corpId);
109
110
  }
111
+ if (options.debugCookies && options.debugCookies.length > 0) {
112
+ server.middlewares.use((req, res, next) => {
113
+ const cookies = import_cookie.default.parse(req.headers.cookie || "");
114
+ for (const [name, value] of Object.entries(cookies)) {
115
+ if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
116
+ const serializedCookie = import_cookie.default.serialize(name, value, {
117
+ httpOnly: false
118
+ });
119
+ res.setHeader("Set-Cookie", serializedCookie);
120
+ }
121
+ }
122
+ next();
123
+ });
124
+ }
110
125
  server.middlewares.use("/open-dingtalk", (req, res) => {
111
126
  var _a3;
112
127
  debug(targetURL.toString());
package/dist/esbuild.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-YU6RRDIU.js";
3
+ } from "./chunk-PSBADVC6.js";
4
4
 
5
5
  // src/esbuild.ts
6
6
  import { createEsbuildPlugin } from "unplugin";
package/dist/index.cjs CHANGED
@@ -40,6 +40,7 @@ var import_node_process = __toESM(require("process"), 1);
40
40
  var import_unplugin = require("unplugin");
41
41
  var import_picocolors = __toESM(require("picocolors"), 1);
42
42
  var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
43
+ var import_cookie = __toESM(require("cookie"), 1);
43
44
  var config;
44
45
  var devtoolsInstance;
45
46
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
@@ -106,6 +107,20 @@ var unpluginFactory = (options) => {
106
107
  if (options == null ? void 0 : options.corpId) {
107
108
  targetURL.searchParams.append("corpId", options.corpId);
108
109
  }
110
+ if (options.debugCookies && options.debugCookies.length > 0) {
111
+ server.middlewares.use((req, res, next) => {
112
+ const cookies = import_cookie.default.parse(req.headers.cookie || "");
113
+ for (const [name, value] of Object.entries(cookies)) {
114
+ if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
115
+ const serializedCookie = import_cookie.default.serialize(name, value, {
116
+ httpOnly: false
117
+ });
118
+ res.setHeader("Set-Cookie", serializedCookie);
119
+ }
120
+ }
121
+ next();
122
+ });
123
+ }
109
124
  server.middlewares.use("/open-dingtalk", (req, res) => {
110
125
  var _a3;
111
126
  debug(targetURL.toString());
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  src_default,
3
3
  unplugin,
4
4
  unpluginFactory
5
- } from "./chunk-YU6RRDIU.js";
5
+ } from "./chunk-PSBADVC6.js";
6
6
  export {
7
7
  src_default as default,
8
8
  unplugin,
package/dist/nuxt.cjs CHANGED
@@ -44,6 +44,7 @@ var import_node_process = __toESM(require("process"), 1);
44
44
  var import_unplugin = require("unplugin");
45
45
  var import_picocolors = __toESM(require("picocolors"), 1);
46
46
  var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
47
+ var import_cookie = __toESM(require("cookie"), 1);
47
48
  var config;
48
49
  var devtoolsInstance;
49
50
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
@@ -110,6 +111,20 @@ var unpluginFactory = (options) => {
110
111
  if (options == null ? void 0 : options.corpId) {
111
112
  targetURL.searchParams.append("corpId", options.corpId);
112
113
  }
114
+ if (options.debugCookies && options.debugCookies.length > 0) {
115
+ server.middlewares.use((req, res, next) => {
116
+ const cookies = import_cookie.default.parse(req.headers.cookie || "");
117
+ for (const [name, value] of Object.entries(cookies)) {
118
+ if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
119
+ const serializedCookie = import_cookie.default.serialize(name, value, {
120
+ httpOnly: false
121
+ });
122
+ res.setHeader("Set-Cookie", serializedCookie);
123
+ }
124
+ }
125
+ next();
126
+ });
127
+ }
113
128
  server.middlewares.use("/open-dingtalk", (req, res) => {
114
129
  var _a3;
115
130
  debug(targetURL.toString());
package/dist/nuxt.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  webpack_default
3
- } from "./chunk-JVGHIAFT.js";
3
+ } from "./chunk-3GLWV5IZ.js";
4
4
  import {
5
5
  vite_default
6
- } from "./chunk-GCW3A6BF.js";
7
- import "./chunk-YU6RRDIU.js";
6
+ } from "./chunk-U5NNQ27H.js";
7
+ import "./chunk-PSBADVC6.js";
8
8
 
9
9
  // src/nuxt.ts
10
10
  import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
package/dist/rollup.cjs CHANGED
@@ -41,6 +41,7 @@ var import_node_process = __toESM(require("process"), 1);
41
41
  var import_unplugin = require("unplugin");
42
42
  var import_picocolors = __toESM(require("picocolors"), 1);
43
43
  var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
44
+ var import_cookie = __toESM(require("cookie"), 1);
44
45
  var config;
45
46
  var devtoolsInstance;
46
47
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
@@ -107,6 +108,20 @@ var unpluginFactory = (options) => {
107
108
  if (options == null ? void 0 : options.corpId) {
108
109
  targetURL.searchParams.append("corpId", options.corpId);
109
110
  }
111
+ if (options.debugCookies && options.debugCookies.length > 0) {
112
+ server.middlewares.use((req, res, next) => {
113
+ const cookies = import_cookie.default.parse(req.headers.cookie || "");
114
+ for (const [name, value] of Object.entries(cookies)) {
115
+ if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
116
+ const serializedCookie = import_cookie.default.serialize(name, value, {
117
+ httpOnly: false
118
+ });
119
+ res.setHeader("Set-Cookie", serializedCookie);
120
+ }
121
+ }
122
+ next();
123
+ });
124
+ }
110
125
  server.middlewares.use("/open-dingtalk", (req, res) => {
111
126
  var _a3;
112
127
  debug(targetURL.toString());
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-YU6RRDIU.js";
3
+ } from "./chunk-PSBADVC6.js";
4
4
 
5
5
  // src/rollup.ts
6
6
  import { createRollupPlugin } from "unplugin";
package/dist/rspack.cjs CHANGED
@@ -41,6 +41,7 @@ var import_node_process = __toESM(require("process"), 1);
41
41
  var import_unplugin = require("unplugin");
42
42
  var import_picocolors = __toESM(require("picocolors"), 1);
43
43
  var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
44
+ var import_cookie = __toESM(require("cookie"), 1);
44
45
  var config;
45
46
  var devtoolsInstance;
46
47
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
@@ -107,6 +108,20 @@ var unpluginFactory = (options) => {
107
108
  if (options == null ? void 0 : options.corpId) {
108
109
  targetURL.searchParams.append("corpId", options.corpId);
109
110
  }
111
+ if (options.debugCookies && options.debugCookies.length > 0) {
112
+ server.middlewares.use((req, res, next) => {
113
+ const cookies = import_cookie.default.parse(req.headers.cookie || "");
114
+ for (const [name, value] of Object.entries(cookies)) {
115
+ if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
116
+ const serializedCookie = import_cookie.default.serialize(name, value, {
117
+ httpOnly: false
118
+ });
119
+ res.setHeader("Set-Cookie", serializedCookie);
120
+ }
121
+ }
122
+ next();
123
+ });
124
+ }
110
125
  server.middlewares.use("/open-dingtalk", (req, res) => {
111
126
  var _a3;
112
127
  debug(targetURL.toString());
package/dist/rspack.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-YU6RRDIU.js";
3
+ } from "./chunk-PSBADVC6.js";
4
4
 
5
5
  // src/rspack.ts
6
6
  import { createRspackPlugin } from "unplugin";
package/dist/types.d.cts CHANGED
@@ -6,6 +6,7 @@ interface Options {
6
6
  corpId?: string;
7
7
  debug?: boolean;
8
8
  vconsole?: viteVConsoleOptions;
9
+ debugCookies?: string[];
9
10
  vueDevtools?: {
10
11
  enable?: boolean;
11
12
  host?: string;
package/dist/types.d.ts CHANGED
@@ -6,6 +6,7 @@ interface Options {
6
6
  corpId?: string;
7
7
  debug?: boolean;
8
8
  vconsole?: viteVConsoleOptions;
9
+ debugCookies?: string[];
9
10
  vueDevtools?: {
10
11
  enable?: boolean;
11
12
  host?: string;
package/dist/vite.cjs CHANGED
@@ -41,6 +41,7 @@ var import_node_process = __toESM(require("process"), 1);
41
41
  var import_unplugin = require("unplugin");
42
42
  var import_picocolors = __toESM(require("picocolors"), 1);
43
43
  var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
44
+ var import_cookie = __toESM(require("cookie"), 1);
44
45
  var config;
45
46
  var devtoolsInstance;
46
47
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
@@ -107,6 +108,20 @@ var unpluginFactory = (options) => {
107
108
  if (options == null ? void 0 : options.corpId) {
108
109
  targetURL.searchParams.append("corpId", options.corpId);
109
110
  }
111
+ if (options.debugCookies && options.debugCookies.length > 0) {
112
+ server.middlewares.use((req, res, next) => {
113
+ const cookies = import_cookie.default.parse(req.headers.cookie || "");
114
+ for (const [name, value] of Object.entries(cookies)) {
115
+ if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
116
+ const serializedCookie = import_cookie.default.serialize(name, value, {
117
+ httpOnly: false
118
+ });
119
+ res.setHeader("Set-Cookie", serializedCookie);
120
+ }
121
+ }
122
+ next();
123
+ });
124
+ }
110
125
  server.middlewares.use("/open-dingtalk", (req, res) => {
111
126
  var _a3;
112
127
  debug(targetURL.toString());
package/dist/vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-GCW3A6BF.js";
4
- import "./chunk-YU6RRDIU.js";
3
+ } from "./chunk-U5NNQ27H.js";
4
+ import "./chunk-PSBADVC6.js";
5
5
  export {
6
6
  vite_default as default
7
7
  };
package/dist/webpack.cjs CHANGED
@@ -41,6 +41,7 @@ var import_node_process = __toESM(require("process"), 1);
41
41
  var import_unplugin = require("unplugin");
42
42
  var import_picocolors = __toESM(require("picocolors"), 1);
43
43
  var import_vite_plugin_vconsole = require("vite-plugin-vconsole");
44
+ var import_cookie = __toESM(require("cookie"), 1);
44
45
  var config;
45
46
  var devtoolsInstance;
46
47
  var colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
@@ -107,6 +108,20 @@ var unpluginFactory = (options) => {
107
108
  if (options == null ? void 0 : options.corpId) {
108
109
  targetURL.searchParams.append("corpId", options.corpId);
109
110
  }
111
+ if (options.debugCookies && options.debugCookies.length > 0) {
112
+ server.middlewares.use((req, res, next) => {
113
+ const cookies = import_cookie.default.parse(req.headers.cookie || "");
114
+ for (const [name, value] of Object.entries(cookies)) {
115
+ if (options.debugCookies && options.debugCookies.length > 0 && options.debugCookies.includes(name)) {
116
+ const serializedCookie = import_cookie.default.serialize(name, value, {
117
+ httpOnly: false
118
+ });
119
+ res.setHeader("Set-Cookie", serializedCookie);
120
+ }
121
+ }
122
+ next();
123
+ });
124
+ }
110
125
  server.middlewares.use("/open-dingtalk", (req, res) => {
111
126
  var _a3;
112
127
  debug(targetURL.toString());
package/dist/webpack.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  webpack_default
3
- } from "./chunk-JVGHIAFT.js";
4
- import "./chunk-YU6RRDIU.js";
3
+ } from "./chunk-3GLWV5IZ.js";
4
+ import "./chunk-PSBADVC6.js";
5
5
  export {
6
6
  webpack_default as default
7
7
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-dingtalk",
3
3
  "type": "module",
4
- "version": "0.1.8",
4
+ "version": "0.1.9",
5
5
  "description": "",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/zcf0508/unplugin-dingtalk#readme",
@@ -119,10 +119,11 @@
119
119
  },
120
120
  "dependencies": {
121
121
  "@antfu/eslint-config": "^2.18.1",
122
+ "cookie": "^0.6.0",
122
123
  "eslint-plugin-security": "^3.0.0",
124
+ "picocolors": "^1.0.1",
123
125
  "unplugin": "^1.5.1",
124
- "vite-plugin-vconsole": "^2.1.1",
125
- "picocolors": "^1.0.1"
126
+ "vite-plugin-vconsole": "^2.1.1"
126
127
  },
127
128
  "devDependencies": {
128
129
  "@nuxt/kit": "^3.8.2",