UNPKG

24.7 kBJavaScriptView Raw
1/*
2 @license
3 Rollup.js v2.33.1
4 Mon, 02 Nov 2020 06:50:50 GMT - commit d861c91c068bc4e64d84db3b84232d3fb7f1d073
5
6
7 https://github.com/rollup/rollup
8
9 Released under the MIT License.
10*/
11'use strict';
12
13var rollup = require('./rollup.js');
14var util = require('util');
15require('fs');
16var sysPath = require('path');
17var mergeOptions = require('./mergeOptions.js');
18require('crypto');
19require('events');
20var index = require('./index.js');
21require('stream');
22var require$$1 = require('os');
23
24const isEmptyString = val => typeof val === 'string' && (val === '' || val === './');
25
26/**
27 * Returns an array of strings that match one or more glob patterns.
28 *
29 * ```js
30 * const mm = require('micromatch');
31 * // mm(list, patterns[, options]);
32 *
33 * console.log(mm(['a.js', 'a.txt'], ['*.js']));
34 * //=> [ 'a.js' ]
35 * ```
36 * @param {String|Array<string>} list List of strings to match.
37 * @param {String|Array<string>} patterns One or more glob patterns to use for matching.
38 * @param {Object} options See available [options](#options)
39 * @return {Array} Returns an array of matches
40 * @summary false
41 * @api public
42 */
43
44const micromatch = (list, patterns, options) => {
45 patterns = [].concat(patterns);
46 list = [].concat(list);
47
48 let omit = new Set();
49 let keep = new Set();
50 let items = new Set();
51 let negatives = 0;
52
53 let onResult = state => {
54 items.add(state.output);
55 if (options && options.onResult) {
56 options.onResult(state);
57 }
58 };
59
60 for (let i = 0; i < patterns.length; i++) {
61 let isMatch = index.picomatch(String(patterns[i]), { ...options, onResult }, true);
62 let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
63 if (negated) negatives++;
64
65 for (let item of list) {
66 let matched = isMatch(item, true);
67
68 let match = negated ? !matched.isMatch : matched.isMatch;
69 if (!match) continue;
70
71 if (negated) {
72 omit.add(matched.output);
73 } else {
74 omit.delete(matched.output);
75 keep.add(matched.output);
76 }
77 }
78 }
79
80 let result = negatives === patterns.length ? [...items] : [...keep];
81 let matches = result.filter(item => !omit.has(item));
82
83 if (options && matches.length === 0) {
84 if (options.failglob === true) {
85 throw new Error(`No matches found for "${patterns.join(', ')}"`);
86 }
87
88 if (options.nonull === true || options.nullglob === true) {
89 return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns;
90 }
91 }
92
93 return matches;
94};
95
96/**
97 * Backwards compatibility
98 */
99
100micromatch.match = micromatch;
101
102/**
103 * Returns a matcher function from the given glob `pattern` and `options`.
104 * The returned function takes a string to match as its only argument and returns
105 * true if the string is a match.
106 *
107 * ```js
108 * const mm = require('micromatch');
109 * // mm.matcher(pattern[, options]);
110 *
111 * const isMatch = mm.matcher('*.!(*a)');
112 * console.log(isMatch('a.a')); //=> false
113 * console.log(isMatch('a.b')); //=> true
114 * ```
115 * @param {String} `pattern` Glob pattern
116 * @param {Object} `options`
117 * @return {Function} Returns a matcher function.
118 * @api public
119 */
120
121micromatch.matcher = (pattern, options) => index.picomatch(pattern, options);
122
123/**
124 * Returns true if **any** of the given glob `patterns` match the specified `string`.
125 *
126 * ```js
127 * const mm = require('micromatch');
128 * // mm.isMatch(string, patterns[, options]);
129 *
130 * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
131 * console.log(mm.isMatch('a.a', 'b.*')); //=> false
132 * ```
133 * @param {String} str The string to test.
134 * @param {String|Array} patterns One or more glob patterns to use for matching.
135 * @param {Object} [options] See available [options](#options).
136 * @return {Boolean} Returns true if any patterns match `str`
137 * @api public
138 */
139
140micromatch.isMatch = (str, patterns, options) => index.picomatch(patterns, options)(str);
141
142/**
143 * Backwards compatibility
144 */
145
146micromatch.any = micromatch.isMatch;
147
148/**
149 * Returns a list of strings that _**do not match any**_ of the given `patterns`.
150 *
151 * ```js
152 * const mm = require('micromatch');
153 * // mm.not(list, patterns[, options]);
154 *
155 * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
156 * //=> ['b.b', 'c.c']
157 * ```
158 * @param {Array} `list` Array of strings to match.
159 * @param {String|Array} `patterns` One or more glob pattern to use for matching.
160 * @param {Object} `options` See available [options](#options) for changing how matches are performed
161 * @return {Array} Returns an array of strings that **do not match** the given patterns.
162 * @api public
163 */
164
165micromatch.not = (list, patterns, options = {}) => {
166 patterns = [].concat(patterns).map(String);
167 let result = new Set();
168 let items = [];
169
170 let onResult = state => {
171 if (options.onResult) options.onResult(state);
172 items.push(state.output);
173 };
174
175 let matches = micromatch(list, patterns, { ...options, onResult });
176
177 for (let item of items) {
178 if (!matches.includes(item)) {
179 result.add(item);
180 }
181 }
182 return [...result];
183};
184
185/**
186 * Returns true if the given `string` contains the given pattern. Similar
187 * to [.isMatch](#isMatch) but the pattern can match any part of the string.
188 *
189 * ```js
190 * var mm = require('micromatch');
191 * // mm.contains(string, pattern[, options]);
192 *
193 * console.log(mm.contains('aa/bb/cc', '*b'));
194 * //=> true
195 * console.log(mm.contains('aa/bb/cc', '*d'));
196 * //=> false
197 * ```
198 * @param {String} `str` The string to match.
199 * @param {String|Array} `patterns` Glob pattern to use for matching.
200 * @param {Object} `options` See available [options](#options) for changing how matches are performed
201 * @return {Boolean} Returns true if the patter matches any part of `str`.
202 * @api public
203 */
204
205micromatch.contains = (str, pattern, options) => {
206 if (typeof str !== 'string') {
207 throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
208 }
209
210 if (Array.isArray(pattern)) {
211 return pattern.some(p => micromatch.contains(str, p, options));
212 }
213
214 if (typeof pattern === 'string') {
215 if (isEmptyString(str) || isEmptyString(pattern)) {
216 return false;
217 }
218
219 if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) {
220 return true;
221 }
222 }
223
224 return micromatch.isMatch(str, pattern, { ...options, contains: true });
225};
226
227/**
228 * Filter the keys of the given object with the given `glob` pattern
229 * and `options`. Does not attempt to match nested keys. If you need this feature,
230 * use [glob-object][] instead.
231 *
232 * ```js
233 * const mm = require('micromatch');
234 * // mm.matchKeys(object, patterns[, options]);
235 *
236 * const obj = { aa: 'a', ab: 'b', ac: 'c' };
237 * console.log(mm.matchKeys(obj, '*b'));
238 * //=> { ab: 'b' }
239 * ```
240 * @param {Object} `object` The object with keys to filter.
241 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
242 * @param {Object} `options` See available [options](#options) for changing how matches are performed
243 * @return {Object} Returns an object with only keys that match the given patterns.
244 * @api public
245 */
246
247micromatch.matchKeys = (obj, patterns, options) => {
248 if (!index.utils.isObject(obj)) {
249 throw new TypeError('Expected the first argument to be an object');
250 }
251 let keys = micromatch(Object.keys(obj), patterns, options);
252 let res = {};
253 for (let key of keys) res[key] = obj[key];
254 return res;
255};
256
257/**
258 * Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
259 *
260 * ```js
261 * const mm = require('micromatch');
262 * // mm.some(list, patterns[, options]);
263 *
264 * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
265 * // true
266 * console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
267 * // false
268 * ```
269 * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
270 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
271 * @param {Object} `options` See available [options](#options) for changing how matches are performed
272 * @return {Boolean} Returns true if any patterns match `str`
273 * @api public
274 */
275
276micromatch.some = (list, patterns, options) => {
277 let items = [].concat(list);
278
279 for (let pattern of [].concat(patterns)) {
280 let isMatch = index.picomatch(String(pattern), options);
281 if (items.some(item => isMatch(item))) {
282 return true;
283 }
284 }
285 return false;
286};
287
288/**
289 * Returns true if every string in the given `list` matches
290 * any of the given glob `patterns`.
291 *
292 * ```js
293 * const mm = require('micromatch');
294 * // mm.every(list, patterns[, options]);
295 *
296 * console.log(mm.every('foo.js', ['foo.js']));
297 * // true
298 * console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
299 * // true
300 * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
301 * // false
302 * console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
303 * // false
304 * ```
305 * @param {String|Array} `list` The string or array of strings to test.
306 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
307 * @param {Object} `options` See available [options](#options) for changing how matches are performed
308 * @return {Boolean} Returns true if any patterns match `str`
309 * @api public
310 */
311
312micromatch.every = (list, patterns, options) => {
313 let items = [].concat(list);
314
315 for (let pattern of [].concat(patterns)) {
316 let isMatch = index.picomatch(String(pattern), options);
317 if (!items.every(item => isMatch(item))) {
318 return false;
319 }
320 }
321 return true;
322};
323
324/**
325 * Returns true if **all** of the given `patterns` match
326 * the specified string.
327 *
328 * ```js
329 * const mm = require('micromatch');
330 * // mm.all(string, patterns[, options]);
331 *
332 * console.log(mm.all('foo.js', ['foo.js']));
333 * // true
334 *
335 * console.log(mm.all('foo.js', ['*.js', '!foo.js']));
336 * // false
337 *
338 * console.log(mm.all('foo.js', ['*.js', 'foo.js']));
339 * // true
340 *
341 * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
342 * // true
343 * ```
344 * @param {String|Array} `str` The string to test.
345 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
346 * @param {Object} `options` See available [options](#options) for changing how matches are performed
347 * @return {Boolean} Returns true if any patterns match `str`
348 * @api public
349 */
350
351micromatch.all = (str, patterns, options) => {
352 if (typeof str !== 'string') {
353 throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
354 }
355
356 return [].concat(patterns).every(p => index.picomatch(p, options)(str));
357};
358
359/**
360 * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
361 *
362 * ```js
363 * const mm = require('micromatch');
364 * // mm.capture(pattern, string[, options]);
365 *
366 * console.log(mm.capture('test/*.js', 'test/foo.js'));
367 * //=> ['foo']
368 * console.log(mm.capture('test/*.js', 'foo/bar.css'));
369 * //=> null
370 * ```
371 * @param {String} `glob` Glob pattern to use for matching.
372 * @param {String} `input` String to match
373 * @param {Object} `options` See available [options](#options) for changing how matches are performed
374 * @return {Boolean} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
375 * @api public
376 */
377
378micromatch.capture = (glob, input, options) => {
379 let posix = index.utils.isWindows(options);
380 let regex = index.picomatch.makeRe(String(glob), { ...options, capture: true });
381 let match = regex.exec(posix ? index.utils.toPosixSlashes(input) : input);
382
383 if (match) {
384 return match.slice(1).map(v => v === void 0 ? '' : v);
385 }
386};
387
388/**
389 * Create a regular expression from the given glob `pattern`.
390 *
391 * ```js
392 * const mm = require('micromatch');
393 * // mm.makeRe(pattern[, options]);
394 *
395 * console.log(mm.makeRe('*.js'));
396 * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
397 * ```
398 * @param {String} `pattern` A glob pattern to convert to regex.
399 * @param {Object} `options`
400 * @return {RegExp} Returns a regex created from the given pattern.
401 * @api public
402 */
403
404micromatch.makeRe = (...args) => index.picomatch.makeRe(...args);
405
406/**
407 * Scan a glob pattern to separate the pattern into segments. Used
408 * by the [split](#split) method.
409 *
410 * ```js
411 * const mm = require('micromatch');
412 * const state = mm.scan(pattern[, options]);
413 * ```
414 * @param {String} `pattern`
415 * @param {Object} `options`
416 * @return {Object} Returns an object with
417 * @api public
418 */
419
420micromatch.scan = (...args) => index.picomatch.scan(...args);
421
422/**
423 * Parse a glob pattern to create the source string for a regular
424 * expression.
425 *
426 * ```js
427 * const mm = require('micromatch');
428 * const state = mm(pattern[, options]);
429 * ```
430 * @param {String} `glob`
431 * @param {Object} `options`
432 * @return {Object} Returns an object with useful properties and output to be used as regex source string.
433 * @api public
434 */
435
436micromatch.parse = (patterns, options) => {
437 let res = [];
438 for (let pattern of [].concat(patterns || [])) {
439 for (let str of index.braces_1(String(pattern), options)) {
440 res.push(index.picomatch.parse(str, options));
441 }
442 }
443 return res;
444};
445
446/**
447 * Process the given brace `pattern`.
448 *
449 * ```js
450 * const { braces } = require('micromatch');
451 * console.log(braces('foo/{a,b,c}/bar'));
452 * //=> [ 'foo/(a|b|c)/bar' ]
453 *
454 * console.log(braces('foo/{a,b,c}/bar', { expand: true }));
455 * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ]
456 * ```
457 * @param {String} `pattern` String with brace pattern to process.
458 * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
459 * @return {Array}
460 * @api public
461 */
462
463micromatch.braces = (pattern, options) => {
464 if (typeof pattern !== 'string') throw new TypeError('Expected a string');
465 if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) {
466 return [pattern];
467 }
468 return index.braces_1(pattern, options);
469};
470
471/**
472 * Expand braces
473 */
474
475micromatch.braceExpand = (pattern, options) => {
476 if (typeof pattern !== 'string') throw new TypeError('Expected a string');
477 return micromatch.braces(pattern, { ...options, expand: true });
478};
479
480/**
481 * Expose micromatch
482 */
483
484var micromatch_1 = micromatch;
485
486function ensureArray(thing) {
487 if (Array.isArray(thing))
488 return thing;
489 if (thing == undefined)
490 return [];
491 return [thing];
492}
493
494function getMatcherString(id, resolutionBase) {
495 if (resolutionBase === false) {
496 return id;
497 }
498 return sysPath.resolve(...(typeof resolutionBase === 'string' ? [resolutionBase, id] : [id]));
499}
500const createFilter = function createFilter(include, exclude, options) {
501 const resolutionBase = options && options.resolve;
502 const getMatcher = (id) => {
503 return id instanceof RegExp
504 ? id
505 : {
506 test: micromatch_1.matcher(getMatcherString(id, resolutionBase)
507 .split(sysPath.sep)
508 .join('/'), { dot: true })
509 };
510 };
511 const includeMatchers = ensureArray(include).map(getMatcher);
512 const excludeMatchers = ensureArray(exclude).map(getMatcher);
513 return function (id) {
514 if (typeof id !== 'string')
515 return false;
516 if (/\0/.test(id))
517 return false;
518 id = id.split(sysPath.sep).join('/');
519 for (let i = 0; i < excludeMatchers.length; ++i) {
520 const matcher = excludeMatchers[i];
521 if (matcher.test(id))
522 return false;
523 }
524 for (let i = 0; i < includeMatchers.length; ++i) {
525 const matcher = includeMatchers[i];
526 if (matcher.test(id))
527 return true;
528 }
529 return !includeMatchers.length;
530 };
531};
532
533class FileWatcher {
534 constructor(task, chokidarOptions) {
535 this.transformWatchers = new Map();
536 this.chokidarOptions = chokidarOptions;
537 this.task = task;
538 this.watcher = this.createWatcher(null);
539 }
540 close() {
541 this.watcher.close();
542 for (const watcher of this.transformWatchers.values()) {
543 watcher.close();
544 }
545 }
546 unwatch(id) {
547 this.watcher.unwatch(id);
548 const transformWatcher = this.transformWatchers.get(id);
549 if (transformWatcher) {
550 this.transformWatchers.delete(id);
551 transformWatcher.close();
552 }
553 }
554 watch(id, isTransformDependency) {
555 if (isTransformDependency) {
556 const watcher = this.transformWatchers.get(id) || this.createWatcher(id);
557 watcher.add(id);
558 this.transformWatchers.set(id, watcher);
559 }
560 else {
561 this.watcher.add(id);
562 }
563 }
564 createWatcher(transformWatcherId) {
565 const task = this.task;
566 const isLinux = require$$1.platform() === 'linux';
567 const isTransformDependency = transformWatcherId !== null;
568 const handleChange = (id, event) => {
569 const changedId = transformWatcherId || id;
570 if (isLinux) {
571 // unwatching and watching fixes an issue with chokidar where on certain systems,
572 // a file that was unlinked and immediately recreated would create a change event
573 // but then no longer any further events
574 watcher.unwatch(changedId);
575 watcher.add(changedId);
576 }
577 task.invalidate(changedId, { isTransformDependency, event });
578 };
579 const watcher = index.chokidar
580 .watch([], this.chokidarOptions)
581 .on('add', id => handleChange(id, 'create'))
582 .on('change', id => handleChange(id, 'update'))
583 .on('unlink', id => handleChange(id, 'delete'));
584 return watcher;
585 }
586}
587
588const eventsRewrites = {
589 create: {
590 create: 'buggy',
591 delete: null,
592 update: 'create',
593 },
594 delete: {
595 create: 'update',
596 delete: 'buggy',
597 update: 'buggy',
598 },
599 update: {
600 create: 'buggy',
601 delete: 'delete',
602 update: 'update',
603 }
604};
605class Watcher {
606 constructor(configs, emitter) {
607 this.buildDelay = 0;
608 this.buildTimeout = null;
609 this.invalidatedIds = new Map();
610 this.rerun = false;
611 this.emitter = emitter;
612 emitter.close = this.close.bind(this);
613 this.tasks = configs.map(config => new Task(this, config));
614 this.buildDelay = configs.reduce((buildDelay, { watch }) => watch && typeof watch.buildDelay === 'number'
615 ? Math.max(buildDelay, watch.buildDelay)
616 : buildDelay, this.buildDelay);
617 this.running = true;
618 process.nextTick(() => this.run());
619 }
620 close() {
621 if (this.buildTimeout)
622 clearTimeout(this.buildTimeout);
623 for (const task of this.tasks) {
624 task.close();
625 }
626 this.emitter.emit('close');
627 this.emitter.removeAllListeners();
628 }
629 invalidate(file) {
630 if (file) {
631 const prevEvent = this.invalidatedIds.get(file.id);
632 const event = prevEvent
633 ? eventsRewrites[prevEvent][file.event]
634 : file.event;
635 if (event === 'buggy') {
636 //TODO: throws or warn? Currently just ignore, uses new event
637 this.invalidatedIds.set(file.id, file.event);
638 }
639 else if (event === null) {
640 this.invalidatedIds.delete(file.id);
641 }
642 else {
643 this.invalidatedIds.set(file.id, event);
644 }
645 }
646 if (this.running) {
647 this.rerun = true;
648 return;
649 }
650 if (this.buildTimeout)
651 clearTimeout(this.buildTimeout);
652 this.buildTimeout = setTimeout(() => {
653 this.buildTimeout = null;
654 for (const [id, event] of this.invalidatedIds.entries()) {
655 this.emitter.emit('change', id, { event });
656 }
657 this.invalidatedIds.clear();
658 this.emitter.emit('restart');
659 this.run();
660 }, this.buildDelay);
661 }
662 async run() {
663 this.running = true;
664 this.emitter.emit('event', {
665 code: 'START'
666 });
667 try {
668 for (const task of this.tasks) {
669 await task.run();
670 }
671 this.running = false;
672 this.emitter.emit('event', {
673 code: 'END'
674 });
675 }
676 catch (error) {
677 this.running = false;
678 this.emitter.emit('event', {
679 code: 'ERROR',
680 error
681 });
682 }
683 if (this.rerun) {
684 this.rerun = false;
685 this.invalidate();
686 }
687 }
688}
689class Task {
690 constructor(watcher, config) {
691 this.cache = { modules: [] };
692 this.watchFiles = [];
693 this.invalidated = true;
694 this.watcher = watcher;
695 this.closed = false;
696 this.watched = new Set();
697 this.skipWrite = config.watch && !!config.watch.skipWrite;
698 this.options = mergeOptions.mergeOptions(config);
699 this.outputs = this.options.output;
700 this.outputFiles = this.outputs.map(output => {
701 if (output.file || output.dir)
702 return sysPath.resolve(output.file || output.dir);
703 return undefined;
704 });
705 const watchOptions = this.options.watch || {};
706 this.filter = createFilter(watchOptions.include, watchOptions.exclude);
707 this.fileWatcher = new FileWatcher(this, {
708 ...watchOptions.chokidar,
709 disableGlobbing: true,
710 ignoreInitial: true
711 });
712 }
713 close() {
714 this.closed = true;
715 this.fileWatcher.close();
716 }
717 invalidate(id, details) {
718 this.invalidated = true;
719 if (details.isTransformDependency) {
720 for (const module of this.cache.modules) {
721 if (module.transformDependencies.indexOf(id) === -1)
722 continue;
723 // effective invalidation
724 module.originalCode = null;
725 }
726 }
727 this.watcher.invalidate({ id, event: details.event });
728 }
729 async run() {
730 if (!this.invalidated)
731 return;
732 this.invalidated = false;
733 const options = {
734 ...this.options,
735 cache: this.cache
736 };
737 const start = Date.now();
738 this.watcher.emitter.emit('event', {
739 code: 'BUNDLE_START',
740 input: this.options.input,
741 output: this.outputFiles
742 });
743 try {
744 const result = await rollup.rollupInternal(options, this.watcher.emitter);
745 if (this.closed) {
746 return;
747 }
748 this.updateWatchedFiles(result);
749 this.skipWrite || (await Promise.all(this.outputs.map(output => result.write(output))));
750 this.watcher.emitter.emit('event', {
751 code: 'BUNDLE_END',
752 duration: Date.now() - start,
753 input: this.options.input,
754 output: this.outputFiles,
755 result
756 });
757 }
758 catch (error) {
759 if (this.closed) {
760 return;
761 }
762 if (Array.isArray(error.watchFiles)) {
763 for (const id of error.watchFiles) {
764 this.watchFile(id);
765 }
766 }
767 if (error.id) {
768 this.cache.modules = this.cache.modules.filter(module => module.id !== error.id);
769 }
770 throw error;
771 }
772 }
773 updateWatchedFiles(result) {
774 const previouslyWatched = this.watched;
775 this.watched = new Set();
776 this.watchFiles = result.watchFiles;
777 this.cache = result.cache;
778 for (const id of this.watchFiles) {
779 this.watchFile(id);
780 }
781 for (const module of this.cache.modules) {
782 for (const depId of module.transformDependencies) {
783 this.watchFile(depId, true);
784 }
785 }
786 for (const id of previouslyWatched) {
787 if (!this.watched.has(id)) {
788 this.fileWatcher.unwatch(id);
789 }
790 }
791 }
792 watchFile(id, isTransformDependency = false) {
793 if (!this.filter(id))
794 return;
795 this.watched.add(id);
796 if (this.outputFiles.some(file => file === id)) {
797 throw new Error('Cannot import the generated bundle');
798 }
799 // this is necessary to ensure that any 'renamed' files
800 // continue to be watched following an error
801 this.fileWatcher.watch(id, isTransformDependency);
802 }
803}
804
805exports.Task = Task;
806exports.Watcher = Watcher;
807//# sourceMappingURL=watch.js.map