mirror of https://github.com/webpack/webpack.git
Prettify source code
This commit is contained in:
parent
093d93fcb8
commit
b25ff237bb
|
@ -206,8 +206,8 @@ const tests = {
|
|||
const suite = new Benchmark.Suite();
|
||||
|
||||
Object.keys(tests)
|
||||
.filter(
|
||||
name => (process.argv.length > 2 ? name.includes(process.argv[2]) : true)
|
||||
.filter(name =>
|
||||
process.argv.length > 2 ? name.includes(process.argv[2]) : true
|
||||
)
|
||||
.forEach(name => {
|
||||
const test = tests[name];
|
||||
|
|
|
@ -15,7 +15,7 @@ export type Entry = EntryDynamic | EntryStatic;
|
|||
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
||||
* via the `definition` "EntryDynamic".
|
||||
*/
|
||||
export type EntryDynamic = (() => EntryStatic | Promise<EntryStatic>);
|
||||
export type EntryDynamic = () => EntryStatic | Promise<EntryStatic>;
|
||||
/**
|
||||
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
||||
* via the `definition` "EntryStatic".
|
||||
|
|
|
@ -11,15 +11,13 @@ export type BannerPluginArgument =
|
|||
/**
|
||||
* The banner as function, it will be wrapped in a comment
|
||||
*/
|
||||
export type BannerFunction = (
|
||||
data: {
|
||||
export type BannerFunction = (data: {
|
||||
hash: string;
|
||||
chunk: import("../../lib/Chunk");
|
||||
filename: string;
|
||||
basename: string;
|
||||
query: string;
|
||||
}
|
||||
) => string;
|
||||
}) => string;
|
||||
export type Rules = Rule[] | Rule;
|
||||
export type Rule = RegExp | string;
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ export type IgnorePluginOptions =
|
|||
/**
|
||||
* A filter function for context
|
||||
*/
|
||||
checkContext?: ((context: string) => boolean);
|
||||
checkContext?: (context: string) => boolean;
|
||||
/**
|
||||
* A filter function for resource and context
|
||||
*/
|
||||
checkResource?: ((resource: string, context: string) => boolean);
|
||||
checkResource?: (resource: string, context: string) => boolean;
|
||||
};
|
||||
|
|
|
@ -8,11 +8,11 @@ export type ProgressPluginArgument = ProgressPluginOptions | HandlerFunction;
|
|||
/**
|
||||
* Function that executes for every progress step
|
||||
*/
|
||||
export type HandlerFunction = ((
|
||||
export type HandlerFunction = (
|
||||
percentage: number,
|
||||
msg: string,
|
||||
...args: string[]
|
||||
) => void);
|
||||
) => void;
|
||||
|
||||
export interface ProgressPluginOptions {
|
||||
/**
|
||||
|
|
|
@ -40,8 +40,8 @@ class AmdMainTemplatePlugin {
|
|||
const onRenderWithEntry = (source, chunk, hash) => {
|
||||
const externals = chunk.getModules().filter(m => m.external);
|
||||
const externalsDepsArray = JSON.stringify(
|
||||
externals.map(
|
||||
m => (typeof m.request === "object" ? m.request.amd : m.request)
|
||||
externals.map(m =>
|
||||
typeof m.request === "object" ? m.request.amd : m.request
|
||||
)
|
||||
);
|
||||
const externalsArguments = externals
|
||||
|
|
|
@ -12,9 +12,8 @@ const stringifySafe = data => {
|
|||
return undefined; // Invalid JSON
|
||||
}
|
||||
|
||||
return stringified.replace(
|
||||
/\u2028|\u2029/g,
|
||||
str => (str === "\u2029" ? "\\u2029" : "\\u2028")
|
||||
return stringified.replace(/\u2028|\u2029/g, str =>
|
||||
str === "\u2029" ? "\\u2029" : "\\u2028"
|
||||
); // invalid in JavaScript but valid JSON
|
||||
};
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ class IgnoringWatchFileSystem {
|
|||
|
||||
watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) {
|
||||
const ignored = path =>
|
||||
this.paths.some(
|
||||
p => (p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0)
|
||||
this.paths.some(p =>
|
||||
p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0
|
||||
);
|
||||
|
||||
const notIgnored = path => !ignored(path);
|
||||
|
|
|
@ -33,10 +33,8 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
|
|||
|
||||
this.set("entry", "./src");
|
||||
|
||||
this.set(
|
||||
"devtool",
|
||||
"make",
|
||||
options => (options.mode === "development" ? "eval" : false)
|
||||
this.set("devtool", "make", options =>
|
||||
options.mode === "development" ? "eval" : false
|
||||
);
|
||||
this.set("cache", "make", options => options.mode === "development");
|
||||
|
||||
|
@ -193,10 +191,8 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
|
|||
});
|
||||
this.set("performance.maxAssetSize", 250000);
|
||||
this.set("performance.maxEntrypointSize", 250000);
|
||||
this.set(
|
||||
"performance.hints",
|
||||
"make",
|
||||
options => (isProductionLikeMode(options) ? "warning" : false)
|
||||
this.set("performance.hints", "make", options =>
|
||||
isProductionLikeMode(options) ? "warning" : false
|
||||
);
|
||||
|
||||
this.set("optimization", "call", value => Object.assign({}, value));
|
||||
|
|
|
@ -96,9 +96,7 @@ class StackedSetMap {
|
|||
|
||||
asPairArray() {
|
||||
this._compress();
|
||||
return Array.from(
|
||||
this.map.entries(),
|
||||
pair =>
|
||||
return Array.from(this.map.entries(), pair =>
|
||||
/** @type {[TODO, TODO]} */ (pair[1] === UNDEFINED_MARKER
|
||||
? [pair[0], undefined]
|
||||
: pair)
|
||||
|
|
|
@ -156,8 +156,8 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|||
// We hit an edgecase where the working set is already smaller than minSize
|
||||
// We merge it with the smallest result node to keep minSize intact
|
||||
if (result.length > 0) {
|
||||
const smallestGroup = result.reduce(
|
||||
(min, group) => (min.size > group.size ? group : min)
|
||||
const smallestGroup = result.reduce((min, group) =>
|
||||
min.size > group.size ? group : min
|
||||
);
|
||||
for (const node of initialGroup.nodes) smallestGroup.nodes.push(node);
|
||||
smallestGroup.nodes.sort((a, b) => {
|
||||
|
|
|
@ -36,8 +36,7 @@ const normalizePathSeparator = p => p.replace(/\\/g, "/");
|
|||
const _makePathsRelative = (context, identifier) => {
|
||||
return identifier
|
||||
.split(/([|! ])/)
|
||||
.map(
|
||||
str =>
|
||||
.map(str =>
|
||||
looksLikeAbsolutePath(str)
|
||||
? normalizePathSeparator(path.relative(context, str))
|
||||
: str
|
||||
|
|
Loading…
Reference in New Issue