rollup 2.68.0 → 2.69.2
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 +50 -0
- package/dist/bin/rollup +5 -11
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +213 -182
- package/dist/es/shared/watch.js +3 -3
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +3 -1
- package/dist/rollup.js +3 -3
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +12 -15
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +235 -204
- package/dist/shared/watch-cli.js +4 -2
- package/dist/shared/watch.js +5 -3
- package/package.json +15 -15
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.69.2
|
|
4
|
+
Sun, 06 Mar 2022 06:43:03 GMT - commit 68817534499a6a1392c465d7fe92a1ef6804ad45
|
|
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$$0, { relative as relative$1,
|
|
11
|
+
import require$$0, { resolve, extname, basename, dirname, relative as relative$1, win32, posix, isAbsolute as isAbsolute$1 } from 'path';
|
|
12
12
|
import process$1 from 'process';
|
|
13
13
|
import { performance } from 'perf_hooks';
|
|
14
14
|
import { createHash as createHash$1 } from 'crypto';
|
|
15
15
|
import { promises } from 'fs';
|
|
16
16
|
import { EventEmitter } from 'events';
|
|
17
17
|
|
|
18
|
-
var version$1 = "2.
|
|
18
|
+
var version$1 = "2.69.2";
|
|
19
19
|
|
|
20
20
|
var charToInteger = {};
|
|
21
21
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1736,7 +1736,7 @@ function printQuotedStringList(list, verbs) {
|
|
|
1736
1736
|
}
|
|
1737
1737
|
|
|
1738
1738
|
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[\\|/])/;
|
|
1739
|
-
const RELATIVE_PATH_REGEX =
|
|
1739
|
+
const RELATIVE_PATH_REGEX = /^\.?\.(\/|$)/;
|
|
1740
1740
|
function isAbsolute(path) {
|
|
1741
1741
|
return ABSOLUTE_PATH_REGEX.test(path);
|
|
1742
1742
|
}
|
|
@@ -1750,17 +1750,35 @@ function normalize(path) {
|
|
|
1750
1750
|
|
|
1751
1751
|
function getAliasName(id) {
|
|
1752
1752
|
const base = basename(id);
|
|
1753
|
-
return base.
|
|
1753
|
+
return base.substring(0, base.length - extname(id).length);
|
|
1754
1754
|
}
|
|
1755
1755
|
function relativeId(id) {
|
|
1756
1756
|
if (!isAbsolute(id))
|
|
1757
1757
|
return id;
|
|
1758
|
-
return relative
|
|
1758
|
+
return relative(resolve(), id);
|
|
1759
1759
|
}
|
|
1760
1760
|
function isPathFragment(name) {
|
|
1761
1761
|
// starting with "/", "./", "../", "C:/"
|
|
1762
1762
|
return (name[0] === '/' || (name[0] === '.' && (name[1] === '/' || name[1] === '.')) || isAbsolute(name));
|
|
1763
1763
|
}
|
|
1764
|
+
const UPPER_DIR_REGEX = /^(\.\.\/)*\.\.$/;
|
|
1765
|
+
function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName) {
|
|
1766
|
+
let relativePath = normalize(relative(dirname(importerId), targetPath));
|
|
1767
|
+
if (stripJsExtension && relativePath.endsWith('.js')) {
|
|
1768
|
+
relativePath = relativePath.slice(0, -3);
|
|
1769
|
+
}
|
|
1770
|
+
if (ensureFileName) {
|
|
1771
|
+
if (relativePath === '')
|
|
1772
|
+
return '../' + basename(targetPath);
|
|
1773
|
+
if (UPPER_DIR_REGEX.test(relativePath)) {
|
|
1774
|
+
return relativePath
|
|
1775
|
+
.split('/')
|
|
1776
|
+
.concat(['..', basename(targetPath)])
|
|
1777
|
+
.join('/');
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
return !relativePath ? '.' : relativePath.startsWith('..') ? relativePath : './' + relativePath;
|
|
1781
|
+
}
|
|
1764
1782
|
|
|
1765
1783
|
function error(base) {
|
|
1766
1784
|
if (!(base instanceof Error))
|
|
@@ -2246,7 +2264,6 @@ class ExternalModule {
|
|
|
2246
2264
|
? normalize(relative$1(inputBase, this.id))
|
|
2247
2265
|
: this.id;
|
|
2248
2266
|
}
|
|
2249
|
-
return this.renderPath;
|
|
2250
2267
|
}
|
|
2251
2268
|
suggestName(name) {
|
|
2252
2269
|
var _a;
|
|
@@ -4663,9 +4680,8 @@ function getLiteralMembersForValue(value) {
|
|
|
4663
4680
|
return literalNumberMembers;
|
|
4664
4681
|
case 'string':
|
|
4665
4682
|
return literalStringMembers;
|
|
4666
|
-
default:
|
|
4667
|
-
return Object.create(null);
|
|
4668
4683
|
}
|
|
4684
|
+
return Object.create(null);
|
|
4669
4685
|
}
|
|
4670
4686
|
function hasMemberEffectWhenCalled(members, memberName, callOptions, context) {
|
|
4671
4687
|
if (typeof memberName !== 'string' || !members[memberName]) {
|
|
@@ -5756,6 +5772,30 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
5756
5772
|
}
|
|
5757
5773
|
}
|
|
5758
5774
|
|
|
5775
|
+
const isInteger = (prop) => typeof prop === 'string' && /^\d+$/.test(prop);
|
|
5776
|
+
// This makes sure unknown properties are not handled as "undefined" but as
|
|
5777
|
+
// "unknown" but without access side effects. An exception is done for numeric
|
|
5778
|
+
// properties as we do not expect new builtin properties to be numbers, this
|
|
5779
|
+
// will improve tree-shaking for out-of-bounds array properties
|
|
5780
|
+
const OBJECT_PROTOTYPE_FALLBACK = new (class ObjectPrototypeFallbackExpression extends ExpressionEntity {
|
|
5781
|
+
deoptimizeThisOnEventAtPath(event, path, thisParameter) {
|
|
5782
|
+
if (event === EVENT_CALLED && path.length === 1 && !isInteger(path[0])) {
|
|
5783
|
+
thisParameter.deoptimizePath(UNKNOWN_PATH);
|
|
5784
|
+
}
|
|
5785
|
+
}
|
|
5786
|
+
getLiteralValueAtPath(path) {
|
|
5787
|
+
// We ignore number properties as we do not expect new properties to be
|
|
5788
|
+
// numbers and also want to keep handling out-of-bound array elements as
|
|
5789
|
+
// "undefined"
|
|
5790
|
+
return path.length === 1 && isInteger(path[0]) ? undefined : UnknownValue;
|
|
5791
|
+
}
|
|
5792
|
+
hasEffectsWhenAccessedAtPath(path) {
|
|
5793
|
+
return path.length > 1;
|
|
5794
|
+
}
|
|
5795
|
+
hasEffectsWhenAssignedAtPath(path) {
|
|
5796
|
+
return path.length > 1;
|
|
5797
|
+
}
|
|
5798
|
+
})();
|
|
5759
5799
|
const OBJECT_PROTOTYPE = new ObjectEntity({
|
|
5760
5800
|
__proto__: null,
|
|
5761
5801
|
hasOwnProperty: METHOD_RETURNS_BOOLEAN,
|
|
@@ -5764,7 +5804,7 @@ const OBJECT_PROTOTYPE = new ObjectEntity({
|
|
|
5764
5804
|
toLocaleString: METHOD_RETURNS_STRING,
|
|
5765
5805
|
toString: METHOD_RETURNS_STRING,
|
|
5766
5806
|
valueOf: METHOD_RETURNS_UNKNOWN
|
|
5767
|
-
},
|
|
5807
|
+
}, OBJECT_PROTOTYPE_FALLBACK, true);
|
|
5768
5808
|
|
|
5769
5809
|
const NEW_ARRAY_PROPERTIES = [
|
|
5770
5810
|
{ key: UnknownInteger, kind: 'init', property: UNKNOWN_EXPRESSION },
|
|
@@ -6832,6 +6872,8 @@ const knownGlobals = {
|
|
|
6832
6872
|
isFrozen: PF,
|
|
6833
6873
|
isSealed: PF,
|
|
6834
6874
|
keys: PF,
|
|
6875
|
+
fromEntries: PF,
|
|
6876
|
+
entries: PF,
|
|
6835
6877
|
prototype: O
|
|
6836
6878
|
},
|
|
6837
6879
|
parseFloat: PF,
|
|
@@ -10001,19 +10043,17 @@ const HELPER_GENERATORS = {
|
|
|
10001
10043
|
return (`${left}e${_}&&${_}e.__esModule${_}?${_}` +
|
|
10002
10044
|
`${liveBindings ? getDefaultLiveBinding(snippets) : getDefaultStatic(snippets)}${right}${n}${n}`);
|
|
10003
10045
|
},
|
|
10004
|
-
[INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE](_t,
|
|
10046
|
+
[INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE](_t, snippets, _liveBindings, freeze, namespaceToStringTag) {
|
|
10047
|
+
const { getDirectReturnFunction, getObject, n } = snippets;
|
|
10005
10048
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
10006
10049
|
functionReturn: true,
|
|
10007
10050
|
lineBreakIndent: null,
|
|
10008
10051
|
name: INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE
|
|
10009
10052
|
});
|
|
10010
|
-
return `${left}${getFrozen(getObject([
|
|
10053
|
+
return `${left}${getFrozen(freeze, getWithToStringTag(namespaceToStringTag, getObject([
|
|
10011
10054
|
['__proto__', 'null'],
|
|
10012
|
-
...(namespaceToStringTag
|
|
10013
|
-
? [[null, `[Symbol.toStringTag]:${_}'Module'`]]
|
|
10014
|
-
: []),
|
|
10015
10055
|
['default', 'e']
|
|
10016
|
-
], { lineBreakIndent: null }),
|
|
10056
|
+
], { lineBreakIndent: null }), snippets))}${right}${n}${n}`;
|
|
10017
10057
|
},
|
|
10018
10058
|
[INTEROP_NAMESPACE_DEFAULT_VARIABLE](t, snippets, liveBindings, freeze, namespaceToStringTag) {
|
|
10019
10059
|
const { _, n } = snippets;
|
|
@@ -10036,7 +10076,7 @@ const HELPER_GENERATORS = {
|
|
|
10036
10076
|
createNamespaceObject(t, t, snippets, liveBindings, freeze, namespaceToStringTag) +
|
|
10037
10077
|
`}${n}${n}`);
|
|
10038
10078
|
},
|
|
10039
|
-
[MERGE_NAMESPACES_VARIABLE](t, snippets, liveBindings, freeze) {
|
|
10079
|
+
[MERGE_NAMESPACES_VARIABLE](t, snippets, liveBindings, freeze, namespaceToStringTag) {
|
|
10040
10080
|
const { _, cnst, n } = snippets;
|
|
10041
10081
|
const useForEach = cnst === 'var' && liveBindings;
|
|
10042
10082
|
return (`function ${MERGE_NAMESPACES_VARIABLE}(n, m)${_}{${n}` +
|
|
@@ -10049,25 +10089,25 @@ const HELPER_GENERATORS = {
|
|
|
10049
10089
|
: copyPropertyStatic)(t, t + t + t + t, snippets) +
|
|
10050
10090
|
`${t}${t}${t}}${n}` +
|
|
10051
10091
|
`${t}${t}}`, useForEach, t, snippets)}${n}` +
|
|
10052
|
-
`${t}return ${getFrozen('n',
|
|
10092
|
+
`${t}return ${getFrozen(freeze, getWithToStringTag(namespaceToStringTag, 'n', snippets))};${n}` +
|
|
10053
10093
|
`}${n}${n}`);
|
|
10054
10094
|
}
|
|
10055
10095
|
};
|
|
10056
10096
|
const getDefaultLiveBinding = ({ _, getObject }) => `e${_}:${_}${getObject([['default', 'e']], { lineBreakIndent: null })}`;
|
|
10057
10097
|
const getDefaultStatic = ({ _, getPropertyAccess }) => `e${getPropertyAccess('default')}${_}:${_}e`;
|
|
10058
10098
|
const createNamespaceObject = (t, i, snippets, liveBindings, freeze, namespaceToStringTag) => {
|
|
10059
|
-
const { _, cnst, getPropertyAccess, n, s } = snippets;
|
|
10099
|
+
const { _, cnst, getObject, getPropertyAccess, n, s } = snippets;
|
|
10060
10100
|
const copyProperty = `{${n}` +
|
|
10061
10101
|
(liveBindings ? copyNonDefaultOwnPropertyLiveBinding : copyPropertyStatic)(t, i + t + t, snippets) +
|
|
10062
10102
|
`${i}${t}}`;
|
|
10063
|
-
return (`${i}${cnst} n${_}=${_}${namespaceToStringTag
|
|
10064
|
-
?
|
|
10065
|
-
: '
|
|
10103
|
+
return (`${i}${cnst} n${_}=${_}Object.create(null${namespaceToStringTag
|
|
10104
|
+
? `,${_}{${_}[Symbol.toStringTag]:${_}${getToStringTagValue(getObject)}${_}}`
|
|
10105
|
+
: ''});${n}` +
|
|
10066
10106
|
`${i}if${_}(e)${_}{${n}` +
|
|
10067
10107
|
`${i}${t}${loopOverKeys(copyProperty, !liveBindings, snippets)}${n}` +
|
|
10068
10108
|
`${i}}${n}` +
|
|
10069
10109
|
`${i}n${getPropertyAccess('default')}${_}=${_}e;${n}` +
|
|
10070
|
-
`${i}return ${getFrozen('n'
|
|
10110
|
+
`${i}return ${getFrozen(freeze, 'n')}${s}${n}`);
|
|
10071
10111
|
};
|
|
10072
10112
|
const loopOverKeys = (body, allowVarLoopVariable, { _, cnst, getFunctionIntro, s }) => cnst !== 'var' || allowVarLoopVariable
|
|
10073
10113
|
? `for${_}(${cnst} k in e)${_}${body}`
|
|
@@ -10125,8 +10165,16 @@ const copyPropertyLiveBinding = (t, i, { _, cnst, getDirectReturnFunction, n })
|
|
|
10125
10165
|
`${i}}${n}`);
|
|
10126
10166
|
};
|
|
10127
10167
|
const copyPropertyStatic = (_t, i, { _, n }) => `${i}n[k]${_}=${_}e[k];${n}`;
|
|
10128
|
-
const getFrozen = (
|
|
10168
|
+
const getFrozen = (freeze, fragment) => freeze ? `Object.freeze(${fragment})` : fragment;
|
|
10169
|
+
const getWithToStringTag = (namespaceToStringTag, fragment, { _, getObject }) => namespaceToStringTag
|
|
10170
|
+
? `Object.defineProperty(${fragment},${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)})`
|
|
10171
|
+
: fragment;
|
|
10129
10172
|
const HELPER_NAMES = Object.keys(HELPER_GENERATORS);
|
|
10173
|
+
function getToStringTagValue(getObject) {
|
|
10174
|
+
return getObject([['value', "'Module'"]], {
|
|
10175
|
+
lineBreakIndent: null
|
|
10176
|
+
});
|
|
10177
|
+
}
|
|
10130
10178
|
|
|
10131
10179
|
class ImportExpression extends NodeBase {
|
|
10132
10180
|
constructor() {
|
|
@@ -10503,7 +10551,7 @@ class MetaProperty extends NodeBase {
|
|
|
10503
10551
|
getReferencedFileName(outputPluginDriver) {
|
|
10504
10552
|
const metaProperty = this.metaProperty;
|
|
10505
10553
|
if (metaProperty && metaProperty.startsWith(FILE_PREFIX)) {
|
|
10506
|
-
return outputPluginDriver.getFileName(metaProperty.
|
|
10554
|
+
return outputPluginDriver.getFileName(metaProperty.substring(FILE_PREFIX.length));
|
|
10507
10555
|
}
|
|
10508
10556
|
return null;
|
|
10509
10557
|
}
|
|
@@ -10539,17 +10587,17 @@ class MetaProperty extends NodeBase {
|
|
|
10539
10587
|
let chunkReferenceId = null;
|
|
10540
10588
|
let fileName;
|
|
10541
10589
|
if (metaProperty.startsWith(FILE_PREFIX)) {
|
|
10542
|
-
referenceId = metaProperty.
|
|
10590
|
+
referenceId = metaProperty.substring(FILE_PREFIX.length);
|
|
10543
10591
|
fileName = outputPluginDriver.getFileName(referenceId);
|
|
10544
10592
|
}
|
|
10545
10593
|
else if (metaProperty.startsWith(ASSET_PREFIX)) {
|
|
10546
10594
|
warnDeprecation(`Using the "${ASSET_PREFIX}" prefix to reference files is deprecated. Use the "${FILE_PREFIX}" prefix instead.`, true, this.context.options);
|
|
10547
|
-
assetReferenceId = metaProperty.
|
|
10595
|
+
assetReferenceId = metaProperty.substring(ASSET_PREFIX.length);
|
|
10548
10596
|
fileName = outputPluginDriver.getFileName(assetReferenceId);
|
|
10549
10597
|
}
|
|
10550
10598
|
else {
|
|
10551
10599
|
warnDeprecation(`Using the "${CHUNK_PREFIX}" prefix to reference files is deprecated. Use the "${FILE_PREFIX}" prefix instead.`, true, this.context.options);
|
|
10552
|
-
chunkReferenceId = metaProperty.
|
|
10600
|
+
chunkReferenceId = metaProperty.substring(CHUNK_PREFIX.length);
|
|
10553
10601
|
fileName = outputPluginDriver.getFileName(chunkReferenceId);
|
|
10554
10602
|
}
|
|
10555
10603
|
const relativePath = normalize(relative$1(dirname(chunkId), fileName));
|
|
@@ -11905,17 +11953,20 @@ class NamespaceVariable extends Variable {
|
|
|
11905
11953
|
}
|
|
11906
11954
|
return [name, original.getName(getPropertyAccess)];
|
|
11907
11955
|
});
|
|
11908
|
-
if (namespaceToStringTag) {
|
|
11909
|
-
members.unshift([null, `[Symbol.toStringTag]:${_}'Module'`]);
|
|
11910
|
-
}
|
|
11911
11956
|
members.unshift([null, `__proto__:${_}null`]);
|
|
11912
11957
|
let output = getObject(members, { lineBreakIndent: { base: '', t } });
|
|
11913
11958
|
if (this.mergedNamespaces.length > 0) {
|
|
11914
11959
|
const assignmentArgs = this.mergedNamespaces.map(variable => variable.getName(getPropertyAccess));
|
|
11915
|
-
output = `/*#__PURE__*/${MERGE_NAMESPACES_VARIABLE}(${output}
|
|
11960
|
+
output = `/*#__PURE__*/${MERGE_NAMESPACES_VARIABLE}(${output},${_}[${assignmentArgs.join(`,${_}`)}])`;
|
|
11916
11961
|
}
|
|
11917
|
-
|
|
11918
|
-
|
|
11962
|
+
else {
|
|
11963
|
+
// The helper to merge namespaces will also take care of freezing and toStringTag
|
|
11964
|
+
if (namespaceToStringTag) {
|
|
11965
|
+
output = `/*#__PURE__*/Object.defineProperty(${output},${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)})`;
|
|
11966
|
+
}
|
|
11967
|
+
if (freeze) {
|
|
11968
|
+
output = `/*#__PURE__*/Object.freeze(${output})`;
|
|
11969
|
+
}
|
|
11919
11970
|
}
|
|
11920
11971
|
const name = this.getName(getPropertyAccess);
|
|
11921
11972
|
output = `${cnst} ${name}${_}=${_}${output};`;
|
|
@@ -11994,29 +12045,23 @@ function getId(m) {
|
|
|
11994
12045
|
|
|
11995
12046
|
function getOriginalLocation(sourcemapChain, location) {
|
|
11996
12047
|
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
|
|
11997
|
-
while (filteredSourcemapChain.length > 0) {
|
|
12048
|
+
traceSourcemap: while (filteredSourcemapChain.length > 0) {
|
|
11998
12049
|
const sourcemap = filteredSourcemapChain.pop();
|
|
11999
12050
|
const line = sourcemap.mappings[location.line - 1];
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
break;
|
|
12051
|
+
if (line) {
|
|
12052
|
+
const filteredLine = line.filter((segment) => segment.length > 1);
|
|
12053
|
+
const lastSegment = filteredLine[filteredLine.length - 1];
|
|
12054
|
+
for (const segment of filteredLine) {
|
|
12055
|
+
if (segment[0] >= location.column || segment === lastSegment) {
|
|
12006
12056
|
location = {
|
|
12007
12057
|
column: segment[3],
|
|
12008
|
-
line: segment[2] + 1
|
|
12009
|
-
name: segment.length === 5 ? sourcemap.names[segment[4]] : undefined,
|
|
12010
|
-
source: sourcemap.sources[segment[1]]
|
|
12058
|
+
line: segment[2] + 1
|
|
12011
12059
|
};
|
|
12012
|
-
|
|
12013
|
-
break;
|
|
12060
|
+
continue traceSourcemap;
|
|
12014
12061
|
}
|
|
12015
12062
|
}
|
|
12016
12063
|
}
|
|
12017
|
-
|
|
12018
|
-
throw new Error("Can't resolve original location of error.");
|
|
12019
|
-
}
|
|
12064
|
+
throw new Error("Can't resolve original location of error.");
|
|
12020
12065
|
}
|
|
12021
12066
|
return location;
|
|
12022
12067
|
}
|
|
@@ -12225,7 +12270,7 @@ class Module {
|
|
|
12225
12270
|
this.preserveSignature = this.options.preserveEntrySignatures;
|
|
12226
12271
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
12227
12272
|
const module = this;
|
|
12228
|
-
const { dynamicImports, dynamicImporters,
|
|
12273
|
+
const { dynamicImports, dynamicImporters, implicitlyLoadedAfter, implicitlyLoadedBefore, importers, reexportDescriptions, sources } = this;
|
|
12229
12274
|
this.info = {
|
|
12230
12275
|
ast: null,
|
|
12231
12276
|
code: null,
|
|
@@ -12237,13 +12282,7 @@ class Module {
|
|
|
12237
12282
|
get dynamicallyImportedIds() {
|
|
12238
12283
|
// We cannot use this.dynamicDependencies because this is needed before
|
|
12239
12284
|
// dynamicDependencies are populated
|
|
12240
|
-
|
|
12241
|
-
for (const { id } of dynamicImports) {
|
|
12242
|
-
if (id) {
|
|
12243
|
-
dynamicallyImportedIds.push(id);
|
|
12244
|
-
}
|
|
12245
|
-
}
|
|
12246
|
-
return dynamicallyImportedIds;
|
|
12285
|
+
return dynamicImports.map(({ id }) => id).filter((id) => id != null);
|
|
12247
12286
|
},
|
|
12248
12287
|
get dynamicImporters() {
|
|
12249
12288
|
return dynamicImporters.sort();
|
|
@@ -12257,7 +12296,7 @@ class Module {
|
|
|
12257
12296
|
},
|
|
12258
12297
|
get hasModuleSideEffects() {
|
|
12259
12298
|
warnDeprecation('Accessing ModuleInfo.hasModuleSideEffects from plugins is deprecated. Please use ModuleInfo.moduleSideEffects instead.', false, options);
|
|
12260
|
-
return
|
|
12299
|
+
return this.moduleSideEffects;
|
|
12261
12300
|
},
|
|
12262
12301
|
id,
|
|
12263
12302
|
get implicitlyLoadedAfterOneOf() {
|
|
@@ -13092,26 +13131,29 @@ function getReexportedImportName(moduleVariableName, imported, depNamedExportsMo
|
|
|
13092
13131
|
}
|
|
13093
13132
|
return `${moduleVariableName}${getPropertyAccess(imported)}`;
|
|
13094
13133
|
}
|
|
13095
|
-
function
|
|
13096
|
-
return
|
|
13097
|
-
|
|
13098
|
-
|
|
13099
|
-
return `exports[Symbol.toStringTag]${_}=${_}'Module';`;
|
|
13134
|
+
function getEsModuleValue(getObject) {
|
|
13135
|
+
return getObject([['value', 'true']], {
|
|
13136
|
+
lineBreakIndent: null
|
|
13137
|
+
});
|
|
13100
13138
|
}
|
|
13101
|
-
function getNamespaceMarkers(hasNamedExports, addEsModule, addNamespaceToStringTag, _,
|
|
13102
|
-
let namespaceMarkers = '';
|
|
13139
|
+
function getNamespaceMarkers(hasNamedExports, addEsModule, addNamespaceToStringTag, { _, getObject }) {
|
|
13103
13140
|
if (hasNamedExports) {
|
|
13104
13141
|
if (addEsModule) {
|
|
13105
|
-
|
|
13142
|
+
if (addNamespaceToStringTag) {
|
|
13143
|
+
return `Object.defineProperties(exports,${_}${getObject([
|
|
13144
|
+
['__esModule', getEsModuleValue(getObject)],
|
|
13145
|
+
[null, `[Symbol.toStringTag]:${_}${getToStringTagValue(getObject)}`]
|
|
13146
|
+
], {
|
|
13147
|
+
lineBreakIndent: null
|
|
13148
|
+
})});`;
|
|
13149
|
+
}
|
|
13150
|
+
return `Object.defineProperty(exports,${_}'__esModule',${_}${getEsModuleValue(getObject)});`;
|
|
13106
13151
|
}
|
|
13107
13152
|
if (addNamespaceToStringTag) {
|
|
13108
|
-
|
|
13109
|
-
namespaceMarkers += n;
|
|
13110
|
-
}
|
|
13111
|
-
namespaceMarkers += getNamespaceToStringExport(_);
|
|
13153
|
+
return `Object.defineProperty(exports,${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)});`;
|
|
13112
13154
|
}
|
|
13113
13155
|
}
|
|
13114
|
-
return
|
|
13156
|
+
return '';
|
|
13115
13157
|
}
|
|
13116
13158
|
const getDefineProperty = (name, needsLiveBinding, t, { _, getDirectReturnFunction, n }) => {
|
|
13117
13159
|
if (needsLiveBinding) {
|
|
@@ -13248,7 +13290,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13248
13290
|
const useStrict = strict ? `${_}'use strict';` : '';
|
|
13249
13291
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, t, snippets)}`);
|
|
13250
13292
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
13251
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag,
|
|
13293
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, snippets);
|
|
13252
13294
|
if (namespaceMarkers) {
|
|
13253
13295
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
13254
13296
|
}
|
|
@@ -13267,7 +13309,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13267
13309
|
function cjs(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
|
|
13268
13310
|
const { _, n } = snippets;
|
|
13269
13311
|
const useStrict = strict ? `'use strict';${n}${n}` : '';
|
|
13270
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag,
|
|
13312
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, snippets);
|
|
13271
13313
|
if (namespaceMarkers) {
|
|
13272
13314
|
namespaceMarkers += n + n;
|
|
13273
13315
|
}
|
|
@@ -13511,7 +13553,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13511
13553
|
wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
|
|
13512
13554
|
}
|
|
13513
13555
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
13514
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag,
|
|
13556
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, snippets);
|
|
13515
13557
|
if (namespaceMarkers) {
|
|
13516
13558
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
13517
13559
|
}
|
|
@@ -13745,7 +13787,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13745
13787
|
const wrapperOutro = n + n + '}));';
|
|
13746
13788
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, t, snippets)}`);
|
|
13747
13789
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
13748
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag,
|
|
13790
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, snippets);
|
|
13749
13791
|
if (namespaceMarkers) {
|
|
13750
13792
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
13751
13793
|
}
|
|
@@ -13773,6 +13815,7 @@ class Link {
|
|
|
13773
13815
|
}
|
|
13774
13816
|
traceMappings() {
|
|
13775
13817
|
const sources = [];
|
|
13818
|
+
const sourceIndexMap = new Map();
|
|
13776
13819
|
const sourcesContent = [];
|
|
13777
13820
|
const names = [];
|
|
13778
13821
|
const nameIndexMap = new Map();
|
|
@@ -13780,41 +13823,36 @@ class Link {
|
|
|
13780
13823
|
for (const line of this.mappings) {
|
|
13781
13824
|
const tracedLine = [];
|
|
13782
13825
|
for (const segment of line) {
|
|
13783
|
-
if (segment.length
|
|
13826
|
+
if (segment.length === 1)
|
|
13784
13827
|
continue;
|
|
13785
13828
|
const source = this.sources[segment[1]];
|
|
13786
13829
|
if (!source)
|
|
13787
13830
|
continue;
|
|
13788
13831
|
const traced = source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : '');
|
|
13789
13832
|
if (traced) {
|
|
13790
|
-
|
|
13791
|
-
let sourceIndex =
|
|
13792
|
-
if (sourceIndex ===
|
|
13833
|
+
const { column, line, name, source: { content, filename } } = traced;
|
|
13834
|
+
let sourceIndex = sourceIndexMap.get(filename);
|
|
13835
|
+
if (sourceIndex === undefined) {
|
|
13793
13836
|
sourceIndex = sources.length;
|
|
13794
|
-
sources.push(
|
|
13795
|
-
|
|
13837
|
+
sources.push(filename);
|
|
13838
|
+
sourceIndexMap.set(filename, sourceIndex);
|
|
13839
|
+
sourcesContent[sourceIndex] = content;
|
|
13796
13840
|
}
|
|
13797
13841
|
else if (sourcesContent[sourceIndex] == null) {
|
|
13798
|
-
sourcesContent[sourceIndex] =
|
|
13842
|
+
sourcesContent[sourceIndex] = content;
|
|
13799
13843
|
}
|
|
13800
|
-
else if (
|
|
13801
|
-
sourcesContent[sourceIndex] !== traced.source.content) {
|
|
13844
|
+
else if (content != null && sourcesContent[sourceIndex] !== content) {
|
|
13802
13845
|
return error({
|
|
13803
|
-
message: `Multiple conflicting contents for sourcemap source ${
|
|
13846
|
+
message: `Multiple conflicting contents for sourcemap source ${filename}`
|
|
13804
13847
|
});
|
|
13805
13848
|
}
|
|
13806
|
-
const tracedSegment = [
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
traced.line,
|
|
13810
|
-
traced.column
|
|
13811
|
-
];
|
|
13812
|
-
if (traced.name) {
|
|
13813
|
-
let nameIndex = nameIndexMap.get(traced.name);
|
|
13849
|
+
const tracedSegment = [segment[0], sourceIndex, line, column];
|
|
13850
|
+
if (name) {
|
|
13851
|
+
let nameIndex = nameIndexMap.get(name);
|
|
13814
13852
|
if (nameIndex === undefined) {
|
|
13815
13853
|
nameIndex = names.length;
|
|
13816
|
-
names.push(
|
|
13817
|
-
nameIndexMap.set(
|
|
13854
|
+
names.push(name);
|
|
13855
|
+
nameIndexMap.set(name, nameIndex);
|
|
13818
13856
|
}
|
|
13819
13857
|
tracedSegment[4] = nameIndex;
|
|
13820
13858
|
}
|
|
@@ -13830,12 +13868,15 @@ class Link {
|
|
|
13830
13868
|
if (!segments)
|
|
13831
13869
|
return null;
|
|
13832
13870
|
// binary search through segments for the given column
|
|
13833
|
-
let
|
|
13834
|
-
let
|
|
13835
|
-
while (
|
|
13836
|
-
const m = (
|
|
13871
|
+
let searchStart = 0;
|
|
13872
|
+
let searchEnd = segments.length - 1;
|
|
13873
|
+
while (searchStart <= searchEnd) {
|
|
13874
|
+
const m = (searchStart + searchEnd) >> 1;
|
|
13837
13875
|
const segment = segments[m];
|
|
13838
|
-
|
|
13876
|
+
// If a sourcemap does not have sufficient resolution to contain a
|
|
13877
|
+
// necessary mapping, e.g. because it only contains line information, we
|
|
13878
|
+
// use the best approximation we could find
|
|
13879
|
+
if (segment[0] === column || searchStart === searchEnd) {
|
|
13839
13880
|
if (segment.length == 1)
|
|
13840
13881
|
return null;
|
|
13841
13882
|
const source = this.sources[segment[1]];
|
|
@@ -13844,10 +13885,10 @@ class Link {
|
|
|
13844
13885
|
return source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : name);
|
|
13845
13886
|
}
|
|
13846
13887
|
if (segment[0] > column) {
|
|
13847
|
-
|
|
13888
|
+
searchEnd = m - 1;
|
|
13848
13889
|
}
|
|
13849
13890
|
else {
|
|
13850
|
-
|
|
13891
|
+
searchStart = m + 1;
|
|
13851
13892
|
}
|
|
13852
13893
|
}
|
|
13853
13894
|
return null;
|
|
@@ -14225,7 +14266,7 @@ function makeUnique(name, existingNames) {
|
|
|
14225
14266
|
if (!existingNamesLowercase.has(name.toLocaleLowerCase()))
|
|
14226
14267
|
return name;
|
|
14227
14268
|
const ext = extname(name);
|
|
14228
|
-
name = name.
|
|
14269
|
+
name = name.substring(0, name.length - ext.length);
|
|
14229
14270
|
let uniqueName, uniqueIndex = 1;
|
|
14230
14271
|
while (existingNamesLowercase.has((uniqueName = name + ++uniqueIndex + ext).toLowerCase()))
|
|
14231
14272
|
;
|
|
@@ -14391,7 +14432,7 @@ class Chunk {
|
|
|
14391
14432
|
var _a;
|
|
14392
14433
|
const facades = [];
|
|
14393
14434
|
const entryModules = new Set([...this.entryModules, ...this.implicitEntryModules]);
|
|
14394
|
-
const exposedVariables = new Set(this.dynamicEntryModules.map(
|
|
14435
|
+
const exposedVariables = new Set(this.dynamicEntryModules.map(({ namespace }) => namespace));
|
|
14395
14436
|
for (const module of entryModules) {
|
|
14396
14437
|
if (module.preserveSignature) {
|
|
14397
14438
|
for (const exportedVariable of module.getExportNamesByVariable().keys()) {
|
|
@@ -14400,7 +14441,9 @@ class Chunk {
|
|
|
14400
14441
|
}
|
|
14401
14442
|
}
|
|
14402
14443
|
for (const module of entryModules) {
|
|
14403
|
-
const requiredFacades = Array.from(new Set(module.chunkNames.filter(({ isUserDefined }) => isUserDefined).map(({ name }) => name)),
|
|
14444
|
+
const requiredFacades = Array.from(new Set(module.chunkNames.filter(({ isUserDefined }) => isUserDefined).map(({ name }) => name)),
|
|
14445
|
+
// mapping must run after Set 'name' dedupe
|
|
14446
|
+
name => ({
|
|
14404
14447
|
name
|
|
14405
14448
|
}));
|
|
14406
14449
|
if (requiredFacades.length === 0 && module.isUserDefinedEntryPoint) {
|
|
@@ -14478,7 +14521,7 @@ class Chunk {
|
|
|
14478
14521
|
const extension = extname(sanitizedId);
|
|
14479
14522
|
const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
|
|
14480
14523
|
assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
|
|
14481
|
-
ext: () => extension.
|
|
14524
|
+
ext: () => extension.substring(1),
|
|
14482
14525
|
extname: () => extension,
|
|
14483
14526
|
format: () => options.format,
|
|
14484
14527
|
name: () => this.getChunkName()
|
|
@@ -14496,7 +14539,7 @@ class Chunk {
|
|
|
14496
14539
|
const extension = extname(sanitizedId);
|
|
14497
14540
|
const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
|
|
14498
14541
|
assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
|
|
14499
|
-
ext: () => extension.
|
|
14542
|
+
ext: () => extension.substring(1),
|
|
14500
14543
|
extname: () => extension,
|
|
14501
14544
|
format: () => options.format,
|
|
14502
14545
|
name: () => getAliasName(sanitizedId)
|
|
@@ -14678,22 +14721,24 @@ class Chunk {
|
|
|
14678
14721
|
const renderedDependency = this.renderedDependencies.get(dependency);
|
|
14679
14722
|
if (dependency instanceof ExternalModule) {
|
|
14680
14723
|
const originalId = dependency.renderPath;
|
|
14681
|
-
renderedDependency.id = escapeId(dependency.renormalizeRenderPath
|
|
14724
|
+
renderedDependency.id = escapeId(dependency.renormalizeRenderPath
|
|
14725
|
+
? getImportPath(this.id, originalId, false, false)
|
|
14726
|
+
: originalId);
|
|
14682
14727
|
}
|
|
14683
14728
|
else {
|
|
14684
14729
|
renderedDependency.namedExportsMode = dependency.exportMode !== 'default';
|
|
14685
|
-
renderedDependency.id = escapeId(this.
|
|
14730
|
+
renderedDependency.id = escapeId(getImportPath(this.id, dependency.id, false, true));
|
|
14686
14731
|
}
|
|
14687
14732
|
}
|
|
14688
14733
|
this.finaliseDynamicImports(options, snippets);
|
|
14689
14734
|
this.finaliseImportMetas(format, snippets);
|
|
14690
14735
|
const hasExports = this.renderedExports.length !== 0 ||
|
|
14691
14736
|
[...this.renderedDependencies.values()].some(dep => (dep.reexports && dep.reexports.length !== 0));
|
|
14692
|
-
let
|
|
14737
|
+
let topLevelAwaitModule = null;
|
|
14693
14738
|
const accessedGlobals = new Set();
|
|
14694
14739
|
for (const module of this.orderedModules) {
|
|
14695
14740
|
if (module.usesTopLevelAwait) {
|
|
14696
|
-
|
|
14741
|
+
topLevelAwaitModule = module.id;
|
|
14697
14742
|
}
|
|
14698
14743
|
const accessedGlobalVariables = this.accessedGlobalsByScope.get(module.scope);
|
|
14699
14744
|
if (accessedGlobalVariables) {
|
|
@@ -14702,9 +14747,10 @@ class Chunk {
|
|
|
14702
14747
|
}
|
|
14703
14748
|
}
|
|
14704
14749
|
}
|
|
14705
|
-
if (
|
|
14750
|
+
if (topLevelAwaitModule !== null && format !== 'es' && format !== 'system') {
|
|
14706
14751
|
return error({
|
|
14707
14752
|
code: 'INVALID_TLA_FORMAT',
|
|
14753
|
+
id: topLevelAwaitModule,
|
|
14708
14754
|
message: `Module format ${format} does not support top-level await. Use the "es" or "system" output formats rather.`
|
|
14709
14755
|
});
|
|
14710
14756
|
}
|
|
@@ -14726,7 +14772,7 @@ class Chunk {
|
|
|
14726
14772
|
namedExportsMode: this.exportMode !== 'default',
|
|
14727
14773
|
outro: addons.outro,
|
|
14728
14774
|
snippets,
|
|
14729
|
-
usesTopLevelAwait,
|
|
14775
|
+
usesTopLevelAwait: topLevelAwaitModule !== null,
|
|
14730
14776
|
warn: this.inputOptions.onwarn
|
|
14731
14777
|
}, options);
|
|
14732
14778
|
if (addons.banner)
|
|
@@ -14865,10 +14911,10 @@ class Chunk {
|
|
|
14865
14911
|
continue;
|
|
14866
14912
|
}
|
|
14867
14913
|
const renderedResolution = resolution instanceof Module
|
|
14868
|
-
? `'${escapeId(this.
|
|
14914
|
+
? `'${escapeId(getImportPath(this.id, (facadeChunk || chunk).id, stripKnownJsExtensions, true))}'`
|
|
14869
14915
|
: resolution instanceof ExternalModule
|
|
14870
14916
|
? `'${escapeId(resolution.renormalizeRenderPath
|
|
14871
|
-
? this.
|
|
14917
|
+
? getImportPath(this.id, resolution.renderPath, stripKnownJsExtensions, false)
|
|
14872
14918
|
: resolution.renderPath)}'`
|
|
14873
14919
|
: resolution;
|
|
14874
14920
|
node.renderFinalResolution(code, renderedResolution, resolution instanceof Module &&
|
|
@@ -15065,7 +15111,7 @@ class Chunk {
|
|
|
15065
15111
|
let imported;
|
|
15066
15112
|
let needsLiveBinding = false;
|
|
15067
15113
|
if (exportName[0] === '*') {
|
|
15068
|
-
const id = exportName.
|
|
15114
|
+
const id = exportName.substring(1);
|
|
15069
15115
|
if (interop(id) === 'defaultOnly') {
|
|
15070
15116
|
this.inputOptions.onwarn(errUnexpectedNamespaceReexport(id));
|
|
15071
15117
|
}
|
|
@@ -15116,17 +15162,6 @@ class Chunk {
|
|
|
15116
15162
|
}
|
|
15117
15163
|
return referencedFiles;
|
|
15118
15164
|
}
|
|
15119
|
-
getRelativePath(targetPath, stripJsExtension) {
|
|
15120
|
-
let relativePath = normalize(relative(dirname(this.id), targetPath));
|
|
15121
|
-
if (stripJsExtension && relativePath.endsWith('.js')) {
|
|
15122
|
-
relativePath = relativePath.slice(0, -3);
|
|
15123
|
-
}
|
|
15124
|
-
if (relativePath === '..')
|
|
15125
|
-
return '../../' + basename(targetPath);
|
|
15126
|
-
if (relativePath === '')
|
|
15127
|
-
return '../' + basename(targetPath);
|
|
15128
|
-
return relativePath.startsWith('../') ? relativePath : './' + relativePath;
|
|
15129
|
-
}
|
|
15130
15165
|
inlineChunkDependencies(chunk) {
|
|
15131
15166
|
for (const dep of chunk.dependencies) {
|
|
15132
15167
|
if (this.dependencies.has(dep))
|
|
@@ -15275,16 +15310,17 @@ function generateAssetFileName(name, source, outputOptions, bundle) {
|
|
|
15275
15310
|
return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
|
|
15276
15311
|
? outputOptions.assetFileNames({ name, source, type: 'asset' })
|
|
15277
15312
|
: outputOptions.assetFileNames, 'output.assetFileNames', {
|
|
15278
|
-
ext: () => extname(emittedName).
|
|
15313
|
+
ext: () => extname(emittedName).substring(1),
|
|
15279
15314
|
extname: () => extname(emittedName),
|
|
15280
15315
|
hash() {
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15316
|
+
return createHash()
|
|
15317
|
+
.update(emittedName)
|
|
15318
|
+
.update(':')
|
|
15319
|
+
.update(source)
|
|
15320
|
+
.digest('hex')
|
|
15321
|
+
.substring(0, 8);
|
|
15286
15322
|
},
|
|
15287
|
-
name: () => emittedName.
|
|
15323
|
+
name: () => emittedName.substring(0, emittedName.length - extname(emittedName).length)
|
|
15288
15324
|
}), bundle);
|
|
15289
15325
|
}
|
|
15290
15326
|
function reserveFileNameInBundle(fileName, bundle, warn) {
|
|
@@ -15333,7 +15369,7 @@ class FileEmitter {
|
|
|
15333
15369
|
this.facadeChunkByModule = null;
|
|
15334
15370
|
this.outputOptions = null;
|
|
15335
15371
|
this.assertAssetsFinalized = () => {
|
|
15336
|
-
for (const [referenceId, emittedFile] of this.filesByReferenceId
|
|
15372
|
+
for (const [referenceId, emittedFile] of this.filesByReferenceId) {
|
|
15337
15373
|
if (emittedFile.type === 'asset' && typeof emittedFile.fileName !== 'string')
|
|
15338
15374
|
return error(errNoAssetSourceSet(emittedFile.name || referenceId));
|
|
15339
15375
|
}
|
|
@@ -15348,9 +15384,7 @@ class FileEmitter {
|
|
|
15348
15384
|
if (emittedFile.type === 'chunk') {
|
|
15349
15385
|
return this.emitChunk(emittedFile);
|
|
15350
15386
|
}
|
|
15351
|
-
|
|
15352
|
-
return this.emitAsset(emittedFile);
|
|
15353
|
-
}
|
|
15387
|
+
return this.emitAsset(emittedFile);
|
|
15354
15388
|
};
|
|
15355
15389
|
this.getFileName = (fileReferenceId) => {
|
|
15356
15390
|
const emittedFile = this.filesByReferenceId.get(fileReferenceId);
|
|
@@ -15359,9 +15393,7 @@ class FileEmitter {
|
|
|
15359
15393
|
if (emittedFile.type === 'chunk') {
|
|
15360
15394
|
return getChunkFileName(emittedFile, this.facadeChunkByModule);
|
|
15361
15395
|
}
|
|
15362
|
-
|
|
15363
|
-
return getAssetFileName(emittedFile, fileReferenceId);
|
|
15364
|
-
}
|
|
15396
|
+
return getAssetFileName(emittedFile, fileReferenceId);
|
|
15365
15397
|
};
|
|
15366
15398
|
this.setAssetSource = (referenceId, requestedSource) => {
|
|
15367
15399
|
const consumedFile = this.filesByReferenceId.get(referenceId);
|
|
@@ -15390,7 +15422,7 @@ class FileEmitter {
|
|
|
15390
15422
|
reserveFileNameInBundle(emittedFile.fileName, this.bundle, this.options.onwarn);
|
|
15391
15423
|
}
|
|
15392
15424
|
}
|
|
15393
|
-
for (const [referenceId, consumedFile] of this.filesByReferenceId
|
|
15425
|
+
for (const [referenceId, consumedFile] of this.filesByReferenceId) {
|
|
15394
15426
|
if (consumedFile.type === 'asset' && consumedFile.source !== undefined) {
|
|
15395
15427
|
this.finalizeAsset(consumedFile, consumedFile.source, referenceId, this.bundle);
|
|
15396
15428
|
}
|
|
@@ -15403,14 +15435,10 @@ class FileEmitter {
|
|
|
15403
15435
|
assignReferenceId(file, idBase) {
|
|
15404
15436
|
let referenceId;
|
|
15405
15437
|
do {
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
else {
|
|
15411
|
-
hash.update(idBase);
|
|
15412
|
-
}
|
|
15413
|
-
referenceId = hash.digest('hex').substr(0, 8);
|
|
15438
|
+
referenceId = createHash()
|
|
15439
|
+
.update(referenceId || idBase)
|
|
15440
|
+
.digest('hex')
|
|
15441
|
+
.substring(0, 8);
|
|
15414
15442
|
} while (this.filesByReferenceId.has(referenceId));
|
|
15415
15443
|
this.filesByReferenceId.set(referenceId, file);
|
|
15416
15444
|
return referenceId;
|
|
@@ -15934,7 +15962,7 @@ class Bundle {
|
|
|
15934
15962
|
warnDeprecation('A plugin is directly adding properties to the bundle object in the "generateBundle" hook. This is deprecated and will be removed in a future Rollup version, please use "this.emitFile" instead.', true, this.inputOptions);
|
|
15935
15963
|
file.type = 'asset';
|
|
15936
15964
|
}
|
|
15937
|
-
if (this.outputOptions.validate &&
|
|
15965
|
+
if (this.outputOptions.validate && 'code' in file) {
|
|
15938
15966
|
try {
|
|
15939
15967
|
this.graph.contextParse(file.code, {
|
|
15940
15968
|
allowHashBang: true,
|
|
@@ -22151,9 +22179,7 @@ class ModuleLoader {
|
|
|
22151
22179
|
}
|
|
22152
22180
|
return Promise.resolve(externalModule);
|
|
22153
22181
|
}
|
|
22154
|
-
|
|
22155
|
-
return this.fetchModule(resolvedId, importer, false, false);
|
|
22156
|
-
}
|
|
22182
|
+
return this.fetchModule(resolvedId, importer, false, false);
|
|
22157
22183
|
}
|
|
22158
22184
|
async fetchStaticDependencies(module, resolveStaticDependencyPromises) {
|
|
22159
22185
|
for (const dependency of await Promise.all(resolveStaticDependencyPromises.map(resolveStaticDependencyPromise => resolveStaticDependencyPromise.then(([source, resolvedId]) => this.fetchResolvedDependency(source, module.id, resolvedId))))) {
|
|
@@ -22291,6 +22317,8 @@ class ModuleLoader {
|
|
|
22291
22317
|
: { id: resolveIdResult }), undefined, isEntry, false);
|
|
22292
22318
|
}
|
|
22293
22319
|
async resolveDynamicImport(module, specifier, importer) {
|
|
22320
|
+
var _a;
|
|
22321
|
+
var _b;
|
|
22294
22322
|
const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
|
|
22295
22323
|
specifier,
|
|
22296
22324
|
importer
|
|
@@ -22309,9 +22337,7 @@ class ModuleLoader {
|
|
|
22309
22337
|
};
|
|
22310
22338
|
}
|
|
22311
22339
|
if (resolution == null) {
|
|
22312
|
-
return (module.resolvedIds[specifier] =
|
|
22313
|
-
module.resolvedIds[specifier] ||
|
|
22314
|
-
this.handleResolveId(await this.resolveId(specifier, module.id, EMPTY_OBJECT, false), specifier, module.id));
|
|
22340
|
+
return ((_a = (_b = module.resolvedIds)[specifier]) !== null && _a !== void 0 ? _a : (_b[specifier] = this.handleResolveId(await this.resolveId(specifier, module.id, EMPTY_OBJECT, false), specifier, module.id)));
|
|
22315
22341
|
}
|
|
22316
22342
|
return this.handleResolveId(this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier)), specifier, importer);
|
|
22317
22343
|
}
|
|
@@ -22362,7 +22388,6 @@ class GlobalScope extends Scope$1 {
|
|
|
22362
22388
|
}
|
|
22363
22389
|
}
|
|
22364
22390
|
|
|
22365
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22366
22391
|
function getDeprecatedContextHandler(handler, handlerName, newHandlerName, pluginName, activeDeprecation, options) {
|
|
22367
22392
|
let deprecationWarningShown = false;
|
|
22368
22393
|
return ((...args) => {
|
|
@@ -22468,24 +22493,19 @@ function resolveAction(actionTuple) {
|
|
|
22468
22493
|
unfulfilledActions.delete(actionTuple);
|
|
22469
22494
|
}
|
|
22470
22495
|
function formatAction([pluginName, hookName, args]) {
|
|
22471
|
-
|
|
22496
|
+
const action = `(${pluginName}) ${hookName}`;
|
|
22472
22497
|
const s = JSON.stringify;
|
|
22473
22498
|
switch (hookName) {
|
|
22474
22499
|
case 'resolveId':
|
|
22475
|
-
action
|
|
22476
|
-
break;
|
|
22500
|
+
return `${action} ${s(args[0])} ${s(args[1])}`;
|
|
22477
22501
|
case 'load':
|
|
22478
|
-
action
|
|
22479
|
-
break;
|
|
22502
|
+
return `${action} ${s(args[0])}`;
|
|
22480
22503
|
case 'transform':
|
|
22481
|
-
action
|
|
22482
|
-
break;
|
|
22504
|
+
return `${action} ${s(args[1])}`;
|
|
22483
22505
|
case 'shouldTransformCachedModule':
|
|
22484
|
-
action
|
|
22485
|
-
break;
|
|
22506
|
+
return `${action} ${s(args[0].id)}`;
|
|
22486
22507
|
case 'moduleParsed':
|
|
22487
|
-
action
|
|
22488
|
-
break;
|
|
22508
|
+
return `${action} ${s(args[0].id)}`;
|
|
22489
22509
|
}
|
|
22490
22510
|
return action;
|
|
22491
22511
|
}
|
|
@@ -22994,13 +23014,15 @@ const generatedCodePresets = {
|
|
|
22994
23014
|
arrowFunctions: true,
|
|
22995
23015
|
constBindings: true,
|
|
22996
23016
|
objectShorthand: true,
|
|
22997
|
-
reservedNamesAsProps: true
|
|
23017
|
+
reservedNamesAsProps: true,
|
|
23018
|
+
symbols: true
|
|
22998
23019
|
},
|
|
22999
23020
|
es5: {
|
|
23000
23021
|
arrowFunctions: false,
|
|
23001
23022
|
constBindings: false,
|
|
23002
23023
|
objectShorthand: false,
|
|
23003
|
-
reservedNamesAsProps: true
|
|
23024
|
+
reservedNamesAsProps: true,
|
|
23025
|
+
symbols: false
|
|
23004
23026
|
}
|
|
23005
23027
|
};
|
|
23006
23028
|
const objectifyOption = (value) => value && typeof value === 'object' ? value : {};
|
|
@@ -23233,6 +23255,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23233
23255
|
const preserveModules = getPreserveModules(config, inlineDynamicImports, inputOptions);
|
|
23234
23256
|
const file = getFile(config, preserveModules, inputOptions);
|
|
23235
23257
|
const preferConst = getPreferConst(config, inputOptions);
|
|
23258
|
+
const generatedCode = getGeneratedCode(config, preferConst);
|
|
23236
23259
|
const outputOptions = {
|
|
23237
23260
|
amd: getAmd(config),
|
|
23238
23261
|
assetFileNames: (_a = config.assetFileNames) !== null && _a !== void 0 ? _a : 'assets/[name]-[hash][extname]',
|
|
@@ -23250,7 +23273,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23250
23273
|
footer: getAddon(config, 'footer'),
|
|
23251
23274
|
format,
|
|
23252
23275
|
freeze: (_e = config.freeze) !== null && _e !== void 0 ? _e : true,
|
|
23253
|
-
generatedCode
|
|
23276
|
+
generatedCode,
|
|
23254
23277
|
globals: config.globals || {},
|
|
23255
23278
|
hoistTransitiveImports: (_f = config.hoistTransitiveImports) !== null && _f !== void 0 ? _f : true,
|
|
23256
23279
|
indent: getIndent(config, compact),
|
|
@@ -23260,7 +23283,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23260
23283
|
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules, inputOptions),
|
|
23261
23284
|
minifyInternalExports: getMinifyInternalExports(config, format, compact),
|
|
23262
23285
|
name: config.name,
|
|
23263
|
-
namespaceToStringTag: config
|
|
23286
|
+
namespaceToStringTag: getNamespaceToStringTag(config, generatedCode, inputOptions),
|
|
23264
23287
|
noConflict: config.noConflict || false,
|
|
23265
23288
|
outro: getAddon(config, 'outro'),
|
|
23266
23289
|
paths: config.paths || {},
|
|
@@ -23430,7 +23453,8 @@ const getGeneratedCode = (config, preferConst) => {
|
|
|
23430
23453
|
arrowFunctions: configWithPreset.arrowFunctions === true,
|
|
23431
23454
|
constBindings: configWithPreset.constBindings === true || preferConst,
|
|
23432
23455
|
objectShorthand: configWithPreset.objectShorthand === true,
|
|
23433
|
-
reservedNamesAsProps: configWithPreset.reservedNamesAsProps === true
|
|
23456
|
+
reservedNamesAsProps: configWithPreset.reservedNamesAsProps === true,
|
|
23457
|
+
symbols: configWithPreset.symbols === true
|
|
23434
23458
|
};
|
|
23435
23459
|
};
|
|
23436
23460
|
const getIndent = (config, compact) => {
|
|
@@ -23455,7 +23479,7 @@ const getInterop = (config, inputOptions) => {
|
|
|
23455
23479
|
if (!validatedInteropTypes.has(interop)) {
|
|
23456
23480
|
validatedInteropTypes.add(interop);
|
|
23457
23481
|
if (!ALLOWED_INTEROP_TYPES.has(interop)) {
|
|
23458
|
-
return error(errInvalidOption('output.interop', 'outputinterop', `use one of ${Array.from(ALLOWED_INTEROP_TYPES
|
|
23482
|
+
return error(errInvalidOption('output.interop', 'outputinterop', `use one of ${Array.from(ALLOWED_INTEROP_TYPES, value => JSON.stringify(value)).join(', ')}`, interop));
|
|
23459
23483
|
}
|
|
23460
23484
|
if (typeof interop === 'boolean') {
|
|
23461
23485
|
warnDeprecation({
|
|
@@ -23490,6 +23514,14 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
|
|
|
23490
23514
|
return configManualChunks || {};
|
|
23491
23515
|
};
|
|
23492
23516
|
const getMinifyInternalExports = (config, format, compact) => { var _a; return (_a = config.minifyInternalExports) !== null && _a !== void 0 ? _a : (compact || format === 'es' || format === 'system'); };
|
|
23517
|
+
const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
|
|
23518
|
+
const configNamespaceToStringTag = config.namespaceToStringTag;
|
|
23519
|
+
if (configNamespaceToStringTag != null) {
|
|
23520
|
+
warnDeprecation(`The "output.namespaceToStringTag" option is deprecated. Use the "output.generatedCode.symbols" option instead.`, false, inputOptions);
|
|
23521
|
+
return configNamespaceToStringTag;
|
|
23522
|
+
}
|
|
23523
|
+
return generatedCode.symbols || false;
|
|
23524
|
+
};
|
|
23493
23525
|
|
|
23494
23526
|
function rollup(rawInputOptions) {
|
|
23495
23527
|
return rollupInternal(rawInputOptions, null);
|
|
@@ -23561,12 +23593,11 @@ function applyOptionHook(watchMode) {
|
|
|
23561
23593
|
};
|
|
23562
23594
|
}
|
|
23563
23595
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
23564
|
-
|
|
23565
|
-
const plugin = plugins[pluginIndex];
|
|
23596
|
+
plugins.forEach((plugin, index) => {
|
|
23566
23597
|
if (!plugin.name) {
|
|
23567
|
-
plugin.name = `${anonymousPrefix}${
|
|
23598
|
+
plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
23568
23599
|
}
|
|
23569
|
-
}
|
|
23600
|
+
});
|
|
23570
23601
|
}
|
|
23571
23602
|
async function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutputOptions, graph) {
|
|
23572
23603
|
const { options: outputOptions, outputPluginDriver, unsetOptions } = getOutputOptionsAndPluginDriver(rawOutputOptions, graph.pluginDriver, inputOptions, unsetInputOptions);
|
|
@@ -23685,11 +23716,11 @@ function getFsEvents() {
|
|
|
23685
23716
|
return fsEvents;
|
|
23686
23717
|
}
|
|
23687
23718
|
|
|
23688
|
-
const fseventsImporter = {
|
|
23719
|
+
const fseventsImporter = /*#__PURE__*/Object.defineProperty({
|
|
23689
23720
|
__proto__: null,
|
|
23690
23721
|
loadFsEvents,
|
|
23691
23722
|
getFsEvents
|
|
23692
|
-
};
|
|
23723
|
+
}, Symbol.toStringTag, { value: 'Module' });
|
|
23693
23724
|
|
|
23694
23725
|
class WatchEmitter extends EventEmitter {
|
|
23695
23726
|
constructor() {
|