MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / _getBundledPackageInfos

Method _getBundledPackageInfos

lib/models/host-info-cache.js:103–145  ·  view source on GitHub ↗

* Returns a `Set` of package-info objects that a given bundle host is * _directly_ responsible for bundling (i.e., it excludes other bundle * hosts/lazy engines when it encounters these) * * @method _getBundledPackageInfos * @param {PackageInfo} pkgInfoToStartAt * @return {Set<Pack

(pkgInfoToStartAt)

Source from the content-addressed store, hash-verified

101 * @private
102 */
103 _getBundledPackageInfos(pkgInfoToStartAt) {
104 let pkgInfos = this._bundledPackageInfoCache.get(pkgInfoToStartAt);
105
106 if (pkgInfos) {
107 return pkgInfos;
108 }
109
110 if (!pkgInfoToStartAt.isForBundleHost()) {
111 throw new Error(
112 `[ember-cli] \`${pkgInfoToStartAt.name}\` is not a bundle host; \`getBundledPackageInfos\` should only be used to find bundled package infos for a project or lazy engine`
113 );
114 }
115
116 pkgInfos = new Set();
117 this._bundledPackageInfoCache.set(pkgInfoToStartAt, pkgInfos);
118
119 let findAddons = (currentPkgInfo) => {
120 if (!currentPkgInfo.valid || !currentPkgInfo.addonMainPath) {
121 return;
122 }
123
124 if (pkgInfos.has(currentPkgInfo)) {
125 return;
126 }
127
128 if (currentPkgInfo.isForBundleHost()) {
129 return;
130 }
131
132 pkgInfos.add(currentPkgInfo);
133
134 let addonPackageList = currentPkgInfo.discoverAddonAddons();
135 addonPackageList.forEach((pkgInfo) => findAddons(pkgInfo));
136 };
137
138 let addonPackageList = pkgInfoToStartAt.project
139 ? pkgInfoToStartAt.discoverProjectAddons()
140 : pkgInfoToStartAt.discoverAddonAddons();
141
142 addonPackageList.forEach((pkgInfo) => findAddons(pkgInfo));
143
144 return pkgInfos;
145 }
146
147 /**
148 * This function intends to return a common host for a bundle host (lazy engine). The root

Callers 1

getHostAddonInfoMethod · 0.95

Calls 4

getMethod · 0.80
isForBundleHostMethod · 0.80
discoverProjectAddonsMethod · 0.80
discoverAddonAddonsMethod · 0.80

Tested by

no test coverage detected