1717import { basename , dirname , extname , join , posix , sep } from 'node:path' ;
1818import { SfError } from '@salesforce/core/sfError' ;
1919import { ensureArray } from '@salesforce/kit' ;
20- import { ComponentLike , SourceComponent } from '../resolve' ;
20+ import { SourceComponentWithContent , SourceComponent } from '../resolve/sourceComponent' ;
21+ import { ComponentLike } from '../resolve' ;
2122import { registry } from '../registry/registry' ;
2223import {
2324 BooleanString ,
@@ -91,47 +92,45 @@ export const createResponses =
9192 return [ { ...base , state, ...parseDeployDiagnostic ( component , message ) } satisfies FileResponseFailure ] ;
9293 }
9394
94- if ( isWebAppBundle ( component ) ) {
95- const walkedPaths = component . walkContent ( ) ;
96- const bundleResponse : FileResponseSuccess = {
97- fullName : component . fullName ,
98- type : component . type . name ,
99- state,
100- filePath : component . content ,
101- } ;
102- const fileResponses : FileResponseSuccess [ ] = walkedPaths . map ( ( filePath ) => {
103- // Normalize paths to ensure relative() works correctly on Windows
104- const normalizedContent = component . content . split ( sep ) . join ( posix . sep ) ;
105- const normalizedFilePath = filePath . split ( sep ) . join ( posix . sep ) ;
106- const relPath = posix . relative ( normalizedContent , normalizedFilePath ) ;
107- return {
108- fullName : posix . join ( component . fullName , relPath ) ,
109- type : 'DigitalExperience' ,
110- state,
111- filePath,
112- } ;
113- } ) ;
114- return [ bundleResponse , ...fileResponses ] ;
115- }
116-
11795 return (
118- [
119- ...( shouldWalkContent ( component )
120- ? component . walkContent ( ) . map ( ( filePath ) : FileResponseSuccess => ( { ...base , state, filePath } ) )
121- : [ ] ) ,
122- ...( component . xml ? [ { ...base , state, filePath : component . xml } satisfies FileResponseSuccess ] : [ ] ) ,
123- ]
96+ isWebAppBundle ( component )
97+ ? [
98+ {
99+ ...base ,
100+ state,
101+ filePath : component . content ,
102+ } ,
103+ ...component . walkContent ( ) . map ( ( filePath ) => ( {
104+ fullName : getWebAppBundleContentFullName ( component ) ( filePath ) ,
105+ type : 'DigitalExperience' ,
106+ state,
107+ filePath,
108+ } ) ) ,
109+ ]
110+ : [
111+ ...( shouldWalkContent ( component )
112+ ? component . walkContent ( ) . map ( ( filePath ) : FileResponseSuccess => ( { ...base , state, filePath } ) )
113+ : [ ] ) ,
114+ ...( component . xml ? [ { ...base , state, filePath : component . xml } ] : [ ] ) ,
115+ ]
116+ ) . map ( ( response ) => ( {
117+ ...response ,
118+ filePath :
124119 // deployResults will produce filePaths relative to cwd, which might not be set in all environments
125120 // if our CS had a projectDir set, we'll make the results relative to that path
126- . map ( ( response ) => ( {
127- ...response ,
128- filePath :
129- projectPath && process . cwd ( ) === projectPath
130- ? response . filePath
131- : join ( projectPath ?? '' , response . filePath ) ,
132- } ) )
133- ) ;
121+ projectPath && process . cwd ( ) === projectPath ? response . filePath : join ( projectPath ?? '' , response . filePath ) ,
122+ } ) ) satisfies FileResponseSuccess [ ] ;
134123 } ) ;
124+
125+ const getWebAppBundleContentFullName =
126+ ( component : SourceComponentWithContent ) =>
127+ ( filePath : string ) : string => {
128+ // Normalize paths to ensure relative() works correctly on Windows
129+ const normalizedContent = component . content . split ( sep ) . join ( posix . sep ) ;
130+ const normalizedFilePath = filePath . split ( sep ) . join ( posix . sep ) ;
131+ return posix . relative ( normalizedContent , normalizedFilePath ) ;
132+ } ;
133+
135134/**
136135 * Groups messages from the deploy result by component fullName and type
137136 */
@@ -152,8 +151,6 @@ export const getDeployMessages = (result: MetadataApiDeployStatus): Map<string,
152151 if ( ! messageMap . has ( key ) ) {
153152 messageMap . set ( key , [ ] ) ;
154153 }
155- messageMap . get ( key ) ?. push ( sanitized ) ;
156- failedComponentKeys . add ( key ) ;
157154 }
158155
159156 for ( const success of successMessages ) {
0 commit comments