vue-component-meta 3.0.1 → 3.0.3
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 +5 -33
- package/package.json +6 -6
package/lib/base.js
CHANGED
|
@@ -24,11 +24,11 @@ __exportStar(require("./types"), exports);
|
|
|
24
24
|
const windowsPathReg = /\\/g;
|
|
25
25
|
function createCheckerByJsonConfigBase(ts, rootDir, json, checkerOptions = {}) {
|
|
26
26
|
rootDir = rootDir.replace(windowsPathReg, '/');
|
|
27
|
-
return baseCreate(ts, () => vue.createParsedCommandLineByJson(ts, ts.sys, rootDir, json
|
|
27
|
+
return baseCreate(ts, () => vue.createParsedCommandLineByJson(ts, ts.sys, rootDir, json), checkerOptions, rootDir, path_browserify_1.posix.join(rootDir, 'jsconfig.json.global.vue'));
|
|
28
28
|
}
|
|
29
29
|
function createCheckerBase(ts, tsconfig, checkerOptions = {}) {
|
|
30
30
|
tsconfig = tsconfig.replace(windowsPathReg, '/');
|
|
31
|
-
return baseCreate(ts, () => vue.createParsedCommandLine(ts, ts.sys, tsconfig
|
|
31
|
+
return baseCreate(ts, () => vue.createParsedCommandLine(ts, ts.sys, tsconfig), checkerOptions, path_browserify_1.posix.dirname(tsconfig), tsconfig + '.global.vue');
|
|
32
32
|
}
|
|
33
33
|
function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponentName) {
|
|
34
34
|
let commandLine = getCommandLine();
|
|
@@ -37,6 +37,7 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
|
|
|
37
37
|
*/
|
|
38
38
|
let fileNames = new Set(commandLine.fileNames.map(path => path.replace(windowsPathReg, '/')));
|
|
39
39
|
let projectVersion = 0;
|
|
40
|
+
vue.writeGlobalTypes(commandLine.vueOptions, ts.sys.writeFile);
|
|
40
41
|
const projectHost = {
|
|
41
42
|
getCurrentDirectory: () => rootPath,
|
|
42
43
|
getProjectVersion: () => projectVersion.toString(),
|
|
@@ -97,36 +98,6 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
|
|
|
97
98
|
});
|
|
98
99
|
const { languageServiceHost } = (0, typescript_1.createLanguageServiceHost)(ts, ts.sys, language, s => s, projectHost);
|
|
99
100
|
const tsLs = ts.createLanguageService(languageServiceHost);
|
|
100
|
-
const directoryExists = languageServiceHost.directoryExists?.bind(languageServiceHost);
|
|
101
|
-
const fileExists = languageServiceHost.fileExists.bind(languageServiceHost);
|
|
102
|
-
const getScriptSnapshot = languageServiceHost.getScriptSnapshot.bind(languageServiceHost);
|
|
103
|
-
const globalTypesName = vue.getGlobalTypesFileName(commandLine.vueOptions);
|
|
104
|
-
const globalTypesContents = `// @ts-nocheck\nexport {};\n` + vue.generateGlobalTypes(commandLine.vueOptions);
|
|
105
|
-
const globalTypesSnapshot = {
|
|
106
|
-
getText: (start, end) => globalTypesContents.slice(start, end),
|
|
107
|
-
getLength: () => globalTypesContents.length,
|
|
108
|
-
getChangeRange: () => undefined,
|
|
109
|
-
};
|
|
110
|
-
if (directoryExists) {
|
|
111
|
-
languageServiceHost.directoryExists = path => {
|
|
112
|
-
if (path.endsWith('.vue-global-types')) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
return directoryExists(path);
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
languageServiceHost.fileExists = path => {
|
|
119
|
-
if (path.endsWith(`.vue-global-types/${globalTypesName}`) || path.endsWith(`.vue-global-types\\${globalTypesName}`)) {
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
return fileExists(path);
|
|
123
|
-
};
|
|
124
|
-
languageServiceHost.getScriptSnapshot = path => {
|
|
125
|
-
if (path.endsWith(`.vue-global-types/${globalTypesName}`) || path.endsWith(`.vue-global-types\\${globalTypesName}`)) {
|
|
126
|
-
return globalTypesSnapshot;
|
|
127
|
-
}
|
|
128
|
-
return getScriptSnapshot(path);
|
|
129
|
-
};
|
|
130
101
|
if (checkerOptions.forceUseTs) {
|
|
131
102
|
const getScriptKind = languageServiceHost.getScriptKind?.bind(languageServiceHost);
|
|
132
103
|
languageServiceHost.getScriptKind = fileName => {
|
|
@@ -712,7 +683,8 @@ function readTsComponentDefaultProps(ast, exportName, printer, ts) {
|
|
|
712
683
|
// export default { ... }
|
|
713
684
|
if (ts.isObjectLiteralExpression(component)) {
|
|
714
685
|
return component;
|
|
715
|
-
}
|
|
686
|
+
}
|
|
687
|
+
// export default defineComponent({ ... })
|
|
716
688
|
else if (ts.isCallExpression(component)) {
|
|
717
689
|
if (component.arguments.length) {
|
|
718
690
|
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.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
"directory": "packages/component-meta"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/typescript": "2.4.
|
|
17
|
-
"@vue/language-core": "3.0.
|
|
16
|
+
"@volar/typescript": "2.4.20",
|
|
17
|
+
"@vue/language-core": "3.0.3",
|
|
18
18
|
"path-browserify": "^1.0.1"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"typescript": "*",
|
|
22
|
-
"vue-component-type-helpers": "3.0.
|
|
22
|
+
"vue-component-type-helpers": "3.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.10.4",
|
|
26
26
|
"@types/path-browserify": "^1.0.1",
|
|
27
|
-
"vue-component-type-helpers": "3.0.
|
|
27
|
+
"vue-component-type-helpers": "3.0.2"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "129f30ff8d8d976abf0431063be5c6c4cf88f0fd"
|
|
30
30
|
}
|