File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
packages/interactivity/src Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -113,9 +113,25 @@ export function toVdom( root ) {
113113 if ( directives . length ) {
114114 props . __directives = directives . reduce (
115115 ( obj , [ name , ns , value ] ) => {
116- const [ , prefix , suffix = 'default' ] =
117- directiveParser . exec ( name ) ;
118- if ( ! obj [ prefix ] ) obj [ prefix ] = [ ] ;
116+ let [ prefix , suffix ] = [ '' , 'default' ] ;
117+
118+ const directiveMatch = directiveParser . exec ( name ) ;
119+ if ( directiveMatch ) {
120+ const [ , _prefix , _suffix ] = directiveMatch ;
121+ prefix = _prefix ;
122+ suffix = _suffix ?? 'default' ;
123+ } else if (
124+ // @ts -expect-error
125+ typeof SCRIPT_DEBUG !== 'undefined' &&
126+ // @ts -expect-error
127+ SCRIPT_DEBUG === true
128+ ) {
129+ // eslint-disable-next-line no-console
130+ console . warn ( `Invalid directive: ${ name } .` ) ;
131+ }
132+ if ( ! obj [ prefix ] ) {
133+ obj [ prefix ] = [ ] ;
134+ }
119135 obj [ prefix ] . push ( {
120136 namespace : ns ?? currentNamespace ( ) ,
121137 value,
You can’t perform that action at this time.
0 commit comments