rollup 4.8.0 → 4.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/rollup CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
3
  @license
4
- Rollup.js v4.8.0
5
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
4
+ Rollup.js v4.9.1
5
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
6
6
 
7
7
  https://github.com/rollup/rollup
8
8
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -16,7 +16,7 @@ import { xxhashBase64Url } from '../../native.js';
16
16
  import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version = "4.8.0";
19
+ var version = "4.9.1";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -2060,6 +2060,20 @@ function makeLegal(value) {
2060
2060
  value = `_${value}`;
2061
2061
  return value || '_';
2062
2062
  }
2063
+ const VALID_IDENTIFIER_REGEXP = /^[$_\p{ID_Start}][$\u200C\u200D\p{ID_Continue}]*$/u;
2064
+ const NUMBER_REGEXP = /^\d+$/;
2065
+ function stringifyObjectKeyIfNeeded(key) {
2066
+ if (VALID_IDENTIFIER_REGEXP.test(key) || NUMBER_REGEXP.test(key)) {
2067
+ return key;
2068
+ }
2069
+ return JSON.stringify(key);
2070
+ }
2071
+ function stringifyIdentifierIfNeeded(key) {
2072
+ if (VALID_IDENTIFIER_REGEXP.test(key)) {
2073
+ return key;
2074
+ }
2075
+ return JSON.stringify(key);
2076
+ }
2063
2077
 
2064
2078
  class ExternalModule {
2065
2079
  constructor(options, id, moduleSideEffects, meta, renormalizeRenderPath, attributes) {
@@ -7849,7 +7863,7 @@ function getSystemExportStatement(exportedVariables, { exportNamesByVariable, sn
7849
7863
  if (exportedVariables.length === 1 &&
7850
7864
  exportNamesByVariable.get(exportedVariables[0]).length === 1) {
7851
7865
  const variable = exportedVariables[0];
7852
- return `exports('${exportNamesByVariable.get(variable)}',${_}${variable.getName(getPropertyAccess)}${modifier})`;
7866
+ return `exports(${JSON.stringify(exportNamesByVariable.get(variable)[0])},${_}${variable.getName(getPropertyAccess)}${modifier})`;
7853
7867
  }
7854
7868
  else {
7855
7869
  const fields = [];
@@ -7861,8 +7875,9 @@ function getSystemExportStatement(exportedVariables, { exportNamesByVariable, sn
7861
7875
  return `exports(${getObject(fields, { lineBreakIndent: null })})`;
7862
7876
  }
7863
7877
  }
7878
+ // This is only invoked if there is exactly one export name
7864
7879
  function renderSystemExportExpression(exportedVariable, expressionStart, expressionEnd, code, { exportNamesByVariable, snippets: { _ } }) {
7865
- code.prependRight(expressionStart, `exports('${exportNamesByVariable.get(exportedVariable)}',${_}`);
7880
+ code.prependRight(expressionStart, `exports(${JSON.stringify(exportNamesByVariable.get(exportedVariable)[0])},${_}`);
7866
7881
  code.appendLeft(expressionEnd, ')');
7867
7882
  }
7868
7883
  function renderSystemExportFunction(exportedVariables, expressionStart, expressionEnd, needsParens, code, options) {
@@ -9787,14 +9802,12 @@ class IfStatement extends NodeBase {
9787
9802
  const { brokenFlow } = context;
9788
9803
  if (this.consequent.hasEffects(context))
9789
9804
  return true;
9790
- // eslint-disable-next-line unicorn/consistent-destructuring
9791
9805
  const consequentBrokenFlow = context.brokenFlow;
9792
9806
  context.brokenFlow = brokenFlow;
9793
9807
  if (this.alternate === null)
9794
9808
  return false;
9795
9809
  if (this.alternate.hasEffects(context))
9796
9810
  return true;
9797
- // eslint-disable-next-line unicorn/consistent-destructuring
9798
9811
  context.brokenFlow = context.brokenFlow && consequentBrokenFlow;
9799
9812
  return false;
9800
9813
  }
@@ -9897,13 +9910,11 @@ class IfStatement extends NodeBase {
9897
9910
  let consequentBrokenFlow = false;
9898
9911
  if (this.consequent.shouldBeIncluded(context)) {
9899
9912
  this.consequent.include(context, false, { asSingleStatement: true });
9900
- // eslint-disable-next-line unicorn/consistent-destructuring
9901
9913
  consequentBrokenFlow = context.brokenFlow;
9902
9914
  context.brokenFlow = brokenFlow;
9903
9915
  }
9904
9916
  if (this.alternate?.shouldBeIncluded(context)) {
9905
9917
  this.alternate.include(context, false, { asSingleStatement: true });
9906
- // eslint-disable-next-line unicorn/consistent-destructuring
9907
9918
  context.brokenFlow = context.brokenFlow && consequentBrokenFlow;
9908
9919
  }
9909
9920
  }
@@ -10528,26 +10539,34 @@ class ImportSpecifier extends NodeBase {
10528
10539
 
10529
10540
  class LabeledStatement extends NodeBase {
10530
10541
  hasEffects(context) {
10531
- const brokenFlow = context.brokenFlow;
10542
+ const { brokenFlow, includedLabels } = context;
10532
10543
  context.ignore.labels.add(this.label.name);
10533
- if (this.body.hasEffects(context))
10534
- return true;
10535
- context.ignore.labels.delete(this.label.name);
10536
- if (context.includedLabels.has(this.label.name)) {
10537
- context.includedLabels.delete(this.label.name);
10538
- context.brokenFlow = brokenFlow;
10544
+ context.includedLabels = new Set();
10545
+ let bodyHasEffects = false;
10546
+ if (this.body.hasEffects(context)) {
10547
+ bodyHasEffects = true;
10539
10548
  }
10540
- return false;
10549
+ else {
10550
+ context.ignore.labels.delete(this.label.name);
10551
+ if (context.includedLabels.has(this.label.name)) {
10552
+ context.includedLabels.delete(this.label.name);
10553
+ context.brokenFlow = brokenFlow;
10554
+ }
10555
+ }
10556
+ context.includedLabels = new Set([...includedLabels, ...context.includedLabels]);
10557
+ return bodyHasEffects;
10541
10558
  }
10542
10559
  include(context, includeChildrenRecursively) {
10543
10560
  this.included = true;
10544
- const brokenFlow = context.brokenFlow;
10561
+ const { brokenFlow, includedLabels } = context;
10562
+ context.includedLabels = new Set();
10545
10563
  this.body.include(context, includeChildrenRecursively);
10546
10564
  if (includeChildrenRecursively || context.includedLabels.has(this.label.name)) {
10547
10565
  this.label.include();
10548
10566
  context.includedLabels.delete(this.label.name);
10549
10567
  context.brokenFlow = brokenFlow;
10550
10568
  }
10569
+ context.includedLabels = new Set([...includedLabels, ...context.includedLabels]);
10551
10570
  }
10552
10571
  render(code, options) {
10553
10572
  if (this.label.included) {
@@ -11291,7 +11310,6 @@ class SwitchStatement extends NodeBase {
11291
11310
  for (const switchCase of this.cases) {
11292
11311
  if (switchCase.hasEffects(context))
11293
11312
  return true;
11294
- // eslint-disable-next-line unicorn/consistent-destructuring
11295
11313
  onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak;
11296
11314
  context.hasBreak = false;
11297
11315
  context.brokenFlow = brokenFlow;
@@ -11323,7 +11341,6 @@ class SwitchStatement extends NodeBase {
11323
11341
  }
11324
11342
  if (isCaseIncluded) {
11325
11343
  switchCase.include(context, includeChildrenRecursively);
11326
- // eslint-disable-next-line unicorn/consistent-destructuring
11327
11344
  onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak;
11328
11345
  context.hasBreak = false;
11329
11346
  context.brokenFlow = brokenFlow;
@@ -12182,7 +12199,7 @@ class NamespaceVariable extends Variable {
12182
12199
  if (this.referencedEarly || variable.isReassigned || variable === this) {
12183
12200
  return [
12184
12201
  null,
12185
- `get ${name}${_}()${_}{${_}return ${variable.getName(getPropertyAccess)}${s}${_}}`
12202
+ `get ${stringifyObjectKeyIfNeeded(name)}${_}()${_}{${_}return ${variable.getName(getPropertyAccess)}${s}${_}}`
12186
12203
  ];
12187
12204
  }
12188
12205
  return [name, variable.getName(getPropertyAccess)];
@@ -13220,7 +13237,7 @@ class Module {
13220
13237
  this.addSource(source, node);
13221
13238
  if (node.exported) {
13222
13239
  // export * as name from './other'
13223
- const name = node.exported.name;
13240
+ const name = node.exported instanceof Literal ? node.exported.value : node.exported.name;
13224
13241
  this.assertUniqueExportName(name, node.exported.start);
13225
13242
  this.reexportDescriptions.set(name, {
13226
13243
  localName: '*',
@@ -13552,7 +13569,7 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
13552
13569
  name: null
13553
13570
  });
13554
13571
  exportBlock +=
13555
- `Object.defineProperty(exports,${_}'${specifier.reexported}',${_}{${n}` +
13572
+ `Object.defineProperty(exports,${_}${JSON.stringify(specifier.reexported)},${_}{${n}` +
13556
13573
  `${t}enumerable:${_}true,${n}` +
13557
13574
  `${t}get:${_}${left}${importName}${right}${n}});`;
13558
13575
  }
@@ -13930,7 +13947,7 @@ function getImportBlock(dependencies, { _ }) {
13930
13947
  importBlock.push(`import ${defaultImport ? `${defaultImport.local},${_}` : ''}{${_}${importedNames
13931
13948
  .map(specifier => specifier.imported === specifier.local
13932
13949
  ? specifier.imported
13933
- : `${specifier.imported} as ${specifier.local}`)
13950
+ : `${stringifyIdentifierIfNeeded(specifier.imported)} as ${specifier.local}`)
13934
13951
  .join(`,${_}`)}${_}}${_}from${_}${pathWithAssertion}`);
13935
13952
  }
13936
13953
  }
@@ -13958,14 +13975,16 @@ function getImportBlock(dependencies, { _ }) {
13958
13975
  importBlock.push(`import${_}*${_}as ${name} from${_}${pathWithAssertion}`);
13959
13976
  }
13960
13977
  for (const specifier of namespaceReexports) {
13961
- importBlock.push(`export${_}{${_}${name === specifier.reexported ? name : `${name} as ${specifier.reexported}`} };`);
13978
+ importBlock.push(`export${_}{${_}${name === specifier.reexported
13979
+ ? name
13980
+ : `${name} as ${stringifyIdentifierIfNeeded(specifier.reexported)}`} };`);
13962
13981
  }
13963
13982
  }
13964
13983
  if (namedReexports.length > 0) {
13965
13984
  importBlock.push(`export${_}{${_}${namedReexports
13966
13985
  .map(specifier => specifier.imported === specifier.reexported
13967
- ? specifier.imported
13968
- : `${specifier.imported} as ${specifier.reexported}`)
13986
+ ? stringifyIdentifierIfNeeded(specifier.imported)
13987
+ : `${stringifyIdentifierIfNeeded(specifier.imported)} as ${stringifyIdentifierIfNeeded(specifier.reexported)}`)
13969
13988
  .join(`,${_}`)}${_}}${_}from${_}${pathWithAssertion}`);
13970
13989
  }
13971
13990
  }
@@ -13981,7 +14000,7 @@ function getExportBlock(exports, { _, cnst }) {
13981
14000
  }
13982
14001
  exportDeclaration.push(specifier.exported === specifier.local
13983
14002
  ? specifier.local
13984
- : `${specifier.local} as ${specifier.exported}`);
14003
+ : `${specifier.local} as ${stringifyIdentifierIfNeeded(specifier.exported)}`);
13985
14004
  }
13986
14005
  if (exportDeclaration.length > 0) {
13987
14006
  exportBlock.push(`export${_}{${_}${exportDeclaration.join(`,${_}`)}${_}};`);
@@ -14397,7 +14416,7 @@ function deconflictImportsEsmOrSystem(usedNames, imports, dependenciesToBeDeconf
14397
14416
  : module.suggestedVariableName, usedNames, variable.forbiddenNames));
14398
14417
  }
14399
14418
  else {
14400
- variable.setRenderNames(null, getSafeName(name, usedNames, variable.forbiddenNames));
14419
+ variable.setRenderNames(null, getSafeName(makeLegal(name), usedNames, variable.forbiddenNames));
14401
14420
  }
14402
14421
  }
14403
14422
  for (const variable of syntheticExports) {
@@ -16527,8 +16546,8 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
16527
16546
  : `${s}${lineBreakIndent ? `${n}${lineBreakIndent.base}` : _}}`
16528
16547
  ];
16529
16548
  const isValidPropertyName = reservedNamesAsProps
16530
- ? (name) => validPropertyName.test(name)
16531
- : (name) => !RESERVED_NAMES$1.has(name) && validPropertyName.test(name);
16549
+ ? (name) => VALID_IDENTIFIER_REGEXP.test(name)
16550
+ : (name) => !RESERVED_NAMES$1.has(name) && VALID_IDENTIFIER_REGEXP.test(name);
16532
16551
  return {
16533
16552
  _,
16534
16553
  cnst,
@@ -16549,10 +16568,10 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
16549
16568
  .map(([key, value]) => {
16550
16569
  if (key === null)
16551
16570
  return `${prefix}${value}`;
16552
- const needsQuotes = !isValidPropertyName(key);
16553
- return key === value && objectShorthand && !needsQuotes
16571
+ const keyInObject = stringifyObjectKeyIfNeeded(key);
16572
+ return key === value && objectShorthand && key === keyInObject
16554
16573
  ? prefix + key
16555
- : `${prefix}${needsQuotes ? `'${key}'` : key}:${_}${value}`;
16574
+ : `${prefix}${keyInObject}:${_}${value}`;
16556
16575
  })
16557
16576
  .join(`,`)}${fields.length === 0 ? '' : lineBreakIndent ? `${n}${lineBreakIndent.base}` : _}}`;
16558
16577
  },
@@ -16562,7 +16581,6 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
16562
16581
  };
16563
16582
  }
16564
16583
  const wrapIfNeeded = (code, needsParens) => needsParens ? `(${code})` : code;
16565
- const validPropertyName = /^(?!\d)[\w$]+$/;
16566
16584
 
16567
16585
  class Source {
16568
16586
  constructor(filename, content) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/parseAst.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
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.8.0";
34
+ var version = "4.9.1";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -3506,6 +3506,20 @@ function makeLegal(value) {
3506
3506
  value = `_${value}`;
3507
3507
  return value || '_';
3508
3508
  }
3509
+ const VALID_IDENTIFIER_REGEXP = /^[$_\p{ID_Start}][$\u200C\u200D\p{ID_Continue}]*$/u;
3510
+ const NUMBER_REGEXP = /^\d+$/;
3511
+ function stringifyObjectKeyIfNeeded(key) {
3512
+ if (VALID_IDENTIFIER_REGEXP.test(key) || NUMBER_REGEXP.test(key)) {
3513
+ return key;
3514
+ }
3515
+ return JSON.stringify(key);
3516
+ }
3517
+ function stringifyIdentifierIfNeeded(key) {
3518
+ if (VALID_IDENTIFIER_REGEXP.test(key)) {
3519
+ return key;
3520
+ }
3521
+ return JSON.stringify(key);
3522
+ }
3509
3523
 
3510
3524
  class ExternalModule {
3511
3525
  constructor(options, id, moduleSideEffects, meta, renormalizeRenderPath, attributes) {
@@ -9281,7 +9295,7 @@ function getSystemExportStatement(exportedVariables, { exportNamesByVariable, sn
9281
9295
  if (exportedVariables.length === 1 &&
9282
9296
  exportNamesByVariable.get(exportedVariables[0]).length === 1) {
9283
9297
  const variable = exportedVariables[0];
9284
- return `exports('${exportNamesByVariable.get(variable)}',${_}${variable.getName(getPropertyAccess)}${modifier})`;
9298
+ return `exports(${JSON.stringify(exportNamesByVariable.get(variable)[0])},${_}${variable.getName(getPropertyAccess)}${modifier})`;
9285
9299
  }
9286
9300
  else {
9287
9301
  const fields = [];
@@ -9293,8 +9307,9 @@ function getSystemExportStatement(exportedVariables, { exportNamesByVariable, sn
9293
9307
  return `exports(${getObject(fields, { lineBreakIndent: null })})`;
9294
9308
  }
9295
9309
  }
9310
+ // This is only invoked if there is exactly one export name
9296
9311
  function renderSystemExportExpression(exportedVariable, expressionStart, expressionEnd, code, { exportNamesByVariable, snippets: { _ } }) {
9297
- code.prependRight(expressionStart, `exports('${exportNamesByVariable.get(exportedVariable)}',${_}`);
9312
+ code.prependRight(expressionStart, `exports(${JSON.stringify(exportNamesByVariable.get(exportedVariable)[0])},${_}`);
9298
9313
  code.appendLeft(expressionEnd, ')');
9299
9314
  }
9300
9315
  function renderSystemExportFunction(exportedVariables, expressionStart, expressionEnd, needsParens, code, options) {
@@ -11219,14 +11234,12 @@ class IfStatement extends NodeBase {
11219
11234
  const { brokenFlow } = context;
11220
11235
  if (this.consequent.hasEffects(context))
11221
11236
  return true;
11222
- // eslint-disable-next-line unicorn/consistent-destructuring
11223
11237
  const consequentBrokenFlow = context.brokenFlow;
11224
11238
  context.brokenFlow = brokenFlow;
11225
11239
  if (this.alternate === null)
11226
11240
  return false;
11227
11241
  if (this.alternate.hasEffects(context))
11228
11242
  return true;
11229
- // eslint-disable-next-line unicorn/consistent-destructuring
11230
11243
  context.brokenFlow = context.brokenFlow && consequentBrokenFlow;
11231
11244
  return false;
11232
11245
  }
@@ -11329,13 +11342,11 @@ class IfStatement extends NodeBase {
11329
11342
  let consequentBrokenFlow = false;
11330
11343
  if (this.consequent.shouldBeIncluded(context)) {
11331
11344
  this.consequent.include(context, false, { asSingleStatement: true });
11332
- // eslint-disable-next-line unicorn/consistent-destructuring
11333
11345
  consequentBrokenFlow = context.brokenFlow;
11334
11346
  context.brokenFlow = brokenFlow;
11335
11347
  }
11336
11348
  if (this.alternate?.shouldBeIncluded(context)) {
11337
11349
  this.alternate.include(context, false, { asSingleStatement: true });
11338
- // eslint-disable-next-line unicorn/consistent-destructuring
11339
11350
  context.brokenFlow = context.brokenFlow && consequentBrokenFlow;
11340
11351
  }
11341
11352
  }
@@ -11960,26 +11971,34 @@ class ImportSpecifier extends NodeBase {
11960
11971
 
11961
11972
  class LabeledStatement extends NodeBase {
11962
11973
  hasEffects(context) {
11963
- const brokenFlow = context.brokenFlow;
11974
+ const { brokenFlow, includedLabels } = context;
11964
11975
  context.ignore.labels.add(this.label.name);
11965
- if (this.body.hasEffects(context))
11966
- return true;
11967
- context.ignore.labels.delete(this.label.name);
11968
- if (context.includedLabels.has(this.label.name)) {
11969
- context.includedLabels.delete(this.label.name);
11970
- context.brokenFlow = brokenFlow;
11976
+ context.includedLabels = new Set();
11977
+ let bodyHasEffects = false;
11978
+ if (this.body.hasEffects(context)) {
11979
+ bodyHasEffects = true;
11971
11980
  }
11972
- return false;
11981
+ else {
11982
+ context.ignore.labels.delete(this.label.name);
11983
+ if (context.includedLabels.has(this.label.name)) {
11984
+ context.includedLabels.delete(this.label.name);
11985
+ context.brokenFlow = brokenFlow;
11986
+ }
11987
+ }
11988
+ context.includedLabels = new Set([...includedLabels, ...context.includedLabels]);
11989
+ return bodyHasEffects;
11973
11990
  }
11974
11991
  include(context, includeChildrenRecursively) {
11975
11992
  this.included = true;
11976
- const brokenFlow = context.brokenFlow;
11993
+ const { brokenFlow, includedLabels } = context;
11994
+ context.includedLabels = new Set();
11977
11995
  this.body.include(context, includeChildrenRecursively);
11978
11996
  if (includeChildrenRecursively || context.includedLabels.has(this.label.name)) {
11979
11997
  this.label.include();
11980
11998
  context.includedLabels.delete(this.label.name);
11981
11999
  context.brokenFlow = brokenFlow;
11982
12000
  }
12001
+ context.includedLabels = new Set([...includedLabels, ...context.includedLabels]);
11983
12002
  }
11984
12003
  render(code, options) {
11985
12004
  if (this.label.included) {
@@ -12723,7 +12742,6 @@ class SwitchStatement extends NodeBase {
12723
12742
  for (const switchCase of this.cases) {
12724
12743
  if (switchCase.hasEffects(context))
12725
12744
  return true;
12726
- // eslint-disable-next-line unicorn/consistent-destructuring
12727
12745
  onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak;
12728
12746
  context.hasBreak = false;
12729
12747
  context.brokenFlow = brokenFlow;
@@ -12755,7 +12773,6 @@ class SwitchStatement extends NodeBase {
12755
12773
  }
12756
12774
  if (isCaseIncluded) {
12757
12775
  switchCase.include(context, includeChildrenRecursively);
12758
- // eslint-disable-next-line unicorn/consistent-destructuring
12759
12776
  onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak;
12760
12777
  context.hasBreak = false;
12761
12778
  context.brokenFlow = brokenFlow;
@@ -13614,7 +13631,7 @@ class NamespaceVariable extends Variable {
13614
13631
  if (this.referencedEarly || variable.isReassigned || variable === this) {
13615
13632
  return [
13616
13633
  null,
13617
- `get ${name}${_}()${_}{${_}return ${variable.getName(getPropertyAccess)}${s}${_}}`
13634
+ `get ${stringifyObjectKeyIfNeeded(name)}${_}()${_}{${_}return ${variable.getName(getPropertyAccess)}${s}${_}}`
13618
13635
  ];
13619
13636
  }
13620
13637
  return [name, variable.getName(getPropertyAccess)];
@@ -14645,7 +14662,7 @@ class Module {
14645
14662
  this.addSource(source, node);
14646
14663
  if (node.exported) {
14647
14664
  // export * as name from './other'
14648
- const name = node.exported.name;
14665
+ const name = node.exported instanceof Literal ? node.exported.value : node.exported.name;
14649
14666
  this.assertUniqueExportName(name, node.exported.start);
14650
14667
  this.reexportDescriptions.set(name, {
14651
14668
  localName: '*',
@@ -14977,7 +14994,7 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
14977
14994
  name: null
14978
14995
  });
14979
14996
  exportBlock +=
14980
- `Object.defineProperty(exports,${_}'${specifier.reexported}',${_}{${n}` +
14997
+ `Object.defineProperty(exports,${_}${JSON.stringify(specifier.reexported)},${_}{${n}` +
14981
14998
  `${t}enumerable:${_}true,${n}` +
14982
14999
  `${t}get:${_}${left}${importName}${right}${n}});`;
14983
15000
  }
@@ -15355,7 +15372,7 @@ function getImportBlock(dependencies, { _ }) {
15355
15372
  importBlock.push(`import ${defaultImport ? `${defaultImport.local},${_}` : ''}{${_}${importedNames
15356
15373
  .map(specifier => specifier.imported === specifier.local
15357
15374
  ? specifier.imported
15358
- : `${specifier.imported} as ${specifier.local}`)
15375
+ : `${stringifyIdentifierIfNeeded(specifier.imported)} as ${specifier.local}`)
15359
15376
  .join(`,${_}`)}${_}}${_}from${_}${pathWithAssertion}`);
15360
15377
  }
15361
15378
  }
@@ -15383,14 +15400,16 @@ function getImportBlock(dependencies, { _ }) {
15383
15400
  importBlock.push(`import${_}*${_}as ${name} from${_}${pathWithAssertion}`);
15384
15401
  }
15385
15402
  for (const specifier of namespaceReexports) {
15386
- importBlock.push(`export${_}{${_}${name === specifier.reexported ? name : `${name} as ${specifier.reexported}`} };`);
15403
+ importBlock.push(`export${_}{${_}${name === specifier.reexported
15404
+ ? name
15405
+ : `${name} as ${stringifyIdentifierIfNeeded(specifier.reexported)}`} };`);
15387
15406
  }
15388
15407
  }
15389
15408
  if (namedReexports.length > 0) {
15390
15409
  importBlock.push(`export${_}{${_}${namedReexports
15391
15410
  .map(specifier => specifier.imported === specifier.reexported
15392
- ? specifier.imported
15393
- : `${specifier.imported} as ${specifier.reexported}`)
15411
+ ? stringifyIdentifierIfNeeded(specifier.imported)
15412
+ : `${stringifyIdentifierIfNeeded(specifier.imported)} as ${stringifyIdentifierIfNeeded(specifier.reexported)}`)
15394
15413
  .join(`,${_}`)}${_}}${_}from${_}${pathWithAssertion}`);
15395
15414
  }
15396
15415
  }
@@ -15406,7 +15425,7 @@ function getExportBlock(exports, { _, cnst }) {
15406
15425
  }
15407
15426
  exportDeclaration.push(specifier.exported === specifier.local
15408
15427
  ? specifier.local
15409
- : `${specifier.local} as ${specifier.exported}`);
15428
+ : `${specifier.local} as ${stringifyIdentifierIfNeeded(specifier.exported)}`);
15410
15429
  }
15411
15430
  if (exportDeclaration.length > 0) {
15412
15431
  exportBlock.push(`export${_}{${_}${exportDeclaration.join(`,${_}`)}${_}};`);
@@ -15822,7 +15841,7 @@ function deconflictImportsEsmOrSystem(usedNames, imports, dependenciesToBeDeconf
15822
15841
  : module.suggestedVariableName, usedNames, variable.forbiddenNames));
15823
15842
  }
15824
15843
  else {
15825
- variable.setRenderNames(null, getSafeName(name, usedNames, variable.forbiddenNames));
15844
+ variable.setRenderNames(null, getSafeName(makeLegal(name), usedNames, variable.forbiddenNames));
15826
15845
  }
15827
15846
  }
15828
15847
  for (const variable of syntheticExports) {
@@ -17847,8 +17866,8 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
17847
17866
  : `${s}${lineBreakIndent ? `${n}${lineBreakIndent.base}` : _}}`
17848
17867
  ];
17849
17868
  const isValidPropertyName = reservedNamesAsProps
17850
- ? (name) => validPropertyName.test(name)
17851
- : (name) => !RESERVED_NAMES$1.has(name) && validPropertyName.test(name);
17869
+ ? (name) => VALID_IDENTIFIER_REGEXP.test(name)
17870
+ : (name) => !RESERVED_NAMES$1.has(name) && VALID_IDENTIFIER_REGEXP.test(name);
17852
17871
  return {
17853
17872
  _,
17854
17873
  cnst,
@@ -17869,10 +17888,10 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
17869
17888
  .map(([key, value]) => {
17870
17889
  if (key === null)
17871
17890
  return `${prefix}${value}`;
17872
- const needsQuotes = !isValidPropertyName(key);
17873
- return key === value && objectShorthand && !needsQuotes
17891
+ const keyInObject = stringifyObjectKeyIfNeeded(key);
17892
+ return key === value && objectShorthand && key === keyInObject
17874
17893
  ? prefix + key
17875
- : `${prefix}${needsQuotes ? `'${key}'` : key}:${_}${value}`;
17894
+ : `${prefix}${keyInObject}:${_}${value}`;
17876
17895
  })
17877
17896
  .join(`,`)}${fields.length === 0 ? '' : lineBreakIndent ? `${n}${lineBreakIndent.base}` : _}}`;
17878
17897
  },
@@ -17882,7 +17901,6 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
17882
17901
  };
17883
17902
  }
17884
17903
  const wrapIfNeeded = (code, needsParens) => needsParens ? `(${code})` : code;
17885
- const validPropertyName = /^(?!\d)[\w$]+$/;
17886
17904
 
17887
17905
  class Source {
17888
17906
  constructor(filename, content) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.8.0
4
- Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
3
+ Rollup.js v4.9.1
4
+ Sun, 17 Dec 2023 06:25:43 GMT - commit d56ac63dc0452820272a0d7536340277f7db68bf
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",
3
- "version": "4.8.0",
3
+ "version": "4.9.1",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -101,19 +101,19 @@
101
101
  "homepage": "https://rollupjs.org/",
102
102
  "optionalDependencies": {
103
103
  "fsevents": "~2.3.2",
104
- "@rollup/rollup-darwin-arm64": "4.8.0",
105
- "@rollup/rollup-android-arm64": "4.8.0",
106
- "@rollup/rollup-win32-arm64-msvc": "4.8.0",
107
- "@rollup/rollup-linux-arm64-gnu": "4.8.0",
108
- "@rollup/rollup-linux-arm64-musl": "4.8.0",
109
- "@rollup/rollup-android-arm-eabi": "4.8.0",
110
- "@rollup/rollup-linux-arm-gnueabihf": "4.8.0",
111
- "@rollup/rollup-win32-ia32-msvc": "4.8.0",
112
- "@rollup/rollup-linux-riscv64-gnu": "4.8.0",
113
- "@rollup/rollup-darwin-x64": "4.8.0",
114
- "@rollup/rollup-win32-x64-msvc": "4.8.0",
115
- "@rollup/rollup-linux-x64-gnu": "4.8.0",
116
- "@rollup/rollup-linux-x64-musl": "4.8.0"
104
+ "@rollup/rollup-darwin-arm64": "4.9.1",
105
+ "@rollup/rollup-android-arm64": "4.9.1",
106
+ "@rollup/rollup-win32-arm64-msvc": "4.9.1",
107
+ "@rollup/rollup-linux-arm64-gnu": "4.9.1",
108
+ "@rollup/rollup-linux-arm64-musl": "4.9.1",
109
+ "@rollup/rollup-android-arm-eabi": "4.9.1",
110
+ "@rollup/rollup-linux-arm-gnueabihf": "4.9.1",
111
+ "@rollup/rollup-win32-ia32-msvc": "4.9.1",
112
+ "@rollup/rollup-linux-riscv64-gnu": "4.9.1",
113
+ "@rollup/rollup-darwin-x64": "4.9.1",
114
+ "@rollup/rollup-win32-x64-msvc": "4.9.1",
115
+ "@rollup/rollup-linux-x64-gnu": "4.9.1",
116
+ "@rollup/rollup-linux-x64-musl": "4.9.1"
117
117
  },
118
118
  "devDependenciesComments": {
119
119
  "@rollup/plugin-typescript": "It appears that 11.1.3 breaks sourcemaps"
@@ -123,8 +123,8 @@
123
123
  "@codemirror/lang-javascript": "^6.2.1",
124
124
  "@codemirror/language": "^6.9.3",
125
125
  "@codemirror/search": "^6.5.5",
126
- "@codemirror/state": "^6.3.2",
127
- "@codemirror/view": "^6.22.1",
126
+ "@codemirror/state": "^6.3.3",
127
+ "@codemirror/view": "^6.22.2",
128
128
  "@jridgewell/sourcemap-codec": "^1.4.15",
129
129
  "@mermaid-js/mermaid-cli": "^10.6.1",
130
130
  "@napi-rs/cli": "^2.17.0",
@@ -141,8 +141,8 @@
141
141
  "@types/mocha": "^10.0.6",
142
142
  "@types/node": "18.0.0",
143
143
  "@types/yargs-parser": "^21.0.3",
144
- "@typescript-eslint/eslint-plugin": "^6.13.2",
145
- "@typescript-eslint/parser": "^6.13.2",
144
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
145
+ "@typescript-eslint/parser": "^6.14.0",
146
146
  "@vue/eslint-config-prettier": "^8.0.0",
147
147
  "@vue/eslint-config-typescript": "^12.0.0",
148
148
  "acorn": "^8.11.2",
@@ -152,7 +152,7 @@
152
152
  "chokidar": "^3.5.3",
153
153
  "colorette": "^2.0.20",
154
154
  "concurrently": "^8.2.2",
155
- "core-js": "^3.33.3",
155
+ "core-js": "^3.34.0",
156
156
  "date-time": "^4.0.0",
157
157
  "es5-shim": "^4.6.7",
158
158
  "es6-shim": "^0.35.8",
@@ -175,11 +175,11 @@
175
175
  "mocha": "^10.2.0",
176
176
  "nyc": "^15.1.0",
177
177
  "pinia": "^2.1.7",
178
- "prettier": "^3.1.0",
178
+ "prettier": "^3.1.1",
179
179
  "pretty-bytes": "^6.1.1",
180
180
  "pretty-ms": "^8.0.0",
181
181
  "requirejs": "^2.3.6",
182
- "rollup": "^4.6.1",
182
+ "rollup": "^4.8.0",
183
183
  "rollup-plugin-license": "^3.2.0",
184
184
  "rollup-plugin-string": "^3.0.0",
185
185
  "rollup-plugin-thatworks": "^1.0.4",
@@ -189,12 +189,12 @@
189
189
  "source-map": "^0.7.4",
190
190
  "source-map-support": "^0.5.21",
191
191
  "systemjs": "^6.14.2",
192
- "terser": "^5.25.0",
192
+ "terser": "^5.26.0",
193
193
  "tslib": "^2.6.2",
194
- "typescript": "^5.3.2",
195
- "vite": "^5.0.5",
194
+ "typescript": "^5.3.3",
195
+ "vite": "^5.0.7",
196
196
  "vitepress": "^1.0.0-rc.31",
197
- "vue": "^3.3.10",
197
+ "vue": "^3.3.11",
198
198
  "wasm-pack": "^0.12.1",
199
199
  "weak-napi": "^2.0.2",
200
200
  "yargs-parser": "^21.1.1"