@@ -91,39 +91,7 @@ class ComponentProject extends Project {
9191
9292 /* === Resource Access === */
9393
94- /**
95- * Get a [ReaderCollection]{@link @ui5/fs/ReaderCollection } for accessing all resources of the
96- * project in the specified "style":
97- *
98- * <ul>
99- * <li><b>buildtime:</b> Resource paths are always prefixed with <code>/resources/</code>
100- * or <code>/test-resources/</code> followed by the project's namespace.
101- * Any configured build-excludes are applied</li>
102- * <li><b>dist:</b> Resource paths always match with what the UI5 runtime expects.
103- * This means that paths generally depend on the project type. Applications for example use a "flat"-like
104- * structure, while libraries use a "buildtime"-like structure.
105- * Any configured build-excludes are applied</li>
106- * <li><b>runtime:</b> Resource paths always match with what the UI5 runtime expects.
107- * This means that paths generally depend on the project type. Applications for example use a "flat"-like
108- * structure, while libraries use a "buildtime"-like structure.
109- * This style is typically used for serving resources directly. Therefore, build-excludes are not applied
110- * <li><b>flat:</b> Resource paths are never prefixed and namespaces are omitted if possible. Note that
111- * project types like "theme-library", which can have multiple namespaces, can't omit them.
112- * Any configured build-excludes are applied</li>
113- * </ul>
114- *
115- * If project resources have been changed through the means of a workspace, those changes
116- * are reflected in the provided reader too.
117- *
118- * Resource readers always use POSIX-style paths.
119- *
120- * @public
121- * @param {object } [options]
122- * @param {string } [options.style=buildtime] Path style to access resources.
123- * Can be "buildtime", "dist", "runtime" or "flat"
124- * @returns {@ui5/fs/ReaderCollection } A reader collection instance
125- */
126- getReader ( { style = "buildtime" } = { } ) {
94+ _getStyledReader ( style ) {
12795 // TODO: Additional style 'ABAP' using "sap.platform.abap".uri from manifest.json?
12896
12997 // Apply builder excludes to all styles but "runtime"
@@ -161,7 +129,7 @@ class ComponentProject extends Project {
161129 throw new Error ( `Unknown path mapping style ${ style } ` ) ;
162130 }
163131
164- reader = this . _addWriter ( reader , style ) ;
132+ // reader = this._addWriter(reader, style, writer );
165133 return reader ;
166134 }
167135
@@ -183,52 +151,49 @@ class ComponentProject extends Project {
183151 throw new Error ( `_getTestReader must be implemented by subclass ${ this . constructor . name } ` ) ;
184152 }
185153
186- /**
187- * Get a resource reader/writer for accessing and modifying a project's resources
188- *
189- * @public
190- * @returns {@ui5/fs/ReaderCollection } A reader collection instance
191- */
192- getWorkspace ( ) {
193- // Workspace is always of style "buildtime"
194- // Therefore builder resource-excludes are always to be applied
195- const excludes = this . getBuilderResourcesExcludes ( ) ;
196- return resourceFactory . createWorkspace ( {
197- name : `Workspace for project ${ this . getName ( ) } ` ,
198- reader : this . _getReader ( excludes ) ,
199- writer : this . _getWriter ( ) . collection
200- } ) ;
201- }
154+ // / **
155+ // * Get a resource reader/writer for accessing and modifying a project's resources
156+ // *
157+ // * @public
158+ // * @returns {@ui5/fs/ReaderCollection } A reader collection instance
159+ // */
160+ // getWorkspace() {
161+ // // Workspace is always of style "buildtime"
162+ // // Therefore builder resource-excludes are always to be applied
163+ // const excludes = this.getBuilderResourcesExcludes();
164+ // return resourceFactory.createWorkspace({
165+ // name: `Workspace for project ${this.getName()}`,
166+ // reader: this._getPlainReader (excludes),
167+ // writer: this._getWriter().collection
168+ // });
169+ // }
202170
203171 _getWriter ( ) {
204- if ( ! this . _writers ) {
205- // writer is always of style "buildtime"
206- const namespaceWriter = resourceFactory . createAdapter ( {
207- virBasePath : "/" ,
208- project : this
209- } ) ;
172+ // writer is always of style "buildtime"
173+ const namespaceWriter = resourceFactory . createAdapter ( {
174+ virBasePath : "/" ,
175+ project : this
176+ } ) ;
210177
211- const generalWriter = resourceFactory . createAdapter ( {
212- virBasePath : "/" ,
213- project : this
214- } ) ;
178+ const generalWriter = resourceFactory . createAdapter ( {
179+ virBasePath : "/" ,
180+ project : this
181+ } ) ;
215182
216- const collection = resourceFactory . createWriterCollection ( {
217- name : `Writers for project ${ this . getName ( ) } ` ,
218- writerMapping : {
219- [ `/resources/${ this . _namespace } /` ] : namespaceWriter ,
220- [ `/test-resources/${ this . _namespace } /` ] : namespaceWriter ,
221- [ `/` ] : generalWriter
222- }
223- } ) ;
183+ const collection = resourceFactory . createWriterCollection ( {
184+ name : `Writers for project ${ this . getName ( ) } ` ,
185+ writerMapping : {
186+ [ `/resources/${ this . _namespace } /` ] : namespaceWriter ,
187+ [ `/test-resources/${ this . _namespace } /` ] : namespaceWriter ,
188+ [ `/` ] : generalWriter
189+ }
190+ } ) ;
224191
225- this . _writers = {
226- namespaceWriter,
227- generalWriter,
228- collection
229- } ;
230- }
231- return this . _writers ;
192+ return {
193+ namespaceWriter,
194+ generalWriter,
195+ collection
196+ } ;
232197 }
233198
234199 _getReader ( excludes ) {
@@ -243,15 +208,15 @@ class ComponentProject extends Project {
243208 return reader ;
244209 }
245210
246- _addWriter ( reader , style ) {
247- const { namespaceWriter, generalWriter} = this . _getWriter ( ) ;
211+ _addReadersFromWriter ( style , readers , writer ) {
212+ const { namespaceWriter, generalWriter} = writer ;
248213
249214 if ( ( style === "runtime" || style === "dist" ) && this . _isRuntimeNamespaced ) {
250215 // If the project's type requires a namespace at runtime, the
251216 // dist- and runtime-style paths are identical to buildtime-style paths
252217 style = "buildtime" ;
253218 }
254- const readers = [ ] ;
219+
255220 switch ( style ) {
256221 case "buildtime" :
257222 // Writer already uses buildtime style
@@ -279,12 +244,13 @@ class ComponentProject extends Project {
279244 default :
280245 throw new Error ( `Unknown path mapping style ${ style } ` ) ;
281246 }
282- readers . push ( reader ) ;
247+ // return readers;
248+ // readers.push(reader);
283249
284- return resourceFactory . createReaderCollectionPrioritized ( {
285- name : `Reader/Writer collection for project ${ this . getName ( ) } ` ,
286- readers
287- } ) ;
250+ // return resourceFactory.createReaderCollectionPrioritized({
251+ // name: `Reader/Writer collection for project ${this.getName()}`,
252+ // readers
253+ // });
288254 }
289255
290256 /* === Internals === */
0 commit comments