chrome-devtools-mcp 0.26.0 → 1.0.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/README.md +54 -5
- package/build/src/DevtoolsUtils.js +13 -0
- package/build/src/HeapSnapshotManager.js +26 -2
- package/build/src/McpContext.js +3 -0
- package/build/src/McpResponse.js +51 -21
- package/build/src/ToolHandler.js +30 -1
- package/build/src/WaitForHelper.js +18 -4
- package/build/src/bin/check-latest-version.js +25 -1
- package/build/src/bin/chrome-devtools-cli-options.js +37 -1
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +2 -8
- package/build/src/daemon/client.js +12 -6
- package/build/src/formatters/HeapSnapshotFormatter.js +27 -6
- package/build/src/index.js +3 -1
- package/build/src/telemetry/ClearcutLogger.js +8 -119
- package/build/src/telemetry/errors.js +4 -0
- package/build/src/telemetry/flagUtils.js +4 -3
- package/build/src/telemetry/{toolMetricsUtils.js → metricsRegistry.js} +3 -3
- package/build/src/telemetry/persistence.js +20 -2
- package/build/src/telemetry/transformation.js +134 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +2 -717
- package/build/src/third_party/bundled-packages.json +2 -2
- package/build/src/third_party/devtools-formatter-worker.js +445 -114
- package/build/src/third_party/devtools-heap-snapshot-worker.js +0 -3
- package/build/src/third_party/index.js +3255 -30087
- package/build/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
- package/build/src/tools/ToolDefinition.js +1 -1
- package/build/src/tools/emulation.js +3 -2
- package/build/src/tools/input.js +18 -9
- package/build/src/tools/memory.js +24 -0
- package/build/src/tools/script.js +32 -10
- package/build/src/version.js +1 -1
- package/package.json +7 -4
- package/build/src/telemetry/metricUtils.js +0 -15
|
@@ -2643,12 +2643,9 @@ CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript
|
|
|
2643
2643
|
var ExperimentName;
|
|
2644
2644
|
(function (ExperimentName) {
|
|
2645
2645
|
ExperimentName["ALL"] = "*";
|
|
2646
|
-
ExperimentName["CAPTURE_NODE_CREATION_STACKS"] = "capture-node-creation-stacks";
|
|
2647
2646
|
ExperimentName["PROTOCOL_MONITOR"] = "protocol-monitor";
|
|
2648
|
-
ExperimentName["TIMELINE_INVALIDATION_TRACKING"] = "timeline-invalidation-tracking";
|
|
2649
2647
|
ExperimentName["INSTRUMENTATION_BREAKPOINTS"] = "instrumentation-breakpoints";
|
|
2650
2648
|
ExperimentName["USE_SOURCE_MAP_SCOPES"] = "use-source-map-scopes";
|
|
2651
|
-
ExperimentName["TIMELINE_DEBUG_MODE"] = "timeline-debug-mode";
|
|
2652
2649
|
ExperimentName["DURABLE_MESSAGES"] = "durable-messages";
|
|
2653
2650
|
ExperimentName["JPEG_XL"] = "jpeg-xl";
|
|
2654
2651
|
})(ExperimentName || (ExperimentName = {}));
|
|
@@ -2766,10 +2763,10 @@ class FormattedContentBuilder {
|
|
|
2766
2763
|
}
|
|
2767
2764
|
}
|
|
2768
2765
|
|
|
2769
|
-
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,
|
|
2770
|
-
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, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1,
|
|
2771
|
-
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\
|
|
2772
|
-
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\u0870-\u0887\u0889-\
|
|
2766
|
+
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, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 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, 199, 7, 137, 9, 54, 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, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 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, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
2767
|
+
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, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 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, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 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, 20, 1, 64, 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, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 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, 38, 6, 186, 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, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 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, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 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, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
|
|
2768
|
+
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\u0897-\u089f\u08ca-\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\u0c3c\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\u0cf3\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-\u0ece\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-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\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-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\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\uff65";
|
|
2769
|
+
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\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\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\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\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-\u1711\u171f-\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-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\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-\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-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\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";
|
|
2773
2770
|
var reservedWords = {
|
|
2774
2771
|
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
|
|
2775
2772
|
5: "class enum extends super const export import",
|
|
@@ -2979,8 +2976,9 @@ var hasOwn = Object.hasOwn || (function (obj, propName) {
|
|
|
2979
2976
|
var isArray = Array.isArray || (function (obj) {
|
|
2980
2977
|
return (toString.call(obj) === "[object Array]");
|
|
2981
2978
|
});
|
|
2979
|
+
var regexpCache = Object.create(null);
|
|
2982
2980
|
function wordsRegexp(words) {
|
|
2983
|
-
return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$");
|
|
2981
|
+
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
|
|
2984
2982
|
}
|
|
2985
2983
|
function codePointToString(code) {
|
|
2986
2984
|
if (code <= 0xFFFF) {
|
|
@@ -3067,6 +3065,9 @@ function getOptions(opts) {
|
|
|
3067
3065
|
if (isArray(options.onComment)) {
|
|
3068
3066
|
options.onComment = pushComment(options, options.onComment);
|
|
3069
3067
|
}
|
|
3068
|
+
if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction) {
|
|
3069
|
+
throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");
|
|
3070
|
+
}
|
|
3070
3071
|
return options;
|
|
3071
3072
|
}
|
|
3072
3073
|
function pushComment(options, array) {
|
|
@@ -3086,7 +3087,7 @@ function pushComment(options, array) {
|
|
|
3086
3087
|
array.push(comment);
|
|
3087
3088
|
};
|
|
3088
3089
|
}
|
|
3089
|
-
var SCOPE_TOP = 1, SCOPE_FUNCTION = 2, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
3090
|
+
var SCOPE_TOP = 1, SCOPE_FUNCTION = 2, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_CLASS_FIELD_INIT = 512, SCOPE_SWITCH = 1024, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
3090
3091
|
function functionFlags(async, generator) {
|
|
3091
3092
|
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
|
|
3092
3093
|
}
|
|
@@ -3141,44 +3142,71 @@ var Parser$1 = function Parser(options, input, startPos) {
|
|
|
3141
3142
|
this.skipLineComment(2);
|
|
3142
3143
|
}
|
|
3143
3144
|
this.scopeStack = [];
|
|
3144
|
-
this.enterScope(
|
|
3145
|
+
this.enterScope(this.options.sourceType === "commonjs"
|
|
3146
|
+
? SCOPE_FUNCTION
|
|
3147
|
+
: SCOPE_TOP);
|
|
3145
3148
|
this.regexpState = null;
|
|
3146
3149
|
this.privateNameStack = [];
|
|
3147
3150
|
};
|
|
3148
|
-
var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, inClassStaticBlock: { configurable: true } };
|
|
3151
|
+
var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowReturn: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, allowUsing: { configurable: true }, inClassStaticBlock: { configurable: true } };
|
|
3149
3152
|
Parser$1.prototype.parse = function parse() {
|
|
3150
3153
|
var node = this.options.program || this.startNode();
|
|
3151
3154
|
this.nextToken();
|
|
3152
3155
|
return this.parseTopLevel(node);
|
|
3153
3156
|
};
|
|
3154
3157
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0; };
|
|
3155
|
-
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0
|
|
3156
|
-
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0
|
|
3158
|
+
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0; };
|
|
3159
|
+
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0; };
|
|
3157
3160
|
prototypeAccessors.canAwait.get = function () {
|
|
3158
3161
|
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
3159
|
-
var
|
|
3160
|
-
|
|
3162
|
+
var ref = this.scopeStack[i];
|
|
3163
|
+
var flags = ref.flags;
|
|
3164
|
+
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) {
|
|
3161
3165
|
return false;
|
|
3162
3166
|
}
|
|
3163
|
-
if (
|
|
3164
|
-
return (
|
|
3167
|
+
if (flags & SCOPE_FUNCTION) {
|
|
3168
|
+
return (flags & SCOPE_ASYNC) > 0;
|
|
3165
3169
|
}
|
|
3166
3170
|
}
|
|
3167
3171
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction;
|
|
3168
3172
|
};
|
|
3173
|
+
prototypeAccessors.allowReturn.get = function () {
|
|
3174
|
+
if (this.inFunction) {
|
|
3175
|
+
return true;
|
|
3176
|
+
}
|
|
3177
|
+
if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) {
|
|
3178
|
+
return true;
|
|
3179
|
+
}
|
|
3180
|
+
return false;
|
|
3181
|
+
};
|
|
3169
3182
|
prototypeAccessors.allowSuper.get = function () {
|
|
3170
3183
|
var ref = this.currentThisScope();
|
|
3171
3184
|
var flags = ref.flags;
|
|
3172
|
-
|
|
3173
|
-
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod;
|
|
3185
|
+
return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod;
|
|
3174
3186
|
};
|
|
3175
3187
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0; };
|
|
3176
3188
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()); };
|
|
3177
3189
|
prototypeAccessors.allowNewDotTarget.get = function () {
|
|
3178
|
-
var
|
|
3190
|
+
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
3191
|
+
var ref = this.scopeStack[i];
|
|
3192
|
+
var flags = ref.flags;
|
|
3193
|
+
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) ||
|
|
3194
|
+
((flags & SCOPE_FUNCTION) && !(flags & SCOPE_ARROW))) {
|
|
3195
|
+
return true;
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
return false;
|
|
3199
|
+
};
|
|
3200
|
+
prototypeAccessors.allowUsing.get = function () {
|
|
3201
|
+
var ref = this.currentScope();
|
|
3179
3202
|
var flags = ref.flags;
|
|
3180
|
-
|
|
3181
|
-
|
|
3203
|
+
if (flags & SCOPE_SWITCH) {
|
|
3204
|
+
return false;
|
|
3205
|
+
}
|
|
3206
|
+
if (!this.inModule && flags & SCOPE_TOP) {
|
|
3207
|
+
return false;
|
|
3208
|
+
}
|
|
3209
|
+
return true;
|
|
3182
3210
|
};
|
|
3183
3211
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
3184
3212
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0;
|
|
@@ -3206,7 +3234,7 @@ Parser$1.tokenizer = function tokenizer(input, options) {
|
|
|
3206
3234
|
};
|
|
3207
3235
|
Object.defineProperties(Parser$1.prototype, prototypeAccessors);
|
|
3208
3236
|
var pp$9 = Parser$1.prototype;
|
|
3209
|
-
var literal = /^(?:'((
|
|
3237
|
+
var literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
|
|
3210
3238
|
pp$9.strictDirective = function (start) {
|
|
3211
3239
|
if (this.options.ecmaVersion < 5) {
|
|
3212
3240
|
return false;
|
|
@@ -3361,7 +3389,7 @@ pp$8.parseTopLevel = function (node) {
|
|
|
3361
3389
|
}
|
|
3362
3390
|
this.adaptDirectivePrologue(node.body);
|
|
3363
3391
|
this.next();
|
|
3364
|
-
node.sourceType = this.options.sourceType;
|
|
3392
|
+
node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType;
|
|
3365
3393
|
return this.finishNode(node, "Program");
|
|
3366
3394
|
};
|
|
3367
3395
|
var loopLabel = { kind: "loop" }, switchLabel = { kind: "switch" };
|
|
@@ -3371,25 +3399,25 @@ pp$8.isLet = function (context) {
|
|
|
3371
3399
|
}
|
|
3372
3400
|
skipWhiteSpace.lastIndex = this.pos;
|
|
3373
3401
|
var skip = skipWhiteSpace.exec(this.input);
|
|
3374
|
-
var next = this.pos + skip[0].length, nextCh = this.
|
|
3402
|
+
var next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next);
|
|
3375
3403
|
if (nextCh === 91 || nextCh === 92) {
|
|
3376
3404
|
return true;
|
|
3377
3405
|
}
|
|
3378
3406
|
if (context) {
|
|
3379
3407
|
return false;
|
|
3380
3408
|
}
|
|
3381
|
-
if (nextCh === 123
|
|
3409
|
+
if (nextCh === 123) {
|
|
3382
3410
|
return true;
|
|
3383
3411
|
}
|
|
3384
|
-
if (isIdentifierStart(nextCh
|
|
3385
|
-
var
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
}
|
|
3389
|
-
if (nextCh === 92
|
|
3412
|
+
if (isIdentifierStart(nextCh)) {
|
|
3413
|
+
var start = next;
|
|
3414
|
+
do {
|
|
3415
|
+
next += nextCh <= 0xffff ? 1 : 2;
|
|
3416
|
+
} while (isIdentifierChar(nextCh = this.fullCharCodeAt(next)));
|
|
3417
|
+
if (nextCh === 92) {
|
|
3390
3418
|
return true;
|
|
3391
3419
|
}
|
|
3392
|
-
var ident = this.input.slice(
|
|
3420
|
+
var ident = this.input.slice(start, next);
|
|
3393
3421
|
if (!keywordRelationalOperator.test(ident)) {
|
|
3394
3422
|
return true;
|
|
3395
3423
|
}
|
|
@@ -3406,7 +3434,55 @@ pp$8.isAsyncFunction = function () {
|
|
|
3406
3434
|
return !lineBreak.test(this.input.slice(this.pos, next)) &&
|
|
3407
3435
|
this.input.slice(next, next + 8) === "function" &&
|
|
3408
3436
|
(next + 8 === this.input.length ||
|
|
3409
|
-
!(isIdentifierChar(after = this.
|
|
3437
|
+
!(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92 ));
|
|
3438
|
+
};
|
|
3439
|
+
pp$8.isUsingKeyword = function (isAwaitUsing, isFor) {
|
|
3440
|
+
if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? "await" : "using")) {
|
|
3441
|
+
return false;
|
|
3442
|
+
}
|
|
3443
|
+
skipWhiteSpace.lastIndex = this.pos;
|
|
3444
|
+
var skip = skipWhiteSpace.exec(this.input);
|
|
3445
|
+
var next = this.pos + skip[0].length;
|
|
3446
|
+
if (lineBreak.test(this.input.slice(this.pos, next))) {
|
|
3447
|
+
return false;
|
|
3448
|
+
}
|
|
3449
|
+
if (isAwaitUsing) {
|
|
3450
|
+
var usingEndPos = next + 5 , after;
|
|
3451
|
+
if (this.input.slice(next, usingEndPos) !== "using" ||
|
|
3452
|
+
usingEndPos === this.input.length ||
|
|
3453
|
+
isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) ||
|
|
3454
|
+
after === 92 ) {
|
|
3455
|
+
return false;
|
|
3456
|
+
}
|
|
3457
|
+
skipWhiteSpace.lastIndex = usingEndPos;
|
|
3458
|
+
var skipAfterUsing = skipWhiteSpace.exec(this.input);
|
|
3459
|
+
next = usingEndPos + skipAfterUsing[0].length;
|
|
3460
|
+
if (skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) {
|
|
3461
|
+
return false;
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
var ch = this.fullCharCodeAt(next);
|
|
3465
|
+
if (!isIdentifierStart(ch) && ch !== 92 ) {
|
|
3466
|
+
return false;
|
|
3467
|
+
}
|
|
3468
|
+
var idStart = next;
|
|
3469
|
+
do {
|
|
3470
|
+
next += ch <= 0xffff ? 1 : 2;
|
|
3471
|
+
} while (isIdentifierChar(ch = this.fullCharCodeAt(next)));
|
|
3472
|
+
if (ch === 92) {
|
|
3473
|
+
return true;
|
|
3474
|
+
}
|
|
3475
|
+
var id = this.input.slice(idStart, next);
|
|
3476
|
+
if (keywordRelationalOperator.test(id) || isFor && id === "of") {
|
|
3477
|
+
return false;
|
|
3478
|
+
}
|
|
3479
|
+
return true;
|
|
3480
|
+
};
|
|
3481
|
+
pp$8.isAwaitUsing = function (isFor) {
|
|
3482
|
+
return this.isUsingKeyword(true, isFor);
|
|
3483
|
+
};
|
|
3484
|
+
pp$8.isUsing = function (isFor) {
|
|
3485
|
+
return this.isUsingKeyword(false, isFor);
|
|
3410
3486
|
};
|
|
3411
3487
|
pp$8.parseStatement = function (context, topLevel, exports) {
|
|
3412
3488
|
var starttype = this.type, node = this.startNode(), kind;
|
|
@@ -3474,6 +3550,22 @@ pp$8.parseStatement = function (context, topLevel, exports) {
|
|
|
3474
3550
|
this.next();
|
|
3475
3551
|
return this.parseFunctionStatement(node, true, !context);
|
|
3476
3552
|
}
|
|
3553
|
+
var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
|
|
3554
|
+
if (usingKind) {
|
|
3555
|
+
if (!this.allowUsing) {
|
|
3556
|
+
this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");
|
|
3557
|
+
}
|
|
3558
|
+
if (usingKind === "await using") {
|
|
3559
|
+
if (!this.canAwait) {
|
|
3560
|
+
this.raise(this.start, "Await using cannot appear outside of async function");
|
|
3561
|
+
}
|
|
3562
|
+
this.next();
|
|
3563
|
+
}
|
|
3564
|
+
this.next();
|
|
3565
|
+
this.parseVar(node, false, usingKind);
|
|
3566
|
+
this.semicolon();
|
|
3567
|
+
return this.finishNode(node, "VariableDeclaration");
|
|
3568
|
+
}
|
|
3477
3569
|
var maybeName = this.value, expr = this.parseExpression();
|
|
3478
3570
|
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) {
|
|
3479
3571
|
return this.parseLabeledStatement(node, maybeName, expr, context);
|
|
@@ -3551,36 +3643,42 @@ pp$8.parseForStatement = function (node) {
|
|
|
3551
3643
|
this.next();
|
|
3552
3644
|
this.parseVar(init$1, true, kind);
|
|
3553
3645
|
this.finishNode(init$1, "VariableDeclaration");
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3646
|
+
return this.parseForAfterInit(node, init$1, awaitAt);
|
|
3647
|
+
}
|
|
3648
|
+
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
3649
|
+
var usingKind = this.isUsing(true) ? "using" : this.isAwaitUsing(true) ? "await using" : null;
|
|
3650
|
+
if (usingKind) {
|
|
3651
|
+
var init$2 = this.startNode();
|
|
3652
|
+
this.next();
|
|
3653
|
+
if (usingKind === "await using") {
|
|
3654
|
+
if (!this.canAwait) {
|
|
3655
|
+
this.raise(this.start, "Await using cannot appear outside of async function");
|
|
3564
3656
|
}
|
|
3565
|
-
|
|
3566
|
-
}
|
|
3567
|
-
if (awaitAt > -1) {
|
|
3568
|
-
this.unexpected(awaitAt);
|
|
3657
|
+
this.next();
|
|
3569
3658
|
}
|
|
3570
|
-
|
|
3659
|
+
this.parseVar(init$2, true, usingKind);
|
|
3660
|
+
this.finishNode(init$2, "VariableDeclaration");
|
|
3661
|
+
return this.parseForAfterInit(node, init$2, awaitAt);
|
|
3571
3662
|
}
|
|
3572
|
-
var
|
|
3663
|
+
var containsEsc = this.containsEsc;
|
|
3573
3664
|
var refDestructuringErrors = new DestructuringErrors;
|
|
3574
|
-
var
|
|
3665
|
+
var initPos = this.start;
|
|
3666
|
+
var init = awaitAt > -1
|
|
3667
|
+
? this.parseExprSubscripts(refDestructuringErrors, "await")
|
|
3668
|
+
: this.parseExpression(true, refDestructuringErrors);
|
|
3575
3669
|
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
3576
|
-
if (
|
|
3670
|
+
if (awaitAt > -1) {
|
|
3577
3671
|
if (this.type === types$1._in) {
|
|
3578
|
-
|
|
3579
|
-
this.unexpected(awaitAt);
|
|
3580
|
-
}
|
|
3672
|
+
this.unexpected(awaitAt);
|
|
3581
3673
|
}
|
|
3582
|
-
|
|
3583
|
-
|
|
3674
|
+
node.await = true;
|
|
3675
|
+
}
|
|
3676
|
+
else if (isForOf && this.options.ecmaVersion >= 8) {
|
|
3677
|
+
if (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async") {
|
|
3678
|
+
this.unexpected();
|
|
3679
|
+
}
|
|
3680
|
+
else if (this.options.ecmaVersion >= 9) {
|
|
3681
|
+
node.await = false;
|
|
3584
3682
|
}
|
|
3585
3683
|
}
|
|
3586
3684
|
if (startsWithLet && isForOf) {
|
|
@@ -3598,6 +3696,25 @@ pp$8.parseForStatement = function (node) {
|
|
|
3598
3696
|
}
|
|
3599
3697
|
return this.parseFor(node, init);
|
|
3600
3698
|
};
|
|
3699
|
+
pp$8.parseForAfterInit = function (node, init, awaitAt) {
|
|
3700
|
+
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1) {
|
|
3701
|
+
if (this.options.ecmaVersion >= 9) {
|
|
3702
|
+
if (this.type === types$1._in) {
|
|
3703
|
+
if (awaitAt > -1) {
|
|
3704
|
+
this.unexpected(awaitAt);
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
else {
|
|
3708
|
+
node.await = awaitAt > -1;
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
return this.parseForIn(node, init);
|
|
3712
|
+
}
|
|
3713
|
+
if (awaitAt > -1) {
|
|
3714
|
+
this.unexpected(awaitAt);
|
|
3715
|
+
}
|
|
3716
|
+
return this.parseFor(node, init);
|
|
3717
|
+
};
|
|
3601
3718
|
pp$8.parseFunctionStatement = function (node, isAsync, declarationPosition) {
|
|
3602
3719
|
this.next();
|
|
3603
3720
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
|
|
@@ -3610,7 +3727,7 @@ pp$8.parseIfStatement = function (node) {
|
|
|
3610
3727
|
return this.finishNode(node, "IfStatement");
|
|
3611
3728
|
};
|
|
3612
3729
|
pp$8.parseReturnStatement = function (node) {
|
|
3613
|
-
if (!this.
|
|
3730
|
+
if (!this.allowReturn) {
|
|
3614
3731
|
this.raise(this.start, "'return' outside of function");
|
|
3615
3732
|
}
|
|
3616
3733
|
this.next();
|
|
@@ -3629,7 +3746,7 @@ pp$8.parseSwitchStatement = function (node) {
|
|
|
3629
3746
|
node.cases = [];
|
|
3630
3747
|
this.expect(types$1.braceL);
|
|
3631
3748
|
this.labels.push(switchLabel);
|
|
3632
|
-
this.enterScope(
|
|
3749
|
+
this.enterScope(SCOPE_SWITCH);
|
|
3633
3750
|
var cur;
|
|
3634
3751
|
for (var sawDefault = false; this.type !== types$1.braceR;) {
|
|
3635
3752
|
if (this.type === types$1._case || this.type === types$1._default) {
|
|
@@ -3835,6 +3952,9 @@ pp$8.parseVar = function (node, isFor, kind, allowMissingInitializer) {
|
|
|
3835
3952
|
else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
3836
3953
|
this.unexpected();
|
|
3837
3954
|
}
|
|
3955
|
+
else if (!allowMissingInitializer && (kind === "using" || kind === "await using") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual("of")) {
|
|
3956
|
+
this.raise(this.lastTokEnd, ("Missing initializer in " + kind + " declaration"));
|
|
3957
|
+
}
|
|
3838
3958
|
else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
3839
3959
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
3840
3960
|
}
|
|
@@ -3849,7 +3969,9 @@ pp$8.parseVar = function (node, isFor, kind, allowMissingInitializer) {
|
|
|
3849
3969
|
return node;
|
|
3850
3970
|
};
|
|
3851
3971
|
pp$8.parseVarId = function (decl, kind) {
|
|
3852
|
-
decl.id =
|
|
3972
|
+
decl.id = kind === "using" || kind === "await using"
|
|
3973
|
+
? this.parseIdent()
|
|
3974
|
+
: this.parseBindingAtom();
|
|
3853
3975
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
3854
3976
|
};
|
|
3855
3977
|
var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
|
@@ -4045,11 +4167,9 @@ pp$8.parseClassField = function (field) {
|
|
|
4045
4167
|
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
4046
4168
|
}
|
|
4047
4169
|
if (this.eat(types$1.eq)) {
|
|
4048
|
-
|
|
4049
|
-
var inClassFieldInit = scope.inClassFieldInit;
|
|
4050
|
-
scope.inClassFieldInit = true;
|
|
4170
|
+
this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);
|
|
4051
4171
|
field.value = this.parseMaybeAssign();
|
|
4052
|
-
|
|
4172
|
+
this.exitScope();
|
|
4053
4173
|
}
|
|
4054
4174
|
else {
|
|
4055
4175
|
field.value = null;
|
|
@@ -4157,6 +4277,9 @@ pp$8.parseExportAllDeclaration = function (node, exports) {
|
|
|
4157
4277
|
this.unexpected();
|
|
4158
4278
|
}
|
|
4159
4279
|
node.source = this.parseExprAtom();
|
|
4280
|
+
if (this.options.ecmaVersion >= 16) {
|
|
4281
|
+
node.attributes = this.parseWithClause();
|
|
4282
|
+
}
|
|
4160
4283
|
this.semicolon();
|
|
4161
4284
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
4162
4285
|
};
|
|
@@ -4180,6 +4303,9 @@ pp$8.parseExport = function (node, exports) {
|
|
|
4180
4303
|
}
|
|
4181
4304
|
node.specifiers = [];
|
|
4182
4305
|
node.source = null;
|
|
4306
|
+
if (this.options.ecmaVersion >= 16) {
|
|
4307
|
+
node.attributes = [];
|
|
4308
|
+
}
|
|
4183
4309
|
}
|
|
4184
4310
|
else {
|
|
4185
4311
|
node.declaration = null;
|
|
@@ -4189,6 +4315,9 @@ pp$8.parseExport = function (node, exports) {
|
|
|
4189
4315
|
this.unexpected();
|
|
4190
4316
|
}
|
|
4191
4317
|
node.source = this.parseExprAtom();
|
|
4318
|
+
if (this.options.ecmaVersion >= 16) {
|
|
4319
|
+
node.attributes = this.parseWithClause();
|
|
4320
|
+
}
|
|
4192
4321
|
}
|
|
4193
4322
|
else {
|
|
4194
4323
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
@@ -4200,6 +4329,9 @@ pp$8.parseExport = function (node, exports) {
|
|
|
4200
4329
|
}
|
|
4201
4330
|
}
|
|
4202
4331
|
node.source = null;
|
|
4332
|
+
if (this.options.ecmaVersion >= 16) {
|
|
4333
|
+
node.attributes = [];
|
|
4334
|
+
}
|
|
4203
4335
|
}
|
|
4204
4336
|
this.semicolon();
|
|
4205
4337
|
}
|
|
@@ -4268,9 +4400,6 @@ pp$8.checkPatternExport = function (exports, pat) {
|
|
|
4268
4400
|
else if (type === "RestElement") {
|
|
4269
4401
|
this.checkPatternExport(exports, pat.argument);
|
|
4270
4402
|
}
|
|
4271
|
-
else if (type === "ParenthesizedExpression") {
|
|
4272
|
-
this.checkPatternExport(exports, pat.expression);
|
|
4273
|
-
}
|
|
4274
4403
|
};
|
|
4275
4404
|
pp$8.checkVariableExport = function (exports, decls) {
|
|
4276
4405
|
if (!exports) {
|
|
@@ -4324,6 +4453,9 @@ pp$8.parseImport = function (node) {
|
|
|
4324
4453
|
this.expectContextual("from");
|
|
4325
4454
|
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
4326
4455
|
}
|
|
4456
|
+
if (this.options.ecmaVersion >= 16) {
|
|
4457
|
+
node.attributes = this.parseWithClause();
|
|
4458
|
+
}
|
|
4327
4459
|
this.semicolon();
|
|
4328
4460
|
return this.finishNode(node, "ImportDeclaration");
|
|
4329
4461
|
};
|
|
@@ -4381,6 +4513,44 @@ pp$8.parseImportSpecifiers = function () {
|
|
|
4381
4513
|
}
|
|
4382
4514
|
return nodes;
|
|
4383
4515
|
};
|
|
4516
|
+
pp$8.parseWithClause = function () {
|
|
4517
|
+
var nodes = [];
|
|
4518
|
+
if (!this.eat(types$1._with)) {
|
|
4519
|
+
return nodes;
|
|
4520
|
+
}
|
|
4521
|
+
this.expect(types$1.braceL);
|
|
4522
|
+
var attributeKeys = {};
|
|
4523
|
+
var first = true;
|
|
4524
|
+
while (!this.eat(types$1.braceR)) {
|
|
4525
|
+
if (!first) {
|
|
4526
|
+
this.expect(types$1.comma);
|
|
4527
|
+
if (this.afterTrailingComma(types$1.braceR)) {
|
|
4528
|
+
break;
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
else {
|
|
4532
|
+
first = false;
|
|
4533
|
+
}
|
|
4534
|
+
var attr = this.parseImportAttribute();
|
|
4535
|
+
var keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value;
|
|
4536
|
+
if (hasOwn(attributeKeys, keyName)) {
|
|
4537
|
+
this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'");
|
|
4538
|
+
}
|
|
4539
|
+
attributeKeys[keyName] = true;
|
|
4540
|
+
nodes.push(attr);
|
|
4541
|
+
}
|
|
4542
|
+
return nodes;
|
|
4543
|
+
};
|
|
4544
|
+
pp$8.parseImportAttribute = function () {
|
|
4545
|
+
var node = this.startNode();
|
|
4546
|
+
node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
4547
|
+
this.expect(types$1.colon);
|
|
4548
|
+
if (this.type !== types$1.string) {
|
|
4549
|
+
this.unexpected();
|
|
4550
|
+
}
|
|
4551
|
+
node.value = this.parseExprAtom();
|
|
4552
|
+
return this.finishNode(node, "ImportAttribute");
|
|
4553
|
+
};
|
|
4384
4554
|
pp$8.parseModuleExportName = function () {
|
|
4385
4555
|
if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
|
|
4386
4556
|
var stringLiteral = this.parseLiteral(this.value);
|
|
@@ -4764,6 +4934,12 @@ types$1._function.updateContext = types$1._class.updateContext = function (prevT
|
|
|
4764
4934
|
}
|
|
4765
4935
|
this.exprAllowed = false;
|
|
4766
4936
|
};
|
|
4937
|
+
types$1.colon.updateContext = function () {
|
|
4938
|
+
if (this.curContext().token === "function") {
|
|
4939
|
+
this.context.pop();
|
|
4940
|
+
}
|
|
4941
|
+
this.exprAllowed = true;
|
|
4942
|
+
};
|
|
4767
4943
|
types$1.backQuote.updateContext = function () {
|
|
4768
4944
|
if (this.curContext() === types.q_tmpl) {
|
|
4769
4945
|
this.context.pop();
|
|
@@ -5007,8 +5183,7 @@ pp$5.parseMaybeUnary = function (refDestructuringErrors, sawUnary, incDec, forIn
|
|
|
5007
5183
|
if (update) {
|
|
5008
5184
|
this.checkLValSimple(node.argument);
|
|
5009
5185
|
}
|
|
5010
|
-
else if (this.strict && node.operator === "delete" &&
|
|
5011
|
-
node.argument.type === "Identifier") {
|
|
5186
|
+
else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument)) {
|
|
5012
5187
|
this.raiseRecoverable(node.start, "Deleting local variable in strict mode");
|
|
5013
5188
|
}
|
|
5014
5189
|
else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) {
|
|
@@ -5055,9 +5230,14 @@ pp$5.parseMaybeUnary = function (refDestructuringErrors, sawUnary, incDec, forIn
|
|
|
5055
5230
|
return expr;
|
|
5056
5231
|
}
|
|
5057
5232
|
};
|
|
5233
|
+
function isLocalVariableAccess(node) {
|
|
5234
|
+
return (node.type === "Identifier" ||
|
|
5235
|
+
node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression));
|
|
5236
|
+
}
|
|
5058
5237
|
function isPrivateFieldAccess(node) {
|
|
5059
5238
|
return (node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
|
|
5060
|
-
node.type === "ChainExpression" && isPrivateFieldAccess(node.expression)
|
|
5239
|
+
node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) ||
|
|
5240
|
+
node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression));
|
|
5061
5241
|
}
|
|
5062
5242
|
pp$5.parseExprSubscripts = function (refDestructuringErrors, forInit) {
|
|
5063
5243
|
var startPos = this.start, startLoc = this.startLoc;
|
|
@@ -5280,12 +5460,14 @@ pp$5.parseExprImport = function (forNew) {
|
|
|
5280
5460
|
if (this.containsEsc) {
|
|
5281
5461
|
this.raiseRecoverable(this.start, "Escape sequence in keyword import");
|
|
5282
5462
|
}
|
|
5283
|
-
|
|
5463
|
+
this.next();
|
|
5284
5464
|
if (this.type === types$1.parenL && !forNew) {
|
|
5285
5465
|
return this.parseDynamicImport(node);
|
|
5286
5466
|
}
|
|
5287
5467
|
else if (this.type === types$1.dot) {
|
|
5288
|
-
|
|
5468
|
+
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
|
|
5469
|
+
meta.name = "import";
|
|
5470
|
+
node.meta = this.finishNode(meta, "Identifier");
|
|
5289
5471
|
return this.parseImportMeta(node);
|
|
5290
5472
|
}
|
|
5291
5473
|
else {
|
|
@@ -5295,13 +5477,35 @@ pp$5.parseExprImport = function (forNew) {
|
|
|
5295
5477
|
pp$5.parseDynamicImport = function (node) {
|
|
5296
5478
|
this.next();
|
|
5297
5479
|
node.source = this.parseMaybeAssign();
|
|
5298
|
-
if (
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
this.
|
|
5480
|
+
if (this.options.ecmaVersion >= 16) {
|
|
5481
|
+
if (!this.eat(types$1.parenR)) {
|
|
5482
|
+
this.expect(types$1.comma);
|
|
5483
|
+
if (!this.afterTrailingComma(types$1.parenR)) {
|
|
5484
|
+
node.options = this.parseMaybeAssign();
|
|
5485
|
+
if (!this.eat(types$1.parenR)) {
|
|
5486
|
+
this.expect(types$1.comma);
|
|
5487
|
+
if (!this.afterTrailingComma(types$1.parenR)) {
|
|
5488
|
+
this.unexpected();
|
|
5489
|
+
}
|
|
5490
|
+
}
|
|
5491
|
+
}
|
|
5492
|
+
else {
|
|
5493
|
+
node.options = null;
|
|
5494
|
+
}
|
|
5302
5495
|
}
|
|
5303
5496
|
else {
|
|
5304
|
-
|
|
5497
|
+
node.options = null;
|
|
5498
|
+
}
|
|
5499
|
+
}
|
|
5500
|
+
else {
|
|
5501
|
+
if (!this.eat(types$1.parenR)) {
|
|
5502
|
+
var errorPos = this.start;
|
|
5503
|
+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
5504
|
+
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
5505
|
+
}
|
|
5506
|
+
else {
|
|
5507
|
+
this.unexpected(errorPos);
|
|
5508
|
+
}
|
|
5305
5509
|
}
|
|
5306
5510
|
}
|
|
5307
5511
|
return this.finishNode(node, "ImportExpression");
|
|
@@ -5326,7 +5530,7 @@ pp$5.parseLiteral = function (value) {
|
|
|
5326
5530
|
node.value = value;
|
|
5327
5531
|
node.raw = this.input.slice(this.start, this.end);
|
|
5328
5532
|
if (node.raw.charCodeAt(node.raw.length - 1) === 110) {
|
|
5329
|
-
node.bigint = node.raw.slice(0, -1).replace(/_/g, "");
|
|
5533
|
+
node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, "");
|
|
5330
5534
|
}
|
|
5331
5535
|
this.next();
|
|
5332
5536
|
return this.finishNode(node, "Literal");
|
|
@@ -5418,9 +5622,12 @@ pp$5.parseNew = function () {
|
|
|
5418
5622
|
this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
5419
5623
|
}
|
|
5420
5624
|
var node = this.startNode();
|
|
5421
|
-
|
|
5422
|
-
if (this.options.ecmaVersion >= 6 && this.
|
|
5423
|
-
|
|
5625
|
+
this.next();
|
|
5626
|
+
if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
|
|
5627
|
+
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
|
|
5628
|
+
meta.name = "new";
|
|
5629
|
+
node.meta = this.finishNode(meta, "Identifier");
|
|
5630
|
+
this.next();
|
|
5424
5631
|
var containsEsc = this.containsEsc;
|
|
5425
5632
|
node.property = this.parseIdent(true);
|
|
5426
5633
|
if (node.property.name !== "target") {
|
|
@@ -5452,7 +5659,7 @@ pp$5.parseTemplateElement = function (ref) {
|
|
|
5452
5659
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
5453
5660
|
}
|
|
5454
5661
|
elem.value = {
|
|
5455
|
-
raw: this.value,
|
|
5662
|
+
raw: this.value.replace(/\r\n?/g, "\n"),
|
|
5456
5663
|
cooked: null
|
|
5457
5664
|
};
|
|
5458
5665
|
}
|
|
@@ -5557,9 +5764,10 @@ pp$5.parseProperty = function (isPattern, refDestructuringErrors) {
|
|
|
5557
5764
|
return this.finishNode(prop, "Property");
|
|
5558
5765
|
};
|
|
5559
5766
|
pp$5.parseGetterSetter = function (prop) {
|
|
5560
|
-
|
|
5767
|
+
var kind = prop.key.name;
|
|
5561
5768
|
this.parsePropertyName(prop);
|
|
5562
5769
|
prop.value = this.parseMethod(false);
|
|
5770
|
+
prop.kind = kind;
|
|
5563
5771
|
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
5564
5772
|
if (prop.value.params.length !== paramCount) {
|
|
5565
5773
|
var start = prop.value.start;
|
|
@@ -5588,9 +5796,9 @@ pp$5.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, start
|
|
|
5588
5796
|
if (isPattern) {
|
|
5589
5797
|
this.unexpected();
|
|
5590
5798
|
}
|
|
5591
|
-
prop.kind = "init";
|
|
5592
5799
|
prop.method = true;
|
|
5593
5800
|
prop.value = this.parseMethod(isGenerator, isAsync);
|
|
5801
|
+
prop.kind = "init";
|
|
5594
5802
|
}
|
|
5595
5803
|
else if (!isPattern && !containsEsc &&
|
|
5596
5804
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
@@ -5609,7 +5817,6 @@ pp$5.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, start
|
|
|
5609
5817
|
if (prop.key.name === "await" && !this.awaitIdentPos) {
|
|
5610
5818
|
this.awaitIdentPos = startPos;
|
|
5611
5819
|
}
|
|
5612
|
-
prop.kind = "init";
|
|
5613
5820
|
if (isPattern) {
|
|
5614
5821
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
5615
5822
|
}
|
|
@@ -5622,6 +5829,7 @@ pp$5.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, start
|
|
|
5622
5829
|
else {
|
|
5623
5830
|
prop.value = this.copyNode(prop.key);
|
|
5624
5831
|
}
|
|
5832
|
+
prop.kind = "init";
|
|
5625
5833
|
prop.shorthand = true;
|
|
5626
5834
|
}
|
|
5627
5835
|
else {
|
|
@@ -5777,7 +5985,7 @@ pp$5.checkUnreserved = function (ref) {
|
|
|
5777
5985
|
if (this.inAsync && name === "await") {
|
|
5778
5986
|
this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function");
|
|
5779
5987
|
}
|
|
5780
|
-
if (this.currentThisScope().
|
|
5988
|
+
if (!(this.currentThisScope().flags & SCOPE_VAR) && name === "arguments") {
|
|
5781
5989
|
this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer");
|
|
5782
5990
|
}
|
|
5783
5991
|
if (this.inClassStaticBlock && (name === "arguments" || name === "await")) {
|
|
@@ -5821,6 +6029,7 @@ pp$5.parseIdentNode = function () {
|
|
|
5821
6029
|
(this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
|
|
5822
6030
|
this.context.pop();
|
|
5823
6031
|
}
|
|
6032
|
+
this.type = types$1.name;
|
|
5824
6033
|
}
|
|
5825
6034
|
else {
|
|
5826
6035
|
this.unexpected();
|
|
@@ -5876,6 +6085,9 @@ var pp$4 = Parser$1.prototype;
|
|
|
5876
6085
|
pp$4.raise = function (pos, message) {
|
|
5877
6086
|
var loc = getLineInfo(this.input, pos);
|
|
5878
6087
|
message += " (" + loc.line + ":" + loc.column + ")";
|
|
6088
|
+
if (this.sourceFile) {
|
|
6089
|
+
message += " in " + this.sourceFile;
|
|
6090
|
+
}
|
|
5879
6091
|
var err = new SyntaxError(message);
|
|
5880
6092
|
err.pos = pos;
|
|
5881
6093
|
err.loc = loc;
|
|
@@ -5894,7 +6106,6 @@ var Scope$1 = function Scope(flags) {
|
|
|
5894
6106
|
this.var = [];
|
|
5895
6107
|
this.lexical = [];
|
|
5896
6108
|
this.functions = [];
|
|
5897
|
-
this.inClassFieldInit = false;
|
|
5898
6109
|
};
|
|
5899
6110
|
pp$3.enterScope = function (flags) {
|
|
5900
6111
|
this.scopeStack.push(new Scope$1(flags));
|
|
@@ -5962,7 +6173,7 @@ pp$3.currentScope = function () {
|
|
|
5962
6173
|
pp$3.currentVarScope = function () {
|
|
5963
6174
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
5964
6175
|
var scope = this.scopeStack[i];
|
|
5965
|
-
if (scope.flags & SCOPE_VAR) {
|
|
6176
|
+
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) {
|
|
5966
6177
|
return scope;
|
|
5967
6178
|
}
|
|
5968
6179
|
}
|
|
@@ -5970,7 +6181,8 @@ pp$3.currentVarScope = function () {
|
|
|
5970
6181
|
pp$3.currentThisScope = function () {
|
|
5971
6182
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
5972
6183
|
var scope = this.scopeStack[i];
|
|
5973
|
-
if (scope.flags & SCOPE_VAR
|
|
6184
|
+
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) &&
|
|
6185
|
+
!(scope.flags & SCOPE_ARROW)) {
|
|
5974
6186
|
return scope;
|
|
5975
6187
|
}
|
|
5976
6188
|
}
|
|
@@ -6020,6 +6232,7 @@ pp$2.copyNode = function (node) {
|
|
|
6020
6232
|
}
|
|
6021
6233
|
return newNode;
|
|
6022
6234
|
};
|
|
6235
|
+
var scriptValuesAddedInUnicode = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz";
|
|
6023
6236
|
var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
|
|
6024
6237
|
var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
|
|
6025
6238
|
var ecma11BinaryProperties = ecma10BinaryProperties;
|
|
@@ -6049,7 +6262,7 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
|
|
|
6049
6262
|
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
|
|
6050
6263
|
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
|
|
6051
6264
|
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
|
|
6052
|
-
var ecma14ScriptValues = ecma13ScriptValues + "
|
|
6265
|
+
var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;
|
|
6053
6266
|
var unicodeScriptValues = {
|
|
6054
6267
|
9: ecma9ScriptValues,
|
|
6055
6268
|
10: ecma10ScriptValues,
|
|
@@ -6078,6 +6291,23 @@ for (var i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) {
|
|
|
6078
6291
|
buildUnicodeData(ecmaVersion);
|
|
6079
6292
|
}
|
|
6080
6293
|
var pp$1 = Parser$1.prototype;
|
|
6294
|
+
var BranchID = function BranchID(parent, base) {
|
|
6295
|
+
this.parent = parent;
|
|
6296
|
+
this.base = base || this;
|
|
6297
|
+
};
|
|
6298
|
+
BranchID.prototype.separatedFrom = function separatedFrom(alt) {
|
|
6299
|
+
for (var self = this; self; self = self.parent) {
|
|
6300
|
+
for (var other = alt; other; other = other.parent) {
|
|
6301
|
+
if (self.base === other.base && self !== other) {
|
|
6302
|
+
return true;
|
|
6303
|
+
}
|
|
6304
|
+
}
|
|
6305
|
+
}
|
|
6306
|
+
return false;
|
|
6307
|
+
};
|
|
6308
|
+
BranchID.prototype.sibling = function sibling() {
|
|
6309
|
+
return new BranchID(this.parent, this.base);
|
|
6310
|
+
};
|
|
6081
6311
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
6082
6312
|
this.parser = parser;
|
|
6083
6313
|
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
@@ -6094,8 +6324,9 @@ var RegExpValidationState = function RegExpValidationState(parser) {
|
|
|
6094
6324
|
this.lastAssertionIsQuantifiable = false;
|
|
6095
6325
|
this.numCapturingParens = 0;
|
|
6096
6326
|
this.maxBackReference = 0;
|
|
6097
|
-
this.groupNames =
|
|
6327
|
+
this.groupNames = Object.create(null);
|
|
6098
6328
|
this.backReferenceNames = [];
|
|
6329
|
+
this.branchID = null;
|
|
6099
6330
|
};
|
|
6100
6331
|
RegExpValidationState.prototype.reset = function reset(start, pattern, flags) {
|
|
6101
6332
|
var unicodeSets = flags.indexOf("v") !== -1;
|
|
@@ -6210,9 +6441,15 @@ pp$1.validateRegExpFlags = function (state) {
|
|
|
6210
6441
|
this.raise(state.start, "Invalid regular expression flag");
|
|
6211
6442
|
}
|
|
6212
6443
|
};
|
|
6444
|
+
function hasProp(obj) {
|
|
6445
|
+
for (var _ in obj) {
|
|
6446
|
+
return true;
|
|
6447
|
+
}
|
|
6448
|
+
return false;
|
|
6449
|
+
}
|
|
6213
6450
|
pp$1.validateRegExpPattern = function (state) {
|
|
6214
6451
|
this.regexp_pattern(state);
|
|
6215
|
-
if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames
|
|
6452
|
+
if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) {
|
|
6216
6453
|
state.switchN = true;
|
|
6217
6454
|
this.regexp_pattern(state);
|
|
6218
6455
|
}
|
|
@@ -6224,8 +6461,9 @@ pp$1.regexp_pattern = function (state) {
|
|
|
6224
6461
|
state.lastAssertionIsQuantifiable = false;
|
|
6225
6462
|
state.numCapturingParens = 0;
|
|
6226
6463
|
state.maxBackReference = 0;
|
|
6227
|
-
state.groupNames
|
|
6464
|
+
state.groupNames = Object.create(null);
|
|
6228
6465
|
state.backReferenceNames.length = 0;
|
|
6466
|
+
state.branchID = null;
|
|
6229
6467
|
this.regexp_disjunction(state);
|
|
6230
6468
|
if (state.pos !== state.source.length) {
|
|
6231
6469
|
if (state.eat(0x29 )) {
|
|
@@ -6240,16 +6478,26 @@ pp$1.regexp_pattern = function (state) {
|
|
|
6240
6478
|
}
|
|
6241
6479
|
for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
|
|
6242
6480
|
var name = list[i];
|
|
6243
|
-
if (state.groupNames
|
|
6481
|
+
if (!state.groupNames[name]) {
|
|
6244
6482
|
state.raise("Invalid named capture referenced");
|
|
6245
6483
|
}
|
|
6246
6484
|
}
|
|
6247
6485
|
};
|
|
6248
6486
|
pp$1.regexp_disjunction = function (state) {
|
|
6487
|
+
var trackDisjunction = this.options.ecmaVersion >= 16;
|
|
6488
|
+
if (trackDisjunction) {
|
|
6489
|
+
state.branchID = new BranchID(state.branchID, null);
|
|
6490
|
+
}
|
|
6249
6491
|
this.regexp_alternative(state);
|
|
6250
6492
|
while (state.eat(0x7C )) {
|
|
6493
|
+
if (trackDisjunction) {
|
|
6494
|
+
state.branchID = state.branchID.sibling();
|
|
6495
|
+
}
|
|
6251
6496
|
this.regexp_alternative(state);
|
|
6252
6497
|
}
|
|
6498
|
+
if (trackDisjunction) {
|
|
6499
|
+
state.branchID = state.branchID.parent;
|
|
6500
|
+
}
|
|
6253
6501
|
if (this.regexp_eatQuantifier(state, true)) {
|
|
6254
6502
|
state.raise("Nothing to repeat");
|
|
6255
6503
|
}
|
|
@@ -6363,12 +6611,39 @@ pp$1.regexp_eatReverseSolidusAtomEscape = function (state) {
|
|
|
6363
6611
|
pp$1.regexp_eatUncapturingGroup = function (state) {
|
|
6364
6612
|
var start = state.pos;
|
|
6365
6613
|
if (state.eat(0x28 )) {
|
|
6366
|
-
if (state.eat(0x3F )
|
|
6367
|
-
this.
|
|
6368
|
-
|
|
6369
|
-
|
|
6614
|
+
if (state.eat(0x3F )) {
|
|
6615
|
+
if (this.options.ecmaVersion >= 16) {
|
|
6616
|
+
var addModifiers = this.regexp_eatModifiers(state);
|
|
6617
|
+
var hasHyphen = state.eat(0x2D );
|
|
6618
|
+
if (addModifiers || hasHyphen) {
|
|
6619
|
+
for (var i = 0; i < addModifiers.length; i++) {
|
|
6620
|
+
var modifier = addModifiers.charAt(i);
|
|
6621
|
+
if (addModifiers.indexOf(modifier, i + 1) > -1) {
|
|
6622
|
+
state.raise("Duplicate regular expression modifiers");
|
|
6623
|
+
}
|
|
6624
|
+
}
|
|
6625
|
+
if (hasHyphen) {
|
|
6626
|
+
var removeModifiers = this.regexp_eatModifiers(state);
|
|
6627
|
+
if (!addModifiers && !removeModifiers && state.current() === 0x3A ) {
|
|
6628
|
+
state.raise("Invalid regular expression modifiers");
|
|
6629
|
+
}
|
|
6630
|
+
for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
|
|
6631
|
+
var modifier$1 = removeModifiers.charAt(i$1);
|
|
6632
|
+
if (removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 ||
|
|
6633
|
+
addModifiers.indexOf(modifier$1) > -1) {
|
|
6634
|
+
state.raise("Duplicate regular expression modifiers");
|
|
6635
|
+
}
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
}
|
|
6640
|
+
if (state.eat(0x3A )) {
|
|
6641
|
+
this.regexp_disjunction(state);
|
|
6642
|
+
if (state.eat(0x29 )) {
|
|
6643
|
+
return true;
|
|
6644
|
+
}
|
|
6645
|
+
state.raise("Unterminated group");
|
|
6370
6646
|
}
|
|
6371
|
-
state.raise("Unterminated group");
|
|
6372
6647
|
}
|
|
6373
6648
|
state.pos = start;
|
|
6374
6649
|
}
|
|
@@ -6391,6 +6666,18 @@ pp$1.regexp_eatCapturingGroup = function (state) {
|
|
|
6391
6666
|
}
|
|
6392
6667
|
return false;
|
|
6393
6668
|
};
|
|
6669
|
+
pp$1.regexp_eatModifiers = function (state) {
|
|
6670
|
+
var modifiers = "";
|
|
6671
|
+
var ch = 0;
|
|
6672
|
+
while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) {
|
|
6673
|
+
modifiers += codePointToString(ch);
|
|
6674
|
+
state.advance();
|
|
6675
|
+
}
|
|
6676
|
+
return modifiers;
|
|
6677
|
+
};
|
|
6678
|
+
function isRegularExpressionModifier(ch) {
|
|
6679
|
+
return ch === 0x69 || ch === 0x6d || ch === 0x73;
|
|
6680
|
+
}
|
|
6394
6681
|
pp$1.regexp_eatExtendedAtom = function (state) {
|
|
6395
6682
|
return (state.eat(0x2E ) ||
|
|
6396
6683
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
|
@@ -6448,14 +6735,30 @@ pp$1.regexp_eatExtendedPatternCharacter = function (state) {
|
|
|
6448
6735
|
};
|
|
6449
6736
|
pp$1.regexp_groupSpecifier = function (state) {
|
|
6450
6737
|
if (state.eat(0x3F )) {
|
|
6451
|
-
if (this.regexp_eatGroupName(state)) {
|
|
6452
|
-
|
|
6738
|
+
if (!this.regexp_eatGroupName(state)) {
|
|
6739
|
+
state.raise("Invalid group");
|
|
6740
|
+
}
|
|
6741
|
+
var trackDisjunction = this.options.ecmaVersion >= 16;
|
|
6742
|
+
var known = state.groupNames[state.lastStringValue];
|
|
6743
|
+
if (known) {
|
|
6744
|
+
if (trackDisjunction) {
|
|
6745
|
+
for (var i = 0, list = known; i < list.length; i += 1) {
|
|
6746
|
+
var altID = list[i];
|
|
6747
|
+
if (!altID.separatedFrom(state.branchID)) {
|
|
6748
|
+
state.raise("Duplicate capture group name");
|
|
6749
|
+
}
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6752
|
+
else {
|
|
6453
6753
|
state.raise("Duplicate capture group name");
|
|
6454
6754
|
}
|
|
6455
|
-
state.groupNames.push(state.lastStringValue);
|
|
6456
|
-
return;
|
|
6457
6755
|
}
|
|
6458
|
-
|
|
6756
|
+
if (trackDisjunction) {
|
|
6757
|
+
(known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
|
|
6758
|
+
}
|
|
6759
|
+
else {
|
|
6760
|
+
state.groupNames[state.lastStringValue] = true;
|
|
6761
|
+
}
|
|
6459
6762
|
}
|
|
6460
6763
|
};
|
|
6461
6764
|
pp$1.regexp_eatGroupName = function (state) {
|
|
@@ -7235,14 +7538,17 @@ pp.readToken = function (code) {
|
|
|
7235
7538
|
}
|
|
7236
7539
|
return this.getTokenFromCode(code);
|
|
7237
7540
|
};
|
|
7238
|
-
pp.
|
|
7239
|
-
var code = this.input.charCodeAt(
|
|
7541
|
+
pp.fullCharCodeAt = function (pos) {
|
|
7542
|
+
var code = this.input.charCodeAt(pos);
|
|
7240
7543
|
if (code <= 0xd7ff || code >= 0xdc00) {
|
|
7241
7544
|
return code;
|
|
7242
7545
|
}
|
|
7243
|
-
var next = this.input.charCodeAt(
|
|
7546
|
+
var next = this.input.charCodeAt(pos + 1);
|
|
7244
7547
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00;
|
|
7245
7548
|
};
|
|
7549
|
+
pp.fullCharCodeAtPos = function () {
|
|
7550
|
+
return this.fullCharCodeAt(this.pos);
|
|
7551
|
+
};
|
|
7246
7552
|
pp.skipBlockComment = function () {
|
|
7247
7553
|
var startLoc = this.options.onComment && this.curPosition();
|
|
7248
7554
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
@@ -7866,6 +8172,16 @@ pp.readInvalidTemplateToken = function () {
|
|
|
7866
8172
|
}
|
|
7867
8173
|
case "`":
|
|
7868
8174
|
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos));
|
|
8175
|
+
case "\r":
|
|
8176
|
+
if (this.input[this.pos + 1] === "\n") {
|
|
8177
|
+
++this.pos;
|
|
8178
|
+
}
|
|
8179
|
+
case "\n":
|
|
8180
|
+
case "\u2028":
|
|
8181
|
+
case "\u2029":
|
|
8182
|
+
++this.curLine;
|
|
8183
|
+
this.lineStart = this.pos + 1;
|
|
8184
|
+
break;
|
|
7869
8185
|
}
|
|
7870
8186
|
}
|
|
7871
8187
|
this.raise(this.start, "Unterminated template");
|
|
@@ -7918,6 +8234,10 @@ pp.readEscapedChar = function (inTemplate) {
|
|
|
7918
8234
|
return String.fromCharCode(octal);
|
|
7919
8235
|
}
|
|
7920
8236
|
if (isNewLine(ch)) {
|
|
8237
|
+
if (this.options.locations) {
|
|
8238
|
+
this.lineStart = this.pos;
|
|
8239
|
+
++this.curLine;
|
|
8240
|
+
}
|
|
7921
8241
|
return "";
|
|
7922
8242
|
}
|
|
7923
8243
|
return String.fromCharCode(ch);
|
|
@@ -7971,7 +8291,7 @@ pp.readWord = function () {
|
|
|
7971
8291
|
}
|
|
7972
8292
|
return this.finishToken(type, word);
|
|
7973
8293
|
};
|
|
7974
|
-
var version = "8.
|
|
8294
|
+
var version = "8.16.0";
|
|
7975
8295
|
Parser$1.acorn = {
|
|
7976
8296
|
Parser: Parser$1,
|
|
7977
8297
|
version: version,
|
|
@@ -12872,7 +13192,7 @@ class AcornTokenizer {
|
|
|
12872
13192
|
return this.#tokenLineEnd;
|
|
12873
13193
|
}
|
|
12874
13194
|
}
|
|
12875
|
-
const ECMA_VERSION =
|
|
13195
|
+
const ECMA_VERSION = 'latest';
|
|
12876
13196
|
|
|
12877
13197
|
// Copyright 2014 The Chromium Authors
|
|
12878
13198
|
class ESTreeWalker {
|
|
@@ -12952,7 +13272,8 @@ const WALK_ORDER = {
|
|
|
12952
13272
|
FunctionDeclaration: ['id', 'params', 'body'],
|
|
12953
13273
|
FunctionExpression: ['id', 'params', 'body'],
|
|
12954
13274
|
Identifier: [],
|
|
12955
|
-
ImportDeclaration: ['specifiers', 'source'],
|
|
13275
|
+
ImportDeclaration: ['specifiers', 'source', 'attributes'],
|
|
13276
|
+
ImportAttribute: ['key', 'value'],
|
|
12956
13277
|
ImportDefaultSpecifier: ['local'],
|
|
12957
13278
|
ImportNamespaceSpecifier: ['local'],
|
|
12958
13279
|
ImportSpecifier: ['imported', 'local'],
|
|
@@ -13135,6 +13456,12 @@ class JavaScriptFormatter {
|
|
|
13135
13456
|
}
|
|
13136
13457
|
return 't';
|
|
13137
13458
|
}
|
|
13459
|
+
if (nodeType === 'ImportAttribute') {
|
|
13460
|
+
if (AT.punctuator(token, ':')) {
|
|
13461
|
+
return 'ts';
|
|
13462
|
+
}
|
|
13463
|
+
return 't';
|
|
13464
|
+
}
|
|
13138
13465
|
if (nodeType === 'ArrayExpression') {
|
|
13139
13466
|
if (AT.punctuator(token, ',')) {
|
|
13140
13467
|
return 'ts';
|
|
@@ -13346,11 +13673,17 @@ class JavaScriptFormatter {
|
|
|
13346
13673
|
return 'ts';
|
|
13347
13674
|
}
|
|
13348
13675
|
if (AT.punctuator(token, '}')) {
|
|
13676
|
+
if (node.attributes.length > 0) {
|
|
13677
|
+
return 't';
|
|
13678
|
+
}
|
|
13349
13679
|
return node.source ? 'ts' : 't';
|
|
13350
13680
|
}
|
|
13351
13681
|
if (AT.punctuator(token, '*')) {
|
|
13352
13682
|
return 'sts';
|
|
13353
13683
|
}
|
|
13684
|
+
if (AT.keyword(token, 'with')) {
|
|
13685
|
+
return 'sts';
|
|
13686
|
+
}
|
|
13354
13687
|
return 't';
|
|
13355
13688
|
}
|
|
13356
13689
|
else if (nodeType === 'MemberExpression') {
|
|
@@ -14688,12 +15021,10 @@ class CSSFormatter {
|
|
|
14688
15021
|
#toOffset;
|
|
14689
15022
|
#fromOffset;
|
|
14690
15023
|
#lineEndings;
|
|
14691
|
-
#lastLine;
|
|
14692
|
-
#state;
|
|
15024
|
+
#lastLine = -1;
|
|
15025
|
+
#state = {};
|
|
14693
15026
|
constructor(builder) {
|
|
14694
15027
|
this.#builder = builder;
|
|
14695
|
-
this.#lastLine = -1;
|
|
14696
|
-
this.#state = {};
|
|
14697
15028
|
}
|
|
14698
15029
|
format(text, lineEndings, fromOffset, toOffset) {
|
|
14699
15030
|
this.#lineEndings = lineEndings;
|