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/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
@@ -18,7 +18,7 @@ const require$$0$1 = require('fs');
|
|
|
18
18
|
const require$$0$2 = require('events');
|
|
19
19
|
|
|
20
20
|
function _interopNamespaceDefault(e) {
|
|
21
|
-
const n = Object.create(null);
|
|
21
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
22
22
|
if (e) {
|
|
23
23
|
for (const k in e) {
|
|
24
24
|
n[k] = e[k];
|
|
@@ -28,7 +28,7 @@ function _interopNamespaceDefault(e) {
|
|
|
28
28
|
return n;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
var version$1 = "2.
|
|
31
|
+
var version$1 = "2.69.2";
|
|
32
32
|
|
|
33
33
|
function ensureArray$1(items) {
|
|
34
34
|
if (Array.isArray(items)) {
|
|
@@ -127,8 +127,30 @@ function printQuotedStringList(list, verbs) {
|
|
|
127
127
|
return output;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
const ANY_SLASH_REGEX = /[/\\]/;
|
|
131
|
+
function relative(from, to) {
|
|
132
|
+
const fromParts = from.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
133
|
+
const toParts = to.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
134
|
+
if (fromParts[0] === '.')
|
|
135
|
+
fromParts.shift();
|
|
136
|
+
if (toParts[0] === '.')
|
|
137
|
+
toParts.shift();
|
|
138
|
+
while (fromParts[0] && toParts[0] && fromParts[0] === toParts[0]) {
|
|
139
|
+
fromParts.shift();
|
|
140
|
+
toParts.shift();
|
|
141
|
+
}
|
|
142
|
+
while (toParts[0] === '..' && fromParts.length > 0) {
|
|
143
|
+
toParts.shift();
|
|
144
|
+
fromParts.pop();
|
|
145
|
+
}
|
|
146
|
+
while (fromParts.pop()) {
|
|
147
|
+
toParts.unshift('..');
|
|
148
|
+
}
|
|
149
|
+
return toParts.join('/');
|
|
150
|
+
}
|
|
151
|
+
|
|
130
152
|
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[\\|/])/;
|
|
131
|
-
const RELATIVE_PATH_REGEX =
|
|
153
|
+
const RELATIVE_PATH_REGEX = /^\.?\.(\/|$)/;
|
|
132
154
|
function isAbsolute(path) {
|
|
133
155
|
return ABSOLUTE_PATH_REGEX.test(path);
|
|
134
156
|
}
|
|
@@ -142,17 +164,35 @@ function normalize(path) {
|
|
|
142
164
|
|
|
143
165
|
function getAliasName(id) {
|
|
144
166
|
const base = require$$0.basename(id);
|
|
145
|
-
return base.
|
|
167
|
+
return base.substring(0, base.length - require$$0.extname(id).length);
|
|
146
168
|
}
|
|
147
169
|
function relativeId(id) {
|
|
148
170
|
if (!isAbsolute(id))
|
|
149
171
|
return id;
|
|
150
|
-
return
|
|
172
|
+
return relative(require$$0.resolve(), id);
|
|
151
173
|
}
|
|
152
174
|
function isPathFragment(name) {
|
|
153
175
|
// starting with "/", "./", "../", "C:/"
|
|
154
176
|
return (name[0] === '/' || (name[0] === '.' && (name[1] === '/' || name[1] === '.')) || isAbsolute(name));
|
|
155
177
|
}
|
|
178
|
+
const UPPER_DIR_REGEX = /^(\.\.\/)*\.\.$/;
|
|
179
|
+
function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName) {
|
|
180
|
+
let relativePath = normalize(relative(require$$0.dirname(importerId), targetPath));
|
|
181
|
+
if (stripJsExtension && relativePath.endsWith('.js')) {
|
|
182
|
+
relativePath = relativePath.slice(0, -3);
|
|
183
|
+
}
|
|
184
|
+
if (ensureFileName) {
|
|
185
|
+
if (relativePath === '')
|
|
186
|
+
return '../' + require$$0.basename(targetPath);
|
|
187
|
+
if (UPPER_DIR_REGEX.test(relativePath)) {
|
|
188
|
+
return relativePath
|
|
189
|
+
.split('/')
|
|
190
|
+
.concat(['..', require$$0.basename(targetPath)])
|
|
191
|
+
.join('/');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return !relativePath ? '.' : relativePath.startsWith('..') ? relativePath : './' + relativePath;
|
|
195
|
+
}
|
|
156
196
|
|
|
157
197
|
function error(base) {
|
|
158
198
|
if (!(base instanceof Error))
|
|
@@ -546,13 +586,15 @@ const generatedCodePresets = {
|
|
|
546
586
|
arrowFunctions: true,
|
|
547
587
|
constBindings: true,
|
|
548
588
|
objectShorthand: true,
|
|
549
|
-
reservedNamesAsProps: true
|
|
589
|
+
reservedNamesAsProps: true,
|
|
590
|
+
symbols: true
|
|
550
591
|
},
|
|
551
592
|
es5: {
|
|
552
593
|
arrowFunctions: false,
|
|
553
594
|
constBindings: false,
|
|
554
595
|
objectShorthand: false,
|
|
555
|
-
reservedNamesAsProps: true
|
|
596
|
+
reservedNamesAsProps: true,
|
|
597
|
+
symbols: false
|
|
556
598
|
}
|
|
557
599
|
};
|
|
558
600
|
const objectifyOption = (value) => value && typeof value === 'object' ? value : {};
|
|
@@ -599,11 +641,11 @@ function getFsEvents() {
|
|
|
599
641
|
return fsEvents;
|
|
600
642
|
}
|
|
601
643
|
|
|
602
|
-
const fseventsImporter = {
|
|
644
|
+
const fseventsImporter = /*#__PURE__*/Object.defineProperty({
|
|
603
645
|
__proto__: null,
|
|
604
646
|
loadFsEvents,
|
|
605
647
|
getFsEvents
|
|
606
|
-
};
|
|
648
|
+
}, Symbol.toStringTag, { value: 'Module' });
|
|
607
649
|
|
|
608
650
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
609
651
|
|
|
@@ -2049,28 +2091,6 @@ Bundle$1.prototype.trimEnd = function trimEnd (charType) {
|
|
|
2049
2091
|
|
|
2050
2092
|
const MagicString$1 = MagicString;
|
|
2051
2093
|
|
|
2052
|
-
const ANY_SLASH_REGEX = /[/\\]/;
|
|
2053
|
-
function relative(from, to) {
|
|
2054
|
-
const fromParts = from.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
2055
|
-
const toParts = to.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
2056
|
-
if (fromParts[0] === '.')
|
|
2057
|
-
fromParts.shift();
|
|
2058
|
-
if (toParts[0] === '.')
|
|
2059
|
-
toParts.shift();
|
|
2060
|
-
while (fromParts[0] && toParts[0] && fromParts[0] === toParts[0]) {
|
|
2061
|
-
fromParts.shift();
|
|
2062
|
-
toParts.shift();
|
|
2063
|
-
}
|
|
2064
|
-
while (toParts[0] === '..' && fromParts.length > 0) {
|
|
2065
|
-
toParts.shift();
|
|
2066
|
-
fromParts.pop();
|
|
2067
|
-
}
|
|
2068
|
-
while (fromParts.pop()) {
|
|
2069
|
-
toParts.unshift('..');
|
|
2070
|
-
}
|
|
2071
|
-
return toParts.join('/');
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
2094
|
function getOrCreate(map, key, init) {
|
|
2075
2095
|
const existing = map.get(key);
|
|
2076
2096
|
if (existing) {
|
|
@@ -2391,7 +2411,6 @@ class ExternalModule {
|
|
|
2391
2411
|
? normalize(require$$0.relative(inputBase, this.id))
|
|
2392
2412
|
: this.id;
|
|
2393
2413
|
}
|
|
2394
|
-
return this.renderPath;
|
|
2395
2414
|
}
|
|
2396
2415
|
suggestName(name) {
|
|
2397
2416
|
var _a;
|
|
@@ -4793,9 +4812,8 @@ function getLiteralMembersForValue(value) {
|
|
|
4793
4812
|
return literalNumberMembers;
|
|
4794
4813
|
case 'string':
|
|
4795
4814
|
return literalStringMembers;
|
|
4796
|
-
default:
|
|
4797
|
-
return Object.create(null);
|
|
4798
4815
|
}
|
|
4816
|
+
return Object.create(null);
|
|
4799
4817
|
}
|
|
4800
4818
|
function hasMemberEffectWhenCalled(members, memberName, callOptions, context) {
|
|
4801
4819
|
if (typeof memberName !== 'string' || !members[memberName]) {
|
|
@@ -5886,6 +5904,30 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
5886
5904
|
}
|
|
5887
5905
|
}
|
|
5888
5906
|
|
|
5907
|
+
const isInteger = (prop) => typeof prop === 'string' && /^\d+$/.test(prop);
|
|
5908
|
+
// This makes sure unknown properties are not handled as "undefined" but as
|
|
5909
|
+
// "unknown" but without access side effects. An exception is done for numeric
|
|
5910
|
+
// properties as we do not expect new builtin properties to be numbers, this
|
|
5911
|
+
// will improve tree-shaking for out-of-bounds array properties
|
|
5912
|
+
const OBJECT_PROTOTYPE_FALLBACK = new (class ObjectPrototypeFallbackExpression extends ExpressionEntity {
|
|
5913
|
+
deoptimizeThisOnEventAtPath(event, path, thisParameter) {
|
|
5914
|
+
if (event === EVENT_CALLED && path.length === 1 && !isInteger(path[0])) {
|
|
5915
|
+
thisParameter.deoptimizePath(UNKNOWN_PATH);
|
|
5916
|
+
}
|
|
5917
|
+
}
|
|
5918
|
+
getLiteralValueAtPath(path) {
|
|
5919
|
+
// We ignore number properties as we do not expect new properties to be
|
|
5920
|
+
// numbers and also want to keep handling out-of-bound array elements as
|
|
5921
|
+
// "undefined"
|
|
5922
|
+
return path.length === 1 && isInteger(path[0]) ? undefined : UnknownValue;
|
|
5923
|
+
}
|
|
5924
|
+
hasEffectsWhenAccessedAtPath(path) {
|
|
5925
|
+
return path.length > 1;
|
|
5926
|
+
}
|
|
5927
|
+
hasEffectsWhenAssignedAtPath(path) {
|
|
5928
|
+
return path.length > 1;
|
|
5929
|
+
}
|
|
5930
|
+
})();
|
|
5889
5931
|
const OBJECT_PROTOTYPE = new ObjectEntity({
|
|
5890
5932
|
__proto__: null,
|
|
5891
5933
|
hasOwnProperty: METHOD_RETURNS_BOOLEAN,
|
|
@@ -5894,7 +5936,7 @@ const OBJECT_PROTOTYPE = new ObjectEntity({
|
|
|
5894
5936
|
toLocaleString: METHOD_RETURNS_STRING,
|
|
5895
5937
|
toString: METHOD_RETURNS_STRING,
|
|
5896
5938
|
valueOf: METHOD_RETURNS_UNKNOWN
|
|
5897
|
-
},
|
|
5939
|
+
}, OBJECT_PROTOTYPE_FALLBACK, true);
|
|
5898
5940
|
|
|
5899
5941
|
const NEW_ARRAY_PROPERTIES = [
|
|
5900
5942
|
{ key: UnknownInteger, kind: 'init', property: UNKNOWN_EXPRESSION },
|
|
@@ -6962,6 +7004,8 @@ const knownGlobals = {
|
|
|
6962
7004
|
isFrozen: PF,
|
|
6963
7005
|
isSealed: PF,
|
|
6964
7006
|
keys: PF,
|
|
7007
|
+
fromEntries: PF,
|
|
7008
|
+
entries: PF,
|
|
6965
7009
|
prototype: O
|
|
6966
7010
|
},
|
|
6967
7011
|
parseFloat: PF,
|
|
@@ -10131,19 +10175,17 @@ const HELPER_GENERATORS = {
|
|
|
10131
10175
|
return (`${left}e${_}&&${_}e.__esModule${_}?${_}` +
|
|
10132
10176
|
`${liveBindings ? getDefaultLiveBinding(snippets) : getDefaultStatic(snippets)}${right}${n}${n}`);
|
|
10133
10177
|
},
|
|
10134
|
-
[INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE](_t,
|
|
10178
|
+
[INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE](_t, snippets, _liveBindings, freeze, namespaceToStringTag) {
|
|
10179
|
+
const { getDirectReturnFunction, getObject, n } = snippets;
|
|
10135
10180
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
10136
10181
|
functionReturn: true,
|
|
10137
10182
|
lineBreakIndent: null,
|
|
10138
10183
|
name: INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE
|
|
10139
10184
|
});
|
|
10140
|
-
return `${left}${getFrozen(getObject([
|
|
10185
|
+
return `${left}${getFrozen(freeze, getWithToStringTag(namespaceToStringTag, getObject([
|
|
10141
10186
|
['__proto__', 'null'],
|
|
10142
|
-
...(namespaceToStringTag
|
|
10143
|
-
? [[null, `[Symbol.toStringTag]:${_}'Module'`]]
|
|
10144
|
-
: []),
|
|
10145
10187
|
['default', 'e']
|
|
10146
|
-
], { lineBreakIndent: null }),
|
|
10188
|
+
], { lineBreakIndent: null }), snippets))}${right}${n}${n}`;
|
|
10147
10189
|
},
|
|
10148
10190
|
[INTEROP_NAMESPACE_DEFAULT_VARIABLE](t, snippets, liveBindings, freeze, namespaceToStringTag) {
|
|
10149
10191
|
const { _, n } = snippets;
|
|
@@ -10166,7 +10208,7 @@ const HELPER_GENERATORS = {
|
|
|
10166
10208
|
createNamespaceObject(t, t, snippets, liveBindings, freeze, namespaceToStringTag) +
|
|
10167
10209
|
`}${n}${n}`);
|
|
10168
10210
|
},
|
|
10169
|
-
[MERGE_NAMESPACES_VARIABLE](t, snippets, liveBindings, freeze) {
|
|
10211
|
+
[MERGE_NAMESPACES_VARIABLE](t, snippets, liveBindings, freeze, namespaceToStringTag) {
|
|
10170
10212
|
const { _, cnst, n } = snippets;
|
|
10171
10213
|
const useForEach = cnst === 'var' && liveBindings;
|
|
10172
10214
|
return (`function ${MERGE_NAMESPACES_VARIABLE}(n, m)${_}{${n}` +
|
|
@@ -10179,25 +10221,25 @@ const HELPER_GENERATORS = {
|
|
|
10179
10221
|
: copyPropertyStatic)(t, t + t + t + t, snippets) +
|
|
10180
10222
|
`${t}${t}${t}}${n}` +
|
|
10181
10223
|
`${t}${t}}`, useForEach, t, snippets)}${n}` +
|
|
10182
|
-
`${t}return ${getFrozen('n',
|
|
10224
|
+
`${t}return ${getFrozen(freeze, getWithToStringTag(namespaceToStringTag, 'n', snippets))};${n}` +
|
|
10183
10225
|
`}${n}${n}`);
|
|
10184
10226
|
}
|
|
10185
10227
|
};
|
|
10186
10228
|
const getDefaultLiveBinding = ({ _, getObject }) => `e${_}:${_}${getObject([['default', 'e']], { lineBreakIndent: null })}`;
|
|
10187
10229
|
const getDefaultStatic = ({ _, getPropertyAccess }) => `e${getPropertyAccess('default')}${_}:${_}e`;
|
|
10188
10230
|
const createNamespaceObject = (t, i, snippets, liveBindings, freeze, namespaceToStringTag) => {
|
|
10189
|
-
const { _, cnst, getPropertyAccess, n, s } = snippets;
|
|
10231
|
+
const { _, cnst, getObject, getPropertyAccess, n, s } = snippets;
|
|
10190
10232
|
const copyProperty = `{${n}` +
|
|
10191
10233
|
(liveBindings ? copyNonDefaultOwnPropertyLiveBinding : copyPropertyStatic)(t, i + t + t, snippets) +
|
|
10192
10234
|
`${i}${t}}`;
|
|
10193
|
-
return (`${i}${cnst} n${_}=${_}${namespaceToStringTag
|
|
10194
|
-
?
|
|
10195
|
-
: '
|
|
10235
|
+
return (`${i}${cnst} n${_}=${_}Object.create(null${namespaceToStringTag
|
|
10236
|
+
? `,${_}{${_}[Symbol.toStringTag]:${_}${getToStringTagValue(getObject)}${_}}`
|
|
10237
|
+
: ''});${n}` +
|
|
10196
10238
|
`${i}if${_}(e)${_}{${n}` +
|
|
10197
10239
|
`${i}${t}${loopOverKeys(copyProperty, !liveBindings, snippets)}${n}` +
|
|
10198
10240
|
`${i}}${n}` +
|
|
10199
10241
|
`${i}n${getPropertyAccess('default')}${_}=${_}e;${n}` +
|
|
10200
|
-
`${i}return ${getFrozen('n'
|
|
10242
|
+
`${i}return ${getFrozen(freeze, 'n')}${s}${n}`);
|
|
10201
10243
|
};
|
|
10202
10244
|
const loopOverKeys = (body, allowVarLoopVariable, { _, cnst, getFunctionIntro, s }) => cnst !== 'var' || allowVarLoopVariable
|
|
10203
10245
|
? `for${_}(${cnst} k in e)${_}${body}`
|
|
@@ -10255,8 +10297,16 @@ const copyPropertyLiveBinding = (t, i, { _, cnst, getDirectReturnFunction, n })
|
|
|
10255
10297
|
`${i}}${n}`);
|
|
10256
10298
|
};
|
|
10257
10299
|
const copyPropertyStatic = (_t, i, { _, n }) => `${i}n[k]${_}=${_}e[k];${n}`;
|
|
10258
|
-
const getFrozen = (
|
|
10300
|
+
const getFrozen = (freeze, fragment) => freeze ? `Object.freeze(${fragment})` : fragment;
|
|
10301
|
+
const getWithToStringTag = (namespaceToStringTag, fragment, { _, getObject }) => namespaceToStringTag
|
|
10302
|
+
? `Object.defineProperty(${fragment},${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)})`
|
|
10303
|
+
: fragment;
|
|
10259
10304
|
const HELPER_NAMES = Object.keys(HELPER_GENERATORS);
|
|
10305
|
+
function getToStringTagValue(getObject) {
|
|
10306
|
+
return getObject([['value', "'Module'"]], {
|
|
10307
|
+
lineBreakIndent: null
|
|
10308
|
+
});
|
|
10309
|
+
}
|
|
10260
10310
|
|
|
10261
10311
|
class ImportExpression extends NodeBase {
|
|
10262
10312
|
constructor() {
|
|
@@ -10633,7 +10683,7 @@ class MetaProperty extends NodeBase {
|
|
|
10633
10683
|
getReferencedFileName(outputPluginDriver) {
|
|
10634
10684
|
const metaProperty = this.metaProperty;
|
|
10635
10685
|
if (metaProperty && metaProperty.startsWith(FILE_PREFIX)) {
|
|
10636
|
-
return outputPluginDriver.getFileName(metaProperty.
|
|
10686
|
+
return outputPluginDriver.getFileName(metaProperty.substring(FILE_PREFIX.length));
|
|
10637
10687
|
}
|
|
10638
10688
|
return null;
|
|
10639
10689
|
}
|
|
@@ -10669,17 +10719,17 @@ class MetaProperty extends NodeBase {
|
|
|
10669
10719
|
let chunkReferenceId = null;
|
|
10670
10720
|
let fileName;
|
|
10671
10721
|
if (metaProperty.startsWith(FILE_PREFIX)) {
|
|
10672
|
-
referenceId = metaProperty.
|
|
10722
|
+
referenceId = metaProperty.substring(FILE_PREFIX.length);
|
|
10673
10723
|
fileName = outputPluginDriver.getFileName(referenceId);
|
|
10674
10724
|
}
|
|
10675
10725
|
else if (metaProperty.startsWith(ASSET_PREFIX)) {
|
|
10676
10726
|
warnDeprecation(`Using the "${ASSET_PREFIX}" prefix to reference files is deprecated. Use the "${FILE_PREFIX}" prefix instead.`, true, this.context.options);
|
|
10677
|
-
assetReferenceId = metaProperty.
|
|
10727
|
+
assetReferenceId = metaProperty.substring(ASSET_PREFIX.length);
|
|
10678
10728
|
fileName = outputPluginDriver.getFileName(assetReferenceId);
|
|
10679
10729
|
}
|
|
10680
10730
|
else {
|
|
10681
10731
|
warnDeprecation(`Using the "${CHUNK_PREFIX}" prefix to reference files is deprecated. Use the "${FILE_PREFIX}" prefix instead.`, true, this.context.options);
|
|
10682
|
-
chunkReferenceId = metaProperty.
|
|
10732
|
+
chunkReferenceId = metaProperty.substring(CHUNK_PREFIX.length);
|
|
10683
10733
|
fileName = outputPluginDriver.getFileName(chunkReferenceId);
|
|
10684
10734
|
}
|
|
10685
10735
|
const relativePath = normalize(require$$0.relative(require$$0.dirname(chunkId), fileName));
|
|
@@ -12035,17 +12085,20 @@ class NamespaceVariable extends Variable {
|
|
|
12035
12085
|
}
|
|
12036
12086
|
return [name, original.getName(getPropertyAccess)];
|
|
12037
12087
|
});
|
|
12038
|
-
if (namespaceToStringTag) {
|
|
12039
|
-
members.unshift([null, `[Symbol.toStringTag]:${_}'Module'`]);
|
|
12040
|
-
}
|
|
12041
12088
|
members.unshift([null, `__proto__:${_}null`]);
|
|
12042
12089
|
let output = getObject(members, { lineBreakIndent: { base: '', t } });
|
|
12043
12090
|
if (this.mergedNamespaces.length > 0) {
|
|
12044
12091
|
const assignmentArgs = this.mergedNamespaces.map(variable => variable.getName(getPropertyAccess));
|
|
12045
|
-
output = `/*#__PURE__*/${MERGE_NAMESPACES_VARIABLE}(${output}
|
|
12092
|
+
output = `/*#__PURE__*/${MERGE_NAMESPACES_VARIABLE}(${output},${_}[${assignmentArgs.join(`,${_}`)}])`;
|
|
12046
12093
|
}
|
|
12047
|
-
|
|
12048
|
-
|
|
12094
|
+
else {
|
|
12095
|
+
// The helper to merge namespaces will also take care of freezing and toStringTag
|
|
12096
|
+
if (namespaceToStringTag) {
|
|
12097
|
+
output = `/*#__PURE__*/Object.defineProperty(${output},${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)})`;
|
|
12098
|
+
}
|
|
12099
|
+
if (freeze) {
|
|
12100
|
+
output = `/*#__PURE__*/Object.freeze(${output})`;
|
|
12101
|
+
}
|
|
12049
12102
|
}
|
|
12050
12103
|
const name = this.getName(getPropertyAccess);
|
|
12051
12104
|
output = `${cnst} ${name}${_}=${_}${output};`;
|
|
@@ -12124,29 +12177,23 @@ function getId(m) {
|
|
|
12124
12177
|
|
|
12125
12178
|
function getOriginalLocation(sourcemapChain, location) {
|
|
12126
12179
|
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
|
|
12127
|
-
while (filteredSourcemapChain.length > 0) {
|
|
12180
|
+
traceSourcemap: while (filteredSourcemapChain.length > 0) {
|
|
12128
12181
|
const sourcemap = filteredSourcemapChain.pop();
|
|
12129
12182
|
const line = sourcemap.mappings[location.line - 1];
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
break;
|
|
12183
|
+
if (line) {
|
|
12184
|
+
const filteredLine = line.filter((segment) => segment.length > 1);
|
|
12185
|
+
const lastSegment = filteredLine[filteredLine.length - 1];
|
|
12186
|
+
for (const segment of filteredLine) {
|
|
12187
|
+
if (segment[0] >= location.column || segment === lastSegment) {
|
|
12136
12188
|
location = {
|
|
12137
12189
|
column: segment[3],
|
|
12138
|
-
line: segment[2] + 1
|
|
12139
|
-
name: segment.length === 5 ? sourcemap.names[segment[4]] : undefined,
|
|
12140
|
-
source: sourcemap.sources[segment[1]]
|
|
12190
|
+
line: segment[2] + 1
|
|
12141
12191
|
};
|
|
12142
|
-
|
|
12143
|
-
break;
|
|
12192
|
+
continue traceSourcemap;
|
|
12144
12193
|
}
|
|
12145
12194
|
}
|
|
12146
12195
|
}
|
|
12147
|
-
|
|
12148
|
-
throw new Error("Can't resolve original location of error.");
|
|
12149
|
-
}
|
|
12196
|
+
throw new Error("Can't resolve original location of error.");
|
|
12150
12197
|
}
|
|
12151
12198
|
return location;
|
|
12152
12199
|
}
|
|
@@ -12355,7 +12402,7 @@ class Module {
|
|
|
12355
12402
|
this.preserveSignature = this.options.preserveEntrySignatures;
|
|
12356
12403
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
12357
12404
|
const module = this;
|
|
12358
|
-
const { dynamicImports, dynamicImporters,
|
|
12405
|
+
const { dynamicImports, dynamicImporters, implicitlyLoadedAfter, implicitlyLoadedBefore, importers, reexportDescriptions, sources } = this;
|
|
12359
12406
|
this.info = {
|
|
12360
12407
|
ast: null,
|
|
12361
12408
|
code: null,
|
|
@@ -12367,13 +12414,7 @@ class Module {
|
|
|
12367
12414
|
get dynamicallyImportedIds() {
|
|
12368
12415
|
// We cannot use this.dynamicDependencies because this is needed before
|
|
12369
12416
|
// dynamicDependencies are populated
|
|
12370
|
-
|
|
12371
|
-
for (const { id } of dynamicImports) {
|
|
12372
|
-
if (id) {
|
|
12373
|
-
dynamicallyImportedIds.push(id);
|
|
12374
|
-
}
|
|
12375
|
-
}
|
|
12376
|
-
return dynamicallyImportedIds;
|
|
12417
|
+
return dynamicImports.map(({ id }) => id).filter((id) => id != null);
|
|
12377
12418
|
},
|
|
12378
12419
|
get dynamicImporters() {
|
|
12379
12420
|
return dynamicImporters.sort();
|
|
@@ -12387,7 +12428,7 @@ class Module {
|
|
|
12387
12428
|
},
|
|
12388
12429
|
get hasModuleSideEffects() {
|
|
12389
12430
|
warnDeprecation('Accessing ModuleInfo.hasModuleSideEffects from plugins is deprecated. Please use ModuleInfo.moduleSideEffects instead.', false, options);
|
|
12390
|
-
return
|
|
12431
|
+
return this.moduleSideEffects;
|
|
12391
12432
|
},
|
|
12392
12433
|
id,
|
|
12393
12434
|
get implicitlyLoadedAfterOneOf() {
|
|
@@ -13222,26 +13263,29 @@ function getReexportedImportName(moduleVariableName, imported, depNamedExportsMo
|
|
|
13222
13263
|
}
|
|
13223
13264
|
return `${moduleVariableName}${getPropertyAccess(imported)}`;
|
|
13224
13265
|
}
|
|
13225
|
-
function
|
|
13226
|
-
return
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
return `exports[Symbol.toStringTag]${_}=${_}'Module';`;
|
|
13266
|
+
function getEsModuleValue(getObject) {
|
|
13267
|
+
return getObject([['value', 'true']], {
|
|
13268
|
+
lineBreakIndent: null
|
|
13269
|
+
});
|
|
13230
13270
|
}
|
|
13231
|
-
function getNamespaceMarkers(hasNamedExports, addEsModule, addNamespaceToStringTag, _,
|
|
13232
|
-
let namespaceMarkers = '';
|
|
13271
|
+
function getNamespaceMarkers(hasNamedExports, addEsModule, addNamespaceToStringTag, { _, getObject }) {
|
|
13233
13272
|
if (hasNamedExports) {
|
|
13234
13273
|
if (addEsModule) {
|
|
13235
|
-
|
|
13274
|
+
if (addNamespaceToStringTag) {
|
|
13275
|
+
return `Object.defineProperties(exports,${_}${getObject([
|
|
13276
|
+
['__esModule', getEsModuleValue(getObject)],
|
|
13277
|
+
[null, `[Symbol.toStringTag]:${_}${getToStringTagValue(getObject)}`]
|
|
13278
|
+
], {
|
|
13279
|
+
lineBreakIndent: null
|
|
13280
|
+
})});`;
|
|
13281
|
+
}
|
|
13282
|
+
return `Object.defineProperty(exports,${_}'__esModule',${_}${getEsModuleValue(getObject)});`;
|
|
13236
13283
|
}
|
|
13237
13284
|
if (addNamespaceToStringTag) {
|
|
13238
|
-
|
|
13239
|
-
namespaceMarkers += n;
|
|
13240
|
-
}
|
|
13241
|
-
namespaceMarkers += getNamespaceToStringExport(_);
|
|
13285
|
+
return `Object.defineProperty(exports,${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)});`;
|
|
13242
13286
|
}
|
|
13243
13287
|
}
|
|
13244
|
-
return
|
|
13288
|
+
return '';
|
|
13245
13289
|
}
|
|
13246
13290
|
const getDefineProperty = (name, needsLiveBinding, t, { _, getDirectReturnFunction, n }) => {
|
|
13247
13291
|
if (needsLiveBinding) {
|
|
@@ -13378,7 +13422,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13378
13422
|
const useStrict = strict ? `${_}'use strict';` : '';
|
|
13379
13423
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, t, snippets)}`);
|
|
13380
13424
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
13381
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag,
|
|
13425
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, snippets);
|
|
13382
13426
|
if (namespaceMarkers) {
|
|
13383
13427
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
13384
13428
|
}
|
|
@@ -13397,7 +13441,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13397
13441
|
function cjs(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
|
|
13398
13442
|
const { _, n } = snippets;
|
|
13399
13443
|
const useStrict = strict ? `'use strict';${n}${n}` : '';
|
|
13400
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag,
|
|
13444
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, snippets);
|
|
13401
13445
|
if (namespaceMarkers) {
|
|
13402
13446
|
namespaceMarkers += n + n;
|
|
13403
13447
|
}
|
|
@@ -13641,7 +13685,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13641
13685
|
wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
|
|
13642
13686
|
}
|
|
13643
13687
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
13644
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag,
|
|
13688
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, snippets);
|
|
13645
13689
|
if (namespaceMarkers) {
|
|
13646
13690
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
13647
13691
|
}
|
|
@@ -13875,7 +13919,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13875
13919
|
const wrapperOutro = n + n + '}));';
|
|
13876
13920
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, t, snippets)}`);
|
|
13877
13921
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
13878
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag,
|
|
13922
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, snippets);
|
|
13879
13923
|
if (namespaceMarkers) {
|
|
13880
13924
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
13881
13925
|
}
|
|
@@ -13903,6 +13947,7 @@ class Link {
|
|
|
13903
13947
|
}
|
|
13904
13948
|
traceMappings() {
|
|
13905
13949
|
const sources = [];
|
|
13950
|
+
const sourceIndexMap = new Map();
|
|
13906
13951
|
const sourcesContent = [];
|
|
13907
13952
|
const names = [];
|
|
13908
13953
|
const nameIndexMap = new Map();
|
|
@@ -13910,41 +13955,36 @@ class Link {
|
|
|
13910
13955
|
for (const line of this.mappings) {
|
|
13911
13956
|
const tracedLine = [];
|
|
13912
13957
|
for (const segment of line) {
|
|
13913
|
-
if (segment.length
|
|
13958
|
+
if (segment.length === 1)
|
|
13914
13959
|
continue;
|
|
13915
13960
|
const source = this.sources[segment[1]];
|
|
13916
13961
|
if (!source)
|
|
13917
13962
|
continue;
|
|
13918
13963
|
const traced = source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : '');
|
|
13919
13964
|
if (traced) {
|
|
13920
|
-
|
|
13921
|
-
let sourceIndex =
|
|
13922
|
-
if (sourceIndex ===
|
|
13965
|
+
const { column, line, name, source: { content, filename } } = traced;
|
|
13966
|
+
let sourceIndex = sourceIndexMap.get(filename);
|
|
13967
|
+
if (sourceIndex === undefined) {
|
|
13923
13968
|
sourceIndex = sources.length;
|
|
13924
|
-
sources.push(
|
|
13925
|
-
|
|
13969
|
+
sources.push(filename);
|
|
13970
|
+
sourceIndexMap.set(filename, sourceIndex);
|
|
13971
|
+
sourcesContent[sourceIndex] = content;
|
|
13926
13972
|
}
|
|
13927
13973
|
else if (sourcesContent[sourceIndex] == null) {
|
|
13928
|
-
sourcesContent[sourceIndex] =
|
|
13974
|
+
sourcesContent[sourceIndex] = content;
|
|
13929
13975
|
}
|
|
13930
|
-
else if (
|
|
13931
|
-
sourcesContent[sourceIndex] !== traced.source.content) {
|
|
13976
|
+
else if (content != null && sourcesContent[sourceIndex] !== content) {
|
|
13932
13977
|
return error({
|
|
13933
|
-
message: `Multiple conflicting contents for sourcemap source ${
|
|
13978
|
+
message: `Multiple conflicting contents for sourcemap source ${filename}`
|
|
13934
13979
|
});
|
|
13935
13980
|
}
|
|
13936
|
-
const tracedSegment = [
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
traced.line,
|
|
13940
|
-
traced.column
|
|
13941
|
-
];
|
|
13942
|
-
if (traced.name) {
|
|
13943
|
-
let nameIndex = nameIndexMap.get(traced.name);
|
|
13981
|
+
const tracedSegment = [segment[0], sourceIndex, line, column];
|
|
13982
|
+
if (name) {
|
|
13983
|
+
let nameIndex = nameIndexMap.get(name);
|
|
13944
13984
|
if (nameIndex === undefined) {
|
|
13945
13985
|
nameIndex = names.length;
|
|
13946
|
-
names.push(
|
|
13947
|
-
nameIndexMap.set(
|
|
13986
|
+
names.push(name);
|
|
13987
|
+
nameIndexMap.set(name, nameIndex);
|
|
13948
13988
|
}
|
|
13949
13989
|
tracedSegment[4] = nameIndex;
|
|
13950
13990
|
}
|
|
@@ -13960,12 +14000,15 @@ class Link {
|
|
|
13960
14000
|
if (!segments)
|
|
13961
14001
|
return null;
|
|
13962
14002
|
// binary search through segments for the given column
|
|
13963
|
-
let
|
|
13964
|
-
let
|
|
13965
|
-
while (
|
|
13966
|
-
const m = (
|
|
14003
|
+
let searchStart = 0;
|
|
14004
|
+
let searchEnd = segments.length - 1;
|
|
14005
|
+
while (searchStart <= searchEnd) {
|
|
14006
|
+
const m = (searchStart + searchEnd) >> 1;
|
|
13967
14007
|
const segment = segments[m];
|
|
13968
|
-
|
|
14008
|
+
// If a sourcemap does not have sufficient resolution to contain a
|
|
14009
|
+
// necessary mapping, e.g. because it only contains line information, we
|
|
14010
|
+
// use the best approximation we could find
|
|
14011
|
+
if (segment[0] === column || searchStart === searchEnd) {
|
|
13969
14012
|
if (segment.length == 1)
|
|
13970
14013
|
return null;
|
|
13971
14014
|
const source = this.sources[segment[1]];
|
|
@@ -13974,10 +14017,10 @@ class Link {
|
|
|
13974
14017
|
return source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : name);
|
|
13975
14018
|
}
|
|
13976
14019
|
if (segment[0] > column) {
|
|
13977
|
-
|
|
14020
|
+
searchEnd = m - 1;
|
|
13978
14021
|
}
|
|
13979
14022
|
else {
|
|
13980
|
-
|
|
14023
|
+
searchStart = m + 1;
|
|
13981
14024
|
}
|
|
13982
14025
|
}
|
|
13983
14026
|
return null;
|
|
@@ -14355,7 +14398,7 @@ function makeUnique(name, existingNames) {
|
|
|
14355
14398
|
if (!existingNamesLowercase.has(name.toLocaleLowerCase()))
|
|
14356
14399
|
return name;
|
|
14357
14400
|
const ext = require$$0.extname(name);
|
|
14358
|
-
name = name.
|
|
14401
|
+
name = name.substring(0, name.length - ext.length);
|
|
14359
14402
|
let uniqueName, uniqueIndex = 1;
|
|
14360
14403
|
while (existingNamesLowercase.has((uniqueName = name + ++uniqueIndex + ext).toLowerCase()))
|
|
14361
14404
|
;
|
|
@@ -14521,7 +14564,7 @@ class Chunk {
|
|
|
14521
14564
|
var _a;
|
|
14522
14565
|
const facades = [];
|
|
14523
14566
|
const entryModules = new Set([...this.entryModules, ...this.implicitEntryModules]);
|
|
14524
|
-
const exposedVariables = new Set(this.dynamicEntryModules.map(
|
|
14567
|
+
const exposedVariables = new Set(this.dynamicEntryModules.map(({ namespace }) => namespace));
|
|
14525
14568
|
for (const module of entryModules) {
|
|
14526
14569
|
if (module.preserveSignature) {
|
|
14527
14570
|
for (const exportedVariable of module.getExportNamesByVariable().keys()) {
|
|
@@ -14530,7 +14573,9 @@ class Chunk {
|
|
|
14530
14573
|
}
|
|
14531
14574
|
}
|
|
14532
14575
|
for (const module of entryModules) {
|
|
14533
|
-
const requiredFacades = Array.from(new Set(module.chunkNames.filter(({ isUserDefined }) => isUserDefined).map(({ name }) => name)),
|
|
14576
|
+
const requiredFacades = Array.from(new Set(module.chunkNames.filter(({ isUserDefined }) => isUserDefined).map(({ name }) => name)),
|
|
14577
|
+
// mapping must run after Set 'name' dedupe
|
|
14578
|
+
name => ({
|
|
14534
14579
|
name
|
|
14535
14580
|
}));
|
|
14536
14581
|
if (requiredFacades.length === 0 && module.isUserDefinedEntryPoint) {
|
|
@@ -14608,7 +14653,7 @@ class Chunk {
|
|
|
14608
14653
|
const extension = require$$0.extname(sanitizedId);
|
|
14609
14654
|
const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
|
|
14610
14655
|
assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
|
|
14611
|
-
ext: () => extension.
|
|
14656
|
+
ext: () => extension.substring(1),
|
|
14612
14657
|
extname: () => extension,
|
|
14613
14658
|
format: () => options.format,
|
|
14614
14659
|
name: () => this.getChunkName()
|
|
@@ -14626,7 +14671,7 @@ class Chunk {
|
|
|
14626
14671
|
const extension = require$$0.extname(sanitizedId);
|
|
14627
14672
|
const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
|
|
14628
14673
|
assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
|
|
14629
|
-
ext: () => extension.
|
|
14674
|
+
ext: () => extension.substring(1),
|
|
14630
14675
|
extname: () => extension,
|
|
14631
14676
|
format: () => options.format,
|
|
14632
14677
|
name: () => getAliasName(sanitizedId)
|
|
@@ -14808,22 +14853,24 @@ class Chunk {
|
|
|
14808
14853
|
const renderedDependency = this.renderedDependencies.get(dependency);
|
|
14809
14854
|
if (dependency instanceof ExternalModule) {
|
|
14810
14855
|
const originalId = dependency.renderPath;
|
|
14811
|
-
renderedDependency.id = escapeId(dependency.renormalizeRenderPath
|
|
14856
|
+
renderedDependency.id = escapeId(dependency.renormalizeRenderPath
|
|
14857
|
+
? getImportPath(this.id, originalId, false, false)
|
|
14858
|
+
: originalId);
|
|
14812
14859
|
}
|
|
14813
14860
|
else {
|
|
14814
14861
|
renderedDependency.namedExportsMode = dependency.exportMode !== 'default';
|
|
14815
|
-
renderedDependency.id = escapeId(this.
|
|
14862
|
+
renderedDependency.id = escapeId(getImportPath(this.id, dependency.id, false, true));
|
|
14816
14863
|
}
|
|
14817
14864
|
}
|
|
14818
14865
|
this.finaliseDynamicImports(options, snippets);
|
|
14819
14866
|
this.finaliseImportMetas(format, snippets);
|
|
14820
14867
|
const hasExports = this.renderedExports.length !== 0 ||
|
|
14821
14868
|
[...this.renderedDependencies.values()].some(dep => (dep.reexports && dep.reexports.length !== 0));
|
|
14822
|
-
let
|
|
14869
|
+
let topLevelAwaitModule = null;
|
|
14823
14870
|
const accessedGlobals = new Set();
|
|
14824
14871
|
for (const module of this.orderedModules) {
|
|
14825
14872
|
if (module.usesTopLevelAwait) {
|
|
14826
|
-
|
|
14873
|
+
topLevelAwaitModule = module.id;
|
|
14827
14874
|
}
|
|
14828
14875
|
const accessedGlobalVariables = this.accessedGlobalsByScope.get(module.scope);
|
|
14829
14876
|
if (accessedGlobalVariables) {
|
|
@@ -14832,9 +14879,10 @@ class Chunk {
|
|
|
14832
14879
|
}
|
|
14833
14880
|
}
|
|
14834
14881
|
}
|
|
14835
|
-
if (
|
|
14882
|
+
if (topLevelAwaitModule !== null && format !== 'es' && format !== 'system') {
|
|
14836
14883
|
return error({
|
|
14837
14884
|
code: 'INVALID_TLA_FORMAT',
|
|
14885
|
+
id: topLevelAwaitModule,
|
|
14838
14886
|
message: `Module format ${format} does not support top-level await. Use the "es" or "system" output formats rather.`
|
|
14839
14887
|
});
|
|
14840
14888
|
}
|
|
@@ -14856,7 +14904,7 @@ class Chunk {
|
|
|
14856
14904
|
namedExportsMode: this.exportMode !== 'default',
|
|
14857
14905
|
outro: addons.outro,
|
|
14858
14906
|
snippets,
|
|
14859
|
-
usesTopLevelAwait,
|
|
14907
|
+
usesTopLevelAwait: topLevelAwaitModule !== null,
|
|
14860
14908
|
warn: this.inputOptions.onwarn
|
|
14861
14909
|
}, options);
|
|
14862
14910
|
if (addons.banner)
|
|
@@ -14995,10 +15043,10 @@ class Chunk {
|
|
|
14995
15043
|
continue;
|
|
14996
15044
|
}
|
|
14997
15045
|
const renderedResolution = resolution instanceof Module
|
|
14998
|
-
? `'${escapeId(this.
|
|
15046
|
+
? `'${escapeId(getImportPath(this.id, (facadeChunk || chunk).id, stripKnownJsExtensions, true))}'`
|
|
14999
15047
|
: resolution instanceof ExternalModule
|
|
15000
15048
|
? `'${escapeId(resolution.renormalizeRenderPath
|
|
15001
|
-
? this.
|
|
15049
|
+
? getImportPath(this.id, resolution.renderPath, stripKnownJsExtensions, false)
|
|
15002
15050
|
: resolution.renderPath)}'`
|
|
15003
15051
|
: resolution;
|
|
15004
15052
|
node.renderFinalResolution(code, renderedResolution, resolution instanceof Module &&
|
|
@@ -15195,7 +15243,7 @@ class Chunk {
|
|
|
15195
15243
|
let imported;
|
|
15196
15244
|
let needsLiveBinding = false;
|
|
15197
15245
|
if (exportName[0] === '*') {
|
|
15198
|
-
const id = exportName.
|
|
15246
|
+
const id = exportName.substring(1);
|
|
15199
15247
|
if (interop(id) === 'defaultOnly') {
|
|
15200
15248
|
this.inputOptions.onwarn(errUnexpectedNamespaceReexport(id));
|
|
15201
15249
|
}
|
|
@@ -15246,17 +15294,6 @@ class Chunk {
|
|
|
15246
15294
|
}
|
|
15247
15295
|
return referencedFiles;
|
|
15248
15296
|
}
|
|
15249
|
-
getRelativePath(targetPath, stripJsExtension) {
|
|
15250
|
-
let relativePath = normalize(relative(require$$0.dirname(this.id), targetPath));
|
|
15251
|
-
if (stripJsExtension && relativePath.endsWith('.js')) {
|
|
15252
|
-
relativePath = relativePath.slice(0, -3);
|
|
15253
|
-
}
|
|
15254
|
-
if (relativePath === '..')
|
|
15255
|
-
return '../../' + require$$0.basename(targetPath);
|
|
15256
|
-
if (relativePath === '')
|
|
15257
|
-
return '../' + require$$0.basename(targetPath);
|
|
15258
|
-
return relativePath.startsWith('../') ? relativePath : './' + relativePath;
|
|
15259
|
-
}
|
|
15260
15297
|
inlineChunkDependencies(chunk) {
|
|
15261
15298
|
for (const dep of chunk.dependencies) {
|
|
15262
15299
|
if (this.dependencies.has(dep))
|
|
@@ -15405,16 +15442,17 @@ function generateAssetFileName(name, source, outputOptions, bundle) {
|
|
|
15405
15442
|
return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
|
|
15406
15443
|
? outputOptions.assetFileNames({ name, source, type: 'asset' })
|
|
15407
15444
|
: outputOptions.assetFileNames, 'output.assetFileNames', {
|
|
15408
|
-
ext: () => require$$0.extname(emittedName).
|
|
15445
|
+
ext: () => require$$0.extname(emittedName).substring(1),
|
|
15409
15446
|
extname: () => require$$0.extname(emittedName),
|
|
15410
15447
|
hash() {
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15448
|
+
return createHash()
|
|
15449
|
+
.update(emittedName)
|
|
15450
|
+
.update(':')
|
|
15451
|
+
.update(source)
|
|
15452
|
+
.digest('hex')
|
|
15453
|
+
.substring(0, 8);
|
|
15416
15454
|
},
|
|
15417
|
-
name: () => emittedName.
|
|
15455
|
+
name: () => emittedName.substring(0, emittedName.length - require$$0.extname(emittedName).length)
|
|
15418
15456
|
}), bundle);
|
|
15419
15457
|
}
|
|
15420
15458
|
function reserveFileNameInBundle(fileName, bundle, warn) {
|
|
@@ -15463,7 +15501,7 @@ class FileEmitter {
|
|
|
15463
15501
|
this.facadeChunkByModule = null;
|
|
15464
15502
|
this.outputOptions = null;
|
|
15465
15503
|
this.assertAssetsFinalized = () => {
|
|
15466
|
-
for (const [referenceId, emittedFile] of this.filesByReferenceId
|
|
15504
|
+
for (const [referenceId, emittedFile] of this.filesByReferenceId) {
|
|
15467
15505
|
if (emittedFile.type === 'asset' && typeof emittedFile.fileName !== 'string')
|
|
15468
15506
|
return error(errNoAssetSourceSet(emittedFile.name || referenceId));
|
|
15469
15507
|
}
|
|
@@ -15478,9 +15516,7 @@ class FileEmitter {
|
|
|
15478
15516
|
if (emittedFile.type === 'chunk') {
|
|
15479
15517
|
return this.emitChunk(emittedFile);
|
|
15480
15518
|
}
|
|
15481
|
-
|
|
15482
|
-
return this.emitAsset(emittedFile);
|
|
15483
|
-
}
|
|
15519
|
+
return this.emitAsset(emittedFile);
|
|
15484
15520
|
};
|
|
15485
15521
|
this.getFileName = (fileReferenceId) => {
|
|
15486
15522
|
const emittedFile = this.filesByReferenceId.get(fileReferenceId);
|
|
@@ -15489,9 +15525,7 @@ class FileEmitter {
|
|
|
15489
15525
|
if (emittedFile.type === 'chunk') {
|
|
15490
15526
|
return getChunkFileName(emittedFile, this.facadeChunkByModule);
|
|
15491
15527
|
}
|
|
15492
|
-
|
|
15493
|
-
return getAssetFileName(emittedFile, fileReferenceId);
|
|
15494
|
-
}
|
|
15528
|
+
return getAssetFileName(emittedFile, fileReferenceId);
|
|
15495
15529
|
};
|
|
15496
15530
|
this.setAssetSource = (referenceId, requestedSource) => {
|
|
15497
15531
|
const consumedFile = this.filesByReferenceId.get(referenceId);
|
|
@@ -15520,7 +15554,7 @@ class FileEmitter {
|
|
|
15520
15554
|
reserveFileNameInBundle(emittedFile.fileName, this.bundle, this.options.onwarn);
|
|
15521
15555
|
}
|
|
15522
15556
|
}
|
|
15523
|
-
for (const [referenceId, consumedFile] of this.filesByReferenceId
|
|
15557
|
+
for (const [referenceId, consumedFile] of this.filesByReferenceId) {
|
|
15524
15558
|
if (consumedFile.type === 'asset' && consumedFile.source !== undefined) {
|
|
15525
15559
|
this.finalizeAsset(consumedFile, consumedFile.source, referenceId, this.bundle);
|
|
15526
15560
|
}
|
|
@@ -15533,14 +15567,10 @@ class FileEmitter {
|
|
|
15533
15567
|
assignReferenceId(file, idBase) {
|
|
15534
15568
|
let referenceId;
|
|
15535
15569
|
do {
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
else {
|
|
15541
|
-
hash.update(idBase);
|
|
15542
|
-
}
|
|
15543
|
-
referenceId = hash.digest('hex').substr(0, 8);
|
|
15570
|
+
referenceId = createHash()
|
|
15571
|
+
.update(referenceId || idBase)
|
|
15572
|
+
.digest('hex')
|
|
15573
|
+
.substring(0, 8);
|
|
15544
15574
|
} while (this.filesByReferenceId.has(referenceId));
|
|
15545
15575
|
this.filesByReferenceId.set(referenceId, file);
|
|
15546
15576
|
return referenceId;
|
|
@@ -16064,7 +16094,7 @@ class Bundle {
|
|
|
16064
16094
|
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);
|
|
16065
16095
|
file.type = 'asset';
|
|
16066
16096
|
}
|
|
16067
|
-
if (this.outputOptions.validate &&
|
|
16097
|
+
if (this.outputOptions.validate && 'code' in file) {
|
|
16068
16098
|
try {
|
|
16069
16099
|
this.graph.contextParse(file.code, {
|
|
16070
16100
|
allowHashBang: true,
|
|
@@ -22281,9 +22311,7 @@ class ModuleLoader {
|
|
|
22281
22311
|
}
|
|
22282
22312
|
return Promise.resolve(externalModule);
|
|
22283
22313
|
}
|
|
22284
|
-
|
|
22285
|
-
return this.fetchModule(resolvedId, importer, false, false);
|
|
22286
|
-
}
|
|
22314
|
+
return this.fetchModule(resolvedId, importer, false, false);
|
|
22287
22315
|
}
|
|
22288
22316
|
async fetchStaticDependencies(module, resolveStaticDependencyPromises) {
|
|
22289
22317
|
for (const dependency of await Promise.all(resolveStaticDependencyPromises.map(resolveStaticDependencyPromise => resolveStaticDependencyPromise.then(([source, resolvedId]) => this.fetchResolvedDependency(source, module.id, resolvedId))))) {
|
|
@@ -22421,6 +22449,8 @@ class ModuleLoader {
|
|
|
22421
22449
|
: { id: resolveIdResult }), undefined, isEntry, false);
|
|
22422
22450
|
}
|
|
22423
22451
|
async resolveDynamicImport(module, specifier, importer) {
|
|
22452
|
+
var _a;
|
|
22453
|
+
var _b;
|
|
22424
22454
|
const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
|
|
22425
22455
|
specifier,
|
|
22426
22456
|
importer
|
|
@@ -22439,9 +22469,7 @@ class ModuleLoader {
|
|
|
22439
22469
|
};
|
|
22440
22470
|
}
|
|
22441
22471
|
if (resolution == null) {
|
|
22442
|
-
return (module.resolvedIds[specifier] =
|
|
22443
|
-
module.resolvedIds[specifier] ||
|
|
22444
|
-
this.handleResolveId(await this.resolveId(specifier, module.id, EMPTY_OBJECT, false), specifier, module.id));
|
|
22472
|
+
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)));
|
|
22445
22473
|
}
|
|
22446
22474
|
return this.handleResolveId(this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier)), specifier, importer);
|
|
22447
22475
|
}
|
|
@@ -22492,7 +22520,6 @@ class GlobalScope extends Scope$1 {
|
|
|
22492
22520
|
}
|
|
22493
22521
|
}
|
|
22494
22522
|
|
|
22495
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22496
22523
|
function getDeprecatedContextHandler(handler, handlerName, newHandlerName, pluginName, activeDeprecation, options) {
|
|
22497
22524
|
let deprecationWarningShown = false;
|
|
22498
22525
|
return ((...args) => {
|
|
@@ -22598,24 +22625,19 @@ function resolveAction(actionTuple) {
|
|
|
22598
22625
|
unfulfilledActions.delete(actionTuple);
|
|
22599
22626
|
}
|
|
22600
22627
|
function formatAction([pluginName, hookName, args]) {
|
|
22601
|
-
|
|
22628
|
+
const action = `(${pluginName}) ${hookName}`;
|
|
22602
22629
|
const s = JSON.stringify;
|
|
22603
22630
|
switch (hookName) {
|
|
22604
22631
|
case 'resolveId':
|
|
22605
|
-
action
|
|
22606
|
-
break;
|
|
22632
|
+
return `${action} ${s(args[0])} ${s(args[1])}`;
|
|
22607
22633
|
case 'load':
|
|
22608
|
-
action
|
|
22609
|
-
break;
|
|
22634
|
+
return `${action} ${s(args[0])}`;
|
|
22610
22635
|
case 'transform':
|
|
22611
|
-
action
|
|
22612
|
-
break;
|
|
22636
|
+
return `${action} ${s(args[1])}`;
|
|
22613
22637
|
case 'shouldTransformCachedModule':
|
|
22614
|
-
action
|
|
22615
|
-
break;
|
|
22638
|
+
return `${action} ${s(args[0].id)}`;
|
|
22616
22639
|
case 'moduleParsed':
|
|
22617
|
-
action
|
|
22618
|
-
break;
|
|
22640
|
+
return `${action} ${s(args[0].id)}`;
|
|
22619
22641
|
}
|
|
22620
22642
|
return action;
|
|
22621
22643
|
}
|
|
@@ -23271,6 +23293,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23271
23293
|
const preserveModules = getPreserveModules(config, inlineDynamicImports, inputOptions);
|
|
23272
23294
|
const file = getFile(config, preserveModules, inputOptions);
|
|
23273
23295
|
const preferConst = getPreferConst(config, inputOptions);
|
|
23296
|
+
const generatedCode = getGeneratedCode(config, preferConst);
|
|
23274
23297
|
const outputOptions = {
|
|
23275
23298
|
amd: getAmd(config),
|
|
23276
23299
|
assetFileNames: (_a = config.assetFileNames) !== null && _a !== void 0 ? _a : 'assets/[name]-[hash][extname]',
|
|
@@ -23288,7 +23311,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23288
23311
|
footer: getAddon(config, 'footer'),
|
|
23289
23312
|
format,
|
|
23290
23313
|
freeze: (_e = config.freeze) !== null && _e !== void 0 ? _e : true,
|
|
23291
|
-
generatedCode
|
|
23314
|
+
generatedCode,
|
|
23292
23315
|
globals: config.globals || {},
|
|
23293
23316
|
hoistTransitiveImports: (_f = config.hoistTransitiveImports) !== null && _f !== void 0 ? _f : true,
|
|
23294
23317
|
indent: getIndent(config, compact),
|
|
@@ -23298,7 +23321,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23298
23321
|
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules, inputOptions),
|
|
23299
23322
|
minifyInternalExports: getMinifyInternalExports(config, format, compact),
|
|
23300
23323
|
name: config.name,
|
|
23301
|
-
namespaceToStringTag: config
|
|
23324
|
+
namespaceToStringTag: getNamespaceToStringTag(config, generatedCode, inputOptions),
|
|
23302
23325
|
noConflict: config.noConflict || false,
|
|
23303
23326
|
outro: getAddon(config, 'outro'),
|
|
23304
23327
|
paths: config.paths || {},
|
|
@@ -23468,7 +23491,8 @@ const getGeneratedCode = (config, preferConst) => {
|
|
|
23468
23491
|
arrowFunctions: configWithPreset.arrowFunctions === true,
|
|
23469
23492
|
constBindings: configWithPreset.constBindings === true || preferConst,
|
|
23470
23493
|
objectShorthand: configWithPreset.objectShorthand === true,
|
|
23471
|
-
reservedNamesAsProps: configWithPreset.reservedNamesAsProps === true
|
|
23494
|
+
reservedNamesAsProps: configWithPreset.reservedNamesAsProps === true,
|
|
23495
|
+
symbols: configWithPreset.symbols === true
|
|
23472
23496
|
};
|
|
23473
23497
|
};
|
|
23474
23498
|
const getIndent = (config, compact) => {
|
|
@@ -23493,7 +23517,7 @@ const getInterop = (config, inputOptions) => {
|
|
|
23493
23517
|
if (!validatedInteropTypes.has(interop)) {
|
|
23494
23518
|
validatedInteropTypes.add(interop);
|
|
23495
23519
|
if (!ALLOWED_INTEROP_TYPES.has(interop)) {
|
|
23496
|
-
return error(errInvalidOption('output.interop', 'outputinterop', `use one of ${Array.from(ALLOWED_INTEROP_TYPES
|
|
23520
|
+
return error(errInvalidOption('output.interop', 'outputinterop', `use one of ${Array.from(ALLOWED_INTEROP_TYPES, value => JSON.stringify(value)).join(', ')}`, interop));
|
|
23497
23521
|
}
|
|
23498
23522
|
if (typeof interop === 'boolean') {
|
|
23499
23523
|
warnDeprecation({
|
|
@@ -23528,6 +23552,14 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
|
|
|
23528
23552
|
return configManualChunks || {};
|
|
23529
23553
|
};
|
|
23530
23554
|
const getMinifyInternalExports = (config, format, compact) => { var _a; return (_a = config.minifyInternalExports) !== null && _a !== void 0 ? _a : (compact || format === 'es' || format === 'system'); };
|
|
23555
|
+
const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
|
|
23556
|
+
const configNamespaceToStringTag = config.namespaceToStringTag;
|
|
23557
|
+
if (configNamespaceToStringTag != null) {
|
|
23558
|
+
warnDeprecation(`The "output.namespaceToStringTag" option is deprecated. Use the "output.generatedCode.symbols" option instead.`, false, inputOptions);
|
|
23559
|
+
return configNamespaceToStringTag;
|
|
23560
|
+
}
|
|
23561
|
+
return generatedCode.symbols || false;
|
|
23562
|
+
};
|
|
23531
23563
|
|
|
23532
23564
|
function rollup(rawInputOptions) {
|
|
23533
23565
|
return rollupInternal(rawInputOptions, null);
|
|
@@ -23599,12 +23631,11 @@ function applyOptionHook(watchMode) {
|
|
|
23599
23631
|
};
|
|
23600
23632
|
}
|
|
23601
23633
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
23602
|
-
|
|
23603
|
-
const plugin = plugins[pluginIndex];
|
|
23634
|
+
plugins.forEach((plugin, index) => {
|
|
23604
23635
|
if (!plugin.name) {
|
|
23605
|
-
plugin.name = `${anonymousPrefix}${
|
|
23636
|
+
plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
23606
23637
|
}
|
|
23607
|
-
}
|
|
23638
|
+
});
|
|
23608
23639
|
}
|
|
23609
23640
|
async function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutputOptions, graph) {
|
|
23610
23641
|
const { options: outputOptions, outputPluginDriver, unsetOptions } = getOutputOptionsAndPluginDriver(rawOutputOptions, graph.pluginDriver, inputOptions, unsetInputOptions);
|