rollup 2.8.0 → 2.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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.8.0
4
- Wed, 06 May 2020 05:15:09 GMT - commit 35b0f782f0de661628e48240cbaed4f0178472f3
3
+ Rollup.js v2.9.1
4
+ Mon, 11 May 2020 05:23:48 GMT - commit 1436473192ef975ee515ede6ab90dbf832cdfab1
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -28,7 +28,7 @@ var crypto = require('crypto');
28
28
  var fs = require('fs');
29
29
  var events = require('events');
30
30
 
31
- var version = "2.8.0";
31
+ var version = "2.9.1";
32
32
 
33
33
  function unwrapExports (x) {
34
34
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -502,7 +502,9 @@ function warnUnknownOptions(passedOptions, validOptions, optionType, warn, ignor
502
502
  if (unknownOptions.length > 0) {
503
503
  warn({
504
504
  code: 'UNKNOWN_OPTION',
505
- message: `Unknown ${optionType}: ${unknownOptions.join(', ')}. Allowed options: ${Array.from(validOptionSet)
505
+ message: `Unknown ${optionType}: ${unknownOptions.join(', ')}. Allowed options: ${[
506
+ ...validOptionSet
507
+ ]
506
508
  .sort()
507
509
  .join(', ')}`
508
510
  });
@@ -592,8 +594,8 @@ var keywordRelationalOperator = /^in(stanceof)?$/;
592
594
  // are only applied when a character is found to actually have a
593
595
  // code point above 128.
594
596
  // Generated by `bin/generate-identifier-regex.js`.
595
- var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
596
- var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
597
+ var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
598
+ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
597
599
 
598
600
  var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
599
601
  var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
@@ -607,10 +609,10 @@ nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
607
609
  // generated by bin/generate-identifier-regex.js
608
610
 
609
611
  // eslint-disable-next-line comma-spacing
610
- var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,477,28,11,0,9,21,155,22,13,52,76,44,33,24,27,35,30,0,12,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,0,33,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,0,161,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,270,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,754,9486,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541];
612
+ var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];
611
613
 
612
614
  // eslint-disable-next-line comma-spacing
613
- var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,525,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,4,9,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,232,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,792487,239];
615
+ var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];
614
616
 
615
617
  // This has a complexity linear to the value of the code. The
616
618
  // assumption is that looking up astral identifier characters is
@@ -763,6 +765,7 @@ var types = {
763
765
  star: binop("*", 10),
764
766
  slash: binop("/", 10),
765
767
  starstar: new TokenType("**", {beforeExpr: true}),
768
+ coalesce: binop("??", 1),
766
769
 
767
770
  // Keyword token types.
768
771
  _break: kw("break"),
@@ -1159,7 +1162,14 @@ pp.strictDirective = function(start) {
1159
1162
  start += skipWhiteSpace.exec(this.input)[0].length;
1160
1163
  var match = literal.exec(this.input.slice(start));
1161
1164
  if (!match) { return false }
1162
- if ((match[1] || match[2]) === "use strict") { return true }
1165
+ if ((match[1] || match[2]) === "use strict") {
1166
+ skipWhiteSpace.lastIndex = start + match[0].length;
1167
+ var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
1168
+ var next = this.input.charAt(end);
1169
+ return next === ";" || next === "}" ||
1170
+ (lineBreak.test(spaceAfter[0]) &&
1171
+ !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="))
1172
+ }
1163
1173
  start += match[0].length;
1164
1174
 
1165
1175
  // Skip semicolon, if any.
@@ -1409,7 +1419,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
1409
1419
  skipWhiteSpace.lastIndex = this.pos;
1410
1420
  var skip = skipWhiteSpace.exec(this.input);
1411
1421
  var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
1412
- if (nextCh === 40) // '('
1422
+ if (nextCh === 40 || nextCh === 46) // '(' or '.'
1413
1423
  { return this.parseExpressionStatement(node, this.parseExpression()) }
1414
1424
  }
1415
1425
 
@@ -1709,17 +1719,19 @@ pp$1.parseExpressionStatement = function(node, expr) {
1709
1719
  // strict"` declarations when `allowStrict` is true (used for
1710
1720
  // function bodies).
1711
1721
 
1712
- pp$1.parseBlock = function(createNewLexicalScope, node) {
1722
+ pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
1713
1723
  if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
1714
1724
  if ( node === void 0 ) node = this.startNode();
1715
1725
 
1716
1726
  node.body = [];
1717
1727
  this.expect(types.braceL);
1718
1728
  if (createNewLexicalScope) { this.enterScope(0); }
1719
- while (!this.eat(types.braceR)) {
1729
+ while (this.type !== types.braceR) {
1720
1730
  var stmt = this.parseStatement(null);
1721
1731
  node.body.push(stmt);
1722
1732
  }
1733
+ if (exitStrict) { this.strict = false; }
1734
+ this.next();
1723
1735
  if (createNewLexicalScope) { this.exitScope(); }
1724
1736
  return this.finishNode(node, "BlockStatement")
1725
1737
  };
@@ -1870,7 +1882,7 @@ pp$1.parseClass = function(node, isStatement) {
1870
1882
  var hadConstructor = false;
1871
1883
  classBody.body = [];
1872
1884
  this.expect(types.braceL);
1873
- while (!this.eat(types.braceR)) {
1885
+ while (this.type !== types.braceR) {
1874
1886
  var element = this.parseClassElement(node.superClass !== null);
1875
1887
  if (element) {
1876
1888
  classBody.body.push(element);
@@ -1880,8 +1892,9 @@ pp$1.parseClass = function(node, isStatement) {
1880
1892
  }
1881
1893
  }
1882
1894
  }
1883
- node.body = this.finishNode(classBody, "ClassBody");
1884
1895
  this.strict = oldStrict;
1896
+ this.next();
1897
+ node.body = this.finishNode(classBody, "ClassBody");
1885
1898
  return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
1886
1899
  };
1887
1900
 
@@ -1969,6 +1982,14 @@ pp$1.parseExport = function(node, exports) {
1969
1982
  this.next();
1970
1983
  // export * from '...'
1971
1984
  if (this.eat(types.star)) {
1985
+ if (this.options.ecmaVersion >= 11) {
1986
+ if (this.eatContextual("as")) {
1987
+ node.exported = this.parseIdent(true);
1988
+ this.checkExport(exports, node.exported.name, this.lastTokStart);
1989
+ } else {
1990
+ node.exported = null;
1991
+ }
1992
+ }
1972
1993
  this.expectContextual("from");
1973
1994
  if (this.type !== types.string) { this.unexpected(); }
1974
1995
  node.source = this.parseExprAtom();
@@ -2585,11 +2606,20 @@ pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
2585
2606
  if (prec != null && (!noIn || this.type !== types._in)) {
2586
2607
  if (prec > minPrec) {
2587
2608
  var logical = this.type === types.logicalOR || this.type === types.logicalAND;
2609
+ var coalesce = this.type === types.coalesce;
2610
+ if (coalesce) {
2611
+ // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
2612
+ // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
2613
+ prec = types.logicalAND.binop;
2614
+ }
2588
2615
  var op = this.value;
2589
2616
  this.next();
2590
2617
  var startPos = this.start, startLoc = this.startLoc;
2591
2618
  var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);
2592
- var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical);
2619
+ var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
2620
+ if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
2621
+ this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
2622
+ }
2593
2623
  return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
2594
2624
  }
2595
2625
  }
@@ -2661,7 +2691,8 @@ pp$3.parseExprSubscripts = function(refDestructuringErrors) {
2661
2691
 
2662
2692
  pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
2663
2693
  var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
2664
- this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async";
2694
+ this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
2695
+ this.potentialArrowAt === base.start;
2665
2696
  while (true) {
2666
2697
  var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);
2667
2698
  if (element === base || element.type === "ArrowFunctionExpression") { return element }
@@ -2825,10 +2856,18 @@ pp$3.parseExprAtom = function(refDestructuringErrors) {
2825
2856
 
2826
2857
  pp$3.parseExprImport = function() {
2827
2858
  var node = this.startNode();
2828
- this.next(); // skip `import`
2859
+
2860
+ // Consume `import` as an identifier for `import.meta`.
2861
+ // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
2862
+ if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
2863
+ var meta = this.parseIdent(true);
2864
+
2829
2865
  switch (this.type) {
2830
2866
  case types.parenL:
2831
2867
  return this.parseDynamicImport(node)
2868
+ case types.dot:
2869
+ node.meta = meta;
2870
+ return this.parseImportMeta(node)
2832
2871
  default:
2833
2872
  this.unexpected();
2834
2873
  }
@@ -2853,6 +2892,22 @@ pp$3.parseDynamicImport = function(node) {
2853
2892
  return this.finishNode(node, "ImportExpression")
2854
2893
  };
2855
2894
 
2895
+ pp$3.parseImportMeta = function(node) {
2896
+ this.next(); // skip `.`
2897
+
2898
+ var containsEsc = this.containsEsc;
2899
+ node.property = this.parseIdent(true);
2900
+
2901
+ if (node.property.name !== "meta")
2902
+ { this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
2903
+ if (containsEsc)
2904
+ { this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
2905
+ if (this.options.sourceType !== "module")
2906
+ { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }
2907
+
2908
+ return this.finishNode(node, "MetaProperty")
2909
+ };
2910
+
2856
2911
  pp$3.parseLiteral = function(value) {
2857
2912
  var node = this.startNode();
2858
2913
  node.value = value;
@@ -2955,10 +3010,12 @@ pp$3.parseNew = function() {
2955
3010
  node.meta = meta;
2956
3011
  var containsEsc = this.containsEsc;
2957
3012
  node.property = this.parseIdent(true);
2958
- if (node.property.name !== "target" || containsEsc)
2959
- { this.raiseRecoverable(node.property.start, "The only valid meta property for new is new.target"); }
3013
+ if (node.property.name !== "target")
3014
+ { this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); }
3015
+ if (containsEsc)
3016
+ { this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); }
2960
3017
  if (!this.inNonArrowFunction())
2961
- { this.raiseRecoverable(node.start, "new.target can only be used in functions"); }
3018
+ { this.raiseRecoverable(node.start, "'new.target' can only be used in functions"); }
2962
3019
  return this.finishNode(node, "MetaProperty")
2963
3020
  }
2964
3021
  var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
@@ -3242,16 +3299,14 @@ pp$3.parseFunctionBody = function(node, isArrowFunction, isMethod) {
3242
3299
  // Add the params to varDeclaredNames to ensure that an error is thrown
3243
3300
  // if a let/const declaration in the function clashes with one of the params.
3244
3301
  this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
3245
- node.body = this.parseBlock(false);
3302
+ // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
3303
+ if (this.strict && node.id) { this.checkLVal(node.id, BIND_OUTSIDE); }
3304
+ node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
3246
3305
  node.expression = false;
3247
3306
  this.adaptDirectivePrologue(node.body.body);
3248
3307
  this.labels = oldLabels;
3249
3308
  }
3250
3309
  this.exitScope();
3251
-
3252
- // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
3253
- if (this.strict && node.id) { this.checkLVal(node.id, BIND_OUTSIDE); }
3254
- this.strict = oldStrict;
3255
3310
  };
3256
3311
 
3257
3312
  pp$3.isSimpleParamList = function(params) {
@@ -3770,49 +3825,61 @@ RegExpValidationState.prototype.raise = function raise (message) {
3770
3825
 
3771
3826
  // If u flag is given, this returns the code point at the index (it combines a surrogate pair).
3772
3827
  // Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
3773
- RegExpValidationState.prototype.at = function at (i) {
3828
+ RegExpValidationState.prototype.at = function at (i, forceU) {
3829
+ if ( forceU === void 0 ) forceU = false;
3830
+
3774
3831
  var s = this.source;
3775
3832
  var l = s.length;
3776
3833
  if (i >= l) {
3777
3834
  return -1
3778
3835
  }
3779
3836
  var c = s.charCodeAt(i);
3780
- if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
3837
+ if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
3781
3838
  return c
3782
3839
  }
3783
3840
  var next = s.charCodeAt(i + 1);
3784
3841
  return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c
3785
3842
  };
3786
3843
 
3787
- RegExpValidationState.prototype.nextIndex = function nextIndex (i) {
3844
+ RegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {
3845
+ if ( forceU === void 0 ) forceU = false;
3846
+
3788
3847
  var s = this.source;
3789
3848
  var l = s.length;
3790
3849
  if (i >= l) {
3791
3850
  return l
3792
3851
  }
3793
3852
  var c = s.charCodeAt(i), next;
3794
- if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
3853
+ if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
3795
3854
  (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
3796
3855
  return i + 1
3797
3856
  }
3798
3857
  return i + 2
3799
3858
  };
3800
3859
 
3801
- RegExpValidationState.prototype.current = function current () {
3802
- return this.at(this.pos)
3860
+ RegExpValidationState.prototype.current = function current (forceU) {
3861
+ if ( forceU === void 0 ) forceU = false;
3862
+
3863
+ return this.at(this.pos, forceU)
3803
3864
  };
3804
3865
 
3805
- RegExpValidationState.prototype.lookahead = function lookahead () {
3806
- return this.at(this.nextIndex(this.pos))
3866
+ RegExpValidationState.prototype.lookahead = function lookahead (forceU) {
3867
+ if ( forceU === void 0 ) forceU = false;
3868
+
3869
+ return this.at(this.nextIndex(this.pos, forceU), forceU)
3807
3870
  };
3808
3871
 
3809
- RegExpValidationState.prototype.advance = function advance () {
3810
- this.pos = this.nextIndex(this.pos);
3872
+ RegExpValidationState.prototype.advance = function advance (forceU) {
3873
+ if ( forceU === void 0 ) forceU = false;
3874
+
3875
+ this.pos = this.nextIndex(this.pos, forceU);
3811
3876
  };
3812
3877
 
3813
- RegExpValidationState.prototype.eat = function eat (ch) {
3814
- if (this.current() === ch) {
3815
- this.advance();
3878
+ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
3879
+ if ( forceU === void 0 ) forceU = false;
3880
+
3881
+ if (this.current(forceU) === ch) {
3882
+ this.advance(forceU);
3816
3883
  return true
3817
3884
  }
3818
3885
  return false
@@ -4151,9 +4218,9 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
4151
4218
  return false
4152
4219
  };
4153
4220
 
4154
- // GroupSpecifier[U] ::
4221
+ // GroupSpecifier ::
4155
4222
  // [empty]
4156
- // `?` GroupName[?U]
4223
+ // `?` GroupName
4157
4224
  pp$8.regexp_groupSpecifier = function(state) {
4158
4225
  if (state.eat(0x3F /* ? */)) {
4159
4226
  if (this.regexp_eatGroupName(state)) {
@@ -4167,8 +4234,8 @@ pp$8.regexp_groupSpecifier = function(state) {
4167
4234
  }
4168
4235
  };
4169
4236
 
4170
- // GroupName[U] ::
4171
- // `<` RegExpIdentifierName[?U] `>`
4237
+ // GroupName ::
4238
+ // `<` RegExpIdentifierName `>`
4172
4239
  // Note: this updates `state.lastStringValue` property with the eaten name.
4173
4240
  pp$8.regexp_eatGroupName = function(state) {
4174
4241
  state.lastStringValue = "";
@@ -4181,9 +4248,9 @@ pp$8.regexp_eatGroupName = function(state) {
4181
4248
  return false
4182
4249
  };
4183
4250
 
4184
- // RegExpIdentifierName[U] ::
4185
- // RegExpIdentifierStart[?U]
4186
- // RegExpIdentifierName[?U] RegExpIdentifierPart[?U]
4251
+ // RegExpIdentifierName ::
4252
+ // RegExpIdentifierStart
4253
+ // RegExpIdentifierName RegExpIdentifierPart
4187
4254
  // Note: this updates `state.lastStringValue` property with the eaten name.
4188
4255
  pp$8.regexp_eatRegExpIdentifierName = function(state) {
4189
4256
  state.lastStringValue = "";
@@ -4197,17 +4264,18 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
4197
4264
  return false
4198
4265
  };
4199
4266
 
4200
- // RegExpIdentifierStart[U] ::
4267
+ // RegExpIdentifierStart ::
4201
4268
  // UnicodeIDStart
4202
4269
  // `$`
4203
4270
  // `_`
4204
- // `\` RegExpUnicodeEscapeSequence[?U]
4271
+ // `\` RegExpUnicodeEscapeSequence[+U]
4205
4272
  pp$8.regexp_eatRegExpIdentifierStart = function(state) {
4206
4273
  var start = state.pos;
4207
- var ch = state.current();
4208
- state.advance();
4274
+ var forceU = this.options.ecmaVersion >= 11;
4275
+ var ch = state.current(forceU);
4276
+ state.advance(forceU);
4209
4277
 
4210
- if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
4278
+ if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
4211
4279
  ch = state.lastIntValue;
4212
4280
  }
4213
4281
  if (isRegExpIdentifierStart(ch)) {
@@ -4222,19 +4290,20 @@ function isRegExpIdentifierStart(ch) {
4222
4290
  return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */
4223
4291
  }
4224
4292
 
4225
- // RegExpIdentifierPart[U] ::
4293
+ // RegExpIdentifierPart ::
4226
4294
  // UnicodeIDContinue
4227
4295
  // `$`
4228
4296
  // `_`
4229
- // `\` RegExpUnicodeEscapeSequence[?U]
4297
+ // `\` RegExpUnicodeEscapeSequence[+U]
4230
4298
  // <ZWNJ>
4231
4299
  // <ZWJ>
4232
4300
  pp$8.regexp_eatRegExpIdentifierPart = function(state) {
4233
4301
  var start = state.pos;
4234
- var ch = state.current();
4235
- state.advance();
4302
+ var forceU = this.options.ecmaVersion >= 11;
4303
+ var ch = state.current(forceU);
4304
+ state.advance(forceU);
4236
4305
 
4237
- if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
4306
+ if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
4238
4307
  ch = state.lastIntValue;
4239
4308
  }
4240
4309
  if (isRegExpIdentifierPart(ch)) {
@@ -4304,7 +4373,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
4304
4373
  this.regexp_eatCControlLetter(state) ||
4305
4374
  this.regexp_eatZero(state) ||
4306
4375
  this.regexp_eatHexEscapeSequence(state) ||
4307
- this.regexp_eatRegExpUnicodeEscapeSequence(state) ||
4376
+ this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||
4308
4377
  (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||
4309
4378
  this.regexp_eatIdentityEscape(state)
4310
4379
  )
@@ -4377,13 +4446,16 @@ function isControlLetter(ch) {
4377
4446
  }
4378
4447
 
4379
4448
  // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
4380
- pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state) {
4449
+ pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
4450
+ if ( forceU === void 0 ) forceU = false;
4451
+
4381
4452
  var start = state.pos;
4453
+ var switchU = forceU || state.switchU;
4382
4454
 
4383
4455
  if (state.eat(0x75 /* u */)) {
4384
4456
  if (this.regexp_eatFixedHexDigits(state, 4)) {
4385
4457
  var lead = state.lastIntValue;
4386
- if (state.switchU && lead >= 0xD800 && lead <= 0xDBFF) {
4458
+ if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
4387
4459
  var leadSurrogateEnd = state.pos;
4388
4460
  if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
4389
4461
  var trail = state.lastIntValue;
@@ -4398,7 +4470,7 @@ pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state) {
4398
4470
  return true
4399
4471
  }
4400
4472
  if (
4401
- state.switchU &&
4473
+ switchU &&
4402
4474
  state.eat(0x7B /* { */) &&
4403
4475
  this.regexp_eatHexDigits(state) &&
4404
4476
  state.eat(0x7D /* } */) &&
@@ -4406,7 +4478,7 @@ pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state) {
4406
4478
  ) {
4407
4479
  return true
4408
4480
  }
4409
- if (state.switchU) {
4481
+ if (switchU) {
4410
4482
  state.raise("Invalid unicode escape");
4411
4483
  }
4412
4484
  state.pos = start;
@@ -5062,6 +5134,14 @@ pp$9.readToken_eq_excl = function(code) { // '=!'
5062
5134
  return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
5063
5135
  };
5064
5136
 
5137
+ pp$9.readToken_question = function() { // '?'
5138
+ if (this.options.ecmaVersion >= 11) {
5139
+ var next = this.input.charCodeAt(this.pos + 1);
5140
+ if (next === 63) { return this.finishOp(types.coalesce, 2) }
5141
+ }
5142
+ return this.finishOp(types.question, 1)
5143
+ };
5144
+
5065
5145
  pp$9.getTokenFromCode = function(code) {
5066
5146
  switch (code) {
5067
5147
  // The interpretation of a dot depends on whether it is followed
@@ -5079,7 +5159,6 @@ pp$9.getTokenFromCode = function(code) {
5079
5159
  case 123: ++this.pos; return this.finishToken(types.braceL)
5080
5160
  case 125: ++this.pos; return this.finishToken(types.braceR)
5081
5161
  case 58: ++this.pos; return this.finishToken(types.colon)
5082
- case 63: ++this.pos; return this.finishToken(types.question)
5083
5162
 
5084
5163
  case 96: // '`'
5085
5164
  if (this.options.ecmaVersion < 6) { break }
@@ -5129,6 +5208,9 @@ pp$9.getTokenFromCode = function(code) {
5129
5208
  case 61: case 33: // '=!'
5130
5209
  return this.readToken_eq_excl(code)
5131
5210
 
5211
+ case 63: // '?'
5212
+ return this.readToken_question()
5213
+
5132
5214
  case 126: // '~'
5133
5215
  return this.finishOp(types.prefix, 1)
5134
5216
  }
@@ -5789,43 +5871,13 @@ var acornClassFields = function(Parser) {
5789
5871
  }
5790
5872
  };
5791
5873
 
5792
- const skipWhiteSpace$1 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
5793
-
5794
5874
  const tt = require$$0.tokTypes;
5795
5875
 
5796
- var acornExportNsFrom = function(Parser) {
5797
- return class extends Parser {
5798
- parseExport(node, exports) {
5799
- skipWhiteSpace$1.lastIndex = this.pos;
5800
- const skip = skipWhiteSpace$1.exec(this.input);
5801
- const next = this.input.charAt(this.pos + skip[0].length);
5802
- if (next !== "*") return super.parseExport(node, exports)
5803
-
5804
- this.next();
5805
- const specifier = this.startNode();
5806
- this.expect(tt.star);
5807
- if (this.eatContextual("as")) {
5808
- node.declaration = null;
5809
- specifier.exported = this.parseIdent(true);
5810
- this.checkExport(exports, specifier.exported.name, this.lastTokStart);
5811
- node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")];
5812
- }
5813
- this.expectContextual("from");
5814
- if (this.type !== tt.string) this.unexpected();
5815
- node.source = this.parseExprAtom();
5816
- this.semicolon();
5817
- return this.finishNode(node, node.specifiers ? "ExportNamedDeclaration" : "ExportAllDeclaration")
5818
- }
5819
- }
5820
- };
5821
-
5822
- const tt$1 = require$$0.tokTypes;
5823
-
5824
- const skipWhiteSpace$2 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
5876
+ const skipWhiteSpace$1 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
5825
5877
 
5826
5878
  const nextTokenIsDot = parser => {
5827
- skipWhiteSpace$2.lastIndex = parser.pos;
5828
- let skip = skipWhiteSpace$2.exec(parser.input);
5879
+ skipWhiteSpace$1.lastIndex = parser.pos;
5880
+ let skip = skipWhiteSpace$1.exec(parser.input);
5829
5881
  let next = parser.pos + skip[0].length;
5830
5882
  return parser.input.slice(next, next + 1) === "."
5831
5883
  };
@@ -5833,7 +5885,7 @@ const nextTokenIsDot = parser => {
5833
5885
  var acornImportMeta = function(Parser) {
5834
5886
  return class extends Parser {
5835
5887
  parseExprAtom(refDestructuringErrors) {
5836
- if (this.type !== tt$1._import || !nextTokenIsDot(this)) return super.parseExprAtom(refDestructuringErrors)
5888
+ if (this.type !== tt._import || !nextTokenIsDot(this)) return super.parseExprAtom(refDestructuringErrors)
5837
5889
 
5838
5890
  if (!this.options.allowImportExportEverywhere && !this.inModule) {
5839
5891
  this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
@@ -5842,7 +5894,7 @@ var acornImportMeta = function(Parser) {
5842
5894
  let node = this.startNode();
5843
5895
  if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword import");
5844
5896
  node.meta = this.parseIdent(true);
5845
- this.expect(tt$1.dot);
5897
+ this.expect(tt.dot);
5846
5898
  node.property = this.parseIdent(true);
5847
5899
  if (node.property.name !== "meta") {
5848
5900
  this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta");
@@ -5854,7 +5906,7 @@ var acornImportMeta = function(Parser) {
5854
5906
  }
5855
5907
 
5856
5908
  parseStatement(context, topLevel, exports) {
5857
- if (this.type !== tt$1._import || !nextTokenIsDot(this)) {
5909
+ if (this.type !== tt._import || !nextTokenIsDot(this)) {
5858
5910
  return super.parseStatement(context, topLevel, exports)
5859
5911
  }
5860
5912
 
@@ -6832,6 +6884,25 @@ class PathTracker {
6832
6884
  }
6833
6885
  }
6834
6886
  const SHARED_RECURSION_TRACKER = new PathTracker();
6887
+ class DiscriminatedPathTracker {
6888
+ constructor() {
6889
+ this.entityPaths = Object.create(null, {
6890
+ [EntitiesKey]: { value: new Map() }
6891
+ });
6892
+ }
6893
+ getEntities(path, discriminator) {
6894
+ let currentPaths = this.entityPaths;
6895
+ for (const pathSegment of path) {
6896
+ currentPaths = currentPaths[pathSegment] =
6897
+ currentPaths[pathSegment] ||
6898
+ Object.create(null, { [EntitiesKey]: { value: new Map() } });
6899
+ }
6900
+ const entities = currentPaths[EntitiesKey];
6901
+ const result = entities.get(discriminator) || new Set();
6902
+ entities.set(discriminator, result);
6903
+ return result;
6904
+ }
6905
+ }
6835
6906
 
6836
6907
  function assembleMemberDescriptions(memberDescriptions, inheritedDescriptions = null) {
6837
6908
  return Object.create(inheritedDescriptions, memberDescriptions);
@@ -7297,6 +7368,10 @@ class Variable {
7297
7368
  }
7298
7369
 
7299
7370
  class GlobalVariable extends Variable {
7371
+ constructor() {
7372
+ super(...arguments);
7373
+ this.isReassigned = true;
7374
+ }
7300
7375
  hasEffectsWhenAccessedAtPath(path) {
7301
7376
  return !isGlobalMember([this.name, ...path]);
7302
7377
  }
@@ -7355,8 +7430,10 @@ function makeLegal(str) {
7355
7430
 
7356
7431
  class ExternalModule {
7357
7432
  constructor(graph, id, moduleSideEffects) {
7433
+ this.dynamicImporters = [];
7358
7434
  this.exportsNames = false;
7359
7435
  this.exportsNamespace = false;
7436
+ this.importers = [];
7360
7437
  this.mostCommonSuggestion = 0;
7361
7438
  this.reexported = false;
7362
7439
  this.renderPath = undefined;
@@ -7468,7 +7545,7 @@ function createHasEffectsContext() {
7468
7545
  accessed: new PathTracker(),
7469
7546
  assigned: new PathTracker(),
7470
7547
  brokenFlow: BROKEN_FLOW_NONE,
7471
- called: new PathTracker(),
7548
+ called: new DiscriminatedPathTracker(),
7472
7549
  ignore: {
7473
7550
  breaks: false,
7474
7551
  continues: false,
@@ -7476,14 +7553,14 @@ function createHasEffectsContext() {
7476
7553
  returnAwaitYield: false
7477
7554
  },
7478
7555
  includedLabels: new Set(),
7479
- instantiated: new PathTracker(),
7556
+ instantiated: new DiscriminatedPathTracker(),
7480
7557
  replacedVariableInits: new Map()
7481
7558
  };
7482
7559
  }
7483
7560
 
7561
+ const ArrowFunctionExpression = 'ArrowFunctionExpression';
7484
7562
  const BlockStatement = 'BlockStatement';
7485
7563
  const CallExpression = 'CallExpression';
7486
- const ExportNamespaceSpecifier = 'ExportNamespaceSpecifier';
7487
7564
  const ExpressionStatement = 'ExpressionStatement';
7488
7565
  const FunctionExpression = 'FunctionExpression';
7489
7566
  const Identifier = 'Identifier';
@@ -7606,7 +7683,7 @@ class LocalVariable extends Variable {
7606
7683
  return true;
7607
7684
  const trackedExpressions = (callOptions.withNew
7608
7685
  ? context.instantiated
7609
- : context.called).getEntities(path);
7686
+ : context.called).getEntities(path, callOptions);
7610
7687
  if (trackedExpressions.has(this))
7611
7688
  return false;
7612
7689
  trackedExpressions.add(this);
@@ -10957,7 +11034,9 @@ function getStarExcludes({ dependencies, exports }) {
10957
11034
  return starExcludes;
10958
11035
  }
10959
11036
  const getStarExcludesBlock = (starExcludes, varOrConst, _, t, n) => starExcludes
10960
- ? `${n}${t}${varOrConst} _starExcludes${_}=${_}{${_}${Array.from(starExcludes).join(`:${_}1,${_}`)}${starExcludes.size ? `:${_}1` : ''}${_}};`
11037
+ ? `${n}${t}${varOrConst} _starExcludes${_}=${_}{${_}${[...starExcludes]
11038
+ .map(prop => `${prop}:${_}1`)
11039
+ .join(`,${_}`)}${_}};`
10961
11040
  : '';
10962
11041
  const getImportBindingsBlock = (importBindings, _, t, n) => (importBindings.length ? `${n}${t}var ${importBindings.join(`,${_}`)};` : '');
10963
11042
  function getExportsBlock(exports, _, t, n) {
@@ -11386,7 +11465,7 @@ class BlockStatement$1 extends NodeBase {
11386
11465
  }
11387
11466
  }
11388
11467
 
11389
- class ArrowFunctionExpression extends NodeBase {
11468
+ class ArrowFunctionExpression$1 extends NodeBase {
11390
11469
  createScope(parentScope) {
11391
11470
  this.scope = new ReturnValueScope(parentScope, this.context);
11392
11471
  }
@@ -11460,7 +11539,7 @@ class ArrowFunctionExpression extends NodeBase {
11460
11539
  super.parseNode(esTreeNode);
11461
11540
  }
11462
11541
  }
11463
- ArrowFunctionExpression.prototype.preventChildBlockScope = true;
11542
+ ArrowFunctionExpression$1.prototype.preventChildBlockScope = true;
11464
11543
 
11465
11544
  function getSystemExportStatement(exportedVariables) {
11466
11545
  if (exportedVariables.length === 1) {
@@ -11559,7 +11638,7 @@ class AwaitExpression extends NodeBase {
11559
11638
  checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
11560
11639
  let parent = this.parent;
11561
11640
  do {
11562
- if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression)
11641
+ if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression$1)
11563
11642
  break checkTopLevelAwait;
11564
11643
  } while ((parent = parent.parent));
11565
11644
  this.context.usesTopLevelAwait = true;
@@ -12054,7 +12133,7 @@ class CallExpression$1 extends NodeBase {
12054
12133
  hasEffectsWhenCalledAtPath(path, callOptions, context) {
12055
12134
  const trackedExpressions = (callOptions.withNew
12056
12135
  ? context.instantiated
12057
- : context.called).getEntities(path);
12136
+ : context.called).getEntities(path, callOptions);
12058
12137
  if (trackedExpressions.has(this))
12059
12138
  return false;
12060
12139
  trackedExpressions.add(this);
@@ -12440,9 +12519,6 @@ class ExportNamedDeclaration extends NodeBase {
12440
12519
  }
12441
12520
  ExportNamedDeclaration.prototype.needsBoundaries = true;
12442
12521
 
12443
- class ExportNamespaceSpecifier$1 extends NodeBase {
12444
- }
12445
-
12446
12522
  class ExportSpecifier extends NodeBase {
12447
12523
  }
12448
12524
 
@@ -13017,7 +13093,9 @@ class LogicalExpression extends NodeBase {
13017
13093
  return null;
13018
13094
  }
13019
13095
  else {
13020
- if (this.operator === '||' ? leftValue : !leftValue) {
13096
+ if ((this.operator === '||' && leftValue) ||
13097
+ (this.operator === '&&' && !leftValue) ||
13098
+ (this.operator === '??' && leftValue != null)) {
13021
13099
  this.usedBranch = this.left;
13022
13100
  this.unusedBranch = this.right;
13023
13101
  }
@@ -13412,7 +13490,8 @@ class ObjectExpression extends NodeBase {
13412
13490
  }
13413
13491
  render(code, options, { renderedParentType } = BLANK) {
13414
13492
  super.render(code, options);
13415
- if (renderedParentType === ExpressionStatement) {
13493
+ if (renderedParentType === ExpressionStatement ||
13494
+ renderedParentType === ArrowFunctionExpression) {
13416
13495
  code.appendRight(this.start, '(');
13417
13496
  code.prependLeft(this.end, ')');
13418
13497
  }
@@ -13635,7 +13714,7 @@ class Property$1 extends NodeBase {
13635
13714
  if (this.kind === 'get') {
13636
13715
  const trackedExpressions = (callOptions.withNew
13637
13716
  ? context.instantiated
13638
- : context.called).getEntities(path);
13717
+ : context.called).getEntities(path, callOptions);
13639
13718
  if (trackedExpressions.has(this))
13640
13719
  return false;
13641
13720
  trackedExpressions.add(this);
@@ -14362,7 +14441,7 @@ class YieldExpression extends NodeBase {
14362
14441
  const nodeConstructors = {
14363
14442
  ArrayExpression,
14364
14443
  ArrayPattern,
14365
- ArrowFunctionExpression,
14444
+ ArrowFunctionExpression: ArrowFunctionExpression$1,
14366
14445
  AssignmentExpression,
14367
14446
  AssignmentPattern,
14368
14447
  AwaitExpression,
@@ -14381,7 +14460,6 @@ const nodeConstructors = {
14381
14460
  ExportAllDeclaration,
14382
14461
  ExportDefaultDeclaration,
14383
14462
  ExportNamedDeclaration,
14384
- ExportNamespaceSpecifier: ExportNamespaceSpecifier$1,
14385
14463
  ExportSpecifier,
14386
14464
  ExpressionStatement: ExpressionStatement$1,
14387
14465
  FieldDefinition,
@@ -14938,8 +15016,8 @@ class Module {
14938
15016
  this.chunkName = null;
14939
15017
  this.comments = [];
14940
15018
  this.dependencies = new Set();
14941
- this.dynamicallyImportedBy = [];
14942
15019
  this.dynamicDependencies = new Set();
15020
+ this.dynamicImporters = [];
14943
15021
  this.dynamicImports = [];
14944
15022
  this.execIndex = Infinity;
14945
15023
  this.exportAllSources = new Set();
@@ -14947,8 +15025,10 @@ class Module {
14947
15025
  this.exportsAll = Object.create(null);
14948
15026
  this.facadeChunk = null;
14949
15027
  this.importDescriptions = Object.create(null);
15028
+ this.importers = [];
14950
15029
  this.importMetas = [];
14951
15030
  this.imports = new Set();
15031
+ this.includedDynamicImporters = [];
14952
15032
  this.isExecuted = false;
14953
15033
  this.isUserDefinedEntryPoint = false;
14954
15034
  this.manualChunkAlias = null;
@@ -15053,11 +15133,11 @@ class Module {
15053
15133
  else if (variable instanceof ExportDefaultVariable) {
15054
15134
  variable = variable.getOriginalVariable();
15055
15135
  }
15056
- if (variable.module) {
15057
- relevantDependencies.add(variable.module);
15058
- }
15136
+ relevantDependencies.add(variable.module);
15059
15137
  }
15060
- if (this.isEntryPoint || this.dynamicallyImportedBy.length > 0 || this.graph.preserveModules) {
15138
+ if (this.isEntryPoint ||
15139
+ this.includedDynamicImporters.length > 0 ||
15140
+ this.graph.preserveModules) {
15061
15141
  for (const exportName of [...this.getReexports(), ...this.getExports()]) {
15062
15142
  let variable = this.getVariableForExportName(exportName);
15063
15143
  if (variable instanceof SyntheticNamedExportVariable) {
@@ -15066,9 +15146,7 @@ class Module {
15066
15146
  else if (variable instanceof ExportDefaultVariable) {
15067
15147
  variable = variable.getOriginalVariable();
15068
15148
  }
15069
- if (variable.module) {
15070
- relevantDependencies.add(variable.module);
15071
- }
15149
+ relevantDependencies.add(variable.module);
15072
15150
  }
15073
15151
  }
15074
15152
  if (this.graph.treeshakingOptions) {
@@ -15094,20 +15172,6 @@ class Module {
15094
15172
  }
15095
15173
  return (this.relevantDependencies = relevantDependencies);
15096
15174
  }
15097
- getDynamicImportExpressions() {
15098
- return this.dynamicImports.map(({ node }) => {
15099
- const importArgument = node.source;
15100
- if (importArgument instanceof TemplateLiteral &&
15101
- importArgument.quasis.length === 1 &&
15102
- importArgument.quasis[0].value.cooked) {
15103
- return importArgument.quasis[0].value.cooked;
15104
- }
15105
- if (importArgument instanceof Literal && typeof importArgument.value === 'string') {
15106
- return importArgument.value;
15107
- }
15108
- return importArgument;
15109
- });
15110
- }
15111
15175
  getExportNamesByVariable() {
15112
15176
  if (this.exportNamesByVariable) {
15113
15177
  return this.exportNamesByVariable;
@@ -15156,7 +15220,7 @@ class Module {
15156
15220
  }
15157
15221
  }
15158
15222
  }
15159
- return (this.transitiveReexports = Array.from(reexports));
15223
+ return (this.transitiveReexports = [...reexports]);
15160
15224
  }
15161
15225
  getRenderedExports() {
15162
15226
  // only direct exports are counted here, not reexports at all
@@ -15373,7 +15437,7 @@ class Module {
15373
15437
  ast: this.esTreeAst,
15374
15438
  code: this.code,
15375
15439
  customTransformCache: this.customTransformCache,
15376
- dependencies: Array.from(this.dependencies).map(module => module.id),
15440
+ dependencies: [...this.dependencies].map(module => module.id),
15377
15441
  id: this.id,
15378
15442
  moduleSideEffects: this.moduleSideEffects,
15379
15443
  originalCode: this.originalCode,
@@ -15415,7 +15479,16 @@ class Module {
15415
15479
  this.graph.warn(warning);
15416
15480
  }
15417
15481
  addDynamicImport(node) {
15418
- this.dynamicImports.push({ node, resolution: null });
15482
+ let argument = node.source;
15483
+ if (argument instanceof TemplateLiteral) {
15484
+ if (argument.quasis.length === 1 && argument.quasis[0].value.cooked) {
15485
+ argument = argument.quasis[0].value.cooked;
15486
+ }
15487
+ }
15488
+ else if (argument instanceof Literal && typeof argument.value === 'string') {
15489
+ argument = argument.value;
15490
+ }
15491
+ this.dynamicImports.push({ node, resolution: null, argument });
15419
15492
  }
15420
15493
  addExport(node) {
15421
15494
  if (node instanceof ExportDefaultDeclaration) {
@@ -15426,10 +15499,22 @@ class Module {
15426
15499
  };
15427
15500
  }
15428
15501
  else if (node instanceof ExportAllDeclaration) {
15429
- // export * from './other'
15430
15502
  const source = node.source.value;
15431
15503
  this.sources.add(source);
15432
- this.exportAllSources.add(source);
15504
+ if (node.exported) {
15505
+ // export * as name from './other'
15506
+ const name = node.exported.name;
15507
+ this.reexportDescriptions[name] = {
15508
+ localName: '*',
15509
+ module: null,
15510
+ source,
15511
+ start: node.start
15512
+ };
15513
+ }
15514
+ else {
15515
+ // export * from './other'
15516
+ this.exportAllSources.add(source);
15517
+ }
15433
15518
  }
15434
15519
  else if (node.source instanceof Literal) {
15435
15520
  // export { name } from './other'
@@ -15438,7 +15523,7 @@ class Module {
15438
15523
  for (const specifier of node.specifiers) {
15439
15524
  const name = specifier.exported.name;
15440
15525
  this.reexportDescriptions[name] = {
15441
- localName: specifier.type === ExportNamespaceSpecifier ? '*' : specifier.local.name,
15526
+ localName: specifier.local.name,
15442
15527
  module: null,
15443
15528
  source,
15444
15529
  start: specifier.start
@@ -15521,7 +15606,7 @@ class Module {
15521
15606
  includeDynamicImport(node) {
15522
15607
  const resolution = this.dynamicImports.find(dynamicImport => dynamicImport.node === node).resolution;
15523
15608
  if (resolution instanceof Module) {
15524
- resolution.dynamicallyImportedBy.push(this);
15609
+ resolution.includedDynamicImporters.push(this);
15525
15610
  resolution.includeAllExports();
15526
15611
  }
15527
15612
  }
@@ -16059,7 +16144,7 @@ class Chunk$1 {
16059
16144
  if (module.isEntryPoint) {
16060
16145
  this.entryModules.push(module);
16061
16146
  }
16062
- if (module.dynamicallyImportedBy.length > 0) {
16147
+ if (module.includedDynamicImporters.length > 0) {
16063
16148
  this.dynamicEntryModules.push(module);
16064
16149
  }
16065
16150
  }
@@ -16133,17 +16218,17 @@ class Chunk$1 {
16133
16218
  }
16134
16219
  generateFacades() {
16135
16220
  const facades = [];
16136
- const dynamicEntryModules = this.dynamicEntryModules.filter(module => module.dynamicallyImportedBy.some(importingModule => importingModule.chunk !== this));
16221
+ const dynamicEntryModules = this.dynamicEntryModules.filter(module => module.includedDynamicImporters.some(importingModule => importingModule.chunk !== this));
16137
16222
  this.isDynamicEntry = dynamicEntryModules.length > 0;
16138
16223
  const exposedNamespaces = dynamicEntryModules.map(module => module.namespace);
16139
16224
  for (const module of this.entryModules) {
16140
- const requiredFacades = Array.from(module.userChunkNames).map(name => ({
16225
+ const requiredFacades = [...module.userChunkNames].map(name => ({
16141
16226
  name
16142
16227
  }));
16143
16228
  if (requiredFacades.length === 0 && module.isUserDefinedEntryPoint) {
16144
16229
  requiredFacades.push({});
16145
16230
  }
16146
- requiredFacades.push(...Array.from(module.chunkFileNames).map(fileName => ({ fileName })));
16231
+ requiredFacades.push(...[...module.chunkFileNames].map(fileName => ({ fileName })));
16147
16232
  if (requiredFacades.length === 0) {
16148
16233
  requiredFacades.push({});
16149
16234
  }
@@ -16772,7 +16857,7 @@ class Chunk$1 {
16772
16857
  }
16773
16858
  }
16774
16859
  if ((module.isEntryPoint && module.preserveSignature !== false) ||
16775
- module.dynamicallyImportedBy.some(importer => importer.chunk !== this)) {
16860
+ module.includedDynamicImporters.some(importer => importer.chunk !== this)) {
16776
16861
  const map = module.getExportNamesByVariable();
16777
16862
  for (const exportedVariable of map.keys()) {
16778
16863
  if (module.isEntryPoint && module.preserveSignature !== false) {
@@ -17189,7 +17274,7 @@ function getHasModuleSideEffects(moduleSideEffectsOption, pureExternalModules, g
17189
17274
  return (id, external) => !(external && isPureExternalModule(id));
17190
17275
  }
17191
17276
  class ModuleLoader {
17192
- constructor(graph, modulesById, pluginDriver, preserveSymlinks, external, getManualChunk, moduleSideEffects, pureExternalModules) {
17277
+ constructor(graph, modulesById, pluginDriver, preserveSymlinks, external, moduleSideEffects, pureExternalModules) {
17193
17278
  this.graph = graph;
17194
17279
  this.modulesById = modulesById;
17195
17280
  this.pluginDriver = pluginDriver;
@@ -17198,24 +17283,10 @@ class ModuleLoader {
17198
17283
  this.latestLoadModulesPromise = Promise.resolve();
17199
17284
  this.manualChunkModules = {};
17200
17285
  this.nextEntryModuleIndex = 0;
17201
- this.loadEntryModule = (unresolvedId, isEntry, importer) => resolveId(unresolvedId, importer, this.preserveSymlinks, this.pluginDriver, null).then(resolveIdResult => {
17202
- if (resolveIdResult === false ||
17203
- (resolveIdResult && typeof resolveIdResult === 'object' && resolveIdResult.external)) {
17204
- return error(errEntryCannotBeExternal(unresolvedId));
17205
- }
17206
- const id = resolveIdResult && typeof resolveIdResult === 'object'
17207
- ? resolveIdResult.id
17208
- : resolveIdResult;
17209
- if (typeof id === 'string') {
17210
- return this.fetchModule(id, undefined, true, false, isEntry);
17211
- }
17212
- return error(errUnresolvedEntry(unresolvedId));
17213
- });
17214
17286
  this.isExternal = getIdMatcher(external);
17215
17287
  this.hasModuleSideEffects = getHasModuleSideEffects(moduleSideEffects, pureExternalModules, graph);
17216
- this.getManualChunk = typeof getManualChunk === 'function' ? getManualChunk : () => null;
17217
17288
  }
17218
- addEntryModules(unresolvedEntryModules, isUserDefined) {
17289
+ async addEntryModules(unresolvedEntryModules, isUserDefined) {
17219
17290
  const firstEntryModuleIndex = this.nextEntryModuleIndex;
17220
17291
  this.nextEntryModuleIndex += unresolvedEntryModules.length;
17221
17292
  const loadNewEntryModulesPromise = Promise.all(unresolvedEntryModules.map(async ({ fileName, id, name, importer }) => {
@@ -17248,11 +17319,12 @@ class ModuleLoader {
17248
17319
  this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
17249
17320
  return entryModules;
17250
17321
  });
17251
- return this.awaitLoadModulesPromise(loadNewEntryModulesPromise).then(newEntryModules => ({
17322
+ const newEntryModules = await this.awaitLoadModulesPromise(loadNewEntryModulesPromise);
17323
+ return {
17252
17324
  entryModules: this.indexedEntryModules.map(({ module }) => module),
17253
17325
  manualChunkModulesByAlias: this.manualChunkModules,
17254
17326
  newEntryModules
17255
- }));
17327
+ };
17256
17328
  }
17257
17329
  addManualChunks(manualChunks) {
17258
17330
  const unresolvedManualChunks = [];
@@ -17262,18 +17334,73 @@ class ModuleLoader {
17262
17334
  unresolvedManualChunks.push({ id, alias });
17263
17335
  }
17264
17336
  }
17265
- const loadNewManualChunkModulesPromise = Promise.all(unresolvedManualChunks.map(({ id }) => this.loadEntryModule(id, false, undefined))).then(manualChunkModules => {
17337
+ return this.awaitLoadModulesPromise(Promise.all(unresolvedManualChunks.map(({ id }) => this.loadEntryModule(id, false, undefined))).then(manualChunkModules => {
17266
17338
  for (let index = 0; index < manualChunkModules.length; index++) {
17267
17339
  this.addModuleToManualChunk(unresolvedManualChunks[index].alias, manualChunkModules[index]);
17268
17340
  }
17269
- });
17270
- return this.awaitLoadModulesPromise(loadNewManualChunkModulesPromise);
17341
+ }));
17342
+ }
17343
+ assignManualChunks(getManualChunk) {
17344
+ const manualChunksApi = {
17345
+ getModuleIds: () => this.modulesById.keys(),
17346
+ getModuleInfo: this.graph.getModuleInfo
17347
+ };
17348
+ for (const module of this.modulesById.values()) {
17349
+ if (module instanceof Module) {
17350
+ const manualChunkAlias = getManualChunk(module.id, manualChunksApi);
17351
+ if (typeof manualChunkAlias === 'string') {
17352
+ this.addModuleToManualChunk(manualChunkAlias, module);
17353
+ }
17354
+ }
17355
+ }
17271
17356
  }
17272
17357
  async resolveId(source, importer, skip = null) {
17273
17358
  return this.normalizeResolveIdResult(this.isExternal(source, importer, false)
17274
17359
  ? false
17275
17360
  : await resolveId(source, importer, this.preserveSymlinks, this.pluginDriver, skip), importer, source);
17276
17361
  }
17362
+ async addModuleSource(id, importer, module) {
17363
+ var _a;
17364
+ timeStart('load modules', 3);
17365
+ let source;
17366
+ try {
17367
+ source = (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await readFile(id));
17368
+ }
17369
+ catch (err) {
17370
+ timeEnd('load modules', 3);
17371
+ let msg = `Could not load ${id}`;
17372
+ if (importer)
17373
+ msg += ` (imported by ${relativeId(importer)})`;
17374
+ msg += `: ${err.message}`;
17375
+ err.message = msg;
17376
+ throw err;
17377
+ }
17378
+ timeEnd('load modules', 3);
17379
+ const sourceDescription = typeof source === 'string'
17380
+ ? { code: source }
17381
+ : typeof source === 'object' && typeof source.code === 'string'
17382
+ ? source
17383
+ : error(errBadLoader(id));
17384
+ const cachedModule = this.graph.cachedModules.get(id);
17385
+ if (cachedModule &&
17386
+ !cachedModule.customTransformCache &&
17387
+ cachedModule.originalCode === sourceDescription.code) {
17388
+ if (cachedModule.transformFiles) {
17389
+ for (const emittedFile of cachedModule.transformFiles)
17390
+ this.pluginDriver.emitFile(emittedFile);
17391
+ }
17392
+ module.setSource(cachedModule);
17393
+ }
17394
+ else {
17395
+ if (typeof sourceDescription.moduleSideEffects === 'boolean') {
17396
+ module.moduleSideEffects = sourceDescription.moduleSideEffects;
17397
+ }
17398
+ if (typeof sourceDescription.syntheticNamedExports === 'boolean') {
17399
+ module.syntheticNamedExports = sourceDescription.syntheticNamedExports;
17400
+ }
17401
+ module.setSource(await transform(this.graph, sourceDescription, module));
17402
+ }
17403
+ }
17277
17404
  addModuleToManualChunk(alias, module) {
17278
17405
  if (module.manualChunkAlias !== null && module.manualChunkAlias !== alias) {
17279
17406
  return error(errCannotAssignModuleToChunk(module.id, alias, module.manualChunkAlias));
@@ -17301,19 +17428,25 @@ class ModuleLoader {
17301
17428
  }
17302
17429
  fetchAllDependencies(module) {
17303
17430
  return Promise.all([
17304
- ...Array.from(module.sources).map(async (source) => this.fetchResolvedDependency(source, module.id, (module.resolvedIds[source] =
17305
- module.resolvedIds[source] ||
17306
- this.handleResolveId(await this.resolveId(source, module.id), source, module.id)))),
17307
- ...module.getDynamicImportExpressions().map(async (specifier, index) => {
17308
- const resolvedId = await this.resolveDynamicImport(module, specifier, module.id);
17431
+ ...[...module.sources].map(async (source) => {
17432
+ const resolution = await this.fetchResolvedDependency(source, module.id, (module.resolvedIds[source] =
17433
+ module.resolvedIds[source] ||
17434
+ this.handleResolveId(await this.resolveId(source, module.id), source, module.id)));
17435
+ resolution.importers.push(module.id);
17436
+ resolution.importers.sort();
17437
+ }),
17438
+ ...module.dynamicImports.map(async (dynamicImport) => {
17439
+ const resolvedId = await this.resolveDynamicImport(module, dynamicImport.argument, module.id);
17309
17440
  if (resolvedId === null)
17310
17441
  return;
17311
- const dynamicImport = module.dynamicImports[index];
17312
17442
  if (typeof resolvedId === 'string') {
17313
17443
  dynamicImport.resolution = resolvedId;
17314
- return;
17315
17444
  }
17316
- dynamicImport.resolution = await this.fetchResolvedDependency(relativeId(resolvedId.id), module.id, resolvedId);
17445
+ else {
17446
+ const resolution = (dynamicImport.resolution = await this.fetchResolvedDependency(relativeId(resolvedId.id), module.id, resolvedId));
17447
+ resolution.dynamicImporters.push(module.id);
17448
+ resolution.dynamicImporters.sort();
17449
+ }
17317
17450
  })
17318
17451
  ]);
17319
17452
  }
@@ -17326,75 +17459,28 @@ class ModuleLoader {
17326
17459
  const module = new Module(this.graph, id, moduleSideEffects, syntheticNamedExports, isEntry);
17327
17460
  this.modulesById.set(id, module);
17328
17461
  this.graph.watchFiles[id] = true;
17329
- const manualChunkAlias = this.getManualChunk(id);
17330
- if (typeof manualChunkAlias === 'string') {
17331
- this.addModuleToManualChunk(manualChunkAlias, module);
17332
- }
17333
- timeStart('load modules', 3);
17334
- return Promise.resolve(this.pluginDriver.hookFirst('load', [id]))
17335
- .then(source => source !== null && source !== void 0 ? source : readFile(id))
17336
- .catch((err) => {
17337
- timeEnd('load modules', 3);
17338
- let msg = `Could not load ${id}`;
17339
- if (importer)
17340
- msg += ` (imported by ${importer})`;
17341
- msg += `: ${err.message}`;
17342
- err.message = msg;
17343
- throw err;
17344
- })
17345
- .then(source => {
17346
- timeEnd('load modules', 3);
17347
- if (typeof source === 'string')
17348
- return { code: source };
17349
- if (source && typeof source === 'object' && typeof source.code === 'string')
17350
- return source;
17351
- return error(errBadLoader(id));
17352
- })
17353
- .then(sourceDescription => {
17354
- const cachedModule = this.graph.cachedModules.get(id);
17355
- if (cachedModule &&
17356
- !cachedModule.customTransformCache &&
17357
- cachedModule.originalCode === sourceDescription.code) {
17358
- if (cachedModule.transformFiles) {
17359
- for (const emittedFile of cachedModule.transformFiles)
17360
- this.pluginDriver.emitFile(emittedFile);
17361
- }
17362
- return cachedModule;
17363
- }
17364
- if (typeof sourceDescription.moduleSideEffects === 'boolean') {
17365
- module.moduleSideEffects = sourceDescription.moduleSideEffects;
17366
- }
17367
- if (typeof sourceDescription.syntheticNamedExports === 'boolean') {
17368
- module.syntheticNamedExports = sourceDescription.syntheticNamedExports;
17462
+ await this.addModuleSource(id, importer, module);
17463
+ await this.fetchAllDependencies(module);
17464
+ for (const name in module.exports) {
17465
+ if (name !== 'default') {
17466
+ module.exportsAll[name] = module.id;
17369
17467
  }
17370
- return transform(this.graph, sourceDescription, module);
17371
- })
17372
- .then((source) => {
17373
- module.setSource(source);
17374
- this.modulesById.set(id, module);
17375
- return this.fetchAllDependencies(module).then(() => {
17376
- for (const name in module.exports) {
17377
- if (name !== 'default') {
17378
- module.exportsAll[name] = module.id;
17379
- }
17468
+ }
17469
+ for (const source of module.exportAllSources) {
17470
+ const id = module.resolvedIds[source].id;
17471
+ const exportAllModule = this.modulesById.get(id);
17472
+ if (exportAllModule instanceof ExternalModule)
17473
+ continue;
17474
+ for (const name in exportAllModule.exportsAll) {
17475
+ if (name in module.exportsAll) {
17476
+ this.graph.warn(errNamespaceConflict(name, module, exportAllModule));
17380
17477
  }
17381
- for (const source of module.exportAllSources) {
17382
- const id = module.resolvedIds[source].id;
17383
- const exportAllModule = this.modulesById.get(id);
17384
- if (exportAllModule instanceof ExternalModule)
17385
- continue;
17386
- for (const name in exportAllModule.exportsAll) {
17387
- if (name in module.exportsAll) {
17388
- this.graph.warn(errNamespaceConflict(name, module, exportAllModule));
17389
- }
17390
- else {
17391
- module.exportsAll[name] = exportAllModule.exportsAll[name];
17392
- }
17393
- }
17478
+ else {
17479
+ module.exportsAll[name] = exportAllModule.exportsAll[name];
17394
17480
  }
17395
- return module;
17396
- });
17397
- });
17481
+ }
17482
+ }
17483
+ return module;
17398
17484
  }
17399
17485
  fetchResolvedDependency(source, importer, resolvedId) {
17400
17486
  if (resolvedId.external) {
@@ -17431,6 +17517,18 @@ class ModuleLoader {
17431
17517
  }
17432
17518
  return resolvedId;
17433
17519
  }
17520
+ async loadEntryModule(unresolvedId, isEntry, importer) {
17521
+ const resolveIdResult = await resolveId(unresolvedId, importer, this.preserveSymlinks, this.pluginDriver, null);
17522
+ if (resolveIdResult === false ||
17523
+ (resolveIdResult && typeof resolveIdResult === 'object' && resolveIdResult.external)) {
17524
+ return error(errEntryCannotBeExternal(unresolvedId));
17525
+ }
17526
+ const id = resolveIdResult && typeof resolveIdResult === 'object' ? resolveIdResult.id : resolveIdResult;
17527
+ if (typeof id === 'string') {
17528
+ return this.fetchModule(id, undefined, true, false, isEntry);
17529
+ }
17530
+ return error(errUnresolvedEntry(unresolvedId));
17531
+ }
17434
17532
  normalizeResolveIdResult(resolveIdResult, importer, source) {
17435
17533
  let id = '';
17436
17534
  let external = false;
@@ -17581,7 +17679,7 @@ function analyzeModuleGraph(entryModules) {
17581
17679
  }
17582
17680
  for (const { resolution } of module.dynamicImports) {
17583
17681
  if (resolution instanceof Module &&
17584
- resolution.dynamicallyImportedBy.length > 0 &&
17682
+ resolution.includedDynamicImporters.length > 0 &&
17585
17683
  !resolution.manualChunkAlias) {
17586
17684
  dynamicEntryModules.add(resolution);
17587
17685
  entriesToHandle.add(resolution);
@@ -17600,7 +17698,7 @@ function getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEnt
17600
17698
  const dynamicallyDependentEntryPointsByDynamicEntry = new Map();
17601
17699
  for (const dynamicEntry of dynamicEntryModules) {
17602
17700
  const dynamicDependentEntryPoints = getDependentModules(dynamicallyDependentEntryPointsByDynamicEntry, dynamicEntry);
17603
- for (const importer of dynamicEntry.dynamicallyImportedBy) {
17701
+ for (const importer of dynamicEntry.includedDynamicImporters) {
17604
17702
  for (const entryPoint of dependentEntryPointsByModule.get(importer)) {
17605
17703
  dynamicDependentEntryPoints.add(entryPoint);
17606
17704
  }
@@ -17925,38 +18023,22 @@ function getPluginContexts(pluginCache, graph, fileEmitter) {
17925
18023
  getAssetFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getAssetFileName', 'getFileName', plugin.name, true, graph),
17926
18024
  getChunkFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getChunkFileName', 'getFileName', plugin.name, true, graph),
17927
18025
  getFileName: fileEmitter.getFileName,
17928
- getModuleInfo(moduleId) {
17929
- const foundModule = graph.moduleById.get(moduleId);
17930
- if (foundModule == null) {
17931
- throw new Error(`Unable to find module ${moduleId}`);
17932
- }
17933
- const importedIds = [];
17934
- const dynamicallyImportedIds = [];
17935
- if (foundModule instanceof Module) {
17936
- for (const source of foundModule.sources) {
17937
- importedIds.push(foundModule.resolvedIds[source].id);
17938
- }
17939
- for (const { resolution } of foundModule.dynamicImports) {
17940
- if (resolution instanceof Module || resolution instanceof ExternalModule) {
17941
- dynamicallyImportedIds.push(resolution.id);
17942
- }
17943
- }
17944
- }
17945
- return {
17946
- dynamicallyImportedIds,
17947
- hasModuleSideEffects: foundModule.moduleSideEffects,
17948
- id: foundModule.id,
17949
- importedIds,
17950
- isEntry: foundModule instanceof Module && foundModule.isEntryPoint,
17951
- isExternal: foundModule instanceof ExternalModule
17952
- };
17953
- },
18026
+ getModuleIds: () => graph.moduleById.keys(),
18027
+ getModuleInfo: graph.getModuleInfo,
17954
18028
  isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => graph.moduleLoader.isExternal(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, graph),
17955
18029
  meta: {
17956
18030
  rollupVersion: version
17957
18031
  },
17958
18032
  get moduleIds() {
17959
- return graph.moduleById.keys();
18033
+ function* wrappedModuleIds() {
18034
+ graph.warnDeprecation({
18035
+ message: `Accessing "this.moduleIds" on the plugin context by plugin ${plugin.name} is deprecated. The "this.getModuleIds" plugin context function should be used instead.`,
18036
+ plugin: plugin.name
18037
+ }, false);
18038
+ yield* moduleIds;
18039
+ }
18040
+ const moduleIds = graph.moduleById.keys();
18041
+ return wrappedModuleIds();
17960
18042
  },
17961
18043
  parse: graph.contextParse,
17962
18044
  resolve(source, importer, options) {
@@ -18187,6 +18269,34 @@ class Graph {
18187
18269
  this.watchFiles = Object.create(null);
18188
18270
  this.externalModules = [];
18189
18271
  this.modules = [];
18272
+ this.getModuleInfo = (moduleId) => {
18273
+ const foundModule = this.moduleById.get(moduleId);
18274
+ if (foundModule == null) {
18275
+ throw new Error(`Unable to find module ${moduleId}`);
18276
+ }
18277
+ const importedIds = [];
18278
+ const dynamicallyImportedIds = [];
18279
+ if (foundModule instanceof Module) {
18280
+ for (const source of foundModule.sources) {
18281
+ importedIds.push(foundModule.resolvedIds[source].id);
18282
+ }
18283
+ for (const { resolution } of foundModule.dynamicImports) {
18284
+ if (resolution instanceof Module || resolution instanceof ExternalModule) {
18285
+ dynamicallyImportedIds.push(resolution.id);
18286
+ }
18287
+ }
18288
+ }
18289
+ return {
18290
+ dynamicallyImportedIds,
18291
+ dynamicImporters: foundModule.dynamicImporters,
18292
+ hasModuleSideEffects: foundModule.moduleSideEffects,
18293
+ id: foundModule.id,
18294
+ importedIds,
18295
+ importers: foundModule.importers,
18296
+ isEntry: foundModule instanceof Module && foundModule.isEntryPoint,
18297
+ isExternal: foundModule instanceof ExternalModule
18298
+ };
18299
+ };
18190
18300
  this.onwarn = options.onwarn;
18191
18301
  this.deoptimizationTracker = new PathTracker();
18192
18302
  this.cachedModules = new Map();
@@ -18262,7 +18372,7 @@ class Graph {
18262
18372
  }
18263
18373
  this.acornOptions = options.acorn ? { ...options.acorn } : {};
18264
18374
  const acornPluginsToInject = [];
18265
- acornPluginsToInject.push(acornImportMeta, acornExportNsFrom, acornClassFields, acornStaticClassFeatures);
18375
+ acornPluginsToInject.push(acornImportMeta, acornClassFields, acornStaticClassFeatures);
18266
18376
  this.acornOptions.allowAwaitOutsideFunction = true;
18267
18377
  const acornInjectPlugins = options.acornInjectPlugins;
18268
18378
  acornPluginsToInject.push(...(Array.isArray(acornInjectPlugins)
@@ -18271,7 +18381,7 @@ class Graph {
18271
18381
  ? [acornInjectPlugins]
18272
18382
  : []));
18273
18383
  this.acornParser = Parser.extend(...acornPluginsToInject);
18274
- this.moduleLoader = new ModuleLoader(this, this.moduleById, this.pluginDriver, options.preserveSymlinks === true, options.external, (typeof options.manualChunks === 'function' && options.manualChunks), (this.treeshakingOptions ? this.treeshakingOptions.moduleSideEffects : null), (this.treeshakingOptions ? this.treeshakingOptions.pureExternalModules : false));
18384
+ this.moduleLoader = new ModuleLoader(this, this.moduleById, this.pluginDriver, options.preserveSymlinks === true, options.external, (this.treeshakingOptions ? this.treeshakingOptions.moduleSideEffects : null), (this.treeshakingOptions ? this.treeshakingOptions.pureExternalModules : false));
18275
18385
  }
18276
18386
  async build(entryModuleIds, manualChunks, inlineDynamicImports) {
18277
18387
  // Phase 1 – discovery. We load the entry module and find which
@@ -18342,7 +18452,9 @@ class Graph {
18342
18452
  const chunks = [];
18343
18453
  if (this.preserveModules) {
18344
18454
  for (const module of this.modules) {
18345
- if (module.isIncluded() || module.isEntryPoint || module.dynamicallyImportedBy.length > 0) {
18455
+ if (module.isIncluded() ||
18456
+ module.isEntryPoint ||
18457
+ module.includedDynamicImporters.length > 0) {
18346
18458
  const chunk = new Chunk$1(this, [module]);
18347
18459
  chunk.entryModules = [module];
18348
18460
  chunks.push(chunk);
@@ -18422,6 +18534,9 @@ class Graph {
18422
18534
  typeof manualChunks === 'object' &&
18423
18535
  this.moduleLoader.addManualChunks(manualChunks)
18424
18536
  ]);
18537
+ if (typeof manualChunks === 'function') {
18538
+ this.moduleLoader.assignManualChunks(manualChunks);
18539
+ }
18425
18540
  if (entryModules.length === 0) {
18426
18541
  throw new Error('You must supply options.input to rollup');
18427
18542
  }