@vue/typescript-plugin
Advanced tools
Comparing version 2.0.4 to 2.0.5
45
index.js
@@ -25,3 +25,16 @@ "use strict"; | ||
const vueOptions = vue.resolveVueCompilerOptions(getVueCompilerOptions()); | ||
const languagePlugin = vue.createVueLanguagePlugin(ts, id => id, info.languageServiceHost.getCompilationSettings(), vueOptions); | ||
const languagePlugin = vue.createVueLanguagePlugin(ts, id => id, fileName => { | ||
if (info.languageServiceHost.useCaseSensitiveFileNames?.() ?? false) { | ||
return externalFiles.get(info.project)?.has(fileName) ?? false; | ||
} | ||
else { | ||
const lowerFileName = fileName.toLowerCase(); | ||
for (const externalFile of externalFiles.get(info.project) ?? []) { | ||
if (externalFile.toLowerCase() === lowerFileName) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
}, info.languageServiceHost.getCompilationSettings(), vueOptions); | ||
const extensions = languagePlugin.typescript?.extraFileExtensions.map(ext => '.' + ext.extension) ?? []; | ||
@@ -32,3 +45,7 @@ const getScriptSnapshot = info.languageServiceHost.getScriptSnapshot.bind(info.languageServiceHost); | ||
if (snapshot) { | ||
files.set(fileName, (0, language_core_1.resolveCommonLanguageId)(fileName), snapshot); | ||
let languageId = (0, language_core_1.resolveCommonLanguageId)(fileName); | ||
if (extensions.some(ext => fileName.endsWith(ext))) { | ||
languageId = 'vue'; | ||
} | ||
files.set(fileName, languageId, snapshot); | ||
} | ||
@@ -173,9 +190,18 @@ else { | ||
const oldFiles = externalFiles.get(project); | ||
const newFiles = (0, decorateLanguageServiceHost_1.searchExternalFiles)(ts, project, projectExternalFileExtensions.get(project)); | ||
const newFiles = new Set((0, decorateLanguageServiceHost_1.searchExternalFiles)(ts, project, projectExternalFileExtensions.get(project))); | ||
console.log('volar-search vue files'); | ||
for (const file of newFiles) { | ||
console.log(file); | ||
} | ||
externalFiles.set(project, newFiles); | ||
if (oldFiles && !arrayItemsEqual(oldFiles, newFiles)) { | ||
if (oldFiles && !twoSetsEqual(oldFiles, newFiles)) { | ||
for (const oldFile of oldFiles) { | ||
if (!newFiles.has(oldFile)) { | ||
utils_1.projects.get(project)?.files.delete(oldFile); | ||
} | ||
} | ||
project.refreshDiagnostics(); | ||
} | ||
} | ||
return externalFiles.get(project); | ||
return [...externalFiles.get(project)]; | ||
}, | ||
@@ -186,9 +212,8 @@ }; | ||
} | ||
function arrayItemsEqual(a, b) { | ||
if (a.length !== b.length) { | ||
function twoSetsEqual(a, b) { | ||
if (a.size !== b.size) { | ||
return false; | ||
} | ||
const set = new Set(a); | ||
for (const file of b) { | ||
if (!set.has(file)) { | ||
for (const file of a) { | ||
if (!b.has(file)) { | ||
return false; | ||
@@ -195,0 +220,0 @@ } |
@@ -113,5 +113,19 @@ "use strict"; | ||
client.on('end', () => { | ||
if (!dataChunks.length) { | ||
console.warn('[Vue Named Pipe Client] No response from server for request:', request.type); | ||
resolve(undefined); | ||
return; | ||
} | ||
const data = Buffer.concat(dataChunks); | ||
const text = data.toString(); | ||
resolve(JSON.parse(text)); | ||
let json = null; | ||
try { | ||
json = JSON.parse(text); | ||
} | ||
catch (e) { | ||
console.error('[Vue Named Pipe Client] Failed to parse response:', text); | ||
resolve(undefined); | ||
return; | ||
} | ||
resolve(json); | ||
}); | ||
@@ -118,0 +132,0 @@ client.write(JSON.stringify(request)); |
@@ -63,3 +63,2 @@ "use strict"; | ||
console.warn('[Vue Named Pipe Server] Unknown request type:', request.type); | ||
connection.write(JSON.stringify(null)); | ||
} | ||
@@ -66,0 +65,0 @@ connection.end(); |
{ | ||
"name": "@vue/typescript-plugin", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"license": "MIT", | ||
@@ -15,4 +15,4 @@ "files": [ | ||
"dependencies": { | ||
"@volar/typescript": "~2.1.0", | ||
"@vue/language-core": "2.0.4", | ||
"@volar/typescript": "~2.1.1", | ||
"@vue/language-core": "2.0.5", | ||
"@vue/shared": "^3.4.0" | ||
@@ -23,3 +23,3 @@ }, | ||
}, | ||
"gitHead": "241300968fd3084c7c09139d05691a51a7800fdc" | ||
"gitHead": "62b4fcb0d3f7153b5b2f5571af32f519117d8466" | ||
} |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
46852
21
963
0
34
+ Added@vue/language-core@2.0.5(transitive)
- Removed@vue/language-core@2.0.4(transitive)
Updated@volar/typescript@~2.1.1
Updated@vue/language-core@2.0.5