@@ -20,7 +20,7 @@ function getTimestamp() {
2020/**
2121 *
2222 * @param {module:@ui5/fs.Resource } manifestResource
23- * @returns {Promise<ManifestInfos > }
23+ * @returns {Promise<ManifestInfo > }
2424 */
2525const processManifest = async ( manifestResource ) => {
2626 const manifestContent = await manifestResource . getString ( ) ;
@@ -58,7 +58,7 @@ const processManifest = async (manifestResource) => {
5858/**
5959 * Library Info
6060 *
61- * @typedef {object<string, object> } DependencyInfos
61+ * @typedef {object<string, object> } ManifestLibs
6262 *
6363 * * @example
6464 * {
@@ -72,8 +72,8 @@ const processManifest = async (manifestResource) => {
7272/**
7373 * Manifest Hint
7474 *
75- * @typedef {object } ManifestInfos
76- * @property {DependencyInfos } libs The library object
75+ * @typedef {object } ManifestInfo
76+ * @property {ManifestLibs } libs The library object
7777 * @property {string[] } embeds embedded components, e.g. "sub/fold" (only relative path)
7878 * @property {string } id the app id, e.g. "lib.a"
7979 *
@@ -94,12 +94,14 @@ const processManifest = async (manifestResource) => {
9494
9595
9696/**
97- * Library Info object
97+ * Library Info
98+ *
99+ * contains information about the name the version of the library and its manifest, as well as the nested manifests.
98100 *
99101 * @typedef {object } LibraryInfo
100102 * @property {string } name The library name
101103 * @property {string } version The library version
102- * @property {module:@ui5/fs.Resource } mainManifest main manifest resources
104+ * @property {module:@ui5/fs.Resource } libraryManifest main manifest resources
103105 * @property {module:@ui5/fs.Resource[] } manifestResources list of corresponding manifest resources
104106 */
105107
@@ -112,23 +114,24 @@ const getManifestPath = (filePath, subPath) => {
112114} ;
113115
114116/**
117+ * Resolves the dependencies recursively
115118 *
116- * @param {Map<string, DependencyInfos > } libraryInfosMap
119+ * @param {Map<string, DependencyInfo > } dependencyInfoMap
117120 */
118- const resolveTransitiveDependencies = ( libraryInfosMap ) => {
119- const keys = [ ...libraryInfosMap . keys ( ) ] ;
121+ const resolveTransitiveDependencies = ( dependencyInfoMap ) => {
122+ const keys = [ ...dependencyInfoMap . keys ( ) ] ;
120123 keys . sort ( ) ;
121124 keys . forEach ( ( libName ) => { // e.g. sap.ui.documentation
122- const libraryInfo = libraryInfosMap . get ( libName ) ;
123- libraryInfo . resolve ( libraryInfosMap ) ;
125+ const libraryInfo = dependencyInfoMap . get ( libName ) ;
126+ libraryInfo . resolve ( dependencyInfoMap ) ;
124127 } ) ;
125128} ;
126129
127130class DependencyInfoObject {
128131 /**
129132 *
130133 * @param {string } name name of the dependency, e.g. sap.ui.documentation
131- * @param {boolean } lazy
134+ * @param {boolean } lazy lazy dependency
132135 */
133136 constructor ( name , lazy ) {
134137 this . name = name ;
@@ -146,11 +149,6 @@ class DependencyInfo {
146149 this . libs = libs ;
147150 this . name = name ;
148151
149- /**
150- *
151- * @type {string[] }
152- */
153- this . resolved = [ ] ;
154152 /**
155153 *
156154 * @type {DependencyInfoObject[] }
@@ -190,7 +188,8 @@ class DependencyInfo {
190188 /**
191189 *
192190 * @param {Map<string,DependencyInfo> } dependencyInfoMap
193- * @param {boolean } [lazy]
191+ * @param {boolean } [lazy] whether or not the dependency is lazy dependency which means
192+ * all its dependencies should be treated as lazy
194193 */
195194 resolve ( dependencyInfoMap , lazy ) {
196195 if ( ! this . wasResolved || lazy ) {
@@ -238,7 +237,6 @@ const sortObjectKeys = (obj) => {
238237 */
239238const addManifestHints = ( result , dependencyInfo ) => {
240239 if ( dependencyInfo && dependencyInfo . libs . length ) {
241- // const sortedLibs = sortObjectKeys(libs.libs);
242240 const libsObject = { } ;
243241 dependencyInfo . libsResolved . forEach ( ( sortedLib ) => {
244242 libsObject [ sortedLib . name ] = { } ;
@@ -261,19 +259,27 @@ const convertToDependencyInfoObjects = (libs) => {
261259 } ) ;
262260} ;
263261
262+ /**
263+ * Processes the library info and fills the maps <code>dependencyInfoMap</code> and <code>embeddedInfoMap</code>.
264+ *
265+ * @param {LibraryInfo } libraryInfo
266+ * @param {Map<string, DependencyInfo> } dependencyInfoMap
267+ * @param {Map<string, object> } embeddedInfoMap
268+ * @returns {Promise<void> }
269+ */
264270const processLibraryInfo = async ( libraryInfo , dependencyInfoMap , embeddedInfoMap ) => {
265- if ( ! libraryInfo . mainManifest ) {
271+ if ( ! libraryInfo . libraryManifest ) {
266272 log . error ( `library manifest not found for ${ libraryInfo . name } ` ) ;
267273 return ;
268274 }
269- const manifestInfo = await processManifest ( libraryInfo . mainManifest ) ;
275+ const manifestInfo = await processManifest ( libraryInfo . libraryManifest ) ;
270276 // gather shallow library information
271277 const dependencyInfoObjects = convertToDependencyInfoObjects ( manifestInfo . libs ) ;
272278 dependencyInfoMap . set ( libraryInfo . name , new DependencyInfo ( dependencyInfoObjects , libraryInfo . name ) ) ;
273279 const embeds = manifestInfo . embeds ; // sdk
274280 // filter
275281 const embeddedPaths = embeds . map ( ( embed ) => {
276- return getManifestPath ( libraryInfo . mainManifest . getPath ( ) , embed ) ;
282+ return getManifestPath ( libraryInfo . libraryManifest . getPath ( ) , embed ) ;
277283 } ) ;
278284 // sap.ui.documentation.sdk
279285 const relevantManifests = libraryInfo . manifestResources . filter ( ( manifestResource ) => {
@@ -307,7 +313,7 @@ const processLibraryInfo = async (libraryInfo, dependencyInfoMap, embeddedInfoMa
307313 * {
308314 * name: "library.xy",
309315 * version: "1.0.0",
310- * mainManifest : module:@ui 5/fs.Resource,
316+ * libraryManifest : module:@ui 5/fs.Resource,
311317 * manifestResources: module:@ui5/fs.Resource[]
312318 * }
313319 * </code>
@@ -336,6 +342,15 @@ module.exports = async function({options}) {
336342 * @type {Map<string, DependencyInfo> }
337343 */
338344 const dependencyInfoMap = new Map ( ) ;
345+ /**
346+ * @example
347+ * {
348+ * "sap.ui.integration.sdk": {
349+ * "library": "sap.ui.integration"
350+ * }
351+ *
352+ * @type {Map<string, object> }
353+ */
339354 const embeddedInfoMap = new Map ( ) ;
340355
341356 // gather all manifestHints
@@ -362,7 +377,6 @@ module.exports = async function({options}) {
362377 return result ;
363378 } ) ;
364379
365- // sort keys
366380 embeddedInfoMap . forEach ( ( embeddedInfo , libName ) => {
367381 components [ libName ] = embeddedInfo ;
368382 const libs = dependencyInfoMap . get ( libName ) ;
0 commit comments