vue-component-meta 3.0.1 → 3.0.2
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 +7 -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,9 @@ 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
|
+
if (commandLine.vueOptions.globalTypesPath) {
|
|
41
|
+
ts.sys.writeFile(commandLine.vueOptions.globalTypesPath, vue.generateGlobalTypes(commandLine.vueOptions));
|
|
42
|
+
}
|
|
40
43
|
const projectHost = {
|
|
41
44
|
getCurrentDirectory: () => rootPath,
|
|
42
45
|
getProjectVersion: () => projectVersion.toString(),
|
|
@@ -97,36 +100,6 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
|
|
|
97
100
|
});
|
|
98
101
|
const { languageServiceHost } = (0, typescript_1.createLanguageServiceHost)(ts, ts.sys, language, s => s, projectHost);
|
|
99
102
|
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
103
|
if (checkerOptions.forceUseTs) {
|
|
131
104
|
const getScriptKind = languageServiceHost.getScriptKind?.bind(languageServiceHost);
|
|
132
105
|
languageServiceHost.getScriptKind = fileName => {
|
|
@@ -712,7 +685,8 @@ function readTsComponentDefaultProps(ast, exportName, printer, ts) {
|
|
|
712
685
|
// export default { ... }
|
|
713
686
|
if (ts.isObjectLiteralExpression(component)) {
|
|
714
687
|
return component;
|
|
715
|
-
}
|
|
688
|
+
}
|
|
689
|
+
// export default defineComponent({ ... })
|
|
716
690
|
else if (ts.isCallExpression(component)) {
|
|
717
691
|
if (component.arguments.length) {
|
|
718
692
|
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.2",
|
|
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.19",
|
|
17
|
+
"@vue/language-core": "3.0.2",
|
|
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": "7343119e9ca4f6a54f63b57f448f15df4b592a9a"
|
|
30
30
|
}
|