@volar/vue-typescript
Advanced tools
Comparing version 0.33.7 to 0.33.9
@@ -8,3 +8,3 @@ "use strict"; | ||
return { | ||
result: template, | ||
html: template, | ||
mapping: (htmlStart, htmlEnd) => ({ start: htmlStart, end: htmlEnd }), | ||
@@ -11,0 +11,0 @@ }; |
@@ -11,3 +11,3 @@ "use strict"; | ||
return { | ||
result: pugDoc.htmlCode, | ||
html: pugDoc.htmlCode, | ||
mapping: (htmlStart, htmlEnd) => { | ||
@@ -14,0 +14,0 @@ const pugRange = pugDoc.sourceMap.getSourceRange(htmlStart, htmlEnd, data => !data?.isEmptyTagCompletion)?.[0]; |
@@ -7,3 +7,3 @@ import type { TextRange } from '@volar/vue-code-gen'; | ||
compileTemplate?(tmplate: string, lang: string): { | ||
result: string; | ||
html: string; | ||
mapping(htmlStart: number, htmlEnd: number): { | ||
@@ -51,3 +51,3 @@ start: number; | ||
}; | ||
maped: { | ||
mapped: { | ||
vueFile: import("./vueFile").VueFile; | ||
@@ -63,3 +63,3 @@ embedded: import("./vueFile").Embedded; | ||
}; | ||
maped?: undefined; | ||
mapped?: undefined; | ||
data?: undefined; | ||
@@ -66,0 +66,0 @@ }, void, unknown>; |
@@ -120,4 +120,3 @@ "use strict"; | ||
const fileVersions = new WeakMap(); | ||
const tsHost = { | ||
...options.vueLsHost, | ||
const _tsHost = { | ||
fileExists: options.vueLsHost.fileExists | ||
@@ -179,3 +178,3 @@ ? fileName => { | ||
if (lsType === 'template') { | ||
tsHost.getCompilationSettings = () => ({ | ||
_tsHost.getCompilationSettings = () => ({ | ||
...options.vueLsHost.getCompilationSettings(), | ||
@@ -185,7 +184,12 @@ jsx: ts.JsxEmit.Preserve, | ||
} | ||
const tsHost = new Proxy(_tsHost, { | ||
get: (target, property) => { | ||
return target[property] || options.vueLsHost[property]; | ||
}, | ||
}); | ||
return tsHost; | ||
function getScriptFileNames() { | ||
const tsFileNames = getLocalTypesFiles(lsType); | ||
for (const maped of vueFiles.getEmbeddeds(lsType)) { | ||
tsFileNames.push(maped.embedded.file.fileName); // virtual .ts | ||
for (const mapped of vueFiles.getEmbeddeds(lsType)) { | ||
tsFileNames.push(mapped.embedded.file.fileName); // virtual .ts | ||
} | ||
@@ -207,14 +211,14 @@ for (const fileName of options.vueLsHost.getScriptFileNames()) { | ||
} | ||
let maped = vueFiles.fromEmbeddedFileName(lsType, fileName); | ||
if (maped) { | ||
if (fileVersions.has(maped.embedded.file)) { | ||
return fileVersions.get(maped.embedded.file); | ||
let mapped = vueFiles.fromEmbeddedFileName(lsType, fileName); | ||
if (mapped) { | ||
if (fileVersions.has(mapped.embedded.file)) { | ||
return fileVersions.get(mapped.embedded.file); | ||
} | ||
else { | ||
let version = ts.sys.createHash?.(maped.embedded.file.content) ?? maped.embedded.file.content; | ||
let version = ts.sys.createHash?.(mapped.embedded.file.content) ?? mapped.embedded.file.content; | ||
if (options.isVueTsc) { | ||
// fix https://github.com/johnsoncodehk/volar/issues/1082 | ||
version = maped.vueFile.getVersion() + ':' + version; | ||
version = mapped.vueFile.getVersion() + ':' + version; | ||
} | ||
fileVersions.set(maped.embedded.file, version); | ||
fileVersions.set(mapped.embedded.file, version); | ||
return version; | ||
@@ -235,5 +239,5 @@ } | ||
} | ||
const maped = vueFiles.fromEmbeddedFileName(lsType, fileName); | ||
if (maped) { | ||
const text = maped.embedded.file.content; | ||
const mapped = vueFiles.fromEmbeddedFileName(lsType, fileName); | ||
if (mapped) { | ||
const text = mapped.embedded.file.content; | ||
const snapshot = ts.ScriptSnapshot.fromString(text); | ||
@@ -240,0 +244,0 @@ scriptSnapshots.set(fileName.toLowerCase(), [version, snapshot]); |
@@ -75,3 +75,3 @@ "use strict"; | ||
if (templateCodeGens.value) { | ||
(0, code_gen_1.margeCodeGen)(codeGen, templateCodeGens.value.codeGen); | ||
(0, code_gen_1.mergeCodeGen)(codeGen, templateCodeGens.value.codeGen); | ||
} | ||
@@ -236,5 +236,5 @@ codeGen.addText(`export default __VLS_slots;\n`); | ||
continue; | ||
for (const maped of mappings) { | ||
const tsRange = maped.tsRange; | ||
for (const cssRange of maped.cssRanges) { | ||
for (const mapped of mappings) { | ||
const tsRange = mapped.tsRange; | ||
for (const cssRange of mapped.cssRanges) { | ||
const vueRange = cssSourceMap.getSourceRange(cssRange.start, cssRange.end)?.[0]; | ||
@@ -249,8 +249,8 @@ if (!vueRange) | ||
rename: true, | ||
referencesCodeLens: maped.mode === SourceMaps.Mode.Totally, // has 2 modes | ||
referencesCodeLens: mapped.mode === SourceMaps.Mode.Totally, // has 2 modes | ||
}, | ||
normalizeNewName: maped.patchRename ? beforeCssRename : undefined, | ||
applyNewName: maped.patchRename ? doCssRename : undefined, | ||
normalizeNewName: mapped.patchRename ? beforeCssRename : undefined, | ||
applyNewName: mapped.patchRename ? doCssRename : undefined, | ||
}, | ||
mode: maped.mode, | ||
mode: mapped.mode, | ||
sourceRange: vueRange, | ||
@@ -369,4 +369,4 @@ mappedRange: tsRange, | ||
const sourceMap = new sourceMaps_1.Teleport(); | ||
for (const maped of data.value.ctxMappings) { | ||
sourceMap.mappings.push(maped); | ||
for (const mapped of data.value.ctxMappings) { | ||
sourceMap.mappings.push(mapped); | ||
} | ||
@@ -373,0 +373,0 @@ teleport.value = sourceMap; |
@@ -60,3 +60,3 @@ "use strict"; | ||
lang: sfc.template.lang ?? 'html', | ||
htmlText: compiledHtml.result, | ||
htmlText: compiledHtml.html, | ||
htmlToTemplate: compiledHtml.mapping, | ||
@@ -63,0 +63,0 @@ }; |
@@ -31,3 +31,3 @@ import type { EmbeddedFileMappingData } from '@volar/vue-code-gen'; | ||
}; | ||
maped: { | ||
mapped: { | ||
vueFile: VueFile; | ||
@@ -43,3 +43,3 @@ embedded: Embedded; | ||
}; | ||
maped?: undefined; | ||
mapped?: undefined; | ||
data?: undefined; | ||
@@ -46,0 +46,0 @@ }, void, unknown>; |
@@ -76,11 +76,11 @@ "use strict"; | ||
end = start; | ||
const maped = sourceMapsByFileNameAndLsType.value[lsType].get(fileName.toLowerCase()); | ||
if (maped) { | ||
if (sourceMapFilter && !sourceMapFilter(maped.embedded.sourceMap)) | ||
const mapped = sourceMapsByFileNameAndLsType.value[lsType].get(fileName.toLowerCase()); | ||
if (mapped) { | ||
if (sourceMapFilter && !sourceMapFilter(mapped.embedded.sourceMap)) | ||
return; | ||
for (const vueRange of maped.embedded.sourceMap.getSourceRanges(start, end, filter)) { | ||
for (const vueRange of mapped.embedded.sourceMap.getSourceRanges(start, end, filter)) { | ||
yield { | ||
fileName: maped.vueFile.fileName, | ||
fileName: mapped.vueFile.fileName, | ||
range: vueRange[0], | ||
maped: maped, | ||
mapped: mapped, | ||
data: vueRange[1], | ||
@@ -87,0 +87,0 @@ }; |
{ | ||
"name": "@volar/vue-typescript", | ||
"version": "0.33.7", | ||
"version": "0.33.9", | ||
"main": "out/index.js", | ||
@@ -19,6 +19,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/code-gen": "0.33.7", | ||
"@volar/pug-language-service": "0.33.7", | ||
"@volar/source-map": "0.33.7", | ||
"@volar/vue-code-gen": "0.33.7", | ||
"@volar/code-gen": "0.33.9", | ||
"@volar/pug-language-service": "0.33.9", | ||
"@volar/source-map": "0.33.9", | ||
"@volar/vue-code-gen": "0.33.9", | ||
"@vue/compiler-sfc": "^3.2.27", | ||
@@ -30,3 +30,3 @@ "@vue/reactivity": "^3.2.27" | ||
}, | ||
"gitHead": "1b89d4dc2fb0fa5b7c17aa9dbff4b0fc62a108f4" | ||
"gitHead": "9031e662fe238df7ec385ddde6a91e1e363a4af4" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132315
2864
+ Added@volar/code-gen@0.33.9(transitive)
+ Added@volar/pug-language-service@0.33.9(transitive)
+ Added@volar/shared@0.33.9(transitive)
+ Added@volar/source-map@0.33.9(transitive)
+ Added@volar/transforms@0.33.9(transitive)
+ Added@volar/vue-code-gen@0.33.9(transitive)
- Removed@volar/code-gen@0.33.7(transitive)
- Removed@volar/pug-language-service@0.33.7(transitive)
- Removed@volar/shared@0.33.7(transitive)
- Removed@volar/source-map@0.33.7(transitive)
- Removed@volar/transforms@0.33.7(transitive)
- Removed@volar/vue-code-gen@0.33.7(transitive)
Updated@volar/code-gen@0.33.9
Updated@volar/source-map@0.33.9
Updated@volar/vue-code-gen@0.33.9