webpack 4.20.2 → 4.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +20 -20
  2. package/SECURITY.md +9 -9
  3. package/buildin/amd-define.js +3 -3
  4. package/buildin/amd-options.js +2 -2
  5. package/buildin/global.js +20 -20
  6. package/buildin/module.js +22 -22
  7. package/buildin/system.js +7 -7
  8. package/declarations/WebpackOptions.d.ts +1388 -0
  9. package/declarations/plugins/BannerPlugin.d.ts +51 -0
  10. package/declarations/plugins/DllPlugin.d.ts +28 -0
  11. package/declarations/plugins/DllReferencePlugin.d.ts +126 -0
  12. package/declarations/plugins/HashedModuleIdsPlugin.d.ts +24 -0
  13. package/declarations/plugins/IgnorePlugin.d.ts +27 -0
  14. package/declarations/plugins/LoaderOptionsPlugin.d.ts +27 -0
  15. package/declarations/plugins/SourceMapDevToolPlugin.d.ts +94 -0
  16. package/declarations/plugins/WatchIgnorePlugin.d.ts +10 -0
  17. package/declarations/plugins/debug/ProfilingPlugin.d.ts +12 -0
  18. package/declarations/plugins/optimize/AggressiveSplittingPlugin.d.ts +24 -0
  19. package/declarations/plugins/optimize/LimitChunkCountPlugin.d.ts +16 -0
  20. package/declarations/plugins/optimize/MinChunkSizePlugin.d.ts +12 -0
  21. package/declarations/plugins/optimize/OccurrenceOrderChunkIdsPlugin.d.ts +12 -0
  22. package/declarations/plugins/optimize/OccurrenceOrderModuleIdsPlugin.d.ts +12 -0
  23. package/hot/emitter.js +2 -2
  24. package/lib/AmdMainTemplatePlugin.js +22 -5
  25. package/lib/BasicEvaluatedExpression.js +211 -211
  26. package/lib/Chunk.js +33 -14
  27. package/lib/Compilation.js +99 -52
  28. package/lib/Compiler.js +6 -1
  29. package/lib/ConstPlugin.js +85 -0
  30. package/lib/Entrypoint.js +10 -0
  31. package/lib/ExternalModule.js +3 -2
  32. package/lib/LibraryTemplatePlugin.js +11 -8
  33. package/lib/MainTemplate.js +13 -0
  34. package/lib/Parser.js +9 -1
  35. package/lib/Stats.js +44 -45
  36. package/lib/WatchIgnorePlugin.js +4 -3
  37. package/lib/Watching.js +4 -3
  38. package/lib/dependencies/WebAssemblyExportImportedDependency.js +3 -1
  39. package/lib/node/NodeWatchFileSystem.js +16 -6
  40. package/lib/optimize/LimitChunkCountPlugin.js +11 -5
  41. package/lib/optimize/OccurrenceModuleOrderPlugin.js +5 -1
  42. package/lib/wasm/WasmFinalizeExportsPlugin.js +2 -0
  43. package/lib/wasm/WebAssemblyJavascriptGenerator.js +9 -4
  44. package/lib/wasm/WebAssemblyParser.js +2 -1
  45. package/lib/web/JsonpMainTemplate.runtime.js +1 -1
  46. package/lib/web/JsonpMainTemplatePlugin.js +1 -3
  47. package/package.json +14 -12
  48. package/schemas/WebpackOptions.json +1 -0
  49. package/schemas/ajv.absolutePath.js +55 -55
  50. package/schemas/plugins/DllReferencePlugin.json +1 -0
@@ -0,0 +1,51 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export type BannerPluginArgument =
8
+ | BannerPluginOptions
9
+ | BannerFunction
10
+ | string;
11
+ /**
12
+ * The banner as function, it will be wrapped in a comment
13
+ */
14
+ export type BannerFunction = (
15
+ data: {
16
+ hash: string;
17
+ chunk: import("../../lib/Chunk");
18
+ filename: string;
19
+ basename: string;
20
+ query: string;
21
+ }
22
+ ) => string;
23
+ export type Rules = Rule[] | Rule;
24
+ export type Rule = RegExp | string;
25
+
26
+ export interface BannerPluginOptions {
27
+ /**
28
+ * Specifies the banner
29
+ */
30
+ banner: BannerFunction | string;
31
+ /**
32
+ * If true, the banner will only be added to the entry chunks
33
+ */
34
+ entryOnly?: boolean;
35
+ /**
36
+ * Exclude all modules matching any of these conditions
37
+ */
38
+ exclude?: Rules;
39
+ /**
40
+ * Include all modules matching any of these conditions
41
+ */
42
+ include?: Rules;
43
+ /**
44
+ * If true, banner will not be wrapped in a comment
45
+ */
46
+ raw?: boolean;
47
+ /**
48
+ * Include all modules that pass test assertion
49
+ */
50
+ test?: Rules;
51
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export interface DllPluginOptions {
8
+ /**
9
+ * Context of requests in the manifest file (defaults to the webpack context)
10
+ */
11
+ context?: string;
12
+ /**
13
+ * If true, only entry points will be exposed
14
+ */
15
+ entryOnly?: boolean;
16
+ /**
17
+ * Name of the exposed dll function (external name, use value of 'output.library')
18
+ */
19
+ name?: string;
20
+ /**
21
+ * Absolute path to the manifest json file (output)
22
+ */
23
+ path: string;
24
+ /**
25
+ * Type of the dll bundle (external type, use value of 'output.libraryTarget')
26
+ */
27
+ type?: string;
28
+ }
@@ -0,0 +1,126 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export type DllReferencePluginOptions =
8
+ | {
9
+ /**
10
+ * (absolute path) context of requests in the manifest (or content property)
11
+ */
12
+ context?: string;
13
+ /**
14
+ * Extensions used to resolve modules in the dll bundle (only used when using 'scope')
15
+ */
16
+ extensions?: string[];
17
+ /**
18
+ * An object containing content and name or a string to the absolute path of the JSON manifest to be loaded upon compilation
19
+ */
20
+ manifest: DllReferencePluginOptionsManifest | string;
21
+ /**
22
+ * The name where the dll is exposed (external name, defaults to manifest.name)
23
+ */
24
+ name?: string;
25
+ /**
26
+ * Prefix which is used for accessing the content of the dll
27
+ */
28
+ scope?: string;
29
+ /**
30
+ * How the dll is exposed (libraryTarget, defaults to manifest.type)
31
+ */
32
+ sourceType?: DllReferencePluginOptionsSourceType;
33
+ /**
34
+ * The way how the export of the dll bundle is used
35
+ */
36
+ type?: "require" | "object";
37
+ }
38
+ | {
39
+ /**
40
+ * The mappings from request to module info
41
+ */
42
+ content: DllReferencePluginOptionsContent;
43
+ /**
44
+ * (absolute path) context of requests in the manifest (or content property)
45
+ */
46
+ context?: string;
47
+ /**
48
+ * Extensions used to resolve modules in the dll bundle (only used when using 'scope')
49
+ */
50
+ extensions?: string[];
51
+ /**
52
+ * The name where the dll is exposed (external name)
53
+ */
54
+ name: string;
55
+ /**
56
+ * Prefix which is used for accessing the content of the dll
57
+ */
58
+ scope?: string;
59
+ /**
60
+ * How the dll is exposed (libraryTarget)
61
+ */
62
+ sourceType?: DllReferencePluginOptionsSourceType;
63
+ /**
64
+ * The way how the export of the dll bundle is used
65
+ */
66
+ type?: "require" | "object";
67
+ };
68
+ /**
69
+ * The type how the dll is exposed (external type)
70
+ */
71
+ export type DllReferencePluginOptionsSourceType =
72
+ | "var"
73
+ | "assign"
74
+ | "this"
75
+ | "window"
76
+ | "global"
77
+ | "commonjs"
78
+ | "commonjs2"
79
+ | "commonjs-module"
80
+ | "amd"
81
+ | "amd-require"
82
+ | "umd"
83
+ | "umd2"
84
+ | "jsonp";
85
+
86
+ /**
87
+ * An object containing content, name and type
88
+ */
89
+ export interface DllReferencePluginOptionsManifest {
90
+ /**
91
+ * The mappings from request to module info
92
+ */
93
+ content: DllReferencePluginOptionsContent;
94
+ /**
95
+ * The name where the dll is exposed (external name)
96
+ */
97
+ name?: string;
98
+ /**
99
+ * The type how the dll is exposed (external type)
100
+ */
101
+ type?: DllReferencePluginOptionsSourceType;
102
+ }
103
+ /**
104
+ * The mappings from request to module info
105
+ */
106
+ export interface DllReferencePluginOptionsContent {
107
+ /**
108
+ * Module info
109
+ */
110
+ [k: string]: {
111
+ /**
112
+ * Meta information about the module
113
+ */
114
+ buildMeta?: {
115
+ [k: string]: any;
116
+ };
117
+ /**
118
+ * Information about the provided exports of the module
119
+ */
120
+ exports?: true | string[];
121
+ /**
122
+ * Module ID
123
+ */
124
+ id: number | string;
125
+ };
126
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export interface HashedModuleIdsPluginOptions {
8
+ /**
9
+ * The context directory for creating names.
10
+ */
11
+ context?: string;
12
+ /**
13
+ * The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.
14
+ */
15
+ hashDigest?: "hex" | "latin1" | "base64";
16
+ /**
17
+ * The prefix length of the hash digest to use, defaults to 4.
18
+ */
19
+ hashDigestLength?: number;
20
+ /**
21
+ * The hashing algorithm to use, defaults to 'md5'. All functions from Node.JS' crypto.createHash are supported.
22
+ */
23
+ hashFunction?: string;
24
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export type IgnorePluginOptions =
8
+ | {
9
+ /**
10
+ * A RegExp to test the context (directory) against
11
+ */
12
+ contextRegExp?: RegExp;
13
+ /**
14
+ * A RegExp to test the request against
15
+ */
16
+ resourceRegExp?: RegExp;
17
+ }
18
+ | {
19
+ /**
20
+ * A filter function for context
21
+ */
22
+ checkContext?: ((context: string) => boolean);
23
+ /**
24
+ * A filter function for resource
25
+ */
26
+ checkResource?: ((resource: string) => boolean);
27
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export interface LoaderOptionsPluginOptions {
8
+ /**
9
+ * Whether loaders should be in debug mode or not. debug will be removed as of webpack 3
10
+ */
11
+ debug?: boolean;
12
+ /**
13
+ * Where loaders can be switched to minimize mode
14
+ */
15
+ minimize?: boolean;
16
+ /**
17
+ * A configuration object that can be used to configure older loaders
18
+ */
19
+ options?: {
20
+ /**
21
+ * The context that can be used to configure older loaders
22
+ */
23
+ context?: string;
24
+ [k: string]: any;
25
+ };
26
+ [k: string]: any;
27
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ /**
8
+ * This interface was referenced by `SourceMapDevToolPluginOptions`'s JSON-Schema
9
+ * via the `definition` "rules".
10
+ */
11
+ export type Rules = Rule[] | Rule;
12
+ /**
13
+ * This interface was referenced by `SourceMapDevToolPluginOptions`'s JSON-Schema
14
+ * via the `definition` "rule".
15
+ */
16
+ export type Rule = RegExp | string;
17
+
18
+ export interface SourceMapDevToolPluginOptions {
19
+ /**
20
+ * Appends the given value to the original asset. Usually the #sourceMappingURL comment. [url] is replaced with a URL to the source map file. false disables the appending
21
+ */
22
+ append?: (false | null) | string;
23
+ /**
24
+ * Indicates whether column mappings should be used (defaults to true)
25
+ */
26
+ columns?: boolean;
27
+ /**
28
+ * Exclude modules that match the given value from source map generation
29
+ */
30
+ exclude?: Rules;
31
+ /**
32
+ * Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap used only if 'moduleFilenameTemplate' would result in a conflict
33
+ */
34
+ fallbackModuleFilenameTemplate?: Function | string;
35
+ /**
36
+ * Path prefix to which the [file] placeholder is relative to
37
+ */
38
+ fileContext?: string;
39
+ /**
40
+ * Defines the output filename of the SourceMap (will be inlined if no value is provided)
41
+ */
42
+ filename?: (false | null) | string;
43
+ /**
44
+ * Include source maps for module paths that match the given value
45
+ */
46
+ include?: Rules;
47
+ /**
48
+ * (deprecated) try to map original files line to line to generated files
49
+ */
50
+ lineToLine?:
51
+ | boolean
52
+ | {
53
+ /**
54
+ * Exclude modules that match the given value from source map generation
55
+ */
56
+ exclude?: Rules;
57
+ /**
58
+ * Include source maps for module paths that match the given value
59
+ */
60
+ include?: Rules;
61
+ /**
62
+ * Include source maps for modules based on their extension (defaults to .js and .css)
63
+ */
64
+ test?: Rules;
65
+ };
66
+ /**
67
+ * Indicates whether SourceMaps from loaders should be used (defaults to true)
68
+ */
69
+ module?: boolean;
70
+ /**
71
+ * Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap
72
+ */
73
+ moduleFilenameTemplate?: Function | string;
74
+ /**
75
+ * Namespace prefix to allow multiple webpack roots in the devtools
76
+ */
77
+ namespace?: string;
78
+ /**
79
+ * Omit the 'sourceContents' array from the SourceMap
80
+ */
81
+ noSources?: boolean;
82
+ /**
83
+ * Provide a custom public path for the SourceMapping comment
84
+ */
85
+ publicPath?: string;
86
+ /**
87
+ * Provide a custom value for the 'sourceRoot' property in the SourceMap
88
+ */
89
+ sourceRoot?: string;
90
+ /**
91
+ * Include source maps for modules based on their extension (defaults to .js and .css)
92
+ */
93
+ test?: Rules;
94
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ /**
8
+ * A list of RegExps or absolute paths to directories or files that should be ignored
9
+ */
10
+ export type WatchIgnorePluginOptions = (string | RegExp)[];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export interface ProfilingPluginOptions {
8
+ /**
9
+ * Path to the output file e.g. `profiling/events.json`. Defaults to `events.json`.
10
+ */
11
+ outputPath?: string;
12
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export interface AggressiveSplittingPluginOptions {
8
+ /**
9
+ * Default: 0
10
+ */
11
+ chunkOverhead?: number;
12
+ /**
13
+ * Default: 1
14
+ */
15
+ entryChunkMultiplicator?: number;
16
+ /**
17
+ * Byte, maxsize of per file. Default: 51200
18
+ */
19
+ maxSize?: number;
20
+ /**
21
+ * Byte, split point. Default: 30720
22
+ */
23
+ minSize?: number;
24
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export interface LimitChunkCountPluginOptions {
8
+ /**
9
+ * Limit the maximum number of chunks using a value greater greater than or equal to 1
10
+ */
11
+ maxChunks?: number;
12
+ /**
13
+ * Set a minimum chunk size
14
+ */
15
+ minChunkSize?: number;
16
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export interface MinChunkSizePluginOptions {
8
+ /**
9
+ * Minimum number of characters
10
+ */
11
+ minChunkSize: number;
12
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export interface OccurrenceOrderChunkIdsPluginOptions {
8
+ /**
9
+ * Prioritise initial size over total size
10
+ */
11
+ prioritiseInitial?: boolean;
12
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+
7
+ export interface OccurrenceOrderModuleIdsPluginOptions {
8
+ /**
9
+ * Prioritise initial size over total size
10
+ */
11
+ prioritiseInitial?: boolean;
12
+ }
package/hot/emitter.js CHANGED
@@ -1,2 +1,2 @@
1
- var EventEmitter = require("events");
2
- module.exports = new EventEmitter();
1
+ var EventEmitter = require("events");
2
+ module.exports = new EventEmitter();
@@ -10,13 +10,24 @@ const Template = require("./Template");
10
10
 
11
11
  /** @typedef {import("./Compilation")} Compilation */
12
12
 
13
+ /**
14
+ * @typedef {Object} AmdMainTemplatePluginOptions
15
+ * @param {string=} name the library name
16
+ * @property {boolean=} requireAsWrapper
17
+ */
18
+
13
19
  class AmdMainTemplatePlugin {
14
20
  /**
15
- * @param {string=} name the library name
21
+ * @param {AmdMainTemplatePluginOptions} options the plugin options
16
22
  */
17
- constructor(name) {
18
- /** @type {string=} */
19
- this.name = name;
23
+ constructor(options) {
24
+ if (!options || typeof options === "string") {
25
+ this.name = options;
26
+ this.requireAsWrapper = false;
27
+ } else {
28
+ this.name = options.name;
29
+ this.requireAsWrapper = options.requireAsWrapper;
30
+ }
20
31
  }
21
32
 
22
33
  /**
@@ -39,7 +50,13 @@ class AmdMainTemplatePlugin {
39
50
  )
40
51
  .join(", ");
41
52
 
42
- if (this.name) {
53
+ if (this.requireAsWrapper) {
54
+ return new ConcatSource(
55
+ `require(${externalsDepsArray}, function(${externalsArguments}) { return `,
56
+ source,
57
+ "});"
58
+ );
59
+ } else if (this.name) {
43
60
  const name = mainTemplate.getAssetPath(this.name, {
44
61
  hash,
45
62
  chunk