Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cleanup() {
if (!this._cleanupPromise) {
let ui = this.project.ui;
ui.startProgress('cleaning up');
ui.writeLine('cleaning up...');
// ensure any addon treeFor caches are reset
_resetTreeCache();
this._onProcessInterrupt.removeHandler(this._cleanup);
let node = heimdall.start({ name: 'Builder Cleanup' });
this._cleanupPromise = promiseFinally(this.builder.cleanup(), () => {
ui.stopProgress();
node.stop();
}).catch(err => {
ui.writeLine(chalk.red('Cleanup error.'));
ui.writeError(err);
});
}
return this._cleanupPromise;
}
processFilters(inputPath) {
let nextTree;
let instrumentation = heimdall.start('derivePatches');
let entries;
this.outputToInputMappings = {}; // we allow users to rename files
if (this.files && !this.exclude && !this.include) {
entries = this._processPaths(this.files);
// clone to be compatible with walkSync
nextTree = FSTree.fromPaths(entries, { sortAndExpand: true });
} else {
if (this._matchedWalk) {
entries = walkSync.entries(inputPath, { globs: this.include, ignore: this.exclude });
} else {
entries = walkSync.entries(inputPath);
}
it('collects nodes from path to root, limited by `depth`', function() {
heimdall.start({ name: 'a' });
heimdall.start({ name: 'b' });
heimdall.start({ name: 'c' });
heimdall.start({ name: 'd' });
heimdall.start({ name: 'e' });
let prefixer = new Prefixer();
prefixer.depth = 4;
expect(prefixer.prefix()).to.match(/\[b#\d -> c#\d -> d#\d -> e#\d\] /);
});
entries = this._processEntries(entries);
nextTree = FSTree.fromEntries(entries, { sortAndExpand: true });
}
let patches = this._currentTree.calculatePatch(nextTree);
this._currentTree = nextTree;
instrumentation.stats.patches = patches.length;
instrumentation.stats.entries = entries.length;
let outputPath = this.outputPath;
instrumentation.stop();
instrumentation = heimdall.start('applyPatch', ApplyPatchesSchema);
patches.forEach(function(entry) {
this._applyPatch(entry, inputPath, outputPath, instrumentation.stats);
}, this);
instrumentation.stop();
}
graph.each((key, value) => {
let addonInfo = value;
if (addonInfo) {
let initializeAddonToken = heimdall.start({
name: `initialize ${addonInfo.name}`,
addonName: addonInfo.name,
addonInitializationNode: true,
});
let start = Date.now();
let pkgInfo = parent.packageInfoCache.getEntry(addonInfo.path);
if (!pkgInfo || !pkgInfo.valid) {
throw new SilentError(
`The \`${addonInfo.pkg.name}\` addon could not be found at \`${addonInfo.path}\` or was otherwise invalid.`
);
}
let AddonConstructor = pkgInfo.getAddonConstructor();
this.addons.forEach(addon => {
if (!addon.includedCommands) {
return;
}
let token = heimdall.start({
name: `lookup-commands: ${addon.name}`,
addonName: addon.name,
addonCommandInitialization: true,
});
let includedCommands = addon.includedCommands();
let addonCommands = Object.create(null);
for (let key in includedCommands) {
if (typeof includedCommands[key] === 'function') {
addonCommands[key] = includedCommands[key];
} else {
addonCommands[key] = Command.extend(includedCommands[key]);
}
}
if (Object.keys(addonCommands).length) {
module.exports = function mergeTrees(_inputTrees, options) {
options = options || {};
let node = heimdall.start(
{
name: `EmberCliMergeTrees(${options.annotation})`,
emberCliMergeTrees: true,
},
function MergeTreesSchema() {
this.emptyTrees = 0;
this.duplicateTrees = 0;
this.returns = {
empty: 0,
identity: 0,
merge: 0,
};
}
);
let inputTrees = _inputTrees
analytics: this.analytics,
commands: environment.commands,
tasks: environment.tasks,
project: environment.project,
settings: environment.settings,
testing: this.testing,
cli: this,
});
commandLookupCreationToken.stop();
getOptionArgs('--verbose', commandArgs).forEach(arg => {
process.env[`EMBER_VERBOSE_${arg.toUpperCase()}`] = 'true';
});
let platformCheckerToken = heimdall.start('platform-checker');
const PlatformChecker = require('../utilities/platform-checker');
let platform = new PlatformChecker(process.version);
let recommendation =
' We recommend that you use the most-recent "Active LTS" version of Node.js.' +
' See https://git.io/v7S5n for details.';
if (!this.testing) {
if (platform.isDeprecated) {
this.ui.writeDeprecateLine(`Node ${process.version} is no longer supported by Ember CLI.${recommendation}`);
}
if (!platform.isTested) {
this.ui.writeWarnLine(
`Node ${process.version} is not tested against Ember CLI on your platform.${recommendation}`
);
discoverProjectAddons(project) {
let token = heimdall.start({
name: `${project.name()}: addon-discovery`,
addonDiscoveryNode: true,
});
let projectAsAddon = this.discoverFromProjectItself(project);
let internalAddons = this.discoverFromInternalProjectAddons(project);
let cliAddons = this.discoverFromCli(project.cli);
let dependencyAddons;
dependencyAddons = this.discoverFromDependencies(project.root, project.pkg, false);
let inRepoAddons = this.discoverInRepoAddons(project.root, project.pkg);
let addons = projectAsAddon.concat(cliAddons, internalAddons, dependencyAddons, inRepoAddons);
token.stop();
return addons;
}
function loadCommands() {
let token = heimdall.start('load-commands');
const Command = require('../models/command');
let hash = requireAsHash('../commands/*.js', Command);
token.stop();
return hash;
}