rollup 3.3.0 → 3.4.0-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/rollup.js +37 -4
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.d.ts +1 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +41 -8
- package/dist/shared/watch-cli.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
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.4.0-0
|
|
4
|
+
Fri, 18 Nov 2022 07:39:24 GMT - commit 6c70b960636630638055594175dbfed0d4b7cd15
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ import { promises } from 'node:fs';
|
|
|
16
16
|
import { EventEmitter } from 'node:events';
|
|
17
17
|
import * as tty from 'tty';
|
|
18
18
|
|
|
19
|
-
var version$1 = "3.
|
|
19
|
+
var version$1 = "3.4.0-0";
|
|
20
20
|
|
|
21
21
|
var charToInteger = {};
|
|
22
22
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -6840,6 +6840,19 @@ function is_reference (node, parent) {
|
|
|
6840
6840
|
return false;
|
|
6841
6841
|
}
|
|
6842
6842
|
|
|
6843
|
+
const PureFunctionKey = Symbol('PureFunction');
|
|
6844
|
+
const getPureFunctions = ({ treeshake }) => {
|
|
6845
|
+
const pureFunctions = Object.create(null);
|
|
6846
|
+
for (const functionName of treeshake ? treeshake.manualPureFunctions : []) {
|
|
6847
|
+
let currentFunctions = pureFunctions;
|
|
6848
|
+
for (const pathSegment of functionName.split('.')) {
|
|
6849
|
+
currentFunctions = currentFunctions[pathSegment] || (currentFunctions[pathSegment] = Object.create(null));
|
|
6850
|
+
}
|
|
6851
|
+
currentFunctions[PureFunctionKey] = true;
|
|
6852
|
+
}
|
|
6853
|
+
return pureFunctions;
|
|
6854
|
+
};
|
|
6855
|
+
|
|
6843
6856
|
/* eslint sort-keys: "off" */
|
|
6844
6857
|
const ValueProperties = Symbol('Value Properties');
|
|
6845
6858
|
const getTruthyLiteralValue = () => UnknownTruthyValue;
|
|
@@ -7833,13 +7846,15 @@ class Identifier extends NodeBase {
|
|
|
7833
7846
|
switch (interaction.type) {
|
|
7834
7847
|
case INTERACTION_ACCESSED: {
|
|
7835
7848
|
return (this.variable !== null &&
|
|
7849
|
+
!this.isPureFunction(path) &&
|
|
7836
7850
|
this.getVariableRespectingTDZ().hasEffectsOnInteractionAtPath(path, interaction, context));
|
|
7837
7851
|
}
|
|
7838
7852
|
case INTERACTION_ASSIGNED: {
|
|
7839
7853
|
return (path.length > 0 ? this.getVariableRespectingTDZ() : this.variable).hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
7840
7854
|
}
|
|
7841
7855
|
case INTERACTION_CALLED: {
|
|
7842
|
-
return this.
|
|
7856
|
+
return (!this.isPureFunction(path) &&
|
|
7857
|
+
this.getVariableRespectingTDZ().hasEffectsOnInteractionAtPath(path, interaction, context));
|
|
7843
7858
|
}
|
|
7844
7859
|
}
|
|
7845
7860
|
}
|
|
@@ -7921,6 +7936,18 @@ class Identifier extends NodeBase {
|
|
|
7921
7936
|
}
|
|
7922
7937
|
return this.variable;
|
|
7923
7938
|
}
|
|
7939
|
+
isPureFunction(path) {
|
|
7940
|
+
let currentPureFunction = this.context.manualPureFunctions[this.name];
|
|
7941
|
+
for (const segment of path) {
|
|
7942
|
+
if (currentPureFunction) {
|
|
7943
|
+
currentPureFunction = currentPureFunction[segment];
|
|
7944
|
+
}
|
|
7945
|
+
else {
|
|
7946
|
+
return false;
|
|
7947
|
+
}
|
|
7948
|
+
}
|
|
7949
|
+
return currentPureFunction?.[PureFunctionKey];
|
|
7950
|
+
}
|
|
7924
7951
|
}
|
|
7925
7952
|
function closestParentFunctionOrProgram(node) {
|
|
7926
7953
|
while (node && !/^Program|Function/.test(node.type)) {
|
|
@@ -13155,6 +13182,7 @@ class Module {
|
|
|
13155
13182
|
includeDynamicImport: this.includeDynamicImport.bind(this),
|
|
13156
13183
|
includeVariableInModule: this.includeVariableInModule.bind(this),
|
|
13157
13184
|
magicString: this.magicString,
|
|
13185
|
+
manualPureFunctions: this.graph.pureFunctions,
|
|
13158
13186
|
module: this,
|
|
13159
13187
|
moduleContext: this.context,
|
|
13160
13188
|
options: this.options,
|
|
@@ -23476,6 +23504,7 @@ class Graph {
|
|
|
23476
23504
|
this.acornParser = Parser.extend(...options.acornInjectPlugins);
|
|
23477
23505
|
this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
|
|
23478
23506
|
this.fileOperationQueue = new Queue(options.maxParallelFileOps);
|
|
23507
|
+
this.pureFunctions = getPureFunctions(options);
|
|
23479
23508
|
}
|
|
23480
23509
|
async build() {
|
|
23481
23510
|
timeStart('generate module graph', 2);
|
|
@@ -23975,6 +24004,7 @@ const treeshakePresets = {
|
|
|
23975
24004
|
recommended: {
|
|
23976
24005
|
annotations: true,
|
|
23977
24006
|
correctVarValueBeforeDeclaration: false,
|
|
24007
|
+
manualPureFunctions: EMPTY_ARRAY,
|
|
23978
24008
|
moduleSideEffects: () => true,
|
|
23979
24009
|
propertyReadSideEffects: true,
|
|
23980
24010
|
tryCatchDeoptimization: true,
|
|
@@ -23983,6 +24013,7 @@ const treeshakePresets = {
|
|
|
23983
24013
|
safest: {
|
|
23984
24014
|
annotations: true,
|
|
23985
24015
|
correctVarValueBeforeDeclaration: true,
|
|
24016
|
+
manualPureFunctions: EMPTY_ARRAY,
|
|
23986
24017
|
moduleSideEffects: () => true,
|
|
23987
24018
|
propertyReadSideEffects: true,
|
|
23988
24019
|
tryCatchDeoptimization: true,
|
|
@@ -23991,6 +24022,7 @@ const treeshakePresets = {
|
|
|
23991
24022
|
smallest: {
|
|
23992
24023
|
annotations: true,
|
|
23993
24024
|
correctVarValueBeforeDeclaration: false,
|
|
24025
|
+
manualPureFunctions: EMPTY_ARRAY,
|
|
23994
24026
|
moduleSideEffects: () => false,
|
|
23995
24027
|
propertyReadSideEffects: false,
|
|
23996
24028
|
tryCatchDeoptimization: false,
|
|
@@ -24187,6 +24219,7 @@ const getTreeshake = (config) => {
|
|
|
24187
24219
|
return {
|
|
24188
24220
|
annotations: configWithPreset.annotations !== false,
|
|
24189
24221
|
correctVarValueBeforeDeclaration: configWithPreset.correctVarValueBeforeDeclaration === true,
|
|
24222
|
+
manualPureFunctions: configWithPreset.manualPureFunctions ?? EMPTY_ARRAY,
|
|
24190
24223
|
moduleSideEffects: getHasModuleSideEffects(configWithPreset.moduleSideEffects),
|
|
24191
24224
|
propertyReadSideEffects: configWithPreset.propertyReadSideEffects === 'always'
|
|
24192
24225
|
? 'always'
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
package/dist/rollup.d.ts
CHANGED
|
@@ -466,6 +466,7 @@ type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
|
|
|
466
466
|
export interface NormalizedTreeshakingOptions {
|
|
467
467
|
annotations: boolean;
|
|
468
468
|
correctVarValueBeforeDeclaration: boolean;
|
|
469
|
+
manualPureFunctions: readonly string[];
|
|
469
470
|
moduleSideEffects: HasModuleSideEffects;
|
|
470
471
|
propertyReadSideEffects: boolean | 'always';
|
|
471
472
|
tryCatchDeoptimization: boolean;
|
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.4.0-0
|
|
4
|
+
Fri, 18 Nov 2022 07:39:24 GMT - commit 6c70b960636630638055594175dbfed0d4b7cd15
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version$1 = "3.
|
|
34
|
+
var version$1 = "3.4.0-0";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -50,6 +50,10 @@ async function asyncFlatten(array) {
|
|
|
50
50
|
return array;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
const BLANK = Object.freeze(Object.create(null));
|
|
54
|
+
const EMPTY_OBJECT = Object.freeze({});
|
|
55
|
+
const EMPTY_ARRAY = Object.freeze([]);
|
|
56
|
+
|
|
53
57
|
function getLocator$1(source, options) {
|
|
54
58
|
if (options === void 0) { options = {}; }
|
|
55
59
|
var offsetLine = options.offsetLine || 0;
|
|
@@ -814,6 +818,7 @@ const treeshakePresets = {
|
|
|
814
818
|
recommended: {
|
|
815
819
|
annotations: true,
|
|
816
820
|
correctVarValueBeforeDeclaration: false,
|
|
821
|
+
manualPureFunctions: EMPTY_ARRAY,
|
|
817
822
|
moduleSideEffects: () => true,
|
|
818
823
|
propertyReadSideEffects: true,
|
|
819
824
|
tryCatchDeoptimization: true,
|
|
@@ -822,6 +827,7 @@ const treeshakePresets = {
|
|
|
822
827
|
safest: {
|
|
823
828
|
annotations: true,
|
|
824
829
|
correctVarValueBeforeDeclaration: true,
|
|
830
|
+
manualPureFunctions: EMPTY_ARRAY,
|
|
825
831
|
moduleSideEffects: () => true,
|
|
826
832
|
propertyReadSideEffects: true,
|
|
827
833
|
tryCatchDeoptimization: true,
|
|
@@ -830,6 +836,7 @@ const treeshakePresets = {
|
|
|
830
836
|
smallest: {
|
|
831
837
|
annotations: true,
|
|
832
838
|
correctVarValueBeforeDeclaration: false,
|
|
839
|
+
manualPureFunctions: EMPTY_ARRAY,
|
|
833
840
|
moduleSideEffects: () => false,
|
|
834
841
|
propertyReadSideEffects: false,
|
|
835
842
|
tryCatchDeoptimization: false,
|
|
@@ -3035,10 +3042,6 @@ class ExternalVariable extends Variable {
|
|
|
3035
3042
|
}
|
|
3036
3043
|
}
|
|
3037
3044
|
|
|
3038
|
-
const BLANK = Object.freeze(Object.create(null));
|
|
3039
|
-
const EMPTY_OBJECT = Object.freeze({});
|
|
3040
|
-
const EMPTY_ARRAY = Object.freeze([]);
|
|
3041
|
-
|
|
3042
3045
|
const RESERVED_NAMES = new Set([
|
|
3043
3046
|
'await',
|
|
3044
3047
|
'break',
|
|
@@ -7352,6 +7355,19 @@ function is_reference (node, parent) {
|
|
|
7352
7355
|
return false;
|
|
7353
7356
|
}
|
|
7354
7357
|
|
|
7358
|
+
const PureFunctionKey = Symbol('PureFunction');
|
|
7359
|
+
const getPureFunctions = ({ treeshake }) => {
|
|
7360
|
+
const pureFunctions = Object.create(null);
|
|
7361
|
+
for (const functionName of treeshake ? treeshake.manualPureFunctions : []) {
|
|
7362
|
+
let currentFunctions = pureFunctions;
|
|
7363
|
+
for (const pathSegment of functionName.split('.')) {
|
|
7364
|
+
currentFunctions = currentFunctions[pathSegment] || (currentFunctions[pathSegment] = Object.create(null));
|
|
7365
|
+
}
|
|
7366
|
+
currentFunctions[PureFunctionKey] = true;
|
|
7367
|
+
}
|
|
7368
|
+
return pureFunctions;
|
|
7369
|
+
};
|
|
7370
|
+
|
|
7355
7371
|
/* eslint sort-keys: "off" */
|
|
7356
7372
|
const ValueProperties = Symbol('Value Properties');
|
|
7357
7373
|
const getTruthyLiteralValue = () => UnknownTruthyValue;
|
|
@@ -8345,13 +8361,15 @@ class Identifier extends NodeBase {
|
|
|
8345
8361
|
switch (interaction.type) {
|
|
8346
8362
|
case INTERACTION_ACCESSED: {
|
|
8347
8363
|
return (this.variable !== null &&
|
|
8364
|
+
!this.isPureFunction(path) &&
|
|
8348
8365
|
this.getVariableRespectingTDZ().hasEffectsOnInteractionAtPath(path, interaction, context));
|
|
8349
8366
|
}
|
|
8350
8367
|
case INTERACTION_ASSIGNED: {
|
|
8351
8368
|
return (path.length > 0 ? this.getVariableRespectingTDZ() : this.variable).hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
8352
8369
|
}
|
|
8353
8370
|
case INTERACTION_CALLED: {
|
|
8354
|
-
return this.
|
|
8371
|
+
return (!this.isPureFunction(path) &&
|
|
8372
|
+
this.getVariableRespectingTDZ().hasEffectsOnInteractionAtPath(path, interaction, context));
|
|
8355
8373
|
}
|
|
8356
8374
|
}
|
|
8357
8375
|
}
|
|
@@ -8433,6 +8451,18 @@ class Identifier extends NodeBase {
|
|
|
8433
8451
|
}
|
|
8434
8452
|
return this.variable;
|
|
8435
8453
|
}
|
|
8454
|
+
isPureFunction(path) {
|
|
8455
|
+
let currentPureFunction = this.context.manualPureFunctions[this.name];
|
|
8456
|
+
for (const segment of path) {
|
|
8457
|
+
if (currentPureFunction) {
|
|
8458
|
+
currentPureFunction = currentPureFunction[segment];
|
|
8459
|
+
}
|
|
8460
|
+
else {
|
|
8461
|
+
return false;
|
|
8462
|
+
}
|
|
8463
|
+
}
|
|
8464
|
+
return currentPureFunction?.[PureFunctionKey];
|
|
8465
|
+
}
|
|
8436
8466
|
}
|
|
8437
8467
|
function closestParentFunctionOrProgram(node) {
|
|
8438
8468
|
while (node && !/^Program|Function/.test(node.type)) {
|
|
@@ -13667,6 +13697,7 @@ class Module {
|
|
|
13667
13697
|
includeDynamicImport: this.includeDynamicImport.bind(this),
|
|
13668
13698
|
includeVariableInModule: this.includeVariableInModule.bind(this),
|
|
13669
13699
|
magicString: this.magicString,
|
|
13700
|
+
manualPureFunctions: this.graph.pureFunctions,
|
|
13670
13701
|
module: this,
|
|
13671
13702
|
moduleContext: this.context,
|
|
13672
13703
|
options: this.options,
|
|
@@ -23988,6 +24019,7 @@ class Graph {
|
|
|
23988
24019
|
this.acornParser = Parser.extend(...options.acornInjectPlugins);
|
|
23989
24020
|
this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
|
|
23990
24021
|
this.fileOperationQueue = new Queue(options.maxParallelFileOps);
|
|
24022
|
+
this.pureFunctions = getPureFunctions(options);
|
|
23991
24023
|
}
|
|
23992
24024
|
async build() {
|
|
23993
24025
|
timeStart('generate module graph', 2);
|
|
@@ -24605,6 +24637,7 @@ const getTreeshake = (config) => {
|
|
|
24605
24637
|
return {
|
|
24606
24638
|
annotations: configWithPreset.annotations !== false,
|
|
24607
24639
|
correctVarValueBeforeDeclaration: configWithPreset.correctVarValueBeforeDeclaration === true,
|
|
24640
|
+
manualPureFunctions: configWithPreset.manualPureFunctions ?? EMPTY_ARRAY,
|
|
24608
24641
|
moduleSideEffects: getHasModuleSideEffects(configWithPreset.moduleSideEffects),
|
|
24609
24642
|
propertyReadSideEffects: configWithPreset.propertyReadSideEffects === 'always'
|
|
24610
24643
|
? 'always'
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED