@volar/vue-typescript
Advanced tools
Comparing version 0.33.5 to 0.33.6
@@ -18,3 +18,3 @@ import type { TextRange } from '@volar/vue-code-gen'; | ||
vueCompilerOptions: VueCompilerOptions; | ||
getCssVBindRanges: (cssEmbeddeFile: EmbeddedFile) => TextRange[]; | ||
baseCssModuleType: string; | ||
getCssClasses: (cssEmbeddeFile: EmbeddedFile) => Record<string, TextRange[]>; | ||
@@ -21,0 +21,0 @@ vueLsHost: LanguageServiceHost; |
@@ -269,3 +269,3 @@ "use strict"; | ||
if (!sourceFile) { | ||
vueFiles.set(fileName, (0, vueFile_1.createVueFile)(fileName, scriptText, scriptVersion, plugins, options.vueCompilerOptions, options.typescript, options.getCssVBindRanges, options.getCssClasses)); | ||
vueFiles.set(fileName, (0, vueFile_1.createVueFile)(fileName, scriptText, scriptVersion, plugins, options.vueCompilerOptions, options.typescript, options.baseCssModuleType, options.getCssClasses)); | ||
vueScriptContentsUpdate = true; | ||
@@ -272,0 +272,0 @@ vueScriptsUpdated = true; |
@@ -16,3 +16,3 @@ import { CodeGen } from '@volar/code-gen'; | ||
} | undefined; | ||
} | undefined>, sfcTemplateCompileResult: Ref<ReturnType<(typeof import('@volar/vue-code-gen'))['compileSFCTemplate']> | undefined>, sfcStyles: ReturnType<(typeof import('./useSfcStyles'))['useSfcStyles']>['files'], scriptLang: Ref<string>, compilerOptions: VueCompilerOptions, getCssVBindRanges: (cssEmbeddeFile: EmbeddedFile) => TextRange[], getCssClasses: (cssEmbeddeFile: EmbeddedFile) => Record<string, TextRange[]>): { | ||
} | undefined>, sfcTemplateCompileResult: Ref<ReturnType<(typeof import('@volar/vue-code-gen'))['compileSFCTemplate']> | undefined>, sfcStyles: ReturnType<(typeof import('./useSfcStyles'))['useSfcStyles']>['files'], scriptLang: Ref<string>, compilerOptions: VueCompilerOptions, baseCssModuleType: string, getCssVBindRanges: (cssEmbeddeFile: EmbeddedFile) => TextRange[], getCssClasses: (cssEmbeddeFile: EmbeddedFile) => Record<string, TextRange[]>): { | ||
templateCodeGens: import("@vue/reactivity").ComputedRef<{ | ||
@@ -19,0 +19,0 @@ codeGen: CodeGen<EmbeddedFileMappingData>; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const path = require("path"); | ||
function useSfcTemplateScript(fileName, template, scriptSetup, scriptSetupRanges, styles, templateScriptData, styleFiles, styleEmbeddeds, templateData, sfcTemplateCompileResult, sfcStyles, scriptLang, compilerOptions, getCssVBindRanges, getCssClasses) { | ||
function useSfcTemplateScript(fileName, template, scriptSetup, scriptSetupRanges, styles, templateScriptData, styleFiles, styleEmbeddeds, templateData, sfcTemplateCompileResult, sfcStyles, scriptLang, compilerOptions, baseCssModuleType, getCssVBindRanges, getCssClasses) { | ||
const baseFileName = path.basename(fileName); | ||
@@ -60,3 +60,3 @@ const cssModuleClasses = (0, reactivity_1.computed)(() => styleFiles.value.reduce((obj, style) => { | ||
const moduleClasses = cssModuleClasses.value[moduleName]; | ||
codeGen.addText(`declare var ${moduleName}: Record<string, string> & {\n`); | ||
codeGen.addText(`declare var ${moduleName}: ${baseCssModuleType} & {\n`); | ||
cssModuleMappingsArr.push(writeCssClassProperties(moduleClasses, true, 'string', false)); | ||
@@ -63,0 +63,0 @@ codeGen.addText('};\n'); |
@@ -54,3 +54,3 @@ import { TextRange } from '@volar/vue-code-gen'; | ||
} | ||
export declare function createVueFile(fileName: string, _content: string, _version: string, plugins: VueLanguagePlugin[], compilerOptions: VueCompilerOptions, ts: typeof import('typescript/lib/tsserverlibrary'), getCssVBindRanges: (cssEmbeddeFile: EmbeddedFile) => TextRange[], getCssClasses: (cssEmbeddeFile: EmbeddedFile) => Record<string, TextRange[]>): { | ||
export declare function createVueFile(fileName: string, _content: string, _version: string, plugins: VueLanguagePlugin[], compilerOptions: VueCompilerOptions, ts: typeof import('typescript/lib/tsserverlibrary'), baseCssModuleType: string, getCssClasses: (cssEmbeddeFile: EmbeddedFile) => Record<string, TextRange[]>): { | ||
fileName: string; | ||
@@ -57,0 +57,0 @@ getContent: () => string; |
@@ -19,4 +19,5 @@ "use strict"; | ||
const untrack_1 = require("./utils/untrack"); | ||
const parseCssVars_1 = require("./utils/parseCssVars"); | ||
; | ||
function createVueFile(fileName, _content, _version, plugins, compilerOptions, ts, getCssVBindRanges, getCssClasses) { | ||
function createVueFile(fileName, _content, _version, plugins, compilerOptions, ts, baseCssModuleType, getCssClasses) { | ||
// refs | ||
@@ -46,2 +47,3 @@ const content = (0, reactivity_1.ref)(''); | ||
}); | ||
const cssVars = new WeakMap(); | ||
// computeds | ||
@@ -84,3 +86,3 @@ const parsedSfc = (0, reactivity_1.computed)(() => (0, compiler_sfc_1.parse)(content.value, { sourceMap: false, ignoreEmpty: false })); | ||
const sfcEntryForTemplateLs = (0, useSfcEntryForTemplateLs_1.useSfcEntryForTemplateLs)(fileName, (0, reactivity_1.computed)(() => sfc.script), (0, reactivity_1.computed)(() => sfc.scriptSetup), (0, reactivity_1.computed)(() => sfc.template), (0, reactivity_1.computed)(() => !!sfcScriptForTemplateLs.fileTs.value), compilerOptions.experimentalCompatMode === 2); | ||
const sfcTemplateScript = (0, useSfcTemplateScript_1.useSfcTemplateScript)(fileName, (0, reactivity_1.computed)(() => sfc.template), (0, reactivity_1.computed)(() => sfc.scriptSetup), (0, reactivity_1.computed)(() => scriptSetupRanges.value), (0, reactivity_1.computed)(() => sfc.styles), templateScriptData, sfcStyles.files, sfcStyles.embeddeds, sfcTemplateCompiled, sfcTemplateCompileResult, sfcStyles.files, sfcScriptForScriptLs.lang, compilerOptions, getCssVBindRanges, getCssClasses); | ||
const sfcTemplateScript = (0, useSfcTemplateScript_1.useSfcTemplateScript)(fileName, (0, reactivity_1.computed)(() => sfc.template), (0, reactivity_1.computed)(() => sfc.scriptSetup), (0, reactivity_1.computed)(() => scriptSetupRanges.value), (0, reactivity_1.computed)(() => sfc.styles), templateScriptData, sfcStyles.files, sfcStyles.embeddeds, sfcTemplateCompiled, sfcTemplateCompileResult, sfcStyles.files, sfcScriptForScriptLs.lang, compilerOptions, baseCssModuleType, getCssVBindRanges, getCssClasses); | ||
const sfcRefSugarRanges = (0, reactivity_1.computed)(() => (sfcScriptSetup.ast.value ? { | ||
@@ -109,16 +111,23 @@ refs: (0, refSugarRanges_1.parseRefSugarDeclarationRanges)(ts, sfcScriptSetup.ast.value, ['$ref', '$computed', '$shallowRef', '$fromRefs']), | ||
const embeddeds = []; | ||
// styles | ||
for (const style of sfcStyles.embeddeds.value) { | ||
embeddeds.push({ | ||
self: style, | ||
embeddeds: [], | ||
}); | ||
} | ||
// customBlocks | ||
for (const customBlock of sfcCustomBlocks.embeddeds.value) { | ||
embeddeds.push({ | ||
self: customBlock, | ||
embeddeds: [], | ||
}); | ||
} | ||
// template | ||
embeddeds.push({ | ||
self: sfcTemplate.embedded.value, | ||
embeddeds: [ | ||
{ | ||
self: sfcTemplateScript.embedded.value, | ||
inheritParentIndent: true, | ||
embeddeds: [], | ||
}, | ||
{ | ||
self: sfcTemplateScript.formatEmbedded.value, | ||
inheritParentIndent: true, | ||
embeddeds: [], | ||
}, | ||
{ | ||
self: sfcTemplateScript.inlineCssEmbedded.value, | ||
inheritParentIndent: true, | ||
embeddeds: [], | ||
}, | ||
], | ||
}); | ||
// scripts - format | ||
@@ -151,23 +160,16 @@ embeddeds.push({ | ||
}); | ||
// template | ||
embeddeds.push({ | ||
self: sfcTemplate.embedded.value, | ||
embeddeds: [ | ||
{ | ||
self: sfcTemplateScript.embedded.value, | ||
inheritParentIndent: true, | ||
embeddeds: [], | ||
}, | ||
{ | ||
self: sfcTemplateScript.formatEmbedded.value, | ||
inheritParentIndent: true, | ||
embeddeds: [], | ||
}, | ||
{ | ||
self: sfcTemplateScript.inlineCssEmbedded.value, | ||
inheritParentIndent: true, | ||
embeddeds: [], | ||
}, | ||
], | ||
}); | ||
// styles | ||
for (const style of sfcStyles.embeddeds.value) { | ||
embeddeds.push({ | ||
self: style, | ||
embeddeds: [], | ||
}); | ||
} | ||
// customBlocks | ||
for (const customBlock of sfcCustomBlocks.embeddeds.value) { | ||
embeddeds.push({ | ||
self: customBlock, | ||
embeddeds: [], | ||
}); | ||
} | ||
return embeddeds; | ||
@@ -395,2 +397,10 @@ }); | ||
} | ||
function getCssVBindRanges(embeddedFile) { | ||
let binds = cssVars.get(embeddedFile); | ||
if (!binds) { | ||
binds = [...(0, parseCssVars_1.parseCssVars)(embeddedFile.content)]; | ||
cssVars.set(embeddedFile, binds); | ||
} | ||
return binds; | ||
} | ||
} | ||
@@ -397,0 +407,0 @@ exports.createVueFile = createVueFile; |
{ | ||
"name": "@volar/vue-typescript", | ||
"version": "0.33.5", | ||
"version": "0.33.6", | ||
"main": "out/index.js", | ||
@@ -19,6 +19,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/code-gen": "0.33.5", | ||
"@volar/pug-language-service": "0.33.5", | ||
"@volar/source-map": "0.33.5", | ||
"@volar/vue-code-gen": "0.33.5", | ||
"@volar/code-gen": "0.33.6", | ||
"@volar/pug-language-service": "0.33.6", | ||
"@volar/source-map": "0.33.6", | ||
"@volar/vue-code-gen": "0.33.6", | ||
"@vue/compiler-sfc": "^3.2.27", | ||
@@ -30,3 +30,3 @@ "@vue/reactivity": "^3.2.27" | ||
}, | ||
"gitHead": "cd8eb5ebc6b2503fa0fa70fe78b6bdf82450a2e4" | ||
"gitHead": "833757bb59d53202e844243a5d1bdd2bf5856c75" | ||
} |
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
132138
48
2860
+ Added@volar/code-gen@0.33.6(transitive)
+ Added@volar/pug-language-service@0.33.6(transitive)
+ Added@volar/shared@0.33.6(transitive)
+ Added@volar/source-map@0.33.6(transitive)
+ Added@volar/transforms@0.33.6(transitive)
+ Added@volar/vue-code-gen@0.33.6(transitive)
- Removed@volar/code-gen@0.33.5(transitive)
- Removed@volar/pug-language-service@0.33.5(transitive)
- Removed@volar/shared@0.33.5(transitive)
- Removed@volar/source-map@0.33.5(transitive)
- Removed@volar/transforms@0.33.5(transitive)
- Removed@volar/vue-code-gen@0.33.5(transitive)
Updated@volar/code-gen@0.33.6
Updated@volar/source-map@0.33.6
Updated@volar/vue-code-gen@0.33.6