@fangzhongya/vue-archive 0.0.33 → 0.0.34
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/node/index.cjs
CHANGED
|
@@ -3166,9 +3166,9 @@ var splitIgnoringNesting = (str, delimiter) => {
|
|
|
3166
3166
|
return parts;
|
|
3167
3167
|
};
|
|
3168
3168
|
var parseTypeDefinition = (typeDef) => {
|
|
3169
|
-
if (!typeDef
|
|
3169
|
+
if (!typeDef) {
|
|
3170
3170
|
return { type: "any", dataType: ["any"] };
|
|
3171
|
-
} else if (typeDef.startsWith("[") && typeDef.endsWith("]")) {
|
|
3171
|
+
} else if (typeDef.startsWith("[") && typeDef.endsWith("]") || typeDef.startsWith("(") && typeDef.endsWith(")")) {
|
|
3172
3172
|
const inner = typeDef.slice(1, -1).trim();
|
|
3173
3173
|
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3174
3174
|
const types = splitIgnoringNesting(inner, ",");
|
|
@@ -3202,7 +3202,6 @@ function parseParamString(input) {
|
|
|
3202
3202
|
const typeDefStart = nameMatch[0].length;
|
|
3203
3203
|
const typeDef = trimmedPart.substring(typeDefStart).trim();
|
|
3204
3204
|
let bracketStack = [];
|
|
3205
|
-
let endIndex = -1;
|
|
3206
3205
|
let t = "";
|
|
3207
3206
|
let description = "";
|
|
3208
3207
|
for (let i = 0; i < typeDef.length; i++) {
|
|
@@ -3213,9 +3212,13 @@ function parseParamString(input) {
|
|
|
3213
3212
|
bracketStack.pop();
|
|
3214
3213
|
}
|
|
3215
3214
|
if (bracketStack.length === 0 && i > 0) {
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3215
|
+
if (i == 1 && char !== "]" && char !== ">" && char !== ")") {
|
|
3216
|
+
t = "";
|
|
3217
|
+
description = typeDef.substring(0);
|
|
3218
|
+
} else {
|
|
3219
|
+
t = typeDef.substring(0, i + 1).trim();
|
|
3220
|
+
description = typeDef.substring(i + 1);
|
|
3221
|
+
}
|
|
3219
3222
|
break;
|
|
3220
3223
|
}
|
|
3221
3224
|
}
|
package/dist/node/index.js
CHANGED
|
@@ -3151,9 +3151,9 @@ var splitIgnoringNesting = (str, delimiter) => {
|
|
|
3151
3151
|
return parts;
|
|
3152
3152
|
};
|
|
3153
3153
|
var parseTypeDefinition = (typeDef) => {
|
|
3154
|
-
if (!typeDef
|
|
3154
|
+
if (!typeDef) {
|
|
3155
3155
|
return { type: "any", dataType: ["any"] };
|
|
3156
|
-
} else if (typeDef.startsWith("[") && typeDef.endsWith("]")) {
|
|
3156
|
+
} else if (typeDef.startsWith("[") && typeDef.endsWith("]") || typeDef.startsWith("(") && typeDef.endsWith(")")) {
|
|
3157
3157
|
const inner = typeDef.slice(1, -1).trim();
|
|
3158
3158
|
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3159
3159
|
const types = splitIgnoringNesting(inner, ",");
|
|
@@ -3187,7 +3187,6 @@ function parseParamString(input) {
|
|
|
3187
3187
|
const typeDefStart = nameMatch[0].length;
|
|
3188
3188
|
const typeDef = trimmedPart.substring(typeDefStart).trim();
|
|
3189
3189
|
let bracketStack = [];
|
|
3190
|
-
let endIndex = -1;
|
|
3191
3190
|
let t = "";
|
|
3192
3191
|
let description = "";
|
|
3193
3192
|
for (let i = 0; i < typeDef.length; i++) {
|
|
@@ -3198,9 +3197,13 @@ function parseParamString(input) {
|
|
|
3198
3197
|
bracketStack.pop();
|
|
3199
3198
|
}
|
|
3200
3199
|
if (bracketStack.length === 0 && i > 0) {
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3200
|
+
if (i == 1 && char !== "]" && char !== ">" && char !== ")") {
|
|
3201
|
+
t = "";
|
|
3202
|
+
description = typeDef.substring(0);
|
|
3203
|
+
} else {
|
|
3204
|
+
t = typeDef.substring(0, i + 1).trim();
|
|
3205
|
+
description = typeDef.substring(i + 1);
|
|
3206
|
+
}
|
|
3204
3207
|
break;
|
|
3205
3208
|
}
|
|
3206
3209
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)}function
|
|
3
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+n+"$").exec(e);return r&&r.length>0?
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@fangzhongya/utils/basic/string/toFunction"),v=require("@fangzhongya/utils/basic/string/firstLower");function y(e){return e.replace(/\;(\s|\n\r)*$/,"")}function w(e){return e="let a = "+e,y(e).replace(/^let a = /,"")}function O(e){return y(e)}function A(e,n=""){let t=(e+"").trim().split(/\n/);return t=t.map(r=>n+r),t.join(`
|
|
2
|
+
`)}function m(e=""){e=e.trim();let n=`[\\s|\\n|\\r]*\\{((.|
|
|
3
|
+
|\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+n+"$").exec(e);return r&&r.length>0?m(r[1]):e}const W=["Boolean","Any","String","Number","Array","Object","Function"];function k(e){return W.includes(e)?v.firstLower(e):e}function x(e){let t=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(t&&t.length>0)return{own:k(t[1]),son:t[2]}}function d(e,n){let t=x(e);t?(n.push(t.own),t.son&&d(t.son,n)):n.push(e)}function h(e){e instanceof Array&&(e=e[0]);const n=[];return e&&d(e,n),n}function T(e){const n=Object.prototype.toString.call(e);let r=/^\[[O|o]bject (.*)\]$/.exec(n),i=typeof e;return r&&r.length>0&&(i=r[1].toLowerCase()),i}function q(e,n){const t=T(e),r=h(n)[0];return r&&r!="any"?t==r:!0}function B(e){if(typeof e=="string"){let n=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(n=!0),n&&(e=e.substring(1,e.length-1)),e+""}else return typeof e=="object"&&e?e.toString():typeof e>"u"||typeof e=="object"&&!e?"":e+""}function E(e){e=(e+"").replace(/^(\s|\n|r)*/,"").replace(/(\s|\n|r)*$/,"");let n="";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}function j(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let t=j(e.splice(1));return t=t=="undefined"?"":t,`[${t}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function L(e){return e.join("|")||"any"}const g=(e,n)=>{let t=[],r=[],i="";for(let u=0;u<e.length;u++){const s=e[u];s==="["||s==="<"||s==="("?(t.push(s),i+=s):s==="]"&&t.length>0&&t[t.length-1]==="["||s===">"&&t.length>0&&t[t.length-1]==="<"||s===")"&&t.length>0&&t[t.length-1]==="("?(t.pop(),i+=s):s===n&&t.length===0?(r.push(i.trim()),i=""):i+=s}return i.trim()!==""&&r.push(i.trim()),r},C=e=>{if(e)if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=g(n,",");return{type:t[0]||"any",dataType:t}}else if(e.startsWith("<")&&e.endsWith(">")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=g(n,"|");return{type:t[0]||"any",dataType:t}}else return{type:e,dataType:[e]};else return{type:"any",dataType:["any"]}};function M(e){return g(e,",").map(t=>{const r=t.trim(),i=t.match(/^([^:?]+)(\??):/);if(!i)return null;const u=i[1].trim(),s=!i[2],F=i[0].length,c=t.substring(F).trim();let a=[],f="",p="";for(let l=0;l<c.length;l++){const o=c[l];if(o==="["||o==="<"||o==="("?a.push(o):(o==="]"&&a[a.length-1]==="["||o===">"&&a[a.length-1]==="<"||o===")"&&a[a.length-1]==="(")&&a.pop(),a.length===0&&l>0){l==1&&o!=="]"&&o!==">"&&o!==")"?(f="",p=c.substring(0)):(f=c.substring(0,l+1).trim(),p=c.substring(l+1));break}}const{type:N,dataType:b}=C(f),$=h(b);return{name:u,prop:u,type:$[0],dataType:b,must:s,label:r,description:p}}).filter(Boolean)}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>S.getFunctionFormat});exports.getFunBody=m;exports.getObjType=T;exports.getSonType=h;exports.getString=B;exports.getTypeValue=j;exports.isDefaultType=E;exports.isTypeEqual=q;exports.parseParamString=M;exports.prettierArrFormat=O;exports.prettierFormat=y;exports.prettierObjFormat=w;exports.setDataType=L;exports.vueFormat=A;
|
|
@@ -37,14 +37,6 @@ export declare function getString(st: unknown): string;
|
|
|
37
37
|
export declare function isDefaultType(st: string): string;
|
|
38
38
|
export declare function getTypeValue(arr: string[]): string;
|
|
39
39
|
export declare function setDataType(arr: string[]): string;
|
|
40
|
-
export declare function getParametersObj(cs: string): {
|
|
41
|
-
label: string;
|
|
42
|
-
prop: string;
|
|
43
|
-
must: boolean;
|
|
44
|
-
type: string;
|
|
45
|
-
dataType: string[];
|
|
46
|
-
description: string;
|
|
47
|
-
}[];
|
|
48
40
|
export declare function parseParamString(input: string): Array<{
|
|
49
41
|
name: string;
|
|
50
42
|
prop: string;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { getFunctionFormat as
|
|
2
|
-
import { firstLower as
|
|
3
|
-
function
|
|
1
|
+
import { getFunctionFormat as M } from "@fangzhongya/utils/basic/string/toFunction";
|
|
2
|
+
import { firstLower as $ } from "@fangzhongya/utils/basic/string/firstLower";
|
|
3
|
+
function h(e) {
|
|
4
4
|
return e.replace(/\;(\s|\n\r)*$/, "");
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return e = "let a = " + e,
|
|
6
|
+
function O(e) {
|
|
7
|
+
return e = "let a = " + e, h(e).replace(/^let a = /, "");
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function B(e) {
|
|
10
|
+
return h(e);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function E(e, n = "") {
|
|
13
13
|
let t = (e + "").trim().split(/\n/);
|
|
14
14
|
return t = t.map((r) => n + r), t.join(`
|
|
15
15
|
`);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function j(e = "") {
|
|
18
18
|
e = e.trim();
|
|
19
19
|
let n = `[\\s|\\n|\\r]*\\{((.|
|
|
20
20
|
|\r)+?)\\}[\\s|\\n|\\r]*`, r = new RegExp("^" + n + "$").exec(e);
|
|
21
|
-
return r && r.length > 0 ?
|
|
21
|
+
return r && r.length > 0 ? j(r[1]) : e;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const S = [
|
|
24
24
|
"Boolean",
|
|
25
25
|
"Any",
|
|
26
26
|
"String",
|
|
@@ -29,36 +29,36 @@ const w = [
|
|
|
29
29
|
"Object",
|
|
30
30
|
"Function"
|
|
31
31
|
];
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function w(e) {
|
|
33
|
+
return S.includes(e) ? $(e) : e;
|
|
34
34
|
}
|
|
35
35
|
function F(e) {
|
|
36
36
|
let t = new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);
|
|
37
37
|
if (t && t.length > 0)
|
|
38
38
|
return {
|
|
39
|
-
own:
|
|
39
|
+
own: w(t[1]),
|
|
40
40
|
son: t[2]
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function m(e, n) {
|
|
44
44
|
let t = F(e);
|
|
45
|
-
t ? (n.push(t.own), t.son &&
|
|
45
|
+
t ? (n.push(t.own), t.son && m(t.son, n)) : n.push(e);
|
|
46
46
|
}
|
|
47
47
|
function b(e) {
|
|
48
48
|
e instanceof Array && (e = e[0]);
|
|
49
49
|
const n = [];
|
|
50
|
-
return e &&
|
|
50
|
+
return e && m(e, n), n;
|
|
51
51
|
}
|
|
52
52
|
function v(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
|
-
function
|
|
57
|
+
function L(e, n) {
|
|
58
58
|
const t = v(e), r = b(n)[0];
|
|
59
59
|
return r && r != "any" ? t == r : !0;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function C(e) {
|
|
62
62
|
if (typeof e == "string") {
|
|
63
63
|
let n = !1;
|
|
64
64
|
return (/^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e)) && (n = !0), n && (e = e.substring(1, e.length - 1)), e + "";
|
|
@@ -69,7 +69,7 @@ function N(e) {
|
|
|
69
69
|
let n = "";
|
|
70
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;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function x(e) {
|
|
73
73
|
switch ((e[0] || "any").toLowerCase()) {
|
|
74
74
|
case "string":
|
|
75
75
|
return '""';
|
|
@@ -78,7 +78,7 @@ function k(e) {
|
|
|
78
78
|
case "number":
|
|
79
79
|
return "0";
|
|
80
80
|
case "array":
|
|
81
|
-
let t =
|
|
81
|
+
let t = x(e.splice(1));
|
|
82
82
|
return t = t == "undefined" ? "" : t, `[${t}]`;
|
|
83
83
|
case "object":
|
|
84
84
|
return "{}";
|
|
@@ -93,76 +93,76 @@ function k(e) {
|
|
|
93
93
|
function R(e) {
|
|
94
94
|
return e.join("|") || "any";
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const g = (e, n) => {
|
|
97
97
|
let t = [], r = [], i = "";
|
|
98
|
-
for (let
|
|
99
|
-
const s = e[
|
|
98
|
+
for (let a = 0; a < e.length; a++) {
|
|
99
|
+
const s = e[a];
|
|
100
100
|
s === "[" || s === "<" || s === "(" ? (t.push(s), i += s) : s === "]" && t.length > 0 && t[t.length - 1] === "[" || s === ">" && t.length > 0 && t[t.length - 1] === "<" || s === ")" && t.length > 0 && t[t.length - 1] === "(" ? (t.pop(), i += s) : s === n && t.length === 0 ? (r.push(i.trim()), i = "") : i += s;
|
|
101
101
|
}
|
|
102
102
|
return i.trim() !== "" && r.push(i.trim()), r;
|
|
103
|
-
},
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
103
|
+
}, W = (e) => {
|
|
104
|
+
if (e)
|
|
105
|
+
if (e.startsWith("[") && e.endsWith("]") || e.startsWith("(") && e.endsWith(")")) {
|
|
106
|
+
const n = e.slice(1, -1).trim();
|
|
107
|
+
if (!n) return { type: "any", dataType: ["any"] };
|
|
108
|
+
const t = g(n, ",");
|
|
109
|
+
return {
|
|
110
|
+
type: t[0] || "any",
|
|
111
|
+
dataType: t
|
|
112
|
+
};
|
|
113
|
+
} else if (e.startsWith("<") && e.endsWith(">")) {
|
|
114
|
+
const n = e.slice(1, -1).trim();
|
|
115
|
+
if (!n) return { type: "any", dataType: ["any"] };
|
|
116
|
+
const t = g(n, "|");
|
|
117
|
+
return {
|
|
118
|
+
type: t[0] || "any",
|
|
119
|
+
dataType: t
|
|
120
|
+
};
|
|
121
|
+
} else
|
|
122
|
+
return {
|
|
123
|
+
type: e,
|
|
124
|
+
dataType: [e]
|
|
125
|
+
};
|
|
126
|
+
else return { type: "any", dataType: ["any"] };
|
|
127
127
|
};
|
|
128
128
|
function q(e) {
|
|
129
|
-
return
|
|
129
|
+
return g(e, ",").map((t) => {
|
|
130
130
|
const r = t.trim(), i = t.match(/^([^:?]+)(\??):/);
|
|
131
131
|
if (!i) return null;
|
|
132
|
-
const
|
|
133
|
-
let
|
|
134
|
-
for (let
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
132
|
+
const a = i[1].trim(), s = !i[2], d = i[0].length, c = t.substring(d).trim();
|
|
133
|
+
let l = [], f = "", p = "";
|
|
134
|
+
for (let u = 0; u < c.length; u++) {
|
|
135
|
+
const o = c[u];
|
|
136
|
+
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 && u > 0) {
|
|
137
|
+
u == 1 && o !== "]" && o !== ">" && o !== ")" ? (f = "", p = c.substring(0)) : (f = c.substring(0, u + 1).trim(), p = c.substring(u + 1));
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
const { type:
|
|
141
|
+
const { type: k, dataType: y } = W(f), T = b(y);
|
|
142
142
|
return {
|
|
143
|
-
name:
|
|
144
|
-
prop:
|
|
145
|
-
type:
|
|
146
|
-
dataType:
|
|
143
|
+
name: a,
|
|
144
|
+
prop: a,
|
|
145
|
+
type: T[0],
|
|
146
|
+
dataType: y,
|
|
147
147
|
must: s,
|
|
148
148
|
label: r,
|
|
149
|
-
description:
|
|
149
|
+
description: p
|
|
150
150
|
};
|
|
151
151
|
}).filter(Boolean);
|
|
152
152
|
}
|
|
153
153
|
export {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
j as getFunBody,
|
|
155
|
+
M as getFunctionFormat,
|
|
156
156
|
v as getObjType,
|
|
157
157
|
b as getSonType,
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
C as getString,
|
|
159
|
+
x as getTypeValue,
|
|
160
160
|
N as isDefaultType,
|
|
161
|
-
|
|
161
|
+
L as isTypeEqual,
|
|
162
162
|
q as parseParamString,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
B as prettierArrFormat,
|
|
164
|
+
h as prettierFormat,
|
|
165
|
+
O as prettierObjFormat,
|
|
166
166
|
R as setDataType,
|
|
167
|
-
|
|
167
|
+
E as vueFormat
|
|
168
168
|
};
|