vue-component-meta 1.3.8 → 1.3.10
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 +32 -12
- package/package.json +4 -4
package/out/index.js
CHANGED
|
@@ -161,9 +161,28 @@ function baseCreate(_host, checkerOptions, globalComponentName, ts) {
|
|
|
161
161
|
}
|
|
162
162
|
function getMetaScriptContent(fileName) {
|
|
163
163
|
return `
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
import * as Components from '${fileName.substring(0, fileName.length - '.meta.ts'.length)}';
|
|
165
|
+
export default {} as { [K in keyof typeof Components]: ComponentMeta<typeof Components[K]>; };
|
|
166
|
+
|
|
167
|
+
type ComponentMeta<T> = {
|
|
168
|
+
props:
|
|
169
|
+
T extends new () => { $props: infer P } ? P :
|
|
170
|
+
T extends (props: infer P) => any ? P :
|
|
171
|
+
{};
|
|
172
|
+
emit:
|
|
173
|
+
T extends new () => { $emit: infer E } ? E :
|
|
174
|
+
T extends (props: any, ctx: { emit: infer E }) => any ? E :
|
|
175
|
+
{};
|
|
176
|
+
slots:
|
|
177
|
+
T extends new () => { ${vueCompilerOptions.target < 3 ? '$scopedSlots' : '$slots'}: infer S } ? S :
|
|
178
|
+
T extends (props: any, ctx: { slots: infer S }) => any ? S :
|
|
179
|
+
{};
|
|
180
|
+
exposed:
|
|
181
|
+
T extends new () => infer E ? E :
|
|
182
|
+
T extends (props: any, ctx: { expose(exposed?: infer E): any }) => any ? E :
|
|
183
|
+
{};
|
|
184
|
+
};
|
|
185
|
+
`.trim();
|
|
167
186
|
}
|
|
168
187
|
function getExportNames(componentPath) {
|
|
169
188
|
const program = tsLs.getProgram();
|
|
@@ -199,7 +218,7 @@ function baseCreate(_host, checkerOptions, globalComponentName, ts) {
|
|
|
199
218
|
},
|
|
200
219
|
};
|
|
201
220
|
function getProps() {
|
|
202
|
-
const $props = symbolProperties.find(prop => prop.escapedName === '
|
|
221
|
+
const $props = symbolProperties.find(prop => prop.escapedName === 'props');
|
|
203
222
|
const propEventRegex = /^(on[A-Z])/;
|
|
204
223
|
let result = [];
|
|
205
224
|
if ($props) {
|
|
@@ -246,7 +265,7 @@ function baseCreate(_host, checkerOptions, globalComponentName, ts) {
|
|
|
246
265
|
return result;
|
|
247
266
|
}
|
|
248
267
|
function getEvents() {
|
|
249
|
-
const $emit = symbolProperties.find(prop => prop.escapedName === '
|
|
268
|
+
const $emit = symbolProperties.find(prop => prop.escapedName === 'emit');
|
|
250
269
|
if ($emit) {
|
|
251
270
|
const type = typeChecker.getTypeOfSymbolAtLocation($emit, symbolNode);
|
|
252
271
|
const calls = type.getCallSignatures();
|
|
@@ -258,8 +277,7 @@ function baseCreate(_host, checkerOptions, globalComponentName, ts) {
|
|
|
258
277
|
return [];
|
|
259
278
|
}
|
|
260
279
|
function getSlots() {
|
|
261
|
-
const
|
|
262
|
-
const $slots = symbolProperties.find(prop => prop.escapedName === propertyName);
|
|
280
|
+
const $slots = symbolProperties.find(prop => prop.escapedName === 'slots');
|
|
263
281
|
if ($slots) {
|
|
264
282
|
const type = typeChecker.getTypeOfSymbolAtLocation($slots, symbolNode);
|
|
265
283
|
const properties = type.getProperties();
|
|
@@ -271,11 +289,13 @@ function baseCreate(_host, checkerOptions, globalComponentName, ts) {
|
|
|
271
289
|
return [];
|
|
272
290
|
}
|
|
273
291
|
function getExposed() {
|
|
274
|
-
const exposed = symbolProperties.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
292
|
+
const $exposed = symbolProperties.find(prop => prop.escapedName === 'exposed');
|
|
293
|
+
if ($exposed) {
|
|
294
|
+
const type = typeChecker.getTypeOfSymbolAtLocation($exposed, symbolNode);
|
|
295
|
+
const properties = type.getProperties().filter(prop =>
|
|
296
|
+
// only exposed props will not have a valueDeclaration
|
|
297
|
+
!prop.valueDeclaration);
|
|
298
|
+
return properties.map((prop) => {
|
|
279
299
|
const { resolveExposedProperties, } = createSchemaResolvers(typeChecker, symbolNode, checkerOptions, ts);
|
|
280
300
|
return resolveExposedProperties(prop);
|
|
281
301
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-component-meta",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.10",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"directory": "packages/vue-component-meta"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-core": "1.4.0-alpha.
|
|
17
|
-
"@volar/vue-language-core": "1.3.
|
|
16
|
+
"@volar/language-core": "1.4.0-alpha.6",
|
|
17
|
+
"@volar/vue-language-core": "1.3.10",
|
|
18
18
|
"typesafe-path": "^0.2.2"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"typescript": "*"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "fe8f9cab04980468a959fbf18f45f85e38a68e79"
|
|
24
24
|
}
|