rollup 2.53.0 → 2.54.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/CHANGELOG.md +44 -0
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +88 -41
- package/dist/es/shared/watch.js +2 -2
- 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 +2 -2
- package/dist/shared/loadConfigFile.js +3 -3
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +88 -41
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.54.0
|
|
4
|
+
Sun, 25 Jul 2021 05:15:03 GMT - commit f90e1a2d9a1822b70ffb532a25404e2f45f17f5b
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -153,7 +153,7 @@ function batchWarnings() {
|
|
|
153
153
|
const immediateHandlers = {
|
|
154
154
|
MISSING_NODE_BUILTINS: warning => {
|
|
155
155
|
title(`Missing shims for Node.js built-ins`);
|
|
156
|
-
stderr(`Creating a browser bundle that depends on ${rollup.printQuotedStringList(warning.modules)}. You might need to include https://github.com/
|
|
156
|
+
stderr(`Creating a browser bundle that depends on ${rollup.printQuotedStringList(warning.modules)}. You might need to include https://github.com/snowpackjs/rollup-plugin-polyfill-node`);
|
|
157
157
|
},
|
|
158
158
|
UNKNOWN_OPTION: warning => {
|
|
159
159
|
title(`You have passed an unrecognized option`);
|
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.54.0
|
|
4
|
+
Sun, 25 Jul 2021 05:15:03 GMT - commit f90e1a2d9a1822b70ffb532a25404e2f45f17f5b
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -19,7 +19,7 @@ function _interopNamespaceDefaultOnly(e) {
|
|
|
19
19
|
return {__proto__: null, 'default': e};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
var version$1 = "2.
|
|
22
|
+
var version$1 = "2.54.0";
|
|
23
23
|
|
|
24
24
|
function ensureArray(items) {
|
|
25
25
|
if (Array.isArray(items)) {
|
|
@@ -3389,13 +3389,11 @@ function getMemberReturnExpressionWhenCalled(members, memberName) {
|
|
|
3389
3389
|
return members[memberName].returns;
|
|
3390
3390
|
}
|
|
3391
3391
|
|
|
3392
|
-
// To avoid infinite recursions
|
|
3393
|
-
const MAX_PATH_DEPTH = 7;
|
|
3394
3392
|
class LocalVariable extends Variable {
|
|
3395
3393
|
constructor(name, declarator, init, context) {
|
|
3396
3394
|
super(name);
|
|
3397
|
-
this.additionalInitializers = null;
|
|
3398
3395
|
this.calledFromTryStatement = false;
|
|
3396
|
+
this.additionalInitializers = null;
|
|
3399
3397
|
this.expressionsToBeDeoptimized = [];
|
|
3400
3398
|
this.declarations = declarator ? [declarator] : [];
|
|
3401
3399
|
this.init = init;
|
|
@@ -3404,13 +3402,9 @@ class LocalVariable extends Variable {
|
|
|
3404
3402
|
}
|
|
3405
3403
|
addDeclaration(identifier, init) {
|
|
3406
3404
|
this.declarations.push(identifier);
|
|
3407
|
-
|
|
3408
|
-
this.additionalInitializers = this.init === null ? [] : [this.init];
|
|
3409
|
-
this.init = UNKNOWN_EXPRESSION;
|
|
3410
|
-
this.isReassigned = true;
|
|
3411
|
-
}
|
|
3405
|
+
const additionalInitializers = this.markInitializersForDeoptimization();
|
|
3412
3406
|
if (init !== null) {
|
|
3413
|
-
|
|
3407
|
+
additionalInitializers.push(init);
|
|
3414
3408
|
}
|
|
3415
3409
|
}
|
|
3416
3410
|
consolidateInitializers() {
|
|
@@ -3423,8 +3417,7 @@ class LocalVariable extends Variable {
|
|
|
3423
3417
|
}
|
|
3424
3418
|
deoptimizePath(path) {
|
|
3425
3419
|
var _a, _b;
|
|
3426
|
-
if (
|
|
3427
|
-
this.isReassigned ||
|
|
3420
|
+
if (this.isReassigned ||
|
|
3428
3421
|
this.deoptimizationTracker.trackEntityAtPathAndGetIfTracked(path, this)) {
|
|
3429
3422
|
return;
|
|
3430
3423
|
}
|
|
@@ -3444,13 +3437,13 @@ class LocalVariable extends Variable {
|
|
|
3444
3437
|
}
|
|
3445
3438
|
}
|
|
3446
3439
|
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
3447
|
-
if (this.isReassigned || !this.init
|
|
3440
|
+
if (this.isReassigned || !this.init) {
|
|
3448
3441
|
return thisParameter.deoptimizePath(UNKNOWN_PATH);
|
|
3449
3442
|
}
|
|
3450
3443
|
recursionTracker.withTrackedEntityAtPath(path, this.init, () => this.init.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker), undefined);
|
|
3451
3444
|
}
|
|
3452
3445
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
3453
|
-
if (this.isReassigned || !this.init
|
|
3446
|
+
if (this.isReassigned || !this.init) {
|
|
3454
3447
|
return UnknownValue;
|
|
3455
3448
|
}
|
|
3456
3449
|
return recursionTracker.withTrackedEntityAtPath(path, this.init, () => {
|
|
@@ -3459,7 +3452,7 @@ class LocalVariable extends Variable {
|
|
|
3459
3452
|
}, UnknownValue);
|
|
3460
3453
|
}
|
|
3461
3454
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
3462
|
-
if (this.isReassigned || !this.init
|
|
3455
|
+
if (this.isReassigned || !this.init) {
|
|
3463
3456
|
return UNKNOWN_EXPRESSION;
|
|
3464
3457
|
}
|
|
3465
3458
|
return recursionTracker.withTrackedEntityAtPath(path, this.init, () => {
|
|
@@ -3468,14 +3461,14 @@ class LocalVariable extends Variable {
|
|
|
3468
3461
|
}, UNKNOWN_EXPRESSION);
|
|
3469
3462
|
}
|
|
3470
3463
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
3471
|
-
if (this.isReassigned
|
|
3464
|
+
if (this.isReassigned)
|
|
3472
3465
|
return true;
|
|
3473
3466
|
return (this.init &&
|
|
3474
3467
|
!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
|
|
3475
3468
|
this.init.hasEffectsWhenAccessedAtPath(path, context));
|
|
3476
3469
|
}
|
|
3477
3470
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
3478
|
-
if (this.included
|
|
3471
|
+
if (this.included)
|
|
3479
3472
|
return true;
|
|
3480
3473
|
if (path.length === 0)
|
|
3481
3474
|
return false;
|
|
@@ -3486,7 +3479,7 @@ class LocalVariable extends Variable {
|
|
|
3486
3479
|
this.init.hasEffectsWhenAssignedAtPath(path, context));
|
|
3487
3480
|
}
|
|
3488
3481
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
3489
|
-
if (
|
|
3482
|
+
if (this.isReassigned)
|
|
3490
3483
|
return true;
|
|
3491
3484
|
return (this.init &&
|
|
3492
3485
|
!(callOptions.withNew ? context.instantiated : context.called).trackEntityAtPathAndGetIfTracked(path, callOptions, this) &&
|
|
@@ -3526,6 +3519,14 @@ class LocalVariable extends Variable {
|
|
|
3526
3519
|
markCalledFromTryStatement() {
|
|
3527
3520
|
this.calledFromTryStatement = true;
|
|
3528
3521
|
}
|
|
3522
|
+
markInitializersForDeoptimization() {
|
|
3523
|
+
if (this.additionalInitializers === null) {
|
|
3524
|
+
this.additionalInitializers = this.init === null ? [] : [this.init];
|
|
3525
|
+
this.init = UNKNOWN_EXPRESSION;
|
|
3526
|
+
this.isReassigned = true;
|
|
3527
|
+
}
|
|
3528
|
+
return this.additionalInitializers;
|
|
3529
|
+
}
|
|
3529
3530
|
}
|
|
3530
3531
|
|
|
3531
3532
|
class Scope$1 {
|
|
@@ -4578,7 +4579,7 @@ class Identifier extends NodeBase {
|
|
|
4578
4579
|
variable = this.scope.addDeclaration(this, this.context, init, true);
|
|
4579
4580
|
if (treeshake && treeshake.correctVarValueBeforeDeclaration) {
|
|
4580
4581
|
// Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here.
|
|
4581
|
-
|
|
4582
|
+
variable.markInitializersForDeoptimization();
|
|
4582
4583
|
}
|
|
4583
4584
|
break;
|
|
4584
4585
|
case 'function':
|
|
@@ -4704,6 +4705,16 @@ class Identifier extends NodeBase {
|
|
|
4704
4705
|
!(this.variable.kind in tdzVariableKinds)) {
|
|
4705
4706
|
return (this.isTDZAccess = false);
|
|
4706
4707
|
}
|
|
4708
|
+
let decl_id;
|
|
4709
|
+
if (this.variable.declarations &&
|
|
4710
|
+
this.variable.declarations.length === 1 &&
|
|
4711
|
+
(decl_id = this.variable.declarations[0]) &&
|
|
4712
|
+
this.start < decl_id.start &&
|
|
4713
|
+
closestParentFunctionOrProgram(this) === closestParentFunctionOrProgram(decl_id)) {
|
|
4714
|
+
// a variable accessed before its declaration
|
|
4715
|
+
// in the same function or at top level of module
|
|
4716
|
+
return (this.isTDZAccess = true);
|
|
4717
|
+
}
|
|
4707
4718
|
if (!this.variable.initReached) {
|
|
4708
4719
|
// Either a const/let TDZ violation or
|
|
4709
4720
|
// var use before declaration was encountered.
|
|
@@ -4712,6 +4723,13 @@ class Identifier extends NodeBase {
|
|
|
4712
4723
|
return (this.isTDZAccess = false);
|
|
4713
4724
|
}
|
|
4714
4725
|
}
|
|
4726
|
+
function closestParentFunctionOrProgram(node) {
|
|
4727
|
+
while (node && !/^Program|Function/.test(node.type)) {
|
|
4728
|
+
node = node.parent;
|
|
4729
|
+
}
|
|
4730
|
+
// one of: ArrowFunctionExpression, FunctionDeclaration, FunctionExpression or Program
|
|
4731
|
+
return node;
|
|
4732
|
+
}
|
|
4715
4733
|
|
|
4716
4734
|
const EVENT_ACCESSED = 0;
|
|
4717
4735
|
const EVENT_ASSIGNED = 1;
|
|
@@ -5172,7 +5190,7 @@ class ObjectMember extends ExpressionEntity {
|
|
|
5172
5190
|
this.object.deoptimizePath([this.key, ...path]);
|
|
5173
5191
|
}
|
|
5174
5192
|
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
5175
|
-
this.object.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
5193
|
+
this.object.deoptimizeThisOnEventAtPath(event, [this.key, ...path], thisParameter, recursionTracker);
|
|
5176
5194
|
}
|
|
5177
5195
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
5178
5196
|
return this.object.getLiteralValueAtPath([this.key, ...path], recursionTracker, origin);
|
|
@@ -6397,10 +6415,11 @@ class ArrayPattern extends NodeBase {
|
|
|
6397
6415
|
class BlockScope extends ChildScope {
|
|
6398
6416
|
addDeclaration(identifier, context, init, isHoisted) {
|
|
6399
6417
|
if (isHoisted) {
|
|
6400
|
-
this.parent.addDeclaration(identifier, context, init, isHoisted);
|
|
6418
|
+
const variable = this.parent.addDeclaration(identifier, context, init, isHoisted);
|
|
6401
6419
|
// Necessary to make sure the init is deoptimized for conditional declarations.
|
|
6402
6420
|
// We cannot call deoptimizePath here.
|
|
6403
|
-
|
|
6421
|
+
variable.markInitializersForDeoptimization();
|
|
6422
|
+
return variable;
|
|
6404
6423
|
}
|
|
6405
6424
|
else {
|
|
6406
6425
|
return super.addDeclaration(identifier, context, init, false);
|
|
@@ -6816,6 +6835,8 @@ class BreakStatement extends NodeBase {
|
|
|
6816
6835
|
}
|
|
6817
6836
|
}
|
|
6818
6837
|
|
|
6838
|
+
// To avoid infinite recursions
|
|
6839
|
+
const MAX_PATH_DEPTH = 7;
|
|
6819
6840
|
function getResolvablePropertyKey(memberExpression) {
|
|
6820
6841
|
return memberExpression.computed
|
|
6821
6842
|
? getResolvableComputedPropertyKey(memberExpression.property)
|
|
@@ -6897,7 +6918,9 @@ class MemberExpression extends NodeBase {
|
|
|
6897
6918
|
this.variable.deoptimizePath(path);
|
|
6898
6919
|
}
|
|
6899
6920
|
else if (!this.replacement) {
|
|
6900
|
-
|
|
6921
|
+
if (path.length < MAX_PATH_DEPTH) {
|
|
6922
|
+
this.object.deoptimizePath([this.getPropertyKey(), ...path]);
|
|
6923
|
+
}
|
|
6901
6924
|
}
|
|
6902
6925
|
}
|
|
6903
6926
|
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
@@ -6905,7 +6928,12 @@ class MemberExpression extends NodeBase {
|
|
|
6905
6928
|
this.variable.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
6906
6929
|
}
|
|
6907
6930
|
else if (!this.replacement) {
|
|
6908
|
-
|
|
6931
|
+
if (path.length < MAX_PATH_DEPTH) {
|
|
6932
|
+
this.object.deoptimizeThisOnEventAtPath(event, [this.getPropertyKey(), ...path], thisParameter, recursionTracker);
|
|
6933
|
+
}
|
|
6934
|
+
else {
|
|
6935
|
+
thisParameter.deoptimizePath(UNKNOWN_PATH);
|
|
6936
|
+
}
|
|
6909
6937
|
}
|
|
6910
6938
|
}
|
|
6911
6939
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
@@ -6916,7 +6944,10 @@ class MemberExpression extends NodeBase {
|
|
|
6916
6944
|
return UnknownValue;
|
|
6917
6945
|
}
|
|
6918
6946
|
this.expressionsToBeDeoptimized.push(origin);
|
|
6919
|
-
|
|
6947
|
+
if (path.length < MAX_PATH_DEPTH) {
|
|
6948
|
+
return this.object.getLiteralValueAtPath([this.getPropertyKey(), ...path], recursionTracker, origin);
|
|
6949
|
+
}
|
|
6950
|
+
return UnknownValue;
|
|
6920
6951
|
}
|
|
6921
6952
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
6922
6953
|
if (this.variable !== null) {
|
|
@@ -6926,7 +6957,10 @@ class MemberExpression extends NodeBase {
|
|
|
6926
6957
|
return UNKNOWN_EXPRESSION;
|
|
6927
6958
|
}
|
|
6928
6959
|
this.expressionsToBeDeoptimized.push(origin);
|
|
6929
|
-
|
|
6960
|
+
if (path.length < MAX_PATH_DEPTH) {
|
|
6961
|
+
return this.object.getReturnExpressionWhenCalledAtPath([this.getPropertyKey(), ...path], callOptions, recursionTracker, origin);
|
|
6962
|
+
}
|
|
6963
|
+
return UNKNOWN_EXPRESSION;
|
|
6930
6964
|
}
|
|
6931
6965
|
hasEffects(context) {
|
|
6932
6966
|
if (!this.deoptimized)
|
|
@@ -6950,7 +6984,10 @@ class MemberExpression extends NodeBase {
|
|
|
6950
6984
|
if (this.replacement) {
|
|
6951
6985
|
return true;
|
|
6952
6986
|
}
|
|
6953
|
-
|
|
6987
|
+
if (path.length < MAX_PATH_DEPTH) {
|
|
6988
|
+
return this.object.hasEffectsWhenAccessedAtPath([this.getPropertyKey(), ...path], context);
|
|
6989
|
+
}
|
|
6990
|
+
return true;
|
|
6954
6991
|
}
|
|
6955
6992
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
6956
6993
|
if (this.variable !== null) {
|
|
@@ -6959,7 +6996,10 @@ class MemberExpression extends NodeBase {
|
|
|
6959
6996
|
if (this.replacement) {
|
|
6960
6997
|
return true;
|
|
6961
6998
|
}
|
|
6962
|
-
|
|
6999
|
+
if (path.length < MAX_PATH_DEPTH) {
|
|
7000
|
+
return this.object.hasEffectsWhenAssignedAtPath([this.getPropertyKey(), ...path], context);
|
|
7001
|
+
}
|
|
7002
|
+
return true;
|
|
6963
7003
|
}
|
|
6964
7004
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
6965
7005
|
if (this.variable !== null) {
|
|
@@ -6968,7 +7008,10 @@ class MemberExpression extends NodeBase {
|
|
|
6968
7008
|
if (this.replacement) {
|
|
6969
7009
|
return true;
|
|
6970
7010
|
}
|
|
6971
|
-
|
|
7011
|
+
if (path.length < MAX_PATH_DEPTH) {
|
|
7012
|
+
return this.object.hasEffectsWhenCalledAtPath([this.getPropertyKey(), ...path], callOptions, context);
|
|
7013
|
+
}
|
|
7014
|
+
return true;
|
|
6972
7015
|
}
|
|
6973
7016
|
include(context, includeChildrenRecursively) {
|
|
6974
7017
|
if (!this.deoptimized)
|
|
@@ -7267,10 +7310,13 @@ class CatchScope extends ParameterScope {
|
|
|
7267
7310
|
addDeclaration(identifier, context, init, isHoisted) {
|
|
7268
7311
|
const existingParameter = this.variables.get(identifier.name);
|
|
7269
7312
|
if (existingParameter) {
|
|
7313
|
+
// While we still create a hoisted declaration, the initializer goes to
|
|
7314
|
+
// the parameter. Note that technically, the declaration now belongs to
|
|
7315
|
+
// two variables, which is not correct but should not cause issues.
|
|
7316
|
+
this.parent.addDeclaration(identifier, context, UNDEFINED_EXPRESSION, isHoisted);
|
|
7270
7317
|
existingParameter.addDeclaration(identifier, init);
|
|
7271
7318
|
return existingParameter;
|
|
7272
7319
|
}
|
|
7273
|
-
// as parameters are handled differently, all remaining declarations are hoisted
|
|
7274
7320
|
return this.parent.addDeclaration(identifier, context, init, isHoisted);
|
|
7275
7321
|
}
|
|
7276
7322
|
}
|
|
@@ -7280,9 +7326,9 @@ class CatchClause extends NodeBase {
|
|
|
7280
7326
|
this.scope = new CatchScope(parentScope, this.context);
|
|
7281
7327
|
}
|
|
7282
7328
|
parseNode(esTreeNode) {
|
|
7283
|
-
// Parameters need to be declared first as the logic is that
|
|
7284
|
-
// variables are associated with
|
|
7285
|
-
//
|
|
7329
|
+
// Parameters need to be declared first as the logic is that initializers
|
|
7330
|
+
// of hoisted body variables are associated with parameters of the same
|
|
7331
|
+
// name instead of the variable
|
|
7286
7332
|
const { param } = esTreeNode;
|
|
7287
7333
|
if (param) {
|
|
7288
7334
|
this.param = new (this.context.nodeConstructors[param.type] ||
|
|
@@ -7765,7 +7811,7 @@ class TrackingScope extends BlockScope {
|
|
|
7765
7811
|
}
|
|
7766
7812
|
addDeclaration(identifier, context, init, isHoisted) {
|
|
7767
7813
|
this.hoistedDeclarations.push(identifier);
|
|
7768
|
-
return
|
|
7814
|
+
return super.addDeclaration(identifier, context, init, isHoisted);
|
|
7769
7815
|
}
|
|
7770
7816
|
}
|
|
7771
7817
|
|
|
@@ -8512,7 +8558,7 @@ const accessedFileUrlGlobals = {
|
|
|
8512
8558
|
umd: ['document', 'require', 'URL']
|
|
8513
8559
|
};
|
|
8514
8560
|
const getResolveUrl = (path, URL = 'URL') => `new ${URL}(${path}).href`;
|
|
8515
|
-
const getRelativeUrlFromDocument = (relativePath) => getResolveUrl(`'${relativePath}', document.currentScript && document.currentScript.src || document.baseURI`);
|
|
8561
|
+
const getRelativeUrlFromDocument = (relativePath, umd = false) => getResolveUrl(`'${relativePath}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ''}document.currentScript && document.currentScript.src || document.baseURI`);
|
|
8516
8562
|
const getGenericImportMetaMechanism = (getUrl) => (prop, chunkId) => {
|
|
8517
8563
|
const urlMechanism = getUrl(chunkId);
|
|
8518
8564
|
return prop === null
|
|
@@ -8521,7 +8567,7 @@ const getGenericImportMetaMechanism = (getUrl) => (prop, chunkId) => {
|
|
|
8521
8567
|
? urlMechanism
|
|
8522
8568
|
: 'undefined';
|
|
8523
8569
|
};
|
|
8524
|
-
const getUrlFromDocument = (chunkId) => `(document.currentScript && document.currentScript.src || new URL('${chunkId}', document.baseURI).href)`;
|
|
8570
|
+
const getUrlFromDocument = (chunkId, umd = false) => `${umd ? `typeof document === 'undefined' ? location.href : ` : ''}(document.currentScript && document.currentScript.src || new URL('${chunkId}', document.baseURI).href)`;
|
|
8525
8571
|
const relativeUrlMechanisms = {
|
|
8526
8572
|
amd: relativePath => {
|
|
8527
8573
|
if (relativePath[0] !== '.')
|
|
@@ -8532,14 +8578,14 @@ const relativeUrlMechanisms = {
|
|
|
8532
8578
|
es: relativePath => getResolveUrl(`'${relativePath}', import.meta.url`),
|
|
8533
8579
|
iife: relativePath => getRelativeUrlFromDocument(relativePath),
|
|
8534
8580
|
system: relativePath => getResolveUrl(`'${relativePath}', module.meta.url`),
|
|
8535
|
-
umd: relativePath => `(typeof document === 'undefined' ? ${getResolveUrl(`'file:' + __dirname + '/${relativePath}'`, `(require('u' + 'rl').URL)`)} : ${getRelativeUrlFromDocument(relativePath)})`
|
|
8581
|
+
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getResolveUrl(`'file:' + __dirname + '/${relativePath}'`, `(require('u' + 'rl').URL)`)} : ${getRelativeUrlFromDocument(relativePath, true)})`
|
|
8536
8582
|
};
|
|
8537
8583
|
const importMetaMechanisms = {
|
|
8538
8584
|
amd: getGenericImportMetaMechanism(() => getResolveUrl(`module.uri, document.baseURI`)),
|
|
8539
8585
|
cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${getResolveUrl(`'file:' + __filename`, `(require('u' + 'rl').URL)`)} : ${getUrlFromDocument(chunkId)})`),
|
|
8540
8586
|
iife: getGenericImportMetaMechanism(chunkId => getUrlFromDocument(chunkId)),
|
|
8541
8587
|
system: prop => (prop === null ? `module.meta` : `module.meta.${prop}`),
|
|
8542
|
-
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${getResolveUrl(`'file:' + __filename`, `(require('u' + 'rl').URL)`)} : ${getUrlFromDocument(chunkId)})`)
|
|
8588
|
+
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getResolveUrl(`'file:' + __filename`, `(require('u' + 'rl').URL)`)} : ${getUrlFromDocument(chunkId, true)})`)
|
|
8543
8589
|
};
|
|
8544
8590
|
|
|
8545
8591
|
class NewExpression extends NodeBase {
|
|
@@ -10247,6 +10293,7 @@ class Module {
|
|
|
10247
10293
|
}
|
|
10248
10294
|
includeAllInBundle() {
|
|
10249
10295
|
this.ast.include(createInclusionContext(), true);
|
|
10296
|
+
this.includeAllExports(false);
|
|
10250
10297
|
}
|
|
10251
10298
|
isIncluded() {
|
|
10252
10299
|
return this.ast.included || this.namespace.included || this.importedFromNotTreeshaken;
|
|
@@ -10924,7 +10971,7 @@ function warnOnBuiltins(warn, dependencies) {
|
|
|
10924
10971
|
return;
|
|
10925
10972
|
warn({
|
|
10926
10973
|
code: 'MISSING_NODE_BUILTINS',
|
|
10927
|
-
message: `Creating a browser bundle that depends on Node.js built-in modules (${printQuotedStringList(externalBuiltins)}). You might need to include https://github.com/
|
|
10974
|
+
message: `Creating a browser bundle that depends on Node.js built-in modules (${printQuotedStringList(externalBuiltins)}). You might need to include https://github.com/snowpackjs/rollup-plugin-polyfill-node`,
|
|
10928
10975
|
modules: externalBuiltins
|
|
10929
10976
|
});
|
|
10930
10977
|
}
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED