@@ -6,8 +6,8 @@ import type { Code, Sfc, VueCodeInformation, VueCompilerOptions } from '../../ty
6
6
import { endOfLine , generateSfcBlockSection , newLine } from '../common' ;
7
7
import { generateGlobalTypes } from '../globalTypes' ;
8
8
import type { TemplateCodegenContext } from '../template/context' ;
9
- import { createScriptCodegenContext , ScriptCodegenContext } from './context' ;
10
9
import { generateComponentSelf } from './componentSelf' ;
10
+ import { createScriptCodegenContext , ScriptCodegenContext } from './context' ;
11
11
import { generateScriptSetup , generateScriptSetupImports } from './scriptSetup' ;
12
12
import { generateSrc } from './src' ;
13
13
import { generateStyleModulesType } from './styleModulesType' ;
@@ -79,6 +79,7 @@ export function* generateScript(options: ScriptCodegenOptions): Generator<Code,
79
79
}
80
80
else {
81
81
yield generateSfcBlockSection ( options . sfc . script , 0 , options . sfc . script . content . length , codeFeatures . all ) ;
82
+ yield * generateScriptSectionPartiallyEnding ( options . sfc . script . name , options . sfc . script . content . length , '#3632/both.vue' ) ;
82
83
yield * generateScriptSetup ( options , ctx , options . sfc . scriptSetup , options . scriptSetupRanges ) ;
83
84
}
84
85
}
@@ -114,8 +115,8 @@ export function* generateScript(options: ScriptCodegenOptions): Generator<Code,
114
115
}
115
116
else {
116
117
yield generateSfcBlockSection ( options . sfc . script , 0 , classBlockEnd , codeFeatures . all ) ;
117
- yield `__VLS_template = () => {` ;
118
- const templateCodegenCtx = yield * generateTemplate ( options , ctx , true ) ;
118
+ yield `__VLS_template = () => {${ newLine } ` ;
119
+ const templateCodegenCtx = yield * generateTemplate ( options , ctx ) ;
119
120
yield * generateComponentSelf ( options , ctx , templateCodegenCtx ) ;
120
121
yield `},${ newLine } ` ;
121
122
yield generateSfcBlockSection ( options . sfc . script , classBlockEnd , options . sfc . script . content . length , codeFeatures . all ) ;
@@ -131,16 +132,16 @@ export function* generateScript(options: ScriptCodegenOptions): Generator<Code,
131
132
yield * generateScriptSetup ( options , ctx , options . sfc . scriptSetup , options . scriptSetupRanges ) ;
132
133
}
133
134
134
- yield `;` ;
135
+ if ( options . sfc . script ) {
136
+ yield * generateScriptSectionPartiallyEnding ( options . sfc . script . name , options . sfc . script . content . length , '#3632/script.vue' ) ;
137
+ }
135
138
if ( options . sfc . scriptSetup ) {
136
- // #4569
137
- yield [ '' , 'scriptSetup' , options . sfc . scriptSetup . content . length , codeFeatures . verification ] ;
139
+ yield * generateScriptSectionPartiallyEnding ( options . sfc . scriptSetup . name , options . sfc . scriptSetup . content . length , '#4569/main.vue' ) ;
138
140
}
139
- yield newLine ;
140
141
141
142
if ( ! ctx . generatedTemplate ) {
142
143
yield `function __VLS_template() {${ newLine } ` ;
143
- const templateCodegenCtx = yield * generateTemplate ( options , ctx , false ) ;
144
+ const templateCodegenCtx = yield * generateTemplate ( options , ctx ) ;
144
145
yield `}${ endOfLine } ` ;
145
146
yield * generateComponentSelf ( options , ctx , templateCodegenCtx ) ;
146
147
}
@@ -163,6 +164,12 @@ export function* generateScript(options: ScriptCodegenOptions): Generator<Code,
163
164
return ctx ;
164
165
}
165
166
167
+ export function * generateScriptSectionPartiallyEnding ( source : string , end : number , mark : string ) : Generator < Code > {
168
+ yield `;` ;
169
+ yield [ '' , source , end , codeFeatures . verification ] ;
170
+ yield `/* PartiallyEnd: ${ mark } */${ newLine } ` ;
171
+ }
172
+
166
173
function * generateDefineProp (
167
174
options : ScriptCodegenOptions ,
168
175
scriptSetup : NonNullable < Sfc [ 'scriptSetup' ] >
0 commit comments