vue-component-meta 3.0.0-alpha.6 → 3.0.0-beta.1
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/lib/base.js +9 -12
- package/package.json +9 -13
package/lib/base.js
CHANGED
|
@@ -20,8 +20,6 @@ exports.baseCreate = baseCreate;
|
|
|
20
20
|
const typescript_1 = require("@volar/typescript");
|
|
21
21
|
const vue = require("@vue/language-core");
|
|
22
22
|
const path_browserify_1 = require("path-browserify");
|
|
23
|
-
const vue_component_type_helpers_1 = require("vue-component-type-helpers");
|
|
24
|
-
const vue2_1 = require("vue-component-type-helpers/vue2");
|
|
25
23
|
__exportStar(require("./types"), exports);
|
|
26
24
|
const windowsPathReg = /\\/g;
|
|
27
25
|
function createCheckerByJsonConfigBase(ts, rootDir, json, checkerOptions = {}) {
|
|
@@ -178,7 +176,9 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
|
|
|
178
176
|
}
|
|
179
177
|
function getMetaScriptContent(fileName) {
|
|
180
178
|
let code = `
|
|
179
|
+
import type { ComponentType, ComponentProps, ComponentEmit, ComponentSlots, ComponentExposed } from 'vue-component-type-helpers';
|
|
181
180
|
import * as Components from '${fileName.slice(0, -'.meta.ts'.length)}';
|
|
181
|
+
|
|
182
182
|
export default {} as { [K in keyof typeof Components]: ComponentMeta<typeof Components[K]>; };
|
|
183
183
|
|
|
184
184
|
interface ComponentMeta<T> {
|
|
@@ -187,9 +187,7 @@ interface ComponentMeta<T> {
|
|
|
187
187
|
emit: ComponentEmit<T>;
|
|
188
188
|
slots: ComponentSlots<T>;
|
|
189
189
|
exposed: ComponentExposed<T>;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
${commandLine.vueOptions.target < 3 ? vue2_1.code : vue_component_type_helpers_1.code}
|
|
190
|
+
}
|
|
193
191
|
`.trim();
|
|
194
192
|
return code;
|
|
195
193
|
}
|
|
@@ -240,7 +238,7 @@ ${commandLine.vueOptions.target < 3 ? vue2_1.code : vue_component_type_helpers_1
|
|
|
240
238
|
}
|
|
241
239
|
function getProps() {
|
|
242
240
|
const $props = symbolProperties.find(prop => prop.escapedName === 'props');
|
|
243
|
-
const
|
|
241
|
+
const vnodeEventRegex = /^onVnode[A-Z]/;
|
|
244
242
|
let result = [];
|
|
245
243
|
if ($props) {
|
|
246
244
|
const type = typeChecker.getTypeOfSymbolAtLocation($props, symbolNode);
|
|
@@ -250,7 +248,7 @@ ${commandLine.vueOptions.target < 3 ? vue2_1.code : vue_component_type_helpers_1
|
|
|
250
248
|
const { resolveNestedProperties, } = createSchemaResolvers(typeChecker, symbolNode, checkerOptions, ts, language);
|
|
251
249
|
return resolveNestedProperties(prop);
|
|
252
250
|
})
|
|
253
|
-
.filter(prop => !
|
|
251
|
+
.filter(prop => !vnodeEventRegex.test(prop.name));
|
|
254
252
|
}
|
|
255
253
|
// fill global
|
|
256
254
|
if (componentPath !== globalComponentName) {
|
|
@@ -635,11 +633,11 @@ function readVueComponentDefaultProps(root, printer, ts) {
|
|
|
635
633
|
}
|
|
636
634
|
}
|
|
637
635
|
}
|
|
638
|
-
if (scriptSetupRanges?.
|
|
639
|
-
for (const
|
|
640
|
-
const obj =
|
|
636
|
+
if (scriptSetupRanges?.defineModel) {
|
|
637
|
+
for (const defineModel of scriptSetupRanges.defineModel) {
|
|
638
|
+
const obj = defineModel.argNode ? findObjectLiteralExpression(defineModel.argNode) : undefined;
|
|
641
639
|
if (obj) {
|
|
642
|
-
const name =
|
|
640
|
+
const name = defineModel.name ? sfc.scriptSetup.content.slice(defineModel.name.start, defineModel.name.end).slice(1, -1) : 'modelValue';
|
|
643
641
|
result[name] = resolveModelOption(ast, obj, printer, ts);
|
|
644
642
|
}
|
|
645
643
|
}
|
|
@@ -705,7 +703,6 @@ function readTsComponentDefaultProps(ast, exportName, printer, ts) {
|
|
|
705
703
|
return component;
|
|
706
704
|
}
|
|
707
705
|
// export default defineComponent({ ... })
|
|
708
|
-
// export default Vue.extend({ ... })
|
|
709
706
|
else if (ts.isCallExpression(component)) {
|
|
710
707
|
if (component.arguments.length) {
|
|
711
708
|
const arg = component.arguments[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-component-meta",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -13,22 +13,18 @@
|
|
|
13
13
|
"directory": "packages/component-meta"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/typescript": "
|
|
17
|
-
"@vue/language-core": "3.0.0-
|
|
18
|
-
"path-browserify": "^1.0.1"
|
|
19
|
-
"vue-component-type-helpers": "3.0.0-alpha.6"
|
|
16
|
+
"@volar/typescript": "2.4.14",
|
|
17
|
+
"@vue/language-core": "3.0.0-beta.1",
|
|
18
|
+
"path-browserify": "^1.0.1"
|
|
20
19
|
},
|
|
21
20
|
"peerDependencies": {
|
|
22
|
-
"typescript": "*"
|
|
23
|
-
|
|
24
|
-
"peerDependenciesMeta": {
|
|
25
|
-
"typescript": {
|
|
26
|
-
"optional": true
|
|
27
|
-
}
|
|
21
|
+
"typescript": "*",
|
|
22
|
+
"vue-component-type-helpers": "3.0.0-alpha.10"
|
|
28
23
|
},
|
|
29
24
|
"devDependencies": {
|
|
30
25
|
"@types/node": "^22.10.4",
|
|
31
|
-
"@types/path-browserify": "^1.0.1"
|
|
26
|
+
"@types/path-browserify": "^1.0.1",
|
|
27
|
+
"vue-component-type-helpers": "3.0.0-beta.1"
|
|
32
28
|
},
|
|
33
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "7a2ea48123679387d7095a81ac49cfc667aeeabb"
|
|
34
30
|
}
|