@omnia/tooling-vue 8.0.113-dev → 8.0.114-dev

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.
@@ -90,68 +90,70 @@ function extractVueComponentInfo(filePath) {
90
90
  if (callExpression.arguments[0].expression.type === "ArrowFunctionExpression") {
91
91
  componentInfo.functionSignature = true;
92
92
  const params = callExpression.arguments[0].expression.params;
93
- const typeParams = params[0].typeAnnotation.typeAnnotation.typeParams.params;
94
- const props = typeParams[0];
95
- const types = props.types ? props.types : [props];
96
- types.forEach((t) => {
97
- const typeName = t.typeName.value;
98
- if (typeName === "DefineProp" || typeName === "DefineVModel") {
99
- const params = t.typeParams.params;
100
- const name = extractTypeValue(params[0]) || "modelValue";
101
- const type = extractTypeValue(params[1]);
102
- // if(!type)console.log(filePath, name, params[1])
103
- const required = params.length > 2 ? extractTypeValue(params[2]) : false;
104
- const defaultValue = params.length > 3 ? extractTypeValue(params[3], true) : undefined;
105
- const description = params.length > 4 ? extractTypeValue(params[4]) : "";
106
- const info = {
107
- type: type,
108
- description: description,
109
- required: required.toString().toLowerCase() === "true" ? true : false
110
- };
111
- if (defaultValue !== undefined && defaultValue !== "null") {
112
- info.defaultValue = defaultValue;
113
- }
114
- if (typeName === "DefineVModel") {
115
- componentInfo.models[name] = info;
116
- }
117
- else { // props
118
- componentInfo.props[name] = info;
119
- }
120
- }
121
- });
122
- if (typeParams.length > 1) {
123
- const emits = typeParams[1];
124
- const types = emits.types ? emits.types : [emits];
125
- types.forEach((t) => {
93
+ const typeParams = params?.length > 0 ? params[0].typeAnnotation.typeAnnotation?.typeParams?.params : null;
94
+ if (typeParams?.length > 0) {
95
+ const props = typeParams[0];
96
+ const types = props.types ? props.types : [props];
97
+ types.filter(t => t.type === "TsTypeReference").forEach((t) => {
126
98
  const typeName = t.typeName.value;
127
- if (typeName === "DefineEmit") {
99
+ if (typeName === "DefineProp" || typeName === "DefineVModel") {
128
100
  const params = t.typeParams.params;
129
- const name = extractTypeValue(params[0]);
101
+ const name = extractTypeValue(params[0]) || "modelValue";
130
102
  const type = extractTypeValue(params[1]);
131
- const description = params.length > 2 ? extractTypeValue(params[2]) : "";
132
- componentInfo.emits[name] = {
133
- type: type,
134
- description: description,
135
- };
136
- }
137
- });
138
- }
139
- if (typeParams.length > 2) {
140
- const slots = typeParams[2];
141
- const types = slots.types ? slots.types : [slots];
142
- types.forEach((t) => {
143
- const typeName = t.typeName.value;
144
- if (typeName === "DefineSlot") {
145
- const params = t.typeParams.params;
146
- const name = extractTypeValue(params[0]);
147
- const type = extractTypeValue(params[1]);
148
- const description = params.length > 2 ? extractTypeValue(params[2]) : "";
149
- componentInfo.slots[name] = {
103
+ // if(!type)console.log(filePath, name, params[1])
104
+ const required = params.length > 2 ? extractTypeValue(params[2]) : false;
105
+ const defaultValue = params.length > 3 ? extractTypeValue(params[3], true) : undefined;
106
+ const description = params.length > 4 ? extractTypeValue(params[4]) : "";
107
+ const info = {
150
108
  type: type,
151
109
  description: description,
110
+ required: required.toString().toLowerCase() === "true" ? true : false
152
111
  };
112
+ if (defaultValue !== undefined && defaultValue !== "null") {
113
+ info.defaultValue = defaultValue;
114
+ }
115
+ if (typeName === "DefineVModel") {
116
+ componentInfo.models[name] = info;
117
+ }
118
+ else { // props
119
+ componentInfo.props[name] = info;
120
+ }
153
121
  }
154
122
  });
123
+ if (typeParams.length > 1) {
124
+ const emits = typeParams[1];
125
+ const types = emits.types ? emits.types : [emits];
126
+ types.filter(t => t.type === "TsTypeReference").forEach((t) => {
127
+ const typeName = t.typeName.value;
128
+ if (typeName === "DefineEmit") {
129
+ const params = t.typeParams.params;
130
+ const name = extractTypeValue(params[0]);
131
+ const type = extractTypeValue(params[1]);
132
+ const description = params.length > 2 ? extractTypeValue(params[2]) : "";
133
+ componentInfo.emits[name] = {
134
+ type: type,
135
+ description: description,
136
+ };
137
+ }
138
+ });
139
+ }
140
+ if (typeParams.length > 2) {
141
+ const slots = typeParams[2];
142
+ const types = slots.types ? slots.types : [slots];
143
+ types.filter(t => t.type === "TsTypeReference").forEach((t) => {
144
+ const typeName = t.typeName.value;
145
+ if (typeName === "DefineSlot") {
146
+ const params = t.typeParams.params;
147
+ const name = extractTypeValue(params[0]);
148
+ const type = extractTypeValue(params[1]);
149
+ const description = params.length > 2 ? extractTypeValue(params[2]) : "";
150
+ componentInfo.slots[name] = {
151
+ type: type,
152
+ description: description,
153
+ };
154
+ }
155
+ });
156
+ }
155
157
  }
156
158
  }
157
159
  else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/tooling-vue",
3
3
  "license": "MIT",
4
- "version": "8.0.113-dev",
4
+ "version": "8.0.114-dev",
5
5
  "description": "Used to bundle and serve manifests web component that build on Vue framework.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "author": "Precio Fishbone",
21
21
  "dependencies": {
22
- "@omnia/fx-models": "8.0.113-dev",
23
- "@omnia/tooling-composers": "8.0.113-dev",
22
+ "@omnia/fx-models": "8.0.114-dev",
23
+ "@omnia/tooling-composers": "8.0.114-dev",
24
24
  "@types/mousetrap": "1.5.34",
25
25
  "@types/quill": "1.3.6",
26
26
  "@types/zepto": "1.0.29",