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

Method writeDepCache

lib/lbt/bundle/Builder.js:620–665  ·  view source on GitHub ↗
(section)

Source from the content-addressed store, hash-verified

618 // module in the next file. This will also duplicate its dependency definition if we do not filter.
619 #depCacheSet = new Set();
620 async writeDepCache(section) {
621 let hasDepCache = false;
622
623 const sequence = section.modules.slice().sort();
624
625 if (sequence.length > 0) {
626 for (const module of sequence) {
627 if (this.#depCacheSet.has(module)) {
628 continue;
629 }
630
631 this.#depCacheSet.add(module);
632 let resource = null;
633 try {
634 resource = await this.pool.findResourceWithInfo(module);
635 } catch {
636 log.error(` couldn't find ${module}`);
637 }
638
639 if (resource != null) {
640 const deps = resource.info.dependencies.filter(
641 (dep) =>
642 !resource.info.isConditionalDependency(dep) &&
643 !resource.info.isImplicitDependency(dep)
644 );
645 if (deps.length > 0) {
646 if (!hasDepCache) {
647 hasDepCache = true;
648 this.outW.ensureNewLine();
649 this.outW.writeln(`sap.ui.loader.config({depCacheUI5:{`);
650 }
651
652 this.outW.writeln(
653 `"${module}": [${deps.map((dep) => `"${dep}"`).join(",")}],`
654 );
655 } else {
656 log.verbose(` skipped ${module}, no dependencies`);
657 }
658 }
659 }
660
661 if (hasDepCache) {
662 this.outW.writeln(`}});`);
663 }
664 }
665 }
666
667 async getSourceMapForModule({moduleName, moduleContent, resourcePath}) {
668 let moduleSourceMap = null;

Callers 1

addSectionMethod · 0.95

Calls 6

addMethod · 0.80
findResourceWithInfoMethod · 0.80
isImplicitDependencyMethod · 0.80
ensureNewLineMethod · 0.80
writelnMethod · 0.80

Tested by

no test coverage detected