@@ -2156,6 +2156,27 @@ impl StepTransform {
21562156 naming:: format_name ( prefix, & self . get_module_path ( ) , & fn_name)
21572157 }
21582158
2159+ fn record_object_property_step_metadata ( & mut self , parent_var_name : & str , prop_key : & str ) {
2160+ let step_id = self . create_object_property_id (
2161+ parent_var_name,
2162+ prop_key,
2163+ false ,
2164+ self . current_workflow_function_name . as_deref ( ) ,
2165+ ) ;
2166+ if self . object_property_workflow_conversions . iter ( ) . any (
2167+ |( parent, prop, existing_step_id) | {
2168+ parent == parent_var_name && prop == prop_key && existing_step_id == & step_id
2169+ } ,
2170+ ) {
2171+ return ;
2172+ }
2173+ self . object_property_workflow_conversions . push ( (
2174+ parent_var_name. to_string ( ) ,
2175+ prop_key. to_string ( ) ,
2176+ step_id,
2177+ ) ) ;
2178+ }
2179+
21592180 // Process object properties for step functions
21602181 fn process_object_properties_for_step_functions (
21612182 & mut self ,
@@ -2185,6 +2206,14 @@ impl StepTransform {
21852206 } ;
21862207
21872208 if should_transform {
2209+ if matches ! ( self . mode, TransformMode :: Detect ) {
2210+ self . record_object_property_step_metadata (
2211+ parent_var_name,
2212+ & prop_key,
2213+ ) ;
2214+ continue ;
2215+ }
2216+
21882217 // Process the transformation
21892218 match & mut * kv_prop. value {
21902219 Expr :: Arrow ( arrow_expr) => {
@@ -2316,6 +2345,14 @@ impl StepTransform {
23162345 } ;
23172346
23182347 if self . has_use_step_directive ( & method_prop. function . body ) {
2348+ if matches ! ( self . mode, TransformMode :: Detect ) {
2349+ self . record_object_property_step_metadata (
2350+ parent_var_name,
2351+ & prop_key,
2352+ ) ;
2353+ continue ;
2354+ }
2355+
23192356 // Remove the directive first
23202357 self . remove_use_step_directive ( & mut method_prop. function . body ) ;
23212358
@@ -2423,6 +2460,14 @@ impl StepTransform {
24232460 . emit ( )
24242461 } ) ;
24252462 } else if has_step {
2463+ if matches ! ( self . mode, TransformMode :: Detect ) {
2464+ self . record_object_property_step_metadata (
2465+ parent_var_name,
2466+ & prop_key,
2467+ ) ;
2468+ continue ;
2469+ }
2470+
24262471 // Getters don't need async validation (they can't be async syntactically)
24272472
24282473 // Remove the directive from the getter body
@@ -2551,13 +2596,6 @@ impl StepTransform {
25512596 prop_key : & str ,
25522597 _span : swc_core:: common:: Span ,
25532598 ) {
2554- let step_id = self . create_object_property_id (
2555- parent_var_name,
2556- prop_key,
2557- false ,
2558- self . current_workflow_function_name . as_deref ( ) ,
2559- ) ;
2560-
25612599 match self . mode {
25622600 TransformMode :: Step => {
25632601 // Replace with reference to hoisted variable so the stepId
@@ -2575,22 +2613,22 @@ impl StepTransform {
25752613 SyntaxContext :: empty ( ) ,
25762614 ) ) ;
25772615 // Track for metadata generation
2578- self . object_property_workflow_conversions . push ( (
2579- parent_var_name. to_string ( ) ,
2580- prop_key. to_string ( ) ,
2581- step_id,
2582- ) ) ;
2616+ self . record_object_property_step_metadata ( parent_var_name, prop_key) ;
25832617 }
25842618 TransformMode :: Workflow => {
2619+ let step_id = self . create_object_property_id (
2620+ parent_var_name,
2621+ prop_key,
2622+ false ,
2623+ self . current_workflow_function_name . as_deref ( ) ,
2624+ ) ;
25852625 // Replace with initializer call
25862626 * kv_prop. value = self . create_step_initializer ( & step_id) ;
2587- self . object_property_workflow_conversions . push ( (
2588- parent_var_name. to_string ( ) ,
2589- prop_key. to_string ( ) ,
2590- step_id,
2591- ) ) ;
2627+ self . record_object_property_step_metadata ( parent_var_name, prop_key) ;
2628+ }
2629+ TransformMode :: Detect => {
2630+ self . record_object_property_step_metadata ( parent_var_name, prop_key) ;
25922631 }
2593- TransformMode :: Detect => { }
25942632 }
25952633 }
25962634
0 commit comments