* Validates that a new cache key for a given tree type matches the previous * cache key for the same tree type. To opt-in to bundle addon caching for * a given addon it's assumed that it returns stable cache keys; specifically * this is because the interplay between bundle addon caching and `embe
(realAddonInstance, treeType, newCacheKey)
| 19 | * @throws {Error} If the new cache key doesn't match the previous cache key |
| 20 | */ |
| 21 | function validateCacheKey(realAddonInstance, treeType, newCacheKey) { |
| 22 | let cacheKeyTracker = realAddonInstance[CACHE_KEY_FOR_TREE_TRACKER]; |
| 23 | |
| 24 | if (!cacheKeyTracker) { |
| 25 | cacheKeyTracker = {}; |
| 26 | realAddonInstance[CACHE_KEY_FOR_TREE_TRACKER] = cacheKeyTracker; |
| 27 | } |
| 28 | |
| 29 | cacheKeyTracker[treeType] = treeType in cacheKeyTracker ? cacheKeyTracker[treeType] : newCacheKey; |
| 30 | |
| 31 | if (cacheKeyTracker[treeType] !== newCacheKey) { |
| 32 | throw new Error( |
| 33 | `[ember-cli] addon bundle caching can only be used on addons that have stable cache keys (previously \`${ |
| 34 | cacheKeyTracker[treeType] |
| 35 | }\`, now \`${newCacheKey}\`; for addon \`${realAddonInstance.name}\` located at \`${ |
| 36 | realAddonInstance.packageRoot || realAddonInstance.root |
| 37 | }\`)` |
| 38 | ); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Returns a proxy to a target with specific handling for the |
no outgoing calls
no test coverage detected
searching dependent graphs…