@@ -39,7 +39,7 @@ export async function transformMain(
3939 options : ResolvedOptions ,
4040 pluginContext : Context ,
4141 ssr : boolean ,
42- asCustomElement : boolean ,
42+ customElement : boolean ,
4343) {
4444 const { devServer, isProduction, devToolsEnabled } = options
4545
@@ -80,6 +80,7 @@ export async function transformMain(
8080 options ,
8181 pluginContext ,
8282 ssr ,
83+ customElement ,
8384 )
8485
8586 // template
@@ -94,6 +95,7 @@ export async function transformMain(
9495 options ,
9596 pluginContext ,
9697 ssr ,
98+ customElement ,
9799 ) )
98100 }
99101
@@ -114,7 +116,7 @@ export async function transformMain(
114116 const stylesCode = await genStyleCode (
115117 descriptor ,
116118 pluginContext ,
117- asCustomElement ,
119+ customElement ,
118120 attachedProps ,
119121 )
120122
@@ -279,6 +281,7 @@ async function genTemplateCode(
279281 options : ResolvedOptions ,
280282 pluginContext : Context ,
281283 ssr : boolean ,
284+ customElement : boolean ,
282285) {
283286 const template = descriptor . template !
284287 const hasScoped = descriptor . styles . some ( ( style ) => style . scoped )
@@ -293,6 +296,7 @@ async function genTemplateCode(
293296 options ,
294297 pluginContext ,
295298 ssr ,
299+ customElement ,
296300 )
297301 } else {
298302 if ( template . src ) {
@@ -326,6 +330,7 @@ async function genScriptCode(
326330 options : ResolvedOptions ,
327331 pluginContext : Context ,
328332 ssr : boolean ,
333+ customElement : boolean ,
329334) : Promise < {
330335 code : string
331336 map : RawSourceMap | undefined
@@ -338,6 +343,7 @@ async function genScriptCode(
338343 descriptor ,
339344 options ,
340345 ssr ,
346+ customElement ,
341347 )
342348 if ( script ) {
343349 // If the script is js/ts and has no external src, it can be directly placed
@@ -385,7 +391,7 @@ async function genScriptCode(
385391async function genStyleCode (
386392 descriptor : SFCDescriptor ,
387393 pluginContext : Context ,
388- asCustomElement : boolean ,
394+ customElement : boolean ,
389395 attachedProps : [ string , string ] [ ] ,
390396) {
391397 let stylesCode = ``
@@ -410,12 +416,12 @@ async function genStyleCode(
410416 ? `&src=${ descriptor . id } `
411417 : '&src=true'
412418 : ''
413- const directQuery = asCustomElement ? `&inline` : ``
419+ const directQuery = customElement ? `&inline` : ``
414420 const scopedQuery = style . scoped ? `&scoped=${ descriptor . id } ` : ``
415421 const query = `?vue&type=style&index=${ i } ${ srcQuery } ${ directQuery } ${ scopedQuery } `
416422 const styleRequest = src + query + attrsQuery
417423 if ( style . module ) {
418- if ( asCustomElement ) {
424+ if ( customElement ) {
419425 throw new Error (
420426 `<style module> is not supported in custom elements mode.` ,
421427 )
@@ -427,7 +433,7 @@ async function genStyleCode(
427433 )
428434 stylesCode += importCode
429435 Object . assign ( ( cssModulesMap ||= { } ) , nameMap )
430- } else if ( asCustomElement ) {
436+ } else if ( customElement ) {
431437 stylesCode += `\nimport _style_${ i } from ${ JSON . stringify (
432438 styleRequest ,
433439 ) } `
@@ -436,7 +442,7 @@ async function genStyleCode(
436442 }
437443 // TODO SSR critical CSS collection
438444 }
439- if ( asCustomElement ) {
445+ if ( customElement ) {
440446 attachedProps . push ( [
441447 `styles` ,
442448 `[${ descriptor . styles . map ( ( _ , i ) => `_style_${ i } ` ) . join ( ',' ) } ]` ,
0 commit comments