Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lib/processors/versionInfoGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ const getManifestHints = (dependencyInfo, dependencyInfoMap) => {

/**
* Common type for Library and Component
* embeds and bundled components makes only sense for library
* embeds and bundled components make only sense for library
*
* @typedef {object} ArtifactInfo
* @property {string} componentName The library name, e.g. "lib.x"
* @property {Set<string>} bundledComponents The embedded components which have a embeddedBy reference to the library
* @property {Set<string>} bundledComponents The embedded components which have an embeddedBy reference to the library
* @property {DependencyInfo} dependencyInfo The dependency info object
* @property {ArtifactInfo[]} embeds The embedded artifact infos
*/
Expand Down Expand Up @@ -423,18 +423,19 @@ module.exports = async function({options}) {
let components;
artifactInfos.forEach((artifactInfo) => {
artifactInfo.embeds.forEach((embeddedArtifactInfo) => {
const componentObject = {
library: artifactInfo.componentName
};
const componentObject = {};
const bundledComponents = artifactInfo.bundledComponents;
const componentName = embeddedArtifactInfo.componentName;
if (!bundledComponents.has(componentName)) {
componentObject.hasOwnPreload = true;
}
componentObject.library = artifactInfo.componentName;

const manifestHints = getManifestHints(embeddedArtifactInfo.dependencyInfo, dependencyInfoMap);
if (manifestHints) {
componentObject.manifestHints = manifestHints;
}
const bundledComponents = artifactInfo.bundledComponents;
if (bundledComponents.has(componentName)) {
componentObject.hasOwnPreload = true;
}

components = components || {};
components[componentName] = componentObject;
});
Expand Down
2 changes: 1 addition & 1 deletion test/lib/processors/versionInfoGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ test.serial("versionInfoGenerator library infos with embeds", async (t) => {
],
"components": {
"lib.a.sub": {
"hasOwnPreload": true,
"library": "lib.a"
}
}
Expand Down Expand Up @@ -439,7 +440,6 @@ test.serial("versionInfoGenerator library infos with embeds and embeddedBy (hasO
],
"components": {
"lib.a.sub": {
"hasOwnPreload": true,
"library": "lib.a"
}
}
Expand Down
7 changes: 6 additions & 1 deletion test/lib/tasks/generateVersionInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ test.serial("integration: Library with dependencies and subcomponent complex sce
}],
"components": {
"lib.a.sub.fold": {
"hasOwnPreload": true,
"library": "lib.a",
"manifestHints": {
"dependencies": {
Expand Down Expand Up @@ -863,6 +864,7 @@ test.serial("integration: Library with dependencies and subcomponent bigger scen
}],
"components": {
"lib.a.sub.fold": {
"hasOwnPreload": true,
"library": "lib.a",
"manifestHints": {
"dependencies": {
Expand Down Expand Up @@ -917,7 +919,6 @@ test.serial("integration: Library without dependencies and embeds and embeddedBy
}],
"components": {
"lib.a.sub.fold": {
"hasOwnPreload": true,
"library": "lib.a"
}
},
Expand Down Expand Up @@ -964,6 +965,7 @@ test.serial("integration: Library without dependencies and embeddedBy undefined"
}],
"components": {
"lib.a.sub.fold": {
"hasOwnPreload": true,
"library": "lib.a"
}
},
Expand Down Expand Up @@ -1014,6 +1016,7 @@ test.serial("integration: Library without dependencies and embeddedBy not a stri
}],
"components": {
"lib.a.sub.fold": {
"hasOwnPreload": true,
"library": "lib.a"
}
},
Expand Down Expand Up @@ -1065,6 +1068,7 @@ test.serial("integration: Library without dependencies and embeddedBy empty stri
}],
"components": {
"lib.a.sub.fold": {
"hasOwnPreload": true,
"library": "lib.a"
}
},
Expand Down Expand Up @@ -1116,6 +1120,7 @@ test.serial("integration: Library without dependencies and embeddedBy path not c
}],
"components": {
"lib.a.sub.fold": {
"hasOwnPreload": true,
"library": "lib.a"
}
},
Expand Down