Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected treeForTestSupport(): Tree | undefined {
if (this.customizes('treeForTestSupport')) {
todo(`${this.name} has customized the test support tree`);
} else if (this.hasStockTree('test-support')) {
// this one doesn't go through transpile yet because it gets handled as
// part of the consuming app. For example, imports should be relative to
// the consuming app, not our own package. That is some of what is lame
// about app trees and why they will go away once everyone is all MU.
return new Funnel(this.stockTree('test-support'), {
destDir: `${appPublicationDir}/tests`,
});
}
}
// This does need to go through parseImports here, because by the time
// these files have been merged into the app we can't tell what their
// allowed dependencies are anymore and would get false positive
// externals.
appTree = this.maybeSetAppJS(built, appTree);
built.trees.push(appTree);
}
if (
typeof this.addonInstance.isDevelopingAddon === 'function' &&
this.addonInstance.isDevelopingAddon() &&
this.addonInstance.hintingEnabled()
) {
let hintTree = this.addonInstance.jshintAddonTree();
if (hintTree) {
hintTree = this.maybeSetAppJS(built, new Funnel(hintTree, { destDir: appPublicationDir }));
built.trees.push(hintTree);
}
}
}
// An array and FSTree, respectively, representing the dependency graph of the
// entry point or the non-dependency graph.
this._depGraph = undefined;
this._depGraphTree = undefined;
this._nonDepGraph = undefined;
this._nonDepGraphTree = undefined;
Plugin.call(this, [inputNodes], {
annotation: options.annotation,
persistentOutput: true
});
this.options = options;
}
RollupFunnel.prototype._copy = Funnel.prototype._copy;
/**
* Constructs an FSTree from the passed in paths.
*
* @param {Array} paths
* @return {FSTree}
*/
RollupFunnel.prototype._getFSTree = function(paths) {
var inputPath = this.inputPaths[0];
var entries = paths.map(function(entryPath) {
var absolutePath = path.join(inputPath, entryPath);
var stat = existsStat(absolutePath);
if (!stat) {
return;
}
get indexTree() {
let indexFilePath = this.app.options.outputPaths.app.html;
let index: Tree = new Funnel(this.app.trees.app, {
allowEmpty: true,
include: [`index.html`],
getDestinationPath: () => indexFilePath,
annotation: 'app/index.html',
});
if (this.isModuleUnification) {
let srcIndex = new Funnel(new WatchedDir(join(this.root, 'src')), {
files: ['ui/index.html'],
getDestinationPath: () => indexFilePath,
annotation: 'src/ui/index.html',
});
index = mergeTrees([index, srcIndex], {
overwrite: true,
annotation: 'merge classic and MU index.html',
let sourceTrees = dirs.map((dir) => {
let treeFor = this[`treeFor${ upperFirst(dir) }`] || this.treeFor;
let tree = treeFor.call(this, path.join(this.dir, dir));
if (typeof tree !== 'string' || fs.existsSync(tree)) {
return new Funnel(tree, { annotation: dir, destDir: dir });
}
return false;
}).filter(Boolean);
function withoutNodeModules(root: string): Tree {
return new Funnel(new UnwatchedDir(root), {
exclude: ['node_modules'],
});
}
buildDummyTree(rootTree) {
debug(`building ${ this.pkg.name }'s dummy app`);
let dummyBuilder = Builder.createFor(path.join(this.dir, 'test', 'dummy'), this, [ this.dir ]);
let dummyTree = dummyBuilder.toTree();
let addonTests = new Funnel(rootTree, {
include: [ 'test/**/*' ],
exclude: [ 'test/dummy/**/*' ]
});
rootTree = new Funnel(rootTree, {
exclude: [ 'test/**/*' ],
destDir: path.join('node_modules', this.pkg.name)
});
return new MergeTree([ rootTree, dummyTree, addonTests ], { overwrite: true });
}
return this.throughTreeCache(treeName, 'stock', () => {
let opts = Object.assign(
{
srcDir: this.addonInstance.treePaths[treeName],
},
this.stockTreeFunnelOptions(treeName)
);
return new Funnel(this.rootTree, opts);
})!;
}
buildDummyTree(rootTree) {
debug(`building ${ this.pkg.name }'s dummy app`);
let dummyBuilder = Builder.createFor(path.join(this.dir, 'test', 'dummy'), this, [ this.dir ]);
let dummyTree = dummyBuilder.toTree();
let addonTests = new Funnel(rootTree, {
include: [ 'test/**/*' ],
exclude: [ 'test/dummy/**/*' ]
});
rootTree = new Funnel(rootTree, {
exclude: [ 'test/**/*' ],
destDir: path.join('node_modules', this.pkg.name)
});
return new MergeTree([ rootTree, dummyTree, addonTests ], { overwrite: true });
}
return [...pkgs.values()].map((pkg, index) => new Funnel(pkg.tree, { destDir: `out-${index}` }));
}