@putout/babel 2.10.2 → 3.1.0
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 +1 -1
- package/bundle/index.d.ts +6 -4248
- package/bundle/index.js +810 -431
- package/package.json +9 -8
package/bundle/index.js
CHANGED
|
@@ -507,9 +507,9 @@ var require_picocolors = __commonJS({
|
|
|
507
507
|
module2.exports.createColors = createColors2;
|
|
508
508
|
}
|
|
509
509
|
});
|
|
510
|
-
// node_modules/js-tokens/index.js
|
|
510
|
+
// node_modules/@babel/code-frame/node_modules/js-tokens/index.js
|
|
511
511
|
var require_js_tokens = __commonJS({
|
|
512
|
-
"node_modules/js-tokens/index.js": function(exports2, module2) {
|
|
512
|
+
"node_modules/@babel/code-frame/node_modules/js-tokens/index.js": function(exports2, module2) {
|
|
513
513
|
var Identifier2;
|
|
514
514
|
var JSXIdentifier2;
|
|
515
515
|
var JSXPunctuator;
|
|
@@ -2104,12 +2104,12 @@ var require_browser = __commonJS({
|
|
|
2104
2104
|
var require_has_flag = __commonJS({
|
|
2105
2105
|
"node_modules/has-flag/index.js": function(exports2, module2) {
|
|
2106
2106
|
"use strict";
|
|
2107
|
-
module2.exports = function(flag
|
|
2108
|
-
argv =
|
|
2107
|
+
module2.exports = function(flag) {
|
|
2108
|
+
var argv = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : process.argv;
|
|
2109
2109
|
var prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
2110
|
-
var
|
|
2111
|
-
var
|
|
2112
|
-
return
|
|
2110
|
+
var position = argv.indexOf(prefix2 + flag);
|
|
2111
|
+
var terminatorPosition = argv.indexOf("--");
|
|
2112
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
2113
2113
|
};
|
|
2114
2114
|
}
|
|
2115
2115
|
});
|
|
@@ -2118,16 +2118,23 @@ var require_supports_color = __commonJS({
|
|
|
2118
2118
|
"node_modules/supports-color/index.js": function(exports2, module2) {
|
|
2119
2119
|
"use strict";
|
|
2120
2120
|
var os = require("os");
|
|
2121
|
+
var tty = require("tty");
|
|
2121
2122
|
var hasFlag = require_has_flag();
|
|
2122
2123
|
var env = process.env;
|
|
2123
2124
|
var forceColor;
|
|
2124
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
|
|
2125
|
-
forceColor =
|
|
2125
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
2126
|
+
forceColor = 0;
|
|
2126
2127
|
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
2127
|
-
forceColor =
|
|
2128
|
+
forceColor = 1;
|
|
2128
2129
|
}
|
|
2129
2130
|
if ("FORCE_COLOR" in env) {
|
|
2130
|
-
|
|
2131
|
+
if (env.FORCE_COLOR === "true") {
|
|
2132
|
+
forceColor = 1;
|
|
2133
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
2134
|
+
forceColor = 0;
|
|
2135
|
+
} else {
|
|
2136
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
2137
|
+
}
|
|
2131
2138
|
}
|
|
2132
2139
|
function translateLevel(level) {
|
|
2133
2140
|
if (level === 0) {
|
|
@@ -2140,8 +2147,8 @@ var require_supports_color = __commonJS({
|
|
|
2140
2147
|
has16m: level >= 3
|
|
2141
2148
|
};
|
|
2142
2149
|
}
|
|
2143
|
-
function supportsColor(
|
|
2144
|
-
if (forceColor ===
|
|
2150
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
2151
|
+
if (forceColor === 0) {
|
|
2145
2152
|
return 0;
|
|
2146
2153
|
}
|
|
2147
2154
|
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
@@ -2150,13 +2157,16 @@ var require_supports_color = __commonJS({
|
|
|
2150
2157
|
if (hasFlag("color=256")) {
|
|
2151
2158
|
return 2;
|
|
2152
2159
|
}
|
|
2153
|
-
if (
|
|
2160
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
2154
2161
|
return 0;
|
|
2155
2162
|
}
|
|
2156
|
-
var min = forceColor
|
|
2163
|
+
var min = forceColor || 0;
|
|
2164
|
+
if (env.TERM === "dumb") {
|
|
2165
|
+
return min;
|
|
2166
|
+
}
|
|
2157
2167
|
if (process.platform === "win32") {
|
|
2158
2168
|
var osRelease = os.release().split(".");
|
|
2159
|
-
if (Number(
|
|
2169
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
2160
2170
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
2161
2171
|
}
|
|
2162
2172
|
return 1;
|
|
@@ -2166,7 +2176,9 @@ var require_supports_color = __commonJS({
|
|
|
2166
2176
|
"TRAVIS",
|
|
2167
2177
|
"CIRCLECI",
|
|
2168
2178
|
"APPVEYOR",
|
|
2169
|
-
"GITLAB_CI"
|
|
2179
|
+
"GITLAB_CI",
|
|
2180
|
+
"GITHUB_ACTIONS",
|
|
2181
|
+
"BUILDKITE"
|
|
2170
2182
|
].some(function(sign) {
|
|
2171
2183
|
return sign in env;
|
|
2172
2184
|
}) || env.CI_NAME === "codeship") {
|
|
@@ -2198,19 +2210,16 @@ var require_supports_color = __commonJS({
|
|
|
2198
2210
|
if ("COLORTERM" in env) {
|
|
2199
2211
|
return 1;
|
|
2200
2212
|
}
|
|
2201
|
-
if (env.TERM === "dumb") {
|
|
2202
|
-
return min;
|
|
2203
|
-
}
|
|
2204
2213
|
return min;
|
|
2205
2214
|
}
|
|
2206
2215
|
function getSupportLevel(stream) {
|
|
2207
|
-
var level = supportsColor(stream);
|
|
2216
|
+
var level = supportsColor(stream, stream && stream.isTTY);
|
|
2208
2217
|
return translateLevel(level);
|
|
2209
2218
|
}
|
|
2210
2219
|
module2.exports = {
|
|
2211
2220
|
supportsColor: getSupportLevel,
|
|
2212
|
-
stdout:
|
|
2213
|
-
stderr:
|
|
2221
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
2222
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
2214
2223
|
};
|
|
2215
2224
|
}
|
|
2216
2225
|
});
|
|
@@ -5068,6 +5077,25 @@ var require_globals = __commonJS({
|
|
|
5068
5077
|
uniq: false,
|
|
5069
5078
|
which: false
|
|
5070
5079
|
},
|
|
5080
|
+
vitest: {
|
|
5081
|
+
afterAll: false,
|
|
5082
|
+
afterEach: false,
|
|
5083
|
+
assert: false,
|
|
5084
|
+
assertType: false,
|
|
5085
|
+
beforeAll: false,
|
|
5086
|
+
beforeEach: false,
|
|
5087
|
+
chai: false,
|
|
5088
|
+
describe: false,
|
|
5089
|
+
expect: false,
|
|
5090
|
+
expectTypeOf: false,
|
|
5091
|
+
it: false,
|
|
5092
|
+
onTestFailed: false,
|
|
5093
|
+
onTestFinished: false,
|
|
5094
|
+
suite: false,
|
|
5095
|
+
test: false,
|
|
5096
|
+
vi: false,
|
|
5097
|
+
vitest: false
|
|
5098
|
+
},
|
|
5071
5099
|
webextensions: {
|
|
5072
5100
|
browser: false,
|
|
5073
5101
|
chrome: false,
|
|
@@ -5400,8 +5428,8 @@ var require_globals2 = __commonJS({
|
|
|
5400
5428
|
}
|
|
5401
5429
|
});
|
|
5402
5430
|
// lib/index.mjs
|
|
5403
|
-
var
|
|
5404
|
-
__export(
|
|
5431
|
+
var index_exports = {};
|
|
5432
|
+
__export(index_exports, {
|
|
5405
5433
|
codeFrameColumns: function() {
|
|
5406
5434
|
return codeFrameColumns;
|
|
5407
5435
|
},
|
|
@@ -5427,7 +5455,7 @@ __export(lib_exports2, {
|
|
|
5427
5455
|
return lib_exports;
|
|
5428
5456
|
}
|
|
5429
5457
|
});
|
|
5430
|
-
module.exports = __toCommonJS(
|
|
5458
|
+
module.exports = __toCommonJS(index_exports);
|
|
5431
5459
|
// node_modules/@babel/types/lib/index.js
|
|
5432
5460
|
var lib_exports = {};
|
|
5433
5461
|
__export(lib_exports, {
|
|
@@ -6160,6 +6188,9 @@ __export(lib_exports, {
|
|
|
6160
6188
|
TSENTITYNAME_TYPES: function() {
|
|
6161
6189
|
return TSENTITYNAME_TYPES;
|
|
6162
6190
|
},
|
|
6191
|
+
TSEnumBody: function() {
|
|
6192
|
+
return tsEnumBody;
|
|
6193
|
+
},
|
|
6163
6194
|
TSEnumDeclaration: function() {
|
|
6164
6195
|
return tsEnumDeclaration;
|
|
6165
6196
|
},
|
|
@@ -6277,6 +6308,9 @@ __export(lib_exports, {
|
|
|
6277
6308
|
TSTYPE_TYPES: function() {
|
|
6278
6309
|
return TSTYPE_TYPES;
|
|
6279
6310
|
},
|
|
6311
|
+
TSTemplateLiteralType: function() {
|
|
6312
|
+
return tsTemplateLiteralType;
|
|
6313
|
+
},
|
|
6280
6314
|
TSThisType: function() {
|
|
6281
6315
|
return tsThisType;
|
|
6282
6316
|
},
|
|
@@ -7111,6 +7145,9 @@ __export(lib_exports, {
|
|
|
7111
7145
|
assertTSEntityName: function() {
|
|
7112
7146
|
return assertTSEntityName;
|
|
7113
7147
|
},
|
|
7148
|
+
assertTSEnumBody: function() {
|
|
7149
|
+
return assertTSEnumBody;
|
|
7150
|
+
},
|
|
7114
7151
|
assertTSEnumDeclaration: function() {
|
|
7115
7152
|
return assertTSEnumDeclaration;
|
|
7116
7153
|
},
|
|
@@ -7222,6 +7259,9 @@ __export(lib_exports, {
|
|
|
7222
7259
|
assertTSSymbolKeyword: function() {
|
|
7223
7260
|
return assertTSSymbolKeyword;
|
|
7224
7261
|
},
|
|
7262
|
+
assertTSTemplateLiteralType: function() {
|
|
7263
|
+
return assertTSTemplateLiteralType;
|
|
7264
|
+
},
|
|
7225
7265
|
assertTSThisType: function() {
|
|
7226
7266
|
return assertTSThisType;
|
|
7227
7267
|
},
|
|
@@ -8368,6 +8408,9 @@ __export(lib_exports, {
|
|
|
8368
8408
|
isTSEntityName: function() {
|
|
8369
8409
|
return isTSEntityName;
|
|
8370
8410
|
},
|
|
8411
|
+
isTSEnumBody: function() {
|
|
8412
|
+
return isTSEnumBody;
|
|
8413
|
+
},
|
|
8371
8414
|
isTSEnumDeclaration: function() {
|
|
8372
8415
|
return isTSEnumDeclaration;
|
|
8373
8416
|
},
|
|
@@ -8479,6 +8522,9 @@ __export(lib_exports, {
|
|
|
8479
8522
|
isTSSymbolKeyword: function() {
|
|
8480
8523
|
return isTSSymbolKeyword;
|
|
8481
8524
|
},
|
|
8525
|
+
isTSTemplateLiteralType: function() {
|
|
8526
|
+
return isTSTemplateLiteralType;
|
|
8527
|
+
},
|
|
8482
8528
|
isTSThisType: function() {
|
|
8483
8529
|
return isTSThisType;
|
|
8484
8530
|
},
|
|
@@ -8962,6 +9008,9 @@ __export(lib_exports, {
|
|
|
8962
9008
|
tsDeclareMethod: function() {
|
|
8963
9009
|
return tsDeclareMethod;
|
|
8964
9010
|
},
|
|
9011
|
+
tsEnumBody: function() {
|
|
9012
|
+
return tsEnumBody;
|
|
9013
|
+
},
|
|
8965
9014
|
tsEnumDeclaration: function() {
|
|
8966
9015
|
return tsEnumDeclaration;
|
|
8967
9016
|
},
|
|
@@ -9073,6 +9122,9 @@ __export(lib_exports, {
|
|
|
9073
9122
|
tsSymbolKeyword: function() {
|
|
9074
9123
|
return tsSymbolKeyword;
|
|
9075
9124
|
},
|
|
9125
|
+
tsTemplateLiteralType: function() {
|
|
9126
|
+
return tsTemplateLiteralType;
|
|
9127
|
+
},
|
|
9076
9128
|
tsThisType: function() {
|
|
9077
9129
|
return tsThisType;
|
|
9078
9130
|
},
|
|
@@ -11715,6 +11767,11 @@ function isTSMappedType(node, opts) {
|
|
|
11715
11767
|
if (node.type !== "TSMappedType") return false;
|
|
11716
11768
|
return opts == null || shallowEqual(node, opts);
|
|
11717
11769
|
}
|
|
11770
|
+
function isTSTemplateLiteralType(node, opts) {
|
|
11771
|
+
if (!node) return false;
|
|
11772
|
+
if (node.type !== "TSTemplateLiteralType") return false;
|
|
11773
|
+
return opts == null || shallowEqual(node, opts);
|
|
11774
|
+
}
|
|
11718
11775
|
function isTSLiteralType(node, opts) {
|
|
11719
11776
|
if (!node) return false;
|
|
11720
11777
|
if (node.type !== "TSLiteralType") return false;
|
|
@@ -11765,6 +11822,11 @@ function isTSTypeAssertion(node, opts) {
|
|
|
11765
11822
|
if (node.type !== "TSTypeAssertion") return false;
|
|
11766
11823
|
return opts == null || shallowEqual(node, opts);
|
|
11767
11824
|
}
|
|
11825
|
+
function isTSEnumBody(node, opts) {
|
|
11826
|
+
if (!node) return false;
|
|
11827
|
+
if (node.type !== "TSEnumBody") return false;
|
|
11828
|
+
return opts == null || shallowEqual(node, opts);
|
|
11829
|
+
}
|
|
11768
11830
|
function isTSEnumDeclaration(node, opts) {
|
|
11769
11831
|
if (!node) return false;
|
|
11770
11832
|
if (node.type !== "TSEnumDeclaration") return false;
|
|
@@ -12341,6 +12403,7 @@ function isDeclaration(node, opts) {
|
|
|
12341
12403
|
case "TSTypeAliasDeclaration":
|
|
12342
12404
|
case "TSEnumDeclaration":
|
|
12343
12405
|
case "TSModuleDeclaration":
|
|
12406
|
+
case "TSImportEqualsDeclaration":
|
|
12344
12407
|
break;
|
|
12345
12408
|
case "Placeholder":
|
|
12346
12409
|
if (node.expectedNode === "Declaration") break;
|
|
@@ -12409,6 +12472,7 @@ function isTSEntityName(node, opts) {
|
|
|
12409
12472
|
if (!node) return false;
|
|
12410
12473
|
switch(node.type){
|
|
12411
12474
|
case "Identifier":
|
|
12475
|
+
case "ThisExpression":
|
|
12412
12476
|
case "TSQualifiedName":
|
|
12413
12477
|
break;
|
|
12414
12478
|
case "Placeholder":
|
|
@@ -12853,6 +12917,7 @@ function isTypeScript(node, opts) {
|
|
|
12853
12917
|
case "TSTypeOperator":
|
|
12854
12918
|
case "TSIndexedAccessType":
|
|
12855
12919
|
case "TSMappedType":
|
|
12920
|
+
case "TSTemplateLiteralType":
|
|
12856
12921
|
case "TSLiteralType":
|
|
12857
12922
|
case "TSClassImplements":
|
|
12858
12923
|
case "TSInterfaceHeritage":
|
|
@@ -12863,6 +12928,7 @@ function isTypeScript(node, opts) {
|
|
|
12863
12928
|
case "TSAsExpression":
|
|
12864
12929
|
case "TSSatisfiesExpression":
|
|
12865
12930
|
case "TSTypeAssertion":
|
|
12931
|
+
case "TSEnumBody":
|
|
12866
12932
|
case "TSEnumDeclaration":
|
|
12867
12933
|
case "TSEnumMember":
|
|
12868
12934
|
case "TSModuleDeclaration":
|
|
@@ -12932,6 +12998,7 @@ function isTSType(node, opts) {
|
|
|
12932
12998
|
case "TSTypeOperator":
|
|
12933
12999
|
case "TSIndexedAccessType":
|
|
12934
13000
|
case "TSMappedType":
|
|
13001
|
+
case "TSTemplateLiteralType":
|
|
12935
13002
|
case "TSLiteralType":
|
|
12936
13003
|
case "TSClassImplements":
|
|
12937
13004
|
case "TSInterfaceHeritage":
|
|
@@ -12959,6 +13026,7 @@ function isTSBaseType(node, opts) {
|
|
|
12959
13026
|
case "TSUnknownKeyword":
|
|
12960
13027
|
case "TSVoidKeyword":
|
|
12961
13028
|
case "TSThisType":
|
|
13029
|
+
case "TSTemplateLiteralType":
|
|
12962
13030
|
case "TSLiteralType":
|
|
12963
13031
|
break;
|
|
12964
13032
|
default:
|
|
@@ -13842,7 +13910,6 @@ defineType$4("CallExpression", {
|
|
|
13842
13910
|
visitor: [
|
|
13843
13911
|
"callee",
|
|
13844
13912
|
"arguments",
|
|
13845
|
-
"typeParameters",
|
|
13846
13913
|
"typeArguments"
|
|
13847
13914
|
],
|
|
13848
13915
|
builder: [
|
|
@@ -13856,14 +13923,14 @@ defineType$4("CallExpression", {
|
|
|
13856
13923
|
callee: {
|
|
13857
13924
|
validate: assertNodeType("Expression", "Super", "V8IntrinsicIdentifier")
|
|
13858
13925
|
},
|
|
13859
|
-
arguments: validateArrayOfType("Expression", "SpreadElement", "ArgumentPlaceholder")
|
|
13860
|
-
}, {}, {
|
|
13926
|
+
arguments: validateArrayOfType("Expression", "SpreadElement", "ArgumentPlaceholder"),
|
|
13861
13927
|
typeArguments: {
|
|
13862
|
-
validate: assertNodeType("TypeParameterInstantiation"),
|
|
13928
|
+
validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
|
|
13863
13929
|
optional: true
|
|
13864
|
-
}
|
|
13865
|
-
|
|
13866
|
-
|
|
13930
|
+
}
|
|
13931
|
+
}, {}, process.env.BABEL_TYPES_8_BREAKING ? {} : {
|
|
13932
|
+
optional: {
|
|
13933
|
+
validate: assertValueType("boolean"),
|
|
13867
13934
|
optional: true
|
|
13868
13935
|
}
|
|
13869
13936
|
})
|
|
@@ -14104,6 +14171,7 @@ defineType$4("FunctionDeclaration", {
|
|
|
14104
14171
|
"id",
|
|
14105
14172
|
"typeParameters",
|
|
14106
14173
|
"params",
|
|
14174
|
+
"predicate",
|
|
14107
14175
|
"returnType",
|
|
14108
14176
|
"body"
|
|
14109
14177
|
],
|
|
@@ -14711,7 +14779,8 @@ defineType$4("SwitchStatement", {
|
|
|
14711
14779
|
});
|
|
14712
14780
|
defineType$4("ThisExpression", {
|
|
14713
14781
|
aliases: [
|
|
14714
|
-
"Expression"
|
|
14782
|
+
"Expression",
|
|
14783
|
+
"TSEntityName"
|
|
14715
14784
|
]
|
|
14716
14785
|
});
|
|
14717
14786
|
defineType$4("ThrowStatement", {
|
|
@@ -14961,6 +15030,7 @@ defineType$4("ArrowFunctionExpression", {
|
|
|
14961
15030
|
visitor: [
|
|
14962
15031
|
"typeParameters",
|
|
14963
15032
|
"params",
|
|
15033
|
+
"predicate",
|
|
14964
15034
|
"returnType",
|
|
14965
15035
|
"body"
|
|
14966
15036
|
],
|
|
@@ -15556,7 +15626,7 @@ defineType$4("Super", void 0);
|
|
|
15556
15626
|
defineType$4("TaggedTemplateExpression", {
|
|
15557
15627
|
visitor: [
|
|
15558
15628
|
"tag",
|
|
15559
|
-
"
|
|
15629
|
+
"typeArguments",
|
|
15560
15630
|
"quasi"
|
|
15561
15631
|
],
|
|
15562
15632
|
builder: [
|
|
@@ -15566,18 +15636,17 @@ defineType$4("TaggedTemplateExpression", {
|
|
|
15566
15636
|
aliases: [
|
|
15567
15637
|
"Expression"
|
|
15568
15638
|
],
|
|
15569
|
-
fields: {
|
|
15639
|
+
fields: _define_property({
|
|
15570
15640
|
tag: {
|
|
15571
15641
|
validate: assertNodeType("Expression")
|
|
15572
15642
|
},
|
|
15573
15643
|
quasi: {
|
|
15574
15644
|
validate: assertNodeType("TemplateLiteral")
|
|
15575
|
-
},
|
|
15576
|
-
typeParameters: {
|
|
15577
|
-
validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
|
|
15578
|
-
optional: true
|
|
15579
15645
|
}
|
|
15580
|
-
}
|
|
15646
|
+
}, "typeArguments", {
|
|
15647
|
+
validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
|
|
15648
|
+
optional: true
|
|
15649
|
+
})
|
|
15581
15650
|
});
|
|
15582
15651
|
defineType$4("TemplateElement", {
|
|
15583
15652
|
builder: [
|
|
@@ -15766,7 +15835,6 @@ defineType$4("OptionalCallExpression", {
|
|
|
15766
15835
|
visitor: [
|
|
15767
15836
|
"callee",
|
|
15768
15837
|
"arguments",
|
|
15769
|
-
"typeParameters",
|
|
15770
15838
|
"typeArguments"
|
|
15771
15839
|
],
|
|
15772
15840
|
builder: [
|
|
@@ -15777,7 +15845,7 @@ defineType$4("OptionalCallExpression", {
|
|
|
15777
15845
|
aliases: [
|
|
15778
15846
|
"Expression"
|
|
15779
15847
|
],
|
|
15780
|
-
fields: {
|
|
15848
|
+
fields: Object.assign({
|
|
15781
15849
|
callee: {
|
|
15782
15850
|
validate: assertNodeType("Expression")
|
|
15783
15851
|
},
|
|
@@ -15786,18 +15854,15 @@ defineType$4("OptionalCallExpression", {
|
|
|
15786
15854
|
validate: chain(assertValueType("boolean"), assertOptionalChainStart())
|
|
15787
15855
|
},
|
|
15788
15856
|
typeArguments: {
|
|
15789
|
-
validate: assertNodeType("TypeParameterInstantiation"),
|
|
15790
|
-
optional: true
|
|
15791
|
-
},
|
|
15792
|
-
typeParameters: {
|
|
15793
|
-
validate: assertNodeType("TSTypeParameterInstantiation"),
|
|
15857
|
+
validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
|
|
15794
15858
|
optional: true
|
|
15795
15859
|
}
|
|
15796
|
-
}
|
|
15860
|
+
}, {})
|
|
15797
15861
|
});
|
|
15798
15862
|
defineType$4("ClassProperty", {
|
|
15799
15863
|
visitor: [
|
|
15800
15864
|
"decorators",
|
|
15865
|
+
"variance",
|
|
15801
15866
|
"key",
|
|
15802
15867
|
"typeAnnotation",
|
|
15803
15868
|
"value"
|
|
@@ -15907,6 +15972,7 @@ defineType$4("ClassAccessorProperty", {
|
|
|
15907
15972
|
defineType$4("ClassPrivateProperty", {
|
|
15908
15973
|
visitor: [
|
|
15909
15974
|
"decorators",
|
|
15975
|
+
"variance",
|
|
15910
15976
|
"key",
|
|
15911
15977
|
"typeAnnotation",
|
|
15912
15978
|
"value"
|
|
@@ -15945,6 +16011,10 @@ defineType$4("ClassPrivateProperty", {
|
|
|
15945
16011
|
validate: assertValueType("boolean"),
|
|
15946
16012
|
optional: true
|
|
15947
16013
|
},
|
|
16014
|
+
optional: {
|
|
16015
|
+
validate: assertValueType("boolean"),
|
|
16016
|
+
optional: true
|
|
16017
|
+
},
|
|
15948
16018
|
definite: {
|
|
15949
16019
|
validate: assertValueType("boolean"),
|
|
15950
16020
|
optional: true
|
|
@@ -16107,9 +16177,13 @@ defineType$3("ClassImplements", {
|
|
|
16107
16177
|
});
|
|
16108
16178
|
defineInterfaceishType("DeclareClass");
|
|
16109
16179
|
defineType$3("DeclareFunction", {
|
|
16110
|
-
|
|
16180
|
+
builder: [
|
|
16111
16181
|
"id"
|
|
16112
16182
|
],
|
|
16183
|
+
visitor: [
|
|
16184
|
+
"id",
|
|
16185
|
+
"predicate"
|
|
16186
|
+
],
|
|
16113
16187
|
aliases: [
|
|
16114
16188
|
"FlowDeclaration",
|
|
16115
16189
|
"Statement",
|
|
@@ -16254,8 +16328,15 @@ defineType$3("ExistsTypeAnnotation", {
|
|
|
16254
16328
|
]
|
|
16255
16329
|
});
|
|
16256
16330
|
defineType$3("FunctionTypeAnnotation", {
|
|
16331
|
+
builder: [
|
|
16332
|
+
"typeParameters",
|
|
16333
|
+
"params",
|
|
16334
|
+
"rest",
|
|
16335
|
+
"returnType"
|
|
16336
|
+
],
|
|
16257
16337
|
visitor: [
|
|
16258
16338
|
"typeParameters",
|
|
16339
|
+
"this",
|
|
16259
16340
|
"params",
|
|
16260
16341
|
"rest",
|
|
16261
16342
|
"returnType"
|
|
@@ -16752,9 +16833,13 @@ defineType$3("EnumBooleanMember", {
|
|
|
16752
16833
|
aliases: [
|
|
16753
16834
|
"EnumMember"
|
|
16754
16835
|
],
|
|
16755
|
-
|
|
16836
|
+
builder: [
|
|
16756
16837
|
"id"
|
|
16757
16838
|
],
|
|
16839
|
+
visitor: [
|
|
16840
|
+
"id",
|
|
16841
|
+
"init"
|
|
16842
|
+
],
|
|
16758
16843
|
fields: {
|
|
16759
16844
|
id: validateType("Identifier"),
|
|
16760
16845
|
init: validateType("BooleanLiteral")
|
|
@@ -16955,12 +17040,13 @@ defineType$2("JSXOpeningElement", {
|
|
|
16955
17040
|
],
|
|
16956
17041
|
visitor: [
|
|
16957
17042
|
"name",
|
|
17043
|
+
"typeArguments",
|
|
16958
17044
|
"attributes"
|
|
16959
17045
|
],
|
|
16960
17046
|
aliases: [
|
|
16961
17047
|
"Immutable"
|
|
16962
17048
|
],
|
|
16963
|
-
fields: {
|
|
17049
|
+
fields: Object.assign({
|
|
16964
17050
|
name: {
|
|
16965
17051
|
validate: assertNodeType("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName")
|
|
16966
17052
|
},
|
|
@@ -16968,11 +17054,11 @@ defineType$2("JSXOpeningElement", {
|
|
|
16968
17054
|
default: false
|
|
16969
17055
|
},
|
|
16970
17056
|
attributes: validateArrayOfType("JSXAttribute", "JSXSpreadAttribute"),
|
|
16971
|
-
|
|
17057
|
+
typeArguments: {
|
|
16972
17058
|
validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
|
|
16973
17059
|
optional: true
|
|
16974
17060
|
}
|
|
16975
|
-
}
|
|
17061
|
+
}, {})
|
|
16976
17062
|
});
|
|
16977
17063
|
defineType$2("JSXSpreadAttribute", {
|
|
16978
17064
|
visitor: [
|
|
@@ -17382,6 +17468,7 @@ defineType("TSPropertySignature", {
|
|
|
17382
17468
|
readonly: validateOptional(bool),
|
|
17383
17469
|
typeAnnotation: validateOptionalType("TSTypeAnnotation"),
|
|
17384
17470
|
kind: {
|
|
17471
|
+
optional: true,
|
|
17385
17472
|
validate: assertOneOf("get", "set")
|
|
17386
17473
|
}
|
|
17387
17474
|
})
|
|
@@ -17522,12 +17609,11 @@ defineType("TSTypeQuery", {
|
|
|
17522
17609
|
],
|
|
17523
17610
|
visitor: [
|
|
17524
17611
|
"exprName",
|
|
17525
|
-
"
|
|
17612
|
+
"typeArguments"
|
|
17526
17613
|
],
|
|
17527
|
-
fields: {
|
|
17528
|
-
exprName: validateType("TSEntityName", "TSImportType")
|
|
17529
|
-
|
|
17530
|
-
}
|
|
17614
|
+
fields: _define_property({
|
|
17615
|
+
exprName: validateType("TSEntityName", "TSImportType")
|
|
17616
|
+
}, "typeArguments", validateOptionalType("TSTypeParameterInstantiation"))
|
|
17531
17617
|
});
|
|
17532
17618
|
defineType("TSTypeLiteral", {
|
|
17533
17619
|
aliases: [
|
|
@@ -17706,6 +17792,26 @@ defineType("TSMappedType", {
|
|
|
17706
17792
|
nameType: validateOptionalType("TSType")
|
|
17707
17793
|
})
|
|
17708
17794
|
});
|
|
17795
|
+
defineType("TSTemplateLiteralType", {
|
|
17796
|
+
aliases: [
|
|
17797
|
+
"TSType",
|
|
17798
|
+
"TSBaseType"
|
|
17799
|
+
],
|
|
17800
|
+
visitor: [
|
|
17801
|
+
"quasis",
|
|
17802
|
+
"types"
|
|
17803
|
+
],
|
|
17804
|
+
fields: {
|
|
17805
|
+
quasis: validateArrayOfType("TemplateElement"),
|
|
17806
|
+
types: {
|
|
17807
|
+
validate: chain(assertValueType("array"), assertEach(assertNodeType("TSType")), function(node, key, val) {
|
|
17808
|
+
if (node.quasis.length !== val.length + 1) {
|
|
17809
|
+
throw new TypeError("Number of ".concat(node.type, " quasis should be exactly one more than the number of types.\nExpected ").concat(val.length + 1, " quasis but got ").concat(node.quasis.length));
|
|
17810
|
+
}
|
|
17811
|
+
})
|
|
17812
|
+
}
|
|
17813
|
+
}
|
|
17814
|
+
});
|
|
17709
17815
|
defineType("TSLiteralType", {
|
|
17710
17816
|
aliases: [
|
|
17711
17817
|
"TSType",
|
|
@@ -17741,22 +17847,33 @@ defineType("TSLiteralType", {
|
|
|
17741
17847
|
}
|
|
17742
17848
|
}
|
|
17743
17849
|
});
|
|
17744
|
-
var expressionWithTypeArguments = {
|
|
17745
|
-
aliases: [
|
|
17746
|
-
"TSType"
|
|
17747
|
-
],
|
|
17748
|
-
visitor: [
|
|
17749
|
-
"expression",
|
|
17750
|
-
"typeParameters"
|
|
17751
|
-
],
|
|
17752
|
-
fields: {
|
|
17753
|
-
expression: validateType("TSEntityName"),
|
|
17754
|
-
typeParameters: validateOptionalType("TSTypeParameterInstantiation")
|
|
17755
|
-
}
|
|
17756
|
-
};
|
|
17757
17850
|
{
|
|
17758
|
-
defineType("TSClassImplements",
|
|
17759
|
-
|
|
17851
|
+
defineType("TSClassImplements", {
|
|
17852
|
+
aliases: [
|
|
17853
|
+
"TSType"
|
|
17854
|
+
],
|
|
17855
|
+
visitor: [
|
|
17856
|
+
"expression",
|
|
17857
|
+
"typeArguments"
|
|
17858
|
+
],
|
|
17859
|
+
fields: {
|
|
17860
|
+
expression: validateType("TSEntityName"),
|
|
17861
|
+
typeArguments: validateOptionalType("TSTypeParameterInstantiation")
|
|
17862
|
+
}
|
|
17863
|
+
});
|
|
17864
|
+
defineType("TSInterfaceHeritage", {
|
|
17865
|
+
aliases: [
|
|
17866
|
+
"TSType"
|
|
17867
|
+
],
|
|
17868
|
+
visitor: [
|
|
17869
|
+
"expression",
|
|
17870
|
+
"typeArguments"
|
|
17871
|
+
],
|
|
17872
|
+
fields: {
|
|
17873
|
+
expression: validateType("TSEntityName"),
|
|
17874
|
+
typeArguments: validateOptionalType("TSTypeParameterInstantiation")
|
|
17875
|
+
}
|
|
17876
|
+
});
|
|
17760
17877
|
}defineType("TSInterfaceDeclaration", {
|
|
17761
17878
|
aliases: [
|
|
17762
17879
|
"Statement",
|
|
@@ -17807,12 +17924,11 @@ defineType("TSInstantiationExpression", {
|
|
|
17807
17924
|
],
|
|
17808
17925
|
visitor: [
|
|
17809
17926
|
"expression",
|
|
17810
|
-
"
|
|
17927
|
+
"typeArguments"
|
|
17811
17928
|
],
|
|
17812
|
-
fields: {
|
|
17813
|
-
expression: validateType("Expression")
|
|
17814
|
-
|
|
17815
|
-
}
|
|
17929
|
+
fields: _define_property({
|
|
17930
|
+
expression: validateType("Expression")
|
|
17931
|
+
}, "typeArguments", validateOptionalType("TSTypeParameterInstantiation"))
|
|
17816
17932
|
});
|
|
17817
17933
|
var TSTypeExpression = {
|
|
17818
17934
|
aliases: [
|
|
@@ -17846,24 +17962,32 @@ defineType("TSTypeAssertion", {
|
|
|
17846
17962
|
expression: validateType("Expression")
|
|
17847
17963
|
}
|
|
17848
17964
|
});
|
|
17849
|
-
defineType("
|
|
17850
|
-
aliases: [
|
|
17851
|
-
"Statement",
|
|
17852
|
-
"Declaration"
|
|
17853
|
-
],
|
|
17965
|
+
defineType("TSEnumBody", {
|
|
17854
17966
|
visitor: [
|
|
17855
|
-
"id",
|
|
17856
17967
|
"members"
|
|
17857
17968
|
],
|
|
17858
17969
|
fields: {
|
|
17859
|
-
|
|
17860
|
-
const: validateOptional(bool),
|
|
17861
|
-
id: validateType("Identifier"),
|
|
17862
|
-
members: validateArrayOfType("TSEnumMember"),
|
|
17863
|
-
initializer: validateOptionalType("Expression")
|
|
17970
|
+
members: validateArrayOfType("TSEnumMember")
|
|
17864
17971
|
}
|
|
17865
17972
|
});
|
|
17866
|
-
|
|
17973
|
+
{
|
|
17974
|
+
defineType("TSEnumDeclaration", {
|
|
17975
|
+
aliases: [
|
|
17976
|
+
"Statement",
|
|
17977
|
+
"Declaration"
|
|
17978
|
+
],
|
|
17979
|
+
visitor: [
|
|
17980
|
+
"id",
|
|
17981
|
+
"body"
|
|
17982
|
+
],
|
|
17983
|
+
fields: {
|
|
17984
|
+
declare: validateOptional(bool),
|
|
17985
|
+
const: validateOptional(bool),
|
|
17986
|
+
id: validateType("Identifier"),
|
|
17987
|
+
body: validateType("TSEnumBody")
|
|
17988
|
+
}
|
|
17989
|
+
});
|
|
17990
|
+
}defineType("TSEnumMember", {
|
|
17867
17991
|
visitor: [
|
|
17868
17992
|
"id",
|
|
17869
17993
|
"initializer"
|
|
@@ -17906,42 +18030,47 @@ defineType("TSModuleBlock", {
|
|
|
17906
18030
|
body: validateArrayOfType("Statement")
|
|
17907
18031
|
}
|
|
17908
18032
|
});
|
|
18033
|
+
var _obj2;
|
|
17909
18034
|
defineType("TSImportType", {
|
|
17910
18035
|
aliases: [
|
|
17911
18036
|
"TSType"
|
|
17912
18037
|
],
|
|
18038
|
+
builder: [
|
|
18039
|
+
"argument",
|
|
18040
|
+
"qualifier",
|
|
18041
|
+
"typeArguments"
|
|
18042
|
+
],
|
|
17913
18043
|
visitor: [
|
|
17914
18044
|
"argument",
|
|
18045
|
+
"options",
|
|
17915
18046
|
"qualifier",
|
|
17916
|
-
"
|
|
18047
|
+
"typeArguments"
|
|
17917
18048
|
],
|
|
17918
|
-
fields: {
|
|
17919
|
-
argument: validateType("
|
|
17920
|
-
qualifier: validateOptionalType("TSEntityName")
|
|
17921
|
-
|
|
17922
|
-
|
|
17923
|
-
|
|
17924
|
-
|
|
17925
|
-
}
|
|
17926
|
-
}
|
|
18049
|
+
fields: (_obj2 = {
|
|
18050
|
+
argument: validateType("TSLiteralType"),
|
|
18051
|
+
qualifier: validateOptionalType("TSEntityName")
|
|
18052
|
+
}, _define_property(_obj2, "typeArguments", validateOptionalType("TSTypeParameterInstantiation")), _define_property(_obj2, "options", {
|
|
18053
|
+
validate: assertNodeType("Expression"),
|
|
18054
|
+
optional: true
|
|
18055
|
+
}), _obj2)
|
|
17927
18056
|
});
|
|
17928
18057
|
defineType("TSImportEqualsDeclaration", {
|
|
17929
18058
|
aliases: [
|
|
17930
|
-
"Statement"
|
|
18059
|
+
"Statement",
|
|
18060
|
+
"Declaration"
|
|
17931
18061
|
],
|
|
17932
18062
|
visitor: [
|
|
17933
18063
|
"id",
|
|
17934
18064
|
"moduleReference"
|
|
17935
18065
|
],
|
|
17936
|
-
fields: {
|
|
17937
|
-
isExport: validate$2(bool),
|
|
18066
|
+
fields: Object.assign({}, {}, {
|
|
17938
18067
|
id: validateType("Identifier"),
|
|
17939
18068
|
moduleReference: validateType("TSEntityName", "TSExternalModuleReference"),
|
|
17940
18069
|
importKind: {
|
|
17941
18070
|
validate: assertOneOf("type", "value"),
|
|
17942
18071
|
optional: true
|
|
17943
18072
|
}
|
|
17944
|
-
}
|
|
18073
|
+
})
|
|
17945
18074
|
});
|
|
17946
18075
|
defineType("TSExternalModuleReference", {
|
|
17947
18076
|
visitor: [
|
|
@@ -18019,6 +18148,7 @@ defineType("TSTypeParameter", {
|
|
|
18019
18148
|
"name"
|
|
18020
18149
|
],
|
|
18021
18150
|
visitor: [
|
|
18151
|
+
"name",
|
|
18022
18152
|
"constraint",
|
|
18023
18153
|
"default"
|
|
18024
18154
|
],
|
|
@@ -20163,8 +20293,7 @@ function tsPropertySignature(key) {
|
|
|
20163
20293
|
var node = {
|
|
20164
20294
|
type: "TSPropertySignature",
|
|
20165
20295
|
key: key,
|
|
20166
|
-
typeAnnotation: typeAnnotation2
|
|
20167
|
-
kind: null
|
|
20296
|
+
typeAnnotation: typeAnnotation2
|
|
20168
20297
|
};
|
|
20169
20298
|
var defs = NODE_FIELDS.TSPropertySignature;
|
|
20170
20299
|
validate(defs.key, node, "key", key, 1);
|
|
@@ -20325,15 +20454,15 @@ function tsTypePredicate(parameterName) {
|
|
|
20325
20454
|
return node;
|
|
20326
20455
|
}
|
|
20327
20456
|
function tsTypeQuery(exprName) {
|
|
20328
|
-
var
|
|
20457
|
+
var typeArguments = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
20329
20458
|
var node = {
|
|
20330
20459
|
type: "TSTypeQuery",
|
|
20331
20460
|
exprName: exprName,
|
|
20332
|
-
|
|
20461
|
+
typeArguments: typeArguments
|
|
20333
20462
|
};
|
|
20334
20463
|
var defs = NODE_FIELDS.TSTypeQuery;
|
|
20335
20464
|
validate(defs.exprName, node, "exprName", exprName, 1);
|
|
20336
|
-
validate(defs.
|
|
20465
|
+
validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
|
|
20337
20466
|
return node;
|
|
20338
20467
|
}
|
|
20339
20468
|
function tsTypeLiteral(members) {
|
|
@@ -20483,6 +20612,17 @@ function tsMappedType(key, constraint) {
|
|
|
20483
20612
|
validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation2, 1);
|
|
20484
20613
|
return node;
|
|
20485
20614
|
}
|
|
20615
|
+
function tsTemplateLiteralType(quasis, types2) {
|
|
20616
|
+
var node = {
|
|
20617
|
+
type: "TSTemplateLiteralType",
|
|
20618
|
+
quasis: quasis,
|
|
20619
|
+
types: types2
|
|
20620
|
+
};
|
|
20621
|
+
var defs = NODE_FIELDS.TSTemplateLiteralType;
|
|
20622
|
+
validate(defs.quasis, node, "quasis", quasis, 1);
|
|
20623
|
+
validate(defs.types, node, "types", types2, 1);
|
|
20624
|
+
return node;
|
|
20625
|
+
}
|
|
20486
20626
|
function tsLiteralType(literal) {
|
|
20487
20627
|
var node = {
|
|
20488
20628
|
type: "TSLiteralType",
|
|
@@ -20493,27 +20633,27 @@ function tsLiteralType(literal) {
|
|
|
20493
20633
|
return node;
|
|
20494
20634
|
}
|
|
20495
20635
|
function tsClassImplements(expression2) {
|
|
20496
|
-
var
|
|
20636
|
+
var typeArguments = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
20497
20637
|
var node = {
|
|
20498
20638
|
type: "TSClassImplements",
|
|
20499
20639
|
expression: expression2,
|
|
20500
|
-
|
|
20640
|
+
typeArguments: typeArguments
|
|
20501
20641
|
};
|
|
20502
20642
|
var defs = NODE_FIELDS.TSClassImplements;
|
|
20503
20643
|
validate(defs.expression, node, "expression", expression2, 1);
|
|
20504
|
-
validate(defs.
|
|
20644
|
+
validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
|
|
20505
20645
|
return node;
|
|
20506
20646
|
}
|
|
20507
20647
|
function tsInterfaceHeritage(expression2) {
|
|
20508
|
-
var
|
|
20648
|
+
var typeArguments = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
20509
20649
|
var node = {
|
|
20510
20650
|
type: "TSInterfaceHeritage",
|
|
20511
20651
|
expression: expression2,
|
|
20512
|
-
|
|
20652
|
+
typeArguments: typeArguments
|
|
20513
20653
|
};
|
|
20514
20654
|
var defs = NODE_FIELDS.TSInterfaceHeritage;
|
|
20515
20655
|
validate(defs.expression, node, "expression", expression2, 1);
|
|
20516
|
-
validate(defs.
|
|
20656
|
+
validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
|
|
20517
20657
|
return node;
|
|
20518
20658
|
}
|
|
20519
20659
|
function tsInterfaceDeclaration(id) {
|
|
@@ -20556,15 +20696,15 @@ function tsTypeAliasDeclaration(id) {
|
|
|
20556
20696
|
return node;
|
|
20557
20697
|
}
|
|
20558
20698
|
function tsInstantiationExpression(expression2) {
|
|
20559
|
-
var
|
|
20699
|
+
var typeArguments = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
20560
20700
|
var node = {
|
|
20561
20701
|
type: "TSInstantiationExpression",
|
|
20562
20702
|
expression: expression2,
|
|
20563
|
-
|
|
20703
|
+
typeArguments: typeArguments
|
|
20564
20704
|
};
|
|
20565
20705
|
var defs = NODE_FIELDS.TSInstantiationExpression;
|
|
20566
20706
|
validate(defs.expression, node, "expression", expression2, 1);
|
|
20567
|
-
validate(defs.
|
|
20707
|
+
validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
|
|
20568
20708
|
return node;
|
|
20569
20709
|
}
|
|
20570
20710
|
function tsAsExpression(expression2, typeAnnotation2) {
|
|
@@ -20600,15 +20740,24 @@ function tsTypeAssertion(typeAnnotation2, expression2) {
|
|
|
20600
20740
|
validate(defs.expression, node, "expression", expression2, 1);
|
|
20601
20741
|
return node;
|
|
20602
20742
|
}
|
|
20603
|
-
function
|
|
20743
|
+
function tsEnumBody(members) {
|
|
20744
|
+
var node = {
|
|
20745
|
+
type: "TSEnumBody",
|
|
20746
|
+
members: members
|
|
20747
|
+
};
|
|
20748
|
+
var defs = NODE_FIELDS.TSEnumBody;
|
|
20749
|
+
validate(defs.members, node, "members", members, 1);
|
|
20750
|
+
return node;
|
|
20751
|
+
}
|
|
20752
|
+
function tsEnumDeclaration(id, body) {
|
|
20604
20753
|
var node = {
|
|
20605
20754
|
type: "TSEnumDeclaration",
|
|
20606
20755
|
id: id,
|
|
20607
|
-
|
|
20756
|
+
body: body
|
|
20608
20757
|
};
|
|
20609
20758
|
var defs = NODE_FIELDS.TSEnumDeclaration;
|
|
20610
20759
|
validate(defs.id, node, "id", id, 1);
|
|
20611
|
-
validate(defs.
|
|
20760
|
+
validate(defs.body, node, "body", body, 1);
|
|
20612
20761
|
return node;
|
|
20613
20762
|
}
|
|
20614
20763
|
function tsEnumMember(id) {
|
|
@@ -20645,25 +20794,24 @@ function tsModuleBlock(body) {
|
|
|
20645
20794
|
return node;
|
|
20646
20795
|
}
|
|
20647
20796
|
function tsImportType(argument) {
|
|
20648
|
-
var qualifier = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null,
|
|
20797
|
+
var qualifier = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, typeArguments = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
|
|
20649
20798
|
var node = {
|
|
20650
20799
|
type: "TSImportType",
|
|
20651
20800
|
argument: argument,
|
|
20652
20801
|
qualifier: qualifier,
|
|
20653
|
-
|
|
20802
|
+
typeArguments: typeArguments
|
|
20654
20803
|
};
|
|
20655
20804
|
var defs = NODE_FIELDS.TSImportType;
|
|
20656
20805
|
validate(defs.argument, node, "argument", argument, 1);
|
|
20657
20806
|
validate(defs.qualifier, node, "qualifier", qualifier, 1);
|
|
20658
|
-
validate(defs.
|
|
20807
|
+
validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
|
|
20659
20808
|
return node;
|
|
20660
20809
|
}
|
|
20661
20810
|
function tsImportEqualsDeclaration(id, moduleReference) {
|
|
20662
20811
|
var node = {
|
|
20663
20812
|
type: "TSImportEqualsDeclaration",
|
|
20664
20813
|
id: id,
|
|
20665
|
-
moduleReference: moduleReference
|
|
20666
|
-
isExport: null
|
|
20814
|
+
moduleReference: moduleReference
|
|
20667
20815
|
};
|
|
20668
20816
|
var defs = NODE_FIELDS.TSImportEqualsDeclaration;
|
|
20669
20817
|
validate(defs.id, node, "id", id, 1);
|
|
@@ -21498,6 +21646,9 @@ function assertTSIndexedAccessType(node, opts) {
|
|
|
21498
21646
|
function assertTSMappedType(node, opts) {
|
|
21499
21647
|
assert("TSMappedType", node, opts);
|
|
21500
21648
|
}
|
|
21649
|
+
function assertTSTemplateLiteralType(node, opts) {
|
|
21650
|
+
assert("TSTemplateLiteralType", node, opts);
|
|
21651
|
+
}
|
|
21501
21652
|
function assertTSLiteralType(node, opts) {
|
|
21502
21653
|
assert("TSLiteralType", node, opts);
|
|
21503
21654
|
}
|
|
@@ -21528,6 +21679,9 @@ function assertTSSatisfiesExpression(node, opts) {
|
|
|
21528
21679
|
function assertTSTypeAssertion(node, opts) {
|
|
21529
21680
|
assert("TSTypeAssertion", node, opts);
|
|
21530
21681
|
}
|
|
21682
|
+
function assertTSEnumBody(node, opts) {
|
|
21683
|
+
assert("TSEnumBody", node, opts);
|
|
21684
|
+
}
|
|
21531
21685
|
function assertTSEnumDeclaration(node, opts) {
|
|
21532
21686
|
assert("TSEnumDeclaration", node, opts);
|
|
21533
21687
|
}
|
|
@@ -21861,7 +22015,7 @@ function createFlowUnionType(types2) {
|
|
|
21861
22015
|
}
|
|
21862
22016
|
}
|
|
21863
22017
|
function getQualifiedName(node) {
|
|
21864
|
-
return isIdentifier(node) ? node.name : "".concat(node.right.name, ".").concat(getQualifiedName(node.left));
|
|
22018
|
+
return isIdentifier(node) ? node.name : isThisExpression(node) ? "this" : "".concat(node.right.name, ".").concat(getQualifiedName(node.left));
|
|
21865
22019
|
}
|
|
21866
22020
|
function removeTypeDuplicates(nodesIn) {
|
|
21867
22021
|
var nodes2 = Array.from(nodesIn);
|
|
@@ -22772,6 +22926,9 @@ var keys = {
|
|
|
22772
22926
|
ImportDeclaration: [
|
|
22773
22927
|
"specifiers"
|
|
22774
22928
|
],
|
|
22929
|
+
TSImportEqualsDeclaration: [
|
|
22930
|
+
"id"
|
|
22931
|
+
],
|
|
22775
22932
|
ExportSpecifier: [
|
|
22776
22933
|
"exported"
|
|
22777
22934
|
],
|
|
@@ -23552,9 +23709,9 @@ var UnparenthesizedPipeBodyDescriptions = /* @__PURE__ */ new Set([
|
|
|
23552
23709
|
"ConditionalExpression",
|
|
23553
23710
|
"YieldExpression"
|
|
23554
23711
|
]);
|
|
23555
|
-
var PipelineOperatorErrors = {
|
|
23712
|
+
var PipelineOperatorErrors = Object.assign({
|
|
23556
23713
|
PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
|
|
23557
|
-
PipeTopicRequiresHackPipes: 'Topic
|
|
23714
|
+
PipeTopicRequiresHackPipes: 'Topic references are only supported when using the `"proposal": "hack"` version of the pipeline proposal.',
|
|
23558
23715
|
PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
|
|
23559
23716
|
PipeTopicUnconfiguredToken: function(param) {
|
|
23560
23717
|
var token = param.token;
|
|
@@ -23566,14 +23723,8 @@ var PipelineOperatorErrors = {
|
|
|
23566
23723
|
return "Hack-style pipe body cannot be an unparenthesized ".concat(toNodeDescription({
|
|
23567
23724
|
type: type
|
|
23568
23725
|
}), "; please wrap it in parentheses.");
|
|
23569
|
-
}
|
|
23570
|
-
|
|
23571
|
-
PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression.",
|
|
23572
|
-
PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression.",
|
|
23573
|
-
PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference.",
|
|
23574
|
-
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
|
23575
|
-
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
|
23576
|
-
};
|
|
23726
|
+
}
|
|
23727
|
+
}, {});
|
|
23577
23728
|
var _excluded = [
|
|
23578
23729
|
"message"
|
|
23579
23730
|
];
|
|
@@ -23669,6 +23820,71 @@ function ParseErrorEnum(argument, syntaxPlugin) {
|
|
|
23669
23820
|
return ParseErrorConstructors;
|
|
23670
23821
|
}
|
|
23671
23822
|
var Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(_templateObject())(PipelineOperatorErrors));
|
|
23823
|
+
function createDefaultOptions() {
|
|
23824
|
+
return {
|
|
23825
|
+
sourceType: "script",
|
|
23826
|
+
sourceFilename: void 0,
|
|
23827
|
+
startIndex: 0,
|
|
23828
|
+
startColumn: 0,
|
|
23829
|
+
startLine: 1,
|
|
23830
|
+
allowAwaitOutsideFunction: false,
|
|
23831
|
+
allowReturnOutsideFunction: false,
|
|
23832
|
+
allowNewTargetOutsideFunction: false,
|
|
23833
|
+
allowImportExportEverywhere: false,
|
|
23834
|
+
allowSuperOutsideMethod: false,
|
|
23835
|
+
allowUndeclaredExports: false,
|
|
23836
|
+
plugins: [],
|
|
23837
|
+
strictMode: null,
|
|
23838
|
+
ranges: false,
|
|
23839
|
+
tokens: false,
|
|
23840
|
+
createImportExpressions: true,
|
|
23841
|
+
createParenthesizedExpressions: false,
|
|
23842
|
+
errorRecovery: false,
|
|
23843
|
+
attachComment: true,
|
|
23844
|
+
annexB: true
|
|
23845
|
+
};
|
|
23846
|
+
}
|
|
23847
|
+
function getOptions(opts) {
|
|
23848
|
+
var options = createDefaultOptions();
|
|
23849
|
+
if (opts == null) {
|
|
23850
|
+
return options;
|
|
23851
|
+
}
|
|
23852
|
+
if (opts.annexB != null && opts.annexB !== false) {
|
|
23853
|
+
throw new Error("The `annexB` option can only be set to `false`.");
|
|
23854
|
+
}
|
|
23855
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
23856
|
+
try {
|
|
23857
|
+
for(var _iterator = Object.keys(options)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
23858
|
+
var key = _step.value;
|
|
23859
|
+
if (opts[key] != null) options[key] = opts[key];
|
|
23860
|
+
}
|
|
23861
|
+
} catch (err) {
|
|
23862
|
+
_didIteratorError = true;
|
|
23863
|
+
_iteratorError = err;
|
|
23864
|
+
} finally{
|
|
23865
|
+
try {
|
|
23866
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
23867
|
+
_iterator.return();
|
|
23868
|
+
}
|
|
23869
|
+
} finally{
|
|
23870
|
+
if (_didIteratorError) {
|
|
23871
|
+
throw _iteratorError;
|
|
23872
|
+
}
|
|
23873
|
+
}
|
|
23874
|
+
}
|
|
23875
|
+
if (options.startLine === 1) {
|
|
23876
|
+
if (opts.startIndex == null && options.startColumn > 0) {
|
|
23877
|
+
options.startIndex = options.startColumn;
|
|
23878
|
+
} else if (opts.startColumn == null && options.startIndex > 0) {
|
|
23879
|
+
options.startColumn = options.startIndex;
|
|
23880
|
+
}
|
|
23881
|
+
} else if (opts.startColumn == null || opts.startIndex == null) {
|
|
23882
|
+
{
|
|
23883
|
+
throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
|
|
23884
|
+
}
|
|
23885
|
+
}
|
|
23886
|
+
return options;
|
|
23887
|
+
}
|
|
23672
23888
|
var defineProperty = Object.defineProperty;
|
|
23673
23889
|
var toUnenumerable = function(object, key) {
|
|
23674
23890
|
if (object) {
|
|
@@ -23696,7 +23912,7 @@ var estree = function(superClass) {
|
|
|
23696
23912
|
key: "parse",
|
|
23697
23913
|
value: function parse() {
|
|
23698
23914
|
var file2 = toESTreeLocation(_get(_get_prototype_of(ESTreeParserMixin.prototype), "parse", this).call(this));
|
|
23699
|
-
if (this.
|
|
23915
|
+
if (this.optionFlags & 128) {
|
|
23700
23916
|
file2.tokens = file2.tokens.map(toESTreeLocation);
|
|
23701
23917
|
}
|
|
23702
23918
|
return file2;
|
|
@@ -23829,21 +24045,6 @@ var estree = function(superClass) {
|
|
|
23829
24045
|
delete node.directives;
|
|
23830
24046
|
}
|
|
23831
24047
|
},
|
|
23832
|
-
{
|
|
23833
|
-
key: "pushClassMethod",
|
|
23834
|
-
value: function pushClassMethod(classBody2, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
23835
|
-
this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true);
|
|
23836
|
-
var typeParameters = method.typeParameters;
|
|
23837
|
-
if (typeParameters) {
|
|
23838
|
-
delete method.typeParameters;
|
|
23839
|
-
var fn = method.value;
|
|
23840
|
-
fn.typeParameters = typeParameters;
|
|
23841
|
-
fn.start = typeParameters.start;
|
|
23842
|
-
fn.loc.start = typeParameters.loc.start;
|
|
23843
|
-
}
|
|
23844
|
-
classBody2.body.push(method);
|
|
23845
|
-
}
|
|
23846
|
-
},
|
|
23847
24048
|
{
|
|
23848
24049
|
key: "parsePrivateName",
|
|
23849
24050
|
value: function parsePrivateName() {
|
|
@@ -23901,9 +24102,23 @@ var estree = function(superClass) {
|
|
|
23901
24102
|
funcNode.type = "FunctionExpression";
|
|
23902
24103
|
delete funcNode.kind;
|
|
23903
24104
|
node.value = funcNode;
|
|
24105
|
+
var typeParameters = node.typeParameters;
|
|
24106
|
+
if (typeParameters) {
|
|
24107
|
+
delete node.typeParameters;
|
|
24108
|
+
funcNode.typeParameters = typeParameters;
|
|
24109
|
+
this.resetStartLocationFromNode(funcNode, typeParameters);
|
|
24110
|
+
}
|
|
23904
24111
|
if (type === "ClassPrivateMethod") {
|
|
23905
24112
|
node.computed = false;
|
|
23906
24113
|
}
|
|
24114
|
+
if (this.hasPlugin("typescript")) {
|
|
24115
|
+
if (!funcNode.body) {
|
|
24116
|
+
funcNode.type = "TSEmptyBodyFunctionExpression";
|
|
24117
|
+
}
|
|
24118
|
+
if (node.abstract) {
|
|
24119
|
+
return this.finishNode(node, "TSAbstractMethodDefinition");
|
|
24120
|
+
}
|
|
24121
|
+
}
|
|
23907
24122
|
return this.finishNode(node, "MethodDefinition");
|
|
23908
24123
|
}
|
|
23909
24124
|
},
|
|
@@ -23924,7 +24139,11 @@ var estree = function(superClass) {
|
|
|
23924
24139
|
var propertyNode = (_$_get = _get(_get_prototype_of(ESTreeParserMixin.prototype), "parseClassProperty", this)).call.apply(_$_get, [
|
|
23925
24140
|
this
|
|
23926
24141
|
].concat(_to_consumable_array(args)));
|
|
23927
|
-
propertyNode.
|
|
24142
|
+
if (propertyNode.abstract && this.hasPlugin("typescript")) {
|
|
24143
|
+
propertyNode.type = "TSAbstractPropertyDefinition";
|
|
24144
|
+
} else {
|
|
24145
|
+
propertyNode.type = "PropertyDefinition";
|
|
24146
|
+
}
|
|
23928
24147
|
return propertyNode;
|
|
23929
24148
|
}
|
|
23930
24149
|
},
|
|
@@ -23938,7 +24157,11 @@ var estree = function(superClass) {
|
|
|
23938
24157
|
var propertyNode = (_$_get = _get(_get_prototype_of(ESTreeParserMixin.prototype), "parseClassPrivateProperty", this)).call.apply(_$_get, [
|
|
23939
24158
|
this
|
|
23940
24159
|
].concat(_to_consumable_array(args)));
|
|
23941
|
-
propertyNode.
|
|
24160
|
+
if (propertyNode.abstract && this.hasPlugin("typescript")) {
|
|
24161
|
+
propertyNode.type = "TSAbstractPropertyDefinition";
|
|
24162
|
+
} else {
|
|
24163
|
+
propertyNode.type = "PropertyDefinition";
|
|
24164
|
+
}
|
|
23942
24165
|
propertyNode.computed = false;
|
|
23943
24166
|
return propertyNode;
|
|
23944
24167
|
}
|
|
@@ -26244,6 +26467,14 @@ var CommentsParser = /*#__PURE__*/ function(BaseParser) {
|
|
|
26244
26467
|
case "ImportDeclaration":
|
|
26245
26468
|
adjustInnerComments(node, node.specifiers, commentWS);
|
|
26246
26469
|
break;
|
|
26470
|
+
case "TSEnumDeclaration":
|
|
26471
|
+
{
|
|
26472
|
+
setInnerComments(node, comments);
|
|
26473
|
+
}
|
|
26474
|
+
break;
|
|
26475
|
+
case "TSEnumBody":
|
|
26476
|
+
adjustInnerComments(node, node.members, commentWS);
|
|
26477
|
+
break;
|
|
26247
26478
|
default:
|
|
26248
26479
|
{
|
|
26249
26480
|
setInnerComments(node, comments);
|
|
@@ -26910,7 +27141,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
26910
27141
|
__publicField(_this, "tokens", []);
|
|
26911
27142
|
__publicField(_this, "errorHandlers_readInt", {
|
|
26912
27143
|
invalidDigit: function(pos, lineStart, curLine, radix) {
|
|
26913
|
-
if (!_this.
|
|
27144
|
+
if (!(_this.optionFlags & 1024)) return false;
|
|
26914
27145
|
_this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
|
|
26915
27146
|
radix: radix
|
|
26916
27147
|
});
|
|
@@ -26958,7 +27189,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
26958
27189
|
key: "next",
|
|
26959
27190
|
value: function next() {
|
|
26960
27191
|
this.checkKeywordEscapes();
|
|
26961
|
-
if (this.
|
|
27192
|
+
if (this.optionFlags & 128) {
|
|
26962
27193
|
this.pushToken(new Token(this.state));
|
|
26963
27194
|
}
|
|
26964
27195
|
this.state.lastTokEndLoc = this.state.endLoc;
|
|
@@ -27125,7 +27356,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
27125
27356
|
end: this.sourceToOffsetPos(end + commentEnd.length),
|
|
27126
27357
|
loc: new SourceLocation(startLoc, this.state.curPosition())
|
|
27127
27358
|
};
|
|
27128
|
-
if (this.
|
|
27359
|
+
if (this.optionFlags & 128) this.pushToken(comment);
|
|
27129
27360
|
return comment;
|
|
27130
27361
|
}
|
|
27131
27362
|
},
|
|
@@ -27151,7 +27382,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
27151
27382
|
end: this.sourceToOffsetPos(end),
|
|
27152
27383
|
loc: new SourceLocation(startLoc, this.state.curPosition())
|
|
27153
27384
|
};
|
|
27154
|
-
if (this.
|
|
27385
|
+
if (this.optionFlags & 128) this.pushToken(comment);
|
|
27155
27386
|
return comment;
|
|
27156
27387
|
}
|
|
27157
27388
|
},
|
|
@@ -27159,7 +27390,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
27159
27390
|
key: "skipSpace",
|
|
27160
27391
|
value: function skipSpace() {
|
|
27161
27392
|
var spaceStart = this.state.pos;
|
|
27162
|
-
var comments = [];
|
|
27393
|
+
var comments = this.optionFlags & 2048 ? [] : null;
|
|
27163
27394
|
loop: while(this.state.pos < this.length){
|
|
27164
27395
|
var ch = this.input.charCodeAt(this.state.pos);
|
|
27165
27396
|
switch(ch){
|
|
@@ -27186,7 +27417,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
27186
27417
|
var comment = this.skipBlockComment("*/");
|
|
27187
27418
|
if (comment !== void 0) {
|
|
27188
27419
|
this.addComment(comment);
|
|
27189
|
-
|
|
27420
|
+
comments === null || comments === void 0 ? void 0 : comments.push(comment);
|
|
27190
27421
|
}
|
|
27191
27422
|
break;
|
|
27192
27423
|
}
|
|
@@ -27195,7 +27426,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
27195
27426
|
var comment1 = this.skipLineComment(2);
|
|
27196
27427
|
if (comment1 !== void 0) {
|
|
27197
27428
|
this.addComment(comment1);
|
|
27198
|
-
|
|
27429
|
+
comments === null || comments === void 0 ? void 0 : comments.push(comment1);
|
|
27199
27430
|
}
|
|
27200
27431
|
break;
|
|
27201
27432
|
}
|
|
@@ -27206,24 +27437,24 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
27206
27437
|
default:
|
|
27207
27438
|
if (isWhitespace(ch)) {
|
|
27208
27439
|
++this.state.pos;
|
|
27209
|
-
} else if (ch === 45 && !this.inModule && this.
|
|
27440
|
+
} else if (ch === 45 && !this.inModule && this.optionFlags & 4096) {
|
|
27210
27441
|
var pos = this.state.pos;
|
|
27211
27442
|
if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) {
|
|
27212
27443
|
var comment2 = this.skipLineComment(3);
|
|
27213
27444
|
if (comment2 !== void 0) {
|
|
27214
27445
|
this.addComment(comment2);
|
|
27215
|
-
|
|
27446
|
+
comments === null || comments === void 0 ? void 0 : comments.push(comment2);
|
|
27216
27447
|
}
|
|
27217
27448
|
} else {
|
|
27218
27449
|
break loop;
|
|
27219
27450
|
}
|
|
27220
|
-
} else if (ch === 60 && !this.inModule && this.
|
|
27451
|
+
} else if (ch === 60 && !this.inModule && this.optionFlags & 4096) {
|
|
27221
27452
|
var pos1 = this.state.pos;
|
|
27222
27453
|
if (this.input.charCodeAt(pos1 + 1) === 33 && this.input.charCodeAt(pos1 + 2) === 45 && this.input.charCodeAt(pos1 + 3) === 45) {
|
|
27223
27454
|
var comment3 = this.skipLineComment(4);
|
|
27224
27455
|
if (comment3 !== void 0) {
|
|
27225
27456
|
this.addComment(comment3);
|
|
27226
|
-
|
|
27457
|
+
comments === null || comments === void 0 ? void 0 : comments.push(comment3);
|
|
27227
27458
|
}
|
|
27228
27459
|
} else {
|
|
27229
27460
|
break loop;
|
|
@@ -27233,7 +27464,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
27233
27464
|
}
|
|
27234
27465
|
}
|
|
27235
27466
|
}
|
|
27236
|
-
if (comments.length > 0) {
|
|
27467
|
+
if ((comments === null || comments === void 0 ? void 0 : comments.length) > 0) {
|
|
27237
27468
|
var end = this.state.pos;
|
|
27238
27469
|
var commentWhitespace = {
|
|
27239
27470
|
start: this.sourceToOffsetPos(spaceStart),
|
|
@@ -27958,7 +28189,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
27958
28189
|
var details = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
27959
28190
|
var loc = _instanceof(at, Position) ? at : at.loc.start;
|
|
27960
28191
|
var error = toParseError(loc, details);
|
|
27961
|
-
if (!this.
|
|
28192
|
+
if (!(this.optionFlags & 1024)) throw error;
|
|
27962
28193
|
if (!this.isLookahead) this.state.errors.push(error);
|
|
27963
28194
|
return error;
|
|
27964
28195
|
}
|
|
@@ -28675,7 +28906,7 @@ var Node = function Node(parser, pos, loc) {
|
|
|
28675
28906
|
this.start = pos;
|
|
28676
28907
|
this.end = 0;
|
|
28677
28908
|
this.loc = new SourceLocation(loc);
|
|
28678
|
-
if (parser === null || parser === void 0 ? void 0 : parser.
|
|
28909
|
+
if ((parser === null || parser === void 0 ? void 0 : parser.optionFlags) & 64) this.range = [
|
|
28679
28910
|
pos,
|
|
28680
28911
|
0
|
|
28681
28912
|
];
|
|
@@ -28758,8 +28989,10 @@ var NodeUtils = /*#__PURE__*/ function(UtilParser) {
|
|
|
28758
28989
|
node.type = type;
|
|
28759
28990
|
node.end = endLoc.index;
|
|
28760
28991
|
node.loc.end = endLoc;
|
|
28761
|
-
if (this.
|
|
28762
|
-
if (this.
|
|
28992
|
+
if (this.optionFlags & 64) node.range[1] = endLoc.index;
|
|
28993
|
+
if (this.optionFlags & 2048) {
|
|
28994
|
+
this.processComment(node);
|
|
28995
|
+
}
|
|
28763
28996
|
return node;
|
|
28764
28997
|
}
|
|
28765
28998
|
},
|
|
@@ -28768,7 +29001,7 @@ var NodeUtils = /*#__PURE__*/ function(UtilParser) {
|
|
|
28768
29001
|
value: function resetStartLocation(node, startLoc) {
|
|
28769
29002
|
node.start = startLoc.index;
|
|
28770
29003
|
node.loc.start = startLoc;
|
|
28771
|
-
if (this.
|
|
29004
|
+
if (this.optionFlags & 64) node.range[0] = startLoc.index;
|
|
28772
29005
|
}
|
|
28773
29006
|
},
|
|
28774
29007
|
{
|
|
@@ -28777,7 +29010,7 @@ var NodeUtils = /*#__PURE__*/ function(UtilParser) {
|
|
|
28777
29010
|
var endLoc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state.lastTokEndLoc;
|
|
28778
29011
|
node.end = endLoc.index;
|
|
28779
29012
|
node.loc.end = endLoc;
|
|
28780
|
-
if (this.
|
|
29013
|
+
if (this.optionFlags & 64) node.range[1] = endLoc.index;
|
|
28781
29014
|
}
|
|
28782
29015
|
},
|
|
28783
29016
|
{
|
|
@@ -29407,31 +29640,63 @@ var flow = function(superClass) {
|
|
|
29407
29640
|
return this.finishNode(node, "TypeParameterDeclaration");
|
|
29408
29641
|
}
|
|
29409
29642
|
},
|
|
29643
|
+
{
|
|
29644
|
+
key: "flowInTopLevelContext",
|
|
29645
|
+
value: function flowInTopLevelContext(cb) {
|
|
29646
|
+
if (this.curContext() !== types.brace) {
|
|
29647
|
+
var oldContext = this.state.context;
|
|
29648
|
+
this.state.context = [
|
|
29649
|
+
oldContext[0]
|
|
29650
|
+
];
|
|
29651
|
+
try {
|
|
29652
|
+
return cb();
|
|
29653
|
+
} finally{
|
|
29654
|
+
this.state.context = oldContext;
|
|
29655
|
+
}
|
|
29656
|
+
} else {
|
|
29657
|
+
return cb();
|
|
29658
|
+
}
|
|
29659
|
+
}
|
|
29660
|
+
},
|
|
29661
|
+
{
|
|
29662
|
+
key: "flowParseTypeParameterInstantiationInExpression",
|
|
29663
|
+
value: function flowParseTypeParameterInstantiationInExpression() {
|
|
29664
|
+
if (this.reScan_lt() !== 47) return;
|
|
29665
|
+
return this.flowParseTypeParameterInstantiation();
|
|
29666
|
+
}
|
|
29667
|
+
},
|
|
29410
29668
|
{
|
|
29411
29669
|
key: "flowParseTypeParameterInstantiation",
|
|
29412
29670
|
value: function flowParseTypeParameterInstantiation() {
|
|
29671
|
+
var _this = this;
|
|
29413
29672
|
var node = this.startNode();
|
|
29414
29673
|
var oldInType = this.state.inType;
|
|
29415
|
-
node.params = [];
|
|
29416
29674
|
this.state.inType = true;
|
|
29417
|
-
|
|
29418
|
-
|
|
29419
|
-
|
|
29420
|
-
|
|
29421
|
-
|
|
29422
|
-
|
|
29423
|
-
|
|
29675
|
+
node.params = [];
|
|
29676
|
+
this.flowInTopLevelContext(function() {
|
|
29677
|
+
_this.expect(47);
|
|
29678
|
+
var oldNoAnonFunctionType = _this.state.noAnonFunctionType;
|
|
29679
|
+
_this.state.noAnonFunctionType = false;
|
|
29680
|
+
while(!_this.match(48)){
|
|
29681
|
+
node.params.push(_this.flowParseType());
|
|
29682
|
+
if (!_this.match(48)) {
|
|
29683
|
+
_this.expect(12);
|
|
29684
|
+
}
|
|
29424
29685
|
}
|
|
29686
|
+
_this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
29687
|
+
});
|
|
29688
|
+
this.state.inType = oldInType;
|
|
29689
|
+
if (!this.state.inType && this.curContext() === types.brace) {
|
|
29690
|
+
this.reScan_lt_gt();
|
|
29425
29691
|
}
|
|
29426
|
-
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
29427
29692
|
this.expect(48);
|
|
29428
|
-
this.state.inType = oldInType;
|
|
29429
29693
|
return this.finishNode(node, "TypeParameterInstantiation");
|
|
29430
29694
|
}
|
|
29431
29695
|
},
|
|
29432
29696
|
{
|
|
29433
29697
|
key: "flowParseTypeParameterInstantiationCallOrNew",
|
|
29434
29698
|
value: function flowParseTypeParameterInstantiationCallOrNew() {
|
|
29699
|
+
if (this.reScan_lt() !== 47) return;
|
|
29435
29700
|
var node = this.startNode();
|
|
29436
29701
|
var oldInType = this.state.inType;
|
|
29437
29702
|
node.params = [];
|
|
@@ -30694,9 +30959,9 @@ var flow = function(superClass) {
|
|
|
30694
30959
|
key: "parseClassSuper",
|
|
30695
30960
|
value: function parseClassSuper(node) {
|
|
30696
30961
|
_get(_get_prototype_of(FlowParserMixin.prototype), "parseClassSuper", this).call(this, node);
|
|
30697
|
-
if (node.superClass && this.match(47)) {
|
|
30962
|
+
if (node.superClass && (this.match(47) || this.match(51))) {
|
|
30698
30963
|
{
|
|
30699
|
-
node.superTypeArguments = this.
|
|
30964
|
+
node.superTypeArguments = this.flowParseTypeParameterInstantiationInExpression();
|
|
30700
30965
|
}
|
|
30701
30966
|
}
|
|
30702
30967
|
if (this.isContextual(113)) {
|
|
@@ -31105,12 +31370,12 @@ var flow = function(superClass) {
|
|
|
31105
31370
|
this.next();
|
|
31106
31371
|
var node = this.startNodeAt(startLoc);
|
|
31107
31372
|
node.callee = base;
|
|
31108
|
-
node.typeArguments = this.
|
|
31373
|
+
node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
|
|
31109
31374
|
this.expect(10);
|
|
31110
31375
|
node.arguments = this.parseCallExpressionArguments(11);
|
|
31111
31376
|
node.optional = true;
|
|
31112
31377
|
return this.finishCallExpression(node, true);
|
|
31113
|
-
} else if (!noCalls && this.shouldParseTypes() && this.match(47)) {
|
|
31378
|
+
} else if (!noCalls && this.shouldParseTypes() && (this.match(47) || this.match(51))) {
|
|
31114
31379
|
var node1 = this.startNodeAt(startLoc);
|
|
31115
31380
|
node1.callee = base;
|
|
31116
31381
|
var result = this.tryParse(function() {
|
|
@@ -31660,6 +31925,17 @@ var flow = function(superClass) {
|
|
|
31660
31925
|
return this.finishNode(node, "EnumDeclaration");
|
|
31661
31926
|
}
|
|
31662
31927
|
},
|
|
31928
|
+
{
|
|
31929
|
+
key: "jsxParseOpeningElementAfterName",
|
|
31930
|
+
value: function jsxParseOpeningElementAfterName(node) {
|
|
31931
|
+
if (this.shouldParseTypes()) {
|
|
31932
|
+
if (this.match(47) || this.match(51)) {
|
|
31933
|
+
node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
|
|
31934
|
+
}
|
|
31935
|
+
}
|
|
31936
|
+
return _get(_get_prototype_of(FlowParserMixin.prototype), "jsxParseOpeningElementAfterName", this).call(this, node);
|
|
31937
|
+
}
|
|
31938
|
+
},
|
|
31663
31939
|
{
|
|
31664
31940
|
key: "isLookaheadToken_lt",
|
|
31665
31941
|
value: function isLookaheadToken_lt() {
|
|
@@ -31671,6 +31947,31 @@ var flow = function(superClass) {
|
|
|
31671
31947
|
return false;
|
|
31672
31948
|
}
|
|
31673
31949
|
},
|
|
31950
|
+
{
|
|
31951
|
+
key: "reScan_lt_gt",
|
|
31952
|
+
value: function reScan_lt_gt() {
|
|
31953
|
+
var type = this.state.type;
|
|
31954
|
+
if (type === 47) {
|
|
31955
|
+
this.state.pos -= 1;
|
|
31956
|
+
this.readToken_lt();
|
|
31957
|
+
} else if (type === 48) {
|
|
31958
|
+
this.state.pos -= 1;
|
|
31959
|
+
this.readToken_gt();
|
|
31960
|
+
}
|
|
31961
|
+
}
|
|
31962
|
+
},
|
|
31963
|
+
{
|
|
31964
|
+
key: "reScan_lt",
|
|
31965
|
+
value: function reScan_lt() {
|
|
31966
|
+
var type = this.state.type;
|
|
31967
|
+
if (type === 51) {
|
|
31968
|
+
this.state.pos -= 2;
|
|
31969
|
+
this.finishOp(47, 1);
|
|
31970
|
+
return 47;
|
|
31971
|
+
}
|
|
31972
|
+
return type;
|
|
31973
|
+
}
|
|
31974
|
+
},
|
|
31674
31975
|
{
|
|
31675
31976
|
key: "maybeUnwrapTypeCastExpression",
|
|
31676
31977
|
value: function maybeUnwrapTypeCastExpression(node) {
|
|
@@ -33509,8 +33810,14 @@ var typescript = function(superClass) {
|
|
|
33509
33810
|
this.expect(10);
|
|
33510
33811
|
if (!this.match(134)) {
|
|
33511
33812
|
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
|
33813
|
+
{
|
|
33814
|
+
node.argument = this.tsParseNonConditionalType();
|
|
33815
|
+
}
|
|
33816
|
+
} else {
|
|
33817
|
+
{
|
|
33818
|
+
node.argument = this.tsParseLiteralTypeNode();
|
|
33819
|
+
}
|
|
33512
33820
|
}
|
|
33513
|
-
node.argument = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseExprAtom", this).call(this);
|
|
33514
33821
|
if (this.eat(12) && !this.match(11)) {
|
|
33515
33822
|
node.options = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeAssignAllowIn", this).call(this);
|
|
33516
33823
|
this.eat(12);
|
|
@@ -33519,24 +33826,36 @@ var typescript = function(superClass) {
|
|
|
33519
33826
|
}
|
|
33520
33827
|
this.expect(11);
|
|
33521
33828
|
if (this.eat(16)) {
|
|
33522
|
-
node.qualifier = this.tsParseEntityName();
|
|
33829
|
+
node.qualifier = this.tsParseEntityName(1 | 2);
|
|
33523
33830
|
}
|
|
33524
33831
|
if (this.match(47)) {
|
|
33525
|
-
|
|
33832
|
+
{
|
|
33833
|
+
node.typeArguments = this.tsParseTypeArguments();
|
|
33834
|
+
}
|
|
33526
33835
|
}
|
|
33527
33836
|
return this.finishNode(node, "TSImportType");
|
|
33528
33837
|
}
|
|
33529
33838
|
},
|
|
33530
33839
|
{
|
|
33531
33840
|
key: "tsParseEntityName",
|
|
33532
|
-
value: function tsParseEntityName() {
|
|
33533
|
-
var
|
|
33534
|
-
|
|
33841
|
+
value: function tsParseEntityName(flags) {
|
|
33842
|
+
var entity;
|
|
33843
|
+
if (flags & 1 && this.match(78)) {
|
|
33844
|
+
if (flags & 2) {
|
|
33845
|
+
entity = this.parseIdentifier(true);
|
|
33846
|
+
} else {
|
|
33847
|
+
var node = this.startNode();
|
|
33848
|
+
this.next();
|
|
33849
|
+
entity = this.finishNode(node, "ThisExpression");
|
|
33850
|
+
}
|
|
33851
|
+
} else {
|
|
33852
|
+
entity = this.parseIdentifier(!!(flags & 1));
|
|
33853
|
+
}
|
|
33535
33854
|
while(this.eat(16)){
|
|
33536
|
-
var
|
|
33537
|
-
|
|
33538
|
-
|
|
33539
|
-
entity = this.finishNode(
|
|
33855
|
+
var node1 = this.startNodeAtNode(entity);
|
|
33856
|
+
node1.left = entity;
|
|
33857
|
+
node1.right = this.parseIdentifier(!!(flags & 1));
|
|
33858
|
+
entity = this.finishNode(node1, "TSQualifiedName");
|
|
33540
33859
|
}
|
|
33541
33860
|
return entity;
|
|
33542
33861
|
}
|
|
@@ -33545,7 +33864,7 @@ var typescript = function(superClass) {
|
|
|
33545
33864
|
key: "tsParseTypeReference",
|
|
33546
33865
|
value: function tsParseTypeReference() {
|
|
33547
33866
|
var node = this.startNode();
|
|
33548
|
-
node.typeName = this.tsParseEntityName();
|
|
33867
|
+
node.typeName = this.tsParseEntityName(1);
|
|
33549
33868
|
if (!this.hasPrecedingLineBreak() && this.match(47)) {
|
|
33550
33869
|
{
|
|
33551
33870
|
node.typeArguments = this.tsParseTypeArguments();
|
|
@@ -33581,10 +33900,14 @@ var typescript = function(superClass) {
|
|
|
33581
33900
|
if (this.match(83)) {
|
|
33582
33901
|
node.exprName = this.tsParseImportType();
|
|
33583
33902
|
} else {
|
|
33584
|
-
|
|
33903
|
+
{
|
|
33904
|
+
node.exprName = this.tsParseEntityName(1);
|
|
33905
|
+
}
|
|
33585
33906
|
}
|
|
33586
33907
|
if (!this.hasPrecedingLineBreak() && this.match(47)) {
|
|
33587
|
-
|
|
33908
|
+
{
|
|
33909
|
+
node.typeArguments = this.tsParseTypeArguments();
|
|
33910
|
+
}
|
|
33588
33911
|
}
|
|
33589
33912
|
return this.finishNode(node, "TSTypeQuery");
|
|
33590
33913
|
}
|
|
@@ -33914,8 +34237,9 @@ var typescript = function(superClass) {
|
|
|
33914
34237
|
{
|
|
33915
34238
|
key: "tsParseTupleElementType",
|
|
33916
34239
|
value: function tsParseTupleElementType() {
|
|
33917
|
-
var
|
|
34240
|
+
var restStartLoc = this.state.startLoc;
|
|
33918
34241
|
var rest = this.eat(21);
|
|
34242
|
+
var startLoc = this.state.startLoc;
|
|
33919
34243
|
var labeled;
|
|
33920
34244
|
var label;
|
|
33921
34245
|
var optional;
|
|
@@ -33930,12 +34254,11 @@ var typescript = function(superClass) {
|
|
|
33930
34254
|
type = this.tsParseType();
|
|
33931
34255
|
} else if (chAfterWord === 63) {
|
|
33932
34256
|
optional = true;
|
|
33933
|
-
var startLoc2 = this.state.startLoc;
|
|
33934
34257
|
var wordName = this.state.value;
|
|
33935
34258
|
var typeOrLabel = this.tsParseNonArrayType();
|
|
33936
34259
|
if (this.lookaheadCharCode() === 58) {
|
|
33937
34260
|
labeled = true;
|
|
33938
|
-
label = this.createIdentifier(this.startNodeAt(
|
|
34261
|
+
label = this.createIdentifier(this.startNodeAt(startLoc), wordName);
|
|
33939
34262
|
this.expect(17);
|
|
33940
34263
|
this.expect(14);
|
|
33941
34264
|
type = this.tsParseType();
|
|
@@ -33952,7 +34275,7 @@ var typescript = function(superClass) {
|
|
|
33952
34275
|
if (labeled) {
|
|
33953
34276
|
var labeledNode;
|
|
33954
34277
|
if (label) {
|
|
33955
|
-
labeledNode = this.
|
|
34278
|
+
labeledNode = this.startNodeAt(startLoc);
|
|
33956
34279
|
labeledNode.optional = optional;
|
|
33957
34280
|
labeledNode.label = label;
|
|
33958
34281
|
labeledNode.elementType = type;
|
|
@@ -33961,7 +34284,7 @@ var typescript = function(superClass) {
|
|
|
33961
34284
|
this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
|
|
33962
34285
|
}
|
|
33963
34286
|
} else {
|
|
33964
|
-
labeledNode = this.
|
|
34287
|
+
labeledNode = this.startNodeAt(startLoc);
|
|
33965
34288
|
labeledNode.optional = optional;
|
|
33966
34289
|
this.raise(TSErrors.InvalidTupleMemberLabel, type);
|
|
33967
34290
|
labeledNode.label = type;
|
|
@@ -33969,12 +34292,12 @@ var typescript = function(superClass) {
|
|
|
33969
34292
|
}
|
|
33970
34293
|
type = this.finishNode(labeledNode, "TSNamedTupleMember");
|
|
33971
34294
|
} else if (optional) {
|
|
33972
|
-
var optionalTypeNode = this.
|
|
34295
|
+
var optionalTypeNode = this.startNodeAt(startLoc);
|
|
33973
34296
|
optionalTypeNode.typeAnnotation = type;
|
|
33974
34297
|
type = this.finishNode(optionalTypeNode, "TSOptionalType");
|
|
33975
34298
|
}
|
|
33976
34299
|
if (rest) {
|
|
33977
|
-
var restNode = this.startNodeAt(
|
|
34300
|
+
var restNode = this.startNodeAt(restStartLoc);
|
|
33978
34301
|
restNode.typeAnnotation = type;
|
|
33979
34302
|
type = this.finishNode(restNode, "TSRestType");
|
|
33980
34303
|
}
|
|
@@ -34028,9 +34351,32 @@ var typescript = function(superClass) {
|
|
|
34028
34351
|
{
|
|
34029
34352
|
key: "tsParseTemplateLiteralType",
|
|
34030
34353
|
value: function tsParseTemplateLiteralType() {
|
|
34031
|
-
|
|
34032
|
-
|
|
34033
|
-
|
|
34354
|
+
{
|
|
34355
|
+
var startLoc = this.state.startLoc;
|
|
34356
|
+
var curElt = this.parseTemplateElement(false);
|
|
34357
|
+
var quasis = [
|
|
34358
|
+
curElt
|
|
34359
|
+
];
|
|
34360
|
+
if (curElt.tail) {
|
|
34361
|
+
var node = this.startNodeAt(startLoc);
|
|
34362
|
+
var literal = this.startNodeAt(startLoc);
|
|
34363
|
+
literal.expressions = [];
|
|
34364
|
+
literal.quasis = quasis;
|
|
34365
|
+
node.literal = this.finishNode(literal, "TemplateLiteral");
|
|
34366
|
+
return this.finishNode(node, "TSLiteralType");
|
|
34367
|
+
} else {
|
|
34368
|
+
var substitutions = [];
|
|
34369
|
+
while(!curElt.tail){
|
|
34370
|
+
substitutions.push(this.tsParseType());
|
|
34371
|
+
this.readTemplateContinuation();
|
|
34372
|
+
quasis.push(curElt = this.parseTemplateElement(false));
|
|
34373
|
+
}
|
|
34374
|
+
var node1 = this.startNodeAt(startLoc);
|
|
34375
|
+
node1.types = substitutions;
|
|
34376
|
+
node1.quasis = quasis;
|
|
34377
|
+
return this.finishNode(node1, "TSTemplateLiteralType");
|
|
34378
|
+
}
|
|
34379
|
+
}
|
|
34034
34380
|
}
|
|
34035
34381
|
},
|
|
34036
34382
|
{
|
|
@@ -34084,7 +34430,7 @@ var typescript = function(superClass) {
|
|
|
34084
34430
|
return this.tsParseTupleType();
|
|
34085
34431
|
case 10:
|
|
34086
34432
|
{
|
|
34087
|
-
if (!this.
|
|
34433
|
+
if (!(this.optionFlags & 512)) {
|
|
34088
34434
|
var startLoc = this.state.startLoc;
|
|
34089
34435
|
this.next();
|
|
34090
34436
|
var type = this.tsParseType();
|
|
@@ -34118,15 +34464,16 @@ var typescript = function(superClass) {
|
|
|
34118
34464
|
{
|
|
34119
34465
|
key: "tsParseArrayTypeOrHigher",
|
|
34120
34466
|
value: function tsParseArrayTypeOrHigher() {
|
|
34467
|
+
var startLoc = this.state.startLoc;
|
|
34121
34468
|
var type = this.tsParseNonArrayType();
|
|
34122
34469
|
while(!this.hasPrecedingLineBreak() && this.eat(0)){
|
|
34123
34470
|
if (this.match(3)) {
|
|
34124
|
-
var node = this.
|
|
34471
|
+
var node = this.startNodeAt(startLoc);
|
|
34125
34472
|
node.elementType = type;
|
|
34126
34473
|
this.expect(3);
|
|
34127
34474
|
type = this.finishNode(node, "TSArrayType");
|
|
34128
34475
|
} else {
|
|
34129
|
-
var node1 = this.
|
|
34476
|
+
var node1 = this.startNodeAt(startLoc);
|
|
34130
34477
|
node1.objectType = type;
|
|
34131
34478
|
node1.indexType = this.tsParseType();
|
|
34132
34479
|
this.expect(3);
|
|
@@ -34465,11 +34812,13 @@ var typescript = function(superClass) {
|
|
|
34465
34812
|
var originalStartLoc = this.state.startLoc;
|
|
34466
34813
|
var delimitedList = this.tsParseDelimitedList("HeritageClauseElement", function() {
|
|
34467
34814
|
var node = _this.startNode();
|
|
34468
|
-
|
|
34469
|
-
|
|
34470
|
-
|
|
34815
|
+
{
|
|
34816
|
+
node.expression = _this.tsParseEntityName(1);
|
|
34817
|
+
if (_this.match(47)) {
|
|
34818
|
+
node.typeArguments = _this.tsParseTypeArguments();
|
|
34819
|
+
}
|
|
34820
|
+
return _this.finishNode(node, token === "extends" ? "TSInterfaceHeritage" : "TSClassImplements");
|
|
34471
34821
|
}
|
|
34472
|
-
return _this.finishNode(node, token === "extends" ? "TSInterfaceHeritage" : "TSClassImplements");
|
|
34473
34822
|
});
|
|
34474
34823
|
if (!delimitedList.length) {
|
|
34475
34824
|
this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
|
|
@@ -34524,16 +34873,20 @@ var typescript = function(superClass) {
|
|
|
34524
34873
|
}
|
|
34525
34874
|
},
|
|
34526
34875
|
{
|
|
34527
|
-
key: "
|
|
34528
|
-
value: function
|
|
34529
|
-
|
|
34530
|
-
|
|
34531
|
-
|
|
34532
|
-
|
|
34533
|
-
|
|
34876
|
+
key: "tsInTopLevelContext",
|
|
34877
|
+
value: function tsInTopLevelContext(cb) {
|
|
34878
|
+
if (this.curContext() !== types.brace) {
|
|
34879
|
+
var oldContext = this.state.context;
|
|
34880
|
+
this.state.context = [
|
|
34881
|
+
oldContext[0]
|
|
34882
|
+
];
|
|
34883
|
+
try {
|
|
34884
|
+
return cb();
|
|
34885
|
+
} finally{
|
|
34886
|
+
this.state.context = oldContext;
|
|
34887
|
+
}
|
|
34888
|
+
} else {
|
|
34534
34889
|
return cb();
|
|
34535
|
-
} finally{
|
|
34536
|
-
this.state.context = oldContext;
|
|
34537
34890
|
}
|
|
34538
34891
|
}
|
|
34539
34892
|
},
|
|
@@ -34621,10 +34974,20 @@ var typescript = function(superClass) {
|
|
|
34621
34974
|
this.expectContextual(126);
|
|
34622
34975
|
node.id = this.parseIdentifier();
|
|
34623
34976
|
this.checkIdentifier(node.id, node.const ? 8971 : 8459);
|
|
34977
|
+
{
|
|
34978
|
+
node.body = this.tsParseEnumBody();
|
|
34979
|
+
}
|
|
34980
|
+
return this.finishNode(node, "TSEnumDeclaration");
|
|
34981
|
+
}
|
|
34982
|
+
},
|
|
34983
|
+
{
|
|
34984
|
+
key: "tsParseEnumBody",
|
|
34985
|
+
value: function tsParseEnumBody() {
|
|
34986
|
+
var node = this.startNode();
|
|
34624
34987
|
this.expect(5);
|
|
34625
34988
|
node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
|
|
34626
34989
|
this.expect(8);
|
|
34627
|
-
return this.finishNode(node, "
|
|
34990
|
+
return this.finishNode(node, "TSEnumBody");
|
|
34628
34991
|
}
|
|
34629
34992
|
},
|
|
34630
34993
|
{
|
|
@@ -34642,7 +35005,7 @@ var typescript = function(superClass) {
|
|
|
34642
35005
|
key: "tsParseModuleOrNamespaceDeclaration",
|
|
34643
35006
|
value: function tsParseModuleOrNamespaceDeclaration(node) {
|
|
34644
35007
|
var nested = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
34645
|
-
node.id = this.tsParseEntityName();
|
|
35008
|
+
node.id = this.tsParseEntityName(1);
|
|
34646
35009
|
if (node.id.type === "Identifier") {
|
|
34647
35010
|
this.checkIdentifier(node.id, 1024);
|
|
34648
35011
|
}
|
|
@@ -34683,7 +35046,6 @@ var typescript = function(superClass) {
|
|
|
34683
35046
|
{
|
|
34684
35047
|
key: "tsParseImportEqualsDeclaration",
|
|
34685
35048
|
value: function tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, isExport) {
|
|
34686
|
-
node.isExport = isExport || false;
|
|
34687
35049
|
node.id = maybeDefaultIdentifier || this.parseIdentifier();
|
|
34688
35050
|
this.checkIdentifier(node.id, 4096);
|
|
34689
35051
|
this.expect(29);
|
|
@@ -34705,7 +35067,7 @@ var typescript = function(superClass) {
|
|
|
34705
35067
|
{
|
|
34706
35068
|
key: "tsParseModuleReference",
|
|
34707
35069
|
value: function tsParseModuleReference() {
|
|
34708
|
-
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(
|
|
35070
|
+
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(0);
|
|
34709
35071
|
}
|
|
34710
35072
|
},
|
|
34711
35073
|
{
|
|
@@ -34920,7 +35282,7 @@ var typescript = function(superClass) {
|
|
|
34920
35282
|
var _this = this;
|
|
34921
35283
|
var node = this.startNode();
|
|
34922
35284
|
node.params = this.tsInType(function() {
|
|
34923
|
-
return _this.
|
|
35285
|
+
return _this.tsInTopLevelContext(function() {
|
|
34924
35286
|
_this.expect(47);
|
|
34925
35287
|
return _this.tsParseDelimitedList("TypeParametersOrArguments", _this.tsParseType.bind(_this));
|
|
34926
35288
|
});
|
|
@@ -35128,7 +35490,9 @@ var typescript = function(superClass) {
|
|
|
35128
35490
|
}
|
|
35129
35491
|
if (tokenIsTemplate(_this.state.type)) {
|
|
35130
35492
|
var result2 = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseTaggedTemplateExpression", _this).call(_this, base, startLoc, state);
|
|
35131
|
-
|
|
35493
|
+
{
|
|
35494
|
+
result2.typeArguments = typeArguments;
|
|
35495
|
+
}
|
|
35132
35496
|
return result2;
|
|
35133
35497
|
}
|
|
35134
35498
|
if (!noCalls && _this.eat(10)) {
|
|
@@ -35136,7 +35500,9 @@ var typescript = function(superClass) {
|
|
|
35136
35500
|
node2.callee = base;
|
|
35137
35501
|
node2.arguments = _this.parseCallExpressionArguments(11);
|
|
35138
35502
|
_this.tsCheckForInvalidTypeCasts(node2.arguments);
|
|
35139
|
-
|
|
35503
|
+
{
|
|
35504
|
+
node2.typeArguments = typeArguments;
|
|
35505
|
+
}
|
|
35140
35506
|
if (state.optionalChainMember) {
|
|
35141
35507
|
node2.optional = isOptionalCall;
|
|
35142
35508
|
}
|
|
@@ -35148,7 +35514,9 @@ var typescript = function(superClass) {
|
|
|
35148
35514
|
}
|
|
35149
35515
|
var node = _this.startNodeAt(startLoc);
|
|
35150
35516
|
node.expression = base;
|
|
35151
|
-
|
|
35517
|
+
{
|
|
35518
|
+
node.typeArguments = typeArguments;
|
|
35519
|
+
}
|
|
35152
35520
|
return _this.finishNode(node, "TSInstantiationExpression");
|
|
35153
35521
|
});
|
|
35154
35522
|
if (missingParenErrorLoc) {
|
|
@@ -35171,7 +35539,9 @@ var typescript = function(superClass) {
|
|
|
35171
35539
|
_get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseNewCallee", this).call(this, node);
|
|
35172
35540
|
var callee = node.callee;
|
|
35173
35541
|
if (callee.type === "TSInstantiationExpression" && !((_callee_extra = callee.extra) === null || _callee_extra === void 0 ? void 0 : _callee_extra.parenthesized)) {
|
|
35174
|
-
|
|
35542
|
+
{
|
|
35543
|
+
node.typeArguments = callee.typeArguments;
|
|
35544
|
+
}
|
|
35175
35545
|
node.callee = callee.expression;
|
|
35176
35546
|
}
|
|
35177
35547
|
}
|
|
@@ -35277,15 +35647,20 @@ var typescript = function(superClass) {
|
|
|
35277
35647
|
key: "parseExport",
|
|
35278
35648
|
value: function parseExport(node, decorators) {
|
|
35279
35649
|
if (this.match(83)) {
|
|
35650
|
+
var nodeImportEquals = this.startNode();
|
|
35280
35651
|
this.next();
|
|
35281
|
-
var nodeImportEquals = node;
|
|
35282
35652
|
var maybeDefaultIdentifier = null;
|
|
35283
35653
|
if (this.isContextual(130) && this.isPotentialImportPhase(false)) {
|
|
35284
35654
|
maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
|
|
35285
35655
|
} else {
|
|
35286
35656
|
nodeImportEquals.importKind = "value";
|
|
35287
35657
|
}
|
|
35288
|
-
|
|
35658
|
+
var declaration = this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
|
|
35659
|
+
{
|
|
35660
|
+
node.declaration = declaration;
|
|
35661
|
+
node.specifiers = [];
|
|
35662
|
+
return this.finishNode(node, "ExportNamedDeclaration");
|
|
35663
|
+
}
|
|
35289
35664
|
} else if (this.eat(29)) {
|
|
35290
35665
|
var assign = node;
|
|
35291
35666
|
assign.expression = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseExpression", this).call(this);
|
|
@@ -35566,7 +35941,7 @@ var typescript = function(superClass) {
|
|
|
35566
35941
|
if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) {
|
|
35567
35942
|
node.exportKind = "type";
|
|
35568
35943
|
}
|
|
35569
|
-
if (isDeclare) {
|
|
35944
|
+
if (isDeclare && declaration.type !== "TSImportEqualsDeclaration") {
|
|
35570
35945
|
this.resetStartLocation(declaration, startLoc);
|
|
35571
35946
|
declaration.declare = true;
|
|
35572
35947
|
}
|
|
@@ -35957,17 +36332,19 @@ var typescript = function(superClass) {
|
|
|
35957
36332
|
},
|
|
35958
36333
|
{
|
|
35959
36334
|
key: "parseMaybeDecoratorArguments",
|
|
35960
|
-
value: function parseMaybeDecoratorArguments(expr) {
|
|
36335
|
+
value: function parseMaybeDecoratorArguments(expr, startLoc) {
|
|
35961
36336
|
if (this.match(47) || this.match(51)) {
|
|
35962
36337
|
var typeArguments = this.tsParseTypeArgumentsInExpression();
|
|
35963
36338
|
if (this.match(10)) {
|
|
35964
|
-
var call2 = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeDecoratorArguments", this).call(this, expr);
|
|
35965
|
-
|
|
36339
|
+
var call2 = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeDecoratorArguments", this).call(this, expr, startLoc);
|
|
36340
|
+
{
|
|
36341
|
+
call2.typeArguments = typeArguments;
|
|
36342
|
+
}
|
|
35966
36343
|
return call2;
|
|
35967
36344
|
}
|
|
35968
36345
|
this.unexpected(null, 10);
|
|
35969
36346
|
}
|
|
35970
|
-
return _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeDecoratorArguments", this).call(this, expr);
|
|
36347
|
+
return _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeDecoratorArguments", this).call(this, expr, startLoc);
|
|
35971
36348
|
}
|
|
35972
36349
|
},
|
|
35973
36350
|
{
|
|
@@ -36095,7 +36472,11 @@ var typescript = function(superClass) {
|
|
|
36095
36472
|
var typeArguments = this.tsTryParseAndCatch(function() {
|
|
36096
36473
|
return _this.tsParseTypeArgumentsInExpression();
|
|
36097
36474
|
});
|
|
36098
|
-
if (typeArguments)
|
|
36475
|
+
if (typeArguments) {
|
|
36476
|
+
{
|
|
36477
|
+
node.typeArguments = typeArguments;
|
|
36478
|
+
}
|
|
36479
|
+
}
|
|
36099
36480
|
}
|
|
36100
36481
|
return _get(_get_prototype_of(TypeScriptParserMixin.prototype), "jsxParseOpeningElementAfterName", this).call(this, node);
|
|
36101
36482
|
}
|
|
@@ -36170,8 +36551,9 @@ var typescript = function(superClass) {
|
|
|
36170
36551
|
value: function parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
|
|
36171
36552
|
var method = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMethod", this).call(this, node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
36172
36553
|
if (method.abstract) {
|
|
36173
|
-
var
|
|
36174
|
-
|
|
36554
|
+
var hasEstreePlugin = this.hasPlugin("estree");
|
|
36555
|
+
var methodFn = hasEstreePlugin ? method.value : method;
|
|
36556
|
+
if (methodFn.body) {
|
|
36175
36557
|
var key = method.key;
|
|
36176
36558
|
this.raise(TSErrors.AbstractMethodHasImplementation, method, {
|
|
36177
36559
|
methodName: key.type === "Identifier" && !method.computed ? key.name : "[".concat(this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end)), "]")
|
|
@@ -36724,11 +37106,6 @@ function validatePlugins(pluginsMap) {
|
|
|
36724
37106
|
pluginsMap.get("recordAndTuple")
|
|
36725
37107
|
]), "`."));
|
|
36726
37108
|
}
|
|
36727
|
-
} else if (proposal === "smart" && tupleSyntaxIsHash) {
|
|
36728
|
-
throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "smart" }]` and `'.concat(JSON.stringify([
|
|
36729
|
-
"recordAndTuple",
|
|
36730
|
-
pluginsMap.get("recordAndTuple")
|
|
36731
|
-
]), "`."));
|
|
36732
37109
|
}
|
|
36733
37110
|
}
|
|
36734
37111
|
if (pluginsMap.has("moduleAttributes")) {
|
|
@@ -36784,71 +37161,6 @@ var mixinPlugins = {
|
|
|
36784
37161
|
placeholders: placeholders
|
|
36785
37162
|
};
|
|
36786
37163
|
var mixinPluginNames = Object.keys(mixinPlugins);
|
|
36787
|
-
function createDefaultOptions() {
|
|
36788
|
-
return {
|
|
36789
|
-
sourceType: "script",
|
|
36790
|
-
sourceFilename: void 0,
|
|
36791
|
-
startIndex: 0,
|
|
36792
|
-
startColumn: 0,
|
|
36793
|
-
startLine: 1,
|
|
36794
|
-
allowAwaitOutsideFunction: false,
|
|
36795
|
-
allowReturnOutsideFunction: false,
|
|
36796
|
-
allowNewTargetOutsideFunction: false,
|
|
36797
|
-
allowImportExportEverywhere: false,
|
|
36798
|
-
allowSuperOutsideMethod: false,
|
|
36799
|
-
allowUndeclaredExports: false,
|
|
36800
|
-
plugins: [],
|
|
36801
|
-
strictMode: null,
|
|
36802
|
-
ranges: false,
|
|
36803
|
-
tokens: false,
|
|
36804
|
-
createImportExpressions: true,
|
|
36805
|
-
createParenthesizedExpressions: false,
|
|
36806
|
-
errorRecovery: false,
|
|
36807
|
-
attachComment: true,
|
|
36808
|
-
annexB: true
|
|
36809
|
-
};
|
|
36810
|
-
}
|
|
36811
|
-
function getOptions(opts) {
|
|
36812
|
-
var options = createDefaultOptions();
|
|
36813
|
-
if (opts == null) {
|
|
36814
|
-
return options;
|
|
36815
|
-
}
|
|
36816
|
-
if (opts.annexB != null && opts.annexB !== false) {
|
|
36817
|
-
throw new Error("The `annexB` option can only be set to `false`.");
|
|
36818
|
-
}
|
|
36819
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
36820
|
-
try {
|
|
36821
|
-
for(var _iterator = Object.keys(options)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
36822
|
-
var key = _step.value;
|
|
36823
|
-
if (opts[key] != null) options[key] = opts[key];
|
|
36824
|
-
}
|
|
36825
|
-
} catch (err) {
|
|
36826
|
-
_didIteratorError = true;
|
|
36827
|
-
_iteratorError = err;
|
|
36828
|
-
} finally{
|
|
36829
|
-
try {
|
|
36830
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
36831
|
-
_iterator.return();
|
|
36832
|
-
}
|
|
36833
|
-
} finally{
|
|
36834
|
-
if (_didIteratorError) {
|
|
36835
|
-
throw _iteratorError;
|
|
36836
|
-
}
|
|
36837
|
-
}
|
|
36838
|
-
}
|
|
36839
|
-
if (options.startLine === 1) {
|
|
36840
|
-
if (opts.startIndex == null && options.startColumn > 0) {
|
|
36841
|
-
options.startIndex = options.startColumn;
|
|
36842
|
-
} else if (opts.startColumn == null && options.startIndex > 0) {
|
|
36843
|
-
options.startColumn = options.startIndex;
|
|
36844
|
-
}
|
|
36845
|
-
} else if (opts.startColumn == null || opts.startIndex == null) {
|
|
36846
|
-
{
|
|
36847
|
-
throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
|
|
36848
|
-
}
|
|
36849
|
-
}
|
|
36850
|
-
return options;
|
|
36851
|
-
}
|
|
36852
37164
|
var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
36853
37165
|
"use strict";
|
|
36854
37166
|
_inherits(ExpressionParser, LValParser);
|
|
@@ -36901,7 +37213,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
36901
37213
|
this.finalizeRemainingComments();
|
|
36902
37214
|
expr.comments = this.comments;
|
|
36903
37215
|
expr.errors = this.state.errors;
|
|
36904
|
-
if (this.
|
|
37216
|
+
if (this.optionFlags & 128) {
|
|
36905
37217
|
expr.tokens = this.tokens;
|
|
36906
37218
|
}
|
|
36907
37219
|
return expr;
|
|
@@ -37100,16 +37412,6 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
37100
37412
|
prec = tokenOperatorPrecedence(42);
|
|
37101
37413
|
}
|
|
37102
37414
|
this.next();
|
|
37103
|
-
if (op === 39 && this.hasPlugin([
|
|
37104
|
-
"pipelineOperator",
|
|
37105
|
-
{
|
|
37106
|
-
proposal: "minimal"
|
|
37107
|
-
}
|
|
37108
|
-
])) {
|
|
37109
|
-
if (this.state.type === 96 && this.prodParam.hasAwait) {
|
|
37110
|
-
throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, this.state.startLoc);
|
|
37111
|
-
}
|
|
37112
|
-
}
|
|
37113
37415
|
node.right = this.parseExprOpRightExpr(op, prec);
|
|
37114
37416
|
var finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
37115
37417
|
var nextOp = this.state.type;
|
|
@@ -37126,7 +37428,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
37126
37428
|
key: "parseExprOpRightExpr",
|
|
37127
37429
|
value: function parseExprOpRightExpr(op, prec) {
|
|
37128
37430
|
var _this = this;
|
|
37129
|
-
|
|
37431
|
+
this.state.startLoc;
|
|
37130
37432
|
switch(op){
|
|
37131
37433
|
case 39:
|
|
37132
37434
|
switch(this.getPluginOption("pipelineOperator", "proposal")){
|
|
@@ -37134,13 +37436,6 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
37134
37436
|
return this.withTopicBindingContext(function() {
|
|
37135
37437
|
return _this.parseHackPipeBody();
|
|
37136
37438
|
});
|
|
37137
|
-
case "smart":
|
|
37138
|
-
return this.withTopicBindingContext(function() {
|
|
37139
|
-
if (_this.prodParam.hasYield && _this.isContextual(108)) {
|
|
37140
|
-
throw _this.raise(Errors.PipeBodyIsTighter, _this.state.startLoc);
|
|
37141
|
-
}
|
|
37142
|
-
return _this.parseSmartPipelineBodyInStyle(_this.parseExprOpBaseRightExpr(op, prec), startLoc);
|
|
37143
|
-
});
|
|
37144
37439
|
case "fsharp":
|
|
37145
37440
|
return this.withSoloAwaitPermittingContext(function() {
|
|
37146
37441
|
return _this.parseFSharpPipelineBody(prec);
|
|
@@ -37523,7 +37818,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
37523
37818
|
return this.parseImportMetaProperty(node);
|
|
37524
37819
|
}
|
|
37525
37820
|
if (this.match(10)) {
|
|
37526
|
-
if (this.
|
|
37821
|
+
if (this.optionFlags & 256) {
|
|
37527
37822
|
return this.parseImportCall(node);
|
|
37528
37823
|
} else {
|
|
37529
37824
|
return this.finishNode(node, "Import");
|
|
@@ -37717,12 +38012,13 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
37717
38012
|
key: "finishTopicReference",
|
|
37718
38013
|
value: function finishTopicReference(node, startLoc, pipeProposal, tokenType) {
|
|
37719
38014
|
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
|
|
37720
|
-
|
|
37721
|
-
|
|
37722
|
-
|
|
38015
|
+
{
|
|
38016
|
+
if (!this.topicReferenceIsAllowedInCurrentContext()) {
|
|
38017
|
+
this.raise(Errors.PipeTopicUnbound, startLoc);
|
|
38018
|
+
}
|
|
38019
|
+
this.registerTopicReference();
|
|
38020
|
+
return this.finishNode(node, "TopicReference");
|
|
37723
38021
|
}
|
|
37724
|
-
this.registerTopicReference();
|
|
37725
|
-
return this.finishNode(node, nodeType);
|
|
37726
38022
|
} else {
|
|
37727
38023
|
throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
|
|
37728
38024
|
token: tokenLabelName(tokenType)
|
|
@@ -37792,9 +38088,9 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
37792
38088
|
value: function parseSuper() {
|
|
37793
38089
|
var node = this.startNode();
|
|
37794
38090
|
this.next();
|
|
37795
|
-
if (this.match(10) && !this.scope.allowDirectSuper && !this.
|
|
38091
|
+
if (this.match(10) && !this.scope.allowDirectSuper && !(this.optionFlags & 16)) {
|
|
37796
38092
|
this.raise(Errors.SuperNotAllowed, node);
|
|
37797
|
-
} else if (!this.scope.allowSuper && !this.
|
|
38093
|
+
} else if (!this.scope.allowSuper && !(this.optionFlags & 16)) {
|
|
37798
38094
|
this.raise(Errors.UnexpectedSuper, node);
|
|
37799
38095
|
}
|
|
37800
38096
|
if (!this.match(10) && !this.match(0) && !this.match(16)) {
|
|
@@ -37860,7 +38156,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
37860
38156
|
} else if (this.isContextual(105) || this.isContextual(97)) {
|
|
37861
38157
|
var isSource = this.isContextual(105);
|
|
37862
38158
|
this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
|
|
37863
|
-
if (!this.
|
|
38159
|
+
if (!(this.optionFlags & 256)) {
|
|
37864
38160
|
throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
|
|
37865
38161
|
phase: this.state.value
|
|
37866
38162
|
});
|
|
@@ -38013,7 +38309,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
38013
38309
|
{
|
|
38014
38310
|
key: "wrapParenthesis",
|
|
38015
38311
|
value: function wrapParenthesis(startLoc, expression2) {
|
|
38016
|
-
if (!this.
|
|
38312
|
+
if (!(this.optionFlags & 512)) {
|
|
38017
38313
|
this.addExtra(expression2, "parenthesized", true);
|
|
38018
38314
|
this.addExtra(expression2, "parenStart", startLoc.index);
|
|
38019
38315
|
this.takeSurroundingComments(expression2, startLoc.index, this.state.lastTokEndLoc.index);
|
|
@@ -38053,7 +38349,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
38053
38349
|
var meta = this.createIdentifier(this.startNodeAtNode(node), "new");
|
|
38054
38350
|
this.next();
|
|
38055
38351
|
var metaProp = this.parseMetaProperty(node, meta, "target");
|
|
38056
|
-
if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.
|
|
38352
|
+
if (!this.scope.inNonArrowFunction && !this.scope.inClass && !(this.optionFlags & 4)) {
|
|
38057
38353
|
this.raise(Errors.UnexpectedNewTarget, metaProp);
|
|
38058
38354
|
}
|
|
38059
38355
|
return metaProp;
|
|
@@ -38669,7 +38965,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
38669
38965
|
{
|
|
38670
38966
|
key: "recordAwaitIfAllowed",
|
|
38671
38967
|
value: function recordAwaitIfAllowed() {
|
|
38672
|
-
var isAwaitAllowed = this.prodParam.hasAwait || this.
|
|
38968
|
+
var isAwaitAllowed = this.prodParam.hasAwait || this.optionFlags & 1 && !this.scope.inFunction;
|
|
38673
38969
|
if (isAwaitAllowed && !this.scope.inFunction) {
|
|
38674
38970
|
this.state.hasTopLevelAwait = true;
|
|
38675
38971
|
}
|
|
@@ -38684,7 +38980,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
38684
38980
|
if (this.eat(55)) {
|
|
38685
38981
|
this.raise(Errors.ObsoleteAwaitStar, node);
|
|
38686
38982
|
}
|
|
38687
|
-
if (!this.scope.inFunction && !this.
|
|
38983
|
+
if (!this.scope.inFunction && !(this.optionFlags & 1)) {
|
|
38688
38984
|
if (this.isAmbiguousAwait()) {
|
|
38689
38985
|
this.ambiguousScriptDifferentAst = true;
|
|
38690
38986
|
} else {
|
|
@@ -38827,23 +39123,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
|
|
|
38827
39123
|
{
|
|
38828
39124
|
key: "withSmartMixTopicForbiddingContext",
|
|
38829
39125
|
value: function withSmartMixTopicForbiddingContext(callback) {
|
|
38830
|
-
|
|
38831
|
-
"pipelineOperator",
|
|
38832
|
-
{
|
|
38833
|
-
proposal: "smart"
|
|
38834
|
-
}
|
|
38835
|
-
])) {
|
|
38836
|
-
var outerContextTopicState = this.state.topicContext;
|
|
38837
|
-
this.state.topicContext = {
|
|
38838
|
-
maxNumOfResolvableTopics: 0,
|
|
38839
|
-
maxTopicIndex: null
|
|
38840
|
-
};
|
|
38841
|
-
try {
|
|
38842
|
-
return callback();
|
|
38843
|
-
} finally{
|
|
38844
|
-
this.state.topicContext = outerContextTopicState;
|
|
38845
|
-
}
|
|
38846
|
-
} else {
|
|
39126
|
+
{
|
|
38847
39127
|
return callback();
|
|
38848
39128
|
}
|
|
38849
39129
|
}
|
|
@@ -38981,7 +39261,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
|
|
|
38981
39261
|
value: function parseTopLevel(file2, program3) {
|
|
38982
39262
|
file2.program = this.parseProgram(program3);
|
|
38983
39263
|
file2.comments = this.comments;
|
|
38984
|
-
if (this.
|
|
39264
|
+
if (this.optionFlags & 128) {
|
|
38985
39265
|
file2.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
|
|
38986
39266
|
}
|
|
38987
39267
|
return this.finishNode(file2, "File");
|
|
@@ -38995,7 +39275,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
|
|
|
38995
39275
|
program3.interpreter = this.parseInterpreterDirective();
|
|
38996
39276
|
this.parseBlockBody(program3, true, true, end);
|
|
38997
39277
|
if (this.inModule) {
|
|
38998
|
-
if (!this.
|
|
39278
|
+
if (!(this.optionFlags & 32) && this.scope.undefinedExports.size > 0) {
|
|
38999
39279
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
39000
39280
|
try {
|
|
39001
39281
|
for(var _iterator = Array.from(this.scope.undefinedExports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -39281,7 +39561,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
|
|
|
39281
39561
|
}
|
|
39282
39562
|
case 82:
|
|
39283
39563
|
{
|
|
39284
|
-
if (!this.
|
|
39564
|
+
if (!(this.optionFlags & 8) && !topLevel) {
|
|
39285
39565
|
this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
|
|
39286
39566
|
}
|
|
39287
39567
|
this.next();
|
|
@@ -39323,7 +39603,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
|
|
|
39323
39603
|
{
|
|
39324
39604
|
key: "assertModuleNodeAllowed",
|
|
39325
39605
|
value: function assertModuleNodeAllowed(node) {
|
|
39326
|
-
if (!this.
|
|
39606
|
+
if (!(this.optionFlags & 8) && !this.inModule) {
|
|
39327
39607
|
this.raise(Errors.ImportOutsideModule, node);
|
|
39328
39608
|
}
|
|
39329
39609
|
}
|
|
@@ -39339,12 +39619,13 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
|
|
|
39339
39619
|
key: "maybeTakeDecorators",
|
|
39340
39620
|
value: function maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
|
|
39341
39621
|
if (maybeDecorators) {
|
|
39342
|
-
|
|
39343
|
-
|
|
39622
|
+
var _classNode_decorators;
|
|
39623
|
+
if ((_classNode_decorators = classNode.decorators) === null || _classNode_decorators === void 0 ? void 0 : _classNode_decorators.length) {
|
|
39624
|
+
var _classNode_decorators1;
|
|
39344
39625
|
if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
|
|
39345
39626
|
this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
|
|
39346
39627
|
}
|
|
39347
|
-
(
|
|
39628
|
+
(_classNode_decorators1 = classNode.decorators).unshift.apply(_classNode_decorators1, _to_consumable_array(maybeDecorators));
|
|
39348
39629
|
} else {
|
|
39349
39630
|
classNode.decorators = maybeDecorators;
|
|
39350
39631
|
}
|
|
@@ -39399,7 +39680,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
|
|
|
39399
39680
|
this.expect(11);
|
|
39400
39681
|
expr = this.wrapParenthesis(startLoc2, expr);
|
|
39401
39682
|
var paramsStartLoc = this.state.startLoc;
|
|
39402
|
-
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
39683
|
+
node.expression = this.parseMaybeDecoratorArguments(expr, startLoc2);
|
|
39403
39684
|
if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
|
|
39404
39685
|
this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
|
|
39405
39686
|
}
|
|
@@ -39417,7 +39698,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
|
|
|
39417
39698
|
node2.computed = false;
|
|
39418
39699
|
expr = this.finishNode(node2, "MemberExpression");
|
|
39419
39700
|
}
|
|
39420
|
-
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
39701
|
+
node.expression = this.parseMaybeDecoratorArguments(expr, startLoc);
|
|
39421
39702
|
}
|
|
39422
39703
|
} else {
|
|
39423
39704
|
node.expression = this.parseExprSubscripts();
|
|
@@ -39427,9 +39708,9 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
|
|
|
39427
39708
|
},
|
|
39428
39709
|
{
|
|
39429
39710
|
key: "parseMaybeDecoratorArguments",
|
|
39430
|
-
value: function parseMaybeDecoratorArguments(expr) {
|
|
39711
|
+
value: function parseMaybeDecoratorArguments(expr, startLoc) {
|
|
39431
39712
|
if (this.eat(10)) {
|
|
39432
|
-
var node = this.
|
|
39713
|
+
var node = this.startNodeAt(startLoc);
|
|
39433
39714
|
node.callee = expr;
|
|
39434
39715
|
node.arguments = this.parseCallExpressionArguments(11);
|
|
39435
39716
|
this.toReferencedList(node.arguments);
|
|
@@ -39606,7 +39887,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
|
|
|
39606
39887
|
{
|
|
39607
39888
|
key: "parseReturnStatement",
|
|
39608
39889
|
value: function parseReturnStatement(node) {
|
|
39609
|
-
if (!this.prodParam.hasReturn && !this.
|
|
39890
|
+
if (!this.prodParam.hasReturn && !(this.optionFlags & 2)) {
|
|
39610
39891
|
this.raise(Errors.IllegalReturn, this.state.startLoc);
|
|
39611
39892
|
}
|
|
39612
39893
|
this.next();
|
|
@@ -41235,6 +41516,47 @@ var Parser = /*#__PURE__*/ function(StatementParser) {
|
|
|
41235
41516
|
_this.plugins = pluginsMap;
|
|
41236
41517
|
_this.filename = options.sourceFilename;
|
|
41237
41518
|
_this.startIndex = options.startIndex;
|
|
41519
|
+
var optionFlags = 0;
|
|
41520
|
+
if (options.allowAwaitOutsideFunction) {
|
|
41521
|
+
optionFlags |= 1;
|
|
41522
|
+
}
|
|
41523
|
+
if (options.allowReturnOutsideFunction) {
|
|
41524
|
+
optionFlags |= 2;
|
|
41525
|
+
}
|
|
41526
|
+
if (options.allowImportExportEverywhere) {
|
|
41527
|
+
optionFlags |= 8;
|
|
41528
|
+
}
|
|
41529
|
+
if (options.allowSuperOutsideMethod) {
|
|
41530
|
+
optionFlags |= 16;
|
|
41531
|
+
}
|
|
41532
|
+
if (options.allowUndeclaredExports) {
|
|
41533
|
+
optionFlags |= 32;
|
|
41534
|
+
}
|
|
41535
|
+
if (options.allowNewTargetOutsideFunction) {
|
|
41536
|
+
optionFlags |= 4;
|
|
41537
|
+
}
|
|
41538
|
+
if (options.ranges) {
|
|
41539
|
+
optionFlags |= 64;
|
|
41540
|
+
}
|
|
41541
|
+
if (options.tokens) {
|
|
41542
|
+
optionFlags |= 128;
|
|
41543
|
+
}
|
|
41544
|
+
if (options.createImportExpressions) {
|
|
41545
|
+
optionFlags |= 256;
|
|
41546
|
+
}
|
|
41547
|
+
if (options.createParenthesizedExpressions) {
|
|
41548
|
+
optionFlags |= 512;
|
|
41549
|
+
}
|
|
41550
|
+
if (options.errorRecovery) {
|
|
41551
|
+
optionFlags |= 1024;
|
|
41552
|
+
}
|
|
41553
|
+
if (options.attachComment) {
|
|
41554
|
+
optionFlags |= 2048;
|
|
41555
|
+
}
|
|
41556
|
+
if (options.annexB) {
|
|
41557
|
+
optionFlags |= 4096;
|
|
41558
|
+
}
|
|
41559
|
+
_this.optionFlags = optionFlags;
|
|
41238
41560
|
return _this;
|
|
41239
41561
|
}
|
|
41240
41562
|
_create_class(Parser, [
|
|
@@ -43865,17 +44187,50 @@ function TSAsExpression(node, parent) {
|
|
|
43865
44187
|
}
|
|
43866
44188
|
return Binary(node, parent);
|
|
43867
44189
|
}
|
|
44190
|
+
function TSConditionalType$1(node, parent) {
|
|
44191
|
+
var parentType = parent.type;
|
|
44192
|
+
if (parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType" || parentType === "TSTypeOperator" || parentType === "TSTypeParameter") {
|
|
44193
|
+
return true;
|
|
44194
|
+
}
|
|
44195
|
+
if ((parentType === "TSIntersectionType" || parentType === "TSUnionType") && parent.types[0] === node) {
|
|
44196
|
+
return true;
|
|
44197
|
+
}
|
|
44198
|
+
if (parentType === "TSConditionalType" && (parent.checkType === node || parent.extendsType === node)) {
|
|
44199
|
+
return true;
|
|
44200
|
+
}
|
|
44201
|
+
return false;
|
|
44202
|
+
}
|
|
43868
44203
|
function TSUnionType$1(node, parent) {
|
|
43869
44204
|
var parentType = parent.type;
|
|
43870
|
-
return parentType === "
|
|
44205
|
+
return parentType === "TSIntersectionType" || parentType === "TSTypeOperator" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType";
|
|
44206
|
+
}
|
|
44207
|
+
function TSIntersectionType$1(node, parent) {
|
|
44208
|
+
var parentType = parent.type;
|
|
44209
|
+
return parentType === "TSTypeOperator" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType";
|
|
43871
44210
|
}
|
|
43872
44211
|
function TSInferType$1(node, parent) {
|
|
43873
44212
|
var parentType = parent.type;
|
|
43874
|
-
|
|
44213
|
+
if (parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType") {
|
|
44214
|
+
return true;
|
|
44215
|
+
}
|
|
44216
|
+
if (node.typeParameter.constraint) {
|
|
44217
|
+
if ((parentType === "TSIntersectionType" || parentType === "TSUnionType") && parent.types[0] === node) {
|
|
44218
|
+
return true;
|
|
44219
|
+
}
|
|
44220
|
+
}
|
|
44221
|
+
return false;
|
|
44222
|
+
}
|
|
44223
|
+
function TSTypeOperator$1(node, parent) {
|
|
44224
|
+
var parentType = parent.type;
|
|
44225
|
+
return parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType";
|
|
43875
44226
|
}
|
|
43876
44227
|
function TSInstantiationExpression$1(node, parent) {
|
|
43877
44228
|
var parentType = parent.type;
|
|
43878
|
-
return (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.
|
|
44229
|
+
return (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.typeArguments;
|
|
44230
|
+
}
|
|
44231
|
+
function TSFunctionType$1(node, parent) {
|
|
44232
|
+
var parentType = parent.type;
|
|
44233
|
+
return parentType === "TSIntersectionType" || parentType === "TSUnionType" || parentType === "TSTypeOperator" || parentType === "TSOptionalType" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSConditionalType" && (parent.checkType === node || parent.extendsType === node);
|
|
43879
44234
|
}
|
|
43880
44235
|
function BinaryExpression(node, parent, tokenContext, inForStatementInit) {
|
|
43881
44236
|
return node.operator === "in" && inForStatementInit;
|
|
@@ -43992,11 +44347,15 @@ var parens = /* @__PURE__ */ Object.freeze({
|
|
|
43992
44347
|
OptionalMemberExpression: OptionalMemberExpression$1,
|
|
43993
44348
|
SequenceExpression: SequenceExpression$1,
|
|
43994
44349
|
TSAsExpression: TSAsExpression,
|
|
44350
|
+
TSConditionalType: TSConditionalType$1,
|
|
44351
|
+
TSConstructorType: TSFunctionType$1,
|
|
44352
|
+
TSFunctionType: TSFunctionType$1,
|
|
43995
44353
|
TSInferType: TSInferType$1,
|
|
43996
44354
|
TSInstantiationExpression: TSInstantiationExpression$1,
|
|
43997
|
-
TSIntersectionType:
|
|
44355
|
+
TSIntersectionType: TSIntersectionType$1,
|
|
43998
44356
|
TSSatisfiesExpression: TSAsExpression,
|
|
43999
44357
|
TSTypeAssertion: UnaryLike,
|
|
44358
|
+
TSTypeOperator: TSTypeOperator$1,
|
|
44000
44359
|
TSUnionType: TSUnionType$1,
|
|
44001
44360
|
UnaryLike: UnaryLike,
|
|
44002
44361
|
UnionTypeAnnotation: UnionTypeAnnotation$1,
|
|
@@ -44487,25 +44846,29 @@ function childrenIterator(node) {
|
|
|
44487
44846
|
}
|
|
44488
44847
|
function TaggedTemplateExpression(node) {
|
|
44489
44848
|
this.print(node.tag);
|
|
44490
|
-
|
|
44849
|
+
{
|
|
44850
|
+
this.print(node.typeArguments);
|
|
44851
|
+
}
|
|
44491
44852
|
this.print(node.quasi);
|
|
44492
44853
|
}
|
|
44493
44854
|
function TemplateElement() {
|
|
44494
44855
|
throw new Error("TemplateElement printing is handled in TemplateLiteral");
|
|
44495
44856
|
}
|
|
44496
|
-
function
|
|
44857
|
+
function _printTemplate(node, substitutions) {
|
|
44497
44858
|
var quasis = node.quasis;
|
|
44498
44859
|
var partRaw = "`";
|
|
44499
|
-
for(var i = 0; i < quasis.length; i++){
|
|
44860
|
+
for(var i = 0; i < quasis.length - 1; i++){
|
|
44500
44861
|
partRaw += quasis[i].value.raw;
|
|
44501
|
-
|
|
44502
|
-
|
|
44503
|
-
|
|
44504
|
-
partRaw = "}";
|
|
44505
|
-
}
|
|
44862
|
+
this.token(partRaw + "${", true);
|
|
44863
|
+
this.print(substitutions[i]);
|
|
44864
|
+
partRaw = "}";
|
|
44506
44865
|
}
|
|
44866
|
+
partRaw += quasis[quasis.length - 1].value.raw;
|
|
44507
44867
|
this.token(partRaw + "`", true);
|
|
44508
44868
|
}
|
|
44869
|
+
function TemplateLiteral(node) {
|
|
44870
|
+
this._printTemplate(node, node.expressions);
|
|
44871
|
+
}
|
|
44509
44872
|
var isCallExpression3 = lib_exports.isCallExpression, isLiteral2 = lib_exports.isLiteral, isMemberExpression2 = lib_exports.isMemberExpression, isNewExpression3 = lib_exports.isNewExpression, isPattern2 = lib_exports.isPattern;
|
|
44510
44873
|
function UnaryExpression(node) {
|
|
44511
44874
|
var operator = node.operator;
|
|
@@ -44563,7 +44926,6 @@ function NewExpression(node, parent) {
|
|
|
44563
44926
|
return;
|
|
44564
44927
|
}
|
|
44565
44928
|
this.print(node.typeArguments);
|
|
44566
|
-
this.print(node.typeParameters);
|
|
44567
44929
|
if (node.optional) {
|
|
44568
44930
|
this.token("?.");
|
|
44569
44931
|
}
|
|
@@ -44622,7 +44984,6 @@ function OptionalMemberExpression(node) {
|
|
|
44622
44984
|
}
|
|
44623
44985
|
function OptionalCallExpression(node) {
|
|
44624
44986
|
this.print(node.callee);
|
|
44625
|
-
this.print(node.typeParameters);
|
|
44626
44987
|
if (node.optional) {
|
|
44627
44988
|
this.token("?.");
|
|
44628
44989
|
}
|
|
@@ -44636,7 +44997,6 @@ function OptionalCallExpression(node) {
|
|
|
44636
44997
|
function CallExpression(node) {
|
|
44637
44998
|
this.print(node.callee);
|
|
44638
44999
|
this.print(node.typeArguments);
|
|
44639
|
-
this.print(node.typeParameters);
|
|
44640
45000
|
this.tokenChar(40);
|
|
44641
45001
|
var exit = this.enterDelimited();
|
|
44642
45002
|
this.printList(node.arguments, this.shouldPrintTrailingComma(")"));
|
|
@@ -45156,11 +45516,14 @@ function ClassAccessorProperty(node) {
|
|
|
45156
45516
|
}
|
|
45157
45517
|
function ClassPrivateProperty(node) {
|
|
45158
45518
|
this.printJoin(node.decorators);
|
|
45159
|
-
|
|
45160
|
-
this.word("static");
|
|
45161
|
-
this.space();
|
|
45162
|
-
}
|
|
45519
|
+
this.tsPrintClassMemberModifiers(node);
|
|
45163
45520
|
this.print(node.key);
|
|
45521
|
+
if (node.optional) {
|
|
45522
|
+
this.tokenChar(63);
|
|
45523
|
+
}
|
|
45524
|
+
if (node.definite) {
|
|
45525
|
+
this.tokenChar(33);
|
|
45526
|
+
}
|
|
45164
45527
|
this.print(node.typeAnnotation);
|
|
45165
45528
|
if (node.value) {
|
|
45166
45529
|
this.space();
|
|
@@ -45779,14 +46142,6 @@ function BigIntLiteral(node) {
|
|
|
45779
46142
|
}
|
|
45780
46143
|
this.word(node.value + "n");
|
|
45781
46144
|
}
|
|
45782
|
-
function DecimalLiteral(node) {
|
|
45783
|
-
var raw = this.getPossibleRaw(node);
|
|
45784
|
-
if (!this.format.minified && raw !== void 0) {
|
|
45785
|
-
this.word(raw);
|
|
45786
|
-
return;
|
|
45787
|
-
}
|
|
45788
|
-
this.word(node.value + "m");
|
|
45789
|
-
}
|
|
45790
46145
|
var validTopicTokenSet = /* @__PURE__ */ new Set([
|
|
45791
46146
|
"^^",
|
|
45792
46147
|
"@@",
|
|
@@ -46542,7 +46897,9 @@ function spaceSeparator() {
|
|
|
46542
46897
|
function JSXOpeningElement(node) {
|
|
46543
46898
|
this.tokenChar(60);
|
|
46544
46899
|
this.print(node.name);
|
|
46545
|
-
|
|
46900
|
+
{
|
|
46901
|
+
this.print(node.typeArguments);
|
|
46902
|
+
}
|
|
46546
46903
|
if (node.attributes.length > 0) {
|
|
46547
46904
|
this.space();
|
|
46548
46905
|
this.printJoin(node.attributes, void 0, void 0, spaceSeparator);
|
|
@@ -46820,8 +47177,9 @@ function TSTypeQuery(node) {
|
|
|
46820
47177
|
this.word("typeof");
|
|
46821
47178
|
this.space();
|
|
46822
47179
|
this.print(node.exprName);
|
|
46823
|
-
|
|
46824
|
-
|
|
47180
|
+
var typeArguments = node.typeArguments;
|
|
47181
|
+
if (typeArguments) {
|
|
47182
|
+
this.print(typeArguments);
|
|
46825
47183
|
}
|
|
46826
47184
|
}
|
|
46827
47185
|
function TSTypeLiteral(node) {
|
|
@@ -46954,12 +47312,15 @@ function tokenIfPlusMinus(self, tok) {
|
|
|
46954
47312
|
self.token(tok);
|
|
46955
47313
|
}
|
|
46956
47314
|
}
|
|
47315
|
+
function TSTemplateLiteralType(node) {
|
|
47316
|
+
this._printTemplate(node, node.types);
|
|
47317
|
+
}
|
|
46957
47318
|
function TSLiteralType(node) {
|
|
46958
47319
|
this.print(node.literal);
|
|
46959
47320
|
}
|
|
46960
47321
|
function TSClassImplements(node) {
|
|
46961
47322
|
this.print(node.expression);
|
|
46962
|
-
this.print(node.
|
|
47323
|
+
this.print(node.typeArguments);
|
|
46963
47324
|
}
|
|
46964
47325
|
function TSInterfaceDeclaration(node) {
|
|
46965
47326
|
var declare = node.declare, id = node.id, typeParameters = node.typeParameters, extendz = node.extends, body = node.body;
|
|
@@ -47020,11 +47381,12 @@ function TSTypeAssertion(node) {
|
|
|
47020
47381
|
}
|
|
47021
47382
|
function TSInstantiationExpression(node) {
|
|
47022
47383
|
this.print(node.expression);
|
|
47023
|
-
|
|
47384
|
+
{
|
|
47385
|
+
this.print(node.typeArguments);
|
|
47386
|
+
}
|
|
47024
47387
|
}
|
|
47025
47388
|
function TSEnumDeclaration(node) {
|
|
47026
|
-
var
|
|
47027
|
-
var declare = node.declare, isConst = node.const, id = node.id, members = node.members;
|
|
47389
|
+
var declare = node.declare, isConst = node.const, id = node.id;
|
|
47028
47390
|
if (declare) {
|
|
47029
47391
|
this.word("declare");
|
|
47030
47392
|
this.space();
|
|
@@ -47037,9 +47399,15 @@ function TSEnumDeclaration(node) {
|
|
|
47037
47399
|
this.space();
|
|
47038
47400
|
this.print(id);
|
|
47039
47401
|
this.space();
|
|
47402
|
+
{
|
|
47403
|
+
this.print(node.body);
|
|
47404
|
+
}
|
|
47405
|
+
}
|
|
47406
|
+
function TSEnumBody(node) {
|
|
47407
|
+
var _this = this;
|
|
47040
47408
|
printBraced(this, node, function() {
|
|
47041
47409
|
var _this_shouldPrintTrailingComma;
|
|
47042
|
-
return _this.printList(members, (_this_shouldPrintTrailingComma = _this.shouldPrintTrailingComma("}")) !== null && _this_shouldPrintTrailingComma !== void 0 ? _this_shouldPrintTrailingComma :
|
|
47410
|
+
return _this.printList(node.members, (_this_shouldPrintTrailingComma = _this.shouldPrintTrailingComma("}")) !== null && _this_shouldPrintTrailingComma !== void 0 ? _this_shouldPrintTrailingComma : false, true, true);
|
|
47043
47411
|
});
|
|
47044
47412
|
}
|
|
47045
47413
|
function TSEnumMember(node) {
|
|
@@ -47079,25 +47447,26 @@ function TSModuleBlock(node) {
|
|
|
47079
47447
|
});
|
|
47080
47448
|
}
|
|
47081
47449
|
function TSImportType(node) {
|
|
47082
|
-
var argument = node.argument, qualifier = node.qualifier,
|
|
47450
|
+
var argument = node.argument, qualifier = node.qualifier, options = node.options;
|
|
47083
47451
|
this.word("import");
|
|
47084
47452
|
this.tokenChar(40);
|
|
47085
47453
|
this.print(argument);
|
|
47454
|
+
if (options) {
|
|
47455
|
+
this.tokenChar(44);
|
|
47456
|
+
this.print(options);
|
|
47457
|
+
}
|
|
47086
47458
|
this.tokenChar(41);
|
|
47087
47459
|
if (qualifier) {
|
|
47088
47460
|
this.tokenChar(46);
|
|
47089
47461
|
this.print(qualifier);
|
|
47090
47462
|
}
|
|
47091
|
-
|
|
47092
|
-
|
|
47463
|
+
var typeArguments = node.typeArguments;
|
|
47464
|
+
if (typeArguments) {
|
|
47465
|
+
this.print(typeArguments);
|
|
47093
47466
|
}
|
|
47094
47467
|
}
|
|
47095
47468
|
function TSImportEqualsDeclaration(node) {
|
|
47096
|
-
var
|
|
47097
|
-
if (isExport) {
|
|
47098
|
-
this.word("export");
|
|
47099
|
-
this.space();
|
|
47100
|
-
}
|
|
47469
|
+
var id = node.id, moduleReference = node.moduleReference;
|
|
47101
47470
|
this.word("import");
|
|
47102
47471
|
this.space();
|
|
47103
47472
|
this.print(id);
|
|
@@ -47144,19 +47513,20 @@ function tsPrintSignatureDeclarationBase(node) {
|
|
|
47144
47513
|
this.print(returnType);
|
|
47145
47514
|
}
|
|
47146
47515
|
function tsPrintClassMemberModifiers(node) {
|
|
47147
|
-
var
|
|
47516
|
+
var isPrivateField = node.type === "ClassPrivateProperty";
|
|
47517
|
+
var isPublicField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty";
|
|
47148
47518
|
printModifiersList(this, node, [
|
|
47149
|
-
|
|
47150
|
-
node.accessibility
|
|
47519
|
+
isPublicField && node.declare && "declare",
|
|
47520
|
+
!isPrivateField && node.accessibility
|
|
47151
47521
|
]);
|
|
47152
47522
|
if (node.static) {
|
|
47153
47523
|
this.word("static");
|
|
47154
47524
|
this.space();
|
|
47155
47525
|
}
|
|
47156
47526
|
printModifiersList(this, node, [
|
|
47157
|
-
node.override && "override",
|
|
47158
|
-
node.abstract && "abstract",
|
|
47159
|
-
|
|
47527
|
+
!isPrivateField && node.override && "override",
|
|
47528
|
+
!isPrivateField && node.abstract && "abstract",
|
|
47529
|
+
(isPublicField || isPrivateField) && node.readonly && "readonly"
|
|
47160
47530
|
]);
|
|
47161
47531
|
}
|
|
47162
47532
|
function printBraced(printer, node, cb) {
|
|
@@ -47252,7 +47622,6 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
|
|
|
47252
47622
|
ConditionalExpression: ConditionalExpression,
|
|
47253
47623
|
ContinueStatement: ContinueStatement,
|
|
47254
47624
|
DebuggerStatement: DebuggerStatement,
|
|
47255
|
-
DecimalLiteral: DecimalLiteral,
|
|
47256
47625
|
DeclareClass: DeclareClass,
|
|
47257
47626
|
DeclareExportAllDeclaration: DeclareExportAllDeclaration,
|
|
47258
47627
|
DeclareExportDeclaration: DeclareExportDeclaration,
|
|
@@ -47389,10 +47758,10 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
|
|
|
47389
47758
|
TSConstructorType: TSConstructorType,
|
|
47390
47759
|
TSDeclareFunction: TSDeclareFunction,
|
|
47391
47760
|
TSDeclareMethod: TSDeclareMethod,
|
|
47761
|
+
TSEnumBody: TSEnumBody,
|
|
47392
47762
|
TSEnumDeclaration: TSEnumDeclaration,
|
|
47393
47763
|
TSEnumMember: TSEnumMember,
|
|
47394
47764
|
TSExportAssignment: TSExportAssignment,
|
|
47395
|
-
TSExpressionWithTypeArguments: TSClassImplements,
|
|
47396
47765
|
TSExternalModuleReference: TSExternalModuleReference,
|
|
47397
47766
|
TSFunctionType: TSFunctionType,
|
|
47398
47767
|
TSImportEqualsDeclaration: TSImportEqualsDeclaration,
|
|
@@ -47427,6 +47796,7 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
|
|
|
47427
47796
|
TSSatisfiesExpression: TSTypeExpression2,
|
|
47428
47797
|
TSStringKeyword: TSStringKeyword,
|
|
47429
47798
|
TSSymbolKeyword: TSSymbolKeyword,
|
|
47799
|
+
TSTemplateLiteralType: TSTemplateLiteralType,
|
|
47430
47800
|
TSThisType: TSThisType,
|
|
47431
47801
|
TSTupleType: TSTupleType,
|
|
47432
47802
|
TSTypeAliasDeclaration: TSTypeAliasDeclaration,
|
|
@@ -47482,6 +47852,7 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
|
|
|
47482
47852
|
_params: _params,
|
|
47483
47853
|
_predicate: _predicate,
|
|
47484
47854
|
_printAttributes: _printAttributes,
|
|
47855
|
+
_printTemplate: _printTemplate,
|
|
47485
47856
|
_shouldPrintArrowParamsParens: _shouldPrintArrowParamsParens,
|
|
47486
47857
|
_shouldPrintDecoratorsBeforeExport: _shouldPrintDecoratorsBeforeExport,
|
|
47487
47858
|
_variance: _variance,
|
|
@@ -47490,7 +47861,7 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
|
|
|
47490
47861
|
tsPrintPropertyOrMethodName: tsPrintPropertyOrMethodName,
|
|
47491
47862
|
tsPrintSignatureDeclarationBase: tsPrintSignatureDeclarationBase
|
|
47492
47863
|
});
|
|
47493
|
-
var isExpression2 = lib_exports.isExpression, isFunction3 = lib_exports.isFunction, isStatement3 = lib_exports.isStatement, isClassBody2 = lib_exports.isClassBody, isTSInterfaceBody2 = lib_exports.isTSInterfaceBody,
|
|
47864
|
+
var isExpression2 = lib_exports.isExpression, isFunction3 = lib_exports.isFunction, isStatement3 = lib_exports.isStatement, isClassBody2 = lib_exports.isClassBody, isTSInterfaceBody2 = lib_exports.isTSInterfaceBody, isTSEnumMember2 = lib_exports.isTSEnumMember;
|
|
47494
47865
|
var SCIENTIFIC_NOTATION = /e/i;
|
|
47495
47866
|
var ZERO_DECIMAL_INTEGER = /\.0+$/;
|
|
47496
47867
|
var HAS_NEWLINE = /[\n\r\u2028\u2029]/;
|
|
@@ -48376,7 +48747,7 @@ var Printer = /*#__PURE__*/ function() {
|
|
|
48376
48747
|
}
|
|
48377
48748
|
if (len === 1) {
|
|
48378
48749
|
var singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value);
|
|
48379
|
-
var shouldSkipNewline = singleLine && !isStatement3(node) && !isClassBody2(parent) && !isTSInterfaceBody2(parent) && !
|
|
48750
|
+
var shouldSkipNewline = singleLine && !isStatement3(node) && !isClassBody2(parent) && !isTSInterfaceBody2(parent) && !isTSEnumMember2(node);
|
|
48380
48751
|
if (type === 0) {
|
|
48381
48752
|
this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction3(parent, {
|
|
48382
48753
|
body: node
|
|
@@ -48897,7 +49268,7 @@ function verify$1(visitor) {
|
|
|
48897
49268
|
}
|
|
48898
49269
|
if (shouldIgnoreKey(nodeType)) continue;
|
|
48899
49270
|
if (!TYPES2.includes(nodeType)) {
|
|
48900
|
-
throw new Error("You gave us a visitor for the node type ".concat(nodeType, " but it's not a valid type in @babel/traverse ", "8.0.0-alpha.
|
|
49271
|
+
throw new Error("You gave us a visitor for the node type ".concat(nodeType, " but it's not a valid type in @babel/traverse ", "8.0.0-alpha.16"));
|
|
48901
49272
|
}
|
|
48902
49273
|
var visitors2 = visitor[nodeType];
|
|
48903
49274
|
if ((typeof visitors2 === "undefined" ? "undefined" : _type_of(visitors2)) === "object") {
|
|
@@ -49553,7 +49924,15 @@ var collectorVisitor = {
|
|
|
49553
49924
|
var parent = path.scope.getBlockParent();
|
|
49554
49925
|
parent.registerDeclaration(path);
|
|
49555
49926
|
},
|
|
49927
|
+
TSImportEqualsDeclaration: function TSImportEqualsDeclaration(path) {
|
|
49928
|
+
var parent = path.scope.getBlockParent();
|
|
49929
|
+
parent.registerDeclaration(path);
|
|
49930
|
+
},
|
|
49556
49931
|
ReferencedIdentifier: function ReferencedIdentifier(path, state) {
|
|
49932
|
+
if (isTSQualifiedName(path.parent) && path.parent.right === path.node) {
|
|
49933
|
+
return;
|
|
49934
|
+
}
|
|
49935
|
+
if (path.parentPath.isTSImportEqualsDeclaration()) return;
|
|
49557
49936
|
state.references.push(path);
|
|
49558
49937
|
},
|
|
49559
49938
|
ForXStatement: function ForXStatement(path, state) {
|