rollup 1.16.4 → 1.17.0

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.
package/dist/rollup.d.ts CHANGED
@@ -38,6 +38,21 @@ export interface RollupLogProps {
38
38
  url?: string;
39
39
  }
40
40
 
41
+ export type SourceMapSegment =
42
+ | [number]
43
+ | [number, number, number, number]
44
+ | [number, number, number, number, number];
45
+
46
+ export interface ExistingDecodedSourceMap {
47
+ file?: string;
48
+ mappings: SourceMapSegment[][];
49
+ names: string[];
50
+ sourceRoot?: string;
51
+ sources: string[];
52
+ sourcesContent?: string[];
53
+ version: number;
54
+ }
55
+
41
56
  export interface ExistingRawSourceMap {
42
57
  file?: string;
43
58
  mappings: string;
@@ -48,7 +63,13 @@ export interface ExistingRawSourceMap {
48
63
  version: number;
49
64
  }
50
65
 
51
- export type RawSourceMap = { mappings: '' } | ExistingRawSourceMap;
66
+ export type DecodedSourceMapOrMissing =
67
+ | {
68
+ mappings?: never;
69
+ missing: true;
70
+ plugin: string;
71
+ }
72
+ | ExistingDecodedSourceMap;
52
73
 
53
74
  export interface SourceMap {
54
75
  file: string;
@@ -61,10 +82,12 @@ export interface SourceMap {
61
82
  toUrl(): string;
62
83
  }
63
84
 
85
+ export type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
86
+
64
87
  export interface SourceDescription {
65
88
  ast?: ESTree.Program;
66
89
  code: string;
67
- map?: string | RawSourceMap;
90
+ map?: SourceMapInput;
68
91
  moduleSideEffects?: boolean | null;
69
92
  }
70
93
 
@@ -79,9 +102,9 @@ export interface TransformModuleJSON {
79
102
  customTransformCache: boolean;
80
103
  moduleSideEffects: boolean | null;
81
104
  originalCode: string;
82
- originalSourcemap: RawSourceMap | null;
105
+ originalSourcemap: ExistingDecodedSourceMap | null;
83
106
  resolvedIds?: ResolvedIdMap;
84
- sourcemapChain: (RawSourceMap | { missing: true; plugin: string })[];
107
+ sourcemapChain: DecodedSourceMapOrMissing[];
85
108
  transformDependencies: string[] | null;
86
109
  }
87
110
 
@@ -207,8 +230,8 @@ export type TransformChunkHook = (
207
230
  code: string,
208
231
  options: OutputOptions
209
232
  ) =>
210
- | Promise<{ code: string; map: RawSourceMap } | null | undefined>
211
- | { code: string; map: RawSourceMap }
233
+ | Promise<{ code: string; map?: SourceMapInput } | null | undefined>
234
+ | { code: string; map?: SourceMapInput }
212
235
  | null
213
236
  | undefined;
214
237
 
@@ -218,8 +241,8 @@ export type RenderChunkHook = (
218
241
  chunk: RenderedChunk,
219
242
  options: OutputOptions
220
243
  ) =>
221
- | Promise<{ code: string; map: RawSourceMap } | null>
222
- | { code: string; map: RawSourceMap }
244
+ | Promise<{ code: string; map?: SourceMapInput } | null>
245
+ | { code: string; map?: SourceMapInput }
223
246
  | string
224
247
  | null;
225
248
 
package/dist/rollup.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v1.16.4
4
- Tue, 02 Jul 2019 07:13:42 GMT - commit 2896755cc61fc360c0b59d196eb04d705a38b633
3
+ Rollup.js v1.17.0
4
+ Mon, 15 Jul 2019 04:31:04 GMT - commit 5d1541a577b06d9004a3533bde672761e5798482
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -16,7 +16,7 @@ import { tokTypes, Parser } from 'acorn';
16
16
  import { EventEmitter } from 'events';
17
17
  import module$1 from 'module';
18
18
 
19
- var version = "1.16.4";
19
+ var version = "1.17.0";
20
20
 
21
21
  var minimalisticAssert = assert;
22
22
  function assert(val, msg) {
@@ -583,13 +583,13 @@ function decode(mappings) {
583
583
  var c = mappings.charCodeAt(i);
584
584
  if (c === 44) { // ","
585
585
  if (segment.length)
586
- line.push(new Int32Array(segment));
586
+ line.push(segment);
587
587
  segment = [];
588
588
  j = 0;
589
589
  }
590
590
  else if (c === 59) { // ";"
591
591
  if (segment.length)
592
- line.push(new Int32Array(segment));
592
+ line.push(segment);
593
593
  segment = [];
594
594
  j = 0;
595
595
  decoded.push(line);
@@ -609,26 +609,30 @@ function decode(mappings) {
609
609
  }
610
610
  else {
611
611
  var shouldNegate = value & 1;
612
- value >>= 1;
613
- var num = shouldNegate ? -value : value;
612
+ value >>>= 1;
613
+ if (shouldNegate) {
614
+ value = -value;
615
+ if (value === 0)
616
+ value = -0x80000000;
617
+ }
614
618
  if (j == 0) {
615
- generatedCodeColumn += num;
619
+ generatedCodeColumn += value;
616
620
  segment.push(generatedCodeColumn);
617
621
  }
618
622
  else if (j === 1) {
619
- sourceFileIndex += num;
623
+ sourceFileIndex += value;
620
624
  segment.push(sourceFileIndex);
621
625
  }
622
626
  else if (j === 2) {
623
- sourceCodeLine += num;
627
+ sourceCodeLine += value;
624
628
  segment.push(sourceCodeLine);
625
629
  }
626
630
  else if (j === 3) {
627
- sourceCodeColumn += num;
631
+ sourceCodeColumn += value;
628
632
  segment.push(sourceCodeColumn);
629
633
  }
630
634
  else if (j === 4) {
631
- nameIndex += num;
635
+ nameIndex += value;
632
636
  segment.push(nameIndex);
633
637
  }
634
638
  j++;
@@ -637,7 +641,7 @@ function decode(mappings) {
637
641
  }
638
642
  }
639
643
  if (segment.length)
640
- line.push(new Int32Array(segment));
644
+ line.push(segment);
641
645
  decoded.push(line);
642
646
  return decoded;
643
647
  }
@@ -683,7 +687,7 @@ function encodeInteger(num) {
683
687
  num = num < 0 ? (-num << 1) | 1 : num << 1;
684
688
  do {
685
689
  var clamped = num & 31;
686
- num >>= 5;
690
+ num >>>= 5;
687
691
  if (num > 0) {
688
692
  clamped |= 32;
689
693
  }
@@ -8276,6 +8280,8 @@ function isReference(node, parent) {
8276
8280
  return !node.computed && isReference(node.object, node);
8277
8281
  }
8278
8282
  if (node.type === 'Identifier') {
8283
+ if (!parent)
8284
+ return true;
8279
8285
  switch (parent.type) {
8280
8286
  // disregard `bar` in `foo.bar`
8281
8287
  case 'MemberExpression': return parent.computed || node === parent.object;
@@ -11667,7 +11673,7 @@ class MetaProperty extends NodeBase {
11667
11673
  }
11668
11674
  ]);
11669
11675
  }
11670
- code.overwrite(parent.start, parent.end, replacement);
11676
+ code.overwrite(parent.start, parent.end, replacement, { contentOnly: true });
11671
11677
  return;
11672
11678
  }
11673
11679
  const replacement = pluginDriver.hookFirstSync('resolveImportMeta', [
@@ -11680,10 +11686,10 @@ class MetaProperty extends NodeBase {
11680
11686
  ]);
11681
11687
  if (typeof replacement === 'string') {
11682
11688
  if (parent instanceof MemberExpression) {
11683
- code.overwrite(parent.start, parent.end, replacement);
11689
+ code.overwrite(parent.start, parent.end, replacement, { contentOnly: true });
11684
11690
  }
11685
11691
  else {
11686
- code.overwrite(this.start, this.end, replacement);
11692
+ code.overwrite(this.start, this.end, replacement, { contentOnly: true });
11687
11693
  }
11688
11694
  }
11689
11695
  }
@@ -12788,6 +12794,7 @@ const nodeConstructors = {
12788
12794
  };
12789
12795
 
12790
12796
  function getOriginalLocation(sourcemapChain, location) {
12797
+ // This cast is guaranteed. If it were a missing Map, it wouldn't have a mappings.
12791
12798
  const filteredSourcemapChain = sourcemapChain.filter(sourcemap => sourcemap.mappings);
12792
12799
  while (filteredSourcemapChain.length > 0) {
12793
12800
  const sourcemap = filteredSourcemapChain.pop();
@@ -12796,12 +12803,12 @@ function getOriginalLocation(sourcemapChain, location) {
12796
12803
  if (line !== undefined) {
12797
12804
  for (const segment of line) {
12798
12805
  if (segment[0] >= location.column) {
12799
- if (segment.length < 4)
12806
+ if (segment.length === 1)
12800
12807
  break;
12801
12808
  location = {
12802
12809
  column: segment[3],
12803
12810
  line: segment[2] + 1,
12804
- name: sourcemap.names[segment[4]],
12811
+ name: segment.length === 5 ? sourcemap.names[segment[4]] : undefined,
12805
12812
  source: sourcemap.sources[segment[1]]
12806
12813
  };
12807
12814
  locationFound = true;
@@ -12850,13 +12857,13 @@ base$1.WithStatement = function (node, st, c) {
12850
12857
  };
12851
12858
  base$1.SwitchStatement = function (node, st, c) {
12852
12859
  c(node.discriminant, st, "Expression");
12853
- for (var i = 0, list = node.cases; i < list.length; i += 1) {
12854
- var cs = list[i];
12860
+ for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
12861
+ var cs = list$1[i$1];
12855
12862
 
12856
12863
  if (cs.test) { c(cs.test, st, "Expression"); }
12857
- for (var i$1 = 0, list$1 = cs.consequent; i$1 < list$1.length; i$1 += 1)
12864
+ for (var i = 0, list = cs.consequent; i < list.length; i += 1)
12858
12865
  {
12859
- var cons = list$1[i$1];
12866
+ var cons = list[i];
12860
12867
 
12861
12868
  c(cons, st, "Statement");
12862
12869
  }
@@ -13051,7 +13058,7 @@ base$1.ImportDeclaration = function (node, st, c) {
13051
13058
  }
13052
13059
  c(node.source, st, "Expression");
13053
13060
  };
13054
- base$1.ImportSpecifier = base$1.ImportDefaultSpecifier = base$1.ImportNamespaceSpecifier = base$1.Identifier = base$1.Literal = ignore;
13061
+ base$1.ImportSpecifier = base$1.ImportDefaultSpecifier = base$1.ImportNamespaceSpecifier = base$1.Identifier = base$1.Literal = base$1.Import = ignore;
13055
13062
 
13056
13063
  base$1.TaggedTemplateExpression = function (node, st, c) {
13057
13064
  c(node.tag, st, "Expression");
@@ -13358,20 +13365,15 @@ class Module {
13358
13365
  getDynamicImportExpressions() {
13359
13366
  return this.dynamicImports.map(({ node }) => {
13360
13367
  const importArgument = node.parent.arguments[0];
13361
- if (importArgument instanceof TemplateLiteral) {
13362
- if (importArgument.expressions.length === 0 && importArgument.quasis.length === 1) {
13363
- return importArgument.quasis[0].value.cooked;
13364
- }
13368
+ if (importArgument instanceof TemplateLiteral &&
13369
+ importArgument.quasis.length === 1 &&
13370
+ importArgument.quasis[0].value.cooked) {
13371
+ return importArgument.quasis[0].value.cooked;
13365
13372
  }
13366
- else if (importArgument instanceof Literal) {
13367
- if (typeof importArgument.value === 'string') {
13368
- return importArgument.value;
13369
- }
13373
+ if (importArgument instanceof Literal && typeof importArgument.value === 'string') {
13374
+ return importArgument.value;
13370
13375
  }
13371
- else {
13372
- return importArgument;
13373
- }
13374
- return undefined;
13376
+ return importArgument;
13375
13377
  });
13376
13378
  }
13377
13379
  getExportNamesByVariable() {
@@ -13834,10 +13836,12 @@ class Link {
13834
13836
  for (const line of this.mappings) {
13835
13837
  const tracedLine = [];
13836
13838
  for (const segment of line) {
13839
+ if (segment.length == 1)
13840
+ continue;
13837
13841
  const source = this.sources[segment[1]];
13838
13842
  if (!source)
13839
13843
  continue;
13840
- const traced = source.traceSegment(segment[2], segment[3], this.names[segment[4]]);
13844
+ const traced = source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : '');
13841
13845
  if (traced) {
13842
13846
  // newer sources are more likely to be used, so search backwards.
13843
13847
  let sourceIndex = sources.lastIndexOf(traced.source.filename);
@@ -13887,10 +13891,12 @@ class Link {
13887
13891
  const m = (i + j) >> 1;
13888
13892
  const segment = segments[m];
13889
13893
  if (segment[0] === column) {
13894
+ if (segment.length == 1)
13895
+ return null;
13890
13896
  const source = this.sources[segment[1]];
13891
13897
  if (!source)
13892
13898
  return null;
13893
- return source.traceSegment(segment[2], segment[3], this.names[segment[4]] || name);
13899
+ return source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : name);
13894
13900
  }
13895
13901
  if (segment[0] > column) {
13896
13902
  j = m - 1;
@@ -13902,50 +13908,46 @@ class Link {
13902
13908
  return null;
13903
13909
  }
13904
13910
  }
13905
- // TODO TypeScript: Fix <any> typecasts
13906
- function collapseSourcemaps(bundle, file, map, modules, bundleSourcemapChain, excludeContent) {
13907
- function linkMap(source, map) {
13908
- if (map.missing) {
13909
- bundle.graph.warn({
13910
- code: 'SOURCEMAP_BROKEN',
13911
- message: `Sourcemap is likely to be incorrect: a plugin${map.plugin ? ` ('${map.plugin}')` : ``} was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help`,
13912
- plugin: map.plugin,
13913
- url: `https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect`
13914
- });
13915
- map = {
13916
- mappings: '',
13917
- names: []
13918
- };
13911
+ function getLinkMap(graph) {
13912
+ return function linkMap(source, map) {
13913
+ if (map.mappings) {
13914
+ return new Link(map, [source]);
13919
13915
  }
13920
- return new Link(map, [source]);
13916
+ graph.warn({
13917
+ code: 'SOURCEMAP_BROKEN',
13918
+ message: `Sourcemap is likely to be incorrect: a plugin${map.plugin ? ` ('${map.plugin}')` : ``} was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help`,
13919
+ plugin: map.plugin,
13920
+ url: `https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect`
13921
+ });
13922
+ return new Link({
13923
+ mappings: [],
13924
+ names: []
13925
+ }, [source]);
13926
+ };
13927
+ }
13928
+ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, linkMap) {
13929
+ let source;
13930
+ if (!originalSourcemap) {
13931
+ source = new Source(id, originalCode);
13921
13932
  }
13933
+ else {
13934
+ const sources = originalSourcemap.sources;
13935
+ const sourcesContent = originalSourcemap.sourcesContent || [];
13936
+ // TODO indiscriminately treating IDs and sources as normal paths is probably bad.
13937
+ const directory = dirname(id) || '.';
13938
+ const sourceRoot = originalSourcemap.sourceRoot || '.';
13939
+ const baseSources = sources.map((source, i) => new Source(resolve(directory, sourceRoot, source), sourcesContent[i]));
13940
+ source = new Link(originalSourcemap, baseSources);
13941
+ }
13942
+ return sourcemapChain.reduce(linkMap, source);
13943
+ }
13944
+ function collapseSourcemaps(bundle, file, map, modules, bundleSourcemapChain, excludeContent) {
13945
+ const linkMap = getLinkMap(bundle.graph);
13922
13946
  const moduleSources = modules
13923
13947
  .filter(module => !module.excludeFromSourcemap)
13924
- .map(module => {
13925
- let sourcemapChain = module.sourcemapChain;
13926
- let source;
13927
- const originalSourcemap = module.originalSourcemap;
13928
- if (!originalSourcemap) {
13929
- source = new Source(module.id, module.originalCode);
13930
- }
13931
- else {
13932
- const sources = originalSourcemap.sources;
13933
- const sourcesContent = originalSourcemap.sourcesContent || [];
13934
- if (sources == null || (sources.length <= 1 && sources[0] == null)) {
13935
- source = new Source(module.id, sourcesContent[0]);
13936
- sourcemapChain = [originalSourcemap].concat(sourcemapChain);
13937
- }
13938
- else {
13939
- // TODO indiscriminately treating IDs and sources as normal paths is probably bad.
13940
- const directory = dirname(module.id) || '.';
13941
- const sourceRoot = originalSourcemap.sourceRoot || '.';
13942
- const baseSources = sources.map((source, i) => new Source(resolve(directory, sourceRoot, source), sourcesContent[i]));
13943
- source = new Link(originalSourcemap, baseSources);
13944
- }
13945
- }
13946
- source = sourcemapChain.reduce(linkMap, source);
13947
- return source;
13948
- });
13948
+ .map(module => getCollapsedSourcemap(module.id, module.originalCode, module.originalSourcemap, module.sourcemapChain, linkMap));
13949
+ // DecodedSourceMap (from magic-string) uses a number[] instead of the more
13950
+ // correct SourceMapSegment tuples. Cast it here to gain type safety.
13949
13951
  let source = new Link(map, moduleSources);
13950
13952
  source = bundleSourcemapChain.reduce(linkMap, source);
13951
13953
  let { sources, sourcesContent, names, mappings } = source.traceMappings();
@@ -13957,6 +13959,14 @@ function collapseSourcemaps(bundle, file, map, modules, bundleSourcemapChain, ex
13957
13959
  sourcesContent = (excludeContent ? null : sourcesContent);
13958
13960
  return new SourceMap({ file, sources, sourcesContent, names, mappings });
13959
13961
  }
13962
+ function collapseSourcemap(graph, id, originalCode, originalSourcemap, sourcemapChain) {
13963
+ if (!sourcemapChain.length) {
13964
+ return originalSourcemap;
13965
+ }
13966
+ const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(graph));
13967
+ const map = source.traceMappings();
13968
+ return Object.assign({ version: 3 }, map);
13969
+ }
13960
13970
 
13961
13971
  const DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT = {
13962
13972
  amd: deconflictImportsOther,
@@ -14153,6 +14163,30 @@ function getIndentString(modules, options) {
14153
14163
  return '\t';
14154
14164
  }
14155
14165
 
14166
+ function decodedSourcemap(map) {
14167
+ if (!map)
14168
+ return null;
14169
+ if (typeof map === 'string') {
14170
+ map = JSON.parse(map);
14171
+ }
14172
+ if (map.mappings === '') {
14173
+ return {
14174
+ mappings: [],
14175
+ names: [],
14176
+ sources: [],
14177
+ version: 3
14178
+ };
14179
+ }
14180
+ let mappings;
14181
+ if (typeof map.mappings === 'string') {
14182
+ mappings = decode(map.mappings);
14183
+ }
14184
+ else {
14185
+ mappings = map.mappings;
14186
+ }
14187
+ return Object.assign({}, map, { mappings });
14188
+ }
14189
+
14156
14190
  function renderChunk({ graph, chunk, renderChunk, code, sourcemapChain, options }) {
14157
14191
  const renderChunkReducer = (code, result, plugin) => {
14158
14192
  if (result == null)
@@ -14162,12 +14196,11 @@ function renderChunk({ graph, chunk, renderChunk, code, sourcemapChain, options
14162
14196
  code: result,
14163
14197
  map: undefined
14164
14198
  };
14165
- const map = typeof result.map === 'string' ? JSON.parse(result.map) : result.map;
14166
- if (map && typeof map.mappings === 'string')
14167
- map.mappings = decode(map.mappings);
14168
14199
  // strict null check allows 'null' maps to not be pushed to the chain, while 'undefined' gets the missing map warning
14169
- if (map !== null)
14200
+ if (result.map !== null) {
14201
+ const map = decodedSourcemap(result.map);
14170
14202
  sourcemapChain.push(map || { missing: true, plugin: plugin.name });
14203
+ }
14171
14204
  return result.code;
14172
14205
  };
14173
14206
  let inTransformBundle = false;
@@ -15962,9 +15995,7 @@ const uncacheablePlugin = pluginName => ({
15962
15995
  function transform(graph, source, module) {
15963
15996
  const id = module.id;
15964
15997
  const sourcemapChain = [];
15965
- const originalSourcemap = typeof source.map === 'string' ? JSON.parse(source.map) : source.map;
15966
- if (originalSourcemap && typeof originalSourcemap.mappings === 'string')
15967
- originalSourcemap.mappings = decode(originalSourcemap.mappings);
15998
+ let originalSourcemap = source.map === null ? null : decodedSourcemap(source.map);
15968
15999
  const baseEmitAsset = graph.pluginDriver.emitAsset;
15969
16000
  const originalCode = source.code;
15970
16001
  let ast = source.ast;
@@ -16024,12 +16055,10 @@ function transform(graph, source, module) {
16024
16055
  else {
16025
16056
  return code;
16026
16057
  }
16027
- if (result.map && typeof result.map.mappings === 'string') {
16028
- result.map.mappings = decode(result.map.mappings);
16029
- }
16030
16058
  // strict null check allows 'null' maps to not be pushed to the chain, while 'undefined' gets the missing map warning
16031
16059
  if (result.map !== null) {
16032
- sourcemapChain.push(result.map || { missing: true, plugin: plugin.name });
16060
+ const map = decodedSourcemap(result.map);
16061
+ sourcemapChain.push(map || { missing: true, plugin: plugin.name });
16033
16062
  }
16034
16063
  ast = result.ast;
16035
16064
  return result.code;
@@ -16086,6 +16115,18 @@ function transform(graph, source, module) {
16086
16115
  setAssetSourceErr = err;
16087
16116
  }
16088
16117
  }
16118
+ },
16119
+ getCombinedSourcemap() {
16120
+ const combinedMap = collapseSourcemap(graph, id, originalCode, originalSourcemap, sourcemapChain);
16121
+ if (!combinedMap) {
16122
+ const magicString = new MagicString(originalCode);
16123
+ return magicString.generateMap({ includeContent: true, hires: true, source: id });
16124
+ }
16125
+ if (originalSourcemap !== combinedMap) {
16126
+ originalSourcemap = combinedMap;
16127
+ sourcemapChain.length = 0;
16128
+ }
16129
+ return new SourceMap(Object.assign({}, combinedMap, { file: null, sourcesContent: combinedMap.sourcesContent }));
16089
16130
  } });
16090
16131
  })
16091
16132
  .catch(err => {
@@ -17052,11 +17093,9 @@ const defaultOnWarn = warning => {
17052
17093
  console.warn(warning.message);
17053
17094
  }
17054
17095
  };
17055
- const getOnWarn = (config, command, defaultOnWarnHandler = defaultOnWarn) => command.silent
17056
- ? () => { }
17057
- : config.onwarn
17058
- ? warning => config.onwarn(warning, defaultOnWarnHandler)
17059
- : defaultOnWarnHandler;
17096
+ const getOnWarn = (config, defaultOnWarnHandler = defaultOnWarn) => config.onwarn
17097
+ ? warning => config.onwarn(warning, defaultOnWarnHandler)
17098
+ : defaultOnWarnHandler;
17060
17099
  const getExternal = (config, command) => {
17061
17100
  const configExternal = config.external;
17062
17101
  return typeof configExternal === 'function'
@@ -17141,7 +17180,7 @@ function getInputOptions(config, command = { external: [], globals: undefined },
17141
17180
  input: getOption('input', []),
17142
17181
  manualChunks: getOption('manualChunks'),
17143
17182
  moduleContext: config.moduleContext,
17144
- onwarn: getOnWarn(config, command, defaultOnWarnHandler),
17183
+ onwarn: getOnWarn(config, defaultOnWarnHandler),
17145
17184
  perf: getOption('perf', false),
17146
17185
  plugins: config.plugins,
17147
17186
  preserveModules: getOption('preserveModules'),
@@ -20880,25 +20919,26 @@ class Task {
20880
20919
  .then(result => {
20881
20920
  if (this.closed)
20882
20921
  return undefined;
20922
+ const previouslyWatched = this.watched;
20883
20923
  const watched = (this.watched = new Set());
20884
20924
  this.cache = result.cache;
20885
20925
  this.watchFiles = result.watchFiles;
20886
- this.cache.modules.forEach(module => {
20926
+ for (const module of this.cache.modules) {
20887
20927
  if (module.transformDependencies) {
20888
20928
  module.transformDependencies.forEach(depId => {
20889
20929
  watched.add(depId);
20890
20930
  this.watchFile(depId, true);
20891
20931
  });
20892
20932
  }
20893
- });
20894
- this.watchFiles.forEach(id => {
20933
+ }
20934
+ for (const id of this.watchFiles) {
20895
20935
  watched.add(id);
20896
20936
  this.watchFile(id);
20897
- });
20898
- this.watched.forEach(id => {
20937
+ }
20938
+ for (const id of previouslyWatched) {
20899
20939
  if (!watched.has(id))
20900
20940
  deleteTask(id, this, this.chokidarOptionsHash);
20901
- });
20941
+ }
20902
20942
  return Promise.all(this.outputs.map(output => result.write(output))).then(() => result);
20903
20943
  })
20904
20944
  .then((result) => {