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

Method onSapUiPredefine

lib/lbt/analyzer/JSModuleAnalyzer.js:671–699  ·  view source on GitHub ↗
(predefineCall, conditional)

Source from the content-addressed store, hash-verified

669 }
670
671 function onSapUiPredefine(predefineCall, conditional) {
672 const args = predefineCall.arguments;
673 const nArgs = args.length;
674 let i = 0;
675
676 // determine the name of the module
677 if ( i < nArgs ) {
678 const value = getStringValue(args[i++]);
679 if ( value !== undefined ) {
680 const moduleName = fromRequireJSName( value );
681 info.addSubModule(moduleName);
682
683 // add dependencies
684 // to correctly identify dependencies e.g. of a library-preload
685 const elementArg = args[i++];
686 if (elementArg && elementArg.type === Syntax.ArrayExpression) {
687 elementArg.elements.forEach((element) => {
688 const dependencyName = resolveRelativeRequireJSName(moduleName,
689 getStringValue(element));
690 info.addDependency(dependencyName, conditional);
691 });
692 }
693 } else {
694 log.warn("sap.ui.predefine call has a non supported type for module name (ignored)");
695 }
696 } else {
697 log.warn("sap.ui.predefine call is missing a module name (ignored)");
698 }
699 }
700
701 function onRegisterPreloadedModules(node, evoSyntax) {
702 const args = node.arguments;

Callers

nothing calls this directly

Calls 5

getStringValueFunction · 0.90
fromRequireJSNameFunction · 0.90
addSubModuleMethod · 0.80
addDependencyMethod · 0.80

Tested by

no test coverage detected