Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Filter(inputTree, options) {
if (!this || !(this instanceof Filter) ||
Object.getPrototypeOf(this) === Filter.prototype) {
throw new TypeError('Filter is an abstract class and must be sub-classed');
}
var name = 'broccoli-filter:' + (this.constructor.name);
if (this.description) {
name += ' > [' + this.description + ']';
}
this._debug = debugGenerator(name);
Plugin.call(this, [inputTree]);
if (options) {
if (options.extensions != null)
this.extensions = options.extensions;
if (options.targetExtension != null)
this.targetExtension = options.targetExtension;
// For encodings, `null` (buffers) is distinct from the default (UTF-8)
if (options.inputEncoding !== undefined)
this.inputEncoding = options.inputEncoding;
if (options.outputEncoding !== undefined)
this.outputEncoding = options.outputEncoding;
}
this._cache = new Cache();
this._canProcessCache = Object.create(null);
this._destFilePathCache = Object.create(null);
function CustomReplace (inputNode, configNode, options) {
options = options || {};
Plugin.call(this, [inputNode, configNode], { annotation: options.annotation }); // this._super();
this.options = options;
this._cache = {};
}
CustomReplace.prototype = Object.create(Plugin.prototype);
function UglifyWriter(inputNodes, options) {
if (!(this instanceof UglifyWriter)) {
return new UglifyWriter(inputNodes, options);
}
inputNodes = Array.isArray(inputNodes) ? inputNodes : [inputNodes];
Plugin.call(this, inputNodes, options);
this.options = defaults(options, {
uglify: {
sourceMap: {},
},
});
// consumers of this plugin can opt-in to async and concurrent behavior
this.async = (this.options.async === true);
this.concurrency = Number(process.env.JOBS) || this.options.concurrency || Math.max(require('os').cpus().length - 1, 1);
// create a worker pool using an external worker script
this.pool = workerpool.pool(path.join(__dirname, 'lib', 'worker.js'), {
maxWorkers: this.concurrency,
nodeWorker: 'auto',
});
}
]
});
}
function LokkaBuilder(options) {
const defaultedOptions = options || {};
Plugin.call(this, [/* takes no input nodes */], {
annotation: defaultedOptions.annotation
});
this.options = defaultedOptions;
}
LokkaBuilder.prototype = Object.create(Plugin.prototype);
LokkaBuilder.prototype.constructor = LokkaBuilder;
LokkaBuilder.prototype.build = function () {
return Promise.all([
bundleLokka(),
bundleLokkaTransport()
]).then(bundles => {
const lokka = bundles[0];
const lokkaTransportHttp = bundles[1];
return Promise.all([lokka.write({
format: 'es',
exports: 'named',
dest: path.join(this.outputPath, 'lokka.js')
}), lokkaTransportHttp.write({
format: 'es',
var Plugin = require("broccoli-plugin");
var path = require("path");
var fs = require("fs");
var Promise = require("rsvp").Promise; // jshint ignore:line
var makeDir = require("../helpers/make-dir");
var analyze = require('../helpers/analyze-path');
var chalk = require('chalk');
// Create a subclass from Plugin
TreeStats.prototype = Object.create(Plugin.prototype);
TreeStats.prototype.constructor = TreeStats;
function TreeStats(inputNodes, options) {
options = options || {
annotation: "Vendor Stats"
};
this.options = options;
Plugin.call(this, inputNodes, {
annotation: options.annotation
});
}
TreeStats.prototype.build = function () {
var _self = this;
var builtAll = [];
var PreventResolveSymlinkPlugin = require('./prevent-resolve-symlink-plugin');
function WebpackFilter(inputNode, options) {
if (!(this instanceof WebpackFilter)) return new WebpackFilter(inputNode, options);
if (Array.isArray(inputNode)) {
throw new Error("WebpackFilter only accepts a single inputNode");
}
Plugin.call(this, [inputNode], {
annotation: options.annotation
});
this.options = options;
}
WebpackFilter.prototype = Object.create(Plugin.prototype);
WebpackFilter.prototype.constructor = WebpackFilter;
// "private" helpers
function ensureArray(potentialArray) {
if (typeof potentialArray === 'string') {
return [potentialArray];
} else {
return potentialArray || [];
}
}
WebpackFilter.prototype.initializeCompiler = function() {
if (this.options.context) throw new Error("WebpackFilter will set the webpack context, you shouldn't set it.");
const Plugin = require('broccoli-plugin');
const fs = require('fs');
const path = require('path');
const walkSync = require('walk-sync');
const getModuleConfig = require('./get-module-config');
function ModuleMapCreator(src, config, options) {
options = options || {};
Plugin.call(this, [src, config], {
annotation: options.annotation
});
this.options = options;
}
ModuleMapCreator.prototype = Object.create(Plugin.prototype);
ModuleMapCreator.prototype.constructor = ModuleMapCreator;
ModuleMapCreator.prototype.build = function() {
function specifierFromModule(modulePrefix, moduleConfig, modulePath) {
let path;
let collectionPath;
for (let i = 0, l = moduleConfig.collectionPaths.length; i < l; i++) {
path = moduleConfig.collectionPaths[i];
if (modulePath.indexOf(path) === 0) {
collectionPath = path;
break;
}
}
if (collectionPath) {
// trim group/collection from module path
/* eslint-env node */
'use strict';
var Plugin = require('broccoli-plugin');
var walkSync = require('walk-sync');
var fs = require('fs');
var FSTree = require('fs-tree-diff');
var Promise = require('rsvp').Promise;
var path = require('path');
var os = require("os");
module.exports = IncludeAll;
IncludeAll.prototype = Object.create(Plugin.prototype);
IncludeAll.prototype.constructor = IncludeAll;
function IncludeAll(inputNode, options) {
options = options || {};
Plugin.call(this, [inputNode], {
annotation: options.annotation,
persistentOutput: true
});
this.currentTree = new FSTree();
this.importedPods = {};
}
IncludeAll.prototype.build = function() {
var srcDir = this.inputPaths[0];
var entries = walkSync.entries(srcDir);
/* eslint-env node */
'use strict';
var Plugin = require('broccoli-plugin');
var walkSync = require('walk-sync');
var fs = require('fs');
var FSTree = require('fs-tree-diff');
var Promise = require('rsvp').Promise;
var path = require('path');
var componentNames = require('./component-names.js');
module.exports = PodNames;
PodNames.prototype = Object.create(Plugin.prototype);
PodNames.prototype.constructor = PodNames;
function PodNames(inputNode, options) {
options = options || {};
Plugin.call(this, [inputNode], {
annotation: options.annotation,
persistentOutput: true
});
this.currentTree = new FSTree();
this.podNameJson = {};
this.classicStyleDir = options.classicStyleDir;
this.terseClassNames = options.terseClassNames;
}
PodNames.prototype.build = function() {
var srcDir = this.inputPaths[0];
if (Array.isArray(inputTree) || !inputTree) {
throw new Error('Expects one inputTree');
}
Plugin.call(this, [inputTree], options);
this._persistentOutput = true;
// setup persistent state
this._previousTree = new FSTree();
this.stubs = new Stubs();
this._fileToChecksumMap = {};
}
StubGenerator.prototype = Object.create(Plugin.prototype);
StubGenerator.prototype.constructor = StubGenerator;
StubGenerator.prototype.build = function() {
var start = Date.now();
var inputPath = this.inputPaths[0];
var previous = this._previousTree;
// get patchset
var input = walkSync.entries(inputPath, [ '**/*.js' ]);
debug('input: %d', input.length);
var next = this._previousTree = FSTree.fromEntries(input);
var patchset = previous.calculatePatch(next);
debug('patchset: %d', patchset.length);