@volar/vue-code-gen
Advanced tools
Comparing version 0.34.4 to 0.34.5
@@ -204,6 +204,3 @@ "use strict"; | ||
codeGen.addText(`props: (`); | ||
if (scriptSetupRanges.propsRuntimeArg) { | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.propsRuntimeArg.start, scriptSetupRanges.propsRuntimeArg.end); | ||
} | ||
else if (scriptSetupRanges.propsTypeArg) { | ||
if (scriptSetupRanges.propsTypeArg) { | ||
usedTypes.DefinePropsToOptions = true; | ||
@@ -223,10 +220,8 @@ codeGen.addText(`{} as `); | ||
} | ||
else if (scriptSetupRanges.propsRuntimeArg) { | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.propsRuntimeArg.start, scriptSetupRanges.propsRuntimeArg.end); | ||
} | ||
codeGen.addText(`),\n`); | ||
} | ||
if (scriptSetupRanges.emitsRuntimeArg) { | ||
codeGen.addText(`emits: (`); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.emitsRuntimeArg.start, scriptSetupRanges.emitsRuntimeArg.end); | ||
codeGen.addText(`),\n`); | ||
} | ||
else if (scriptSetupRanges.emitsTypeArg) { | ||
if (scriptSetupRanges.emitsTypeArg) { | ||
usedTypes.ConstructorOverloads = true; | ||
@@ -237,2 +232,7 @@ codeGen.addText(`emits: ({} as __VLS_UnionToIntersection<__VLS_ConstructorOverloads<`); | ||
} | ||
else if (scriptSetupRanges.emitsRuntimeArg) { | ||
codeGen.addText(`emits: (`); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.emitsRuntimeArg.start, scriptSetupRanges.emitsRuntimeArg.end); | ||
codeGen.addText(`),\n`); | ||
} | ||
const bindingsArr = []; | ||
@@ -262,3 +262,8 @@ if (scriptSetupRanges) { | ||
codeGen.addText(`};\n`); | ||
if (scriptSetupRanges.exposeRuntimeArg) { | ||
if (scriptSetupRanges.exposeTypeArg) { | ||
codeGen.addText(`return { } as `); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.exposeTypeArg.start, scriptSetupRanges.exposeTypeArg.end); | ||
codeGen.addText(`;\n`); | ||
} | ||
else if (scriptSetupRanges.exposeRuntimeArg) { | ||
codeGen.addText(`return `); | ||
@@ -339,3 +344,3 @@ addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.exposeRuntimeArg.start, scriptSetupRanges.exposeRuntimeArg.end); | ||
} | ||
if (scriptSetupRanges?.propsTypeArg && scriptSetup) { | ||
else if (scriptSetupRanges?.propsTypeArg && scriptSetup) { | ||
codeGen.addText(`props: ({} as `); | ||
@@ -364,3 +369,3 @@ codeGen.addCode(scriptSetup.content.substring(scriptSetupRanges.propsTypeArg.start, scriptSetupRanges.propsTypeArg.end), scriptSetupRanges.propsTypeArg, SourceMaps.Mode.Offset, { | ||
} | ||
if (scriptSetupRanges?.emitsTypeArg && scriptSetup) { | ||
else if (scriptSetupRanges?.emitsTypeArg && scriptSetup) { | ||
codeGen.addText(`emits: ({} as `); | ||
@@ -367,0 +372,0 @@ codeGen.addCode(scriptSetup.content.substring(scriptSetupRanges.emitsTypeArg.start, scriptSetupRanges.emitsTypeArg.end), scriptSetupRanges.emitsTypeArg, SourceMaps.Mode.Offset, { |
@@ -17,2 +17,3 @@ import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
exposeRuntimeArg: TextRange | undefined; | ||
exposeTypeArg: TextRange | undefined; | ||
}; | ||
@@ -19,0 +20,0 @@ export declare function parseBindingRanges(ts: typeof import('typescript/lib/tsserverlibrary'), sourceFile: ts.SourceFile, isType: boolean): TextRange[]; |
@@ -14,2 +14,3 @@ "use strict"; | ||
let exposeRuntimeArg; | ||
let exposeTypeArg; | ||
let emitsTypeNums = -1; | ||
@@ -44,2 +45,3 @@ const bindings = parseBindingRanges(ts, ast, false); | ||
exposeRuntimeArg, | ||
exposeTypeArg, | ||
}; | ||
@@ -66,3 +68,3 @@ function _getStartEnd(node) { | ||
} | ||
else if (node.typeArguments?.length) { | ||
if (node.typeArguments?.length) { | ||
const typeArg = node.typeArguments[0]; | ||
@@ -78,2 +80,5 @@ if (callText === 'defineProps') { | ||
} | ||
else if (callText === 'defineExpose') { | ||
exposeTypeArg = _getStartEnd(typeArg); | ||
} | ||
} | ||
@@ -80,0 +85,0 @@ } |
{ | ||
"name": "@volar/vue-code-gen", | ||
"version": "0.34.4", | ||
"version": "0.34.5", | ||
"main": "out/index.js", | ||
@@ -19,4 +19,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/code-gen": "0.34.4", | ||
"@volar/source-map": "0.34.4", | ||
"@volar/code-gen": "0.34.5", | ||
"@volar/source-map": "0.34.5", | ||
"@vue/compiler-core": "^3.2.31", | ||
@@ -26,3 +26,3 @@ "@vue/compiler-dom": "^3.2.31", | ||
}, | ||
"gitHead": "ba5106415fb5106b2cd9108186e8278517b592d6" | ||
"gitHead": "84a104b9744fb08960ff3bd8bf86a01436be2960" | ||
} |
Sorry, the diff of this file is too big to display
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
142592
3250
+ Added@volar/code-gen@0.34.5(transitive)
+ Added@volar/source-map@0.34.5(transitive)
- Removed@volar/code-gen@0.34.4(transitive)
- Removed@volar/source-map@0.34.4(transitive)
Updated@volar/code-gen@0.34.5
Updated@volar/source-map@0.34.5