<commit_before>'use strict';

/**
@module ember-cli
*/

const existsSync = require('exists-sync');
const path = require('path');
const assign = require('ember-cli-lodash-subset').assign;
const SilentError = require('silent-error');
const heimdallLogger = require('heimdalljs-logger');
let logger = heimdallLogger('ember-cli:addon');
let treeCacheLogger = heimdallLogger('ember-cli:addon:tree-cache');
let cacheKeyLogger = heimdallLogger('ember-cli:addon:cache-key-for-tree');

const nodeModulesPath = require('node-modules-path');

const p = require('ember-cli-preprocess-registry/preprocessors');
let preprocessJs = p.preprocessJs;
let preprocessCss = p.preprocessCss;
let preprocessTemplates = p.preprocessTemplates;

const AddonDiscovery = require('../models/addon-discovery');
const AddonsFactory = require('../models/addons-factory');
const CoreObject = require('core-object');
const Project = require('./project');

const mergeTrees = require('../broccoli/merge-trees');
const Funnel = require('broccoli-funnel');
const walkSync = require('walk-sync');
const ensurePosixPath = require('ensure-posix-path');
const defaultsDeep = require('ember-cli-lodash-subset').defaultsDeep;
const findAddonByName = require('../utilities/find-addon-by-name');
const experiments = require('../experiments');
const heimdall = require('heimdalljs');
const calculateCacheKeyForTree = require('calculate-cache-key-for-tree');
const addonProcessTree = require('../utilities/addon-process-tree');

heimdall.registerMonitor('addon-tree-cache', function AddonTreeCacheSchema() {
  this.hits = 0;
  this.misses = 0;
  this.adds = 0;
});

heimdall.registerMonitor('cache-key-for-tree', function CacheKeyForTreeSchema() {
  this.modifiedMethods = 0;
  this.treeForMethodsOverride = 0;
});

let DEFAULT_BABEL_CONFIG = {
  modules: 'amdStrict',
  moduleIds: true,
  resolveModuleSource: require('amd-name-resolver').moduleResolve,
};

let DEFAULT_TREE_FOR_METHODS = {
  app: 'treeForApp',
  addon: 'treeForAddon',
  'addon-styles': 'treeForAddonStyles',
  'addon-templates': 'treeForAddonTemplates',
  'addon-test-support': 'treeForAddonTestSupport',
  public: 'treeForPublic',
  styles: 'treeForStyles',
  templates: 'treeForTemplates',
  'test-support': 'treeForTestSupport',
  vendor: 'treeForVendor',
};

let GLOBAL_TREE_FOR_METHOD_METHODS = ['treeFor', '_treeFor', 'treeGenerator'];
let DEFAULT_TREE_FOR_METHOD_METHODS = {<commit_msg>Auto merge of #6678 - rwjblue:prevent-error-in-linking-scenarios, r=rwjblue<commit_after>'use strict';

/**
@module ember-cli
*/

const existsSync = require('exists-sync');
const path = require('path');
const assign = require('ember-cli-lodash-subset').assign;
const SilentError = require('silent-error');
const heimdallLogger = require('heimdalljs-logger');
let logger = heimdallLogger('ember-cli:addon');
let treeCacheLogger = heimdallLogger('ember-cli:addon:tree-cache');
let cacheKeyLogger = heimdallLogger('ember-cli:addon:cache-key-for-tree');

const nodeModulesPath = require('node-modules-path');

const p = require('ember-cli-preprocess-registry/preprocessors');
let preprocessJs = p.preprocessJs;
let preprocessCss = p.preprocessCss;
let preprocessTemplates = p.preprocessTemplates;

const AddonDiscovery = require('../models/addon-discovery');
const AddonsFactory = require('../models/addons-factory');
const CoreObject = require('core-object');
const Project = require('./project');

const mergeTrees = require('../broccoli/merge-trees');
const Funnel = require('broccoli-funnel');
const walkSync = require('walk-sync');
const ensurePosixPath = require('ensure-posix-path');
const defaultsDeep = require('ember-cli-lodash-subset').defaultsDeep;
const findAddonByName = require('../utilities/find-addon-by-name');
const experiments = require('../experiments');
const heimdall = require('heimdalljs');
const calculateCacheKeyForTree = require('calculate-cache-key-for-tree');
const addonProcessTree = require('../utilities/addon-process-tree');

if (!heimdall.hasMonitor('addon-tree-cache')) {
  heimdall.registerMonitor('addon-tree-cache', function AddonTreeCacheSchema() {
    this.hits = 0;
    this.misses = 0;
    this.adds = 0;
  });
}

if (!heimdall.hasMonitor('cache-key-for-tree')) {
  heimdall.registerMonitor('cache-key-for-tree', function CacheKeyForTreeSchema() {
    this.modifiedMethods = 0;
    this.treeForMethodsOverride = 0;
  });
}

let DEFAULT_BABEL_CONFIG = {
  modules: 'amdStrict',
  moduleIds: true,
  resolveModuleSource: require('amd-name-resolver').moduleResolve,
};

let DEFAULT_TREE_FOR_METHODS = {
  app: 'treeForApp',
  addon: 'treeForAddon',
  'addon-styles': 'treeForAddonStyles',
  'addon-templates': 'treeForAddonTemplates',
  'addon-test-support': 'treeForAddonTestSupport',
  public: 'treeForPublic',
  styles: 'treeForStyles',
  templates: 'treeForTemplates',
  'test-support': 'treeForTestSupport',
  vendor: 'treeForVendor',
};

let GLOBAL_TREE_FOR_METHOD_METHODS = ['treeFor', '_treeFor', 'treeGenerator'];
let DEFAULT_TREE_FOR_METHOD_METHODS = {
{'fraction_non_alphanumeric': 0.15396888711607498, 'fraction_numerical': 0.002792181890706023, 'mean_word_length': 6.257597684515195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7444276', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1635, 'n_words': 285}