rollup 2.54.0 → 2.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/dist/bin/rollup +15 -8
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +140 -133
- package/dist/es/shared/watch.js +10 -6
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +7 -5
- package/dist/shared/loadConfigFile.js +7 -3
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +140 -133
- package/dist/shared/watch-cli.js +3 -3
- package/dist/shared/watch.js +5 -3
- package/package.json +1 -1
package/dist/es/rollup.js
CHANGED
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
Sun,
|
|
3
|
+
Rollup.js v2.56.1
|
|
4
|
+
Sun, 08 Aug 2021 11:58:39 GMT - commit 2a097a809d7976d0684370fb14b61b3c2fa86bca
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -13,7 +13,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
13
13
|
import fs, { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
14
14
|
import { EventEmitter } from 'events';
|
|
15
15
|
|
|
16
|
-
var version$1 = "2.
|
|
16
|
+
var version$1 = "2.56.1";
|
|
17
17
|
|
|
18
18
|
var charToInteger = {};
|
|
19
19
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1440,6 +1440,8 @@ Bundle$1.prototype.trimEnd = function trimEnd (charType) {
|
|
|
1440
1440
|
return this;
|
|
1441
1441
|
};
|
|
1442
1442
|
|
|
1443
|
+
var MagicString$1 = MagicString;
|
|
1444
|
+
|
|
1443
1445
|
function relative(from, to) {
|
|
1444
1446
|
const fromParts = from.split(/[/\\]/).filter(Boolean);
|
|
1445
1447
|
const toParts = to.split(/[/\\]/).filter(Boolean);
|
|
@@ -2703,35 +2705,54 @@ function removeLineBreaks(code, start, end) {
|
|
|
2703
2705
|
}
|
|
2704
2706
|
}
|
|
2705
2707
|
|
|
2706
|
-
function getSystemExportStatement(exportedVariables,
|
|
2707
|
-
const _ =
|
|
2708
|
+
function getSystemExportStatement(exportedVariables, { compact, exportNamesByVariable }, modifier = '') {
|
|
2709
|
+
const _ = compact ? '' : ' ';
|
|
2708
2710
|
if (exportedVariables.length === 1 &&
|
|
2709
|
-
|
|
2711
|
+
exportNamesByVariable.get(exportedVariables[0]).length === 1) {
|
|
2710
2712
|
const variable = exportedVariables[0];
|
|
2711
|
-
return `exports('${
|
|
2713
|
+
return `exports('${exportNamesByVariable.get(variable)}',${_}${variable.getName()}${modifier})`;
|
|
2712
2714
|
}
|
|
2713
2715
|
else {
|
|
2714
2716
|
return `exports({${_}${exportedVariables
|
|
2715
2717
|
.map(variable => {
|
|
2716
|
-
return
|
|
2718
|
+
return exportNamesByVariable
|
|
2717
2719
|
.get(variable)
|
|
2718
|
-
.map(exportName => `${exportName}:${_}${variable.getName()}`)
|
|
2720
|
+
.map(exportName => `${exportName}:${_}${variable.getName()}${modifier}`)
|
|
2719
2721
|
.join(`,${_}`);
|
|
2720
2722
|
})
|
|
2721
2723
|
.join(`,${_}`)}${_}})`;
|
|
2722
2724
|
}
|
|
2723
2725
|
}
|
|
2724
|
-
function
|
|
2726
|
+
function renderSystemExportExpression(exportedVariable, expressionStart, expressionEnd, code, { compact, exportNamesByVariable }) {
|
|
2727
|
+
const _ = compact ? '' : ' ';
|
|
2728
|
+
code.prependRight(expressionStart, `exports('${exportNamesByVariable.get(exportedVariable)}',${_}`);
|
|
2729
|
+
code.appendLeft(expressionEnd, ')');
|
|
2730
|
+
}
|
|
2731
|
+
function renderSystemExportFunction(exportedVariables, expressionStart, expressionEnd, needsParens, code, options) {
|
|
2725
2732
|
const _ = options.compact ? '' : ' ';
|
|
2726
2733
|
const s = options.compact ? '' : ';';
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2734
|
+
code.prependRight(expressionStart, `function${_}(v)${_}{${_}return ${getSystemExportStatement(exportedVariables, options)},${_}v${s}${_}}(`);
|
|
2735
|
+
code.appendLeft(expressionEnd, ')');
|
|
2736
|
+
if (needsParens) {
|
|
2737
|
+
code.prependRight(expressionStart, '(');
|
|
2738
|
+
code.appendLeft(expressionEnd, ')');
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
function renderSystemExportSequenceAfterExpression(exportedVariable, expressionStart, expressionEnd, needsParens, code, options) {
|
|
2742
|
+
const _ = options.compact ? '' : ' ';
|
|
2743
|
+
code.appendLeft(expressionEnd, `,${_}${getSystemExportStatement([exportedVariable], options)},${_}${exportedVariable.getName()}`);
|
|
2744
|
+
if (needsParens) {
|
|
2745
|
+
code.prependRight(expressionStart, '(');
|
|
2746
|
+
code.appendLeft(expressionEnd, ')');
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
function renderSystemExportSequenceBeforeExpression(exportedVariable, expressionStart, expressionEnd, needsParens, code, options, modifier) {
|
|
2750
|
+
const _ = options.compact ? '' : ' ';
|
|
2751
|
+
code.prependRight(expressionStart, `${getSystemExportStatement([exportedVariable], options, modifier)},${_}`);
|
|
2752
|
+
if (needsParens) {
|
|
2753
|
+
code.prependRight(expressionStart, '(');
|
|
2754
|
+
code.appendLeft(expressionEnd, ')');
|
|
2755
|
+
}
|
|
2735
2756
|
}
|
|
2736
2757
|
|
|
2737
2758
|
const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
|
|
@@ -4193,6 +4214,32 @@ class Identifier extends NodeBase {
|
|
|
4193
4214
|
includeCallArguments(context, args) {
|
|
4194
4215
|
this.getVariableRespectingTDZ().includeCallArguments(context, args);
|
|
4195
4216
|
}
|
|
4217
|
+
isPossibleTDZ() {
|
|
4218
|
+
// return cached value to avoid issues with the next tree-shaking pass
|
|
4219
|
+
if (this.isTDZAccess !== null)
|
|
4220
|
+
return this.isTDZAccess;
|
|
4221
|
+
if (!(this.variable instanceof LocalVariable) ||
|
|
4222
|
+
!this.variable.kind ||
|
|
4223
|
+
!(this.variable.kind in tdzVariableKinds)) {
|
|
4224
|
+
return (this.isTDZAccess = false);
|
|
4225
|
+
}
|
|
4226
|
+
let decl_id;
|
|
4227
|
+
if (this.variable.declarations &&
|
|
4228
|
+
this.variable.declarations.length === 1 &&
|
|
4229
|
+
(decl_id = this.variable.declarations[0]) &&
|
|
4230
|
+
this.start < decl_id.start &&
|
|
4231
|
+
closestParentFunctionOrProgram(this) === closestParentFunctionOrProgram(decl_id)) {
|
|
4232
|
+
// a variable accessed before its declaration
|
|
4233
|
+
// in the same function or at top level of module
|
|
4234
|
+
return (this.isTDZAccess = true);
|
|
4235
|
+
}
|
|
4236
|
+
if (!this.variable.initReached) {
|
|
4237
|
+
// Either a const/let TDZ violation or
|
|
4238
|
+
// var use before declaration was encountered.
|
|
4239
|
+
return (this.isTDZAccess = true);
|
|
4240
|
+
}
|
|
4241
|
+
return (this.isTDZAccess = false);
|
|
4242
|
+
}
|
|
4196
4243
|
markDeclarationReached() {
|
|
4197
4244
|
this.variable.initReached = true;
|
|
4198
4245
|
}
|
|
@@ -4235,32 +4282,6 @@ class Identifier extends NodeBase {
|
|
|
4235
4282
|
}
|
|
4236
4283
|
return this.variable;
|
|
4237
4284
|
}
|
|
4238
|
-
isPossibleTDZ() {
|
|
4239
|
-
// return cached value to avoid issues with the next tree-shaking pass
|
|
4240
|
-
if (this.isTDZAccess !== null)
|
|
4241
|
-
return this.isTDZAccess;
|
|
4242
|
-
if (!(this.variable instanceof LocalVariable) ||
|
|
4243
|
-
!this.variable.kind ||
|
|
4244
|
-
!(this.variable.kind in tdzVariableKinds)) {
|
|
4245
|
-
return (this.isTDZAccess = false);
|
|
4246
|
-
}
|
|
4247
|
-
let decl_id;
|
|
4248
|
-
if (this.variable.declarations &&
|
|
4249
|
-
this.variable.declarations.length === 1 &&
|
|
4250
|
-
(decl_id = this.variable.declarations[0]) &&
|
|
4251
|
-
this.start < decl_id.start &&
|
|
4252
|
-
closestParentFunctionOrProgram(this) === closestParentFunctionOrProgram(decl_id)) {
|
|
4253
|
-
// a variable accessed before its declaration
|
|
4254
|
-
// in the same function or at top level of module
|
|
4255
|
-
return (this.isTDZAccess = true);
|
|
4256
|
-
}
|
|
4257
|
-
if (!this.variable.initReached) {
|
|
4258
|
-
// Either a const/let TDZ violation or
|
|
4259
|
-
// var use before declaration was encountered.
|
|
4260
|
-
return (this.isTDZAccess = true);
|
|
4261
|
-
}
|
|
4262
|
-
return (this.isTDZAccess = false);
|
|
4263
|
-
}
|
|
4264
4285
|
}
|
|
4265
4286
|
function closestParentFunctionOrProgram(node) {
|
|
4266
4287
|
while (node && !/^Program|Function/.test(node.type)) {
|
|
@@ -5667,12 +5688,14 @@ class VariableDeclaration extends NodeBase {
|
|
|
5667
5688
|
let isInDeclaration = false;
|
|
5668
5689
|
let hasRenderedContent = false;
|
|
5669
5690
|
let separatorString = '', leadingString, nextSeparatorString;
|
|
5670
|
-
const
|
|
5691
|
+
const aggregatedSystemExports = [];
|
|
5692
|
+
const singleSystemExport = gatherSystemExportsAndGetSingleExport(separatedNodes, options, aggregatedSystemExports);
|
|
5671
5693
|
for (const { node, start, separator, contentEnd, end } of separatedNodes) {
|
|
5672
5694
|
if (!node.included) {
|
|
5673
5695
|
code.remove(start, end);
|
|
5674
5696
|
continue;
|
|
5675
5697
|
}
|
|
5698
|
+
node.render(code, options);
|
|
5676
5699
|
leadingString = '';
|
|
5677
5700
|
nextSeparatorString = '';
|
|
5678
5701
|
if (!node.id.included ||
|
|
@@ -5684,21 +5707,9 @@ class VariableDeclaration extends NodeBase {
|
|
|
5684
5707
|
isInDeclaration = false;
|
|
5685
5708
|
}
|
|
5686
5709
|
else {
|
|
5687
|
-
if (
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
}
|
|
5691
|
-
else {
|
|
5692
|
-
const exportNames = options.exportNamesByVariable.get(node.id.variable);
|
|
5693
|
-
if (exportNames) {
|
|
5694
|
-
const _ = options.compact ? '' : ' ';
|
|
5695
|
-
const operatorPos = findFirstOccurrenceOutsideComment(code.original, '=', node.id.end);
|
|
5696
|
-
code.prependLeft(findNonWhiteSpace(code.original, operatorPos + 1), exportNames.length === 1
|
|
5697
|
-
? `exports('${exportNames[0]}',${_}`
|
|
5698
|
-
: getSystemExportFunctionLeft([node.id.variable], false, options));
|
|
5699
|
-
nextSeparatorString += ')';
|
|
5700
|
-
}
|
|
5701
|
-
}
|
|
5710
|
+
if (singleSystemExport && singleSystemExport === node.id.variable) {
|
|
5711
|
+
const operatorPos = findFirstOccurrenceOutsideComment(code.original, '=', node.id.end);
|
|
5712
|
+
renderSystemExportExpression(singleSystemExport, findNonWhiteSpace(code.original, operatorPos + 1), separator === null ? contentEnd : separator, code, options);
|
|
5702
5713
|
}
|
|
5703
5714
|
if (isInDeclaration) {
|
|
5704
5715
|
separatorString += ',';
|
|
@@ -5718,15 +5729,39 @@ class VariableDeclaration extends NodeBase {
|
|
|
5718
5729
|
code.overwrite(lastSeparatorPos, lastSeparatorPos + 1, separatorString);
|
|
5719
5730
|
code.appendLeft(renderedContentEnd, leadingString);
|
|
5720
5731
|
}
|
|
5721
|
-
node.render(code, options);
|
|
5722
5732
|
actualContentEnd = contentEnd;
|
|
5723
5733
|
renderedContentEnd = end;
|
|
5724
5734
|
hasRenderedContent = true;
|
|
5725
5735
|
lastSeparatorPos = separator;
|
|
5726
5736
|
separatorString = nextSeparatorString;
|
|
5727
5737
|
}
|
|
5728
|
-
this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd,
|
|
5738
|
+
this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, aggregatedSystemExports, options, isNoStatement);
|
|
5739
|
+
}
|
|
5740
|
+
}
|
|
5741
|
+
function gatherSystemExportsAndGetSingleExport(separatedNodes, options, aggregatedSystemExports) {
|
|
5742
|
+
var _a;
|
|
5743
|
+
let singleSystemExport = null;
|
|
5744
|
+
if (options.format === 'system') {
|
|
5745
|
+
for (const { node } of separatedNodes) {
|
|
5746
|
+
if (node.id instanceof Identifier &&
|
|
5747
|
+
node.init &&
|
|
5748
|
+
aggregatedSystemExports.length === 0 &&
|
|
5749
|
+
((_a = options.exportNamesByVariable.get(node.id.variable)) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
5750
|
+
singleSystemExport = node.id.variable;
|
|
5751
|
+
aggregatedSystemExports.push(singleSystemExport);
|
|
5752
|
+
}
|
|
5753
|
+
else {
|
|
5754
|
+
node.id.addExportedVariables(aggregatedSystemExports, options.exportNamesByVariable);
|
|
5755
|
+
}
|
|
5756
|
+
}
|
|
5757
|
+
if (aggregatedSystemExports.length > 1) {
|
|
5758
|
+
singleSystemExport = null;
|
|
5759
|
+
}
|
|
5760
|
+
else if (singleSystemExport) {
|
|
5761
|
+
aggregatedSystemExports.length = 0;
|
|
5762
|
+
}
|
|
5729
5763
|
}
|
|
5764
|
+
return singleSystemExport;
|
|
5730
5765
|
}
|
|
5731
5766
|
|
|
5732
5767
|
const NEW_ARRAY_PROPERTIES = [
|
|
@@ -6180,7 +6215,7 @@ class AssignmentExpression extends NodeBase {
|
|
|
6180
6215
|
}
|
|
6181
6216
|
this.right.include(context, includeChildrenRecursively);
|
|
6182
6217
|
}
|
|
6183
|
-
render(code, options, { preventASI, renderedParentType } = BLANK) {
|
|
6218
|
+
render(code, options, { preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
6184
6219
|
if (this.left.included) {
|
|
6185
6220
|
this.left.render(code, options);
|
|
6186
6221
|
this.right.render(code, options);
|
|
@@ -6192,26 +6227,27 @@ class AssignmentExpression extends NodeBase {
|
|
|
6192
6227
|
removeLineBreaks(code, inclusionStart, this.right.start);
|
|
6193
6228
|
}
|
|
6194
6229
|
this.right.render(code, options, {
|
|
6195
|
-
renderedParentType: renderedParentType || this.parent.type
|
|
6230
|
+
renderedParentType: renderedParentType || renderedSurroundingElement || this.parent.type
|
|
6196
6231
|
});
|
|
6197
6232
|
}
|
|
6198
6233
|
if (options.format === 'system') {
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
const
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6234
|
+
if (this.left instanceof Identifier) {
|
|
6235
|
+
const variable = this.left.variable;
|
|
6236
|
+
const exportNames = options.exportNamesByVariable.get(variable);
|
|
6237
|
+
if (exportNames) {
|
|
6238
|
+
if (exportNames.length === 1) {
|
|
6239
|
+
renderSystemExportExpression(variable, this.start, this.end, code, options);
|
|
6240
|
+
}
|
|
6241
|
+
else {
|
|
6242
|
+
renderSystemExportSequenceAfterExpression(variable, this.start, this.end, this.parent.type !== ExpressionStatement$1, code, options);
|
|
6243
|
+
}
|
|
6244
|
+
}
|
|
6208
6245
|
}
|
|
6209
6246
|
else {
|
|
6210
6247
|
const systemPatternExports = [];
|
|
6211
6248
|
this.left.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
|
|
6212
6249
|
if (systemPatternExports.length > 0) {
|
|
6213
|
-
|
|
6214
|
-
code.appendLeft(this.end, '))');
|
|
6250
|
+
renderSystemExportFunction(systemPatternExports, this.start, this.end, (renderedParentType || renderedSurroundingElement) === ExpressionStatement$1, code, options);
|
|
6215
6251
|
}
|
|
6216
6252
|
}
|
|
6217
6253
|
}
|
|
@@ -7664,12 +7700,12 @@ class ImportExpression extends NodeBase {
|
|
|
7664
7700
|
if (this.inlineNamespace) {
|
|
7665
7701
|
const _ = options.compact ? '' : ' ';
|
|
7666
7702
|
const s = options.compact ? '' : ';';
|
|
7667
|
-
code.overwrite(this.start, this.end, `Promise.resolve().then(function${_}()${_}{${_}return ${this.inlineNamespace.getName()}${s}${_}})
|
|
7703
|
+
code.overwrite(this.start, this.end, `Promise.resolve().then(function${_}()${_}{${_}return ${this.inlineNamespace.getName()}${s}${_}})`, { contentOnly: true });
|
|
7668
7704
|
return;
|
|
7669
7705
|
}
|
|
7670
7706
|
if (this.mechanism) {
|
|
7671
|
-
code.overwrite(this.start, findFirstOccurrenceOutsideComment(code.original, '(', this.start + 6) + 1, this.mechanism.left);
|
|
7672
|
-
code.overwrite(this.end - 1, this.end, this.mechanism.right);
|
|
7707
|
+
code.overwrite(this.start, findFirstOccurrenceOutsideComment(code.original, '(', this.start + 6) + 1, this.mechanism.left, { contentOnly: true });
|
|
7708
|
+
code.overwrite(this.end - 1, this.end, this.mechanism.right, { contentOnly: true });
|
|
7673
7709
|
}
|
|
7674
7710
|
this.source.render(code, options);
|
|
7675
7711
|
}
|
|
@@ -9055,7 +9091,8 @@ class ExportDefaultVariable extends LocalVariable {
|
|
|
9055
9091
|
getDirectOriginalVariable() {
|
|
9056
9092
|
return this.originalId &&
|
|
9057
9093
|
(this.hasId ||
|
|
9058
|
-
!(this.originalId.
|
|
9094
|
+
!(this.originalId.isPossibleTDZ() ||
|
|
9095
|
+
this.originalId.variable.isReassigned ||
|
|
9059
9096
|
this.originalId.variable instanceof UndefinedVariable ||
|
|
9060
9097
|
// this avoids a circular dependency
|
|
9061
9098
|
'syntheticNamespace' in this.originalId.variable))
|
|
@@ -9296,31 +9333,19 @@ class UpdateExpression extends NodeBase {
|
|
|
9296
9333
|
if (options.format === 'system') {
|
|
9297
9334
|
const variable = this.argument.variable;
|
|
9298
9335
|
const exportNames = options.exportNamesByVariable.get(variable);
|
|
9299
|
-
if (exportNames
|
|
9336
|
+
if (exportNames) {
|
|
9300
9337
|
const _ = options.compact ? '' : ' ';
|
|
9301
|
-
const name = variable.getName();
|
|
9302
9338
|
if (this.prefix) {
|
|
9303
9339
|
if (exportNames.length === 1) {
|
|
9304
|
-
|
|
9340
|
+
renderSystemExportExpression(variable, this.start, this.end, code, options);
|
|
9305
9341
|
}
|
|
9306
9342
|
else {
|
|
9307
|
-
|
|
9343
|
+
renderSystemExportSequenceAfterExpression(variable, this.start, this.end, this.parent.type !== ExpressionStatement$1, code, options);
|
|
9308
9344
|
}
|
|
9309
9345
|
}
|
|
9310
|
-
else if (exportNames.length > 1) {
|
|
9311
|
-
code.overwrite(this.start, this.end, `(${getSystemExportFunctionLeft([variable], false, options)}${this.operator}${name}))`);
|
|
9312
|
-
}
|
|
9313
9346
|
else {
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
case '++':
|
|
9317
|
-
op = `${name}${_}+${_}1`;
|
|
9318
|
-
break;
|
|
9319
|
-
case '--':
|
|
9320
|
-
op = `${name}${_}-${_}1`;
|
|
9321
|
-
break;
|
|
9322
|
-
}
|
|
9323
|
-
code.overwrite(this.start, this.end, `(exports('${exportNames[0]}',${_}${op}),${_}${name}${this.operator})`);
|
|
9347
|
+
const operator = this.operator[0];
|
|
9348
|
+
renderSystemExportSequenceBeforeExpression(variable, this.start, this.end, this.parent.type !== ExpressionStatement$1, code, options, `${_}${operator}${_}1`);
|
|
9324
9349
|
}
|
|
9325
9350
|
}
|
|
9326
9351
|
}
|
|
@@ -10269,7 +10294,7 @@ class Module {
|
|
|
10269
10294
|
// By default, `id` is the file name. Custom resolvers and loaders
|
|
10270
10295
|
// can change that, but it makes sense to use it for the source file name
|
|
10271
10296
|
const fileName = this.id;
|
|
10272
|
-
this.magicString = new MagicString(code, {
|
|
10297
|
+
this.magicString = new MagicString$1(code, {
|
|
10273
10298
|
filename: (this.excludeFromSourcemap ? null : fileName),
|
|
10274
10299
|
indentExclusionRanges: []
|
|
10275
10300
|
});
|
|
@@ -10703,9 +10728,9 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, comp
|
|
|
10703
10728
|
}
|
|
10704
10729
|
}
|
|
10705
10730
|
}
|
|
10706
|
-
for (const
|
|
10707
|
-
const lhs = `exports
|
|
10708
|
-
const rhs =
|
|
10731
|
+
for (const { exported, local } of exports) {
|
|
10732
|
+
const lhs = `exports${RESERVED_NAMES[exported] ? `['${exported}']` : `.${exported}`}`;
|
|
10733
|
+
const rhs = local;
|
|
10709
10734
|
if (lhs !== rhs) {
|
|
10710
10735
|
if (exportBlock)
|
|
10711
10736
|
exportBlock += n;
|
|
@@ -11072,17 +11097,12 @@ function getExportBlock(exports, _, varOrConst) {
|
|
|
11072
11097
|
const exportBlock = [];
|
|
11073
11098
|
const exportDeclaration = [];
|
|
11074
11099
|
for (const specifier of exports) {
|
|
11075
|
-
if (specifier.
|
|
11076
|
-
exportBlock.push(
|
|
11077
|
-
}
|
|
11078
|
-
else {
|
|
11079
|
-
if (specifier.expression) {
|
|
11080
|
-
exportBlock.push(`${varOrConst} ${specifier.local}${_}=${_}${specifier.expression};`);
|
|
11081
|
-
}
|
|
11082
|
-
exportDeclaration.push(specifier.exported === specifier.local
|
|
11083
|
-
? specifier.local
|
|
11084
|
-
: `${specifier.local} as ${specifier.exported}`);
|
|
11100
|
+
if (specifier.expression) {
|
|
11101
|
+
exportBlock.push(`${varOrConst} ${specifier.local}${_}=${_}${specifier.expression};`);
|
|
11085
11102
|
}
|
|
11103
|
+
exportDeclaration.push(specifier.exported === specifier.local
|
|
11104
|
+
? specifier.local
|
|
11105
|
+
: `${specifier.local} as ${specifier.exported}`);
|
|
11086
11106
|
}
|
|
11087
11107
|
if (exportDeclaration.length) {
|
|
11088
11108
|
exportBlock.push(`export${_}{${_}${exportDeclaration.join(`,${_}`)}${_}};`);
|
|
@@ -11200,13 +11220,11 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
11200
11220
|
|
|
11201
11221
|
function getStarExcludes({ dependencies, exports }) {
|
|
11202
11222
|
const starExcludes = new Set(exports.map(expt => expt.exported));
|
|
11203
|
-
|
|
11204
|
-
starExcludes.add('default');
|
|
11205
|
-
// also include reexport names
|
|
11223
|
+
starExcludes.add('default');
|
|
11206
11224
|
for (const { reexports } of dependencies) {
|
|
11207
11225
|
if (reexports) {
|
|
11208
11226
|
for (const reexport of reexports) {
|
|
11209
|
-
if (reexport.imported !== '*'
|
|
11227
|
+
if (reexport.imported !== '*')
|
|
11210
11228
|
starExcludes.add(reexport.reexported);
|
|
11211
11229
|
}
|
|
11212
11230
|
}
|
|
@@ -11230,9 +11248,7 @@ function getExportsBlock(exports, _, t, n) {
|
|
|
11230
11248
|
exports.map(({ name, value }) => `${t}${t}${t}${t}${name}:${_}${value}`).join(`,${n}`) +
|
|
11231
11249
|
`${n}${t}${t}${t}});${n}${n}`);
|
|
11232
11250
|
}
|
|
11233
|
-
const getHoistedExportsBlock = (exports, _, t, n) => getExportsBlock(exports
|
|
11234
|
-
.filter(expt => expt.hoisted || expt.uninitialized)
|
|
11235
|
-
.map(expt => ({ name: expt.exported, value: expt.uninitialized ? 'void 0' : expt.local })), _, t, n);
|
|
11251
|
+
const getHoistedExportsBlock = (exports, _, t, n) => getExportsBlock(exports.filter(expt => expt.hoisted).map(expt => ({ name: expt.exported, value: expt.local })), _, t, n);
|
|
11236
11252
|
const getMissingExportsBlock = (exports, _, t, n) => getExportsBlock(exports
|
|
11237
11253
|
.filter(expt => expt.local === MISSING_EXPORT_SHIM_VARIABLE)
|
|
11238
11254
|
.map(expt => ({ name: expt.exported, value: MISSING_EXPORT_SHIM_VARIABLE })), _, t, n);
|
|
@@ -11273,10 +11289,8 @@ function system(magicString, { accessedGlobals, dependencies, exports, hasExport
|
|
|
11273
11289
|
if (!starExcludes) {
|
|
11274
11290
|
starExcludes = getStarExcludes({ dependencies, exports });
|
|
11275
11291
|
}
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
createdSetter = true;
|
|
11279
|
-
}
|
|
11292
|
+
createdSetter = true;
|
|
11293
|
+
setter.push(`${varOrConst} _setter${_}=${_}{};`);
|
|
11280
11294
|
setter.push(`for${_}(var _$p${_}in${_}module)${_}{`);
|
|
11281
11295
|
setter.push(`${t}if${_}(!_starExcludes[_$p])${_}_setter[_$p]${_}=${_}module[_$p];`);
|
|
11282
11296
|
setter.push('}');
|
|
@@ -12306,7 +12320,7 @@ class Chunk {
|
|
|
12306
12320
|
if (namespace.renderFirst())
|
|
12307
12321
|
hoistedSource += n + rendered;
|
|
12308
12322
|
else
|
|
12309
|
-
magicString.addSource(new MagicString(rendered));
|
|
12323
|
+
magicString.addSource(new MagicString$1(rendered));
|
|
12310
12324
|
}
|
|
12311
12325
|
}
|
|
12312
12326
|
const { renderedExports, removedExports } = module.getRenderedExports();
|
|
@@ -12619,12 +12633,8 @@ class Chunk {
|
|
|
12619
12633
|
}
|
|
12620
12634
|
let expression = null;
|
|
12621
12635
|
let hoisted = false;
|
|
12622
|
-
let uninitialized = false;
|
|
12623
12636
|
let local = variable.getName();
|
|
12624
12637
|
if (variable instanceof LocalVariable) {
|
|
12625
|
-
if (variable.init === UNDEFINED_EXPRESSION) {
|
|
12626
|
-
uninitialized = true;
|
|
12627
|
-
}
|
|
12628
12638
|
for (const declaration of variable.declarations) {
|
|
12629
12639
|
if (declaration.parent instanceof FunctionDeclaration ||
|
|
12630
12640
|
(declaration instanceof ExportDefaultDeclaration &&
|
|
@@ -12636,7 +12646,7 @@ class Chunk {
|
|
|
12636
12646
|
}
|
|
12637
12647
|
else if (variable instanceof SyntheticNamedExportVariable) {
|
|
12638
12648
|
expression = local;
|
|
12639
|
-
if (format === 'es'
|
|
12649
|
+
if (format === 'es') {
|
|
12640
12650
|
local = variable.renderName;
|
|
12641
12651
|
}
|
|
12642
12652
|
}
|
|
@@ -12644,8 +12654,7 @@ class Chunk {
|
|
|
12644
12654
|
exported: exportName,
|
|
12645
12655
|
expression,
|
|
12646
12656
|
hoisted,
|
|
12647
|
-
local
|
|
12648
|
-
uninitialized
|
|
12657
|
+
local
|
|
12649
12658
|
});
|
|
12650
12659
|
}
|
|
12651
12660
|
return exports;
|
|
@@ -19438,7 +19447,7 @@ function transform(source, module, pluginDriver, warn) {
|
|
|
19438
19447
|
getCombinedSourcemap() {
|
|
19439
19448
|
const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, warn);
|
|
19440
19449
|
if (!combinedMap) {
|
|
19441
|
-
const magicString = new MagicString(originalCode);
|
|
19450
|
+
const magicString = new MagicString$1(originalCode);
|
|
19442
19451
|
return magicString.generateMap({ hires: true, includeContent: true, source: id });
|
|
19443
19452
|
}
|
|
19444
19453
|
if (originalSourcemap !== combinedMap) {
|
|
@@ -19589,12 +19598,10 @@ class ModuleLoader {
|
|
|
19589
19598
|
}));
|
|
19590
19599
|
}
|
|
19591
19600
|
async addModuleSource(id, importer, module) {
|
|
19592
|
-
var _a;
|
|
19593
19601
|
timeStart('load modules', 3);
|
|
19594
19602
|
let source;
|
|
19595
19603
|
try {
|
|
19596
|
-
source =
|
|
19597
|
-
(_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await this.readQueue.run(async () => readFile(id)));
|
|
19604
|
+
source = await this.readQueue.run(async () => { var _a; return (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await readFile(id)); });
|
|
19598
19605
|
}
|
|
19599
19606
|
catch (err) {
|
|
19600
19607
|
timeEnd('load modules', 3);
|
package/dist/es/shared/watch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
Sun,
|
|
3
|
+
Rollup.js v2.56.1
|
|
4
|
+
Sun, 08 Aug 2021 11:58:39 GMT - commit 2a097a809d7976d0684370fb14b61b3c2fa86bca
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -3974,6 +3974,8 @@ micromatch.braceExpand = (pattern, options) => {
|
|
|
3974
3974
|
|
|
3975
3975
|
var micromatch_1 = micromatch;
|
|
3976
3976
|
|
|
3977
|
+
var mm = micromatch_1;
|
|
3978
|
+
|
|
3977
3979
|
function ensureArray(thing) {
|
|
3978
3980
|
if (Array.isArray(thing))
|
|
3979
3981
|
return thing;
|
|
@@ -3994,7 +3996,7 @@ const createFilter = function createFilter(include, exclude, options) {
|
|
|
3994
3996
|
return id instanceof RegExp
|
|
3995
3997
|
? id
|
|
3996
3998
|
: {
|
|
3997
|
-
test:
|
|
3999
|
+
test: mm.matcher(getMatcherString(id, resolutionBase)
|
|
3998
4000
|
.split(sep)
|
|
3999
4001
|
.join('/'), { dot: true })
|
|
4000
4002
|
};
|
|
@@ -4185,7 +4187,7 @@ function mergeOutputOptions(config, overrides, warn) {
|
|
|
4185
4187
|
return outputOptions;
|
|
4186
4188
|
}
|
|
4187
4189
|
|
|
4188
|
-
var chokidar = {};
|
|
4190
|
+
var chokidar$1 = {};
|
|
4189
4191
|
|
|
4190
4192
|
const fs$3 = fs$4;
|
|
4191
4193
|
const { Readable } = require$$1;
|
|
@@ -7182,7 +7184,7 @@ _readdirp(root, opts) {
|
|
|
7182
7184
|
}
|
|
7183
7185
|
|
|
7184
7186
|
// Export FSWatcher class
|
|
7185
|
-
chokidar.FSWatcher = FSWatcher;
|
|
7187
|
+
chokidar$1.FSWatcher = FSWatcher;
|
|
7186
7188
|
|
|
7187
7189
|
/**
|
|
7188
7190
|
* Instantiates watcher with paths to be tracked.
|
|
@@ -7196,7 +7198,9 @@ const watch = (paths, options) => {
|
|
|
7196
7198
|
return watcher;
|
|
7197
7199
|
};
|
|
7198
7200
|
|
|
7199
|
-
chokidar.watch = watch;
|
|
7201
|
+
chokidar$1.watch = watch;
|
|
7202
|
+
|
|
7203
|
+
var chokidar = chokidar$1;
|
|
7200
7204
|
|
|
7201
7205
|
class FileWatcher {
|
|
7202
7206
|
constructor(task, chokidarOptions) {
|
package/dist/loadConfigFile.js
CHANGED