vue-component-meta 1.7.12 → 1.7.13
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/out/index.js +13 -0
- package/out/types.d.ts +6 -0
- package/out/types.js +7 -0
- package/package.json +5 -5
package/out/index.js
CHANGED
|
@@ -147,6 +147,7 @@ import * as Components from '${fileName.substring(0, fileName.length - '.meta.ts
|
|
|
147
147
|
export default {} as { [K in keyof typeof Components]: ComponentMeta<typeof Components[K]>; };
|
|
148
148
|
|
|
149
149
|
interface ComponentMeta<T> {
|
|
150
|
+
type: ComponentType<T>;
|
|
150
151
|
props: ComponentProps<T>;
|
|
151
152
|
emit: ComponentEmit<T>;
|
|
152
153
|
slots: ${vueCompilerOptions.target < 3 ? 'Vue2ComponentSlots' : 'ComponentSlots'}<T>;
|
|
@@ -172,11 +173,15 @@ ${vue_component_type_helpers_1.default}
|
|
|
172
173
|
}
|
|
173
174
|
const componentType = typeChecker.getTypeOfSymbolAtLocation(_export, symbolNode);
|
|
174
175
|
const symbolProperties = componentType.getProperties() ?? [];
|
|
176
|
+
let _type;
|
|
175
177
|
let _props;
|
|
176
178
|
let _events;
|
|
177
179
|
let _slots;
|
|
178
180
|
let _exposed;
|
|
179
181
|
return {
|
|
182
|
+
get type() {
|
|
183
|
+
return _type ?? (_type = getType());
|
|
184
|
+
},
|
|
180
185
|
get props() {
|
|
181
186
|
return _props ?? (_props = getProps());
|
|
182
187
|
},
|
|
@@ -190,6 +195,14 @@ ${vue_component_type_helpers_1.default}
|
|
|
190
195
|
return _exposed ?? (_exposed = getExposed());
|
|
191
196
|
},
|
|
192
197
|
};
|
|
198
|
+
function getType() {
|
|
199
|
+
const $type = symbolProperties.find(prop => prop.escapedName === 'type');
|
|
200
|
+
if ($type) {
|
|
201
|
+
const type = typeChecker.getTypeOfSymbolAtLocation($type, symbolNode);
|
|
202
|
+
return Number(typeChecker.typeToString(type));
|
|
203
|
+
}
|
|
204
|
+
return 0;
|
|
205
|
+
}
|
|
193
206
|
function getProps() {
|
|
194
207
|
const $props = symbolProperties.find(prop => prop.escapedName === 'props');
|
|
195
208
|
const propEventRegex = /^(on[A-Z])/;
|
package/out/types.d.ts
CHANGED
|
@@ -4,11 +4,17 @@ export interface Declaration {
|
|
|
4
4
|
range: [number, number];
|
|
5
5
|
}
|
|
6
6
|
export interface ComponentMeta {
|
|
7
|
+
type: TypeMeta;
|
|
7
8
|
props: PropertyMeta[];
|
|
8
9
|
events: EventMeta[];
|
|
9
10
|
slots: SlotMeta[];
|
|
10
11
|
exposed: ExposeMeta[];
|
|
11
12
|
}
|
|
13
|
+
export declare enum TypeMeta {
|
|
14
|
+
Unknown = 0,
|
|
15
|
+
Class = 1,
|
|
16
|
+
Function = 2
|
|
17
|
+
}
|
|
12
18
|
export interface PropertyMeta {
|
|
13
19
|
name: string;
|
|
14
20
|
default?: string;
|
package/out/types.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeMeta = void 0;
|
|
4
|
+
var TypeMeta;
|
|
5
|
+
(function (TypeMeta) {
|
|
6
|
+
TypeMeta[TypeMeta["Unknown"] = 0] = "Unknown";
|
|
7
|
+
TypeMeta[TypeMeta["Class"] = 1] = "Class";
|
|
8
|
+
TypeMeta[TypeMeta["Function"] = 2] = "Function";
|
|
9
|
+
})(TypeMeta || (exports.TypeMeta = TypeMeta = {}));
|
|
3
10
|
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-component-meta",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.13",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"directory": "packages/vue-component-meta"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/typescript": "1.7.
|
|
17
|
-
"@vue/language-core": "1.7.
|
|
16
|
+
"@volar/typescript": "1.7.5",
|
|
17
|
+
"@vue/language-core": "1.7.13",
|
|
18
18
|
"typesafe-path": "^0.2.2",
|
|
19
|
-
"vue-component-type-helpers": "1.7.
|
|
19
|
+
"vue-component-type-helpers": "1.7.13"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"typescript": "*"
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"optional": true
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "32d5d5e4414f97b0dc28cd727a9cecf60acd4e97"
|
|
30
30
|
}
|