rollup 2.8.0 → 2.9.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.
- package/CHANGELOG.md +44 -0
- package/LICENSE.md +0 -27
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +390 -275
- package/dist/es/shared/watch.js +20 -16
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.d.ts +22 -12
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +7 -7
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +390 -275
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +20 -16
- package/package.json +9 -10
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.9.1
|
|
4
|
+
Mon, 11 May 2020 05:23:48 GMT - commit 1436473192ef975ee515ede6ab90dbf832cdfab1
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -584,15 +584,19 @@ class FileWatcher {
|
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
-
const DELAY = 200;
|
|
588
587
|
class Watcher {
|
|
589
588
|
constructor(configs, emitter) {
|
|
589
|
+
this.buildDelay = 0;
|
|
590
590
|
this.buildTimeout = null;
|
|
591
591
|
this.invalidatedIds = new Set();
|
|
592
592
|
this.rerun = false;
|
|
593
593
|
this.emitter = emitter;
|
|
594
594
|
emitter.close = this.close.bind(this);
|
|
595
|
-
|
|
595
|
+
const configArray = rollup_js.ensureArray(configs);
|
|
596
|
+
this.tasks = configArray.map(config => new Task(this, config));
|
|
597
|
+
this.buildDelay = configArray.reduce((buildDelay, { watch }) => watch && typeof watch.buildDelay === 'number'
|
|
598
|
+
? Math.max(buildDelay, watch.buildDelay)
|
|
599
|
+
: buildDelay, this.buildDelay);
|
|
596
600
|
this.running = true;
|
|
597
601
|
process.nextTick(() => this.run());
|
|
598
602
|
}
|
|
@@ -625,12 +629,12 @@ class Watcher {
|
|
|
625
629
|
this.invalidatedIds.clear();
|
|
626
630
|
this.emit('restart');
|
|
627
631
|
this.run();
|
|
628
|
-
},
|
|
632
|
+
}, this.buildDelay);
|
|
629
633
|
}
|
|
630
634
|
async run() {
|
|
631
635
|
this.running = true;
|
|
632
636
|
this.emit('event', {
|
|
633
|
-
code: 'START'
|
|
637
|
+
code: 'START'
|
|
634
638
|
});
|
|
635
639
|
try {
|
|
636
640
|
for (const task of this.tasks) {
|
|
@@ -638,14 +642,14 @@ class Watcher {
|
|
|
638
642
|
}
|
|
639
643
|
this.running = false;
|
|
640
644
|
this.emit('event', {
|
|
641
|
-
code: 'END'
|
|
645
|
+
code: 'END'
|
|
642
646
|
});
|
|
643
647
|
}
|
|
644
648
|
catch (error) {
|
|
645
649
|
this.running = false;
|
|
646
650
|
this.emit('event', {
|
|
647
651
|
code: 'ERROR',
|
|
648
|
-
error
|
|
652
|
+
error
|
|
649
653
|
});
|
|
650
654
|
}
|
|
651
655
|
if (this.rerun) {
|
|
@@ -665,7 +669,7 @@ class Task {
|
|
|
665
669
|
this.skipWrite = config.watch && !!config.watch.skipWrite;
|
|
666
670
|
this.options = mergeOptions.mergeOptions(config);
|
|
667
671
|
this.outputs = this.options.output;
|
|
668
|
-
this.outputFiles = this.outputs.map(
|
|
672
|
+
this.outputFiles = this.outputs.map(output => {
|
|
669
673
|
if (output.file || output.dir)
|
|
670
674
|
return path.resolve(output.file || output.dir);
|
|
671
675
|
return undefined;
|
|
@@ -675,7 +679,7 @@ class Task {
|
|
|
675
679
|
this.fileWatcher = new FileWatcher(this, {
|
|
676
680
|
...watchOptions.chokidar,
|
|
677
681
|
disableGlobbing: true,
|
|
678
|
-
ignoreInitial: true
|
|
682
|
+
ignoreInitial: true
|
|
679
683
|
});
|
|
680
684
|
}
|
|
681
685
|
close() {
|
|
@@ -700,13 +704,13 @@ class Task {
|
|
|
700
704
|
this.invalidated = false;
|
|
701
705
|
const options = {
|
|
702
706
|
...this.options,
|
|
703
|
-
cache: this.cache
|
|
707
|
+
cache: this.cache
|
|
704
708
|
};
|
|
705
709
|
const start = Date.now();
|
|
706
710
|
this.watcher.emit('event', {
|
|
707
711
|
code: 'BUNDLE_START',
|
|
708
712
|
input: this.options.input,
|
|
709
|
-
output: this.outputFiles
|
|
713
|
+
output: this.outputFiles
|
|
710
714
|
});
|
|
711
715
|
try {
|
|
712
716
|
const result = await rollup_js.rollupInternal(options, this.watcher.emitter);
|
|
@@ -714,13 +718,13 @@ class Task {
|
|
|
714
718
|
return;
|
|
715
719
|
}
|
|
716
720
|
this.updateWatchedFiles(result);
|
|
717
|
-
this.skipWrite || (await Promise.all(this.outputs.map(
|
|
721
|
+
this.skipWrite || (await Promise.all(this.outputs.map(output => result.write(output))));
|
|
718
722
|
this.watcher.emit('event', {
|
|
719
723
|
code: 'BUNDLE_END',
|
|
720
724
|
duration: Date.now() - start,
|
|
721
725
|
input: this.options.input,
|
|
722
726
|
output: this.outputFiles,
|
|
723
|
-
result
|
|
727
|
+
result
|
|
724
728
|
});
|
|
725
729
|
}
|
|
726
730
|
catch (error) {
|
|
@@ -733,7 +737,7 @@ class Task {
|
|
|
733
737
|
}
|
|
734
738
|
}
|
|
735
739
|
if (error.id) {
|
|
736
|
-
this.cache.modules = this.cache.modules.filter(
|
|
740
|
+
this.cache.modules = this.cache.modules.filter(module => module.id !== error.id);
|
|
737
741
|
}
|
|
738
742
|
throw error;
|
|
739
743
|
}
|
|
@@ -761,7 +765,7 @@ class Task {
|
|
|
761
765
|
if (!this.filter(id))
|
|
762
766
|
return;
|
|
763
767
|
this.watched.add(id);
|
|
764
|
-
if (this.outputFiles.some(
|
|
768
|
+
if (this.outputFiles.some(file => file === id)) {
|
|
765
769
|
throw new Error('Cannot import the generated bundle');
|
|
766
770
|
}
|
|
767
771
|
// this is necessary to ensure that any 'renamed' files
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "Next-generation ES module bundler",
|
|
5
5
|
"main": "dist/rollup.js",
|
|
6
6
|
"module": "dist/es/rollup.js",
|
|
@@ -71,13 +71,12 @@
|
|
|
71
71
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
72
72
|
"@rollup/plugin-replace": "^2.3.2",
|
|
73
73
|
"@types/micromatch": "^4.0.1",
|
|
74
|
-
"@types/node": "^13.13.
|
|
74
|
+
"@types/node": "^13.13.5",
|
|
75
75
|
"@types/require-relative": "^0.8.0",
|
|
76
76
|
"@types/signal-exit": "^3.0.0",
|
|
77
77
|
"@types/yargs-parser": "^15.0.0",
|
|
78
|
-
"acorn": "^7.
|
|
78
|
+
"acorn": "^7.2.0",
|
|
79
79
|
"acorn-class-fields": "^0.3.2",
|
|
80
|
-
"acorn-export-ns-from": "^0.1.0",
|
|
81
80
|
"acorn-import-meta": "^1.1.0",
|
|
82
81
|
"acorn-jsx": "^5.2.0",
|
|
83
82
|
"acorn-static-class-features": "^0.2.1",
|
|
@@ -91,17 +90,17 @@
|
|
|
91
90
|
"date-time": "^3.1.0",
|
|
92
91
|
"es5-shim": "^4.5.14",
|
|
93
92
|
"es6-shim": "^0.35.5",
|
|
94
|
-
"eslint": "^
|
|
93
|
+
"eslint": "^7.0.0",
|
|
95
94
|
"eslint-plugin-import": "^2.20.2",
|
|
96
|
-
"execa": "^4.0.
|
|
95
|
+
"execa": "^4.0.1",
|
|
97
96
|
"fixturify": "^2.1.0",
|
|
98
97
|
"hash.js": "^1.1.7",
|
|
99
98
|
"husky": "^4.2.5",
|
|
100
99
|
"is-reference": "^1.1.4",
|
|
101
|
-
"lint-staged": "^10.2.
|
|
100
|
+
"lint-staged": "^10.2.2",
|
|
102
101
|
"locate-character": "^2.0.5",
|
|
103
102
|
"magic-string": "^0.25.7",
|
|
104
|
-
"markdownlint-cli": "^0.
|
|
103
|
+
"markdownlint-cli": "^0.23.0",
|
|
105
104
|
"micromatch": "^4.0.2",
|
|
106
105
|
"mocha": "^7.1.2",
|
|
107
106
|
"node-fetch": "^2.6.0",
|
|
@@ -111,7 +110,7 @@
|
|
|
111
110
|
"pretty-ms": "^7.0.0",
|
|
112
111
|
"require-relative": "^0.8.7",
|
|
113
112
|
"requirejs": "^2.3.6",
|
|
114
|
-
"rollup": "^2.
|
|
113
|
+
"rollup": "^2.8.2",
|
|
115
114
|
"rollup-plugin-license": "^2.0.0",
|
|
116
115
|
"rollup-plugin-string": "^3.0.0",
|
|
117
116
|
"rollup-plugin-terser": "^5.3.0",
|
|
@@ -126,7 +125,7 @@
|
|
|
126
125
|
"sourcemap-codec": "^1.4.8",
|
|
127
126
|
"systemjs": "^6.3.1",
|
|
128
127
|
"terser": "^4.6.13",
|
|
129
|
-
"tslib": "^1.11.
|
|
128
|
+
"tslib": "^1.11.2",
|
|
130
129
|
"tslint": "^6.1.2",
|
|
131
130
|
"typescript": "^3.8.3",
|
|
132
131
|
"url-parse": "^1.4.7",
|