brasscoders 2.0.4__py3-none-any.whl

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 (615) hide show
  1. brass/__init__.py +9 -0
  2. brass/cli/__init__.py +7 -0
  3. brass/cli/brass_cli.py +2721 -0
  4. brass/config/patterns.yaml +243 -0
  5. brass/core/__init__.py +13 -0
  6. brass/core/atomic_writer.py +181 -0
  7. brass/core/brassignore.py +182 -0
  8. brass/core/change_detection.py +206 -0
  9. brass/core/error_handling.py +262 -0
  10. brass/core/error_reporter.py +308 -0
  11. brass/core/file_classifier.py +433 -0
  12. brass/core/file_index.py +111 -0
  13. brass/core/file_integrity.py +199 -0
  14. brass/core/finding_cache.py +254 -0
  15. brass/core/framework_registry.py +523 -0
  16. brass/core/logging_config.py +160 -0
  17. brass/core/path_safety.py +36 -0
  18. brass/core/scanner_status.py +56 -0
  19. brass/core/startup_checks.py +247 -0
  20. brass/core/state_validator.py +188 -0
  21. brass/core/user_error_handler.py +202 -0
  22. brass/core/version_check.py +104 -0
  23. brass/data/ast_grep_rules/javascript/sql_injection.yml +27 -0
  24. brass/data/ast_grep_rules/javascript/sql_injection_ts.yml +20 -0
  25. brass/data/ast_grep_rules/javascript/xss.yml +15 -0
  26. brass/data/ast_grep_rules/javascript/xss_ts.yml +14 -0
  27. brass/data/ast_grep_rules/python/command_injection.yml +25 -0
  28. brass/data/ast_grep_rules/python/sql_injection.yml +26 -0
  29. brass/data/ast_grep_rules/python/sql_var_execute.yml +24 -0
  30. brass/data/ast_grep_rules/python/weak_crypto.yml +31 -0
  31. brass/data/ast_grep_rules/sgconfig.yml +3 -0
  32. brass/data/framework_registry/javascript.yaml +205 -0
  33. brass/data/framework_registry/python.yaml +355 -0
  34. brass/data/framework_registry/typescript.yaml +165 -0
  35. brass/data/pysa_models/model_queries.pysa +51 -0
  36. brass/data/pysa_models/stdlib.pysa +82 -0
  37. brass/data/pysa_models/taint.config +62 -0
  38. brass/data/pysa_models/third_party.pysa +78 -0
  39. brass/data/pysa_stubs/django/__init__.pyi +2 -0
  40. brass/data/pysa_stubs/django/db/__init__.pyi +0 -0
  41. brass/data/pysa_stubs/django/db/backends/__init__.pyi +0 -0
  42. brass/data/pysa_stubs/django/db/backends/utils.pyi +4 -0
  43. brass/data/pysa_stubs/django/db/models/__init__.pyi +0 -0
  44. brass/data/pysa_stubs/django/db/models/query.pyi +4 -0
  45. brass/data/pysa_stubs/django/http/__init__.pyi +8 -0
  46. brass/data/pysa_stubs/django/utils/__init__.pyi +0 -0
  47. brass/data/pysa_stubs/django/utils/safestring.pyi +1 -0
  48. brass/data/pysa_stubs/flask/__init__.pyi +26 -0
  49. brass/data/pysa_stubs/httpx/__init__.pyi +4 -0
  50. brass/data/pysa_stubs/requests/__init__.pyi +0 -0
  51. brass/data/pysa_stubs/requests/api.pyi +7 -0
  52. brass/data/pysa_stubs/sqlalchemy/__init__.pyi +3 -0
  53. brass/data/pysa_stubs/sqlalchemy/engine/__init__.pyi +4 -0
  54. brass/data/pysa_stubs/sqlalchemy/orm/__init__.pyi +0 -0
  55. brass/data/pysa_stubs/sqlalchemy/orm/session.pyi +4 -0
  56. brass/data/pysa_stubs/yaml/__init__.pyi +4 -0
  57. brass/data/semgrep_rules/javascript/command_injection.yml +50 -0
  58. brass/data/semgrep_rules/javascript/sql_injection.yml +61 -0
  59. brass/data/semgrep_rules/javascript/ssrf.yml +82 -0
  60. brass/data/semgrep_rules/javascript/xss.yml +44 -0
  61. brass/data/semgrep_rules/python/command_injection.yml +82 -0
  62. brass/data/semgrep_rules/python/deserialization.yml +87 -0
  63. brass/data/semgrep_rules/python/path_traversal.yml +120 -0
  64. brass/data/semgrep_rules/python/sql_injection.yml +77 -0
  65. brass/data/semgrep_rules/python/ssrf.yml +102 -0
  66. brass/data/semgrep_rules/python/xss.yml +86 -0
  67. brass/enrichment/__init__.py +51 -0
  68. brass/enrichment/_token_budget.py +112 -0
  69. brass/enrichment/_wire_clamp.py +42 -0
  70. brass/enrichment/client.py +683 -0
  71. brass/enrichment/filter.py +371 -0
  72. brass/enrichment/project_signature.py +197 -0
  73. brass/filtering/__init__.py +8 -0
  74. brass/filtering/ai_review_filter.py +302 -0
  75. brass/js_analysis/babel_parser.js +416 -0
  76. brass/js_analysis/node_modules/@babel/code-frame/LICENSE +22 -0
  77. brass/js_analysis/node_modules/@babel/code-frame/README.md +19 -0
  78. brass/js_analysis/node_modules/@babel/code-frame/lib/index.js +216 -0
  79. brass/js_analysis/node_modules/@babel/code-frame/lib/index.js.map +1 -0
  80. brass/js_analysis/node_modules/@babel/code-frame/package.json +31 -0
  81. brass/js_analysis/node_modules/@babel/generator/LICENSE +22 -0
  82. brass/js_analysis/node_modules/@babel/generator/README.md +19 -0
  83. brass/js_analysis/node_modules/@babel/generator/lib/buffer.js +317 -0
  84. brass/js_analysis/node_modules/@babel/generator/lib/buffer.js.map +1 -0
  85. brass/js_analysis/node_modules/@babel/generator/lib/generators/base.js +87 -0
  86. brass/js_analysis/node_modules/@babel/generator/lib/generators/base.js.map +1 -0
  87. brass/js_analysis/node_modules/@babel/generator/lib/generators/classes.js +212 -0
  88. brass/js_analysis/node_modules/@babel/generator/lib/generators/classes.js.map +1 -0
  89. brass/js_analysis/node_modules/@babel/generator/lib/generators/deprecated.js +28 -0
  90. brass/js_analysis/node_modules/@babel/generator/lib/generators/deprecated.js.map +1 -0
  91. brass/js_analysis/node_modules/@babel/generator/lib/generators/expressions.js +300 -0
  92. brass/js_analysis/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -0
  93. brass/js_analysis/node_modules/@babel/generator/lib/generators/flow.js +660 -0
  94. brass/js_analysis/node_modules/@babel/generator/lib/generators/flow.js.map +1 -0
  95. brass/js_analysis/node_modules/@babel/generator/lib/generators/index.js +128 -0
  96. brass/js_analysis/node_modules/@babel/generator/lib/generators/index.js.map +1 -0
  97. brass/js_analysis/node_modules/@babel/generator/lib/generators/jsx.js +126 -0
  98. brass/js_analysis/node_modules/@babel/generator/lib/generators/jsx.js.map +1 -0
  99. brass/js_analysis/node_modules/@babel/generator/lib/generators/methods.js +198 -0
  100. brass/js_analysis/node_modules/@babel/generator/lib/generators/methods.js.map +1 -0
  101. brass/js_analysis/node_modules/@babel/generator/lib/generators/modules.js +287 -0
  102. brass/js_analysis/node_modules/@babel/generator/lib/generators/modules.js.map +1 -0
  103. brass/js_analysis/node_modules/@babel/generator/lib/generators/statements.js +279 -0
  104. brass/js_analysis/node_modules/@babel/generator/lib/generators/statements.js.map +1 -0
  105. brass/js_analysis/node_modules/@babel/generator/lib/generators/template-literals.js +40 -0
  106. brass/js_analysis/node_modules/@babel/generator/lib/generators/template-literals.js.map +1 -0
  107. brass/js_analysis/node_modules/@babel/generator/lib/generators/types.js +238 -0
  108. brass/js_analysis/node_modules/@babel/generator/lib/generators/types.js.map +1 -0
  109. brass/js_analysis/node_modules/@babel/generator/lib/generators/typescript.js +724 -0
  110. brass/js_analysis/node_modules/@babel/generator/lib/generators/typescript.js.map +1 -0
  111. brass/js_analysis/node_modules/@babel/generator/lib/index.js +112 -0
  112. brass/js_analysis/node_modules/@babel/generator/lib/index.js.map +1 -0
  113. brass/js_analysis/node_modules/@babel/generator/lib/node/index.js +122 -0
  114. brass/js_analysis/node_modules/@babel/generator/lib/node/index.js.map +1 -0
  115. brass/js_analysis/node_modules/@babel/generator/lib/node/parentheses.js +262 -0
  116. brass/js_analysis/node_modules/@babel/generator/lib/node/parentheses.js.map +1 -0
  117. brass/js_analysis/node_modules/@babel/generator/lib/node/whitespace.js +145 -0
  118. brass/js_analysis/node_modules/@babel/generator/lib/node/whitespace.js.map +1 -0
  119. brass/js_analysis/node_modules/@babel/generator/lib/printer.js +781 -0
  120. brass/js_analysis/node_modules/@babel/generator/lib/printer.js.map +1 -0
  121. brass/js_analysis/node_modules/@babel/generator/lib/source-map.js +85 -0
  122. brass/js_analysis/node_modules/@babel/generator/lib/source-map.js.map +1 -0
  123. brass/js_analysis/node_modules/@babel/generator/lib/token-map.js +191 -0
  124. brass/js_analysis/node_modules/@babel/generator/lib/token-map.js.map +1 -0
  125. brass/js_analysis/node_modules/@babel/generator/package.json +40 -0
  126. brass/js_analysis/node_modules/@babel/helper-globals/LICENSE +22 -0
  127. brass/js_analysis/node_modules/@babel/helper-globals/README.md +19 -0
  128. brass/js_analysis/node_modules/@babel/helper-globals/data/browser-upper.json +911 -0
  129. brass/js_analysis/node_modules/@babel/helper-globals/data/builtin-lower.json +15 -0
  130. brass/js_analysis/node_modules/@babel/helper-globals/data/builtin-upper.json +51 -0
  131. brass/js_analysis/node_modules/@babel/helper-globals/package.json +32 -0
  132. brass/js_analysis/node_modules/@babel/helper-string-parser/LICENSE +22 -0
  133. brass/js_analysis/node_modules/@babel/helper-string-parser/README.md +19 -0
  134. brass/js_analysis/node_modules/@babel/helper-string-parser/lib/index.js +295 -0
  135. brass/js_analysis/node_modules/@babel/helper-string-parser/lib/index.js.map +1 -0
  136. brass/js_analysis/node_modules/@babel/helper-string-parser/package.json +31 -0
  137. brass/js_analysis/node_modules/@babel/helper-validator-identifier/LICENSE +22 -0
  138. brass/js_analysis/node_modules/@babel/helper-validator-identifier/README.md +19 -0
  139. brass/js_analysis/node_modules/@babel/helper-validator-identifier/lib/identifier.js +70 -0
  140. brass/js_analysis/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +1 -0
  141. brass/js_analysis/node_modules/@babel/helper-validator-identifier/lib/index.js +57 -0
  142. brass/js_analysis/node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -0
  143. brass/js_analysis/node_modules/@babel/helper-validator-identifier/lib/keyword.js +35 -0
  144. brass/js_analysis/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +1 -0
  145. brass/js_analysis/node_modules/@babel/helper-validator-identifier/package.json +31 -0
  146. brass/js_analysis/node_modules/@babel/parser/CHANGELOG.md +1073 -0
  147. brass/js_analysis/node_modules/@babel/parser/LICENSE +19 -0
  148. brass/js_analysis/node_modules/@babel/parser/README.md +19 -0
  149. brass/js_analysis/node_modules/@babel/parser/bin/babel-parser.js +15 -0
  150. brass/js_analysis/node_modules/@babel/parser/lib/index.js +14586 -0
  151. brass/js_analysis/node_modules/@babel/parser/lib/index.js.map +1 -0
  152. brass/js_analysis/node_modules/@babel/parser/package.json +50 -0
  153. brass/js_analysis/node_modules/@babel/parser/typings/babel-parser.d.ts +239 -0
  154. brass/js_analysis/node_modules/@babel/template/LICENSE +22 -0
  155. brass/js_analysis/node_modules/@babel/template/README.md +19 -0
  156. brass/js_analysis/node_modules/@babel/template/lib/builder.js +69 -0
  157. brass/js_analysis/node_modules/@babel/template/lib/builder.js.map +1 -0
  158. brass/js_analysis/node_modules/@babel/template/lib/formatters.js +61 -0
  159. brass/js_analysis/node_modules/@babel/template/lib/formatters.js.map +1 -0
  160. brass/js_analysis/node_modules/@babel/template/lib/index.js +23 -0
  161. brass/js_analysis/node_modules/@babel/template/lib/index.js.map +1 -0
  162. brass/js_analysis/node_modules/@babel/template/lib/literal.js +69 -0
  163. brass/js_analysis/node_modules/@babel/template/lib/literal.js.map +1 -0
  164. brass/js_analysis/node_modules/@babel/template/lib/options.js +73 -0
  165. brass/js_analysis/node_modules/@babel/template/lib/options.js.map +1 -0
  166. brass/js_analysis/node_modules/@babel/template/lib/parse.js +163 -0
  167. brass/js_analysis/node_modules/@babel/template/lib/parse.js.map +1 -0
  168. brass/js_analysis/node_modules/@babel/template/lib/populate.js +138 -0
  169. brass/js_analysis/node_modules/@babel/template/lib/populate.js.map +1 -0
  170. brass/js_analysis/node_modules/@babel/template/lib/string.js +20 -0
  171. brass/js_analysis/node_modules/@babel/template/lib/string.js.map +1 -0
  172. brass/js_analysis/node_modules/@babel/template/package.json +27 -0
  173. brass/js_analysis/node_modules/@babel/traverse/LICENSE +22 -0
  174. brass/js_analysis/node_modules/@babel/traverse/README.md +19 -0
  175. brass/js_analysis/node_modules/@babel/traverse/lib/cache.js +38 -0
  176. brass/js_analysis/node_modules/@babel/traverse/lib/cache.js.map +1 -0
  177. brass/js_analysis/node_modules/@babel/traverse/lib/context.js +119 -0
  178. brass/js_analysis/node_modules/@babel/traverse/lib/context.js.map +1 -0
  179. brass/js_analysis/node_modules/@babel/traverse/lib/hub.js +19 -0
  180. brass/js_analysis/node_modules/@babel/traverse/lib/hub.js.map +1 -0
  181. brass/js_analysis/node_modules/@babel/traverse/lib/index.js +87 -0
  182. brass/js_analysis/node_modules/@babel/traverse/lib/index.js.map +1 -0
  183. brass/js_analysis/node_modules/@babel/traverse/lib/path/ancestry.js +139 -0
  184. brass/js_analysis/node_modules/@babel/traverse/lib/path/ancestry.js.map +1 -0
  185. brass/js_analysis/node_modules/@babel/traverse/lib/path/comments.js +52 -0
  186. brass/js_analysis/node_modules/@babel/traverse/lib/path/comments.js.map +1 -0
  187. brass/js_analysis/node_modules/@babel/traverse/lib/path/context.js +242 -0
  188. brass/js_analysis/node_modules/@babel/traverse/lib/path/context.js.map +1 -0
  189. brass/js_analysis/node_modules/@babel/traverse/lib/path/conversion.js +612 -0
  190. brass/js_analysis/node_modules/@babel/traverse/lib/path/conversion.js.map +1 -0
  191. brass/js_analysis/node_modules/@babel/traverse/lib/path/evaluation.js +368 -0
  192. brass/js_analysis/node_modules/@babel/traverse/lib/path/evaluation.js.map +1 -0
  193. brass/js_analysis/node_modules/@babel/traverse/lib/path/family.js +346 -0
  194. brass/js_analysis/node_modules/@babel/traverse/lib/path/family.js.map +1 -0
  195. brass/js_analysis/node_modules/@babel/traverse/lib/path/index.js +293 -0
  196. brass/js_analysis/node_modules/@babel/traverse/lib/path/index.js.map +1 -0
  197. brass/js_analysis/node_modules/@babel/traverse/lib/path/inference/index.js +149 -0
  198. brass/js_analysis/node_modules/@babel/traverse/lib/path/inference/index.js.map +1 -0
  199. brass/js_analysis/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js +151 -0
  200. brass/js_analysis/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js.map +1 -0
  201. brass/js_analysis/node_modules/@babel/traverse/lib/path/inference/inferers.js +207 -0
  202. brass/js_analysis/node_modules/@babel/traverse/lib/path/inference/inferers.js.map +1 -0
  203. brass/js_analysis/node_modules/@babel/traverse/lib/path/inference/util.js +30 -0
  204. brass/js_analysis/node_modules/@babel/traverse/lib/path/inference/util.js.map +1 -0
  205. brass/js_analysis/node_modules/@babel/traverse/lib/path/introspection.js +398 -0
  206. brass/js_analysis/node_modules/@babel/traverse/lib/path/introspection.js.map +1 -0
  207. brass/js_analysis/node_modules/@babel/traverse/lib/path/lib/hoister.js +171 -0
  208. brass/js_analysis/node_modules/@babel/traverse/lib/path/lib/hoister.js.map +1 -0
  209. brass/js_analysis/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js +37 -0
  210. brass/js_analysis/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js.map +1 -0
  211. brass/js_analysis/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js +163 -0
  212. brass/js_analysis/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js.map +1 -0
  213. brass/js_analysis/node_modules/@babel/traverse/lib/path/lib/virtual-types.js +26 -0
  214. brass/js_analysis/node_modules/@babel/traverse/lib/path/lib/virtual-types.js.map +1 -0
  215. brass/js_analysis/node_modules/@babel/traverse/lib/path/modification.js +230 -0
  216. brass/js_analysis/node_modules/@babel/traverse/lib/path/modification.js.map +1 -0
  217. brass/js_analysis/node_modules/@babel/traverse/lib/path/removal.js +70 -0
  218. brass/js_analysis/node_modules/@babel/traverse/lib/path/removal.js.map +1 -0
  219. brass/js_analysis/node_modules/@babel/traverse/lib/path/replacement.js +263 -0
  220. brass/js_analysis/node_modules/@babel/traverse/lib/path/replacement.js.map +1 -0
  221. brass/js_analysis/node_modules/@babel/traverse/lib/scope/binding.js +84 -0
  222. brass/js_analysis/node_modules/@babel/traverse/lib/scope/binding.js.map +1 -0
  223. brass/js_analysis/node_modules/@babel/traverse/lib/scope/index.js +1039 -0
  224. brass/js_analysis/node_modules/@babel/traverse/lib/scope/index.js.map +1 -0
  225. brass/js_analysis/node_modules/@babel/traverse/lib/scope/lib/renamer.js +131 -0
  226. brass/js_analysis/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map +1 -0
  227. brass/js_analysis/node_modules/@babel/traverse/lib/traverse-node.js +138 -0
  228. brass/js_analysis/node_modules/@babel/traverse/lib/traverse-node.js.map +1 -0
  229. brass/js_analysis/node_modules/@babel/traverse/lib/types.js +3 -0
  230. brass/js_analysis/node_modules/@babel/traverse/lib/types.js.map +1 -0
  231. brass/js_analysis/node_modules/@babel/traverse/lib/visitors.js +258 -0
  232. brass/js_analysis/node_modules/@babel/traverse/lib/visitors.js.map +1 -0
  233. brass/js_analysis/node_modules/@babel/traverse/package.json +35 -0
  234. brass/js_analysis/node_modules/@babel/types/LICENSE +22 -0
  235. brass/js_analysis/node_modules/@babel/types/README.md +19 -0
  236. brass/js_analysis/node_modules/@babel/types/lib/asserts/assertNode.js +16 -0
  237. brass/js_analysis/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -0
  238. brass/js_analysis/node_modules/@babel/types/lib/asserts/generated/index.js +1251 -0
  239. brass/js_analysis/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -0
  240. brass/js_analysis/node_modules/@babel/types/lib/ast-types/generated/index.js +3 -0
  241. brass/js_analysis/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -0
  242. brass/js_analysis/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +18 -0
  243. brass/js_analysis/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -0
  244. brass/js_analysis/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +31 -0
  245. brass/js_analysis/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -0
  246. brass/js_analysis/node_modules/@babel/types/lib/builders/generated/index.js +29 -0
  247. brass/js_analysis/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -0
  248. brass/js_analysis/node_modules/@babel/types/lib/builders/generated/lowercase.js +2896 -0
  249. brass/js_analysis/node_modules/@babel/types/lib/builders/generated/lowercase.js.map +1 -0
  250. brass/js_analysis/node_modules/@babel/types/lib/builders/generated/uppercase.js +274 -0
  251. brass/js_analysis/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -0
  252. brass/js_analysis/node_modules/@babel/types/lib/builders/productions.js +12 -0
  253. brass/js_analysis/node_modules/@babel/types/lib/builders/productions.js.map +1 -0
  254. brass/js_analysis/node_modules/@babel/types/lib/builders/react/buildChildren.js +24 -0
  255. brass/js_analysis/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -0
  256. brass/js_analysis/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +22 -0
  257. brass/js_analysis/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -0
  258. brass/js_analysis/node_modules/@babel/types/lib/builders/validateNode.js +21 -0
  259. brass/js_analysis/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -0
  260. brass/js_analysis/node_modules/@babel/types/lib/clone/clone.js +12 -0
  261. brass/js_analysis/node_modules/@babel/types/lib/clone/clone.js.map +1 -0
  262. brass/js_analysis/node_modules/@babel/types/lib/clone/cloneDeep.js +12 -0
  263. brass/js_analysis/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -0
  264. brass/js_analysis/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +12 -0
  265. brass/js_analysis/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -0
  266. brass/js_analysis/node_modules/@babel/types/lib/clone/cloneNode.js +107 -0
  267. brass/js_analysis/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -0
  268. brass/js_analysis/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +12 -0
  269. brass/js_analysis/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -0
  270. brass/js_analysis/node_modules/@babel/types/lib/comments/addComment.js +15 -0
  271. brass/js_analysis/node_modules/@babel/types/lib/comments/addComment.js.map +1 -0
  272. brass/js_analysis/node_modules/@babel/types/lib/comments/addComments.js +22 -0
  273. brass/js_analysis/node_modules/@babel/types/lib/comments/addComments.js.map +1 -0
  274. brass/js_analysis/node_modules/@babel/types/lib/comments/inheritInnerComments.js +12 -0
  275. brass/js_analysis/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -0
  276. brass/js_analysis/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +12 -0
  277. brass/js_analysis/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -0
  278. brass/js_analysis/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +12 -0
  279. brass/js_analysis/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -0
  280. brass/js_analysis/node_modules/@babel/types/lib/comments/inheritsComments.js +17 -0
  281. brass/js_analysis/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -0
  282. brass/js_analysis/node_modules/@babel/types/lib/comments/removeComments.js +15 -0
  283. brass/js_analysis/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -0
  284. brass/js_analysis/node_modules/@babel/types/lib/constants/generated/index.js +60 -0
  285. brass/js_analysis/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -0
  286. brass/js_analysis/node_modules/@babel/types/lib/constants/index.js +33 -0
  287. brass/js_analysis/node_modules/@babel/types/lib/constants/index.js.map +1 -0
  288. brass/js_analysis/node_modules/@babel/types/lib/converters/ensureBlock.js +14 -0
  289. brass/js_analysis/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -0
  290. brass/js_analysis/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +66 -0
  291. brass/js_analysis/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -0
  292. brass/js_analysis/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +14 -0
  293. brass/js_analysis/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -0
  294. brass/js_analysis/node_modules/@babel/types/lib/converters/toBlock.js +29 -0
  295. brass/js_analysis/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -0
  296. brass/js_analysis/node_modules/@babel/types/lib/converters/toComputedKey.js +14 -0
  297. brass/js_analysis/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -0
  298. brass/js_analysis/node_modules/@babel/types/lib/converters/toExpression.js +28 -0
  299. brass/js_analysis/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -0
  300. brass/js_analysis/node_modules/@babel/types/lib/converters/toIdentifier.js +25 -0
  301. brass/js_analysis/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -0
  302. brass/js_analysis/node_modules/@babel/types/lib/converters/toKeyAlias.js +38 -0
  303. brass/js_analysis/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -0
  304. brass/js_analysis/node_modules/@babel/types/lib/converters/toSequenceExpression.js +20 -0
  305. brass/js_analysis/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -0
  306. brass/js_analysis/node_modules/@babel/types/lib/converters/toStatement.js +39 -0
  307. brass/js_analysis/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -0
  308. brass/js_analysis/node_modules/@babel/types/lib/converters/valueToNode.js +89 -0
  309. brass/js_analysis/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -0
  310. brass/js_analysis/node_modules/@babel/types/lib/definitions/core.js +1659 -0
  311. brass/js_analysis/node_modules/@babel/types/lib/definitions/core.js.map +1 -0
  312. brass/js_analysis/node_modules/@babel/types/lib/definitions/deprecated-aliases.js +11 -0
  313. brass/js_analysis/node_modules/@babel/types/lib/definitions/deprecated-aliases.js.map +1 -0
  314. brass/js_analysis/node_modules/@babel/types/lib/definitions/experimental.js +126 -0
  315. brass/js_analysis/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -0
  316. brass/js_analysis/node_modules/@babel/types/lib/definitions/flow.js +495 -0
  317. brass/js_analysis/node_modules/@babel/types/lib/definitions/flow.js.map +1 -0
  318. brass/js_analysis/node_modules/@babel/types/lib/definitions/index.js +100 -0
  319. brass/js_analysis/node_modules/@babel/types/lib/definitions/index.js.map +1 -0
  320. brass/js_analysis/node_modules/@babel/types/lib/definitions/jsx.js +157 -0
  321. brass/js_analysis/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -0
  322. brass/js_analysis/node_modules/@babel/types/lib/definitions/misc.js +33 -0
  323. brass/js_analysis/node_modules/@babel/types/lib/definitions/misc.js.map +1 -0
  324. brass/js_analysis/node_modules/@babel/types/lib/definitions/placeholders.js +27 -0
  325. brass/js_analysis/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -0
  326. brass/js_analysis/node_modules/@babel/types/lib/definitions/typescript.js +528 -0
  327. brass/js_analysis/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -0
  328. brass/js_analysis/node_modules/@babel/types/lib/definitions/utils.js +292 -0
  329. brass/js_analysis/node_modules/@babel/types/lib/definitions/utils.js.map +1 -0
  330. brass/js_analysis/node_modules/@babel/types/lib/index-legacy.d.ts +2797 -0
  331. brass/js_analysis/node_modules/@babel/types/lib/index.d.ts +3308 -0
  332. brass/js_analysis/node_modules/@babel/types/lib/index.js +584 -0
  333. brass/js_analysis/node_modules/@babel/types/lib/index.js.flow +2650 -0
  334. brass/js_analysis/node_modules/@babel/types/lib/index.js.map +1 -0
  335. brass/js_analysis/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +15 -0
  336. brass/js_analysis/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -0
  337. brass/js_analysis/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +65 -0
  338. brass/js_analysis/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -0
  339. brass/js_analysis/node_modules/@babel/types/lib/modifications/inherits.js +28 -0
  340. brass/js_analysis/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -0
  341. brass/js_analysis/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +17 -0
  342. brass/js_analysis/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -0
  343. brass/js_analysis/node_modules/@babel/types/lib/modifications/removeProperties.js +24 -0
  344. brass/js_analysis/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -0
  345. brass/js_analysis/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +14 -0
  346. brass/js_analysis/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -0
  347. brass/js_analysis/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +66 -0
  348. brass/js_analysis/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -0
  349. brass/js_analysis/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js +48 -0
  350. brass/js_analysis/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js.map +1 -0
  351. brass/js_analysis/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +102 -0
  352. brass/js_analysis/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -0
  353. brass/js_analysis/node_modules/@babel/types/lib/retrievers/getFunctionName.js +63 -0
  354. brass/js_analysis/node_modules/@babel/types/lib/retrievers/getFunctionName.js.map +1 -0
  355. brass/js_analysis/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +13 -0
  356. brass/js_analysis/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -0
  357. brass/js_analysis/node_modules/@babel/types/lib/traverse/traverse.js +50 -0
  358. brass/js_analysis/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -0
  359. brass/js_analysis/node_modules/@babel/types/lib/traverse/traverseFast.js +40 -0
  360. brass/js_analysis/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -0
  361. brass/js_analysis/node_modules/@babel/types/lib/utils/deprecationWarning.js +44 -0
  362. brass/js_analysis/node_modules/@babel/types/lib/utils/deprecationWarning.js.map +1 -0
  363. brass/js_analysis/node_modules/@babel/types/lib/utils/inherit.js +13 -0
  364. brass/js_analysis/node_modules/@babel/types/lib/utils/inherit.js.map +1 -0
  365. brass/js_analysis/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +40 -0
  366. brass/js_analysis/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -0
  367. brass/js_analysis/node_modules/@babel/types/lib/utils/shallowEqual.js +17 -0
  368. brass/js_analysis/node_modules/@babel/types/lib/utils/shallowEqual.js.map +1 -0
  369. brass/js_analysis/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +13 -0
  370. brass/js_analysis/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -0
  371. brass/js_analysis/node_modules/@babel/types/lib/validators/generated/index.js +2797 -0
  372. brass/js_analysis/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -0
  373. brass/js_analysis/node_modules/@babel/types/lib/validators/is.js +27 -0
  374. brass/js_analysis/node_modules/@babel/types/lib/validators/is.js.map +1 -0
  375. brass/js_analysis/node_modules/@babel/types/lib/validators/isBinding.js +27 -0
  376. brass/js_analysis/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -0
  377. brass/js_analysis/node_modules/@babel/types/lib/validators/isBlockScoped.js +13 -0
  378. brass/js_analysis/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -0
  379. brass/js_analysis/node_modules/@babel/types/lib/validators/isImmutable.js +21 -0
  380. brass/js_analysis/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -0
  381. brass/js_analysis/node_modules/@babel/types/lib/validators/isLet.js +17 -0
  382. brass/js_analysis/node_modules/@babel/types/lib/validators/isLet.js.map +1 -0
  383. brass/js_analysis/node_modules/@babel/types/lib/validators/isNode.js +12 -0
  384. brass/js_analysis/node_modules/@babel/types/lib/validators/isNode.js.map +1 -0
  385. brass/js_analysis/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +57 -0
  386. brass/js_analysis/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -0
  387. brass/js_analysis/node_modules/@babel/types/lib/validators/isPlaceholderType.js +15 -0
  388. brass/js_analysis/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -0
  389. brass/js_analysis/node_modules/@babel/types/lib/validators/isReferenced.js +96 -0
  390. brass/js_analysis/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -0
  391. brass/js_analysis/node_modules/@babel/types/lib/validators/isScope.js +18 -0
  392. brass/js_analysis/node_modules/@babel/types/lib/validators/isScope.js.map +1 -0
  393. brass/js_analysis/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +14 -0
  394. brass/js_analysis/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -0
  395. brass/js_analysis/node_modules/@babel/types/lib/validators/isType.js +17 -0
  396. brass/js_analysis/node_modules/@babel/types/lib/validators/isType.js.map +1 -0
  397. brass/js_analysis/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +13 -0
  398. brass/js_analysis/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -0
  399. brass/js_analysis/node_modules/@babel/types/lib/validators/isValidIdentifier.js +18 -0
  400. brass/js_analysis/node_modules/@babel/types/lib/validators/isValidIdentifier.js.map +1 -0
  401. brass/js_analysis/node_modules/@babel/types/lib/validators/isVar.js +19 -0
  402. brass/js_analysis/node_modules/@babel/types/lib/validators/isVar.js.map +1 -0
  403. brass/js_analysis/node_modules/@babel/types/lib/validators/matchesPattern.js +44 -0
  404. brass/js_analysis/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -0
  405. brass/js_analysis/node_modules/@babel/types/lib/validators/react/isCompatTag.js +11 -0
  406. brass/js_analysis/node_modules/@babel/types/lib/validators/react/isCompatTag.js.map +1 -0
  407. brass/js_analysis/node_modules/@babel/types/lib/validators/react/isReactComponent.js +11 -0
  408. brass/js_analysis/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -0
  409. brass/js_analysis/node_modules/@babel/types/lib/validators/validate.js +42 -0
  410. brass/js_analysis/node_modules/@babel/types/lib/validators/validate.js.map +1 -0
  411. brass/js_analysis/node_modules/@babel/types/package.json +39 -0
  412. brass/js_analysis/node_modules/@jridgewell/gen-mapping/LICENSE +19 -0
  413. brass/js_analysis/node_modules/@jridgewell/gen-mapping/README.md +227 -0
  414. brass/js_analysis/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs +292 -0
  415. brass/js_analysis/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs.map +6 -0
  416. brass/js_analysis/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js +346 -0
  417. brass/js_analysis/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js.map +6 -0
  418. brass/js_analysis/node_modules/@jridgewell/gen-mapping/package.json +71 -0
  419. brass/js_analysis/node_modules/@jridgewell/gen-mapping/src/gen-mapping.ts +614 -0
  420. brass/js_analysis/node_modules/@jridgewell/gen-mapping/src/set-array.ts +82 -0
  421. brass/js_analysis/node_modules/@jridgewell/gen-mapping/src/sourcemap-segment.ts +16 -0
  422. brass/js_analysis/node_modules/@jridgewell/gen-mapping/src/types.ts +61 -0
  423. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts +89 -0
  424. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts.map +1 -0
  425. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts +89 -0
  426. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts.map +1 -0
  427. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts +33 -0
  428. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts.map +1 -0
  429. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts +33 -0
  430. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts.map +1 -0
  431. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts +13 -0
  432. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts.map +1 -0
  433. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts +13 -0
  434. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts.map +1 -0
  435. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/types.d.cts +44 -0
  436. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/types.d.cts.map +1 -0
  437. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/types.d.mts +44 -0
  438. brass/js_analysis/node_modules/@jridgewell/gen-mapping/types/types.d.mts.map +1 -0
  439. brass/js_analysis/node_modules/@jridgewell/resolve-uri/LICENSE +19 -0
  440. brass/js_analysis/node_modules/@jridgewell/resolve-uri/README.md +40 -0
  441. brass/js_analysis/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs +232 -0
  442. brass/js_analysis/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map +1 -0
  443. brass/js_analysis/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js +240 -0
  444. brass/js_analysis/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map +1 -0
  445. brass/js_analysis/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +4 -0
  446. brass/js_analysis/node_modules/@jridgewell/resolve-uri/package.json +69 -0
  447. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/LICENSE +19 -0
  448. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/README.md +264 -0
  449. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +423 -0
  450. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +6 -0
  451. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +452 -0
  452. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +6 -0
  453. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/package.json +67 -0
  454. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts +345 -0
  455. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +111 -0
  456. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/src/strings.ts +65 -0
  457. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts +55 -0
  458. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts +50 -0
  459. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map +1 -0
  460. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +50 -0
  461. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map +1 -0
  462. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts +9 -0
  463. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map +1 -0
  464. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +9 -0
  465. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map +1 -0
  466. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts +16 -0
  467. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map +1 -0
  468. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +16 -0
  469. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map +1 -0
  470. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts +7 -0
  471. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map +1 -0
  472. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +7 -0
  473. brass/js_analysis/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map +1 -0
  474. brass/js_analysis/node_modules/@jridgewell/trace-mapping/LICENSE +19 -0
  475. brass/js_analysis/node_modules/@jridgewell/trace-mapping/README.md +348 -0
  476. brass/js_analysis/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +504 -0
  477. brass/js_analysis/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +6 -0
  478. brass/js_analysis/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +558 -0
  479. brass/js_analysis/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +6 -0
  480. brass/js_analysis/node_modules/@jridgewell/trace-mapping/package.json +71 -0
  481. brass/js_analysis/node_modules/@jridgewell/trace-mapping/src/binary-search.ts +115 -0
  482. brass/js_analysis/node_modules/@jridgewell/trace-mapping/src/by-source.ts +65 -0
  483. brass/js_analysis/node_modules/@jridgewell/trace-mapping/src/flatten-map.ts +192 -0
  484. brass/js_analysis/node_modules/@jridgewell/trace-mapping/src/resolve.ts +16 -0
  485. brass/js_analysis/node_modules/@jridgewell/trace-mapping/src/sort.ts +45 -0
  486. brass/js_analysis/node_modules/@jridgewell/trace-mapping/src/sourcemap-segment.ts +23 -0
  487. brass/js_analysis/node_modules/@jridgewell/trace-mapping/src/strip-filename.ts +8 -0
  488. brass/js_analysis/node_modules/@jridgewell/trace-mapping/src/trace-mapping.ts +504 -0
  489. brass/js_analysis/node_modules/@jridgewell/trace-mapping/src/types.ts +114 -0
  490. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts +33 -0
  491. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts.map +1 -0
  492. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts +33 -0
  493. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts.map +1 -0
  494. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts +8 -0
  495. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts.map +1 -0
  496. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts +8 -0
  497. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts.map +1 -0
  498. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts +9 -0
  499. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts.map +1 -0
  500. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts +9 -0
  501. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts.map +1 -0
  502. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts +4 -0
  503. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts.map +1 -0
  504. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts +4 -0
  505. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts.map +1 -0
  506. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/sort.d.cts +3 -0
  507. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/sort.d.cts.map +1 -0
  508. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/sort.d.mts +3 -0
  509. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/sort.d.mts.map +1 -0
  510. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts +17 -0
  511. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts.map +1 -0
  512. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts +17 -0
  513. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts.map +1 -0
  514. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts +5 -0
  515. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts.map +1 -0
  516. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts +5 -0
  517. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts.map +1 -0
  518. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts +80 -0
  519. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts.map +1 -0
  520. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts +80 -0
  521. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts.map +1 -0
  522. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/types.d.cts +107 -0
  523. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/types.d.cts.map +1 -0
  524. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/types.d.mts +107 -0
  525. brass/js_analysis/node_modules/@jridgewell/trace-mapping/types/types.d.mts.map +1 -0
  526. brass/js_analysis/node_modules/debug/LICENSE +20 -0
  527. brass/js_analysis/node_modules/debug/README.md +481 -0
  528. brass/js_analysis/node_modules/debug/package.json +64 -0
  529. brass/js_analysis/node_modules/debug/src/browser.js +272 -0
  530. brass/js_analysis/node_modules/debug/src/common.js +292 -0
  531. brass/js_analysis/node_modules/debug/src/index.js +10 -0
  532. brass/js_analysis/node_modules/debug/src/node.js +263 -0
  533. brass/js_analysis/node_modules/js-tokens/CHANGELOG.md +151 -0
  534. brass/js_analysis/node_modules/js-tokens/LICENSE +21 -0
  535. brass/js_analysis/node_modules/js-tokens/README.md +240 -0
  536. brass/js_analysis/node_modules/js-tokens/index.js +23 -0
  537. brass/js_analysis/node_modules/js-tokens/package.json +30 -0
  538. brass/js_analysis/node_modules/jsesc/LICENSE-MIT.txt +20 -0
  539. brass/js_analysis/node_modules/jsesc/README.md +422 -0
  540. brass/js_analysis/node_modules/jsesc/bin/jsesc +148 -0
  541. brass/js_analysis/node_modules/jsesc/jsesc.js +337 -0
  542. brass/js_analysis/node_modules/jsesc/man/jsesc.1 +94 -0
  543. brass/js_analysis/node_modules/jsesc/package.json +56 -0
  544. brass/js_analysis/node_modules/ms/index.js +162 -0
  545. brass/js_analysis/node_modules/ms/license.md +21 -0
  546. brass/js_analysis/node_modules/ms/package.json +38 -0
  547. brass/js_analysis/node_modules/ms/readme.md +59 -0
  548. brass/js_analysis/node_modules/picocolors/LICENSE +15 -0
  549. brass/js_analysis/node_modules/picocolors/README.md +21 -0
  550. brass/js_analysis/node_modules/picocolors/package.json +25 -0
  551. brass/js_analysis/node_modules/picocolors/picocolors.browser.js +4 -0
  552. brass/js_analysis/node_modules/picocolors/picocolors.d.ts +5 -0
  553. brass/js_analysis/node_modules/picocolors/picocolors.js +75 -0
  554. brass/js_analysis/node_modules/picocolors/types.d.ts +51 -0
  555. brass/js_analysis/package-lock.json +218 -0
  556. brass/js_analysis/package.json +13 -0
  557. brass/licensing/__init__.py +55 -0
  558. brass/licensing/lemonsqueezy.py +205 -0
  559. brass/licensing/store.py +134 -0
  560. brass/models/__init__.py +7 -0
  561. brass/models/finding.py +142 -0
  562. brass/monitoring/__init__.py +7 -0
  563. brass/monitoring/file_watcher.py +408 -0
  564. brass/output/__init__.py +7 -0
  565. brass/output/cross_scanner_overlap.py +132 -0
  566. brass/output/output_generator.py +679 -0
  567. brass/output/redaction_checker.py +254 -0
  568. brass/output/yaml_builders/__init__.py +28 -0
  569. brass/output/yaml_builders/ai_instructions_builder.py +1867 -0
  570. brass/output/yaml_builders/base_builder.py +735 -0
  571. brass/output/yaml_builders/constants.py +44 -0
  572. brass/output/yaml_builders/detailed_analysis_builder.py +111 -0
  573. brass/output/yaml_builders/file_intelligence_builder.py +115 -0
  574. brass/output/yaml_builders/metadata_builder.py +40 -0
  575. brass/output/yaml_builders/privacy_report_builder.py +226 -0
  576. brass/output/yaml_builders/security_report_builder.py +165 -0
  577. brass/output/yaml_builders/statistics_builder.py +264 -0
  578. brass/output/yaml_builders/yaml_utils.py +156 -0
  579. brass/output/yaml_output_generator.py +918 -0
  580. brass/output/yaml_output_generator_v2.py +424 -0
  581. brass/ranking/__init__.py +7 -0
  582. brass/ranking/intelligence_ranker.py +736 -0
  583. brass/scanners/__init__.py +15 -0
  584. brass/scanners/_known_test_values.py +183 -0
  585. brass/scanners/ai_context_coherence_scanner.py +811 -0
  586. brass/scanners/api_security_refactored/__init__.py +35 -0
  587. brass/scanners/api_security_refactored/auth_patterns.py +234 -0
  588. brass/scanners/api_security_refactored/input_validation.py +236 -0
  589. brass/scanners/api_security_refactored/package_hallucination.py +207 -0
  590. brass/scanners/api_security_refactored/scanner.py +213 -0
  591. brass/scanners/api_security_refactored/utils.py +192 -0
  592. brass/scanners/api_security_scanner.py +900 -0
  593. brass/scanners/ast_grep_scanner.py +277 -0
  594. brass/scanners/brass2_privacy_scanner.py +1122 -0
  595. brass/scanners/brass_performance_scanner.py +1615 -0
  596. brass/scanners/content_moderation_scanner.py +793 -0
  597. brass/scanners/file_prefilter_scanner.py +413 -0
  598. brass/scanners/javascript_typescript_scanner.py +771 -0
  599. brass/scanners/noise_reduction_scanner.py +448 -0
  600. brass/scanners/phantom_ai_code_scanner.py +935 -0
  601. brass/scanners/professional_code_scanner.py +1470 -0
  602. brass/scanners/pysa_taint_scanner.py +1501 -0
  603. brass/scanners/secrets_scanner.py +392 -0
  604. brass/scanners/semgrep_taint_scanner.py +478 -0
  605. brass/telemetry/__init__.py +50 -0
  606. brass/telemetry/backend.py +61 -0
  607. brass/telemetry/client.py +82 -0
  608. brass/telemetry/consent.py +82 -0
  609. brasscoders-2.0.4.dist-info/METADATA +251 -0
  610. brasscoders-2.0.4.dist-info/RECORD +615 -0
  611. brasscoders-2.0.4.dist-info/WHEEL +5 -0
  612. brasscoders-2.0.4.dist-info/entry_points.txt +2 -0
  613. brasscoders-2.0.4.dist-info/licenses/LICENSE +202 -0
  614. brasscoders-2.0.4.dist-info/licenses/NOTICE +5 -0
  615. brasscoders-2.0.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _index = require("./path/index.js");
8
+ var _t = require("@babel/types");
9
+ var _context = require("./path/context.js");
10
+ const {
11
+ VISITOR_KEYS
12
+ } = _t;
13
+ class TraversalContext {
14
+ constructor(scope, opts, state, parentPath) {
15
+ this.queue = null;
16
+ this.priorityQueue = null;
17
+ this.parentPath = parentPath;
18
+ this.scope = scope;
19
+ this.state = state;
20
+ this.opts = opts;
21
+ }
22
+ shouldVisit(node) {
23
+ const opts = this.opts;
24
+ if (opts.enter || opts.exit) return true;
25
+ if (opts[node.type]) return true;
26
+ const keys = VISITOR_KEYS[node.type];
27
+ if (!(keys != null && keys.length)) return false;
28
+ for (const key of keys) {
29
+ if (node[key]) {
30
+ return true;
31
+ }
32
+ }
33
+ return false;
34
+ }
35
+ create(node, container, key, listKey) {
36
+ return _index.default.get({
37
+ parentPath: this.parentPath,
38
+ parent: node,
39
+ container,
40
+ key: key,
41
+ listKey
42
+ });
43
+ }
44
+ maybeQueue(path, notPriority) {
45
+ if (this.queue) {
46
+ if (notPriority) {
47
+ this.queue.push(path);
48
+ } else {
49
+ this.priorityQueue.push(path);
50
+ }
51
+ }
52
+ }
53
+ visitMultiple(container, parent, listKey) {
54
+ if (container.length === 0) return false;
55
+ const queue = [];
56
+ for (let key = 0; key < container.length; key++) {
57
+ const node = container[key];
58
+ if (node && this.shouldVisit(node)) {
59
+ queue.push(this.create(parent, container, key, listKey));
60
+ }
61
+ }
62
+ return this.visitQueue(queue);
63
+ }
64
+ visitSingle(node, key) {
65
+ if (this.shouldVisit(node[key])) {
66
+ return this.visitQueue([this.create(node, node, key)]);
67
+ } else {
68
+ return false;
69
+ }
70
+ }
71
+ visitQueue(queue) {
72
+ this.queue = queue;
73
+ this.priorityQueue = [];
74
+ const visited = new WeakSet();
75
+ let stop = false;
76
+ let visitIndex = 0;
77
+ for (; visitIndex < queue.length;) {
78
+ const path = queue[visitIndex];
79
+ visitIndex++;
80
+ _context.resync.call(path);
81
+ if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) {
82
+ _context.pushContext.call(path, this);
83
+ }
84
+ if (path.key === null) continue;
85
+ const {
86
+ node
87
+ } = path;
88
+ if (visited.has(node)) continue;
89
+ if (node) visited.add(node);
90
+ if (path.visit()) {
91
+ stop = true;
92
+ break;
93
+ }
94
+ if (this.priorityQueue.length) {
95
+ stop = this.visitQueue(this.priorityQueue);
96
+ this.priorityQueue = [];
97
+ this.queue = queue;
98
+ if (stop) break;
99
+ }
100
+ }
101
+ for (let i = 0; i < visitIndex; i++) {
102
+ _context.popContext.call(queue[i]);
103
+ }
104
+ this.queue = null;
105
+ return stop;
106
+ }
107
+ visit(node, key) {
108
+ const nodes = node[key];
109
+ if (!nodes) return false;
110
+ if (Array.isArray(nodes)) {
111
+ return this.visitMultiple(nodes, node, key);
112
+ } else {
113
+ return this.visitSingle(node, key);
114
+ }
115
+ }
116
+ }
117
+ exports.default = TraversalContext;
118
+
119
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_index","require","_t","_context","VISITOR_KEYS","TraversalContext","constructor","scope","opts","state","parentPath","queue","priorityQueue","shouldVisit","node","enter","exit","type","keys","length","key","create","container","listKey","NodePath","get","parent","maybeQueue","path","notPriority","push","visitMultiple","visitQueue","visitSingle","visited","WeakSet","stop","visitIndex","resync","call","contexts","pushContext","has","add","visit","i","popContext","nodes","Array","isArray","exports","default"],"sources":["../src/context.ts"],"sourcesContent":["import NodePath from \"./path/index.ts\";\nimport { VISITOR_KEYS } from \"@babel/types\";\nimport type Scope from \"./scope/index.ts\";\nimport type { ExplodedTraverseOptions } from \"./index.ts\";\nimport type * as t from \"@babel/types\";\nimport type { Visitor } from \"./types.ts\";\nimport { popContext, pushContext, resync } from \"./path/context.ts\";\n\nexport default class TraversalContext<S = unknown> {\n constructor(\n scope: Scope,\n opts: ExplodedTraverseOptions<S>,\n state: S,\n parentPath: NodePath,\n ) {\n this.parentPath = parentPath;\n this.scope = scope;\n this.state = state;\n this.opts = opts;\n }\n\n declare parentPath: NodePath;\n declare scope: Scope;\n declare state: S;\n declare opts: ExplodedTraverseOptions<S>;\n queue: Array<NodePath> | null = null;\n priorityQueue: Array<NodePath> | null = null;\n\n /**\n * This method does a simple check to determine whether or not we really need to attempt\n * visit a node. This will prevent us from constructing a NodePath.\n */\n\n shouldVisit(node: t.Node): boolean {\n const opts = this.opts as Visitor;\n if (opts.enter || opts.exit) return true;\n\n // check if we have a visitor for this node\n if (opts[node.type]) return true;\n\n // check if we're going to traverse into this node\n const keys: Array<string> | undefined = VISITOR_KEYS[node.type];\n if (!keys?.length) return false;\n\n // we need to traverse into this node so ensure that it has children to traverse into!\n for (const key of keys) {\n if (\n // @ts-expect-error key is from visitor keys\n node[key]\n ) {\n return true;\n }\n }\n\n return false;\n }\n\n create(\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey?: string,\n ): NodePath {\n // We don't need to `.setContext()` here, since `.visitQueue()` already\n // calls `.pushContext`.\n return NodePath.get({\n parentPath: this.parentPath,\n parent: node,\n container,\n key: key,\n listKey,\n });\n }\n\n maybeQueue(path: NodePath, notPriority?: boolean) {\n if (this.queue) {\n if (notPriority) {\n this.queue.push(path);\n } else {\n this.priorityQueue.push(path);\n }\n }\n }\n\n visitMultiple(container: t.Node[], parent: t.Node, listKey: string) {\n // nothing to traverse!\n if (container.length === 0) return false;\n\n const queue = [];\n\n // build up initial queue\n for (let key = 0; key < container.length; key++) {\n const node = container[key];\n if (node && this.shouldVisit(node)) {\n queue.push(this.create(parent, container, key, listKey));\n }\n }\n\n return this.visitQueue(queue);\n }\n\n visitSingle(node: t.Node, key: string): boolean {\n if (\n this.shouldVisit(\n // @ts-expect-error key may not index node\n node[key],\n )\n ) {\n return this.visitQueue([this.create(node, node, key)]);\n } else {\n return false;\n }\n }\n\n visitQueue(queue: Array<NodePath>): boolean {\n // set queue\n this.queue = queue;\n this.priorityQueue = [];\n\n const visited = new WeakSet();\n let stop = false;\n let visitIndex = 0;\n\n // visit the queue\n for (; visitIndex < queue.length; ) {\n const path = queue[visitIndex];\n visitIndex++;\n resync.call(path);\n\n if (\n path.contexts.length === 0 ||\n path.contexts[path.contexts.length - 1] !== this\n ) {\n // The context might already have been pushed when this path was inserted and queued.\n // If we always re-pushed here, we could get duplicates and risk leaving contexts\n // on the stack after the traversal has completed, which could break things.\n pushContext.call(path, this);\n }\n\n // this path no longer belongs to the tree\n if (path.key === null) continue;\n\n // ensure we don't visit the same node twice\n const { node } = path;\n if (visited.has(node)) continue;\n if (node) visited.add(node);\n\n if (path.visit()) {\n stop = true;\n break;\n }\n\n if (this.priorityQueue.length) {\n stop = this.visitQueue(this.priorityQueue);\n this.priorityQueue = [];\n this.queue = queue;\n if (stop) break;\n }\n }\n\n // pop contexts\n for (let i = 0; i < visitIndex; i++) {\n popContext.call(queue[i]);\n }\n\n // clear queue\n this.queue = null;\n\n return stop;\n }\n\n visit(node: t.Node, key: string) {\n // @ts-expect-error key may not index node\n const nodes = node[key] as t.Node | t.Node[] | null;\n if (!nodes) return false;\n\n if (Array.isArray(nodes)) {\n return this.visitMultiple(nodes, node, key);\n } else {\n return this.visitSingle(node, key);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,EAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAAoE;EAL3DG;AAAY,IAAAF,EAAA;AAON,MAAMG,gBAAgB,CAAc;EACjDC,WAAWA,CACTC,KAAY,EACZC,IAAgC,EAChCC,KAAQ,EACRC,UAAoB,EACpB;IAAA,KAWFC,KAAK,GAA2B,IAAI;IAAA,KACpCC,aAAa,GAA2B,IAAI;IAX1C,IAAI,CAACF,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACH,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACE,KAAK,GAAGA,KAAK;IAClB,IAAI,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-0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ class Hub {
8
+ getCode() {}
9
+ getScope() {}
10
+ addHelper() {
11
+ throw new Error("Helpers are not supported by the default hub.");
12
+ }
13
+ buildError(node, msg, Error = TypeError) {
14
+ return new Error(msg);
15
+ }
16
+ }
17
+ exports.default = Hub;
18
+
19
+ //# sourceMappingURL=hub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Hub","getCode","getScope","addHelper","Error","buildError","node","msg","TypeError","exports","default"],"sources":["../src/hub.ts"],"sourcesContent":["import type Scope from \"./scope/index.ts\";\nimport type { Node } from \"@babel/types\";\n\nexport interface HubInterface {\n getCode(): string | void;\n getScope(): Scope | void;\n addHelper(name: string): any;\n buildError(node: Node, msg: string, Error: new () => Error): Error;\n}\n\nexport default class Hub implements HubInterface {\n getCode() {}\n\n getScope() {}\n\n addHelper() {\n throw new Error(\"Helpers are not supported by the default hub.\");\n }\n\n buildError(node: Node, msg: string, Error = TypeError): Error {\n return new Error(msg);\n }\n}\n"],"mappings":";;;;;;AAUe,MAAMA,GAAG,CAAyB;EAC/CC,OAAOA,CAAA,EAAG,CAAC;EAEXC,QAAQA,CAAA,EAAG,CAAC;EAEZC,SAASA,CAAA,EAAG;IACV,MAAM,IAAIC,KAAK,CAAC,+CAA+C,CAAC;EAClE;EAEAC,UAAUA,CAACC,IAAU,EAAEC,GAAW,EAAEH,KAAK,GAAGI,SAAS,EAAS;IAC5D,OAAO,IAAIJ,KAAK,CAACG,GAAG,CAAC;EACvB;AACF;AAACE,OAAA,CAAAC,OAAA,GAAAV,GAAA","ignoreList":[]}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Hub", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _hub.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "NodePath", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _index.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "Scope", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _index2.default;
22
+ }
23
+ });
24
+ exports.visitors = exports.default = void 0;
25
+ require("./path/context.js");
26
+ var visitors = require("./visitors.js");
27
+ exports.visitors = visitors;
28
+ var _t = require("@babel/types");
29
+ var cache = require("./cache.js");
30
+ var _traverseNode = require("./traverse-node.js");
31
+ var _index = require("./path/index.js");
32
+ var _index2 = require("./scope/index.js");
33
+ var _hub = require("./hub.js");
34
+ const {
35
+ VISITOR_KEYS,
36
+ removeProperties,
37
+ traverseFast
38
+ } = _t;
39
+ function traverse(parent, opts = {}, scope, state, parentPath, visitSelf) {
40
+ if (!parent) return;
41
+ if (!opts.noScope && !scope) {
42
+ if (parent.type !== "Program" && parent.type !== "File") {
43
+ throw new Error("You must pass a scope and parentPath unless traversing a Program/File. " + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath.");
44
+ }
45
+ }
46
+ if (!parentPath && visitSelf) {
47
+ throw new Error("visitSelf can only be used when providing a NodePath.");
48
+ }
49
+ if (!VISITOR_KEYS[parent.type]) {
50
+ return;
51
+ }
52
+ visitors.explode(opts);
53
+ (0, _traverseNode.traverseNode)(parent, opts, scope, state, parentPath, null, visitSelf);
54
+ }
55
+ var _default = exports.default = traverse;
56
+ traverse.visitors = visitors;
57
+ traverse.verify = visitors.verify;
58
+ traverse.explode = visitors.explode;
59
+ traverse.cheap = function (node, enter) {
60
+ traverseFast(node, enter);
61
+ return;
62
+ };
63
+ traverse.node = function (node, opts, scope, state, path, skipKeys) {
64
+ (0, _traverseNode.traverseNode)(node, opts, scope, state, path, skipKeys);
65
+ };
66
+ traverse.clearNode = function (node, opts) {
67
+ removeProperties(node, opts);
68
+ };
69
+ traverse.removeProperties = function (tree, opts) {
70
+ traverseFast(tree, traverse.clearNode, opts);
71
+ return tree;
72
+ };
73
+ traverse.hasType = function (tree, type, denylistTypes) {
74
+ if (denylistTypes != null && denylistTypes.includes(tree.type)) return false;
75
+ if (tree.type === type) return true;
76
+ return traverseFast(tree, function (node) {
77
+ if (denylistTypes != null && denylistTypes.includes(node.type)) {
78
+ return traverseFast.skip;
79
+ }
80
+ if (node.type === type) {
81
+ return traverseFast.stop;
82
+ }
83
+ });
84
+ };
85
+ traverse.cache = cache;
86
+
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["require","visitors","exports","_t","cache","_traverseNode","_index","_index2","_hub","VISITOR_KEYS","removeProperties","traverseFast","traverse","parent","opts","scope","state","parentPath","visitSelf","noScope","type","Error","explode","traverseNode","_default","default","verify","cheap","node","enter","path","skipKeys","clearNode","tree","hasType","denylistTypes","includes","skip","stop"],"sources":["../src/index.ts"],"sourcesContent":["import \"./path/context.ts\"; // We have some cycles, this ensures correct order to avoid TDZ\nimport * as visitors from \"./visitors.ts\";\nimport {\n VISITOR_KEYS,\n removeProperties,\n type RemovePropertiesOptions,\n traverseFast,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as cache from \"./cache.ts\";\nimport type NodePath from \"./path/index.ts\";\nimport type { default as Scope, Binding } from \"./scope/index.ts\";\nimport type { ExplodedVisitor, Visitor, VisitorBase } from \"./types.ts\";\nimport { traverseNode } from \"./traverse-node.ts\";\n\nexport type { ExplodedVisitor, Visitor, VisitorBase, Binding };\nexport { default as NodePath } from \"./path/index.ts\";\nexport { default as Scope } from \"./scope/index.ts\";\nexport { default as Hub } from \"./hub.ts\";\nexport type { HubInterface } from \"./hub.ts\";\n\nexport { visitors };\n\nexport type TraverseOptions<S = t.Node> = {\n scope?: Scope;\n noScope?: boolean;\n denylist?: string[];\n shouldSkip?: (node: NodePath) => boolean;\n} & Visitor<S>;\n\nexport type ExplodedTraverseOptions<S = t.Node> = TraverseOptions<S> &\n ExplodedVisitor<S>;\n\nfunction traverse<S>(\n parent: t.Node,\n opts: TraverseOptions<S>,\n scope: Scope | undefined,\n state: S,\n parentPath?: NodePath,\n visitSelf?: boolean,\n): void;\n\nfunction traverse(\n parent: t.Node,\n opts: TraverseOptions,\n scope?: Scope,\n state?: any,\n parentPath?: NodePath,\n visitSelf?: boolean,\n): void;\n\nfunction traverse<Options extends TraverseOptions>(\n parent: t.Node,\n // @ts-expect-error provide {} as default value for Options\n opts: Options = {},\n scope?: Scope,\n state?: any,\n parentPath?: NodePath,\n visitSelf?: boolean,\n) {\n if (!parent) return;\n\n if (!opts.noScope && !scope) {\n if (parent.type !== \"Program\" && parent.type !== \"File\") {\n throw new Error(\n \"You must pass a scope and parentPath unless traversing a Program/File. \" +\n `Instead of that you tried to traverse a ${parent.type} node without ` +\n \"passing scope and parentPath.\",\n );\n }\n }\n\n if (!parentPath && visitSelf) {\n throw new Error(\"visitSelf can only be used when providing a NodePath.\");\n }\n\n if (!VISITOR_KEYS[parent.type]) {\n return;\n }\n\n visitors.explode(opts as Visitor);\n\n traverseNode(\n parent,\n opts as ExplodedVisitor,\n scope,\n state,\n parentPath,\n /* skipKeys */ null,\n visitSelf,\n );\n}\n\nexport default traverse;\n\ntraverse.visitors = visitors;\ntraverse.verify = visitors.verify;\ntraverse.explode = visitors.explode;\n\ntraverse.cheap = function (node: t.Node, enter: (node: t.Node) => void) {\n traverseFast(node, enter);\n return;\n};\n\ntraverse.node = function (\n node: t.Node,\n opts: ExplodedTraverseOptions,\n scope?: Scope,\n state?: any,\n path?: NodePath,\n skipKeys?: Record<string, boolean>,\n) {\n traverseNode(node, opts, scope, state, path, skipKeys);\n // traverse.node always returns undefined\n};\n\ntraverse.clearNode = function (node: t.Node, opts?: RemovePropertiesOptions) {\n removeProperties(node, opts);\n};\n\ntraverse.removeProperties = function (\n tree: t.Node,\n opts?: RemovePropertiesOptions,\n) {\n traverseFast(tree, traverse.clearNode, opts);\n return tree;\n};\n\ntraverse.hasType = function (\n tree: t.Node,\n type: t.Node[\"type\"],\n denylistTypes?: Array<string>,\n): boolean {\n // the node we're searching in is denylisted\n if (denylistTypes?.includes(tree.type)) return false;\n\n // the type we're looking for is the same as the passed node\n if (tree.type === type) return true;\n\n return traverseFast(tree, function (node) {\n if (denylistTypes?.includes(node.type)) {\n return traverseFast.skip;\n }\n if (node.type === type) {\n return traverseFast.stop;\n }\n });\n};\n\ntraverse.cache = cache;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAA0CE,OAAA,CAAAD,QAAA,GAAAA,QAAA;AAC1C,IAAAE,EAAA,GAAAH,OAAA;AAOA,IAAAI,KAAA,GAAAJ,OAAA;AAIA,IAAAK,aAAA,GAAAL,OAAA;AAGA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,IAAA,GAAAR,OAAA;AAA0C;EAfxCS,YAAY;EACZC,gBAAgB;EAEhBC;AAAY,IAAAR,EAAA;AA6Cd,SAASS,QAAQA,CACfC,MAAc,EAEdC,IAAa,GAAG,CAAC,CAAC,EAClBC,KAAa,EACbC,KAAW,EACXC,UAAqB,EACrBC,SAAmB,EACnB;EACA,IAAI,CAACL,MAAM,EAAE;EAEb,IAAI,CAACC,IAAI,CAACK,OAAO,IAAI,CAACJ,KAAK,EAAE;IAC3B,IAAIF,MAAM,CAACO,IAAI,KAAK,SAAS,IAAIP,MAAM,CAACO,IAAI,KAAK,MAAM,EAAE;MACvD,MAAM,IAAIC,KAAK,CACb,yEAAyE,GACvE,2CAA2CR,MAAM,CAACO,IAAI,gBAAgB,GACtE,+BACJ,CAAC;IACH;EACF;EAEA,IAAI,CAACH,UAAU,IAAIC,SAAS,EAAE;IAC5B,MAAM,IAAIG,KAAK,CAAC,uDAAuD,CAAC;EAC1E;EAEA,IAAI,CAACZ,YAAY,CAACI,MAAM,CAACO,IAAI,CAAC,EAAE;IAC9B;EACF;EAEAnB,QAAQ,CAACqB,OAAO,CAACR,IAAe,CAA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EAAE,OAAO,IAAI;EAEnC,OAAOT,YAAY,CAACsB,IAAI,EAAE,UAAUL,IAAI,EAAE;IACxC,IAAIO,aAAa,YAAbA,aAAa,CAAEC,QAAQ,CAACR,IAAI,CAACR,IAAI,CAAC,EAAE;MACtC,OAAOT,YAAY,CAAC0B,IAAI;IAC1B;IACA,IAAIT,IAAI,CAACR,IAAI,KAAKA,IAAI,EAAE;MACtB,OAAOT,YAAY,CAAC2B,IAAI;IAC1B;EACF,CAAC,CAAC;AACJ,CAAC;AAED1B,QAAQ,CAACR,KAAK,GAAGA,KAAK","ignoreList":[]}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.find = find;
7
+ exports.findParent = findParent;
8
+ exports.getAncestry = getAncestry;
9
+ exports.getDeepestCommonAncestorFrom = getDeepestCommonAncestorFrom;
10
+ exports.getEarliestCommonAncestorFrom = getEarliestCommonAncestorFrom;
11
+ exports.getFunctionParent = getFunctionParent;
12
+ exports.getStatementParent = getStatementParent;
13
+ exports.inType = inType;
14
+ exports.isAncestor = isAncestor;
15
+ exports.isDescendant = isDescendant;
16
+ var _t = require("@babel/types");
17
+ const {
18
+ VISITOR_KEYS
19
+ } = _t;
20
+ function findParent(callback) {
21
+ let path = this;
22
+ while (path = path.parentPath) {
23
+ if (callback(path)) return path;
24
+ }
25
+ return null;
26
+ }
27
+ function find(callback) {
28
+ let path = this;
29
+ do {
30
+ if (callback(path)) return path;
31
+ } while (path = path.parentPath);
32
+ return null;
33
+ }
34
+ function getFunctionParent() {
35
+ return this.findParent(p => p.isFunction());
36
+ }
37
+ function getStatementParent() {
38
+ let path = this;
39
+ do {
40
+ if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) {
41
+ break;
42
+ } else {
43
+ path = path.parentPath;
44
+ }
45
+ } while (path);
46
+ if (path && (path.isProgram() || path.isFile())) {
47
+ throw new Error("File/Program node, we can't possibly find a statement parent to this");
48
+ }
49
+ return path;
50
+ }
51
+ function getEarliestCommonAncestorFrom(paths) {
52
+ return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) {
53
+ let earliest;
54
+ const keys = VISITOR_KEYS[deepest.type];
55
+ for (const ancestry of ancestries) {
56
+ const path = ancestry[i + 1];
57
+ if (!earliest) {
58
+ earliest = path;
59
+ continue;
60
+ }
61
+ if (path.listKey && earliest.listKey === path.listKey) {
62
+ if (path.key < earliest.key) {
63
+ earliest = path;
64
+ continue;
65
+ }
66
+ }
67
+ const earliestKeyIndex = keys.indexOf(earliest.parentKey);
68
+ const currentKeyIndex = keys.indexOf(path.parentKey);
69
+ if (earliestKeyIndex > currentKeyIndex) {
70
+ earliest = path;
71
+ }
72
+ }
73
+ return earliest;
74
+ });
75
+ }
76
+ function getDeepestCommonAncestorFrom(paths, filter) {
77
+ if (!paths.length) {
78
+ return this;
79
+ }
80
+ if (paths.length === 1) {
81
+ return paths[0];
82
+ }
83
+ let minDepth = Infinity;
84
+ let lastCommonIndex, lastCommon;
85
+ const ancestries = paths.map(path => {
86
+ const ancestry = [];
87
+ do {
88
+ ancestry.unshift(path);
89
+ } while ((path = path.parentPath) && path !== this);
90
+ if (ancestry.length < minDepth) {
91
+ minDepth = ancestry.length;
92
+ }
93
+ return ancestry;
94
+ });
95
+ const first = ancestries[0];
96
+ depthLoop: for (let i = 0; i < minDepth; i++) {
97
+ const shouldMatch = first[i];
98
+ for (const ancestry of ancestries) {
99
+ if (ancestry[i] !== shouldMatch) {
100
+ break depthLoop;
101
+ }
102
+ }
103
+ lastCommonIndex = i;
104
+ lastCommon = shouldMatch;
105
+ }
106
+ if (lastCommon) {
107
+ if (filter) {
108
+ return filter(lastCommon, lastCommonIndex, ancestries);
109
+ } else {
110
+ return lastCommon;
111
+ }
112
+ } else {
113
+ throw new Error("Couldn't find intersection");
114
+ }
115
+ }
116
+ function getAncestry() {
117
+ let path = this;
118
+ const paths = [];
119
+ do {
120
+ paths.push(path);
121
+ } while (path = path.parentPath);
122
+ return paths;
123
+ }
124
+ function isAncestor(maybeDescendant) {
125
+ return maybeDescendant.isDescendant(this);
126
+ }
127
+ function isDescendant(maybeAncestor) {
128
+ return !!this.findParent(parent => parent === maybeAncestor);
129
+ }
130
+ function inType(...candidateTypes) {
131
+ let path = this;
132
+ while (path) {
133
+ if (candidateTypes.includes(path.node.type)) return true;
134
+ path = path.parentPath;
135
+ }
136
+ return false;
137
+ }
138
+
139
+ //# sourceMappingURL=ancestry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_t","require","VISITOR_KEYS","findParent","callback","path","parentPath","find","getFunctionParent","p","isFunction","getStatementParent","Array","isArray","container","isStatement","isProgram","isFile","Error","getEarliestCommonAncestorFrom","paths","getDeepestCommonAncestorFrom","deepest","i","ancestries","earliest","keys","type","ancestry","listKey","key","earliestKeyIndex","indexOf","parentKey","currentKeyIndex","filter","length","minDepth","Infinity","lastCommonIndex","lastCommon","map","unshift","first","depthLoop","shouldMatch","getAncestry","push","isAncestor","maybeDescendant","isDescendant","maybeAncestor","parent","inType","candidateTypes","includes","node"],"sources":["../../src/path/ancestry.ts"],"sourcesContent":["// This file contains that retrieve or validate anything related to the current paths ancestry.\n\nimport { VISITOR_KEYS } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type NodePath from \"./index.ts\";\n\n/**\n * Starting at the parent path of the current `NodePath` and going up the\n * tree, return the first `NodePath` that causes the provided `callback`\n * to return a truthy value, or `null` if the `callback` never returns a\n * truthy value.\n */\n\nexport function findParent(\n this: NodePath,\n callback: (path: NodePath) => boolean,\n): NodePath | null {\n let path = this;\n while ((path = path.parentPath)) {\n if (callback(path)) return path;\n }\n return null;\n}\n\n/**\n * Starting at current `NodePath` and going up the tree, return the first\n * `NodePath` that causes the provided `callback` to return a truthy value,\n * or `null` if the `callback` never returns a truthy value.\n */\n\nexport function find(\n this: NodePath,\n callback: (path: NodePath) => boolean,\n): NodePath | null {\n let path = this;\n do {\n if (callback(path)) return path;\n } while ((path = path.parentPath));\n return null;\n}\n\n/**\n * Get the parent function of the current path.\n */\n\nexport function getFunctionParent(this: NodePath): NodePath<t.Function> | null {\n return this.findParent(p => p.isFunction()) as NodePath<t.Function> | null;\n}\n\n/**\n * Walk up the tree until we hit a parent node path in a list.\n */\n\nexport function getStatementParent(this: NodePath): NodePath<t.Statement> {\n let path = this;\n\n do {\n if (\n !path.parentPath ||\n (Array.isArray(path.container) && path.isStatement())\n ) {\n break;\n } else {\n path = path.parentPath;\n }\n } while (path);\n\n if (path && (path.isProgram() || path.isFile())) {\n throw new Error(\n \"File/Program node, we can't possibly find a statement parent to this\",\n );\n }\n\n return path as NodePath<t.Statement>;\n}\n\n/**\n * Get the deepest common ancestor and then from it, get the earliest relationship path\n * to that ancestor.\n *\n * Earliest is defined as being \"before\" all the other nodes in terms of list container\n * position and visiting key.\n */\n\nexport function getEarliestCommonAncestorFrom(\n this: NodePath,\n paths: Array<NodePath>,\n): NodePath {\n return this.getDeepestCommonAncestorFrom(\n paths,\n function (deepest, i, ancestries) {\n let earliest;\n const keys = VISITOR_KEYS[deepest.type];\n\n for (const ancestry of ancestries) {\n const path = ancestry[i + 1];\n\n // first path\n if (!earliest) {\n earliest = path;\n continue;\n }\n\n // handle containers\n if (path.listKey && earliest.listKey === path.listKey) {\n // we're in the same container so check if we're earlier\n if (path.key < earliest.key) {\n earliest = path;\n continue;\n }\n }\n\n // handle keys\n const earliestKeyIndex = keys.indexOf(earliest.parentKey);\n const currentKeyIndex = keys.indexOf(path.parentKey);\n if (earliestKeyIndex > currentKeyIndex) {\n // key appears before so it's earlier\n earliest = path;\n }\n }\n\n return earliest;\n },\n );\n}\n\n/**\n * Get the earliest path in the tree where the provided `paths` intersect.\n *\n * TODO: Possible optimisation target.\n */\n\nexport function getDeepestCommonAncestorFrom(\n this: NodePath,\n paths: Array<NodePath>,\n filter?: (deepest: NodePath, i: number, ancestries: NodePath[][]) => NodePath,\n): NodePath {\n if (!paths.length) {\n return this;\n }\n\n if (paths.length === 1) {\n return paths[0];\n }\n\n // minimum depth of the tree so we know the highest node\n let minDepth = Infinity;\n\n // last common ancestor\n let lastCommonIndex, lastCommon;\n\n // get the ancestors of the path, breaking when the parent exceeds ourselves\n const ancestries = paths.map(path => {\n const ancestry: NodePath[] = [];\n\n do {\n ancestry.unshift(path);\n } while ((path = path.parentPath) && path !== this);\n\n // save min depth to avoid going too far in\n if (ancestry.length < minDepth) {\n minDepth = ancestry.length;\n }\n\n return ancestry;\n });\n\n // get the first ancestry so we have a seed to assess all other ancestries with\n const first = ancestries[0];\n\n // check ancestor equality\n depthLoop: for (let i = 0; i < minDepth; i++) {\n const shouldMatch = first[i];\n\n for (const ancestry of ancestries) {\n if (ancestry[i] !== shouldMatch) {\n // we've hit a snag\n break depthLoop;\n }\n }\n\n // next iteration may break so store these so they can be returned\n lastCommonIndex = i;\n lastCommon = shouldMatch;\n }\n\n if (lastCommon) {\n if (filter) {\n return filter(lastCommon, lastCommonIndex, ancestries);\n } else {\n return lastCommon;\n }\n } else {\n throw new Error(\"Couldn't find intersection\");\n }\n}\n\n/**\n * Build an array of node paths containing the entire ancestry of the current node path.\n *\n * NOTE: The current node path is included in this.\n */\n\nexport function getAncestry(this: NodePath): Array<NodePath> {\n let path = this;\n const paths = [];\n do {\n paths.push(path);\n } while ((path = path.parentPath));\n return paths;\n}\n\n/**\n * A helper to find if `this` path is an ancestor of @param maybeDescendant\n */\nexport function isAncestor(this: NodePath, maybeDescendant: NodePath): boolean {\n return maybeDescendant.isDescendant(this);\n}\n\n/**\n * A helper to find if `this` path is a descendant of @param maybeAncestor\n */\nexport function isDescendant(this: NodePath, maybeAncestor: NodePath): boolean {\n return !!this.findParent(parent => parent === maybeAncestor);\n}\n\nexport function inType(this: NodePath, ...candidateTypes: string[]): boolean {\n let path = this;\n while (path) {\n if (candidateTypes.includes(path.node.type)) return true;\n path = path.parentPath;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA,IAAAA,EAAA,GAAA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,CAACiD,MAAM,IAAIA,MAAM,KAAKD,aAAa,CAAC;AAC9D;AAEO,SAASE,MAAMA,CAAiB,GAAGC,cAAwB,EAAW;EAC3E,IAAIjD,IAAI,GAAG,IAAI;EACf,OAAOA,IAAI,EAAE;IACX,IAAIiD,cAAc,CAACC,QAAQ,CAAClD,IAAI,CAACmD,IAAI,CAAC7B,IAAI,CAAC,EAAE,OAAO,IAAI;IACxDtB,IAAI,GAAGA,IAAI,CAACC,UAAU;EACxB;EAEA,OAAO,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addComment = addComment;
7
+ exports.addComments = addComments;
8
+ exports.shareCommentsWithSiblings = shareCommentsWithSiblings;
9
+ var _t = require("@babel/types");
10
+ const {
11
+ addComment: _addComment,
12
+ addComments: _addComments
13
+ } = _t;
14
+ function shareCommentsWithSiblings() {
15
+ if (typeof this.key === "string") return;
16
+ const node = this.node;
17
+ if (!node) return;
18
+ const trailing = node.trailingComments;
19
+ const leading = node.leadingComments;
20
+ if (!trailing && !leading) return;
21
+ const prev = this.getSibling(this.key - 1);
22
+ const next = this.getSibling(this.key + 1);
23
+ const hasPrev = Boolean(prev.node);
24
+ const hasNext = Boolean(next.node);
25
+ if (hasPrev) {
26
+ if (leading) {
27
+ prev.addComments("trailing", removeIfExisting(leading, prev.node.trailingComments));
28
+ }
29
+ if (trailing && !hasNext) prev.addComments("trailing", trailing);
30
+ }
31
+ if (hasNext) {
32
+ if (trailing) {
33
+ next.addComments("leading", removeIfExisting(trailing, next.node.leadingComments));
34
+ }
35
+ if (leading && !hasPrev) next.addComments("leading", leading);
36
+ }
37
+ }
38
+ function removeIfExisting(list, toRemove) {
39
+ if (!(toRemove != null && toRemove.length)) return list;
40
+ const set = new Set(toRemove);
41
+ return list.filter(el => {
42
+ return !set.has(el);
43
+ });
44
+ }
45
+ function addComment(type, content, line) {
46
+ _addComment(this.node, type, content, line);
47
+ }
48
+ function addComments(type, comments) {
49
+ _addComments(this.node, type, comments);
50
+ }
51
+
52
+ //# sourceMappingURL=comments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_t","require","addComment","_addComment","addComments","_addComments","shareCommentsWithSiblings","key","node","trailing","trailingComments","leading","leadingComments","prev","getSibling","next","hasPrev","Boolean","hasNext","removeIfExisting","list","toRemove","length","set","Set","filter","el","has","type","content","line","comments"],"sources":["../../src/path/comments.ts"],"sourcesContent":["// This file contains methods responsible for dealing with comments.\nimport type * as t from \"@babel/types\";\nimport type NodePath from \"./index.ts\";\nimport {\n addComment as _addComment,\n addComments as _addComments,\n} from \"@babel/types\";\n\n/**\n * Share comments amongst siblings.\n */\n\nexport function shareCommentsWithSiblings(this: NodePath) {\n // NOTE: this assumes numbered keys\n if (typeof this.key === \"string\") return;\n\n const node = this.node;\n if (!node) return;\n\n const trailing = node.trailingComments;\n const leading = node.leadingComments;\n if (!trailing && !leading) return;\n\n const prev = this.getSibling(this.key - 1);\n const next = this.getSibling(this.key + 1);\n const hasPrev = Boolean(prev.node);\n const hasNext = Boolean(next.node);\n\n if (hasPrev) {\n if (leading) {\n prev.addComments(\n \"trailing\",\n removeIfExisting(leading, prev.node.trailingComments),\n );\n }\n if (trailing && !hasNext) prev.addComments(\"trailing\", trailing);\n }\n if (hasNext) {\n if (trailing) {\n next.addComments(\n \"leading\",\n removeIfExisting(trailing, next.node.leadingComments),\n );\n }\n if (leading && !hasPrev) next.addComments(\"leading\", leading);\n }\n}\n\nfunction removeIfExisting<T>(list: T[], toRemove?: T[]): T[] {\n if (!toRemove?.length) return list;\n const set = new Set(toRemove);\n return list.filter(el => {\n return !set.has(el);\n });\n}\n\nexport function addComment(\n this: NodePath,\n type: t.CommentTypeShorthand,\n content: string,\n line?: boolean,\n) {\n _addComment(this.node, type, content, line);\n}\n\n/**\n * Give node `comments` of the specified `type`.\n */\n\nexport function addComments(\n this: NodePath,\n type: t.CommentTypeShorthand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