vue-component-meta 2.1.5 → 2.1.8
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 +8 -11
- package/package.json +6 -5
package/lib/base.js
CHANGED
|
@@ -19,18 +19,18 @@ exports.createCheckerBase = createCheckerBase;
|
|
|
19
19
|
exports.baseCreate = baseCreate;
|
|
20
20
|
const typescript_1 = require("@volar/typescript");
|
|
21
21
|
const vue = require("@vue/language-core");
|
|
22
|
-
const
|
|
22
|
+
const path_browserify_1 = require("path-browserify");
|
|
23
23
|
const vue_component_type_helpers_1 = require("vue-component-type-helpers");
|
|
24
24
|
const vue2_1 = require("vue-component-type-helpers/vue2");
|
|
25
25
|
__exportStar(require("./types"), exports);
|
|
26
26
|
const windowsPathReg = /\\/g;
|
|
27
27
|
function createCheckerByJsonConfigBase(ts, rootDir, json, checkerOptions = {}) {
|
|
28
28
|
rootDir = rootDir.replace(windowsPathReg, '/');
|
|
29
|
-
return baseCreate(ts, () => vue.createParsedCommandLineByJson(ts, ts.sys, rootDir, json), checkerOptions, rootDir,
|
|
29
|
+
return baseCreate(ts, () => vue.createParsedCommandLineByJson(ts, ts.sys, rootDir, json, undefined, true), checkerOptions, rootDir, path_browserify_1.posix.join(rootDir, 'jsconfig.json.global.vue'));
|
|
30
30
|
}
|
|
31
31
|
function createCheckerBase(ts, tsconfig, checkerOptions = {}) {
|
|
32
32
|
tsconfig = tsconfig.replace(windowsPathReg, '/');
|
|
33
|
-
return baseCreate(ts, () => vue.createParsedCommandLine(ts, ts.sys, tsconfig), checkerOptions,
|
|
33
|
+
return baseCreate(ts, () => vue.createParsedCommandLine(ts, ts.sys, tsconfig, true), checkerOptions, path_browserify_1.posix.dirname(tsconfig), tsconfig + '.global.vue');
|
|
34
34
|
}
|
|
35
35
|
function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponentName) {
|
|
36
36
|
let commandLine = getCommandLine();
|
|
@@ -56,10 +56,7 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
|
|
|
56
56
|
getMetaFileName(globalComponentName),
|
|
57
57
|
];
|
|
58
58
|
};
|
|
59
|
-
const vueLanguagePlugin = vue.createVueLanguagePlugin(ts, projectHost.getCompilationSettings(),
|
|
60
|
-
...commandLine.vueOptions,
|
|
61
|
-
__setupedGlobalTypes: () => true,
|
|
62
|
-
}, id => id);
|
|
59
|
+
const vueLanguagePlugin = vue.createVueLanguagePlugin(ts, projectHost.getCompilationSettings(), commandLine.vueOptions, id => id);
|
|
63
60
|
const language = vue.createLanguage([
|
|
64
61
|
vueLanguagePlugin,
|
|
65
62
|
{
|
|
@@ -103,7 +100,7 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
|
|
|
103
100
|
const fileExists = languageServiceHost.fileExists.bind(languageServiceHost);
|
|
104
101
|
const getScriptSnapshot = languageServiceHost.getScriptSnapshot.bind(languageServiceHost);
|
|
105
102
|
const globalTypesName = `${commandLine.vueOptions.lib}_${commandLine.vueOptions.target}_${commandLine.vueOptions.strictTemplates}.d.ts`;
|
|
106
|
-
const globalTypesContents = vue.generateGlobalTypes(
|
|
103
|
+
const globalTypesContents = `// @ts-nocheck\nexport {};\n` + vue.generateGlobalTypes(commandLine.vueOptions.lib, commandLine.vueOptions.target, commandLine.vueOptions.strictTemplates);
|
|
107
104
|
const globalTypesSnapshot = {
|
|
108
105
|
getText: (start, end) => globalTypesContents.substring(start, end),
|
|
109
106
|
getLength: () => globalTypesContents.length,
|
|
@@ -410,7 +407,7 @@ function createSchemaResolvers(typeChecker, symbolNode, { rawType, schema: optio
|
|
|
410
407
|
function resolveSlotProperties(prop) {
|
|
411
408
|
const propType = typeChecker.getNonNullableType(typeChecker.getTypeOfSymbolAtLocation(prop, symbolNode));
|
|
412
409
|
const signatures = propType.getCallSignatures();
|
|
413
|
-
const paramType = signatures[0]
|
|
410
|
+
const paramType = signatures[0]?.parameters[0];
|
|
414
411
|
const subtype = paramType ? typeChecker.getTypeOfSymbolAtLocation(paramType, symbolNode) : typeChecker.getAnyType();
|
|
415
412
|
let schema;
|
|
416
413
|
let declarations;
|
|
@@ -567,7 +564,7 @@ function readVueComponentDefaultProps(vueSourceFile, printer, ts, vueCompilerOpt
|
|
|
567
564
|
scriptWorker();
|
|
568
565
|
return result;
|
|
569
566
|
function scriptSetupWorker() {
|
|
570
|
-
const descriptor = vueSourceFile.
|
|
567
|
+
const descriptor = vueSourceFile._sfc;
|
|
571
568
|
const scriptSetupRanges = descriptor.scriptSetup ? vue.parseScriptSetupRanges(ts, descriptor.scriptSetup.ast, vueCompilerOptions) : undefined;
|
|
572
569
|
if (descriptor.scriptSetup && scriptSetupRanges?.props.withDefaults?.arg) {
|
|
573
570
|
const defaultsText = descriptor.scriptSetup.content.substring(scriptSetupRanges.props.withDefaults.arg.start, scriptSetupRanges.props.withDefaults.arg.end);
|
|
@@ -611,7 +608,7 @@ function readVueComponentDefaultProps(vueSourceFile, printer, ts, vueCompilerOpt
|
|
|
611
608
|
}
|
|
612
609
|
}
|
|
613
610
|
function scriptWorker() {
|
|
614
|
-
const descriptor = vueSourceFile.
|
|
611
|
+
const descriptor = vueSourceFile._sfc;
|
|
615
612
|
if (descriptor.script) {
|
|
616
613
|
const scriptResult = readTsComponentDefaultProps(descriptor.script.lang, descriptor.script.content, 'default', printer, ts);
|
|
617
614
|
for (const [key, value] of Object.entries(scriptResult)) {
|
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-component-meta",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
7
7
|
"**/*.d.ts"
|
|
8
8
|
],
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
11
12
|
"url": "https://github.com/vuejs/language-tools.git",
|
|
12
13
|
"directory": "packages/component-meta"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@volar/typescript": "~2.4.
|
|
16
|
-
"@vue/language-core": "2.1.
|
|
16
|
+
"@volar/typescript": "~2.4.8",
|
|
17
|
+
"@vue/language-core": "2.1.8",
|
|
17
18
|
"path-browserify": "^1.0.1",
|
|
18
|
-
"vue-component-type-helpers": "2.1.
|
|
19
|
+
"vue-component-type-helpers": "2.1.8"
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|
|
21
22
|
"typescript": "*"
|
|
@@ -29,5 +30,5 @@
|
|
|
29
30
|
"@types/node": "latest",
|
|
30
31
|
"@types/path-browserify": "latest"
|
|
31
32
|
},
|
|
32
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "25cccedc53e7361ed4e34296d6ecd43d7de2a095"
|
|
33
34
|
}
|