webpack 2.1.0-beta.21 → 2.1.0-beta.25

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 (66) hide show
  1. package/bin/config-yargs.js +6 -5
  2. package/bin/convert-argv.js +59 -31
  3. package/bin/webpack.js +30 -2
  4. package/lib/APIPlugin.js +19 -16
  5. package/lib/Chunk.js +1 -1
  6. package/lib/CommonJsHarmonyMainTemplatePlugin.js +21 -0
  7. package/lib/CompatibilityPlugin.js +24 -17
  8. package/lib/Compilation.js +36 -15
  9. package/lib/Compiler.js +48 -15
  10. package/lib/ConstPlugin.js +40 -37
  11. package/lib/DefinePlugin.js +107 -103
  12. package/lib/DelegatedModule.js +1 -2
  13. package/lib/Dependency.js +5 -0
  14. package/lib/DllReferencePlugin.js +41 -15
  15. package/lib/ExtendedAPIPlugin.js +14 -11
  16. package/lib/FlagDependencyExportsPlugin.js +102 -0
  17. package/lib/FlagInitialModulesAsUsedPlugin.js +23 -23
  18. package/lib/FunctionModuleTemplatePlugin.js +4 -0
  19. package/lib/HotModuleReplacement.runtime.js +1 -1
  20. package/lib/HotModuleReplacementPlugin.js +71 -68
  21. package/lib/LibManifestPlugin.js +1 -2
  22. package/lib/LibraryTemplatePlugin.js +4 -0
  23. package/lib/MainTemplate.js +12 -13
  24. package/lib/Module.js +10 -1
  25. package/lib/MovedToPluginWarningPlugin.js +3 -1
  26. package/lib/MultiCompiler.js +81 -7
  27. package/lib/NodeStuffPlugin.js +97 -86
  28. package/lib/NormalModule.js +6 -0
  29. package/lib/NormalModuleFactory.js +87 -34
  30. package/lib/Parser.js +13 -4
  31. package/lib/ProvidePlugin.js +30 -27
  32. package/lib/RequireJsStuffPlugin.js +27 -21
  33. package/lib/RuleSet.js +369 -0
  34. package/lib/Stats.js +74 -90
  35. package/lib/UseStrictPlugin.js +12 -8
  36. package/lib/WebpackOptionsApply.js +3 -13
  37. package/lib/WebpackOptionsDefaulter.js +0 -1
  38. package/lib/WebpackOptionsValidationError.js +186 -0
  39. package/lib/dependencies/AMDPlugin.js +64 -55
  40. package/lib/dependencies/CommonJsPlugin.js +55 -45
  41. package/lib/dependencies/HarmonyExportExpressionDependency.js +6 -0
  42. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +76 -16
  43. package/lib/dependencies/HarmonyExportSpecifierDependency.js +12 -4
  44. package/lib/dependencies/HarmonyImportSpecifierDependency.js +6 -4
  45. package/lib/dependencies/HarmonyModulesHelpers.js +0 -29
  46. package/lib/dependencies/HarmonyModulesPlugin.js +11 -4
  47. package/lib/dependencies/RequireContextPlugin.js +12 -5
  48. package/lib/dependencies/RequireEnsurePlugin.js +17 -10
  49. package/lib/dependencies/RequireIncludePlugin.js +18 -10
  50. package/lib/dependencies/SystemPlugin.js +48 -29
  51. package/lib/node/NodeMainTemplate.runtime.js +2 -2
  52. package/lib/node/NodeMainTemplateAsync.runtime.js +2 -2
  53. package/lib/node/NodeSourcePlugin.js +84 -71
  54. package/lib/optimize/ChunkModuleIdRangePlugin.js +52 -0
  55. package/lib/optimize/EnsureChunkConditionsPlugin.js +7 -2
  56. package/lib/validateWebpackOptions.js +63 -0
  57. package/lib/webpack.js +9 -6
  58. package/lib/webworker/WebWorkerMainTemplate.runtime.js +35 -33
  59. package/package.json +13 -8
  60. package/schemas/webpackOptionsSchema.json +802 -0
  61. package/README.md +0 -315
  62. package/lib/LoadersList.js +0 -110
  63. package/lib/dependencies/LabeledExportsDependency.js +0 -21
  64. package/lib/dependencies/LabeledModuleDependency.js +0 -36
  65. package/lib/dependencies/LabeledModuleDependencyParserPlugin.js +0 -78
  66. package/lib/dependencies/LabeledModulesPlugin.js +0 -26
package/lib/RuleSet.js ADDED
@@ -0,0 +1,369 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ /*
6
+ <rules>: <rule>
7
+ <rules>: [<rule>]
8
+ <rule>: {
9
+ resource: {
10
+ test: <condition>,
11
+ include: <condition>,
12
+ exclude: <condition>,
13
+ },
14
+ resource: <condition>, -> resource.test
15
+ test: <condition>, -> resource.test
16
+ include: <condition>, -> resource.include
17
+ exclude: <condition>, -> resource.exclude
18
+ issuer: {
19
+ test: <condition>,
20
+ include: <condition>,
21
+ exclude: <condition>,
22
+ },
23
+ issuer: <condition>, -> issuer.test
24
+ use: "loader", -> use[0].loader
25
+ loader: <>, -> use[0].loader
26
+ loaders: <>, -> use
27
+ options: {}, -> use[0].options,
28
+ query: {}, -> options
29
+ parser: {},
30
+ use: [
31
+ "loader" -> use[x].loader
32
+ ],
33
+ use: [
34
+ {
35
+ loader: "loader",
36
+ options: {}
37
+ }
38
+ ],
39
+ rules: [
40
+ <rule>
41
+ ],
42
+ oneOf: [
43
+ <rule>
44
+ ]
45
+ }
46
+
47
+ <condition>: /regExp/
48
+ <condition>: function(arg) {}
49
+ <condition>: "starting"
50
+ <condition>: [<condition>] // or
51
+ <condition>: { and: [<condition>] }
52
+ <condition>: { or: [<condition>] }
53
+ <condition>: { not: [<condition>] }
54
+ <condition>: { test: <condition>, include: <condition>, exclude: <codition> }
55
+
56
+
57
+ normalized:
58
+
59
+ {
60
+ resource: function(),
61
+ issuer: function(),
62
+ use: [
63
+ {
64
+ loader: string,
65
+ options: string,
66
+ <any>: <any>
67
+ }
68
+ ],
69
+ rules: [<rule>],
70
+ oneOf: [<rule>],
71
+ <any>: <any>,
72
+ }
73
+
74
+ */
75
+
76
+ function RuleSet(rules) {
77
+ this.rules = RuleSet.normalizeRules(rules);
78
+ }
79
+
80
+ module.exports = RuleSet;
81
+
82
+ RuleSet.normalizeRules = function(rules) {
83
+ if(Array.isArray(rules)) {
84
+ return rules.map(function(rule) {
85
+ return RuleSet.normalizeRule(rule);
86
+ });
87
+ } else if(rules) {
88
+ return [RuleSet.normalizeRule(rules)]
89
+ } else {
90
+ return [];
91
+ }
92
+ };
93
+
94
+ RuleSet.normalizeRule = function(rule) {
95
+ if(typeof rule === "string")
96
+ return {
97
+ use: [{
98
+ loader: rule
99
+ }]
100
+ };
101
+ if(!rule)
102
+ throw new Error("Unexcepted null when object was expected as rule");
103
+ if(typeof rule !== "object")
104
+ throw new Error("Unexcepted " + typeof rule + " when object was expected as rule (" + rule + ")");
105
+
106
+ var newRule = {};
107
+ var useSource;
108
+ var resourceSource;
109
+
110
+ if(rule.test || rule.include || rule.exclude) {
111
+ checkResourceSource("test + include + exclude");
112
+ newRule.resource = RuleSet.normalizeCondition({
113
+ test: rule.test,
114
+ include: rule.include,
115
+ exclude: rule.exclude
116
+ });
117
+ }
118
+
119
+ if(rule.resource) {
120
+ checkResourceSource("resource");
121
+ newRule.resource = RuleSet.normalizeCondition(rule.resource);
122
+ }
123
+
124
+ if(rule.issuer) {
125
+ newRule.issuer = RuleSet.normalizeCondition(rule.issuer);
126
+ }
127
+
128
+ if(rule.loader && rule.loaders)
129
+ throw new Error("Provided loader and loaders for rule");
130
+
131
+ var loader = rule.loaders || rule.loader;
132
+ if(typeof loader === "string" && !rule.options && !rule.query) {
133
+ checkUseSource("loader");
134
+ newRule.use = RuleSet.normalizeUse(loader.split("!"));
135
+ } else if(typeof loader === "string" && (rule.options || rule.query)) {
136
+ checkUseSource("loader + options/query");
137
+ newRule.use = RuleSet.normalizeUse({
138
+ loader: loader,
139
+ options: rule.options,
140
+ query: rule.query
141
+ });
142
+ } else if(loader && (rule.options || rule.query)) {
143
+ throw new Error("options/query cannot be used with loaders");
144
+ } else if(loader) {
145
+ checkUseSource("loaders");
146
+ newRule.use = RuleSet.normalizeUse(loader);
147
+ }
148
+
149
+ if(rule.use) {
150
+ checkUseSource("use");
151
+ newRule.use = RuleSet.normalizeUse(rule.use);
152
+ }
153
+
154
+ if(rule.rules)
155
+ newRule.rules = RuleSet.normalizeRules(rule.rules);
156
+
157
+ if(rule.oneOf)
158
+ newRule.oneOf = RuleSet.normalizeRules(rule.oneOf);
159
+
160
+ var keys = Object.keys(rule).filter(function(key) {
161
+ return ["resource", "test", "include", "exclude", "issuer", "loader", "options", "query", "loaders", "use", "rules", "oneOf"].indexOf(key) < 0;
162
+ });
163
+ keys.forEach(function(key) {
164
+ newRule[key] = rule[key];
165
+ });
166
+
167
+ function checkUseSource(newSource) {
168
+ if(useSource && useSource !== newSource)
169
+ throw new Error("Rule can only have one result source (provided " + newSource + " and " + useSource + ")");
170
+ useSource = newSource;
171
+ }
172
+
173
+ function checkResourceSource(newSource) {
174
+ if(resourceSource && resourceSource !== newSource)
175
+ throw new Error("Rule can only have one resource source (provided " + newSource + " and " + resourceSource + ")");
176
+ resourceSource = newSource;
177
+ }
178
+
179
+ return newRule;
180
+ };
181
+
182
+ RuleSet.normalizeUse = function normalizeUse(use) {
183
+ if(Array.isArray(use)) {
184
+ return use.map(RuleSet.normalizeUse).reduce(function(arr, items) {
185
+ return arr.concat(items);
186
+ }, []);
187
+ }
188
+ return [RuleSet.normalizeUseItem(use)];
189
+ };
190
+
191
+ RuleSet.normalizeUseItem = function normalizeUseItem(item) {
192
+ if(typeof item === "function")
193
+ return item;
194
+
195
+ if(typeof item === "string") {
196
+ var idx = item.indexOf("?");
197
+ if(idx >= 0) {
198
+ return {
199
+ loader: item.substr(0, idx),
200
+ options: item.substr(idx + 1)
201
+ };
202
+ }
203
+ return {
204
+ loader: item
205
+ };
206
+ }
207
+
208
+ var newItem = {};
209
+
210
+ if(item.options && item.query)
211
+ throw new Error("Provided options and query in use");
212
+
213
+ if(!item.loader)
214
+ throw new Error("No loader specified");
215
+
216
+ newItem.options = item.options || item.query;
217
+
218
+ var keys = Object.keys(item).filter(function(key) {
219
+ return ["options", "query"].indexOf(key) < 0;
220
+ });
221
+
222
+ keys.forEach(function(key) {
223
+ newItem[key] = item[key];
224
+ });
225
+
226
+ return newItem;
227
+ }
228
+
229
+ RuleSet.normalizeCondition = function normalizeCondition(condition) {
230
+ if(!condition)
231
+ throw new Error("Expected condition but got falsy value");
232
+ if(typeof condition === "string") {
233
+ return function(str) {
234
+ return str.indexOf(condition) === 0;
235
+ };
236
+ }
237
+ if(typeof condition === "function") {
238
+ return condition;
239
+ }
240
+ if(condition instanceof RegExp) {
241
+ return condition.test.bind(condition);
242
+ }
243
+ if(Array.isArray(condition)) {
244
+ var items = condition.map(function(c) {
245
+ return RuleSet.normalizeCondition(c);
246
+ });
247
+ return orMatcher(items);
248
+ }
249
+ if(typeof condition !== "object")
250
+ throw Error("Unexcepted " + typeof condition + " when condition was expected (" + condition + ")");
251
+ var matchers = [];
252
+ Object.keys(condition).forEach(function(key) {
253
+ var value = condition[key];
254
+ switch(key) {
255
+ case "or":
256
+ case "include":
257
+ case "test":
258
+ if(value)
259
+ matchers.push(RuleSet.normalizeCondition(value));
260
+ break;
261
+ case "and":
262
+ if(value) {
263
+ var items = value.map(function(c) {
264
+ return RuleSet.normalizeCondition(c);
265
+ });
266
+ matchers.push(andMatcher(items));
267
+ }
268
+ break;
269
+ case "not":
270
+ case "exclude":
271
+ if(value) {
272
+ var matcher = RuleSet.normalizeCondition(value);
273
+ matchers.push(notMatcher(matcher));
274
+ }
275
+ break;
276
+ default:
277
+ throw new Error("Unexcepted property " + key + " in condition");
278
+ }
279
+ });
280
+ if(matchers.length === 0)
281
+ throw new Error("Excepted condition but got " + condition);
282
+ if(matchers.length === 1)
283
+ return matchers[0];
284
+ return andMatcher(matchers);
285
+ };
286
+
287
+ function notMatcher(matcher) {
288
+ return function(str) {
289
+ return !matcher(str);
290
+ }
291
+ }
292
+
293
+ function orMatcher(items) {
294
+ return function(str) {
295
+ for(var i = 0; i < items.length; i++) {
296
+ if(items[i](str))
297
+ return true;
298
+ }
299
+ return false;
300
+ }
301
+ }
302
+
303
+ function andMatcher(items) {
304
+ return function(str) {
305
+ for(var i = 0; i < items.length; i++) {
306
+ if(!items[i](str))
307
+ return false;
308
+ }
309
+ return true;
310
+ }
311
+ }
312
+
313
+ RuleSet.prototype.exec = function(data) {
314
+ var result = [];
315
+ this._run(data, {
316
+ rules: this.rules
317
+ }, result);
318
+ return result;
319
+ };
320
+
321
+ RuleSet.prototype._run = function _run(data, rule, result) {
322
+ // test conditions
323
+ if(rule.resource && !data.resource)
324
+ return false;
325
+ if(rule.issuer && !data.issuer)
326
+ return false;
327
+ if(rule.resource && !rule.resource(data.resource))
328
+ return false;
329
+ if(data.issuer && rule.issuer && !rule.issuer(data.issuer))
330
+ return false;
331
+
332
+ // apply
333
+ var keys = Object.keys(rule).filter(function(key) {
334
+ return ["resource", "issuer", "rules", "oneOf", "use", "enforce"].indexOf(key) < 0;
335
+ });
336
+ keys.forEach(function(key) {
337
+ result.push({
338
+ type: key,
339
+ value: rule[key]
340
+ });
341
+ });
342
+
343
+ if(rule.use) {
344
+ rule.use.forEach(function(use) {
345
+ result.push({
346
+ type: "use",
347
+ value: typeof use === "function" ? use(data) : use,
348
+ enforce: rule.enforce
349
+ });
350
+ });
351
+ }
352
+
353
+ var i;
354
+
355
+ if(rule.rules) {
356
+ for(i = 0; i < rule.rules.length; i++) {
357
+ this._run(data, rule.rules[i], result);
358
+ }
359
+ }
360
+
361
+ if(rule.oneOf) {
362
+ for(i = 0; i < rule.oneOf.length; i++) {
363
+ if(this._run(data, rule.oneOf[i], result))
364
+ break;
365
+ }
366
+ }
367
+
368
+ return true;
369
+ };
package/lib/Stats.js CHANGED
@@ -43,6 +43,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
43
43
  var showCachedAssets = d(options.cachedAssets, true);
44
44
  var showReasons = d(options.reasons, !forToString);
45
45
  var showUsedExports = d(options.usedExports, !forToString);
46
+ var showProvidedExports = d(options.providedExports, !forToString);
46
47
  var showChildren = d(options.children, true);
47
48
  var showSource = d(options.source, !forToString);
48
49
  var showErrors = d(options.errors, true);
@@ -258,6 +259,9 @@ Stats.prototype.toJson = function toJson(options, forToString) {
258
259
  if(showUsedExports) {
259
260
  obj.usedExports = module.used ? module.usedExports : false;
260
261
  }
262
+ if(showProvidedExports) {
263
+ obj.providedExports = Array.isArray(module.providedExports) ? module.providedExports : null;
264
+ }
261
265
  if(showSource && module._source) {
262
266
  obj.source = module._source.source();
263
267
  }
@@ -498,9 +502,72 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
498
502
  });
499
503
  }
500
504
 
501
- function processProfile(module) {
505
+ function processModuleAttributes(module) {
506
+ colors.normal(" ");
507
+ colors.normal(formatSize(module.size));
508
+ if(module.chunks) {
509
+ module.chunks.forEach(function(chunk) {
510
+ colors.normal(" {");
511
+ colors.yellow(chunk);
512
+ colors.normal("}");
513
+ });
514
+ }
515
+ if(!module.cacheable) {
516
+ colors.red(" [not cacheable]");
517
+ }
518
+ if(module.optional) {
519
+ colors.yellow(" [optional]");
520
+ }
521
+ if(module.built) {
522
+ colors.green(" [built]");
523
+ }
524
+ if(module.prefetched) {
525
+ colors.magenta(" [prefetched]");
526
+ }
527
+ if(module.failed)
528
+ colors.red(" [failed]");
529
+ if(module.warnings)
530
+ colors.yellow(" [" + module.warnings + " warning" + (module.warnings === 1 ? "" : "s") + "]");
531
+ if(module.errors)
532
+ colors.red(" [" + module.errors + " error" + (module.errors === 1 ? "" : "s") + "]");
533
+ }
534
+
535
+ function processModuleContent(module, prefix) {
536
+ if(Array.isArray(module.providedExports)) {
537
+ colors.normal(prefix);
538
+ colors.cyan("[exports: " + module.providedExports.join(", ") + "]");
539
+ newline();
540
+ }
541
+ if(module.usedExports !== undefined) {
542
+ if(module.usedExports !== true) {
543
+ colors.normal(prefix);
544
+ if(module.usedExports === false)
545
+ colors.cyan("[no exports used]");
546
+ else
547
+ colors.cyan("[only some exports used: " + module.usedExports.join(", ") + "]");
548
+ newline();
549
+ }
550
+ }
551
+ if(module.reasons) {
552
+ module.reasons.forEach(function(reason) {
553
+ colors.normal(prefix);
554
+ colors.normal(reason.type);
555
+ colors.normal(" ");
556
+ colors.cyan(reason.userRequest);
557
+ if(reason.templateModules) colors.cyan(reason.templateModules.join(" "));
558
+ colors.normal(" [");
559
+ colors.normal(reason.moduleId);
560
+ colors.normal("] ");
561
+ colors.magenta(reason.module);
562
+ if(reason.loc) {
563
+ colors.normal(" ");
564
+ colors.normal(reason.loc);
565
+ }
566
+ newline();
567
+ });
568
+ }
502
569
  if(module.profile) {
503
- colors.normal(" ");
570
+ colors.normal(prefix);
504
571
  var sum = 0;
505
572
  var path = [];
506
573
  var current = module;
@@ -508,7 +575,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
508
575
  path.unshift(current = current.issuer);
509
576
  }
510
577
  path.forEach(function(module) {
511
- colors.normal(" [");
578
+ colors.normal("[");
512
579
  colors.normal(module.id);
513
580
  colors.normal("] ");
514
581
  if(module.profile) {
@@ -531,35 +598,6 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
531
598
  }
532
599
  }
533
600
 
534
- function processModuleAttributes(module) {
535
- colors.normal(" ");
536
- colors.normal(formatSize(module.size));
537
- if(module.chunks) {
538
- module.chunks.forEach(function(chunk) {
539
- colors.normal(" {");
540
- colors.yellow(chunk);
541
- colors.normal("}");
542
- });
543
- }
544
- if(!module.cacheable) {
545
- colors.red(" [not cacheable]");
546
- }
547
- if(module.optional) {
548
- colors.yellow(" [optional]");
549
- }
550
- if(module.built) {
551
- colors.green(" [built]");
552
- }
553
- if(module.prefetched) {
554
- colors.magenta(" [prefetched]");
555
- }
556
- if(module.failed)
557
- colors.red(" [failed]");
558
- if(module.warnings)
559
- colors.yellow(" [" + module.warnings + " warning" + (module.warnings === 1 ? "" : "s") + "]");
560
- if(module.errors)
561
- colors.red(" [" + module.errors + " error" + (module.errors === 1 ? "" : "s") + "]");
562
- }
563
601
  if(obj.chunks) {
564
602
  obj.chunks.forEach(function(chunk) {
565
603
  colors.normal("chunk ");
@@ -633,35 +671,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
633
671
  colors.bold(module.name);
634
672
  processModuleAttributes(module);
635
673
  newline();
636
- if(module.usedExports !== undefined) {
637
- if(module.usedExports !== true) {
638
- colors.normal(" ");
639
- if(module.usedExports === false)
640
- colors.cyan("[no exports used]");
641
- else
642
- colors.cyan("[only some exports used: " + module.usedExports.join(", ") + "]");
643
- newline();
644
- }
645
- }
646
- if(module.reasons) {
647
- module.reasons.forEach(function(reason) {
648
- colors.normal(" ");
649
- colors.normal(reason.type);
650
- colors.normal(" ");
651
- colors.cyan(reason.userRequest);
652
- if(reason.templateModules) colors.cyan(reason.templateModules.join(" "));
653
- colors.normal(" [");
654
- colors.normal(reason.moduleId);
655
- colors.normal("] ");
656
- colors.magenta(reason.module);
657
- if(reason.loc) {
658
- colors.normal(" ");
659
- colors.normal(reason.loc);
660
- }
661
- newline();
662
- });
663
- }
664
- processProfile(module);
674
+ processModuleContent(module, " ");
665
675
  });
666
676
  if(chunk.filteredModules > 0) {
667
677
  colors.normal(" + " + chunk.filteredModules + " hidden modules");
@@ -681,35 +691,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
681
691
  colors.bold(module.name || module.identifier);
682
692
  processModuleAttributes(module);
683
693
  newline();
684
- if(module.usedExports !== undefined) {
685
- if(module.usedExports !== true) {
686
- colors.normal(" ");
687
- if(module.usedExports === false)
688
- colors.cyan("[no exports used]");
689
- else
690
- colors.cyan("[only some exports used: " + module.usedExports.join(", ") + "]");
691
- newline();
692
- }
693
- }
694
- if(module.reasons) {
695
- module.reasons.forEach(function(reason) {
696
- colors.normal(" ");
697
- colors.normal(reason.type);
698
- colors.normal(" ");
699
- colors.cyan(reason.userRequest);
700
- if(reason.templateModules) colors.cyan(reason.templateModules.join(" "));
701
- colors.normal(" [");
702
- colors.normal(reason.moduleId);
703
- colors.normal("] ");
704
- colors.magenta(reason.module);
705
- if(reason.loc) {
706
- colors.normal(" ");
707
- colors.normal(reason.loc);
708
- }
709
- newline();
710
- });
711
- }
712
- processProfile(module);
694
+ processModuleContent(module, " ");
713
695
  });
714
696
  if(obj.filteredModules > 0) {
715
697
  colors.normal(" + " + obj.filteredModules + " hidden modules");
@@ -768,6 +750,7 @@ Stats.presetToOptions = function(name) {
768
750
  modules: false,
769
751
  reasons: false,
770
752
  usedExports: false,
753
+ providedExports: false,
771
754
  children: false,
772
755
  source: false,
773
756
  errors: false,
@@ -788,6 +771,7 @@ Stats.presetToOptions = function(name) {
788
771
  errorDetails: pn !== "errors-only" && pn !== "minimal",
789
772
  reasons: pn === "verbose",
790
773
  usedExports: pn === "verbose",
774
+ providedExports: pn === "verbose",
791
775
  colors: true
792
776
  };
793
777
  }
@@ -11,12 +11,16 @@ function UseStrictPlugin() {}
11
11
  module.exports = UseStrictPlugin;
12
12
 
13
13
  UseStrictPlugin.prototype.apply = function(compiler) {
14
- compiler.parser.plugin("program", function(ast) {
15
- var body = ast.body[0]
16
- if(body &&
17
- body.type === "ExpressionStatement" &&
18
- body.expression.type === "Literal" &&
19
- body.expression.value === "use strict")
20
- this.state.module.strict = true;
21
- });
14
+ compiler.plugin("compilation", function(compilation, params) {
15
+ params.normalModuleFactory.plugin("parser", function(parser) {
16
+ parser.plugin("program", function(ast) {
17
+ var body = ast.body[0]
18
+ if(body &&
19
+ body.type === "ExpressionStatement" &&
20
+ body.expression.type === "Literal" &&
21
+ body.expression.value === "use strict")
22
+ this.state.module.strict = true;
23
+ });
24
+ })
25
+ })
22
26
  };
@@ -40,6 +40,7 @@ var MergeDuplicateChunksPlugin = require("./optimize/MergeDuplicateChunksPlugin"
40
40
  var FlagIncludedChunksPlugin = require("./optimize/FlagIncludedChunksPlugin");
41
41
  var OccurrenceOrderPlugin = require("./optimize/OccurrenceOrderPlugin");
42
42
  var FlagDependencyUsagePlugin = require("./FlagDependencyUsagePlugin");
43
+ var FlagDependencyExportsPlugin = require("./FlagDependencyExportsPlugin");
43
44
 
44
45
  var ResolverFactory = require("enhanced-resolve").ResolverFactory;
45
46
 
@@ -61,6 +62,7 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
61
62
  compiler.recordsInputPath = options.recordsInputPath || options.recordsPath;
62
63
  compiler.recordsOutputPath = options.recordsOutputPath || options.recordsPath;
63
64
  compiler.name = options.name;
65
+ compiler.dependencies = options.dependencies;
64
66
  if(typeof options.target === "string") {
65
67
  var JsonpTemplatePlugin;
66
68
  var NodeSourcePlugin;
@@ -256,6 +258,7 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
256
258
  new MergeDuplicateChunksPlugin(),
257
259
  new FlagIncludedChunksPlugin(),
258
260
  new OccurrenceOrderPlugin(true),
261
+ new FlagDependencyExportsPlugin(),
259
262
  new FlagDependencyUsagePlugin()
260
263
  );
261
264
 
@@ -284,16 +287,3 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
284
287
  compiler.applyPlugins("after-resolvers", compiler);
285
288
  return options;
286
289
  };
287
-
288
- function makeRootPlugin(name, root) {
289
- if(typeof root === "string")
290
- return new ModulesInRootPlugin(name, root);
291
- else if(Array.isArray(root)) {
292
- return function() {
293
- root.forEach(function(root) {
294
- this.apply(new ModulesInRootPlugin(name, root));
295
- }, this);
296
- };
297
- }
298
- return function() {};
299
- }
@@ -7,7 +7,6 @@ var Template = require("./Template");
7
7
 
8
8
  function WebpackOptionsDefaulter() {
9
9
  OptionsDefaulter.call(this);
10
- this.set("debug", false);
11
10
  this.set("devtool", false);
12
11
  this.set("cache", true);
13
12