@volar/vue-typescript
Advanced tools
Comparing version 0.34.11 to 0.34.12
@@ -12,3 +12,3 @@ import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
experimentalCompatMode?: 2 | 3; | ||
experimentalShamefullySupportOptionsApi?: boolean; | ||
experimentalShamefullySupportOptionsApi?: boolean | 'warning'; | ||
experimentalTemplateCompilerOptions?: any; | ||
@@ -18,2 +18,3 @@ experimentalTemplateCompilerOptionsRequirePath?: string; | ||
experimentalResolveStyleCssClasses?: 'scoped' | 'always' | 'never'; | ||
experimentalAllowTypeNarrowingInInlineHandlers?: boolean; | ||
} |
import { Ref, ComputedRef } from '@vue/reactivity'; | ||
import { Teleport } from '../utils/sourceMaps'; | ||
import * as SourceMaps from '@volar/source-map'; | ||
import type * as templateGen from '@volar/vue-code-gen/out/generators/template'; | ||
import type { parseScriptRanges } from '@volar/vue-code-gen/out/parsers/scriptRanges'; | ||
import type { parseScriptSetupRanges } from '@volar/vue-code-gen/out/parsers/scriptSetupRanges'; | ||
import type { TextRange } from '@volar/vue-code-gen'; | ||
import type { EmbeddedFileMappingData, TextRange } from '@volar/vue-code-gen'; | ||
import { Embedded, EmbeddedFile, Sfc } from '../vueFile'; | ||
import { VueCompilerOptions } from '../types'; | ||
export declare function useSfcScriptGen<T extends 'template' | 'script'>(lsType: T, fileName: string, vueFileContent: Ref<string>, lang: Ref<string>, script: Ref<Sfc['script']>, scriptSetup: Ref<Sfc['scriptSetup']>, scriptRanges: Ref<ReturnType<typeof parseScriptRanges> | undefined>, scriptSetupRanges: Ref<ReturnType<typeof parseScriptSetupRanges> | undefined>, htmlGen: Ref<ReturnType<typeof templateGen.generate> | undefined>, sfcStyles: ReturnType<(typeof import('./useSfcStyles'))['useSfcStyles']>['files'], compilerOptions: VueCompilerOptions, getCssVBindRanges: (cssEmbeddeFile: EmbeddedFile) => TextRange[]): { | ||
codeGen: ComputedRef<{ | ||
codeGen: import("@volar/code-gen").CodeGen<EmbeddedFileMappingData>; | ||
teleports: SourceMaps.Mapping<import("@volar/vue-code-gen").TeleportMappingData>[]; | ||
shimedComponentOptions: boolean; | ||
}>; | ||
lang: Ref<string>; | ||
@@ -11,0 +17,0 @@ file: T extends "script" ? ComputedRef<EmbeddedFile<undefined>> : ComputedRef<EmbeddedFile<undefined> | undefined>; |
@@ -21,3 +21,3 @@ "use strict"; | ||
return bindTexts; | ||
}, (0, localTypes_1.getVueLibraryName)(compilerOptions.experimentalCompatMode === 2), !!compilerOptions.experimentalShamefullySupportOptionsApi); | ||
}, (0, localTypes_1.getVueLibraryName)(compilerOptions.experimentalCompatMode === 2), compilerOptions.experimentalShamefullySupportOptionsApi === undefined ? true : !!compilerOptions.experimentalShamefullySupportOptionsApi); | ||
}); | ||
@@ -79,2 +79,3 @@ const file = (0, reactivity_1.computed)(() => { | ||
return { | ||
codeGen, | ||
lang, | ||
@@ -81,0 +82,0 @@ file: file, |
@@ -40,3 +40,3 @@ "use strict"; | ||
return; | ||
return templateGen.generate(ts, templateData.value.lang, sfcTemplateCompileResult.value.ast, compilerOptions.experimentalCompatMode === 2, Object.values(cssScopedClasses.value).map(map => Object.keys(map)).flat(), templateData.value.htmlToTemplate, !!scriptSetup.value, { | ||
return templateGen.generate(ts, templateData.value.lang, sfcTemplateCompileResult.value.ast, compilerOptions.experimentalCompatMode === 2, !!compilerOptions.experimentalAllowTypeNarrowingInInlineHandlers, Object.values(cssScopedClasses.value).map(map => Object.keys(map)).flat(), templateData.value.htmlToTemplate, { | ||
getEmitCompletion: string_1.SearchTexts.EmitCompletion, | ||
@@ -158,3 +158,3 @@ getPropsCompletion: string_1.SearchTexts.PropsCompletion, | ||
const bindText = style.content.substring(cssBind.start, cssBind.end); | ||
(0, transform_1.walkInterpolationFragment)(ts, bindText, (frag, fragOffset, lastCtxAccess) => { | ||
(0, transform_1.walkInterpolationFragment)(ts, bindText, (frag, fragOffset, isJustForErrorMapping) => { | ||
if (fragOffset === undefined) { | ||
@@ -164,23 +164,2 @@ codeGen.addText(frag); | ||
else { | ||
// fix https://github.com/johnsoncodehk/volar/issues/1205 | ||
if (lastCtxAccess) { | ||
codeGen.addMapping2({ | ||
data: { | ||
vueTag: 'style', | ||
vueTagIndex: i, | ||
capabilities: { | ||
diagnostic: true, | ||
}, | ||
}, | ||
mode: SourceMaps.Mode.Totally, | ||
sourceRange: { | ||
start: cssBind.start + fragOffset, | ||
end: cssBind.start + fragOffset + lastCtxAccess.varLength, | ||
}, | ||
mappedRange: { | ||
start: codeGen.getText().length - lastCtxAccess.ctxText.length, | ||
end: codeGen.getText().length + lastCtxAccess.varLength, | ||
}, | ||
}); | ||
} | ||
codeGen.addCode(frag, { | ||
@@ -192,3 +171,5 @@ start: cssBind.start + fragOffset, | ||
vueTagIndex: i, | ||
capabilities: { | ||
capabilities: isJustForErrorMapping ? { | ||
diagnostic: true, | ||
} : { | ||
basic: true, | ||
@@ -195,0 +176,0 @@ references: true, |
@@ -108,2 +108,12 @@ import { TextRange } from '@volar/vue-code-gen'; | ||
}; | ||
getScriptRanges: () => { | ||
exportDefault: (TextRange & { | ||
expression: TextRange; | ||
args: TextRange; | ||
argsNode: _0.ObjectLiteralExpression | undefined; | ||
componentsOption: TextRange | undefined; | ||
componentsOptionNode: _0.ObjectLiteralExpression | undefined; | ||
}) | undefined; | ||
bindings: TextRange[]; | ||
} | undefined; | ||
getScriptSetupRanges: () => { | ||
@@ -155,2 +165,7 @@ importSectionEndOffset: number; | ||
sfcScriptForScriptLs: { | ||
codeGen: import("@vue/reactivity").ComputedRef<{ | ||
codeGen: import("@volar/code-gen").CodeGen<import("@volar/vue-code-gen").EmbeddedFileMappingData>; | ||
teleports: import("@volar/source-map").Mapping<import("@volar/vue-code-gen").TeleportMappingData>[]; | ||
shimedComponentOptions: boolean; | ||
}>; | ||
lang: import("@vue/reactivity").Ref<string>; | ||
@@ -157,0 +172,0 @@ file: import("@vue/reactivity").ComputedRef<EmbeddedFile<undefined>>; |
@@ -204,2 +204,3 @@ "use strict"; | ||
getLastUpdated: (0, untrack_1.untrack)(() => (0, reactivity_1.unref)(lastUpdated)), | ||
getScriptRanges: (0, untrack_1.untrack)(() => scriptRanges.value), | ||
getScriptSetupRanges: (0, untrack_1.untrack)(() => scriptSetupRanges.value), | ||
@@ -206,0 +207,0 @@ getSfcTemplateDocument: (0, untrack_1.untrack)(() => sfcTemplate.file.value), |
{ | ||
"name": "@volar/vue-typescript", | ||
"version": "0.34.11", | ||
"version": "0.34.12", | ||
"main": "out/index.js", | ||
@@ -16,9 +16,9 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@volar/pug-language-service": "0.34.11", | ||
"@volar/pug-language-service": "0.34.12", | ||
"typescript": "latest" | ||
}, | ||
"dependencies": { | ||
"@volar/code-gen": "0.34.11", | ||
"@volar/source-map": "0.34.11", | ||
"@volar/vue-code-gen": "0.34.11", | ||
"@volar/code-gen": "0.34.12", | ||
"@volar/source-map": "0.34.12", | ||
"@volar/vue-code-gen": "0.34.12", | ||
"@vue/compiler-sfc": "^3.2.31", | ||
@@ -30,3 +30,3 @@ "@vue/reactivity": "^3.2.31" | ||
}, | ||
"gitHead": "55bca2915d0d4a41ac893e015358cdb3424440d2" | ||
"gitHead": "0b41a6ac83f781d4413530b55610f8e2466b5e6c" | ||
} |
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
121068
2572
+ Added@volar/code-gen@0.34.12(transitive)
+ Added@volar/source-map@0.34.12(transitive)
+ Added@volar/vue-code-gen@0.34.12(transitive)
- Removed@volar/code-gen@0.34.11(transitive)
- Removed@volar/source-map@0.34.11(transitive)
- Removed@volar/vue-code-gen@0.34.11(transitive)
Updated@volar/code-gen@0.34.12
Updated@volar/source-map@0.34.12
Updated@volar/vue-code-gen@0.34.12