svelte 3.46.2 → 3.46.5

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/compiler.js CHANGED
@@ -5820,6 +5820,7 @@
5820
5820
  'Event',
5821
5821
  'EventSource',
5822
5822
  'fetch',
5823
+ 'FormData',
5823
5824
  'global',
5824
5825
  'globalThis',
5825
5826
  'history',
@@ -6710,6 +6711,19 @@
6710
6711
  return nodes;
6711
6712
  }
6712
6713
 
6714
+ /**
6715
+ * Does `array.push` for all `items`. Needed because `array.push(...items)` throws
6716
+ * "Maximum call stack size exceeded" when `items` is too big of an array.
6717
+ *
6718
+ * @param {any[]} array
6719
+ * @param {any[]} items
6720
+ */
6721
+ function push_array(array, items) {
6722
+ for (let i = 0; i < items.length; i++) {
6723
+ array.push(items[i]);
6724
+ }
6725
+ }
6726
+
6713
6727
  // heavily based on https://github.com/davidbonnet/astring
6714
6728
 
6715
6729
  /** @typedef {import('estree').ArrowFunctionExpression} ArrowFunctionExpression */
@@ -6957,7 +6971,8 @@
6957
6971
 
6958
6972
  const joined = [...nodes[0]];
6959
6973
  for (let i = 1; i < nodes.length; i += 1) {
6960
- joined.push(separator, ...nodes[i]);
6974
+ joined.push(separator);
6975
+ push_array(joined, nodes[i]);
6961
6976
  }
6962
6977
  return joined;
6963
6978
  };
@@ -7035,9 +7050,7 @@
7035
7050
  );
7036
7051
  }
7037
7052
 
7038
- chunks.push(
7039
- ...body[i]
7040
- );
7053
+ push_array(chunks, body[i]);
7041
7054
 
7042
7055
  needed_padding = needs_padding;
7043
7056
  }
@@ -7064,13 +7077,7 @@
7064
7077
 
7065
7078
  const separator = c(multiple_lines ? `,\n${state.indent}\t` : ', ');
7066
7079
 
7067
- if (multiple_lines) {
7068
- chunks.push(...join(declarators, separator));
7069
- } else {
7070
- chunks.push(
7071
- ...join(declarators, separator)
7072
- );
7073
- }
7080
+ push_array(chunks, join(declarators, separator));
7074
7081
 
7075
7082
  return chunks;
7076
7083
  };
@@ -7125,10 +7132,8 @@
7125
7132
  ];
7126
7133
 
7127
7134
  if (node.alternate) {
7128
- chunks.push(
7129
- c(' else '),
7130
- ...handle(node.alternate, state)
7131
- );
7135
+ chunks.push(c(' else '));
7136
+ push_array(chunks, handle(node.alternate, state));
7132
7137
  }
7133
7138
 
7134
7139
  return chunks;
@@ -7172,20 +7177,16 @@
7172
7177
 
7173
7178
  node.cases.forEach(block => {
7174
7179
  if (block.test) {
7175
- chunks.push(
7176
- c(`\n${state.indent}\tcase `),
7177
- ...handle(block.test, { ...state, indent: `${state.indent}\t` }),
7178
- c(':')
7179
- );
7180
+ chunks.push(c(`\n${state.indent}\tcase `));
7181
+ push_array(chunks, handle(block.test, { ...state, indent: `${state.indent}\t` }));
7182
+ chunks.push(c(':'));
7180
7183
  } else {
7181
7184
  chunks.push(c(`\n${state.indent}\tdefault:`));
7182
7185
  }
7183
7186
 
7184
7187
  block.consequent.forEach(statement => {
7185
- chunks.push(
7186
- c(`\n${state.indent}\t\t`),
7187
- ...handle(statement, { ...state, indent: `${state.indent}\t\t` })
7188
- );
7188
+ chunks.push(c(`\n${state.indent}\t\t`));
7189
+ push_array(chunks, handle(statement, { ...state, indent: `${state.indent}\t\t` }));
7189
7190
  });
7190
7191
  });
7191
7192
 
@@ -7223,20 +7224,19 @@
7223
7224
 
7224
7225
  if (node.handler) {
7225
7226
  if (node.handler.param) {
7226
- chunks.push(
7227
- c(' catch('),
7228
- ...handle(node.handler.param, state),
7229
- c(') ')
7230
- );
7227
+ chunks.push(c(' catch('));
7228
+ push_array(chunks, handle(node.handler.param, state));
7229
+ chunks.push(c(') '));
7231
7230
  } else {
7232
7231
  chunks.push(c(' catch '));
7233
7232
  }
7234
7233
 
7235
- chunks.push(...handle(node.handler.body, state));
7234
+ push_array(chunks, handle(node.handler.body, state));
7236
7235
  }
7237
7236
 
7238
7237
  if (node.finalizer) {
7239
- chunks.push(c(' finally '), ...handle(node.finalizer, state));
7238
+ chunks.push(c(' finally '));
7239
+ push_array(chunks, handle(node.finalizer, state));
7240
7240
  }
7241
7241
 
7242
7242
  return chunks;
@@ -7266,21 +7266,19 @@
7266
7266
 
7267
7267
  if (node.init) {
7268
7268
  if (node.init.type === 'VariableDeclaration') {
7269
- chunks.push(...handle_var_declaration(node.init, state));
7269
+ push_array(chunks, handle_var_declaration(node.init, state));
7270
7270
  } else {
7271
- chunks.push(...handle(node.init, state));
7271
+ push_array(chunks, handle(node.init, state));
7272
7272
  }
7273
7273
  }
7274
7274
 
7275
7275
  chunks.push(c('; '));
7276
- if (node.test) chunks.push(...handle(node.test, state));
7276
+ if (node.test) push_array(chunks, handle(node.test, state));
7277
7277
  chunks.push(c('; '));
7278
- if (node.update) chunks.push(...handle(node.update, state));
7278
+ if (node.update) push_array(chunks, handle(node.update, state));
7279
7279
 
7280
- chunks.push(
7281
- c(') '),
7282
- ...handle(node.body, state)
7283
- );
7280
+ chunks.push(c(') '));
7281
+ push_array(chunks, handle(node.body, state));
7284
7282
 
7285
7283
  return chunks;
7286
7284
  }),
@@ -7291,17 +7289,15 @@
7291
7289
  ];
7292
7290
 
7293
7291
  if (node.left.type === 'VariableDeclaration') {
7294
- chunks.push(...handle_var_declaration(node.left, state));
7292
+ push_array(chunks, handle_var_declaration(node.left, state));
7295
7293
  } else {
7296
- chunks.push(...handle(node.left, state));
7294
+ push_array(chunks, handle(node.left, state));
7297
7295
  }
7298
7296
 
7299
- chunks.push(
7300
- c(node.type === 'ForInStatement' ? ` in ` : ` of `),
7301
- ...handle(node.right, state),
7302
- c(') '),
7303
- ...handle(node.body, state)
7304
- );
7297
+ chunks.push(c(node.type === 'ForInStatement' ? ` in ` : ` of `));
7298
+ push_array(chunks, handle(node.right, state));
7299
+ chunks.push(c(') '));
7300
+ push_array(chunks, handle(node.body, state));
7305
7301
 
7306
7302
  return chunks;
7307
7303
  }),
@@ -7315,7 +7311,7 @@
7315
7311
 
7316
7312
  if (node.async) chunks.push(c('async '));
7317
7313
  chunks.push(c(node.generator ? 'function* ' : 'function '));
7318
- if (node.id) chunks.push(...handle(node.id, state));
7314
+ if (node.id) push_array(chunks, handle(node.id, state));
7319
7315
  chunks.push(c('('));
7320
7316
 
7321
7317
  const params = node.params.map(p => handle(p, {
@@ -7331,21 +7327,15 @@
7331
7327
  const separator = c(multiple_lines ? `,\n${state.indent}` : ', ');
7332
7328
 
7333
7329
  if (multiple_lines) {
7334
- chunks.push(
7335
- c(`\n${state.indent}\t`),
7336
- ...join(params, separator),
7337
- c(`\n${state.indent}`)
7338
- );
7330
+ chunks.push(c(`\n${state.indent}\t`));
7331
+ push_array(chunks, join(params, separator));
7332
+ chunks.push(c(`\n${state.indent}`));
7339
7333
  } else {
7340
- chunks.push(
7341
- ...join(params, separator)
7342
- );
7334
+ push_array(chunks, join(params, separator));
7343
7335
  }
7344
7336
 
7345
- chunks.push(
7346
- c(') '),
7347
- ...handle(node.body, state)
7348
- );
7337
+ chunks.push(c(') '));
7338
+ push_array(chunks, handle(node.body, state));
7349
7339
 
7350
7340
  return chunks;
7351
7341
  }),
@@ -7369,17 +7359,18 @@
7369
7359
  ClassDeclaration(node, state) {
7370
7360
  const chunks = [c('class ')];
7371
7361
 
7372
- if (node.id) chunks.push(...handle(node.id, state), c(' '));
7362
+ if (node.id) {
7363
+ push_array(chunks, handle(node.id, state));
7364
+ chunks.push(c(' '));
7365
+ }
7373
7366
 
7374
7367
  if (node.superClass) {
7375
- chunks.push(
7376
- c('extends '),
7377
- ...handle(node.superClass, state),
7378
- c(' ')
7379
- );
7368
+ chunks.push(c('extends '));
7369
+ push_array(chunks, handle(node.superClass, state));
7370
+ chunks.push(c(' '));
7380
7371
  }
7381
7372
 
7382
- chunks.push(...handle(node.body, state));
7373
+ push_array(chunks, handle(node.body, state));
7383
7374
 
7384
7375
  return chunks;
7385
7376
  },
@@ -7427,27 +7418,21 @@
7427
7418
  const width = get_length(chunks) + specifiers.map(get_length).reduce(sum, 0) + (2 * specifiers.length) + 6 + get_length(source);
7428
7419
 
7429
7420
  if (width > 80) {
7430
- chunks.push(
7431
- c(`{\n\t`),
7432
- ...join(specifiers, c(',\n\t')),
7433
- c('\n}')
7434
- );
7421
+ chunks.push(c(`{\n\t`));
7422
+ push_array(chunks, join(specifiers, c(',\n\t')));
7423
+ chunks.push(c('\n}'));
7435
7424
  } else {
7436
- chunks.push(
7437
- c(`{ `),
7438
- ...join(specifiers, c(', ')),
7439
- c(' }')
7440
- );
7425
+ chunks.push(c(`{ `));
7426
+ push_array(chunks, join(specifiers, c(', ')));
7427
+ chunks.push(c(' }'));
7441
7428
  }
7442
7429
  }
7443
7430
 
7444
7431
  chunks.push(c(' from '));
7445
7432
  }
7446
7433
 
7447
- chunks.push(
7448
- ...source,
7449
- c(';')
7450
- );
7434
+ push_array(chunks, source);
7435
+ chunks.push(c(';'));
7451
7436
 
7452
7437
  return chunks;
7453
7438
  },
@@ -7473,7 +7458,7 @@
7473
7458
  const chunks = [c('export ')];
7474
7459
 
7475
7460
  if (node.declaration) {
7476
- chunks.push(...handle(node.declaration, state));
7461
+ push_array(chunks, handle(node.declaration, state));
7477
7462
  } else {
7478
7463
  const specifiers = node.specifiers.map((/** @type {ExportSpecifier} */ specifier) => {
7479
7464
  const name = handle(specifier.local, state)[0];
@@ -7489,24 +7474,18 @@
7489
7474
  const width = 7 + specifiers.map(get_length).reduce(sum, 0) + 2 * specifiers.length;
7490
7475
 
7491
7476
  if (width > 80) {
7492
- chunks.push(
7493
- c('{\n\t'),
7494
- ...join(specifiers, c(',\n\t')),
7495
- c('\n}')
7496
- );
7477
+ chunks.push(c('{\n\t'));
7478
+ push_array(chunks, join(specifiers, c(',\n\t')));
7479
+ chunks.push(c('\n}'));
7497
7480
  } else {
7498
- chunks.push(
7499
- c('{ '),
7500
- ...join(specifiers, c(', ')),
7501
- c(' }')
7502
- );
7481
+ chunks.push(c('{ '));
7482
+ push_array(chunks, join(specifiers, c(', ')));
7483
+ chunks.push(c(' }'));
7503
7484
  }
7504
7485
 
7505
7486
  if (node.source) {
7506
- chunks.push(
7507
- c(' from '),
7508
- ...handle(node.source, state)
7509
- );
7487
+ chunks.push(c(' from '));
7488
+ push_array(chunks, handle(node.source, state));
7510
7489
  }
7511
7490
  }
7512
7491
 
@@ -7544,27 +7523,23 @@
7544
7523
  }
7545
7524
 
7546
7525
  if (node.computed) {
7547
- chunks.push(
7548
- c('['),
7549
- ...handle(node.key, state),
7550
- c(']')
7551
- );
7526
+ chunks.push(c('['));
7527
+ push_array(chunks, handle(node.key, state));
7528
+ chunks.push(c(']'));
7552
7529
  } else {
7553
- chunks.push(...handle(node.key, state));
7530
+ push_array(chunks, handle(node.key, state));
7554
7531
  }
7555
7532
 
7556
7533
  chunks.push(c('('));
7557
7534
 
7558
7535
  const { params } = node.value;
7559
7536
  for (let i = 0; i < params.length; i += 1) {
7560
- chunks.push(...handle(params[i], state));
7537
+ push_array(chunks, handle(params[i], state));
7561
7538
  if (i < params.length - 1) chunks.push(c(', '));
7562
7539
  }
7563
7540
 
7564
- chunks.push(
7565
- c(') '),
7566
- ...handle(node.value.body, state)
7567
- );
7541
+ chunks.push(c(') '));
7542
+ push_array(chunks, handle(node.value.body, state));
7568
7543
 
7569
7544
  return chunks;
7570
7545
  },
@@ -7575,18 +7550,16 @@
7575
7550
  if (node.async) chunks.push(c('async '));
7576
7551
 
7577
7552
  if (node.params.length === 1 && node.params[0].type === 'Identifier') {
7578
- chunks.push(...handle(node.params[0], state));
7553
+ push_array(chunks, handle(node.params[0], state));
7579
7554
  } else {
7580
7555
  const params = node.params.map(param => handle(param, {
7581
7556
  ...state,
7582
7557
  indent: state.indent + '\t'
7583
7558
  }));
7584
7559
 
7585
- chunks.push(
7586
- c('('),
7587
- ...join(params, c(', ')),
7588
- c(')')
7589
- );
7560
+ chunks.push(c('('));
7561
+ push_array(chunks, join(params, c(', ')));
7562
+ chunks.push(c(')'));
7590
7563
  }
7591
7564
 
7592
7565
  chunks.push(c(' => '));
@@ -7595,13 +7568,11 @@
7595
7568
  node.body.type === 'ObjectExpression' ||
7596
7569
  (node.body.type === 'AssignmentExpression' && node.body.left.type === 'ObjectPattern')
7597
7570
  ) {
7598
- chunks.push(
7599
- c('('),
7600
- ...handle(node.body, state),
7601
- c(')')
7602
- );
7571
+ chunks.push(c('('));
7572
+ push_array(chunks, handle(node.body, state));
7573
+ chunks.push(c(')'));
7603
7574
  } else {
7604
- chunks.push(...handle(node.body, state));
7575
+ push_array(chunks, handle(node.body, state));
7605
7576
  }
7606
7577
 
7607
7578
  return chunks;
@@ -7649,10 +7620,10 @@
7649
7620
  for (let i = 0; i < expressions.length; i++) {
7650
7621
  chunks.push(
7651
7622
  c(quasis[i].value.raw),
7652
- c('${'),
7653
- ...handle(expressions[i], state),
7654
- c('}')
7623
+ c('${')
7655
7624
  );
7625
+ push_array(chunks, handle(expressions[i], state));
7626
+ chunks.push(c('}'));
7656
7627
  }
7657
7628
 
7658
7629
  chunks.push(
@@ -7696,14 +7667,13 @@
7696
7667
  );
7697
7668
 
7698
7669
  if (multiple_lines) {
7699
- chunks.push(
7700
- c(`\n${state.indent}\t`),
7701
- ...join(elements, c(`,\n${state.indent}\t`)),
7702
- c(`\n${state.indent}`),
7703
- ...sparse_commas
7704
- );
7670
+ chunks.push(c(`\n${state.indent}\t`));
7671
+ push_array(chunks, join(elements, c(`,\n${state.indent}\t`)));
7672
+ chunks.push(c(`\n${state.indent}`));
7673
+ push_array(chunks, sparse_commas);
7705
7674
  } else {
7706
- chunks.push(...join(elements, c(', ')), ...sparse_commas);
7675
+ push_array(chunks, join(elements, c(', ')));
7676
+ push_array(chunks, sparse_commas);
7707
7677
  }
7708
7678
 
7709
7679
  chunks.push(c(']'));
@@ -7723,7 +7693,7 @@
7723
7693
  const separator = c(', ');
7724
7694
 
7725
7695
  node.properties.forEach((p, i) => {
7726
- chunks.push(...handle(p, {
7696
+ push_array(chunks, handle(p, {
7727
7697
  ...state,
7728
7698
  indent: state.indent + '\t'
7729
7699
  }));
@@ -7811,13 +7781,11 @@
7811
7781
  chunks.push(c('*'));
7812
7782
  }
7813
7783
 
7814
- chunks.push(
7815
- ...(node.computed ? [c('['), ...key, c(']')] : key),
7816
- c('('),
7817
- ...join(node.value.params.map((/** @type {Pattern} */ param) => handle(param, state)), c(', ')),
7818
- c(') '),
7819
- ...handle(node.value.body, state)
7820
- );
7784
+ push_array(chunks, node.computed ? [c('['), ...key, c(']')] : key);
7785
+ chunks.push(c('('));
7786
+ push_array(chunks, join(node.value.params.map((/** @type {Pattern} */ param) => handle(param, state)), c(', ')));
7787
+ chunks.push(c(') '));
7788
+ push_array(chunks, handle(node.value.body, state));
7821
7789
 
7822
7790
  return chunks;
7823
7791
  }
@@ -7842,7 +7810,7 @@
7842
7810
  const chunks = [c('{ ')];
7843
7811
 
7844
7812
  for (let i = 0; i < node.properties.length; i += 1) {
7845
- chunks.push(...handle(node.properties[i], state));
7813
+ push_array(chunks, handle(node.properties[i], state));
7846
7814
  if (i < node.properties.length - 1) chunks.push(c(', '));
7847
7815
  }
7848
7816
 
@@ -7872,13 +7840,11 @@
7872
7840
  EXPRESSIONS_PRECEDENCE[node.argument.type] <
7873
7841
  EXPRESSIONS_PRECEDENCE.UnaryExpression
7874
7842
  ) {
7875
- chunks.push(
7876
- c('('),
7877
- ...handle(node.argument, state),
7878
- c(')')
7879
- );
7843
+ chunks.push(c('('));
7844
+ push_array(chunks, handle(node.argument, state));
7845
+ chunks.push(c(')'));
7880
7846
  } else {
7881
- chunks.push(...handle(node.argument, state));
7847
+ push_array(chunks, handle(node.argument, state));
7882
7848
  }
7883
7849
 
7884
7850
  return chunks;
@@ -7899,6 +7865,9 @@
7899
7865
  },
7900
7866
 
7901
7867
  BinaryExpression(node, state) {
7868
+ /**
7869
+ * @type any[]
7870
+ */
7902
7871
  const chunks = [];
7903
7872
 
7904
7873
  // TODO
@@ -7909,44 +7878,41 @@
7909
7878
  // }
7910
7879
 
7911
7880
  if (needs_parens(node.left, node, false)) {
7912
- chunks.push(
7913
- c('('),
7914
- ...handle(node.left, state),
7915
- c(')')
7916
- );
7881
+ chunks.push(c('('));
7882
+ push_array(chunks, handle(node.left, state));
7883
+ chunks.push(c(')'));
7917
7884
  } else {
7918
- chunks.push(...handle(node.left, state));
7885
+ push_array(chunks, handle(node.left, state));
7919
7886
  }
7920
7887
 
7921
7888
  chunks.push(c(` ${node.operator} `));
7922
7889
 
7923
7890
  if (needs_parens(node.right, node, true)) {
7924
- chunks.push(
7925
- c('('),
7926
- ...handle(node.right, state),
7927
- c(')')
7928
- );
7891
+ chunks.push(c('('));
7892
+ push_array(chunks, handle(node.right, state));
7893
+ chunks.push(c(')'));
7929
7894
  } else {
7930
- chunks.push(...handle(node.right, state));
7895
+ push_array(chunks, handle(node.right, state));
7931
7896
  }
7932
7897
 
7933
7898
  return chunks;
7934
7899
  },
7935
7900
 
7936
7901
  ConditionalExpression(node, state) {
7902
+ /**
7903
+ * @type any[]
7904
+ */
7937
7905
  const chunks = [];
7938
7906
 
7939
7907
  if (
7940
7908
  EXPRESSIONS_PRECEDENCE[node.test.type] >
7941
7909
  EXPRESSIONS_PRECEDENCE.ConditionalExpression
7942
7910
  ) {
7943
- chunks.push(...handle(node.test, state));
7911
+ push_array(chunks, handle(node.test, state));
7944
7912
  } else {
7945
- chunks.push(
7946
- c('('),
7947
- ...handle(node.test, state),
7948
- c(')')
7949
- );
7913
+ chunks.push(c('('));
7914
+ push_array(chunks, handle(node.test, state));
7915
+ chunks.push(c(')'));
7950
7916
  }
7951
7917
 
7952
7918
  const child_state = { ...state, indent: state.indent + '\t' };
@@ -7960,19 +7926,15 @@
7960
7926
  );
7961
7927
 
7962
7928
  if (multiple_lines) {
7963
- chunks.push(
7964
- c(`\n${state.indent}? `),
7965
- ...consequent,
7966
- c(`\n${state.indent}: `),
7967
- ...alternate
7968
- );
7929
+ chunks.push(c(`\n${state.indent}? `));
7930
+ push_array(chunks, consequent);
7931
+ chunks.push(c(`\n${state.indent}: `));
7932
+ push_array(chunks, alternate);
7969
7933
  } else {
7970
- chunks.push(
7971
- c(` ? `),
7972
- ...consequent,
7973
- c(` : `),
7974
- ...alternate
7975
- );
7934
+ chunks.push(c(` ? `));
7935
+ push_array(chunks, consequent);
7936
+ chunks.push(c(` : `));
7937
+ push_array(chunks, alternate);
7976
7938
  }
7977
7939
 
7978
7940
  return chunks;
@@ -7985,13 +7947,11 @@
7985
7947
  EXPRESSIONS_PRECEDENCE[node.callee.type] <
7986
7948
  EXPRESSIONS_PRECEDENCE.CallExpression || has_call_expression(node.callee)
7987
7949
  ) {
7988
- chunks.push(
7989
- c('('),
7990
- ...handle(node.callee, state),
7991
- c(')')
7992
- );
7950
+ chunks.push(c('('));
7951
+ push_array(chunks, handle(node.callee, state));
7952
+ chunks.push(c(')'));
7993
7953
  } else {
7994
- chunks.push(...handle(node.callee, state));
7954
+ push_array(chunks, handle(node.callee, state));
7995
7955
  }
7996
7956
 
7997
7957
  // TODO this is copied from CallExpression — DRY it out
@@ -8004,11 +7964,9 @@
8004
7964
  ? c(',\n' + state.indent)
8005
7965
  : c(', ');
8006
7966
 
8007
- chunks.push(
8008
- c('('),
8009
- ...join(args, separator),
8010
- c(')')
8011
- );
7967
+ chunks.push(c('('));
7968
+ push_array(chunks, join(args, separator));
7969
+ chunks.push(c(')'));
8012
7970
 
8013
7971
  return chunks;
8014
7972
  },
@@ -8018,19 +7976,20 @@
8018
7976
  },
8019
7977
 
8020
7978
  CallExpression(/** @type {CallExpression} */ node, state) {
7979
+ /**
7980
+ * @type any[]
7981
+ */
8021
7982
  const chunks = [];
8022
7983
 
8023
7984
  if (
8024
7985
  EXPRESSIONS_PRECEDENCE[node.callee.type] <
8025
7986
  EXPRESSIONS_PRECEDENCE.CallExpression
8026
7987
  ) {
8027
- chunks.push(
8028
- c('('),
8029
- ...handle(node.callee, state),
8030
- c(')')
8031
- );
7988
+ chunks.push(c('('));
7989
+ push_array(chunks, handle(node.callee, state));
7990
+ chunks.push(c(')'));
8032
7991
  } else {
8033
- chunks.push(...handle(node.callee, state));
7992
+ push_array(chunks, handle(node.callee, state));
8034
7993
  }
8035
7994
 
8036
7995
  if (/** @type {SimpleCallExpression} */ (node).optional) {
@@ -8048,49 +8007,42 @@
8048
8007
  indent: `${state.indent}\t`
8049
8008
  }));
8050
8009
 
8051
- chunks.push(
8052
- c(`(\n${state.indent}\t`),
8053
- ...join(args, c(`,\n${state.indent}\t`)),
8054
- c(`\n${state.indent})`)
8055
- );
8010
+ chunks.push(c(`(\n${state.indent}\t`));
8011
+ push_array(chunks, join(args, c(`,\n${state.indent}\t`)));
8012
+ chunks.push(c(`\n${state.indent})`));
8056
8013
  } else {
8057
- chunks.push(
8058
- c('('),
8059
- ...join(args, c(', ')),
8060
- c(')')
8061
- );
8014
+ chunks.push(c('('));
8015
+ push_array(chunks, join(args, c(', ')));
8016
+ chunks.push(c(')'));
8062
8017
  }
8063
8018
 
8064
8019
  return chunks;
8065
8020
  },
8066
8021
 
8067
8022
  MemberExpression(node, state) {
8023
+ /**
8024
+ * @type any[]
8025
+ */
8068
8026
  const chunks = [];
8069
8027
 
8070
8028
  if (EXPRESSIONS_PRECEDENCE[node.object.type] < EXPRESSIONS_PRECEDENCE.MemberExpression) {
8071
- chunks.push(
8072
- c('('),
8073
- ...handle(node.object, state),
8074
- c(')')
8075
- );
8029
+ chunks.push(c('('));
8030
+ push_array(chunks, handle(node.object, state));
8031
+ chunks.push(c(')'));
8076
8032
  } else {
8077
- chunks.push(...handle(node.object, state));
8033
+ push_array(chunks, handle(node.object, state));
8078
8034
  }
8079
8035
 
8080
8036
  if (node.computed) {
8081
8037
  if (node.optional) {
8082
8038
  chunks.push(c('?.'));
8083
8039
  }
8084
- chunks.push(
8085
- c('['),
8086
- ...handle(node.property, state),
8087
- c(']')
8088
- );
8040
+ chunks.push(c('['));
8041
+ push_array(chunks, handle(node.property, state));
8042
+ chunks.push(c(']'));
8089
8043
  } else {
8090
- chunks.push(
8091
- c(node.optional ? '?.' : '.'),
8092
- ...handle(node.property, state)
8093
- );
8044
+ chunks.push(c(node.optional ? '?.' : '.'));
8045
+ push_array(chunks, handle(node.property, state));
8094
8046
  }
8095
8047
 
8096
8048
  return chunks;
@@ -19044,6 +18996,10 @@
19044
18996
  code: 'illegal-global',
19045
18997
  message: `${name} is an illegal variable name`
19046
18998
  }),
18999
+ illegal_variable_declaration: {
19000
+ code: 'illegal-variable-declaration',
19001
+ message: 'Cannot declare same variable name which is imported inside <script context="module">'
19002
+ },
19047
19003
  cyclical_reactive_declaration: (cycle) => ({
19048
19004
  code: 'cyclical-reactive-declaration',
19049
19005
  message: `Cyclical dependency detected: ${cycle.join(' → ')}`
@@ -19115,7 +19071,11 @@
19115
19071
  cyclical_const_tags: (cycle) => ({
19116
19072
  code: 'cyclical-const-tags',
19117
19073
  message: `Cyclical dependency detected: ${cycle.join(' → ')}`
19118
- })
19074
+ }),
19075
+ invalid_component_style_directive: {
19076
+ code: 'invalid-component-style-directive',
19077
+ message: 'Style directives cannot be used on components'
19078
+ }
19119
19079
  };
19120
19080
 
19121
19081
  class Expression {
@@ -19186,7 +19146,7 @@
19186
19146
  if (!lazy) {
19187
19147
  dependencies.add(name);
19188
19148
  }
19189
- component.add_reference(name);
19149
+ component.add_reference(node, name);
19190
19150
  component.warn_if_undefined(name, nodes[0], template_scope);
19191
19151
  }
19192
19152
  this.skip();
@@ -19218,7 +19178,7 @@
19218
19178
  each_block.has_binding = true;
19219
19179
  }
19220
19180
  else {
19221
- component.add_reference(name);
19181
+ component.add_reference(node, name);
19222
19182
  const variable = component.var_lookup.get(name);
19223
19183
  if (variable)
19224
19184
  variable[deep ? 'mutated' : 'reassigned'] = true;
@@ -19279,7 +19239,7 @@
19279
19239
  }
19280
19240
  else {
19281
19241
  dependencies.add(name);
19282
- component.add_reference(name); // TODO is this redundant/misplaced?
19242
+ component.add_reference(node, name); // TODO is this redundant/misplaced?
19283
19243
  }
19284
19244
  }
19285
19245
  else if (is_contextual(component, template_scope, name)) {
@@ -19303,11 +19263,20 @@
19303
19263
  if (node === function_expression) {
19304
19264
  const id = component.get_unique_name(sanitize(get_function_name(node, owner)));
19305
19265
  const declaration = b `const ${id} = ${node}`;
19306
- if (dependencies.size === 0 && contextual_dependencies.size === 0) {
19266
+ if (owner.type === 'ConstTag') {
19267
+ walk(node, {
19268
+ enter(node) {
19269
+ if (node.type === 'Identifier') {
19270
+ this.replace(block.renderer.reference(node, ctx));
19271
+ }
19272
+ }
19273
+ });
19274
+ }
19275
+ else if (dependencies.size === 0 && contextual_dependencies.size === 0) {
19307
19276
  // we can hoist this out of the component completely
19308
19277
  component.fully_hoisted.push(declaration);
19309
19278
  this.replace(id);
19310
- component.add_var({
19279
+ component.add_var(node, {
19311
19280
  name: id.name,
19312
19281
  internal: true,
19313
19282
  hoistable: true,
@@ -19572,7 +19541,7 @@
19572
19541
  if (is_reference(node, parent)) {
19573
19542
  const { name } = flatten_reference(node);
19574
19543
  if (!scope.is_let(name) && !scope.names.has(name)) {
19575
- component.add_reference(name);
19544
+ component.add_reference(node, name);
19576
19545
  }
19577
19546
  }
19578
19547
  }
@@ -19724,7 +19693,7 @@
19724
19693
  const object = info.name.split('.')[0];
19725
19694
  component.warn_if_undefined(object, info, scope);
19726
19695
  this.name = info.name;
19727
- component.add_reference(object);
19696
+ component.add_reference(this, object);
19728
19697
  this.expression = info.expression
19729
19698
  ? new Expression(component, this, scope, info.expression)
19730
19699
  : null;
@@ -19791,6 +19760,7 @@
19791
19760
  this.has_animation = false;
19792
19761
  ([this.const_tags, this.children] = get_const_tags(info.children, component, this, this));
19793
19762
  if (this.has_animation) {
19763
+ this.children = this.children.filter(child => !isEmptyNode(child));
19794
19764
  if (this.children.length !== 1) {
19795
19765
  const child = this.children.find(child => !!child.animation);
19796
19766
  component.error(child.animation, compiler_errors.invalid_animation_sole);
@@ -19803,6 +19773,9 @@
19803
19773
  : null;
19804
19774
  }
19805
19775
  }
19776
+ function isEmptyNode(node) {
19777
+ return node.type === 'Text' && node.data.trim() === '';
19778
+ }
19806
19779
 
19807
19780
  function string_literal(data) {
19808
19781
  return {
@@ -19985,7 +19958,7 @@
19985
19958
  super(component, parent, scope, info);
19986
19959
  component.warn_if_undefined(info.name, info, scope);
19987
19960
  this.name = info.name;
19988
- component.add_reference(info.name.split('.')[0]);
19961
+ component.add_reference(this, info.name.split('.')[0]);
19989
19962
  this.directive = info.intro && info.outro ? 'transition' : info.intro ? 'in' : 'out';
19990
19963
  this.is_local = info.modifiers.includes('local');
19991
19964
  if ((info.intro && parent.intro) || (info.outro && parent.outro)) {
@@ -20004,7 +19977,7 @@
20004
19977
  super(component, parent, scope, info);
20005
19978
  component.warn_if_undefined(info.name, info, scope);
20006
19979
  this.name = info.name;
20007
- component.add_reference(info.name.split('.')[0]);
19980
+ component.add_reference(this, info.name.split('.')[0]);
20008
19981
  if (parent.animation) {
20009
19982
  component.error(this, compiler_errors.duplicate_animation);
20010
19983
  return;
@@ -20126,6 +20099,21 @@
20126
20099
  }
20127
20100
  return parent_element.namespace || elements_without_text.has(parent_element.name);
20128
20101
  }
20102
+ keep_space() {
20103
+ if (this.component.component_options.preserveWhitespace)
20104
+ return true;
20105
+ return this.within_pre();
20106
+ }
20107
+ within_pre() {
20108
+ let node = this.parent;
20109
+ while (node) {
20110
+ if (node.type === 'Element' && node.name === 'pre') {
20111
+ return true;
20112
+ }
20113
+ node = node.parent;
20114
+ }
20115
+ return false;
20116
+ }
20129
20117
  }
20130
20118
 
20131
20119
  // The `foreign` namespace covers all DOM implementations that aren't HTML5.
@@ -20189,7 +20177,7 @@
20189
20177
  }
20190
20178
 
20191
20179
  const svg$1 = /^(?:altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|animateMotion|animateTransform|circle|clipPath|color-profile|cursor|defs|desc|discard|ellipse|feBlend|feColorMatrix|feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap|feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|font|font-face|font-face-format|font-face-name|font-face-src|font-face-uri|foreignObject|g|glyph|glyphRef|hatch|hatchpath|hkern|image|line|linearGradient|marker|mask|mesh|meshgradient|meshpatch|meshrow|metadata|missing-glyph|mpath|path|pattern|polygon|polyline|radialGradient|rect|set|solidcolor|stop|svg|switch|symbol|text|textPath|tref|tspan|unknown|use|view|vkern)$/;
20192
- const aria_attributes = 'activedescendant atomic autocomplete busy checked colcount colindex colspan controls current describedby details disabled dropeffect errormessage expanded flowto grabbed haspopup hidden invalid keyshortcuts label labelledby level live modal multiline multiselectable orientation owns placeholder posinset pressed readonly relevant required roledescription rowcount rowindex rowspan selected setsize sort valuemax valuemin valuenow valuetext'.split(' ');
20180
+ const aria_attributes = 'activedescendant atomic autocomplete busy checked colcount colindex colspan controls current describedby description details disabled dropeffect errormessage expanded flowto grabbed haspopup hidden invalid keyshortcuts label labelledby level live modal multiline multiselectable orientation owns placeholder posinset pressed readonly relevant required roledescription rowcount rowindex rowspan selected setsize sort valuemax valuemin valuenow valuetext'.split(' ');
20193
20181
  const aria_attribute_set = new Set(aria_attributes);
20194
20182
  const aria_roles = 'alert alertdialog application article banner blockquote button caption cell checkbox code columnheader combobox complementary contentinfo definition deletion dialog directory document emphasis feed figure form generic graphics-document graphics-object graphics-symbol grid gridcell group heading img link list listbox listitem log main marquee math meter menu menubar menuitem menuitemcheckbox menuitemradio navigation none note option paragraph presentation progressbar radio radiogroup region row rowgroup rowheader scrollbar search searchbox separator slider spinbutton status strong subscript superscript switch tab table tablist tabpanel term textbox time timer toolbar tooltip tree treegrid treeitem'.split(' ');
20195
20183
  const aria_role_set = new Set(aria_roles);
@@ -20947,7 +20935,7 @@
20947
20935
  if (info.name !== 'svelte:component' && info.name !== 'svelte:self') {
20948
20936
  const name = info.name.split('.')[0]; // accommodate namespaces
20949
20937
  component.warn_if_undefined(name, info, scope);
20950
- component.add_reference(name);
20938
+ component.add_reference(this, name);
20951
20939
  }
20952
20940
  this.name = info.name;
20953
20941
  this.expression = this.name === 'svelte:component'
@@ -20980,6 +20968,8 @@
20980
20968
  break;
20981
20969
  case 'Transition':
20982
20970
  return component.error(node, compiler_errors.invalid_transition);
20971
+ case 'StyleDirective':
20972
+ return component.error(node, compiler_errors.invalid_component_style_directive);
20983
20973
  default:
20984
20974
  throw new Error(`Not implemented: ${node.type}`);
20985
20975
  }
@@ -21261,6 +21251,19 @@
21261
21251
  }
21262
21252
  }
21263
21253
 
21254
+ /**
21255
+ * Pushes all `items` into `array` using `push`, therefore mutating the array.
21256
+ * We do this for memory and perf reasons, and because `array.push(...items)` would
21257
+ * run into a "max call stack size exceeded" error with too many items (~65k).
21258
+ * @param array
21259
+ * @param items
21260
+ */
21261
+ function push_array$1(array, items) {
21262
+ for (let i = 0; i < items.length; i++) {
21263
+ array.push(items[i]);
21264
+ }
21265
+ }
21266
+
21264
21267
  function get_constructor(type) {
21265
21268
  switch (type) {
21266
21269
  case 'AwaitBlock': return AwaitBlock;
@@ -21297,7 +21300,7 @@
21297
21300
  if (use_ignores)
21298
21301
  component.pop_ignores(), ignores = [];
21299
21302
  if (node.type === 'Comment' && node.ignores.length) {
21300
- ignores.push(...node.ignores);
21303
+ push_array$1(ignores, node.ignores);
21301
21304
  }
21302
21305
  if (last)
21303
21306
  last.next = node;
@@ -22243,14 +22246,7 @@
22243
22246
  return false;
22244
22247
  if (/[\S\u00A0]/.test(this.data))
22245
22248
  return false;
22246
- let node = this.parent && this.parent.node;
22247
- while (node) {
22248
- if (node.type === 'Element' && node.name === 'pre') {
22249
- return false;
22250
- }
22251
- node = node.parent;
22252
- }
22253
- return true;
22249
+ return !this.node.within_pre();
22254
22250
  }
22255
22251
  render(block, parent_node, parent_nodes) {
22256
22252
  if (this.skip)
@@ -23445,6 +23441,7 @@
23445
23441
  node.classes.length > 0 ||
23446
23442
  node.intro || node.outro ||
23447
23443
  node.handlers.length > 0 ||
23444
+ node.styles.length > 0 ||
23448
23445
  this.node.name === 'option' ||
23449
23446
  renderer.options.dev) {
23450
23447
  this.parent.cannot_use_innerhtml(); // need to use add_location
@@ -23743,7 +23740,7 @@
23743
23740
  this.attributes.forEach((attribute) => {
23744
23741
  if (attribute.node.name === 'class') {
23745
23742
  const dependencies = attribute.node.get_dependencies();
23746
- this.class_dependencies.push(...dependencies);
23743
+ push_array$1(this.class_dependencies, dependencies);
23747
23744
  }
23748
23745
  });
23749
23746
  if (this.node.attributes.some(attr => attr.is_spread)) {
@@ -24217,7 +24214,7 @@
24217
24214
  block.has_intro_method = has_intros;
24218
24215
  block.has_outro_method = has_outros;
24219
24216
  });
24220
- renderer.blocks.push(...blocks);
24217
+ push_array$1(renderer.blocks, blocks);
24221
24218
  }
24222
24219
  render(block, parent_node, parent_nodes) {
24223
24220
  const name = this.var;
@@ -25710,7 +25707,7 @@
25710
25707
  // *unless* there is no whitespace between this node and its next sibling
25711
25708
  if (this.nodes.length === 0) {
25712
25709
  const should_trim = (next_sibling ? (next_sibling.node.type === 'Text' && /^\s/.test(next_sibling.node.data) && trimmable_at(child, next_sibling)) : !child.has_ancestor('EachBlock'));
25713
- if (should_trim) {
25710
+ if (should_trim && !child.keep_space()) {
25714
25711
  data = trim_end(data);
25715
25712
  if (!data)
25716
25713
  continue;
@@ -25738,7 +25735,7 @@
25738
25735
  }
25739
25736
  if (strip_whitespace) {
25740
25737
  const first = this.nodes[0];
25741
- if (first && first.node.type === 'Text') {
25738
+ if (first && first.node.type === 'Text' && !first.node.keep_space()) {
25742
25739
  first.data = trim_start(first.data);
25743
25740
  if (!first.data) {
25744
25741
  first.var = null;
@@ -25953,7 +25950,7 @@
25953
25950
  const member = this.context_lookup.get(name);
25954
25951
  // TODO is this correct?
25955
25952
  if (this.component.var_lookup.get(name)) {
25956
- this.component.add_reference(name);
25953
+ this.component.add_reference(node, name);
25957
25954
  }
25958
25955
  if (member !== undefined) {
25959
25956
  const replacement = x `/*${member.name}*/ ${ctx}[${member.index}]`;
@@ -26797,13 +26794,6 @@
26797
26794
  }
26798
26795
  return [new_table, idx_map, val_changed, idx_changed];
26799
26796
  }
26800
- function pushArray(_this, other) {
26801
- // We use push to mutate in place for memory and perf reasons
26802
- // We use the for loop instead of _this.push(...other) to avoid the JS engine's function argument limit (65,535 in JavascriptCore)
26803
- for (let i = 0; i < other.length; i++) {
26804
- _this.push(other[i]);
26805
- }
26806
- }
26807
26797
  class MappedCode {
26808
26798
  constructor(string = '', map = null) {
26809
26799
  this.string = string;
@@ -26891,9 +26881,9 @@
26891
26881
  }
26892
26882
  }
26893
26883
  // combine last line + first line
26894
- pushArray(m1.mappings[m1.mappings.length - 1], m2.mappings.shift());
26884
+ push_array$1(m1.mappings[m1.mappings.length - 1], m2.mappings.shift());
26895
26885
  // append other lines
26896
- pushArray(m1.mappings, m2.mappings);
26886
+ push_array$1(m1.mappings, m2.mappings);
26897
26887
  return this;
26898
26888
  }
26899
26889
  static from_processed(string, map) {
@@ -27084,7 +27074,7 @@
27084
27074
  // fix order
27085
27075
  // TODO the deconflicted names of blocks are reversed... should set them here
27086
27076
  const blocks = renderer.blocks.slice().reverse();
27087
- body.push(...blocks.map(block => {
27077
+ push_array$1(body, blocks.map(block => {
27088
27078
  // TODO this is a horrible mess — renderer.blocks
27089
27079
  // contains a mixture of Blocks and Nodes
27090
27080
  if (block.render)
@@ -27505,7 +27495,7 @@
27505
27495
  }`
27506
27496
  });
27507
27497
  }
27508
- declaration.body.body.push(...accessors);
27498
+ push_array$1(declaration.body.body, accessors);
27509
27499
  body.push(declaration);
27510
27500
  if (component.tag != null) {
27511
27501
  body.push(b `
@@ -27539,7 +27529,7 @@
27539
27529
  }
27540
27530
  }
27541
27531
  `[0];
27542
- declaration.body.body.push(...accessors);
27532
+ push_array$1(declaration.body.body, accessors);
27543
27533
  body.push(declaration);
27544
27534
  }
27545
27535
  return { js: flatten(body), css };
@@ -27690,7 +27680,7 @@
27690
27680
  /^\s/.test(next.data) &&
27691
27681
  trimmable_at$1(child, next)
27692
27682
  : !child.has_ancestor('EachBlock');
27693
- if (should_trim) {
27683
+ if (should_trim && !child.keep_space()) {
27694
27684
  data = trim_end(data);
27695
27685
  if (!data)
27696
27686
  continue;
@@ -27710,7 +27700,7 @@
27710
27700
  }
27711
27701
  }
27712
27702
  const first = nodes[0];
27713
- if (first && first.type === 'Text') {
27703
+ if (first && first.type === 'Text' && !first.keep_space()) {
27714
27704
  first.data = trim_start(first.data);
27715
27705
  if (!first.data) {
27716
27706
  first.var = null;
@@ -30193,6 +30183,10 @@
30193
30183
  const first = this.node.value.children
30194
30184
  ? this.node.value.children[0]
30195
30185
  : this.node.value;
30186
+ // Don't minify whitespace in custom properties, since some browsers (Chromium < 99)
30187
+ // treat --foo: ; and --foo:; differently
30188
+ if (first.type === 'Raw' && /^\s+$/.test(first.value))
30189
+ return;
30196
30190
  let start = first.start;
30197
30191
  while (/\s/.test(code.original[start]))
30198
30192
  start += 1;
@@ -30359,7 +30353,7 @@
30359
30353
  const at_rule_declarations = node.block.children
30360
30354
  .filter(node => node.type === 'Declaration')
30361
30355
  .map(node => new Declaration$1(node));
30362
- atrule.declarations.push(...at_rule_declarations);
30356
+ push_array$1(atrule.declarations, at_rule_declarations);
30363
30357
  }
30364
30358
  current_atrule = atrule;
30365
30359
  }
@@ -30617,26 +30611,32 @@
30617
30611
  this.stylesheet.reify();
30618
30612
  this.stylesheet.warn_on_unused_selectors(this);
30619
30613
  }
30620
- add_var(variable, add_to_lookup = true) {
30614
+ add_var(node, variable, add_to_lookup = true) {
30621
30615
  this.vars.push(variable);
30622
30616
  if (add_to_lookup) {
30617
+ if (this.var_lookup.has(variable.name)) {
30618
+ const exists_var = this.var_lookup.get(variable.name);
30619
+ if (exists_var.module && exists_var.imported) {
30620
+ this.error(node, compiler_errors.illegal_variable_declaration);
30621
+ }
30622
+ }
30623
30623
  this.var_lookup.set(variable.name, variable);
30624
30624
  }
30625
30625
  }
30626
- add_reference(name) {
30626
+ add_reference(node, name) {
30627
30627
  const variable = this.var_lookup.get(name);
30628
30628
  if (variable) {
30629
30629
  variable.referenced = true;
30630
30630
  }
30631
30631
  else if (is_reserved_keyword(name)) {
30632
- this.add_var({
30632
+ this.add_var(node, {
30633
30633
  name,
30634
30634
  injected: true,
30635
30635
  referenced: true
30636
30636
  });
30637
30637
  }
30638
30638
  else if (name[0] === '$') {
30639
- this.add_var({
30639
+ this.add_var(node, {
30640
30640
  name,
30641
30641
  injected: true,
30642
30642
  referenced: true,
@@ -30652,7 +30652,7 @@
30652
30652
  }
30653
30653
  else {
30654
30654
  if (this.compile_options.varsReport === 'full') {
30655
- this.add_var({ name, referenced: true }, false);
30655
+ this.add_var(node, { name, referenced: true }, false);
30656
30656
  }
30657
30657
  this.used_names.add(name);
30658
30658
  }
@@ -30677,7 +30677,7 @@
30677
30677
  if (result) {
30678
30678
  const { compile_options, name } = this;
30679
30679
  const { format = 'esm' } = compile_options;
30680
- const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'3.46.2'}`;
30680
+ const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'3.46.5'}`;
30681
30681
  const program = { type: 'Program', body: result.js };
30682
30682
  walk(program, {
30683
30683
  enter: (node, parent, key) => {
@@ -30888,7 +30888,7 @@
30888
30888
  extract_names(declarator.id).forEach(name => {
30889
30889
  const variable = this.var_lookup.get(name);
30890
30890
  variable.export_name = name;
30891
- if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
30891
+ if (!module_script && variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
30892
30892
  this.warn(declarator, compiler_warnings.unused_export_let(this.name.name, name));
30893
30893
  }
30894
30894
  });
@@ -30906,7 +30906,7 @@
30906
30906
  const variable = this.var_lookup.get(specifier.local.name);
30907
30907
  if (variable) {
30908
30908
  variable.export_name = specifier.exported.name;
30909
- if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
30909
+ if (!module_script && variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
30910
30910
  this.warn(specifier, compiler_warnings.unused_export_let(this.name.name, specifier.exported.name));
30911
30911
  }
30912
30912
  }
@@ -30951,11 +30951,13 @@
30951
30951
  return this.error(node, compiler_errors.illegal_declaration);
30952
30952
  }
30953
30953
  const writable = node.type === 'VariableDeclaration' && (node.kind === 'var' || node.kind === 'let');
30954
- this.add_var({
30954
+ const imported = node.type.startsWith('Import');
30955
+ this.add_var(node, {
30955
30956
  name,
30956
30957
  module: true,
30957
30958
  hoistable: true,
30958
- writable
30959
+ writable,
30960
+ imported
30959
30961
  });
30960
30962
  });
30961
30963
  globals.forEach((node, name) => {
@@ -30963,7 +30965,7 @@
30963
30965
  return this.error(node, compiler_errors.illegal_subscription);
30964
30966
  }
30965
30967
  else {
30966
- this.add_var({
30968
+ this.add_var(node, {
30967
30969
  name,
30968
30970
  global: true,
30969
30971
  hoistable: true
@@ -31019,7 +31021,7 @@
31019
31021
  }
31020
31022
  const writable = node.type === 'VariableDeclaration' && (node.kind === 'var' || node.kind === 'let');
31021
31023
  const imported = node.type.startsWith('Import');
31022
- this.add_var({
31024
+ this.add_var(node, {
31023
31025
  name,
31024
31026
  initialised: instance_scope.initialised_declarations.has(name),
31025
31027
  writable,
@@ -31039,7 +31041,7 @@
31039
31041
  return;
31040
31042
  const node = globals.get(name);
31041
31043
  if (this.injected_reactive_declaration_vars.has(name)) {
31042
- this.add_var({
31044
+ this.add_var(node, {
31043
31045
  name,
31044
31046
  injected: true,
31045
31047
  writable: true,
@@ -31048,7 +31050,7 @@
31048
31050
  });
31049
31051
  }
31050
31052
  else if (is_reserved_keyword(name)) {
31051
- this.add_var({
31053
+ this.add_var(node, {
31052
31054
  name,
31053
31055
  injected: true
31054
31056
  });
@@ -31057,13 +31059,13 @@
31057
31059
  if (name === '$' || name[1] === '$') {
31058
31060
  return this.error(node, compiler_errors.illegal_global(name));
31059
31061
  }
31060
- this.add_var({
31062
+ this.add_var(node, {
31061
31063
  name,
31062
31064
  injected: true,
31063
31065
  mutated: true,
31064
31066
  writable: true
31065
31067
  });
31066
- this.add_reference(name.slice(1));
31068
+ this.add_reference(node, name.slice(1));
31067
31069
  const variable = this.var_lookup.get(name.slice(1));
31068
31070
  if (variable) {
31069
31071
  variable.subscribable = true;
@@ -31071,7 +31073,7 @@
31071
31073
  }
31072
31074
  }
31073
31075
  else {
31074
- this.add_var({
31076
+ this.add_var(node, {
31075
31077
  name,
31076
31078
  global: true,
31077
31079
  hoistable: true
@@ -32168,7 +32170,7 @@
32168
32170
  return result.to_processed();
32169
32171
  }
32170
32172
 
32171
- const VERSION = '3.46.2';
32173
+ const VERSION = '3.46.5';
32172
32174
 
32173
32175
  exports.VERSION = VERSION;
32174
32176
  exports.compile = compile;