@zipify/wysiwyg 1.1.0-2 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/wysiwyg.mjs +10 -17
  3. package/lib/extensions/Alignment.js +10 -8
  4. package/lib/extensions/FontSize.js +8 -3
  5. package/lib/extensions/LineHeight.js +10 -4
  6. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +3 -3
  7. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +9 -9
  8. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +5 -5
  9. package/lib/services/NodeFactory.js +4 -1
  10. package/node_modules_lambda/acorn-globals/node_modules/.bin/acorn +4 -0
  11. package/node_modules_lambda/acorn-globals/node_modules/acorn/CHANGELOG.md +620 -0
  12. package/node_modules_lambda/acorn-globals/node_modules/acorn/LICENSE +21 -0
  13. package/node_modules_lambda/acorn-globals/node_modules/acorn/README.md +269 -0
  14. package/node_modules_lambda/acorn-globals/node_modules/acorn/bin/acorn +4 -0
  15. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.d.ts +209 -0
  16. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js +5186 -0
  17. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js.map +1 -0
  18. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs +5155 -0
  19. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.d.ts +2 -0
  20. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.map +1 -0
  21. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/bin.js +64 -0
  22. package/node_modules_lambda/acorn-globals/node_modules/acorn/package.json +35 -0
  23. package/node_modules_lambda/cssstyle/node_modules/cssom/LICENSE.txt +20 -0
  24. package/node_modules_lambda/cssstyle/node_modules/cssom/README.mdown +67 -0
  25. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSDocumentRule.js +39 -0
  26. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSFontFaceRule.js +36 -0
  27. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSHostRule.js +37 -0
  28. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSImportRule.js +132 -0
  29. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframeRule.js +37 -0
  30. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframesRule.js +39 -0
  31. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSMediaRule.js +41 -0
  32. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSOM.js +3 -0
  33. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSRule.js +43 -0
  34. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleDeclaration.js +148 -0
  35. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleRule.js +190 -0
  36. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleSheet.js +88 -0
  37. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSSupportsRule.js +36 -0
  38. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValue.js +43 -0
  39. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValueExpression.js +344 -0
  40. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MatcherList.js +62 -0
  41. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MediaList.js +61 -0
  42. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/StyleSheet.js +17 -0
  43. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/clone.js +82 -0
  44. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/index.js +21 -0
  45. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/parse.js +464 -0
  46. package/node_modules_lambda/cssstyle/node_modules/cssom/package.json +18 -0
  47. package/node_modules_lambda/data-urls/node_modules/whatwg-url/LICENSE.txt +21 -0
  48. package/node_modules_lambda/data-urls/node_modules/whatwg-url/README.md +106 -0
  49. package/node_modules_lambda/data-urls/node_modules/whatwg-url/index.js +27 -0
  50. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/Function.js +42 -0
  51. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL-impl.js +209 -0
  52. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL.js +442 -0
  53. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams-impl.js +130 -0
  54. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams.js +472 -0
  55. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/VoidFunction.js +26 -0
  56. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/encoding.js +16 -0
  57. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/infra.js +26 -0
  58. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/percent-encoding.js +142 -0
  59. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/url-state-machine.js +1244 -0
  60. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/urlencoded.js +106 -0
  61. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/utils.js +190 -0
  62. package/node_modules_lambda/data-urls/node_modules/whatwg-url/package.json +58 -0
  63. package/node_modules_lambda/data-urls/node_modules/whatwg-url/webidl2js-wrapper.js +7 -0
  64. package/node_modules_lambda/escodegen/node_modules/estraverse/.jshintrc +16 -0
  65. package/node_modules_lambda/escodegen/node_modules/estraverse/LICENSE.BSD +19 -0
  66. package/node_modules_lambda/escodegen/node_modules/estraverse/README.md +153 -0
  67. package/node_modules_lambda/escodegen/node_modules/estraverse/estraverse.js +805 -0
  68. package/node_modules_lambda/escodegen/node_modules/estraverse/gulpfile.js +70 -0
  69. package/node_modules_lambda/escodegen/node_modules/estraverse/package.json +40 -0
  70. package/node_modules_lambda/escodegen/node_modules/levn/LICENSE +22 -0
  71. package/node_modules_lambda/escodegen/node_modules/levn/README.md +196 -0
  72. package/node_modules_lambda/escodegen/node_modules/levn/lib/cast.js +298 -0
  73. package/node_modules_lambda/escodegen/node_modules/levn/lib/coerce.js +285 -0
  74. package/node_modules_lambda/escodegen/node_modules/levn/lib/index.js +22 -0
  75. package/node_modules_lambda/escodegen/node_modules/levn/lib/parse-string.js +113 -0
  76. package/node_modules_lambda/escodegen/node_modules/levn/lib/parse.js +102 -0
  77. package/node_modules_lambda/escodegen/node_modules/levn/package.json +47 -0
  78. package/node_modules_lambda/escodegen/node_modules/optionator/CHANGELOG.md +56 -0
  79. package/node_modules_lambda/escodegen/node_modules/optionator/LICENSE +22 -0
  80. package/node_modules_lambda/escodegen/node_modules/optionator/README.md +238 -0
  81. package/node_modules_lambda/escodegen/node_modules/optionator/lib/help.js +260 -0
  82. package/node_modules_lambda/escodegen/node_modules/optionator/lib/index.js +465 -0
  83. package/node_modules_lambda/escodegen/node_modules/optionator/lib/util.js +54 -0
  84. package/node_modules_lambda/escodegen/node_modules/optionator/package.json +44 -0
  85. package/node_modules_lambda/escodegen/node_modules/prelude-ls/CHANGELOG.md +99 -0
  86. package/node_modules_lambda/escodegen/node_modules/prelude-ls/LICENSE +22 -0
  87. package/node_modules_lambda/escodegen/node_modules/prelude-ls/README.md +15 -0
  88. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Func.js +65 -0
  89. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/List.js +686 -0
  90. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Num.js +130 -0
  91. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Obj.js +154 -0
  92. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Str.js +92 -0
  93. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/index.js +178 -0
  94. package/node_modules_lambda/escodegen/node_modules/prelude-ls/package.json +52 -0
  95. package/node_modules_lambda/escodegen/node_modules/source-map/CHANGELOG.md +301 -0
  96. package/node_modules_lambda/escodegen/node_modules/source-map/LICENSE +28 -0
  97. package/node_modules_lambda/escodegen/node_modules/source-map/README.md +742 -0
  98. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.debug.js +3234 -0
  99. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.js +3233 -0
  100. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js +2 -0
  101. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js.map +1 -0
  102. package/node_modules_lambda/escodegen/node_modules/source-map/lib/array-set.js +121 -0
  103. package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64-vlq.js +140 -0
  104. package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64.js +67 -0
  105. package/node_modules_lambda/escodegen/node_modules/source-map/lib/binary-search.js +111 -0
  106. package/node_modules_lambda/escodegen/node_modules/source-map/lib/mapping-list.js +79 -0
  107. package/node_modules_lambda/escodegen/node_modules/source-map/lib/quick-sort.js +114 -0
  108. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-consumer.js +1145 -0
  109. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-generator.js +425 -0
  110. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-node.js +413 -0
  111. package/node_modules_lambda/escodegen/node_modules/source-map/lib/util.js +488 -0
  112. package/node_modules_lambda/escodegen/node_modules/source-map/package.json +73 -0
  113. package/node_modules_lambda/escodegen/node_modules/source-map/source-map.d.ts +98 -0
  114. package/node_modules_lambda/escodegen/node_modules/source-map/source-map.js +8 -0
  115. package/node_modules_lambda/escodegen/node_modules/type-check/LICENSE +22 -0
  116. package/node_modules_lambda/escodegen/node_modules/type-check/README.md +210 -0
  117. package/node_modules_lambda/escodegen/node_modules/type-check/lib/check.js +126 -0
  118. package/node_modules_lambda/escodegen/node_modules/type-check/lib/index.js +16 -0
  119. package/node_modules_lambda/escodegen/node_modules/type-check/lib/parse-type.js +196 -0
  120. package/node_modules_lambda/escodegen/node_modules/type-check/package.json +40 -0
  121. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/.github/dependabot.yml +11 -0
  122. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/Changelog.md +212 -0
  123. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/LICENSE +21 -0
  124. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/README.md +130 -0
  125. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-codec.js +597 -0
  126. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-data.js +188 -0
  127. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/index.js +23 -0
  128. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/internal.js +198 -0
  129. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
  130. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  131. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data.js +179 -0
  132. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  133. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  134. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  135. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  136. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  137. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  138. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  139. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  140. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf16.js +197 -0
  141. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf32.js +319 -0
  142. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf7.js +290 -0
  143. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/bom-handling.js +52 -0
  144. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.d.ts +41 -0
  145. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.js +180 -0
  146. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/streams.js +109 -0
  147. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/package.json +44 -0
  148. package/package.json +1 -1
@@ -0,0 +1,269 @@
1
+ # Acorn
2
+
3
+ A tiny, fast JavaScript parser written in JavaScript.
4
+
5
+ ## Community
6
+
7
+ Acorn is open source software released under an
8
+ [MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
9
+
10
+ You are welcome to
11
+ [report bugs](https://github.com/acornjs/acorn/issues) or create pull
12
+ requests on [github](https://github.com/acornjs/acorn). For questions
13
+ and discussion, please use the
14
+ [Tern discussion forum](https://discuss.ternjs.net).
15
+
16
+ ## Installation
17
+
18
+ The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
19
+
20
+ ```sh
21
+ npm install acorn
22
+ ```
23
+
24
+ Alternately, you can download the source and build acorn yourself:
25
+
26
+ ```sh
27
+ git clone https://github.com/acornjs/acorn.git
28
+ cd acorn
29
+ npm install
30
+ ```
31
+
32
+ ## Interface
33
+
34
+ **parse**`(input, options)` is the main interface to the library. The
35
+ `input` parameter is a string, `options` can be undefined or an object
36
+ setting some of the options listed below. The return value will be an
37
+ abstract syntax tree object as specified by the [ESTree
38
+ spec](https://github.com/estree/estree).
39
+
40
+ ```javascript
41
+ let acorn = require("acorn");
42
+ console.log(acorn.parse("1 + 1"));
43
+ ```
44
+
45
+ When encountering a syntax error, the parser will raise a
46
+ `SyntaxError` object with a meaningful message. The error object will
47
+ have a `pos` property that indicates the string offset at which the
48
+ error occurred, and a `loc` object that contains a `{line, column}`
49
+ object referring to that same position.
50
+
51
+ Options can be provided by passing a second argument, which should be
52
+ an object containing any of these fields:
53
+
54
+ - **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
55
+ either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019) or 11
56
+ (2020, partial support). This influences support for strict mode,
57
+ the set of reserved words, and support for new syntax features.
58
+ Default is 10.
59
+
60
+ **NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
61
+ implemented by Acorn. Other proposed new features can be implemented
62
+ through plugins.
63
+
64
+ - **sourceType**: Indicate the mode the code should be parsed in. Can be
65
+ either `"script"` or `"module"`. This influences global strict mode
66
+ and parsing of `import` and `export` declarations.
67
+
68
+ **NOTE**: If set to `"module"`, then static `import` / `export` syntax
69
+ will be valid, even if `ecmaVersion` is less than 6.
70
+
71
+ - **onInsertedSemicolon**: If given a callback, that callback will be
72
+ called whenever a missing semicolon is inserted by the parser. The
73
+ callback will be given the character offset of the point where the
74
+ semicolon is inserted as argument, and if `locations` is on, also a
75
+ `{line, column}` object representing this position.
76
+
77
+ - **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
78
+ commas.
79
+
80
+ - **allowReserved**: If `false`, using a reserved word will generate
81
+ an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
82
+ versions. When given the value `"never"`, reserved words and
83
+ keywords can also not be used as property names (as in Internet
84
+ Explorer's old parser).
85
+
86
+ - **allowReturnOutsideFunction**: By default, a return statement at
87
+ the top level raises an error. Set this to `true` to accept such
88
+ code.
89
+
90
+ - **allowImportExportEverywhere**: By default, `import` and `export`
91
+ declarations can only appear at a program's top level. Setting this
92
+ option to `true` allows them anywhere where a statement is allowed.
93
+
94
+ - **allowAwaitOutsideFunction**: By default, `await` expressions can
95
+ only appear inside `async` functions. Setting this option to
96
+ `true` allows to have top-level `await` expressions. They are
97
+ still not allowed in non-`async` functions, though.
98
+
99
+ - **allowHashBang**: When this is enabled (off by default), if the
100
+ code starts with the characters `#!` (as in a shellscript), the
101
+ first line will be treated as a comment.
102
+
103
+ - **locations**: When `true`, each node has a `loc` object attached
104
+ with `start` and `end` subobjects, each of which contains the
105
+ one-based line and zero-based column numbers in `{line, column}`
106
+ form. Default is `false`.
107
+
108
+ - **onToken**: If a function is passed for this option, each found
109
+ token will be passed in same format as tokens returned from
110
+ `tokenizer().getToken()`.
111
+
112
+ If array is passed, each found token is pushed to it.
113
+
114
+ Note that you are not allowed to call the parser from the
115
+ callback—that will corrupt its internal state.
116
+
117
+ - **onComment**: If a function is passed for this option, whenever a
118
+ comment is encountered the function will be called with the
119
+ following parameters:
120
+
121
+ - `block`: `true` if the comment is a block comment, false if it
122
+ is a line comment.
123
+ - `text`: The content of the comment.
124
+ - `start`: Character offset of the start of the comment.
125
+ - `end`: Character offset of the end of the comment.
126
+
127
+ When the `locations` options is on, the `{line, column}` locations
128
+ of the comment’s start and end are passed as two additional
129
+ parameters.
130
+
131
+ If array is passed for this option, each found comment is pushed
132
+ to it as object in Esprima format:
133
+
134
+ ```javascript
135
+ {
136
+ "type": "Line" | "Block",
137
+ "value": "comment text",
138
+ "start": Number,
139
+ "end": Number,
140
+ // If `locations` option is on:
141
+ "loc": {
142
+ "start": {line: Number, column: Number}
143
+ "end": {line: Number, column: Number}
144
+ },
145
+ // If `ranges` option is on:
146
+ "range": [Number, Number]
147
+ }
148
+ ```
149
+
150
+ Note that you are not allowed to call the parser from the
151
+ callback—that will corrupt its internal state.
152
+
153
+ - **ranges**: Nodes have their start and end characters offsets
154
+ recorded in `start` and `end` properties (directly on the node,
155
+ rather than the `loc` object, which holds line/column data. To also
156
+ add a
157
+ [semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
158
+ `range` property holding a `[start, end]` array with the same
159
+ numbers, set the `ranges` option to `true`.
160
+
161
+ - **program**: It is possible to parse multiple files into a single
162
+ AST by passing the tree produced by parsing the first file as the
163
+ `program` option in subsequent parses. This will add the toplevel
164
+ forms of the parsed file to the "Program" (top) node of an existing
165
+ parse tree.
166
+
167
+ - **sourceFile**: When the `locations` option is `true`, you can pass
168
+ this option to add a `source` attribute in every node’s `loc`
169
+ object. Note that the contents of this option are not examined or
170
+ processed in any way; you are free to use whatever format you
171
+ choose.
172
+
173
+ - **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
174
+ will be added (regardless of the `location` option) directly to the
175
+ nodes, rather than the `loc` object.
176
+
177
+ - **preserveParens**: If this option is `true`, parenthesized expressions
178
+ are represented by (non-standard) `ParenthesizedExpression` nodes
179
+ that have a single `expression` property containing the expression
180
+ inside parentheses.
181
+
182
+ **parseExpressionAt**`(input, offset, options)` will parse a single
183
+ expression in a string, and return its AST. It will not complain if
184
+ there is more of the string left after the expression.
185
+
186
+ **tokenizer**`(input, options)` returns an object with a `getToken`
187
+ method that can be called repeatedly to get the next token, a `{start,
188
+ end, type, value}` object (with added `loc` property when the
189
+ `locations` option is enabled and `range` property when the `ranges`
190
+ option is enabled). When the token's type is `tokTypes.eof`, you
191
+ should stop calling the method, since it will keep returning that same
192
+ token forever.
193
+
194
+ In ES6 environment, returned result can be used as any other
195
+ protocol-compliant iterable:
196
+
197
+ ```javascript
198
+ for (let token of acorn.tokenizer(str)) {
199
+ // iterate over the tokens
200
+ }
201
+
202
+ // transform code to array of tokens:
203
+ var tokens = [...acorn.tokenizer(str)];
204
+ ```
205
+
206
+ **tokTypes** holds an object mapping names to the token type objects
207
+ that end up in the `type` properties of tokens.
208
+
209
+ **getLineInfo**`(input, offset)` can be used to get a `{line,
210
+ column}` object for a given program string and offset.
211
+
212
+ ### The `Parser` class
213
+
214
+ Instances of the **`Parser`** class contain all the state and logic
215
+ that drives a parse. It has static methods `parse`,
216
+ `parseExpressionAt`, and `tokenizer` that match the top-level
217
+ functions by the same name.
218
+
219
+ When extending the parser with plugins, you need to call these methods
220
+ on the extended version of the class. To extend a parser with plugins,
221
+ you can use its static `extend` method.
222
+
223
+ ```javascript
224
+ var acorn = require("acorn");
225
+ var jsx = require("acorn-jsx");
226
+ var JSXParser = acorn.Parser.extend(jsx());
227
+ JSXParser.parse("foo(<bar/>)");
228
+ ```
229
+
230
+ The `extend` method takes any number of plugin values, and returns a
231
+ new `Parser` class that includes the extra parser logic provided by
232
+ the plugins.
233
+
234
+ ## Command line interface
235
+
236
+ The `bin/acorn` utility can be used to parse a file from the command
237
+ line. It accepts as arguments its input file and the following
238
+ options:
239
+
240
+ - `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
241
+ to parse. Default is version 9.
242
+
243
+ - `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
244
+
245
+ - `--locations`: Attaches a "loc" object to each node with "start" and
246
+ "end" subobjects, each of which contains the one-based line and
247
+ zero-based column numbers in `{line, column}` form.
248
+
249
+ - `--allow-hash-bang`: If the code starts with the characters #! (as
250
+ in a shellscript), the first line will be treated as a comment.
251
+
252
+ - `--compact`: No whitespace is used in the AST output.
253
+
254
+ - `--silent`: Do not output the AST, just return the exit status.
255
+
256
+ - `--help`: Print the usage information and quit.
257
+
258
+ The utility spits out the syntax tree as JSON data.
259
+
260
+ ## Existing plugins
261
+
262
+ - [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
263
+
264
+ Plugins for ECMAScript proposals:
265
+
266
+ - [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
267
+ - [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
268
+ - [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
269
+ - [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ require('../dist/bin.js');
@@ -0,0 +1,209 @@
1
+ export as namespace acorn
2
+ export = acorn
3
+
4
+ declare namespace acorn {
5
+ function parse(input: string, options?: Options): Node
6
+
7
+ function parseExpressionAt(input: string, pos?: number, options?: Options): Node
8
+
9
+ function tokenizer(input: string, options?: Options): {
10
+ getToken(): Token
11
+ [Symbol.iterator](): Iterator<Token>
12
+ }
13
+
14
+ interface Options {
15
+ ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
16
+ sourceType?: 'script' | 'module'
17
+ onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
18
+ onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
19
+ allowReserved?: boolean | 'never'
20
+ allowReturnOutsideFunction?: boolean
21
+ allowImportExportEverywhere?: boolean
22
+ allowAwaitOutsideFunction?: boolean
23
+ allowHashBang?: boolean
24
+ locations?: boolean
25
+ onToken?: ((token: Token) => any) | Token[]
26
+ onComment?: ((
27
+ isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
28
+ endLoc?: Position
29
+ ) => void) | Comment[]
30
+ ranges?: boolean
31
+ program?: Node
32
+ sourceFile?: string
33
+ directSourceFile?: string
34
+ preserveParens?: boolean
35
+ }
36
+
37
+ class Parser {
38
+ constructor(options: Options, input: string, startPos?: number)
39
+ parse(this: Parser): Node
40
+ static parse(this: typeof Parser, input: string, options?: Options): Node
41
+ static parseExpressionAt(this: typeof Parser, input: string, pos: number, options?: Options): Node
42
+ static tokenizer(this: typeof Parser, input: string, options?: Options): {
43
+ getToken(): Token
44
+ [Symbol.iterator](): Iterator<Token>
45
+ }
46
+ static extend(this: typeof Parser, ...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
47
+ }
48
+
49
+ interface Position { line: number; column: number; offset: number }
50
+
51
+ const defaultOptions: Options
52
+
53
+ function getLineInfo(input: string, offset: number): Position
54
+
55
+ class SourceLocation {
56
+ start: Position
57
+ end: Position
58
+ source?: string | null
59
+ constructor(p: Parser, start: Position, end: Position)
60
+ }
61
+
62
+ class Node {
63
+ type: string
64
+ start: number
65
+ end: number
66
+ loc?: SourceLocation
67
+ sourceFile?: string
68
+ range?: [number, number]
69
+ constructor(parser: Parser, pos: number, loc?: SourceLocation)
70
+ }
71
+
72
+ class TokenType {
73
+ label: string
74
+ keyword: string
75
+ beforeExpr: boolean
76
+ startsExpr: boolean
77
+ isLoop: boolean
78
+ isAssign: boolean
79
+ prefix: boolean
80
+ postfix: boolean
81
+ binop: number
82
+ updateContext?: (prevType: TokenType) => void
83
+ constructor(label: string, conf?: any)
84
+ }
85
+
86
+ const tokTypes: {
87
+ num: TokenType
88
+ regexp: TokenType
89
+ string: TokenType
90
+ name: TokenType
91
+ eof: TokenType
92
+ bracketL: TokenType
93
+ bracketR: TokenType
94
+ braceL: TokenType
95
+ braceR: TokenType
96
+ parenL: TokenType
97
+ parenR: TokenType
98
+ comma: TokenType
99
+ semi: TokenType
100
+ colon: TokenType
101
+ dot: TokenType
102
+ question: TokenType
103
+ arrow: TokenType
104
+ template: TokenType
105
+ ellipsis: TokenType
106
+ backQuote: TokenType
107
+ dollarBraceL: TokenType
108
+ eq: TokenType
109
+ assign: TokenType
110
+ incDec: TokenType
111
+ prefix: TokenType
112
+ logicalOR: TokenType
113
+ logicalAND: TokenType
114
+ bitwiseOR: TokenType
115
+ bitwiseXOR: TokenType
116
+ bitwiseAND: TokenType
117
+ equality: TokenType
118
+ relational: TokenType
119
+ bitShift: TokenType
120
+ plusMin: TokenType
121
+ modulo: TokenType
122
+ star: TokenType
123
+ slash: TokenType
124
+ starstar: TokenType
125
+ _break: TokenType
126
+ _case: TokenType
127
+ _catch: TokenType
128
+ _continue: TokenType
129
+ _debugger: TokenType
130
+ _default: TokenType
131
+ _do: TokenType
132
+ _else: TokenType
133
+ _finally: TokenType
134
+ _for: TokenType
135
+ _function: TokenType
136
+ _if: TokenType
137
+ _return: TokenType
138
+ _switch: TokenType
139
+ _throw: TokenType
140
+ _try: TokenType
141
+ _var: TokenType
142
+ _const: TokenType
143
+ _while: TokenType
144
+ _with: TokenType
145
+ _new: TokenType
146
+ _this: TokenType
147
+ _super: TokenType
148
+ _class: TokenType
149
+ _extends: TokenType
150
+ _export: TokenType
151
+ _import: TokenType
152
+ _null: TokenType
153
+ _true: TokenType
154
+ _false: TokenType
155
+ _in: TokenType
156
+ _instanceof: TokenType
157
+ _typeof: TokenType
158
+ _void: TokenType
159
+ _delete: TokenType
160
+ }
161
+
162
+ class TokContext {
163
+ constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
164
+ }
165
+
166
+ const tokContexts: {
167
+ b_stat: TokContext
168
+ b_expr: TokContext
169
+ b_tmpl: TokContext
170
+ p_stat: TokContext
171
+ p_expr: TokContext
172
+ q_tmpl: TokContext
173
+ f_expr: TokContext
174
+ }
175
+
176
+ function isIdentifierStart(code: number, astral?: boolean): boolean
177
+
178
+ function isIdentifierChar(code: number, astral?: boolean): boolean
179
+
180
+ interface AbstractToken {
181
+ }
182
+
183
+ interface Comment extends AbstractToken {
184
+ type: string
185
+ value: string
186
+ start: number
187
+ end: number
188
+ loc?: SourceLocation
189
+ range?: [number, number]
190
+ }
191
+
192
+ class Token {
193
+ type: TokenType
194
+ value: any
195
+ start: number
196
+ end: number
197
+ loc?: SourceLocation
198
+ range?: [number, number]
199
+ constructor(p: Parser)
200
+ }
201
+
202
+ function isNewLine(code: number): boolean
203
+
204
+ const lineBreak: RegExp
205
+
206
+ const lineBreakG: RegExp
207
+
208
+ const version: string
209
+ }