@vue/language-core
Advanced tools
Comparing version 1.8.16 to 1.8.17
@@ -58,2 +58,3 @@ "use strict"; | ||
exposeRuntimeArg: undefined, | ||
exposeTypeArg: undefined, | ||
leadingCommentEndOffset: 0, | ||
@@ -360,3 +361,3 @@ importSectionEndOffset: 0, | ||
codes.push(`props: __VLS_Prettify<Omit<typeof __VLS_fnPropsDefineComponent & typeof __VLS_fnPropsTypeOnly, keyof typeof __VLS_defaultProps>> & typeof __VLS_fnPropsSlots & typeof __VLS_defaultProps,\n`); | ||
codes.push(`expose(exposed: import('${vueCompilerOptions.lib}').ShallowUnwrapRef<${scriptSetupRanges.exposeRuntimeArg ? 'typeof __VLS_exposed' : '{}'}>): void,\n`); | ||
codes.push(`expose(exposed: import('${vueCompilerOptions.lib}').ShallowUnwrapRef<${scriptSetupRanges.defineExpose ? 'typeof __VLS_exposed' : '{}'}>): void,\n`); | ||
codes.push('attrs: any,\n'); | ||
@@ -434,8 +435,7 @@ codes.push('slots: ReturnType<typeof __VLS_template>,\n'); | ||
if (scriptSetupRanges.defineProps && !scriptSetupRanges.propsAssignName) { | ||
if (scriptSetupRanges.withDefaults) { | ||
setupCodeModifies.push([() => codes.push(`const __VLS_props = `), scriptSetupRanges.withDefaults.start, scriptSetupRanges.withDefaults.start]); | ||
} | ||
else { | ||
setupCodeModifies.push([() => codes.push(`const __VLS_props = `), scriptSetupRanges.defineProps.start, scriptSetupRanges.defineProps.start]); | ||
} | ||
const ranges = scriptSetupRanges.withDefaults ?? scriptSetupRanges.defineProps; | ||
codes.push(`const __VLS_props = `); | ||
addVirtualCode('scriptSetup', ranges.start, ranges.end); | ||
codes.push(`;\n`); | ||
setupCodeModifies.push([() => codes.push(`__VLS_props`), ranges.start, ranges.end]); | ||
} | ||
@@ -448,11 +448,18 @@ if (scriptSetupRanges.defineSlots && !scriptSetupRanges.slotsAssignName) { | ||
} | ||
if (scriptSetupRanges.defineExpose && scriptSetupRanges.exposeRuntimeArg) { | ||
if (scriptSetupRanges.defineExpose) { | ||
setupCodeModifies.push([() => { | ||
codes.push(`const __VLS_exposed = `); | ||
addVirtualCode('scriptSetup', scriptSetupRanges.exposeRuntimeArg.start, scriptSetupRanges.exposeRuntimeArg.end); | ||
codes.push(`;`); | ||
addVirtualCode('scriptSetup', scriptSetupRanges.defineExpose.start, scriptSetupRanges.exposeRuntimeArg.start); | ||
codes.push(`__VLS_exposed`); | ||
addVirtualCode('scriptSetup', scriptSetupRanges.exposeRuntimeArg.end, scriptSetupRanges.defineExpose.end); | ||
}, scriptSetupRanges.defineExpose.start, scriptSetupRanges.defineExpose.end]); | ||
if (scriptSetupRanges?.exposeTypeArg) { | ||
codes.push(`let __VLS_exposed!: `); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.exposeTypeArg.start, scriptSetupRanges.exposeTypeArg.end); | ||
codes.push(`;\n`); | ||
} | ||
else if (scriptSetupRanges?.exposeRuntimeArg) { | ||
codes.push(`const __VLS_exposed = `); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.exposeRuntimeArg.start, scriptSetupRanges.exposeRuntimeArg.end); | ||
codes.push(`;\n`); | ||
} | ||
else { | ||
codes.push(`const __VLS_exposed = {};\n`); | ||
} | ||
}, scriptSetupRanges.defineExpose.start, scriptSetupRanges.defineExpose.start]); | ||
} | ||
@@ -553,3 +560,3 @@ setupCodeModifies = setupCodeModifies.sort((a, b) => a[1] - b[1]); | ||
generateSetupReturns(); | ||
if (scriptSetupRanges.exposeRuntimeArg) { | ||
if (scriptSetupRanges.defineExpose) { | ||
codes.push(`...__VLS_exposed,\n`); | ||
@@ -556,0 +563,0 @@ } |
@@ -8,3 +8,3 @@ import { FileRangeCapabilities } from '@volar/language-core'; | ||
type Code = Segment<FileRangeCapabilities>; | ||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, sourceTemplate: string, sourceLang: string, sfc: Sfc, hasScriptSetupSlots: boolean, slotsAssignName: string | undefined, codegenStack: boolean): { | ||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, sourceTemplate: string, sourceLang: string, sfc: Sfc, hasScriptSetupSlots: boolean, slotsAssignName: string | undefined, propsAssignName: string | undefined, codegenStack: boolean): { | ||
codes: Code[]; | ||
@@ -11,0 +11,0 @@ codeStacks: muggle.StackNode[]; |
@@ -21,2 +21,3 @@ import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
exposeRuntimeArg: TextRange | undefined; | ||
exposeTypeArg: TextRange | undefined; | ||
defineProp: { | ||
@@ -23,0 +24,0 @@ name: TextRange | undefined; |
@@ -19,2 +19,3 @@ "use strict"; | ||
let exposeRuntimeArg; | ||
let exposeTypeArg; | ||
const definePropProposalA = vueCompilerOptions.experimentalDefinePropProposal === 'kevinEdition' || ast.getFullText().trimStart().startsWith('// @experimentalDefinePropProposal=kevinEdition'); | ||
@@ -62,2 +63,3 @@ const definePropProposalB = vueCompilerOptions.experimentalDefinePropProposal === 'johnsonEdition' || ast.getFullText().trimStart().startsWith('// @experimentalDefinePropProposal=johnsonEdition'); | ||
exposeRuntimeArg, | ||
exposeTypeArg, | ||
defineProp, | ||
@@ -164,2 +166,5 @@ }; | ||
} | ||
if (node.typeArguments?.length) { | ||
exposeTypeArg = _getStartEnd(node.typeArguments[0]); | ||
} | ||
} | ||
@@ -166,0 +171,0 @@ else if (vueCompilerOptions.macros.defineProps.includes(callText)) { |
@@ -31,2 +31,3 @@ import { Sfc, VueLanguagePlugin } from '../types'; | ||
exposeRuntimeArg: import("../types").TextRange | undefined; | ||
exposeTypeArg: import("../types").TextRange | undefined; | ||
defineProp: { | ||
@@ -33,0 +34,0 @@ name: import("../types").TextRange | undefined; |
@@ -141,3 +141,3 @@ "use strict"; | ||
return; | ||
return templateGen.generate(ts, compilerOptions, vueCompilerOptions, _sfc.template?.content ?? '', _sfc.template?.lang ?? 'html', _sfc, hasScriptSetupSlots.value, slotsAssignName.value, codegenStack); | ||
return templateGen.generate(ts, compilerOptions, vueCompilerOptions, _sfc.template?.content ?? '', _sfc.template?.lang ?? 'html', _sfc, hasScriptSetupSlots.value, slotsAssignName.value, propsAssignName.value, codegenStack); | ||
}); | ||
@@ -147,2 +147,3 @@ //#region remove when https://github.com/vuejs/core/pull/5912 merged | ||
const slotsAssignName = (0, reactivity_1.shallowRef)(); | ||
const propsAssignName = (0, reactivity_1.shallowRef)(); | ||
//#endregion | ||
@@ -152,2 +153,3 @@ const tsxGen = (0, reactivity_1.computed)(() => { | ||
slotsAssignName.value = scriptSetupRanges.value?.slotsAssignName; | ||
propsAssignName.value = scriptSetupRanges.value?.propsAssignName; | ||
return (0, script_1.generate)(ts, fileName, _sfc, lang.value, scriptRanges.value, scriptSetupRanges.value, htmlGen.value, compilerOptions, vueCompilerOptions, codegenStack); | ||
@@ -154,0 +156,0 @@ }); |
{ | ||
"name": "@vue/language-core", | ||
"version": "1.8.16", | ||
"version": "1.8.17", | ||
"main": "out/index.js", | ||
@@ -16,4 +16,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "~1.10.3", | ||
"@volar/source-map": "~1.10.3", | ||
"@volar/language-core": "1.10.2", | ||
"@volar/source-map": "1.10.2", | ||
"@vue/compiler-dom": "^3.3.0", | ||
@@ -38,3 +38,3 @@ "@vue/reactivity": "^3.3.0", | ||
}, | ||
"gitHead": "f9e281db3f47f9a3f94c79dbbf81102cba01eb5d" | ||
"gitHead": "81b41fe5daa15b01183459d036710ccc2491782e" | ||
} |
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
256692
5545
+ Added@volar/language-core@1.10.2(transitive)
+ Added@volar/source-map@1.10.2(transitive)
- Removed@volar/language-core@1.10.10(transitive)
- Removed@volar/source-map@1.10.10(transitive)
Updated@volar/language-core@1.10.2
Updated@volar/source-map@1.10.2