@@ -53,45 +53,53 @@ function assemble($loader, frags, name, uxType, lite) {
5353 }
5454
5555 // prettier-ignore
56- let content =
57- `${ importFrag } \n` +
58- `var $app_style$ = ${ processStyleFrag ( $loader , frags . style , uxType , lite ) } \n`
56+ let content = `${ importFrag } \n`
57+ if ( ! lite ) {
58+ // process script for JS card
59+ content += `var $app_script$ = ${ processScriptFrag ( $loader , frags . script , uxType ) } \n`
60+ }
61+ content +=
62+ `$app_define$('@app-component/${ name } ', [], function($app_require$, $app_exports$, $app_module$) {\n` +
63+ `${ moduleExports } \n` +
64+ ` $app_module$.exports.template = ${ processTemplateFrag (
65+ $loader ,
66+ frags . template ,
67+ uxType ,
68+ importNames ,
69+ lite
70+ ) } \n`
71+ // $app_define$ function content
72+ if ( frags . style . length > 0 ) {
73+ content += ` $app_module$.exports.style = ${ processStyleFrag (
74+ $loader ,
75+ frags . style ,
76+ uxType ,
77+ lite
78+ ) } \n`
79+ }
5980 if ( lite ) {
6081 // process <data> for lite card
61- content += `$app_module$.exports.uidata = ${ processDataFrag (
82+ content += ` $app_module$.exports.uidata = ${ processDataFrag (
6283 $loader ,
6384 frags . data ,
6485 uxType ,
6586 FRAG_TYPE . DATA
6687 ) } \n`
67- content += `$app_module$.exports.actions = ${ processActionFrag (
88+ content += ` $app_module$.exports.actions = ${ processActionFrag (
6889 $loader ,
6990 frags . data ,
7091 uxType ,
7192 FRAG_TYPE . ACTIONS
7293 ) } \n`
73- content += `$app_module$.exports.props = ${ processPropsFrag (
94+ content += ` $app_module$.exports.props = ${ processPropsFrag (
7495 $loader ,
7596 frags . data ,
7697 uxType ,
7798 FRAG_TYPE . PROPS
7899 ) } \n`
79- content += `$app_data$($app_module$, $app_require$)\n`
80- } else {
81- // process script for normal card
82- content += `var $app_script$ = ${ processScriptFrag ( $loader , frags . script , uxType ) } \n`
100+ content += ` $app_data$($app_module$, $app_require$)\n`
83101 }
84102 content +=
85- `$app_define$('@app-component/${ name } ', [], function($app_require$, $app_exports$, $app_module$) {\n` +
86- `${ moduleExports } \n` +
87- ` $app_module$.exports.template = ${ processTemplateFrag (
88- $loader ,
89- frags . template ,
90- uxType ,
91- importNames ,
92- lite
93- ) } \n` +
94- `${ frags . style . length > 0 ? ' $app_module$.exports.style = $app_style$;' : '' } \n` +
95103 `});\n` +
96104 `${
97105 isUXRender ( uxType )
0 commit comments