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

Method checkForDecomposableBundle

lib/lbt/bundle/Resolver.js:85–109  ·  view source on GitHub ↗
(resource)

Source from the content-addressed store, hash-verified

83 }
84
85 function checkForDecomposableBundle(resource) {
86 const isBundle =
87 resource?.info?.subModules.length > 0 &&
88 !/(?:^|\/)library.js$/.test(resource.info.name);
89
90 if (!isBundle) {
91 return {
92 resource,
93 isBundle,
94 decomposable: false
95 };
96 }
97
98 return Promise.all(
99 resource.info.subModules.map((sub) => pool.findResource(sub).catch(() => false))
100 ).then((modules) => {
101 // it might look more natural to expect 'all' embedded modules to exist in the pool,
102 // but expecting only 'some' module to exist is a more conservative approach
103 return {
104 resource,
105 isBundle,
106 decomposable: modules.some(($) => ($))
107 };
108 });
109 }
110
111 function checkAndAddResource(resourceName, depth, msg) {
112 // console.log(" checking " + resourceName + " at depth " + depth);

Callers

nothing calls this directly

Calls 1

findResourceMethod · 0.45

Tested by

no test coverage detected