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.
- package/CHANGELOG.md +44 -0
- package/LICENSE.md +0 -27
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +390 -275
- package/dist/es/shared/watch.js +20 -16
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.d.ts +22 -12
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +7 -7
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +390 -275
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +20 -16
- package/package.json +9 -10
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
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
|
|
@@ -13,7 +13,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
13
13
|
import { writeFile as writeFile$1, readdirSync, mkdirSync, readFile as readFile$1, lstatSync, realpathSync } from 'fs';
|
|
14
14
|
import { EventEmitter } from 'events';
|
|
15
15
|
|
|
16
|
-
var version = "2.
|
|
16
|
+
var version = "2.9.1";
|
|
17
17
|
|
|
18
18
|
// Reserved word lists for various dialects of the language
|
|
19
19
|
|
|
@@ -44,8 +44,8 @@ var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
|
44
44
|
// are only applied when a character is found to actually have a
|
|
45
45
|
// code point above 128.
|
|
46
46
|
// Generated by `bin/generate-identifier-regex.js`.
|
|
47
|
-
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-\
|
|
48
|
-
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\
|
|
47
|
+
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";
|
|
48
|
+
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";
|
|
49
49
|
|
|
50
50
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
51
51
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
@@ -59,10 +59,10 @@ nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
|
59
59
|
// generated by bin/generate-identifier-regex.js
|
|
60
60
|
|
|
61
61
|
// eslint-disable-next-line comma-spacing
|
|
62
|
-
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,
|
|
62
|
+
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];
|
|
63
63
|
|
|
64
64
|
// eslint-disable-next-line comma-spacing
|
|
65
|
-
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,
|
|
65
|
+
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];
|
|
66
66
|
|
|
67
67
|
// This has a complexity linear to the value of the code. The
|
|
68
68
|
// assumption is that looking up astral identifier characters is
|
|
@@ -215,6 +215,7 @@ var types = {
|
|
|
215
215
|
star: binop("*", 10),
|
|
216
216
|
slash: binop("/", 10),
|
|
217
217
|
starstar: new TokenType("**", {beforeExpr: true}),
|
|
218
|
+
coalesce: binop("??", 1),
|
|
218
219
|
|
|
219
220
|
// Keyword token types.
|
|
220
221
|
_break: kw("break"),
|
|
@@ -611,7 +612,14 @@ pp.strictDirective = function(start) {
|
|
|
611
612
|
start += skipWhiteSpace.exec(this.input)[0].length;
|
|
612
613
|
var match = literal.exec(this.input.slice(start));
|
|
613
614
|
if (!match) { return false }
|
|
614
|
-
if ((match[1] || match[2]) === "use strict") {
|
|
615
|
+
if ((match[1] || match[2]) === "use strict") {
|
|
616
|
+
skipWhiteSpace.lastIndex = start + match[0].length;
|
|
617
|
+
var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
|
|
618
|
+
var next = this.input.charAt(end);
|
|
619
|
+
return next === ";" || next === "}" ||
|
|
620
|
+
(lineBreak.test(spaceAfter[0]) &&
|
|
621
|
+
!(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="))
|
|
622
|
+
}
|
|
615
623
|
start += match[0].length;
|
|
616
624
|
|
|
617
625
|
// Skip semicolon, if any.
|
|
@@ -861,7 +869,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
861
869
|
skipWhiteSpace.lastIndex = this.pos;
|
|
862
870
|
var skip = skipWhiteSpace.exec(this.input);
|
|
863
871
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
864
|
-
if (nextCh === 40) // '('
|
|
872
|
+
if (nextCh === 40 || nextCh === 46) // '(' or '.'
|
|
865
873
|
{ return this.parseExpressionStatement(node, this.parseExpression()) }
|
|
866
874
|
}
|
|
867
875
|
|
|
@@ -1161,17 +1169,19 @@ pp$1.parseExpressionStatement = function(node, expr) {
|
|
|
1161
1169
|
// strict"` declarations when `allowStrict` is true (used for
|
|
1162
1170
|
// function bodies).
|
|
1163
1171
|
|
|
1164
|
-
pp$1.parseBlock = function(createNewLexicalScope, node) {
|
|
1172
|
+
pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
1165
1173
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
|
1166
1174
|
if ( node === void 0 ) node = this.startNode();
|
|
1167
1175
|
|
|
1168
1176
|
node.body = [];
|
|
1169
1177
|
this.expect(types.braceL);
|
|
1170
1178
|
if (createNewLexicalScope) { this.enterScope(0); }
|
|
1171
|
-
while (
|
|
1179
|
+
while (this.type !== types.braceR) {
|
|
1172
1180
|
var stmt = this.parseStatement(null);
|
|
1173
1181
|
node.body.push(stmt);
|
|
1174
1182
|
}
|
|
1183
|
+
if (exitStrict) { this.strict = false; }
|
|
1184
|
+
this.next();
|
|
1175
1185
|
if (createNewLexicalScope) { this.exitScope(); }
|
|
1176
1186
|
return this.finishNode(node, "BlockStatement")
|
|
1177
1187
|
};
|
|
@@ -1322,7 +1332,7 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
1322
1332
|
var hadConstructor = false;
|
|
1323
1333
|
classBody.body = [];
|
|
1324
1334
|
this.expect(types.braceL);
|
|
1325
|
-
while (
|
|
1335
|
+
while (this.type !== types.braceR) {
|
|
1326
1336
|
var element = this.parseClassElement(node.superClass !== null);
|
|
1327
1337
|
if (element) {
|
|
1328
1338
|
classBody.body.push(element);
|
|
@@ -1332,8 +1342,9 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
1332
1342
|
}
|
|
1333
1343
|
}
|
|
1334
1344
|
}
|
|
1335
|
-
node.body = this.finishNode(classBody, "ClassBody");
|
|
1336
1345
|
this.strict = oldStrict;
|
|
1346
|
+
this.next();
|
|
1347
|
+
node.body = this.finishNode(classBody, "ClassBody");
|
|
1337
1348
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
1338
1349
|
};
|
|
1339
1350
|
|
|
@@ -1421,6 +1432,14 @@ pp$1.parseExport = function(node, exports) {
|
|
|
1421
1432
|
this.next();
|
|
1422
1433
|
// export * from '...'
|
|
1423
1434
|
if (this.eat(types.star)) {
|
|
1435
|
+
if (this.options.ecmaVersion >= 11) {
|
|
1436
|
+
if (this.eatContextual("as")) {
|
|
1437
|
+
node.exported = this.parseIdent(true);
|
|
1438
|
+
this.checkExport(exports, node.exported.name, this.lastTokStart);
|
|
1439
|
+
} else {
|
|
1440
|
+
node.exported = null;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1424
1443
|
this.expectContextual("from");
|
|
1425
1444
|
if (this.type !== types.string) { this.unexpected(); }
|
|
1426
1445
|
node.source = this.parseExprAtom();
|
|
@@ -2037,11 +2056,20 @@ pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
|
|
|
2037
2056
|
if (prec != null && (!noIn || this.type !== types._in)) {
|
|
2038
2057
|
if (prec > minPrec) {
|
|
2039
2058
|
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
2059
|
+
var coalesce = this.type === types.coalesce;
|
|
2060
|
+
if (coalesce) {
|
|
2061
|
+
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
|
2062
|
+
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
|
2063
|
+
prec = types.logicalAND.binop;
|
|
2064
|
+
}
|
|
2040
2065
|
var op = this.value;
|
|
2041
2066
|
this.next();
|
|
2042
2067
|
var startPos = this.start, startLoc = this.startLoc;
|
|
2043
2068
|
var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);
|
|
2044
|
-
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical);
|
|
2069
|
+
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
2070
|
+
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
2071
|
+
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
2072
|
+
}
|
|
2045
2073
|
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
|
|
2046
2074
|
}
|
|
2047
2075
|
}
|
|
@@ -2113,7 +2141,8 @@ pp$3.parseExprSubscripts = function(refDestructuringErrors) {
|
|
|
2113
2141
|
|
|
2114
2142
|
pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
|
|
2115
2143
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
|
2116
|
-
this.lastTokEnd === base.end && !this.canInsertSemicolon() &&
|
|
2144
|
+
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
|
|
2145
|
+
this.potentialArrowAt === base.start;
|
|
2117
2146
|
while (true) {
|
|
2118
2147
|
var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);
|
|
2119
2148
|
if (element === base || element.type === "ArrowFunctionExpression") { return element }
|
|
@@ -2277,10 +2306,18 @@ pp$3.parseExprAtom = function(refDestructuringErrors) {
|
|
|
2277
2306
|
|
|
2278
2307
|
pp$3.parseExprImport = function() {
|
|
2279
2308
|
var node = this.startNode();
|
|
2280
|
-
|
|
2309
|
+
|
|
2310
|
+
// Consume `import` as an identifier for `import.meta`.
|
|
2311
|
+
// Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
|
|
2312
|
+
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
|
|
2313
|
+
var meta = this.parseIdent(true);
|
|
2314
|
+
|
|
2281
2315
|
switch (this.type) {
|
|
2282
2316
|
case types.parenL:
|
|
2283
2317
|
return this.parseDynamicImport(node)
|
|
2318
|
+
case types.dot:
|
|
2319
|
+
node.meta = meta;
|
|
2320
|
+
return this.parseImportMeta(node)
|
|
2284
2321
|
default:
|
|
2285
2322
|
this.unexpected();
|
|
2286
2323
|
}
|
|
@@ -2305,6 +2342,22 @@ pp$3.parseDynamicImport = function(node) {
|
|
|
2305
2342
|
return this.finishNode(node, "ImportExpression")
|
|
2306
2343
|
};
|
|
2307
2344
|
|
|
2345
|
+
pp$3.parseImportMeta = function(node) {
|
|
2346
|
+
this.next(); // skip `.`
|
|
2347
|
+
|
|
2348
|
+
var containsEsc = this.containsEsc;
|
|
2349
|
+
node.property = this.parseIdent(true);
|
|
2350
|
+
|
|
2351
|
+
if (node.property.name !== "meta")
|
|
2352
|
+
{ this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
|
|
2353
|
+
if (containsEsc)
|
|
2354
|
+
{ this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
|
|
2355
|
+
if (this.options.sourceType !== "module")
|
|
2356
|
+
{ this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }
|
|
2357
|
+
|
|
2358
|
+
return this.finishNode(node, "MetaProperty")
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2308
2361
|
pp$3.parseLiteral = function(value) {
|
|
2309
2362
|
var node = this.startNode();
|
|
2310
2363
|
node.value = value;
|
|
@@ -2407,10 +2460,12 @@ pp$3.parseNew = function() {
|
|
|
2407
2460
|
node.meta = meta;
|
|
2408
2461
|
var containsEsc = this.containsEsc;
|
|
2409
2462
|
node.property = this.parseIdent(true);
|
|
2410
|
-
if (node.property.name !== "target"
|
|
2411
|
-
{ this.raiseRecoverable(node.property.start, "The only valid meta property for new is new.target"); }
|
|
2463
|
+
if (node.property.name !== "target")
|
|
2464
|
+
{ this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); }
|
|
2465
|
+
if (containsEsc)
|
|
2466
|
+
{ this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); }
|
|
2412
2467
|
if (!this.inNonArrowFunction())
|
|
2413
|
-
{ this.raiseRecoverable(node.start, "new.target can only be used in functions"); }
|
|
2468
|
+
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions"); }
|
|
2414
2469
|
return this.finishNode(node, "MetaProperty")
|
|
2415
2470
|
}
|
|
2416
2471
|
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
|
|
@@ -2694,16 +2749,14 @@ pp$3.parseFunctionBody = function(node, isArrowFunction, isMethod) {
|
|
|
2694
2749
|
// Add the params to varDeclaredNames to ensure that an error is thrown
|
|
2695
2750
|
// if a let/const declaration in the function clashes with one of the params.
|
|
2696
2751
|
this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
|
|
2697
|
-
|
|
2752
|
+
// Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
|
|
2753
|
+
if (this.strict && node.id) { this.checkLVal(node.id, BIND_OUTSIDE); }
|
|
2754
|
+
node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
|
|
2698
2755
|
node.expression = false;
|
|
2699
2756
|
this.adaptDirectivePrologue(node.body.body);
|
|
2700
2757
|
this.labels = oldLabels;
|
|
2701
2758
|
}
|
|
2702
2759
|
this.exitScope();
|
|
2703
|
-
|
|
2704
|
-
// Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
|
|
2705
|
-
if (this.strict && node.id) { this.checkLVal(node.id, BIND_OUTSIDE); }
|
|
2706
|
-
this.strict = oldStrict;
|
|
2707
2760
|
};
|
|
2708
2761
|
|
|
2709
2762
|
pp$3.isSimpleParamList = function(params) {
|
|
@@ -3222,49 +3275,61 @@ RegExpValidationState.prototype.raise = function raise (message) {
|
|
|
3222
3275
|
|
|
3223
3276
|
// If u flag is given, this returns the code point at the index (it combines a surrogate pair).
|
|
3224
3277
|
// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
|
|
3225
|
-
RegExpValidationState.prototype.at = function at (i) {
|
|
3278
|
+
RegExpValidationState.prototype.at = function at (i, forceU) {
|
|
3279
|
+
if ( forceU === void 0 ) forceU = false;
|
|
3280
|
+
|
|
3226
3281
|
var s = this.source;
|
|
3227
3282
|
var l = s.length;
|
|
3228
3283
|
if (i >= l) {
|
|
3229
3284
|
return -1
|
|
3230
3285
|
}
|
|
3231
3286
|
var c = s.charCodeAt(i);
|
|
3232
|
-
if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
|
|
3287
|
+
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
|
|
3233
3288
|
return c
|
|
3234
3289
|
}
|
|
3235
3290
|
var next = s.charCodeAt(i + 1);
|
|
3236
3291
|
return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c
|
|
3237
3292
|
};
|
|
3238
3293
|
|
|
3239
|
-
RegExpValidationState.prototype.nextIndex = function nextIndex (i) {
|
|
3294
|
+
RegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {
|
|
3295
|
+
if ( forceU === void 0 ) forceU = false;
|
|
3296
|
+
|
|
3240
3297
|
var s = this.source;
|
|
3241
3298
|
var l = s.length;
|
|
3242
3299
|
if (i >= l) {
|
|
3243
3300
|
return l
|
|
3244
3301
|
}
|
|
3245
3302
|
var c = s.charCodeAt(i), next;
|
|
3246
|
-
if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
|
|
3303
|
+
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
|
|
3247
3304
|
(next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
|
|
3248
3305
|
return i + 1
|
|
3249
3306
|
}
|
|
3250
3307
|
return i + 2
|
|
3251
3308
|
};
|
|
3252
3309
|
|
|
3253
|
-
RegExpValidationState.prototype.current = function current () {
|
|
3254
|
-
|
|
3310
|
+
RegExpValidationState.prototype.current = function current (forceU) {
|
|
3311
|
+
if ( forceU === void 0 ) forceU = false;
|
|
3312
|
+
|
|
3313
|
+
return this.at(this.pos, forceU)
|
|
3255
3314
|
};
|
|
3256
3315
|
|
|
3257
|
-
RegExpValidationState.prototype.lookahead = function lookahead () {
|
|
3258
|
-
|
|
3316
|
+
RegExpValidationState.prototype.lookahead = function lookahead (forceU) {
|
|
3317
|
+
if ( forceU === void 0 ) forceU = false;
|
|
3318
|
+
|
|
3319
|
+
return this.at(this.nextIndex(this.pos, forceU), forceU)
|
|
3259
3320
|
};
|
|
3260
3321
|
|
|
3261
|
-
RegExpValidationState.prototype.advance = function advance () {
|
|
3262
|
-
|
|
3322
|
+
RegExpValidationState.prototype.advance = function advance (forceU) {
|
|
3323
|
+
if ( forceU === void 0 ) forceU = false;
|
|
3324
|
+
|
|
3325
|
+
this.pos = this.nextIndex(this.pos, forceU);
|
|
3263
3326
|
};
|
|
3264
3327
|
|
|
3265
|
-
RegExpValidationState.prototype.eat = function eat (ch) {
|
|
3266
|
-
|
|
3267
|
-
|
|
3328
|
+
RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
3329
|
+
if ( forceU === void 0 ) forceU = false;
|
|
3330
|
+
|
|
3331
|
+
if (this.current(forceU) === ch) {
|
|
3332
|
+
this.advance(forceU);
|
|
3268
3333
|
return true
|
|
3269
3334
|
}
|
|
3270
3335
|
return false
|
|
@@ -3603,9 +3668,9 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
|
|
|
3603
3668
|
return false
|
|
3604
3669
|
};
|
|
3605
3670
|
|
|
3606
|
-
// GroupSpecifier
|
|
3671
|
+
// GroupSpecifier ::
|
|
3607
3672
|
// [empty]
|
|
3608
|
-
// `?` GroupName
|
|
3673
|
+
// `?` GroupName
|
|
3609
3674
|
pp$8.regexp_groupSpecifier = function(state) {
|
|
3610
3675
|
if (state.eat(0x3F /* ? */)) {
|
|
3611
3676
|
if (this.regexp_eatGroupName(state)) {
|
|
@@ -3619,8 +3684,8 @@ pp$8.regexp_groupSpecifier = function(state) {
|
|
|
3619
3684
|
}
|
|
3620
3685
|
};
|
|
3621
3686
|
|
|
3622
|
-
// GroupName
|
|
3623
|
-
// `<` RegExpIdentifierName
|
|
3687
|
+
// GroupName ::
|
|
3688
|
+
// `<` RegExpIdentifierName `>`
|
|
3624
3689
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
3625
3690
|
pp$8.regexp_eatGroupName = function(state) {
|
|
3626
3691
|
state.lastStringValue = "";
|
|
@@ -3633,9 +3698,9 @@ pp$8.regexp_eatGroupName = function(state) {
|
|
|
3633
3698
|
return false
|
|
3634
3699
|
};
|
|
3635
3700
|
|
|
3636
|
-
// RegExpIdentifierName
|
|
3637
|
-
// RegExpIdentifierStart
|
|
3638
|
-
// RegExpIdentifierName
|
|
3701
|
+
// RegExpIdentifierName ::
|
|
3702
|
+
// RegExpIdentifierStart
|
|
3703
|
+
// RegExpIdentifierName RegExpIdentifierPart
|
|
3639
3704
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
3640
3705
|
pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
|
3641
3706
|
state.lastStringValue = "";
|
|
@@ -3649,17 +3714,18 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
|
|
3649
3714
|
return false
|
|
3650
3715
|
};
|
|
3651
3716
|
|
|
3652
|
-
// RegExpIdentifierStart
|
|
3717
|
+
// RegExpIdentifierStart ::
|
|
3653
3718
|
// UnicodeIDStart
|
|
3654
3719
|
// `$`
|
|
3655
3720
|
// `_`
|
|
3656
|
-
// `\` RegExpUnicodeEscapeSequence[
|
|
3721
|
+
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
3657
3722
|
pp$8.regexp_eatRegExpIdentifierStart = function(state) {
|
|
3658
3723
|
var start = state.pos;
|
|
3659
|
-
var
|
|
3660
|
-
state.
|
|
3724
|
+
var forceU = this.options.ecmaVersion >= 11;
|
|
3725
|
+
var ch = state.current(forceU);
|
|
3726
|
+
state.advance(forceU);
|
|
3661
3727
|
|
|
3662
|
-
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
|
|
3728
|
+
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
|
|
3663
3729
|
ch = state.lastIntValue;
|
|
3664
3730
|
}
|
|
3665
3731
|
if (isRegExpIdentifierStart(ch)) {
|
|
@@ -3674,19 +3740,20 @@ function isRegExpIdentifierStart(ch) {
|
|
|
3674
3740
|
return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */
|
|
3675
3741
|
}
|
|
3676
3742
|
|
|
3677
|
-
// RegExpIdentifierPart
|
|
3743
|
+
// RegExpIdentifierPart ::
|
|
3678
3744
|
// UnicodeIDContinue
|
|
3679
3745
|
// `$`
|
|
3680
3746
|
// `_`
|
|
3681
|
-
// `\` RegExpUnicodeEscapeSequence[
|
|
3747
|
+
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
3682
3748
|
// <ZWNJ>
|
|
3683
3749
|
// <ZWJ>
|
|
3684
3750
|
pp$8.regexp_eatRegExpIdentifierPart = function(state) {
|
|
3685
3751
|
var start = state.pos;
|
|
3686
|
-
var
|
|
3687
|
-
state.
|
|
3752
|
+
var forceU = this.options.ecmaVersion >= 11;
|
|
3753
|
+
var ch = state.current(forceU);
|
|
3754
|
+
state.advance(forceU);
|
|
3688
3755
|
|
|
3689
|
-
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
|
|
3756
|
+
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
|
|
3690
3757
|
ch = state.lastIntValue;
|
|
3691
3758
|
}
|
|
3692
3759
|
if (isRegExpIdentifierPart(ch)) {
|
|
@@ -3756,7 +3823,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
|
|
|
3756
3823
|
this.regexp_eatCControlLetter(state) ||
|
|
3757
3824
|
this.regexp_eatZero(state) ||
|
|
3758
3825
|
this.regexp_eatHexEscapeSequence(state) ||
|
|
3759
|
-
this.regexp_eatRegExpUnicodeEscapeSequence(state) ||
|
|
3826
|
+
this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||
|
|
3760
3827
|
(!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||
|
|
3761
3828
|
this.regexp_eatIdentityEscape(state)
|
|
3762
3829
|
)
|
|
@@ -3829,13 +3896,16 @@ function isControlLetter(ch) {
|
|
|
3829
3896
|
}
|
|
3830
3897
|
|
|
3831
3898
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
|
3832
|
-
pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state) {
|
|
3899
|
+
pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
3900
|
+
if ( forceU === void 0 ) forceU = false;
|
|
3901
|
+
|
|
3833
3902
|
var start = state.pos;
|
|
3903
|
+
var switchU = forceU || state.switchU;
|
|
3834
3904
|
|
|
3835
3905
|
if (state.eat(0x75 /* u */)) {
|
|
3836
3906
|
if (this.regexp_eatFixedHexDigits(state, 4)) {
|
|
3837
3907
|
var lead = state.lastIntValue;
|
|
3838
|
-
if (
|
|
3908
|
+
if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
|
|
3839
3909
|
var leadSurrogateEnd = state.pos;
|
|
3840
3910
|
if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
|
|
3841
3911
|
var trail = state.lastIntValue;
|
|
@@ -3850,7 +3920,7 @@ pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state) {
|
|
|
3850
3920
|
return true
|
|
3851
3921
|
}
|
|
3852
3922
|
if (
|
|
3853
|
-
|
|
3923
|
+
switchU &&
|
|
3854
3924
|
state.eat(0x7B /* { */) &&
|
|
3855
3925
|
this.regexp_eatHexDigits(state) &&
|
|
3856
3926
|
state.eat(0x7D /* } */) &&
|
|
@@ -3858,7 +3928,7 @@ pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state) {
|
|
|
3858
3928
|
) {
|
|
3859
3929
|
return true
|
|
3860
3930
|
}
|
|
3861
|
-
if (
|
|
3931
|
+
if (switchU) {
|
|
3862
3932
|
state.raise("Invalid unicode escape");
|
|
3863
3933
|
}
|
|
3864
3934
|
state.pos = start;
|
|
@@ -4514,6 +4584,14 @@ pp$9.readToken_eq_excl = function(code) { // '=!'
|
|
|
4514
4584
|
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
|
4515
4585
|
};
|
|
4516
4586
|
|
|
4587
|
+
pp$9.readToken_question = function() { // '?'
|
|
4588
|
+
if (this.options.ecmaVersion >= 11) {
|
|
4589
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
4590
|
+
if (next === 63) { return this.finishOp(types.coalesce, 2) }
|
|
4591
|
+
}
|
|
4592
|
+
return this.finishOp(types.question, 1)
|
|
4593
|
+
};
|
|
4594
|
+
|
|
4517
4595
|
pp$9.getTokenFromCode = function(code) {
|
|
4518
4596
|
switch (code) {
|
|
4519
4597
|
// The interpretation of a dot depends on whether it is followed
|
|
@@ -4531,7 +4609,6 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
4531
4609
|
case 123: ++this.pos; return this.finishToken(types.braceL)
|
|
4532
4610
|
case 125: ++this.pos; return this.finishToken(types.braceR)
|
|
4533
4611
|
case 58: ++this.pos; return this.finishToken(types.colon)
|
|
4534
|
-
case 63: ++this.pos; return this.finishToken(types.question)
|
|
4535
4612
|
|
|
4536
4613
|
case 96: // '`'
|
|
4537
4614
|
if (this.options.ecmaVersion < 6) { break }
|
|
@@ -4581,6 +4658,9 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
4581
4658
|
case 61: case 33: // '=!'
|
|
4582
4659
|
return this.readToken_eq_excl(code)
|
|
4583
4660
|
|
|
4661
|
+
case 63: // '?'
|
|
4662
|
+
return this.readToken_question()
|
|
4663
|
+
|
|
4584
4664
|
case 126: // '~'
|
|
4585
4665
|
return this.finishOp(types.prefix, 1)
|
|
4586
4666
|
}
|
|
@@ -5253,43 +5333,13 @@ var acornClassFields = function(Parser) {
|
|
|
5253
5333
|
}
|
|
5254
5334
|
};
|
|
5255
5335
|
|
|
5256
|
-
const skipWhiteSpace$1 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
5257
|
-
|
|
5258
5336
|
const tt = require$$0.tokTypes;
|
|
5259
5337
|
|
|
5260
|
-
|
|
5261
|
-
return class extends Parser {
|
|
5262
|
-
parseExport(node, exports) {
|
|
5263
|
-
skipWhiteSpace$1.lastIndex = this.pos;
|
|
5264
|
-
const skip = skipWhiteSpace$1.exec(this.input);
|
|
5265
|
-
const next = this.input.charAt(this.pos + skip[0].length);
|
|
5266
|
-
if (next !== "*") return super.parseExport(node, exports)
|
|
5267
|
-
|
|
5268
|
-
this.next();
|
|
5269
|
-
const specifier = this.startNode();
|
|
5270
|
-
this.expect(tt.star);
|
|
5271
|
-
if (this.eatContextual("as")) {
|
|
5272
|
-
node.declaration = null;
|
|
5273
|
-
specifier.exported = this.parseIdent(true);
|
|
5274
|
-
this.checkExport(exports, specifier.exported.name, this.lastTokStart);
|
|
5275
|
-
node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")];
|
|
5276
|
-
}
|
|
5277
|
-
this.expectContextual("from");
|
|
5278
|
-
if (this.type !== tt.string) this.unexpected();
|
|
5279
|
-
node.source = this.parseExprAtom();
|
|
5280
|
-
this.semicolon();
|
|
5281
|
-
return this.finishNode(node, node.specifiers ? "ExportNamedDeclaration" : "ExportAllDeclaration")
|
|
5282
|
-
}
|
|
5283
|
-
}
|
|
5284
|
-
};
|
|
5285
|
-
|
|
5286
|
-
const tt$1 = require$$0.tokTypes;
|
|
5287
|
-
|
|
5288
|
-
const skipWhiteSpace$2 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
5338
|
+
const skipWhiteSpace$1 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
5289
5339
|
|
|
5290
5340
|
const nextTokenIsDot = parser => {
|
|
5291
|
-
skipWhiteSpace$
|
|
5292
|
-
let skip = skipWhiteSpace$
|
|
5341
|
+
skipWhiteSpace$1.lastIndex = parser.pos;
|
|
5342
|
+
let skip = skipWhiteSpace$1.exec(parser.input);
|
|
5293
5343
|
let next = parser.pos + skip[0].length;
|
|
5294
5344
|
return parser.input.slice(next, next + 1) === "."
|
|
5295
5345
|
};
|
|
@@ -5297,7 +5347,7 @@ const nextTokenIsDot = parser => {
|
|
|
5297
5347
|
var acornImportMeta = function(Parser) {
|
|
5298
5348
|
return class extends Parser {
|
|
5299
5349
|
parseExprAtom(refDestructuringErrors) {
|
|
5300
|
-
if (this.type !== tt
|
|
5350
|
+
if (this.type !== tt._import || !nextTokenIsDot(this)) return super.parseExprAtom(refDestructuringErrors)
|
|
5301
5351
|
|
|
5302
5352
|
if (!this.options.allowImportExportEverywhere && !this.inModule) {
|
|
5303
5353
|
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
|
|
@@ -5306,7 +5356,7 @@ var acornImportMeta = function(Parser) {
|
|
|
5306
5356
|
let node = this.startNode();
|
|
5307
5357
|
if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword import");
|
|
5308
5358
|
node.meta = this.parseIdent(true);
|
|
5309
|
-
this.expect(tt
|
|
5359
|
+
this.expect(tt.dot);
|
|
5310
5360
|
node.property = this.parseIdent(true);
|
|
5311
5361
|
if (node.property.name !== "meta") {
|
|
5312
5362
|
this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta");
|
|
@@ -5318,7 +5368,7 @@ var acornImportMeta = function(Parser) {
|
|
|
5318
5368
|
}
|
|
5319
5369
|
|
|
5320
5370
|
parseStatement(context, topLevel, exports) {
|
|
5321
|
-
if (this.type !== tt
|
|
5371
|
+
if (this.type !== tt._import || !nextTokenIsDot(this)) {
|
|
5322
5372
|
return super.parseStatement(context, topLevel, exports)
|
|
5323
5373
|
}
|
|
5324
5374
|
|
|
@@ -6296,6 +6346,25 @@ class PathTracker {
|
|
|
6296
6346
|
}
|
|
6297
6347
|
}
|
|
6298
6348
|
const SHARED_RECURSION_TRACKER = new PathTracker();
|
|
6349
|
+
class DiscriminatedPathTracker {
|
|
6350
|
+
constructor() {
|
|
6351
|
+
this.entityPaths = Object.create(null, {
|
|
6352
|
+
[EntitiesKey]: { value: new Map() }
|
|
6353
|
+
});
|
|
6354
|
+
}
|
|
6355
|
+
getEntities(path, discriminator) {
|
|
6356
|
+
let currentPaths = this.entityPaths;
|
|
6357
|
+
for (const pathSegment of path) {
|
|
6358
|
+
currentPaths = currentPaths[pathSegment] =
|
|
6359
|
+
currentPaths[pathSegment] ||
|
|
6360
|
+
Object.create(null, { [EntitiesKey]: { value: new Map() } });
|
|
6361
|
+
}
|
|
6362
|
+
const entities = currentPaths[EntitiesKey];
|
|
6363
|
+
const result = entities.get(discriminator) || new Set();
|
|
6364
|
+
entities.set(discriminator, result);
|
|
6365
|
+
return result;
|
|
6366
|
+
}
|
|
6367
|
+
}
|
|
6299
6368
|
|
|
6300
6369
|
function assembleMemberDescriptions(memberDescriptions, inheritedDescriptions = null) {
|
|
6301
6370
|
return Object.create(inheritedDescriptions, memberDescriptions);
|
|
@@ -6761,6 +6830,10 @@ class Variable {
|
|
|
6761
6830
|
}
|
|
6762
6831
|
|
|
6763
6832
|
class GlobalVariable extends Variable {
|
|
6833
|
+
constructor() {
|
|
6834
|
+
super(...arguments);
|
|
6835
|
+
this.isReassigned = true;
|
|
6836
|
+
}
|
|
6764
6837
|
hasEffectsWhenAccessedAtPath(path) {
|
|
6765
6838
|
return !isGlobalMember([this.name, ...path]);
|
|
6766
6839
|
}
|
|
@@ -6833,8 +6906,10 @@ function normalize(path) {
|
|
|
6833
6906
|
|
|
6834
6907
|
class ExternalModule {
|
|
6835
6908
|
constructor(graph, id, moduleSideEffects) {
|
|
6909
|
+
this.dynamicImporters = [];
|
|
6836
6910
|
this.exportsNames = false;
|
|
6837
6911
|
this.exportsNamespace = false;
|
|
6912
|
+
this.importers = [];
|
|
6838
6913
|
this.mostCommonSuggestion = 0;
|
|
6839
6914
|
this.reexported = false;
|
|
6840
6915
|
this.renderPath = undefined;
|
|
@@ -6946,7 +7021,7 @@ function createHasEffectsContext() {
|
|
|
6946
7021
|
accessed: new PathTracker(),
|
|
6947
7022
|
assigned: new PathTracker(),
|
|
6948
7023
|
brokenFlow: BROKEN_FLOW_NONE,
|
|
6949
|
-
called: new
|
|
7024
|
+
called: new DiscriminatedPathTracker(),
|
|
6950
7025
|
ignore: {
|
|
6951
7026
|
breaks: false,
|
|
6952
7027
|
continues: false,
|
|
@@ -6954,14 +7029,14 @@ function createHasEffectsContext() {
|
|
|
6954
7029
|
returnAwaitYield: false
|
|
6955
7030
|
},
|
|
6956
7031
|
includedLabels: new Set(),
|
|
6957
|
-
instantiated: new
|
|
7032
|
+
instantiated: new DiscriminatedPathTracker(),
|
|
6958
7033
|
replacedVariableInits: new Map()
|
|
6959
7034
|
};
|
|
6960
7035
|
}
|
|
6961
7036
|
|
|
7037
|
+
const ArrowFunctionExpression = 'ArrowFunctionExpression';
|
|
6962
7038
|
const BlockStatement = 'BlockStatement';
|
|
6963
7039
|
const CallExpression = 'CallExpression';
|
|
6964
|
-
const ExportNamespaceSpecifier = 'ExportNamespaceSpecifier';
|
|
6965
7040
|
const ExpressionStatement = 'ExpressionStatement';
|
|
6966
7041
|
const FunctionExpression = 'FunctionExpression';
|
|
6967
7042
|
const Identifier = 'Identifier';
|
|
@@ -7084,7 +7159,7 @@ class LocalVariable extends Variable {
|
|
|
7084
7159
|
return true;
|
|
7085
7160
|
const trackedExpressions = (callOptions.withNew
|
|
7086
7161
|
? context.instantiated
|
|
7087
|
-
: context.called).getEntities(path);
|
|
7162
|
+
: context.called).getEntities(path, callOptions);
|
|
7088
7163
|
if (trackedExpressions.has(this))
|
|
7089
7164
|
return false;
|
|
7090
7165
|
trackedExpressions.add(this);
|
|
@@ -10748,7 +10823,9 @@ function getStarExcludes({ dependencies, exports }) {
|
|
|
10748
10823
|
return starExcludes;
|
|
10749
10824
|
}
|
|
10750
10825
|
const getStarExcludesBlock = (starExcludes, varOrConst, _, t, n) => starExcludes
|
|
10751
|
-
? `${n}${t}${varOrConst} _starExcludes${_}=${_}{${_}${
|
|
10826
|
+
? `${n}${t}${varOrConst} _starExcludes${_}=${_}{${_}${[...starExcludes]
|
|
10827
|
+
.map(prop => `${prop}:${_}1`)
|
|
10828
|
+
.join(`,${_}`)}${_}};`
|
|
10752
10829
|
: '';
|
|
10753
10830
|
const getImportBindingsBlock = (importBindings, _, t, n) => (importBindings.length ? `${n}${t}var ${importBindings.join(`,${_}`)};` : '');
|
|
10754
10831
|
function getExportsBlock(exports, _, t, n) {
|
|
@@ -11177,7 +11254,7 @@ class BlockStatement$1 extends NodeBase {
|
|
|
11177
11254
|
}
|
|
11178
11255
|
}
|
|
11179
11256
|
|
|
11180
|
-
class ArrowFunctionExpression extends NodeBase {
|
|
11257
|
+
class ArrowFunctionExpression$1 extends NodeBase {
|
|
11181
11258
|
createScope(parentScope) {
|
|
11182
11259
|
this.scope = new ReturnValueScope(parentScope, this.context);
|
|
11183
11260
|
}
|
|
@@ -11251,7 +11328,7 @@ class ArrowFunctionExpression extends NodeBase {
|
|
|
11251
11328
|
super.parseNode(esTreeNode);
|
|
11252
11329
|
}
|
|
11253
11330
|
}
|
|
11254
|
-
ArrowFunctionExpression.prototype.preventChildBlockScope = true;
|
|
11331
|
+
ArrowFunctionExpression$1.prototype.preventChildBlockScope = true;
|
|
11255
11332
|
|
|
11256
11333
|
function getSystemExportStatement(exportedVariables) {
|
|
11257
11334
|
if (exportedVariables.length === 1) {
|
|
@@ -11350,7 +11427,7 @@ class AwaitExpression extends NodeBase {
|
|
|
11350
11427
|
checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
|
|
11351
11428
|
let parent = this.parent;
|
|
11352
11429
|
do {
|
|
11353
|
-
if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression)
|
|
11430
|
+
if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression$1)
|
|
11354
11431
|
break checkTopLevelAwait;
|
|
11355
11432
|
} while ((parent = parent.parent));
|
|
11356
11433
|
this.context.usesTopLevelAwait = true;
|
|
@@ -11845,7 +11922,7 @@ class CallExpression$1 extends NodeBase {
|
|
|
11845
11922
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
11846
11923
|
const trackedExpressions = (callOptions.withNew
|
|
11847
11924
|
? context.instantiated
|
|
11848
|
-
: context.called).getEntities(path);
|
|
11925
|
+
: context.called).getEntities(path, callOptions);
|
|
11849
11926
|
if (trackedExpressions.has(this))
|
|
11850
11927
|
return false;
|
|
11851
11928
|
trackedExpressions.add(this);
|
|
@@ -12231,9 +12308,6 @@ class ExportNamedDeclaration extends NodeBase {
|
|
|
12231
12308
|
}
|
|
12232
12309
|
ExportNamedDeclaration.prototype.needsBoundaries = true;
|
|
12233
12310
|
|
|
12234
|
-
class ExportNamespaceSpecifier$1 extends NodeBase {
|
|
12235
|
-
}
|
|
12236
|
-
|
|
12237
12311
|
class ExportSpecifier extends NodeBase {
|
|
12238
12312
|
}
|
|
12239
12313
|
|
|
@@ -12808,7 +12882,9 @@ class LogicalExpression extends NodeBase {
|
|
|
12808
12882
|
return null;
|
|
12809
12883
|
}
|
|
12810
12884
|
else {
|
|
12811
|
-
if (this.operator === '||'
|
|
12885
|
+
if ((this.operator === '||' && leftValue) ||
|
|
12886
|
+
(this.operator === '&&' && !leftValue) ||
|
|
12887
|
+
(this.operator === '??' && leftValue != null)) {
|
|
12812
12888
|
this.usedBranch = this.left;
|
|
12813
12889
|
this.unusedBranch = this.right;
|
|
12814
12890
|
}
|
|
@@ -13203,7 +13279,8 @@ class ObjectExpression extends NodeBase {
|
|
|
13203
13279
|
}
|
|
13204
13280
|
render(code, options, { renderedParentType } = BLANK) {
|
|
13205
13281
|
super.render(code, options);
|
|
13206
|
-
if (renderedParentType === ExpressionStatement
|
|
13282
|
+
if (renderedParentType === ExpressionStatement ||
|
|
13283
|
+
renderedParentType === ArrowFunctionExpression) {
|
|
13207
13284
|
code.appendRight(this.start, '(');
|
|
13208
13285
|
code.prependLeft(this.end, ')');
|
|
13209
13286
|
}
|
|
@@ -13426,7 +13503,7 @@ class Property$1 extends NodeBase {
|
|
|
13426
13503
|
if (this.kind === 'get') {
|
|
13427
13504
|
const trackedExpressions = (callOptions.withNew
|
|
13428
13505
|
? context.instantiated
|
|
13429
|
-
: context.called).getEntities(path);
|
|
13506
|
+
: context.called).getEntities(path, callOptions);
|
|
13430
13507
|
if (trackedExpressions.has(this))
|
|
13431
13508
|
return false;
|
|
13432
13509
|
trackedExpressions.add(this);
|
|
@@ -14153,7 +14230,7 @@ class YieldExpression extends NodeBase {
|
|
|
14153
14230
|
const nodeConstructors = {
|
|
14154
14231
|
ArrayExpression,
|
|
14155
14232
|
ArrayPattern,
|
|
14156
|
-
ArrowFunctionExpression,
|
|
14233
|
+
ArrowFunctionExpression: ArrowFunctionExpression$1,
|
|
14157
14234
|
AssignmentExpression,
|
|
14158
14235
|
AssignmentPattern,
|
|
14159
14236
|
AwaitExpression,
|
|
@@ -14172,7 +14249,6 @@ const nodeConstructors = {
|
|
|
14172
14249
|
ExportAllDeclaration,
|
|
14173
14250
|
ExportDefaultDeclaration,
|
|
14174
14251
|
ExportNamedDeclaration,
|
|
14175
|
-
ExportNamespaceSpecifier: ExportNamespaceSpecifier$1,
|
|
14176
14252
|
ExportSpecifier,
|
|
14177
14253
|
ExpressionStatement: ExpressionStatement$1,
|
|
14178
14254
|
FieldDefinition,
|
|
@@ -14729,8 +14805,8 @@ class Module {
|
|
|
14729
14805
|
this.chunkName = null;
|
|
14730
14806
|
this.comments = [];
|
|
14731
14807
|
this.dependencies = new Set();
|
|
14732
|
-
this.dynamicallyImportedBy = [];
|
|
14733
14808
|
this.dynamicDependencies = new Set();
|
|
14809
|
+
this.dynamicImporters = [];
|
|
14734
14810
|
this.dynamicImports = [];
|
|
14735
14811
|
this.execIndex = Infinity;
|
|
14736
14812
|
this.exportAllSources = new Set();
|
|
@@ -14738,8 +14814,10 @@ class Module {
|
|
|
14738
14814
|
this.exportsAll = Object.create(null);
|
|
14739
14815
|
this.facadeChunk = null;
|
|
14740
14816
|
this.importDescriptions = Object.create(null);
|
|
14817
|
+
this.importers = [];
|
|
14741
14818
|
this.importMetas = [];
|
|
14742
14819
|
this.imports = new Set();
|
|
14820
|
+
this.includedDynamicImporters = [];
|
|
14743
14821
|
this.isExecuted = false;
|
|
14744
14822
|
this.isUserDefinedEntryPoint = false;
|
|
14745
14823
|
this.manualChunkAlias = null;
|
|
@@ -14844,11 +14922,11 @@ class Module {
|
|
|
14844
14922
|
else if (variable instanceof ExportDefaultVariable) {
|
|
14845
14923
|
variable = variable.getOriginalVariable();
|
|
14846
14924
|
}
|
|
14847
|
-
|
|
14848
|
-
relevantDependencies.add(variable.module);
|
|
14849
|
-
}
|
|
14925
|
+
relevantDependencies.add(variable.module);
|
|
14850
14926
|
}
|
|
14851
|
-
if (this.isEntryPoint ||
|
|
14927
|
+
if (this.isEntryPoint ||
|
|
14928
|
+
this.includedDynamicImporters.length > 0 ||
|
|
14929
|
+
this.graph.preserveModules) {
|
|
14852
14930
|
for (const exportName of [...this.getReexports(), ...this.getExports()]) {
|
|
14853
14931
|
let variable = this.getVariableForExportName(exportName);
|
|
14854
14932
|
if (variable instanceof SyntheticNamedExportVariable) {
|
|
@@ -14857,9 +14935,7 @@ class Module {
|
|
|
14857
14935
|
else if (variable instanceof ExportDefaultVariable) {
|
|
14858
14936
|
variable = variable.getOriginalVariable();
|
|
14859
14937
|
}
|
|
14860
|
-
|
|
14861
|
-
relevantDependencies.add(variable.module);
|
|
14862
|
-
}
|
|
14938
|
+
relevantDependencies.add(variable.module);
|
|
14863
14939
|
}
|
|
14864
14940
|
}
|
|
14865
14941
|
if (this.graph.treeshakingOptions) {
|
|
@@ -14885,20 +14961,6 @@ class Module {
|
|
|
14885
14961
|
}
|
|
14886
14962
|
return (this.relevantDependencies = relevantDependencies);
|
|
14887
14963
|
}
|
|
14888
|
-
getDynamicImportExpressions() {
|
|
14889
|
-
return this.dynamicImports.map(({ node }) => {
|
|
14890
|
-
const importArgument = node.source;
|
|
14891
|
-
if (importArgument instanceof TemplateLiteral &&
|
|
14892
|
-
importArgument.quasis.length === 1 &&
|
|
14893
|
-
importArgument.quasis[0].value.cooked) {
|
|
14894
|
-
return importArgument.quasis[0].value.cooked;
|
|
14895
|
-
}
|
|
14896
|
-
if (importArgument instanceof Literal && typeof importArgument.value === 'string') {
|
|
14897
|
-
return importArgument.value;
|
|
14898
|
-
}
|
|
14899
|
-
return importArgument;
|
|
14900
|
-
});
|
|
14901
|
-
}
|
|
14902
14964
|
getExportNamesByVariable() {
|
|
14903
14965
|
if (this.exportNamesByVariable) {
|
|
14904
14966
|
return this.exportNamesByVariable;
|
|
@@ -14947,7 +15009,7 @@ class Module {
|
|
|
14947
15009
|
}
|
|
14948
15010
|
}
|
|
14949
15011
|
}
|
|
14950
|
-
return (this.transitiveReexports =
|
|
15012
|
+
return (this.transitiveReexports = [...reexports]);
|
|
14951
15013
|
}
|
|
14952
15014
|
getRenderedExports() {
|
|
14953
15015
|
// only direct exports are counted here, not reexports at all
|
|
@@ -15164,7 +15226,7 @@ class Module {
|
|
|
15164
15226
|
ast: this.esTreeAst,
|
|
15165
15227
|
code: this.code,
|
|
15166
15228
|
customTransformCache: this.customTransformCache,
|
|
15167
|
-
dependencies:
|
|
15229
|
+
dependencies: [...this.dependencies].map(module => module.id),
|
|
15168
15230
|
id: this.id,
|
|
15169
15231
|
moduleSideEffects: this.moduleSideEffects,
|
|
15170
15232
|
originalCode: this.originalCode,
|
|
@@ -15206,7 +15268,16 @@ class Module {
|
|
|
15206
15268
|
this.graph.warn(warning);
|
|
15207
15269
|
}
|
|
15208
15270
|
addDynamicImport(node) {
|
|
15209
|
-
|
|
15271
|
+
let argument = node.source;
|
|
15272
|
+
if (argument instanceof TemplateLiteral) {
|
|
15273
|
+
if (argument.quasis.length === 1 && argument.quasis[0].value.cooked) {
|
|
15274
|
+
argument = argument.quasis[0].value.cooked;
|
|
15275
|
+
}
|
|
15276
|
+
}
|
|
15277
|
+
else if (argument instanceof Literal && typeof argument.value === 'string') {
|
|
15278
|
+
argument = argument.value;
|
|
15279
|
+
}
|
|
15280
|
+
this.dynamicImports.push({ node, resolution: null, argument });
|
|
15210
15281
|
}
|
|
15211
15282
|
addExport(node) {
|
|
15212
15283
|
if (node instanceof ExportDefaultDeclaration) {
|
|
@@ -15217,10 +15288,22 @@ class Module {
|
|
|
15217
15288
|
};
|
|
15218
15289
|
}
|
|
15219
15290
|
else if (node instanceof ExportAllDeclaration) {
|
|
15220
|
-
// export * from './other'
|
|
15221
15291
|
const source = node.source.value;
|
|
15222
15292
|
this.sources.add(source);
|
|
15223
|
-
|
|
15293
|
+
if (node.exported) {
|
|
15294
|
+
// export * as name from './other'
|
|
15295
|
+
const name = node.exported.name;
|
|
15296
|
+
this.reexportDescriptions[name] = {
|
|
15297
|
+
localName: '*',
|
|
15298
|
+
module: null,
|
|
15299
|
+
source,
|
|
15300
|
+
start: node.start
|
|
15301
|
+
};
|
|
15302
|
+
}
|
|
15303
|
+
else {
|
|
15304
|
+
// export * from './other'
|
|
15305
|
+
this.exportAllSources.add(source);
|
|
15306
|
+
}
|
|
15224
15307
|
}
|
|
15225
15308
|
else if (node.source instanceof Literal) {
|
|
15226
15309
|
// export { name } from './other'
|
|
@@ -15229,7 +15312,7 @@ class Module {
|
|
|
15229
15312
|
for (const specifier of node.specifiers) {
|
|
15230
15313
|
const name = specifier.exported.name;
|
|
15231
15314
|
this.reexportDescriptions[name] = {
|
|
15232
|
-
localName: specifier.
|
|
15315
|
+
localName: specifier.local.name,
|
|
15233
15316
|
module: null,
|
|
15234
15317
|
source,
|
|
15235
15318
|
start: specifier.start
|
|
@@ -15312,7 +15395,7 @@ class Module {
|
|
|
15312
15395
|
includeDynamicImport(node) {
|
|
15313
15396
|
const resolution = this.dynamicImports.find(dynamicImport => dynamicImport.node === node).resolution;
|
|
15314
15397
|
if (resolution instanceof Module) {
|
|
15315
|
-
resolution.
|
|
15398
|
+
resolution.includedDynamicImporters.push(this);
|
|
15316
15399
|
resolution.includeAllExports();
|
|
15317
15400
|
}
|
|
15318
15401
|
}
|
|
@@ -15850,7 +15933,7 @@ class Chunk$1 {
|
|
|
15850
15933
|
if (module.isEntryPoint) {
|
|
15851
15934
|
this.entryModules.push(module);
|
|
15852
15935
|
}
|
|
15853
|
-
if (module.
|
|
15936
|
+
if (module.includedDynamicImporters.length > 0) {
|
|
15854
15937
|
this.dynamicEntryModules.push(module);
|
|
15855
15938
|
}
|
|
15856
15939
|
}
|
|
@@ -15924,17 +16007,17 @@ class Chunk$1 {
|
|
|
15924
16007
|
}
|
|
15925
16008
|
generateFacades() {
|
|
15926
16009
|
const facades = [];
|
|
15927
|
-
const dynamicEntryModules = this.dynamicEntryModules.filter(module => module.
|
|
16010
|
+
const dynamicEntryModules = this.dynamicEntryModules.filter(module => module.includedDynamicImporters.some(importingModule => importingModule.chunk !== this));
|
|
15928
16011
|
this.isDynamicEntry = dynamicEntryModules.length > 0;
|
|
15929
16012
|
const exposedNamespaces = dynamicEntryModules.map(module => module.namespace);
|
|
15930
16013
|
for (const module of this.entryModules) {
|
|
15931
|
-
const requiredFacades =
|
|
16014
|
+
const requiredFacades = [...module.userChunkNames].map(name => ({
|
|
15932
16015
|
name
|
|
15933
16016
|
}));
|
|
15934
16017
|
if (requiredFacades.length === 0 && module.isUserDefinedEntryPoint) {
|
|
15935
16018
|
requiredFacades.push({});
|
|
15936
16019
|
}
|
|
15937
|
-
requiredFacades.push(...
|
|
16020
|
+
requiredFacades.push(...[...module.chunkFileNames].map(fileName => ({ fileName })));
|
|
15938
16021
|
if (requiredFacades.length === 0) {
|
|
15939
16022
|
requiredFacades.push({});
|
|
15940
16023
|
}
|
|
@@ -16563,7 +16646,7 @@ class Chunk$1 {
|
|
|
16563
16646
|
}
|
|
16564
16647
|
}
|
|
16565
16648
|
if ((module.isEntryPoint && module.preserveSignature !== false) ||
|
|
16566
|
-
module.
|
|
16649
|
+
module.includedDynamicImporters.some(importer => importer.chunk !== this)) {
|
|
16567
16650
|
const map = module.getExportNamesByVariable();
|
|
16568
16651
|
for (const exportedVariable of map.keys()) {
|
|
16569
16652
|
if (module.isEntryPoint && module.preserveSignature !== false) {
|
|
@@ -16980,7 +17063,7 @@ function getHasModuleSideEffects(moduleSideEffectsOption, pureExternalModules, g
|
|
|
16980
17063
|
return (id, external) => !(external && isPureExternalModule(id));
|
|
16981
17064
|
}
|
|
16982
17065
|
class ModuleLoader {
|
|
16983
|
-
constructor(graph, modulesById, pluginDriver, preserveSymlinks, external,
|
|
17066
|
+
constructor(graph, modulesById, pluginDriver, preserveSymlinks, external, moduleSideEffects, pureExternalModules) {
|
|
16984
17067
|
this.graph = graph;
|
|
16985
17068
|
this.modulesById = modulesById;
|
|
16986
17069
|
this.pluginDriver = pluginDriver;
|
|
@@ -16989,24 +17072,10 @@ class ModuleLoader {
|
|
|
16989
17072
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
16990
17073
|
this.manualChunkModules = {};
|
|
16991
17074
|
this.nextEntryModuleIndex = 0;
|
|
16992
|
-
this.loadEntryModule = (unresolvedId, isEntry, importer) => resolveId(unresolvedId, importer, this.preserveSymlinks, this.pluginDriver, null).then(resolveIdResult => {
|
|
16993
|
-
if (resolveIdResult === false ||
|
|
16994
|
-
(resolveIdResult && typeof resolveIdResult === 'object' && resolveIdResult.external)) {
|
|
16995
|
-
return error(errEntryCannotBeExternal(unresolvedId));
|
|
16996
|
-
}
|
|
16997
|
-
const id = resolveIdResult && typeof resolveIdResult === 'object'
|
|
16998
|
-
? resolveIdResult.id
|
|
16999
|
-
: resolveIdResult;
|
|
17000
|
-
if (typeof id === 'string') {
|
|
17001
|
-
return this.fetchModule(id, undefined, true, false, isEntry);
|
|
17002
|
-
}
|
|
17003
|
-
return error(errUnresolvedEntry(unresolvedId));
|
|
17004
|
-
});
|
|
17005
17075
|
this.isExternal = getIdMatcher(external);
|
|
17006
17076
|
this.hasModuleSideEffects = getHasModuleSideEffects(moduleSideEffects, pureExternalModules, graph);
|
|
17007
|
-
this.getManualChunk = typeof getManualChunk === 'function' ? getManualChunk : () => null;
|
|
17008
17077
|
}
|
|
17009
|
-
addEntryModules(unresolvedEntryModules, isUserDefined) {
|
|
17078
|
+
async addEntryModules(unresolvedEntryModules, isUserDefined) {
|
|
17010
17079
|
const firstEntryModuleIndex = this.nextEntryModuleIndex;
|
|
17011
17080
|
this.nextEntryModuleIndex += unresolvedEntryModules.length;
|
|
17012
17081
|
const loadNewEntryModulesPromise = Promise.all(unresolvedEntryModules.map(async ({ fileName, id, name, importer }) => {
|
|
@@ -17039,11 +17108,12 @@ class ModuleLoader {
|
|
|
17039
17108
|
this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
|
|
17040
17109
|
return entryModules;
|
|
17041
17110
|
});
|
|
17042
|
-
|
|
17111
|
+
const newEntryModules = await this.awaitLoadModulesPromise(loadNewEntryModulesPromise);
|
|
17112
|
+
return {
|
|
17043
17113
|
entryModules: this.indexedEntryModules.map(({ module }) => module),
|
|
17044
17114
|
manualChunkModulesByAlias: this.manualChunkModules,
|
|
17045
17115
|
newEntryModules
|
|
17046
|
-
}
|
|
17116
|
+
};
|
|
17047
17117
|
}
|
|
17048
17118
|
addManualChunks(manualChunks) {
|
|
17049
17119
|
const unresolvedManualChunks = [];
|
|
@@ -17053,18 +17123,73 @@ class ModuleLoader {
|
|
|
17053
17123
|
unresolvedManualChunks.push({ id, alias });
|
|
17054
17124
|
}
|
|
17055
17125
|
}
|
|
17056
|
-
|
|
17126
|
+
return this.awaitLoadModulesPromise(Promise.all(unresolvedManualChunks.map(({ id }) => this.loadEntryModule(id, false, undefined))).then(manualChunkModules => {
|
|
17057
17127
|
for (let index = 0; index < manualChunkModules.length; index++) {
|
|
17058
17128
|
this.addModuleToManualChunk(unresolvedManualChunks[index].alias, manualChunkModules[index]);
|
|
17059
17129
|
}
|
|
17060
|
-
});
|
|
17061
|
-
|
|
17130
|
+
}));
|
|
17131
|
+
}
|
|
17132
|
+
assignManualChunks(getManualChunk) {
|
|
17133
|
+
const manualChunksApi = {
|
|
17134
|
+
getModuleIds: () => this.modulesById.keys(),
|
|
17135
|
+
getModuleInfo: this.graph.getModuleInfo
|
|
17136
|
+
};
|
|
17137
|
+
for (const module of this.modulesById.values()) {
|
|
17138
|
+
if (module instanceof Module) {
|
|
17139
|
+
const manualChunkAlias = getManualChunk(module.id, manualChunksApi);
|
|
17140
|
+
if (typeof manualChunkAlias === 'string') {
|
|
17141
|
+
this.addModuleToManualChunk(manualChunkAlias, module);
|
|
17142
|
+
}
|
|
17143
|
+
}
|
|
17144
|
+
}
|
|
17062
17145
|
}
|
|
17063
17146
|
async resolveId(source, importer, skip = null) {
|
|
17064
17147
|
return this.normalizeResolveIdResult(this.isExternal(source, importer, false)
|
|
17065
17148
|
? false
|
|
17066
17149
|
: await resolveId(source, importer, this.preserveSymlinks, this.pluginDriver, skip), importer, source);
|
|
17067
17150
|
}
|
|
17151
|
+
async addModuleSource(id, importer, module) {
|
|
17152
|
+
var _a;
|
|
17153
|
+
timeStart('load modules', 3);
|
|
17154
|
+
let source;
|
|
17155
|
+
try {
|
|
17156
|
+
source = (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await readFile(id));
|
|
17157
|
+
}
|
|
17158
|
+
catch (err) {
|
|
17159
|
+
timeEnd('load modules', 3);
|
|
17160
|
+
let msg = `Could not load ${id}`;
|
|
17161
|
+
if (importer)
|
|
17162
|
+
msg += ` (imported by ${relativeId(importer)})`;
|
|
17163
|
+
msg += `: ${err.message}`;
|
|
17164
|
+
err.message = msg;
|
|
17165
|
+
throw err;
|
|
17166
|
+
}
|
|
17167
|
+
timeEnd('load modules', 3);
|
|
17168
|
+
const sourceDescription = typeof source === 'string'
|
|
17169
|
+
? { code: source }
|
|
17170
|
+
: typeof source === 'object' && typeof source.code === 'string'
|
|
17171
|
+
? source
|
|
17172
|
+
: error(errBadLoader(id));
|
|
17173
|
+
const cachedModule = this.graph.cachedModules.get(id);
|
|
17174
|
+
if (cachedModule &&
|
|
17175
|
+
!cachedModule.customTransformCache &&
|
|
17176
|
+
cachedModule.originalCode === sourceDescription.code) {
|
|
17177
|
+
if (cachedModule.transformFiles) {
|
|
17178
|
+
for (const emittedFile of cachedModule.transformFiles)
|
|
17179
|
+
this.pluginDriver.emitFile(emittedFile);
|
|
17180
|
+
}
|
|
17181
|
+
module.setSource(cachedModule);
|
|
17182
|
+
}
|
|
17183
|
+
else {
|
|
17184
|
+
if (typeof sourceDescription.moduleSideEffects === 'boolean') {
|
|
17185
|
+
module.moduleSideEffects = sourceDescription.moduleSideEffects;
|
|
17186
|
+
}
|
|
17187
|
+
if (typeof sourceDescription.syntheticNamedExports === 'boolean') {
|
|
17188
|
+
module.syntheticNamedExports = sourceDescription.syntheticNamedExports;
|
|
17189
|
+
}
|
|
17190
|
+
module.setSource(await transform(this.graph, sourceDescription, module));
|
|
17191
|
+
}
|
|
17192
|
+
}
|
|
17068
17193
|
addModuleToManualChunk(alias, module) {
|
|
17069
17194
|
if (module.manualChunkAlias !== null && module.manualChunkAlias !== alias) {
|
|
17070
17195
|
return error(errCannotAssignModuleToChunk(module.id, alias, module.manualChunkAlias));
|
|
@@ -17092,19 +17217,25 @@ class ModuleLoader {
|
|
|
17092
17217
|
}
|
|
17093
17218
|
fetchAllDependencies(module) {
|
|
17094
17219
|
return Promise.all([
|
|
17095
|
-
...
|
|
17096
|
-
module.resolvedIds[source]
|
|
17097
|
-
|
|
17098
|
-
|
|
17099
|
-
|
|
17220
|
+
...[...module.sources].map(async (source) => {
|
|
17221
|
+
const resolution = await this.fetchResolvedDependency(source, module.id, (module.resolvedIds[source] =
|
|
17222
|
+
module.resolvedIds[source] ||
|
|
17223
|
+
this.handleResolveId(await this.resolveId(source, module.id), source, module.id)));
|
|
17224
|
+
resolution.importers.push(module.id);
|
|
17225
|
+
resolution.importers.sort();
|
|
17226
|
+
}),
|
|
17227
|
+
...module.dynamicImports.map(async (dynamicImport) => {
|
|
17228
|
+
const resolvedId = await this.resolveDynamicImport(module, dynamicImport.argument, module.id);
|
|
17100
17229
|
if (resolvedId === null)
|
|
17101
17230
|
return;
|
|
17102
|
-
const dynamicImport = module.dynamicImports[index];
|
|
17103
17231
|
if (typeof resolvedId === 'string') {
|
|
17104
17232
|
dynamicImport.resolution = resolvedId;
|
|
17105
|
-
return;
|
|
17106
17233
|
}
|
|
17107
|
-
|
|
17234
|
+
else {
|
|
17235
|
+
const resolution = (dynamicImport.resolution = await this.fetchResolvedDependency(relativeId(resolvedId.id), module.id, resolvedId));
|
|
17236
|
+
resolution.dynamicImporters.push(module.id);
|
|
17237
|
+
resolution.dynamicImporters.sort();
|
|
17238
|
+
}
|
|
17108
17239
|
})
|
|
17109
17240
|
]);
|
|
17110
17241
|
}
|
|
@@ -17117,75 +17248,28 @@ class ModuleLoader {
|
|
|
17117
17248
|
const module = new Module(this.graph, id, moduleSideEffects, syntheticNamedExports, isEntry);
|
|
17118
17249
|
this.modulesById.set(id, module);
|
|
17119
17250
|
this.graph.watchFiles[id] = true;
|
|
17120
|
-
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
|
|
17125
|
-
return Promise.resolve(this.pluginDriver.hookFirst('load', [id]))
|
|
17126
|
-
.then(source => source !== null && source !== void 0 ? source : readFile(id))
|
|
17127
|
-
.catch((err) => {
|
|
17128
|
-
timeEnd('load modules', 3);
|
|
17129
|
-
let msg = `Could not load ${id}`;
|
|
17130
|
-
if (importer)
|
|
17131
|
-
msg += ` (imported by ${importer})`;
|
|
17132
|
-
msg += `: ${err.message}`;
|
|
17133
|
-
err.message = msg;
|
|
17134
|
-
throw err;
|
|
17135
|
-
})
|
|
17136
|
-
.then(source => {
|
|
17137
|
-
timeEnd('load modules', 3);
|
|
17138
|
-
if (typeof source === 'string')
|
|
17139
|
-
return { code: source };
|
|
17140
|
-
if (source && typeof source === 'object' && typeof source.code === 'string')
|
|
17141
|
-
return source;
|
|
17142
|
-
return error(errBadLoader(id));
|
|
17143
|
-
})
|
|
17144
|
-
.then(sourceDescription => {
|
|
17145
|
-
const cachedModule = this.graph.cachedModules.get(id);
|
|
17146
|
-
if (cachedModule &&
|
|
17147
|
-
!cachedModule.customTransformCache &&
|
|
17148
|
-
cachedModule.originalCode === sourceDescription.code) {
|
|
17149
|
-
if (cachedModule.transformFiles) {
|
|
17150
|
-
for (const emittedFile of cachedModule.transformFiles)
|
|
17151
|
-
this.pluginDriver.emitFile(emittedFile);
|
|
17152
|
-
}
|
|
17153
|
-
return cachedModule;
|
|
17154
|
-
}
|
|
17155
|
-
if (typeof sourceDescription.moduleSideEffects === 'boolean') {
|
|
17156
|
-
module.moduleSideEffects = sourceDescription.moduleSideEffects;
|
|
17157
|
-
}
|
|
17158
|
-
if (typeof sourceDescription.syntheticNamedExports === 'boolean') {
|
|
17159
|
-
module.syntheticNamedExports = sourceDescription.syntheticNamedExports;
|
|
17251
|
+
await this.addModuleSource(id, importer, module);
|
|
17252
|
+
await this.fetchAllDependencies(module);
|
|
17253
|
+
for (const name in module.exports) {
|
|
17254
|
+
if (name !== 'default') {
|
|
17255
|
+
module.exportsAll[name] = module.id;
|
|
17160
17256
|
}
|
|
17161
|
-
|
|
17162
|
-
|
|
17163
|
-
.
|
|
17164
|
-
|
|
17165
|
-
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17169
|
-
|
|
17170
|
-
}
|
|
17257
|
+
}
|
|
17258
|
+
for (const source of module.exportAllSources) {
|
|
17259
|
+
const id = module.resolvedIds[source].id;
|
|
17260
|
+
const exportAllModule = this.modulesById.get(id);
|
|
17261
|
+
if (exportAllModule instanceof ExternalModule)
|
|
17262
|
+
continue;
|
|
17263
|
+
for (const name in exportAllModule.exportsAll) {
|
|
17264
|
+
if (name in module.exportsAll) {
|
|
17265
|
+
this.graph.warn(errNamespaceConflict(name, module, exportAllModule));
|
|
17171
17266
|
}
|
|
17172
|
-
|
|
17173
|
-
|
|
17174
|
-
const exportAllModule = this.modulesById.get(id);
|
|
17175
|
-
if (exportAllModule instanceof ExternalModule)
|
|
17176
|
-
continue;
|
|
17177
|
-
for (const name in exportAllModule.exportsAll) {
|
|
17178
|
-
if (name in module.exportsAll) {
|
|
17179
|
-
this.graph.warn(errNamespaceConflict(name, module, exportAllModule));
|
|
17180
|
-
}
|
|
17181
|
-
else {
|
|
17182
|
-
module.exportsAll[name] = exportAllModule.exportsAll[name];
|
|
17183
|
-
}
|
|
17184
|
-
}
|
|
17267
|
+
else {
|
|
17268
|
+
module.exportsAll[name] = exportAllModule.exportsAll[name];
|
|
17185
17269
|
}
|
|
17186
|
-
|
|
17187
|
-
|
|
17188
|
-
|
|
17270
|
+
}
|
|
17271
|
+
}
|
|
17272
|
+
return module;
|
|
17189
17273
|
}
|
|
17190
17274
|
fetchResolvedDependency(source, importer, resolvedId) {
|
|
17191
17275
|
if (resolvedId.external) {
|
|
@@ -17222,6 +17306,18 @@ class ModuleLoader {
|
|
|
17222
17306
|
}
|
|
17223
17307
|
return resolvedId;
|
|
17224
17308
|
}
|
|
17309
|
+
async loadEntryModule(unresolvedId, isEntry, importer) {
|
|
17310
|
+
const resolveIdResult = await resolveId(unresolvedId, importer, this.preserveSymlinks, this.pluginDriver, null);
|
|
17311
|
+
if (resolveIdResult === false ||
|
|
17312
|
+
(resolveIdResult && typeof resolveIdResult === 'object' && resolveIdResult.external)) {
|
|
17313
|
+
return error(errEntryCannotBeExternal(unresolvedId));
|
|
17314
|
+
}
|
|
17315
|
+
const id = resolveIdResult && typeof resolveIdResult === 'object' ? resolveIdResult.id : resolveIdResult;
|
|
17316
|
+
if (typeof id === 'string') {
|
|
17317
|
+
return this.fetchModule(id, undefined, true, false, isEntry);
|
|
17318
|
+
}
|
|
17319
|
+
return error(errUnresolvedEntry(unresolvedId));
|
|
17320
|
+
}
|
|
17225
17321
|
normalizeResolveIdResult(resolveIdResult, importer, source) {
|
|
17226
17322
|
let id = '';
|
|
17227
17323
|
let external = false;
|
|
@@ -17372,7 +17468,7 @@ function analyzeModuleGraph(entryModules) {
|
|
|
17372
17468
|
}
|
|
17373
17469
|
for (const { resolution } of module.dynamicImports) {
|
|
17374
17470
|
if (resolution instanceof Module &&
|
|
17375
|
-
resolution.
|
|
17471
|
+
resolution.includedDynamicImporters.length > 0 &&
|
|
17376
17472
|
!resolution.manualChunkAlias) {
|
|
17377
17473
|
dynamicEntryModules.add(resolution);
|
|
17378
17474
|
entriesToHandle.add(resolution);
|
|
@@ -17391,7 +17487,7 @@ function getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEnt
|
|
|
17391
17487
|
const dynamicallyDependentEntryPointsByDynamicEntry = new Map();
|
|
17392
17488
|
for (const dynamicEntry of dynamicEntryModules) {
|
|
17393
17489
|
const dynamicDependentEntryPoints = getDependentModules(dynamicallyDependentEntryPointsByDynamicEntry, dynamicEntry);
|
|
17394
|
-
for (const importer of dynamicEntry.
|
|
17490
|
+
for (const importer of dynamicEntry.includedDynamicImporters) {
|
|
17395
17491
|
for (const entryPoint of dependentEntryPointsByModule.get(importer)) {
|
|
17396
17492
|
dynamicDependentEntryPoints.add(entryPoint);
|
|
17397
17493
|
}
|
|
@@ -17716,38 +17812,22 @@ function getPluginContexts(pluginCache, graph, fileEmitter) {
|
|
|
17716
17812
|
getAssetFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getAssetFileName', 'getFileName', plugin.name, true, graph),
|
|
17717
17813
|
getChunkFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getChunkFileName', 'getFileName', plugin.name, true, graph),
|
|
17718
17814
|
getFileName: fileEmitter.getFileName,
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
if (foundModule == null) {
|
|
17722
|
-
throw new Error(`Unable to find module ${moduleId}`);
|
|
17723
|
-
}
|
|
17724
|
-
const importedIds = [];
|
|
17725
|
-
const dynamicallyImportedIds = [];
|
|
17726
|
-
if (foundModule instanceof Module) {
|
|
17727
|
-
for (const source of foundModule.sources) {
|
|
17728
|
-
importedIds.push(foundModule.resolvedIds[source].id);
|
|
17729
|
-
}
|
|
17730
|
-
for (const { resolution } of foundModule.dynamicImports) {
|
|
17731
|
-
if (resolution instanceof Module || resolution instanceof ExternalModule) {
|
|
17732
|
-
dynamicallyImportedIds.push(resolution.id);
|
|
17733
|
-
}
|
|
17734
|
-
}
|
|
17735
|
-
}
|
|
17736
|
-
return {
|
|
17737
|
-
dynamicallyImportedIds,
|
|
17738
|
-
hasModuleSideEffects: foundModule.moduleSideEffects,
|
|
17739
|
-
id: foundModule.id,
|
|
17740
|
-
importedIds,
|
|
17741
|
-
isEntry: foundModule instanceof Module && foundModule.isEntryPoint,
|
|
17742
|
-
isExternal: foundModule instanceof ExternalModule
|
|
17743
|
-
};
|
|
17744
|
-
},
|
|
17815
|
+
getModuleIds: () => graph.moduleById.keys(),
|
|
17816
|
+
getModuleInfo: graph.getModuleInfo,
|
|
17745
17817
|
isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => graph.moduleLoader.isExternal(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, graph),
|
|
17746
17818
|
meta: {
|
|
17747
17819
|
rollupVersion: version
|
|
17748
17820
|
},
|
|
17749
17821
|
get moduleIds() {
|
|
17750
|
-
|
|
17822
|
+
function* wrappedModuleIds() {
|
|
17823
|
+
graph.warnDeprecation({
|
|
17824
|
+
message: `Accessing "this.moduleIds" on the plugin context by plugin ${plugin.name} is deprecated. The "this.getModuleIds" plugin context function should be used instead.`,
|
|
17825
|
+
plugin: plugin.name
|
|
17826
|
+
}, false);
|
|
17827
|
+
yield* moduleIds;
|
|
17828
|
+
}
|
|
17829
|
+
const moduleIds = graph.moduleById.keys();
|
|
17830
|
+
return wrappedModuleIds();
|
|
17751
17831
|
},
|
|
17752
17832
|
parse: graph.contextParse,
|
|
17753
17833
|
resolve(source, importer, options) {
|
|
@@ -17978,6 +18058,34 @@ class Graph {
|
|
|
17978
18058
|
this.watchFiles = Object.create(null);
|
|
17979
18059
|
this.externalModules = [];
|
|
17980
18060
|
this.modules = [];
|
|
18061
|
+
this.getModuleInfo = (moduleId) => {
|
|
18062
|
+
const foundModule = this.moduleById.get(moduleId);
|
|
18063
|
+
if (foundModule == null) {
|
|
18064
|
+
throw new Error(`Unable to find module ${moduleId}`);
|
|
18065
|
+
}
|
|
18066
|
+
const importedIds = [];
|
|
18067
|
+
const dynamicallyImportedIds = [];
|
|
18068
|
+
if (foundModule instanceof Module) {
|
|
18069
|
+
for (const source of foundModule.sources) {
|
|
18070
|
+
importedIds.push(foundModule.resolvedIds[source].id);
|
|
18071
|
+
}
|
|
18072
|
+
for (const { resolution } of foundModule.dynamicImports) {
|
|
18073
|
+
if (resolution instanceof Module || resolution instanceof ExternalModule) {
|
|
18074
|
+
dynamicallyImportedIds.push(resolution.id);
|
|
18075
|
+
}
|
|
18076
|
+
}
|
|
18077
|
+
}
|
|
18078
|
+
return {
|
|
18079
|
+
dynamicallyImportedIds,
|
|
18080
|
+
dynamicImporters: foundModule.dynamicImporters,
|
|
18081
|
+
hasModuleSideEffects: foundModule.moduleSideEffects,
|
|
18082
|
+
id: foundModule.id,
|
|
18083
|
+
importedIds,
|
|
18084
|
+
importers: foundModule.importers,
|
|
18085
|
+
isEntry: foundModule instanceof Module && foundModule.isEntryPoint,
|
|
18086
|
+
isExternal: foundModule instanceof ExternalModule
|
|
18087
|
+
};
|
|
18088
|
+
};
|
|
17981
18089
|
this.onwarn = options.onwarn;
|
|
17982
18090
|
this.deoptimizationTracker = new PathTracker();
|
|
17983
18091
|
this.cachedModules = new Map();
|
|
@@ -18053,7 +18161,7 @@ class Graph {
|
|
|
18053
18161
|
}
|
|
18054
18162
|
this.acornOptions = options.acorn ? { ...options.acorn } : {};
|
|
18055
18163
|
const acornPluginsToInject = [];
|
|
18056
|
-
acornPluginsToInject.push(acornImportMeta,
|
|
18164
|
+
acornPluginsToInject.push(acornImportMeta, acornClassFields, acornStaticClassFeatures);
|
|
18057
18165
|
this.acornOptions.allowAwaitOutsideFunction = true;
|
|
18058
18166
|
const acornInjectPlugins = options.acornInjectPlugins;
|
|
18059
18167
|
acornPluginsToInject.push(...(Array.isArray(acornInjectPlugins)
|
|
@@ -18062,7 +18170,7 @@ class Graph {
|
|
|
18062
18170
|
? [acornInjectPlugins]
|
|
18063
18171
|
: []));
|
|
18064
18172
|
this.acornParser = Parser.extend(...acornPluginsToInject);
|
|
18065
|
-
this.moduleLoader = new ModuleLoader(this, this.moduleById, this.pluginDriver, options.preserveSymlinks === true, options.external, (
|
|
18173
|
+
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));
|
|
18066
18174
|
}
|
|
18067
18175
|
async build(entryModuleIds, manualChunks, inlineDynamicImports) {
|
|
18068
18176
|
// Phase 1 – discovery. We load the entry module and find which
|
|
@@ -18133,7 +18241,9 @@ class Graph {
|
|
|
18133
18241
|
const chunks = [];
|
|
18134
18242
|
if (this.preserveModules) {
|
|
18135
18243
|
for (const module of this.modules) {
|
|
18136
|
-
if (module.isIncluded() ||
|
|
18244
|
+
if (module.isIncluded() ||
|
|
18245
|
+
module.isEntryPoint ||
|
|
18246
|
+
module.includedDynamicImporters.length > 0) {
|
|
18137
18247
|
const chunk = new Chunk$1(this, [module]);
|
|
18138
18248
|
chunk.entryModules = [module];
|
|
18139
18249
|
chunks.push(chunk);
|
|
@@ -18213,6 +18323,9 @@ class Graph {
|
|
|
18213
18323
|
typeof manualChunks === 'object' &&
|
|
18214
18324
|
this.moduleLoader.addManualChunks(manualChunks)
|
|
18215
18325
|
]);
|
|
18326
|
+
if (typeof manualChunks === 'function') {
|
|
18327
|
+
this.moduleLoader.assignManualChunks(manualChunks);
|
|
18328
|
+
}
|
|
18216
18329
|
if (entryModules.length === 0) {
|
|
18217
18330
|
throw new Error('You must supply options.input to rollup');
|
|
18218
18331
|
}
|
|
@@ -18481,7 +18594,9 @@ function warnUnknownOptions(passedOptions, validOptions, optionType, warn, ignor
|
|
|
18481
18594
|
if (unknownOptions.length > 0) {
|
|
18482
18595
|
warn({
|
|
18483
18596
|
code: 'UNKNOWN_OPTION',
|
|
18484
|
-
message: `Unknown ${optionType}: ${unknownOptions.join(', ')}. Allowed options: ${
|
|
18597
|
+
message: `Unknown ${optionType}: ${unknownOptions.join(', ')}. Allowed options: ${[
|
|
18598
|
+
...validOptionSet
|
|
18599
|
+
]
|
|
18485
18600
|
.sort()
|
|
18486
18601
|
.join(', ')}`
|
|
18487
18602
|
});
|