Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Author Tobias Koppers @sokra
*/
var async = require("async");
var path = require("path");
var Tapable = require("tapable");
var ContextModule = require("./ContextModule");
var ContextElementDependency = require("./dependencies/ContextElementDependency");
function ContextModuleFactory(resolvers) {
Tapable.call(this);
this.resolvers = resolvers;
}
module.exports = ContextModuleFactory;
ContextModuleFactory.prototype = Object.create(Tapable.prototype);
ContextModuleFactory.prototype.constructor = ContextModuleFactory;
ContextModuleFactory.prototype.create = function(context, dependency, callback) {
this.applyPluginsAsyncWaterfall("before-resolve", {
context: context,
request: dependency.request,
recursive: dependency.recursive,
regExp: dependency.regExp
}, function(err, result) {
if(err) return callback(err);
// Ignored
if(!result) return callback();
var context = result.context;
var request = result.request;
Author Tobias Koppers @sokra
*/
var acorn = require("acorn-dynamic-import").default;
var Tapable = require("tapable");
var BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
function Parser(options) {
Tapable.call(this);
this.options = options;
this.initializeEvaluating();
}
module.exports = Parser;
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
Parser.prototype = Object.create(Tapable.prototype);
Parser.prototype.constructor = Parser;
Parser.prototype.initializeEvaluating = function() {
function joinRanges(startRange, endRange) {
if(!endRange) return startRange;
if(!startRange) return endRange;
return [startRange[0], endRange[1]];
}
this.plugin("evaluate Literal", function(expr) {
switch(typeof expr.value) {
case "number":
return new BasicEvaluatedExpression().setNumber(expr.value).setRange(expr.range);
case "string":
return new BasicEvaluatedExpression().setString(expr.value).setRange(expr.range);
case "boolean":
return new BasicEvaluatedExpression().setBoolean(expr.value).setRange(expr.range);
Author Tobias Koppers @sokra
*/
var async = require("async");
var path = require("path");
var Tapable = require("tapable");
var ContextModule = require("./ContextModule");
var ContextElementDependency = require("./dependencies/ContextElementDependency");
function ContextModuleFactory(resolvers) {
Tapable.call(this);
this.resolvers = resolvers;
}
module.exports = ContextModuleFactory;
ContextModuleFactory.prototype = Object.create(Tapable.prototype);
ContextModuleFactory.prototype.constructor = ContextModuleFactory;
ContextModuleFactory.prototype.create = function(context, dependency, callback) {
this.applyPluginsAsyncWaterfall("before-resolve", {
context: context,
request: dependency.request,
recursive: dependency.recursive,
regExp: dependency.regExp
}, function(err, result) {
if(err) return callback(err);
// Ignored
if(!result) return callback();
var context = result.context;
var request = result.request;
Author Tobias Koppers @sokra
*/
var acorn = require("acorn-dynamic-import").default;
var Tapable = require("tapable");
var BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
function Parser(options) {
Tapable.call(this);
this.options = options;
this.initializeEvaluating();
}
module.exports = Parser;
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
Parser.prototype = Object.create(Tapable.prototype);
Parser.prototype.constructor = Parser;
Parser.prototype.initializeEvaluating = function() {
function joinRanges(startRange, endRange) {
if(!endRange) return startRange;
if(!startRange) return endRange;
return [startRange[0], endRange[1]];
}
this.plugin("evaluate Literal", function(expr) {
switch(typeof expr.value) {
case "number":
return new BasicEvaluatedExpression().setNumber(expr.value).setRange(expr.range);
case "string":
return new BasicEvaluatedExpression().setString(expr.value).setRange(expr.range);
case "boolean":
return new BasicEvaluatedExpression().setBoolean(expr.value).setRange(expr.range);
Author Tobias Koppers @sokra
*/
var acorn = require("acorn");
var Tapable = require("tapable");
var BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
function Parser(options) {
Tapable.call(this);
this.options = options;
this.initializeEvaluating();
}
module.exports = Parser;
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
Parser.prototype = Object.create(Tapable.prototype);
Parser.prototype.constructor = Parser;
Parser.prototype.initializeEvaluating = function() {
function joinRanges(startRange, endRange) {
if(!endRange) return startRange;
if(!startRange) return endRange;
return [startRange[0], endRange[1]];
}
this.plugin("evaluate Literal", function(expr) {
switch(typeof expr.value) {
case "number":
return new BasicEvaluatedExpression().setNumber(expr.value).setRange(expr.range);
case "string":
return new BasicEvaluatedExpression().setString(expr.value).setRange(expr.range);
case "boolean":
return new BasicEvaluatedExpression().setBoolean(expr.value).setRange(expr.range);
Author Tobias Koppers @sokra
*/
var async = require("async");
var path = require("path");
var Tapable = require("tapable");
var ContextModule = require("./ContextModule");
var ContextElementDependency = require("./dependencies/ContextElementDependency");
function ContextModuleFactory(resolvers) {
Tapable.call(this);
this.resolvers = resolvers;
}
module.exports = ContextModuleFactory;
ContextModuleFactory.prototype = Object.create(Tapable.prototype);
ContextModuleFactory.prototype.constructor = ContextModuleFactory;
ContextModuleFactory.prototype.create = function(data, callback) {
var module = this;
var context = data.context;
var dependencies = data.dependencies;
var dependency = dependencies[0];
this.applyPluginsAsyncWaterfall("before-resolve", {
context: context,
request: dependency.request,
recursive: dependency.recursive,
regExp: dependency.regExp,
async: dependency.async,
dependencies: dependencies
}, function(err, result) {
if(err) return callback(err);
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var Tapable = require("tapable");
var DllModule = require("./DllModule");
function DllModuleFactory() {
Tapable.call(this);
}
module.exports = DllModuleFactory;
DllModuleFactory.prototype = Object.create(Tapable.prototype);
DllModuleFactory.prototype.constructor = DllModuleFactory;
DllModuleFactory.prototype.create = function(context, dependency, callback) {
callback(null, new DllModule(context, dependency.dependencies, dependency.name, dependency.type));
};
if(doneCompilers === this.compilers.length) {
this.applyPlugins("done", new MultiStats(compilerStats));
}
}.bind(this));
compiler.plugin("invalid", function() {
if(compilerDone) {
compilerDone = false;
doneCompilers--;
}
this.applyPlugins("invalid");
}.bind(this));
}, this);
}
module.exports = MultiCompiler;
MultiCompiler.prototype = Object.create(Tapable.prototype);
MultiCompiler.prototype.constructor = MultiCompiler;
MultiCompiler.prototype.watch = function(watchDelay, handler) {
var watchings = this.compilers.map(function(compiler) {
return compiler.watch(watchDelay, handler);
});
return new MultiWatching(watchings);
};
MultiCompiler.prototype.run = function(callback) {
async.map(this.compilers, function(compiler, callback) {
compiler.run(callback);
}, function(err, stats) {
if(err) return callback(err);
callback(null, new MultiStats(stats));
});
this.records = null;
this.nextFreeModuleId = 1;
this.nextFreeChunkId = 0;
this.nextFreeModuleIndex = 0;
this.nextFreeModuleIndex2 = 0;
this.additionalChunkAssets = [];
this.assets = {};
this.errors = [];
this.warnings = [];
this.children = [];
this.dependencyFactories = new ArrayMap();
this.dependencyTemplates = new ArrayMap();
}
module.exports = Compilation;
Compilation.prototype = Object.create(Tapable.prototype);
Compilation.prototype.templatesPlugin = function(name, fn) {
this.mainTemplate.plugin(name, fn);
this.chunkTemplate.plugin(name, fn);
};
Compilation.prototype.addModule = function(module, cacheGroup) {
cacheGroup = cacheGroup || "m";
var identifier = module.identifier();
if(this._modules[identifier]) {
return false;
}
if(this.cache && this.cache[cacheGroup + identifier]) {
var cacheModule = this.cache[cacheGroup + identifier];
var rebuild = true;
if(!cacheModule.error && cacheModule.cacheable && this.fileTimestamps && this.contextTimestamps) {
this._modules = {};
this.cache = null;
this.records = null;
this.nextFreeModuleId = 1;
this.nextFreeChunkId = 0;
this.additionalChunkAssets = [];
this.assets = {};
this.errors = [];
this.warnings = [];
this.children = [];
this.dependencyFactories = new ArrayMap();
this.dependencyTemplates = new ArrayMap();
}
module.exports = Compilation;
Compilation.prototype = Object.create(Tapable.prototype);
Compilation.prototype.templatesPlugin = function(name, fn) {
this.mainTemplate.plugin(name, fn);
this.chunkTemplate.plugin(name, fn);
};
Compilation.prototype.addModule = function(module, cacheGroup) {
cacheGroup = cacheGroup || "m";
var identifier = module.identifier();
if(this._modules[identifier]) {
return false;
}
if(this.cache && this.cache[cacheGroup + identifier]) {
var cacheModule = this.cache[cacheGroup + identifier];
var rebuild = true;
if(!cacheModule.error && cacheModule.cacheable && this.fileTimestamps && this.contextTimestamps) {