@rollup/wasm-node 4.14.3 → 4.16.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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.14.3
4
- Mon, 15 Apr 2024 07:18:00 GMT - commit e64f3d8d0cdc561f00d3efe503e3081f81889679
3
+ Rollup.js v4.16.0
4
+ Sun, 21 Apr 2024 04:41:09 GMT - commit 38fe70780cb7e374b47da99e3a3dca6b2a2170d2
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 = "4.14.3";
34
+ var version = "4.16.0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -1262,6 +1262,7 @@ async function mergeOutputOptions(config, overrides, log) {
1262
1262
  globals: getOption('globals'),
1263
1263
  hashCharacters: getOption('hashCharacters'),
1264
1264
  hoistTransitiveImports: getOption('hoistTransitiveImports'),
1265
+ importAttributesKey: getOption('importAttributesKey'),
1265
1266
  indent: getOption('indent'),
1266
1267
  inlineDynamicImports: getOption('inlineDynamicImports'),
1267
1268
  interop: getOption('interop'),
@@ -3392,6 +3393,9 @@ const NODE_INTERACTION_UNKNOWN_CALL = {
3392
3393
  };
3393
3394
 
3394
3395
  class Variable extends ExpressionEntity {
3396
+ markReassigned() {
3397
+ this.isReassigned = true;
3398
+ }
3395
3399
  constructor(name) {
3396
3400
  super();
3397
3401
  this.name = name;
@@ -3399,16 +3403,36 @@ class Variable extends ExpressionEntity {
3399
3403
  this.forbiddenNames = null;
3400
3404
  this.initReached = false;
3401
3405
  this.isId = false;
3402
- this.isReassigned = false;
3403
3406
  this.kind = null;
3404
3407
  this.renderBaseName = null;
3405
3408
  this.renderName = null;
3409
+ this.isReassigned = false;
3410
+ this.onlyFunctionCallUsed = true;
3406
3411
  }
3407
3412
  /**
3408
3413
  * Binds identifiers that reference this variable to this variable.
3409
3414
  * Necessary to be able to change variable names.
3410
3415
  */
3411
3416
  addReference(_identifier) { }
3417
+ /**
3418
+ * Check if the identifier variable is only used as function call
3419
+ * Forward the check to the export default variable if it is only used once
3420
+ * @returns true if the variable is only used as function call
3421
+ */
3422
+ getOnlyFunctionCallUsed() {
3423
+ return this.onlyFunctionCallUsed;
3424
+ }
3425
+ /**
3426
+ * Collect the places where the identifier variable is used
3427
+ * @param usedPlace Where the variable is used
3428
+ */
3429
+ addUsedPlace(usedPlace) {
3430
+ const isFunctionCall = usedPlace.parent.type === parseAst_js.CallExpression &&
3431
+ usedPlace.parent.callee === usedPlace;
3432
+ if (!isFunctionCall && usedPlace.parent.type !== parseAst_js.ExportDefaultDeclaration) {
3433
+ this.onlyFunctionCallUsed = false;
3434
+ }
3435
+ }
3412
3436
  /**
3413
3437
  * Prevent this variable from being renamed to this name to avoid name
3414
3438
  * collisions
@@ -7146,7 +7170,7 @@ class LocalVariable extends Variable {
7146
7170
  return;
7147
7171
  }
7148
7172
  if (path.length === 0) {
7149
- this.isReassigned = true;
7173
+ this.markReassigned();
7150
7174
  const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
7151
7175
  this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
7152
7176
  for (const expression of expressionsToBeDeoptimized) {
@@ -7240,7 +7264,7 @@ class LocalVariable extends Variable {
7240
7264
  if (this.additionalInitializers === null) {
7241
7265
  this.additionalInitializers = [this.init];
7242
7266
  this.init = UNKNOWN_EXPRESSION;
7243
- this.isReassigned = true;
7267
+ this.markReassigned();
7244
7268
  }
7245
7269
  return this.additionalInitializers;
7246
7270
  }
@@ -7258,6 +7282,8 @@ class ParameterVariable extends LocalVariable {
7258
7282
  this.deoptimizations = new PathTracker();
7259
7283
  this.deoptimizedFields = new Set();
7260
7284
  this.entitiesToBeDeoptimized = new Set();
7285
+ this.knownExpressionsToBeDeoptimized = [];
7286
+ this.knownValue = UNKNOWN_EXPRESSION;
7261
7287
  }
7262
7288
  addEntityToBeDeoptimized(entity) {
7263
7289
  if (entity === UNKNOWN_EXPRESSION) {
@@ -7287,6 +7313,47 @@ class ParameterVariable extends LocalVariable {
7287
7313
  }
7288
7314
  }
7289
7315
  }
7316
+ markReassigned() {
7317
+ if (this.isReassigned) {
7318
+ return;
7319
+ }
7320
+ super.markReassigned();
7321
+ for (const expression of this.knownExpressionsToBeDeoptimized) {
7322
+ expression.deoptimizeCache();
7323
+ }
7324
+ this.knownExpressionsToBeDeoptimized = [];
7325
+ }
7326
+ /**
7327
+ * If we are sure about the value of this parameter, we can set it here.
7328
+ * It can be a literal or the only possible value of the parameter.
7329
+ * an undefined value means that the parameter is not known.
7330
+ * @param value The known value of the parameter to be set.
7331
+ */
7332
+ setKnownValue(value) {
7333
+ if (this.isReassigned) {
7334
+ return;
7335
+ }
7336
+ if (this.knownValue !== value) {
7337
+ for (const expression of this.knownExpressionsToBeDeoptimized) {
7338
+ expression.deoptimizeCache();
7339
+ }
7340
+ this.knownExpressionsToBeDeoptimized = [];
7341
+ }
7342
+ this.knownValue = value;
7343
+ }
7344
+ getLiteralValueAtPath(path, recursionTracker, origin) {
7345
+ if (this.isReassigned) {
7346
+ return UnknownValue;
7347
+ }
7348
+ this.knownExpressionsToBeDeoptimized.push(origin);
7349
+ return recursionTracker.withTrackedEntityAtPath(path, this.knownValue, () => this.knownValue.getLiteralValueAtPath(path, recursionTracker, origin), UnknownValue);
7350
+ }
7351
+ hasEffectsOnInteractionAtPath(path, interaction, context) {
7352
+ // assigned is a bit different, since the value has a new name (the parameter)
7353
+ return interaction.type === INTERACTION_ASSIGNED
7354
+ ? super.hasEffectsOnInteractionAtPath(path, interaction, context)
7355
+ : this.knownValue.hasEffectsOnInteractionAtPath(path, interaction, context);
7356
+ }
7290
7357
  deoptimizeArgumentsOnInteractionAtPath(interaction, path) {
7291
7358
  // For performance reasons, we fully deoptimize all deeper interactions
7292
7359
  if (path.length >= 2 ||
@@ -7311,7 +7378,11 @@ class ParameterVariable extends LocalVariable {
7311
7378
  }
7312
7379
  }
7313
7380
  deoptimizePath(path) {
7314
- if (path.length === 0 || this.deoptimizedFields.has(UnknownKey)) {
7381
+ if (this.deoptimizedFields.has(UnknownKey)) {
7382
+ return;
7383
+ }
7384
+ if (path.length === 0) {
7385
+ this.markReassigned();
7315
7386
  return;
7316
7387
  }
7317
7388
  const key = path[0];
@@ -8673,11 +8744,11 @@ function getGlobalAtPath(path) {
8673
8744
  }
8674
8745
 
8675
8746
  class GlobalVariable extends Variable {
8676
- constructor() {
8677
- super(...arguments);
8747
+ constructor(name) {
8748
+ super(name);
8678
8749
  // Ensure we use live-bindings for globals as we do not know if they have
8679
8750
  // been reassigned
8680
- this.isReassigned = true;
8751
+ this.markReassigned();
8681
8752
  }
8682
8753
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
8683
8754
  switch (interaction.type) {
@@ -8731,6 +8802,7 @@ class Identifier extends NodeBase {
8731
8802
  constructor() {
8732
8803
  super(...arguments);
8733
8804
  this.variable = null;
8805
+ this.isReferenceVariable = false;
8734
8806
  }
8735
8807
  get isTDZAccess() {
8736
8808
  if (!isFlagSet(this.flags, 4 /* Flag.tdzAccessDefined */)) {
@@ -8751,6 +8823,7 @@ class Identifier extends NodeBase {
8751
8823
  if (!this.variable && is_reference(this, this.parent)) {
8752
8824
  this.variable = this.scope.findVariable(this.name);
8753
8825
  this.variable.addReference(this);
8826
+ this.isReferenceVariable = true;
8754
8827
  }
8755
8828
  }
8756
8829
  declare(kind, init) {
@@ -8913,6 +8986,9 @@ class Identifier extends NodeBase {
8913
8986
  this.variable.consolidateInitializers();
8914
8987
  this.scope.context.requestTreeshakingPass();
8915
8988
  }
8989
+ if (this.isReferenceVariable) {
8990
+ this.variable.addUsedPlace(this);
8991
+ }
8916
8992
  }
8917
8993
  getVariableRespectingTDZ() {
8918
8994
  if (this.isPossibleTDZ()) {
@@ -9232,10 +9308,17 @@ class RestElement extends NodeBase {
9232
9308
  }
9233
9309
  }
9234
9310
 
9311
+ // This handler does nothing.
9312
+ // Since we always re-evaluate argument values in a new tree-shaking pass,
9313
+ // we don't need to get notified if it is deoptimized.
9314
+ const EMPTY_DEOPTIMIZABLE_HANDLER = { deoptimizeCache() { } };
9235
9315
  class FunctionBase extends NodeBase {
9236
9316
  constructor() {
9237
9317
  super(...arguments);
9318
+ this.knownParameterValues = [];
9319
+ this.allArguments = [];
9238
9320
  this.objectEntity = null;
9321
+ this.functionParametersOptimized = false;
9239
9322
  }
9240
9323
  get async() {
9241
9324
  return isFlagSet(this.flags, 256 /* Flag.async */);
@@ -9255,6 +9338,87 @@ class FunctionBase extends NodeBase {
9255
9338
  set generator(value) {
9256
9339
  this.flags = setFlag(this.flags, 4194304 /* Flag.generator */, value);
9257
9340
  }
9341
+ /**
9342
+ * update knownParameterValues when a call is made to this function
9343
+ * @param newArguments arguments of the call
9344
+ */
9345
+ updateKnownParameterValues(newArguments) {
9346
+ for (let position = 0; position < this.params.length; position++) {
9347
+ // only the "this" argument newArguments[0] can be null
9348
+ // it's possible that some arguments are empty, so the value is undefined
9349
+ const argument = newArguments[position + 1] ?? UNDEFINED_EXPRESSION;
9350
+ const parameter = this.params[position];
9351
+ // RestElement can be, and can only be, the last parameter
9352
+ if (parameter instanceof RestElement) {
9353
+ return;
9354
+ }
9355
+ const knownParameterValue = this.knownParameterValues[position];
9356
+ if (knownParameterValue === undefined) {
9357
+ this.knownParameterValues[position] = argument;
9358
+ continue;
9359
+ }
9360
+ if (knownParameterValue === UNKNOWN_EXPRESSION ||
9361
+ knownParameterValue === argument ||
9362
+ (knownParameterValue instanceof Identifier &&
9363
+ argument instanceof Identifier &&
9364
+ knownParameterValue.variable === argument.variable)) {
9365
+ continue;
9366
+ }
9367
+ const oldValue = knownParameterValue.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, EMPTY_DEOPTIMIZABLE_HANDLER);
9368
+ const newValue = argument.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, EMPTY_DEOPTIMIZABLE_HANDLER);
9369
+ if (oldValue !== newValue || typeof oldValue === 'symbol') {
9370
+ this.knownParameterValues[position] = UNKNOWN_EXPRESSION;
9371
+ } // else both are the same literal, no need to update
9372
+ }
9373
+ }
9374
+ forwardArgumentsForFunctionCalledOnce(newArguments) {
9375
+ for (let position = 0; position < this.params.length; position++) {
9376
+ const parameter = this.params[position];
9377
+ if (parameter instanceof Identifier) {
9378
+ const ParameterVariable = parameter.variable;
9379
+ const argument = newArguments[position + 1] ?? UNDEFINED_EXPRESSION;
9380
+ ParameterVariable?.setKnownValue(argument);
9381
+ }
9382
+ }
9383
+ }
9384
+ /**
9385
+ * each time tree-shake starts, this method should be called to reoptimize the parameters
9386
+ * a parameter's state will change at most twice:
9387
+ * `undefined` (no call is made) -> an expression -> `UnknownArgument`
9388
+ * we are sure it will converge, and can use state from last iteration
9389
+ */
9390
+ applyFunctionParameterOptimization() {
9391
+ if (this.allArguments.length === 0) {
9392
+ return;
9393
+ }
9394
+ if (this.allArguments.length === 1) {
9395
+ // we are sure what knownParameterValues will be, so skip it and do setKnownValue
9396
+ this.forwardArgumentsForFunctionCalledOnce(this.allArguments[0]);
9397
+ return;
9398
+ }
9399
+ // reoptimize all arguments, that's why we save them
9400
+ for (const argumentsList of this.allArguments) {
9401
+ this.updateKnownParameterValues(argumentsList);
9402
+ }
9403
+ for (let position = 0; position < this.params.length; position++) {
9404
+ const parameter = this.params[position];
9405
+ // Parameters without default values
9406
+ if (parameter instanceof Identifier) {
9407
+ const parameterVariable = parameter.variable;
9408
+ // Only the RestElement may be undefined
9409
+ const knownParameterValue = this.knownParameterValues[position];
9410
+ parameterVariable?.setKnownValue(knownParameterValue);
9411
+ }
9412
+ }
9413
+ }
9414
+ deoptimizeFunctionParameters() {
9415
+ for (const parameter of this.params) {
9416
+ if (parameter instanceof Identifier) {
9417
+ const parameterVariable = parameter.variable;
9418
+ parameterVariable?.markReassigned();
9419
+ }
9420
+ }
9421
+ }
9258
9422
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
9259
9423
  if (interaction.type === INTERACTION_CALLED) {
9260
9424
  const { parameters } = this.scope;
@@ -9279,6 +9443,7 @@ class FunctionBase extends NodeBase {
9279
9443
  this.addArgumentToBeDeoptimized(argument);
9280
9444
  }
9281
9445
  }
9446
+ this.allArguments.push(args);
9282
9447
  }
9283
9448
  else {
9284
9449
  this.getObjectEntity().deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
@@ -9293,6 +9458,7 @@ class FunctionBase extends NodeBase {
9293
9458
  for (const parameterList of this.scope.parameters) {
9294
9459
  for (const parameter of parameterList) {
9295
9460
  parameter.deoptimizePath(UNKNOWN_PATH);
9461
+ parameter.markReassigned();
9296
9462
  }
9297
9463
  }
9298
9464
  }
@@ -9338,7 +9504,30 @@ class FunctionBase extends NodeBase {
9338
9504
  }
9339
9505
  return false;
9340
9506
  }
9507
+ /**
9508
+ * If the function (expression or declaration) is only used as function calls
9509
+ */
9510
+ onlyFunctionCallUsed() {
9511
+ let variable = null;
9512
+ if (this.parent.type === parseAst_js.VariableDeclarator) {
9513
+ variable = this.parent.id.variable ?? null;
9514
+ }
9515
+ if (this.parent.type === parseAst_js.ExportDefaultDeclaration) {
9516
+ variable = this.parent.variable;
9517
+ }
9518
+ return variable?.getOnlyFunctionCallUsed() ?? false;
9519
+ }
9341
9520
  include(context, includeChildrenRecursively) {
9521
+ const isIIFE = this.parent.type === parseAst_js.CallExpression &&
9522
+ this.parent.callee === this;
9523
+ const shoulOptimizeFunctionParameters = isIIFE || this.onlyFunctionCallUsed();
9524
+ if (shoulOptimizeFunctionParameters) {
9525
+ this.applyFunctionParameterOptimization();
9526
+ }
9527
+ else if (this.functionParametersOptimized) {
9528
+ this.deoptimizeFunctionParameters();
9529
+ }
9530
+ this.functionParametersOptimized = shoulOptimizeFunctionParameters;
9342
9531
  if (!this.deoptimized)
9343
9532
  this.applyDeoptimizations();
9344
9533
  this.included = true;
@@ -10088,7 +10277,7 @@ class MemberExpression extends NodeBase {
10088
10277
  }
10089
10278
  deoptimizeCache() {
10090
10279
  const { expressionsToBeDeoptimized, object } = this;
10091
- this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
10280
+ this.expressionsToBeDeoptimized = [];
10092
10281
  this.propertyKey = UnknownKey;
10093
10282
  object.deoptimizePath(UNKNOWN_PATH);
10094
10283
  for (const expression of expressionsToBeDeoptimized) {
@@ -10237,6 +10426,9 @@ class MemberExpression extends NodeBase {
10237
10426
  this.object.deoptimizeArgumentsOnInteractionAtPath(this.accessInteraction, [propertyKey], SHARED_RECURSION_TRACKER);
10238
10427
  this.scope.context.requestTreeshakingPass();
10239
10428
  }
10429
+ if (this.variable) {
10430
+ this.variable.addUsedPlace(this);
10431
+ }
10240
10432
  }
10241
10433
  applyAssignmentDeoptimization() {
10242
10434
  this.assignmentDeoptimized = true;
@@ -10886,15 +11078,16 @@ class ConditionalExpression extends NodeBase {
10886
11078
  this.alternate.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
10887
11079
  }
10888
11080
  deoptimizeCache() {
11081
+ this.isBranchResolutionAnalysed = false;
11082
+ const { expressionsToBeDeoptimized } = this;
11083
+ this.expressionsToBeDeoptimized = [];
11084
+ for (const expression of expressionsToBeDeoptimized) {
11085
+ expression.deoptimizeCache();
11086
+ }
10889
11087
  if (this.usedBranch !== null) {
10890
11088
  const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent;
10891
11089
  this.usedBranch = null;
10892
11090
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
10893
- const { expressionsToBeDeoptimized } = this;
10894
- this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
10895
- for (const expression of expressionsToBeDeoptimized) {
10896
- expression.deoptimizeCache();
10897
- }
10898
11091
  }
10899
11092
  }
10900
11093
  deoptimizePath(path) {
@@ -10908,10 +11101,10 @@ class ConditionalExpression extends NodeBase {
10908
11101
  }
10909
11102
  }
10910
11103
  getLiteralValueAtPath(path, recursionTracker, origin) {
11104
+ this.expressionsToBeDeoptimized.push(origin);
10911
11105
  const usedBranch = this.getUsedBranch();
10912
11106
  if (!usedBranch)
10913
11107
  return UnknownValue;
10914
- this.expressionsToBeDeoptimized.push(origin);
10915
11108
  return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
10916
11109
  }
10917
11110
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
@@ -11110,6 +11303,10 @@ class FunctionDeclaration extends FunctionNode {
11110
11303
  this.id.variable.isId = true;
11111
11304
  }
11112
11305
  }
11306
+ onlyFunctionCallUsed() {
11307
+ // call super.onlyFunctionCallUsed for export default anonymous function
11308
+ return this.id?.variable.getOnlyFunctionCallUsed() ?? super.onlyFunctionCallUsed();
11309
+ }
11113
11310
  parseNode(esTreeNode) {
11114
11311
  if (esTreeNode.id !== null) {
11115
11312
  this.id = new Identifier(this, this.scope.parent).parseNode(esTreeNode.id);
@@ -11398,7 +11595,7 @@ class IfStatement extends NodeBase {
11398
11595
  this.testValue = unset;
11399
11596
  }
11400
11597
  deoptimizeCache() {
11401
- this.testValue = UnknownValue;
11598
+ this.testValue = unset;
11402
11599
  }
11403
11600
  hasEffects(context) {
11404
11601
  if (this.test.hasEffects(context)) {
@@ -12206,12 +12403,10 @@ class LogicalExpression extends NodeBase {
12206
12403
  this.right.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
12207
12404
  }
12208
12405
  deoptimizeCache() {
12209
- if (this.usedBranch) {
12210
- const unusedBranch = this.usedBranch === this.left ? this.right : this.left;
12211
- this.usedBranch = null;
12212
- unusedBranch.deoptimizePath(UNKNOWN_PATH);
12406
+ this.isBranchResolutionAnalysed = false;
12407
+ if (this.expressionsToBeDeoptimized.length > 0) {
12213
12408
  const { scope: { context }, expressionsToBeDeoptimized } = this;
12214
- this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
12409
+ this.expressionsToBeDeoptimized = [];
12215
12410
  for (const expression of expressionsToBeDeoptimized) {
12216
12411
  expression.deoptimizeCache();
12217
12412
  }
@@ -12219,6 +12414,11 @@ class LogicalExpression extends NodeBase {
12219
12414
  // it is rendered
12220
12415
  context.requestTreeshakingPass();
12221
12416
  }
12417
+ if (this.usedBranch) {
12418
+ const unusedBranch = this.usedBranch === this.left ? this.right : this.left;
12419
+ this.usedBranch = null;
12420
+ unusedBranch.deoptimizePath(UNKNOWN_PATH);
12421
+ }
12222
12422
  }
12223
12423
  deoptimizePath(path) {
12224
12424
  const usedBranch = this.getUsedBranch();
@@ -12231,10 +12431,10 @@ class LogicalExpression extends NodeBase {
12231
12431
  }
12232
12432
  }
12233
12433
  getLiteralValueAtPath(path, recursionTracker, origin) {
12434
+ this.expressionsToBeDeoptimized.push(origin);
12234
12435
  const usedBranch = this.getUsedBranch();
12235
12436
  if (!usedBranch)
12236
12437
  return UnknownValue;
12237
- this.expressionsToBeDeoptimized.push(origin);
12238
12438
  return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
12239
12439
  }
12240
12440
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
@@ -13176,6 +13376,15 @@ class ExportDefaultVariable extends LocalVariable {
13176
13376
  this.name = identifier.name;
13177
13377
  }
13178
13378
  }
13379
+ addUsedPlace(usedPlace) {
13380
+ const original = this.getOriginalVariable();
13381
+ if (original === this) {
13382
+ super.addUsedPlace(usedPlace);
13383
+ }
13384
+ else {
13385
+ original.addUsedPlace(usedPlace);
13386
+ }
13387
+ }
13179
13388
  forbidName(name) {
13180
13389
  const original = this.getOriginalVariable();
13181
13390
  if (original === this) {
@@ -13449,7 +13658,7 @@ class UpdateExpression extends NodeBase {
13449
13658
  this.argument.deoptimizePath(EMPTY_PATH);
13450
13659
  if (this.argument instanceof Identifier) {
13451
13660
  const variable = this.scope.findVariable(this.argument.name);
13452
- variable.isReassigned = true;
13661
+ variable.markReassigned();
13453
13662
  }
13454
13663
  this.scope.context.requestTreeshakingPass();
13455
13664
  }
@@ -16291,9 +16500,9 @@ function getImportBlock$1(dependencies, { _, cnst, n }, compact) {
16291
16500
  return '';
16292
16501
  }
16293
16502
 
16294
- function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze, generatedCode: { symbols } }) {
16503
+ function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze, generatedCode: { symbols }, importAttributesKey }) {
16295
16504
  const { n } = snippets;
16296
- const importBlock = getImportBlock(dependencies, snippets);
16505
+ const importBlock = getImportBlock(dependencies, importAttributesKey, snippets);
16297
16506
  if (importBlock.length > 0)
16298
16507
  intro += importBlock.join(n) + n + n;
16299
16508
  intro += getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols);
@@ -16306,10 +16515,10 @@ function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencie
16306
16515
  magicString.append(outro);
16307
16516
  magicString.trim();
16308
16517
  }
16309
- function getImportBlock(dependencies, { _ }) {
16518
+ function getImportBlock(dependencies, importAttributesKey, { _ }) {
16310
16519
  const importBlock = [];
16311
16520
  for (const { importPath, reexports, imports, name, attributes } of dependencies) {
16312
- const assertion = attributes ? `${_}assert${_}${attributes}` : '';
16521
+ const assertion = attributes ? `${_}${importAttributesKey}${_}${attributes}` : '';
16313
16522
  const pathWithAssertion = `'${importPath}'${assertion};`;
16314
16523
  if (!reexports && !imports) {
16315
16524
  importBlock.push(`import${_}${pathWithAssertion}`);
@@ -19434,7 +19643,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
19434
19643
 
19435
19644
  function flru (max) {
19436
19645
  var num, curr, prev;
19437
- var limit = max || 1;
19646
+ var limit = max ;
19438
19647
 
19439
19648
  function keep(key, value) {
19440
19649
  if (++num > limit) {
@@ -20574,6 +20783,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
20574
20783
  globals: config.globals || {},
20575
20784
  hashCharacters: config.hashCharacters ?? 'base64',
20576
20785
  hoistTransitiveImports: config.hoistTransitiveImports ?? true,
20786
+ importAttributesKey: config.importAttributesKey ?? 'assert',
20577
20787
  indent: getIndent(config, compact),
20578
20788
  inlineDynamicImports,
20579
20789
  interop: getInterop(config),
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.14.3
4
- Mon, 15 Apr 2024 07:18:00 GMT - commit e64f3d8d0cdc561f00d3efe503e3081f81889679
3
+ Rollup.js v4.16.0
4
+ Sun, 21 Apr 2024 04:41:09 GMT - commit 38fe70780cb7e374b47da99e3a3dca6b2a2170d2
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.14.3
4
- Mon, 15 Apr 2024 07:18:00 GMT - commit e64f3d8d0cdc561f00d3efe503e3081f81889679
3
+ Rollup.js v4.16.0
4
+ Sun, 21 Apr 2024 04:41:09 GMT - commit 38fe70780cb7e374b47da99e3a3dca6b2a2170d2
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rollup/wasm-node",
3
- "version": "4.14.3",
3
+ "version": "4.16.0",
4
4
  "description": "Next-generation ES module bundler with Node wasm",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -38,7 +38,7 @@
38
38
  "@codemirror/language": "^6.10.1",
39
39
  "@codemirror/search": "^6.5.6",
40
40
  "@codemirror/state": "^6.4.1",
41
- "@codemirror/view": "^6.26.1",
41
+ "@codemirror/view": "^6.26.3",
42
42
  "@jridgewell/sourcemap-codec": "^1.4.15",
43
43
  "@mermaid-js/mermaid-cli": "^10.8.0",
44
44
  "@napi-rs/cli": "^2.18.1",
@@ -51,14 +51,14 @@
51
51
  "@rollup/plugin-terser": "^0.4.4",
52
52
  "@rollup/plugin-typescript": "^11.1.6",
53
53
  "@rollup/pluginutils": "^5.1.0",
54
- "@shikijs/vitepress-twoslash": "^1.2.4",
55
- "@types/eslint": "^8.56.7",
54
+ "@shikijs/vitepress-twoslash": "^1.3.0",
55
+ "@types/eslint": "^8.56.9",
56
56
  "@types/inquirer": "^9.0.7",
57
57
  "@types/mocha": "^10.0.6",
58
58
  "@types/node": "~18.18.14",
59
59
  "@types/yargs-parser": "^21.0.3",
60
- "@typescript-eslint/eslint-plugin": "^7.6.0",
61
- "@typescript-eslint/parser": "^7.6.0",
60
+ "@typescript-eslint/eslint-plugin": "^7.7.0",
61
+ "@typescript-eslint/parser": "^7.7.0",
62
62
  "@vue/eslint-config-prettier": "^9.0.0",
63
63
  "@vue/eslint-config-typescript": "^13.0.0",
64
64
  "acorn": "^8.11.3",
@@ -77,13 +77,13 @@
77
77
  "eslint-plugin-import": "^2.29.1",
78
78
  "eslint-plugin-prettier": "^5.1.3",
79
79
  "eslint-plugin-unicorn": "^52.0.0",
80
- "eslint-plugin-vue": "^9.24.1",
80
+ "eslint-plugin-vue": "^9.25.0",
81
81
  "fixturify": "^3.0.0",
82
82
  "flru": "^1.0.2",
83
83
  "fs-extra": "^11.2.0",
84
84
  "github-api": "^3.4.0",
85
85
  "husky": "^9.0.11",
86
- "inquirer": "^9.2.17",
86
+ "inquirer": "^9.2.18",
87
87
  "is-reference": "^3.0.2",
88
88
  "lint-staged": "^15.2.2",
89
89
  "locate-character": "^3.0.0",
@@ -95,7 +95,7 @@
95
95
  "pretty-bytes": "^6.1.1",
96
96
  "pretty-ms": "^9.0.0",
97
97
  "requirejs": "^2.3.6",
98
- "rollup": "^4.14.1",
98
+ "rollup": "^4.14.3",
99
99
  "rollup-plugin-license": "^3.3.1",
100
100
  "rollup-plugin-string": "^3.0.0",
101
101
  "semver": "^7.6.0",
@@ -106,10 +106,10 @@
106
106
  "systemjs": "^6.14.3",
107
107
  "terser": "^5.30.3",
108
108
  "tslib": "^2.6.2",
109
- "typescript": "^5.4.4",
110
- "vite": "^5.2.8",
111
- "vitepress": "^1.0.2",
112
- "vue": "^3.4.21",
109
+ "typescript": "^5.4.5",
110
+ "vite": "^5.2.9",
111
+ "vitepress": "^1.1.0",
112
+ "vue": "^3.4.22",
113
113
  "wasm-pack": "^0.12.1",
114
114
  "weak-napi": "^2.0.2",
115
115
  "yargs-parser": "^21.1.1"