@galadrim/galadmin 0.1.38 → 0.1.40

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 (486) hide show
  1. package/dist/tsconfig.tsbuildinfo +1 -1
  2. package/package.json +1 -1
  3. package/src/front/build/asset-manifest.json +3 -3
  4. package/src/front/build/index.html +1 -1
  5. package/src/front/build/static/js/{main.4ce5340d.chunk.js → main.8a63b422.chunk.js} +2 -2
  6. package/src/front/build/static/js/main.8a63b422.chunk.js.map +1 -0
  7. package/src/front/node_modules/.cache/.eslintcache +1 -1
  8. package/src/front/node_modules/.cache/babel-loader/0046fa6def7297665aceff65675276fb.json +1 -0
  9. package/src/front/node_modules/.cache/babel-loader/6b6404ad16b4fb247c0dfe43c03f4a02.json +1 -0
  10. package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/ef/81/2c9ecc926af52757cb3670536bc07219d1ccfba4d898a451352553fa6634b48d69ec580dd7c756e5fbcdc72e870664ef6bd7dc1af98e94d9eb182ba93be9 +1 -0
  11. package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/{c2/e5/5451dd89bb0fd48f988bf27c7ee614c66eb91f7085c5b5c8cb33048d0c32 → 31/fe/6640db1983b9834e63d1a760fa17521e8cf616b567ef7114a0676aa6971a} +1 -1
  12. package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/6c/19/fe86ba5d7c4062f185480ad22dd3b9fae9b30149827224339f9a633a9a94 +1 -1
  13. package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/87/08/421190bfe6e50816e059da6c33526c9943732ef856ebd2752d0cbfb4a852 +1 -1
  14. package/src/front/node_modules/.package-lock.json +72 -72
  15. package/src/front/node_modules/@babel/code-frame/lib/index.js +5 -4
  16. package/src/front/node_modules/@babel/code-frame/lib/index.js.map +1 -1
  17. package/src/front/node_modules/@babel/code-frame/package.json +3 -2
  18. package/src/front/node_modules/@babel/core/lib/config/cache-contexts.js.map +1 -1
  19. package/src/front/node_modules/@babel/core/lib/config/caching.js +2 -2
  20. package/src/front/node_modules/@babel/core/lib/config/caching.js.map +1 -1
  21. package/src/front/node_modules/@babel/core/lib/config/config-chain.js +13 -13
  22. package/src/front/node_modules/@babel/core/lib/config/config-chain.js.map +1 -1
  23. package/src/front/node_modules/@babel/core/lib/config/config-descriptors.js +6 -6
  24. package/src/front/node_modules/@babel/core/lib/config/config-descriptors.js.map +1 -1
  25. package/src/front/node_modules/@babel/core/lib/config/files/configuration.js +44 -41
  26. package/src/front/node_modules/@babel/core/lib/config/files/configuration.js.map +1 -1
  27. package/src/front/node_modules/@babel/core/lib/config/files/import-meta-resolve.js +1 -1
  28. package/src/front/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map +1 -1
  29. package/src/front/node_modules/@babel/core/lib/config/files/index-browser.js.map +1 -1
  30. package/src/front/node_modules/@babel/core/lib/config/files/index.js +3 -3
  31. package/src/front/node_modules/@babel/core/lib/config/files/index.js.map +1 -1
  32. package/src/front/node_modules/@babel/core/lib/config/files/module-types.js +27 -8
  33. package/src/front/node_modules/@babel/core/lib/config/files/module-types.js.map +1 -1
  34. package/src/front/node_modules/@babel/core/lib/config/files/package.js +2 -2
  35. package/src/front/node_modules/@babel/core/lib/config/files/package.js.map +1 -1
  36. package/src/front/node_modules/@babel/core/lib/config/files/plugins.js +3 -3
  37. package/src/front/node_modules/@babel/core/lib/config/files/plugins.js.map +1 -1
  38. package/src/front/node_modules/@babel/core/lib/config/files/types.js.map +1 -1
  39. package/src/front/node_modules/@babel/core/lib/config/files/utils.js +2 -2
  40. package/src/front/node_modules/@babel/core/lib/config/files/utils.js.map +1 -1
  41. package/src/front/node_modules/@babel/core/lib/config/full.js +13 -13
  42. package/src/front/node_modules/@babel/core/lib/config/full.js.map +1 -1
  43. package/src/front/node_modules/@babel/core/lib/config/helpers/config-api.js +6 -6
  44. package/src/front/node_modules/@babel/core/lib/config/helpers/config-api.js.map +1 -1
  45. package/src/front/node_modules/@babel/core/lib/config/index.js +60 -40
  46. package/src/front/node_modules/@babel/core/lib/config/index.js.map +1 -1
  47. package/src/front/node_modules/@babel/core/lib/config/item.js +1 -1
  48. package/src/front/node_modules/@babel/core/lib/config/item.js.map +1 -1
  49. package/src/front/node_modules/@babel/core/lib/config/partial.js +15 -23
  50. package/src/front/node_modules/@babel/core/lib/config/partial.js.map +1 -1
  51. package/src/front/node_modules/@babel/core/lib/config/plugin.js +1 -1
  52. package/src/front/node_modules/@babel/core/lib/config/plugin.js.map +1 -1
  53. package/src/front/node_modules/@babel/core/lib/config/printer.js.map +1 -1
  54. package/src/front/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map +1 -1
  55. package/src/front/node_modules/@babel/core/lib/config/resolve-targets.js.map +1 -1
  56. package/src/front/node_modules/@babel/core/lib/config/util.js.map +1 -1
  57. package/src/front/node_modules/@babel/core/lib/config/validation/option-assertions.js +1 -1
  58. package/src/front/node_modules/@babel/core/lib/config/validation/option-assertions.js.map +1 -1
  59. package/src/front/node_modules/@babel/core/lib/config/validation/options.js +3 -3
  60. package/src/front/node_modules/@babel/core/lib/config/validation/options.js.map +1 -1
  61. package/src/front/node_modules/@babel/core/lib/config/validation/plugins.js +1 -1
  62. package/src/front/node_modules/@babel/core/lib/config/validation/plugins.js.map +1 -1
  63. package/src/front/node_modules/@babel/core/lib/errors/config-error.js +1 -1
  64. package/src/front/node_modules/@babel/core/lib/errors/config-error.js.map +1 -1
  65. package/src/front/node_modules/@babel/core/lib/gensync-utils/functional.js +1 -1
  66. package/src/front/node_modules/@babel/core/lib/gensync-utils/functional.js.map +1 -1
  67. package/src/front/node_modules/@babel/core/lib/index.js +23 -23
  68. package/src/front/node_modules/@babel/core/lib/index.js.map +1 -1
  69. package/src/front/node_modules/@babel/core/lib/parse.js +6 -6
  70. package/src/front/node_modules/@babel/core/lib/parse.js.map +1 -1
  71. package/src/front/node_modules/@babel/core/lib/parser/index.js +1 -1
  72. package/src/front/node_modules/@babel/core/lib/parser/index.js.map +1 -1
  73. package/src/front/node_modules/@babel/core/lib/tools/build-external-helpers.js +1 -1
  74. package/src/front/node_modules/@babel/core/lib/tools/build-external-helpers.js.map +1 -1
  75. package/src/front/node_modules/@babel/core/lib/transform-ast.js +5 -5
  76. package/src/front/node_modules/@babel/core/lib/transform-ast.js.map +1 -1
  77. package/src/front/node_modules/@babel/core/lib/transform-file.js +5 -5
  78. package/src/front/node_modules/@babel/core/lib/transform-file.js.map +1 -1
  79. package/src/front/node_modules/@babel/core/lib/transform.js +5 -5
  80. package/src/front/node_modules/@babel/core/lib/transform.js.map +1 -1
  81. package/src/front/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +1 -1
  82. package/src/front/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map +1 -1
  83. package/src/front/node_modules/@babel/core/lib/transformation/file/file.js.map +1 -1
  84. package/src/front/node_modules/@babel/core/lib/transformation/file/generate.js +1 -1
  85. package/src/front/node_modules/@babel/core/lib/transformation/file/generate.js.map +1 -1
  86. package/src/front/node_modules/@babel/core/lib/transformation/index.js +6 -6
  87. package/src/front/node_modules/@babel/core/lib/transformation/index.js.map +1 -1
  88. package/src/front/node_modules/@babel/core/lib/transformation/normalize-file.js +4 -4
  89. package/src/front/node_modules/@babel/core/lib/transformation/normalize-file.js.map +1 -1
  90. package/src/front/node_modules/@babel/core/lib/transformation/normalize-opts.js.map +1 -1
  91. package/src/front/node_modules/@babel/core/lib/transformation/plugin-pass.js.map +1 -1
  92. package/src/front/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map +1 -1
  93. package/src/front/node_modules/@babel/core/package.json +15 -15
  94. package/src/front/node_modules/@babel/core/src/config/files/index-browser.ts +2 -2
  95. package/src/front/node_modules/@babel/core/src/config/files/index.ts +4 -4
  96. package/src/front/node_modules/@babel/core/src/config/resolve-targets-browser.ts +1 -1
  97. package/src/front/node_modules/@babel/core/src/config/resolve-targets.ts +1 -1
  98. package/src/front/node_modules/@babel/core/src/transform-file.ts +5 -5
  99. package/src/front/node_modules/@babel/generator/lib/buffer.js.map +1 -1
  100. package/src/front/node_modules/@babel/generator/lib/generators/base.js.map +1 -1
  101. package/src/front/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
  102. package/src/front/node_modules/@babel/generator/lib/generators/expressions.js +1 -1
  103. package/src/front/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
  104. package/src/front/node_modules/@babel/generator/lib/generators/flow.js +2 -2
  105. package/src/front/node_modules/@babel/generator/lib/generators/flow.js.map +1 -1
  106. package/src/front/node_modules/@babel/generator/lib/generators/index.js +11 -11
  107. package/src/front/node_modules/@babel/generator/lib/generators/index.js.map +1 -1
  108. package/src/front/node_modules/@babel/generator/lib/generators/jsx.js.map +1 -1
  109. package/src/front/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
  110. package/src/front/node_modules/@babel/generator/lib/generators/modules.js.map +1 -1
  111. package/src/front/node_modules/@babel/generator/lib/generators/statements.js.map +1 -1
  112. package/src/front/node_modules/@babel/generator/lib/generators/template-literals.js.map +1 -1
  113. package/src/front/node_modules/@babel/generator/lib/generators/types.js.map +1 -1
  114. package/src/front/node_modules/@babel/generator/lib/generators/typescript.js.map +1 -1
  115. package/src/front/node_modules/@babel/generator/lib/index.js +2 -2
  116. package/src/front/node_modules/@babel/generator/lib/index.js.map +1 -1
  117. package/src/front/node_modules/@babel/generator/lib/node/index.js +2 -2
  118. package/src/front/node_modules/@babel/generator/lib/node/index.js.map +1 -1
  119. package/src/front/node_modules/@babel/generator/lib/node/whitespace.js.map +1 -1
  120. package/src/front/node_modules/@babel/generator/lib/printer.js +3 -3
  121. package/src/front/node_modules/@babel/generator/lib/printer.js.map +1 -1
  122. package/src/front/node_modules/@babel/generator/package.json +4 -4
  123. package/src/front/node_modules/@babel/helper-compilation-targets/lib/debug.js +2 -2
  124. package/src/front/node_modules/@babel/helper-compilation-targets/lib/debug.js.map +1 -1
  125. package/src/front/node_modules/@babel/helper-compilation-targets/lib/filter-items.js +1 -1
  126. package/src/front/node_modules/@babel/helper-compilation-targets/lib/filter-items.js.map +1 -1
  127. package/src/front/node_modules/@babel/helper-compilation-targets/lib/index.js +6 -6
  128. package/src/front/node_modules/@babel/helper-compilation-targets/lib/index.js.map +1 -1
  129. package/src/front/node_modules/@babel/helper-compilation-targets/lib/pretty.js +1 -1
  130. package/src/front/node_modules/@babel/helper-compilation-targets/lib/pretty.js.map +1 -1
  131. package/src/front/node_modules/@babel/helper-compilation-targets/lib/utils.js +1 -1
  132. package/src/front/node_modules/@babel/helper-compilation-targets/lib/utils.js.map +1 -1
  133. package/src/front/node_modules/@babel/helper-compilation-targets/package.json +2 -2
  134. package/src/front/node_modules/@babel/helper-module-imports/README.md +1 -1
  135. package/src/front/node_modules/@babel/helper-module-imports/lib/import-injector.js +2 -2
  136. package/src/front/node_modules/@babel/helper-module-imports/lib/import-injector.js.map +1 -1
  137. package/src/front/node_modules/@babel/helper-module-imports/lib/index.js +2 -2
  138. package/src/front/node_modules/@babel/helper-module-imports/lib/index.js.map +1 -1
  139. package/src/front/node_modules/@babel/helper-module-imports/package.json +4 -4
  140. package/src/front/node_modules/@babel/helper-module-transforms/lib/index.js +5 -5
  141. package/src/front/node_modules/@babel/helper-module-transforms/lib/index.js.map +1 -1
  142. package/src/front/node_modules/@babel/helper-module-transforms/lib/rewrite-live-references.js.map +1 -1
  143. package/src/front/node_modules/@babel/helper-module-transforms/package.json +5 -5
  144. package/src/front/node_modules/@babel/helper-validator-identifier/README.md +1 -1
  145. package/src/front/node_modules/@babel/helper-validator-identifier/lib/index.js +2 -2
  146. package/src/front/node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -1
  147. package/src/front/node_modules/@babel/helper-validator-identifier/package.json +1 -1
  148. package/src/front/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js +8 -6
  149. package/src/front/node_modules/@babel/helper-validator-option/README.md +1 -1
  150. package/src/front/node_modules/@babel/helper-validator-option/lib/index.js +2 -2
  151. package/src/front/node_modules/@babel/helper-validator-option/lib/index.js.map +1 -1
  152. package/src/front/node_modules/@babel/helper-validator-option/lib/validator.js +1 -1
  153. package/src/front/node_modules/@babel/helper-validator-option/lib/validator.js.map +1 -1
  154. package/src/front/node_modules/@babel/helper-validator-option/package.json +1 -1
  155. package/src/front/node_modules/@babel/helpers/lib/helpers-generated.js +21 -21
  156. package/src/front/node_modules/@babel/helpers/lib/helpers-generated.js.map +1 -1
  157. package/src/front/node_modules/@babel/helpers/lib/helpers.js +1 -1
  158. package/src/front/node_modules/@babel/helpers/lib/helpers.js.map +1 -1
  159. package/src/front/node_modules/@babel/helpers/lib/index.js +1 -1
  160. package/src/front/node_modules/@babel/helpers/lib/index.js.map +1 -1
  161. package/src/front/node_modules/@babel/helpers/package.json +7 -7
  162. package/src/front/node_modules/@babel/helpers/scripts/generate-helpers.js +1 -1
  163. package/src/front/node_modules/@babel/highlight/lib/index.js +6 -5
  164. package/src/front/node_modules/@babel/highlight/lib/index.js.map +1 -1
  165. package/src/front/node_modules/@babel/highlight/package.json +1 -1
  166. package/src/front/node_modules/@babel/parser/lib/index.js +52 -57
  167. package/src/front/node_modules/@babel/parser/lib/index.js.map +1 -1
  168. package/src/front/node_modules/@babel/parser/package.json +4 -4
  169. package/src/front/node_modules/@babel/template/README.md +1 -1
  170. package/src/front/node_modules/@babel/template/lib/builder.js +3 -3
  171. package/src/front/node_modules/@babel/template/lib/builder.js.map +1 -1
  172. package/src/front/node_modules/@babel/template/lib/index.js +2 -2
  173. package/src/front/node_modules/@babel/template/lib/index.js.map +1 -1
  174. package/src/front/node_modules/@babel/template/lib/literal.js +3 -3
  175. package/src/front/node_modules/@babel/template/lib/literal.js.map +1 -1
  176. package/src/front/node_modules/@babel/template/lib/parse.js.map +1 -1
  177. package/src/front/node_modules/@babel/template/lib/populate.js.map +1 -1
  178. package/src/front/node_modules/@babel/template/lib/string.js +3 -3
  179. package/src/front/node_modules/@babel/template/lib/string.js.map +1 -1
  180. package/src/front/node_modules/@babel/template/package.json +4 -4
  181. package/src/front/node_modules/@babel/traverse/lib/cache.js.map +1 -1
  182. package/src/front/node_modules/@babel/traverse/lib/context.js +2 -2
  183. package/src/front/node_modules/@babel/traverse/lib/context.js.map +1 -1
  184. package/src/front/node_modules/@babel/traverse/lib/hub.js.map +1 -1
  185. package/src/front/node_modules/@babel/traverse/lib/index.js +8 -8
  186. package/src/front/node_modules/@babel/traverse/lib/index.js.map +1 -1
  187. package/src/front/node_modules/@babel/traverse/lib/path/ancestry.js.map +1 -1
  188. package/src/front/node_modules/@babel/traverse/lib/path/comments.js.map +1 -1
  189. package/src/front/node_modules/@babel/traverse/lib/path/context.js +2 -2
  190. package/src/front/node_modules/@babel/traverse/lib/path/context.js.map +1 -1
  191. package/src/front/node_modules/@babel/traverse/lib/path/conversion.js +1 -1
  192. package/src/front/node_modules/@babel/traverse/lib/path/conversion.js.map +1 -1
  193. package/src/front/node_modules/@babel/traverse/lib/path/evaluation.js.map +1 -1
  194. package/src/front/node_modules/@babel/traverse/lib/path/family.js +1 -1
  195. package/src/front/node_modules/@babel/traverse/lib/path/family.js.map +1 -1
  196. package/src/front/node_modules/@babel/traverse/lib/path/index.js +17 -17
  197. package/src/front/node_modules/@babel/traverse/lib/path/index.js.map +1 -1
  198. package/src/front/node_modules/@babel/traverse/lib/path/inference/index.js +1 -1
  199. package/src/front/node_modules/@babel/traverse/lib/path/inference/index.js.map +1 -1
  200. package/src/front/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js +1 -1
  201. package/src/front/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js.map +1 -1
  202. package/src/front/node_modules/@babel/traverse/lib/path/inference/inferers.js +2 -2
  203. package/src/front/node_modules/@babel/traverse/lib/path/inference/inferers.js.map +1 -1
  204. package/src/front/node_modules/@babel/traverse/lib/path/introspection.js.map +1 -1
  205. package/src/front/node_modules/@babel/traverse/lib/path/lib/hoister.js.map +1 -1
  206. package/src/front/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js.map +1 -1
  207. package/src/front/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js.map +1 -1
  208. package/src/front/node_modules/@babel/traverse/lib/path/modification.js +3 -3
  209. package/src/front/node_modules/@babel/traverse/lib/path/modification.js.map +1 -1
  210. package/src/front/node_modules/@babel/traverse/lib/path/removal.js +3 -3
  211. package/src/front/node_modules/@babel/traverse/lib/path/removal.js.map +1 -1
  212. package/src/front/node_modules/@babel/traverse/lib/path/replacement.js +3 -3
  213. package/src/front/node_modules/@babel/traverse/lib/path/replacement.js.map +1 -1
  214. package/src/front/node_modules/@babel/traverse/lib/scope/binding.js +1 -3
  215. package/src/front/node_modules/@babel/traverse/lib/scope/binding.js.map +1 -1
  216. package/src/front/node_modules/@babel/traverse/lib/scope/index.js +5 -5
  217. package/src/front/node_modules/@babel/traverse/lib/scope/index.js.map +1 -1
  218. package/src/front/node_modules/@babel/traverse/lib/scope/lib/renamer.js +2 -2
  219. package/src/front/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map +1 -1
  220. package/src/front/node_modules/@babel/traverse/lib/traverse-node.js +1 -1
  221. package/src/front/node_modules/@babel/traverse/lib/traverse-node.js.map +1 -1
  222. package/src/front/node_modules/@babel/traverse/lib/types.js.map +1 -1
  223. package/src/front/node_modules/@babel/traverse/lib/visitors.js +1 -1
  224. package/src/front/node_modules/@babel/traverse/lib/visitors.js.map +1 -1
  225. package/src/front/node_modules/@babel/traverse/package.json +6 -6
  226. package/src/front/node_modules/@babel/types/lib/asserts/assertNode.js +1 -1
  227. package/src/front/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -1
  228. package/src/front/node_modules/@babel/types/lib/asserts/generated/index.js +2 -2
  229. package/src/front/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -1
  230. package/src/front/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -1
  231. package/src/front/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +3 -3
  232. package/src/front/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -1
  233. package/src/front/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +9 -9
  234. package/src/front/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -1
  235. package/src/front/node_modules/@babel/types/lib/builders/generated/index.js +2 -2
  236. package/src/front/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -1
  237. package/src/front/node_modules/@babel/types/lib/builders/generated/uppercase.js +1 -1
  238. package/src/front/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -1
  239. package/src/front/node_modules/@babel/types/lib/builders/react/buildChildren.js +5 -5
  240. package/src/front/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -1
  241. package/src/front/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +5 -5
  242. package/src/front/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -1
  243. package/src/front/node_modules/@babel/types/lib/builders/validateNode.js +3 -3
  244. package/src/front/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -1
  245. package/src/front/node_modules/@babel/types/lib/clone/clone.js +1 -1
  246. package/src/front/node_modules/@babel/types/lib/clone/clone.js.map +1 -1
  247. package/src/front/node_modules/@babel/types/lib/clone/cloneDeep.js +1 -1
  248. package/src/front/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -1
  249. package/src/front/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +1 -1
  250. package/src/front/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -1
  251. package/src/front/node_modules/@babel/types/lib/clone/cloneNode.js +6 -6
  252. package/src/front/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -1
  253. package/src/front/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +1 -1
  254. package/src/front/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -1
  255. package/src/front/node_modules/@babel/types/lib/comments/addComment.js +1 -1
  256. package/src/front/node_modules/@babel/types/lib/comments/addComment.js.map +1 -1
  257. package/src/front/node_modules/@babel/types/lib/comments/addComments.js.map +1 -1
  258. package/src/front/node_modules/@babel/types/lib/comments/inheritInnerComments.js +1 -1
  259. package/src/front/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -1
  260. package/src/front/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +1 -1
  261. package/src/front/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -1
  262. package/src/front/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +1 -1
  263. package/src/front/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -1
  264. package/src/front/node_modules/@babel/types/lib/comments/inheritsComments.js +3 -3
  265. package/src/front/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -1
  266. package/src/front/node_modules/@babel/types/lib/comments/removeComments.js +2 -2
  267. package/src/front/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -1
  268. package/src/front/node_modules/@babel/types/lib/constants/generated/index.js +50 -50
  269. package/src/front/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -1
  270. package/src/front/node_modules/@babel/types/lib/converters/ensureBlock.js +1 -1
  271. package/src/front/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -1
  272. package/src/front/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +14 -14
  273. package/src/front/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -1
  274. package/src/front/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +1 -1
  275. package/src/front/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -1
  276. package/src/front/node_modules/@babel/types/lib/converters/toBlock.js +9 -9
  277. package/src/front/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -1
  278. package/src/front/node_modules/@babel/types/lib/converters/toComputedKey.js +3 -3
  279. package/src/front/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -1
  280. package/src/front/node_modules/@babel/types/lib/converters/toExpression.js +6 -6
  281. package/src/front/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -1
  282. package/src/front/node_modules/@babel/types/lib/converters/toIdentifier.js +1 -1
  283. package/src/front/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -1
  284. package/src/front/node_modules/@babel/types/lib/converters/toKeyAlias.js +5 -5
  285. package/src/front/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -1
  286. package/src/front/node_modules/@babel/types/lib/converters/toSequenceExpression.js +1 -1
  287. package/src/front/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -1
  288. package/src/front/node_modules/@babel/types/lib/converters/toStatement.js +7 -7
  289. package/src/front/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -1
  290. package/src/front/node_modules/@babel/types/lib/converters/valueToNode.js +17 -17
  291. package/src/front/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -1
  292. package/src/front/node_modules/@babel/types/lib/definitions/core.js +9 -9
  293. package/src/front/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
  294. package/src/front/node_modules/@babel/types/lib/definitions/experimental.js +1 -1
  295. package/src/front/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -1
  296. package/src/front/node_modules/@babel/types/lib/definitions/flow.js +1 -1
  297. package/src/front/node_modules/@babel/types/lib/definitions/flow.js.map +1 -1
  298. package/src/front/node_modules/@babel/types/lib/definitions/index.js +9 -9
  299. package/src/front/node_modules/@babel/types/lib/definitions/index.js.map +1 -1
  300. package/src/front/node_modules/@babel/types/lib/definitions/jsx.js +1 -1
  301. package/src/front/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -1
  302. package/src/front/node_modules/@babel/types/lib/definitions/misc.js +2 -2
  303. package/src/front/node_modules/@babel/types/lib/definitions/misc.js.map +1 -1
  304. package/src/front/node_modules/@babel/types/lib/definitions/placeholders.js +1 -1
  305. package/src/front/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -1
  306. package/src/front/node_modules/@babel/types/lib/definitions/typescript.js +4 -4
  307. package/src/front/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
  308. package/src/front/node_modules/@babel/types/lib/definitions/utils.js +2 -2
  309. package/src/front/node_modules/@babel/types/lib/definitions/utils.js.map +1 -1
  310. package/src/front/node_modules/@babel/types/lib/index-legacy.d.ts +10 -10
  311. package/src/front/node_modules/@babel/types/lib/index.d.ts +12 -12
  312. package/src/front/node_modules/@babel/types/lib/index.js +84 -84
  313. package/src/front/node_modules/@babel/types/lib/index.js.flow +10 -10
  314. package/src/front/node_modules/@babel/types/lib/index.js.map +1 -1
  315. package/src/front/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +2 -2
  316. package/src/front/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -1
  317. package/src/front/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +6 -6
  318. package/src/front/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -1
  319. package/src/front/node_modules/@babel/types/lib/modifications/inherits.js +4 -4
  320. package/src/front/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -1
  321. package/src/front/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +4 -4
  322. package/src/front/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -1
  323. package/src/front/node_modules/@babel/types/lib/modifications/removeProperties.js +2 -2
  324. package/src/front/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -1
  325. package/src/front/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +2 -2
  326. package/src/front/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -1
  327. package/src/front/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +6 -6
  328. package/src/front/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -1
  329. package/src/front/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +6 -6
  330. package/src/front/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -1
  331. package/src/front/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +1 -1
  332. package/src/front/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -1
  333. package/src/front/node_modules/@babel/types/lib/traverse/traverse.js +2 -2
  334. package/src/front/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -1
  335. package/src/front/node_modules/@babel/types/lib/traverse/traverseFast.js +2 -2
  336. package/src/front/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -1
  337. package/src/front/node_modules/@babel/types/lib/utils/inherit.js.map +1 -1
  338. package/src/front/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +3 -3
  339. package/src/front/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -1
  340. package/src/front/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +1 -1
  341. package/src/front/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -1
  342. package/src/front/node_modules/@babel/types/lib/validators/generated/index.js +2 -2
  343. package/src/front/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -1
  344. package/src/front/node_modules/@babel/types/lib/validators/is.js +5 -5
  345. package/src/front/node_modules/@babel/types/lib/validators/is.js.map +1 -1
  346. package/src/front/node_modules/@babel/types/lib/validators/isBinding.js +1 -1
  347. package/src/front/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -1
  348. package/src/front/node_modules/@babel/types/lib/validators/isBlockScoped.js +3 -3
  349. package/src/front/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -1
  350. package/src/front/node_modules/@babel/types/lib/validators/isImmutable.js +3 -3
  351. package/src/front/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -1
  352. package/src/front/node_modules/@babel/types/lib/validators/isLet.js +3 -3
  353. package/src/front/node_modules/@babel/types/lib/validators/isLet.js.map +1 -1
  354. package/src/front/node_modules/@babel/types/lib/validators/isNode.js +2 -2
  355. package/src/front/node_modules/@babel/types/lib/validators/isNode.js.map +1 -1
  356. package/src/front/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +3 -3
  357. package/src/front/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -1
  358. package/src/front/node_modules/@babel/types/lib/validators/isPlaceholderType.js +2 -2
  359. package/src/front/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -1
  360. package/src/front/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -1
  361. package/src/front/node_modules/@babel/types/lib/validators/isScope.js +4 -4
  362. package/src/front/node_modules/@babel/types/lib/validators/isScope.js.map +1 -1
  363. package/src/front/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +2 -2
  364. package/src/front/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -1
  365. package/src/front/node_modules/@babel/types/lib/validators/isType.js +3 -3
  366. package/src/front/node_modules/@babel/types/lib/validators/isType.js.map +1 -1
  367. package/src/front/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +1 -1
  368. package/src/front/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -1
  369. package/src/front/node_modules/@babel/types/lib/validators/isVar.js +4 -4
  370. package/src/front/node_modules/@babel/types/lib/validators/isVar.js.map +1 -1
  371. package/src/front/node_modules/@babel/types/lib/validators/matchesPattern.js +6 -6
  372. package/src/front/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -1
  373. package/src/front/node_modules/@babel/types/lib/validators/react/isReactComponent.js +1 -1
  374. package/src/front/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -1
  375. package/src/front/node_modules/@babel/types/lib/validators/validate.js +3 -3
  376. package/src/front/node_modules/@babel/types/lib/validators/validate.js.map +1 -1
  377. package/src/front/node_modules/@babel/types/package.json +4 -4
  378. package/src/front/node_modules/typescript/lib/lib.decorators.d.ts +17 -0
  379. package/src/front/node_modules/typescript/lib/lib.dom.d.ts +313 -90
  380. package/src/front/node_modules/typescript/lib/lib.es2015.collection.d.ts +9 -9
  381. package/src/front/node_modules/typescript/lib/lib.es2015.core.d.ts +2 -2
  382. package/src/front/node_modules/typescript/lib/lib.es2015.iterable.d.ts +4 -4
  383. package/src/front/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +2 -2
  384. package/src/front/node_modules/typescript/lib/lib.es2017.d.ts +1 -0
  385. package/src/front/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  386. package/src/front/node_modules/typescript/lib/lib.es2020.bigint.d.ts +4 -4
  387. package/src/front/node_modules/typescript/lib/lib.es2021.weakref.d.ts +19 -16
  388. package/src/front/node_modules/typescript/lib/lib.es2023.array.d.ts +618 -36
  389. package/src/front/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  390. package/src/front/node_modules/typescript/lib/lib.es2023.d.ts +1 -0
  391. package/src/front/node_modules/typescript/lib/lib.es5.d.ts +27 -18
  392. package/src/front/node_modules/typescript/lib/lib.esnext.d.ts +2 -0
  393. package/src/front/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  394. package/src/front/node_modules/typescript/lib/lib.esnext.disposable.d.ts +185 -0
  395. package/src/front/node_modules/typescript/lib/lib.webworker.d.ts +172 -33
  396. package/src/front/node_modules/typescript/lib/tsc.js +8311 -6557
  397. package/src/front/node_modules/typescript/lib/tsserver.js +11796 -9281
  398. package/src/front/node_modules/typescript/lib/tsserverlibrary.d.ts +287 -249
  399. package/src/front/node_modules/typescript/lib/tsserverlibrary.js +11801 -9288
  400. package/src/front/node_modules/typescript/lib/typescript.d.ts +274 -248
  401. package/src/front/node_modules/typescript/lib/typescript.js +11678 -9231
  402. package/src/front/node_modules/typescript/lib/typingsInstaller.js +1852 -1645
  403. package/src/front/node_modules/typescript/package.json +7 -7
  404. package/src/front/package-lock.json +144 -144
  405. package/src/front/src/components/inputs/FileInput.js +1 -0
  406. package/src/front/src/pages/Records.js +1 -0
  407. package/src/front/build/static/js/main.4ce5340d.chunk.js.map +0 -1
  408. package/src/front/node_modules/.cache/babel-loader/1dbf9b1b83cdf813e9dc5f561b9b97ac.json +0 -1
  409. package/src/front/node_modules/.cache/babel-loader/d88f947a76ac5f78797e69c737b6267e.json +0 -1
  410. package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/c3/3e/f2b5b90044b7bdbb4cff67b2c09e24bb506274240d920de24bb4b678f3f00b80f7e9f0900cd1de883484031488d8603e97ea6b4e39a9c6ab5160353d3be9 +0 -1
  411. package/src/front/node_modules/@babel/parser/lib/options.js +0 -44
  412. package/src/front/node_modules/@babel/parser/lib/options.js.map +0 -1
  413. package/src/front/node_modules/@babel/parser/lib/parse-error/credentials.js +0 -28
  414. package/src/front/node_modules/@babel/parser/lib/parse-error/credentials.js.map +0 -1
  415. package/src/front/node_modules/@babel/parser/lib/parse-error/module-errors.js +0 -20
  416. package/src/front/node_modules/@babel/parser/lib/parse-error/module-errors.js.map +0 -1
  417. package/src/front/node_modules/@babel/parser/lib/parse-error/pipeline-operator-errors.js +0 -32
  418. package/src/front/node_modules/@babel/parser/lib/parse-error/pipeline-operator-errors.js.map +0 -1
  419. package/src/front/node_modules/@babel/parser/lib/parse-error/standard-errors.js +0 -220
  420. package/src/front/node_modules/@babel/parser/lib/parse-error/standard-errors.js.map +0 -1
  421. package/src/front/node_modules/@babel/parser/lib/parse-error/strict-mode-errors.js +0 -22
  422. package/src/front/node_modules/@babel/parser/lib/parse-error/strict-mode-errors.js.map +0 -1
  423. package/src/front/node_modules/@babel/parser/lib/parse-error/to-node-description.js +0 -39
  424. package/src/front/node_modules/@babel/parser/lib/parse-error/to-node-description.js.map +0 -1
  425. package/src/front/node_modules/@babel/parser/lib/parse-error.js +0 -106
  426. package/src/front/node_modules/@babel/parser/lib/parse-error.js.map +0 -1
  427. package/src/front/node_modules/@babel/parser/lib/parser/base.js +0 -36
  428. package/src/front/node_modules/@babel/parser/lib/parser/base.js.map +0 -1
  429. package/src/front/node_modules/@babel/parser/lib/parser/comments.js +0 -190
  430. package/src/front/node_modules/@babel/parser/lib/parser/comments.js.map +0 -1
  431. package/src/front/node_modules/@babel/parser/lib/parser/expression.js +0 -1824
  432. package/src/front/node_modules/@babel/parser/lib/parser/expression.js.map +0 -1
  433. package/src/front/node_modules/@babel/parser/lib/parser/index.js +0 -43
  434. package/src/front/node_modules/@babel/parser/lib/parser/index.js.map +0 -1
  435. package/src/front/node_modules/@babel/parser/lib/parser/lval.js +0 -421
  436. package/src/front/node_modules/@babel/parser/lib/parser/lval.js.map +0 -1
  437. package/src/front/node_modules/@babel/parser/lib/parser/node.js +0 -127
  438. package/src/front/node_modules/@babel/parser/lib/parser/node.js.map +0 -1
  439. package/src/front/node_modules/@babel/parser/lib/parser/statement.js +0 -2033
  440. package/src/front/node_modules/@babel/parser/lib/parser/statement.js.map +0 -1
  441. package/src/front/node_modules/@babel/parser/lib/parser/util.js +0 -238
  442. package/src/front/node_modules/@babel/parser/lib/parser/util.js.map +0 -1
  443. package/src/front/node_modules/@babel/parser/lib/plugin-utils.js +0 -136
  444. package/src/front/node_modules/@babel/parser/lib/plugin-utils.js.map +0 -1
  445. package/src/front/node_modules/@babel/parser/lib/plugins/estree.js +0 -340
  446. package/src/front/node_modules/@babel/parser/lib/plugins/estree.js.map +0 -1
  447. package/src/front/node_modules/@babel/parser/lib/plugins/flow/index.js +0 -2474
  448. package/src/front/node_modules/@babel/parser/lib/plugins/flow/index.js.map +0 -1
  449. package/src/front/node_modules/@babel/parser/lib/plugins/flow/scope.js +0 -44
  450. package/src/front/node_modules/@babel/parser/lib/plugins/flow/scope.js.map +0 -1
  451. package/src/front/node_modules/@babel/parser/lib/plugins/jsx/index.js +0 -444
  452. package/src/front/node_modules/@babel/parser/lib/plugins/jsx/index.js.map +0 -1
  453. package/src/front/node_modules/@babel/parser/lib/plugins/jsx/xhtml.js +0 -266
  454. package/src/front/node_modules/@babel/parser/lib/plugins/jsx/xhtml.js.map +0 -1
  455. package/src/front/node_modules/@babel/parser/lib/plugins/placeholders.js +0 -198
  456. package/src/front/node_modules/@babel/parser/lib/plugins/placeholders.js.map +0 -1
  457. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/index.js +0 -2656
  458. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/index.js.map +0 -1
  459. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/scope.js +0 -121
  460. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/scope.js.map +0 -1
  461. package/src/front/node_modules/@babel/parser/lib/plugins/v8intrinsic.js +0 -31
  462. package/src/front/node_modules/@babel/parser/lib/plugins/v8intrinsic.js.map +0 -1
  463. package/src/front/node_modules/@babel/parser/lib/tokenizer/context.js +0 -27
  464. package/src/front/node_modules/@babel/parser/lib/tokenizer/context.js.map +0 -1
  465. package/src/front/node_modules/@babel/parser/lib/tokenizer/index.js +0 -1119
  466. package/src/front/node_modules/@babel/parser/lib/tokenizer/index.js.map +0 -1
  467. package/src/front/node_modules/@babel/parser/lib/tokenizer/state.js +0 -82
  468. package/src/front/node_modules/@babel/parser/lib/tokenizer/state.js.map +0 -1
  469. package/src/front/node_modules/@babel/parser/lib/tokenizer/types.js +0 -586
  470. package/src/front/node_modules/@babel/parser/lib/tokenizer/types.js.map +0 -1
  471. package/src/front/node_modules/@babel/parser/lib/util/class-scope.js +0 -92
  472. package/src/front/node_modules/@babel/parser/lib/util/class-scope.js.map +0 -1
  473. package/src/front/node_modules/@babel/parser/lib/util/expression-scope.js +0 -142
  474. package/src/front/node_modules/@babel/parser/lib/util/expression-scope.js.map +0 -1
  475. package/src/front/node_modules/@babel/parser/lib/util/identifier.js +0 -62
  476. package/src/front/node_modules/@babel/parser/lib/util/identifier.js.map +0 -1
  477. package/src/front/node_modules/@babel/parser/lib/util/location.js +0 -39
  478. package/src/front/node_modules/@babel/parser/lib/util/location.js.map +0 -1
  479. package/src/front/node_modules/@babel/parser/lib/util/production-parameter.js +0 -49
  480. package/src/front/node_modules/@babel/parser/lib/util/production-parameter.js.map +0 -1
  481. package/src/front/node_modules/@babel/parser/lib/util/scope.js +0 -161
  482. package/src/front/node_modules/@babel/parser/lib/util/scope.js.map +0 -1
  483. package/src/front/node_modules/@babel/parser/lib/util/scopeflags.js +0 -67
  484. package/src/front/node_modules/@babel/parser/lib/util/scopeflags.js.map +0 -1
  485. package/src/front/node_modules/@babel/parser/lib/util/whitespace.js +0 -59
  486. package/src/front/node_modules/@babel/parser/lib/util/whitespace.js.map +0 -1
@@ -1,2474 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _types = require("../../tokenizer/types");
8
- var _context = require("../../tokenizer/context");
9
- var _identifier = require("../../util/identifier");
10
- var _scope = require("./scope");
11
- var _scopeflags = require("../../util/scopeflags");
12
- var _parseError = require("../../parse-error");
13
- var _node = require("../../parser/node");
14
- const reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
15
- const FlowErrors = (0, _parseError.ParseErrorEnum)`flow`({
16
- AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
17
- AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
18
- AssignReservedType: ({
19
- reservedType
20
- }) => `Cannot overwrite reserved type ${reservedType}.`,
21
- DeclareClassElement: "The `declare` modifier can only appear on class fields.",
22
- DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.",
23
- DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.",
24
- EnumBooleanMemberNotInitialized: ({
25
- memberName,
26
- enumName
27
- }) => `Boolean enum members need to be initialized. Use either \`${memberName} = true,\` or \`${memberName} = false,\` in enum \`${enumName}\`.`,
28
- EnumDuplicateMemberName: ({
29
- memberName,
30
- enumName
31
- }) => `Enum member names need to be unique, but the name \`${memberName}\` has already been used before in enum \`${enumName}\`.`,
32
- EnumInconsistentMemberValues: ({
33
- enumName
34
- }) => `Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,
35
- EnumInvalidExplicitType: ({
36
- invalidEnumType,
37
- enumName
38
- }) => `Enum type \`${invalidEnumType}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
39
- EnumInvalidExplicitTypeUnknownSupplied: ({
40
- enumName
41
- }) => `Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
42
- EnumInvalidMemberInitializerPrimaryType: ({
43
- enumName,
44
- memberName,
45
- explicitType
46
- }) => `Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of \`${memberName}\` needs to be a ${explicitType} literal.`,
47
- EnumInvalidMemberInitializerSymbolType: ({
48
- enumName,
49
- memberName
50
- }) => `Symbol enum members cannot be initialized. Use \`${memberName},\` in enum \`${enumName}\`.`,
51
- EnumInvalidMemberInitializerUnknownType: ({
52
- enumName,
53
- memberName
54
- }) => `The enum member initializer for \`${memberName}\` needs to be a literal (either a boolean, number, or string) in enum \`${enumName}\`.`,
55
- EnumInvalidMemberName: ({
56
- enumName,
57
- memberName,
58
- suggestion
59
- }) => `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`,
60
- EnumNumberMemberNotInitialized: ({
61
- enumName,
62
- memberName
63
- }) => `Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`,
64
- EnumStringMemberInconsistentlyInitailized: ({
65
- enumName
66
- }) => `String enum members need to consistently either all use initializers, or use no initializers, in enum \`${enumName}\`.`,
67
- GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.",
68
- ImportReflectionHasImportType: "An `import module` declaration can not use `type` or `typeof` keyword.",
69
- ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",
70
- InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.",
71
- InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.",
72
- InexactVariance: "Explicit inexact syntax cannot have variance.",
73
- InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.",
74
- MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",
75
- NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.",
76
- NestedFlowComment: "Cannot have a flow comment inside another flow comment.",
77
- PatternIsOptional: Object.assign({
78
- message: "A binding pattern parameter cannot be optional in an implementation signature."
79
- }, {
80
- reasonCode: "OptionalBindingPattern"
81
- }),
82
- SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.",
83
- SpreadVariance: "Spread properties cannot have variance.",
84
- ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.",
85
- ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",
86
- ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.",
87
- ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.",
88
- ThisParamNoDefault: "The `this` parameter may not have a default value.",
89
- TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
90
- TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.",
91
- UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.",
92
- UnexpectedReservedType: ({
93
- reservedType
94
- }) => `Unexpected reserved type ${reservedType}.`,
95
- UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.",
96
- UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.",
97
- UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.",
98
- UnexpectedSubtractionOperand: 'Unexpected token, expected "number" or "bigint".',
99
- UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.",
100
- UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",
101
- UnsupportedDeclareExportKind: ({
102
- unsupportedExportKind,
103
- suggestion
104
- }) => `\`declare export ${unsupportedExportKind}\` is not supported. Use \`${suggestion}\` instead.`,
105
- UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
106
- UnterminatedFlowComment: "Unterminated flow-comment."
107
- });
108
- function isEsModuleType(bodyElement) {
109
- return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration");
110
- }
111
- function hasTypeImportKind(node) {
112
- return node.importKind === "type" || node.importKind === "typeof";
113
- }
114
- const exportSuggestions = {
115
- const: "declare export var",
116
- let: "declare export var",
117
- type: "export type",
118
- interface: "export interface"
119
- };
120
- function partition(list, test) {
121
- const list1 = [];
122
- const list2 = [];
123
- for (let i = 0; i < list.length; i++) {
124
- (test(list[i], i, list) ? list1 : list2).push(list[i]);
125
- }
126
- return [list1, list2];
127
- }
128
- const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/;
129
- var _default = superClass => class FlowParserMixin extends superClass {
130
- constructor(...args) {
131
- super(...args);
132
- this.flowPragma = undefined;
133
- }
134
- getScopeHandler() {
135
- return _scope.default;
136
- }
137
- shouldParseTypes() {
138
- return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
139
- }
140
- shouldParseEnums() {
141
- return !!this.getPluginOption("flow", "enums");
142
- }
143
- finishToken(type, val) {
144
- if (type !== 131 && type !== 13 && type !== 28) {
145
- if (this.flowPragma === undefined) {
146
- this.flowPragma = null;
147
- }
148
- }
149
- super.finishToken(type, val);
150
- }
151
- addComment(comment) {
152
- if (this.flowPragma === undefined) {
153
- const matches = FLOW_PRAGMA_REGEX.exec(comment.value);
154
- if (!matches) {} else if (matches[1] === "flow") {
155
- this.flowPragma = "flow";
156
- } else if (matches[1] === "noflow") {
157
- this.flowPragma = "noflow";
158
- } else {
159
- throw new Error("Unexpected flow pragma");
160
- }
161
- }
162
- super.addComment(comment);
163
- }
164
- flowParseTypeInitialiser(tok) {
165
- const oldInType = this.state.inType;
166
- this.state.inType = true;
167
- this.expect(tok || 14);
168
- const type = this.flowParseType();
169
- this.state.inType = oldInType;
170
- return type;
171
- }
172
- flowParsePredicate() {
173
- const node = this.startNode();
174
- const moduloLoc = this.state.startLoc;
175
- this.next();
176
- this.expectContextual(108);
177
- if (this.state.lastTokStart > moduloLoc.index + 1) {
178
- this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, {
179
- at: moduloLoc
180
- });
181
- }
182
- if (this.eat(10)) {
183
- node.value = super.parseExpression();
184
- this.expect(11);
185
- return this.finishNode(node, "DeclaredPredicate");
186
- } else {
187
- return this.finishNode(node, "InferredPredicate");
188
- }
189
- }
190
- flowParseTypeAndPredicateInitialiser() {
191
- const oldInType = this.state.inType;
192
- this.state.inType = true;
193
- this.expect(14);
194
- let type = null;
195
- let predicate = null;
196
- if (this.match(54)) {
197
- this.state.inType = oldInType;
198
- predicate = this.flowParsePredicate();
199
- } else {
200
- type = this.flowParseType();
201
- this.state.inType = oldInType;
202
- if (this.match(54)) {
203
- predicate = this.flowParsePredicate();
204
- }
205
- }
206
- return [type, predicate];
207
- }
208
- flowParseDeclareClass(node) {
209
- this.next();
210
- this.flowParseInterfaceish(node, true);
211
- return this.finishNode(node, "DeclareClass");
212
- }
213
- flowParseDeclareFunction(node) {
214
- this.next();
215
- const id = node.id = this.parseIdentifier();
216
- const typeNode = this.startNode();
217
- const typeContainer = this.startNode();
218
- if (this.match(47)) {
219
- typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
220
- } else {
221
- typeNode.typeParameters = null;
222
- }
223
- this.expect(10);
224
- const tmp = this.flowParseFunctionTypeParams();
225
- typeNode.params = tmp.params;
226
- typeNode.rest = tmp.rest;
227
- typeNode.this = tmp._this;
228
- this.expect(11);
229
- [typeNode.returnType, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
230
- typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation");
231
- id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation");
232
- this.resetEndLocation(id);
233
- this.semicolon();
234
- this.scope.declareName(node.id.name, _scopeflags.BindingFlag.TYPE_FLOW_DECLARE_FN, node.id.loc.start);
235
- return this.finishNode(node, "DeclareFunction");
236
- }
237
- flowParseDeclare(node, insideModule) {
238
- if (this.match(80)) {
239
- return this.flowParseDeclareClass(node);
240
- } else if (this.match(68)) {
241
- return this.flowParseDeclareFunction(node);
242
- } else if (this.match(74)) {
243
- return this.flowParseDeclareVariable(node);
244
- } else if (this.eatContextual(125)) {
245
- if (this.match(16)) {
246
- return this.flowParseDeclareModuleExports(node);
247
- } else {
248
- if (insideModule) {
249
- this.raise(FlowErrors.NestedDeclareModule, {
250
- at: this.state.lastTokStartLoc
251
- });
252
- }
253
- return this.flowParseDeclareModule(node);
254
- }
255
- } else if (this.isContextual(128)) {
256
- return this.flowParseDeclareTypeAlias(node);
257
- } else if (this.isContextual(129)) {
258
- return this.flowParseDeclareOpaqueType(node);
259
- } else if (this.isContextual(127)) {
260
- return this.flowParseDeclareInterface(node);
261
- } else if (this.match(82)) {
262
- return this.flowParseDeclareExportDeclaration(node, insideModule);
263
- } else {
264
- this.unexpected();
265
- }
266
- }
267
- flowParseDeclareVariable(node) {
268
- this.next();
269
- node.id = this.flowParseTypeAnnotatableIdentifier(true);
270
- this.scope.declareName(node.id.name, _scopeflags.BindingFlag.TYPE_VAR, node.id.loc.start);
271
- this.semicolon();
272
- return this.finishNode(node, "DeclareVariable");
273
- }
274
- flowParseDeclareModule(node) {
275
- this.scope.enter(_scopeflags.ScopeFlag.OTHER);
276
- if (this.match(131)) {
277
- node.id = super.parseExprAtom();
278
- } else {
279
- node.id = this.parseIdentifier();
280
- }
281
- const bodyNode = node.body = this.startNode();
282
- const body = bodyNode.body = [];
283
- this.expect(5);
284
- while (!this.match(8)) {
285
- let bodyNode = this.startNode();
286
- if (this.match(83)) {
287
- this.next();
288
- if (!this.isContextual(128) && !this.match(87)) {
289
- this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, {
290
- at: this.state.lastTokStartLoc
291
- });
292
- }
293
- super.parseImport(bodyNode);
294
- } else {
295
- this.expectContextual(123, FlowErrors.UnsupportedStatementInDeclareModule);
296
- bodyNode = this.flowParseDeclare(bodyNode, true);
297
- }
298
- body.push(bodyNode);
299
- }
300
- this.scope.exit();
301
- this.expect(8);
302
- this.finishNode(bodyNode, "BlockStatement");
303
- let kind = null;
304
- let hasModuleExport = false;
305
- body.forEach(bodyElement => {
306
- if (isEsModuleType(bodyElement)) {
307
- if (kind === "CommonJS") {
308
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
309
- at: bodyElement
310
- });
311
- }
312
- kind = "ES";
313
- } else if (bodyElement.type === "DeclareModuleExports") {
314
- if (hasModuleExport) {
315
- this.raise(FlowErrors.DuplicateDeclareModuleExports, {
316
- at: bodyElement
317
- });
318
- }
319
- if (kind === "ES") {
320
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
321
- at: bodyElement
322
- });
323
- }
324
- kind = "CommonJS";
325
- hasModuleExport = true;
326
- }
327
- });
328
- node.kind = kind || "CommonJS";
329
- return this.finishNode(node, "DeclareModule");
330
- }
331
- flowParseDeclareExportDeclaration(node, insideModule) {
332
- this.expect(82);
333
- if (this.eat(65)) {
334
- if (this.match(68) || this.match(80)) {
335
- node.declaration = this.flowParseDeclare(this.startNode());
336
- } else {
337
- node.declaration = this.flowParseType();
338
- this.semicolon();
339
- }
340
- node.default = true;
341
- return this.finishNode(node, "DeclareExportDeclaration");
342
- } else {
343
- if (this.match(75) || this.isLet() || (this.isContextual(128) || this.isContextual(127)) && !insideModule) {
344
- const label = this.state.value;
345
- throw this.raise(FlowErrors.UnsupportedDeclareExportKind, {
346
- at: this.state.startLoc,
347
- unsupportedExportKind: label,
348
- suggestion: exportSuggestions[label]
349
- });
350
- }
351
- if (this.match(74) || this.match(68) || this.match(80) || this.isContextual(129)) {
352
- node.declaration = this.flowParseDeclare(this.startNode());
353
- node.default = false;
354
- return this.finishNode(node, "DeclareExportDeclaration");
355
- } else if (this.match(55) || this.match(5) || this.isContextual(127) || this.isContextual(128) || this.isContextual(129)) {
356
- node = this.parseExport(node, null);
357
- if (node.type === "ExportNamedDeclaration") {
358
- node.type = "ExportDeclaration";
359
- node.default = false;
360
- delete node.exportKind;
361
- }
362
- node.type = "Declare" + node.type;
363
- return node;
364
- }
365
- }
366
- this.unexpected();
367
- }
368
- flowParseDeclareModuleExports(node) {
369
- this.next();
370
- this.expectContextual(109);
371
- node.typeAnnotation = this.flowParseTypeAnnotation();
372
- this.semicolon();
373
- return this.finishNode(node, "DeclareModuleExports");
374
- }
375
- flowParseDeclareTypeAlias(node) {
376
- this.next();
377
- const finished = this.flowParseTypeAlias(node);
378
- finished.type = "DeclareTypeAlias";
379
- return finished;
380
- }
381
- flowParseDeclareOpaqueType(node) {
382
- this.next();
383
- const finished = this.flowParseOpaqueType(node, true);
384
- finished.type = "DeclareOpaqueType";
385
- return finished;
386
- }
387
- flowParseDeclareInterface(node) {
388
- this.next();
389
- this.flowParseInterfaceish(node, false);
390
- return this.finishNode(node, "DeclareInterface");
391
- }
392
- flowParseInterfaceish(node, isClass) {
393
- node.id = this.flowParseRestrictedIdentifier(!isClass, true);
394
- this.scope.declareName(node.id.name, isClass ? _scopeflags.BindingFlag.TYPE_FUNCTION : _scopeflags.BindingFlag.TYPE_LEXICAL, node.id.loc.start);
395
- if (this.match(47)) {
396
- node.typeParameters = this.flowParseTypeParameterDeclaration();
397
- } else {
398
- node.typeParameters = null;
399
- }
400
- node.extends = [];
401
- if (this.eat(81)) {
402
- do {
403
- node.extends.push(this.flowParseInterfaceExtends());
404
- } while (!isClass && this.eat(12));
405
- }
406
- if (isClass) {
407
- node.implements = [];
408
- node.mixins = [];
409
- if (this.eatContextual(115)) {
410
- do {
411
- node.mixins.push(this.flowParseInterfaceExtends());
412
- } while (this.eat(12));
413
- }
414
- if (this.eatContextual(111)) {
415
- do {
416
- node.implements.push(this.flowParseInterfaceExtends());
417
- } while (this.eat(12));
418
- }
419
- }
420
- node.body = this.flowParseObjectType({
421
- allowStatic: isClass,
422
- allowExact: false,
423
- allowSpread: false,
424
- allowProto: isClass,
425
- allowInexact: false
426
- });
427
- }
428
- flowParseInterfaceExtends() {
429
- const node = this.startNode();
430
- node.id = this.flowParseQualifiedTypeIdentifier();
431
- if (this.match(47)) {
432
- node.typeParameters = this.flowParseTypeParameterInstantiation();
433
- } else {
434
- node.typeParameters = null;
435
- }
436
- return this.finishNode(node, "InterfaceExtends");
437
- }
438
- flowParseInterface(node) {
439
- this.flowParseInterfaceish(node, false);
440
- return this.finishNode(node, "InterfaceDeclaration");
441
- }
442
- checkNotUnderscore(word) {
443
- if (word === "_") {
444
- this.raise(FlowErrors.UnexpectedReservedUnderscore, {
445
- at: this.state.startLoc
446
- });
447
- }
448
- }
449
- checkReservedType(word, startLoc, declaration) {
450
- if (!reservedTypes.has(word)) return;
451
- this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, {
452
- at: startLoc,
453
- reservedType: word
454
- });
455
- }
456
- flowParseRestrictedIdentifier(liberal, declaration) {
457
- this.checkReservedType(this.state.value, this.state.startLoc, declaration);
458
- return this.parseIdentifier(liberal);
459
- }
460
- flowParseTypeAlias(node) {
461
- node.id = this.flowParseRestrictedIdentifier(false, true);
462
- this.scope.declareName(node.id.name, _scopeflags.BindingFlag.TYPE_LEXICAL, node.id.loc.start);
463
- if (this.match(47)) {
464
- node.typeParameters = this.flowParseTypeParameterDeclaration();
465
- } else {
466
- node.typeParameters = null;
467
- }
468
- node.right = this.flowParseTypeInitialiser(29);
469
- this.semicolon();
470
- return this.finishNode(node, "TypeAlias");
471
- }
472
- flowParseOpaqueType(node, declare) {
473
- this.expectContextual(128);
474
- node.id = this.flowParseRestrictedIdentifier(true, true);
475
- this.scope.declareName(node.id.name, _scopeflags.BindingFlag.TYPE_LEXICAL, node.id.loc.start);
476
- if (this.match(47)) {
477
- node.typeParameters = this.flowParseTypeParameterDeclaration();
478
- } else {
479
- node.typeParameters = null;
480
- }
481
- node.supertype = null;
482
- if (this.match(14)) {
483
- node.supertype = this.flowParseTypeInitialiser(14);
484
- }
485
- node.impltype = null;
486
- if (!declare) {
487
- node.impltype = this.flowParseTypeInitialiser(29);
488
- }
489
- this.semicolon();
490
- return this.finishNode(node, "OpaqueType");
491
- }
492
- flowParseTypeParameter(requireDefault = false) {
493
- const nodeStartLoc = this.state.startLoc;
494
- const node = this.startNode();
495
- const variance = this.flowParseVariance();
496
- const ident = this.flowParseTypeAnnotatableIdentifier();
497
- node.name = ident.name;
498
- node.variance = variance;
499
- node.bound = ident.typeAnnotation;
500
- if (this.match(29)) {
501
- this.eat(29);
502
- node.default = this.flowParseType();
503
- } else {
504
- if (requireDefault) {
505
- this.raise(FlowErrors.MissingTypeParamDefault, {
506
- at: nodeStartLoc
507
- });
508
- }
509
- }
510
- return this.finishNode(node, "TypeParameter");
511
- }
512
- flowParseTypeParameterDeclaration() {
513
- const oldInType = this.state.inType;
514
- const node = this.startNode();
515
- node.params = [];
516
- this.state.inType = true;
517
- if (this.match(47) || this.match(140)) {
518
- this.next();
519
- } else {
520
- this.unexpected();
521
- }
522
- let defaultRequired = false;
523
- do {
524
- const typeParameter = this.flowParseTypeParameter(defaultRequired);
525
- node.params.push(typeParameter);
526
- if (typeParameter.default) {
527
- defaultRequired = true;
528
- }
529
- if (!this.match(48)) {
530
- this.expect(12);
531
- }
532
- } while (!this.match(48));
533
- this.expect(48);
534
- this.state.inType = oldInType;
535
- return this.finishNode(node, "TypeParameterDeclaration");
536
- }
537
- flowParseTypeParameterInstantiation() {
538
- const node = this.startNode();
539
- const oldInType = this.state.inType;
540
- node.params = [];
541
- this.state.inType = true;
542
- this.expect(47);
543
- const oldNoAnonFunctionType = this.state.noAnonFunctionType;
544
- this.state.noAnonFunctionType = false;
545
- while (!this.match(48)) {
546
- node.params.push(this.flowParseType());
547
- if (!this.match(48)) {
548
- this.expect(12);
549
- }
550
- }
551
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
552
- this.expect(48);
553
- this.state.inType = oldInType;
554
- return this.finishNode(node, "TypeParameterInstantiation");
555
- }
556
- flowParseTypeParameterInstantiationCallOrNew() {
557
- const node = this.startNode();
558
- const oldInType = this.state.inType;
559
- node.params = [];
560
- this.state.inType = true;
561
- this.expect(47);
562
- while (!this.match(48)) {
563
- node.params.push(this.flowParseTypeOrImplicitInstantiation());
564
- if (!this.match(48)) {
565
- this.expect(12);
566
- }
567
- }
568
- this.expect(48);
569
- this.state.inType = oldInType;
570
- return this.finishNode(node, "TypeParameterInstantiation");
571
- }
572
- flowParseInterfaceType() {
573
- const node = this.startNode();
574
- this.expectContextual(127);
575
- node.extends = [];
576
- if (this.eat(81)) {
577
- do {
578
- node.extends.push(this.flowParseInterfaceExtends());
579
- } while (this.eat(12));
580
- }
581
- node.body = this.flowParseObjectType({
582
- allowStatic: false,
583
- allowExact: false,
584
- allowSpread: false,
585
- allowProto: false,
586
- allowInexact: false
587
- });
588
- return this.finishNode(node, "InterfaceTypeAnnotation");
589
- }
590
- flowParseObjectPropertyKey() {
591
- return this.match(132) || this.match(131) ? super.parseExprAtom() : this.parseIdentifier(true);
592
- }
593
- flowParseObjectTypeIndexer(node, isStatic, variance) {
594
- node.static = isStatic;
595
- if (this.lookahead().type === 14) {
596
- node.id = this.flowParseObjectPropertyKey();
597
- node.key = this.flowParseTypeInitialiser();
598
- } else {
599
- node.id = null;
600
- node.key = this.flowParseType();
601
- }
602
- this.expect(3);
603
- node.value = this.flowParseTypeInitialiser();
604
- node.variance = variance;
605
- return this.finishNode(node, "ObjectTypeIndexer");
606
- }
607
- flowParseObjectTypeInternalSlot(node, isStatic) {
608
- node.static = isStatic;
609
- node.id = this.flowParseObjectPropertyKey();
610
- this.expect(3);
611
- this.expect(3);
612
- if (this.match(47) || this.match(10)) {
613
- node.method = true;
614
- node.optional = false;
615
- node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.loc.start));
616
- } else {
617
- node.method = false;
618
- if (this.eat(17)) {
619
- node.optional = true;
620
- }
621
- node.value = this.flowParseTypeInitialiser();
622
- }
623
- return this.finishNode(node, "ObjectTypeInternalSlot");
624
- }
625
- flowParseObjectTypeMethodish(node) {
626
- node.params = [];
627
- node.rest = null;
628
- node.typeParameters = null;
629
- node.this = null;
630
- if (this.match(47)) {
631
- node.typeParameters = this.flowParseTypeParameterDeclaration();
632
- }
633
- this.expect(10);
634
- if (this.match(78)) {
635
- node.this = this.flowParseFunctionTypeParam(true);
636
- node.this.name = null;
637
- if (!this.match(11)) {
638
- this.expect(12);
639
- }
640
- }
641
- while (!this.match(11) && !this.match(21)) {
642
- node.params.push(this.flowParseFunctionTypeParam(false));
643
- if (!this.match(11)) {
644
- this.expect(12);
645
- }
646
- }
647
- if (this.eat(21)) {
648
- node.rest = this.flowParseFunctionTypeParam(false);
649
- }
650
- this.expect(11);
651
- node.returnType = this.flowParseTypeInitialiser();
652
- return this.finishNode(node, "FunctionTypeAnnotation");
653
- }
654
- flowParseObjectTypeCallProperty(node, isStatic) {
655
- const valueNode = this.startNode();
656
- node.static = isStatic;
657
- node.value = this.flowParseObjectTypeMethodish(valueNode);
658
- return this.finishNode(node, "ObjectTypeCallProperty");
659
- }
660
- flowParseObjectType({
661
- allowStatic,
662
- allowExact,
663
- allowSpread,
664
- allowProto,
665
- allowInexact
666
- }) {
667
- const oldInType = this.state.inType;
668
- this.state.inType = true;
669
- const nodeStart = this.startNode();
670
- nodeStart.callProperties = [];
671
- nodeStart.properties = [];
672
- nodeStart.indexers = [];
673
- nodeStart.internalSlots = [];
674
- let endDelim;
675
- let exact;
676
- let inexact = false;
677
- if (allowExact && this.match(6)) {
678
- this.expect(6);
679
- endDelim = 9;
680
- exact = true;
681
- } else {
682
- this.expect(5);
683
- endDelim = 8;
684
- exact = false;
685
- }
686
- nodeStart.exact = exact;
687
- while (!this.match(endDelim)) {
688
- let isStatic = false;
689
- let protoStartLoc = null;
690
- let inexactStartLoc = null;
691
- const node = this.startNode();
692
- if (allowProto && this.isContextual(116)) {
693
- const lookahead = this.lookahead();
694
- if (lookahead.type !== 14 && lookahead.type !== 17) {
695
- this.next();
696
- protoStartLoc = this.state.startLoc;
697
- allowStatic = false;
698
- }
699
- }
700
- if (allowStatic && this.isContextual(104)) {
701
- const lookahead = this.lookahead();
702
- if (lookahead.type !== 14 && lookahead.type !== 17) {
703
- this.next();
704
- isStatic = true;
705
- }
706
- }
707
- const variance = this.flowParseVariance();
708
- if (this.eat(0)) {
709
- if (protoStartLoc != null) {
710
- this.unexpected(protoStartLoc);
711
- }
712
- if (this.eat(0)) {
713
- if (variance) {
714
- this.unexpected(variance.loc.start);
715
- }
716
- nodeStart.internalSlots.push(this.flowParseObjectTypeInternalSlot(node, isStatic));
717
- } else {
718
- nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
719
- }
720
- } else if (this.match(10) || this.match(47)) {
721
- if (protoStartLoc != null) {
722
- this.unexpected(protoStartLoc);
723
- }
724
- if (variance) {
725
- this.unexpected(variance.loc.start);
726
- }
727
- nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
728
- } else {
729
- let kind = "init";
730
- if (this.isContextual(98) || this.isContextual(103)) {
731
- const lookahead = this.lookahead();
732
- if ((0, _types.tokenIsLiteralPropertyName)(lookahead.type)) {
733
- kind = this.state.value;
734
- this.next();
735
- }
736
- }
737
- const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic, protoStartLoc, variance, kind, allowSpread, allowInexact != null ? allowInexact : !exact);
738
- if (propOrInexact === null) {
739
- inexact = true;
740
- inexactStartLoc = this.state.lastTokStartLoc;
741
- } else {
742
- nodeStart.properties.push(propOrInexact);
743
- }
744
- }
745
- this.flowObjectTypeSemicolon();
746
- if (inexactStartLoc && !this.match(8) && !this.match(9)) {
747
- this.raise(FlowErrors.UnexpectedExplicitInexactInObject, {
748
- at: inexactStartLoc
749
- });
750
- }
751
- }
752
- this.expect(endDelim);
753
- if (allowSpread) {
754
- nodeStart.inexact = inexact;
755
- }
756
- const out = this.finishNode(nodeStart, "ObjectTypeAnnotation");
757
- this.state.inType = oldInType;
758
- return out;
759
- }
760
- flowParseObjectTypeProperty(node, isStatic, protoStartLoc, variance, kind, allowSpread, allowInexact) {
761
- if (this.eat(21)) {
762
- const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9);
763
- if (isInexactToken) {
764
- if (!allowSpread) {
765
- this.raise(FlowErrors.InexactInsideNonObject, {
766
- at: this.state.lastTokStartLoc
767
- });
768
- } else if (!allowInexact) {
769
- this.raise(FlowErrors.InexactInsideExact, {
770
- at: this.state.lastTokStartLoc
771
- });
772
- }
773
- if (variance) {
774
- this.raise(FlowErrors.InexactVariance, {
775
- at: variance
776
- });
777
- }
778
- return null;
779
- }
780
- if (!allowSpread) {
781
- this.raise(FlowErrors.UnexpectedSpreadType, {
782
- at: this.state.lastTokStartLoc
783
- });
784
- }
785
- if (protoStartLoc != null) {
786
- this.unexpected(protoStartLoc);
787
- }
788
- if (variance) {
789
- this.raise(FlowErrors.SpreadVariance, {
790
- at: variance
791
- });
792
- }
793
- node.argument = this.flowParseType();
794
- return this.finishNode(node, "ObjectTypeSpreadProperty");
795
- } else {
796
- node.key = this.flowParseObjectPropertyKey();
797
- node.static = isStatic;
798
- node.proto = protoStartLoc != null;
799
- node.kind = kind;
800
- let optional = false;
801
- if (this.match(47) || this.match(10)) {
802
- node.method = true;
803
- if (protoStartLoc != null) {
804
- this.unexpected(protoStartLoc);
805
- }
806
- if (variance) {
807
- this.unexpected(variance.loc.start);
808
- }
809
- node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.loc.start));
810
- if (kind === "get" || kind === "set") {
811
- this.flowCheckGetterSetterParams(node);
812
- }
813
- if (!allowSpread && node.key.name === "constructor" && node.value.this) {
814
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
815
- at: node.value.this
816
- });
817
- }
818
- } else {
819
- if (kind !== "init") this.unexpected();
820
- node.method = false;
821
- if (this.eat(17)) {
822
- optional = true;
823
- }
824
- node.value = this.flowParseTypeInitialiser();
825
- node.variance = variance;
826
- }
827
- node.optional = optional;
828
- return this.finishNode(node, "ObjectTypeProperty");
829
- }
830
- }
831
- flowCheckGetterSetterParams(property) {
832
- const paramCount = property.kind === "get" ? 0 : 1;
833
- const length = property.value.params.length + (property.value.rest ? 1 : 0);
834
- if (property.value.this) {
835
- this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, {
836
- at: property.value.this
837
- });
838
- }
839
- if (length !== paramCount) {
840
- this.raise(property.kind === "get" ? _parseError.Errors.BadGetterArity : _parseError.Errors.BadSetterArity, {
841
- at: property
842
- });
843
- }
844
- if (property.kind === "set" && property.value.rest) {
845
- this.raise(_parseError.Errors.BadSetterRestParameter, {
846
- at: property
847
- });
848
- }
849
- }
850
- flowObjectTypeSemicolon() {
851
- if (!this.eat(13) && !this.eat(12) && !this.match(8) && !this.match(9)) {
852
- this.unexpected();
853
- }
854
- }
855
- flowParseQualifiedTypeIdentifier(startLoc, id) {
856
- var _startLoc;
857
- (_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc;
858
- let node = id || this.flowParseRestrictedIdentifier(true);
859
- while (this.eat(16)) {
860
- const node2 = this.startNodeAt(startLoc);
861
- node2.qualification = node;
862
- node2.id = this.flowParseRestrictedIdentifier(true);
863
- node = this.finishNode(node2, "QualifiedTypeIdentifier");
864
- }
865
- return node;
866
- }
867
- flowParseGenericType(startLoc, id) {
868
- const node = this.startNodeAt(startLoc);
869
- node.typeParameters = null;
870
- node.id = this.flowParseQualifiedTypeIdentifier(startLoc, id);
871
- if (this.match(47)) {
872
- node.typeParameters = this.flowParseTypeParameterInstantiation();
873
- }
874
- return this.finishNode(node, "GenericTypeAnnotation");
875
- }
876
- flowParseTypeofType() {
877
- const node = this.startNode();
878
- this.expect(87);
879
- node.argument = this.flowParsePrimaryType();
880
- return this.finishNode(node, "TypeofTypeAnnotation");
881
- }
882
- flowParseTupleType() {
883
- const node = this.startNode();
884
- node.types = [];
885
- this.expect(0);
886
- while (this.state.pos < this.length && !this.match(3)) {
887
- node.types.push(this.flowParseType());
888
- if (this.match(3)) break;
889
- this.expect(12);
890
- }
891
- this.expect(3);
892
- return this.finishNode(node, "TupleTypeAnnotation");
893
- }
894
- flowParseFunctionTypeParam(first) {
895
- let name = null;
896
- let optional = false;
897
- let typeAnnotation = null;
898
- const node = this.startNode();
899
- const lh = this.lookahead();
900
- const isThis = this.state.type === 78;
901
- if (lh.type === 14 || lh.type === 17) {
902
- if (isThis && !first) {
903
- this.raise(FlowErrors.ThisParamMustBeFirst, {
904
- at: node
905
- });
906
- }
907
- name = this.parseIdentifier(isThis);
908
- if (this.eat(17)) {
909
- optional = true;
910
- if (isThis) {
911
- this.raise(FlowErrors.ThisParamMayNotBeOptional, {
912
- at: node
913
- });
914
- }
915
- }
916
- typeAnnotation = this.flowParseTypeInitialiser();
917
- } else {
918
- typeAnnotation = this.flowParseType();
919
- }
920
- node.name = name;
921
- node.optional = optional;
922
- node.typeAnnotation = typeAnnotation;
923
- return this.finishNode(node, "FunctionTypeParam");
924
- }
925
- reinterpretTypeAsFunctionTypeParam(type) {
926
- const node = this.startNodeAt(type.loc.start);
927
- node.name = null;
928
- node.optional = false;
929
- node.typeAnnotation = type;
930
- return this.finishNode(node, "FunctionTypeParam");
931
- }
932
- flowParseFunctionTypeParams(params = []) {
933
- let rest = null;
934
- let _this = null;
935
- if (this.match(78)) {
936
- _this = this.flowParseFunctionTypeParam(true);
937
- _this.name = null;
938
- if (!this.match(11)) {
939
- this.expect(12);
940
- }
941
- }
942
- while (!this.match(11) && !this.match(21)) {
943
- params.push(this.flowParseFunctionTypeParam(false));
944
- if (!this.match(11)) {
945
- this.expect(12);
946
- }
947
- }
948
- if (this.eat(21)) {
949
- rest = this.flowParseFunctionTypeParam(false);
950
- }
951
- return {
952
- params,
953
- rest,
954
- _this
955
- };
956
- }
957
- flowIdentToTypeAnnotation(startLoc, node, id) {
958
- switch (id.name) {
959
- case "any":
960
- return this.finishNode(node, "AnyTypeAnnotation");
961
- case "bool":
962
- case "boolean":
963
- return this.finishNode(node, "BooleanTypeAnnotation");
964
- case "mixed":
965
- return this.finishNode(node, "MixedTypeAnnotation");
966
- case "empty":
967
- return this.finishNode(node, "EmptyTypeAnnotation");
968
- case "number":
969
- return this.finishNode(node, "NumberTypeAnnotation");
970
- case "string":
971
- return this.finishNode(node, "StringTypeAnnotation");
972
- case "symbol":
973
- return this.finishNode(node, "SymbolTypeAnnotation");
974
- default:
975
- this.checkNotUnderscore(id.name);
976
- return this.flowParseGenericType(startLoc, id);
977
- }
978
- }
979
- flowParsePrimaryType() {
980
- const startLoc = this.state.startLoc;
981
- const node = this.startNode();
982
- let tmp;
983
- let type;
984
- let isGroupedType = false;
985
- const oldNoAnonFunctionType = this.state.noAnonFunctionType;
986
- switch (this.state.type) {
987
- case 5:
988
- return this.flowParseObjectType({
989
- allowStatic: false,
990
- allowExact: false,
991
- allowSpread: true,
992
- allowProto: false,
993
- allowInexact: true
994
- });
995
- case 6:
996
- return this.flowParseObjectType({
997
- allowStatic: false,
998
- allowExact: true,
999
- allowSpread: true,
1000
- allowProto: false,
1001
- allowInexact: false
1002
- });
1003
- case 0:
1004
- this.state.noAnonFunctionType = false;
1005
- type = this.flowParseTupleType();
1006
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
1007
- return type;
1008
- case 47:
1009
- node.typeParameters = this.flowParseTypeParameterDeclaration();
1010
- this.expect(10);
1011
- tmp = this.flowParseFunctionTypeParams();
1012
- node.params = tmp.params;
1013
- node.rest = tmp.rest;
1014
- node.this = tmp._this;
1015
- this.expect(11);
1016
- this.expect(19);
1017
- node.returnType = this.flowParseType();
1018
- return this.finishNode(node, "FunctionTypeAnnotation");
1019
- case 10:
1020
- this.next();
1021
- if (!this.match(11) && !this.match(21)) {
1022
- if ((0, _types.tokenIsIdentifier)(this.state.type) || this.match(78)) {
1023
- const token = this.lookahead().type;
1024
- isGroupedType = token !== 17 && token !== 14;
1025
- } else {
1026
- isGroupedType = true;
1027
- }
1028
- }
1029
- if (isGroupedType) {
1030
- this.state.noAnonFunctionType = false;
1031
- type = this.flowParseType();
1032
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
1033
- if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) {
1034
- this.expect(11);
1035
- return type;
1036
- } else {
1037
- this.eat(12);
1038
- }
1039
- }
1040
- if (type) {
1041
- tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
1042
- } else {
1043
- tmp = this.flowParseFunctionTypeParams();
1044
- }
1045
- node.params = tmp.params;
1046
- node.rest = tmp.rest;
1047
- node.this = tmp._this;
1048
- this.expect(11);
1049
- this.expect(19);
1050
- node.returnType = this.flowParseType();
1051
- node.typeParameters = null;
1052
- return this.finishNode(node, "FunctionTypeAnnotation");
1053
- case 131:
1054
- return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
1055
- case 85:
1056
- case 86:
1057
- node.value = this.match(85);
1058
- this.next();
1059
- return this.finishNode(node, "BooleanLiteralTypeAnnotation");
1060
- case 53:
1061
- if (this.state.value === "-") {
1062
- this.next();
1063
- if (this.match(132)) {
1064
- return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
1065
- }
1066
- if (this.match(133)) {
1067
- return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
1068
- }
1069
- throw this.raise(FlowErrors.UnexpectedSubtractionOperand, {
1070
- at: this.state.startLoc
1071
- });
1072
- }
1073
- this.unexpected();
1074
- return;
1075
- case 132:
1076
- return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
1077
- case 133:
1078
- return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
1079
- case 88:
1080
- this.next();
1081
- return this.finishNode(node, "VoidTypeAnnotation");
1082
- case 84:
1083
- this.next();
1084
- return this.finishNode(node, "NullLiteralTypeAnnotation");
1085
- case 78:
1086
- this.next();
1087
- return this.finishNode(node, "ThisTypeAnnotation");
1088
- case 55:
1089
- this.next();
1090
- return this.finishNode(node, "ExistsTypeAnnotation");
1091
- case 87:
1092
- return this.flowParseTypeofType();
1093
- default:
1094
- if ((0, _types.tokenIsKeyword)(this.state.type)) {
1095
- const label = (0, _types.tokenLabelName)(this.state.type);
1096
- this.next();
1097
- return super.createIdentifier(node, label);
1098
- } else if ((0, _types.tokenIsIdentifier)(this.state.type)) {
1099
- if (this.isContextual(127)) {
1100
- return this.flowParseInterfaceType();
1101
- }
1102
- return this.flowIdentToTypeAnnotation(startLoc, node, this.parseIdentifier());
1103
- }
1104
- }
1105
- this.unexpected();
1106
- }
1107
- flowParsePostfixType() {
1108
- const startLoc = this.state.startLoc;
1109
- let type = this.flowParsePrimaryType();
1110
- let seenOptionalIndexedAccess = false;
1111
- while ((this.match(0) || this.match(18)) && !this.canInsertSemicolon()) {
1112
- const node = this.startNodeAt(startLoc);
1113
- const optional = this.eat(18);
1114
- seenOptionalIndexedAccess = seenOptionalIndexedAccess || optional;
1115
- this.expect(0);
1116
- if (!optional && this.match(3)) {
1117
- node.elementType = type;
1118
- this.next();
1119
- type = this.finishNode(node, "ArrayTypeAnnotation");
1120
- } else {
1121
- node.objectType = type;
1122
- node.indexType = this.flowParseType();
1123
- this.expect(3);
1124
- if (seenOptionalIndexedAccess) {
1125
- node.optional = optional;
1126
- type = this.finishNode(node, "OptionalIndexedAccessType");
1127
- } else {
1128
- type = this.finishNode(node, "IndexedAccessType");
1129
- }
1130
- }
1131
- }
1132
- return type;
1133
- }
1134
- flowParsePrefixType() {
1135
- const node = this.startNode();
1136
- if (this.eat(17)) {
1137
- node.typeAnnotation = this.flowParsePrefixType();
1138
- return this.finishNode(node, "NullableTypeAnnotation");
1139
- } else {
1140
- return this.flowParsePostfixType();
1141
- }
1142
- }
1143
- flowParseAnonFunctionWithoutParens() {
1144
- const param = this.flowParsePrefixType();
1145
- if (!this.state.noAnonFunctionType && this.eat(19)) {
1146
- const node = this.startNodeAt(param.loc.start);
1147
- node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
1148
- node.rest = null;
1149
- node.this = null;
1150
- node.returnType = this.flowParseType();
1151
- node.typeParameters = null;
1152
- return this.finishNode(node, "FunctionTypeAnnotation");
1153
- }
1154
- return param;
1155
- }
1156
- flowParseIntersectionType() {
1157
- const node = this.startNode();
1158
- this.eat(45);
1159
- const type = this.flowParseAnonFunctionWithoutParens();
1160
- node.types = [type];
1161
- while (this.eat(45)) {
1162
- node.types.push(this.flowParseAnonFunctionWithoutParens());
1163
- }
1164
- return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation");
1165
- }
1166
- flowParseUnionType() {
1167
- const node = this.startNode();
1168
- this.eat(43);
1169
- const type = this.flowParseIntersectionType();
1170
- node.types = [type];
1171
- while (this.eat(43)) {
1172
- node.types.push(this.flowParseIntersectionType());
1173
- }
1174
- return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation");
1175
- }
1176
- flowParseType() {
1177
- const oldInType = this.state.inType;
1178
- this.state.inType = true;
1179
- const type = this.flowParseUnionType();
1180
- this.state.inType = oldInType;
1181
- return type;
1182
- }
1183
- flowParseTypeOrImplicitInstantiation() {
1184
- if (this.state.type === 130 && this.state.value === "_") {
1185
- const startLoc = this.state.startLoc;
1186
- const node = this.parseIdentifier();
1187
- return this.flowParseGenericType(startLoc, node);
1188
- } else {
1189
- return this.flowParseType();
1190
- }
1191
- }
1192
- flowParseTypeAnnotation() {
1193
- const node = this.startNode();
1194
- node.typeAnnotation = this.flowParseTypeInitialiser();
1195
- return this.finishNode(node, "TypeAnnotation");
1196
- }
1197
- flowParseTypeAnnotatableIdentifier(allowPrimitiveOverride) {
1198
- const ident = allowPrimitiveOverride ? this.parseIdentifier() : this.flowParseRestrictedIdentifier();
1199
- if (this.match(14)) {
1200
- ident.typeAnnotation = this.flowParseTypeAnnotation();
1201
- this.resetEndLocation(ident);
1202
- }
1203
- return ident;
1204
- }
1205
- typeCastToParameter(node) {
1206
- node.expression.typeAnnotation = node.typeAnnotation;
1207
- this.resetEndLocation(node.expression, node.typeAnnotation.loc.end);
1208
- return node.expression;
1209
- }
1210
- flowParseVariance() {
1211
- let variance = null;
1212
- if (this.match(53)) {
1213
- variance = this.startNode();
1214
- if (this.state.value === "+") {
1215
- variance.kind = "plus";
1216
- } else {
1217
- variance.kind = "minus";
1218
- }
1219
- this.next();
1220
- return this.finishNode(variance, "Variance");
1221
- }
1222
- return variance;
1223
- }
1224
- parseFunctionBody(node, allowExpressionBody, isMethod = false) {
1225
- if (allowExpressionBody) {
1226
- this.forwardNoArrowParamsConversionAt(node, () => super.parseFunctionBody(node, true, isMethod));
1227
- return;
1228
- }
1229
- super.parseFunctionBody(node, false, isMethod);
1230
- }
1231
- parseFunctionBodyAndFinish(node, type, isMethod = false) {
1232
- if (this.match(14)) {
1233
- const typeNode = this.startNode();
1234
- [typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
1235
- node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
1236
- }
1237
- return super.parseFunctionBodyAndFinish(node, type, isMethod);
1238
- }
1239
- parseStatementLike(flags) {
1240
- if (this.state.strict && this.isContextual(127)) {
1241
- const lookahead = this.lookahead();
1242
- if ((0, _types.tokenIsKeywordOrIdentifier)(lookahead.type)) {
1243
- const node = this.startNode();
1244
- this.next();
1245
- return this.flowParseInterface(node);
1246
- }
1247
- } else if (this.shouldParseEnums() && this.isContextual(124)) {
1248
- const node = this.startNode();
1249
- this.next();
1250
- return this.flowParseEnumDeclaration(node);
1251
- }
1252
- const stmt = super.parseStatementLike(flags);
1253
- if (this.flowPragma === undefined && !this.isValidDirective(stmt)) {
1254
- this.flowPragma = null;
1255
- }
1256
- return stmt;
1257
- }
1258
- parseExpressionStatement(node, expr, decorators) {
1259
- if (expr.type === "Identifier") {
1260
- if (expr.name === "declare") {
1261
- if (this.match(80) || (0, _types.tokenIsIdentifier)(this.state.type) || this.match(68) || this.match(74) || this.match(82)) {
1262
- return this.flowParseDeclare(node);
1263
- }
1264
- } else if ((0, _types.tokenIsIdentifier)(this.state.type)) {
1265
- if (expr.name === "interface") {
1266
- return this.flowParseInterface(node);
1267
- } else if (expr.name === "type") {
1268
- return this.flowParseTypeAlias(node);
1269
- } else if (expr.name === "opaque") {
1270
- return this.flowParseOpaqueType(node, false);
1271
- }
1272
- }
1273
- }
1274
- return super.parseExpressionStatement(node, expr, decorators);
1275
- }
1276
- shouldParseExportDeclaration() {
1277
- const {
1278
- type
1279
- } = this.state;
1280
- if ((0, _types.tokenIsFlowInterfaceOrTypeOrOpaque)(type) || this.shouldParseEnums() && type === 124) {
1281
- return !this.state.containsEsc;
1282
- }
1283
- return super.shouldParseExportDeclaration();
1284
- }
1285
- isExportDefaultSpecifier() {
1286
- const {
1287
- type
1288
- } = this.state;
1289
- if ((0, _types.tokenIsFlowInterfaceOrTypeOrOpaque)(type) || this.shouldParseEnums() && type === 124) {
1290
- return this.state.containsEsc;
1291
- }
1292
- return super.isExportDefaultSpecifier();
1293
- }
1294
- parseExportDefaultExpression() {
1295
- if (this.shouldParseEnums() && this.isContextual(124)) {
1296
- const node = this.startNode();
1297
- this.next();
1298
- return this.flowParseEnumDeclaration(node);
1299
- }
1300
- return super.parseExportDefaultExpression();
1301
- }
1302
- parseConditional(expr, startLoc, refExpressionErrors) {
1303
- if (!this.match(17)) return expr;
1304
- if (this.state.maybeInArrowParameters) {
1305
- const nextCh = this.lookaheadCharCode();
1306
- if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) {
1307
- this.setOptionalParametersError(refExpressionErrors);
1308
- return expr;
1309
- }
1310
- }
1311
- this.expect(17);
1312
- const state = this.state.clone();
1313
- const originalNoArrowAt = this.state.noArrowAt;
1314
- const node = this.startNodeAt(startLoc);
1315
- let {
1316
- consequent,
1317
- failed
1318
- } = this.tryParseConditionalConsequent();
1319
- let [valid, invalid] = this.getArrowLikeExpressions(consequent);
1320
- if (failed || invalid.length > 0) {
1321
- const noArrowAt = [...originalNoArrowAt];
1322
- if (invalid.length > 0) {
1323
- this.state = state;
1324
- this.state.noArrowAt = noArrowAt;
1325
- for (let i = 0; i < invalid.length; i++) {
1326
- noArrowAt.push(invalid[i].start);
1327
- }
1328
- ({
1329
- consequent,
1330
- failed
1331
- } = this.tryParseConditionalConsequent());
1332
- [valid, invalid] = this.getArrowLikeExpressions(consequent);
1333
- }
1334
- if (failed && valid.length > 1) {
1335
- this.raise(FlowErrors.AmbiguousConditionalArrow, {
1336
- at: state.startLoc
1337
- });
1338
- }
1339
- if (failed && valid.length === 1) {
1340
- this.state = state;
1341
- noArrowAt.push(valid[0].start);
1342
- this.state.noArrowAt = noArrowAt;
1343
- ({
1344
- consequent,
1345
- failed
1346
- } = this.tryParseConditionalConsequent());
1347
- }
1348
- }
1349
- this.getArrowLikeExpressions(consequent, true);
1350
- this.state.noArrowAt = originalNoArrowAt;
1351
- this.expect(14);
1352
- node.test = expr;
1353
- node.consequent = consequent;
1354
- node.alternate = this.forwardNoArrowParamsConversionAt(node, () => this.parseMaybeAssign(undefined, undefined));
1355
- return this.finishNode(node, "ConditionalExpression");
1356
- }
1357
- tryParseConditionalConsequent() {
1358
- this.state.noArrowParamsConversionAt.push(this.state.start);
1359
- const consequent = this.parseMaybeAssignAllowIn();
1360
- const failed = !this.match(14);
1361
- this.state.noArrowParamsConversionAt.pop();
1362
- return {
1363
- consequent,
1364
- failed
1365
- };
1366
- }
1367
- getArrowLikeExpressions(node, disallowInvalid) {
1368
- const stack = [node];
1369
- const arrows = [];
1370
- while (stack.length !== 0) {
1371
- const node = stack.pop();
1372
- if (node.type === "ArrowFunctionExpression") {
1373
- if (node.typeParameters || !node.returnType) {
1374
- this.finishArrowValidation(node);
1375
- } else {
1376
- arrows.push(node);
1377
- }
1378
- stack.push(node.body);
1379
- } else if (node.type === "ConditionalExpression") {
1380
- stack.push(node.consequent);
1381
- stack.push(node.alternate);
1382
- }
1383
- }
1384
- if (disallowInvalid) {
1385
- arrows.forEach(node => this.finishArrowValidation(node));
1386
- return [arrows, []];
1387
- }
1388
- return partition(arrows, node => node.params.every(param => this.isAssignable(param, true)));
1389
- }
1390
- finishArrowValidation(node) {
1391
- var _node$extra;
1392
- this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
1393
- this.scope.enter(_scopeflags.ScopeFlag.FUNCTION | _scopeflags.ScopeFlag.ARROW);
1394
- super.checkParams(node, false, true);
1395
- this.scope.exit();
1396
- }
1397
- forwardNoArrowParamsConversionAt(node, parse) {
1398
- let result;
1399
- if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
1400
- this.state.noArrowParamsConversionAt.push(this.state.start);
1401
- result = parse();
1402
- this.state.noArrowParamsConversionAt.pop();
1403
- } else {
1404
- result = parse();
1405
- }
1406
- return result;
1407
- }
1408
- parseParenItem(node, startLoc) {
1409
- node = super.parseParenItem(node, startLoc);
1410
- if (this.eat(17)) {
1411
- node.optional = true;
1412
- this.resetEndLocation(node);
1413
- }
1414
- if (this.match(14)) {
1415
- const typeCastNode = this.startNodeAt(startLoc);
1416
- typeCastNode.expression = node;
1417
- typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
1418
- return this.finishNode(typeCastNode, "TypeCastExpression");
1419
- }
1420
- return node;
1421
- }
1422
- assertModuleNodeAllowed(node) {
1423
- if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
1424
- return;
1425
- }
1426
- super.assertModuleNodeAllowed(node);
1427
- }
1428
- parseExportDeclaration(node) {
1429
- if (this.isContextual(128)) {
1430
- node.exportKind = "type";
1431
- const declarationNode = this.startNode();
1432
- this.next();
1433
- if (this.match(5)) {
1434
- node.specifiers = this.parseExportSpecifiers(true);
1435
- super.parseExportFrom(node);
1436
- return null;
1437
- } else {
1438
- return this.flowParseTypeAlias(declarationNode);
1439
- }
1440
- } else if (this.isContextual(129)) {
1441
- node.exportKind = "type";
1442
- const declarationNode = this.startNode();
1443
- this.next();
1444
- return this.flowParseOpaqueType(declarationNode, false);
1445
- } else if (this.isContextual(127)) {
1446
- node.exportKind = "type";
1447
- const declarationNode = this.startNode();
1448
- this.next();
1449
- return this.flowParseInterface(declarationNode);
1450
- } else if (this.shouldParseEnums() && this.isContextual(124)) {
1451
- node.exportKind = "value";
1452
- const declarationNode = this.startNode();
1453
- this.next();
1454
- return this.flowParseEnumDeclaration(declarationNode);
1455
- } else {
1456
- return super.parseExportDeclaration(node);
1457
- }
1458
- }
1459
- eatExportStar(node) {
1460
- if (super.eatExportStar(node)) return true;
1461
- if (this.isContextual(128) && this.lookahead().type === 55) {
1462
- node.exportKind = "type";
1463
- this.next();
1464
- this.next();
1465
- return true;
1466
- }
1467
- return false;
1468
- }
1469
- maybeParseExportNamespaceSpecifier(node) {
1470
- const {
1471
- startLoc
1472
- } = this.state;
1473
- const hasNamespace = super.maybeParseExportNamespaceSpecifier(node);
1474
- if (hasNamespace && node.exportKind === "type") {
1475
- this.unexpected(startLoc);
1476
- }
1477
- return hasNamespace;
1478
- }
1479
- parseClassId(node, isStatement, optionalId) {
1480
- super.parseClassId(node, isStatement, optionalId);
1481
- if (this.match(47)) {
1482
- node.typeParameters = this.flowParseTypeParameterDeclaration();
1483
- }
1484
- }
1485
- parseClassMember(classBody, member, state) {
1486
- const {
1487
- startLoc
1488
- } = this.state;
1489
- if (this.isContextual(123)) {
1490
- if (super.parseClassMemberFromModifier(classBody, member)) {
1491
- return;
1492
- }
1493
- member.declare = true;
1494
- }
1495
- super.parseClassMember(classBody, member, state);
1496
- if (member.declare) {
1497
- if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
1498
- this.raise(FlowErrors.DeclareClassElement, {
1499
- at: startLoc
1500
- });
1501
- } else if (member.value) {
1502
- this.raise(FlowErrors.DeclareClassFieldInitializer, {
1503
- at: member.value
1504
- });
1505
- }
1506
- }
1507
- }
1508
- isIterator(word) {
1509
- return word === "iterator" || word === "asyncIterator";
1510
- }
1511
- readIterator() {
1512
- const word = super.readWord1();
1513
- const fullWord = "@@" + word;
1514
- if (!this.isIterator(word) || !this.state.inType) {
1515
- this.raise(_parseError.Errors.InvalidIdentifier, {
1516
- at: this.state.curPosition(),
1517
- identifierName: fullWord
1518
- });
1519
- }
1520
- this.finishToken(130, fullWord);
1521
- }
1522
- getTokenFromCode(code) {
1523
- const next = this.input.charCodeAt(this.state.pos + 1);
1524
- if (code === 123 && next === 124) {
1525
- this.finishOp(6, 2);
1526
- } else if (this.state.inType && (code === 62 || code === 60)) {
1527
- this.finishOp(code === 62 ? 48 : 47, 1);
1528
- } else if (this.state.inType && code === 63) {
1529
- if (next === 46) {
1530
- this.finishOp(18, 2);
1531
- } else {
1532
- this.finishOp(17, 1);
1533
- }
1534
- } else if ((0, _identifier.isIteratorStart)(code, next, this.input.charCodeAt(this.state.pos + 2))) {
1535
- this.state.pos += 2;
1536
- this.readIterator();
1537
- } else {
1538
- super.getTokenFromCode(code);
1539
- }
1540
- }
1541
- isAssignable(node, isBinding) {
1542
- if (node.type === "TypeCastExpression") {
1543
- return this.isAssignable(node.expression, isBinding);
1544
- } else {
1545
- return super.isAssignable(node, isBinding);
1546
- }
1547
- }
1548
- toAssignable(node, isLHS = false) {
1549
- if (!isLHS && node.type === "AssignmentExpression" && node.left.type === "TypeCastExpression") {
1550
- node.left = this.typeCastToParameter(node.left);
1551
- }
1552
- super.toAssignable(node, isLHS);
1553
- }
1554
- toAssignableList(exprList, trailingCommaLoc, isLHS) {
1555
- for (let i = 0; i < exprList.length; i++) {
1556
- const expr = exprList[i];
1557
- if ((expr == null ? void 0 : expr.type) === "TypeCastExpression") {
1558
- exprList[i] = this.typeCastToParameter(expr);
1559
- }
1560
- }
1561
- super.toAssignableList(exprList, trailingCommaLoc, isLHS);
1562
- }
1563
- toReferencedList(exprList, isParenthesizedExpr) {
1564
- for (let i = 0; i < exprList.length; i++) {
1565
- var _expr$extra;
1566
- const expr = exprList[i];
1567
- if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
1568
- this.raise(FlowErrors.TypeCastInPattern, {
1569
- at: expr.typeAnnotation
1570
- });
1571
- }
1572
- }
1573
- return exprList;
1574
- }
1575
- parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
1576
- const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);
1577
- if (canBePattern && !this.state.maybeInArrowParameters) {
1578
- this.toReferencedList(node.elements);
1579
- }
1580
- return node;
1581
- }
1582
- isValidLVal(type, isParenthesized, binding) {
1583
- return type === "TypeCastExpression" || super.isValidLVal(type, isParenthesized, binding);
1584
- }
1585
- parseClassProperty(node) {
1586
- if (this.match(14)) {
1587
- node.typeAnnotation = this.flowParseTypeAnnotation();
1588
- }
1589
- return super.parseClassProperty(node);
1590
- }
1591
- parseClassPrivateProperty(node) {
1592
- if (this.match(14)) {
1593
- node.typeAnnotation = this.flowParseTypeAnnotation();
1594
- }
1595
- return super.parseClassPrivateProperty(node);
1596
- }
1597
- isClassMethod() {
1598
- return this.match(47) || super.isClassMethod();
1599
- }
1600
- isClassProperty() {
1601
- return this.match(14) || super.isClassProperty();
1602
- }
1603
- isNonstaticConstructor(method) {
1604
- return !this.match(14) && super.isNonstaticConstructor(method);
1605
- }
1606
- pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
1607
- if (method.variance) {
1608
- this.unexpected(method.variance.loc.start);
1609
- }
1610
- delete method.variance;
1611
- if (this.match(47)) {
1612
- method.typeParameters = this.flowParseTypeParameterDeclaration();
1613
- }
1614
- super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
1615
- if (method.params && isConstructor) {
1616
- const params = method.params;
1617
- if (params.length > 0 && this.isThisParam(params[0])) {
1618
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
1619
- at: method
1620
- });
1621
- }
1622
- } else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
1623
- const params = method.value.params;
1624
- if (params.length > 0 && this.isThisParam(params[0])) {
1625
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
1626
- at: method
1627
- });
1628
- }
1629
- }
1630
- }
1631
- pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
1632
- if (method.variance) {
1633
- this.unexpected(method.variance.loc.start);
1634
- }
1635
- delete method.variance;
1636
- if (this.match(47)) {
1637
- method.typeParameters = this.flowParseTypeParameterDeclaration();
1638
- }
1639
- super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
1640
- }
1641
- parseClassSuper(node) {
1642
- super.parseClassSuper(node);
1643
- if (node.superClass && this.match(47)) {
1644
- node.superTypeParameters = this.flowParseTypeParameterInstantiation();
1645
- }
1646
- if (this.isContextual(111)) {
1647
- this.next();
1648
- const implemented = node.implements = [];
1649
- do {
1650
- const node = this.startNode();
1651
- node.id = this.flowParseRestrictedIdentifier(true);
1652
- if (this.match(47)) {
1653
- node.typeParameters = this.flowParseTypeParameterInstantiation();
1654
- } else {
1655
- node.typeParameters = null;
1656
- }
1657
- implemented.push(this.finishNode(node, "ClassImplements"));
1658
- } while (this.eat(12));
1659
- }
1660
- }
1661
- checkGetterSetterParams(method) {
1662
- super.checkGetterSetterParams(method);
1663
- const params = this.getObjectOrClassMethodParams(method);
1664
- if (params.length > 0) {
1665
- const param = params[0];
1666
- if (this.isThisParam(param) && method.kind === "get") {
1667
- this.raise(FlowErrors.GetterMayNotHaveThisParam, {
1668
- at: param
1669
- });
1670
- } else if (this.isThisParam(param)) {
1671
- this.raise(FlowErrors.SetterMayNotHaveThisParam, {
1672
- at: param
1673
- });
1674
- }
1675
- }
1676
- }
1677
- parsePropertyNamePrefixOperator(node) {
1678
- node.variance = this.flowParseVariance();
1679
- }
1680
- parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
1681
- if (prop.variance) {
1682
- this.unexpected(prop.variance.loc.start);
1683
- }
1684
- delete prop.variance;
1685
- let typeParameters;
1686
- if (this.match(47) && !isAccessor) {
1687
- typeParameters = this.flowParseTypeParameterDeclaration();
1688
- if (!this.match(10)) this.unexpected();
1689
- }
1690
- const result = super.parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
1691
- if (typeParameters) {
1692
- (result.value || result).typeParameters = typeParameters;
1693
- }
1694
- return result;
1695
- }
1696
- parseAssignableListItemTypes(param) {
1697
- if (this.eat(17)) {
1698
- if (param.type !== "Identifier") {
1699
- this.raise(FlowErrors.PatternIsOptional, {
1700
- at: param
1701
- });
1702
- }
1703
- if (this.isThisParam(param)) {
1704
- this.raise(FlowErrors.ThisParamMayNotBeOptional, {
1705
- at: param
1706
- });
1707
- }
1708
- param.optional = true;
1709
- }
1710
- if (this.match(14)) {
1711
- param.typeAnnotation = this.flowParseTypeAnnotation();
1712
- } else if (this.isThisParam(param)) {
1713
- this.raise(FlowErrors.ThisParamAnnotationRequired, {
1714
- at: param
1715
- });
1716
- }
1717
- if (this.match(29) && this.isThisParam(param)) {
1718
- this.raise(FlowErrors.ThisParamNoDefault, {
1719
- at: param
1720
- });
1721
- }
1722
- this.resetEndLocation(param);
1723
- return param;
1724
- }
1725
- parseMaybeDefault(startLoc, left) {
1726
- const node = super.parseMaybeDefault(startLoc, left);
1727
- if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
1728
- this.raise(FlowErrors.TypeBeforeInitializer, {
1729
- at: node.typeAnnotation
1730
- });
1731
- }
1732
- return node;
1733
- }
1734
- checkImportReflection(node) {
1735
- super.checkImportReflection(node);
1736
- if (node.module && node.importKind !== "value") {
1737
- this.raise(FlowErrors.ImportReflectionHasImportType, {
1738
- at: node.specifiers[0].loc.start
1739
- });
1740
- }
1741
- }
1742
- parseImportSpecifierLocal(node, specifier, type) {
1743
- specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier(true, true) : this.parseIdentifier();
1744
- node.specifiers.push(this.finishImportSpecifier(specifier, type));
1745
- }
1746
- isPotentialImportPhase(isExport) {
1747
- if (super.isPotentialImportPhase(isExport)) return true;
1748
- if (this.isContextual(128)) {
1749
- if (!isExport) return true;
1750
- const ch = this.lookaheadCharCode();
1751
- return ch === 123 || ch === 42;
1752
- }
1753
- return !isExport && this.isContextual(87);
1754
- }
1755
- applyImportPhase(node, isExport, phase, loc) {
1756
- super.applyImportPhase(node, isExport, phase, loc);
1757
- if (isExport) {
1758
- if (!phase && this.match(65)) {
1759
- return;
1760
- }
1761
- node.exportKind = phase === "type" ? phase : "value";
1762
- } else {
1763
- if (phase === "type" && this.match(55)) this.unexpected();
1764
- node.importKind = phase === "type" || phase === "typeof" ? phase : "value";
1765
- }
1766
- }
1767
- parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
1768
- const firstIdent = specifier.imported;
1769
- let specifierTypeKind = null;
1770
- if (firstIdent.type === "Identifier") {
1771
- if (firstIdent.name === "type") {
1772
- specifierTypeKind = "type";
1773
- } else if (firstIdent.name === "typeof") {
1774
- specifierTypeKind = "typeof";
1775
- }
1776
- }
1777
- let isBinding = false;
1778
- if (this.isContextual(93) && !this.isLookaheadContextual("as")) {
1779
- const as_ident = this.parseIdentifier(true);
1780
- if (specifierTypeKind !== null && !(0, _types.tokenIsKeywordOrIdentifier)(this.state.type)) {
1781
- specifier.imported = as_ident;
1782
- specifier.importKind = specifierTypeKind;
1783
- specifier.local = (0, _node.cloneIdentifier)(as_ident);
1784
- } else {
1785
- specifier.imported = firstIdent;
1786
- specifier.importKind = null;
1787
- specifier.local = this.parseIdentifier();
1788
- }
1789
- } else {
1790
- if (specifierTypeKind !== null && (0, _types.tokenIsKeywordOrIdentifier)(this.state.type)) {
1791
- specifier.imported = this.parseIdentifier(true);
1792
- specifier.importKind = specifierTypeKind;
1793
- } else {
1794
- if (importedIsString) {
1795
- throw this.raise(_parseError.Errors.ImportBindingIsString, {
1796
- at: specifier,
1797
- importName: firstIdent.value
1798
- });
1799
- }
1800
- specifier.imported = firstIdent;
1801
- specifier.importKind = null;
1802
- }
1803
- if (this.eatContextual(93)) {
1804
- specifier.local = this.parseIdentifier();
1805
- } else {
1806
- isBinding = true;
1807
- specifier.local = (0, _node.cloneIdentifier)(specifier.imported);
1808
- }
1809
- }
1810
- const specifierIsTypeImport = hasTypeImportKind(specifier);
1811
- if (isInTypeOnlyImport && specifierIsTypeImport) {
1812
- this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, {
1813
- at: specifier
1814
- });
1815
- }
1816
- if (isInTypeOnlyImport || specifierIsTypeImport) {
1817
- this.checkReservedType(specifier.local.name, specifier.local.loc.start, true);
1818
- }
1819
- if (isBinding && !isInTypeOnlyImport && !specifierIsTypeImport) {
1820
- this.checkReservedWord(specifier.local.name, specifier.loc.start, true, true);
1821
- }
1822
- return this.finishImportSpecifier(specifier, "ImportSpecifier");
1823
- }
1824
- parseBindingAtom() {
1825
- switch (this.state.type) {
1826
- case 78:
1827
- return this.parseIdentifier(true);
1828
- default:
1829
- return super.parseBindingAtom();
1830
- }
1831
- }
1832
- parseFunctionParams(node, isConstructor) {
1833
- const kind = node.kind;
1834
- if (kind !== "get" && kind !== "set" && this.match(47)) {
1835
- node.typeParameters = this.flowParseTypeParameterDeclaration();
1836
- }
1837
- super.parseFunctionParams(node, isConstructor);
1838
- }
1839
- parseVarId(decl, kind) {
1840
- super.parseVarId(decl, kind);
1841
- if (this.match(14)) {
1842
- decl.id.typeAnnotation = this.flowParseTypeAnnotation();
1843
- this.resetEndLocation(decl.id);
1844
- }
1845
- }
1846
- parseAsyncArrowFromCallExpression(node, call) {
1847
- if (this.match(14)) {
1848
- const oldNoAnonFunctionType = this.state.noAnonFunctionType;
1849
- this.state.noAnonFunctionType = true;
1850
- node.returnType = this.flowParseTypeAnnotation();
1851
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
1852
- }
1853
- return super.parseAsyncArrowFromCallExpression(node, call);
1854
- }
1855
- shouldParseAsyncArrow() {
1856
- return this.match(14) || super.shouldParseAsyncArrow();
1857
- }
1858
- parseMaybeAssign(refExpressionErrors, afterLeftParse) {
1859
- var _jsx;
1860
- let state = null;
1861
- let jsx;
1862
- if (this.hasPlugin("jsx") && (this.match(140) || this.match(47))) {
1863
- state = this.state.clone();
1864
- jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
1865
- if (!jsx.error) return jsx.node;
1866
- const {
1867
- context
1868
- } = this.state;
1869
- const currentContext = context[context.length - 1];
1870
- if (currentContext === _context.types.j_oTag || currentContext === _context.types.j_expr) {
1871
- context.pop();
1872
- }
1873
- }
1874
- if ((_jsx = jsx) != null && _jsx.error || this.match(47)) {
1875
- var _jsx2, _jsx3;
1876
- state = state || this.state.clone();
1877
- let typeParameters;
1878
- const arrow = this.tryParse(abort => {
1879
- var _arrowExpression$extr;
1880
- typeParameters = this.flowParseTypeParameterDeclaration();
1881
- const arrowExpression = this.forwardNoArrowParamsConversionAt(typeParameters, () => {
1882
- const result = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
1883
- this.resetStartLocationFromNode(result, typeParameters);
1884
- return result;
1885
- });
1886
- if ((_arrowExpression$extr = arrowExpression.extra) != null && _arrowExpression$extr.parenthesized) abort();
1887
- const expr = this.maybeUnwrapTypeCastExpression(arrowExpression);
1888
- if (expr.type !== "ArrowFunctionExpression") abort();
1889
- expr.typeParameters = typeParameters;
1890
- this.resetStartLocationFromNode(expr, typeParameters);
1891
- return arrowExpression;
1892
- }, state);
1893
- let arrowExpression = null;
1894
- if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
1895
- if (!arrow.error && !arrow.aborted) {
1896
- if (arrow.node.async) {
1897
- this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, {
1898
- at: typeParameters
1899
- });
1900
- }
1901
- return arrow.node;
1902
- }
1903
- arrowExpression = arrow.node;
1904
- }
1905
- if ((_jsx2 = jsx) != null && _jsx2.node) {
1906
- this.state = jsx.failState;
1907
- return jsx.node;
1908
- }
1909
- if (arrowExpression) {
1910
- this.state = arrow.failState;
1911
- return arrowExpression;
1912
- }
1913
- if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
1914
- if (arrow.thrown) throw arrow.error;
1915
- throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, {
1916
- at: typeParameters
1917
- });
1918
- }
1919
- return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
1920
- }
1921
- parseArrow(node) {
1922
- if (this.match(14)) {
1923
- const result = this.tryParse(() => {
1924
- const oldNoAnonFunctionType = this.state.noAnonFunctionType;
1925
- this.state.noAnonFunctionType = true;
1926
- const typeNode = this.startNode();
1927
- [typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
1928
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
1929
- if (this.canInsertSemicolon()) this.unexpected();
1930
- if (!this.match(19)) this.unexpected();
1931
- return typeNode;
1932
- });
1933
- if (result.thrown) return null;
1934
- if (result.error) this.state = result.failState;
1935
- node.returnType = result.node.typeAnnotation ? this.finishNode(result.node, "TypeAnnotation") : null;
1936
- }
1937
- return super.parseArrow(node);
1938
- }
1939
- shouldParseArrow(params) {
1940
- return this.match(14) || super.shouldParseArrow(params);
1941
- }
1942
- setArrowFunctionParameters(node, params) {
1943
- if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
1944
- node.params = params;
1945
- } else {
1946
- super.setArrowFunctionParameters(node, params);
1947
- }
1948
- }
1949
- checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
1950
- if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
1951
- return;
1952
- }
1953
- for (let i = 0; i < node.params.length; i++) {
1954
- if (this.isThisParam(node.params[i]) && i > 0) {
1955
- this.raise(FlowErrors.ThisParamMustBeFirst, {
1956
- at: node.params[i]
1957
- });
1958
- }
1959
- }
1960
- super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
1961
- }
1962
- parseParenAndDistinguishExpression(canBeArrow) {
1963
- return super.parseParenAndDistinguishExpression(canBeArrow && this.state.noArrowAt.indexOf(this.state.start) === -1);
1964
- }
1965
- parseSubscripts(base, startLoc, noCalls) {
1966
- if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.indexOf(startLoc.index) !== -1) {
1967
- this.next();
1968
- const node = this.startNodeAt(startLoc);
1969
- node.callee = base;
1970
- node.arguments = super.parseCallExpressionArguments(11, false);
1971
- base = this.finishNode(node, "CallExpression");
1972
- } else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
1973
- const state = this.state.clone();
1974
- const arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startLoc) || abort(), state);
1975
- if (!arrow.error && !arrow.aborted) return arrow.node;
1976
- const result = this.tryParse(() => super.parseSubscripts(base, startLoc, noCalls), state);
1977
- if (result.node && !result.error) return result.node;
1978
- if (arrow.node) {
1979
- this.state = arrow.failState;
1980
- return arrow.node;
1981
- }
1982
- if (result.node) {
1983
- this.state = result.failState;
1984
- return result.node;
1985
- }
1986
- throw arrow.error || result.error;
1987
- }
1988
- return super.parseSubscripts(base, startLoc, noCalls);
1989
- }
1990
- parseSubscript(base, startLoc, noCalls, subscriptState) {
1991
- if (this.match(18) && this.isLookaheadToken_lt()) {
1992
- subscriptState.optionalChainMember = true;
1993
- if (noCalls) {
1994
- subscriptState.stop = true;
1995
- return base;
1996
- }
1997
- this.next();
1998
- const node = this.startNodeAt(startLoc);
1999
- node.callee = base;
2000
- node.typeArguments = this.flowParseTypeParameterInstantiation();
2001
- this.expect(10);
2002
- node.arguments = this.parseCallExpressionArguments(11, false);
2003
- node.optional = true;
2004
- return this.finishCallExpression(node, true);
2005
- } else if (!noCalls && this.shouldParseTypes() && this.match(47)) {
2006
- const node = this.startNodeAt(startLoc);
2007
- node.callee = base;
2008
- const result = this.tryParse(() => {
2009
- node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
2010
- this.expect(10);
2011
- node.arguments = super.parseCallExpressionArguments(11, false);
2012
- if (subscriptState.optionalChainMember) {
2013
- node.optional = false;
2014
- }
2015
- return this.finishCallExpression(node, subscriptState.optionalChainMember);
2016
- });
2017
- if (result.node) {
2018
- if (result.error) this.state = result.failState;
2019
- return result.node;
2020
- }
2021
- }
2022
- return super.parseSubscript(base, startLoc, noCalls, subscriptState);
2023
- }
2024
- parseNewCallee(node) {
2025
- super.parseNewCallee(node);
2026
- let targs = null;
2027
- if (this.shouldParseTypes() && this.match(47)) {
2028
- targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node;
2029
- }
2030
- node.typeArguments = targs;
2031
- }
2032
- parseAsyncArrowWithTypeParameters(startLoc) {
2033
- const node = this.startNodeAt(startLoc);
2034
- this.parseFunctionParams(node, false);
2035
- if (!this.parseArrow(node)) return;
2036
- return super.parseArrowExpression(node, undefined, true);
2037
- }
2038
- readToken_mult_modulo(code) {
2039
- const next = this.input.charCodeAt(this.state.pos + 1);
2040
- if (code === 42 && next === 47 && this.state.hasFlowComment) {
2041
- this.state.hasFlowComment = false;
2042
- this.state.pos += 2;
2043
- this.nextToken();
2044
- return;
2045
- }
2046
- super.readToken_mult_modulo(code);
2047
- }
2048
- readToken_pipe_amp(code) {
2049
- const next = this.input.charCodeAt(this.state.pos + 1);
2050
- if (code === 124 && next === 125) {
2051
- this.finishOp(9, 2);
2052
- return;
2053
- }
2054
- super.readToken_pipe_amp(code);
2055
- }
2056
- parseTopLevel(file, program) {
2057
- const fileNode = super.parseTopLevel(file, program);
2058
- if (this.state.hasFlowComment) {
2059
- this.raise(FlowErrors.UnterminatedFlowComment, {
2060
- at: this.state.curPosition()
2061
- });
2062
- }
2063
- return fileNode;
2064
- }
2065
- skipBlockComment() {
2066
- if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
2067
- if (this.state.hasFlowComment) {
2068
- throw this.raise(FlowErrors.NestedFlowComment, {
2069
- at: this.state.startLoc
2070
- });
2071
- }
2072
- this.hasFlowCommentCompletion();
2073
- const commentSkip = this.skipFlowComment();
2074
- if (commentSkip) {
2075
- this.state.pos += commentSkip;
2076
- this.state.hasFlowComment = true;
2077
- }
2078
- return;
2079
- }
2080
- return super.skipBlockComment(this.state.hasFlowComment ? "*-/" : "*/");
2081
- }
2082
- skipFlowComment() {
2083
- const {
2084
- pos
2085
- } = this.state;
2086
- let shiftToFirstNonWhiteSpace = 2;
2087
- while ([32, 9].includes(this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace))) {
2088
- shiftToFirstNonWhiteSpace++;
2089
- }
2090
- const ch2 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos);
2091
- const ch3 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos + 1);
2092
- if (ch2 === 58 && ch3 === 58) {
2093
- return shiftToFirstNonWhiteSpace + 2;
2094
- }
2095
- if (this.input.slice(shiftToFirstNonWhiteSpace + pos, shiftToFirstNonWhiteSpace + pos + 12) === "flow-include") {
2096
- return shiftToFirstNonWhiteSpace + 12;
2097
- }
2098
- if (ch2 === 58 && ch3 !== 58) {
2099
- return shiftToFirstNonWhiteSpace;
2100
- }
2101
- return false;
2102
- }
2103
- hasFlowCommentCompletion() {
2104
- const end = this.input.indexOf("*/", this.state.pos);
2105
- if (end === -1) {
2106
- throw this.raise(_parseError.Errors.UnterminatedComment, {
2107
- at: this.state.curPosition()
2108
- });
2109
- }
2110
- }
2111
- flowEnumErrorBooleanMemberNotInitialized(loc, {
2112
- enumName,
2113
- memberName
2114
- }) {
2115
- this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
2116
- at: loc,
2117
- memberName,
2118
- enumName
2119
- });
2120
- }
2121
- flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
2122
- return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, Object.assign({
2123
- at: loc
2124
- }, enumContext));
2125
- }
2126
- flowEnumErrorNumberMemberNotInitialized(loc, {
2127
- enumName,
2128
- memberName
2129
- }) {
2130
- this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
2131
- at: loc,
2132
- enumName,
2133
- memberName
2134
- });
2135
- }
2136
- flowEnumErrorStringMemberInconsistentlyInitailized(node, {
2137
- enumName
2138
- }) {
2139
- this.raise(FlowErrors.EnumStringMemberInconsistentlyInitailized, {
2140
- at: node,
2141
- enumName
2142
- });
2143
- }
2144
- flowEnumMemberInit() {
2145
- const startLoc = this.state.startLoc;
2146
- const endOfInit = () => this.match(12) || this.match(8);
2147
- switch (this.state.type) {
2148
- case 132:
2149
- {
2150
- const literal = this.parseNumericLiteral(this.state.value);
2151
- if (endOfInit()) {
2152
- return {
2153
- type: "number",
2154
- loc: literal.loc.start,
2155
- value: literal
2156
- };
2157
- }
2158
- return {
2159
- type: "invalid",
2160
- loc: startLoc
2161
- };
2162
- }
2163
- case 131:
2164
- {
2165
- const literal = this.parseStringLiteral(this.state.value);
2166
- if (endOfInit()) {
2167
- return {
2168
- type: "string",
2169
- loc: literal.loc.start,
2170
- value: literal
2171
- };
2172
- }
2173
- return {
2174
- type: "invalid",
2175
- loc: startLoc
2176
- };
2177
- }
2178
- case 85:
2179
- case 86:
2180
- {
2181
- const literal = this.parseBooleanLiteral(this.match(85));
2182
- if (endOfInit()) {
2183
- return {
2184
- type: "boolean",
2185
- loc: literal.loc.start,
2186
- value: literal
2187
- };
2188
- }
2189
- return {
2190
- type: "invalid",
2191
- loc: startLoc
2192
- };
2193
- }
2194
- default:
2195
- return {
2196
- type: "invalid",
2197
- loc: startLoc
2198
- };
2199
- }
2200
- }
2201
- flowEnumMemberRaw() {
2202
- const loc = this.state.startLoc;
2203
- const id = this.parseIdentifier(true);
2204
- const init = this.eat(29) ? this.flowEnumMemberInit() : {
2205
- type: "none",
2206
- loc
2207
- };
2208
- return {
2209
- id,
2210
- init
2211
- };
2212
- }
2213
- flowEnumCheckExplicitTypeMismatch(loc, context, expectedType) {
2214
- const {
2215
- explicitType
2216
- } = context;
2217
- if (explicitType === null) {
2218
- return;
2219
- }
2220
- if (explicitType !== expectedType) {
2221
- this.flowEnumErrorInvalidMemberInitializer(loc, context);
2222
- }
2223
- }
2224
- flowEnumMembers({
2225
- enumName,
2226
- explicitType
2227
- }) {
2228
- const seenNames = new Set();
2229
- const members = {
2230
- booleanMembers: [],
2231
- numberMembers: [],
2232
- stringMembers: [],
2233
- defaultedMembers: []
2234
- };
2235
- let hasUnknownMembers = false;
2236
- while (!this.match(8)) {
2237
- if (this.eat(21)) {
2238
- hasUnknownMembers = true;
2239
- break;
2240
- }
2241
- const memberNode = this.startNode();
2242
- const {
2243
- id,
2244
- init
2245
- } = this.flowEnumMemberRaw();
2246
- const memberName = id.name;
2247
- if (memberName === "") {
2248
- continue;
2249
- }
2250
- if (/^[a-z]/.test(memberName)) {
2251
- this.raise(FlowErrors.EnumInvalidMemberName, {
2252
- at: id,
2253
- memberName,
2254
- suggestion: memberName[0].toUpperCase() + memberName.slice(1),
2255
- enumName
2256
- });
2257
- }
2258
- if (seenNames.has(memberName)) {
2259
- this.raise(FlowErrors.EnumDuplicateMemberName, {
2260
- at: id,
2261
- memberName,
2262
- enumName
2263
- });
2264
- }
2265
- seenNames.add(memberName);
2266
- const context = {
2267
- enumName,
2268
- explicitType,
2269
- memberName
2270
- };
2271
- memberNode.id = id;
2272
- switch (init.type) {
2273
- case "boolean":
2274
- {
2275
- this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "boolean");
2276
- memberNode.init = init.value;
2277
- members.booleanMembers.push(this.finishNode(memberNode, "EnumBooleanMember"));
2278
- break;
2279
- }
2280
- case "number":
2281
- {
2282
- this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "number");
2283
- memberNode.init = init.value;
2284
- members.numberMembers.push(this.finishNode(memberNode, "EnumNumberMember"));
2285
- break;
2286
- }
2287
- case "string":
2288
- {
2289
- this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "string");
2290
- memberNode.init = init.value;
2291
- members.stringMembers.push(this.finishNode(memberNode, "EnumStringMember"));
2292
- break;
2293
- }
2294
- case "invalid":
2295
- {
2296
- throw this.flowEnumErrorInvalidMemberInitializer(init.loc, context);
2297
- }
2298
- case "none":
2299
- {
2300
- switch (explicitType) {
2301
- case "boolean":
2302
- this.flowEnumErrorBooleanMemberNotInitialized(init.loc, context);
2303
- break;
2304
- case "number":
2305
- this.flowEnumErrorNumberMemberNotInitialized(init.loc, context);
2306
- break;
2307
- default:
2308
- members.defaultedMembers.push(this.finishNode(memberNode, "EnumDefaultedMember"));
2309
- }
2310
- }
2311
- }
2312
- if (!this.match(8)) {
2313
- this.expect(12);
2314
- }
2315
- }
2316
- return {
2317
- members,
2318
- hasUnknownMembers
2319
- };
2320
- }
2321
- flowEnumStringMembers(initializedMembers, defaultedMembers, {
2322
- enumName
2323
- }) {
2324
- if (initializedMembers.length === 0) {
2325
- return defaultedMembers;
2326
- } else if (defaultedMembers.length === 0) {
2327
- return initializedMembers;
2328
- } else if (defaultedMembers.length > initializedMembers.length) {
2329
- for (const member of initializedMembers) {
2330
- this.flowEnumErrorStringMemberInconsistentlyInitailized(member, {
2331
- enumName
2332
- });
2333
- }
2334
- return defaultedMembers;
2335
- } else {
2336
- for (const member of defaultedMembers) {
2337
- this.flowEnumErrorStringMemberInconsistentlyInitailized(member, {
2338
- enumName
2339
- });
2340
- }
2341
- return initializedMembers;
2342
- }
2343
- }
2344
- flowEnumParseExplicitType({
2345
- enumName
2346
- }) {
2347
- if (!this.eatContextual(101)) return null;
2348
- if (!(0, _types.tokenIsIdentifier)(this.state.type)) {
2349
- throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, {
2350
- at: this.state.startLoc,
2351
- enumName
2352
- });
2353
- }
2354
- const {
2355
- value
2356
- } = this.state;
2357
- this.next();
2358
- if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
2359
- this.raise(FlowErrors.EnumInvalidExplicitType, {
2360
- at: this.state.startLoc,
2361
- enumName,
2362
- invalidEnumType: value
2363
- });
2364
- }
2365
- return value;
2366
- }
2367
- flowEnumBody(node, id) {
2368
- const enumName = id.name;
2369
- const nameLoc = id.loc.start;
2370
- const explicitType = this.flowEnumParseExplicitType({
2371
- enumName
2372
- });
2373
- this.expect(5);
2374
- const {
2375
- members,
2376
- hasUnknownMembers
2377
- } = this.flowEnumMembers({
2378
- enumName,
2379
- explicitType
2380
- });
2381
- node.hasUnknownMembers = hasUnknownMembers;
2382
- switch (explicitType) {
2383
- case "boolean":
2384
- node.explicitType = true;
2385
- node.members = members.booleanMembers;
2386
- this.expect(8);
2387
- return this.finishNode(node, "EnumBooleanBody");
2388
- case "number":
2389
- node.explicitType = true;
2390
- node.members = members.numberMembers;
2391
- this.expect(8);
2392
- return this.finishNode(node, "EnumNumberBody");
2393
- case "string":
2394
- node.explicitType = true;
2395
- node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, {
2396
- enumName
2397
- });
2398
- this.expect(8);
2399
- return this.finishNode(node, "EnumStringBody");
2400
- case "symbol":
2401
- node.members = members.defaultedMembers;
2402
- this.expect(8);
2403
- return this.finishNode(node, "EnumSymbolBody");
2404
- default:
2405
- {
2406
- const empty = () => {
2407
- node.members = [];
2408
- this.expect(8);
2409
- return this.finishNode(node, "EnumStringBody");
2410
- };
2411
- node.explicitType = false;
2412
- const boolsLen = members.booleanMembers.length;
2413
- const numsLen = members.numberMembers.length;
2414
- const strsLen = members.stringMembers.length;
2415
- const defaultedLen = members.defaultedMembers.length;
2416
- if (!boolsLen && !numsLen && !strsLen && !defaultedLen) {
2417
- return empty();
2418
- } else if (!boolsLen && !numsLen) {
2419
- node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, {
2420
- enumName
2421
- });
2422
- this.expect(8);
2423
- return this.finishNode(node, "EnumStringBody");
2424
- } else if (!numsLen && !strsLen && boolsLen >= defaultedLen) {
2425
- for (const member of members.defaultedMembers) {
2426
- this.flowEnumErrorBooleanMemberNotInitialized(member.loc.start, {
2427
- enumName,
2428
- memberName: member.id.name
2429
- });
2430
- }
2431
- node.members = members.booleanMembers;
2432
- this.expect(8);
2433
- return this.finishNode(node, "EnumBooleanBody");
2434
- } else if (!boolsLen && !strsLen && numsLen >= defaultedLen) {
2435
- for (const member of members.defaultedMembers) {
2436
- this.flowEnumErrorNumberMemberNotInitialized(member.loc.start, {
2437
- enumName,
2438
- memberName: member.id.name
2439
- });
2440
- }
2441
- node.members = members.numberMembers;
2442
- this.expect(8);
2443
- return this.finishNode(node, "EnumNumberBody");
2444
- } else {
2445
- this.raise(FlowErrors.EnumInconsistentMemberValues, {
2446
- at: nameLoc,
2447
- enumName
2448
- });
2449
- return empty();
2450
- }
2451
- }
2452
- }
2453
- }
2454
- flowParseEnumDeclaration(node) {
2455
- const id = this.parseIdentifier();
2456
- node.id = id;
2457
- node.body = this.flowEnumBody(this.startNode(), id);
2458
- return this.finishNode(node, "EnumDeclaration");
2459
- }
2460
- isLookaheadToken_lt() {
2461
- const next = this.nextTokenStart();
2462
- if (this.input.charCodeAt(next) === 60) {
2463
- const afterNext = this.input.charCodeAt(next + 1);
2464
- return afterNext !== 60 && afterNext !== 61;
2465
- }
2466
- return false;
2467
- }
2468
- maybeUnwrapTypeCastExpression(node) {
2469
- return node.type === "TypeCastExpression" ? node.expression : node;
2470
- }
2471
- };
2472
- exports.default = _default;
2473
-
2474
- //# sourceMappingURL=index.js.map