@fangzhongya/vue-archive 0.0.48 → 0.0.50

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.
@@ -3,10 +3,10 @@ import { firstLower as $ } from "@fangzhongya/utils/basic/string/firstLower";
3
3
  function h(e) {
4
4
  return e.replace(/\;(\s|\n\r)*$/, "");
5
5
  }
6
- function E(e) {
6
+ function v(e) {
7
7
  return e = "let a = " + e, h(e).replace(/^let a = /, "");
8
8
  }
9
- function v(e) {
9
+ function E(e) {
10
10
  return h(e);
11
11
  }
12
12
  function B(e, n = "") {
@@ -49,13 +49,13 @@ function b(e) {
49
49
  const n = [];
50
50
  return e && m(e, n), n;
51
51
  }
52
- function F(e) {
52
+ function A(e) {
53
53
  const n = Object.prototype.toString.call(e);
54
54
  let r = /^\[[O|o]bject (.*)\]$/.exec(n), i = typeof e;
55
55
  return r && r.length > 0 && (i = r[1].toLowerCase()), i;
56
56
  }
57
57
  function L(e, n) {
58
- const t = F(e), r = b(n)[0];
58
+ const t = A(e), r = b(n)[0];
59
59
  return r && r != "any" ? t == r : !0;
60
60
  }
61
61
  function C(e) {
@@ -65,11 +65,15 @@ function C(e) {
65
65
  } else return typeof e == "object" && e ? e.toString() : typeof e > "u" || typeof e == "object" && !e ? "" : e + "";
66
66
  }
67
67
  function N(e) {
68
- e = (e + "").replace(/^(\s|\n|r)*/, "").replace(/(\s|\n|r)*$/, "");
69
- let n = "";
70
- return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ? n = "string" : /^\[(.|\n|\r)*\]$/.test(e) ? n = "array" : /^\{(.|\n|\r)*\}$/.test(e) ? n = "object" : /^[0-9]*$/.test(e) ? n = "number" : e === "true" || e === "false" ? n = "boolean" : e == "undefined" ? n = "undefined" : e == "null" ? n = "null" : e && (n = "string"), n;
68
+ const n = typeof e;
69
+ if (n == "string") {
70
+ e = (e + "").replace(/^(\s|\n|r)*/, "").replace(/(\s|\n|r)*$/, "");
71
+ let t = "";
72
+ return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ? t = "string" : /^\[(.|\n|\r)*\]$/.test(e) ? t = "array" : /^\{(.|\n|\r)*\}$/.test(e) ? t = "object" : /^[0-9]*$/.test(e) ? t = "number" : e === "true" || e === "false" ? t = "boolean" : e == "undefined" ? t = "undefined" : e == "null" ? t = "null" : e && (t = "string"), t;
73
+ } else
74
+ return n === "object" ? e instanceof Array ? "array" : n === null ? "null" : n : n;
71
75
  }
72
- function A(e) {
76
+ function F(e) {
73
77
  switch ((e[0] || "any").toLowerCase()) {
74
78
  case "string":
75
79
  return '""';
@@ -78,7 +82,7 @@ function A(e) {
78
82
  case "number":
79
83
  return "0";
80
84
  case "array":
81
- let t = A(e.splice(1));
85
+ let t = F(e.splice(1));
82
86
  return t = t == "undefined" ? "" : t, `[${t}]`;
83
87
  case "object":
84
88
  return "{}";
@@ -96,7 +100,7 @@ function R(e) {
96
100
  t = t.trim(), t && (n && (n += " | "), t === "Array" ? n += "Array<any>" : n += t);
97
101
  }), n || "any";
98
102
  }
99
- const g = (e, n) => {
103
+ const f = (e, n) => {
100
104
  let t = [], r = [], i = "";
101
105
  for (let u = 0; u < e.length; u++) {
102
106
  const s = e[u];
@@ -108,7 +112,7 @@ const g = (e, n) => {
108
112
  if (e.startsWith("[") && e.endsWith("]") || e.startsWith("(") && e.endsWith(")")) {
109
113
  const n = e.slice(1, -1).trim();
110
114
  if (!n) return { type: "any", dataType: ["any"] };
111
- const t = g(n, ",");
115
+ const t = f(n, ",");
112
116
  return {
113
117
  type: t[0] || "any",
114
118
  dataType: t
@@ -116,32 +120,34 @@ const g = (e, n) => {
116
120
  } else if (e.startsWith("<") && e.endsWith(">")) {
117
121
  const n = e.slice(1, -1).trim();
118
122
  if (!n) return { type: "any", dataType: ["any"] };
119
- const t = g(n, "|");
123
+ const t = f(n, "|");
120
124
  return {
121
125
  type: t[0] || "any",
122
126
  dataType: t
123
127
  };
124
- } else
128
+ } else {
129
+ const n = f(e, ",");
125
130
  return {
126
- type: e,
127
- dataType: [e]
131
+ type: n[0] || "any",
132
+ dataType: n
128
133
  };
134
+ }
129
135
  else return { type: "any", dataType: ["any"] };
130
136
  };
131
137
  function q(e) {
132
- return g(e, ",").map((t) => {
138
+ return f(e, ",").map((t) => {
133
139
  const r = t.trim(), i = t.match(/^([^:?]+)(\??):/);
134
140
  if (!i) return null;
135
141
  const u = i[1].trim(), s = !i[2], d = i[0].length, c = t.substring(d).trim();
136
- let l = [], f = "", p = "";
142
+ let o = [], p = "", g = "";
137
143
  for (let a = 0; a < c.length; a++) {
138
- const o = c[a];
139
- if (o === "[" || o === "<" || o === "(" ? l.push(o) : (o === "]" && l[l.length - 1] === "[" || o === ">" && l[l.length - 1] === "<" || o === ")" && l[l.length - 1] === "(") && l.pop(), l.length === 0 && a > 0) {
140
- a == 1 && o !== "]" && o !== ">" && o !== ")" ? (f = "", p = c.substring(0)) : (f = c.substring(0, a + 1).trim(), p = c.substring(a + 1));
144
+ const l = c[a];
145
+ if (l === "[" || l === "<" || l === "(" ? o.push(l) : (l === "]" && o[o.length - 1] === "[" || l === ">" && o[o.length - 1] === "<" || l === ")" && o[o.length - 1] === "(") && o.pop(), o.length === 0 && a > 0) {
146
+ a == 1 && l !== "]" && l !== ">" && l !== ")" ? (p = "", g = c.substring(0)) : (p = c.substring(0, a + 1).trim(), g = c.substring(a + 1));
141
147
  break;
142
148
  }
143
149
  }
144
- const { type: k, dataType: y } = W(f), T = b(y);
150
+ const { type: k, dataType: y } = W(p), T = b(y);
145
151
  return {
146
152
  name: u,
147
153
  prop: u,
@@ -149,23 +155,24 @@ function q(e) {
149
155
  dataType: y,
150
156
  must: s,
151
157
  label: r,
152
- description: p
158
+ description: g
153
159
  };
154
160
  }).filter(Boolean);
155
161
  }
156
162
  export {
157
163
  j as getFunBody,
158
164
  M as getFunctionFormat,
159
- F as getObjType,
165
+ A as getObjType,
160
166
  b as getSonType,
161
167
  C as getString,
162
- A as getTypeValue,
168
+ F as getTypeValue,
163
169
  N as isDefaultType,
164
170
  L as isTypeEqual,
165
171
  q as parseParamString,
166
- v as prettierArrFormat,
172
+ W as parseTypeDefinition,
173
+ E as prettierArrFormat,
167
174
  h as prettierFormat,
168
- E as prettierObjFormat,
175
+ v as prettierObjFormat,
169
176
  R as setDataType,
170
177
  B as vueFormat
171
178
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.48",
4
+ "version": "0.0.50",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@fangzhongya/create": "0.2.34",
22
- "@fangzhongya/utils": "0.0.27",
22
+ "@fangzhongya/utils": "0.0.28",
23
23
  "@fangzhongya/vue-components": "0.1.9",
24
24
  "@highlightjs/vue-plugin": "^2.1.0",
25
25
  "@types/node": "^24.2.1",