vue-component-meta 2.1.2 → 2.1.5
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 +23 -14
- package/package.json +4 -4
package/lib/base.js
CHANGED
|
@@ -56,7 +56,10 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
|
|
|
56
56
|
getMetaFileName(globalComponentName),
|
|
57
57
|
];
|
|
58
58
|
};
|
|
59
|
-
const vueLanguagePlugin = vue.createVueLanguagePlugin(ts, projectHost.getCompilationSettings(),
|
|
59
|
+
const vueLanguagePlugin = vue.createVueLanguagePlugin(ts, projectHost.getCompilationSettings(), {
|
|
60
|
+
...commandLine.vueOptions,
|
|
61
|
+
__setupedGlobalTypes: () => true,
|
|
62
|
+
}, id => id);
|
|
60
63
|
const language = vue.createLanguage([
|
|
61
64
|
vueLanguagePlugin,
|
|
62
65
|
{
|
|
@@ -96,27 +99,33 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
|
|
|
96
99
|
});
|
|
97
100
|
const { languageServiceHost } = (0, typescript_1.createLanguageServiceHost)(ts, ts.sys, language, s => s, projectHost);
|
|
98
101
|
const tsLs = ts.createLanguageService(languageServiceHost);
|
|
102
|
+
const directoryExists = languageServiceHost.directoryExists?.bind(languageServiceHost);
|
|
99
103
|
const fileExists = languageServiceHost.fileExists.bind(languageServiceHost);
|
|
100
104
|
const getScriptSnapshot = languageServiceHost.getScriptSnapshot.bind(languageServiceHost);
|
|
101
|
-
const globalTypesName =
|
|
102
|
-
const
|
|
105
|
+
const globalTypesName = `${commandLine.vueOptions.lib}_${commandLine.vueOptions.target}_${commandLine.vueOptions.strictTemplates}.d.ts`;
|
|
106
|
+
const globalTypesContents = vue.generateGlobalTypes('global', commandLine.vueOptions.lib, commandLine.vueOptions.target, commandLine.vueOptions.strictTemplates);
|
|
107
|
+
const globalTypesSnapshot = {
|
|
108
|
+
getText: (start, end) => globalTypesContents.substring(start, end),
|
|
109
|
+
getLength: () => globalTypesContents.length,
|
|
110
|
+
getChangeRange: () => undefined,
|
|
111
|
+
};
|
|
112
|
+
if (directoryExists) {
|
|
113
|
+
languageServiceHost.directoryExists = path => {
|
|
114
|
+
if (path.endsWith('.vue-global-types')) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
return directoryExists(path);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
103
120
|
languageServiceHost.fileExists = path => {
|
|
104
|
-
if (path.endsWith(globalTypesName)) {
|
|
121
|
+
if (path.endsWith(`.vue-global-types/${globalTypesName}`) || path.endsWith(`.vue-global-types\\${globalTypesName}`)) {
|
|
105
122
|
return true;
|
|
106
123
|
}
|
|
107
124
|
return fileExists(path);
|
|
108
125
|
};
|
|
109
126
|
languageServiceHost.getScriptSnapshot = path => {
|
|
110
|
-
if (path.endsWith(globalTypesName)) {
|
|
111
|
-
|
|
112
|
-
const contents = vue.generateGlobalTypes(commandLine.vueOptions.lib, commandLine.vueOptions.target, commandLine.vueOptions.strictTemplates);
|
|
113
|
-
snapshots.set(path, {
|
|
114
|
-
getText: (start, end) => contents.substring(start, end),
|
|
115
|
-
getLength: () => contents.length,
|
|
116
|
-
getChangeRange: () => undefined,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
return snapshots.get(path);
|
|
127
|
+
if (path.endsWith(`.vue-global-types/${globalTypesName}`) || path.endsWith(`.vue-global-types\\${globalTypesName}`)) {
|
|
128
|
+
return globalTypesSnapshot;
|
|
120
129
|
}
|
|
121
130
|
return getScriptSnapshot(path);
|
|
122
131
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-component-meta",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@volar/typescript": "~2.4.1",
|
|
16
|
-
"@vue/language-core": "2.1.
|
|
16
|
+
"@vue/language-core": "2.1.5",
|
|
17
17
|
"path-browserify": "^1.0.1",
|
|
18
|
-
"vue-component-type-helpers": "2.1.
|
|
18
|
+
"vue-component-type-helpers": "2.1.5"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"typescript": "*"
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"@types/node": "latest",
|
|
30
30
|
"@types/path-browserify": "latest"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "a95b51ac0b0db8825f77fbba37e29932b5be61e4"
|
|
33
33
|
}
|