mirror of https://github.com/webpack/webpack.git
code linting
This commit is contained in:
parent
330ca07fba
commit
8e69a80847
|
@ -8,6 +8,13 @@
|
|||
"rules": {
|
||||
"quotes": ["error", "double"],
|
||||
"no-undef": "error",
|
||||
"no-extra-semi": "error",
|
||||
"semi": "error",
|
||||
"no-template-curly-in-string": "error",
|
||||
"no-caller": "error",
|
||||
"yoda": "error",
|
||||
"eqeqeq": "error",
|
||||
"global-require": "off",
|
||||
"brace-style": "error",
|
||||
"eol-last": "error",
|
||||
"indent": ["error", "tab", { "SwitchCase": 1 }],
|
||||
|
|
|
@ -46,7 +46,7 @@ module.exports = function(yargs, argv, convertOptions) {
|
|||
}
|
||||
}
|
||||
return path.extname(configPath);
|
||||
}
|
||||
};
|
||||
|
||||
var mapConfigArg = function mapConfigArg(configArg) {
|
||||
var resolvedPath = path.resolve(configArg);
|
||||
|
@ -55,7 +55,7 @@ module.exports = function(yargs, argv, convertOptions) {
|
|||
path: resolvedPath,
|
||||
ext: extension
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var configArgList = Array.isArray(argv.config) ? argv.config : [argv.config];
|
||||
configFiles = configArgList.map(mapConfigArg);
|
||||
|
@ -90,7 +90,7 @@ module.exports = function(yargs, argv, convertOptions) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var requireConfig = function requireConfig(configPath) {
|
||||
var options = require(configPath);
|
||||
|
@ -102,7 +102,7 @@ module.exports = function(yargs, argv, convertOptions) {
|
|||
options = options(argv.env, argv);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
};
|
||||
|
||||
configFiles.forEach(function(file) {
|
||||
registerCompiler(interpret.extensions[file.ext]);
|
||||
|
@ -511,7 +511,7 @@ module.exports = function(yargs, argv, convertOptions) {
|
|||
} else {
|
||||
options.entry[name] = entry;
|
||||
}
|
||||
}
|
||||
};
|
||||
argv._.forEach(function(content) {
|
||||
var i = content.indexOf("=");
|
||||
var j = content.indexOf("?");
|
||||
|
|
|
@ -21,4 +21,4 @@ module.exports = function(module) {
|
|||
module.webpackPolyfill = 1;
|
||||
}
|
||||
return module;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -17,4 +17,4 @@ module.exports = {
|
|||
moveToParents: true
|
||||
})
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -20,4 +20,4 @@ module.exports = {
|
|||
})
|
||||
*/
|
||||
]
|
||||
};
|
||||
};
|
||||
|
|
|
@ -17,4 +17,4 @@ module.exports = {
|
|||
filename: "style.css"
|
||||
})
|
||||
]
|
||||
};
|
||||
};
|
||||
|
|
|
@ -7,4 +7,4 @@ module.exports = {
|
|||
resolve: {
|
||||
extensions: [".web.coffee", ".web.js", ".coffee", ".js"]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -17,4 +17,4 @@ module.exports = {
|
|||
allChunks: true
|
||||
})
|
||||
]
|
||||
};
|
||||
};
|
||||
|
|
|
@ -4,11 +4,11 @@ module.exports = {
|
|||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
context: path.join(__dirname, "..", "dll"),
|
||||
manifest: require("../dll/js/alpha-manifest.json")
|
||||
manifest: require("../dll/js/alpha-manifest.json") // eslint-disable-line
|
||||
}),
|
||||
new webpack.DllReferencePlugin({
|
||||
scope: "beta",
|
||||
manifest: require("../dll/js/beta-manifest.json"),
|
||||
manifest: require("../dll/js/beta-manifest.json"), // eslint-disable-line
|
||||
extensions: [".js", ".jsx"]
|
||||
})
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@ var path = require("path");
|
|||
var webpack = require("../../");
|
||||
module.exports = {
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx']
|
||||
extensions: [".js", ".jsx"]
|
||||
},
|
||||
entry: {
|
||||
alpha: ["./alpha", "./a", "module"],
|
||||
|
|
|
@ -13,4 +13,4 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var path = require("path");
|
||||
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new CommonsChunkPlugin({
|
||||
|
@ -15,4 +15,4 @@ module.exports = {
|
|||
async: true
|
||||
}),
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var path = require("path");
|
||||
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new CommonsChunkPlugin({
|
||||
|
@ -11,4 +11,4 @@ module.exports = {
|
|||
async: true
|
||||
})
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = {
|
|||
},
|
||||
output: {
|
||||
path: path.join(__dirname, "js"),
|
||||
publicPath: 'js/',
|
||||
publicPath: "js/",
|
||||
filename: "[name].bundle.js",
|
||||
chunkFilename: "[id].chunk.js"
|
||||
},
|
||||
|
@ -24,4 +24,4 @@ module.exports = {
|
|||
})
|
||||
// The pages cannot run without the commons.js file now.
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,4 +18,4 @@ module.exports = Object.keys(languages).map(function(language) {
|
|||
)
|
||||
]
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -36,4 +36,4 @@ module.exports = {
|
|||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -27,4 +27,4 @@ module.exports = [
|
|||
})
|
||||
]
|
||||
}
|
||||
];
|
||||
];
|
||||
|
|
|
@ -10,4 +10,4 @@ module.exports = {
|
|||
library: ["MyLibrary", "[name]"],
|
||||
libraryTarget: "umd"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -28,4 +28,4 @@ module.exports = {
|
|||
chunks: ["pageC", "adminPageC"]
|
||||
}),
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -33,4 +33,4 @@ module.exports = {
|
|||
filename: "[name].css"
|
||||
}),
|
||||
]
|
||||
};
|
||||
};
|
||||
|
|
|
@ -16,4 +16,4 @@ module.exports = {
|
|||
name: "commons"
|
||||
})
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,4 +18,4 @@ module.exports = {
|
|||
minChunks: Infinity
|
||||
})
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,4 +12,4 @@ module.exports = {
|
|||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,6 +25,6 @@ module.exports = function(updatedModules, renewedModules) {
|
|||
return typeof moduleId === "number";
|
||||
});
|
||||
if(numberIds)
|
||||
console.log("[HMR] Consider using the NamedModulesPlugin for module names.")
|
||||
console.log("[HMR] Consider using the NamedModulesPlugin for module names.");
|
||||
}
|
||||
};
|
||||
|
|
|
@ -26,7 +26,7 @@ if(module.hot) {
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
setInterval(checkForUpdate, hotPollInterval);
|
||||
} else {
|
||||
throw new Error("[HMR] Hot Module Replacement is disabled.");
|
||||
|
|
|
@ -34,7 +34,7 @@ if(module.hot) {
|
|||
console.warn("[HMR] Update failed: " + err.stack || err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
process.on(__resourceQuery.substr(1) || "SIGUSR2", function() {
|
||||
if(module.hot.status() !== "idle") {
|
||||
|
|
|
@ -40,4 +40,4 @@ module.exports = class CaseSensitiveModulesWarning extends Error {
|
|||
return message;
|
||||
}).join("\n");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ const byId = (a, b) => {
|
|||
if(a.id < b.id) return -1;
|
||||
if(b.id < a.id) return 1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
class Chunk {
|
||||
|
||||
|
@ -183,7 +183,7 @@ class Chunk {
|
|||
}
|
||||
onChunk(c);
|
||||
});
|
||||
}
|
||||
};
|
||||
moveChunks(other.parents, "chunks", c => {
|
||||
if(c !== this && this.addParent(c)) {
|
||||
c.addChunk(this);
|
||||
|
|
|
@ -187,7 +187,7 @@ function Compiler() {
|
|||
});
|
||||
});
|
||||
}.bind(this)
|
||||
}
|
||||
};
|
||||
|
||||
this.options = {};
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ const NullFactory = require("./NullFactory");
|
|||
const getQuery = (request) => {
|
||||
const i = request.indexOf("?");
|
||||
return request.indexOf("?") < 0 ? "" : request.substr(i);
|
||||
}
|
||||
};
|
||||
|
||||
class ConstPlugin {
|
||||
apply(compiler) {
|
||||
|
|
|
@ -77,7 +77,7 @@ ContextModule.prototype.libIdent = function(options) {
|
|||
if(this.addon)
|
||||
identifier += contextify(options, this.addon);
|
||||
if(this.regExp)
|
||||
identifier += prettyRegExp(this.regExp + "")
|
||||
identifier += prettyRegExp(this.regExp + "");
|
||||
return identifier.replace(/ $/, "");
|
||||
};
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ ContextModuleFactory.prototype.create = function(data, callback) {
|
|||
resolvers.loader.resolve({}, context, loader, function(err, result) {
|
||||
if(err) return callback(err);
|
||||
callback(null, result);
|
||||
})
|
||||
}, callback)
|
||||
});
|
||||
}, callback);
|
||||
}
|
||||
], function(err, result) {
|
||||
if(err) return callback(err);
|
||||
|
|
|
@ -12,7 +12,7 @@ function ContextReplacementPlugin(resourceRegExp, newContentResource, newContent
|
|||
} else if(typeof newContentResource === "string" && typeof newContentRecursive === "object") {
|
||||
this.newContentResource = newContentResource;
|
||||
this.newContentCreateContextMap = function(fs, callback) {
|
||||
callback(null, newContentRecursive)
|
||||
callback(null, newContentRecursive);
|
||||
};
|
||||
} else if(typeof newContentResource === "string" && typeof newContentRecursive === "function") {
|
||||
this.newContentResource = newContentResource;
|
||||
|
@ -99,5 +99,5 @@ function createResolveDependenciesFromContextMap(createContextMap) {
|
|||
});
|
||||
callback(null, dependencies);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ DelegatedModule.prototype.build = function(options, compilation, resolver, fs, c
|
|||
DelegatedModule.prototype.unbuild = function() {
|
||||
this.built = false;
|
||||
Module.prototype.unbuild.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
DelegatedModule.prototype.source = function() {
|
||||
var sourceModule = this.dependencies[0].module;
|
||||
|
|
|
@ -33,7 +33,7 @@ class DynamicEntryPlugin {
|
|||
if(err) return reject(err);
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
Promise.resolve(this.entry()).then((entry) => {
|
||||
|
@ -44,7 +44,7 @@ class DynamicEntryPlugin {
|
|||
return addEntry(entry[name], name);
|
||||
})).then(() => callback(), callback);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,4 @@ module.exports = class EntryOptionPlugin {
|
|||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ ExternalModuleFactoryPlugin.prototype.apply = function(normalModuleFactory) {
|
|||
return next();
|
||||
}
|
||||
callback(null, module);
|
||||
}
|
||||
};
|
||||
|
||||
do {
|
||||
var async = true;
|
||||
|
|
|
@ -13,7 +13,7 @@ FlagDependencyUsagePlugin.prototype.apply = function(compiler) {
|
|||
|
||||
modules.forEach(function(module) {
|
||||
module.used = false;
|
||||
})
|
||||
});
|
||||
|
||||
var queue = [];
|
||||
compilation.chunks.forEach(function(chunk) {
|
||||
|
|
|
@ -41,7 +41,7 @@ module.exports = function() {
|
|||
$require$[name] = value;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
for(var name in $require$) {
|
||||
if(Object.prototype.hasOwnProperty.call($require$, name)) {
|
||||
Object.defineProperty(fn, name, ObjectFactory(name));
|
||||
|
@ -263,7 +263,7 @@ module.exports = function() {
|
|||
return {
|
||||
chain: [id],
|
||||
id: id
|
||||
}
|
||||
};
|
||||
});
|
||||
while(queue.length > 0) {
|
||||
var queueItem = queue.pop();
|
||||
|
@ -277,7 +277,7 @@ module.exports = function() {
|
|||
type: "self-declined",
|
||||
chain: chain,
|
||||
moduleId: moduleId
|
||||
}
|
||||
};
|
||||
}
|
||||
if(module.hot._main) {
|
||||
return {
|
||||
|
@ -296,7 +296,7 @@ module.exports = function() {
|
|||
chain: chain.concat([parentId]),
|
||||
moduleId: moduleId,
|
||||
parentId: parentId
|
||||
}
|
||||
};
|
||||
}
|
||||
if(outdatedModules.indexOf(parentId) >= 0) continue;
|
||||
if(parent.hot._acceptedDependencies[moduleId]) {
|
||||
|
|
|
@ -20,4 +20,4 @@ module.exports = class ModuleDependencyError extends Error {
|
|||
this.origin = this.module = module;
|
||||
this.error = err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -20,4 +20,4 @@ module.exports = class ModuleDependencyWarning extends Error {
|
|||
this.origin = this.module = module;
|
||||
this.error = err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -9,4 +9,4 @@ module.exports = class ModuleReason {
|
|||
this.module = module;
|
||||
this.dependency = dependency;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ const Template = require("./Template");
|
|||
|
||||
module.exports = class ModuleTemplate extends Template {
|
||||
constructor(outputOptions) {
|
||||
super(outputOptions)
|
||||
super(outputOptions);
|
||||
}
|
||||
render(module, dependencyTemplates, chunk) {
|
||||
let moduleSource = module.source(dependencyTemplates, this.outputOptions, this.requestShortener);
|
||||
|
@ -18,6 +18,6 @@ module.exports = class ModuleTemplate extends Template {
|
|||
}
|
||||
updateHash(hash) {
|
||||
hash.update("1");
|
||||
this.applyPlugins("hash", hash)
|
||||
this.applyPlugins("hash", hash);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,4 +18,4 @@ module.exports = class MovedToPluginWarningPlugin {
|
|||
For more info about the usage of the ${pluginName} see https://webpack.github.io/docs/list-of-plugins.html`);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -135,7 +135,7 @@ MultiCompiler.prototype.watch = function(watchOptions, handler) {
|
|||
});
|
||||
compilerStatus.fill(true);
|
||||
var multiStats = new MultiStats(freshStats);
|
||||
handler(null, multiStats)
|
||||
handler(null, multiStats);
|
||||
}
|
||||
}
|
||||
if(firstRun && !err) {
|
||||
|
|
|
@ -36,4 +36,4 @@ module.exports = class MultiEntryPlugin {
|
|||
return dep;
|
||||
}), name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -188,7 +188,7 @@ NormalModule.prototype.build = function build(options, compilation, resolver, fs
|
|||
return typeof regExp === "string" ?
|
||||
_this.request.indexOf(regExp) === 0 :
|
||||
regExp.test(_this.request);
|
||||
}
|
||||
};
|
||||
if(Array.isArray(options.module.noParse)) {
|
||||
if(options.module.noParse.some(testRegExp, _this))
|
||||
return callback();
|
||||
|
@ -280,7 +280,7 @@ NormalModule.prototype.source = function(dependencyTemplates, outputOptions, req
|
|||
|
||||
varNames.length = 0;
|
||||
varExpressions.length = 0;
|
||||
}
|
||||
};
|
||||
vars.forEach(function(v) {
|
||||
if(varNames.indexOf(v.name) >= 0) emitFunction();
|
||||
varNames.push(v.name);
|
||||
|
|
|
@ -36,7 +36,7 @@ function identToLoaderRequest(resultString) {
|
|||
} else {
|
||||
return {
|
||||
loader: resultString
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ function NormalModuleFactory(context, resolvers, options) {
|
|||
if(typeof item.options === "string" && /^\?/.test(item.options)) {
|
||||
item.options = _this.ruleSet.findOptionsByIdent(item.options.substr(1));
|
||||
}
|
||||
})
|
||||
});
|
||||
} catch(e) {
|
||||
return callback(e);
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ NormalModuleFactory.prototype.resolveRequestArray = function resolveRequestArray
|
|||
};
|
||||
|
||||
NormalModuleFactory.prototype.getParser = function getParser(parserOptions) {
|
||||
var ident = "null"
|
||||
var ident = "null";
|
||||
if(parserOptions) {
|
||||
if(parserOptions.ident)
|
||||
ident = parserOptions.ident;
|
||||
|
|
|
@ -25,7 +25,7 @@ function setProperty(obj, name, value) {
|
|||
|
||||
class OptionsDefaulter {
|
||||
constructor() {
|
||||
this.defaults = {}
|
||||
this.defaults = {};
|
||||
this.config = {};
|
||||
}
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ Parser.prototype.initializeEvaluating = function() {
|
|||
var expr = this.evaluateExpression(expressions[i - 1]);
|
||||
if(!(expr.isString() || expr.isNumber())) continue;
|
||||
|
||||
prevExpr.setString(prevExpr.string + (expr.isString() ? expr.string : expr.number) + lastExpr.string)
|
||||
prevExpr.setString(prevExpr.string + (expr.isString() ? expr.string : expr.number) + lastExpr.string);
|
||||
prevExpr.setRange([prevExpr.range[0], lastExpr.range[1]]);
|
||||
parts.pop();
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ Parser.prototype.initializeEvaluating = function() {
|
|||
|
||||
this.plugin("evaluate TemplateLiteral", function(node) {
|
||||
var parts = getSimplifiedTemplateResult.call(this, "cooked", node.quasis, node.expressions);
|
||||
if(parts.length == 1) {
|
||||
if(parts.length === 1) {
|
||||
return parts[0].setRange(node.range);
|
||||
}
|
||||
return new BasicEvaluatedExpression().setTemplateString(parts).setRange(node.range);
|
||||
|
@ -692,10 +692,10 @@ Parser.prototype.walkExpression = function walkExpression(expression) {
|
|||
};
|
||||
|
||||
Parser.prototype.walkAwaitExpression = function walkAwaitExpression(expression) {
|
||||
var argument = expression.argument
|
||||
var argument = expression.argument;
|
||||
if(this["walk" + argument.type])
|
||||
return this["walk" + argument.type](argument);
|
||||
}
|
||||
};
|
||||
|
||||
Parser.prototype.walkArrayExpression = function walkArrayExpression(expression) {
|
||||
if(expression.elements)
|
||||
|
@ -959,7 +959,7 @@ Parser.prototype.inScope = function inScope(params, fn) {
|
|||
};
|
||||
|
||||
Parser.prototype.enterPattern = function enterPattern(pattern, onIdent) {
|
||||
if(pattern != null && this["enter" + pattern.type])
|
||||
if(pattern && this["enter" + pattern.type])
|
||||
return this["enter" + pattern.type](pattern, onIdent);
|
||||
};
|
||||
|
||||
|
@ -1100,7 +1100,7 @@ var POSSIBLE_AST_OPTIONS = [{
|
|||
plugins: {
|
||||
dynamicImport: true
|
||||
}
|
||||
}]
|
||||
}];
|
||||
|
||||
Parser.prototype.parse = function parse(source, initialState) {
|
||||
var ast, comments = [];
|
||||
|
|
|
@ -46,7 +46,7 @@ ProgressPlugin.prototype.apply = function(compiler) {
|
|||
activeModules.length + " active",
|
||||
activeModules[activeModules.length - 1]
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
var moduleDone = function moduleDone(module) {
|
||||
doneModules++;
|
||||
|
@ -56,7 +56,7 @@ ProgressPlugin.prototype.apply = function(compiler) {
|
|||
if(idx >= 0) activeModules.splice(idx, 1);
|
||||
}
|
||||
update();
|
||||
}
|
||||
};
|
||||
compiler.plugin("compilation", function(compilation) {
|
||||
if(compilation.compiler.isChild()) return;
|
||||
lastModulesCount = moduleCount;
|
||||
|
@ -151,7 +151,7 @@ ProgressPlugin.prototype.apply = function(compiler) {
|
|||
if(detail.length > 40) {
|
||||
detail = "..." + detail.substr(detail.length - 37);
|
||||
}
|
||||
msg += " " + detail
|
||||
msg += " " + detail;
|
||||
});
|
||||
}
|
||||
if(profile) {
|
||||
|
|
|
@ -11,7 +11,7 @@ const RawSource = require("webpack-sources").RawSource;
|
|||
module.exports = class RawModule extends Module {
|
||||
|
||||
constructor(source, identifier, readableIdentifier) {
|
||||
super()
|
||||
super();
|
||||
this.sourceStr = source;
|
||||
this.identifierStr = identifier || this.sourceStr;
|
||||
this.readableIdentifierStr = readableIdentifier || this.identifierStr;
|
||||
|
@ -47,4 +47,4 @@ module.exports = class RawModule extends Module {
|
|||
return new RawSource(this.sourceStr);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict"
|
||||
"use strict";
|
||||
|
||||
const ConstDependency = require("./dependencies/ConstDependency");
|
||||
const NullFactory = require("./NullFactory");
|
||||
|
@ -43,4 +43,4 @@ module.exports = class RequireJsStuffPlugin {
|
|||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -83,7 +83,7 @@ RuleSet.normalizeRules = function(rules, refs) {
|
|||
return RuleSet.normalizeRule(rule, refs);
|
||||
});
|
||||
} else if(rules) {
|
||||
return [RuleSet.normalizeRule(rules, refs)]
|
||||
return [RuleSet.normalizeRule(rules, refs)];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ RuleSet.normalizeRule = function(rule, refs) {
|
|||
RuleSet.buildErrorMessage = function buildErrorMessage(condition, error) {
|
||||
var conditionAsText = JSON.stringify(condition, function(key, value) {
|
||||
return value === undefined ? "undefined" : value;
|
||||
}, 2)
|
||||
}, 2);
|
||||
var message = error.message + " in " + conditionAsText;
|
||||
return message;
|
||||
};
|
||||
|
@ -232,7 +232,7 @@ RuleSet.normalizeUseItemFunction = function normalizeUseItemFunction(use, data)
|
|||
return RuleSet.normalizeUseItem(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
RuleSet.normalizeUseItemString = function normalizeUseItemString(useItemString) {
|
||||
var idx = useItemString.indexOf("?");
|
||||
|
@ -245,7 +245,7 @@ RuleSet.normalizeUseItemString = function normalizeUseItemString(useItemString)
|
|||
return {
|
||||
loader: useItemString
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
RuleSet.normalizeUseItem = function normalizeUseItem(item) {
|
||||
if(typeof item === "function")
|
||||
|
@ -274,7 +274,7 @@ RuleSet.normalizeUseItem = function normalizeUseItem(item) {
|
|||
});
|
||||
|
||||
return newItem;
|
||||
}
|
||||
};
|
||||
|
||||
RuleSet.normalizeCondition = function normalizeCondition(condition) {
|
||||
if(!condition)
|
||||
|
@ -337,7 +337,7 @@ RuleSet.normalizeCondition = function normalizeCondition(condition) {
|
|||
function notMatcher(matcher) {
|
||||
return function(str) {
|
||||
return !matcher(str);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function orMatcher(items) {
|
||||
|
@ -347,7 +347,7 @@ function orMatcher(items) {
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function andMatcher(items) {
|
||||
|
@ -357,7 +357,7 @@ function andMatcher(items) {
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
RuleSet.prototype.exec = function(data) {
|
||||
|
|
|
@ -32,4 +32,4 @@ class SingleEntryPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = SingleEntryPlugin
|
||||
module.exports = SingleEntryPlugin;
|
||||
|
|
|
@ -14,4 +14,4 @@ SizeFormatHelpers.formatSize = function(size) {
|
|||
|
||||
return +(size / Math.pow(1000, index))
|
||||
.toPrecision(3) + " " + abbreviations[index];
|
||||
}
|
||||
};
|
||||
|
|
18
lib/Stats.js
18
lib/Stats.js
|
@ -78,7 +78,7 @@ class Stats {
|
|||
}
|
||||
return i++ < maxModules;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const sortByField = (field) => {
|
||||
let callback;
|
||||
|
@ -105,7 +105,7 @@ class Stats {
|
|||
return a[field] < b[field] ? -1 : 1;
|
||||
};
|
||||
return callback;
|
||||
}
|
||||
};
|
||||
|
||||
const formatError = (e) => {
|
||||
let text = "";
|
||||
|
@ -141,7 +141,7 @@ class Stats {
|
|||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
const obj = {
|
||||
errors: compilation.errors.map(formatError),
|
||||
|
@ -401,13 +401,13 @@ class Stats {
|
|||
colors.yellow(`${time}ms`);
|
||||
else
|
||||
colors.red(`${time}ms`);
|
||||
}
|
||||
};
|
||||
|
||||
const newline = () => buf.push("\n");
|
||||
|
||||
const getText = (arr, row, col) => {
|
||||
return arr[row][col].value;
|
||||
}
|
||||
};
|
||||
|
||||
const table = (array, align, splitter) => {
|
||||
let row;
|
||||
|
@ -442,7 +442,7 @@ class Stats {
|
|||
}
|
||||
newline();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const getAssetColor = (asset, defaultColor) => {
|
||||
if(asset.isOverSizeLimit) {
|
||||
|
@ -450,7 +450,7 @@ class Stats {
|
|||
}
|
||||
|
||||
return defaultColor;
|
||||
}
|
||||
};
|
||||
|
||||
if(obj.hash) {
|
||||
colors.normal("Hash: ");
|
||||
|
@ -582,7 +582,7 @@ class Stats {
|
|||
colors.yellow(` [${module.warnings} warning${module.warnings === 1 ? "" : "s"}]`);
|
||||
if(module.errors)
|
||||
colors.red(` [${module.errors} error${module.errors === 1 ? "" : "s"}]`);
|
||||
}
|
||||
};
|
||||
|
||||
const processModuleContent = (module, prefix) => {
|
||||
if(Array.isArray(module.providedExports)) {
|
||||
|
@ -648,7 +648,7 @@ class Stats {
|
|||
coloredTime(sum);
|
||||
newline();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if(obj.chunks) {
|
||||
obj.chunks.forEach(chunk => {
|
||||
|
|
|
@ -37,20 +37,20 @@ const withHashLength = (replacer, handlerFn) => {
|
|||
const hash = replacer.apply(this, arguments);
|
||||
return length ? hash.slice(0, length) : hash;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const getReplacer = (value, allowEmpty) => {
|
||||
return function(match) {
|
||||
// last argument in replacer is the entire input string
|
||||
const input = arguments[arguments.length - 1];
|
||||
if(value == null) {
|
||||
if(value === null || value === undefined) {
|
||||
if(!allowEmpty) throw new Error(`Path variable ${match} not implemented in this context: ${input}`);
|
||||
return "";
|
||||
} else {
|
||||
return `${value}`;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const replacePathVariables = (path, data) => {
|
||||
const chunk = data.chunk;
|
||||
|
@ -72,7 +72,7 @@ const replacePathVariables = (path, data) => {
|
|||
.replace(REGEXP_FILEBASE, getReplacer(data.basename))
|
||||
// query is optional, it's OK if it's in a path but there's nothing to replace it with
|
||||
.replace(REGEXP_QUERY, getReplacer(data.query, true));
|
||||
}
|
||||
};
|
||||
|
||||
class TemplatedPathPlugin {
|
||||
apply(compiler) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict"
|
||||
"use strict";
|
||||
|
||||
const ConstDependency = require("./dependencies/ConstDependency");
|
||||
|
||||
|
@ -27,8 +27,8 @@ class UseStrictPlugin {
|
|||
parserInstance.state.module.strict = true;
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict"
|
||||
"use strict";
|
||||
|
||||
class WatchIgnorePlugin {
|
||||
constructor(paths) {
|
||||
|
|
|
@ -48,10 +48,10 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
|
|||
});
|
||||
this.set("output.library", "");
|
||||
this.set("output.hotUpdateFunction", "make", (options) => {
|
||||
return Template.toIdentifier("webpackHotUpdate" + options.output.library)
|
||||
return Template.toIdentifier("webpackHotUpdate" + options.output.library);
|
||||
});
|
||||
this.set("output.jsonpFunction", "make", (options) => {
|
||||
return Template.toIdentifier("webpackJsonp" + options.output.library)
|
||||
return Template.toIdentifier("webpackJsonp" + options.output.library);
|
||||
});
|
||||
this.set("output.libraryTarget", "var");
|
||||
this.set("output.path", process.cwd());
|
||||
|
|
|
@ -21,7 +21,7 @@ const getSchemaPart = (path, parents, additionalPath) => {
|
|||
schemaPart = inner;
|
||||
}
|
||||
return schemaPart;
|
||||
}
|
||||
};
|
||||
|
||||
const getSchemaPartText = (schemaPart, additionalPath) => {
|
||||
if(additionalPath) {
|
||||
|
@ -36,7 +36,7 @@ const getSchemaPartText = (schemaPart, additionalPath) => {
|
|||
if(schemaPart.description)
|
||||
schemaText += `\n${schemaPart.description}`;
|
||||
return schemaText;
|
||||
}
|
||||
};
|
||||
|
||||
const indent = (str, prefix, firstLine) => {
|
||||
if(firstLine) {
|
||||
|
@ -44,7 +44,7 @@ const indent = (str, prefix, firstLine) => {
|
|||
} else {
|
||||
return str.replace(/\n(?!$)/g, `\n${prefix}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class WebpackOptionsValidationError extends Error {
|
||||
|
||||
|
@ -69,7 +69,7 @@ class WebpackOptionsValidationError extends Error {
|
|||
if(!addSelf) return WebpackOptionsValidationError.formatSchema(innerSchema, prevSchemas);
|
||||
if(prevSchemas.indexOf(innerSchema) >= 0) return "(recursive)";
|
||||
return WebpackOptionsValidationError.formatSchema(innerSchema, prevSchemas.concat(schema));
|
||||
}
|
||||
};
|
||||
|
||||
if(schema.type === "string") {
|
||||
if(schema.minLength === 1)
|
||||
|
@ -146,7 +146,7 @@ class WebpackOptionsValidationError extends Error {
|
|||
} else if(err.keyword === "oneOf" || err.keyword === "anyOf") {
|
||||
if(err.children && err.children.length > 0) {
|
||||
return `${dataPath} should be one of these:\n${getSchemaPartText(err.parentSchema)}\n` +
|
||||
`Details:\n${err.children.map(err => " * " + indent(WebpackOptionsValidationError.formatValidationError(err), " ", false)).join("\n")}`
|
||||
`Details:\n${err.children.map(err => " * " + indent(WebpackOptionsValidationError.formatValidationError(err), " ", false)).join("\n")}`;
|
||||
}
|
||||
return `${dataPath} should be one of these:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
|
||||
|
|
|
@ -133,6 +133,6 @@ AMDDefineDependency.Template = class AMDDefineDependencyTemplate {
|
|||
if(texts.length > 0)
|
||||
throw new Error("Implementation error");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AMDDefineDependency;
|
||||
|
|
|
@ -51,6 +51,6 @@ AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate {
|
|||
|
||||
return webpackMissingModuleModule(dep.request);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AMDRequireArrayDependency;
|
||||
|
|
|
@ -30,4 +30,4 @@ module.exports = class AMDRequireDependenciesBlock extends AsyncDependenciesBloc
|
|||
dep.loc = loc;
|
||||
this.addDependency(dep);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -62,6 +62,6 @@ AMDRequireDependency.Template = class AMDRequireDependencyTemplate {
|
|||
source.replace(depBlock.functionRange[1], depBlock.outerRange[1] - 1, endBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AMDRequireDependency;
|
||||
|
|
|
@ -15,7 +15,7 @@ class CommonJsInHarmonyDependency extends NullDependency {
|
|||
}
|
||||
|
||||
get type() {
|
||||
return "cjs in harmony"
|
||||
return "cjs in harmony";
|
||||
}
|
||||
|
||||
get requireWebpackRequire() {
|
||||
|
|
|
@ -15,4 +15,4 @@ module.exports = class CommonJsInHarmonyWarning extends Error {
|
|||
|
||||
this.message = `${name} is not allowed in EcmaScript module: This module was detected as EcmaScript module (import or export syntax was used). In such a module using '${name}' is not allowed.`;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -27,6 +27,6 @@ ConstDependency.Template = class ConstDependencyTemplate {
|
|||
|
||||
source.replace(dep.range[0], dep.range[1] - 1, dep.expression);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ConstDependency;
|
||||
|
|
|
@ -10,7 +10,7 @@ var ContextDependencyHelpers = exports;
|
|||
* @return {string} Escaped string
|
||||
*/
|
||||
function quotemeta(str) {
|
||||
return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&")
|
||||
return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
|
||||
}
|
||||
|
||||
ContextDependencyHelpers.create = function(Dep, range, param, expr, options) {
|
||||
|
|
|
@ -13,7 +13,7 @@ ContextDependencyTemplateAsId.prototype.apply = function(dep, source, outputOpti
|
|||
if(Array.isArray(dep.replaces)) {
|
||||
for(var i = 0; i < dep.replaces.length; i++) {
|
||||
var rep = dep.replaces[i];
|
||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value)
|
||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
||||
}
|
||||
}
|
||||
source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
|
||||
|
|
|
@ -15,7 +15,7 @@ ContextDependencyTemplateAsRequireCall.prototype.apply = function(dep, source, o
|
|||
if(Array.isArray(dep.replaces)) {
|
||||
for(var i = 0; i < dep.replaces.length; i++) {
|
||||
var rep = dep.replaces[i];
|
||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value)
|
||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
||||
}
|
||||
}
|
||||
source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
|
||||
|
|
|
@ -37,6 +37,6 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate {
|
|||
|
||||
source.insert(dep.range[1] - 0.5, `, function() { ${content} }`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyAcceptDependency;
|
||||
|
|
|
@ -17,6 +17,6 @@ class HarmonyAcceptImportDependency extends HarmonyImportDependency {
|
|||
|
||||
HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyAcceptImportDependency;
|
||||
|
|
|
@ -24,6 +24,6 @@ HarmonyCompatiblilityDependency.Template = class HarmonyExportDependencyTemplate
|
|||
source.insert(-1, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyCompatiblilityDependency;
|
||||
|
|
|
@ -51,6 +51,6 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|||
}
|
||||
return "/* unused harmony default export */ var _unused_webpack_default_export = ";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyExportExpressionDependency;
|
||||
|
|
|
@ -23,6 +23,6 @@ HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate {
|
|||
const replaceUntil = dep.range ? dep.range[0] - 1 : dep.rangeStatement[1] - 1;
|
||||
source.replace(dep.rangeStatement[0], replaceUntil, content);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyExportHeaderDependency;
|
||||
|
|
|
@ -61,7 +61,7 @@ class HarmonyExportImportedSpecifierDependency extends NullDependency {
|
|||
const inProvidedExports = importedModule.providedExports.indexOf(id) >= 0;
|
||||
return notInActiveExports && notDefault && inProvidedExports;
|
||||
}),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -71,27 +71,27 @@ class HarmonyExportImportedSpecifierDependency extends NullDependency {
|
|||
const notDefault = id !== "default";
|
||||
return notInActiveExports && notDefault;
|
||||
}),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if(Array.isArray(importedModule.providedExports)) {
|
||||
return {
|
||||
module: importedModule,
|
||||
importedNames: importedModule.providedExports.filter(id => id !== "default"),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
module: importedModule,
|
||||
importedNames: true,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
getExports() {
|
||||
if(this.name) {
|
||||
return {
|
||||
exports: [this.name]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const importedModule = this.importDependency.module;
|
||||
|
@ -129,7 +129,7 @@ class HarmonyExportImportedSpecifierDependency extends NullDependency {
|
|||
return {
|
||||
exportedName: importedModule.providedExports,
|
||||
precedence: 3
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -260,7 +260,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|||
reexportStatementCreator(importsExportsUnknown, name) {
|
||||
const getReexportStatement = (key, valueKey) => {
|
||||
const conditional = this.getConditional(importsExportsUnknown, valueKey, name);
|
||||
const returnValue = this.getReturnValue(valueKey)
|
||||
const returnValue = this.getReturnValue(valueKey);
|
||||
return `${conditional}__webpack_require__.d(exports, ${key}, function() { return ${name}${returnValue}; });\n`;
|
||||
};
|
||||
return getReexportStatement;
|
||||
|
@ -281,4 +281,4 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|||
|
||||
return valueKey && "[" + valueKey + "]";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -61,6 +61,6 @@ HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependen
|
|||
|
||||
return `/* harmony export (binding) */ __webpack_require__.d(exports, ${JSON.stringify(used)}, function() { return ${dep.id}; });\n`;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyExportSpecifierDependency;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict"
|
||||
"use strict";
|
||||
var ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
class HarmonyImportDependency extends ModuleDependency {
|
||||
|
@ -37,7 +37,7 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate {
|
|||
source.replace(dep.range[0], dep.range[1] - 1, "");
|
||||
source.insert(-1, content);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function getOptionalComment(pathinfo, shortenedRequest) {
|
||||
if(!pathinfo) {
|
||||
|
|
|
@ -78,7 +78,7 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
|
|||
}
|
||||
|
||||
if(dep.call && dep.id) {
|
||||
return `${shortHandPrefix}__webpack_require__.i(${importedVar}${importedVarSuffix})`
|
||||
return `${shortHandPrefix}__webpack_require__.i(${importedVar}${importedVarSuffix})`;
|
||||
}
|
||||
|
||||
return `${shortHandPrefix}${importedVar}${importedVarSuffix}`;
|
||||
|
@ -105,6 +105,6 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
|
|||
|
||||
return dep.name + ": ";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyImportSpecifierDependency;
|
||||
|
|
|
@ -62,7 +62,7 @@ HarmonyModulesHelpers.getActiveExports = function(module, currentDependency) {
|
|||
return {
|
||||
dep: dep,
|
||||
idx: idx
|
||||
}
|
||||
};
|
||||
}).reduce(function(arr, data) {
|
||||
var dep = data.dep;
|
||||
if(!dep.describeHarmonyExport) return arr;
|
||||
|
|
|
@ -14,4 +14,4 @@ module.exports = class ImportDependenciesBlock extends AsyncDependenciesBlock {
|
|||
dep.loc = loc;
|
||||
this.addDependency(dep);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -49,6 +49,6 @@ ImportDependency.Template = class ImportDependencyTemplate {
|
|||
|
||||
return webpackMissingPromiseModule(dep.request);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ImportDependency;
|
||||
|
|
|
@ -19,6 +19,6 @@ LocalModuleDependency.Template = class LocalModuleDependencyTemplate {
|
|||
if(!dep.range) return;
|
||||
source.replace(dep.range[0], dep.range[1] - 1, dep.localModule.variableName());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = LocalModuleDependency;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict"
|
||||
"use strict";
|
||||
const Dependency = require("../Dependency");
|
||||
|
||||
class ModuleDependency extends Dependency {
|
||||
|
|
|
@ -19,6 +19,6 @@ class NullDependency extends Dependency {
|
|||
|
||||
NullDependency.Template = class NullDependencyTemplate {
|
||||
apply() {}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = NullDependency;
|
||||
|
|
|
@ -17,4 +17,4 @@ module.exports = class RequireEnsureDependenciesBlock extends AsyncDependenciesB
|
|||
dep.loc = loc;
|
||||
this.addDependency(dep);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -26,6 +26,6 @@ RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate {
|
|||
source.replace(depBlock.expr.range[0], depBlock.expr.arguments[1].range[0] - 1, startBlock);
|
||||
source.replace(depBlock.expr.arguments[1].range[1], depBlock.expr.range[1] - 1, endBlock);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RequireEnsureDependency;
|
||||
|
|
|
@ -21,6 +21,6 @@ RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate {
|
|||
applyAsTemplateArgument(name, dep, source) {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "require");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RequireHeaderDependency;
|
||||
|
|
|
@ -28,6 +28,6 @@ RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate {
|
|||
}
|
||||
return `/*! require.include ${shortenedRequest} */`;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RequireIncludeDependency;
|
||||
|
|
|
@ -16,6 +16,6 @@ module.exports = class RequireIncludeDependencyParserPlugin {
|
|||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,6 +21,6 @@ RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTe
|
|||
applyAsTemplateArgument(name, dep, source) {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RequireResolveHeaderDependency;
|
||||
|
|
|
@ -18,6 +18,6 @@ UnsupportedDependency.Template = class UnsupportedDependencyTemplate {
|
|||
apply(dep, source, outputOptions, requestShortener) {
|
||||
source.replace(dep.range[0], dep.range[1], webpackMissingModule(dep.request));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = UnsupportedDependency;
|
||||
|
|
|
@ -14,31 +14,31 @@ function makeRelative(context) {
|
|||
return path.relative(context, str);
|
||||
}).join("!");
|
||||
}).join("|");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function toIndexOf(list) {
|
||||
return function(item) {
|
||||
return list.indexOf(item);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function toChunkModuleIndices(modules) {
|
||||
return function(idx) {
|
||||
return modules[idx];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function moveModuleBetween(oldChunk, newChunk) {
|
||||
return function(module) {
|
||||
oldChunk.moveModule(module, newChunk);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function isNotAEntryModule(entryModule) {
|
||||
return function(module) {
|
||||
return entryModule !== module;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function copyWithReason(obj) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict"
|
||||
"use strict";
|
||||
class ChunkModuleIdRangePlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
|
|
|
@ -114,7 +114,7 @@ CommonsChunkPlugin.prototype.apply = function(compiler) {
|
|||
}
|
||||
});
|
||||
});
|
||||
var _minChunks = (minChunks || Math.max(2, usedChunks.length))
|
||||
var _minChunks = (minChunks || Math.max(2, usedChunks.length));
|
||||
commonModulesCount.forEach(function(count, idx) {
|
||||
var module = commonModules[idx];
|
||||
if(typeof minChunks === "function") {
|
||||
|
|
|
@ -64,7 +64,7 @@ function exportPlugins(exports, path, plugins) {
|
|||
configurable: false,
|
||||
enumerable: true,
|
||||
get() {
|
||||
return require(`${path}/${name}`)
|
||||
return require(`${path}/${name}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -47,7 +47,7 @@ module.exports = function() {
|
|||
}
|
||||
resolve(update);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
"build:examples": "cd examples && node buildAll.js",
|
||||
"pretest": "npm run lint-files",
|
||||
"lint-files": "npm run lint && npm run beautify-lint",
|
||||
"lint": "eslint lib bin hot buildin",
|
||||
"lint": "eslint lib bin hot buildin test/**/webpack.config.js test/binCases/**/test.js examples/**/webpack.config.js",
|
||||
"beautify-lint": "beautify-lint 'lib/**/*.js' 'hot/**/*.js' 'bin/**/*.js' 'benchmark/*.js' 'test/*.js'",
|
||||
"nsp": "nsp check --output summary",
|
||||
"cover": "node --harmony ./node_modules/.bin/istanbul cover -x '**/*.runtime.js' node_modules/mocha/bin/_mocha",
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue