mirror of https://github.com/webpack/webpack.git
Merge branch 'master' of https://github.com/webpack/webpack into jest
# Conflicts: # test/Chunk.unittest.js # test/NullDependency.unittest.js # test/SourceMapDevToolModuleOptionsPlugin.unittest.js # yarn.lock
This commit is contained in:
commit
11ad57c045
|
@ -9,25 +9,23 @@ declare namespace NodeJS {
|
|||
}
|
||||
|
||||
// There are no typings for chrome-trace-event
|
||||
declare module 'chrome-trace-event' {
|
||||
declare module "chrome-trace-event" {
|
||||
interface Event {
|
||||
name: string
|
||||
id?: number
|
||||
cat: string[]
|
||||
args?: Object
|
||||
name: string;
|
||||
id?: number;
|
||||
cat: string[];
|
||||
args?: Object;
|
||||
}
|
||||
|
||||
export class Tracer {
|
||||
constructor(options: {
|
||||
noStream: boolean
|
||||
})
|
||||
pipe(stream: NodeJS.WritableStream) : void
|
||||
instantEvent(event: Event) : void
|
||||
counter: number
|
||||
constructor(options: { noStream: boolean });
|
||||
pipe(stream: NodeJS.WritableStream): void;
|
||||
instantEvent(event: Event): void;
|
||||
counter: number;
|
||||
trace: {
|
||||
begin(event: Event) : void
|
||||
end(event: Event) : void
|
||||
}
|
||||
begin(event: Event): void;
|
||||
end(event: Event): void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,9 @@ class Stats {
|
|||
const optionOrLocalFallback = (v, def) =>
|
||||
typeof v !== "undefined"
|
||||
? v
|
||||
: typeof options.all !== "undefined" ? options.all : def;
|
||||
: typeof options.all !== "undefined"
|
||||
? options.all
|
||||
: def;
|
||||
|
||||
const testAgainstGivenOption = item => {
|
||||
if (typeof item === "string") {
|
||||
|
@ -266,7 +268,9 @@ class Stats {
|
|||
text += `chunk ${e.chunk.name || e.chunk.id}${
|
||||
e.chunk.hasRuntime()
|
||||
? " [entry]"
|
||||
: e.chunk.canBeInitial() ? " [initial]" : ""
|
||||
: e.chunk.canBeInitial()
|
||||
? " [initial]"
|
||||
: ""
|
||||
}\n`;
|
||||
}
|
||||
if (e.file) {
|
||||
|
|
|
@ -235,7 +235,9 @@ class WebpackOptionsApply extends OptionsApply {
|
|||
"MappingURL=[url]\n*/"
|
||||
: legacy
|
||||
? "\n/*\n//@ source" + "MappingURL=[url]\n*/"
|
||||
: modern ? "\n//# source" + "MappingURL=[url]" : null;
|
||||
: modern
|
||||
? "\n//# source" + "MappingURL=[url]"
|
||||
: null;
|
||||
let Plugin = evalWrapped
|
||||
? EvalSourceMapDevToolPlugin
|
||||
: SourceMapDevToolPlugin;
|
||||
|
@ -259,7 +261,9 @@ class WebpackOptionsApply extends OptionsApply {
|
|||
? "\n//@ sourceURL=[url]\n//# sourceURL=[url]"
|
||||
: legacy
|
||||
? "\n//@ sourceURL=[url]"
|
||||
: modern ? "\n//# sourceURL=[url]" : null;
|
||||
: modern
|
||||
? "\n//# sourceURL=[url]"
|
||||
: null;
|
||||
new EvalDevToolModulePlugin({
|
||||
sourceUrlComment: comment,
|
||||
moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
|
||||
|
|
|
@ -291,11 +291,15 @@ module.exports = class SplitChunksPlugin {
|
|||
minSize:
|
||||
cacheGroupSource.minSize !== undefined
|
||||
? cacheGroupSource.minSize
|
||||
: cacheGroupSource.enforce ? 0 : this.options.minSize,
|
||||
: cacheGroupSource.enforce
|
||||
? 0
|
||||
: this.options.minSize,
|
||||
minChunks:
|
||||
cacheGroupSource.minChunks !== undefined
|
||||
? cacheGroupSource.minChunks
|
||||
: cacheGroupSource.enforce ? 1 : this.options.minChunks,
|
||||
: cacheGroupSource.enforce
|
||||
? 1
|
||||
: this.options.minChunks,
|
||||
maxAsyncRequests:
|
||||
cacheGroupSource.maxAsyncRequests !== undefined
|
||||
? cacheGroupSource.maxAsyncRequests
|
||||
|
|
|
@ -3,10 +3,47 @@
|
|||
const NullDependency = require("../lib/dependencies/NullDependency");
|
||||
|
||||
describe("NullDependency", () => {
|
||||
let env;
|
||||
|
||||
beforeEach(() => (env = {}));
|
||||
|
||||
it("is a function", () => {
|
||||
expect(NullDependency).toBeTypeOf("function");
|
||||
});
|
||||
|
||||
describe("when created", () => {
|
||||
beforeEach(() => (env.nullDependency = new NullDependency()));
|
||||
|
||||
it("has a null type", () => {
|
||||
const nullDependency = new NullDependency();
|
||||
expect(nullDependency.type).toBe("null");
|
||||
expect(env.nullDependency.type).toBe("null");
|
||||
});
|
||||
|
||||
it("has update hash function", () => {
|
||||
expect(env.nullDependency.updateHash).toBeTypeOf("function");
|
||||
});
|
||||
|
||||
it("does not update hash", () => {
|
||||
const hash = {
|
||||
update: jest.fn()
|
||||
};
|
||||
env.nullDependency.updateHash(hash);
|
||||
expect(hash.update).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Template", () => {
|
||||
it("is a function", () => {
|
||||
expect(NullDependency.Template).toBeTypeOf("function");
|
||||
});
|
||||
|
||||
describe("when created", () => {
|
||||
beforeEach(() => {
|
||||
env.nullDependencyTemplate = new NullDependency.Template();
|
||||
});
|
||||
|
||||
it("has apply function", () => {
|
||||
expect(env.nullDependencyTemplate.apply).toBeTypeOf("function");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue