(section)
| 307 | } |
| 308 | |
| 309 | async writePreloadFunction(section) { |
| 310 | const outW = this.outW; |
| 311 | |
| 312 | outW.ensureNewLine(); |
| 313 | |
| 314 | const sequence = section.modules.slice(); |
| 315 | |
| 316 | this.beforeWriteFunctionPreloadSection(sequence); |
| 317 | |
| 318 | await this.rewriteAMDModules(sequence); |
| 319 | if ( sequence.length > 0 ) { |
| 320 | this.writeWithSourceMap(`sap.ui.require.preload({\n`); |
| 321 | let i = 0; |
| 322 | for ( const module of sequence ) { |
| 323 | const resource = await this.pool.findResourceWithInfo(module); |
| 324 | if ( resource != null ) { |
| 325 | if ( i>0 ) { |
| 326 | outW.writeln(","); |
| 327 | } |
| 328 | outW.write(`\t"${module.toString()}":`); |
| 329 | outW.startSegment(module); |
| 330 | await this.writePreloadModule(module, resource.info, resource); |
| 331 | const compressedSize = outW.endSegment(); |
| 332 | log.verbose(` ${module} (${resource.info != null ? resource.info.size : -1},${compressedSize})`); |
| 333 | i++; |
| 334 | } else { |
| 335 | log.error(` Could not find module ${module}`); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | if ( i > 0 ) { |
| 340 | outW.writeln(); |
| 341 | } |
| 342 | outW.write(this.generateAfterPreloads(section)); |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | beforeWriteFunctionPreloadSection(sequence) { |
| 347 | // simple version: just sort alphabetically |
no test coverage detected