@amplitude/ai 0.2.1 → 0.3.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/.claude/commands/instrument-with-amplitude-ai.md +12 -0
- package/.cursor/skills/instrument-with-amplitude-ai/SKILL.md +4 -42
- package/AGENTS.md +86 -28
- package/README.md +190 -111
- package/amplitude-ai.md +463 -0
- package/bin/amplitude-ai-doctor.mjs +0 -0
- package/bin/amplitude-ai-instrument.mjs +0 -0
- package/bin/amplitude-ai-mcp.mjs +0 -0
- package/bin/amplitude-ai-register-catalog.mjs +0 -0
- package/bin/amplitude-ai-status.mjs +0 -0
- package/bin/amplitude-ai.mjs +14 -5
- package/data/agent_event_catalog.json +52 -2
- package/dist/bound-agent.d.ts +18 -14
- package/dist/bound-agent.d.ts.map +1 -1
- package/dist/bound-agent.js +4 -1
- package/dist/bound-agent.js.map +1 -1
- package/dist/cli/status.d.ts.map +1 -1
- package/dist/cli/status.js +31 -19
- package/dist/cli/status.js.map +1 -1
- package/dist/client.d.ts +14 -14
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +38 -0
- package/dist/client.js.map +1 -1
- package/dist/context.d.ts +5 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +4 -0
- package/dist/context.js.map +1 -1
- package/dist/core/constants.d.ts +3 -1
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +3 -1
- package/dist/core/constants.js.map +1 -1
- package/dist/core/tracking.d.ts +12 -2
- package/dist/core/tracking.d.ts.map +1 -1
- package/dist/core/tracking.js +13 -2
- package/dist/core/tracking.js.map +1 -1
- package/dist/decorators.d.ts +1 -1
- package/dist/decorators.d.ts.map +1 -1
- package/dist/decorators.js +4 -3
- package/dist/decorators.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +5 -2
- package/dist/mcp/contract.d.ts +4 -0
- package/dist/mcp/contract.d.ts.map +1 -1
- package/dist/mcp/contract.js +6 -2
- package/dist/mcp/contract.js.map +1 -1
- package/dist/mcp/generate-verify-test.d.ts +7 -0
- package/dist/mcp/generate-verify-test.d.ts.map +1 -0
- package/dist/mcp/generate-verify-test.js +25 -0
- package/dist/mcp/generate-verify-test.js.map +1 -0
- package/dist/mcp/index.d.ts +2 -1
- package/dist/mcp/index.js +2 -1
- package/dist/mcp/instrument-file.d.ts +14 -0
- package/dist/mcp/instrument-file.d.ts.map +1 -0
- package/dist/mcp/instrument-file.js +139 -0
- package/dist/mcp/instrument-file.js.map +1 -0
- package/dist/mcp/scan-project.d.ts +52 -0
- package/dist/mcp/scan-project.d.ts.map +1 -0
- package/dist/mcp/scan-project.js +309 -0
- package/dist/mcp/scan-project.js.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +79 -4
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/validate-file.d.ts +4 -0
- package/dist/mcp/validate-file.d.ts.map +1 -1
- package/dist/mcp/validate-file.js +559 -11
- package/dist/mcp/validate-file.js.map +1 -1
- package/dist/middleware.js +2 -1
- package/dist/middleware.js.map +1 -1
- package/dist/node_modules/.pnpm/acorn-typescript@1.4.13_acorn@8.16.0/node_modules/acorn-typescript/lib/index.js +2389 -0
- package/dist/node_modules/.pnpm/acorn-typescript@1.4.13_acorn@8.16.0/node_modules/acorn-typescript/lib/index.js.map +1 -0
- package/dist/node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.js +5128 -0
- package/dist/node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js +1 -1
- package/dist/patching.d.ts.map +1 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +1 -0
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/base.d.ts +2 -1
- package/dist/providers/base.d.ts.map +1 -1
- package/dist/providers/base.js +4 -0
- package/dist/providers/base.js.map +1 -1
- package/dist/providers/openai.d.ts.map +1 -1
- package/dist/providers/openai.js +2 -0
- package/dist/providers/openai.js.map +1 -1
- package/dist/serverless.d.ts +19 -0
- package/dist/serverless.d.ts.map +1 -0
- package/dist/serverless.js +35 -0
- package/dist/serverless.js.map +1 -0
- package/dist/session.d.ts +24 -8
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +20 -1
- package/dist/session.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/llms-full.txt +353 -69
- package/llms.txt +6 -2
- package/mcp.schema.json +7 -3
- package/package.json +10 -5
- package/bin/amplitude-ai-init.mjs +0 -27
- package/dist/cli/init.d.ts +0 -14
- package/dist/cli/init.d.ts.map +0 -1
- package/dist/cli/init.js +0 -40
- package/dist/cli/init.js.map +0 -1
|
@@ -0,0 +1,2389 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_acorn } from "../../../../acorn@8.16.0/node_modules/acorn/dist/acorn.js";
|
|
3
|
+
|
|
4
|
+
//#region node_modules/.pnpm/acorn-typescript@1.4.13_acorn@8.16.0/node_modules/acorn-typescript/lib/index.js
|
|
5
|
+
var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
|
+
var t = require_acorn();
|
|
7
|
+
function e(t) {
|
|
8
|
+
if (t && t.__esModule) return t;
|
|
9
|
+
var e = Object.create(null);
|
|
10
|
+
return t && Object.keys(t).forEach(function(s) {
|
|
11
|
+
if ("default" !== s) {
|
|
12
|
+
var i = Object.getOwnPropertyDescriptor(t, s);
|
|
13
|
+
Object.defineProperty(e, s, i.get ? i : {
|
|
14
|
+
enumerable: !0,
|
|
15
|
+
get: function() {
|
|
16
|
+
return t[s];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}), e.default = t, e;
|
|
21
|
+
}
|
|
22
|
+
var s = /* @__PURE__ */ e(t);
|
|
23
|
+
function i(t, e) {
|
|
24
|
+
for (var s = 0; s < e.length; s++) {
|
|
25
|
+
var i = e[s];
|
|
26
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, "symbol" == typeof (r = function(t$1, e$1) {
|
|
27
|
+
if ("object" != typeof t$1 || null === t$1) return t$1;
|
|
28
|
+
var s$1 = t$1[Symbol.toPrimitive];
|
|
29
|
+
if (void 0 !== s$1) {
|
|
30
|
+
var i$1 = s$1.call(t$1, "string");
|
|
31
|
+
if ("object" != typeof i$1) return i$1;
|
|
32
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
33
|
+
}
|
|
34
|
+
return String(t$1);
|
|
35
|
+
}(i.key)) ? r : String(r), i);
|
|
36
|
+
}
|
|
37
|
+
var r;
|
|
38
|
+
}
|
|
39
|
+
function r() {
|
|
40
|
+
return r = Object.assign ? Object.assign.bind() : function(t) {
|
|
41
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
42
|
+
var s = arguments[e];
|
|
43
|
+
for (var i in s) Object.prototype.hasOwnProperty.call(s, i) && (t[i] = s[i]);
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
}, r.apply(this, arguments);
|
|
47
|
+
}
|
|
48
|
+
function a(t, e) {
|
|
49
|
+
t.prototype = Object.create(e.prototype), t.prototype.constructor = t, n(t, e);
|
|
50
|
+
}
|
|
51
|
+
function n(t, e) {
|
|
52
|
+
return n = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t$1, e$1) {
|
|
53
|
+
return t$1.__proto__ = e$1, t$1;
|
|
54
|
+
}, n(t, e);
|
|
55
|
+
}
|
|
56
|
+
function o(t, e) {
|
|
57
|
+
(null == e || e > t.length) && (e = t.length);
|
|
58
|
+
for (var s = 0, i = new Array(e); s < e; s++) i[s] = t[s];
|
|
59
|
+
return i;
|
|
60
|
+
}
|
|
61
|
+
function h(t, e) {
|
|
62
|
+
var s = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
63
|
+
if (s) return (s = s.call(t)).next.bind(s);
|
|
64
|
+
if (Array.isArray(t) || (s = function(t$1, e$1) {
|
|
65
|
+
if (t$1) {
|
|
66
|
+
if ("string" == typeof t$1) return o(t$1, e$1);
|
|
67
|
+
var s$1 = Object.prototype.toString.call(t$1).slice(8, -1);
|
|
68
|
+
return "Object" === s$1 && t$1.constructor && (s$1 = t$1.constructor.name), "Map" === s$1 || "Set" === s$1 ? Array.from(t$1) : "Arguments" === s$1 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s$1) ? o(t$1, e$1) : void 0;
|
|
69
|
+
}
|
|
70
|
+
}(t)) || e && t && "number" == typeof t.length) {
|
|
71
|
+
s && (t = s);
|
|
72
|
+
var i = 0;
|
|
73
|
+
return function() {
|
|
74
|
+
return i >= t.length ? { done: !0 } : {
|
|
75
|
+
done: !1,
|
|
76
|
+
value: t[i++]
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
81
|
+
}
|
|
82
|
+
var p = !0;
|
|
83
|
+
function c(e, s) {
|
|
84
|
+
return void 0 === s && (s = {}), new t.TokenType("name", s);
|
|
85
|
+
}
|
|
86
|
+
var l = /* @__PURE__ */ new WeakMap(), u = 1024, d = new RegExp("(?:[^\\S\\n\\r\\u2028\\u2029]|\\/\\/.*|\\/\\*.*?\\*\\/)*", "y"), m = new RegExp("(?=(" + d.source + "))\\1" + /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y"), y = function() {
|
|
87
|
+
this.shorthandAssign = void 0, this.trailingComma = void 0, this.parenthesizedAssign = void 0, this.parenthesizedBind = void 0, this.doubleProto = void 0, this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
88
|
+
};
|
|
89
|
+
function f(t, e) {
|
|
90
|
+
var s = e.key.name, i = t[s], r = "true";
|
|
91
|
+
return "MethodDefinition" !== e.type || "get" !== e.kind && "set" !== e.kind || (r = (e.static ? "s" : "i") + e.kind), "iget" === i && "iset" === r || "iset" === i && "iget" === r || "sget" === i && "sset" === r || "sset" === i && "sget" === r ? (t[s] = "true", !1) : !!i || (t[s] = r, !1);
|
|
92
|
+
}
|
|
93
|
+
function x(t, e) {
|
|
94
|
+
var s = t.key;
|
|
95
|
+
return !t.computed && ("Identifier" === s.type && s.name === e || "Literal" === s.type && s.value === e);
|
|
96
|
+
}
|
|
97
|
+
var T = {
|
|
98
|
+
AbstractMethodHasImplementation: function(t) {
|
|
99
|
+
return "Method '" + t.methodName + "' cannot have an implementation because it is marked abstract.";
|
|
100
|
+
},
|
|
101
|
+
AbstractPropertyHasInitializer: function(t) {
|
|
102
|
+
return "Property '" + t.propertyName + "' cannot have an initializer because it is marked abstract.";
|
|
103
|
+
},
|
|
104
|
+
AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
|
|
105
|
+
AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
|
|
106
|
+
CannotFindName: function(t) {
|
|
107
|
+
return "Cannot find name '" + t.name + "'.";
|
|
108
|
+
},
|
|
109
|
+
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
|
|
110
|
+
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
|
|
111
|
+
ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
|
|
112
|
+
ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
|
|
113
|
+
DeclareAccessor: function(t) {
|
|
114
|
+
return "'declare' is not allowed in " + t.kind + "ters.";
|
|
115
|
+
},
|
|
116
|
+
DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
|
|
117
|
+
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
|
118
|
+
DuplicateAccessibilityModifier: function() {
|
|
119
|
+
return "Accessibility modifier already seen.";
|
|
120
|
+
},
|
|
121
|
+
DuplicateModifier: function(t) {
|
|
122
|
+
return "Duplicate modifier: '" + t.modifier + "'.";
|
|
123
|
+
},
|
|
124
|
+
EmptyHeritageClauseType: function(t) {
|
|
125
|
+
return "'" + t.token + "' list cannot be empty.";
|
|
126
|
+
},
|
|
127
|
+
EmptyTypeArguments: "Type argument list cannot be empty.",
|
|
128
|
+
EmptyTypeParameters: "Type parameter list cannot be empty.",
|
|
129
|
+
ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
|
|
130
|
+
ImportAliasHasImportType: "An import alias can not use 'import type'.",
|
|
131
|
+
IncompatibleModifiers: function(t) {
|
|
132
|
+
var e = t.modifiers;
|
|
133
|
+
return "'" + e[0] + "' modifier cannot be used with '" + e[1] + "' modifier.";
|
|
134
|
+
},
|
|
135
|
+
IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
|
|
136
|
+
IndexSignatureHasAccessibility: function(t) {
|
|
137
|
+
return "Index signatures cannot have an accessibility modifier ('" + t.modifier + "').";
|
|
138
|
+
},
|
|
139
|
+
IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
|
|
140
|
+
IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
|
|
141
|
+
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
|
|
142
|
+
InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
|
|
143
|
+
InvalidModifierOnTypeMember: function(t) {
|
|
144
|
+
return "'" + t.modifier + "' modifier cannot appear on a type member.";
|
|
145
|
+
},
|
|
146
|
+
InvalidModifierOnTypeParameter: function(t) {
|
|
147
|
+
return "'" + t.modifier + "' modifier cannot appear on a type parameter.";
|
|
148
|
+
},
|
|
149
|
+
InvalidModifierOnTypeParameterPositions: function(t) {
|
|
150
|
+
return "'" + t.modifier + "' modifier can only appear on a type parameter of a class, interface or type alias.";
|
|
151
|
+
},
|
|
152
|
+
InvalidModifiersOrder: function(t) {
|
|
153
|
+
var e = t.orderedModifiers;
|
|
154
|
+
return "'" + e[0] + "' modifier must precede '" + e[1] + "' modifier.";
|
|
155
|
+
},
|
|
156
|
+
InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",
|
|
157
|
+
InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
|
|
158
|
+
MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
|
|
159
|
+
MixedLabeledAndUnlabeledElements: "Tuple members must all have names or all not have names.",
|
|
160
|
+
NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
|
|
161
|
+
NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.",
|
|
162
|
+
OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
|
|
163
|
+
OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
|
|
164
|
+
PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
|
|
165
|
+
PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
|
|
166
|
+
PrivateElementHasAccessibility: function(t) {
|
|
167
|
+
return "Private elements cannot have an accessibility modifier ('" + t.modifier + "').";
|
|
168
|
+
},
|
|
169
|
+
PrivateMethodsHasAccessibility: function(t) {
|
|
170
|
+
return "Private methods cannot have an accessibility modifier ('" + t.modifier + "').";
|
|
171
|
+
},
|
|
172
|
+
ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
|
|
173
|
+
ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
|
|
174
|
+
ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
|
|
175
|
+
SetAccesorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
|
|
176
|
+
SetAccesorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
|
|
177
|
+
SetAccesorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
|
|
178
|
+
SingleTypeParameterWithoutTrailingComma: function(t) {
|
|
179
|
+
var e = t.typeParameterName;
|
|
180
|
+
return "Single type parameter " + e + " should have a trailing comma. Example usage: <" + e + ",>.";
|
|
181
|
+
},
|
|
182
|
+
StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
|
|
183
|
+
TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
|
|
184
|
+
TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
|
|
185
|
+
TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",
|
|
186
|
+
TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",
|
|
187
|
+
UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
|
|
188
|
+
UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
|
|
189
|
+
GenericsEndWithComma: "Trailing comma is not allowed at the end of generics.",
|
|
190
|
+
UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
|
|
191
|
+
UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
|
|
192
|
+
UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.",
|
|
193
|
+
UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
|
|
194
|
+
UnsupportedSignatureParameterKind: function(t) {
|
|
195
|
+
return "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got " + t.type + ".";
|
|
196
|
+
},
|
|
197
|
+
LetInLexicalBinding: "'let' is not allowed to be used as a name in 'let' or 'const' declarations."
|
|
198
|
+
}, v = {
|
|
199
|
+
quot: "\"",
|
|
200
|
+
amp: "&",
|
|
201
|
+
apos: "'",
|
|
202
|
+
lt: "<",
|
|
203
|
+
gt: ">",
|
|
204
|
+
nbsp: "\xA0",
|
|
205
|
+
iexcl: "¡",
|
|
206
|
+
cent: "¢",
|
|
207
|
+
pound: "£",
|
|
208
|
+
curren: "¤",
|
|
209
|
+
yen: "¥",
|
|
210
|
+
brvbar: "¦",
|
|
211
|
+
sect: "§",
|
|
212
|
+
uml: "¨",
|
|
213
|
+
copy: "©",
|
|
214
|
+
ordf: "ª",
|
|
215
|
+
laquo: "«",
|
|
216
|
+
not: "¬",
|
|
217
|
+
shy: "",
|
|
218
|
+
reg: "®",
|
|
219
|
+
macr: "¯",
|
|
220
|
+
deg: "°",
|
|
221
|
+
plusmn: "±",
|
|
222
|
+
sup2: "²",
|
|
223
|
+
sup3: "³",
|
|
224
|
+
acute: "´",
|
|
225
|
+
micro: "µ",
|
|
226
|
+
para: "¶",
|
|
227
|
+
middot: "·",
|
|
228
|
+
cedil: "¸",
|
|
229
|
+
sup1: "¹",
|
|
230
|
+
ordm: "º",
|
|
231
|
+
raquo: "»",
|
|
232
|
+
frac14: "¼",
|
|
233
|
+
frac12: "½",
|
|
234
|
+
frac34: "¾",
|
|
235
|
+
iquest: "¿",
|
|
236
|
+
Agrave: "À",
|
|
237
|
+
Aacute: "Á",
|
|
238
|
+
Acirc: "Â",
|
|
239
|
+
Atilde: "Ã",
|
|
240
|
+
Auml: "Ä",
|
|
241
|
+
Aring: "Å",
|
|
242
|
+
AElig: "Æ",
|
|
243
|
+
Ccedil: "Ç",
|
|
244
|
+
Egrave: "È",
|
|
245
|
+
Eacute: "É",
|
|
246
|
+
Ecirc: "Ê",
|
|
247
|
+
Euml: "Ë",
|
|
248
|
+
Igrave: "Ì",
|
|
249
|
+
Iacute: "Í",
|
|
250
|
+
Icirc: "Î",
|
|
251
|
+
Iuml: "Ï",
|
|
252
|
+
ETH: "Ð",
|
|
253
|
+
Ntilde: "Ñ",
|
|
254
|
+
Ograve: "Ò",
|
|
255
|
+
Oacute: "Ó",
|
|
256
|
+
Ocirc: "Ô",
|
|
257
|
+
Otilde: "Õ",
|
|
258
|
+
Ouml: "Ö",
|
|
259
|
+
times: "×",
|
|
260
|
+
Oslash: "Ø",
|
|
261
|
+
Ugrave: "Ù",
|
|
262
|
+
Uacute: "Ú",
|
|
263
|
+
Ucirc: "Û",
|
|
264
|
+
Uuml: "Ü",
|
|
265
|
+
Yacute: "Ý",
|
|
266
|
+
THORN: "Þ",
|
|
267
|
+
szlig: "ß",
|
|
268
|
+
agrave: "à",
|
|
269
|
+
aacute: "á",
|
|
270
|
+
acirc: "â",
|
|
271
|
+
atilde: "ã",
|
|
272
|
+
auml: "ä",
|
|
273
|
+
aring: "å",
|
|
274
|
+
aelig: "æ",
|
|
275
|
+
ccedil: "ç",
|
|
276
|
+
egrave: "è",
|
|
277
|
+
eacute: "é",
|
|
278
|
+
ecirc: "ê",
|
|
279
|
+
euml: "ë",
|
|
280
|
+
igrave: "ì",
|
|
281
|
+
iacute: "í",
|
|
282
|
+
icirc: "î",
|
|
283
|
+
iuml: "ï",
|
|
284
|
+
eth: "ð",
|
|
285
|
+
ntilde: "ñ",
|
|
286
|
+
ograve: "ò",
|
|
287
|
+
oacute: "ó",
|
|
288
|
+
ocirc: "ô",
|
|
289
|
+
otilde: "õ",
|
|
290
|
+
ouml: "ö",
|
|
291
|
+
divide: "÷",
|
|
292
|
+
oslash: "ø",
|
|
293
|
+
ugrave: "ù",
|
|
294
|
+
uacute: "ú",
|
|
295
|
+
ucirc: "û",
|
|
296
|
+
uuml: "ü",
|
|
297
|
+
yacute: "ý",
|
|
298
|
+
thorn: "þ",
|
|
299
|
+
yuml: "ÿ",
|
|
300
|
+
OElig: "Œ",
|
|
301
|
+
oelig: "œ",
|
|
302
|
+
Scaron: "Š",
|
|
303
|
+
scaron: "š",
|
|
304
|
+
Yuml: "Ÿ",
|
|
305
|
+
fnof: "ƒ",
|
|
306
|
+
circ: "ˆ",
|
|
307
|
+
tilde: "˜",
|
|
308
|
+
Alpha: "Α",
|
|
309
|
+
Beta: "Β",
|
|
310
|
+
Gamma: "Γ",
|
|
311
|
+
Delta: "Δ",
|
|
312
|
+
Epsilon: "Ε",
|
|
313
|
+
Zeta: "Ζ",
|
|
314
|
+
Eta: "Η",
|
|
315
|
+
Theta: "Θ",
|
|
316
|
+
Iota: "Ι",
|
|
317
|
+
Kappa: "Κ",
|
|
318
|
+
Lambda: "Λ",
|
|
319
|
+
Mu: "Μ",
|
|
320
|
+
Nu: "Ν",
|
|
321
|
+
Xi: "Ξ",
|
|
322
|
+
Omicron: "Ο",
|
|
323
|
+
Pi: "Π",
|
|
324
|
+
Rho: "Ρ",
|
|
325
|
+
Sigma: "Σ",
|
|
326
|
+
Tau: "Τ",
|
|
327
|
+
Upsilon: "Υ",
|
|
328
|
+
Phi: "Φ",
|
|
329
|
+
Chi: "Χ",
|
|
330
|
+
Psi: "Ψ",
|
|
331
|
+
Omega: "Ω",
|
|
332
|
+
alpha: "α",
|
|
333
|
+
beta: "β",
|
|
334
|
+
gamma: "γ",
|
|
335
|
+
delta: "δ",
|
|
336
|
+
epsilon: "ε",
|
|
337
|
+
zeta: "ζ",
|
|
338
|
+
eta: "η",
|
|
339
|
+
theta: "θ",
|
|
340
|
+
iota: "ι",
|
|
341
|
+
kappa: "κ",
|
|
342
|
+
lambda: "λ",
|
|
343
|
+
mu: "μ",
|
|
344
|
+
nu: "ν",
|
|
345
|
+
xi: "ξ",
|
|
346
|
+
omicron: "ο",
|
|
347
|
+
pi: "π",
|
|
348
|
+
rho: "ρ",
|
|
349
|
+
sigmaf: "ς",
|
|
350
|
+
sigma: "σ",
|
|
351
|
+
tau: "τ",
|
|
352
|
+
upsilon: "υ",
|
|
353
|
+
phi: "φ",
|
|
354
|
+
chi: "χ",
|
|
355
|
+
psi: "ψ",
|
|
356
|
+
omega: "ω",
|
|
357
|
+
thetasym: "ϑ",
|
|
358
|
+
upsih: "ϒ",
|
|
359
|
+
piv: "ϖ",
|
|
360
|
+
ensp: " ",
|
|
361
|
+
emsp: " ",
|
|
362
|
+
thinsp: " ",
|
|
363
|
+
zwnj: "",
|
|
364
|
+
zwj: "",
|
|
365
|
+
lrm: "",
|
|
366
|
+
rlm: "",
|
|
367
|
+
ndash: "–",
|
|
368
|
+
mdash: "—",
|
|
369
|
+
lsquo: "‘",
|
|
370
|
+
rsquo: "’",
|
|
371
|
+
sbquo: "‚",
|
|
372
|
+
ldquo: "“",
|
|
373
|
+
rdquo: "”",
|
|
374
|
+
bdquo: "„",
|
|
375
|
+
dagger: "†",
|
|
376
|
+
Dagger: "‡",
|
|
377
|
+
bull: "•",
|
|
378
|
+
hellip: "…",
|
|
379
|
+
permil: "‰",
|
|
380
|
+
prime: "′",
|
|
381
|
+
Prime: "″",
|
|
382
|
+
lsaquo: "‹",
|
|
383
|
+
rsaquo: "›",
|
|
384
|
+
oline: "‾",
|
|
385
|
+
frasl: "⁄",
|
|
386
|
+
euro: "€",
|
|
387
|
+
image: "ℑ",
|
|
388
|
+
weierp: "℘",
|
|
389
|
+
real: "ℜ",
|
|
390
|
+
trade: "™",
|
|
391
|
+
alefsym: "ℵ",
|
|
392
|
+
larr: "←",
|
|
393
|
+
uarr: "↑",
|
|
394
|
+
rarr: "→",
|
|
395
|
+
darr: "↓",
|
|
396
|
+
harr: "↔",
|
|
397
|
+
crarr: "↵",
|
|
398
|
+
lArr: "⇐",
|
|
399
|
+
uArr: "⇑",
|
|
400
|
+
rArr: "⇒",
|
|
401
|
+
dArr: "⇓",
|
|
402
|
+
hArr: "⇔",
|
|
403
|
+
forall: "∀",
|
|
404
|
+
part: "∂",
|
|
405
|
+
exist: "∃",
|
|
406
|
+
empty: "∅",
|
|
407
|
+
nabla: "∇",
|
|
408
|
+
isin: "∈",
|
|
409
|
+
notin: "∉",
|
|
410
|
+
ni: "∋",
|
|
411
|
+
prod: "∏",
|
|
412
|
+
sum: "∑",
|
|
413
|
+
minus: "−",
|
|
414
|
+
lowast: "∗",
|
|
415
|
+
radic: "√",
|
|
416
|
+
prop: "∝",
|
|
417
|
+
infin: "∞",
|
|
418
|
+
ang: "∠",
|
|
419
|
+
and: "∧",
|
|
420
|
+
or: "∨",
|
|
421
|
+
cap: "∩",
|
|
422
|
+
cup: "∪",
|
|
423
|
+
int: "∫",
|
|
424
|
+
there4: "∴",
|
|
425
|
+
sim: "∼",
|
|
426
|
+
cong: "≅",
|
|
427
|
+
asymp: "≈",
|
|
428
|
+
ne: "≠",
|
|
429
|
+
equiv: "≡",
|
|
430
|
+
le: "≤",
|
|
431
|
+
ge: "≥",
|
|
432
|
+
sub: "⊂",
|
|
433
|
+
sup: "⊃",
|
|
434
|
+
nsub: "⊄",
|
|
435
|
+
sube: "⊆",
|
|
436
|
+
supe: "⊇",
|
|
437
|
+
oplus: "⊕",
|
|
438
|
+
otimes: "⊗",
|
|
439
|
+
perp: "⊥",
|
|
440
|
+
sdot: "⋅",
|
|
441
|
+
lceil: "⌈",
|
|
442
|
+
rceil: "⌉",
|
|
443
|
+
lfloor: "⌊",
|
|
444
|
+
rfloor: "⌋",
|
|
445
|
+
lang: "〈",
|
|
446
|
+
rang: "〉",
|
|
447
|
+
loz: "◊",
|
|
448
|
+
spades: "♠",
|
|
449
|
+
clubs: "♣",
|
|
450
|
+
hearts: "♥",
|
|
451
|
+
diams: "♦"
|
|
452
|
+
}, P = /^[\da-fA-F]+$/, b = /^\d+$/;
|
|
453
|
+
function g(t) {
|
|
454
|
+
return t ? "JSXIdentifier" === t.type ? t.name : "JSXNamespacedName" === t.type ? t.namespace.name + ":" + t.name.name : "JSXMemberExpression" === t.type ? g(t.object) + "." + g(t.property) : void 0 : t;
|
|
455
|
+
}
|
|
456
|
+
var A = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
457
|
+
function S(t) {
|
|
458
|
+
if (!t) throw new Error("Assert fail");
|
|
459
|
+
}
|
|
460
|
+
function k(t) {
|
|
461
|
+
return "accessor" === t;
|
|
462
|
+
}
|
|
463
|
+
function C(t) {
|
|
464
|
+
return "in" === t || "out" === t;
|
|
465
|
+
}
|
|
466
|
+
function E(t, e) {
|
|
467
|
+
return 2 | (t ? 4 : 0) | (e ? 8 : 0);
|
|
468
|
+
}
|
|
469
|
+
function I(t) {
|
|
470
|
+
if ("MemberExpression" !== t.type) return !1;
|
|
471
|
+
var e = t.property;
|
|
472
|
+
return (!t.computed || !("TemplateLiteral" !== e.type || e.expressions.length > 0)) && N(t.object);
|
|
473
|
+
}
|
|
474
|
+
function N(t) {
|
|
475
|
+
return "Identifier" === t.type || "MemberExpression" === t.type && !t.computed && N(t.object);
|
|
476
|
+
}
|
|
477
|
+
function w(t) {
|
|
478
|
+
return "private" === t || "public" === t || "protected" === t;
|
|
479
|
+
}
|
|
480
|
+
function L(e) {
|
|
481
|
+
var n = e || {}, o = n.dts, d = void 0 !== o && o, N = n.allowSatisfies, L = void 0 !== N && N;
|
|
482
|
+
return function(n$1) {
|
|
483
|
+
var o$1 = n$1.acorn || s, N$1 = function(e$1) {
|
|
484
|
+
var s = l.get(e$1.Parser.acorn || e$1);
|
|
485
|
+
if (!s) {
|
|
486
|
+
var i = {
|
|
487
|
+
assert: c(0, { startsExpr: p }),
|
|
488
|
+
asserts: c(0, { startsExpr: p }),
|
|
489
|
+
global: c(0, { startsExpr: p }),
|
|
490
|
+
keyof: c(0, { startsExpr: p }),
|
|
491
|
+
readonly: c(0, { startsExpr: p }),
|
|
492
|
+
unique: c(0, { startsExpr: p }),
|
|
493
|
+
abstract: c(0, { startsExpr: p }),
|
|
494
|
+
declare: c(0, { startsExpr: p }),
|
|
495
|
+
enum: c(0, { startsExpr: p }),
|
|
496
|
+
module: c(0, { startsExpr: p }),
|
|
497
|
+
namespace: c(0, { startsExpr: p }),
|
|
498
|
+
interface: c(0, { startsExpr: p }),
|
|
499
|
+
type: c(0, { startsExpr: p })
|
|
500
|
+
}, a = {
|
|
501
|
+
at: new t.TokenType("@"),
|
|
502
|
+
jsxName: new t.TokenType("jsxName"),
|
|
503
|
+
jsxText: new t.TokenType("jsxText", { beforeExpr: !0 }),
|
|
504
|
+
jsxTagStart: new t.TokenType("jsxTagStart", { startsExpr: !0 }),
|
|
505
|
+
jsxTagEnd: new t.TokenType("jsxTagEnd")
|
|
506
|
+
}, n$2 = {
|
|
507
|
+
tc_oTag: new t.TokContext("<tag", !1, !1),
|
|
508
|
+
tc_cTag: new t.TokContext("</tag", !1, !1),
|
|
509
|
+
tc_expr: new t.TokContext("<tag>...</tag>", !0, !0)
|
|
510
|
+
}, o$2 = /* @__PURE__ */ new RegExp("^(?:" + Object.keys(i).join("|") + ")$");
|
|
511
|
+
a.jsxTagStart.updateContext = function() {
|
|
512
|
+
this.context.push(n$2.tc_expr), this.context.push(n$2.tc_oTag), this.exprAllowed = !1;
|
|
513
|
+
}, a.jsxTagEnd.updateContext = function(e$2) {
|
|
514
|
+
var s$1 = this.context.pop();
|
|
515
|
+
s$1 === n$2.tc_oTag && e$2 === t.tokTypes.slash || s$1 === n$2.tc_cTag ? (this.context.pop(), this.exprAllowed = this.curContext() === n$2.tc_expr) : this.exprAllowed = !0;
|
|
516
|
+
}, s = {
|
|
517
|
+
tokTypes: r({}, i, a),
|
|
518
|
+
tokContexts: r({}, n$2),
|
|
519
|
+
keywordsRegExp: o$2,
|
|
520
|
+
tokenIsLiteralPropertyName: function(e$2) {
|
|
521
|
+
return [
|
|
522
|
+
t.tokTypes.name,
|
|
523
|
+
t.tokTypes.string,
|
|
524
|
+
t.tokTypes.num
|
|
525
|
+
].concat(Object.values(t.keywordTypes), Object.values(i)).includes(e$2);
|
|
526
|
+
},
|
|
527
|
+
tokenIsKeywordOrIdentifier: function(e$2) {
|
|
528
|
+
return [t.tokTypes.name].concat(Object.values(t.keywordTypes), Object.values(i)).includes(e$2);
|
|
529
|
+
},
|
|
530
|
+
tokenIsIdentifier: function(e$2) {
|
|
531
|
+
return [].concat(Object.values(i), [t.tokTypes.name]).includes(e$2);
|
|
532
|
+
},
|
|
533
|
+
tokenIsTSDeclarationStart: function(t) {
|
|
534
|
+
return [
|
|
535
|
+
i.abstract,
|
|
536
|
+
i.declare,
|
|
537
|
+
i.enum,
|
|
538
|
+
i.module,
|
|
539
|
+
i.namespace,
|
|
540
|
+
i.interface,
|
|
541
|
+
i.type
|
|
542
|
+
].includes(t);
|
|
543
|
+
},
|
|
544
|
+
tokenIsTSTypeOperator: function(t) {
|
|
545
|
+
return [
|
|
546
|
+
i.keyof,
|
|
547
|
+
i.readonly,
|
|
548
|
+
i.unique
|
|
549
|
+
].includes(t);
|
|
550
|
+
},
|
|
551
|
+
tokenIsTemplate: function(e$2) {
|
|
552
|
+
return e$2 === t.tokTypes.invalidTemplate;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
return s;
|
|
557
|
+
}(o$1), M = o$1.tokTypes, O = o$1.keywordTypes, D = o$1.isIdentifierStart, _ = o$1.lineBreak, R = o$1.isNewLine, j = o$1.tokContexts, F = o$1.isIdentifierChar, B = N$1.tokTypes, H = N$1.tokContexts, q = N$1.keywordsRegExp, U = N$1.tokenIsLiteralPropertyName, V = N$1.tokenIsTemplate, K = N$1.tokenIsTSDeclarationStart, z = N$1.tokenIsIdentifier, J = N$1.tokenIsKeywordOrIdentifier, X = N$1.tokenIsTSTypeOperator;
|
|
558
|
+
function W(t, e$1, s) {
|
|
559
|
+
void 0 === s && (s = t.length);
|
|
560
|
+
for (var i = e$1; i < s; i++) {
|
|
561
|
+
var r = t.charCodeAt(i);
|
|
562
|
+
if (R(r)) return i < s - 1 && 13 === r && 10 === t.charCodeAt(i + 1) ? i + 2 : i + 1;
|
|
563
|
+
}
|
|
564
|
+
return -1;
|
|
565
|
+
}
|
|
566
|
+
n$1 = function(t, e$1, s) {
|
|
567
|
+
var i = s.tokTypes, r = e$1.tokTypes;
|
|
568
|
+
return function(t$1) {
|
|
569
|
+
function e$2() {
|
|
570
|
+
return t$1.apply(this, arguments) || this;
|
|
571
|
+
}
|
|
572
|
+
a(e$2, t$1);
|
|
573
|
+
var s$1 = e$2.prototype;
|
|
574
|
+
return s$1.takeDecorators = function(t$2) {
|
|
575
|
+
var e$3 = this.decoratorStack[this.decoratorStack.length - 1];
|
|
576
|
+
e$3.length && (t$2.decorators = e$3, this.resetStartLocationFromNode(t$2, e$3[0]), this.decoratorStack[this.decoratorStack.length - 1] = []);
|
|
577
|
+
}, s$1.parseDecorators = function(t$2) {
|
|
578
|
+
for (var e$3 = this.decoratorStack[this.decoratorStack.length - 1]; this.match(r.at);) {
|
|
579
|
+
var s$2 = this.parseDecorator();
|
|
580
|
+
e$3.push(s$2);
|
|
581
|
+
}
|
|
582
|
+
this.match(i._export) ? t$2 || this.unexpected() : this.canHaveLeadingDecorator() || this.raise(this.start, "Leading decorators must be attached to a class declaration.");
|
|
583
|
+
}, s$1.parseDecorator = function() {
|
|
584
|
+
var t$2 = this.startNode();
|
|
585
|
+
this.next(), this.decoratorStack.push([]);
|
|
586
|
+
var e$3, s$2 = this.start, r$1 = this.startLoc;
|
|
587
|
+
if (this.match(i.parenL)) {
|
|
588
|
+
var a = this.start, n$2 = this.startLoc;
|
|
589
|
+
if (this.next(), e$3 = this.parseExpression(), this.expect(i.parenR), this.options.preserveParens) {
|
|
590
|
+
var o$2 = this.startNodeAt(a, n$2);
|
|
591
|
+
o$2.expression = e$3, e$3 = this.finishNode(o$2, "ParenthesizedExpression");
|
|
592
|
+
}
|
|
593
|
+
} else for (e$3 = this.parseIdent(!1); this.eat(i.dot);) {
|
|
594
|
+
var h = this.startNodeAt(s$2, r$1);
|
|
595
|
+
h.object = e$3, h.property = this.parseIdent(!0), h.computed = !1, e$3 = this.finishNode(h, "MemberExpression");
|
|
596
|
+
}
|
|
597
|
+
return t$2.expression = this.parseMaybeDecoratorArguments(e$3), this.decoratorStack.pop(), this.finishNode(t$2, "Decorator");
|
|
598
|
+
}, s$1.parseMaybeDecoratorArguments = function(t$2) {
|
|
599
|
+
if (this.eat(i.parenL)) {
|
|
600
|
+
var e$3 = this.startNodeAtNode(t$2);
|
|
601
|
+
return e$3.callee = t$2, e$3.arguments = this.parseExprList(i.parenR, !1), this.finishNode(e$3, "CallExpression");
|
|
602
|
+
}
|
|
603
|
+
return t$2;
|
|
604
|
+
}, e$2;
|
|
605
|
+
}(t);
|
|
606
|
+
}(n$1, N$1, o$1), n$1 = function(t, e$1, s, i) {
|
|
607
|
+
var r = t.tokTypes, n$2 = e$1.tokTypes, o$2 = t.isNewLine, h = t.isIdentifierChar, p = Object.assign({
|
|
608
|
+
allowNamespaces: !0,
|
|
609
|
+
allowNamespacedObjects: !0
|
|
610
|
+
}, i || {});
|
|
611
|
+
return function(t$1) {
|
|
612
|
+
function e$2() {
|
|
613
|
+
return t$1.apply(this, arguments) || this;
|
|
614
|
+
}
|
|
615
|
+
a(e$2, t$1);
|
|
616
|
+
var s$1 = e$2.prototype;
|
|
617
|
+
return s$1.jsx_readToken = function() {
|
|
618
|
+
for (var t$2 = "", e$3 = this.pos;;) {
|
|
619
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated JSX contents");
|
|
620
|
+
var s$2 = this.input.charCodeAt(this.pos);
|
|
621
|
+
switch (s$2) {
|
|
622
|
+
case 60:
|
|
623
|
+
case 123: return this.pos === this.start ? 60 === s$2 && this.exprAllowed ? (++this.pos, this.finishToken(n$2.jsxTagStart)) : this.getTokenFromCode(s$2) : (t$2 += this.input.slice(e$3, this.pos), this.finishToken(n$2.jsxText, t$2));
|
|
624
|
+
case 38:
|
|
625
|
+
t$2 += this.input.slice(e$3, this.pos), t$2 += this.jsx_readEntity(), e$3 = this.pos;
|
|
626
|
+
break;
|
|
627
|
+
case 62:
|
|
628
|
+
case 125: this.raise(this.pos, "Unexpected token `" + this.input[this.pos] + "`. Did you mean `" + (62 === s$2 ? ">" : "}") + "` or `{\"" + this.input[this.pos] + "\"}`?");
|
|
629
|
+
default: o$2(s$2) ? (t$2 += this.input.slice(e$3, this.pos), t$2 += this.jsx_readNewLine(!0), e$3 = this.pos) : ++this.pos;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}, s$1.jsx_readNewLine = function(t$2) {
|
|
633
|
+
var e$3, s$2 = this.input.charCodeAt(this.pos);
|
|
634
|
+
return ++this.pos, 13 === s$2 && 10 === this.input.charCodeAt(this.pos) ? (++this.pos, e$3 = t$2 ? "\n" : "\r\n") : e$3 = String.fromCharCode(s$2), this.options.locations && (++this.curLine, this.lineStart = this.pos), e$3;
|
|
635
|
+
}, s$1.jsx_readString = function(t$2) {
|
|
636
|
+
for (var e$3 = "", s$2 = ++this.pos;;) {
|
|
637
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant");
|
|
638
|
+
var i$1 = this.input.charCodeAt(this.pos);
|
|
639
|
+
if (i$1 === t$2) break;
|
|
640
|
+
38 === i$1 ? (e$3 += this.input.slice(s$2, this.pos), e$3 += this.jsx_readEntity(), s$2 = this.pos) : o$2(i$1) ? (e$3 += this.input.slice(s$2, this.pos), e$3 += this.jsx_readNewLine(!1), s$2 = this.pos) : ++this.pos;
|
|
641
|
+
}
|
|
642
|
+
return e$3 += this.input.slice(s$2, this.pos++), this.finishToken(r.string, e$3);
|
|
643
|
+
}, s$1.jsx_readEntity = function() {
|
|
644
|
+
var t$2, e$3 = "", s$2 = 0, i$1 = this.input[this.pos];
|
|
645
|
+
"&" !== i$1 && this.raise(this.pos, "Entity must start with an ampersand");
|
|
646
|
+
for (var r$1 = ++this.pos; this.pos < this.input.length && s$2++ < 10;) {
|
|
647
|
+
if (";" === (i$1 = this.input[this.pos++])) {
|
|
648
|
+
"#" === e$3[0] ? "x" === e$3[1] ? (e$3 = e$3.substr(2), P.test(e$3) && (t$2 = String.fromCharCode(parseInt(e$3, 16)))) : (e$3 = e$3.substr(1), b.test(e$3) && (t$2 = String.fromCharCode(parseInt(e$3, 10)))) : t$2 = v[e$3];
|
|
649
|
+
break;
|
|
650
|
+
}
|
|
651
|
+
e$3 += i$1;
|
|
652
|
+
}
|
|
653
|
+
return t$2 || (this.pos = r$1, "&");
|
|
654
|
+
}, s$1.jsx_readWord = function() {
|
|
655
|
+
var t$2, e$3 = this.pos;
|
|
656
|
+
do
|
|
657
|
+
t$2 = this.input.charCodeAt(++this.pos);
|
|
658
|
+
while (h(t$2) || 45 === t$2);
|
|
659
|
+
return this.finishToken(n$2.jsxName, this.input.slice(e$3, this.pos));
|
|
660
|
+
}, s$1.jsx_parseIdentifier = function() {
|
|
661
|
+
var t$2 = this.startNode();
|
|
662
|
+
return this.type === n$2.jsxName ? t$2.name = this.value : this.type.keyword ? t$2.name = this.type.keyword : this.unexpected(), this.next(), this.finishNode(t$2, "JSXIdentifier");
|
|
663
|
+
}, s$1.jsx_parseNamespacedName = function() {
|
|
664
|
+
var t$2 = this.start, e$3 = this.startLoc, s$2 = this.jsx_parseIdentifier();
|
|
665
|
+
if (!p.allowNamespaces || !this.eat(r.colon)) return s$2;
|
|
666
|
+
var i$1 = this.startNodeAt(t$2, e$3);
|
|
667
|
+
return i$1.namespace = s$2, i$1.name = this.jsx_parseIdentifier(), this.finishNode(i$1, "JSXNamespacedName");
|
|
668
|
+
}, s$1.jsx_parseElementName = function() {
|
|
669
|
+
if (this.type === n$2.jsxTagEnd) return "";
|
|
670
|
+
var t$2 = this.start, e$3 = this.startLoc, s$2 = this.jsx_parseNamespacedName();
|
|
671
|
+
for (this.type !== r.dot || "JSXNamespacedName" !== s$2.type || p.allowNamespacedObjects || this.unexpected(); this.eat(r.dot);) {
|
|
672
|
+
var i$1 = this.startNodeAt(t$2, e$3);
|
|
673
|
+
i$1.object = s$2, i$1.property = this.jsx_parseIdentifier(), s$2 = this.finishNode(i$1, "JSXMemberExpression");
|
|
674
|
+
}
|
|
675
|
+
return s$2;
|
|
676
|
+
}, s$1.jsx_parseAttributeValue = function() {
|
|
677
|
+
switch (this.type) {
|
|
678
|
+
case r.braceL:
|
|
679
|
+
var t$2 = this.jsx_parseExpressionContainer();
|
|
680
|
+
return "JSXEmptyExpression" === t$2.expression.type && this.raise(t$2.start, "JSX attributes must only be assigned a non-empty expression"), t$2;
|
|
681
|
+
case n$2.jsxTagStart:
|
|
682
|
+
case r.string: return this.parseExprAtom();
|
|
683
|
+
default: this.raise(this.start, "JSX value should be either an expression or a quoted JSX text");
|
|
684
|
+
}
|
|
685
|
+
}, s$1.jsx_parseEmptyExpression = function() {
|
|
686
|
+
var t$2 = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
|
|
687
|
+
return this.finishNodeAt(t$2, "JSXEmptyExpression", this.start, this.startLoc);
|
|
688
|
+
}, s$1.jsx_parseExpressionContainer = function() {
|
|
689
|
+
var t$2 = this.startNode();
|
|
690
|
+
return this.next(), t$2.expression = this.type === r.braceR ? this.jsx_parseEmptyExpression() : this.parseExpression(), this.expect(r.braceR), this.finishNode(t$2, "JSXExpressionContainer");
|
|
691
|
+
}, s$1.jsx_parseAttribute = function() {
|
|
692
|
+
var t$2 = this.startNode();
|
|
693
|
+
return this.eat(r.braceL) ? (this.expect(r.ellipsis), t$2.argument = this.parseMaybeAssign(), this.expect(r.braceR), this.finishNode(t$2, "JSXSpreadAttribute")) : (t$2.name = this.jsx_parseNamespacedName(), t$2.value = this.eat(r.eq) ? this.jsx_parseAttributeValue() : null, this.finishNode(t$2, "JSXAttribute"));
|
|
694
|
+
}, s$1.jsx_parseOpeningElementAt = function(t$2, e$3) {
|
|
695
|
+
var s$2 = this.startNodeAt(t$2, e$3);
|
|
696
|
+
s$2.attributes = [];
|
|
697
|
+
var i$1 = this.jsx_parseElementName();
|
|
698
|
+
for (i$1 && (s$2.name = i$1); this.type !== r.slash && this.type !== n$2.jsxTagEnd;) s$2.attributes.push(this.jsx_parseAttribute());
|
|
699
|
+
return s$2.selfClosing = this.eat(r.slash), this.expect(n$2.jsxTagEnd), this.finishNode(s$2, i$1 ? "JSXOpeningElement" : "JSXOpeningFragment");
|
|
700
|
+
}, s$1.jsx_parseClosingElementAt = function(t$2, e$3) {
|
|
701
|
+
var s$2 = this.startNodeAt(t$2, e$3), i$1 = this.jsx_parseElementName();
|
|
702
|
+
return i$1 && (s$2.name = i$1), this.expect(n$2.jsxTagEnd), this.finishNode(s$2, i$1 ? "JSXClosingElement" : "JSXClosingFragment");
|
|
703
|
+
}, s$1.jsx_parseElementAt = function(t$2, e$3) {
|
|
704
|
+
var s$2 = this.startNodeAt(t$2, e$3), i$1 = [], a = this.jsx_parseOpeningElementAt(t$2, e$3), o$3 = null;
|
|
705
|
+
if (!a.selfClosing) {
|
|
706
|
+
t: for (;;) switch (this.type) {
|
|
707
|
+
case n$2.jsxTagStart:
|
|
708
|
+
if (t$2 = this.start, e$3 = this.startLoc, this.next(), this.eat(r.slash)) {
|
|
709
|
+
o$3 = this.jsx_parseClosingElementAt(t$2, e$3);
|
|
710
|
+
break t;
|
|
711
|
+
}
|
|
712
|
+
i$1.push(this.jsx_parseElementAt(t$2, e$3));
|
|
713
|
+
break;
|
|
714
|
+
case n$2.jsxText:
|
|
715
|
+
i$1.push(this.parseExprAtom());
|
|
716
|
+
break;
|
|
717
|
+
case r.braceL:
|
|
718
|
+
i$1.push(this.jsx_parseExpressionContainer());
|
|
719
|
+
break;
|
|
720
|
+
default: this.unexpected();
|
|
721
|
+
}
|
|
722
|
+
g(o$3.name) !== g(a.name) && this.raise(o$3.start, "Expected corresponding JSX closing tag for <" + g(a.name) + ">");
|
|
723
|
+
}
|
|
724
|
+
var h$1 = a.name ? "Element" : "Fragment";
|
|
725
|
+
return s$2["opening" + h$1] = a, s$2["closing" + h$1] = o$3, s$2.children = i$1, this.type === r.relational && "<" === this.value && this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag"), this.finishNode(s$2, "JSX" + h$1);
|
|
726
|
+
}, s$1.jsx_parseText = function() {
|
|
727
|
+
var t$2 = this.parseLiteral(this.value);
|
|
728
|
+
return t$2.type = "JSXText", t$2;
|
|
729
|
+
}, s$1.jsx_parseElement = function() {
|
|
730
|
+
var t$2 = this.start, e$3 = this.startLoc;
|
|
731
|
+
return this.next(), this.jsx_parseElementAt(t$2, e$3);
|
|
732
|
+
}, e$2;
|
|
733
|
+
}(s);
|
|
734
|
+
}(o$1, N$1, n$1, null == e ? void 0 : e.jsx), n$1 = function(t, e$1, s) {
|
|
735
|
+
var i = e$1.tokTypes, r = s.tokTypes;
|
|
736
|
+
return function(t$1) {
|
|
737
|
+
function e$2() {
|
|
738
|
+
return t$1.apply(this, arguments) || this;
|
|
739
|
+
}
|
|
740
|
+
a(e$2, t$1);
|
|
741
|
+
var s$1 = e$2.prototype;
|
|
742
|
+
return s$1.parseMaybeImportAttributes = function(t$2) {
|
|
743
|
+
if (this.type === r._with || this.type === i.assert) {
|
|
744
|
+
this.next();
|
|
745
|
+
var e$3 = this.parseImportAttributes();
|
|
746
|
+
e$3 && (t$2.attributes = e$3);
|
|
747
|
+
}
|
|
748
|
+
}, s$1.parseImportAttributes = function() {
|
|
749
|
+
this.expect(r.braceL);
|
|
750
|
+
var t$2 = this.parseWithEntries();
|
|
751
|
+
return this.expect(r.braceR), t$2;
|
|
752
|
+
}, s$1.parseWithEntries = function() {
|
|
753
|
+
var t$2 = [], e$3 = /* @__PURE__ */ new Set();
|
|
754
|
+
do {
|
|
755
|
+
if (this.type === r.braceR) break;
|
|
756
|
+
var s$2, i$1 = this.startNode();
|
|
757
|
+
s$2 = this.type === r.string ? this.parseLiteral(this.value) : this.parseIdent(!0), this.next(), i$1.key = s$2, e$3.has(i$1.key.name) && this.raise(this.pos, "Duplicated key in attributes"), e$3.add(i$1.key.name), this.type !== r.string && this.raise(this.pos, "Only string is supported as an attribute value"), i$1.value = this.parseLiteral(this.value), t$2.push(this.finishNode(i$1, "ImportAttribute"));
|
|
758
|
+
} while (this.eat(r.comma));
|
|
759
|
+
return t$2;
|
|
760
|
+
}, e$2;
|
|
761
|
+
}(t);
|
|
762
|
+
}(n$1, N$1, o$1);
|
|
763
|
+
return /* @__PURE__ */ function(t) {
|
|
764
|
+
function e$1(e$2, s$1, i) {
|
|
765
|
+
var r$1;
|
|
766
|
+
return (r$1 = t.call(this, e$2, s$1, i) || this).preValue = null, r$1.preToken = null, r$1.isLookahead = !1, r$1.isAmbientContext = !1, r$1.inAbstractClass = !1, r$1.inType = !1, r$1.inDisallowConditionalTypesContext = !1, r$1.maybeInArrowParameters = !1, r$1.shouldParseArrowReturnType = void 0, r$1.shouldParseAsyncArrowReturnType = void 0, r$1.decoratorStack = [[]], r$1.importsStack = [[]], r$1.importOrExportOuterKind = void 0, r$1.tsParseConstModifier = r$1.tsParseModifiers.bind(function(t$1) {
|
|
767
|
+
if (void 0 === t$1) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
768
|
+
return t$1;
|
|
769
|
+
}(r$1), {
|
|
770
|
+
allowedModifiers: ["const"],
|
|
771
|
+
disallowedModifiers: ["in", "out"],
|
|
772
|
+
errorTemplate: T.InvalidModifierOnTypeParameterPositions
|
|
773
|
+
}), r$1;
|
|
774
|
+
}
|
|
775
|
+
a(e$1, t);
|
|
776
|
+
var s, r, n$2, p = e$1.prototype;
|
|
777
|
+
return p.getTokenFromCodeInType = function(e$2) {
|
|
778
|
+
return 62 === e$2 || 60 === e$2 ? this.finishOp(M.relational, 1) : t.prototype.getTokenFromCode.call(this, e$2);
|
|
779
|
+
}, p.readToken = function(e$2) {
|
|
780
|
+
if (!this.inType) {
|
|
781
|
+
var s$1 = this.curContext();
|
|
782
|
+
if (s$1 === H.tc_expr) return this.jsx_readToken();
|
|
783
|
+
if (s$1 === H.tc_oTag || s$1 === H.tc_cTag) {
|
|
784
|
+
if (D(e$2)) return this.jsx_readWord();
|
|
785
|
+
if (62 == e$2) return ++this.pos, this.finishToken(B.jsxTagEnd);
|
|
786
|
+
if ((34 === e$2 || 39 === e$2) && s$1 == H.tc_oTag) return this.jsx_readString(e$2);
|
|
787
|
+
}
|
|
788
|
+
if (60 === e$2 && this.exprAllowed && 33 !== this.input.charCodeAt(this.pos + 1)) return ++this.pos, this.finishToken(B.jsxTagStart);
|
|
789
|
+
}
|
|
790
|
+
return t.prototype.readToken.call(this, e$2);
|
|
791
|
+
}, p.getTokenFromCode = function(e$2) {
|
|
792
|
+
return this.inType ? this.getTokenFromCodeInType(e$2) : 64 === e$2 ? (++this.pos, this.finishToken(B.at)) : t.prototype.getTokenFromCode.call(this, e$2);
|
|
793
|
+
}, p.isAbstractClass = function() {
|
|
794
|
+
return this.ts_isContextual(B.abstract) && this.lookahead().type === M._class;
|
|
795
|
+
}, p.finishNode = function(e$2, s$1) {
|
|
796
|
+
return "" !== e$2.type && 0 !== e$2.end ? e$2 : t.prototype.finishNode.call(this, e$2, s$1);
|
|
797
|
+
}, p.tryParse = function(t$1, e$2) {
|
|
798
|
+
void 0 === e$2 && (e$2 = this.cloneCurLookaheadState());
|
|
799
|
+
var s$1 = { node: null };
|
|
800
|
+
try {
|
|
801
|
+
return {
|
|
802
|
+
node: t$1(function(t$2) {
|
|
803
|
+
throw void 0 === t$2 && (t$2 = null), s$1.node = t$2, s$1;
|
|
804
|
+
}),
|
|
805
|
+
error: null,
|
|
806
|
+
thrown: !1,
|
|
807
|
+
aborted: !1,
|
|
808
|
+
failState: null
|
|
809
|
+
};
|
|
810
|
+
} catch (t$2) {
|
|
811
|
+
var i = this.getCurLookaheadState();
|
|
812
|
+
if (this.setLookaheadState(e$2), t$2 instanceof SyntaxError) return {
|
|
813
|
+
node: null,
|
|
814
|
+
error: t$2,
|
|
815
|
+
thrown: !0,
|
|
816
|
+
aborted: !1,
|
|
817
|
+
failState: i
|
|
818
|
+
};
|
|
819
|
+
if (t$2 === s$1) return {
|
|
820
|
+
node: s$1.node,
|
|
821
|
+
error: null,
|
|
822
|
+
thrown: !1,
|
|
823
|
+
aborted: !0,
|
|
824
|
+
failState: i
|
|
825
|
+
};
|
|
826
|
+
throw t$2;
|
|
827
|
+
}
|
|
828
|
+
}, p.setOptionalParametersError = function(t$1, e$2) {
|
|
829
|
+
var s$1;
|
|
830
|
+
t$1.optionalParametersLoc = null != (s$1 = null == e$2 ? void 0 : e$2.loc) ? s$1 : this.startLoc;
|
|
831
|
+
}, p.reScan_lt_gt = function() {
|
|
832
|
+
this.type === M.relational && (this.pos -= 1, this.readToken_lt_gt(this.fullCharCodeAtPos()));
|
|
833
|
+
}, p.reScan_lt = function() {
|
|
834
|
+
var t$1 = this.type;
|
|
835
|
+
return t$1 === M.bitShift ? (this.pos -= 2, this.finishOp(M.relational, 1), M.relational) : t$1;
|
|
836
|
+
}, p.resetEndLocation = function(t$1, e$2) {
|
|
837
|
+
void 0 === e$2 && (e$2 = this.lastTokEndLoc), t$1.end = e$2.column, t$1.loc.end = e$2, this.options.ranges && (t$1.range[1] = e$2.column);
|
|
838
|
+
}, p.startNodeAtNode = function(e$2) {
|
|
839
|
+
return t.prototype.startNodeAt.call(this, e$2.start, e$2.loc.start);
|
|
840
|
+
}, p.nextTokenStart = function() {
|
|
841
|
+
return this.nextTokenStartSince(this.pos);
|
|
842
|
+
}, p.tsHasSomeModifiers = function(t$1, e$2) {
|
|
843
|
+
return e$2.some(function(e$3) {
|
|
844
|
+
return w(e$3) ? t$1.accessibility === e$3 : !!t$1[e$3];
|
|
845
|
+
});
|
|
846
|
+
}, p.tsIsStartOfStaticBlocks = function() {
|
|
847
|
+
return this.isContextual("static") && 123 === this.lookaheadCharCode();
|
|
848
|
+
}, p.tsCheckForInvalidTypeCasts = function(t$1) {
|
|
849
|
+
var e$2 = this;
|
|
850
|
+
t$1.forEach(function(t$2) {
|
|
851
|
+
"TSTypeCastExpression" === (null == t$2 ? void 0 : t$2.type) && e$2.raise(t$2.typeAnnotation.start, T.UnexpectedTypeAnnotation);
|
|
852
|
+
});
|
|
853
|
+
}, p.atPossibleAsyncArrow = function(t$1) {
|
|
854
|
+
return "Identifier" === t$1.type && "async" === t$1.name && this.lastTokEndLoc.column === t$1.end && !this.canInsertSemicolon() && t$1.end - t$1.start == 5 && t$1.start === this.potentialArrowAt;
|
|
855
|
+
}, p.tsIsIdentifier = function() {
|
|
856
|
+
return z(this.type);
|
|
857
|
+
}, p.tsTryParseTypeOrTypePredicateAnnotation = function() {
|
|
858
|
+
return this.match(M.colon) ? this.tsParseTypeOrTypePredicateAnnotation(M.colon) : void 0;
|
|
859
|
+
}, p.tsTryParseGenericAsyncArrowFunction = function(e$2, s$1, i) {
|
|
860
|
+
var r$1 = this;
|
|
861
|
+
if (this.tsMatchLeftRelational()) {
|
|
862
|
+
var a = this.maybeInArrowParameters;
|
|
863
|
+
this.maybeInArrowParameters = !0;
|
|
864
|
+
var n$3 = this.tsTryParseAndCatch(function() {
|
|
865
|
+
var i$1 = r$1.startNodeAt(e$2, s$1);
|
|
866
|
+
return i$1.typeParameters = r$1.tsParseTypeParameters(), t.prototype.parseFunctionParams.call(r$1, i$1), i$1.returnType = r$1.tsTryParseTypeOrTypePredicateAnnotation(), r$1.expect(M.arrow), i$1;
|
|
867
|
+
});
|
|
868
|
+
if (this.maybeInArrowParameters = a, n$3) return t.prototype.parseArrowExpression.call(this, n$3, null, !0, i);
|
|
869
|
+
}
|
|
870
|
+
}, p.tsParseTypeArgumentsInExpression = function() {
|
|
871
|
+
if (this.reScan_lt() === M.relational) return this.tsParseTypeArguments();
|
|
872
|
+
}, p.tsInNoContext = function(t$1) {
|
|
873
|
+
var e$2 = this.context;
|
|
874
|
+
this.context = [e$2[0]];
|
|
875
|
+
try {
|
|
876
|
+
return t$1();
|
|
877
|
+
} finally {
|
|
878
|
+
this.context = e$2;
|
|
879
|
+
}
|
|
880
|
+
}, p.tsTryParseTypeAnnotation = function() {
|
|
881
|
+
return this.match(M.colon) ? this.tsParseTypeAnnotation() : void 0;
|
|
882
|
+
}, p.isUnparsedContextual = function(t$1, e$2) {
|
|
883
|
+
var s$1 = t$1 + e$2.length;
|
|
884
|
+
if (this.input.slice(t$1, s$1) === e$2) {
|
|
885
|
+
var i = this.input.charCodeAt(s$1);
|
|
886
|
+
return !(F(i) || 55296 == (64512 & i));
|
|
887
|
+
}
|
|
888
|
+
return !1;
|
|
889
|
+
}, p.isAbstractConstructorSignature = function() {
|
|
890
|
+
return this.ts_isContextual(B.abstract) && this.lookahead().type === M._new;
|
|
891
|
+
}, p.nextTokenStartSince = function(t$1) {
|
|
892
|
+
return A.lastIndex = t$1, A.test(this.input) ? A.lastIndex : t$1;
|
|
893
|
+
}, p.lookaheadCharCode = function() {
|
|
894
|
+
return this.input.charCodeAt(this.nextTokenStart());
|
|
895
|
+
}, p.compareLookaheadState = function(t$1, e$2) {
|
|
896
|
+
for (var s$1 = 0, i = Object.keys(t$1); s$1 < i.length; s$1++) {
|
|
897
|
+
var r$1 = i[s$1];
|
|
898
|
+
if (t$1[r$1] !== e$2[r$1]) return !1;
|
|
899
|
+
}
|
|
900
|
+
return !0;
|
|
901
|
+
}, p.createLookaheadState = function() {
|
|
902
|
+
this.value = null, this.context = [this.curContext()];
|
|
903
|
+
}, p.getCurLookaheadState = function() {
|
|
904
|
+
return {
|
|
905
|
+
endLoc: this.endLoc,
|
|
906
|
+
lastTokEnd: this.lastTokEnd,
|
|
907
|
+
lastTokStart: this.lastTokStart,
|
|
908
|
+
lastTokStartLoc: this.lastTokStartLoc,
|
|
909
|
+
pos: this.pos,
|
|
910
|
+
value: this.value,
|
|
911
|
+
type: this.type,
|
|
912
|
+
start: this.start,
|
|
913
|
+
end: this.end,
|
|
914
|
+
context: this.context,
|
|
915
|
+
startLoc: this.startLoc,
|
|
916
|
+
lastTokEndLoc: this.lastTokEndLoc,
|
|
917
|
+
curLine: this.curLine,
|
|
918
|
+
lineStart: this.lineStart,
|
|
919
|
+
curPosition: this.curPosition,
|
|
920
|
+
containsEsc: this.containsEsc
|
|
921
|
+
};
|
|
922
|
+
}, p.cloneCurLookaheadState = function() {
|
|
923
|
+
return {
|
|
924
|
+
pos: this.pos,
|
|
925
|
+
value: this.value,
|
|
926
|
+
type: this.type,
|
|
927
|
+
start: this.start,
|
|
928
|
+
end: this.end,
|
|
929
|
+
context: this.context && this.context.slice(),
|
|
930
|
+
startLoc: this.startLoc,
|
|
931
|
+
lastTokEndLoc: this.lastTokEndLoc,
|
|
932
|
+
endLoc: this.endLoc,
|
|
933
|
+
lastTokEnd: this.lastTokEnd,
|
|
934
|
+
lastTokStart: this.lastTokStart,
|
|
935
|
+
lastTokStartLoc: this.lastTokStartLoc,
|
|
936
|
+
curLine: this.curLine,
|
|
937
|
+
lineStart: this.lineStart,
|
|
938
|
+
curPosition: this.curPosition,
|
|
939
|
+
containsEsc: this.containsEsc
|
|
940
|
+
};
|
|
941
|
+
}, p.setLookaheadState = function(t$1) {
|
|
942
|
+
this.pos = t$1.pos, this.value = t$1.value, this.endLoc = t$1.endLoc, this.lastTokEnd = t$1.lastTokEnd, this.lastTokStart = t$1.lastTokStart, this.lastTokStartLoc = t$1.lastTokStartLoc, this.type = t$1.type, this.start = t$1.start, this.end = t$1.end, this.context = t$1.context, this.startLoc = t$1.startLoc, this.lastTokEndLoc = t$1.lastTokEndLoc, this.curLine = t$1.curLine, this.lineStart = t$1.lineStart, this.curPosition = t$1.curPosition, this.containsEsc = t$1.containsEsc;
|
|
943
|
+
}, p.tsLookAhead = function(t$1) {
|
|
944
|
+
var e$2 = this.getCurLookaheadState(), s$1 = t$1();
|
|
945
|
+
return this.setLookaheadState(e$2), s$1;
|
|
946
|
+
}, p.lookahead = function(t$1) {
|
|
947
|
+
var e$2 = this.getCurLookaheadState();
|
|
948
|
+
if (this.createLookaheadState(), this.isLookahead = !0, void 0 !== t$1) for (var s$1 = 0; s$1 < t$1; s$1++) this.nextToken();
|
|
949
|
+
else this.nextToken();
|
|
950
|
+
this.isLookahead = !1;
|
|
951
|
+
var i = this.getCurLookaheadState();
|
|
952
|
+
return this.setLookaheadState(e$2), i;
|
|
953
|
+
}, p.readWord = function() {
|
|
954
|
+
var t$1 = this.readWord1(), e$2 = M.name;
|
|
955
|
+
return this.keywords.test(t$1) ? e$2 = O[t$1] : new RegExp(q).test(t$1) && (e$2 = B[t$1]), this.finishToken(e$2, t$1);
|
|
956
|
+
}, p.skipBlockComment = function() {
|
|
957
|
+
var t$1;
|
|
958
|
+
this.isLookahead || (t$1 = this.options.onComment && this.curPosition());
|
|
959
|
+
var e$2 = this.pos, s$1 = this.input.indexOf("*/", this.pos += 2);
|
|
960
|
+
if (-1 === s$1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = s$1 + 2, this.options.locations) for (var i, r$1 = e$2; (i = W(this.input, r$1, this.pos)) > -1;) ++this.curLine, r$1 = this.lineStart = i;
|
|
961
|
+
this.isLookahead || this.options.onComment && this.options.onComment(!0, this.input.slice(e$2 + 2, s$1), e$2, this.pos, t$1, this.curPosition());
|
|
962
|
+
}, p.skipLineComment = function(t$1) {
|
|
963
|
+
var e$2, s$1 = this.pos;
|
|
964
|
+
this.isLookahead || (e$2 = this.options.onComment && this.curPosition());
|
|
965
|
+
for (var i = this.input.charCodeAt(this.pos += t$1); this.pos < this.input.length && !R(i);) i = this.input.charCodeAt(++this.pos);
|
|
966
|
+
this.isLookahead || this.options.onComment && this.options.onComment(!1, this.input.slice(s$1 + t$1, this.pos), s$1, this.pos, e$2, this.curPosition());
|
|
967
|
+
}, p.finishToken = function(t$1, e$2) {
|
|
968
|
+
this.preValue = this.value, this.preToken = this.type, this.end = this.pos, this.options.locations && (this.endLoc = this.curPosition());
|
|
969
|
+
var s$1 = this.type;
|
|
970
|
+
this.type = t$1, this.value = e$2, this.isLookahead || this.updateContext(s$1);
|
|
971
|
+
}, p.resetStartLocation = function(t$1, e$2, s$1) {
|
|
972
|
+
t$1.start = e$2, t$1.loc.start = s$1, this.options.ranges && (t$1.range[0] = e$2);
|
|
973
|
+
}, p.isLineTerminator = function() {
|
|
974
|
+
return this.eat(M.semi) || t.prototype.canInsertSemicolon.call(this);
|
|
975
|
+
}, p.hasFollowingLineBreak = function() {
|
|
976
|
+
return m.lastIndex = this.end, m.test(this.input);
|
|
977
|
+
}, p.addExtra = function(t$1, e$2, s$1, i) {
|
|
978
|
+
if (void 0 === i && (i = !0), t$1) {
|
|
979
|
+
var r$1 = t$1.extra = t$1.extra || {};
|
|
980
|
+
i ? r$1[e$2] = s$1 : Object.defineProperty(r$1, e$2, {
|
|
981
|
+
enumerable: i,
|
|
982
|
+
value: s$1
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}, p.isLiteralPropertyName = function() {
|
|
986
|
+
return U(this.type);
|
|
987
|
+
}, p.hasPrecedingLineBreak = function() {
|
|
988
|
+
return _.test(this.input.slice(this.lastTokEndLoc.index, this.start));
|
|
989
|
+
}, p.createIdentifier = function(t$1, e$2) {
|
|
990
|
+
return t$1.name = e$2, this.finishNode(t$1, "Identifier");
|
|
991
|
+
}, p.resetStartLocationFromNode = function(t$1, e$2) {
|
|
992
|
+
this.resetStartLocation(t$1, e$2.start, e$2.loc.start);
|
|
993
|
+
}, p.isThisParam = function(t$1) {
|
|
994
|
+
return "Identifier" === t$1.type && "this" === t$1.name;
|
|
995
|
+
}, p.isLookaheadContextual = function(t$1) {
|
|
996
|
+
var e$2 = this.nextTokenStart();
|
|
997
|
+
return this.isUnparsedContextual(e$2, t$1);
|
|
998
|
+
}, p.ts_type_isContextual = function(t$1, e$2) {
|
|
999
|
+
return t$1 === e$2 && !this.containsEsc;
|
|
1000
|
+
}, p.ts_isContextual = function(t$1) {
|
|
1001
|
+
return this.type === t$1 && !this.containsEsc;
|
|
1002
|
+
}, p.ts_isContextualWithState = function(t$1, e$2) {
|
|
1003
|
+
return t$1.type === e$2 && !t$1.containsEsc;
|
|
1004
|
+
}, p.isContextualWithState = function(t$1, e$2) {
|
|
1005
|
+
return e$2.type === M.name && e$2.value === t$1 && !e$2.containsEsc;
|
|
1006
|
+
}, p.tsIsStartOfMappedType = function() {
|
|
1007
|
+
return this.next(), this.eat(M.plusMin) ? this.ts_isContextual(B.readonly) : (this.ts_isContextual(B.readonly) && this.next(), !!this.match(M.bracketL) && (this.next(), !!this.tsIsIdentifier() && (this.next(), this.match(M._in))));
|
|
1008
|
+
}, p.tsInDisallowConditionalTypesContext = function(t$1) {
|
|
1009
|
+
var e$2 = this.inDisallowConditionalTypesContext;
|
|
1010
|
+
this.inDisallowConditionalTypesContext = !0;
|
|
1011
|
+
try {
|
|
1012
|
+
return t$1();
|
|
1013
|
+
} finally {
|
|
1014
|
+
this.inDisallowConditionalTypesContext = e$2;
|
|
1015
|
+
}
|
|
1016
|
+
}, p.tsTryParseType = function() {
|
|
1017
|
+
return this.tsEatThenParseType(M.colon);
|
|
1018
|
+
}, p.match = function(t$1) {
|
|
1019
|
+
return this.type === t$1;
|
|
1020
|
+
}, p.matchJsx = function(t$1) {
|
|
1021
|
+
return this.type === N$1.tokTypes[t$1];
|
|
1022
|
+
}, p.ts_eatWithState = function(t$1, e$2, s$1) {
|
|
1023
|
+
if (t$1 === s$1.type) {
|
|
1024
|
+
for (var i = 0; i < e$2; i++) this.next();
|
|
1025
|
+
return !0;
|
|
1026
|
+
}
|
|
1027
|
+
return !1;
|
|
1028
|
+
}, p.ts_eatContextualWithState = function(t$1, e$2, s$1) {
|
|
1029
|
+
if (q.test(t$1)) {
|
|
1030
|
+
if (this.ts_isContextualWithState(s$1, B[t$1])) {
|
|
1031
|
+
for (var i = 0; i < e$2; i++) this.next();
|
|
1032
|
+
return !0;
|
|
1033
|
+
}
|
|
1034
|
+
return !1;
|
|
1035
|
+
}
|
|
1036
|
+
if (!this.isContextualWithState(t$1, s$1)) return !1;
|
|
1037
|
+
for (var r$1 = 0; r$1 < e$2; r$1++) this.next();
|
|
1038
|
+
return !0;
|
|
1039
|
+
}, p.canHaveLeadingDecorator = function() {
|
|
1040
|
+
return this.match(M._class);
|
|
1041
|
+
}, p.eatContextual = function(e$2) {
|
|
1042
|
+
return q.test(e$2) ? !!this.ts_isContextual(B[e$2]) && (this.next(), !0) : t.prototype.eatContextual.call(this, e$2);
|
|
1043
|
+
}, p.tsIsExternalModuleReference = function() {
|
|
1044
|
+
return this.isContextual("require") && 40 === this.lookaheadCharCode();
|
|
1045
|
+
}, p.tsParseExternalModuleReference = function() {
|
|
1046
|
+
var t$1 = this.startNode();
|
|
1047
|
+
return this.expectContextual("require"), this.expect(M.parenL), this.match(M.string) || this.unexpected(), t$1.expression = this.parseExprAtom(), this.expect(M.parenR), this.finishNode(t$1, "TSExternalModuleReference");
|
|
1048
|
+
}, p.tsParseEntityName = function(t$1) {
|
|
1049
|
+
void 0 === t$1 && (t$1 = !0);
|
|
1050
|
+
for (var e$2 = this.parseIdent(t$1); this.eat(M.dot);) {
|
|
1051
|
+
var s$1 = this.startNodeAtNode(e$2);
|
|
1052
|
+
s$1.left = e$2, s$1.right = this.parseIdent(t$1), e$2 = this.finishNode(s$1, "TSQualifiedName");
|
|
1053
|
+
}
|
|
1054
|
+
return e$2;
|
|
1055
|
+
}, p.tsParseEnumMember = function() {
|
|
1056
|
+
var t$1 = this.startNode();
|
|
1057
|
+
return t$1.id = this.match(M.string) ? this.parseLiteral(this.value) : this.parseIdent(!0), this.eat(M.eq) && (t$1.initializer = this.parseMaybeAssign()), this.finishNode(t$1, "TSEnumMember");
|
|
1058
|
+
}, p.tsParseEnumDeclaration = function(t$1, e$2) {
|
|
1059
|
+
return void 0 === e$2 && (e$2 = {}), e$2.const && (t$1.const = !0), e$2.declare && (t$1.declare = !0), this.expectContextual("enum"), t$1.id = this.parseIdent(), this.checkLValSimple(t$1.id), this.expect(M.braceL), t$1.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this)), this.expect(M.braceR), this.finishNode(t$1, "TSEnumDeclaration");
|
|
1060
|
+
}, p.tsParseModuleBlock = function() {
|
|
1061
|
+
var e$2 = this.startNode();
|
|
1062
|
+
for (t.prototype.enterScope.call(this, 512), this.expect(M.braceL), e$2.body = []; this.type !== M.braceR;) {
|
|
1063
|
+
var s$1 = this.parseStatement(null, !0);
|
|
1064
|
+
e$2.body.push(s$1);
|
|
1065
|
+
}
|
|
1066
|
+
return this.next(), t.prototype.exitScope.call(this), this.finishNode(e$2, "TSModuleBlock");
|
|
1067
|
+
}, p.tsParseAmbientExternalModuleDeclaration = function(e$2) {
|
|
1068
|
+
return this.ts_isContextual(B.global) ? (e$2.global = !0, e$2.id = this.parseIdent()) : this.match(M.string) ? e$2.id = this.parseLiteral(this.value) : this.unexpected(), this.match(M.braceL) ? (t.prototype.enterScope.call(this, u), e$2.body = this.tsParseModuleBlock(), t.prototype.exitScope.call(this)) : t.prototype.semicolon.call(this), this.finishNode(e$2, "TSModuleDeclaration");
|
|
1069
|
+
}, p.tsTryParseDeclare = function(t$1) {
|
|
1070
|
+
var e$2 = this;
|
|
1071
|
+
if (!this.isLineTerminator()) {
|
|
1072
|
+
var s$1, i = this.type;
|
|
1073
|
+
return this.isContextual("let") && (i = M._var, s$1 = "let"), this.tsInAmbientContext(function() {
|
|
1074
|
+
if (i === M._function) return t$1.declare = !0, e$2.parseFunctionStatement(t$1, !1, !0);
|
|
1075
|
+
if (i === M._class) return t$1.declare = !0, e$2.parseClass(t$1, !0);
|
|
1076
|
+
if (i === B.enum) return e$2.tsParseEnumDeclaration(t$1, { declare: !0 });
|
|
1077
|
+
if (i === B.global) return e$2.tsParseAmbientExternalModuleDeclaration(t$1);
|
|
1078
|
+
if (i === M._const || i === M._var) return e$2.match(M._const) && e$2.isLookaheadContextual("enum") ? (e$2.expect(M._const), e$2.tsParseEnumDeclaration(t$1, {
|
|
1079
|
+
const: !0,
|
|
1080
|
+
declare: !0
|
|
1081
|
+
})) : (t$1.declare = !0, e$2.parseVarStatement(t$1, s$1 || e$2.value, !0));
|
|
1082
|
+
if (i === B.interface) {
|
|
1083
|
+
var r$1 = e$2.tsParseInterfaceDeclaration(t$1, { declare: !0 });
|
|
1084
|
+
if (r$1) return r$1;
|
|
1085
|
+
}
|
|
1086
|
+
return z(i) ? e$2.tsParseDeclaration(t$1, e$2.value, !0) : void 0;
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
}, p.tsIsListTerminator = function(t$1) {
|
|
1090
|
+
switch (t$1) {
|
|
1091
|
+
case "EnumMembers":
|
|
1092
|
+
case "TypeMembers": return this.match(M.braceR);
|
|
1093
|
+
case "HeritageClauseElement": return this.match(M.braceL);
|
|
1094
|
+
case "TupleElementTypes": return this.match(M.bracketR);
|
|
1095
|
+
case "TypeParametersOrArguments": return this.tsMatchRightRelational();
|
|
1096
|
+
}
|
|
1097
|
+
}, p.tsParseDelimitedListWorker = function(t$1, e$2, s$1, i) {
|
|
1098
|
+
for (var r$1 = [], a = -1; !this.tsIsListTerminator(t$1);) {
|
|
1099
|
+
a = -1;
|
|
1100
|
+
var n$3 = e$2();
|
|
1101
|
+
if (null == n$3) return;
|
|
1102
|
+
if (r$1.push(n$3), !this.eat(M.comma)) {
|
|
1103
|
+
if (this.tsIsListTerminator(t$1)) break;
|
|
1104
|
+
s$1 && this.expect(M.comma);
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
a = this.lastTokStart;
|
|
1108
|
+
}
|
|
1109
|
+
return i && (i.value = a), r$1;
|
|
1110
|
+
}, p.tsParseDelimitedList = function(t$1, e$2, s$1) {
|
|
1111
|
+
return function(t$2) {
|
|
1112
|
+
if (null == t$2) throw new Error("Unexpected " + t$2 + " value.");
|
|
1113
|
+
return t$2;
|
|
1114
|
+
}(this.tsParseDelimitedListWorker(t$1, e$2, !0, s$1));
|
|
1115
|
+
}, p.tsParseBracketedList = function(t$1, e$2, s$1, i, r$1) {
|
|
1116
|
+
i || this.expect(s$1 ? M.bracketL : M.relational);
|
|
1117
|
+
var a = this.tsParseDelimitedList(t$1, e$2, r$1);
|
|
1118
|
+
return this.expect(s$1 ? M.bracketR : M.relational), a;
|
|
1119
|
+
}, p.tsParseTypeParameterName = function() {
|
|
1120
|
+
return this.parseIdent().name;
|
|
1121
|
+
}, p.tsEatThenParseType = function(t$1) {
|
|
1122
|
+
return this.match(t$1) ? this.tsNextThenParseType() : void 0;
|
|
1123
|
+
}, p.tsExpectThenParseType = function(t$1) {
|
|
1124
|
+
var e$2 = this;
|
|
1125
|
+
return this.tsDoThenParseType(function() {
|
|
1126
|
+
return e$2.expect(t$1);
|
|
1127
|
+
});
|
|
1128
|
+
}, p.tsNextThenParseType = function() {
|
|
1129
|
+
var t$1 = this;
|
|
1130
|
+
return this.tsDoThenParseType(function() {
|
|
1131
|
+
return t$1.next();
|
|
1132
|
+
});
|
|
1133
|
+
}, p.tsDoThenParseType = function(t$1) {
|
|
1134
|
+
var e$2 = this;
|
|
1135
|
+
return this.tsInType(function() {
|
|
1136
|
+
return t$1(), e$2.tsParseType();
|
|
1137
|
+
});
|
|
1138
|
+
}, p.tsSkipParameterStart = function() {
|
|
1139
|
+
if (z(this.type) || this.match(M._this)) return this.next(), !0;
|
|
1140
|
+
if (this.match(M.braceL)) try {
|
|
1141
|
+
return this.parseObj(!0), !0;
|
|
1142
|
+
} catch (t$1) {
|
|
1143
|
+
return !1;
|
|
1144
|
+
}
|
|
1145
|
+
if (this.match(M.bracketL)) {
|
|
1146
|
+
this.next();
|
|
1147
|
+
try {
|
|
1148
|
+
return this.parseBindingList(M.bracketR, !0, !0), !0;
|
|
1149
|
+
} catch (t$1) {
|
|
1150
|
+
return !1;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
return !1;
|
|
1154
|
+
}, p.tsIsUnambiguouslyStartOfFunctionType = function() {
|
|
1155
|
+
if (this.next(), this.match(M.parenR) || this.match(M.ellipsis)) return !0;
|
|
1156
|
+
if (this.tsSkipParameterStart()) {
|
|
1157
|
+
if (this.match(M.colon) || this.match(M.comma) || this.match(M.question) || this.match(M.eq)) return !0;
|
|
1158
|
+
if (this.match(M.parenR) && (this.next(), this.match(M.arrow))) return !0;
|
|
1159
|
+
}
|
|
1160
|
+
return !1;
|
|
1161
|
+
}, p.tsIsStartOfFunctionType = function() {
|
|
1162
|
+
return !!this.tsMatchLeftRelational() || this.match(M.parenL) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this));
|
|
1163
|
+
}, p.tsInAllowConditionalTypesContext = function(t$1) {
|
|
1164
|
+
var e$2 = this.inDisallowConditionalTypesContext;
|
|
1165
|
+
this.inDisallowConditionalTypesContext = !1;
|
|
1166
|
+
try {
|
|
1167
|
+
return t$1();
|
|
1168
|
+
} finally {
|
|
1169
|
+
this.inDisallowConditionalTypesContext = e$2;
|
|
1170
|
+
}
|
|
1171
|
+
}, p.tsParseBindingListForSignature = function() {
|
|
1172
|
+
var e$2 = this;
|
|
1173
|
+
return t.prototype.parseBindingList.call(this, M.parenR, !0, !0).map(function(t$1) {
|
|
1174
|
+
return "Identifier" !== t$1.type && "RestElement" !== t$1.type && "ObjectPattern" !== t$1.type && "ArrayPattern" !== t$1.type && e$2.raise(t$1.start, T.UnsupportedSignatureParameterKind(t$1.type)), t$1;
|
|
1175
|
+
});
|
|
1176
|
+
}, p.tsParseTypePredicateAsserts = function() {
|
|
1177
|
+
if (this.type !== B.asserts) return !1;
|
|
1178
|
+
var t$1 = this.containsEsc;
|
|
1179
|
+
return this.next(), !(!z(this.type) && !this.match(M._this) || (t$1 && this.raise(this.lastTokStart, "Escape sequence in keyword asserts"), 0));
|
|
1180
|
+
}, p.tsParseThisTypeNode = function() {
|
|
1181
|
+
var t$1 = this.startNode();
|
|
1182
|
+
return this.next(), this.finishNode(t$1, "TSThisType");
|
|
1183
|
+
}, p.tsParseTypeAnnotation = function(t$1, e$2) {
|
|
1184
|
+
var s$1 = this;
|
|
1185
|
+
return void 0 === t$1 && (t$1 = !0), void 0 === e$2 && (e$2 = this.startNode()), this.tsInType(function() {
|
|
1186
|
+
t$1 && s$1.expect(M.colon), e$2.typeAnnotation = s$1.tsParseType();
|
|
1187
|
+
}), this.finishNode(e$2, "TSTypeAnnotation");
|
|
1188
|
+
}, p.tsParseThisTypePredicate = function(t$1) {
|
|
1189
|
+
this.next();
|
|
1190
|
+
var e$2 = this.startNodeAtNode(t$1);
|
|
1191
|
+
return e$2.parameterName = t$1, e$2.typeAnnotation = this.tsParseTypeAnnotation(!1), e$2.asserts = !1, this.finishNode(e$2, "TSTypePredicate");
|
|
1192
|
+
}, p.tsParseThisTypeOrThisTypePredicate = function() {
|
|
1193
|
+
var t$1 = this.tsParseThisTypeNode();
|
|
1194
|
+
return this.isContextual("is") && !this.hasPrecedingLineBreak() ? this.tsParseThisTypePredicate(t$1) : t$1;
|
|
1195
|
+
}, p.tsParseTypePredicatePrefix = function() {
|
|
1196
|
+
var t$1 = this.parseIdent();
|
|
1197
|
+
if (this.isContextual("is") && !this.hasPrecedingLineBreak()) return this.next(), t$1;
|
|
1198
|
+
}, p.tsParseTypeOrTypePredicateAnnotation = function(t$1) {
|
|
1199
|
+
var e$2 = this;
|
|
1200
|
+
return this.tsInType(function() {
|
|
1201
|
+
var s$1 = e$2.startNode();
|
|
1202
|
+
e$2.expect(t$1);
|
|
1203
|
+
var i = e$2.startNode(), r$1 = !!e$2.tsTryParse(e$2.tsParseTypePredicateAsserts.bind(e$2));
|
|
1204
|
+
if (r$1 && e$2.match(M._this)) {
|
|
1205
|
+
var a = e$2.tsParseThisTypeOrThisTypePredicate();
|
|
1206
|
+
return "TSThisType" === a.type ? (i.parameterName = a, i.asserts = !0, i.typeAnnotation = null, a = e$2.finishNode(i, "TSTypePredicate")) : (e$2.resetStartLocationFromNode(a, i), a.asserts = !0), s$1.typeAnnotation = a, e$2.finishNode(s$1, "TSTypeAnnotation");
|
|
1207
|
+
}
|
|
1208
|
+
var n$3 = e$2.tsIsIdentifier() && e$2.tsTryParse(e$2.tsParseTypePredicatePrefix.bind(e$2));
|
|
1209
|
+
if (!n$3) return r$1 ? (i.parameterName = e$2.parseIdent(), i.asserts = r$1, i.typeAnnotation = null, s$1.typeAnnotation = e$2.finishNode(i, "TSTypePredicate"), e$2.finishNode(s$1, "TSTypeAnnotation")) : e$2.tsParseTypeAnnotation(!1, s$1);
|
|
1210
|
+
var o$2 = e$2.tsParseTypeAnnotation(!1);
|
|
1211
|
+
return i.parameterName = n$3, i.typeAnnotation = o$2, i.asserts = r$1, s$1.typeAnnotation = e$2.finishNode(i, "TSTypePredicate"), e$2.finishNode(s$1, "TSTypeAnnotation");
|
|
1212
|
+
});
|
|
1213
|
+
}, p.tsFillSignature = function(t$1, e$2) {
|
|
1214
|
+
var s$1 = t$1 === M.arrow;
|
|
1215
|
+
e$2.typeParameters = this.tsTryParseTypeParameters(), this.expect(M.parenL), e$2.parameters = this.tsParseBindingListForSignature(), (s$1 || this.match(t$1)) && (e$2.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation(t$1));
|
|
1216
|
+
}, p.tsTryNextParseConstantContext = function() {
|
|
1217
|
+
if (this.lookahead().type !== M._const) return null;
|
|
1218
|
+
this.next();
|
|
1219
|
+
var t$1 = this.tsParseTypeReference();
|
|
1220
|
+
return t$1.typeParameters && this.raise(t$1.typeName.start, T.CannotFindName({ name: "const" })), t$1;
|
|
1221
|
+
}, p.tsParseFunctionOrConstructorType = function(t$1, e$2) {
|
|
1222
|
+
var s$1 = this, i = this.startNode();
|
|
1223
|
+
return "TSConstructorType" === t$1 && (i.abstract = !!e$2, e$2 && this.next(), this.next()), this.tsInAllowConditionalTypesContext(function() {
|
|
1224
|
+
return s$1.tsFillSignature(M.arrow, i);
|
|
1225
|
+
}), this.finishNode(i, t$1);
|
|
1226
|
+
}, p.tsParseUnionOrIntersectionType = function(t$1, e$2, s$1) {
|
|
1227
|
+
var i = this.startNode(), r$1 = this.eat(s$1), a = [];
|
|
1228
|
+
do
|
|
1229
|
+
a.push(e$2());
|
|
1230
|
+
while (this.eat(s$1));
|
|
1231
|
+
return 1 !== a.length || r$1 ? (i.types = a, this.finishNode(i, t$1)) : a[0];
|
|
1232
|
+
}, p.tsCheckTypeAnnotationForReadOnly = function(t$1) {
|
|
1233
|
+
switch (t$1.typeAnnotation.type) {
|
|
1234
|
+
case "TSTupleType":
|
|
1235
|
+
case "TSArrayType": return;
|
|
1236
|
+
default: this.raise(t$1.start, T.UnexpectedReadonly);
|
|
1237
|
+
}
|
|
1238
|
+
}, p.tsParseTypeOperator = function() {
|
|
1239
|
+
var t$1 = this.startNode(), e$2 = this.value;
|
|
1240
|
+
return this.next(), t$1.operator = e$2, t$1.typeAnnotation = this.tsParseTypeOperatorOrHigher(), "readonly" === e$2 && this.tsCheckTypeAnnotationForReadOnly(t$1), this.finishNode(t$1, "TSTypeOperator");
|
|
1241
|
+
}, p.tsParseConstraintForInferType = function() {
|
|
1242
|
+
var t$1 = this;
|
|
1243
|
+
if (this.eat(M._extends)) {
|
|
1244
|
+
var e$2 = this.tsInDisallowConditionalTypesContext(function() {
|
|
1245
|
+
return t$1.tsParseType();
|
|
1246
|
+
});
|
|
1247
|
+
if (this.inDisallowConditionalTypesContext || !this.match(M.question)) return e$2;
|
|
1248
|
+
}
|
|
1249
|
+
}, p.tsParseInferType = function() {
|
|
1250
|
+
var t$1 = this, e$2 = this.startNode();
|
|
1251
|
+
this.expectContextual("infer");
|
|
1252
|
+
var s$1 = this.startNode();
|
|
1253
|
+
return s$1.name = this.tsParseTypeParameterName(), s$1.constraint = this.tsTryParse(function() {
|
|
1254
|
+
return t$1.tsParseConstraintForInferType();
|
|
1255
|
+
}), e$2.typeParameter = this.finishNode(s$1, "TSTypeParameter"), this.finishNode(e$2, "TSInferType");
|
|
1256
|
+
}, p.tsParseLiteralTypeNode = function() {
|
|
1257
|
+
var t$1 = this, e$2 = this.startNode();
|
|
1258
|
+
return e$2.literal = function() {
|
|
1259
|
+
switch (t$1.type) {
|
|
1260
|
+
case M.num:
|
|
1261
|
+
case M.string:
|
|
1262
|
+
case M._true:
|
|
1263
|
+
case M._false: return t$1.parseExprAtom();
|
|
1264
|
+
default: t$1.unexpected();
|
|
1265
|
+
}
|
|
1266
|
+
}(), this.finishNode(e$2, "TSLiteralType");
|
|
1267
|
+
}, p.tsParseImportType = function() {
|
|
1268
|
+
var t$1 = this.startNode();
|
|
1269
|
+
return this.expect(M._import), this.expect(M.parenL), this.match(M.string) || this.raise(this.start, T.UnsupportedImportTypeArgument), t$1.argument = this.parseExprAtom(), this.expect(M.parenR), this.eat(M.dot) && (t$1.qualifier = this.tsParseEntityName()), this.tsMatchLeftRelational() && (t$1.typeParameters = this.tsParseTypeArguments()), this.finishNode(t$1, "TSImportType");
|
|
1270
|
+
}, p.tsParseTypeQuery = function() {
|
|
1271
|
+
var t$1 = this.startNode();
|
|
1272
|
+
return this.expect(M._typeof), t$1.exprName = this.match(M._import) ? this.tsParseImportType() : this.tsParseEntityName(), !this.hasPrecedingLineBreak() && this.tsMatchLeftRelational() && (t$1.typeParameters = this.tsParseTypeArguments()), this.finishNode(t$1, "TSTypeQuery");
|
|
1273
|
+
}, p.tsParseMappedTypeParameter = function() {
|
|
1274
|
+
var t$1 = this.startNode();
|
|
1275
|
+
return t$1.name = this.tsParseTypeParameterName(), t$1.constraint = this.tsExpectThenParseType(M._in), this.finishNode(t$1, "TSTypeParameter");
|
|
1276
|
+
}, p.tsParseMappedType = function() {
|
|
1277
|
+
var t$1 = this.startNode();
|
|
1278
|
+
return this.expect(M.braceL), this.match(M.plusMin) ? (t$1.readonly = this.value, this.next(), this.expectContextual("readonly")) : this.eatContextual("readonly") && (t$1.readonly = !0), this.expect(M.bracketL), t$1.typeParameter = this.tsParseMappedTypeParameter(), t$1.nameType = this.eatContextual("as") ? this.tsParseType() : null, this.expect(M.bracketR), this.match(M.plusMin) ? (t$1.optional = this.value, this.next(), this.expect(M.question)) : this.eat(M.question) && (t$1.optional = !0), t$1.typeAnnotation = this.tsTryParseType(), this.semicolon(), this.expect(M.braceR), this.finishNode(t$1, "TSMappedType");
|
|
1279
|
+
}, p.tsParseTypeLiteral = function() {
|
|
1280
|
+
var t$1 = this.startNode();
|
|
1281
|
+
return t$1.members = this.tsParseObjectTypeMembers(), this.finishNode(t$1, "TSTypeLiteral");
|
|
1282
|
+
}, p.tsParseTupleElementType = function() {
|
|
1283
|
+
var t$1 = this.startLoc, e$2 = this.start, s$1 = this.eat(M.ellipsis), i = this.tsParseType(), r$1 = this.eat(M.question);
|
|
1284
|
+
if (this.eat(M.colon)) {
|
|
1285
|
+
var a = this.startNodeAtNode(i);
|
|
1286
|
+
a.optional = r$1, "TSTypeReference" !== i.type || i.typeParameters || "Identifier" !== i.typeName.type ? (this.raise(i.start, T.InvalidTupleMemberLabel), a.label = i) : a.label = i.typeName, a.elementType = this.tsParseType(), i = this.finishNode(a, "TSNamedTupleMember");
|
|
1287
|
+
} else if (r$1) {
|
|
1288
|
+
var n$3 = this.startNodeAtNode(i);
|
|
1289
|
+
n$3.typeAnnotation = i, i = this.finishNode(n$3, "TSOptionalType");
|
|
1290
|
+
}
|
|
1291
|
+
if (s$1) {
|
|
1292
|
+
var o$2 = this.startNodeAt(e$2, t$1);
|
|
1293
|
+
o$2.typeAnnotation = i, i = this.finishNode(o$2, "TSRestType");
|
|
1294
|
+
}
|
|
1295
|
+
return i;
|
|
1296
|
+
}, p.tsParseTupleType = function() {
|
|
1297
|
+
var t$1 = this, e$2 = this.startNode();
|
|
1298
|
+
e$2.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), !0, !1);
|
|
1299
|
+
var s$1 = !1, i = null;
|
|
1300
|
+
return e$2.elementTypes.forEach(function(e$3) {
|
|
1301
|
+
var r$1 = e$3.type;
|
|
1302
|
+
!s$1 || "TSRestType" === r$1 || "TSOptionalType" === r$1 || "TSNamedTupleMember" === r$1 && e$3.optional || t$1.raise(e$3.start, T.OptionalTypeBeforeRequired), s$1 || (s$1 = "TSNamedTupleMember" === r$1 && e$3.optional || "TSOptionalType" === r$1);
|
|
1303
|
+
var a = r$1;
|
|
1304
|
+
"TSRestType" === r$1 && (a = (e$3 = e$3.typeAnnotation).type);
|
|
1305
|
+
var n$3 = "TSNamedTupleMember" === a;
|
|
1306
|
+
i ??= n$3, i !== n$3 && t$1.raise(e$3.start, T.MixedLabeledAndUnlabeledElements);
|
|
1307
|
+
}), this.finishNode(e$2, "TSTupleType");
|
|
1308
|
+
}, p.tsParseTemplateLiteralType = function() {
|
|
1309
|
+
var t$1 = this.startNode();
|
|
1310
|
+
return t$1.literal = this.parseTemplate({ isTagged: !1 }), this.finishNode(t$1, "TSLiteralType");
|
|
1311
|
+
}, p.tsParseTypeReference = function() {
|
|
1312
|
+
var t$1 = this.startNode();
|
|
1313
|
+
return t$1.typeName = this.tsParseEntityName(), !this.hasPrecedingLineBreak() && this.tsMatchLeftRelational() && (t$1.typeParameters = this.tsParseTypeArguments()), this.finishNode(t$1, "TSTypeReference");
|
|
1314
|
+
}, p.tsMatchLeftRelational = function() {
|
|
1315
|
+
return this.match(M.relational) && "<" === this.value;
|
|
1316
|
+
}, p.tsMatchRightRelational = function() {
|
|
1317
|
+
return this.match(M.relational) && ">" === this.value;
|
|
1318
|
+
}, p.tsParseParenthesizedType = function() {
|
|
1319
|
+
var t$1 = this.startNode();
|
|
1320
|
+
return this.expect(M.parenL), t$1.typeAnnotation = this.tsParseType(), this.expect(M.parenR), this.finishNode(t$1, "TSParenthesizedType");
|
|
1321
|
+
}, p.tsParseNonArrayType = function() {
|
|
1322
|
+
switch (this.type) {
|
|
1323
|
+
case M.string:
|
|
1324
|
+
case M.num:
|
|
1325
|
+
case M._true:
|
|
1326
|
+
case M._false: return this.tsParseLiteralTypeNode();
|
|
1327
|
+
case M.plusMin:
|
|
1328
|
+
if ("-" === this.value) {
|
|
1329
|
+
var t$1 = this.startNode();
|
|
1330
|
+
return this.lookahead().type !== M.num && this.unexpected(), t$1.literal = this.parseMaybeUnary(), this.finishNode(t$1, "TSLiteralType");
|
|
1331
|
+
}
|
|
1332
|
+
break;
|
|
1333
|
+
case M._this: return this.tsParseThisTypeOrThisTypePredicate();
|
|
1334
|
+
case M._typeof: return this.tsParseTypeQuery();
|
|
1335
|
+
case M._import: return this.tsParseImportType();
|
|
1336
|
+
case M.braceL: return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral();
|
|
1337
|
+
case M.bracketL: return this.tsParseTupleType();
|
|
1338
|
+
case M.parenL: return this.tsParseParenthesizedType();
|
|
1339
|
+
case M.backQuote:
|
|
1340
|
+
case M.dollarBraceL: return this.tsParseTemplateLiteralType();
|
|
1341
|
+
default:
|
|
1342
|
+
var e$2 = this.type;
|
|
1343
|
+
if (z(e$2) || e$2 === M._void || e$2 === M._null) {
|
|
1344
|
+
var s$1 = e$2 === M._void ? "TSVoidKeyword" : e$2 === M._null ? "TSNullKeyword" : function(t$2) {
|
|
1345
|
+
switch (t$2) {
|
|
1346
|
+
case "any": return "TSAnyKeyword";
|
|
1347
|
+
case "boolean": return "TSBooleanKeyword";
|
|
1348
|
+
case "bigint": return "TSBigIntKeyword";
|
|
1349
|
+
case "never": return "TSNeverKeyword";
|
|
1350
|
+
case "number": return "TSNumberKeyword";
|
|
1351
|
+
case "object": return "TSObjectKeyword";
|
|
1352
|
+
case "string": return "TSStringKeyword";
|
|
1353
|
+
case "symbol": return "TSSymbolKeyword";
|
|
1354
|
+
case "undefined": return "TSUndefinedKeyword";
|
|
1355
|
+
case "unknown": return "TSUnknownKeyword";
|
|
1356
|
+
default: return;
|
|
1357
|
+
}
|
|
1358
|
+
}(this.value);
|
|
1359
|
+
if (void 0 !== s$1 && 46 !== this.lookaheadCharCode()) {
|
|
1360
|
+
var i = this.startNode();
|
|
1361
|
+
return this.next(), this.finishNode(i, s$1);
|
|
1362
|
+
}
|
|
1363
|
+
return this.tsParseTypeReference();
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
this.unexpected();
|
|
1367
|
+
}, p.tsParseArrayTypeOrHigher = function() {
|
|
1368
|
+
for (var t$1 = this.tsParseNonArrayType(); !this.hasPrecedingLineBreak() && this.eat(M.bracketL);) if (this.match(M.bracketR)) {
|
|
1369
|
+
var e$2 = this.startNodeAtNode(t$1);
|
|
1370
|
+
e$2.elementType = t$1, this.expect(M.bracketR), t$1 = this.finishNode(e$2, "TSArrayType");
|
|
1371
|
+
} else {
|
|
1372
|
+
var s$1 = this.startNodeAtNode(t$1);
|
|
1373
|
+
s$1.objectType = t$1, s$1.indexType = this.tsParseType(), this.expect(M.bracketR), t$1 = this.finishNode(s$1, "TSIndexedAccessType");
|
|
1374
|
+
}
|
|
1375
|
+
return t$1;
|
|
1376
|
+
}, p.tsParseTypeOperatorOrHigher = function() {
|
|
1377
|
+
var t$1 = this;
|
|
1378
|
+
return X(this.type) && !this.containsEsc ? this.tsParseTypeOperator() : this.isContextual("infer") ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(function() {
|
|
1379
|
+
return t$1.tsParseArrayTypeOrHigher();
|
|
1380
|
+
});
|
|
1381
|
+
}, p.tsParseIntersectionTypeOrHigher = function() {
|
|
1382
|
+
return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), M.bitwiseAND);
|
|
1383
|
+
}, p.tsParseUnionTypeOrHigher = function() {
|
|
1384
|
+
return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), M.bitwiseOR);
|
|
1385
|
+
}, p.tsParseNonConditionalType = function() {
|
|
1386
|
+
return this.tsIsStartOfFunctionType() ? this.tsParseFunctionOrConstructorType("TSFunctionType") : this.match(M._new) ? this.tsParseFunctionOrConstructorType("TSConstructorType") : this.isAbstractConstructorSignature() ? this.tsParseFunctionOrConstructorType("TSConstructorType", !0) : this.tsParseUnionTypeOrHigher();
|
|
1387
|
+
}, p.tsParseType = function() {
|
|
1388
|
+
var t$1 = this;
|
|
1389
|
+
S(this.inType);
|
|
1390
|
+
var e$2 = this.tsParseNonConditionalType();
|
|
1391
|
+
if (this.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(M._extends)) return e$2;
|
|
1392
|
+
var s$1 = this.startNodeAtNode(e$2);
|
|
1393
|
+
return s$1.checkType = e$2, s$1.extendsType = this.tsInDisallowConditionalTypesContext(function() {
|
|
1394
|
+
return t$1.tsParseNonConditionalType();
|
|
1395
|
+
}), this.expect(M.question), s$1.trueType = this.tsInAllowConditionalTypesContext(function() {
|
|
1396
|
+
return t$1.tsParseType();
|
|
1397
|
+
}), this.expect(M.colon), s$1.falseType = this.tsInAllowConditionalTypesContext(function() {
|
|
1398
|
+
return t$1.tsParseType();
|
|
1399
|
+
}), this.finishNode(s$1, "TSConditionalType");
|
|
1400
|
+
}, p.tsIsUnambiguouslyIndexSignature = function() {
|
|
1401
|
+
return this.next(), !!z(this.type) && (this.next(), this.match(M.colon));
|
|
1402
|
+
}, p.tsInType = function(t$1) {
|
|
1403
|
+
var e$2 = this.inType;
|
|
1404
|
+
this.inType = !0;
|
|
1405
|
+
try {
|
|
1406
|
+
return t$1();
|
|
1407
|
+
} finally {
|
|
1408
|
+
this.inType = e$2;
|
|
1409
|
+
}
|
|
1410
|
+
}, p.tsTryParseIndexSignature = function(t$1) {
|
|
1411
|
+
if (this.match(M.bracketL) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))) {
|
|
1412
|
+
this.expect(M.bracketL);
|
|
1413
|
+
var e$2 = this.parseIdent();
|
|
1414
|
+
e$2.typeAnnotation = this.tsParseTypeAnnotation(), this.resetEndLocation(e$2), this.expect(M.bracketR), t$1.parameters = [e$2];
|
|
1415
|
+
var s$1 = this.tsTryParseTypeAnnotation();
|
|
1416
|
+
return s$1 && (t$1.typeAnnotation = s$1), this.tsParseTypeMemberSemicolon(), this.finishNode(t$1, "TSIndexSignature");
|
|
1417
|
+
}
|
|
1418
|
+
}, p.tsParseNoneModifiers = function(t$1) {
|
|
1419
|
+
this.tsParseModifiers({
|
|
1420
|
+
modified: t$1,
|
|
1421
|
+
allowedModifiers: [],
|
|
1422
|
+
disallowedModifiers: ["in", "out"],
|
|
1423
|
+
errorTemplate: T.InvalidModifierOnTypeParameterPositions
|
|
1424
|
+
});
|
|
1425
|
+
}, p.tsParseTypeParameter = function(t$1) {
|
|
1426
|
+
void 0 === t$1 && (t$1 = this.tsParseNoneModifiers.bind(this));
|
|
1427
|
+
var e$2 = this.startNode();
|
|
1428
|
+
return t$1(e$2), e$2.name = this.tsParseTypeParameterName(), e$2.constraint = this.tsEatThenParseType(M._extends), e$2.default = this.tsEatThenParseType(M.eq), this.finishNode(e$2, "TSTypeParameter");
|
|
1429
|
+
}, p.tsParseTypeParameters = function(t$1) {
|
|
1430
|
+
var e$2 = this.startNode();
|
|
1431
|
+
this.tsMatchLeftRelational() || this.matchJsx("jsxTagStart") ? this.next() : this.unexpected();
|
|
1432
|
+
var s$1 = { value: -1 };
|
|
1433
|
+
return e$2.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, t$1), !1, !0, s$1), 0 === e$2.params.length && this.raise(this.start, T.EmptyTypeParameters), -1 !== s$1.value && this.addExtra(e$2, "trailingComma", s$1.value), this.finishNode(e$2, "TSTypeParameterDeclaration");
|
|
1434
|
+
}, p.tsTryParseTypeParameters = function(t$1) {
|
|
1435
|
+
if (this.tsMatchLeftRelational()) return this.tsParseTypeParameters(t$1);
|
|
1436
|
+
}, p.tsTryParse = function(t$1) {
|
|
1437
|
+
var e$2 = this.getCurLookaheadState(), s$1 = t$1();
|
|
1438
|
+
return void 0 !== s$1 && !1 !== s$1 ? s$1 : void this.setLookaheadState(e$2);
|
|
1439
|
+
}, p.tsTokenCanFollowModifier = function() {
|
|
1440
|
+
return (this.match(M.bracketL) || this.match(M.braceL) || this.match(M.star) || this.match(M.ellipsis) || this.match(M.privateId) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
|
|
1441
|
+
}, p.tsNextTokenCanFollowModifier = function() {
|
|
1442
|
+
return this.next(!0), this.tsTokenCanFollowModifier();
|
|
1443
|
+
}, p.tsParseModifier = function(t$1, e$2) {
|
|
1444
|
+
if (z(this.type) || this.type === M._in) {
|
|
1445
|
+
var s$1 = this.value;
|
|
1446
|
+
if (-1 !== t$1.indexOf(s$1) && !this.containsEsc) {
|
|
1447
|
+
if (e$2 && this.tsIsStartOfStaticBlocks()) return;
|
|
1448
|
+
if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) return s$1;
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}, p.tsParseModifiersByMap = function(t$1) {
|
|
1452
|
+
for (var e$2 = t$1.modified, s$1 = t$1.map, i = 0, r$1 = Object.keys(s$1); i < r$1.length; i++) {
|
|
1453
|
+
var a = r$1[i];
|
|
1454
|
+
e$2[a] = s$1[a];
|
|
1455
|
+
}
|
|
1456
|
+
}, p.tsParseModifiers = function(t$1) {
|
|
1457
|
+
for (var e$2 = this, s$1 = t$1.modified, i = t$1.allowedModifiers, r$1 = t$1.disallowedModifiers, a = t$1.stopOnStartOfClassStaticBlock, n$3 = t$1.errorTemplate, o$2 = void 0 === n$3 ? T.InvalidModifierOnTypeMember : n$3, h = {}, p$1 = function(t$2, i$1, r$2, a$1) {
|
|
1458
|
+
i$1 === r$2 && s$1[a$1] && e$2.raise(t$2.column, T.InvalidModifiersOrder({ orderedModifiers: [r$2, a$1] }));
|
|
1459
|
+
}, c = function(t$2, i$1, r$2, a$1) {
|
|
1460
|
+
(s$1[r$2] && i$1 === a$1 || s$1[a$1] && i$1 === r$2) && e$2.raise(t$2.column, T.IncompatibleModifiers({ modifiers: [r$2, a$1] }));
|
|
1461
|
+
};;) {
|
|
1462
|
+
var l = this.startLoc, u = this.tsParseModifier(i.concat(null != r$1 ? r$1 : []), a);
|
|
1463
|
+
if (!u) break;
|
|
1464
|
+
w(u) ? s$1.accessibility ? this.raise(this.start, T.DuplicateAccessibilityModifier()) : (p$1(l, u, u, "override"), p$1(l, u, u, "static"), p$1(l, u, u, "readonly"), p$1(l, u, u, "accessor"), h.accessibility = u, s$1.accessibility = u) : C(u) ? s$1[u] ? this.raise(this.start, T.DuplicateModifier({ modifier: u })) : (p$1(l, u, "in", "out"), h[u] = u, s$1[u] = !0) : k(u) ? s$1[u] ? this.raise(this.start, T.DuplicateModifier({ modifier: u })) : (c(l, u, "accessor", "readonly"), c(l, u, "accessor", "static"), c(l, u, "accessor", "override"), h[u] = u, s$1[u] = !0) : Object.hasOwnProperty.call(s$1, u) ? this.raise(this.start, T.DuplicateModifier({ modifier: u })) : (p$1(l, u, "static", "readonly"), p$1(l, u, "static", "override"), p$1(l, u, "override", "readonly"), p$1(l, u, "abstract", "override"), c(l, u, "declare", "override"), c(l, u, "static", "abstract"), h[u] = u, s$1[u] = !0), null != r$1 && r$1.includes(u) && this.raise(this.start, o$2);
|
|
1465
|
+
}
|
|
1466
|
+
return h;
|
|
1467
|
+
}, p.tsParseInOutModifiers = function(t$1) {
|
|
1468
|
+
this.tsParseModifiers({
|
|
1469
|
+
modified: t$1,
|
|
1470
|
+
allowedModifiers: ["in", "out"],
|
|
1471
|
+
disallowedModifiers: [
|
|
1472
|
+
"public",
|
|
1473
|
+
"private",
|
|
1474
|
+
"protected",
|
|
1475
|
+
"readonly",
|
|
1476
|
+
"declare",
|
|
1477
|
+
"abstract",
|
|
1478
|
+
"override"
|
|
1479
|
+
],
|
|
1480
|
+
errorTemplate: T.InvalidModifierOnTypeParameter
|
|
1481
|
+
});
|
|
1482
|
+
}, p.tsParseTypeArguments = function() {
|
|
1483
|
+
var t$1 = this, e$2 = this.startNode();
|
|
1484
|
+
return e$2.params = this.tsInType(function() {
|
|
1485
|
+
return t$1.tsInNoContext(function() {
|
|
1486
|
+
return t$1.expect(M.relational), t$1.tsParseDelimitedList("TypeParametersOrArguments", t$1.tsParseType.bind(t$1));
|
|
1487
|
+
});
|
|
1488
|
+
}), 0 === e$2.params.length && this.raise(this.start, T.EmptyTypeArguments), this.exprAllowed = !1, this.expect(M.relational), this.finishNode(e$2, "TSTypeParameterInstantiation");
|
|
1489
|
+
}, p.tsParseHeritageClause = function(t$1) {
|
|
1490
|
+
var e$2 = this, s$1 = this.start, i = this.tsParseDelimitedList("HeritageClauseElement", function() {
|
|
1491
|
+
var t$2 = e$2.startNode();
|
|
1492
|
+
return t$2.expression = e$2.tsParseEntityName(), e$2.tsMatchLeftRelational() && (t$2.typeParameters = e$2.tsParseTypeArguments()), e$2.finishNode(t$2, "TSExpressionWithTypeArguments");
|
|
1493
|
+
});
|
|
1494
|
+
return i.length || this.raise(s$1, T.EmptyHeritageClauseType({ token: t$1 })), i;
|
|
1495
|
+
}, p.tsParseTypeMemberSemicolon = function() {
|
|
1496
|
+
this.eat(M.comma) || this.isLineTerminator() || this.expect(M.semi);
|
|
1497
|
+
}, p.tsTryParseAndCatch = function(t$1) {
|
|
1498
|
+
var e$2 = this.tryParse(function(e$3) {
|
|
1499
|
+
return t$1() || e$3();
|
|
1500
|
+
});
|
|
1501
|
+
if (!e$2.aborted && e$2.node) return e$2.error && this.setLookaheadState(e$2.failState), e$2.node;
|
|
1502
|
+
}, p.tsParseSignatureMember = function(t$1, e$2) {
|
|
1503
|
+
return this.tsFillSignature(M.colon, e$2), this.tsParseTypeMemberSemicolon(), this.finishNode(e$2, t$1);
|
|
1504
|
+
}, p.tsParsePropertyOrMethodSignature = function(t$1, e$2) {
|
|
1505
|
+
this.eat(M.question) && (t$1.optional = !0);
|
|
1506
|
+
var s$1 = t$1;
|
|
1507
|
+
if (this.match(M.parenL) || this.tsMatchLeftRelational()) {
|
|
1508
|
+
e$2 && this.raise(t$1.start, T.ReadonlyForMethodSignature);
|
|
1509
|
+
var i = s$1;
|
|
1510
|
+
i.kind && this.tsMatchLeftRelational() && this.raise(this.start, T.AccesorCannotHaveTypeParameters), this.tsFillSignature(M.colon, i), this.tsParseTypeMemberSemicolon();
|
|
1511
|
+
var r$1 = "parameters", a = "typeAnnotation";
|
|
1512
|
+
if ("get" === i.kind) i[r$1].length > 0 && (this.raise(this.start, "A 'get' accesor must not have any formal parameters."), this.isThisParam(i[r$1][0]) && this.raise(this.start, T.AccesorCannotDeclareThisParameter));
|
|
1513
|
+
else if ("set" === i.kind) {
|
|
1514
|
+
if (1 !== i[r$1].length) this.raise(this.start, "A 'get' accesor must not have any formal parameters.");
|
|
1515
|
+
else {
|
|
1516
|
+
var n$3 = i[r$1][0];
|
|
1517
|
+
this.isThisParam(n$3) && this.raise(this.start, T.AccesorCannotDeclareThisParameter), "Identifier" === n$3.type && n$3.optional && this.raise(this.start, T.SetAccesorCannotHaveOptionalParameter), "RestElement" === n$3.type && this.raise(this.start, T.SetAccesorCannotHaveRestParameter);
|
|
1518
|
+
}
|
|
1519
|
+
i[a] && this.raise(i[a].start, T.SetAccesorCannotHaveReturnType);
|
|
1520
|
+
} else i.kind = "method";
|
|
1521
|
+
return this.finishNode(i, "TSMethodSignature");
|
|
1522
|
+
}
|
|
1523
|
+
var o$2 = s$1;
|
|
1524
|
+
e$2 && (o$2.readonly = !0);
|
|
1525
|
+
var h = this.tsTryParseTypeAnnotation();
|
|
1526
|
+
return h && (o$2.typeAnnotation = h), this.tsParseTypeMemberSemicolon(), this.finishNode(o$2, "TSPropertySignature");
|
|
1527
|
+
}, p.tsParseTypeMember = function() {
|
|
1528
|
+
var t$1 = this.startNode();
|
|
1529
|
+
if (this.match(M.parenL) || this.tsMatchLeftRelational()) return this.tsParseSignatureMember("TSCallSignatureDeclaration", t$1);
|
|
1530
|
+
if (this.match(M._new)) {
|
|
1531
|
+
var e$2 = this.startNode();
|
|
1532
|
+
return this.next(), this.match(M.parenL) || this.tsMatchLeftRelational() ? this.tsParseSignatureMember("TSConstructSignatureDeclaration", t$1) : (t$1.key = this.createIdentifier(e$2, "new"), this.tsParsePropertyOrMethodSignature(t$1, !1));
|
|
1533
|
+
}
|
|
1534
|
+
return this.tsParseModifiers({
|
|
1535
|
+
modified: t$1,
|
|
1536
|
+
allowedModifiers: ["readonly"],
|
|
1537
|
+
disallowedModifiers: [
|
|
1538
|
+
"declare",
|
|
1539
|
+
"abstract",
|
|
1540
|
+
"private",
|
|
1541
|
+
"protected",
|
|
1542
|
+
"public",
|
|
1543
|
+
"static",
|
|
1544
|
+
"override"
|
|
1545
|
+
]
|
|
1546
|
+
}), this.tsTryParseIndexSignature(t$1) || (this.parsePropertyName(t$1), t$1.computed || "Identifier" !== t$1.key.type || "get" !== t$1.key.name && "set" !== t$1.key.name || !this.tsTokenCanFollowModifier() || (t$1.kind = t$1.key.name, this.parsePropertyName(t$1)), this.tsParsePropertyOrMethodSignature(t$1, !!t$1.readonly));
|
|
1547
|
+
}, p.tsParseList = function(t$1, e$2) {
|
|
1548
|
+
for (var s$1 = []; !this.tsIsListTerminator(t$1);) s$1.push(e$2());
|
|
1549
|
+
return s$1;
|
|
1550
|
+
}, p.tsParseObjectTypeMembers = function() {
|
|
1551
|
+
this.expect(M.braceL);
|
|
1552
|
+
var t$1 = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this));
|
|
1553
|
+
return this.expect(M.braceR), t$1;
|
|
1554
|
+
}, p.tsParseInterfaceDeclaration = function(t$1, e$2) {
|
|
1555
|
+
if (void 0 === e$2 && (e$2 = {}), this.hasFollowingLineBreak()) return null;
|
|
1556
|
+
this.expectContextual("interface"), e$2.declare && (t$1.declare = !0), z(this.type) ? (t$1.id = this.parseIdent(), this.checkLValSimple(t$1.id, 7)) : (t$1.id = null, this.raise(this.start, T.MissingInterfaceName)), t$1.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this)), this.eat(M._extends) && (t$1.extends = this.tsParseHeritageClause("extends"));
|
|
1557
|
+
var s$1 = this.startNode();
|
|
1558
|
+
return s$1.body = this.tsInType(this.tsParseObjectTypeMembers.bind(this)), t$1.body = this.finishNode(s$1, "TSInterfaceBody"), this.finishNode(t$1, "TSInterfaceDeclaration");
|
|
1559
|
+
}, p.tsParseAbstractDeclaration = function(t$1) {
|
|
1560
|
+
if (this.match(M._class)) return t$1.abstract = !0, this.parseClass(t$1, !0);
|
|
1561
|
+
if (this.ts_isContextual(B.interface)) {
|
|
1562
|
+
if (!this.hasFollowingLineBreak()) return t$1.abstract = !0, this.tsParseInterfaceDeclaration(t$1);
|
|
1563
|
+
} else this.unexpected(t$1.start);
|
|
1564
|
+
}, p.tsIsDeclarationStart = function() {
|
|
1565
|
+
return K(this.type);
|
|
1566
|
+
}, p.tsParseExpressionStatement = function(e$2, s$1) {
|
|
1567
|
+
switch (s$1.name) {
|
|
1568
|
+
case "declare":
|
|
1569
|
+
var i = this.tsTryParseDeclare(e$2);
|
|
1570
|
+
if (i) return i.declare = !0, i;
|
|
1571
|
+
break;
|
|
1572
|
+
case "global":
|
|
1573
|
+
if (this.match(M.braceL)) {
|
|
1574
|
+
t.prototype.enterScope.call(this, u);
|
|
1575
|
+
var r$1 = e$2;
|
|
1576
|
+
return r$1.global = !0, r$1.id = s$1, r$1.body = this.tsParseModuleBlock(), t.prototype.exitScope.call(this), this.finishNode(r$1, "TSModuleDeclaration");
|
|
1577
|
+
}
|
|
1578
|
+
break;
|
|
1579
|
+
default: return this.tsParseDeclaration(e$2, s$1.name, !1);
|
|
1580
|
+
}
|
|
1581
|
+
}, p.tsParseModuleReference = function() {
|
|
1582
|
+
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(!1);
|
|
1583
|
+
}, p.tsIsExportDefaultSpecifier = function() {
|
|
1584
|
+
var t$1 = this.type, e$2 = this.isAsyncFunction(), s$1 = this.isLet();
|
|
1585
|
+
if (z(t$1)) {
|
|
1586
|
+
if (e$2 && !this.containsEsc || s$1) return !1;
|
|
1587
|
+
if ((t$1 === B.type || t$1 === B.interface) && !this.containsEsc) {
|
|
1588
|
+
var i = this.lookahead();
|
|
1589
|
+
if (z(i.type) && !this.isContextualWithState("from", i) || i.type === M.braceL) return !1;
|
|
1590
|
+
}
|
|
1591
|
+
} else if (!this.match(M._default)) return !1;
|
|
1592
|
+
var r$1 = this.nextTokenStart(), a = this.isUnparsedContextual(r$1, "from");
|
|
1593
|
+
if (44 === this.input.charCodeAt(r$1) || z(this.type) && a) return !0;
|
|
1594
|
+
if (this.match(M._default) && a) {
|
|
1595
|
+
var n$3 = this.input.charCodeAt(this.nextTokenStartSince(r$1 + 4));
|
|
1596
|
+
return 34 === n$3 || 39 === n$3;
|
|
1597
|
+
}
|
|
1598
|
+
return !1;
|
|
1599
|
+
}, p.tsInAmbientContext = function(t$1) {
|
|
1600
|
+
var e$2 = this.isAmbientContext;
|
|
1601
|
+
this.isAmbientContext = !0;
|
|
1602
|
+
try {
|
|
1603
|
+
return t$1();
|
|
1604
|
+
} finally {
|
|
1605
|
+
this.isAmbientContext = e$2;
|
|
1606
|
+
}
|
|
1607
|
+
}, p.tsCheckLineTerminator = function(t$1) {
|
|
1608
|
+
return t$1 ? !this.hasFollowingLineBreak() && (this.next(), !0) : !this.isLineTerminator();
|
|
1609
|
+
}, p.tsParseModuleOrNamespaceDeclaration = function(e$2, s$1) {
|
|
1610
|
+
if (void 0 === s$1 && (s$1 = !1), e$2.id = this.parseIdent(), s$1 || this.checkLValSimple(e$2.id, 8), this.eat(M.dot)) {
|
|
1611
|
+
var i = this.startNode();
|
|
1612
|
+
this.tsParseModuleOrNamespaceDeclaration(i, !0), e$2.body = i;
|
|
1613
|
+
} else t.prototype.enterScope.call(this, u), e$2.body = this.tsParseModuleBlock(), t.prototype.exitScope.call(this);
|
|
1614
|
+
return this.finishNode(e$2, "TSModuleDeclaration");
|
|
1615
|
+
}, p.checkLValSimple = function(e$2, s$1, i) {
|
|
1616
|
+
return void 0 === s$1 && (s$1 = 0), t.prototype.checkLValSimple.call(this, e$2, s$1, i);
|
|
1617
|
+
}, p.tsParseTypeAliasDeclaration = function(t$1) {
|
|
1618
|
+
var e$2 = this;
|
|
1619
|
+
return t$1.id = this.parseIdent(), this.checkLValSimple(t$1.id, 6), t$1.typeAnnotation = this.tsInType(function() {
|
|
1620
|
+
if (t$1.typeParameters = e$2.tsTryParseTypeParameters(e$2.tsParseInOutModifiers.bind(e$2)), e$2.expect(M.eq), e$2.ts_isContextual(B.interface) && e$2.lookahead().type !== M.dot) {
|
|
1621
|
+
var s$1 = e$2.startNode();
|
|
1622
|
+
return e$2.next(), e$2.finishNode(s$1, "TSIntrinsicKeyword");
|
|
1623
|
+
}
|
|
1624
|
+
return e$2.tsParseType();
|
|
1625
|
+
}), this.semicolon(), this.finishNode(t$1, "TSTypeAliasDeclaration");
|
|
1626
|
+
}, p.tsParseDeclaration = function(t$1, e$2, s$1) {
|
|
1627
|
+
switch (e$2) {
|
|
1628
|
+
case "abstract":
|
|
1629
|
+
if (this.tsCheckLineTerminator(s$1) && (this.match(M._class) || z(this.type))) return this.tsParseAbstractDeclaration(t$1);
|
|
1630
|
+
break;
|
|
1631
|
+
case "module":
|
|
1632
|
+
if (this.tsCheckLineTerminator(s$1)) {
|
|
1633
|
+
if (this.match(M.string)) return this.tsParseAmbientExternalModuleDeclaration(t$1);
|
|
1634
|
+
if (z(this.type)) return this.tsParseModuleOrNamespaceDeclaration(t$1);
|
|
1635
|
+
}
|
|
1636
|
+
break;
|
|
1637
|
+
case "namespace":
|
|
1638
|
+
if (this.tsCheckLineTerminator(s$1) && z(this.type)) return this.tsParseModuleOrNamespaceDeclaration(t$1);
|
|
1639
|
+
break;
|
|
1640
|
+
case "type": if (this.tsCheckLineTerminator(s$1) && z(this.type)) return this.tsParseTypeAliasDeclaration(t$1);
|
|
1641
|
+
}
|
|
1642
|
+
}, p.tsTryParseExportDeclaration = function() {
|
|
1643
|
+
return this.tsParseDeclaration(this.startNode(), this.value, !0);
|
|
1644
|
+
}, p.tsParseImportEqualsDeclaration = function(e$2, s$1) {
|
|
1645
|
+
e$2.isExport = s$1 || !1, e$2.id = this.parseIdent(), this.checkLValSimple(e$2.id, 2), t.prototype.expect.call(this, M.eq);
|
|
1646
|
+
var i = this.tsParseModuleReference();
|
|
1647
|
+
return "type" === e$2.importKind && "TSExternalModuleReference" !== i.type && this.raise(i.start, T.ImportAliasHasImportType), e$2.moduleReference = i, t.prototype.semicolon.call(this), this.finishNode(e$2, "TSImportEqualsDeclaration");
|
|
1648
|
+
}, p.isExportDefaultSpecifier = function() {
|
|
1649
|
+
if (this.tsIsDeclarationStart()) return !1;
|
|
1650
|
+
var t$1 = this.type;
|
|
1651
|
+
if (z(t$1)) {
|
|
1652
|
+
if (this.isContextual("async") || this.isContextual("let")) return !1;
|
|
1653
|
+
if ((t$1 === B.type || t$1 === B.interface) && !this.containsEsc) {
|
|
1654
|
+
var e$2 = this.lookahead();
|
|
1655
|
+
if (z(e$2.type) && !this.isContextualWithState("from", e$2) || e$2.type === M.braceL) return !1;
|
|
1656
|
+
}
|
|
1657
|
+
} else if (!this.match(M._default)) return !1;
|
|
1658
|
+
var s$1 = this.nextTokenStart(), i = this.isUnparsedContextual(s$1, "from");
|
|
1659
|
+
if (44 === this.input.charCodeAt(s$1) || z(this.type) && i) return !0;
|
|
1660
|
+
if (this.match(M._default) && i) {
|
|
1661
|
+
var r$1 = this.input.charCodeAt(this.nextTokenStartSince(s$1 + 4));
|
|
1662
|
+
return 34 === r$1 || 39 === r$1;
|
|
1663
|
+
}
|
|
1664
|
+
return !1;
|
|
1665
|
+
}, p.parseTemplate = function(t$1) {
|
|
1666
|
+
var e$2 = (void 0 === t$1 ? {} : t$1).isTagged, s$1 = void 0 !== e$2 && e$2, i = this.startNode();
|
|
1667
|
+
this.next(), i.expressions = [];
|
|
1668
|
+
var r$1 = this.parseTemplateElement({ isTagged: s$1 });
|
|
1669
|
+
for (i.quasis = [r$1]; !r$1.tail;) this.type === M.eof && this.raise(this.pos, "Unterminated template literal"), this.expect(M.dollarBraceL), i.expressions.push(this.inType ? this.tsParseType() : this.parseExpression()), this.expect(M.braceR), i.quasis.push(r$1 = this.parseTemplateElement({ isTagged: s$1 }));
|
|
1670
|
+
return this.next(), this.finishNode(i, "TemplateLiteral");
|
|
1671
|
+
}, p.parseFunction = function(t$1, e$2, s$1, i, r$1) {
|
|
1672
|
+
this.initFunction(t$1), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !i) && (this.type === M.star && 2 & e$2 && this.unexpected(), t$1.generator = this.eat(M.star)), this.options.ecmaVersion >= 8 && (t$1.async = !!i), 1 & e$2 && (t$1.id = 4 & e$2 && this.type !== M.name ? null : this.parseIdent());
|
|
1673
|
+
var a = this.yieldPos, n$3 = this.awaitPos, o$2 = this.awaitIdentPos, h = this.maybeInArrowParameters;
|
|
1674
|
+
this.maybeInArrowParameters = !1, this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(E(t$1.async, t$1.generator)), 1 & e$2 || (t$1.id = this.type === M.name ? this.parseIdent() : null), this.parseFunctionParams(t$1);
|
|
1675
|
+
var p$1 = 1 & e$2;
|
|
1676
|
+
return this.parseFunctionBody(t$1, s$1, !1, r$1, { isFunctionDeclaration: p$1 }), this.yieldPos = a, this.awaitPos = n$3, this.awaitIdentPos = o$2, 1 & e$2 && t$1.id && !(2 & e$2) && this.checkLValSimple(t$1.id, t$1.body ? this.strict || t$1.generator || t$1.async ? this.treatFunctionsAsVar ? 1 : 2 : 3 : 0), this.maybeInArrowParameters = h, this.finishNode(t$1, p$1 ? "FunctionDeclaration" : "FunctionExpression");
|
|
1677
|
+
}, p.parseFunctionBody = function(e$2, s$1, i, r$1, a) {
|
|
1678
|
+
void 0 === s$1 && (s$1 = !1), void 0 === i && (i = !1), void 0 === r$1 && (r$1 = !1), this.match(M.colon) && (e$2.returnType = this.tsParseTypeOrTypePredicateAnnotation(M.colon));
|
|
1679
|
+
var n$3 = null != a && a.isFunctionDeclaration ? "TSDeclareFunction" : null != a && a.isClassMethod ? "TSDeclareMethod" : void 0;
|
|
1680
|
+
return n$3 && !this.match(M.braceL) && this.isLineTerminator() ? this.finishNode(e$2, n$3) : "TSDeclareFunction" === n$3 && this.isAmbientContext && (this.raise(e$2.start, T.DeclareFunctionHasImplementation), e$2.declare) ? (t.prototype.parseFunctionBody.call(this, e$2, s$1, i, !1), this.finishNode(e$2, n$3)) : (t.prototype.parseFunctionBody.call(this, e$2, s$1, i, r$1), e$2);
|
|
1681
|
+
}, p.parseNew = function() {
|
|
1682
|
+
var t$1;
|
|
1683
|
+
this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
1684
|
+
var e$2 = this.startNode(), s$1 = this.parseIdent(!0);
|
|
1685
|
+
if (this.options.ecmaVersion >= 6 && this.eat(M.dot)) {
|
|
1686
|
+
e$2.meta = s$1;
|
|
1687
|
+
var i = this.containsEsc;
|
|
1688
|
+
return e$2.property = this.parseIdent(!0), "target" !== e$2.property.name && this.raiseRecoverable(e$2.property.start, "The only valid meta property for new is 'new.target'"), i && this.raiseRecoverable(e$2.start, "'new.target' must not contain escaped characters"), this.allowNewDotTarget || this.raiseRecoverable(e$2.start, "'new.target' can only be used in functions and class static block"), this.finishNode(e$2, "MetaProperty");
|
|
1689
|
+
}
|
|
1690
|
+
var r$1 = this.start, a = this.startLoc, n$3 = this.type === M._import;
|
|
1691
|
+
e$2.callee = this.parseSubscripts(this.parseExprAtom(), r$1, a, !0, !1), n$3 && "ImportExpression" === e$2.callee.type && this.raise(r$1, "Cannot use new with import()");
|
|
1692
|
+
var o$2 = e$2.callee;
|
|
1693
|
+
return "TSInstantiationExpression" !== o$2.type || null != (t$1 = o$2.extra) && t$1.parenthesized || (e$2.typeParameters = o$2.typeParameters, e$2.callee = o$2.expression), e$2.arguments = this.eat(M.parenL) ? this.parseExprList(M.parenR, this.options.ecmaVersion >= 8, !1) : [], this.finishNode(e$2, "NewExpression");
|
|
1694
|
+
}, p.parseExprOp = function(e$2, s$1, i, r$1, a) {
|
|
1695
|
+
var n$3;
|
|
1696
|
+
if (M._in.binop > r$1 && !this.hasPrecedingLineBreak() && (this.isContextual("as") && (n$3 = "TSAsExpression"), L && this.isContextual("satisfies") && (n$3 = "TSSatisfiesExpression"), n$3)) {
|
|
1697
|
+
var o$2 = this.startNodeAt(s$1, i);
|
|
1698
|
+
o$2.expression = e$2;
|
|
1699
|
+
return o$2.typeAnnotation = this.tsTryNextParseConstantContext() || this.tsNextThenParseType(), this.finishNode(o$2, n$3), this.reScan_lt_gt(), this.parseExprOp(o$2, s$1, i, r$1, a);
|
|
1700
|
+
}
|
|
1701
|
+
return t.prototype.parseExprOp.call(this, e$2, s$1, i, r$1, a);
|
|
1702
|
+
}, p.parseImportSpecifiers = function() {
|
|
1703
|
+
var t$1 = [], e$2 = !0;
|
|
1704
|
+
if (N$1.tokenIsIdentifier(this.type) && (t$1.push(this.parseImportDefaultSpecifier()), !this.eat(M.comma))) return t$1;
|
|
1705
|
+
if (this.type === M.star) return t$1.push(this.parseImportNamespaceSpecifier()), t$1;
|
|
1706
|
+
for (this.expect(M.braceL); !this.eat(M.braceR);) {
|
|
1707
|
+
if (e$2) e$2 = !1;
|
|
1708
|
+
else if (this.expect(M.comma), this.afterTrailingComma(M.braceR)) break;
|
|
1709
|
+
t$1.push(this.parseImportSpecifier());
|
|
1710
|
+
}
|
|
1711
|
+
return t$1;
|
|
1712
|
+
}, p.parseImport = function(t$1) {
|
|
1713
|
+
var e$2 = this.lookahead();
|
|
1714
|
+
if (t$1.importKind = "value", this.importOrExportOuterKind = "value", z(e$2.type) || this.match(M.star) || this.match(M.braceL)) {
|
|
1715
|
+
var s$1 = this.lookahead(2);
|
|
1716
|
+
if (s$1.type !== M.comma && !this.isContextualWithState("from", s$1) && s$1.type !== M.eq && this.ts_eatContextualWithState("type", 1, e$2) && (this.importOrExportOuterKind = "type", t$1.importKind = "type", e$2 = this.lookahead(), s$1 = this.lookahead(2)), z(e$2.type) && s$1.type === M.eq) {
|
|
1717
|
+
this.next();
|
|
1718
|
+
var i = this.tsParseImportEqualsDeclaration(t$1);
|
|
1719
|
+
return this.importOrExportOuterKind = "value", i;
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
return this.next(), this.type === M.string ? (t$1.specifiers = [], t$1.source = this.parseExprAtom()) : (t$1.specifiers = this.parseImportSpecifiers(), this.expectContextual("from"), t$1.source = this.type === M.string ? this.parseExprAtom() : this.unexpected()), this.parseMaybeImportAttributes(t$1), this.semicolon(), this.finishNode(t$1, "ImportDeclaration"), this.importOrExportOuterKind = "value", "type" === t$1.importKind && t$1.specifiers.length > 1 && "ImportDefaultSpecifier" === t$1.specifiers[0].type && this.raise(t$1.start, T.TypeImportCannotSpecifyDefaultAndNamed), t$1;
|
|
1723
|
+
}, p.parseExportDefaultDeclaration = function() {
|
|
1724
|
+
if (this.isAbstractClass()) {
|
|
1725
|
+
var e$2 = this.startNode();
|
|
1726
|
+
return this.next(), e$2.abstract = !0, this.parseClass(e$2, !0);
|
|
1727
|
+
}
|
|
1728
|
+
if (this.match(B.interface)) {
|
|
1729
|
+
var s$1 = this.tsParseInterfaceDeclaration(this.startNode());
|
|
1730
|
+
if (s$1) return s$1;
|
|
1731
|
+
}
|
|
1732
|
+
return t.prototype.parseExportDefaultDeclaration.call(this);
|
|
1733
|
+
}, p.parseExportAllDeclaration = function(t$1, e$2) {
|
|
1734
|
+
return this.options.ecmaVersion >= 11 && (this.eatContextual("as") ? (t$1.exported = this.parseModuleExportName(), this.checkExport(e$2, t$1.exported, this.lastTokStart)) : t$1.exported = null), this.expectContextual("from"), this.type !== M.string && this.unexpected(), t$1.source = this.parseExprAtom(), this.parseMaybeImportAttributes(t$1), this.semicolon(), this.finishNode(t$1, "ExportAllDeclaration");
|
|
1735
|
+
}, p.parseDynamicImport = function(t$1) {
|
|
1736
|
+
if (this.next(), t$1.source = this.parseMaybeAssign(), this.eat(M.comma)) t$1.arguments = [this.parseExpression()];
|
|
1737
|
+
if (!this.eat(M.parenR)) {
|
|
1738
|
+
var s$1 = this.start;
|
|
1739
|
+
this.eat(M.comma) && this.eat(M.parenR) ? this.raiseRecoverable(s$1, "Trailing comma is not allowed in import()") : this.unexpected(s$1);
|
|
1740
|
+
}
|
|
1741
|
+
return this.finishNode(t$1, "ImportExpression");
|
|
1742
|
+
}, p.parseExport = function(t$1, e$2) {
|
|
1743
|
+
var s$1 = this.lookahead();
|
|
1744
|
+
if (this.ts_eatWithState(M._import, 2, s$1)) {
|
|
1745
|
+
this.ts_isContextual(B.type) && 61 !== this.lookaheadCharCode() ? (t$1.importKind = "type", this.importOrExportOuterKind = "type", this.next()) : (t$1.importKind = "value", this.importOrExportOuterKind = "value");
|
|
1746
|
+
var i = this.tsParseImportEqualsDeclaration(t$1, !0);
|
|
1747
|
+
return this.importOrExportOuterKind = void 0, i;
|
|
1748
|
+
}
|
|
1749
|
+
if (this.ts_eatWithState(M.eq, 2, s$1)) {
|
|
1750
|
+
var r$1 = t$1;
|
|
1751
|
+
return r$1.expression = this.parseExpression(), this.semicolon(), this.importOrExportOuterKind = void 0, this.finishNode(r$1, "TSExportAssignment");
|
|
1752
|
+
}
|
|
1753
|
+
if (this.ts_eatContextualWithState("as", 2, s$1)) {
|
|
1754
|
+
var a = t$1;
|
|
1755
|
+
return this.expectContextual("namespace"), a.id = this.parseIdent(), this.semicolon(), this.importOrExportOuterKind = void 0, this.finishNode(a, "TSNamespaceExportDeclaration");
|
|
1756
|
+
}
|
|
1757
|
+
if (this.ts_isContextualWithState(s$1, B.type) && this.lookahead(2).type === M.braceL ? (this.next(), this.importOrExportOuterKind = "type", t$1.exportKind = "type") : (this.importOrExportOuterKind = "value", t$1.exportKind = "value"), this.next(), this.eat(M.star)) return this.parseExportAllDeclaration(t$1, e$2);
|
|
1758
|
+
if (this.eat(M._default)) return this.checkExport(e$2, "default", this.lastTokStart), t$1.declaration = this.parseExportDefaultDeclaration(), this.finishNode(t$1, "ExportDefaultDeclaration");
|
|
1759
|
+
if (this.shouldParseExportStatement()) t$1.declaration = this.parseExportDeclaration(t$1), "VariableDeclaration" === t$1.declaration.type ? this.checkVariableExport(e$2, t$1.declaration.declarations) : this.checkExport(e$2, t$1.declaration.id, t$1.declaration.id.start), t$1.specifiers = [], t$1.source = null;
|
|
1760
|
+
else {
|
|
1761
|
+
if (t$1.declaration = null, t$1.specifiers = this.parseExportSpecifiers(e$2), this.eatContextual("from")) this.type !== M.string && this.unexpected(), t$1.source = this.parseExprAtom(), this.parseMaybeImportAttributes(t$1);
|
|
1762
|
+
else {
|
|
1763
|
+
for (var n$3, o$2 = h(t$1.specifiers); !(n$3 = o$2()).done;) {
|
|
1764
|
+
var p$1 = n$3.value;
|
|
1765
|
+
this.checkUnreserved(p$1.local), this.checkLocalExport(p$1.local), "Literal" === p$1.local.type && this.raise(p$1.local.start, "A string literal cannot be used as an exported binding without `from`.");
|
|
1766
|
+
}
|
|
1767
|
+
t$1.source = null;
|
|
1768
|
+
}
|
|
1769
|
+
this.semicolon();
|
|
1770
|
+
}
|
|
1771
|
+
return this.finishNode(t$1, "ExportNamedDeclaration");
|
|
1772
|
+
}, p.checkExport = function(t$1, e$2, s$1) {
|
|
1773
|
+
t$1 && ("string" != typeof e$2 && (e$2 = "Identifier" === e$2.type ? e$2.name : e$2.value), t$1[e$2] = !0);
|
|
1774
|
+
}, p.parseMaybeDefault = function(e$2, s$1, i) {
|
|
1775
|
+
var r$1 = t.prototype.parseMaybeDefault.call(this, e$2, s$1, i);
|
|
1776
|
+
return "AssignmentPattern" === r$1.type && r$1.typeAnnotation && r$1.right.start < r$1.typeAnnotation.start && this.raise(r$1.typeAnnotation.start, T.TypeAnnotationAfterAssign), r$1;
|
|
1777
|
+
}, p.typeCastToParameter = function(t$1) {
|
|
1778
|
+
return t$1.expression.typeAnnotation = t$1.typeAnnotation, this.resetEndLocation(t$1.expression, t$1.typeAnnotation.end), t$1.expression;
|
|
1779
|
+
}, p.toAssignableList = function(e$2, s$1) {
|
|
1780
|
+
for (var i = 0; i < e$2.length; i++) {
|
|
1781
|
+
var r$1 = e$2[i];
|
|
1782
|
+
"TSTypeCastExpression" === (null == r$1 ? void 0 : r$1.type) && (e$2[i] = this.typeCastToParameter(r$1));
|
|
1783
|
+
}
|
|
1784
|
+
return t.prototype.toAssignableList.call(this, e$2, s$1);
|
|
1785
|
+
}, p.reportReservedArrowTypeParam = function(t$1) {}, p.parseExprAtom = function(e$2, s$1, i) {
|
|
1786
|
+
if (this.type === B.jsxText) return this.jsx_parseText();
|
|
1787
|
+
if (this.type === B.jsxTagStart) return this.jsx_parseElement();
|
|
1788
|
+
if (this.type === B.at) return this.parseDecorators(), this.parseExprAtom();
|
|
1789
|
+
if (z(this.type)) {
|
|
1790
|
+
var r$1 = this.potentialArrowAt === this.start, a = this.start, n$3 = this.startLoc, o$2 = this.containsEsc, h = this.parseIdent(!1);
|
|
1791
|
+
if (this.options.ecmaVersion >= 8 && !o$2 && "async" === h.name && !this.canInsertSemicolon() && this.eat(M._function)) return this.overrideContext(j.f_expr), this.parseFunction(this.startNodeAt(a, n$3), 0, !1, !0, s$1);
|
|
1792
|
+
if (r$1 && !this.canInsertSemicolon()) {
|
|
1793
|
+
if (this.eat(M.arrow)) return this.parseArrowExpression(this.startNodeAt(a, n$3), [h], !1, s$1);
|
|
1794
|
+
if (this.options.ecmaVersion >= 8 && "async" === h.name && this.type === M.name && !o$2 && (!this.potentialArrowInForAwait || "of" !== this.value || this.containsEsc)) return h = this.parseIdent(!1), !this.canInsertSemicolon() && this.eat(M.arrow) || this.unexpected(), this.parseArrowExpression(this.startNodeAt(a, n$3), [h], !0, s$1);
|
|
1795
|
+
}
|
|
1796
|
+
return h;
|
|
1797
|
+
}
|
|
1798
|
+
return t.prototype.parseExprAtom.call(this, e$2, s$1, i);
|
|
1799
|
+
}, p.parseExprAtomDefault = function() {
|
|
1800
|
+
if (z(this.type)) {
|
|
1801
|
+
var t$1 = this.potentialArrowAt === this.start, e$2 = this.containsEsc, s$1 = this.parseIdent();
|
|
1802
|
+
if (!e$2 && "async" === s$1.name && !this.canInsertSemicolon()) {
|
|
1803
|
+
var i = this.type;
|
|
1804
|
+
if (i === M._function) return this.next(), this.parseFunction(this.startNodeAtNode(s$1), void 0, !0, !0);
|
|
1805
|
+
if (z(i)) {
|
|
1806
|
+
if (61 === this.lookaheadCharCode()) {
|
|
1807
|
+
var r$1 = this.parseIdent(!1);
|
|
1808
|
+
return !this.canInsertSemicolon() && this.eat(M.arrow) || this.unexpected(), this.parseArrowExpression(this.startNodeAtNode(s$1), [r$1], !0);
|
|
1809
|
+
}
|
|
1810
|
+
return s$1;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
return t$1 && this.match(M.arrow) && !this.canInsertSemicolon() ? (this.next(), this.parseArrowExpression(this.startNodeAtNode(s$1), [s$1], !1)) : s$1;
|
|
1814
|
+
}
|
|
1815
|
+
this.unexpected();
|
|
1816
|
+
}, p.parseIdentNode = function() {
|
|
1817
|
+
var e$2 = this.startNode();
|
|
1818
|
+
return J(this.type) ? (e$2.name = this.value, e$2) : t.prototype.parseIdentNode.call(this);
|
|
1819
|
+
}, p.parseVarStatement = function(e$2, s$1, i) {
|
|
1820
|
+
void 0 === i && (i = !1);
|
|
1821
|
+
var r$1 = this.isAmbientContext;
|
|
1822
|
+
this.next(), t.prototype.parseVar.call(this, e$2, !1, s$1, i || r$1), this.semicolon();
|
|
1823
|
+
var a = this.finishNode(e$2, "VariableDeclaration");
|
|
1824
|
+
if (!r$1) return a;
|
|
1825
|
+
for (var n$3, o$2 = h(a.declarations); !(n$3 = o$2()).done;) {
|
|
1826
|
+
var p$1 = n$3.value, c = p$1.init;
|
|
1827
|
+
c && ("const" !== s$1 || p$1.id.typeAnnotation ? this.raise(c.start, T.InitializerNotAllowedInAmbientContext) : "StringLiteral" !== c.type && "BooleanLiteral" !== c.type && "NumericLiteral" !== c.type && "BigIntLiteral" !== c.type && ("TemplateLiteral" !== c.type || c.expressions.length > 0) && !I(c) && this.raise(c.start, T.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference));
|
|
1828
|
+
}
|
|
1829
|
+
return a;
|
|
1830
|
+
}, p.parseStatement = function(e$2, s$1, i) {
|
|
1831
|
+
if (this.match(B.at) && this.parseDecorators(!0), this.match(M._const) && this.isLookaheadContextual("enum")) {
|
|
1832
|
+
var r$1 = this.startNode();
|
|
1833
|
+
return this.expect(M._const), this.tsParseEnumDeclaration(r$1, { const: !0 });
|
|
1834
|
+
}
|
|
1835
|
+
if (this.ts_isContextual(B.enum)) return this.tsParseEnumDeclaration(this.startNode());
|
|
1836
|
+
if (this.ts_isContextual(B.interface)) {
|
|
1837
|
+
var a = this.tsParseInterfaceDeclaration(this.startNode());
|
|
1838
|
+
if (a) return a;
|
|
1839
|
+
}
|
|
1840
|
+
return t.prototype.parseStatement.call(this, e$2, s$1, i);
|
|
1841
|
+
}, p.parseAccessModifier = function() {
|
|
1842
|
+
return this.tsParseModifier([
|
|
1843
|
+
"public",
|
|
1844
|
+
"protected",
|
|
1845
|
+
"private"
|
|
1846
|
+
]);
|
|
1847
|
+
}, p.parsePostMemberNameModifiers = function(t$1) {
|
|
1848
|
+
this.eat(M.question) && (t$1.optional = !0), t$1.readonly && this.match(M.parenL) && this.raise(t$1.start, T.ClassMethodHasReadonly), t$1.declare && this.match(M.parenL) && this.raise(t$1.start, T.ClassMethodHasDeclare);
|
|
1849
|
+
}, p.parseExpressionStatement = function(e$2, s$1) {
|
|
1850
|
+
return ("Identifier" === s$1.type ? this.tsParseExpressionStatement(e$2, s$1) : void 0) || t.prototype.parseExpressionStatement.call(this, e$2, s$1);
|
|
1851
|
+
}, p.shouldParseExportStatement = function() {
|
|
1852
|
+
return !!this.tsIsDeclarationStart() || !!this.match(B.at) || t.prototype.shouldParseExportStatement.call(this);
|
|
1853
|
+
}, p.parseConditional = function(t$1, e$2, s$1, i, r$1) {
|
|
1854
|
+
if (this.eat(M.question)) {
|
|
1855
|
+
var a = this.startNodeAt(e$2, s$1);
|
|
1856
|
+
return a.test = t$1, a.consequent = this.parseMaybeAssign(), this.expect(M.colon), a.alternate = this.parseMaybeAssign(i), this.finishNode(a, "ConditionalExpression");
|
|
1857
|
+
}
|
|
1858
|
+
return t$1;
|
|
1859
|
+
}, p.parseMaybeConditional = function(t$1, e$2) {
|
|
1860
|
+
var s$1 = this, i = this.start, r$1 = this.startLoc, a = this.parseExprOps(t$1, e$2);
|
|
1861
|
+
if (this.checkExpressionErrors(e$2)) return a;
|
|
1862
|
+
if (!this.maybeInArrowParameters || !this.match(M.question)) return this.parseConditional(a, i, r$1, t$1, e$2);
|
|
1863
|
+
var n$3 = this.tryParse(function() {
|
|
1864
|
+
return s$1.parseConditional(a, i, r$1, t$1, e$2);
|
|
1865
|
+
});
|
|
1866
|
+
return n$3.node ? (n$3.error && this.setLookaheadState(n$3.failState), n$3.node) : (n$3.error && this.setOptionalParametersError(e$2, n$3.error), a);
|
|
1867
|
+
}, p.parseParenItem = function(e$2) {
|
|
1868
|
+
var s$1 = this.start, i = this.startLoc;
|
|
1869
|
+
if (e$2 = t.prototype.parseParenItem.call(this, e$2), this.eat(M.question) && (e$2.optional = !0, this.resetEndLocation(e$2)), this.match(M.colon)) {
|
|
1870
|
+
var r$1 = this.startNodeAt(s$1, i);
|
|
1871
|
+
return r$1.expression = e$2, r$1.typeAnnotation = this.tsParseTypeAnnotation(), this.finishNode(r$1, "TSTypeCastExpression");
|
|
1872
|
+
}
|
|
1873
|
+
return e$2;
|
|
1874
|
+
}, p.parseExportDeclaration = function(t$1) {
|
|
1875
|
+
var e$2 = this;
|
|
1876
|
+
if (!this.isAmbientContext && this.ts_isContextual(B.declare)) return this.tsInAmbientContext(function() {
|
|
1877
|
+
return e$2.parseExportDeclaration(t$1);
|
|
1878
|
+
});
|
|
1879
|
+
var s$1 = this.start, i = this.startLoc, r$1 = this.eatContextual("declare");
|
|
1880
|
+
!r$1 || !this.ts_isContextual(B.declare) && this.shouldParseExportStatement() || this.raise(this.start, T.ExpectedAmbientAfterExportDeclare);
|
|
1881
|
+
var a = z(this.type) && this.tsTryParseExportDeclaration() || this.parseStatement(null);
|
|
1882
|
+
return a ? (("TSInterfaceDeclaration" === a.type || "TSTypeAliasDeclaration" === a.type || r$1) && (t$1.exportKind = "type"), r$1 && (this.resetStartLocation(a, s$1, i), a.declare = !0), a) : null;
|
|
1883
|
+
}, p.parseClassId = function(e$2, s$1) {
|
|
1884
|
+
if (s$1 || !this.isContextual("implements")) {
|
|
1885
|
+
t.prototype.parseClassId.call(this, e$2, s$1);
|
|
1886
|
+
var i = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));
|
|
1887
|
+
i && (e$2.typeParameters = i);
|
|
1888
|
+
}
|
|
1889
|
+
}, p.parseClassPropertyAnnotation = function(t$1) {
|
|
1890
|
+
t$1.optional || ("!" === this.value && this.eat(M.prefix) ? t$1.definite = !0 : this.eat(M.question) && (t$1.optional = !0));
|
|
1891
|
+
var e$2 = this.tsTryParseTypeAnnotation();
|
|
1892
|
+
e$2 && (t$1.typeAnnotation = e$2);
|
|
1893
|
+
}, p.parseClassField = function(e$2) {
|
|
1894
|
+
if ("PrivateIdentifier" === e$2.key.type) e$2.abstract && this.raise(e$2.start, T.PrivateElementHasAbstract), e$2.accessibility && this.raise(e$2.start, T.PrivateElementHasAccessibility({ modifier: e$2.accessibility })), this.parseClassPropertyAnnotation(e$2);
|
|
1895
|
+
else if (this.parseClassPropertyAnnotation(e$2), this.isAmbientContext && (!e$2.readonly || e$2.typeAnnotation) && this.match(M.eq) && this.raise(this.start, T.DeclareClassFieldHasInitializer), e$2.abstract && this.match(M.eq)) {
|
|
1896
|
+
var s$1 = e$2.key;
|
|
1897
|
+
this.raise(this.start, T.AbstractPropertyHasInitializer({ propertyName: "Identifier" !== s$1.type || e$2.computed ? "[" + this.input.slice(s$1.start, s$1.end) + "]" : s$1.name }));
|
|
1898
|
+
}
|
|
1899
|
+
return t.prototype.parseClassField.call(this, e$2);
|
|
1900
|
+
}, p.parseClassMethod = function(t$1, e$2, s$1, i) {
|
|
1901
|
+
var r$1 = "constructor" === t$1.kind, a = "PrivateIdentifier" === t$1.key.type, n$3 = this.tsTryParseTypeParameters();
|
|
1902
|
+
a ? (n$3 && (t$1.typeParameters = n$3), t$1.accessibility && this.raise(t$1.start, T.PrivateMethodsHasAccessibility({ modifier: t$1.accessibility }))) : n$3 && r$1 && this.raise(n$3.start, T.ConstructorHasTypeParameters);
|
|
1903
|
+
var o$2 = t$1.declare, h = t$1.kind;
|
|
1904
|
+
!(void 0 !== o$2 && o$2) || "get" !== h && "set" !== h || this.raise(t$1.start, T.DeclareAccessor({ kind: h })), n$3 && (t$1.typeParameters = n$3);
|
|
1905
|
+
var p$1 = t$1.key;
|
|
1906
|
+
"constructor" === t$1.kind ? (e$2 && this.raise(p$1.start, "Constructor can't be a generator"), s$1 && this.raise(p$1.start, "Constructor can't be an async method")) : t$1.static && x(t$1, "prototype") && this.raise(p$1.start, "Classes may not have a static property named prototype");
|
|
1907
|
+
var c = t$1.value = this.parseMethod(e$2, s$1, i, !0, t$1);
|
|
1908
|
+
return "get" === t$1.kind && 0 !== c.params.length && this.raiseRecoverable(c.start, "getter should have no params"), "set" === t$1.kind && 1 !== c.params.length && this.raiseRecoverable(c.start, "setter should have exactly one param"), "set" === t$1.kind && "RestElement" === c.params[0].type && this.raiseRecoverable(c.params[0].start, "Setter cannot use rest params"), this.finishNode(t$1, "MethodDefinition");
|
|
1909
|
+
}, p.isClassMethod = function() {
|
|
1910
|
+
return this.match(M.relational);
|
|
1911
|
+
}, p.parseClassElement = function(e$2) {
|
|
1912
|
+
var s$1 = this;
|
|
1913
|
+
if (this.eat(M.semi)) return null;
|
|
1914
|
+
var i, r$1 = this.options.ecmaVersion, a = this.startNode(), n$3 = "", o$2 = !1, h = !1, p$1 = "method", c = [
|
|
1915
|
+
"declare",
|
|
1916
|
+
"private",
|
|
1917
|
+
"public",
|
|
1918
|
+
"protected",
|
|
1919
|
+
"accessor",
|
|
1920
|
+
"override",
|
|
1921
|
+
"abstract",
|
|
1922
|
+
"readonly",
|
|
1923
|
+
"static"
|
|
1924
|
+
], l = this.tsParseModifiers({
|
|
1925
|
+
modified: a,
|
|
1926
|
+
allowedModifiers: c,
|
|
1927
|
+
disallowedModifiers: ["in", "out"],
|
|
1928
|
+
stopOnStartOfClassStaticBlock: !0,
|
|
1929
|
+
errorTemplate: T.InvalidModifierOnTypeParameterPositions
|
|
1930
|
+
});
|
|
1931
|
+
i = Boolean(l.static);
|
|
1932
|
+
var u = function() {
|
|
1933
|
+
if (!s$1.tsIsStartOfStaticBlocks()) {
|
|
1934
|
+
var l$1 = s$1.tsTryParseIndexSignature(a);
|
|
1935
|
+
if (l$1) return a.abstract && s$1.raise(a.start, T.IndexSignatureHasAbstract), a.accessibility && s$1.raise(a.start, T.IndexSignatureHasAccessibility({ modifier: a.accessibility })), a.declare && s$1.raise(a.start, T.IndexSignatureHasDeclare), a.override && s$1.raise(a.start, T.IndexSignatureHasOverride), l$1;
|
|
1936
|
+
if (!s$1.inAbstractClass && a.abstract && s$1.raise(a.start, T.NonAbstractClassHasAbstractMethod), a.override && e$2 && s$1.raise(a.start, T.OverrideNotInSubClass), a.static = i, i && (s$1.isClassElementNameStart() || s$1.type === M.star || (n$3 = "static")), !n$3 && r$1 >= 8 && s$1.eatContextual("async") && (!s$1.isClassElementNameStart() && s$1.type !== M.star || s$1.canInsertSemicolon() ? n$3 = "async" : h = !0), !n$3 && (r$1 >= 9 || !h) && s$1.eat(M.star) && (o$2 = !0), !n$3 && !h && !o$2) {
|
|
1937
|
+
var u$1 = s$1.value;
|
|
1938
|
+
(s$1.eatContextual("get") || s$1.eatContextual("set")) && (s$1.isClassElementNameStart() ? p$1 = u$1 : n$3 = u$1);
|
|
1939
|
+
}
|
|
1940
|
+
if (n$3 ? (a.computed = !1, a.key = s$1.startNodeAt(s$1.lastTokStart, s$1.lastTokStartLoc), a.key.name = n$3, s$1.finishNode(a.key, "Identifier")) : s$1.parseClassElementName(a), s$1.parsePostMemberNameModifiers(a), s$1.isClassMethod() || r$1 < 13 || s$1.type === M.parenL || "method" !== p$1 || o$2 || h) {
|
|
1941
|
+
var d$1 = !a.static && x(a, "constructor"), m = d$1 && e$2;
|
|
1942
|
+
d$1 && "method" !== p$1 && s$1.raise(a.key.start, "Constructor can't have get/set modifier"), a.kind = d$1 ? "constructor" : p$1, s$1.parseClassMethod(a, o$2, h, m);
|
|
1943
|
+
} else s$1.parseClassField(a);
|
|
1944
|
+
return a;
|
|
1945
|
+
}
|
|
1946
|
+
if (s$1.next(), s$1.next(), s$1.tsHasSomeModifiers(a, c) && s$1.raise(s$1.start, T.StaticBlockCannotHaveModifier), r$1 >= 13) return t.prototype.parseClassStaticBlock.call(s$1, a), a;
|
|
1947
|
+
};
|
|
1948
|
+
return a.declare ? this.tsInAmbientContext(u) : u(), a;
|
|
1949
|
+
}, p.isClassElementNameStart = function() {
|
|
1950
|
+
return !!this.tsIsIdentifier() || t.prototype.isClassElementNameStart.call(this);
|
|
1951
|
+
}, p.parseClassSuper = function(e$2) {
|
|
1952
|
+
t.prototype.parseClassSuper.call(this, e$2), e$2.superClass && (this.tsMatchLeftRelational() || this.match(M.bitShift)) && (e$2.superTypeParameters = this.tsParseTypeArgumentsInExpression()), this.eatContextual("implements") && (e$2.implements = this.tsParseHeritageClause("implements"));
|
|
1953
|
+
}, p.parseFunctionParams = function(e$2) {
|
|
1954
|
+
var s$1 = this.tsTryParseTypeParameters();
|
|
1955
|
+
s$1 && (e$2.typeParameters = s$1), t.prototype.parseFunctionParams.call(this, e$2);
|
|
1956
|
+
}, p.parseVarId = function(e$2, s$1) {
|
|
1957
|
+
t.prototype.parseVarId.call(this, e$2, s$1), "Identifier" === e$2.id.type && !this.hasPrecedingLineBreak() && "!" === this.value && this.eat(M.prefix) && (e$2.definite = !0);
|
|
1958
|
+
var i = this.tsTryParseTypeAnnotation();
|
|
1959
|
+
i && (e$2.id.typeAnnotation = i, this.resetEndLocation(e$2.id));
|
|
1960
|
+
}, p.parseArrowExpression = function(t$1, e$2, s$1, i) {
|
|
1961
|
+
this.match(M.colon) && (t$1.returnType = this.tsParseTypeAnnotation());
|
|
1962
|
+
var r$1 = this.yieldPos, a = this.awaitPos, n$3 = this.awaitIdentPos;
|
|
1963
|
+
this.enterScope(16 | E(s$1, !1)), this.initFunction(t$1);
|
|
1964
|
+
var o$2 = this.maybeInArrowParameters;
|
|
1965
|
+
return this.options.ecmaVersion >= 8 && (t$1.async = !!s$1), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.maybeInArrowParameters = !0, t$1.params = this.toAssignableList(e$2, !0), this.maybeInArrowParameters = !1, this.parseFunctionBody(t$1, !0, !1, i), this.yieldPos = r$1, this.awaitPos = a, this.awaitIdentPos = n$3, this.maybeInArrowParameters = o$2, this.finishNode(t$1, "ArrowFunctionExpression");
|
|
1966
|
+
}, p.parseMaybeAssignOrigin = function(t$1, e$2, s$1) {
|
|
1967
|
+
if (this.isContextual("yield")) {
|
|
1968
|
+
if (this.inGenerator) return this.parseYield(t$1);
|
|
1969
|
+
this.exprAllowed = !1;
|
|
1970
|
+
}
|
|
1971
|
+
var i = !1, r$1 = -1, a = -1, n$3 = -1;
|
|
1972
|
+
e$2 ? (r$1 = e$2.parenthesizedAssign, a = e$2.trailingComma, n$3 = e$2.doubleProto, e$2.parenthesizedAssign = e$2.trailingComma = -1) : (e$2 = new y(), i = !0);
|
|
1973
|
+
var o$2 = this.start, h = this.startLoc;
|
|
1974
|
+
(this.type === M.parenL || z(this.type)) && (this.potentialArrowAt = this.start, this.potentialArrowInForAwait = "await" === t$1);
|
|
1975
|
+
var p$1 = this.parseMaybeConditional(t$1, e$2);
|
|
1976
|
+
if (s$1 && (p$1 = s$1.call(this, p$1, o$2, h)), this.type.isAssign) {
|
|
1977
|
+
var c = this.startNodeAt(o$2, h);
|
|
1978
|
+
return c.operator = this.value, this.type === M.eq && (p$1 = this.toAssignable(p$1, !0, e$2)), i || (e$2.parenthesizedAssign = e$2.trailingComma = e$2.doubleProto = -1), e$2.shorthandAssign >= p$1.start && (e$2.shorthandAssign = -1), this.type === M.eq ? this.checkLValPattern(p$1) : this.checkLValSimple(p$1), c.left = p$1, this.next(), c.right = this.parseMaybeAssign(t$1), n$3 > -1 && (e$2.doubleProto = n$3), this.finishNode(c, "AssignmentExpression");
|
|
1979
|
+
}
|
|
1980
|
+
return i && this.checkExpressionErrors(e$2, !0), r$1 > -1 && (e$2.parenthesizedAssign = r$1), a > -1 && (e$2.trailingComma = a), p$1;
|
|
1981
|
+
}, p.parseMaybeAssign = function(t$1, e$2, s$1) {
|
|
1982
|
+
var i, r$1, a, n$3, o$2, h, p$1, c, l, u, d$1, m = this;
|
|
1983
|
+
if (this.matchJsx("jsxTagStart") || this.tsMatchLeftRelational()) {
|
|
1984
|
+
if (c = this.cloneCurLookaheadState(), !(l = this.tryParse(function() {
|
|
1985
|
+
return m.parseMaybeAssignOrigin(t$1, e$2, s$1);
|
|
1986
|
+
}, c)).error) return l.node;
|
|
1987
|
+
var y = this.context, f = y[y.length - 1];
|
|
1988
|
+
f === N$1.tokContexts.tc_oTag && y[y.length - 2] === N$1.tokContexts.tc_expr ? (y.pop(), y.pop()) : f !== N$1.tokContexts.tc_oTag && f !== N$1.tokContexts.tc_expr || y.pop();
|
|
1989
|
+
}
|
|
1990
|
+
if (!(null != (i = l) && i.error || this.tsMatchLeftRelational())) return this.parseMaybeAssignOrigin(t$1, e$2, s$1);
|
|
1991
|
+
c && !this.compareLookaheadState(c, this.getCurLookaheadState()) || (c = this.cloneCurLookaheadState());
|
|
1992
|
+
var x = this.tryParse(function(i$1) {
|
|
1993
|
+
var r$2, a$1;
|
|
1994
|
+
d$1 = m.tsParseTypeParameters();
|
|
1995
|
+
var n$4 = m.parseMaybeAssignOrigin(t$1, e$2, s$1);
|
|
1996
|
+
return ("ArrowFunctionExpression" !== n$4.type || null != (r$2 = n$4.extra) && r$2.parenthesized) && i$1(), 0 !== (null == (a$1 = d$1) ? void 0 : a$1.params.length) && m.resetStartLocationFromNode(n$4, d$1), n$4.typeParameters = d$1, n$4;
|
|
1997
|
+
}, c);
|
|
1998
|
+
if (!x.error && !x.aborted) return d$1 && this.reportReservedArrowTypeParam(d$1), x.node;
|
|
1999
|
+
if (!l && (S(!0), !(u = this.tryParse(function() {
|
|
2000
|
+
return m.parseMaybeAssignOrigin(t$1, e$2, s$1);
|
|
2001
|
+
}, c)).error)) return u.node;
|
|
2002
|
+
if (null != (r$1 = l) && r$1.node) return this.setLookaheadState(l.failState), l.node;
|
|
2003
|
+
if (x.node) return this.setLookaheadState(x.failState), d$1 && this.reportReservedArrowTypeParam(d$1), x.node;
|
|
2004
|
+
if (null != (a = u) && a.node) return this.setLookaheadState(u.failState), u.node;
|
|
2005
|
+
if (null != (n$3 = l) && n$3.thrown) throw l.error;
|
|
2006
|
+
if (x.thrown) throw x.error;
|
|
2007
|
+
if (null != (o$2 = u) && o$2.thrown) throw u.error;
|
|
2008
|
+
throw (null == (h = l) ? void 0 : h.error) || x.error || (null == (p$1 = u) ? void 0 : p$1.error);
|
|
2009
|
+
}, p.parseAssignableListItem = function(t$1) {
|
|
2010
|
+
for (var e$2 = []; this.match(B.at);) e$2.push(this.parseDecorator());
|
|
2011
|
+
var s$1, i = this.start, r$1 = this.startLoc, a = !1, n$3 = !1;
|
|
2012
|
+
if (void 0 !== t$1) {
|
|
2013
|
+
var o$2 = {};
|
|
2014
|
+
this.tsParseModifiers({
|
|
2015
|
+
modified: o$2,
|
|
2016
|
+
allowedModifiers: [
|
|
2017
|
+
"public",
|
|
2018
|
+
"private",
|
|
2019
|
+
"protected",
|
|
2020
|
+
"override",
|
|
2021
|
+
"readonly"
|
|
2022
|
+
]
|
|
2023
|
+
}), s$1 = o$2.accessibility, n$3 = o$2.override, a = o$2.readonly, !1 === t$1 && (s$1 || a || n$3) && this.raise(r$1.start, T.UnexpectedParameterModifier);
|
|
2024
|
+
}
|
|
2025
|
+
var h = this.parseMaybeDefault(i, r$1);
|
|
2026
|
+
this.parseBindingListItem(h);
|
|
2027
|
+
var p$1 = this.parseMaybeDefault(h.start, h.loc, h);
|
|
2028
|
+
if (e$2.length && (p$1.decorators = e$2), s$1 || a || n$3) {
|
|
2029
|
+
var c = this.startNodeAt(i, r$1);
|
|
2030
|
+
return s$1 && (c.accessibility = s$1), a && (c.readonly = a), n$3 && (c.override = n$3), "Identifier" !== p$1.type && "AssignmentPattern" !== p$1.type && this.raise(c.start, T.UnsupportedParameterPropertyKind), c.parameter = p$1, this.finishNode(c, "TSParameterProperty");
|
|
2031
|
+
}
|
|
2032
|
+
return p$1;
|
|
2033
|
+
}, p.checkLValInnerPattern = function(e$2, s$1, i) {
|
|
2034
|
+
void 0 === s$1 && (s$1 = 0), "TSParameterProperty" === e$2.type ? this.checkLValInnerPattern(e$2.parameter, s$1, i) : t.prototype.checkLValInnerPattern.call(this, e$2, s$1, i);
|
|
2035
|
+
}, p.parseBindingListItem = function(t$1) {
|
|
2036
|
+
this.eat(M.question) && ("Identifier" === t$1.type || this.isAmbientContext || this.inType || this.raise(t$1.start, T.PatternIsOptional), t$1.optional = !0);
|
|
2037
|
+
var e$2 = this.tsTryParseTypeAnnotation();
|
|
2038
|
+
return e$2 && (t$1.typeAnnotation = e$2), this.resetEndLocation(t$1), t$1;
|
|
2039
|
+
}, p.isAssignable = function(t$1, e$2) {
|
|
2040
|
+
var s$1 = this;
|
|
2041
|
+
switch (t$1.type) {
|
|
2042
|
+
case "TSTypeCastExpression": return this.isAssignable(t$1.expression, e$2);
|
|
2043
|
+
case "TSParameterProperty":
|
|
2044
|
+
case "Identifier":
|
|
2045
|
+
case "ObjectPattern":
|
|
2046
|
+
case "ArrayPattern":
|
|
2047
|
+
case "AssignmentPattern":
|
|
2048
|
+
case "RestElement": return !0;
|
|
2049
|
+
case "ObjectExpression":
|
|
2050
|
+
var i = t$1.properties.length - 1;
|
|
2051
|
+
return t$1.properties.every(function(t$2, e$3) {
|
|
2052
|
+
return "ObjectMethod" !== t$2.type && (e$3 === i || "SpreadElement" !== t$2.type) && s$1.isAssignable(t$2);
|
|
2053
|
+
});
|
|
2054
|
+
case "Property":
|
|
2055
|
+
case "ObjectProperty": return this.isAssignable(t$1.value);
|
|
2056
|
+
case "SpreadElement": return this.isAssignable(t$1.argument);
|
|
2057
|
+
case "ArrayExpression": return t$1.elements.every(function(t$2) {
|
|
2058
|
+
return null === t$2 || s$1.isAssignable(t$2);
|
|
2059
|
+
});
|
|
2060
|
+
case "AssignmentExpression": return "=" === t$1.operator;
|
|
2061
|
+
case "ParenthesizedExpression": return this.isAssignable(t$1.expression);
|
|
2062
|
+
case "MemberExpression":
|
|
2063
|
+
case "OptionalMemberExpression": return !e$2;
|
|
2064
|
+
default: return !1;
|
|
2065
|
+
}
|
|
2066
|
+
}, p.toAssignable = function(e$2, s$1, i) {
|
|
2067
|
+
switch (void 0 === s$1 && (s$1 = !1), void 0 === i && (i = new y()), e$2.type) {
|
|
2068
|
+
case "ParenthesizedExpression": return this.toAssignableParenthesizedExpression(e$2, s$1, i);
|
|
2069
|
+
case "TSAsExpression":
|
|
2070
|
+
case "TSSatisfiesExpression":
|
|
2071
|
+
case "TSNonNullExpression":
|
|
2072
|
+
case "TSTypeAssertion": return s$1 || this.raise(e$2.start, T.UnexpectedTypeCastInParameter), this.toAssignable(e$2.expression, s$1, i);
|
|
2073
|
+
case "MemberExpression": break;
|
|
2074
|
+
case "AssignmentExpression": return s$1 || "TSTypeCastExpression" !== e$2.left.type || (e$2.left = this.typeCastToParameter(e$2.left)), t.prototype.toAssignable.call(this, e$2, s$1, i);
|
|
2075
|
+
case "TSTypeCastExpression": return this.typeCastToParameter(e$2);
|
|
2076
|
+
default: return t.prototype.toAssignable.call(this, e$2, s$1, i);
|
|
2077
|
+
}
|
|
2078
|
+
return e$2;
|
|
2079
|
+
}, p.toAssignableParenthesizedExpression = function(e$2, s$1, i) {
|
|
2080
|
+
switch (e$2.expression.type) {
|
|
2081
|
+
case "TSAsExpression":
|
|
2082
|
+
case "TSSatisfiesExpression":
|
|
2083
|
+
case "TSNonNullExpression":
|
|
2084
|
+
case "TSTypeAssertion":
|
|
2085
|
+
case "ParenthesizedExpression": return this.toAssignable(e$2.expression, s$1, i);
|
|
2086
|
+
default: return t.prototype.toAssignable.call(this, e$2, s$1, i);
|
|
2087
|
+
}
|
|
2088
|
+
}, p.curPosition = function() {
|
|
2089
|
+
if (this.options.locations) {
|
|
2090
|
+
var e$2 = t.prototype.curPosition.call(this);
|
|
2091
|
+
return Object.defineProperty(e$2, "offset", { get: function() {
|
|
2092
|
+
return function(t$1) {
|
|
2093
|
+
var e$3 = new o$1.Position(this.line, this.column + t$1);
|
|
2094
|
+
return e$3.index = this.index + t$1, e$3;
|
|
2095
|
+
};
|
|
2096
|
+
} }), e$2.index = this.pos, e$2;
|
|
2097
|
+
}
|
|
2098
|
+
}, p.parseBindingAtom = function() {
|
|
2099
|
+
return this.type === M._this ? this.parseIdent(!0) : t.prototype.parseBindingAtom.call(this);
|
|
2100
|
+
}, p.shouldParseArrow = function(t$1) {
|
|
2101
|
+
var e$2, s$1 = this;
|
|
2102
|
+
if (e$2 = this.match(M.colon) ? t$1.every(function(t$2) {
|
|
2103
|
+
return s$1.isAssignable(t$2, !0);
|
|
2104
|
+
}) : !this.canInsertSemicolon()) {
|
|
2105
|
+
if (this.match(M.colon)) {
|
|
2106
|
+
var i = this.tryParse(function(t$2) {
|
|
2107
|
+
var e$3 = s$1.tsParseTypeOrTypePredicateAnnotation(M.colon);
|
|
2108
|
+
return !s$1.canInsertSemicolon() && s$1.match(M.arrow) || t$2(), e$3;
|
|
2109
|
+
});
|
|
2110
|
+
if (i.aborted) return this.shouldParseArrowReturnType = void 0, !1;
|
|
2111
|
+
i.thrown || (i.error && this.setLookaheadState(i.failState), this.shouldParseArrowReturnType = i.node);
|
|
2112
|
+
}
|
|
2113
|
+
return !!this.match(M.arrow) || (this.shouldParseArrowReturnType = void 0, !1);
|
|
2114
|
+
}
|
|
2115
|
+
return this.shouldParseArrowReturnType = void 0, e$2;
|
|
2116
|
+
}, p.parseParenArrowList = function(t$1, e$2, s$1, i) {
|
|
2117
|
+
var r$1 = this.startNodeAt(t$1, e$2);
|
|
2118
|
+
return r$1.returnType = this.shouldParseArrowReturnType, this.shouldParseArrowReturnType = void 0, this.parseArrowExpression(r$1, s$1, !1, i);
|
|
2119
|
+
}, p.parseParenAndDistinguishExpression = function(t$1, e$2) {
|
|
2120
|
+
var s$1, i = this.start, r$1 = this.startLoc, a = this.options.ecmaVersion >= 8;
|
|
2121
|
+
if (this.options.ecmaVersion >= 6) {
|
|
2122
|
+
var n$3 = this.maybeInArrowParameters;
|
|
2123
|
+
this.maybeInArrowParameters = !0, this.next();
|
|
2124
|
+
var o$2, h = this.start, p$1 = this.startLoc, c = [], l = !0, u = !1, d$1 = new y(), m = this.yieldPos, f = this.awaitPos;
|
|
2125
|
+
for (this.yieldPos = 0, this.awaitPos = 0; this.type !== M.parenR;) {
|
|
2126
|
+
if (l ? l = !1 : this.expect(M.comma), a && this.afterTrailingComma(M.parenR, !0)) {
|
|
2127
|
+
u = !0;
|
|
2128
|
+
break;
|
|
2129
|
+
}
|
|
2130
|
+
if (this.type === M.ellipsis) {
|
|
2131
|
+
o$2 = this.start, c.push(this.parseParenItem(this.parseRestBinding())), this.type === M.comma && this.raise(this.start, "Comma is not permitted after the rest element");
|
|
2132
|
+
break;
|
|
2133
|
+
}
|
|
2134
|
+
c.push(this.parseMaybeAssign(e$2, d$1, this.parseParenItem));
|
|
2135
|
+
}
|
|
2136
|
+
var x = this.lastTokEnd, T = this.lastTokEndLoc;
|
|
2137
|
+
if (this.expect(M.parenR), this.maybeInArrowParameters = n$3, t$1 && this.shouldParseArrow(c) && this.eat(M.arrow)) return this.checkPatternErrors(d$1, !1), this.checkYieldAwaitInDefaultParams(), this.yieldPos = m, this.awaitPos = f, this.parseParenArrowList(i, r$1, c, e$2);
|
|
2138
|
+
c.length && !u || this.unexpected(this.lastTokStart), o$2 && this.unexpected(o$2), this.checkExpressionErrors(d$1, !0), this.yieldPos = m || this.yieldPos, this.awaitPos = f || this.awaitPos, c.length > 1 ? ((s$1 = this.startNodeAt(h, p$1)).expressions = c, this.finishNodeAt(s$1, "SequenceExpression", x, T)) : s$1 = c[0];
|
|
2139
|
+
} else s$1 = this.parseParenExpression();
|
|
2140
|
+
if (this.options.preserveParens) {
|
|
2141
|
+
var v = this.startNodeAt(i, r$1);
|
|
2142
|
+
return v.expression = s$1, this.finishNode(v, "ParenthesizedExpression");
|
|
2143
|
+
}
|
|
2144
|
+
return s$1;
|
|
2145
|
+
}, p.parseTaggedTemplateExpression = function(t$1, e$2, s$1, i) {
|
|
2146
|
+
var r$1 = this.startNodeAt(e$2, s$1);
|
|
2147
|
+
return r$1.tag = t$1, r$1.quasi = this.parseTemplate({ isTagged: !0 }), i && this.raise(e$2, "Tagged Template Literals are not allowed in optionalChain."), this.finishNode(r$1, "TaggedTemplateExpression");
|
|
2148
|
+
}, p.shouldParseAsyncArrow = function() {
|
|
2149
|
+
var t$1 = this;
|
|
2150
|
+
if (!this.match(M.colon)) return !this.canInsertSemicolon() && this.eat(M.arrow);
|
|
2151
|
+
var e$2 = this.tryParse(function(e$3) {
|
|
2152
|
+
var s$1 = t$1.tsParseTypeOrTypePredicateAnnotation(M.colon);
|
|
2153
|
+
return !t$1.canInsertSemicolon() && t$1.match(M.arrow) || e$3(), s$1;
|
|
2154
|
+
});
|
|
2155
|
+
return e$2.aborted ? (this.shouldParseAsyncArrowReturnType = void 0, !1) : e$2.thrown ? void 0 : (e$2.error && this.setLookaheadState(e$2.failState), this.shouldParseAsyncArrowReturnType = e$2.node, !this.canInsertSemicolon() && this.eat(M.arrow));
|
|
2156
|
+
}, p.parseSubscriptAsyncArrow = function(t$1, e$2, s$1, i) {
|
|
2157
|
+
var r$1 = this.startNodeAt(t$1, e$2);
|
|
2158
|
+
return r$1.returnType = this.shouldParseAsyncArrowReturnType, this.shouldParseAsyncArrowReturnType = void 0, this.parseArrowExpression(r$1, s$1, !0, i);
|
|
2159
|
+
}, p.parseExprList = function(t$1, e$2, s$1, i) {
|
|
2160
|
+
for (var r$1 = [], a = !0; !this.eat(t$1);) {
|
|
2161
|
+
if (a) a = !1;
|
|
2162
|
+
else if (this.expect(M.comma), e$2 && this.afterTrailingComma(t$1)) break;
|
|
2163
|
+
var n$3 = void 0;
|
|
2164
|
+
s$1 && this.type === M.comma ? n$3 = null : this.type === M.ellipsis ? (n$3 = this.parseSpread(i), i && this.type === M.comma && i.trailingComma < 0 && (i.trailingComma = this.start)) : n$3 = this.parseMaybeAssign(!1, i, this.parseParenItem), r$1.push(n$3);
|
|
2165
|
+
}
|
|
2166
|
+
return r$1;
|
|
2167
|
+
}, p.parseSubscript = function(t$1, e$2, s$1, i, r$1, a, n$3) {
|
|
2168
|
+
var o$2 = this, h = a;
|
|
2169
|
+
if (!this.hasPrecedingLineBreak() && "!" === this.value && this.match(M.prefix)) {
|
|
2170
|
+
this.exprAllowed = !1, this.next();
|
|
2171
|
+
var p$1 = this.startNodeAt(e$2, s$1);
|
|
2172
|
+
return p$1.expression = t$1, t$1 = this.finishNode(p$1, "TSNonNullExpression");
|
|
2173
|
+
}
|
|
2174
|
+
var c = !1;
|
|
2175
|
+
if (this.match(M.questionDot) && 60 === this.lookaheadCharCode()) {
|
|
2176
|
+
if (i) return t$1;
|
|
2177
|
+
t$1.optional = !0, h = c = !0, this.next();
|
|
2178
|
+
}
|
|
2179
|
+
if (this.tsMatchLeftRelational() || this.match(M.bitShift)) {
|
|
2180
|
+
var l, u = this.tsTryParseAndCatch(function() {
|
|
2181
|
+
if (!i && o$2.atPossibleAsyncArrow(t$1)) {
|
|
2182
|
+
var r$2 = o$2.tsTryParseGenericAsyncArrowFunction(e$2, s$1, n$3);
|
|
2183
|
+
if (r$2) return t$1 = r$2;
|
|
2184
|
+
}
|
|
2185
|
+
var a$1 = o$2.tsParseTypeArgumentsInExpression();
|
|
2186
|
+
if (!a$1) return t$1;
|
|
2187
|
+
if (c && !o$2.match(M.parenL)) return l = o$2.curPosition(), t$1;
|
|
2188
|
+
if (V(o$2.type) || o$2.type === M.backQuote) {
|
|
2189
|
+
var p$2 = o$2.parseTaggedTemplateExpression(t$1, e$2, s$1, h);
|
|
2190
|
+
return p$2.typeParameters = a$1, p$2;
|
|
2191
|
+
}
|
|
2192
|
+
if (!i && o$2.eat(M.parenL)) {
|
|
2193
|
+
var u$1 = new y(), d$2 = o$2.startNodeAt(e$2, s$1);
|
|
2194
|
+
return d$2.callee = t$1, d$2.arguments = o$2.parseExprList(M.parenR, o$2.options.ecmaVersion >= 8, !1, u$1), o$2.tsCheckForInvalidTypeCasts(d$2.arguments), d$2.typeParameters = a$1, h && (d$2.optional = c), o$2.checkExpressionErrors(u$1, !0), t$1 = o$2.finishNode(d$2, "CallExpression");
|
|
2195
|
+
}
|
|
2196
|
+
var m$1 = o$2.type;
|
|
2197
|
+
if (!(o$2.tsMatchRightRelational() || m$1 === M.bitShift || m$1 !== M.parenL && (f$1 = m$1, Boolean(f$1.startsExpr)) && !o$2.hasPrecedingLineBreak())) {
|
|
2198
|
+
var f$1, x$1 = o$2.startNodeAt(e$2, s$1);
|
|
2199
|
+
return x$1.expression = t$1, x$1.typeParameters = a$1, o$2.finishNode(x$1, "TSInstantiationExpression");
|
|
2200
|
+
}
|
|
2201
|
+
});
|
|
2202
|
+
if (l && this.unexpected(l), u) return "TSInstantiationExpression" === u.type && (this.match(M.dot) || this.match(M.questionDot) && 40 !== this.lookaheadCharCode()) && this.raise(this.start, T.InvalidPropertyAccessAfterInstantiationExpression), t$1 = u;
|
|
2203
|
+
}
|
|
2204
|
+
var d$1 = this.options.ecmaVersion >= 11, m = d$1 && this.eat(M.questionDot);
|
|
2205
|
+
i && m && this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
|
|
2206
|
+
var f = this.eat(M.bracketL);
|
|
2207
|
+
if (f || m && this.type !== M.parenL && this.type !== M.backQuote || this.eat(M.dot)) {
|
|
2208
|
+
var x = this.startNodeAt(e$2, s$1);
|
|
2209
|
+
x.object = t$1, f ? (x.property = this.parseExpression(), this.expect(M.bracketR)) : x.property = this.type === M.privateId && "Super" !== t$1.type ? this.parsePrivateIdent() : this.parseIdent("never" !== this.options.allowReserved), x.computed = !!f, d$1 && (x.optional = m), t$1 = this.finishNode(x, "MemberExpression");
|
|
2210
|
+
} else if (!i && this.eat(M.parenL)) {
|
|
2211
|
+
var v = this.maybeInArrowParameters;
|
|
2212
|
+
this.maybeInArrowParameters = !0;
|
|
2213
|
+
var P = new y(), b = this.yieldPos, g = this.awaitPos, A = this.awaitIdentPos;
|
|
2214
|
+
this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0;
|
|
2215
|
+
var S = this.parseExprList(M.parenR, this.options.ecmaVersion >= 8, !1, P);
|
|
2216
|
+
if (r$1 && !m && this.shouldParseAsyncArrow()) this.checkPatternErrors(P, !1), this.checkYieldAwaitInDefaultParams(), this.awaitIdentPos > 0 && this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"), this.yieldPos = b, this.awaitPos = g, this.awaitIdentPos = A, t$1 = this.parseSubscriptAsyncArrow(e$2, s$1, S, n$3);
|
|
2217
|
+
else {
|
|
2218
|
+
this.checkExpressionErrors(P, !0), this.yieldPos = b || this.yieldPos, this.awaitPos = g || this.awaitPos, this.awaitIdentPos = A || this.awaitIdentPos;
|
|
2219
|
+
var k = this.startNodeAt(e$2, s$1);
|
|
2220
|
+
k.callee = t$1, k.arguments = S, d$1 && (k.optional = m), t$1 = this.finishNode(k, "CallExpression");
|
|
2221
|
+
}
|
|
2222
|
+
this.maybeInArrowParameters = v;
|
|
2223
|
+
} else if (this.type === M.backQuote) {
|
|
2224
|
+
(m || h) && this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
2225
|
+
var C = this.startNodeAt(e$2, s$1);
|
|
2226
|
+
C.tag = t$1, C.quasi = this.parseTemplate({ isTagged: !0 }), t$1 = this.finishNode(C, "TaggedTemplateExpression");
|
|
2227
|
+
}
|
|
2228
|
+
return t$1;
|
|
2229
|
+
}, p.parseGetterSetter = function(t$1) {
|
|
2230
|
+
t$1.kind = t$1.key.name, this.parsePropertyName(t$1), t$1.value = this.parseMethod(!1);
|
|
2231
|
+
var e$2 = "get" === t$1.kind ? 0 : 1, s$1 = t$1.value.params[0], i = s$1 && this.isThisParam(s$1);
|
|
2232
|
+
t$1.value.params.length !== (e$2 = i ? e$2 + 1 : e$2) ? this.raiseRecoverable(t$1.value.start, "get" === t$1.kind ? "getter should have no params" : "setter should have exactly one param") : "set" === t$1.kind && "RestElement" === t$1.value.params[0].type && this.raiseRecoverable(t$1.value.params[0].start, "Setter cannot use rest params");
|
|
2233
|
+
}, p.parseProperty = function(e$2, s$1) {
|
|
2234
|
+
if (!e$2) {
|
|
2235
|
+
var i = [];
|
|
2236
|
+
if (this.match(B.at)) for (; this.match(B.at);) i.push(this.parseDecorator());
|
|
2237
|
+
var r$1 = t.prototype.parseProperty.call(this, e$2, s$1);
|
|
2238
|
+
return "SpreadElement" === r$1.type && i.length && this.raise(r$1.start, "Decorators can't be used with SpreadElement"), i.length && (r$1.decorators = i, i = []), r$1;
|
|
2239
|
+
}
|
|
2240
|
+
return t.prototype.parseProperty.call(this, e$2, s$1);
|
|
2241
|
+
}, p.parseCatchClauseParam = function() {
|
|
2242
|
+
var t$1 = this.parseBindingAtom(), e$2 = "Identifier" === t$1.type;
|
|
2243
|
+
this.enterScope(e$2 ? 32 : 0), this.checkLValPattern(t$1, e$2 ? 4 : 2);
|
|
2244
|
+
var s$1 = this.tsTryParseTypeAnnotation();
|
|
2245
|
+
return s$1 && (t$1.typeAnnotation = s$1, this.resetEndLocation(t$1)), this.expect(M.parenR), t$1;
|
|
2246
|
+
}, p.parseClass = function(t$1, e$2) {
|
|
2247
|
+
var s$1 = this.inAbstractClass;
|
|
2248
|
+
this.inAbstractClass = !!t$1.abstract;
|
|
2249
|
+
try {
|
|
2250
|
+
this.next(), this.takeDecorators(t$1);
|
|
2251
|
+
var i = this.strict;
|
|
2252
|
+
this.strict = !0, this.parseClassId(t$1, e$2), this.parseClassSuper(t$1);
|
|
2253
|
+
var r$1 = this.enterClassBody(), a = this.startNode(), n$3 = !1;
|
|
2254
|
+
a.body = [];
|
|
2255
|
+
var o$2 = [];
|
|
2256
|
+
for (this.expect(M.braceL); this.type !== M.braceR;) if (this.match(B.at)) o$2.push(this.parseDecorator());
|
|
2257
|
+
else {
|
|
2258
|
+
var h = this.parseClassElement(null !== t$1.superClass);
|
|
2259
|
+
o$2.length && (h.decorators = o$2, this.resetStartLocationFromNode(h, o$2[0]), o$2 = []), h && (a.body.push(h), "MethodDefinition" === h.type && "constructor" === h.kind && "FunctionExpression" === h.value.type ? (n$3 && this.raiseRecoverable(h.start, "Duplicate constructor in the same class"), n$3 = !0, h.decorators && h.decorators.length > 0 && this.raise(h.start, "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?")) : h.key && "PrivateIdentifier" === h.key.type && f(r$1, h) && this.raiseRecoverable(h.key.start, "Identifier '#" + h.key.name + "' has already been declared"));
|
|
2260
|
+
}
|
|
2261
|
+
return this.strict = i, this.next(), o$2.length && this.raise(this.start, "Decorators must be attached to a class element."), t$1.body = this.finishNode(a, "ClassBody"), this.exitClassBody(), this.finishNode(t$1, e$2 ? "ClassDeclaration" : "ClassExpression");
|
|
2262
|
+
} finally {
|
|
2263
|
+
this.inAbstractClass = s$1;
|
|
2264
|
+
}
|
|
2265
|
+
}, p.parseClassFunctionParams = function() {
|
|
2266
|
+
var t$1 = this.tsTryParseTypeParameters(this.tsParseConstModifier), e$2 = this.parseBindingList(M.parenR, !1, this.options.ecmaVersion >= 8, !0);
|
|
2267
|
+
return t$1 && (e$2.typeParameters = t$1), e$2;
|
|
2268
|
+
}, p.parseMethod = function(t$1, e$2, s$1, i, r$1) {
|
|
2269
|
+
var a = this.startNode(), n$3 = this.yieldPos, o$2 = this.awaitPos, h = this.awaitIdentPos;
|
|
2270
|
+
if (this.initFunction(a), this.options.ecmaVersion >= 6 && (a.generator = t$1), this.options.ecmaVersion >= 8 && (a.async = !!e$2), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(64 | E(e$2, a.generator) | (s$1 ? 128 : 0)), this.expect(M.parenL), a.params = this.parseClassFunctionParams(), this.checkYieldAwaitInDefaultParams(), this.parseFunctionBody(a, !1, !0, !1, { isClassMethod: i }), this.yieldPos = n$3, this.awaitPos = o$2, this.awaitIdentPos = h, r$1 && r$1.abstract && a.body) {
|
|
2271
|
+
var p$1 = r$1.key;
|
|
2272
|
+
this.raise(r$1.start, T.AbstractMethodHasImplementation({ methodName: "Identifier" !== p$1.type || r$1.computed ? "[" + this.input.slice(p$1.start, p$1.end) + "]" : p$1.name }));
|
|
2273
|
+
}
|
|
2274
|
+
return this.finishNode(a, "FunctionExpression");
|
|
2275
|
+
}, e$1.parse = function(t$1, e$2) {
|
|
2276
|
+
if (!1 === e$2.locations) throw new Error("You have to enable options.locations while using acorn-typescript");
|
|
2277
|
+
e$2.locations = !0;
|
|
2278
|
+
var s$1 = new this(e$2, t$1);
|
|
2279
|
+
return d && (s$1.isAmbientContext = !0), s$1.parse();
|
|
2280
|
+
}, e$1.parseExpressionAt = function(t$1, e$2, s$1) {
|
|
2281
|
+
if (!1 === s$1.locations) throw new Error("You have to enable options.locations while using acorn-typescript");
|
|
2282
|
+
s$1.locations = !0;
|
|
2283
|
+
var i = new this(s$1, t$1, e$2);
|
|
2284
|
+
return d && (i.isAmbientContext = !0), i.nextToken(), i.parseExpression();
|
|
2285
|
+
}, p.parseImportSpecifier = function() {
|
|
2286
|
+
if (this.ts_isContextual(B.type)) {
|
|
2287
|
+
var e$2 = this.startNode();
|
|
2288
|
+
return e$2.imported = this.parseModuleExportName(), this.parseTypeOnlyImportExportSpecifier(e$2, !0, "type" === this.importOrExportOuterKind), this.finishNode(e$2, "ImportSpecifier");
|
|
2289
|
+
}
|
|
2290
|
+
var s$1 = t.prototype.parseImportSpecifier.call(this);
|
|
2291
|
+
return s$1.importKind = "value", s$1;
|
|
2292
|
+
}, p.parseExportSpecifier = function(e$2) {
|
|
2293
|
+
var s$1 = this.ts_isContextual(B.type);
|
|
2294
|
+
if (!this.match(M.string) && s$1) {
|
|
2295
|
+
var i = this.startNode();
|
|
2296
|
+
return i.local = this.parseModuleExportName(), this.parseTypeOnlyImportExportSpecifier(i, !1, "type" === this.importOrExportOuterKind), this.finishNode(i, "ExportSpecifier"), this.checkExport(e$2, i.exported, i.exported.start), i;
|
|
2297
|
+
}
|
|
2298
|
+
var r$1 = t.prototype.parseExportSpecifier.call(this, e$2);
|
|
2299
|
+
return r$1.exportKind = "value", r$1;
|
|
2300
|
+
}, p.parseTypeOnlyImportExportSpecifier = function(e$2, s$1, i) {
|
|
2301
|
+
var r$1, a = s$1 ? "imported" : "local", n$3 = s$1 ? "local" : "exported", o$2 = e$2[a], h = !1, p$1 = !0, c = o$2.start;
|
|
2302
|
+
if (this.isContextual("as")) {
|
|
2303
|
+
var l = this.parseIdent();
|
|
2304
|
+
if (this.isContextual("as")) {
|
|
2305
|
+
var u = this.parseIdent();
|
|
2306
|
+
J(this.type) ? (h = !0, o$2 = l, r$1 = s$1 ? this.parseIdent() : this.parseModuleExportName(), p$1 = !1) : (r$1 = u, p$1 = !1);
|
|
2307
|
+
} else J(this.type) ? (p$1 = !1, r$1 = s$1 ? this.parseIdent() : this.parseModuleExportName()) : (h = !0, o$2 = l);
|
|
2308
|
+
} else J(this.type) && (h = !0, s$1 ? (o$2 = t.prototype.parseIdent.call(this, !0), this.isContextual("as") || this.checkUnreserved(o$2)) : o$2 = this.parseModuleExportName());
|
|
2309
|
+
h && i && this.raise(c, s$1 ? T.TypeModifierIsUsedInTypeImports : T.TypeModifierIsUsedInTypeExports), e$2[a] = o$2, e$2[n$3] = r$1, e$2[s$1 ? "importKind" : "exportKind"] = h ? "type" : "value", p$1 && this.eatContextual("as") && (e$2[n$3] = s$1 ? this.parseIdent() : this.parseModuleExportName()), e$2[n$3] || (e$2[n$3] = this.copyNode(e$2[a])), s$1 && this.checkLValSimple(e$2[n$3], 2);
|
|
2310
|
+
}, p.raiseCommonCheck = function(e$2, s$1, i) {
|
|
2311
|
+
return "Comma is not permitted after the rest element" === s$1 ? this.isAmbientContext && this.match(M.comma) && 41 === this.lookaheadCharCode() ? void this.next() : t.prototype.raise.call(this, e$2, s$1) : i ? t.prototype.raiseRecoverable.call(this, e$2, s$1) : t.prototype.raise.call(this, e$2, s$1);
|
|
2312
|
+
}, p.raiseRecoverable = function(t$1, e$2) {
|
|
2313
|
+
return this.raiseCommonCheck(t$1, e$2, !0);
|
|
2314
|
+
}, p.raise = function(t$1, e$2) {
|
|
2315
|
+
return this.raiseCommonCheck(t$1, e$2, !0);
|
|
2316
|
+
}, p.updateContext = function(e$2) {
|
|
2317
|
+
var s$1 = this.type;
|
|
2318
|
+
if (s$1 == M.braceL) {
|
|
2319
|
+
var i = this.curContext();
|
|
2320
|
+
i == H.tc_oTag ? this.context.push(j.b_expr) : i == H.tc_expr ? this.context.push(j.b_tmpl) : t.prototype.updateContext.call(this, e$2), this.exprAllowed = !0;
|
|
2321
|
+
} else {
|
|
2322
|
+
if (s$1 !== M.slash || e$2 !== B.jsxTagStart) return t.prototype.updateContext.call(this, e$2);
|
|
2323
|
+
this.context.length -= 2, this.context.push(H.tc_cTag), this.exprAllowed = !1;
|
|
2324
|
+
}
|
|
2325
|
+
}, p.jsx_parseOpeningElementAt = function(t$1, e$2) {
|
|
2326
|
+
var s$1 = this, i = this.startNodeAt(t$1, e$2), r$1 = this.jsx_parseElementName();
|
|
2327
|
+
if (r$1 && (i.name = r$1), this.match(M.relational) || this.match(M.bitShift)) {
|
|
2328
|
+
var a = this.tsTryParseAndCatch(function() {
|
|
2329
|
+
return s$1.tsParseTypeArgumentsInExpression();
|
|
2330
|
+
});
|
|
2331
|
+
a && (i.typeParameters = a);
|
|
2332
|
+
}
|
|
2333
|
+
for (i.attributes = []; this.type !== M.slash && this.type !== B.jsxTagEnd;) i.attributes.push(this.jsx_parseAttribute());
|
|
2334
|
+
return i.selfClosing = this.eat(M.slash), this.expect(B.jsxTagEnd), this.finishNode(i, r$1 ? "JSXOpeningElement" : "JSXOpeningFragment");
|
|
2335
|
+
}, p.enterScope = function(e$2) {
|
|
2336
|
+
e$2 === u && this.importsStack.push([]), t.prototype.enterScope.call(this, e$2);
|
|
2337
|
+
var s$1 = t.prototype.currentScope.call(this);
|
|
2338
|
+
s$1.types = [], s$1.enums = [], s$1.constEnums = [], s$1.classes = [], s$1.exportOnlyBindings = [];
|
|
2339
|
+
}, p.exitScope = function() {
|
|
2340
|
+
t.prototype.currentScope.call(this).flags === u && this.importsStack.pop(), t.prototype.exitScope.call(this);
|
|
2341
|
+
}, p.hasImport = function(t$1, e$2) {
|
|
2342
|
+
var s$1 = this.importsStack.length;
|
|
2343
|
+
if (this.importsStack[s$1 - 1].indexOf(t$1) > -1) return !0;
|
|
2344
|
+
if (!e$2 && s$1 > 1) {
|
|
2345
|
+
for (var i = 0; i < s$1 - 1; i++) if (this.importsStack[i].indexOf(t$1) > -1) return !0;
|
|
2346
|
+
}
|
|
2347
|
+
return !1;
|
|
2348
|
+
}, p.maybeExportDefined = function(t$1, e$2) {
|
|
2349
|
+
this.inModule && 1 & t$1.flags && this.undefinedExports.delete(e$2);
|
|
2350
|
+
}, p.isRedeclaredInScope = function(e$2, s$1, i) {
|
|
2351
|
+
return !!(0 & i) && (2 & i ? e$2.lexical.indexOf(s$1) > -1 || e$2.functions.indexOf(s$1) > -1 || e$2.var.indexOf(s$1) > -1 : 3 & i ? e$2.lexical.indexOf(s$1) > -1 || !t.prototype.treatFunctionsAsVarInScope.call(this, e$2) && e$2.var.indexOf(s$1) > -1 : e$2.lexical.indexOf(s$1) > -1 && !(32 & e$2.flags && e$2.lexical[0] === s$1) || !this.treatFunctionsAsVarInScope(e$2) && e$2.functions.indexOf(s$1) > -1);
|
|
2352
|
+
}, p.checkRedeclarationInScope = function(t$1, e$2, s$1, i) {
|
|
2353
|
+
this.isRedeclaredInScope(t$1, e$2, s$1) && this.raise(i, "Identifier '" + e$2 + "' has already been declared.");
|
|
2354
|
+
}, p.declareName = function(e$2, s$1, i) {
|
|
2355
|
+
if (4096 & s$1) return this.hasImport(e$2, !0) && this.raise(i, "Identifier '" + e$2 + "' has already been declared."), void this.importsStack[this.importsStack.length - 1].push(e$2);
|
|
2356
|
+
var r$1 = this.currentScope();
|
|
2357
|
+
if (1024 & s$1) return this.maybeExportDefined(r$1, e$2), void r$1.exportOnlyBindings.push(e$2);
|
|
2358
|
+
t.prototype.declareName.call(this, e$2, s$1, i), 0 & s$1 && (0 & s$1 || (this.checkRedeclarationInScope(r$1, e$2, s$1, i), this.maybeExportDefined(r$1, e$2)), r$1.types.push(e$2)), 256 & s$1 && r$1.enums.push(e$2), 512 & s$1 && r$1.constEnums.push(e$2), 128 & s$1 && r$1.classes.push(e$2);
|
|
2359
|
+
}, p.checkLocalExport = function(e$2) {
|
|
2360
|
+
var s$1 = e$2.name;
|
|
2361
|
+
if (!this.hasImport(s$1)) {
|
|
2362
|
+
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
2363
|
+
var r$1 = this.scopeStack[i];
|
|
2364
|
+
if (r$1.types.indexOf(s$1) > -1 || r$1.exportOnlyBindings.indexOf(s$1) > -1) return;
|
|
2365
|
+
}
|
|
2366
|
+
t.prototype.checkLocalExport.call(this, e$2);
|
|
2367
|
+
}
|
|
2368
|
+
}, s = e$1, n$2 = [{
|
|
2369
|
+
key: "acornTypeScript",
|
|
2370
|
+
get: function() {
|
|
2371
|
+
return N$1;
|
|
2372
|
+
}
|
|
2373
|
+
}], (r = [{
|
|
2374
|
+
key: "acornTypeScript",
|
|
2375
|
+
get: function() {
|
|
2376
|
+
return N$1;
|
|
2377
|
+
}
|
|
2378
|
+
}]) && i(s.prototype, r), n$2 && i(s, n$2), Object.defineProperty(s, "prototype", { writable: !1 }), e$1;
|
|
2379
|
+
}(n$1);
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2382
|
+
exports.default = L, exports.tsPlugin = L;
|
|
2383
|
+
}));
|
|
2384
|
+
|
|
2385
|
+
//#endregion
|
|
2386
|
+
export default require_lib();
|
|
2387
|
+
|
|
2388
|
+
export { require_lib };
|
|
2389
|
+
//# sourceMappingURL=index.js.map
|