rollup 3.23.1 → 3.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +57 -12
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +57 -12
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch-proxy.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/bin/rollup
CHANGED
package/dist/es/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.24.0
|
|
4
|
+
Wed, 07 Jun 2023 04:46:58 GMT - commit bcd64961f92535d2d6d0b663d1e17a500374358b
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ import { createHash as createHash$1 } from 'node:crypto';
|
|
|
15
15
|
import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
|
|
16
16
|
import * as tty from 'tty';
|
|
17
17
|
|
|
18
|
-
var version$1 = "3.
|
|
18
|
+
var version$1 = "3.24.0";
|
|
19
19
|
|
|
20
20
|
const comma = ','.charCodeAt(0);
|
|
21
21
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -5539,7 +5539,10 @@ const BlockStatement$1 = 'BlockStatement';
|
|
|
5539
5539
|
const CallExpression$1 = 'CallExpression';
|
|
5540
5540
|
const ChainExpression$1 = 'ChainExpression';
|
|
5541
5541
|
const ConditionalExpression$1 = 'ConditionalExpression';
|
|
5542
|
+
const ExportDefaultDeclaration$1 = 'ExportDefaultDeclaration';
|
|
5543
|
+
const ExportNamedDeclaration$1 = 'ExportNamedDeclaration';
|
|
5542
5544
|
const ExpressionStatement$1 = 'ExpressionStatement';
|
|
5545
|
+
const FunctionDeclaration$1 = 'FunctionDeclaration';
|
|
5543
5546
|
const Identifier$1 = 'Identifier';
|
|
5544
5547
|
const LogicalExpression$1 = 'LogicalExpression';
|
|
5545
5548
|
const NewExpression$1 = 'NewExpression';
|
|
@@ -5547,6 +5550,8 @@ const Program$1 = 'Program';
|
|
|
5547
5550
|
const Property$1 = 'Property';
|
|
5548
5551
|
const ReturnStatement$1 = 'ReturnStatement';
|
|
5549
5552
|
const SequenceExpression$1 = 'SequenceExpression';
|
|
5553
|
+
const VariableDeclarator$1 = 'VariableDeclarator';
|
|
5554
|
+
const VariableDeclaration$1 = 'VariableDeclaration';
|
|
5550
5555
|
|
|
5551
5556
|
// this looks ridiculous, but it prevents sourcemap tooling from mistaking
|
|
5552
5557
|
// this for an actual sourceMappingURL
|
|
@@ -5618,6 +5623,28 @@ function markPureNode(node, comment, code) {
|
|
|
5618
5623
|
invalidAnnotation = true;
|
|
5619
5624
|
break;
|
|
5620
5625
|
}
|
|
5626
|
+
case ExportNamedDeclaration$1:
|
|
5627
|
+
case ExportDefaultDeclaration$1: {
|
|
5628
|
+
node = node.declaration;
|
|
5629
|
+
continue;
|
|
5630
|
+
}
|
|
5631
|
+
case VariableDeclaration$1: {
|
|
5632
|
+
|
|
5633
|
+
const declaration = node;
|
|
5634
|
+
if (declaration.kind === 'const') {
|
|
5635
|
+
// jsdoc only applies to the first declaration
|
|
5636
|
+
node = declaration.declarations[0].init;
|
|
5637
|
+
continue;
|
|
5638
|
+
}
|
|
5639
|
+
invalidAnnotation = true;
|
|
5640
|
+
break;
|
|
5641
|
+
}
|
|
5642
|
+
case VariableDeclarator$1: {
|
|
5643
|
+
node = node.init;
|
|
5644
|
+
continue;
|
|
5645
|
+
}
|
|
5646
|
+
case FunctionDeclaration$1:
|
|
5647
|
+
case ArrowFunctionExpression$1:
|
|
5621
5648
|
case CallExpression$1:
|
|
5622
5649
|
case NewExpression$1: {
|
|
5623
5650
|
break;
|
|
@@ -5660,15 +5687,20 @@ function doesNotMatchOutsideComment(code, forbiddenChars) {
|
|
|
5660
5687
|
}
|
|
5661
5688
|
return true;
|
|
5662
5689
|
}
|
|
5663
|
-
const
|
|
5690
|
+
const annotationsRegexes = [
|
|
5691
|
+
['pure', /[#@]__PURE__/],
|
|
5692
|
+
['noSideEffects', /[#@]__NO_SIDE_EFFECTS__/]
|
|
5693
|
+
];
|
|
5664
5694
|
function addAnnotations(comments, esTreeAst, code) {
|
|
5665
5695
|
const annotations = [];
|
|
5666
5696
|
const sourceMappingComments = [];
|
|
5667
5697
|
for (const comment of comments) {
|
|
5668
|
-
|
|
5669
|
-
|
|
5698
|
+
for (const [annotationType, regex] of annotationsRegexes) {
|
|
5699
|
+
if (regex.test(comment.value)) {
|
|
5700
|
+
annotations.push({ ...comment, annotationType });
|
|
5701
|
+
}
|
|
5670
5702
|
}
|
|
5671
|
-
|
|
5703
|
+
if (SOURCEMAPPING_URL_RE.test(comment.value)) {
|
|
5672
5704
|
sourceMappingComments.push(comment);
|
|
5673
5705
|
}
|
|
5674
5706
|
}
|
|
@@ -5812,7 +5844,12 @@ class NodeBase extends ExpressionEntity {
|
|
|
5812
5844
|
continue;
|
|
5813
5845
|
if (key.charCodeAt(0) === 95 /* _ */) {
|
|
5814
5846
|
if (key === ANNOTATION_KEY) {
|
|
5815
|
-
|
|
5847
|
+
const annotations = value;
|
|
5848
|
+
this.annotations = annotations;
|
|
5849
|
+
if (this.context.options.treeshake.annotations) {
|
|
5850
|
+
this.annotationNoSideEffects = annotations.some(comment => comment.annotationType === 'noSideEffects');
|
|
5851
|
+
this.annotationPure = annotations.some(comment => comment.annotationType === 'pure');
|
|
5852
|
+
}
|
|
5816
5853
|
}
|
|
5817
5854
|
else if (key === INVALID_COMMENT_KEY) {
|
|
5818
5855
|
for (const { start, end } of value)
|
|
@@ -8730,6 +8767,9 @@ class ArrowFunctionExpression extends FunctionBase {
|
|
|
8730
8767
|
if (super.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
8731
8768
|
return true;
|
|
8732
8769
|
if (interaction.type === INTERACTION_CALLED) {
|
|
8770
|
+
if (this.annotationNoSideEffects) {
|
|
8771
|
+
return false;
|
|
8772
|
+
}
|
|
8733
8773
|
const { ignore, brokenFlow } = context;
|
|
8734
8774
|
context.ignore = {
|
|
8735
8775
|
breaks: false,
|
|
@@ -9034,11 +9074,17 @@ class FunctionNode extends FunctionBase {
|
|
|
9034
9074
|
hasEffects(context) {
|
|
9035
9075
|
if (!this.deoptimized)
|
|
9036
9076
|
this.applyDeoptimizations();
|
|
9077
|
+
if (this.annotationNoSideEffects) {
|
|
9078
|
+
return false;
|
|
9079
|
+
}
|
|
9037
9080
|
return !!this.id?.hasEffects(context);
|
|
9038
9081
|
}
|
|
9039
9082
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
9040
9083
|
if (super.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
9041
9084
|
return true;
|
|
9085
|
+
if (this.annotationNoSideEffects) {
|
|
9086
|
+
return false;
|
|
9087
|
+
}
|
|
9042
9088
|
if (interaction.type === INTERACTION_CALLED) {
|
|
9043
9089
|
const thisInit = context.replacedVariableInits.get(this.scope.thisVariable);
|
|
9044
9090
|
context.replacedVariableInits.set(this.scope.thisVariable, interaction.withNew ? this.constructedEntity : UNKNOWN_EXPRESSION);
|
|
@@ -9710,9 +9756,9 @@ class CallExpression extends CallExpressionBase {
|
|
|
9710
9756
|
if (argument.hasEffects(context))
|
|
9711
9757
|
return true;
|
|
9712
9758
|
}
|
|
9713
|
-
if (this.
|
|
9714
|
-
this.annotations)
|
|
9759
|
+
if (this.annotationPure) {
|
|
9715
9760
|
return false;
|
|
9761
|
+
}
|
|
9716
9762
|
return (this.callee.hasEffects(context) ||
|
|
9717
9763
|
this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
|
|
9718
9764
|
}
|
|
@@ -11683,8 +11729,7 @@ class NewExpression extends NodeBase {
|
|
|
11683
11729
|
if (argument.hasEffects(context))
|
|
11684
11730
|
return true;
|
|
11685
11731
|
}
|
|
11686
|
-
if (this.
|
|
11687
|
-
this.annotations) {
|
|
11732
|
+
if (this.annotationPure) {
|
|
11688
11733
|
return false;
|
|
11689
11734
|
}
|
|
11690
11735
|
return (this.callee.hasEffects(context) ||
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.24.0
|
|
4
|
+
Wed, 07 Jun 2023 04:46:58 GMT - commit bcd64961f92535d2d6d0b663d1e17a500374358b
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ function _interopNamespaceDefault(e) {
|
|
|
30
30
|
|
|
31
31
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
32
32
|
|
|
33
|
-
var version$1 = "3.
|
|
33
|
+
var version$1 = "3.24.0";
|
|
34
34
|
|
|
35
35
|
function ensureArray$1(items) {
|
|
36
36
|
if (Array.isArray(items)) {
|
|
@@ -6034,7 +6034,10 @@ const BlockStatement$1 = 'BlockStatement';
|
|
|
6034
6034
|
const CallExpression$1 = 'CallExpression';
|
|
6035
6035
|
const ChainExpression$1 = 'ChainExpression';
|
|
6036
6036
|
const ConditionalExpression$1 = 'ConditionalExpression';
|
|
6037
|
+
const ExportDefaultDeclaration$1 = 'ExportDefaultDeclaration';
|
|
6038
|
+
const ExportNamedDeclaration$1 = 'ExportNamedDeclaration';
|
|
6037
6039
|
const ExpressionStatement$1 = 'ExpressionStatement';
|
|
6040
|
+
const FunctionDeclaration$1 = 'FunctionDeclaration';
|
|
6038
6041
|
const Identifier$1 = 'Identifier';
|
|
6039
6042
|
const LogicalExpression$1 = 'LogicalExpression';
|
|
6040
6043
|
const NewExpression$1 = 'NewExpression';
|
|
@@ -6042,6 +6045,8 @@ const Program$1 = 'Program';
|
|
|
6042
6045
|
const Property$1 = 'Property';
|
|
6043
6046
|
const ReturnStatement$1 = 'ReturnStatement';
|
|
6044
6047
|
const SequenceExpression$1 = 'SequenceExpression';
|
|
6048
|
+
const VariableDeclarator$1 = 'VariableDeclarator';
|
|
6049
|
+
const VariableDeclaration$1 = 'VariableDeclaration';
|
|
6045
6050
|
|
|
6046
6051
|
// this looks ridiculous, but it prevents sourcemap tooling from mistaking
|
|
6047
6052
|
// this for an actual sourceMappingURL
|
|
@@ -6113,6 +6118,28 @@ function markPureNode(node, comment, code) {
|
|
|
6113
6118
|
invalidAnnotation = true;
|
|
6114
6119
|
break;
|
|
6115
6120
|
}
|
|
6121
|
+
case ExportNamedDeclaration$1:
|
|
6122
|
+
case ExportDefaultDeclaration$1: {
|
|
6123
|
+
node = node.declaration;
|
|
6124
|
+
continue;
|
|
6125
|
+
}
|
|
6126
|
+
case VariableDeclaration$1: {
|
|
6127
|
+
|
|
6128
|
+
const declaration = node;
|
|
6129
|
+
if (declaration.kind === 'const') {
|
|
6130
|
+
// jsdoc only applies to the first declaration
|
|
6131
|
+
node = declaration.declarations[0].init;
|
|
6132
|
+
continue;
|
|
6133
|
+
}
|
|
6134
|
+
invalidAnnotation = true;
|
|
6135
|
+
break;
|
|
6136
|
+
}
|
|
6137
|
+
case VariableDeclarator$1: {
|
|
6138
|
+
node = node.init;
|
|
6139
|
+
continue;
|
|
6140
|
+
}
|
|
6141
|
+
case FunctionDeclaration$1:
|
|
6142
|
+
case ArrowFunctionExpression$1:
|
|
6116
6143
|
case CallExpression$1:
|
|
6117
6144
|
case NewExpression$1: {
|
|
6118
6145
|
break;
|
|
@@ -6155,15 +6182,20 @@ function doesNotMatchOutsideComment(code, forbiddenChars) {
|
|
|
6155
6182
|
}
|
|
6156
6183
|
return true;
|
|
6157
6184
|
}
|
|
6158
|
-
const
|
|
6185
|
+
const annotationsRegexes = [
|
|
6186
|
+
['pure', /[#@]__PURE__/],
|
|
6187
|
+
['noSideEffects', /[#@]__NO_SIDE_EFFECTS__/]
|
|
6188
|
+
];
|
|
6159
6189
|
function addAnnotations(comments, esTreeAst, code) {
|
|
6160
6190
|
const annotations = [];
|
|
6161
6191
|
const sourceMappingComments = [];
|
|
6162
6192
|
for (const comment of comments) {
|
|
6163
|
-
|
|
6164
|
-
|
|
6193
|
+
for (const [annotationType, regex] of annotationsRegexes) {
|
|
6194
|
+
if (regex.test(comment.value)) {
|
|
6195
|
+
annotations.push({ ...comment, annotationType });
|
|
6196
|
+
}
|
|
6165
6197
|
}
|
|
6166
|
-
|
|
6198
|
+
if (SOURCEMAPPING_URL_RE.test(comment.value)) {
|
|
6167
6199
|
sourceMappingComments.push(comment);
|
|
6168
6200
|
}
|
|
6169
6201
|
}
|
|
@@ -6307,7 +6339,12 @@ class NodeBase extends ExpressionEntity {
|
|
|
6307
6339
|
continue;
|
|
6308
6340
|
if (key.charCodeAt(0) === 95 /* _ */) {
|
|
6309
6341
|
if (key === ANNOTATION_KEY) {
|
|
6310
|
-
|
|
6342
|
+
const annotations = value;
|
|
6343
|
+
this.annotations = annotations;
|
|
6344
|
+
if (this.context.options.treeshake.annotations) {
|
|
6345
|
+
this.annotationNoSideEffects = annotations.some(comment => comment.annotationType === 'noSideEffects');
|
|
6346
|
+
this.annotationPure = annotations.some(comment => comment.annotationType === 'pure');
|
|
6347
|
+
}
|
|
6311
6348
|
}
|
|
6312
6349
|
else if (key === INVALID_COMMENT_KEY) {
|
|
6313
6350
|
for (const { start, end } of value)
|
|
@@ -9225,6 +9262,9 @@ class ArrowFunctionExpression extends FunctionBase {
|
|
|
9225
9262
|
if (super.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
9226
9263
|
return true;
|
|
9227
9264
|
if (interaction.type === INTERACTION_CALLED) {
|
|
9265
|
+
if (this.annotationNoSideEffects) {
|
|
9266
|
+
return false;
|
|
9267
|
+
}
|
|
9228
9268
|
const { ignore, brokenFlow } = context;
|
|
9229
9269
|
context.ignore = {
|
|
9230
9270
|
breaks: false,
|
|
@@ -9529,11 +9569,17 @@ class FunctionNode extends FunctionBase {
|
|
|
9529
9569
|
hasEffects(context) {
|
|
9530
9570
|
if (!this.deoptimized)
|
|
9531
9571
|
this.applyDeoptimizations();
|
|
9572
|
+
if (this.annotationNoSideEffects) {
|
|
9573
|
+
return false;
|
|
9574
|
+
}
|
|
9532
9575
|
return !!this.id?.hasEffects(context);
|
|
9533
9576
|
}
|
|
9534
9577
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
9535
9578
|
if (super.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
9536
9579
|
return true;
|
|
9580
|
+
if (this.annotationNoSideEffects) {
|
|
9581
|
+
return false;
|
|
9582
|
+
}
|
|
9537
9583
|
if (interaction.type === INTERACTION_CALLED) {
|
|
9538
9584
|
const thisInit = context.replacedVariableInits.get(this.scope.thisVariable);
|
|
9539
9585
|
context.replacedVariableInits.set(this.scope.thisVariable, interaction.withNew ? this.constructedEntity : UNKNOWN_EXPRESSION);
|
|
@@ -10205,9 +10251,9 @@ class CallExpression extends CallExpressionBase {
|
|
|
10205
10251
|
if (argument.hasEffects(context))
|
|
10206
10252
|
return true;
|
|
10207
10253
|
}
|
|
10208
|
-
if (this.
|
|
10209
|
-
this.annotations)
|
|
10254
|
+
if (this.annotationPure) {
|
|
10210
10255
|
return false;
|
|
10256
|
+
}
|
|
10211
10257
|
return (this.callee.hasEffects(context) ||
|
|
10212
10258
|
this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
|
|
10213
10259
|
}
|
|
@@ -12178,8 +12224,7 @@ class NewExpression extends NodeBase {
|
|
|
12178
12224
|
if (argument.hasEffects(context))
|
|
12179
12225
|
return true;
|
|
12180
12226
|
}
|
|
12181
|
-
if (this.
|
|
12182
|
-
this.annotations) {
|
|
12227
|
+
if (this.annotationPure) {
|
|
12183
12228
|
return false;
|
|
12184
12229
|
}
|
|
12185
12230
|
return (this.callee.hasEffects(context) ||
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED