vue-component-meta 2.0.3 → 2.0.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.
Files changed (2) hide show
  1. package/lib/base.js +22 -3
  2. package/package.json +5 -5
package/lib/base.js CHANGED
@@ -40,6 +40,7 @@ function createCheckerWorker(ts, loadParsedCommandLine, checkerOptions, rootPath
40
40
  let fileNames = parsedCommandLine.fileNames.map(path => path.replace(windowsPathReg, '/'));
41
41
  let projectVersion = 0;
42
42
  const scriptSnapshots = new Map();
43
+ const resolvedVueOptions = vue.resolveVueCompilerOptions(parsedCommandLine.vueOptions);
43
44
  const _host = {
44
45
  getCurrentDirectory: () => rootPath,
45
46
  getProjectVersion: () => projectVersion.toString(),
@@ -55,10 +56,15 @@ function createCheckerWorker(ts, loadParsedCommandLine, checkerOptions, rootPath
55
56
  }
56
57
  return scriptSnapshots.get(fileName);
57
58
  },
58
- getLanguageId: vue.resolveCommonLanguageId,
59
+ getLanguageId: fileName => {
60
+ if (resolvedVueOptions.extensions.some(ext => fileName.endsWith(ext))) {
61
+ return 'vue';
62
+ }
63
+ return vue.resolveCommonLanguageId(fileName);
64
+ },
59
65
  };
60
66
  return {
61
- ...baseCreate(ts, configFileName, _host, vue.resolveVueCompilerOptions(parsedCommandLine.vueOptions), checkerOptions, globalComponentName),
67
+ ...baseCreate(ts, configFileName, _host, resolvedVueOptions, checkerOptions, globalComponentName),
62
68
  updateFile(fileName, text) {
63
69
  fileName = fileName.replace(windowsPathReg, '/');
64
70
  scriptSnapshots.set(fileName, ts.ScriptSnapshot.fromString(text));
@@ -108,7 +114,20 @@ function baseCreate(ts, configFileName, host, vueCompilerOptions, checkerOptions
108
114
  return getScriptSnapshot(fileName);
109
115
  }
110
116
  };
111
- const vueLanguagePlugin = vue.createVueLanguagePlugin(ts, id => id, host.getCompilationSettings(), vueCompilerOptions);
117
+ const vueLanguagePlugin = vue.createVueLanguagePlugin(ts, id => id, fileName => {
118
+ if (ts.sys.useCaseSensitiveFileNames) {
119
+ return host.getScriptFileNames().includes(fileName) ?? false;
120
+ }
121
+ else {
122
+ const lowerFileName = fileName.toLowerCase();
123
+ for (const rootFile of host.getScriptFileNames()) {
124
+ if (rootFile.toLowerCase() === lowerFileName) {
125
+ return true;
126
+ }
127
+ }
128
+ return false;
129
+ }
130
+ }, host.getCompilationSettings(), vueCompilerOptions);
112
131
  const language = (0, typescript_1.createLanguage)(ts, ts.sys, [vueLanguagePlugin], configFileName, host, {
113
132
  fileIdToFileName: id => id,
114
133
  fileNameToFileId: id => id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-component-meta",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,10 +12,10 @@
12
12
  "directory": "packages/component-meta"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/typescript": "~2.1.0",
16
- "@vue/language-core": "2.0.3",
15
+ "@volar/typescript": "~2.1.1",
16
+ "@vue/language-core": "2.0.5",
17
17
  "path-browserify": "^1.0.1",
18
- "vue-component-type-helpers": "2.0.3"
18
+ "vue-component-type-helpers": "2.0.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": "fc1e288c8c0c82e6730781006d84a2676b5266ff"
32
+ "gitHead": "62b4fcb0d3f7153b5b2f5571af32f519117d8466"
33
33
  }