MCPcopy Create free account
hub / github.com/SAP/ui5-builder / writeBundleInfos

Method writeBundleInfos

lib/lbt/bundle/Builder.js:564–598  ·  view source on GitHub ↗
(sections)

Source from the content-addressed store, hash-verified

562 }
563
564 async writeBundleInfos(sections) {
565 this.outW.ensureNewLine();
566
567 let bundleInfoStr = "";
568 if ( sections.length > 0 ) {
569 bundleInfoStr = "sap.ui.loader.config({bundlesUI5:{\n";
570 let initial = true;
571 for (let idx = 0; idx < sections.length; idx++) {
572 const section = sections[idx];
573
574 // Remove modules requiring string bundling
575 let modules = await Promise.all(section.modules.map(this.checkForStringBundling.bind(this)));
576 modules = modules.filter(($) => $) || [];
577
578 if (!initial) {
579 bundleInfoStr += ",\n";
580 } else {
581 initial = false;
582 }
583
584 if (!section.name) {
585 throw new Error(`A 'bundleInfo' section is missing the mandatory 'name' property.` );
586 }
587 if (!path.extname(section.name)) {
588 log.warn(`BundleInfo section name '${section.name}' is missing a file extension. ` +
589 `The info might not work as expected. ` +
590 `The name must match the bundle filename (incl. extension such as '.js')`);
591 }
592 bundleInfoStr += `"${section.name}":[${modules.map(makeStringLiteral).join(",")}]`;
593 }
594 bundleInfoStr += "\n}});\n";
595
596 this.writeWithSourceMap(bundleInfoStr);
597 }
598 }
599
600 async writeRequires(section) {
601 if (section.modules.length === 0) {

Callers 2

_createBundleMethod · 0.95
addSectionMethod · 0.95

Calls 2

writeWithSourceMapMethod · 0.95
ensureNewLineMethod · 0.80

Tested by

no test coverage detected