jass 0.9.1 → 0.9.3

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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/jass.rb +5 -0
  4. data/lib/jass/compiler.rb +5 -0
  5. data/lib/jass/plugin.rb +2 -1
  6. data/lib/jass/version.rb +1 -1
  7. data/vendor/node_modules/@types/estree/index.d.ts +4 -2
  8. data/vendor/node_modules/@types/estree/package.json +2 -2
  9. data/vendor/node_modules/acorn/bin/_acorn.js +12 -12
  10. data/vendor/node_modules/acorn/bin/run_test262.js +2 -3
  11. data/vendor/node_modules/acorn/bin/test262.whitelist +0 -5
  12. data/vendor/node_modules/acorn/dist/acorn.es.js +76 -68
  13. data/vendor/node_modules/acorn/dist/acorn.js +76 -68
  14. data/vendor/node_modules/acorn/dist/acorn_loose.es.js +42 -30
  15. data/vendor/node_modules/acorn/dist/acorn_loose.js +42 -30
  16. data/vendor/node_modules/acorn/dist/walk.es.js +47 -43
  17. data/vendor/node_modules/acorn/dist/walk.js +47 -43
  18. data/vendor/node_modules/acorn/package.json +9 -5
  19. data/vendor/node_modules/chalk/index.js.flow +93 -0
  20. data/vendor/node_modules/chalk/package.json +8 -3
  21. data/vendor/node_modules/color-convert/conversions.js +36 -29
  22. data/vendor/node_modules/color-convert/package.json +4 -4
  23. data/vendor/node_modules/estree-walker/index.d.ts +17 -0
  24. data/vendor/node_modules/estree-walker/package.json +2 -1
  25. data/vendor/node_modules/fill-range/index.js +2 -2
  26. data/vendor/node_modules/fill-range/package.json +24 -7
  27. data/vendor/node_modules/is-reference/node_modules/@types/estree/index.d.ts +546 -0
  28. data/vendor/node_modules/is-reference/node_modules/@types/estree/package.json +22 -0
  29. data/vendor/node_modules/math-random/browser.js +17 -0
  30. data/vendor/node_modules/math-random/node.js +13 -0
  31. data/vendor/node_modules/math-random/package.json +31 -0
  32. data/vendor/node_modules/math-random/test.js +26 -0
  33. data/vendor/node_modules/nodent-compiler/compiler.js +115 -11
  34. data/vendor/node_modules/nodent-compiler/{lib/output.js → output.js} +0 -0
  35. data/vendor/node_modules/nodent-compiler/package.json +8 -4
  36. data/vendor/node_modules/{nodent-compiler/lib → nodent-transform}/arboriculture.js +1340 -1107
  37. data/vendor/node_modules/nodent-transform/package.json +19 -0
  38. data/vendor/node_modules/path-parse/package.json +1 -1
  39. data/vendor/node_modules/pretty-ms/index.js +2 -1
  40. data/vendor/node_modules/pretty-ms/package.json +2 -3
  41. data/vendor/node_modules/randomatic/index.js +12 -2
  42. data/vendor/node_modules/randomatic/node_modules/is-number/index.js +6 -7
  43. data/vendor/node_modules/randomatic/node_modules/is-number/package.json +9 -16
  44. data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +112 -102
  45. data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +18 -20
  46. data/vendor/node_modules/randomatic/package.json +15 -13
  47. data/vendor/node_modules/repeat-element/index.js +1 -1
  48. data/vendor/node_modules/repeat-element/package.json +27 -22
  49. data/vendor/node_modules/resolve/lib/async.js +20 -17
  50. data/vendor/node_modules/resolve/lib/core.js +2 -2
  51. data/vendor/node_modules/resolve/lib/core.json +4 -1
  52. data/vendor/node_modules/resolve/lib/sync.js +52 -13
  53. data/vendor/node_modules/resolve/package.json +3 -3
  54. data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +50 -12
  55. data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +50 -12
  56. data/vendor/node_modules/rollup-plugin-commonjs/package.json +2 -2
  57. data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +49 -11
  58. data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +1 -1
  59. data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +82 -85
  60. data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +82 -85
  61. data/vendor/node_modules/rollup-plugin-node-resolve/package.json +1 -1
  62. data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +81 -84
  63. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +81 -2
  64. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +81 -3
  65. data/vendor/node_modules/rollup-pluginutils/package.json +12 -6
  66. data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +10 -2
  67. data/vendor/node_modules/rollup-pluginutils/src/dataToEsm.js +69 -0
  68. data/vendor/node_modules/rollup-pluginutils/src/index.js +1 -0
  69. data/vendor/node_modules/supports-color/index.js +1 -5
  70. data/vendor/node_modules/supports-color/package.json +51 -51
  71. data/vendor/yarn.lock +65 -70
  72. metadata +16 -21
  73. data/vendor/node_modules/irregular-plurals/irregular-plurals.json +0 -146
  74. data/vendor/node_modules/irregular-plurals/package.json +0 -39
  75. data/vendor/node_modules/nodent-compiler/lib/parser.js +0 -291
  76. data/vendor/node_modules/path-parse/index.min.js +0 -1
  77. data/vendor/node_modules/path-parse/test.min.js +0 -1
  78. data/vendor/node_modules/plur/index.js +0 -20
  79. data/vendor/node_modules/plur/package.json +0 -42
  80. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +0 -116
  81. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +0 -90
  82. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +0 -217
  83. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +0 -55
  84. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +0 -59
  85. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +0 -65
  86. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +0 -33
  87. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +0 -49
@@ -0,0 +1,93 @@
1
+ // @flow
2
+
3
+ type TemplateStringsArray = $ReadOnlyArray<string>;
4
+
5
+ export type Level = $Values<{
6
+ None: 0,
7
+ Basic: 1,
8
+ Ansi256: 2,
9
+ TrueColor: 3
10
+ }>;
11
+
12
+ export type ChalkOptions = {|
13
+ enabled?: boolean,
14
+ level?: Level
15
+ |};
16
+
17
+ export type ColorSupport = {|
18
+ level: Level,
19
+ hasBasic: boolean,
20
+ has256: boolean,
21
+ has16m: boolean
22
+ |};
23
+
24
+ export interface Chalk {
25
+ (...text: string[]): string,
26
+ (text: TemplateStringsArray, ...placeholders: string[]): string,
27
+ constructor(options?: ChalkOptions): Chalk,
28
+ enabled: boolean,
29
+ level: Level,
30
+ rgb(r: number, g: number, b: number): Chalk,
31
+ hsl(h: number, s: number, l: number): Chalk,
32
+ hsv(h: number, s: number, v: number): Chalk,
33
+ hwb(h: number, w: number, b: number): Chalk,
34
+ bgHex(color: string): Chalk,
35
+ bgKeyword(color: string): Chalk,
36
+ bgRgb(r: number, g: number, b: number): Chalk,
37
+ bgHsl(h: number, s: number, l: number): Chalk,
38
+ bgHsv(h: number, s: number, v: number): Chalk,
39
+ bgHwb(h: number, w: number, b: number): Chalk,
40
+ hex(color: string): Chalk,
41
+ keyword(color: string): Chalk,
42
+
43
+ +reset: Chalk,
44
+ +bold: Chalk,
45
+ +dim: Chalk,
46
+ +italic: Chalk,
47
+ +underline: Chalk,
48
+ +inverse: Chalk,
49
+ +hidden: Chalk,
50
+ +strikethrough: Chalk,
51
+
52
+ +visible: Chalk,
53
+
54
+ +black: Chalk,
55
+ +red: Chalk,
56
+ +green: Chalk,
57
+ +yellow: Chalk,
58
+ +blue: Chalk,
59
+ +magenta: Chalk,
60
+ +cyan: Chalk,
61
+ +white: Chalk,
62
+ +gray: Chalk,
63
+ +grey: Chalk,
64
+ +blackBright: Chalk,
65
+ +redBright: Chalk,
66
+ +greenBright: Chalk,
67
+ +yellowBright: Chalk,
68
+ +blueBright: Chalk,
69
+ +magentaBright: Chalk,
70
+ +cyanBright: Chalk,
71
+ +whiteBright: Chalk,
72
+
73
+ +bgBlack: Chalk,
74
+ +bgRed: Chalk,
75
+ +bgGreen: Chalk,
76
+ +bgYellow: Chalk,
77
+ +bgBlue: Chalk,
78
+ +bgMagenta: Chalk,
79
+ +bgCyan: Chalk,
80
+ +bgWhite: Chalk,
81
+ +bgBlackBright: Chalk,
82
+ +bgRedBright: Chalk,
83
+ +bgGreenBright: Chalk,
84
+ +bgYellowBright: Chalk,
85
+ +bgBlueBright: Chalk,
86
+ +bgMagentaBright: Chalk,
87
+ +bgCyanBright: Chalk,
88
+ +bgWhiteBrigh: Chalk,
89
+
90
+ supportsColor: ColorSupport
91
+ };
92
+
93
+ declare module.exports: Chalk;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chalk",
3
- "version": "2.3.2",
3
+ "version": "2.4.1",
4
4
  "description": "Terminal string styling done right",
5
5
  "license": "MIT",
6
6
  "repository": "chalk/chalk",
@@ -8,14 +8,15 @@
8
8
  "node": ">=4"
9
9
  },
10
10
  "scripts": {
11
- "test": "xo && tsc --project types && nyc ava",
11
+ "test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava",
12
12
  "bench": "matcha benchmark.js",
13
13
  "coveralls": "nyc report --reporter=text-lcov | coveralls"
14
14
  },
15
15
  "files": [
16
16
  "index.js",
17
17
  "templates.js",
18
- "types/index.d.ts"
18
+ "types/index.d.ts",
19
+ "index.js.flow"
19
20
  ],
20
21
  "keywords": [
21
22
  "color",
@@ -49,6 +50,7 @@
49
50
  "ava": "*",
50
51
  "coveralls": "^3.0.0",
51
52
  "execa": "^0.9.0",
53
+ "flow-bin": "^0.68.0",
52
54
  "import-fresh": "^2.0.0",
53
55
  "matcha": "^0.7.0",
54
56
  "nyc": "^11.0.2",
@@ -61,6 +63,9 @@
61
63
  "envs": [
62
64
  "node",
63
65
  "mocha"
66
+ ],
67
+ "ignores": [
68
+ "test/_flow.js"
64
69
  ]
65
70
  }
66
71
  }
@@ -95,41 +95,48 @@ convert.rgb.hsl = function (rgb) {
95
95
  };
96
96
 
97
97
  convert.rgb.hsv = function (rgb) {
98
- var r = rgb[0];
99
- var g = rgb[1];
100
- var b = rgb[2];
101
- var min = Math.min(r, g, b);
102
- var max = Math.max(r, g, b);
103
- var delta = max - min;
98
+ var rdif;
99
+ var gdif;
100
+ var bdif;
104
101
  var h;
105
102
  var s;
106
- var v;
107
103
 
108
- if (max === 0) {
109
- s = 0;
104
+ var r = rgb[0] / 255;
105
+ var g = rgb[1] / 255;
106
+ var b = rgb[2] / 255;
107
+ var v = Math.max(r, g, b);
108
+ var diff = v - Math.min(r, g, b);
109
+ var diffc = function (c) {
110
+ return (v - c) / 6 / diff + 1 / 2;
111
+ };
112
+
113
+ if (diff === 0) {
114
+ h = s = 0;
110
115
  } else {
111
- s = (delta / max * 1000) / 10;
112
- }
113
-
114
- if (max === min) {
115
- h = 0;
116
- } else if (r === max) {
117
- h = (g - b) / delta;
118
- } else if (g === max) {
119
- h = 2 + (b - r) / delta;
120
- } else if (b === max) {
121
- h = 4 + (r - g) / delta;
122
- }
123
-
124
- h = Math.min(h * 60, 360);
125
-
126
- if (h < 0) {
127
- h += 360;
116
+ s = diff / v;
117
+ rdif = diffc(r);
118
+ gdif = diffc(g);
119
+ bdif = diffc(b);
120
+
121
+ if (r === v) {
122
+ h = bdif - gdif;
123
+ } else if (g === v) {
124
+ h = (1 / 3) + rdif - bdif;
125
+ } else if (b === v) {
126
+ h = (2 / 3) + gdif - rdif;
127
+ }
128
+ if (h < 0) {
129
+ h += 1;
130
+ } else if (h > 1) {
131
+ h -= 1;
132
+ }
128
133
  }
129
134
 
130
- v = ((max / 255) * 1000) / 10;
131
-
132
- return [h, s, v];
135
+ return [
136
+ h * 360,
137
+ s * 100,
138
+ v * 100
139
+ ];
133
140
  };
134
141
 
135
142
  convert.rgb.hwb = function (rgb) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "color-convert",
3
3
  "description": "Plain color conversion functions",
4
- "version": "1.9.1",
4
+ "version": "1.9.3",
5
5
  "author": "Heather Arthur <fayearthur@gmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": "Qix-/color-convert",
@@ -37,10 +37,10 @@
37
37
  }
38
38
  },
39
39
  "devDependencies": {
40
- "chalk": "^1.1.1",
41
- "xo": "^0.11.2"
40
+ "chalk": "1.1.1",
41
+ "xo": "0.11.2"
42
42
  },
43
43
  "dependencies": {
44
- "color-name": "^1.1.1"
44
+ "color-name": "1.1.3"
45
45
  }
46
46
  }
@@ -0,0 +1,17 @@
1
+ declare module "estree-walker" {
2
+ export interface Node {
3
+ start: number;
4
+ end: number;
5
+ type: string;
6
+ [propName: string]: any;
7
+ }
8
+
9
+ export type WalkerListener = (node: Node, parent?: Node, prop?: string, index?: number) => void;
10
+
11
+ export interface WalkerOptions {
12
+ enter?: WalkerListener;
13
+ leave?: WalkerListener;
14
+ }
15
+
16
+ export function walk(ast: Node, options: WalkerOptions): void;
17
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "estree-walker",
3
3
  "description": "Traverse an ESTree-compliant AST",
4
- "version": "0.5.1",
4
+ "version": "0.5.2",
5
5
  "author": "Rich Harris",
6
6
  "license": "MIT",
7
7
  "typings": "index.d.ts",
@@ -29,6 +29,7 @@
29
29
  "files": [
30
30
  "src",
31
31
  "dist",
32
+ "index.d.ts",
32
33
  "README.md"
33
34
  ]
34
35
  }
@@ -1,8 +1,8 @@
1
1
  /*!
2
2
  * fill-range <https://github.com/jonschlinkert/fill-range>
3
3
  *
4
- * Copyright (c) 2014-2015, Jon Schlinkert.
5
- * Licensed under the MIT License.
4
+ * Copyright (c) 2014-2018, Jon Schlinkert.
5
+ * Released under the MIT License.
6
6
  */
7
7
 
8
8
  'use strict';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fill-range",
3
3
  "description": "Fill in a range of numbers or letters, optionally passing an increment or multiplier to use.",
4
- "version": "2.2.3",
4
+ "version": "2.2.4",
5
5
  "homepage": "https://github.com/jonschlinkert/fill-range",
6
6
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
7
7
  "repository": "jonschlinkert/fill-range",
@@ -22,14 +22,15 @@
22
22
  "dependencies": {
23
23
  "is-number": "^2.1.0",
24
24
  "isobject": "^2.0.0",
25
- "randomatic": "^1.1.3",
25
+ "randomatic": "^3.0.0",
26
26
  "repeat-element": "^1.1.2",
27
27
  "repeat-string": "^1.5.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "benchmarked": "^0.1.3",
31
31
  "chalk": "^0.5.1",
32
- "should": "*"
32
+ "gulp-format-md": "^1.0.0",
33
+ "should": "^13.2.1"
33
34
  },
34
35
  "keywords": [
35
36
  "alpha",
@@ -38,6 +39,7 @@
38
39
  "brace",
39
40
  "expand",
40
41
  "expansion",
42
+ "fill",
41
43
  "glob",
42
44
  "match",
43
45
  "matches",
@@ -49,13 +51,28 @@
49
51
  "sh"
50
52
  ],
51
53
  "verb": {
54
+ "toc": true,
55
+ "layout": "default",
56
+ "tasks": [
57
+ "readme"
58
+ ],
59
+ "plugins": [
60
+ "gulp-format-md"
61
+ ],
52
62
  "related": {
53
63
  "list": [
54
- "micromatch",
55
- "expand-range",
56
64
  "braces",
57
- "is-glob"
65
+ "expand-range",
66
+ "is-glob",
67
+ "micromatch"
58
68
  ]
59
- }
69
+ },
70
+ "lint": {
71
+ "reflinks": true
72
+ },
73
+ "reflinks": [
74
+ "micromatch",
75
+ "randomatic"
76
+ ]
60
77
  }
61
78
  }
@@ -0,0 +1,546 @@
1
+ // Type definitions for ESTree AST specification
2
+ // Project: https://github.com/estree/estree
3
+ // Definitions by: RReverser <https://github.com/RReverser>
4
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+
6
+ // This definition file follows a somewhat unusual format. ESTree allows
7
+ // runtime type checks based on the `type` parameter. In order to explain this
8
+ // to typescript we want to use discriminated union types:
9
+ // https://github.com/Microsoft/TypeScript/pull/9163
10
+ //
11
+ // For ESTree this is a bit tricky because the high level interfaces like
12
+ // Node or Function are pulling double duty. We want to pass common fields down
13
+ // to the interfaces that extend them (like Identifier or
14
+ // ArrowFunctionExpression), but you can't extend a type union or enforce
15
+ // common fields on them. So we've split the high level interfaces into two
16
+ // types, a base type which passes down inhereted fields, and a type union of
17
+ // all types which extend the base type. Only the type union is exported, and
18
+ // the union is how other types refer to the collection of inheriting types.
19
+ //
20
+ // This makes the definitions file here somewhat more difficult to maintain,
21
+ // but it has the notable advantage of making ESTree much easier to use as
22
+ // an end user.
23
+
24
+ interface BaseNodeWithoutComments {
25
+ // Every leaf interface that extends BaseNode must specify a type property.
26
+ // The type property should be a string literal. For example, Identifier
27
+ // has: `type: "Identifier"`
28
+ type: string;
29
+ loc?: SourceLocation | null;
30
+ range?: [number, number];
31
+ }
32
+
33
+ interface BaseNode extends BaseNodeWithoutComments {
34
+ leadingComments?: Array<Comment>;
35
+ trailingComments?: Array<Comment>;
36
+ }
37
+
38
+ export type Node =
39
+ Identifier | Literal | Program | Function | SwitchCase | CatchClause |
40
+ VariableDeclarator | Statement | Expression | Property |
41
+ AssignmentProperty | Super | TemplateElement | SpreadElement | Pattern |
42
+ ClassBody | Class | MethodDefinition | ModuleDeclaration | ModuleSpecifier;
43
+
44
+ export interface Comment extends BaseNodeWithoutComments {
45
+ type: "Line" | "Block";
46
+ value: string;
47
+ }
48
+
49
+ interface SourceLocation {
50
+ source?: string | null;
51
+ start: Position;
52
+ end: Position;
53
+ }
54
+
55
+ export interface Position {
56
+ /** >= 1 */
57
+ line: number;
58
+ /** >= 0 */
59
+ column: number;
60
+ }
61
+
62
+ export interface Program extends BaseNode {
63
+ type: "Program";
64
+ sourceType: "script" | "module";
65
+ body: Array<Statement | ModuleDeclaration>;
66
+ comments?: Array<Comment>;
67
+ }
68
+
69
+ interface BaseFunction extends BaseNode {
70
+ params: Array<Pattern>;
71
+ generator?: boolean;
72
+ async?: boolean;
73
+ // The body is either BlockStatement or Expression because arrow functions
74
+ // can have a body that's either. FunctionDeclarations and
75
+ // FunctionExpressions have only BlockStatement bodies.
76
+ body: BlockStatement | Expression;
77
+ }
78
+
79
+ export type Function =
80
+ FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
81
+
82
+ export type Statement =
83
+ ExpressionStatement | BlockStatement | EmptyStatement |
84
+ DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement |
85
+ BreakStatement | ContinueStatement | IfStatement | SwitchStatement |
86
+ ThrowStatement | TryStatement | WhileStatement | DoWhileStatement |
87
+ ForStatement | ForInStatement | ForOfStatement | Declaration;
88
+
89
+ interface BaseStatement extends BaseNode { }
90
+
91
+ export interface EmptyStatement extends BaseStatement {
92
+ type: "EmptyStatement";
93
+ }
94
+
95
+ export interface BlockStatement extends BaseStatement {
96
+ type: "BlockStatement";
97
+ body: Array<Statement>;
98
+ innerComments?: Array<Comment>;
99
+ }
100
+
101
+ export interface ExpressionStatement extends BaseStatement {
102
+ type: "ExpressionStatement";
103
+ expression: Expression;
104
+ }
105
+
106
+ export interface IfStatement extends BaseStatement {
107
+ type: "IfStatement";
108
+ test: Expression;
109
+ consequent: Statement;
110
+ alternate?: Statement | null;
111
+ }
112
+
113
+ export interface LabeledStatement extends BaseStatement {
114
+ type: "LabeledStatement";
115
+ label: Identifier;
116
+ body: Statement;
117
+ }
118
+
119
+ export interface BreakStatement extends BaseStatement {
120
+ type: "BreakStatement";
121
+ label?: Identifier | null;
122
+ }
123
+
124
+ export interface ContinueStatement extends BaseStatement {
125
+ type: "ContinueStatement";
126
+ label?: Identifier | null;
127
+ }
128
+
129
+ export interface WithStatement extends BaseStatement {
130
+ type: "WithStatement";
131
+ object: Expression;
132
+ body: Statement;
133
+ }
134
+
135
+ export interface SwitchStatement extends BaseStatement {
136
+ type: "SwitchStatement";
137
+ discriminant: Expression;
138
+ cases: Array<SwitchCase>;
139
+ }
140
+
141
+ export interface ReturnStatement extends BaseStatement {
142
+ type: "ReturnStatement";
143
+ argument?: Expression | null;
144
+ }
145
+
146
+ export interface ThrowStatement extends BaseStatement {
147
+ type: "ThrowStatement";
148
+ argument: Expression;
149
+ }
150
+
151
+ export interface TryStatement extends BaseStatement {
152
+ type: "TryStatement";
153
+ block: BlockStatement;
154
+ handler?: CatchClause | null;
155
+ finalizer?: BlockStatement | null;
156
+ }
157
+
158
+ export interface WhileStatement extends BaseStatement {
159
+ type: "WhileStatement";
160
+ test: Expression;
161
+ body: Statement;
162
+ }
163
+
164
+ export interface DoWhileStatement extends BaseStatement {
165
+ type: "DoWhileStatement";
166
+ body: Statement;
167
+ test: Expression;
168
+ }
169
+
170
+ export interface ForStatement extends BaseStatement {
171
+ type: "ForStatement";
172
+ init?: VariableDeclaration | Expression | null;
173
+ test?: Expression | null;
174
+ update?: Expression | null;
175
+ body: Statement;
176
+ }
177
+
178
+ interface BaseForXStatement extends BaseStatement {
179
+ left: VariableDeclaration | Pattern;
180
+ right: Expression;
181
+ body: Statement;
182
+ }
183
+
184
+ export interface ForInStatement extends BaseForXStatement {
185
+ type: "ForInStatement";
186
+ }
187
+
188
+ export interface DebuggerStatement extends BaseStatement {
189
+ type: "DebuggerStatement";
190
+ }
191
+
192
+ export type Declaration =
193
+ FunctionDeclaration | VariableDeclaration | ClassDeclaration;
194
+
195
+ interface BaseDeclaration extends BaseStatement { }
196
+
197
+ export interface FunctionDeclaration extends BaseFunction, BaseDeclaration {
198
+ type: "FunctionDeclaration";
199
+ id: Identifier;
200
+ body: BlockStatement;
201
+ }
202
+
203
+ export interface VariableDeclaration extends BaseDeclaration {
204
+ type: "VariableDeclaration";
205
+ declarations: Array<VariableDeclarator>;
206
+ kind: "var" | "let" | "const";
207
+ }
208
+
209
+ export interface VariableDeclarator extends BaseNode {
210
+ type: "VariableDeclarator";
211
+ id: Pattern;
212
+ init?: Expression | null;
213
+ }
214
+
215
+ type Expression =
216
+ ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression |
217
+ ArrowFunctionExpression | YieldExpression | Literal | UnaryExpression |
218
+ UpdateExpression | BinaryExpression | AssignmentExpression |
219
+ LogicalExpression | MemberExpression | ConditionalExpression |
220
+ CallExpression | NewExpression | SequenceExpression | TemplateLiteral |
221
+ TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier |
222
+ AwaitExpression;
223
+
224
+ export interface BaseExpression extends BaseNode { }
225
+
226
+ export interface ThisExpression extends BaseExpression {
227
+ type: "ThisExpression";
228
+ }
229
+
230
+ export interface ArrayExpression extends BaseExpression {
231
+ type: "ArrayExpression";
232
+ elements: Array<Expression | SpreadElement>;
233
+ }
234
+
235
+ export interface ObjectExpression extends BaseExpression {
236
+ type: "ObjectExpression";
237
+ properties: Array<Property>;
238
+ }
239
+
240
+ export interface Property extends BaseNode {
241
+ type: "Property";
242
+ key: Expression;
243
+ value: Expression | Pattern; // Could be an AssignmentProperty
244
+ kind: "init" | "get" | "set";
245
+ method: boolean;
246
+ shorthand: boolean;
247
+ computed: boolean;
248
+ }
249
+
250
+ export interface FunctionExpression extends BaseFunction, BaseExpression {
251
+ id?: Identifier | null;
252
+ type: "FunctionExpression";
253
+ body: BlockStatement;
254
+ }
255
+
256
+ export interface SequenceExpression extends BaseExpression {
257
+ type: "SequenceExpression";
258
+ expressions: Array<Expression>;
259
+ }
260
+
261
+ export interface UnaryExpression extends BaseExpression {
262
+ type: "UnaryExpression";
263
+ operator: UnaryOperator;
264
+ prefix: true;
265
+ argument: Expression;
266
+ }
267
+
268
+ export interface BinaryExpression extends BaseExpression {
269
+ type: "BinaryExpression";
270
+ operator: BinaryOperator;
271
+ left: Expression;
272
+ right: Expression;
273
+ }
274
+
275
+ export interface AssignmentExpression extends BaseExpression {
276
+ type: "AssignmentExpression";
277
+ operator: AssignmentOperator;
278
+ left: Pattern | MemberExpression;
279
+ right: Expression;
280
+ }
281
+
282
+ export interface UpdateExpression extends BaseExpression {
283
+ type: "UpdateExpression";
284
+ operator: UpdateOperator;
285
+ argument: Expression;
286
+ prefix: boolean;
287
+ }
288
+
289
+ export interface LogicalExpression extends BaseExpression {
290
+ type: "LogicalExpression";
291
+ operator: LogicalOperator;
292
+ left: Expression;
293
+ right: Expression;
294
+ }
295
+
296
+ export interface ConditionalExpression extends BaseExpression {
297
+ type: "ConditionalExpression";
298
+ test: Expression;
299
+ alternate: Expression;
300
+ consequent: Expression;
301
+ }
302
+
303
+ interface BaseCallExpression extends BaseExpression {
304
+ callee: Expression | Super;
305
+ arguments: Array<Expression | SpreadElement>;
306
+ }
307
+ export type CallExpression = SimpleCallExpression | NewExpression;
308
+
309
+ export interface SimpleCallExpression extends BaseCallExpression {
310
+ type: "CallExpression";
311
+ }
312
+
313
+ export interface NewExpression extends BaseCallExpression {
314
+ type: "NewExpression";
315
+ }
316
+
317
+ export interface MemberExpression extends BaseExpression, BasePattern {
318
+ type: "MemberExpression";
319
+ object: Expression | Super;
320
+ property: Expression;
321
+ computed: boolean;
322
+ }
323
+
324
+ export type Pattern =
325
+ Identifier | ObjectPattern | ArrayPattern | RestElement |
326
+ AssignmentPattern | MemberExpression;
327
+
328
+ interface BasePattern extends BaseNode { }
329
+
330
+ export interface SwitchCase extends BaseNode {
331
+ type: "SwitchCase";
332
+ test?: Expression | null;
333
+ consequent: Array<Statement>;
334
+ }
335
+
336
+ export interface CatchClause extends BaseNode {
337
+ type: "CatchClause";
338
+ param: Pattern;
339
+ body: BlockStatement;
340
+ }
341
+
342
+ export interface Identifier extends BaseNode, BaseExpression, BasePattern {
343
+ type: "Identifier";
344
+ name: string;
345
+ }
346
+
347
+ export type Literal = SimpleLiteral | RegExpLiteral;
348
+
349
+ export interface SimpleLiteral extends BaseNode, BaseExpression {
350
+ type: "Literal";
351
+ value: string | boolean | number | null;
352
+ raw?: string;
353
+ }
354
+
355
+ export interface RegExpLiteral extends BaseNode, BaseExpression {
356
+ type: "Literal";
357
+ value?: RegExp | null;
358
+ regex: {
359
+ pattern: string;
360
+ flags: string;
361
+ };
362
+ raw?: string;
363
+ }
364
+
365
+ export type UnaryOperator =
366
+ "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
367
+
368
+ export type BinaryOperator =
369
+ "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" |
370
+ ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" |
371
+ "instanceof";
372
+
373
+ export type LogicalOperator = "||" | "&&";
374
+
375
+ export type AssignmentOperator =
376
+ "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" |
377
+ "|=" | "^=" | "&=";
378
+
379
+ export type UpdateOperator = "++" | "--";
380
+
381
+ export interface ForOfStatement extends BaseForXStatement {
382
+ type: "ForOfStatement";
383
+ }
384
+
385
+ export interface Super extends BaseNode {
386
+ type: "Super";
387
+ }
388
+
389
+ export interface SpreadElement extends BaseNode {
390
+ type: "SpreadElement";
391
+ argument: Expression;
392
+ }
393
+
394
+ export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
395
+ type: "ArrowFunctionExpression";
396
+ expression: boolean;
397
+ body: BlockStatement | Expression;
398
+ }
399
+
400
+ export interface YieldExpression extends BaseExpression {
401
+ type: "YieldExpression";
402
+ argument?: Expression | null;
403
+ delegate: boolean;
404
+ }
405
+
406
+ export interface TemplateLiteral extends BaseExpression {
407
+ type: "TemplateLiteral";
408
+ quasis: Array<TemplateElement>;
409
+ expressions: Array<Expression>;
410
+ }
411
+
412
+ export interface TaggedTemplateExpression extends BaseExpression {
413
+ type: "TaggedTemplateExpression";
414
+ tag: Expression;
415
+ quasi: TemplateLiteral;
416
+ }
417
+
418
+ export interface TemplateElement extends BaseNode {
419
+ type: "TemplateElement";
420
+ tail: boolean;
421
+ value: {
422
+ cooked: string;
423
+ raw: string;
424
+ };
425
+ }
426
+
427
+ export interface AssignmentProperty extends Property {
428
+ value: Pattern;
429
+ kind: "init";
430
+ method: boolean; // false
431
+ }
432
+
433
+ export interface ObjectPattern extends BasePattern {
434
+ type: "ObjectPattern";
435
+ properties: Array<AssignmentProperty>;
436
+ }
437
+
438
+ export interface ArrayPattern extends BasePattern {
439
+ type: "ArrayPattern";
440
+ elements: Array<Pattern>;
441
+ }
442
+
443
+ export interface RestElement extends BasePattern {
444
+ type: "RestElement";
445
+ argument: Pattern;
446
+ }
447
+
448
+ export interface AssignmentPattern extends BasePattern {
449
+ type: "AssignmentPattern";
450
+ left: Pattern;
451
+ right: Expression;
452
+ }
453
+
454
+ export type Class = ClassDeclaration | ClassExpression;
455
+ interface BaseClass extends BaseNode {
456
+ superClass?: Expression | null;
457
+ body: ClassBody;
458
+ }
459
+
460
+ export interface ClassBody extends BaseNode {
461
+ type: "ClassBody";
462
+ body: Array<MethodDefinition>;
463
+ }
464
+
465
+ export interface MethodDefinition extends BaseNode {
466
+ type: "MethodDefinition";
467
+ key: Expression;
468
+ value: FunctionExpression;
469
+ kind: "constructor" | "method" | "get" | "set";
470
+ computed: boolean;
471
+ static: boolean;
472
+ }
473
+
474
+ export interface ClassDeclaration extends BaseClass, BaseDeclaration {
475
+ type: "ClassDeclaration";
476
+ id: Identifier;
477
+ }
478
+
479
+ export interface ClassExpression extends BaseClass, BaseExpression {
480
+ type: "ClassExpression";
481
+ id?: Identifier | null;
482
+ }
483
+
484
+ export interface MetaProperty extends BaseExpression {
485
+ type: "MetaProperty";
486
+ meta: Identifier;
487
+ property: Identifier;
488
+ }
489
+
490
+ export type ModuleDeclaration =
491
+ ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration |
492
+ ExportAllDeclaration;
493
+ interface BaseModuleDeclaration extends BaseNode { }
494
+
495
+ export type ModuleSpecifier =
496
+ ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier |
497
+ ExportSpecifier;
498
+ interface BaseModuleSpecifier extends BaseNode {
499
+ local: Identifier;
500
+ }
501
+
502
+ export interface ImportDeclaration extends BaseModuleDeclaration {
503
+ type: "ImportDeclaration";
504
+ specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
505
+ source: Literal;
506
+ }
507
+
508
+ export interface ImportSpecifier extends BaseModuleSpecifier {
509
+ type: "ImportSpecifier";
510
+ imported: Identifier;
511
+ }
512
+
513
+ export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
514
+ type: "ImportDefaultSpecifier";
515
+ }
516
+
517
+ export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
518
+ type: "ImportNamespaceSpecifier";
519
+ }
520
+
521
+ export interface ExportNamedDeclaration extends BaseModuleDeclaration {
522
+ type: "ExportNamedDeclaration";
523
+ declaration?: Declaration | null;
524
+ specifiers: Array<ExportSpecifier>;
525
+ source?: Literal | null;
526
+ }
527
+
528
+ export interface ExportSpecifier extends BaseModuleSpecifier {
529
+ type: "ExportSpecifier";
530
+ exported: Identifier;
531
+ }
532
+
533
+ export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
534
+ type: "ExportDefaultDeclaration";
535
+ declaration: Declaration | Expression;
536
+ }
537
+
538
+ export interface ExportAllDeclaration extends BaseModuleDeclaration {
539
+ type: "ExportAllDeclaration";
540
+ source: Literal;
541
+ }
542
+
543
+ export interface AwaitExpression extends BaseExpression {
544
+ type: "AwaitExpression";
545
+ argument: Expression;
546
+ }