How to use the ember-cli/lib/models/addon._treeCache function in ember-cli

To help you get started, we’ve selected a few ember-cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ember-engines / ember-engines / lib / engine-addon.js View on Github external
options.treeFor = function treeFor(name, source) {
      // @TODO: remove once support for ember-cli@2.x is dropped.
      // https://github.com/ember-cli/ember-cli/pull/8264
      this._requireBuildPackages && this._requireBuildPackages();

      let cacheKey;
      if (HAS_TREE_CACHE) {
        cacheKey = this.cacheKeyForTree(name);
        let cachedTree = Addon._treeCache.getItem(cacheKey);
        if (cachedTree) {
          return cachedTree;
        }
      }

      /**
        Scenarios where we don't want to call `eachAddonInvoke`:
        - app tree.
        - addon tree of a lazy engine.
        - public tree of a lazy engine.

        We handle these cases manually inside of treeForPublic.
        This is to consolidate child dependencies of this engine
        into the engine namespace as opposed to shoving them into
        the host application's vendor.js file.
       */
github ember-engines / ember-engines / lib / engine-addon.js View on Github external
const calculateCacheKeyForTree = require('calculate-cache-key-for-tree');
const Addon = require('ember-cli/lib/models/addon');
const { memoize } = require('./utils/memoize');
const maybeMergeTrees = require('./utils/maybe-merge-trees');
const deeplyNonDuplicatedAddon = require('./utils/deeply-non-duplicated-addon');
const restoreOriginalAddons = require('./utils/restore-original-addons');
const p = require('ember-cli-preprocess-registry/preprocessors');
const shouldCompactReexports = require('./utils/should-compact-reexports');
const appendCompactReexportsIfNeeded = require('./utils/append-compact-reexports-if-needed');
const ensureLazyLoadingHash = require('./utils/ensure-lazy-loading-hash');
const preprocessCss = p.preprocessCss;
const preprocessMinifyCss = p.preprocessMinifyCss;
const BroccoliDebug = require('broccoli-debug');

// Older versions of Ember-CLI may not have the Addon's tree cache
const HAS_TREE_CACHE = !!Addon._treeCache;
const EOL = require('os').EOL;
const DEFAULT_CONFIG = {
  outputPaths: {
    vendor: {
      css: '/assets/engine-vendor.css',
      js: '/assets/engine-vendor.js',
    },
  },
  trees: {
    addon: 'addon',
  },
  minifyCSS: {},
};

const findRoot = require('./utils/find-root');
const findHost = require('./utils/find-host');