eslint-cli-bundle 2.0.0 → 3.0.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/LICENSE +22 -0
- package/README.md +10 -1
- package/dist/api.d.ts +32 -11
- package/dist/api.js +7 -7
- package/dist/babel.cjs +38 -27
- package/dist/config.d.ts +10 -2
- package/dist/config.js +1 -1
- package/dist/eslint-C-fkO7XK.js +166 -0
- package/dist/eslint-helpers-4m3QC9jt.js +370 -0
- package/dist/eslint.js +11 -8
- package/dist/jiti-CaIpDikP.js +15 -0
- package/dist/naming-BtEmRC_V.js +1 -0
- package/dist/rolldown-runtime-C7uQZ-1I.js +1 -0
- package/dist/shared/translate-cli-options.js +1 -0
- package/dist/src-Bnjf7phB.js +1 -0
- package/dist/types/config-helpers.d.ts +1473 -0
- package/dist/{types-CXey2reC.d.ts → types/core.d.ts} +62 -5
- package/dist/types/estree.d.ts +527 -0
- package/dist/types/plugin-kit.d.ts +1732 -0
- package/dist/worker.js +1 -0
- package/package.json +20 -15
- package/dist/chunk-qnHZjHhP.js +0 -1
- package/dist/eslint-BTrx12MV.js +0 -256
- package/dist/jiti-BvM1NyiB.js +0 -9
- package/dist/src-D7slgxDU.js +0 -1
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
|
|
7
7
|
*/
|
|
8
8
|
type JSONSchema4TypeName = "string" //
|
|
9
|
-
| "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
|
|
9
|
+
| "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
|
|
10
10
|
/**
|
|
11
11
|
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
|
|
12
12
|
*/
|
|
13
13
|
type JSONSchema4Type = string //
|
|
14
|
-
| number | boolean | JSONSchema4Object | JSONSchema4Array | null;
|
|
14
|
+
| number | boolean | JSONSchema4Object | JSONSchema4Array | null;
|
|
15
15
|
// Workaround for infinite type recursion
|
|
16
16
|
interface JSONSchema4Object {
|
|
17
17
|
[key: string]: JSONSchema4Type;
|
|
@@ -197,7 +197,7 @@ interface JSONSchema4 {
|
|
|
197
197
|
format?: string | undefined;
|
|
198
198
|
}
|
|
199
199
|
//#endregion
|
|
200
|
-
//#region node_modules/.pnpm/@eslint+core@1.
|
|
200
|
+
//#region node_modules/.pnpm/@eslint+core@1.2.1/node_modules/@eslint/core/dist/esm/types.d.ts
|
|
201
201
|
/**
|
|
202
202
|
* Represents an error inside of a file.
|
|
203
203
|
*/
|
|
@@ -223,6 +223,13 @@ interface SourceLocation {
|
|
|
223
223
|
start: Position;
|
|
224
224
|
end: Position;
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Represents the start and end coordinates of a node inside the source with an offset.
|
|
228
|
+
*/
|
|
229
|
+
interface SourceLocationWithOffset {
|
|
230
|
+
start: PositionWithOffset;
|
|
231
|
+
end: PositionWithOffset;
|
|
232
|
+
}
|
|
226
233
|
/**
|
|
227
234
|
* Represents a location coordinate inside the source. ESLint-style formats
|
|
228
235
|
* have just `line` and `column` while others may have `offset` as well.
|
|
@@ -231,6 +238,12 @@ interface Position {
|
|
|
231
238
|
line: number;
|
|
232
239
|
column: number;
|
|
233
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Represents a location coordinate inside the source with an offset.
|
|
243
|
+
*/
|
|
244
|
+
interface PositionWithOffset extends Position {
|
|
245
|
+
offset: number;
|
|
246
|
+
}
|
|
234
247
|
/**
|
|
235
248
|
* Represents a range of characters in the source.
|
|
236
249
|
*/
|
|
@@ -276,6 +289,12 @@ interface RulesMetaDocs {
|
|
|
276
289
|
* Indicates if the rule is frozen (no longer accepting feature requests).
|
|
277
290
|
*/
|
|
278
291
|
frozen?: boolean | undefined;
|
|
292
|
+
/**
|
|
293
|
+
* The dialects of the languages that the rule is intended to lint.
|
|
294
|
+
* @example
|
|
295
|
+
* ["JavaScript", "TypeScript"]
|
|
296
|
+
*/
|
|
297
|
+
dialects?: string[] | undefined;
|
|
279
298
|
}
|
|
280
299
|
/**
|
|
281
300
|
* Meta information about a rule.
|
|
@@ -320,12 +339,21 @@ interface RulesMeta<MessageIds extends string = string, RuleOptions = unknown[],
|
|
|
320
339
|
hasSuggestions?: boolean | undefined;
|
|
321
340
|
/**
|
|
322
341
|
* The language the rule is intended to lint.
|
|
342
|
+
* @deprecated Use `languages` instead.
|
|
323
343
|
*/
|
|
324
344
|
language?: string;
|
|
325
345
|
/**
|
|
326
346
|
* The dialects of `language` that the rule is intended to lint.
|
|
347
|
+
* @deprecated Use `docs.dialects` instead.
|
|
327
348
|
*/
|
|
328
349
|
dialects?: string[];
|
|
350
|
+
/**
|
|
351
|
+
* Languages supported by this rule in the format `"plugin/language"`.
|
|
352
|
+
* Use `"*"` for any language or `"plugin/*"` for any language from a specific plugin.
|
|
353
|
+
* @example
|
|
354
|
+
* ["js/js", "markdown/gfm", "json/jsonc", "css/css"]
|
|
355
|
+
*/
|
|
356
|
+
languages?: string[] | undefined;
|
|
329
357
|
}
|
|
330
358
|
/**
|
|
331
359
|
* Provides additional metadata about a deprecation.
|
|
@@ -640,6 +668,35 @@ interface RuleDefinition<Options extends RuleDefinitionTypeOptions = RuleDefinit
|
|
|
640
668
|
MessageIds: Options["MessageIds"];
|
|
641
669
|
}>): Options["Visitor"];
|
|
642
670
|
}
|
|
671
|
+
/**
|
|
672
|
+
* Defaults for non-language-related `RuleDefinition` options.
|
|
673
|
+
* @deprecated Use the same type from `@eslint/plugin-kit` instead.
|
|
674
|
+
*/
|
|
675
|
+
interface CustomRuleTypeDefinitions {
|
|
676
|
+
RuleOptions: unknown[];
|
|
677
|
+
MessageIds: string;
|
|
678
|
+
ExtRuleDocs: Record<string, unknown>;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* A helper type to define language specific specializations of the `RuleDefinition` type.
|
|
682
|
+
* @deprecated Use the same type from `@eslint/plugin-kit` instead.
|
|
683
|
+
*
|
|
684
|
+
* @example
|
|
685
|
+
* ```ts
|
|
686
|
+
* type YourRuleDefinition<
|
|
687
|
+
* Options extends Partial<CustomRuleTypeDefinitions> = {},
|
|
688
|
+
* > = CustomRuleDefinitionType<
|
|
689
|
+
* {
|
|
690
|
+
* LangOptions: YourLanguageOptions;
|
|
691
|
+
* Code: YourSourceCode;
|
|
692
|
+
* Visitor: YourRuleVisitor;
|
|
693
|
+
* Node: YourNode;
|
|
694
|
+
* },
|
|
695
|
+
* Options
|
|
696
|
+
* >;
|
|
697
|
+
* ```
|
|
698
|
+
*/
|
|
699
|
+
type CustomRuleDefinitionType<LanguageSpecificOptions extends Omit<RuleDefinitionTypeOptions, keyof CustomRuleTypeDefinitions>, Options extends Partial<CustomRuleTypeDefinitions>> = RuleDefinition<LanguageSpecificOptions & Required<Options & Omit<CustomRuleTypeDefinitions, keyof Options>>>;
|
|
643
700
|
/**
|
|
644
701
|
* The human readable severity level used in a configuration.
|
|
645
702
|
*/
|
|
@@ -1022,7 +1079,7 @@ interface Language<Options extends LanguageTypeOptions = {
|
|
|
1022
1079
|
/**
|
|
1023
1080
|
* Default language options. User-defined options are merged with this object.
|
|
1024
1081
|
*/
|
|
1025
|
-
defaultLanguageOptions?:
|
|
1082
|
+
defaultLanguageOptions?: Options["LangOptions"];
|
|
1026
1083
|
/**
|
|
1027
1084
|
* Validates languageOptions for this language.
|
|
1028
1085
|
*/
|
|
@@ -1296,4 +1353,4 @@ interface Directive {
|
|
|
1296
1353
|
justification?: string;
|
|
1297
1354
|
}
|
|
1298
1355
|
//#endregion
|
|
1299
|
-
export {
|
|
1356
|
+
export type { BaseConfig, BinarySourceCode, CallTraversalStep, ConfigObject, ConfigOverride, CustomRuleDefinitionType, CustomRuleTypeDefinitions, DeprecatedInfo, Directive, DirectiveType, EcmaVersion, EnvironmentConfig, ExternalSpecifier, File, FileError, FileProblem, GlobalAccess, GlobalsConfig, HasRules, JavaScriptParserOptionsConfig, JavaScriptSourceType, Language, LanguageContext, LanguageOptions, LanguageTypeOptions, LegacyConfigObject, LintMessage, LintSuggestion, LinterOptionsConfig, MessagePlaceholderData, NotOkParseResult, ObjectMetaProperties, OkParseResult, ParseResult, Plugin, Position, PositionWithOffset, Processor, ProcessorFile, ReplacedByInfo, RuleConfig, RuleContext, RuleContextTypeOptions, RuleDefinition, RuleDefinitionTypeOptions, RuleFixType, RuleFixer, RuleTextEdit, RuleTextEditor, RuleType, RuleVisitor, RulesConfig, RulesMeta, RulesMetaDocs, SettingsConfig, Severity, SeverityLevel, SeverityName, SourceCode, SourceCodeBaseTypeOptions, SourceLocation, SourceLocationWithOffset, SourceRange, SuggestedEdit, SuggestedEditBase, SuggestionMessage, TextSourceCode, TraversalStep, ViolationLocation, ViolationMessage, ViolationReport, ViolationReportBase, VisitTraversalStep };
|
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/@types+estree@1.0.9/node_modules/@types/estree/index.d.ts
|
|
2
|
+
// This definition file follows a somewhat unusual format. ESTree allows
|
|
3
|
+
// runtime type checks based on the `type` parameter. In order to explain this
|
|
4
|
+
// to typescript we want to use discriminated union types:
|
|
5
|
+
// https://github.com/Microsoft/TypeScript/pull/9163
|
|
6
|
+
//
|
|
7
|
+
// For ESTree this is a bit tricky because the high level interfaces like
|
|
8
|
+
// Node or Function are pulling double duty. We want to pass common fields down
|
|
9
|
+
// to the interfaces that extend them (like Identifier or
|
|
10
|
+
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
|
11
|
+
// common fields on them. So we've split the high level interfaces into two
|
|
12
|
+
// types, a base type which passes down inherited fields, and a type union of
|
|
13
|
+
// all types which extend the base type. Only the type union is exported, and
|
|
14
|
+
// the union is how other types refer to the collection of inheriting types.
|
|
15
|
+
//
|
|
16
|
+
// This makes the definitions file here somewhat more difficult to maintain,
|
|
17
|
+
// but it has the notable advantage of making ESTree much easier to use as
|
|
18
|
+
// an end user.
|
|
19
|
+
interface BaseNodeWithoutComments {
|
|
20
|
+
// Every leaf interface that extends BaseNode must specify a type property.
|
|
21
|
+
// The type property should be a string literal. For example, Identifier
|
|
22
|
+
// has: `type: "Identifier"`
|
|
23
|
+
type: string;
|
|
24
|
+
loc?: SourceLocation | null | undefined;
|
|
25
|
+
range?: [number, number] | undefined;
|
|
26
|
+
}
|
|
27
|
+
interface BaseNode extends BaseNodeWithoutComments {
|
|
28
|
+
leadingComments?: Comment[] | undefined;
|
|
29
|
+
trailingComments?: Comment[] | undefined;
|
|
30
|
+
}
|
|
31
|
+
interface NodeMap {
|
|
32
|
+
AssignmentProperty: AssignmentProperty;
|
|
33
|
+
CatchClause: CatchClause;
|
|
34
|
+
Class: Class;
|
|
35
|
+
ClassBody: ClassBody;
|
|
36
|
+
Expression: Expression;
|
|
37
|
+
Function: Function;
|
|
38
|
+
Identifier: Identifier;
|
|
39
|
+
Literal: Literal;
|
|
40
|
+
MethodDefinition: MethodDefinition;
|
|
41
|
+
ModuleDeclaration: ModuleDeclaration;
|
|
42
|
+
ModuleSpecifier: ModuleSpecifier;
|
|
43
|
+
Pattern: Pattern;
|
|
44
|
+
PrivateIdentifier: PrivateIdentifier;
|
|
45
|
+
Program: Program;
|
|
46
|
+
Property: Property;
|
|
47
|
+
PropertyDefinition: PropertyDefinition;
|
|
48
|
+
SpreadElement: SpreadElement;
|
|
49
|
+
Statement: Statement;
|
|
50
|
+
Super: Super;
|
|
51
|
+
SwitchCase: SwitchCase;
|
|
52
|
+
TemplateElement: TemplateElement;
|
|
53
|
+
VariableDeclarator: VariableDeclarator;
|
|
54
|
+
}
|
|
55
|
+
type Node = NodeMap[keyof NodeMap];
|
|
56
|
+
interface Comment extends BaseNodeWithoutComments {
|
|
57
|
+
type: "Line" | "Block";
|
|
58
|
+
value: string;
|
|
59
|
+
}
|
|
60
|
+
interface SourceLocation {
|
|
61
|
+
source?: string | null | undefined;
|
|
62
|
+
start: Position;
|
|
63
|
+
end: Position;
|
|
64
|
+
}
|
|
65
|
+
interface Position {
|
|
66
|
+
/** >= 1 */
|
|
67
|
+
line: number;
|
|
68
|
+
/** >= 0 */
|
|
69
|
+
column: number;
|
|
70
|
+
}
|
|
71
|
+
interface Program extends BaseNode {
|
|
72
|
+
type: "Program";
|
|
73
|
+
sourceType: "script" | "module";
|
|
74
|
+
body: Array<Directive | Statement | ModuleDeclaration>;
|
|
75
|
+
comments?: Comment[] | undefined;
|
|
76
|
+
}
|
|
77
|
+
interface Directive extends BaseNode {
|
|
78
|
+
type: "ExpressionStatement";
|
|
79
|
+
expression: Literal;
|
|
80
|
+
directive: string;
|
|
81
|
+
}
|
|
82
|
+
interface BaseFunction extends BaseNode {
|
|
83
|
+
params: Pattern[];
|
|
84
|
+
generator?: boolean | undefined;
|
|
85
|
+
async?: boolean | undefined;
|
|
86
|
+
// The body is either BlockStatement or Expression because arrow functions
|
|
87
|
+
// can have a body that's either. FunctionDeclarations and
|
|
88
|
+
// FunctionExpressions have only BlockStatement bodies.
|
|
89
|
+
body: BlockStatement | Expression;
|
|
90
|
+
}
|
|
91
|
+
type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
|
92
|
+
type Statement = ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration;
|
|
93
|
+
interface BaseStatement extends BaseNode {}
|
|
94
|
+
interface EmptyStatement extends BaseStatement {
|
|
95
|
+
type: "EmptyStatement";
|
|
96
|
+
}
|
|
97
|
+
interface BlockStatement extends BaseStatement {
|
|
98
|
+
type: "BlockStatement";
|
|
99
|
+
body: Statement[];
|
|
100
|
+
innerComments?: Comment[] | undefined;
|
|
101
|
+
}
|
|
102
|
+
interface StaticBlock extends Omit<BlockStatement, "type"> {
|
|
103
|
+
type: "StaticBlock";
|
|
104
|
+
}
|
|
105
|
+
interface ExpressionStatement extends BaseStatement {
|
|
106
|
+
type: "ExpressionStatement";
|
|
107
|
+
expression: Expression;
|
|
108
|
+
}
|
|
109
|
+
interface IfStatement extends BaseStatement {
|
|
110
|
+
type: "IfStatement";
|
|
111
|
+
test: Expression;
|
|
112
|
+
consequent: Statement;
|
|
113
|
+
alternate?: Statement | null | undefined;
|
|
114
|
+
}
|
|
115
|
+
interface LabeledStatement extends BaseStatement {
|
|
116
|
+
type: "LabeledStatement";
|
|
117
|
+
label: Identifier;
|
|
118
|
+
body: Statement;
|
|
119
|
+
}
|
|
120
|
+
interface BreakStatement extends BaseStatement {
|
|
121
|
+
type: "BreakStatement";
|
|
122
|
+
label?: Identifier | null | undefined;
|
|
123
|
+
}
|
|
124
|
+
interface ContinueStatement extends BaseStatement {
|
|
125
|
+
type: "ContinueStatement";
|
|
126
|
+
label?: Identifier | null | undefined;
|
|
127
|
+
}
|
|
128
|
+
interface WithStatement extends BaseStatement {
|
|
129
|
+
type: "WithStatement";
|
|
130
|
+
object: Expression;
|
|
131
|
+
body: Statement;
|
|
132
|
+
}
|
|
133
|
+
interface SwitchStatement extends BaseStatement {
|
|
134
|
+
type: "SwitchStatement";
|
|
135
|
+
discriminant: Expression;
|
|
136
|
+
cases: SwitchCase[];
|
|
137
|
+
}
|
|
138
|
+
interface ReturnStatement extends BaseStatement {
|
|
139
|
+
type: "ReturnStatement";
|
|
140
|
+
argument?: Expression | null | undefined;
|
|
141
|
+
}
|
|
142
|
+
interface ThrowStatement extends BaseStatement {
|
|
143
|
+
type: "ThrowStatement";
|
|
144
|
+
argument: Expression;
|
|
145
|
+
}
|
|
146
|
+
interface TryStatement extends BaseStatement {
|
|
147
|
+
type: "TryStatement";
|
|
148
|
+
block: BlockStatement;
|
|
149
|
+
handler?: CatchClause | null | undefined;
|
|
150
|
+
finalizer?: BlockStatement | null | undefined;
|
|
151
|
+
}
|
|
152
|
+
interface WhileStatement extends BaseStatement {
|
|
153
|
+
type: "WhileStatement";
|
|
154
|
+
test: Expression;
|
|
155
|
+
body: Statement;
|
|
156
|
+
}
|
|
157
|
+
interface DoWhileStatement extends BaseStatement {
|
|
158
|
+
type: "DoWhileStatement";
|
|
159
|
+
body: Statement;
|
|
160
|
+
test: Expression;
|
|
161
|
+
}
|
|
162
|
+
interface ForStatement extends BaseStatement {
|
|
163
|
+
type: "ForStatement";
|
|
164
|
+
init?: VariableDeclaration | Expression | null | undefined;
|
|
165
|
+
test?: Expression | null | undefined;
|
|
166
|
+
update?: Expression | null | undefined;
|
|
167
|
+
body: Statement;
|
|
168
|
+
}
|
|
169
|
+
interface BaseForXStatement extends BaseStatement {
|
|
170
|
+
left: VariableDeclaration | Pattern;
|
|
171
|
+
right: Expression;
|
|
172
|
+
body: Statement;
|
|
173
|
+
}
|
|
174
|
+
interface ForInStatement extends BaseForXStatement {
|
|
175
|
+
type: "ForInStatement";
|
|
176
|
+
}
|
|
177
|
+
interface DebuggerStatement extends BaseStatement {
|
|
178
|
+
type: "DebuggerStatement";
|
|
179
|
+
}
|
|
180
|
+
type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
|
181
|
+
interface BaseDeclaration extends BaseStatement {}
|
|
182
|
+
interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
|
183
|
+
type: "FunctionDeclaration";
|
|
184
|
+
/** It is null when a function declaration is a part of the `export default function` statement */
|
|
185
|
+
id: Identifier | null;
|
|
186
|
+
body: BlockStatement;
|
|
187
|
+
}
|
|
188
|
+
interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
|
189
|
+
id: Identifier;
|
|
190
|
+
}
|
|
191
|
+
interface VariableDeclaration extends BaseDeclaration {
|
|
192
|
+
type: "VariableDeclaration";
|
|
193
|
+
declarations: VariableDeclarator[];
|
|
194
|
+
kind: "var" | "let" | "const" | "using" | "await using";
|
|
195
|
+
}
|
|
196
|
+
interface VariableDeclarator extends BaseNode {
|
|
197
|
+
type: "VariableDeclarator";
|
|
198
|
+
id: Pattern;
|
|
199
|
+
init?: Expression | null | undefined;
|
|
200
|
+
}
|
|
201
|
+
interface ExpressionMap {
|
|
202
|
+
ArrayExpression: ArrayExpression;
|
|
203
|
+
ArrowFunctionExpression: ArrowFunctionExpression;
|
|
204
|
+
AssignmentExpression: AssignmentExpression;
|
|
205
|
+
AwaitExpression: AwaitExpression;
|
|
206
|
+
BinaryExpression: BinaryExpression;
|
|
207
|
+
CallExpression: CallExpression;
|
|
208
|
+
ChainExpression: ChainExpression;
|
|
209
|
+
ClassExpression: ClassExpression;
|
|
210
|
+
ConditionalExpression: ConditionalExpression;
|
|
211
|
+
FunctionExpression: FunctionExpression;
|
|
212
|
+
Identifier: Identifier;
|
|
213
|
+
ImportExpression: ImportExpression;
|
|
214
|
+
Literal: Literal;
|
|
215
|
+
LogicalExpression: LogicalExpression;
|
|
216
|
+
MemberExpression: MemberExpression;
|
|
217
|
+
MetaProperty: MetaProperty;
|
|
218
|
+
NewExpression: NewExpression;
|
|
219
|
+
ObjectExpression: ObjectExpression;
|
|
220
|
+
SequenceExpression: SequenceExpression;
|
|
221
|
+
TaggedTemplateExpression: TaggedTemplateExpression;
|
|
222
|
+
TemplateLiteral: TemplateLiteral;
|
|
223
|
+
ThisExpression: ThisExpression;
|
|
224
|
+
UnaryExpression: UnaryExpression;
|
|
225
|
+
UpdateExpression: UpdateExpression;
|
|
226
|
+
YieldExpression: YieldExpression;
|
|
227
|
+
}
|
|
228
|
+
type Expression = ExpressionMap[keyof ExpressionMap];
|
|
229
|
+
interface BaseExpression extends BaseNode {}
|
|
230
|
+
type ChainElement = SimpleCallExpression | MemberExpression;
|
|
231
|
+
interface ChainExpression extends BaseExpression {
|
|
232
|
+
type: "ChainExpression";
|
|
233
|
+
expression: ChainElement;
|
|
234
|
+
}
|
|
235
|
+
interface ThisExpression extends BaseExpression {
|
|
236
|
+
type: "ThisExpression";
|
|
237
|
+
}
|
|
238
|
+
interface ArrayExpression extends BaseExpression {
|
|
239
|
+
type: "ArrayExpression";
|
|
240
|
+
elements: Array<Expression | SpreadElement | null>;
|
|
241
|
+
}
|
|
242
|
+
interface ObjectExpression extends BaseExpression {
|
|
243
|
+
type: "ObjectExpression";
|
|
244
|
+
properties: Array<Property | SpreadElement>;
|
|
245
|
+
}
|
|
246
|
+
interface PrivateIdentifier extends BaseNode {
|
|
247
|
+
type: "PrivateIdentifier";
|
|
248
|
+
name: string;
|
|
249
|
+
}
|
|
250
|
+
interface Property extends BaseNode {
|
|
251
|
+
type: "Property";
|
|
252
|
+
key: Expression;
|
|
253
|
+
value: Expression | Pattern; // Could be an AssignmentProperty
|
|
254
|
+
kind: "init" | "get" | "set";
|
|
255
|
+
method: boolean;
|
|
256
|
+
shorthand: boolean;
|
|
257
|
+
computed: boolean;
|
|
258
|
+
}
|
|
259
|
+
interface PropertyDefinition extends BaseNode {
|
|
260
|
+
type: "PropertyDefinition";
|
|
261
|
+
key: Expression | PrivateIdentifier;
|
|
262
|
+
value?: Expression | null | undefined;
|
|
263
|
+
computed: boolean;
|
|
264
|
+
static: boolean;
|
|
265
|
+
}
|
|
266
|
+
interface FunctionExpression extends BaseFunction, BaseExpression {
|
|
267
|
+
id?: Identifier | null | undefined;
|
|
268
|
+
type: "FunctionExpression";
|
|
269
|
+
body: BlockStatement;
|
|
270
|
+
}
|
|
271
|
+
interface SequenceExpression extends BaseExpression {
|
|
272
|
+
type: "SequenceExpression";
|
|
273
|
+
expressions: Expression[];
|
|
274
|
+
}
|
|
275
|
+
interface UnaryExpression extends BaseExpression {
|
|
276
|
+
type: "UnaryExpression";
|
|
277
|
+
operator: UnaryOperator;
|
|
278
|
+
prefix: true;
|
|
279
|
+
argument: Expression;
|
|
280
|
+
}
|
|
281
|
+
interface BinaryExpression extends BaseExpression {
|
|
282
|
+
type: "BinaryExpression";
|
|
283
|
+
operator: BinaryOperator;
|
|
284
|
+
left: Expression | PrivateIdentifier;
|
|
285
|
+
right: Expression;
|
|
286
|
+
}
|
|
287
|
+
interface AssignmentExpression extends BaseExpression {
|
|
288
|
+
type: "AssignmentExpression";
|
|
289
|
+
operator: AssignmentOperator;
|
|
290
|
+
left: Pattern | MemberExpression;
|
|
291
|
+
right: Expression;
|
|
292
|
+
}
|
|
293
|
+
interface UpdateExpression extends BaseExpression {
|
|
294
|
+
type: "UpdateExpression";
|
|
295
|
+
operator: UpdateOperator;
|
|
296
|
+
argument: Expression;
|
|
297
|
+
prefix: boolean;
|
|
298
|
+
}
|
|
299
|
+
interface LogicalExpression extends BaseExpression {
|
|
300
|
+
type: "LogicalExpression";
|
|
301
|
+
operator: LogicalOperator;
|
|
302
|
+
left: Expression;
|
|
303
|
+
right: Expression;
|
|
304
|
+
}
|
|
305
|
+
interface ConditionalExpression extends BaseExpression {
|
|
306
|
+
type: "ConditionalExpression";
|
|
307
|
+
test: Expression;
|
|
308
|
+
alternate: Expression;
|
|
309
|
+
consequent: Expression;
|
|
310
|
+
}
|
|
311
|
+
interface BaseCallExpression extends BaseExpression {
|
|
312
|
+
callee: Expression | Super;
|
|
313
|
+
arguments: Array<Expression | SpreadElement>;
|
|
314
|
+
}
|
|
315
|
+
type CallExpression = SimpleCallExpression | NewExpression;
|
|
316
|
+
interface SimpleCallExpression extends BaseCallExpression {
|
|
317
|
+
type: "CallExpression";
|
|
318
|
+
optional: boolean;
|
|
319
|
+
}
|
|
320
|
+
interface NewExpression extends BaseCallExpression {
|
|
321
|
+
type: "NewExpression";
|
|
322
|
+
}
|
|
323
|
+
interface MemberExpression extends BaseExpression, BasePattern {
|
|
324
|
+
type: "MemberExpression";
|
|
325
|
+
object: Expression | Super;
|
|
326
|
+
property: Expression | PrivateIdentifier;
|
|
327
|
+
computed: boolean;
|
|
328
|
+
optional: boolean;
|
|
329
|
+
}
|
|
330
|
+
type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
|
331
|
+
interface BasePattern extends BaseNode {}
|
|
332
|
+
interface SwitchCase extends BaseNode {
|
|
333
|
+
type: "SwitchCase";
|
|
334
|
+
test?: Expression | null | undefined;
|
|
335
|
+
consequent: Statement[];
|
|
336
|
+
}
|
|
337
|
+
interface CatchClause extends BaseNode {
|
|
338
|
+
type: "CatchClause";
|
|
339
|
+
param: Pattern | null;
|
|
340
|
+
body: BlockStatement;
|
|
341
|
+
}
|
|
342
|
+
interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
|
343
|
+
type: "Identifier";
|
|
344
|
+
name: string;
|
|
345
|
+
}
|
|
346
|
+
type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
|
347
|
+
interface SimpleLiteral extends BaseNode, BaseExpression {
|
|
348
|
+
type: "Literal";
|
|
349
|
+
value: string | boolean | number | null;
|
|
350
|
+
raw?: string | undefined;
|
|
351
|
+
}
|
|
352
|
+
interface RegExpLiteral extends BaseNode, BaseExpression {
|
|
353
|
+
type: "Literal";
|
|
354
|
+
value?: RegExp | null | undefined;
|
|
355
|
+
regex: {
|
|
356
|
+
pattern: string;
|
|
357
|
+
flags: string;
|
|
358
|
+
};
|
|
359
|
+
raw?: string | undefined;
|
|
360
|
+
}
|
|
361
|
+
interface BigIntLiteral extends BaseNode, BaseExpression {
|
|
362
|
+
type: "Literal";
|
|
363
|
+
value?: bigint | null | undefined;
|
|
364
|
+
bigint: string;
|
|
365
|
+
raw?: string | undefined;
|
|
366
|
+
}
|
|
367
|
+
type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
|
368
|
+
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof";
|
|
369
|
+
type LogicalOperator = "||" | "&&" | "??";
|
|
370
|
+
type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
|
371
|
+
type UpdateOperator = "++" | "--";
|
|
372
|
+
interface ForOfStatement extends BaseForXStatement {
|
|
373
|
+
type: "ForOfStatement";
|
|
374
|
+
await: boolean;
|
|
375
|
+
}
|
|
376
|
+
interface Super extends BaseNode {
|
|
377
|
+
type: "Super";
|
|
378
|
+
}
|
|
379
|
+
interface SpreadElement extends BaseNode {
|
|
380
|
+
type: "SpreadElement";
|
|
381
|
+
argument: Expression;
|
|
382
|
+
}
|
|
383
|
+
interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
|
384
|
+
type: "ArrowFunctionExpression";
|
|
385
|
+
expression: boolean;
|
|
386
|
+
body: BlockStatement | Expression;
|
|
387
|
+
}
|
|
388
|
+
interface YieldExpression extends BaseExpression {
|
|
389
|
+
type: "YieldExpression";
|
|
390
|
+
argument?: Expression | null | undefined;
|
|
391
|
+
delegate: boolean;
|
|
392
|
+
}
|
|
393
|
+
interface TemplateLiteral extends BaseExpression {
|
|
394
|
+
type: "TemplateLiteral";
|
|
395
|
+
quasis: TemplateElement[];
|
|
396
|
+
expressions: Expression[];
|
|
397
|
+
}
|
|
398
|
+
interface TaggedTemplateExpression extends BaseExpression {
|
|
399
|
+
type: "TaggedTemplateExpression";
|
|
400
|
+
tag: Expression;
|
|
401
|
+
quasi: TemplateLiteral;
|
|
402
|
+
}
|
|
403
|
+
interface TemplateElement extends BaseNode {
|
|
404
|
+
type: "TemplateElement";
|
|
405
|
+
tail: boolean;
|
|
406
|
+
value: {
|
|
407
|
+
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */
|
|
408
|
+
cooked?: string | null | undefined;
|
|
409
|
+
raw: string;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
interface AssignmentProperty extends Property {
|
|
413
|
+
value: Pattern;
|
|
414
|
+
kind: "init";
|
|
415
|
+
method: boolean; // false
|
|
416
|
+
}
|
|
417
|
+
interface ObjectPattern extends BasePattern {
|
|
418
|
+
type: "ObjectPattern";
|
|
419
|
+
properties: Array<AssignmentProperty | RestElement>;
|
|
420
|
+
}
|
|
421
|
+
interface ArrayPattern extends BasePattern {
|
|
422
|
+
type: "ArrayPattern";
|
|
423
|
+
elements: Array<Pattern | null>;
|
|
424
|
+
}
|
|
425
|
+
interface RestElement extends BasePattern {
|
|
426
|
+
type: "RestElement";
|
|
427
|
+
argument: Pattern;
|
|
428
|
+
}
|
|
429
|
+
interface AssignmentPattern extends BasePattern {
|
|
430
|
+
type: "AssignmentPattern";
|
|
431
|
+
left: Pattern;
|
|
432
|
+
right: Expression;
|
|
433
|
+
}
|
|
434
|
+
type Class = ClassDeclaration | ClassExpression;
|
|
435
|
+
interface BaseClass extends BaseNode {
|
|
436
|
+
superClass?: Expression | null | undefined;
|
|
437
|
+
body: ClassBody;
|
|
438
|
+
}
|
|
439
|
+
interface ClassBody extends BaseNode {
|
|
440
|
+
type: "ClassBody";
|
|
441
|
+
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
|
442
|
+
}
|
|
443
|
+
interface MethodDefinition extends BaseNode {
|
|
444
|
+
type: "MethodDefinition";
|
|
445
|
+
key: Expression | PrivateIdentifier;
|
|
446
|
+
value: FunctionExpression;
|
|
447
|
+
kind: "constructor" | "method" | "get" | "set";
|
|
448
|
+
computed: boolean;
|
|
449
|
+
static: boolean;
|
|
450
|
+
}
|
|
451
|
+
interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
|
452
|
+
type: "ClassDeclaration";
|
|
453
|
+
/** It is null when a class declaration is a part of the `export default class` statement */
|
|
454
|
+
id: Identifier | null;
|
|
455
|
+
}
|
|
456
|
+
interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
|
457
|
+
id: Identifier;
|
|
458
|
+
}
|
|
459
|
+
interface ClassExpression extends BaseClass, BaseExpression {
|
|
460
|
+
type: "ClassExpression";
|
|
461
|
+
id?: Identifier | null | undefined;
|
|
462
|
+
}
|
|
463
|
+
interface MetaProperty extends BaseExpression {
|
|
464
|
+
type: "MetaProperty";
|
|
465
|
+
meta: Identifier;
|
|
466
|
+
property: Identifier;
|
|
467
|
+
}
|
|
468
|
+
type ModuleDeclaration = ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration;
|
|
469
|
+
interface BaseModuleDeclaration extends BaseNode {}
|
|
470
|
+
type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
|
|
471
|
+
interface BaseModuleSpecifier extends BaseNode {
|
|
472
|
+
local: Identifier;
|
|
473
|
+
}
|
|
474
|
+
interface ImportDeclaration extends BaseModuleDeclaration {
|
|
475
|
+
type: "ImportDeclaration";
|
|
476
|
+
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
|
477
|
+
attributes: ImportAttribute[];
|
|
478
|
+
source: Literal;
|
|
479
|
+
}
|
|
480
|
+
interface ImportSpecifier extends BaseModuleSpecifier {
|
|
481
|
+
type: "ImportSpecifier";
|
|
482
|
+
imported: Identifier | Literal;
|
|
483
|
+
}
|
|
484
|
+
interface ImportAttribute extends BaseNode {
|
|
485
|
+
type: "ImportAttribute";
|
|
486
|
+
key: Identifier | Literal;
|
|
487
|
+
value: Literal;
|
|
488
|
+
}
|
|
489
|
+
interface ImportExpression extends BaseExpression {
|
|
490
|
+
type: "ImportExpression";
|
|
491
|
+
source: Expression;
|
|
492
|
+
options?: Expression | null | undefined;
|
|
493
|
+
}
|
|
494
|
+
interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
|
495
|
+
type: "ImportDefaultSpecifier";
|
|
496
|
+
}
|
|
497
|
+
interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
|
498
|
+
type: "ImportNamespaceSpecifier";
|
|
499
|
+
}
|
|
500
|
+
interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
|
501
|
+
type: "ExportNamedDeclaration";
|
|
502
|
+
declaration?: Declaration | null | undefined;
|
|
503
|
+
specifiers: ExportSpecifier[];
|
|
504
|
+
attributes: ImportAttribute[];
|
|
505
|
+
source?: Literal | null | undefined;
|
|
506
|
+
}
|
|
507
|
+
interface ExportSpecifier extends Omit<BaseModuleSpecifier, "local"> {
|
|
508
|
+
type: "ExportSpecifier";
|
|
509
|
+
local: Identifier | Literal;
|
|
510
|
+
exported: Identifier | Literal;
|
|
511
|
+
}
|
|
512
|
+
interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
|
513
|
+
type: "ExportDefaultDeclaration";
|
|
514
|
+
declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression;
|
|
515
|
+
}
|
|
516
|
+
interface ExportAllDeclaration extends BaseModuleDeclaration {
|
|
517
|
+
type: "ExportAllDeclaration";
|
|
518
|
+
exported: Identifier | Literal | null;
|
|
519
|
+
attributes: ImportAttribute[];
|
|
520
|
+
source: Literal;
|
|
521
|
+
}
|
|
522
|
+
interface AwaitExpression extends BaseExpression {
|
|
523
|
+
type: "AwaitExpression";
|
|
524
|
+
argument: Expression;
|
|
525
|
+
}
|
|
526
|
+
//#endregion
|
|
527
|
+
export type { ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentOperator, AssignmentPattern, AssignmentProperty, AwaitExpression, BaseCallExpression, BaseClass, BaseDeclaration, BaseExpression, BaseForXStatement, BaseFunction, BaseModuleDeclaration, BaseModuleSpecifier, BaseNode, BaseNodeWithoutComments, BasePattern, BaseStatement, BigIntLiteral, BinaryExpression, BinaryOperator, BlockStatement, BreakStatement, CallExpression, CatchClause, ChainElement, ChainExpression, Class, ClassBody, ClassDeclaration, ClassExpression, Comment, ConditionalExpression, ContinueStatement, DebuggerStatement, Declaration, Directive, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, ExportSpecifier, Expression, ExpressionMap, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, Function, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, ImportAttribute, ImportDeclaration, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportSpecifier, LabeledStatement, Literal, LogicalExpression, LogicalOperator, MaybeNamedClassDeclaration, MaybeNamedFunctionDeclaration, MemberExpression, MetaProperty, MethodDefinition, ModuleDeclaration, ModuleSpecifier, NewExpression, Node, NodeMap, ObjectExpression, ObjectPattern, Pattern, Position, PrivateIdentifier, Program, Property, PropertyDefinition, RegExpLiteral, RestElement, ReturnStatement, SequenceExpression, SimpleCallExpression, SimpleLiteral, SourceLocation, SpreadElement, Statement, StaticBlock, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateElement, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, UnaryExpression, UnaryOperator, UpdateExpression, UpdateOperator, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression };
|