@yanglaofish/fishtools 0.3.0 → 0.5.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.
Files changed (247) hide show
  1. package/README.md +33 -5
  2. package/bin/fst.js +1 -1
  3. package/manual/README.md +33 -5
  4. package/manual/docs/deployment.md +3 -3
  5. package/manual/docs/examples/script-plugin/LICENSE +21 -0
  6. package/manual/docs/examples/script-plugin/README.md +64 -0
  7. package/manual/docs/examples/script-plugin/index.js +39 -0
  8. package/manual/docs/examples/script-plugin/package.json +9 -0
  9. package/manual/docs/examples/script-plugin/scripts/benchmark.py +23 -0
  10. package/manual/docs/kernel-generation.md +97 -0
  11. package/manual/docs/modules.md +57 -0
  12. package/manual/docs/plugin-development.md +163 -12
  13. package/manual/docs/releases.md +23 -0
  14. package/manual/docs/research/2026-10-11-plugin-kernel-capabilities.md +6 -6
  15. package/manual/docs/roadmap.md +16 -3
  16. package/manual/docs/superpowers/plans/2026-10-09-workflow-mvp.md +5 -5
  17. package/manual/docs/superpowers/plans/2026-10-11-public-plugin-fixes.md +2 -2
  18. package/manual/docs/superpowers/plans/2026-10-12-kernel-generation.md +22 -0
  19. package/manual/docs/superpowers/plans/2026-10-12-modular-kernel.md +40 -0
  20. package/manual/docs/superpowers/plans/2026-10-12-plugin-developer-experience.md +50 -0
  21. package/manual/docs/superpowers/reviews/2026-10-12-kernel-generation-review.md +27 -0
  22. package/manual/docs/superpowers/reviews/2026-10-12-modular-kernel-review.md +32 -0
  23. package/manual/docs/superpowers/reviews/2026-10-12-plugin-release-review.md +20 -0
  24. package/manual/docs/superpowers/reviews/2026-10-13-kernel-runtime-release-review.md +19 -0
  25. package/manual/docs/superpowers/specs/2026-10-12-action-network-policy-design.md +52 -0
  26. package/manual/docs/superpowers/specs/2026-10-12-kernel-generation-design.md +38 -0
  27. package/manual/docs/superpowers/specs/2026-10-12-modular-kernel-design.md +70 -0
  28. package/manual/docs/superpowers/specs/2026-10-12-plugin-developer-experience.md +22 -0
  29. package/manual/docs/superpowers/specs/2026-10-12-plugin-readiness-design.md +21 -0
  30. package/manual/docs/superpowers/specs/2026-10-12-runtime-maintenance-granularity-design.md +35 -0
  31. package/manual/docs/superpowers/specs/2026-10-12-workflow-variation-design.md +19 -0
  32. package/manual/docs/verification.md +58 -1
  33. package/manual/packages/core/README.md +44 -0
  34. package/manual/packages/core/package.json +38 -0
  35. package/manual/packages/core/src/application.js +268 -87
  36. package/manual/packages/core/src/bundle.js +2 -0
  37. package/manual/packages/core/src/development-watch-worker.js +69 -0
  38. package/manual/packages/core/src/development.js +146 -0
  39. package/manual/packages/core/src/environments.js +2 -0
  40. package/manual/packages/core/src/export-snapshot.js +42 -0
  41. package/manual/packages/core/src/plugin-update.js +108 -0
  42. package/manual/packages/core/src/process.js +2 -0
  43. package/manual/packages/core/src/resources.js +31 -0
  44. package/manual/packages/core/src/version.js +2 -0
  45. package/manual/packages/fst-cli/LICENSE +21 -0
  46. package/manual/packages/fst-cli/README.md +54 -0
  47. package/manual/packages/fst-cli/bin/fst.js +124 -0
  48. package/manual/packages/fst-cli/package.json +49 -0
  49. package/manual/packages/fst-cli/src/development.js +53 -0
  50. package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/model.js +1 -1
  51. package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/navigation.js +1 -1
  52. package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/presentation.js +9 -1
  53. package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/run-feed.js +31 -5
  54. package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/run-viewer.js +9 -7
  55. package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/schema.js +1 -1
  56. package/manual/packages/{core → fst-cli}/src/terminal/session.js +137 -9
  57. package/manual/packages/{core → fst-cli}/src/terminal/view.js +20 -3
  58. package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/workflow-menu.js +17 -2
  59. package/manual/packages/fst-devtools/LICENSE +21 -0
  60. package/manual/packages/fst-devtools/README.md +28 -0
  61. package/manual/packages/fst-devtools/package.json +29 -0
  62. package/{node_modules/@mytools/core → manual/packages/fst-devtools}/src/documentation.js +3 -1
  63. package/manual/packages/fst-devtools/src/plugin-quality.js +136 -0
  64. package/manual/packages/fst-devtools/src/plugin-tools.js +152 -0
  65. package/manual/packages/fst-logs/LICENSE +21 -0
  66. package/manual/packages/fst-logs/README.md +56 -0
  67. package/manual/packages/fst-logs/package.json +24 -0
  68. package/manual/packages/fst-logs/src/log-bounds.js +91 -0
  69. package/manual/packages/fst-logs/src/run-logs.js +239 -0
  70. package/manual/packages/fst-platform/LICENSE +21 -0
  71. package/manual/packages/fst-platform/README.md +67 -0
  72. package/manual/packages/fst-platform/package.json +33 -0
  73. package/manual/packages/fst-platform/src/bundle.js +17 -0
  74. package/manual/packages/fst-platform/src/environments.js +67 -0
  75. package/manual/packages/fst-platform/src/file-probe-engine.js +183 -0
  76. package/manual/packages/fst-platform/src/file-probe-worker.js +43 -0
  77. package/manual/packages/fst-platform/src/file-probe.js +6 -0
  78. package/manual/packages/fst-platform/src/json.js +5 -0
  79. package/manual/packages/fst-platform/src/network.js +199 -0
  80. package/manual/packages/fst-platform/src/npm.js +11 -0
  81. package/manual/packages/fst-platform/src/process.js +110 -0
  82. package/manual/packages/fst-plugin/LICENSE +21 -0
  83. package/manual/packages/fst-plugin/README.md +29 -0
  84. package/manual/packages/fst-plugin/package.json +29 -0
  85. package/manual/packages/fst-plugin/src/contracts.js +86 -0
  86. package/manual/packages/fst-plugin/src/host.js +232 -0
  87. package/manual/packages/fst-plugin/src/loader.js +21 -0
  88. package/manual/packages/fst-plugin/src/privileges.js +91 -0
  89. package/manual/packages/{core → fst-plugin}/src/runtime.js +20 -4
  90. package/manual/packages/fst-workflow/LICENSE +21 -0
  91. package/manual/packages/fst-workflow/README.md +28 -0
  92. package/manual/packages/fst-workflow/package.json +24 -0
  93. package/{node_modules/@mytools/core → manual/packages/fst-workflow}/src/control.js +3 -2
  94. package/manual/packages/{core → fst-workflow}/src/engine.js +2 -2
  95. package/manual/packages/fst-workspace/LICENSE +21 -0
  96. package/manual/packages/fst-workspace/README.md +32 -0
  97. package/manual/packages/fst-workspace/package.json +34 -0
  98. package/{node_modules/@mytools/core → manual/packages/fst-workspace}/src/bundle-workspace.js +1 -1
  99. package/manual/packages/fst-workspace/src/index.js +3 -0
  100. package/manual/packages/fst-workspace/src/plugin-installations.js +84 -0
  101. package/manual/packages/fst-workspace/src/plugins.js +35 -0
  102. package/{node_modules/@mytools/core → manual/packages/fst-workspace}/src/workflows.js +41 -21
  103. package/manual/packages/pack/LICENSE +21 -0
  104. package/manual/packages/pack/README.md +31 -0
  105. package/manual/packages/pack/archive.js +15 -0
  106. package/manual/packages/pack/dependencies.js +105 -0
  107. package/manual/packages/pack/environments.js +50 -0
  108. package/manual/packages/pack/index.js +103 -0
  109. package/manual/packages/pack/package.json +29 -0
  110. package/manual/packages/pack/runtime.js +61 -0
  111. package/manual/packages/sdk/README.md +31 -0
  112. package/manual/packages/sdk/conditions.js +1 -0
  113. package/manual/packages/sdk/package.json +23 -1
  114. package/manual/packages/sdk/schema-path.js +31 -0
  115. package/{node_modules/@mytools/core/src → manual/packages/sdk}/validation.js +22 -9
  116. package/manual/plugins/web/README.md +29 -0
  117. package/manual/tests/application.test.js +6 -4
  118. package/node_modules/@mytools/core/README.md +44 -0
  119. package/node_modules/@mytools/core/package.json +17 -15
  120. package/node_modules/@mytools/core/src/application.js +268 -87
  121. package/node_modules/@mytools/core/src/bundle.js +2 -17
  122. package/node_modules/@mytools/core/src/development-watch-worker.js +69 -0
  123. package/node_modules/@mytools/core/src/development.js +146 -0
  124. package/node_modules/@mytools/core/src/environments.js +2 -29
  125. package/node_modules/@mytools/core/src/export-snapshot.js +42 -0
  126. package/node_modules/@mytools/core/src/plugin-update.js +108 -0
  127. package/node_modules/@mytools/core/src/process.js +2 -71
  128. package/node_modules/@mytools/core/src/version.js +1 -1
  129. package/node_modules/@mytools/fst-cli/LICENSE +21 -0
  130. package/node_modules/@mytools/fst-cli/README.md +54 -0
  131. package/node_modules/@mytools/fst-cli/bin/fst.js +124 -0
  132. package/node_modules/@mytools/fst-cli/package.json +49 -0
  133. package/node_modules/@mytools/fst-cli/src/cli-run.js +12 -0
  134. package/node_modules/@mytools/fst-cli/src/development.js +53 -0
  135. package/node_modules/@mytools/fst-cli/src/terminal/conditions.js +32 -0
  136. package/node_modules/@mytools/fst-cli/src/terminal/log-viewer.js +45 -0
  137. package/node_modules/@mytools/fst-cli/src/terminal/model.js +104 -0
  138. package/node_modules/@mytools/fst-cli/src/terminal/navigation.js +17 -0
  139. package/node_modules/@mytools/fst-cli/src/terminal/presentation.js +50 -0
  140. package/{manual/packages/core → node_modules/@mytools/fst-cli}/src/terminal/run-feed.js +31 -5
  141. package/node_modules/@mytools/fst-cli/src/terminal/run-presentation.js +60 -0
  142. package/node_modules/@mytools/fst-cli/src/terminal/run-viewer.js +106 -0
  143. package/node_modules/@mytools/fst-cli/src/terminal/schema.js +52 -0
  144. package/node_modules/@mytools/{core → fst-cli}/src/terminal/session.js +137 -9
  145. package/node_modules/@mytools/fst-cli/src/terminal/theme.js +29 -0
  146. package/node_modules/@mytools/{core → fst-cli}/src/terminal/view.js +20 -3
  147. package/node_modules/@mytools/fst-cli/src/terminal/workflow-menu.js +65 -0
  148. package/node_modules/@mytools/fst-devtools/LICENSE +21 -0
  149. package/node_modules/@mytools/fst-devtools/README.md +28 -0
  150. package/node_modules/@mytools/fst-devtools/package.json +29 -0
  151. package/node_modules/@mytools/fst-devtools/src/documentation.js +67 -0
  152. package/node_modules/@mytools/fst-devtools/src/plugin-quality.js +136 -0
  153. package/node_modules/@mytools/fst-devtools/src/plugin-tools.js +152 -0
  154. package/node_modules/@mytools/fst-logs/LICENSE +21 -0
  155. package/node_modules/@mytools/fst-logs/README.md +56 -0
  156. package/node_modules/@mytools/fst-logs/package.json +24 -0
  157. package/node_modules/@mytools/fst-logs/src/log-bounds.js +91 -0
  158. package/node_modules/@mytools/fst-logs/src/markdown-log.js +55 -0
  159. package/node_modules/@mytools/fst-logs/src/run-logs.js +239 -0
  160. package/node_modules/@mytools/fst-platform/LICENSE +21 -0
  161. package/node_modules/@mytools/fst-platform/README.md +67 -0
  162. package/node_modules/@mytools/fst-platform/package.json +33 -0
  163. package/node_modules/@mytools/fst-platform/src/bundle.js +17 -0
  164. package/node_modules/@mytools/fst-platform/src/environments.js +67 -0
  165. package/node_modules/@mytools/fst-platform/src/file-probe-engine.js +183 -0
  166. package/node_modules/@mytools/fst-platform/src/file-probe-worker.js +43 -0
  167. package/node_modules/@mytools/fst-platform/src/file-probe.js +6 -0
  168. package/node_modules/@mytools/fst-platform/src/json.js +5 -0
  169. package/node_modules/@mytools/fst-platform/src/network.js +199 -0
  170. package/node_modules/@mytools/fst-platform/src/npm.js +11 -0
  171. package/node_modules/@mytools/fst-platform/src/process.js +110 -0
  172. package/node_modules/@mytools/fst-plugin/LICENSE +21 -0
  173. package/node_modules/@mytools/fst-plugin/README.md +29 -0
  174. package/node_modules/@mytools/fst-plugin/package.json +29 -0
  175. package/node_modules/@mytools/fst-plugin/src/contracts.js +86 -0
  176. package/node_modules/@mytools/fst-plugin/src/host.js +232 -0
  177. package/node_modules/@mytools/fst-plugin/src/loader.js +21 -0
  178. package/node_modules/@mytools/fst-plugin/src/privileges.js +91 -0
  179. package/node_modules/@mytools/{core → fst-plugin}/src/runtime.js +20 -4
  180. package/node_modules/@mytools/fst-workflow/LICENSE +21 -0
  181. package/node_modules/@mytools/fst-workflow/README.md +28 -0
  182. package/node_modules/@mytools/fst-workflow/package.json +24 -0
  183. package/node_modules/@mytools/fst-workflow/src/control.js +64 -0
  184. package/node_modules/@mytools/{core → fst-workflow}/src/engine.js +2 -2
  185. package/node_modules/@mytools/fst-workspace/LICENSE +21 -0
  186. package/node_modules/@mytools/fst-workspace/README.md +32 -0
  187. package/node_modules/@mytools/fst-workspace/package.json +34 -0
  188. package/node_modules/@mytools/fst-workspace/src/bundle-workspace.js +39 -0
  189. package/node_modules/@mytools/fst-workspace/src/index.js +3 -0
  190. package/node_modules/@mytools/fst-workspace/src/plugin-installations.js +84 -0
  191. package/node_modules/@mytools/fst-workspace/src/plugins.js +35 -0
  192. package/node_modules/@mytools/fst-workspace/src/project.js +29 -0
  193. package/node_modules/@mytools/fst-workspace/src/workflows.js +150 -0
  194. package/node_modules/@mytools/fst-workspace/templates/control-demo.yaml +47 -0
  195. package/node_modules/@mytools/fst-workspace/templates/hello.yaml +35 -0
  196. package/node_modules/@mytools/fst-workspace/templates/python-check.yaml +26 -0
  197. package/node_modules/@mytools/fst-workspace/templates/system-check.yaml +11 -0
  198. package/node_modules/@mytools/pack/README.md +31 -0
  199. package/node_modules/@mytools/pack/dependencies.js +15 -3
  200. package/node_modules/@mytools/pack/environments.js +1 -1
  201. package/node_modules/@mytools/pack/index.js +33 -25
  202. package/node_modules/@mytools/pack/package.json +29 -1
  203. package/node_modules/@mytools/sdk/README.md +31 -0
  204. package/node_modules/@mytools/sdk/conditions.js +1 -0
  205. package/node_modules/@mytools/sdk/diagnostics.js +27 -0
  206. package/node_modules/@mytools/sdk/package.json +23 -1
  207. package/node_modules/@mytools/sdk/schema-path.js +31 -0
  208. package/node_modules/@mytools/sdk/validation.js +78 -0
  209. package/node_modules/@mytools/web/README.md +29 -0
  210. package/node_modules/@mytools/web/package.json +7 -0
  211. package/node_modules/@mytools/web/public/THIRD_PARTY_NOTICES.txt +1275 -1076
  212. package/node_modules/@mytools/web/public/assets/index-BaVzHycP.js +70 -0
  213. package/node_modules/@mytools/web/public/assets/index-DA8Ae92t.css +1 -0
  214. package/node_modules/@mytools/web/public/index.html +2 -2
  215. package/node_modules/@mytools/web/server.js +24 -17
  216. package/node_modules/@mytools/web/src/model.js +84 -0
  217. package/node_modules/acorn/CHANGELOG.md +1012 -0
  218. package/node_modules/acorn/LICENSE +21 -0
  219. package/node_modules/acorn/README.md +309 -0
  220. package/node_modules/acorn/bin/acorn +4 -0
  221. package/node_modules/acorn/dist/acorn.d.mts +897 -0
  222. package/node_modules/acorn/dist/acorn.d.ts +897 -0
  223. package/node_modules/acorn/dist/acorn.js +6370 -0
  224. package/node_modules/acorn/dist/acorn.mjs +6341 -0
  225. package/node_modules/acorn/dist/bin.js +90 -0
  226. package/node_modules/acorn/package.json +50 -0
  227. package/package.json +117 -101
  228. package/manual/packages/core/src/host.js +0 -124
  229. package/node_modules/@mytools/core/bin/fst.js +0 -70
  230. package/node_modules/@mytools/core/src/contracts.js +0 -41
  231. package/node_modules/@mytools/core/src/host.js +0 -124
  232. package/node_modules/@mytools/core/src/plugins.js +0 -55
  233. package/node_modules/@mytools/core/src/run-logs.js +0 -63
  234. package/node_modules/@mytools/web/public/assets/index-DT2B4tMV.js +0 -70
  235. package/node_modules/@mytools/web/public/assets/index-vuZvrUTT.css +0 -1
  236. /package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/cli-run.js +0 -0
  237. /package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/conditions.js +0 -0
  238. /package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/log-viewer.js +0 -0
  239. /package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/run-presentation.js +0 -0
  240. /package/{node_modules/@mytools/core → manual/packages/fst-cli}/src/terminal/theme.js +0 -0
  241. /package/{node_modules/@mytools/core → manual/packages/fst-logs}/src/markdown-log.js +0 -0
  242. /package/{node_modules/@mytools/core → manual/packages/fst-workspace}/src/project.js +0 -0
  243. /package/{node_modules/@mytools/core → manual/packages/fst-workspace}/templates/control-demo.yaml +0 -0
  244. /package/{node_modules/@mytools/core → manual/packages/fst-workspace}/templates/hello.yaml +0 -0
  245. /package/{node_modules/@mytools/core → manual/packages/fst-workspace}/templates/python-check.yaml +0 -0
  246. /package/{node_modules/@mytools/core → manual/packages/fst-workspace}/templates/system-check.yaml +0 -0
  247. /package/{node_modules/@mytools/core/src → manual/packages/sdk}/diagnostics.js +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (C) 2012-2022 by various contributors (see AUTHORS)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,309 @@
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).
13
+
14
+ ## Installation
15
+
16
+ The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
17
+
18
+ ```sh
19
+ npm install acorn
20
+ ```
21
+
22
+ Alternately, you can download the source and build acorn yourself:
23
+
24
+ ```sh
25
+ git clone https://github.com/acornjs/acorn.git
26
+ cd acorn
27
+ npm install
28
+ ```
29
+ ## Importing acorn
30
+
31
+ ESM as well as CommonJS is supported for all 3: `acorn`, `acorn-walk` and `acorn-loose`.
32
+
33
+ ESM example for `acorn`:
34
+
35
+ ```js
36
+ import * as acorn from "acorn"
37
+ ```
38
+
39
+ CommonJS example for `acorn`:
40
+
41
+ ```js
42
+ let acorn = require("acorn")
43
+ ```
44
+
45
+ ESM is preferred, as it allows better editor auto-completions by offering TypeScript support.
46
+ For this reason, following examples will use ESM imports.
47
+
48
+ ## Interface
49
+
50
+ **parse**`(input, options)` is the main interface to the library. The
51
+ `input` parameter is a string, `options` must be an object setting
52
+ some of the options listed below. The return value will be an abstract
53
+ syntax tree object as specified by the [ESTree
54
+ spec](https://github.com/estree/estree).
55
+
56
+ ```javascript
57
+ import * as acorn from "acorn"
58
+ console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}))
59
+ ```
60
+
61
+ When encountering a syntax error, the parser will raise a
62
+ `SyntaxError` object with a meaningful message. The error object will
63
+ have a `pos` property that indicates the string offset at which the
64
+ error occurred, and a `loc` object that contains a `{line, column}`
65
+ object referring to that same position.
66
+
67
+ Options are provided by in a second argument, which should be an
68
+ object containing any of these fields (only `ecmaVersion` is
69
+ required):
70
+
71
+ - **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
72
+ number, either in year (`2022`) or plain version number (`6`) form,
73
+ or `"latest"` (the latest the library supports). This influences
74
+ support for strict mode, the set of reserved words, and support for
75
+ new syntax features.
76
+
77
+ **NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
78
+ implemented by Acorn. Other proposed new features must be
79
+ implemented through plugins.
80
+
81
+ - **sourceType**: Indicate the mode the code should be parsed in. Can be
82
+ either `"script"`, `"module"` or `"commonjs"`. This influences global strict mode
83
+ and parsing of `import` and `export` declarations.
84
+
85
+ **NOTE**: If set to `"module"`, then static `import` / `export` syntax
86
+ will be valid, even if `ecmaVersion` is less than 6. If set to `"commonjs"`,
87
+ it is the same as `"script"` except that the top-level scope behaves like a function.
88
+
89
+ - **strict**: When set to true, enable strict parsing mode even if
90
+ `sourceType` is `"script"`.
91
+
92
+ - **onInsertedSemicolon**: If given a callback, that callback will be
93
+ called whenever a missing semicolon is inserted by the parser. The
94
+ callback will be given the character offset of the point where the
95
+ semicolon is inserted as argument, and if `locations` is on, also a
96
+ `{line, column}` object representing this position.
97
+
98
+ - **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
99
+ commas.
100
+
101
+ - **allowReserved**: If `false`, using a reserved word will generate
102
+ an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
103
+ versions. When given the value `"never"`, reserved words and
104
+ keywords can also not be used as property names (as in Internet
105
+ Explorer's old parser).
106
+
107
+ - **allowReturnOutsideFunction**: By default, a return statement at
108
+ the top level raises an error. Set this to `true` to accept such
109
+ code.
110
+
111
+ - **allowImportExportEverywhere**: By default, `import` and `export`
112
+ declarations can only appear at a program's top level. Setting this
113
+ option to `true` allows them anywhere where a statement is allowed,
114
+ and also allows `import.meta` expressions to appear in scripts
115
+ (when `sourceType` is not `"module"`).
116
+
117
+ - **allowAwaitOutsideFunction**: If `false`, `await` expressions can
118
+ only appear inside `async` functions. Defaults to `true` in modules
119
+ for `ecmaVersion` 2022 and later, `false` for lower versions.
120
+ Setting this option to `true` allows to have top-level `await`
121
+ expressions. They are still not allowed in non-`async` functions,
122
+ though. Setting this option to `true` is not allowed when `sourceType: "commonjs"`.
123
+
124
+ - **allowSuperOutsideMethod**: By default, `super` outside a method
125
+ raises an error. Set this to `true` to accept such code.
126
+
127
+ - **allowHashBang**: When this is enabled, if the code starts with the
128
+ characters `#!` (as in a shellscript), the first line will be
129
+ treated as a comment. Defaults to true when `ecmaVersion` >= 2023.
130
+
131
+ - **checkPrivateFields**: By default, the parser will verify that
132
+ private properties are only used in places where they are valid and
133
+ have been declared. Set this to false to turn such checks off.
134
+
135
+ - **locations**: When `true`, each node has a `loc` object attached
136
+ with `start` and `end` subobjects, each of which contains the
137
+ one-based line and zero-based column numbers in `{line, column}`
138
+ form. Default is `false`.
139
+
140
+ - **startLocation**: An optional `{line, column}` object to use for
141
+ the start of the parse. This is mostly useful when using
142
+ `parseExpressionAt` with `locations: true`, to prevent the parser
143
+ from having to determine the line position at the start position.
144
+
145
+ - **onToken**: If a function is passed for this option, each found
146
+ token will be passed in same format as tokens returned from
147
+ `tokenizer().getToken()`.
148
+
149
+ If array is passed, each found token is pushed to it.
150
+
151
+ Note that you are not allowed to call the parser from the
152
+ callback—that will corrupt its internal state.
153
+
154
+ - **onComment**: If a function is passed for this option, whenever a
155
+ comment is encountered the function will be called with the
156
+ following parameters:
157
+
158
+ - `block`: `true` if the comment is a block comment, false if it
159
+ is a line comment.
160
+ - `text`: The content of the comment.
161
+ - `start`: Character offset of the start of the comment.
162
+ - `end`: Character offset of the end of the comment.
163
+
164
+ When the `locations` options is on, the `{line, column}` locations
165
+ of the comment’s start and end are passed as two additional
166
+ parameters.
167
+
168
+ If array is passed for this option, each found comment is pushed
169
+ to it as object in Esprima format:
170
+
171
+ ```javascript
172
+ {
173
+ "type": "Line" | "Block",
174
+ "value": "comment text",
175
+ "start": Number,
176
+ "end": Number,
177
+ // If `locations` option is on:
178
+ "loc": {
179
+ "start": {line: Number, column: Number}
180
+ "end": {line: Number, column: Number}
181
+ },
182
+ // If `ranges` option is on:
183
+ "range": [Number, Number]
184
+ }
185
+ ```
186
+
187
+ Note that you are not allowed to call the parser from the
188
+ callback—that will corrupt its internal state.
189
+
190
+ - **ranges**: Nodes have their start and end characters offsets
191
+ recorded in `start` and `end` properties (directly on the node,
192
+ rather than the `loc` object, which holds line/column data. To also
193
+ add a
194
+ [semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
195
+ `range` property holding a `[start, end]` array with the same
196
+ numbers, set the `ranges` option to `true`.
197
+
198
+ - **program**: It is possible to parse multiple files into a single
199
+ AST by passing the tree produced by parsing the first file as the
200
+ `program` option in subsequent parses. This will add the toplevel
201
+ forms of the parsed file to the "Program" (top) node of an existing
202
+ parse tree.
203
+
204
+ - **sourceFile**: When the `locations` option is `true`, you can pass
205
+ this option to add a `source` attribute in every node’s `loc`
206
+ object. Note that the contents of this option are not examined or
207
+ processed in any way; you are free to use whatever format you
208
+ choose.
209
+
210
+ - **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
211
+ will be added (regardless of the `location` option) directly to the
212
+ nodes, rather than the `loc` object.
213
+
214
+ - **preserveParens**: If this option is `true`, parenthesized expressions
215
+ are represented by (non-standard) `ParenthesizedExpression` nodes
216
+ that have a single `expression` property containing the expression
217
+ inside parentheses.
218
+
219
+ **parseExpressionAt**`(input, offset, options)` will parse a single
220
+ expression in a string, and return its AST. It will not complain if
221
+ there is more of the string left after the expression.
222
+
223
+ **tokenizer**`(input, options)` returns an object with a `getToken`
224
+ method that can be called repeatedly to get the next token, a `{start,
225
+ end, type, value}` object (with added `loc` property when the
226
+ `locations` option is enabled and `range` property when the `ranges`
227
+ option is enabled). When the token's type is `tokTypes.eof`, you
228
+ should stop calling the method, since it will keep returning that same
229
+ token forever.
230
+
231
+ Note that tokenizing JavaScript without parsing it is, in modern
232
+ versions of the language, not really possible due to the way syntax is
233
+ overloaded in ways that can only be disambiguated by the parse
234
+ context. This package applies a bunch of heuristics to try and do a
235
+ reasonable job, but you are advised to use `parse` with the `onToken`
236
+ option instead of this.
237
+
238
+ In ES6 environment, returned result can be used as any other
239
+ protocol-compliant iterable:
240
+
241
+ ```javascript
242
+ for (let token of acorn.tokenizer(str)) {
243
+ // iterate over the tokens
244
+ }
245
+
246
+ // transform code to array of tokens:
247
+ var tokens = [...acorn.tokenizer(str)]
248
+ ```
249
+
250
+ **tokTypes** holds an object mapping names to the token type objects
251
+ that end up in the `type` properties of tokens.
252
+
253
+ **getLineInfo**`(input, offset)` can be used to get a `{line,
254
+ column}` object for a given program string and offset.
255
+
256
+ ### The `Parser` class
257
+
258
+ Instances of the **`Parser`** class contain all the state and logic
259
+ that drives a parse. It has static methods `parse`,
260
+ `parseExpressionAt`, and `tokenizer` that match the top-level
261
+ functions by the same name.
262
+
263
+ When extending the parser with plugins, you need to call these methods
264
+ on the extended version of the class. To extend a parser with plugins,
265
+ you can use its static `extend` method.
266
+
267
+ ```javascript
268
+ var acorn = require("acorn")
269
+ var jsx = require("acorn-jsx")
270
+ var JSXParser = acorn.Parser.extend(jsx())
271
+ JSXParser.parse("foo(<bar/>)", {ecmaVersion: 2020})
272
+ ```
273
+
274
+ The `extend` method takes any number of plugin values, and returns a
275
+ new `Parser` class that includes the extra parser logic provided by
276
+ the plugins.
277
+
278
+ ## Command line interface
279
+
280
+ The `bin/acorn` utility can be used to parse a file from the command
281
+ line. It accepts as arguments its input file and the following
282
+ options:
283
+
284
+ - `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
285
+ to parse. Default is version 9.
286
+
287
+ - `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
288
+
289
+ - `--locations`: Attaches a "loc" object to each node with "start" and
290
+ "end" subobjects, each of which contains the one-based line and
291
+ zero-based column numbers in `{line, column}` form.
292
+
293
+ - `--allow-hash-bang`: If the code starts with the characters #! (as
294
+ in a shellscript), the first line will be treated as a comment.
295
+
296
+ - `--allow-await-outside-function`: Allows top-level `await` expressions.
297
+ See the `allowAwaitOutsideFunction` option for more information.
298
+
299
+ - `--compact`: No whitespace is used in the AST output.
300
+
301
+ - `--silent`: Do not output the AST, just return the exit status.
302
+
303
+ - `--help`: Print the usage information and quit.
304
+
305
+ The utility spits out the syntax tree as JSON data.
306
+
307
+ ## Existing plugins
308
+
309
+ - [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ "use strict"
3
+
4
+ require("../dist/bin.js")