rollup 2.61.0 → 2.64.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/CHANGELOG.md +88 -0
- package/dist/bin/rollup +11 -23
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +4 -2
- package/dist/es/shared/rollup.js +382 -268
- package/dist/es/shared/watch.js +22 -18
- package/dist/loadConfigFile.js +3 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +19 -3
- package/dist/rollup.js +4 -2
- package/dist/shared/index.js +15 -13
- package/dist/shared/loadConfigFile.js +10 -11
- package/dist/shared/mergeOptions.js +12 -5
- package/dist/shared/rollup.js +427 -310
- package/dist/shared/watch-cli.js +21 -29
- package/dist/shared/watch.js +8 -18
- package/package.json +9 -9
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.64.0
|
|
4
|
+
Fri, 14 Jan 2022 14:02:32 GMT - commit 82a3e2634a9d51b5040752e4fb2fd264651d504e
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
8
8
|
|
|
9
9
|
Released under the MIT License.
|
|
10
10
|
*/
|
|
11
|
-
import require$$
|
|
11
|
+
import require$$0, { relative as relative$1, resolve, extname, basename, win32, posix, isAbsolute as isAbsolute$1, dirname } from 'path';
|
|
12
|
+
import process$1 from 'process';
|
|
13
|
+
import { performance } from 'perf_hooks';
|
|
12
14
|
import { createHash as createHash$1 } from 'crypto';
|
|
13
15
|
import fs, { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
14
16
|
import { EventEmitter } from 'events';
|
|
15
17
|
|
|
16
|
-
var version$1 = "2.
|
|
18
|
+
var version$1 = "2.64.0";
|
|
17
19
|
|
|
18
20
|
var charToInteger = {};
|
|
19
21
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1645,20 +1647,70 @@ const BLANK = Object.freeze(Object.create(null));
|
|
|
1645
1647
|
const EMPTY_OBJECT = Object.freeze({});
|
|
1646
1648
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
1647
1649
|
|
|
1648
|
-
const
|
|
1649
|
-
|
|
1650
|
-
|
|
1650
|
+
const RESERVED_NAMES = new Set([
|
|
1651
|
+
'await',
|
|
1652
|
+
'break',
|
|
1653
|
+
'case',
|
|
1654
|
+
'catch',
|
|
1655
|
+
'class',
|
|
1656
|
+
'const',
|
|
1657
|
+
'continue',
|
|
1658
|
+
'debugger',
|
|
1659
|
+
'default',
|
|
1660
|
+
'delete',
|
|
1661
|
+
'do',
|
|
1662
|
+
'else',
|
|
1663
|
+
'enum',
|
|
1664
|
+
'eval',
|
|
1665
|
+
'export',
|
|
1666
|
+
'extends',
|
|
1667
|
+
'false',
|
|
1668
|
+
'finally',
|
|
1669
|
+
'for',
|
|
1670
|
+
'function',
|
|
1671
|
+
'if',
|
|
1672
|
+
'implements',
|
|
1673
|
+
'import',
|
|
1674
|
+
'in',
|
|
1675
|
+
'instanceof',
|
|
1676
|
+
'interface',
|
|
1677
|
+
'let',
|
|
1678
|
+
'NaN',
|
|
1679
|
+
'new',
|
|
1680
|
+
'null',
|
|
1681
|
+
'package',
|
|
1682
|
+
'private',
|
|
1683
|
+
'protected',
|
|
1684
|
+
'public',
|
|
1685
|
+
'return',
|
|
1686
|
+
'static',
|
|
1687
|
+
'super',
|
|
1688
|
+
'switch',
|
|
1689
|
+
'this',
|
|
1690
|
+
'throw',
|
|
1691
|
+
'true',
|
|
1692
|
+
'try',
|
|
1693
|
+
'typeof',
|
|
1694
|
+
'undefined',
|
|
1695
|
+
'var',
|
|
1696
|
+
'void',
|
|
1697
|
+
'while',
|
|
1698
|
+
'with',
|
|
1699
|
+
'yield'
|
|
1700
|
+
]);
|
|
1701
|
+
const RESERVED_NAMES$1 = RESERVED_NAMES;
|
|
1702
|
+
|
|
1651
1703
|
const illegalCharacters = /[^$_a-zA-Z0-9]/g;
|
|
1652
1704
|
const startsWithDigit = (str) => /\d/.test(str[0]);
|
|
1653
1705
|
function isLegal(str) {
|
|
1654
|
-
if (startsWithDigit(str) ||
|
|
1706
|
+
if (startsWithDigit(str) || RESERVED_NAMES$1.has(str)) {
|
|
1655
1707
|
return false;
|
|
1656
1708
|
}
|
|
1657
1709
|
return !illegalCharacters.test(str);
|
|
1658
1710
|
}
|
|
1659
1711
|
function makeLegal(str) {
|
|
1660
1712
|
str = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(illegalCharacters, '_');
|
|
1661
|
-
if (startsWithDigit(str) ||
|
|
1713
|
+
if (startsWithDigit(str) || RESERVED_NAMES$1.has(str))
|
|
1662
1714
|
str = `_${str}`;
|
|
1663
1715
|
return str || '_';
|
|
1664
1716
|
}
|
|
@@ -1740,6 +1792,7 @@ class ExternalModule {
|
|
|
1740
1792
|
},
|
|
1741
1793
|
isEntry: false,
|
|
1742
1794
|
isExternal: true,
|
|
1795
|
+
isIncluded: null,
|
|
1743
1796
|
meta,
|
|
1744
1797
|
syntheticNamedExports: false
|
|
1745
1798
|
};
|
|
@@ -1798,9 +1851,24 @@ class ExternalModule {
|
|
|
1798
1851
|
}
|
|
1799
1852
|
}
|
|
1800
1853
|
|
|
1854
|
+
function getAugmentedNamespace(n) {
|
|
1855
|
+
if (n.__esModule) return n;
|
|
1856
|
+
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
1857
|
+
Object.keys(n).forEach(function (k) {
|
|
1858
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
1859
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
1860
|
+
enumerable: true,
|
|
1861
|
+
get: function () {
|
|
1862
|
+
return n[k];
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
});
|
|
1866
|
+
return a;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1801
1869
|
var utils$3 = {};
|
|
1802
1870
|
|
|
1803
|
-
const path$1 = require$$
|
|
1871
|
+
const path$1 = require$$0;
|
|
1804
1872
|
const WIN_SLASH = '\\\\/';
|
|
1805
1873
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1806
1874
|
|
|
@@ -1980,7 +2048,7 @@ var constants$2 = {
|
|
|
1980
2048
|
|
|
1981
2049
|
(function (exports) {
|
|
1982
2050
|
|
|
1983
|
-
const path = require$$
|
|
2051
|
+
const path = require$$0;
|
|
1984
2052
|
const win32 = process.platform === 'win32';
|
|
1985
2053
|
const {
|
|
1986
2054
|
REGEX_BACKSLASH,
|
|
@@ -3510,7 +3578,7 @@ parse$1.fastpaths = (input, options) => {
|
|
|
3510
3578
|
|
|
3511
3579
|
var parse_1 = parse$1;
|
|
3512
3580
|
|
|
3513
|
-
const path = require$$
|
|
3581
|
+
const path = require$$0;
|
|
3514
3582
|
const scan = scan_1;
|
|
3515
3583
|
const parse = parse_1;
|
|
3516
3584
|
const utils = utils$3;
|
|
@@ -5023,8 +5091,6 @@ const knownGlobals = {
|
|
|
5023
5091
|
__proto__: null,
|
|
5024
5092
|
[ValueProperties]: PURE,
|
|
5025
5093
|
create: PF,
|
|
5026
|
-
getNotifier: PF,
|
|
5027
|
-
getOwn: PF,
|
|
5028
5094
|
getOwnPropertyDescriptor: PF,
|
|
5029
5095
|
getOwnPropertyNames: PF,
|
|
5030
5096
|
getOwnPropertySymbols: PF,
|
|
@@ -6066,62 +6132,10 @@ function toBase64(num) {
|
|
|
6066
6132
|
return outStr;
|
|
6067
6133
|
}
|
|
6068
6134
|
|
|
6069
|
-
const RESERVED_NAMES = {
|
|
6070
|
-
__proto__: null,
|
|
6071
|
-
await: true,
|
|
6072
|
-
break: true,
|
|
6073
|
-
case: true,
|
|
6074
|
-
catch: true,
|
|
6075
|
-
class: true,
|
|
6076
|
-
const: true,
|
|
6077
|
-
continue: true,
|
|
6078
|
-
debugger: true,
|
|
6079
|
-
default: true,
|
|
6080
|
-
delete: true,
|
|
6081
|
-
do: true,
|
|
6082
|
-
else: true,
|
|
6083
|
-
enum: true,
|
|
6084
|
-
eval: true,
|
|
6085
|
-
export: true,
|
|
6086
|
-
extends: true,
|
|
6087
|
-
false: true,
|
|
6088
|
-
finally: true,
|
|
6089
|
-
for: true,
|
|
6090
|
-
function: true,
|
|
6091
|
-
if: true,
|
|
6092
|
-
implements: true,
|
|
6093
|
-
import: true,
|
|
6094
|
-
in: true,
|
|
6095
|
-
instanceof: true,
|
|
6096
|
-
interface: true,
|
|
6097
|
-
let: true,
|
|
6098
|
-
new: true,
|
|
6099
|
-
null: true,
|
|
6100
|
-
package: true,
|
|
6101
|
-
private: true,
|
|
6102
|
-
protected: true,
|
|
6103
|
-
public: true,
|
|
6104
|
-
return: true,
|
|
6105
|
-
static: true,
|
|
6106
|
-
super: true,
|
|
6107
|
-
switch: true,
|
|
6108
|
-
this: true,
|
|
6109
|
-
throw: true,
|
|
6110
|
-
true: true,
|
|
6111
|
-
try: true,
|
|
6112
|
-
typeof: true,
|
|
6113
|
-
undefined: true,
|
|
6114
|
-
var: true,
|
|
6115
|
-
void: true,
|
|
6116
|
-
while: true,
|
|
6117
|
-
with: true,
|
|
6118
|
-
yield: true
|
|
6119
|
-
};
|
|
6120
|
-
|
|
6121
6135
|
function getSafeName(baseName, usedNames) {
|
|
6122
6136
|
let safeName = baseName;
|
|
6123
6137
|
let count = 1;
|
|
6124
|
-
while (usedNames.has(safeName) || RESERVED_NAMES
|
|
6138
|
+
while (usedNames.has(safeName) || RESERVED_NAMES$1.has(safeName)) {
|
|
6125
6139
|
safeName = `${baseName}$${toBase64(count++)}`;
|
|
6126
6140
|
}
|
|
6127
6141
|
usedNames.add(safeName);
|
|
@@ -6232,16 +6246,27 @@ const literalNumberMembers = assembleMemberDescriptions({
|
|
|
6232
6246
|
valueOf: returnsNumber
|
|
6233
6247
|
}, objectMembers);
|
|
6234
6248
|
const literalStringMembers = assembleMemberDescriptions({
|
|
6249
|
+
anchor: returnsString,
|
|
6250
|
+
at: returnsUnknown,
|
|
6251
|
+
big: returnsString,
|
|
6252
|
+
blink: returnsString,
|
|
6253
|
+
bold: returnsString,
|
|
6235
6254
|
charAt: returnsString,
|
|
6236
6255
|
charCodeAt: returnsNumber,
|
|
6237
|
-
codePointAt:
|
|
6256
|
+
codePointAt: returnsUnknown,
|
|
6238
6257
|
concat: returnsString,
|
|
6239
6258
|
endsWith: returnsBoolean,
|
|
6259
|
+
fixed: returnsString,
|
|
6260
|
+
fontcolor: returnsString,
|
|
6261
|
+
fontsize: returnsString,
|
|
6240
6262
|
includes: returnsBoolean,
|
|
6241
6263
|
indexOf: returnsNumber,
|
|
6264
|
+
italics: returnsString,
|
|
6242
6265
|
lastIndexOf: returnsNumber,
|
|
6266
|
+
link: returnsString,
|
|
6243
6267
|
localeCompare: returnsNumber,
|
|
6244
|
-
match:
|
|
6268
|
+
match: returnsUnknown,
|
|
6269
|
+
matchAll: returnsUnknown,
|
|
6245
6270
|
normalize: returnsString,
|
|
6246
6271
|
padEnd: returnsString,
|
|
6247
6272
|
padStart: returnsString,
|
|
@@ -6252,17 +6277,32 @@ const literalStringMembers = assembleMemberDescriptions({
|
|
|
6252
6277
|
returns: UNKNOWN_LITERAL_STRING
|
|
6253
6278
|
}
|
|
6254
6279
|
},
|
|
6280
|
+
replaceAll: {
|
|
6281
|
+
value: {
|
|
6282
|
+
callsArgs: [1],
|
|
6283
|
+
returns: UNKNOWN_LITERAL_STRING
|
|
6284
|
+
}
|
|
6285
|
+
},
|
|
6255
6286
|
search: returnsNumber,
|
|
6256
6287
|
slice: returnsString,
|
|
6288
|
+
small: returnsString,
|
|
6257
6289
|
split: returnsUnknown,
|
|
6258
6290
|
startsWith: returnsBoolean,
|
|
6291
|
+
strike: returnsString,
|
|
6292
|
+
sub: returnsString,
|
|
6259
6293
|
substr: returnsString,
|
|
6260
6294
|
substring: returnsString,
|
|
6295
|
+
sup: returnsString,
|
|
6261
6296
|
toLocaleLowerCase: returnsString,
|
|
6262
6297
|
toLocaleUpperCase: returnsString,
|
|
6263
6298
|
toLowerCase: returnsString,
|
|
6299
|
+
toString: returnsString,
|
|
6264
6300
|
toUpperCase: returnsString,
|
|
6265
6301
|
trim: returnsString,
|
|
6302
|
+
trimEnd: returnsString,
|
|
6303
|
+
trimLeft: returnsString,
|
|
6304
|
+
trimRight: returnsString,
|
|
6305
|
+
trimStart: returnsString,
|
|
6266
6306
|
valueOf: returnsString
|
|
6267
6307
|
}, objectMembers);
|
|
6268
6308
|
function getLiteralMembersForValue(value) {
|
|
@@ -8078,6 +8118,10 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
8078
8118
|
filter: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8079
8119
|
find: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8080
8120
|
findIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER,
|
|
8121
|
+
findLast: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8122
|
+
findLastIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER,
|
|
8123
|
+
flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8124
|
+
flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8081
8125
|
forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8082
8126
|
includes: METHOD_RETURNS_BOOLEAN,
|
|
8083
8127
|
indexOf: METHOD_RETURNS_NUMBER,
|
|
@@ -8095,6 +8139,8 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
8095
8139
|
some: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN,
|
|
8096
8140
|
sort: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_SELF,
|
|
8097
8141
|
splice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
|
|
8142
|
+
toLocaleString: METHOD_RETURNS_STRING,
|
|
8143
|
+
toString: METHOD_RETURNS_STRING,
|
|
8098
8144
|
unshift: METHOD_MUTATES_SELF_RETURNS_NUMBER,
|
|
8099
8145
|
values: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN
|
|
8100
8146
|
}, OBJECT_PROTOTYPE, true);
|
|
@@ -11927,13 +11973,19 @@ class SyntheticNamedExportVariable extends Variable {
|
|
|
11927
11973
|
}
|
|
11928
11974
|
}
|
|
11929
11975
|
|
|
11976
|
+
var BuildPhase;
|
|
11977
|
+
(function (BuildPhase) {
|
|
11978
|
+
BuildPhase[BuildPhase["LOAD_AND_PARSE"] = 0] = "LOAD_AND_PARSE";
|
|
11979
|
+
BuildPhase[BuildPhase["ANALYSE"] = 1] = "ANALYSE";
|
|
11980
|
+
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
11981
|
+
})(BuildPhase || (BuildPhase = {}));
|
|
11982
|
+
|
|
11930
11983
|
function getId(m) {
|
|
11931
11984
|
return m.id;
|
|
11932
11985
|
}
|
|
11933
11986
|
|
|
11934
11987
|
function getOriginalLocation(sourcemapChain, location) {
|
|
11935
|
-
|
|
11936
|
-
const filteredSourcemapChain = sourcemapChain.filter(sourcemap => sourcemap.mappings);
|
|
11988
|
+
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
|
|
11937
11989
|
while (filteredSourcemapChain.length > 0) {
|
|
11938
11990
|
const sourcemap = filteredSourcemapChain.pop();
|
|
11939
11991
|
const line = sourcemap.mappings[location.line - 1];
|
|
@@ -11962,24 +12014,7 @@ function getOriginalLocation(sourcemapChain, location) {
|
|
|
11962
12014
|
}
|
|
11963
12015
|
|
|
11964
12016
|
const NOOP = () => { };
|
|
11965
|
-
let
|
|
11966
|
-
let getElapsedTime = () => 0;
|
|
11967
|
-
let getMemory = () => 0;
|
|
11968
|
-
let timers = {};
|
|
11969
|
-
const normalizeHrTime = (time) => time[0] * 1e3 + time[1] / 1e6;
|
|
11970
|
-
function setTimeHelpers() {
|
|
11971
|
-
if (typeof process !== 'undefined' && typeof process.hrtime === 'function') {
|
|
11972
|
-
getStartTime = process.hrtime.bind(process);
|
|
11973
|
-
getElapsedTime = previous => normalizeHrTime(process.hrtime(previous));
|
|
11974
|
-
}
|
|
11975
|
-
else if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
|
|
11976
|
-
getStartTime = () => [performance.now(), 0];
|
|
11977
|
-
getElapsedTime = previous => performance.now() - previous[0];
|
|
11978
|
-
}
|
|
11979
|
-
if (typeof process !== 'undefined' && typeof process.memoryUsage === 'function') {
|
|
11980
|
-
getMemory = () => process.memoryUsage().heapUsed;
|
|
11981
|
-
}
|
|
11982
|
-
}
|
|
12017
|
+
let timers = new Map();
|
|
11983
12018
|
function getPersistedLabel(label, level) {
|
|
11984
12019
|
switch (level) {
|
|
11985
12020
|
case 1:
|
|
@@ -11994,46 +12029,47 @@ function getPersistedLabel(label, level) {
|
|
|
11994
12029
|
}
|
|
11995
12030
|
function timeStartImpl(label, level = 3) {
|
|
11996
12031
|
label = getPersistedLabel(label, level);
|
|
11997
|
-
|
|
11998
|
-
|
|
12032
|
+
const startMemory = process$1.memoryUsage().heapUsed;
|
|
12033
|
+
const startTime = performance.now();
|
|
12034
|
+
const timer = timers.get(label);
|
|
12035
|
+
if (timer === undefined) {
|
|
12036
|
+
timers.set(label, {
|
|
11999
12037
|
memory: 0,
|
|
12000
|
-
startMemory
|
|
12001
|
-
startTime
|
|
12038
|
+
startMemory,
|
|
12039
|
+
startTime,
|
|
12002
12040
|
time: 0,
|
|
12003
12041
|
totalMemory: 0
|
|
12004
|
-
};
|
|
12042
|
+
});
|
|
12043
|
+
}
|
|
12044
|
+
else {
|
|
12045
|
+
timer.startMemory = startMemory;
|
|
12046
|
+
timer.startTime = startTime;
|
|
12005
12047
|
}
|
|
12006
|
-
const currentMemory = getMemory();
|
|
12007
|
-
timers[label].startTime = getStartTime();
|
|
12008
|
-
timers[label].startMemory = currentMemory;
|
|
12009
12048
|
}
|
|
12010
12049
|
function timeEndImpl(label, level = 3) {
|
|
12011
12050
|
label = getPersistedLabel(label, level);
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12051
|
+
const timer = timers.get(label);
|
|
12052
|
+
if (timer !== undefined) {
|
|
12053
|
+
const currentMemory = process$1.memoryUsage().heapUsed;
|
|
12054
|
+
timer.memory += currentMemory - timer.startMemory;
|
|
12055
|
+
timer.time += performance.now() - timer.startTime;
|
|
12056
|
+
timer.totalMemory = Math.max(timer.totalMemory, currentMemory);
|
|
12017
12057
|
}
|
|
12018
12058
|
}
|
|
12019
12059
|
function getTimings() {
|
|
12020
12060
|
const newTimings = {};
|
|
12021
|
-
for (const [label, {
|
|
12061
|
+
for (const [label, { memory, time, totalMemory }] of timers) {
|
|
12022
12062
|
newTimings[label] = [time, memory, totalMemory];
|
|
12023
12063
|
}
|
|
12024
12064
|
return newTimings;
|
|
12025
12065
|
}
|
|
12026
|
-
let timeStart = NOOP
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
resolveDynamicImport: true,
|
|
12030
|
-
resolveId: true,
|
|
12031
|
-
transform: true
|
|
12032
|
-
};
|
|
12066
|
+
let timeStart = NOOP;
|
|
12067
|
+
let timeEnd = NOOP;
|
|
12068
|
+
const TIMED_PLUGIN_HOOKS = ['load', 'resolveDynamicImport', 'resolveId', 'transform'];
|
|
12033
12069
|
function getPluginWithTimers(plugin, index) {
|
|
12034
12070
|
const timedPlugin = {};
|
|
12035
|
-
for (const hook of
|
|
12036
|
-
if (
|
|
12071
|
+
for (const hook of TIMED_PLUGIN_HOOKS) {
|
|
12072
|
+
if (hook in plugin) {
|
|
12037
12073
|
let timerLabel = `plugin ${index}`;
|
|
12038
12074
|
if (plugin.name) {
|
|
12039
12075
|
timerLabel += ` (${plugin.name})`;
|
|
@@ -12041,11 +12077,11 @@ function getPluginWithTimers(plugin, index) {
|
|
|
12041
12077
|
timerLabel += ` - ${hook}`;
|
|
12042
12078
|
timedPlugin[hook] = function (...args) {
|
|
12043
12079
|
timeStart(timerLabel, 4);
|
|
12044
|
-
|
|
12080
|
+
const result = plugin[hook](...args);
|
|
12045
12081
|
timeEnd(timerLabel, 4);
|
|
12046
12082
|
if (result && typeof result.then === 'function') {
|
|
12047
12083
|
timeStart(`${timerLabel} (async)`, 4);
|
|
12048
|
-
|
|
12084
|
+
return result.then((hookResult) => {
|
|
12049
12085
|
timeEnd(`${timerLabel} (async)`, 4);
|
|
12050
12086
|
return hookResult;
|
|
12051
12087
|
});
|
|
@@ -12053,16 +12089,15 @@ function getPluginWithTimers(plugin, index) {
|
|
|
12053
12089
|
return result;
|
|
12054
12090
|
};
|
|
12055
12091
|
}
|
|
12056
|
-
else {
|
|
12057
|
-
timedPlugin[hook] = plugin[hook];
|
|
12058
|
-
}
|
|
12059
12092
|
}
|
|
12060
|
-
return
|
|
12093
|
+
return {
|
|
12094
|
+
...plugin,
|
|
12095
|
+
...timedPlugin
|
|
12096
|
+
};
|
|
12061
12097
|
}
|
|
12062
12098
|
function initialiseTimers(inputOptions) {
|
|
12063
12099
|
if (inputOptions.perf) {
|
|
12064
|
-
timers =
|
|
12065
|
-
setTimeHelpers();
|
|
12100
|
+
timers = new Map();
|
|
12066
12101
|
timeStart = timeStartImpl;
|
|
12067
12102
|
timeEnd = timeEndImpl;
|
|
12068
12103
|
inputOptions.plugins = inputOptions.plugins.map(getPluginWithTimers);
|
|
@@ -12206,10 +12241,10 @@ class Module {
|
|
|
12206
12241
|
hasModuleSideEffects,
|
|
12207
12242
|
id,
|
|
12208
12243
|
get implicitlyLoadedAfterOneOf() {
|
|
12209
|
-
return Array.from(module.implicitlyLoadedAfter, getId);
|
|
12244
|
+
return Array.from(module.implicitlyLoadedAfter, getId).sort();
|
|
12210
12245
|
},
|
|
12211
12246
|
get implicitlyLoadedBefore() {
|
|
12212
|
-
return Array.from(module.implicitlyLoadedBefore, getId);
|
|
12247
|
+
return Array.from(module.implicitlyLoadedBefore, getId).sort();
|
|
12213
12248
|
},
|
|
12214
12249
|
get importedIds() {
|
|
12215
12250
|
return Array.from(module.sources, source => { var _a; return (_a = module.resolvedIds[source]) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean);
|
|
@@ -12219,7 +12254,13 @@ class Module {
|
|
|
12219
12254
|
},
|
|
12220
12255
|
isEntry,
|
|
12221
12256
|
isExternal: false,
|
|
12222
|
-
|
|
12257
|
+
get isIncluded() {
|
|
12258
|
+
if (module.graph.phase !== BuildPhase.GENERATE) {
|
|
12259
|
+
return null;
|
|
12260
|
+
}
|
|
12261
|
+
return module.isIncluded();
|
|
12262
|
+
},
|
|
12263
|
+
meta: { ...meta },
|
|
12223
12264
|
syntheticNamedExports
|
|
12224
12265
|
};
|
|
12225
12266
|
}
|
|
@@ -12240,7 +12281,7 @@ class Module {
|
|
|
12240
12281
|
return this.allExportNames;
|
|
12241
12282
|
}
|
|
12242
12283
|
const allExportNames = (this.allExportNames = new Set());
|
|
12243
|
-
for (const name of
|
|
12284
|
+
for (const name of this.getExports()) {
|
|
12244
12285
|
allExportNames.add(name);
|
|
12245
12286
|
}
|
|
12246
12287
|
for (const name of Object.keys(this.reexportDescriptions)) {
|
|
@@ -12264,12 +12305,11 @@ class Module {
|
|
|
12264
12305
|
const relevantDependencies = new Set();
|
|
12265
12306
|
const necessaryDependencies = new Set();
|
|
12266
12307
|
const alwaysCheckedDependencies = new Set();
|
|
12267
|
-
|
|
12308
|
+
const dependencyVariables = new Set(this.imports);
|
|
12268
12309
|
if (this.info.isEntry ||
|
|
12269
12310
|
this.includedDynamicImporters.length > 0 ||
|
|
12270
12311
|
this.namespace.included ||
|
|
12271
12312
|
this.implicitlyLoadedAfter.size > 0) {
|
|
12272
|
-
dependencyVariables = new Set(dependencyVariables);
|
|
12273
12313
|
for (const exportName of [...this.getReexports(), ...this.getExports()]) {
|
|
12274
12314
|
const exportedVariable = this.getVariableForExportName(exportName);
|
|
12275
12315
|
if (exportedVariable) {
|
|
@@ -12651,7 +12691,7 @@ class Module {
|
|
|
12651
12691
|
this.info.syntheticNamedExports = syntheticNamedExports;
|
|
12652
12692
|
}
|
|
12653
12693
|
if (meta != null) {
|
|
12654
|
-
|
|
12694
|
+
Object.assign(this.info.meta, meta);
|
|
12655
12695
|
}
|
|
12656
12696
|
}
|
|
12657
12697
|
warn(props, pos) {
|
|
@@ -12742,11 +12782,7 @@ class Module {
|
|
|
12742
12782
|
for (const specifier of node.specifiers) {
|
|
12743
12783
|
const isDefault = specifier.type === ImportDefaultSpecifier$1;
|
|
12744
12784
|
const isNamespace = specifier.type === ImportNamespaceSpecifier$1;
|
|
12745
|
-
const name = isDefault
|
|
12746
|
-
? 'default'
|
|
12747
|
-
: isNamespace
|
|
12748
|
-
? '*'
|
|
12749
|
-
: specifier.imported.name;
|
|
12785
|
+
const name = isDefault ? 'default' : isNamespace ? '*' : specifier.imported.name;
|
|
12750
12786
|
this.importDescriptions[specifier.local.name] = {
|
|
12751
12787
|
module: null,
|
|
12752
12788
|
name,
|
|
@@ -12893,7 +12929,7 @@ class Module {
|
|
|
12893
12929
|
variable.include();
|
|
12894
12930
|
this.graph.needsTreeshakingPass = true;
|
|
12895
12931
|
const variableModule = variable.module;
|
|
12896
|
-
if (variableModule
|
|
12932
|
+
if (variableModule instanceof Module) {
|
|
12897
12933
|
if (!variableModule.isExecuted) {
|
|
12898
12934
|
markModuleAndImpureDependenciesAsExecuted(variableModule);
|
|
12899
12935
|
}
|
|
@@ -14009,7 +14045,7 @@ function escapeId(id) {
|
|
|
14009
14045
|
function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariable) {
|
|
14010
14046
|
let nameIndex = 0;
|
|
14011
14047
|
for (const variable of exports) {
|
|
14012
|
-
let exportName = variable.name
|
|
14048
|
+
let [exportName] = variable.name;
|
|
14013
14049
|
if (exportsByName[exportName]) {
|
|
14014
14050
|
do {
|
|
14015
14051
|
exportName = toBase64(++nameIndex);
|
|
@@ -14018,7 +14054,7 @@ function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariab
|
|
|
14018
14054
|
nameIndex += 9 * 64 ** (exportName.length - 1);
|
|
14019
14055
|
exportName = toBase64(nameIndex);
|
|
14020
14056
|
}
|
|
14021
|
-
} while (RESERVED_NAMES
|
|
14057
|
+
} while (RESERVED_NAMES$1.has(exportName) || exportsByName[exportName]);
|
|
14022
14058
|
}
|
|
14023
14059
|
exportsByName[exportName] = variable;
|
|
14024
14060
|
exportNamesByVariable.set(variable, [exportName]);
|
|
@@ -14251,6 +14287,7 @@ class Chunk {
|
|
|
14251
14287
|
this.implicitlyLoadedBefore = new Set();
|
|
14252
14288
|
this.imports = new Set();
|
|
14253
14289
|
this.indentString = undefined;
|
|
14290
|
+
// This may only be updated in the constructor
|
|
14254
14291
|
this.isEmpty = true;
|
|
14255
14292
|
this.name = null;
|
|
14256
14293
|
this.renderedDependencies = null;
|
|
@@ -14436,7 +14473,7 @@ class Chunk {
|
|
|
14436
14473
|
}), existingNames);
|
|
14437
14474
|
}
|
|
14438
14475
|
generateIdPreserveModules(preserveModulesRelativeDir, options, existingNames, unsetOptions) {
|
|
14439
|
-
const id = this.orderedModules
|
|
14476
|
+
const [{ id }] = this.orderedModules;
|
|
14440
14477
|
const sanitizedId = this.outputOptions.sanitizeFileName(id);
|
|
14441
14478
|
let path;
|
|
14442
14479
|
const patternOpt = unsetOptions.has('entryFileNames')
|
|
@@ -15236,13 +15273,6 @@ function getChunkNameFromModule(module) {
|
|
|
15236
15273
|
return module.chunkName || getAliasName(module.id);
|
|
15237
15274
|
}
|
|
15238
15275
|
|
|
15239
|
-
var BuildPhase;
|
|
15240
|
-
(function (BuildPhase) {
|
|
15241
|
-
BuildPhase[BuildPhase["LOAD_AND_PARSE"] = 0] = "LOAD_AND_PARSE";
|
|
15242
|
-
BuildPhase[BuildPhase["ANALYSE"] = 1] = "ANALYSE";
|
|
15243
|
-
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
15244
|
-
})(BuildPhase || (BuildPhase = {}));
|
|
15245
|
-
|
|
15246
15276
|
function generateAssetFileName(name, source, outputOptions, bundle) {
|
|
15247
15277
|
const emittedName = outputOptions.sanitizeFileName(name || 'asset');
|
|
15248
15278
|
return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
|
|
@@ -15753,7 +15783,7 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
|
|
|
15753
15783
|
];
|
|
15754
15784
|
const isValidPropName = reservedNamesAsProps
|
|
15755
15785
|
? (name) => validPropName.test(name)
|
|
15756
|
-
: (name) => !RESERVED_NAMES
|
|
15786
|
+
: (name) => !RESERVED_NAMES$1.has(name) && validPropName.test(name);
|
|
15757
15787
|
return {
|
|
15758
15788
|
_,
|
|
15759
15789
|
cnst,
|
|
@@ -15978,7 +16008,7 @@ function validateOptionsForMultiChunkOutput(outputOptions, onWarn) {
|
|
|
15978
16008
|
onWarn(errInvalidOption('output.amd.id', 'outputamd', 'this option is only properly supported for single-file builds. Use "output.amd.autoId" and "output.amd.basePath" instead'));
|
|
15979
16009
|
}
|
|
15980
16010
|
function getIncludedModules(modulesById) {
|
|
15981
|
-
return [...modulesById.values()].filter(module => module instanceof Module &&
|
|
16011
|
+
return [...modulesById.values()].filter((module) => module instanceof Module &&
|
|
15982
16012
|
(module.isIncluded() || module.info.isEntry || module.includedDynamicImporters.length > 0));
|
|
15983
16013
|
}
|
|
15984
16014
|
function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
@@ -21540,9 +21570,9 @@ function writeFile(dest, data) {
|
|
|
21540
21570
|
}
|
|
21541
21571
|
|
|
21542
21572
|
class Queue {
|
|
21543
|
-
constructor(maxParallel
|
|
21573
|
+
constructor(maxParallel) {
|
|
21544
21574
|
this.maxParallel = maxParallel;
|
|
21545
|
-
this.queue =
|
|
21575
|
+
this.queue = [];
|
|
21546
21576
|
this.workerCount = 0;
|
|
21547
21577
|
}
|
|
21548
21578
|
run(task) {
|
|
@@ -21752,7 +21782,7 @@ function getCacheForUncacheablePlugin(pluginName) {
|
|
|
21752
21782
|
};
|
|
21753
21783
|
}
|
|
21754
21784
|
|
|
21755
|
-
function transform(source, module, pluginDriver, warn) {
|
|
21785
|
+
async function transform(source, module, pluginDriver, warn) {
|
|
21756
21786
|
const id = module.id;
|
|
21757
21787
|
const sourcemapChain = [];
|
|
21758
21788
|
let originalSourcemap = source.map === null ? null : decodedSourcemap(source.map);
|
|
@@ -21762,7 +21792,7 @@ function transform(source, module, pluginDriver, warn) {
|
|
|
21762
21792
|
const emittedFiles = [];
|
|
21763
21793
|
let customTransformCache = false;
|
|
21764
21794
|
const useCustomTransformCache = () => (customTransformCache = true);
|
|
21765
|
-
let
|
|
21795
|
+
let pluginName = '';
|
|
21766
21796
|
const curSource = source.code;
|
|
21767
21797
|
function transformReducer(previousCode, result, plugin) {
|
|
21768
21798
|
let code;
|
|
@@ -21793,90 +21823,91 @@ function transform(source, module, pluginDriver, warn) {
|
|
|
21793
21823
|
}
|
|
21794
21824
|
return code;
|
|
21795
21825
|
}
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21811
|
-
|
|
21812
|
-
|
|
21813
|
-
|
|
21814
|
-
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21819
|
-
|
|
21820
|
-
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
|
|
21824
|
-
|
|
21825
|
-
|
|
21826
|
-
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
originalSourcemap
|
|
21837
|
-
|
|
21826
|
+
let code;
|
|
21827
|
+
try {
|
|
21828
|
+
code = await pluginDriver.hookReduceArg0('transform', [curSource, id], transformReducer, (pluginContext, plugin) => {
|
|
21829
|
+
pluginName = plugin.name;
|
|
21830
|
+
return {
|
|
21831
|
+
...pluginContext,
|
|
21832
|
+
addWatchFile(id) {
|
|
21833
|
+
transformDependencies.push(id);
|
|
21834
|
+
pluginContext.addWatchFile(id);
|
|
21835
|
+
},
|
|
21836
|
+
cache: customTransformCache
|
|
21837
|
+
? pluginContext.cache
|
|
21838
|
+
: getTrackedPluginCache(pluginContext.cache, useCustomTransformCache),
|
|
21839
|
+
emitAsset(name, source) {
|
|
21840
|
+
emittedFiles.push({ name, source, type: 'asset' });
|
|
21841
|
+
return pluginContext.emitAsset(name, source);
|
|
21842
|
+
},
|
|
21843
|
+
emitChunk(id, options) {
|
|
21844
|
+
emittedFiles.push({ id, name: options && options.name, type: 'chunk' });
|
|
21845
|
+
return pluginContext.emitChunk(id, options);
|
|
21846
|
+
},
|
|
21847
|
+
emitFile(emittedFile) {
|
|
21848
|
+
emittedFiles.push(emittedFile);
|
|
21849
|
+
return pluginDriver.emitFile(emittedFile);
|
|
21850
|
+
},
|
|
21851
|
+
error(err, pos) {
|
|
21852
|
+
if (typeof err === 'string')
|
|
21853
|
+
err = { message: err };
|
|
21854
|
+
if (pos)
|
|
21855
|
+
augmentCodeLocation(err, pos, curSource, id);
|
|
21856
|
+
err.id = id;
|
|
21857
|
+
err.hook = 'transform';
|
|
21858
|
+
return pluginContext.error(err);
|
|
21859
|
+
},
|
|
21860
|
+
getCombinedSourcemap() {
|
|
21861
|
+
const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, warn);
|
|
21862
|
+
if (!combinedMap) {
|
|
21863
|
+
const magicString = new MagicString$1(originalCode);
|
|
21864
|
+
return magicString.generateMap({ hires: true, includeContent: true, source: id });
|
|
21865
|
+
}
|
|
21866
|
+
if (originalSourcemap !== combinedMap) {
|
|
21867
|
+
originalSourcemap = combinedMap;
|
|
21868
|
+
sourcemapChain.length = 0;
|
|
21869
|
+
}
|
|
21870
|
+
return new SourceMap({
|
|
21871
|
+
...combinedMap,
|
|
21872
|
+
file: null,
|
|
21873
|
+
sourcesContent: combinedMap.sourcesContent
|
|
21874
|
+
});
|
|
21875
|
+
},
|
|
21876
|
+
setAssetSource() {
|
|
21877
|
+
return this.error({
|
|
21878
|
+
code: 'INVALID_SETASSETSOURCE',
|
|
21879
|
+
message: `setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.`
|
|
21880
|
+
});
|
|
21881
|
+
},
|
|
21882
|
+
warn(warning, pos) {
|
|
21883
|
+
if (typeof warning === 'string')
|
|
21884
|
+
warning = { message: warning };
|
|
21885
|
+
if (pos)
|
|
21886
|
+
augmentCodeLocation(warning, pos, curSource, id);
|
|
21887
|
+
warning.id = id;
|
|
21888
|
+
warning.hook = 'transform';
|
|
21889
|
+
pluginContext.warn(warning);
|
|
21838
21890
|
}
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
}
|
|
21860
|
-
};
|
|
21861
|
-
})
|
|
21862
|
-
.catch(err => throwPluginError(err, curPlugin.name, { hook: 'transform', id }))
|
|
21863
|
-
.then(code => {
|
|
21864
|
-
if (!customTransformCache) {
|
|
21865
|
-
// files emitted by a transform hook need to be emitted again if the hook is skipped
|
|
21866
|
-
if (emittedFiles.length)
|
|
21867
|
-
module.transformFiles = emittedFiles;
|
|
21868
|
-
}
|
|
21869
|
-
return {
|
|
21870
|
-
ast,
|
|
21871
|
-
code,
|
|
21872
|
-
customTransformCache,
|
|
21873
|
-
meta: module.info.meta,
|
|
21874
|
-
originalCode,
|
|
21875
|
-
originalSourcemap,
|
|
21876
|
-
sourcemapChain,
|
|
21877
|
-
transformDependencies
|
|
21878
|
-
};
|
|
21879
|
-
});
|
|
21891
|
+
};
|
|
21892
|
+
});
|
|
21893
|
+
}
|
|
21894
|
+
catch (err) {
|
|
21895
|
+
throwPluginError(err, pluginName, { hook: 'transform', id });
|
|
21896
|
+
}
|
|
21897
|
+
if (!customTransformCache) {
|
|
21898
|
+
// files emitted by a transform hook need to be emitted again if the hook is skipped
|
|
21899
|
+
if (emittedFiles.length)
|
|
21900
|
+
module.transformFiles = emittedFiles;
|
|
21901
|
+
}
|
|
21902
|
+
return {
|
|
21903
|
+
ast,
|
|
21904
|
+
code,
|
|
21905
|
+
customTransformCache,
|
|
21906
|
+
originalCode,
|
|
21907
|
+
originalSourcemap,
|
|
21908
|
+
sourcemapChain,
|
|
21909
|
+
transformDependencies
|
|
21910
|
+
};
|
|
21880
21911
|
}
|
|
21881
21912
|
|
|
21882
21913
|
class ModuleLoader {
|
|
@@ -21889,8 +21920,8 @@ class ModuleLoader {
|
|
|
21889
21920
|
this.indexedEntryModules = [];
|
|
21890
21921
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
21891
21922
|
this.moduleLoadPromises = new Map();
|
|
21923
|
+
this.modulesWithLoadedDependencies = new Set();
|
|
21892
21924
|
this.nextEntryModuleIndex = 0;
|
|
21893
|
-
this.readQueue = new Queue();
|
|
21894
21925
|
this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
|
|
21895
21926
|
return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
|
|
21896
21927
|
? false
|
|
@@ -21899,7 +21930,7 @@ class ModuleLoader {
|
|
|
21899
21930
|
this.hasModuleSideEffects = options.treeshake
|
|
21900
21931
|
? options.treeshake.moduleSideEffects
|
|
21901
21932
|
: () => true;
|
|
21902
|
-
this.readQueue
|
|
21933
|
+
this.readQueue = new Queue(options.maxParallelFileReads);
|
|
21903
21934
|
}
|
|
21904
21935
|
async addAdditionalModules(unresolvedModules) {
|
|
21905
21936
|
const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
|
|
@@ -21950,8 +21981,9 @@ class ModuleLoader {
|
|
|
21950
21981
|
}
|
|
21951
21982
|
return module;
|
|
21952
21983
|
}
|
|
21953
|
-
preloadModule(resolvedId) {
|
|
21954
|
-
|
|
21984
|
+
async preloadModule(resolvedId) {
|
|
21985
|
+
const module = await this.fetchModule(this.addDefaultsToResolvedId(resolvedId), undefined, false, true);
|
|
21986
|
+
return module.info;
|
|
21955
21987
|
}
|
|
21956
21988
|
addDefaultsToResolvedId(resolvedId) {
|
|
21957
21989
|
var _a, _b;
|
|
@@ -21962,7 +21994,7 @@ class ModuleLoader {
|
|
|
21962
21994
|
return {
|
|
21963
21995
|
external,
|
|
21964
21996
|
id: resolvedId.id,
|
|
21965
|
-
meta: resolvedId.meta ||
|
|
21997
|
+
meta: resolvedId.meta || {},
|
|
21966
21998
|
moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, !!external),
|
|
21967
21999
|
syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
|
|
21968
22000
|
};
|
|
@@ -22001,13 +22033,23 @@ class ModuleLoader {
|
|
|
22001
22033
|
timeEnd('load modules', 3);
|
|
22002
22034
|
const sourceDescription = typeof source === 'string'
|
|
22003
22035
|
? { code: source }
|
|
22004
|
-
: typeof source === 'object' && typeof source.code === 'string'
|
|
22036
|
+
: source != null && typeof source === 'object' && typeof source.code === 'string'
|
|
22005
22037
|
? source
|
|
22006
22038
|
: error(errBadLoader(id));
|
|
22007
22039
|
const cachedModule = this.graph.cachedModules.get(id);
|
|
22008
22040
|
if (cachedModule &&
|
|
22009
22041
|
!cachedModule.customTransformCache &&
|
|
22010
|
-
cachedModule.originalCode === sourceDescription.code
|
|
22042
|
+
cachedModule.originalCode === sourceDescription.code &&
|
|
22043
|
+
!(await this.pluginDriver.hookFirst('shouldTransformCachedModule', [
|
|
22044
|
+
{
|
|
22045
|
+
ast: cachedModule.ast,
|
|
22046
|
+
code: cachedModule.code,
|
|
22047
|
+
id: cachedModule.id,
|
|
22048
|
+
meta: cachedModule.meta,
|
|
22049
|
+
moduleSideEffects: cachedModule.moduleSideEffects,
|
|
22050
|
+
syntheticNamedExports: cachedModule.syntheticNamedExports
|
|
22051
|
+
}
|
|
22052
|
+
]))) {
|
|
22011
22053
|
if (cachedModule.transformFiles) {
|
|
22012
22054
|
for (const emittedFile of cachedModule.transformFiles)
|
|
22013
22055
|
this.pluginDriver.emitFile(emittedFile);
|
|
@@ -22067,7 +22109,8 @@ class ModuleLoader {
|
|
|
22067
22109
|
this.graph.watchFiles[id] = true;
|
|
22068
22110
|
const loadPromise = this.addModuleSource(id, importer, module).then(() => [
|
|
22069
22111
|
this.getResolveStaticDependencyPromises(module),
|
|
22070
|
-
this.getResolveDynamicImportPromises(module)
|
|
22112
|
+
this.getResolveDynamicImportPromises(module),
|
|
22113
|
+
loadAndResolveDependenciesPromise
|
|
22071
22114
|
]);
|
|
22072
22115
|
const loadAndResolveDependenciesPromise = loadPromise
|
|
22073
22116
|
.then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]))
|
|
@@ -22075,23 +22118,25 @@ class ModuleLoader {
|
|
|
22075
22118
|
loadAndResolveDependenciesPromise.catch(() => {
|
|
22076
22119
|
/* avoid unhandled promise rejections */
|
|
22077
22120
|
});
|
|
22078
|
-
|
|
22079
|
-
|
|
22080
|
-
|
|
22081
|
-
|
|
22082
|
-
else {
|
|
22083
|
-
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22084
|
-
// To handle errors when resolving dependencies or in moduleParsed
|
|
22085
|
-
await loadAndResolveDependenciesPromise;
|
|
22121
|
+
this.moduleLoadPromises.set(module, loadPromise);
|
|
22122
|
+
const resolveDependencyPromises = await loadPromise;
|
|
22123
|
+
if (!isPreload) {
|
|
22124
|
+
await this.fetchModuleDependencies(module, ...resolveDependencyPromises);
|
|
22086
22125
|
}
|
|
22087
22126
|
return module;
|
|
22088
22127
|
}
|
|
22089
|
-
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises) {
|
|
22128
|
+
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises, loadAndResolveDependenciesPromise) {
|
|
22129
|
+
if (this.modulesWithLoadedDependencies.has(module)) {
|
|
22130
|
+
return;
|
|
22131
|
+
}
|
|
22132
|
+
this.modulesWithLoadedDependencies.add(module);
|
|
22090
22133
|
await Promise.all([
|
|
22091
22134
|
this.fetchStaticDependencies(module, resolveStaticDependencyPromises),
|
|
22092
22135
|
this.fetchDynamicDependencies(module, resolveDynamicDependencyPromises)
|
|
22093
22136
|
]);
|
|
22094
22137
|
module.linkImports();
|
|
22138
|
+
// To handle errors when resolving dependencies or in moduleParsed
|
|
22139
|
+
await loadAndResolveDependenciesPromise;
|
|
22095
22140
|
}
|
|
22096
22141
|
fetchResolvedDependency(source, importer, resolvedId) {
|
|
22097
22142
|
if (resolvedId.external) {
|
|
@@ -22180,8 +22225,7 @@ class ModuleLoader {
|
|
|
22180
22225
|
async handleExistingModule(module, isEntry, isPreload) {
|
|
22181
22226
|
const loadPromise = this.moduleLoadPromises.get(module);
|
|
22182
22227
|
if (isPreload) {
|
|
22183
|
-
|
|
22184
|
-
return;
|
|
22228
|
+
return loadPromise;
|
|
22185
22229
|
}
|
|
22186
22230
|
if (isEntry) {
|
|
22187
22231
|
module.info.isEntry = true;
|
|
@@ -22191,11 +22235,7 @@ class ModuleLoader {
|
|
|
22191
22235
|
}
|
|
22192
22236
|
module.implicitlyLoadedAfter.clear();
|
|
22193
22237
|
}
|
|
22194
|
-
|
|
22195
|
-
this.moduleLoadPromises.delete(module);
|
|
22196
|
-
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22197
|
-
}
|
|
22198
|
-
return;
|
|
22238
|
+
return this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22199
22239
|
}
|
|
22200
22240
|
handleResolveId(resolvedId, source, importer) {
|
|
22201
22241
|
if (resolvedId === null) {
|
|
@@ -22206,7 +22246,7 @@ class ModuleLoader {
|
|
|
22206
22246
|
return {
|
|
22207
22247
|
external: true,
|
|
22208
22248
|
id: source,
|
|
22209
|
-
meta:
|
|
22249
|
+
meta: {},
|
|
22210
22250
|
moduleSideEffects: this.hasModuleSideEffects(source, true),
|
|
22211
22251
|
syntheticNamedExports: false
|
|
22212
22252
|
};
|
|
@@ -22401,6 +22441,40 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22401
22441
|
return context;
|
|
22402
22442
|
}
|
|
22403
22443
|
|
|
22444
|
+
const unfulfilledActions = new Set();
|
|
22445
|
+
function addUnresolvedAction(actionTuple) {
|
|
22446
|
+
unfulfilledActions.add(actionTuple);
|
|
22447
|
+
}
|
|
22448
|
+
function resolveAction(actionTuple) {
|
|
22449
|
+
unfulfilledActions.delete(actionTuple);
|
|
22450
|
+
}
|
|
22451
|
+
function formatAction([pluginName, hookName, args]) {
|
|
22452
|
+
let action = `(${pluginName}) ${hookName}`;
|
|
22453
|
+
const s = JSON.stringify;
|
|
22454
|
+
switch (hookName) {
|
|
22455
|
+
case 'resolveId':
|
|
22456
|
+
action += ` ${s(args[0])} ${s(args[1])}`;
|
|
22457
|
+
break;
|
|
22458
|
+
case 'load':
|
|
22459
|
+
action += ` ${s(args[0])}`;
|
|
22460
|
+
break;
|
|
22461
|
+
case 'transform':
|
|
22462
|
+
action += ` ${s(args[1])}`;
|
|
22463
|
+
break;
|
|
22464
|
+
}
|
|
22465
|
+
return action;
|
|
22466
|
+
}
|
|
22467
|
+
process.on('exit', () => {
|
|
22468
|
+
if (unfulfilledActions.size) {
|
|
22469
|
+
let err = '[!] Error: unfinished hook action(s) on exit:\n';
|
|
22470
|
+
for (const action of unfulfilledActions) {
|
|
22471
|
+
err += formatAction(action) + '\n';
|
|
22472
|
+
}
|
|
22473
|
+
console.error('%s', err);
|
|
22474
|
+
process.exit(1);
|
|
22475
|
+
}
|
|
22476
|
+
});
|
|
22477
|
+
|
|
22404
22478
|
const inputHookNames = {
|
|
22405
22479
|
buildEnd: 1,
|
|
22406
22480
|
buildStart: 1,
|
|
@@ -22411,6 +22485,7 @@ const inputHookNames = {
|
|
|
22411
22485
|
options: 1,
|
|
22412
22486
|
resolveDynamicImport: 1,
|
|
22413
22487
|
resolveId: 1,
|
|
22488
|
+
shouldTransformCachedModule: 1,
|
|
22414
22489
|
transform: 1,
|
|
22415
22490
|
watchChange: 1
|
|
22416
22491
|
};
|
|
@@ -22552,6 +22627,7 @@ class PluginDriver {
|
|
|
22552
22627
|
if (hookContext) {
|
|
22553
22628
|
context = hookContext(context, plugin);
|
|
22554
22629
|
}
|
|
22630
|
+
let action = null;
|
|
22555
22631
|
return Promise.resolve()
|
|
22556
22632
|
.then(() => {
|
|
22557
22633
|
// permit values allows values to be returned instead of a functional hook
|
|
@@ -22561,9 +22637,35 @@ class PluginDriver {
|
|
|
22561
22637
|
return throwInvalidHookError(hookName, plugin.name);
|
|
22562
22638
|
}
|
|
22563
22639
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22564
|
-
|
|
22640
|
+
const hookResult = hook.apply(context, args);
|
|
22641
|
+
if (!hookResult || !hookResult.then) {
|
|
22642
|
+
// short circuit for non-thenables and non-Promises
|
|
22643
|
+
return hookResult;
|
|
22644
|
+
}
|
|
22645
|
+
// Track pending hook actions to properly error out when
|
|
22646
|
+
// unfulfilled promises cause rollup to abruptly and confusingly
|
|
22647
|
+
// exit with a successful 0 return code but without producing any
|
|
22648
|
+
// output, errors or warnings.
|
|
22649
|
+
action = [plugin.name, hookName, args];
|
|
22650
|
+
addUnresolvedAction(action);
|
|
22651
|
+
// Although it would be more elegant to just return hookResult here
|
|
22652
|
+
// and put the .then() handler just above the .catch() handler below,
|
|
22653
|
+
// doing so would subtly change the defacto async event dispatch order
|
|
22654
|
+
// which at least one test and some plugins in the wild may depend on.
|
|
22655
|
+
const promise = Promise.resolve(hookResult);
|
|
22656
|
+
return promise.then(() => {
|
|
22657
|
+
// action was fulfilled
|
|
22658
|
+
resolveAction(action);
|
|
22659
|
+
return promise;
|
|
22660
|
+
});
|
|
22565
22661
|
})
|
|
22566
|
-
.catch(err =>
|
|
22662
|
+
.catch(err => {
|
|
22663
|
+
if (action !== null) {
|
|
22664
|
+
// action considered to be fulfilled since error being handled
|
|
22665
|
+
resolveAction(action);
|
|
22666
|
+
}
|
|
22667
|
+
return throwPluginError(err, plugin.name, { hook: hookName });
|
|
22668
|
+
});
|
|
22567
22669
|
}
|
|
22568
22670
|
/**
|
|
22569
22671
|
* Run a sync plugin hook and return the result.
|
|
@@ -22876,6 +22978,7 @@ const generatedCodePresets = {
|
|
|
22876
22978
|
reservedNamesAsProps: true
|
|
22877
22979
|
}
|
|
22878
22980
|
};
|
|
22981
|
+
const objectifyOption = (value) => value && typeof value === 'object' ? value : {};
|
|
22879
22982
|
const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (value) => {
|
|
22880
22983
|
if (typeof value === 'string') {
|
|
22881
22984
|
const preset = presets[value];
|
|
@@ -22884,7 +22987,7 @@ const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (v
|
|
|
22884
22987
|
}
|
|
22885
22988
|
error(errInvalidOption(optionName, getHashFromObjectOption(optionName), `valid values are ${additionalValues}${printQuotedStringList(Object.keys(presets))}. You can also supply an object for more fine-grained control`, value));
|
|
22886
22989
|
}
|
|
22887
|
-
return value
|
|
22990
|
+
return objectifyOption(value);
|
|
22888
22991
|
};
|
|
22889
22992
|
const getOptionWithPreset = (value, presets, optionName, additionalValues) => {
|
|
22890
22993
|
var _a;
|
|
@@ -23532,16 +23635,27 @@ function defineConfig(options) {
|
|
|
23532
23635
|
|
|
23533
23636
|
let fsEvents;
|
|
23534
23637
|
let fsEventsImportError;
|
|
23535
|
-
function loadFsEvents() {
|
|
23638
|
+
async function loadFsEvents() {
|
|
23536
23639
|
const moduleName = 'fsevents';
|
|
23537
|
-
|
|
23538
|
-
|
|
23539
|
-
|
|
23540
|
-
|
|
23541
|
-
.catch(err => {
|
|
23640
|
+
try {
|
|
23641
|
+
({ default: fsEvents } = await import(moduleName));
|
|
23642
|
+
}
|
|
23643
|
+
catch (err) {
|
|
23542
23644
|
fsEventsImportError = err;
|
|
23543
|
-
}
|
|
23645
|
+
}
|
|
23544
23646
|
}
|
|
23647
|
+
// A call to this function will be injected into the chokidar code
|
|
23648
|
+
function getFsEvents() {
|
|
23649
|
+
if (fsEventsImportError)
|
|
23650
|
+
throw fsEventsImportError;
|
|
23651
|
+
return fsEvents;
|
|
23652
|
+
}
|
|
23653
|
+
|
|
23654
|
+
const fseventsImporter = {
|
|
23655
|
+
__proto__: null,
|
|
23656
|
+
loadFsEvents,
|
|
23657
|
+
getFsEvents
|
|
23658
|
+
};
|
|
23545
23659
|
|
|
23546
23660
|
class WatchEmitter extends EventEmitter {
|
|
23547
23661
|
constructor() {
|
|
@@ -23565,4 +23679,4 @@ function watch(configs) {
|
|
|
23565
23679
|
return emitter;
|
|
23566
23680
|
}
|
|
23567
23681
|
|
|
23568
|
-
export { createFilter, defaultOnWarn, defineConfig, ensureArray, generatedCodePresets, objectifyOptionWithPresets, picomatch, rollup, rollupInternal, treeshakePresets, version$1 as version, warnUnknownOptions, watch };
|
|
23682
|
+
export { createFilter, defaultOnWarn, defineConfig, ensureArray, fseventsImporter, generatedCodePresets, getAugmentedNamespace, objectifyOption, objectifyOptionWithPresets, picomatch, rollup, rollupInternal, treeshakePresets, version$1 as version, warnUnknownOptions, watch };
|