@@ -35,19 +35,30 @@ export const formatComponentRuntimeMeta = (
3535 if ( compilerMeta . encapsulation !== 'shadow' && compilerMeta . htmlTagNames . includes ( 'slot' ) ) {
3636 flags |= CMP_FLAGS . hasSlotRelocation ;
3737 }
38+ if ( compilerMeta . hasRenderFn ) {
39+ flags |= CMP_FLAGS . hasRenderFn ;
40+ }
3841 if ( compilerMeta . hasMode ) {
3942 flags |= CMP_FLAGS . hasMode ;
4043 }
44+ if ( compilerMeta . hasModernPropertyDecls ) {
45+ flags |= CMP_FLAGS . hasModernPropertyDecls ;
46+ }
4147
4248 const members = formatComponentRuntimeMembers ( compilerMeta , includeMethods ) ;
4349 const hostListeners = formatHostListeners ( compilerMeta ) ;
44- const watchers = formatComponentRuntimeWatchers ( compilerMeta ) ;
50+ const watchers = formatComponentRuntimeReactiveHandlers ( compilerMeta ) ;
51+ const serializers = formatComponentRuntimeReactiveHandlers ( compilerMeta , 'serializers' ) ;
52+ const deserializers = formatComponentRuntimeReactiveHandlers ( compilerMeta , 'deserializers' ) ;
53+
4554 return trimFalsy ( [
4655 flags ,
4756 compilerMeta . tagName ,
4857 Object . keys ( members ) . length > 0 ? members : undefined ,
4958 hostListeners . length > 0 ? hostListeners : undefined ,
5059 Object . keys ( watchers ) . length > 0 ? watchers : undefined ,
60+ Object . keys ( serializers ) . length > 0 ? serializers : undefined ,
61+ Object . keys ( deserializers ) . length > 0 ? deserializers : undefined ,
5162 ] ) ;
5263} ;
5364
@@ -63,21 +74,25 @@ export const stringifyRuntimeData = (data: any) => {
6374
6475/**
6576 * Transforms Stencil compiler metadata into a {@link d.ComponentCompilerMeta} object.
66- * This handles processing any compiler metadata transformed from components' uses of `@Watch()`.
67- * The map of watched attributes to their callback(s) will be immediately available
77+ * This handles processing any compiler metadata transformed from components' uses of `@Watch()`, `@PropSerialize()`, and `@AttrDeserialize()` .
78+ * The map of watched properties to their callback(s) will be immediately available
6879 * to the runtime at bootstrap.
6980 *
7081 * @param compilerMeta Component metadata gathered during compilation
71- * @returns An object mapping watched attributes to their respective callback(s)
82+ * @param decorator The decorator type to be processed: 'watchers', 'serializers', or 'deserializers'
83+ * @returns An object mapping watched properties to their respective callback(s)
7284 */
73- const formatComponentRuntimeWatchers = ( compilerMeta : d . ComponentCompilerMeta ) => {
74- const watchers : d . ComponentConstructorWatchers = { } ;
85+ const formatComponentRuntimeReactiveHandlers = (
86+ compilerMeta : d . ComponentCompilerMeta ,
87+ decorator : 'watchers' | 'serializers' | 'deserializers' ,
88+ ) => {
89+ const handlers : d . ComponentConstructorChangeHandlers = { } ;
7590
76- compilerMeta . watchers . forEach ( ( { propName, methodName } ) => {
77- watchers [ propName ] = [ ...( watchers [ propName ] ?? [ ] ) , methodName ] ;
91+ compilerMeta [ decorator ] ? .forEach ( ( { propName, methodName } ) => {
92+ handlers [ propName ] = [ ...( handlers [ propName ] ?? [ ] ) , methodName ] ;
7893 } ) ;
7994
80- return watchers ;
95+ return handlers ;
8196} ;
8297
8398const formatComponentRuntimeMembers = (
0 commit comments