@galadrim/galadmin 0.1.38 → 0.1.41

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 (511) hide show
  1. package/dist/tsconfig.tsbuildinfo +1 -1
  2. package/dist/types/config.d.ts +1 -0
  3. package/package.json +1 -1
  4. package/src/front/build/asset-manifest.json +3 -3
  5. package/src/front/build/index.html +1 -1
  6. package/src/front/build/static/js/{main.4ce5340d.chunk.js → main.6010b0e8.chunk.js} +2 -2
  7. package/src/front/build/static/js/main.6010b0e8.chunk.js.map +1 -0
  8. package/src/front/node_modules/.cache/.eslintcache +1 -1
  9. package/src/front/node_modules/.cache/babel-loader/6b6404ad16b4fb247c0dfe43c03f4a02.json +1 -0
  10. package/src/front/node_modules/.cache/babel-loader/e0d7182bb1587d3516bddc6e5995e4de.json +1 -0
  11. package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/3e/1f/8bb0086d6062c3f47f7b0b5ec83819f94cb4fbede3b188fa7e17a4abcc21fdb88f189c80f4202c4b2ca9d1d4b10584c75f117e5d929bed254fc25456e138 +1 -0
  12. package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/{c2/e5/5451dd89bb0fd48f988bf27c7ee614c66eb91f7085c5b5c8cb33048d0c32 → 36/6b/7209102ab666b1484b1283f341a44aaefbdd015c78e198b49193da03be46} +1 -1
  13. package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/6c/19/fe86ba5d7c4062f185480ad22dd3b9fae9b30149827224339f9a633a9a94 +1 -1
  14. package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/87/08/421190bfe6e50816e059da6c33526c9943732ef856ebd2752d0cbfb4a852 +1 -1
  15. package/src/front/node_modules/.package-lock.json +84 -84
  16. package/src/front/node_modules/@babel/code-frame/lib/index.js +5 -4
  17. package/src/front/node_modules/@babel/code-frame/lib/index.js.map +1 -1
  18. package/src/front/node_modules/@babel/code-frame/package.json +3 -2
  19. package/src/front/node_modules/@babel/compat-data/data/plugins.json +1 -0
  20. package/src/front/node_modules/@babel/compat-data/package.json +1 -1
  21. package/src/front/node_modules/@babel/core/lib/config/cache-contexts.js.map +1 -1
  22. package/src/front/node_modules/@babel/core/lib/config/caching.js +2 -2
  23. package/src/front/node_modules/@babel/core/lib/config/caching.js.map +1 -1
  24. package/src/front/node_modules/@babel/core/lib/config/config-chain.js +13 -13
  25. package/src/front/node_modules/@babel/core/lib/config/config-chain.js.map +1 -1
  26. package/src/front/node_modules/@babel/core/lib/config/config-descriptors.js +6 -6
  27. package/src/front/node_modules/@babel/core/lib/config/config-descriptors.js.map +1 -1
  28. package/src/front/node_modules/@babel/core/lib/config/files/configuration.js +44 -41
  29. package/src/front/node_modules/@babel/core/lib/config/files/configuration.js.map +1 -1
  30. package/src/front/node_modules/@babel/core/lib/config/files/index-browser.js.map +1 -1
  31. package/src/front/node_modules/@babel/core/lib/config/files/index.js +3 -3
  32. package/src/front/node_modules/@babel/core/lib/config/files/index.js.map +1 -1
  33. package/src/front/node_modules/@babel/core/lib/config/files/module-types.js +27 -8
  34. package/src/front/node_modules/@babel/core/lib/config/files/module-types.js.map +1 -1
  35. package/src/front/node_modules/@babel/core/lib/config/files/package.js +2 -2
  36. package/src/front/node_modules/@babel/core/lib/config/files/package.js.map +1 -1
  37. package/src/front/node_modules/@babel/core/lib/config/files/plugins.js +4 -4
  38. package/src/front/node_modules/@babel/core/lib/config/files/plugins.js.map +1 -1
  39. package/src/front/node_modules/@babel/core/lib/config/files/types.js.map +1 -1
  40. package/src/front/node_modules/@babel/core/lib/config/files/utils.js +2 -2
  41. package/src/front/node_modules/@babel/core/lib/config/files/utils.js.map +1 -1
  42. package/src/front/node_modules/@babel/core/lib/config/full.js +13 -13
  43. package/src/front/node_modules/@babel/core/lib/config/full.js.map +1 -1
  44. package/src/front/node_modules/@babel/core/lib/config/helpers/config-api.js +6 -6
  45. package/src/front/node_modules/@babel/core/lib/config/helpers/config-api.js.map +1 -1
  46. package/src/front/node_modules/@babel/core/lib/config/index.js +60 -40
  47. package/src/front/node_modules/@babel/core/lib/config/index.js.map +1 -1
  48. package/src/front/node_modules/@babel/core/lib/config/item.js +1 -1
  49. package/src/front/node_modules/@babel/core/lib/config/item.js.map +1 -1
  50. package/src/front/node_modules/@babel/core/lib/config/partial.js +15 -23
  51. package/src/front/node_modules/@babel/core/lib/config/partial.js.map +1 -1
  52. package/src/front/node_modules/@babel/core/lib/config/plugin.js +1 -1
  53. package/src/front/node_modules/@babel/core/lib/config/plugin.js.map +1 -1
  54. package/src/front/node_modules/@babel/core/lib/config/printer.js.map +1 -1
  55. package/src/front/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map +1 -1
  56. package/src/front/node_modules/@babel/core/lib/config/resolve-targets.js.map +1 -1
  57. package/src/front/node_modules/@babel/core/lib/config/util.js.map +1 -1
  58. package/src/front/node_modules/@babel/core/lib/config/validation/option-assertions.js +1 -1
  59. package/src/front/node_modules/@babel/core/lib/config/validation/option-assertions.js.map +1 -1
  60. package/src/front/node_modules/@babel/core/lib/config/validation/options.js +3 -3
  61. package/src/front/node_modules/@babel/core/lib/config/validation/options.js.map +1 -1
  62. package/src/front/node_modules/@babel/core/lib/config/validation/plugins.js +1 -1
  63. package/src/front/node_modules/@babel/core/lib/config/validation/plugins.js.map +1 -1
  64. package/src/front/node_modules/@babel/core/lib/errors/config-error.js +1 -1
  65. package/src/front/node_modules/@babel/core/lib/errors/config-error.js.map +1 -1
  66. package/src/front/node_modules/@babel/core/lib/gensync-utils/functional.js +1 -1
  67. package/src/front/node_modules/@babel/core/lib/gensync-utils/functional.js.map +1 -1
  68. package/src/front/node_modules/@babel/core/lib/index.js +30 -32
  69. package/src/front/node_modules/@babel/core/lib/index.js.map +1 -1
  70. package/src/front/node_modules/@babel/core/lib/parse.js +6 -6
  71. package/src/front/node_modules/@babel/core/lib/parse.js.map +1 -1
  72. package/src/front/node_modules/@babel/core/lib/parser/index.js +1 -1
  73. package/src/front/node_modules/@babel/core/lib/parser/index.js.map +1 -1
  74. package/src/front/node_modules/@babel/core/lib/tools/build-external-helpers.js +1 -1
  75. package/src/front/node_modules/@babel/core/lib/tools/build-external-helpers.js.map +1 -1
  76. package/src/front/node_modules/@babel/core/lib/transform-ast.js +5 -5
  77. package/src/front/node_modules/@babel/core/lib/transform-ast.js.map +1 -1
  78. package/src/front/node_modules/@babel/core/lib/transform-file.js +5 -5
  79. package/src/front/node_modules/@babel/core/lib/transform-file.js.map +1 -1
  80. package/src/front/node_modules/@babel/core/lib/transform.js +5 -5
  81. package/src/front/node_modules/@babel/core/lib/transform.js.map +1 -1
  82. package/src/front/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +1 -1
  83. package/src/front/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map +1 -1
  84. package/src/front/node_modules/@babel/core/lib/transformation/file/file.js.map +1 -1
  85. package/src/front/node_modules/@babel/core/lib/transformation/file/generate.js +1 -1
  86. package/src/front/node_modules/@babel/core/lib/transformation/file/generate.js.map +1 -1
  87. package/src/front/node_modules/@babel/core/lib/transformation/index.js +6 -6
  88. package/src/front/node_modules/@babel/core/lib/transformation/index.js.map +1 -1
  89. package/src/front/node_modules/@babel/core/lib/transformation/normalize-file.js +4 -4
  90. package/src/front/node_modules/@babel/core/lib/transformation/normalize-file.js.map +1 -1
  91. package/src/front/node_modules/@babel/core/lib/transformation/normalize-opts.js.map +1 -1
  92. package/src/front/node_modules/@babel/core/lib/transformation/plugin-pass.js.map +1 -1
  93. package/src/front/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map +1 -1
  94. package/src/front/node_modules/@babel/core/package.json +15 -15
  95. package/src/front/node_modules/@babel/core/src/config/files/index-browser.ts +2 -2
  96. package/src/front/node_modules/@babel/core/src/config/files/index.ts +4 -4
  97. package/src/front/node_modules/@babel/core/src/config/resolve-targets-browser.ts +1 -1
  98. package/src/front/node_modules/@babel/core/src/config/resolve-targets.ts +1 -1
  99. package/src/front/node_modules/@babel/core/src/transform-file.ts +5 -5
  100. package/src/front/node_modules/@babel/generator/lib/buffer.js.map +1 -1
  101. package/src/front/node_modules/@babel/generator/lib/generators/base.js.map +1 -1
  102. package/src/front/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
  103. package/src/front/node_modules/@babel/generator/lib/generators/expressions.js +1 -1
  104. package/src/front/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
  105. package/src/front/node_modules/@babel/generator/lib/generators/flow.js +2 -2
  106. package/src/front/node_modules/@babel/generator/lib/generators/flow.js.map +1 -1
  107. package/src/front/node_modules/@babel/generator/lib/generators/index.js +11 -11
  108. package/src/front/node_modules/@babel/generator/lib/generators/index.js.map +1 -1
  109. package/src/front/node_modules/@babel/generator/lib/generators/jsx.js.map +1 -1
  110. package/src/front/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
  111. package/src/front/node_modules/@babel/generator/lib/generators/modules.js.map +1 -1
  112. package/src/front/node_modules/@babel/generator/lib/generators/statements.js.map +1 -1
  113. package/src/front/node_modules/@babel/generator/lib/generators/template-literals.js.map +1 -1
  114. package/src/front/node_modules/@babel/generator/lib/generators/types.js.map +1 -1
  115. package/src/front/node_modules/@babel/generator/lib/generators/typescript.js.map +1 -1
  116. package/src/front/node_modules/@babel/generator/lib/index.js +2 -2
  117. package/src/front/node_modules/@babel/generator/lib/index.js.map +1 -1
  118. package/src/front/node_modules/@babel/generator/lib/node/index.js +2 -2
  119. package/src/front/node_modules/@babel/generator/lib/node/index.js.map +1 -1
  120. package/src/front/node_modules/@babel/generator/lib/node/whitespace.js.map +1 -1
  121. package/src/front/node_modules/@babel/generator/lib/printer.js +3 -3
  122. package/src/front/node_modules/@babel/generator/lib/printer.js.map +1 -1
  123. package/src/front/node_modules/@babel/generator/package.json +4 -4
  124. package/src/front/node_modules/@babel/helper-compilation-targets/lib/debug.js +2 -2
  125. package/src/front/node_modules/@babel/helper-compilation-targets/lib/debug.js.map +1 -1
  126. package/src/front/node_modules/@babel/helper-compilation-targets/lib/filter-items.js +1 -1
  127. package/src/front/node_modules/@babel/helper-compilation-targets/lib/filter-items.js.map +1 -1
  128. package/src/front/node_modules/@babel/helper-compilation-targets/lib/index.js +6 -6
  129. package/src/front/node_modules/@babel/helper-compilation-targets/lib/index.js.map +1 -1
  130. package/src/front/node_modules/@babel/helper-compilation-targets/lib/pretty.js +1 -1
  131. package/src/front/node_modules/@babel/helper-compilation-targets/lib/pretty.js.map +1 -1
  132. package/src/front/node_modules/@babel/helper-compilation-targets/lib/utils.js +1 -1
  133. package/src/front/node_modules/@babel/helper-compilation-targets/lib/utils.js.map +1 -1
  134. package/src/front/node_modules/@babel/helper-compilation-targets/package.json +2 -2
  135. package/src/front/node_modules/@babel/helper-environment-visitor/README.md +1 -1
  136. package/src/front/node_modules/@babel/helper-environment-visitor/lib/index.js +5 -9
  137. package/src/front/node_modules/@babel/helper-environment-visitor/lib/index.js.map +1 -1
  138. package/src/front/node_modules/@babel/helper-environment-visitor/package.json +3 -3
  139. package/src/front/node_modules/@babel/helper-module-imports/README.md +1 -1
  140. package/src/front/node_modules/@babel/helper-module-imports/lib/import-injector.js +2 -2
  141. package/src/front/node_modules/@babel/helper-module-imports/lib/import-injector.js.map +1 -1
  142. package/src/front/node_modules/@babel/helper-module-imports/lib/index.js +2 -2
  143. package/src/front/node_modules/@babel/helper-module-imports/lib/index.js.map +1 -1
  144. package/src/front/node_modules/@babel/helper-module-imports/package.json +4 -4
  145. package/src/front/node_modules/@babel/helper-module-transforms/lib/dynamic-import.js +4 -8
  146. package/src/front/node_modules/@babel/helper-module-transforms/lib/dynamic-import.js.map +1 -1
  147. package/src/front/node_modules/@babel/helper-module-transforms/lib/index.js +9 -13
  148. package/src/front/node_modules/@babel/helper-module-transforms/lib/index.js.map +1 -1
  149. package/src/front/node_modules/@babel/helper-module-transforms/lib/normalize-and-load-metadata.js +7 -2
  150. package/src/front/node_modules/@babel/helper-module-transforms/lib/normalize-and-load-metadata.js.map +1 -1
  151. package/src/front/node_modules/@babel/helper-module-transforms/lib/rewrite-live-references.js.map +1 -1
  152. package/src/front/node_modules/@babel/helper-module-transforms/package.json +6 -6
  153. package/src/front/node_modules/@babel/helper-validator-identifier/README.md +1 -1
  154. package/src/front/node_modules/@babel/helper-validator-identifier/lib/identifier.js +2 -2
  155. package/src/front/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +1 -1
  156. package/src/front/node_modules/@babel/helper-validator-identifier/lib/index.js +2 -2
  157. package/src/front/node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -1
  158. package/src/front/node_modules/@babel/helper-validator-identifier/package.json +2 -2
  159. package/src/front/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js +9 -11
  160. package/src/front/node_modules/@babel/helper-validator-option/README.md +1 -1
  161. package/src/front/node_modules/@babel/helper-validator-option/lib/index.js +2 -2
  162. package/src/front/node_modules/@babel/helper-validator-option/lib/index.js.map +1 -1
  163. package/src/front/node_modules/@babel/helper-validator-option/lib/validator.js +1 -1
  164. package/src/front/node_modules/@babel/helper-validator-option/lib/validator.js.map +1 -1
  165. package/src/front/node_modules/@babel/helper-validator-option/package.json +1 -1
  166. package/src/front/node_modules/@babel/helpers/lib/helpers-generated.js +21 -21
  167. package/src/front/node_modules/@babel/helpers/lib/helpers-generated.js.map +1 -1
  168. package/src/front/node_modules/@babel/helpers/lib/helpers.js +1 -1
  169. package/src/front/node_modules/@babel/helpers/lib/helpers.js.map +1 -1
  170. package/src/front/node_modules/@babel/helpers/lib/index.js +1 -1
  171. package/src/front/node_modules/@babel/helpers/lib/index.js.map +1 -1
  172. package/src/front/node_modules/@babel/helpers/package.json +7 -7
  173. package/src/front/node_modules/@babel/helpers/scripts/generate-helpers.js +1 -1
  174. package/src/front/node_modules/@babel/highlight/lib/index.js +7 -8
  175. package/src/front/node_modules/@babel/highlight/lib/index.js.map +1 -1
  176. package/src/front/node_modules/@babel/highlight/package.json +2 -2
  177. package/src/front/node_modules/@babel/parser/lib/index.js +52 -57
  178. package/src/front/node_modules/@babel/parser/lib/index.js.map +1 -1
  179. package/src/front/node_modules/@babel/parser/package.json +4 -4
  180. package/src/front/node_modules/@babel/template/README.md +1 -1
  181. package/src/front/node_modules/@babel/template/lib/builder.js +3 -3
  182. package/src/front/node_modules/@babel/template/lib/builder.js.map +1 -1
  183. package/src/front/node_modules/@babel/template/lib/index.js +2 -2
  184. package/src/front/node_modules/@babel/template/lib/index.js.map +1 -1
  185. package/src/front/node_modules/@babel/template/lib/literal.js +3 -3
  186. package/src/front/node_modules/@babel/template/lib/literal.js.map +1 -1
  187. package/src/front/node_modules/@babel/template/lib/parse.js.map +1 -1
  188. package/src/front/node_modules/@babel/template/lib/populate.js.map +1 -1
  189. package/src/front/node_modules/@babel/template/lib/string.js +3 -3
  190. package/src/front/node_modules/@babel/template/lib/string.js.map +1 -1
  191. package/src/front/node_modules/@babel/template/package.json +4 -4
  192. package/src/front/node_modules/@babel/traverse/lib/cache.js.map +1 -1
  193. package/src/front/node_modules/@babel/traverse/lib/context.js +2 -2
  194. package/src/front/node_modules/@babel/traverse/lib/context.js.map +1 -1
  195. package/src/front/node_modules/@babel/traverse/lib/hub.js.map +1 -1
  196. package/src/front/node_modules/@babel/traverse/lib/index.js +8 -8
  197. package/src/front/node_modules/@babel/traverse/lib/index.js.map +1 -1
  198. package/src/front/node_modules/@babel/traverse/lib/path/ancestry.js.map +1 -1
  199. package/src/front/node_modules/@babel/traverse/lib/path/comments.js.map +1 -1
  200. package/src/front/node_modules/@babel/traverse/lib/path/context.js +2 -2
  201. package/src/front/node_modules/@babel/traverse/lib/path/context.js.map +1 -1
  202. package/src/front/node_modules/@babel/traverse/lib/path/conversion.js +5 -7
  203. package/src/front/node_modules/@babel/traverse/lib/path/conversion.js.map +1 -1
  204. package/src/front/node_modules/@babel/traverse/lib/path/evaluation.js.map +1 -1
  205. package/src/front/node_modules/@babel/traverse/lib/path/family.js +1 -1
  206. package/src/front/node_modules/@babel/traverse/lib/path/family.js.map +1 -1
  207. package/src/front/node_modules/@babel/traverse/lib/path/index.js +17 -17
  208. package/src/front/node_modules/@babel/traverse/lib/path/index.js.map +1 -1
  209. package/src/front/node_modules/@babel/traverse/lib/path/inference/index.js +1 -1
  210. package/src/front/node_modules/@babel/traverse/lib/path/inference/index.js.map +1 -1
  211. package/src/front/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js +1 -1
  212. package/src/front/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js.map +1 -1
  213. package/src/front/node_modules/@babel/traverse/lib/path/inference/inferers.js +2 -2
  214. package/src/front/node_modules/@babel/traverse/lib/path/inference/inferers.js.map +1 -1
  215. package/src/front/node_modules/@babel/traverse/lib/path/introspection.js.map +1 -1
  216. package/src/front/node_modules/@babel/traverse/lib/path/lib/hoister.js.map +1 -1
  217. package/src/front/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js.map +1 -1
  218. package/src/front/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js +6 -8
  219. package/src/front/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js.map +1 -1
  220. package/src/front/node_modules/@babel/traverse/lib/path/modification.js +3 -3
  221. package/src/front/node_modules/@babel/traverse/lib/path/modification.js.map +1 -1
  222. package/src/front/node_modules/@babel/traverse/lib/path/removal.js +3 -3
  223. package/src/front/node_modules/@babel/traverse/lib/path/removal.js.map +1 -1
  224. package/src/front/node_modules/@babel/traverse/lib/path/replacement.js +3 -3
  225. package/src/front/node_modules/@babel/traverse/lib/path/replacement.js.map +1 -1
  226. package/src/front/node_modules/@babel/traverse/lib/scope/binding.js +1 -3
  227. package/src/front/node_modules/@babel/traverse/lib/scope/binding.js.map +1 -1
  228. package/src/front/node_modules/@babel/traverse/lib/scope/index.js +5 -5
  229. package/src/front/node_modules/@babel/traverse/lib/scope/index.js.map +1 -1
  230. package/src/front/node_modules/@babel/traverse/lib/scope/lib/renamer.js +2 -2
  231. package/src/front/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map +1 -1
  232. package/src/front/node_modules/@babel/traverse/lib/traverse-node.js +1 -1
  233. package/src/front/node_modules/@babel/traverse/lib/traverse-node.js.map +1 -1
  234. package/src/front/node_modules/@babel/traverse/lib/types.js.map +1 -1
  235. package/src/front/node_modules/@babel/traverse/lib/visitors.js +1 -1
  236. package/src/front/node_modules/@babel/traverse/lib/visitors.js.map +1 -1
  237. package/src/front/node_modules/@babel/traverse/package.json +7 -7
  238. package/src/front/node_modules/@babel/types/lib/asserts/assertNode.js +1 -1
  239. package/src/front/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -1
  240. package/src/front/node_modules/@babel/types/lib/asserts/generated/index.js +2 -2
  241. package/src/front/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -1
  242. package/src/front/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -1
  243. package/src/front/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +3 -3
  244. package/src/front/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -1
  245. package/src/front/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +9 -9
  246. package/src/front/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -1
  247. package/src/front/node_modules/@babel/types/lib/builders/generated/index.js +3 -3
  248. package/src/front/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -1
  249. package/src/front/node_modules/@babel/types/lib/builders/generated/uppercase.js +1 -1
  250. package/src/front/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -1
  251. package/src/front/node_modules/@babel/types/lib/builders/react/buildChildren.js +5 -5
  252. package/src/front/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -1
  253. package/src/front/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +5 -5
  254. package/src/front/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -1
  255. package/src/front/node_modules/@babel/types/lib/builders/validateNode.js +3 -3
  256. package/src/front/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -1
  257. package/src/front/node_modules/@babel/types/lib/clone/clone.js +1 -1
  258. package/src/front/node_modules/@babel/types/lib/clone/clone.js.map +1 -1
  259. package/src/front/node_modules/@babel/types/lib/clone/cloneDeep.js +1 -1
  260. package/src/front/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -1
  261. package/src/front/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +1 -1
  262. package/src/front/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -1
  263. package/src/front/node_modules/@babel/types/lib/clone/cloneNode.js +6 -6
  264. package/src/front/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -1
  265. package/src/front/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +1 -1
  266. package/src/front/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -1
  267. package/src/front/node_modules/@babel/types/lib/comments/addComment.js +1 -1
  268. package/src/front/node_modules/@babel/types/lib/comments/addComment.js.map +1 -1
  269. package/src/front/node_modules/@babel/types/lib/comments/addComments.js.map +1 -1
  270. package/src/front/node_modules/@babel/types/lib/comments/inheritInnerComments.js +1 -1
  271. package/src/front/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -1
  272. package/src/front/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +1 -1
  273. package/src/front/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -1
  274. package/src/front/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +1 -1
  275. package/src/front/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -1
  276. package/src/front/node_modules/@babel/types/lib/comments/inheritsComments.js +3 -3
  277. package/src/front/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -1
  278. package/src/front/node_modules/@babel/types/lib/comments/removeComments.js +2 -2
  279. package/src/front/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -1
  280. package/src/front/node_modules/@babel/types/lib/constants/generated/index.js +50 -50
  281. package/src/front/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -1
  282. package/src/front/node_modules/@babel/types/lib/converters/ensureBlock.js +1 -1
  283. package/src/front/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -1
  284. package/src/front/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +14 -14
  285. package/src/front/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -1
  286. package/src/front/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +1 -1
  287. package/src/front/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -1
  288. package/src/front/node_modules/@babel/types/lib/converters/toBlock.js +9 -9
  289. package/src/front/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -1
  290. package/src/front/node_modules/@babel/types/lib/converters/toComputedKey.js +3 -3
  291. package/src/front/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -1
  292. package/src/front/node_modules/@babel/types/lib/converters/toExpression.js +6 -6
  293. package/src/front/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -1
  294. package/src/front/node_modules/@babel/types/lib/converters/toIdentifier.js +1 -1
  295. package/src/front/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -1
  296. package/src/front/node_modules/@babel/types/lib/converters/toKeyAlias.js +5 -5
  297. package/src/front/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -1
  298. package/src/front/node_modules/@babel/types/lib/converters/toSequenceExpression.js +1 -1
  299. package/src/front/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -1
  300. package/src/front/node_modules/@babel/types/lib/converters/toStatement.js +7 -7
  301. package/src/front/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -1
  302. package/src/front/node_modules/@babel/types/lib/converters/valueToNode.js +17 -17
  303. package/src/front/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -1
  304. package/src/front/node_modules/@babel/types/lib/definitions/core.js +11 -10
  305. package/src/front/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
  306. package/src/front/node_modules/@babel/types/lib/definitions/experimental.js +1 -1
  307. package/src/front/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -1
  308. package/src/front/node_modules/@babel/types/lib/definitions/flow.js +1 -1
  309. package/src/front/node_modules/@babel/types/lib/definitions/flow.js.map +1 -1
  310. package/src/front/node_modules/@babel/types/lib/definitions/index.js +9 -9
  311. package/src/front/node_modules/@babel/types/lib/definitions/index.js.map +1 -1
  312. package/src/front/node_modules/@babel/types/lib/definitions/jsx.js +1 -1
  313. package/src/front/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -1
  314. package/src/front/node_modules/@babel/types/lib/definitions/misc.js +2 -2
  315. package/src/front/node_modules/@babel/types/lib/definitions/misc.js.map +1 -1
  316. package/src/front/node_modules/@babel/types/lib/definitions/placeholders.js +1 -1
  317. package/src/front/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -1
  318. package/src/front/node_modules/@babel/types/lib/definitions/typescript.js +4 -4
  319. package/src/front/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
  320. package/src/front/node_modules/@babel/types/lib/definitions/utils.js +2 -2
  321. package/src/front/node_modules/@babel/types/lib/definitions/utils.js.map +1 -1
  322. package/src/front/node_modules/@babel/types/lib/index-legacy.d.ts +12 -12
  323. package/src/front/node_modules/@babel/types/lib/index.d.ts +14 -14
  324. package/src/front/node_modules/@babel/types/lib/index.js +84 -84
  325. package/src/front/node_modules/@babel/types/lib/index.js.flow +12 -12
  326. package/src/front/node_modules/@babel/types/lib/index.js.map +1 -1
  327. package/src/front/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +2 -2
  328. package/src/front/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -1
  329. package/src/front/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +6 -6
  330. package/src/front/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -1
  331. package/src/front/node_modules/@babel/types/lib/modifications/inherits.js +4 -4
  332. package/src/front/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -1
  333. package/src/front/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +4 -4
  334. package/src/front/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -1
  335. package/src/front/node_modules/@babel/types/lib/modifications/removeProperties.js +2 -2
  336. package/src/front/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -1
  337. package/src/front/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +2 -2
  338. package/src/front/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -1
  339. package/src/front/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +6 -6
  340. package/src/front/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -1
  341. package/src/front/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +6 -6
  342. package/src/front/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -1
  343. package/src/front/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +1 -1
  344. package/src/front/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -1
  345. package/src/front/node_modules/@babel/types/lib/traverse/traverse.js +2 -2
  346. package/src/front/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -1
  347. package/src/front/node_modules/@babel/types/lib/traverse/traverseFast.js +2 -2
  348. package/src/front/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -1
  349. package/src/front/node_modules/@babel/types/lib/utils/inherit.js.map +1 -1
  350. package/src/front/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +3 -3
  351. package/src/front/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -1
  352. package/src/front/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +1 -1
  353. package/src/front/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -1
  354. package/src/front/node_modules/@babel/types/lib/validators/generated/index.js +2 -2
  355. package/src/front/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -1
  356. package/src/front/node_modules/@babel/types/lib/validators/is.js +5 -5
  357. package/src/front/node_modules/@babel/types/lib/validators/is.js.map +1 -1
  358. package/src/front/node_modules/@babel/types/lib/validators/isBinding.js +1 -1
  359. package/src/front/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -1
  360. package/src/front/node_modules/@babel/types/lib/validators/isBlockScoped.js +3 -3
  361. package/src/front/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -1
  362. package/src/front/node_modules/@babel/types/lib/validators/isImmutable.js +3 -3
  363. package/src/front/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -1
  364. package/src/front/node_modules/@babel/types/lib/validators/isLet.js +3 -3
  365. package/src/front/node_modules/@babel/types/lib/validators/isLet.js.map +1 -1
  366. package/src/front/node_modules/@babel/types/lib/validators/isNode.js +2 -2
  367. package/src/front/node_modules/@babel/types/lib/validators/isNode.js.map +1 -1
  368. package/src/front/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +3 -3
  369. package/src/front/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -1
  370. package/src/front/node_modules/@babel/types/lib/validators/isPlaceholderType.js +2 -2
  371. package/src/front/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -1
  372. package/src/front/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -1
  373. package/src/front/node_modules/@babel/types/lib/validators/isScope.js +4 -4
  374. package/src/front/node_modules/@babel/types/lib/validators/isScope.js.map +1 -1
  375. package/src/front/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +2 -2
  376. package/src/front/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -1
  377. package/src/front/node_modules/@babel/types/lib/validators/isType.js +3 -3
  378. package/src/front/node_modules/@babel/types/lib/validators/isType.js.map +1 -1
  379. package/src/front/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +1 -1
  380. package/src/front/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -1
  381. package/src/front/node_modules/@babel/types/lib/validators/isVar.js +4 -4
  382. package/src/front/node_modules/@babel/types/lib/validators/isVar.js.map +1 -1
  383. package/src/front/node_modules/@babel/types/lib/validators/matchesPattern.js +6 -6
  384. package/src/front/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -1
  385. package/src/front/node_modules/@babel/types/lib/validators/react/isReactComponent.js +1 -1
  386. package/src/front/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -1
  387. package/src/front/node_modules/@babel/types/lib/validators/validate.js +3 -3
  388. package/src/front/node_modules/@babel/types/lib/validators/validate.js.map +1 -1
  389. package/src/front/node_modules/@babel/types/package.json +4 -4
  390. package/src/front/node_modules/nan/CHANGELOG.md +5 -1
  391. package/src/front/node_modules/nan/CMakeLists.txt +138 -0
  392. package/src/front/node_modules/nan/README.md +4 -4
  393. package/src/front/node_modules/nan/doc/errors.md +1 -1
  394. package/src/front/node_modules/nan/doc/methods.md +21 -13
  395. package/src/front/node_modules/nan/doc/persistent.md +1 -1
  396. package/src/front/node_modules/nan/nan.h +3 -1
  397. package/src/front/node_modules/nan/nan_callbacks_12_inl.h +46 -40
  398. package/src/front/node_modules/nan/package.json +3 -2
  399. package/src/front/node_modules/nan/tools/1to2.js +1 -1
  400. package/src/front/node_modules/typescript/lib/lib.decorators.d.ts +17 -0
  401. package/src/front/node_modules/typescript/lib/lib.dom.d.ts +313 -90
  402. package/src/front/node_modules/typescript/lib/lib.es2015.collection.d.ts +9 -9
  403. package/src/front/node_modules/typescript/lib/lib.es2015.core.d.ts +2 -2
  404. package/src/front/node_modules/typescript/lib/lib.es2015.iterable.d.ts +4 -4
  405. package/src/front/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +2 -2
  406. package/src/front/node_modules/typescript/lib/lib.es2017.d.ts +1 -0
  407. package/src/front/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  408. package/src/front/node_modules/typescript/lib/lib.es2020.bigint.d.ts +4 -4
  409. package/src/front/node_modules/typescript/lib/lib.es2021.weakref.d.ts +19 -16
  410. package/src/front/node_modules/typescript/lib/lib.es2023.array.d.ts +618 -36
  411. package/src/front/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  412. package/src/front/node_modules/typescript/lib/lib.es2023.d.ts +1 -0
  413. package/src/front/node_modules/typescript/lib/lib.es5.d.ts +27 -18
  414. package/src/front/node_modules/typescript/lib/lib.esnext.d.ts +2 -0
  415. package/src/front/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  416. package/src/front/node_modules/typescript/lib/lib.esnext.disposable.d.ts +185 -0
  417. package/src/front/node_modules/typescript/lib/lib.webworker.d.ts +172 -33
  418. package/src/front/node_modules/typescript/lib/tsc.js +8311 -6557
  419. package/src/front/node_modules/typescript/lib/tsserver.js +11796 -9281
  420. package/src/front/node_modules/typescript/lib/tsserverlibrary.d.ts +287 -249
  421. package/src/front/node_modules/typescript/lib/tsserverlibrary.js +11801 -9288
  422. package/src/front/node_modules/typescript/lib/typescript.d.ts +274 -248
  423. package/src/front/node_modules/typescript/lib/typescript.js +11678 -9231
  424. package/src/front/node_modules/typescript/lib/typingsInstaller.js +1852 -1645
  425. package/src/front/node_modules/typescript/package.json +7 -7
  426. package/src/front/package-lock.json +168 -168
  427. package/src/front/src/components/inputs/FileInput.js +1 -0
  428. package/src/front/src/pages/Records.js +5 -3
  429. package/src/types/config.ts +1 -0
  430. package/src/front/build/static/js/main.4ce5340d.chunk.js.map +0 -1
  431. package/src/front/node_modules/.cache/babel-loader/1dbf9b1b83cdf813e9dc5f561b9b97ac.json +0 -1
  432. package/src/front/node_modules/.cache/babel-loader/d88f947a76ac5f78797e69c737b6267e.json +0 -1
  433. package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/c3/3e/f2b5b90044b7bdbb4cff67b2c09e24bb506274240d920de24bb4b678f3f00b80f7e9f0900cd1de883484031488d8603e97ea6b4e39a9c6ab5160353d3be9 +0 -1
  434. package/src/front/node_modules/@babel/core/lib/config/files/import-meta-resolve.js +0 -17
  435. package/src/front/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map +0 -1
  436. package/src/front/node_modules/@babel/parser/lib/options.js +0 -44
  437. package/src/front/node_modules/@babel/parser/lib/options.js.map +0 -1
  438. package/src/front/node_modules/@babel/parser/lib/parse-error/credentials.js +0 -28
  439. package/src/front/node_modules/@babel/parser/lib/parse-error/credentials.js.map +0 -1
  440. package/src/front/node_modules/@babel/parser/lib/parse-error/module-errors.js +0 -20
  441. package/src/front/node_modules/@babel/parser/lib/parse-error/module-errors.js.map +0 -1
  442. package/src/front/node_modules/@babel/parser/lib/parse-error/pipeline-operator-errors.js +0 -32
  443. package/src/front/node_modules/@babel/parser/lib/parse-error/pipeline-operator-errors.js.map +0 -1
  444. package/src/front/node_modules/@babel/parser/lib/parse-error/standard-errors.js +0 -220
  445. package/src/front/node_modules/@babel/parser/lib/parse-error/standard-errors.js.map +0 -1
  446. package/src/front/node_modules/@babel/parser/lib/parse-error/strict-mode-errors.js +0 -22
  447. package/src/front/node_modules/@babel/parser/lib/parse-error/strict-mode-errors.js.map +0 -1
  448. package/src/front/node_modules/@babel/parser/lib/parse-error/to-node-description.js +0 -39
  449. package/src/front/node_modules/@babel/parser/lib/parse-error/to-node-description.js.map +0 -1
  450. package/src/front/node_modules/@babel/parser/lib/parse-error.js +0 -106
  451. package/src/front/node_modules/@babel/parser/lib/parse-error.js.map +0 -1
  452. package/src/front/node_modules/@babel/parser/lib/parser/base.js +0 -36
  453. package/src/front/node_modules/@babel/parser/lib/parser/base.js.map +0 -1
  454. package/src/front/node_modules/@babel/parser/lib/parser/comments.js +0 -190
  455. package/src/front/node_modules/@babel/parser/lib/parser/comments.js.map +0 -1
  456. package/src/front/node_modules/@babel/parser/lib/parser/expression.js +0 -1824
  457. package/src/front/node_modules/@babel/parser/lib/parser/expression.js.map +0 -1
  458. package/src/front/node_modules/@babel/parser/lib/parser/index.js +0 -43
  459. package/src/front/node_modules/@babel/parser/lib/parser/index.js.map +0 -1
  460. package/src/front/node_modules/@babel/parser/lib/parser/lval.js +0 -421
  461. package/src/front/node_modules/@babel/parser/lib/parser/lval.js.map +0 -1
  462. package/src/front/node_modules/@babel/parser/lib/parser/node.js +0 -127
  463. package/src/front/node_modules/@babel/parser/lib/parser/node.js.map +0 -1
  464. package/src/front/node_modules/@babel/parser/lib/parser/statement.js +0 -2033
  465. package/src/front/node_modules/@babel/parser/lib/parser/statement.js.map +0 -1
  466. package/src/front/node_modules/@babel/parser/lib/parser/util.js +0 -238
  467. package/src/front/node_modules/@babel/parser/lib/parser/util.js.map +0 -1
  468. package/src/front/node_modules/@babel/parser/lib/plugin-utils.js +0 -136
  469. package/src/front/node_modules/@babel/parser/lib/plugin-utils.js.map +0 -1
  470. package/src/front/node_modules/@babel/parser/lib/plugins/estree.js +0 -340
  471. package/src/front/node_modules/@babel/parser/lib/plugins/estree.js.map +0 -1
  472. package/src/front/node_modules/@babel/parser/lib/plugins/flow/index.js +0 -2474
  473. package/src/front/node_modules/@babel/parser/lib/plugins/flow/index.js.map +0 -1
  474. package/src/front/node_modules/@babel/parser/lib/plugins/flow/scope.js +0 -44
  475. package/src/front/node_modules/@babel/parser/lib/plugins/flow/scope.js.map +0 -1
  476. package/src/front/node_modules/@babel/parser/lib/plugins/jsx/index.js +0 -444
  477. package/src/front/node_modules/@babel/parser/lib/plugins/jsx/index.js.map +0 -1
  478. package/src/front/node_modules/@babel/parser/lib/plugins/jsx/xhtml.js +0 -266
  479. package/src/front/node_modules/@babel/parser/lib/plugins/jsx/xhtml.js.map +0 -1
  480. package/src/front/node_modules/@babel/parser/lib/plugins/placeholders.js +0 -198
  481. package/src/front/node_modules/@babel/parser/lib/plugins/placeholders.js.map +0 -1
  482. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/index.js +0 -2656
  483. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/index.js.map +0 -1
  484. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/scope.js +0 -121
  485. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/scope.js.map +0 -1
  486. package/src/front/node_modules/@babel/parser/lib/plugins/v8intrinsic.js +0 -31
  487. package/src/front/node_modules/@babel/parser/lib/plugins/v8intrinsic.js.map +0 -1
  488. package/src/front/node_modules/@babel/parser/lib/tokenizer/context.js +0 -27
  489. package/src/front/node_modules/@babel/parser/lib/tokenizer/context.js.map +0 -1
  490. package/src/front/node_modules/@babel/parser/lib/tokenizer/index.js +0 -1119
  491. package/src/front/node_modules/@babel/parser/lib/tokenizer/index.js.map +0 -1
  492. package/src/front/node_modules/@babel/parser/lib/tokenizer/state.js +0 -82
  493. package/src/front/node_modules/@babel/parser/lib/tokenizer/state.js.map +0 -1
  494. package/src/front/node_modules/@babel/parser/lib/tokenizer/types.js +0 -586
  495. package/src/front/node_modules/@babel/parser/lib/tokenizer/types.js.map +0 -1
  496. package/src/front/node_modules/@babel/parser/lib/util/class-scope.js +0 -92
  497. package/src/front/node_modules/@babel/parser/lib/util/class-scope.js.map +0 -1
  498. package/src/front/node_modules/@babel/parser/lib/util/expression-scope.js +0 -142
  499. package/src/front/node_modules/@babel/parser/lib/util/expression-scope.js.map +0 -1
  500. package/src/front/node_modules/@babel/parser/lib/util/identifier.js +0 -62
  501. package/src/front/node_modules/@babel/parser/lib/util/identifier.js.map +0 -1
  502. package/src/front/node_modules/@babel/parser/lib/util/location.js +0 -39
  503. package/src/front/node_modules/@babel/parser/lib/util/location.js.map +0 -1
  504. package/src/front/node_modules/@babel/parser/lib/util/production-parameter.js +0 -49
  505. package/src/front/node_modules/@babel/parser/lib/util/production-parameter.js.map +0 -1
  506. package/src/front/node_modules/@babel/parser/lib/util/scope.js +0 -161
  507. package/src/front/node_modules/@babel/parser/lib/util/scope.js.map +0 -1
  508. package/src/front/node_modules/@babel/parser/lib/util/scopeflags.js +0 -67
  509. package/src/front/node_modules/@babel/parser/lib/util/scopeflags.js.map +0 -1
  510. package/src/front/node_modules/@babel/parser/lib/util/whitespace.js +0 -59
  511. package/src/front/node_modules/@babel/parser/lib/util/whitespace.js.map +0 -1
@@ -1,2656 +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 _location = require("../../util/location");
10
- var _scopeflags = require("../../util/scopeflags");
11
- var _scope = require("./scope");
12
- var _productionParameter = require("../../util/production-parameter");
13
- var _parseError = require("../../parse-error");
14
- var _node = require("../../parser/node");
15
- var _lval = require("../../parser/lval");
16
- const getOwn = (object, key) => Object.hasOwnProperty.call(object, key) && object[key];
17
- function nonNull(x) {
18
- if (x == null) {
19
- throw new Error(`Unexpected ${x} value.`);
20
- }
21
- return x;
22
- }
23
- function assert(x) {
24
- if (!x) {
25
- throw new Error("Assert fail");
26
- }
27
- }
28
- const TSErrors = (0, _parseError.ParseErrorEnum)`typescript`({
29
- AbstractMethodHasImplementation: ({
30
- methodName
31
- }) => `Method '${methodName}' cannot have an implementation because it is marked abstract.`,
32
- AbstractPropertyHasInitializer: ({
33
- propertyName
34
- }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
35
- AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
36
- AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
37
- AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
38
- ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
39
- ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
40
- ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
41
- ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
42
- DeclareAccessor: ({
43
- kind
44
- }) => `'declare' is not allowed in ${kind}ters.`,
45
- DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
46
- DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
47
- DuplicateAccessibilityModifier: ({
48
- modifier
49
- }) => `Accessibility modifier already seen.`,
50
- DuplicateModifier: ({
51
- modifier
52
- }) => `Duplicate modifier: '${modifier}'.`,
53
- EmptyHeritageClauseType: ({
54
- token
55
- }) => `'${token}' list cannot be empty.`,
56
- EmptyTypeArguments: "Type argument list cannot be empty.",
57
- EmptyTypeParameters: "Type parameter list cannot be empty.",
58
- ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
59
- ImportAliasHasImportType: "An import alias can not use 'import type'.",
60
- ImportReflectionHasImportType: "An `import module` declaration can not use `type` modifier",
61
- IncompatibleModifiers: ({
62
- modifiers
63
- }) => `'${modifiers[0]}' modifier cannot be used with '${modifiers[1]}' modifier.`,
64
- IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
65
- IndexSignatureHasAccessibility: ({
66
- modifier
67
- }) => `Index signatures cannot have an accessibility modifier ('${modifier}').`,
68
- IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
69
- IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
70
- IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
71
- InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
72
- InvalidModifierOnTypeMember: ({
73
- modifier
74
- }) => `'${modifier}' modifier cannot appear on a type member.`,
75
- InvalidModifierOnTypeParameter: ({
76
- modifier
77
- }) => `'${modifier}' modifier cannot appear on a type parameter.`,
78
- InvalidModifierOnTypeParameterPositions: ({
79
- modifier
80
- }) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,
81
- InvalidModifiersOrder: ({
82
- orderedModifiers
83
- }) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,
84
- InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. " + "You can either wrap the instantiation expression in parentheses, or delete the type arguments.",
85
- InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
86
- MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
87
- MixedLabeledAndUnlabeledElements: "Tuple members must all have names or all not have names.",
88
- NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
89
- NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.",
90
- OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
91
- OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
92
- PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
93
- PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
94
- PrivateElementHasAccessibility: ({
95
- modifier
96
- }) => `Private elements cannot have an accessibility modifier ('${modifier}').`,
97
- ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
98
- ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
99
- ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
100
- SetAccesorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
101
- SetAccesorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
102
- SetAccesorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
103
- SingleTypeParameterWithoutTrailingComma: ({
104
- typeParameterName
105
- }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,
106
- StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
107
- TupleOptionalAfterType: "A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",
108
- TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
109
- TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
110
- TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",
111
- TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",
112
- UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
113
- UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
114
- UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
115
- UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
116
- UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.",
117
- UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
118
- UnsupportedSignatureParameterKind: ({
119
- type
120
- }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`
121
- });
122
- function keywordTypeFromName(value) {
123
- switch (value) {
124
- case "any":
125
- return "TSAnyKeyword";
126
- case "boolean":
127
- return "TSBooleanKeyword";
128
- case "bigint":
129
- return "TSBigIntKeyword";
130
- case "never":
131
- return "TSNeverKeyword";
132
- case "number":
133
- return "TSNumberKeyword";
134
- case "object":
135
- return "TSObjectKeyword";
136
- case "string":
137
- return "TSStringKeyword";
138
- case "symbol":
139
- return "TSSymbolKeyword";
140
- case "undefined":
141
- return "TSUndefinedKeyword";
142
- case "unknown":
143
- return "TSUnknownKeyword";
144
- default:
145
- return undefined;
146
- }
147
- }
148
- function tsIsAccessModifier(modifier) {
149
- return modifier === "private" || modifier === "public" || modifier === "protected";
150
- }
151
- function tsIsVarianceAnnotations(modifier) {
152
- return modifier === "in" || modifier === "out";
153
- }
154
- var _default = superClass => class TypeScriptParserMixin extends superClass {
155
- constructor(...args) {
156
- super(...args);
157
- this.tsParseInOutModifiers = this.tsParseModifiers.bind(this, {
158
- allowedModifiers: ["in", "out"],
159
- disallowedModifiers: ["const", "public", "private", "protected", "readonly", "declare", "abstract", "override"],
160
- errorTemplate: TSErrors.InvalidModifierOnTypeParameter
161
- });
162
- this.tsParseConstModifier = this.tsParseModifiers.bind(this, {
163
- allowedModifiers: ["const"],
164
- disallowedModifiers: ["in", "out"],
165
- errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
166
- });
167
- this.tsParseInOutConstModifiers = this.tsParseModifiers.bind(this, {
168
- allowedModifiers: ["in", "out", "const"],
169
- disallowedModifiers: ["public", "private", "protected", "readonly", "declare", "abstract", "override"],
170
- errorTemplate: TSErrors.InvalidModifierOnTypeParameter
171
- });
172
- }
173
- getScopeHandler() {
174
- return _scope.default;
175
- }
176
- tsIsIdentifier() {
177
- return (0, _types.tokenIsIdentifier)(this.state.type);
178
- }
179
- tsTokenCanFollowModifier() {
180
- return (this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(136) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
181
- }
182
- tsNextTokenCanFollowModifier() {
183
- this.next();
184
- return this.tsTokenCanFollowModifier();
185
- }
186
- tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
187
- if (!(0, _types.tokenIsIdentifier)(this.state.type) && this.state.type !== 58 && this.state.type !== 75) {
188
- return undefined;
189
- }
190
- const modifier = this.state.value;
191
- if (allowedModifiers.indexOf(modifier) !== -1) {
192
- if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) {
193
- return undefined;
194
- }
195
- if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) {
196
- return modifier;
197
- }
198
- }
199
- return undefined;
200
- }
201
- tsParseModifiers({
202
- allowedModifiers,
203
- disallowedModifiers,
204
- stopOnStartOfClassStaticBlock,
205
- errorTemplate = TSErrors.InvalidModifierOnTypeMember
206
- }, modified) {
207
- const enforceOrder = (loc, modifier, before, after) => {
208
- if (modifier === before && modified[after]) {
209
- this.raise(TSErrors.InvalidModifiersOrder, {
210
- at: loc,
211
- orderedModifiers: [before, after]
212
- });
213
- }
214
- };
215
- const incompatible = (loc, modifier, mod1, mod2) => {
216
- if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
217
- this.raise(TSErrors.IncompatibleModifiers, {
218
- at: loc,
219
- modifiers: [mod1, mod2]
220
- });
221
- }
222
- };
223
- for (;;) {
224
- const {
225
- startLoc
226
- } = this.state;
227
- const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock);
228
- if (!modifier) break;
229
- if (tsIsAccessModifier(modifier)) {
230
- if (modified.accessibility) {
231
- this.raise(TSErrors.DuplicateAccessibilityModifier, {
232
- at: startLoc,
233
- modifier
234
- });
235
- } else {
236
- enforceOrder(startLoc, modifier, modifier, "override");
237
- enforceOrder(startLoc, modifier, modifier, "static");
238
- enforceOrder(startLoc, modifier, modifier, "readonly");
239
- modified.accessibility = modifier;
240
- }
241
- } else if (tsIsVarianceAnnotations(modifier)) {
242
- if (modified[modifier]) {
243
- this.raise(TSErrors.DuplicateModifier, {
244
- at: startLoc,
245
- modifier
246
- });
247
- }
248
- modified[modifier] = true;
249
- enforceOrder(startLoc, modifier, "in", "out");
250
- } else {
251
- if (Object.hasOwnProperty.call(modified, modifier)) {
252
- this.raise(TSErrors.DuplicateModifier, {
253
- at: startLoc,
254
- modifier
255
- });
256
- } else {
257
- enforceOrder(startLoc, modifier, "static", "readonly");
258
- enforceOrder(startLoc, modifier, "static", "override");
259
- enforceOrder(startLoc, modifier, "override", "readonly");
260
- enforceOrder(startLoc, modifier, "abstract", "override");
261
- incompatible(startLoc, modifier, "declare", "override");
262
- incompatible(startLoc, modifier, "static", "abstract");
263
- }
264
- modified[modifier] = true;
265
- }
266
- if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
267
- this.raise(errorTemplate, {
268
- at: startLoc,
269
- modifier
270
- });
271
- }
272
- }
273
- }
274
- tsIsListTerminator(kind) {
275
- switch (kind) {
276
- case "EnumMembers":
277
- case "TypeMembers":
278
- return this.match(8);
279
- case "HeritageClauseElement":
280
- return this.match(5);
281
- case "TupleElementTypes":
282
- return this.match(3);
283
- case "TypeParametersOrArguments":
284
- return this.match(48);
285
- }
286
- }
287
- tsParseList(kind, parseElement) {
288
- const result = [];
289
- while (!this.tsIsListTerminator(kind)) {
290
- result.push(parseElement());
291
- }
292
- return result;
293
- }
294
- tsParseDelimitedList(kind, parseElement, refTrailingCommaPos) {
295
- return nonNull(this.tsParseDelimitedListWorker(kind, parseElement, true, refTrailingCommaPos));
296
- }
297
- tsParseDelimitedListWorker(kind, parseElement, expectSuccess, refTrailingCommaPos) {
298
- const result = [];
299
- let trailingCommaPos = -1;
300
- for (;;) {
301
- if (this.tsIsListTerminator(kind)) {
302
- break;
303
- }
304
- trailingCommaPos = -1;
305
- const element = parseElement();
306
- if (element == null) {
307
- return undefined;
308
- }
309
- result.push(element);
310
- if (this.eat(12)) {
311
- trailingCommaPos = this.state.lastTokStart;
312
- continue;
313
- }
314
- if (this.tsIsListTerminator(kind)) {
315
- break;
316
- }
317
- if (expectSuccess) {
318
- this.expect(12);
319
- }
320
- return undefined;
321
- }
322
- if (refTrailingCommaPos) {
323
- refTrailingCommaPos.value = trailingCommaPos;
324
- }
325
- return result;
326
- }
327
- tsParseBracketedList(kind, parseElement, bracket, skipFirstToken, refTrailingCommaPos) {
328
- if (!skipFirstToken) {
329
- if (bracket) {
330
- this.expect(0);
331
- } else {
332
- this.expect(47);
333
- }
334
- }
335
- const result = this.tsParseDelimitedList(kind, parseElement, refTrailingCommaPos);
336
- if (bracket) {
337
- this.expect(3);
338
- } else {
339
- this.expect(48);
340
- }
341
- return result;
342
- }
343
- tsParseImportType() {
344
- const node = this.startNode();
345
- this.expect(83);
346
- this.expect(10);
347
- if (!this.match(131)) {
348
- this.raise(TSErrors.UnsupportedImportTypeArgument, {
349
- at: this.state.startLoc
350
- });
351
- }
352
- node.argument = super.parseExprAtom();
353
- this.expect(11);
354
- if (this.eat(16)) {
355
- node.qualifier = this.tsParseEntityName();
356
- }
357
- if (this.match(47)) {
358
- node.typeParameters = this.tsParseTypeArguments();
359
- }
360
- return this.finishNode(node, "TSImportType");
361
- }
362
- tsParseEntityName(allowReservedWords = true) {
363
- let entity = this.parseIdentifier(allowReservedWords);
364
- while (this.eat(16)) {
365
- const node = this.startNodeAtNode(entity);
366
- node.left = entity;
367
- node.right = this.parseIdentifier(allowReservedWords);
368
- entity = this.finishNode(node, "TSQualifiedName");
369
- }
370
- return entity;
371
- }
372
- tsParseTypeReference() {
373
- const node = this.startNode();
374
- node.typeName = this.tsParseEntityName();
375
- if (!this.hasPrecedingLineBreak() && this.match(47)) {
376
- node.typeParameters = this.tsParseTypeArguments();
377
- }
378
- return this.finishNode(node, "TSTypeReference");
379
- }
380
- tsParseThisTypePredicate(lhs) {
381
- this.next();
382
- const node = this.startNodeAtNode(lhs);
383
- node.parameterName = lhs;
384
- node.typeAnnotation = this.tsParseTypeAnnotation(false);
385
- node.asserts = false;
386
- return this.finishNode(node, "TSTypePredicate");
387
- }
388
- tsParseThisTypeNode() {
389
- const node = this.startNode();
390
- this.next();
391
- return this.finishNode(node, "TSThisType");
392
- }
393
- tsParseTypeQuery() {
394
- const node = this.startNode();
395
- this.expect(87);
396
- if (this.match(83)) {
397
- node.exprName = this.tsParseImportType();
398
- } else {
399
- node.exprName = this.tsParseEntityName();
400
- }
401
- if (!this.hasPrecedingLineBreak() && this.match(47)) {
402
- node.typeParameters = this.tsParseTypeArguments();
403
- }
404
- return this.finishNode(node, "TSTypeQuery");
405
- }
406
- tsParseTypeParameter(parseModifiers) {
407
- const node = this.startNode();
408
- parseModifiers(node);
409
- node.name = this.tsParseTypeParameterName();
410
- node.constraint = this.tsEatThenParseType(81);
411
- node.default = this.tsEatThenParseType(29);
412
- return this.finishNode(node, "TSTypeParameter");
413
- }
414
- tsTryParseTypeParameters(parseModifiers) {
415
- if (this.match(47)) {
416
- return this.tsParseTypeParameters(parseModifiers);
417
- }
418
- }
419
- tsParseTypeParameters(parseModifiers) {
420
- const node = this.startNode();
421
- if (this.match(47) || this.match(140)) {
422
- this.next();
423
- } else {
424
- this.unexpected();
425
- }
426
- const refTrailingCommaPos = {
427
- value: -1
428
- };
429
- node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
430
- if (node.params.length === 0) {
431
- this.raise(TSErrors.EmptyTypeParameters, {
432
- at: node
433
- });
434
- }
435
- if (refTrailingCommaPos.value !== -1) {
436
- this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
437
- }
438
- return this.finishNode(node, "TSTypeParameterDeclaration");
439
- }
440
- tsFillSignature(returnToken, signature) {
441
- const returnTokenRequired = returnToken === 19;
442
- const paramsKey = "parameters";
443
- const returnTypeKey = "typeAnnotation";
444
- signature.typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
445
- this.expect(10);
446
- signature[paramsKey] = this.tsParseBindingListForSignature();
447
- if (returnTokenRequired) {
448
- signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
449
- } else if (this.match(returnToken)) {
450
- signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
451
- }
452
- }
453
- tsParseBindingListForSignature() {
454
- const list = super.parseBindingList(11, 41, _lval.ParseBindingListFlags.IS_FUNCTION_PARAMS);
455
- for (const pattern of list) {
456
- const {
457
- type
458
- } = pattern;
459
- if (type === "AssignmentPattern" || type === "TSParameterProperty") {
460
- this.raise(TSErrors.UnsupportedSignatureParameterKind, {
461
- at: pattern,
462
- type
463
- });
464
- }
465
- }
466
- return list;
467
- }
468
- tsParseTypeMemberSemicolon() {
469
- if (!this.eat(12) && !this.isLineTerminator()) {
470
- this.expect(13);
471
- }
472
- }
473
- tsParseSignatureMember(kind, node) {
474
- this.tsFillSignature(14, node);
475
- this.tsParseTypeMemberSemicolon();
476
- return this.finishNode(node, kind);
477
- }
478
- tsIsUnambiguouslyIndexSignature() {
479
- this.next();
480
- if ((0, _types.tokenIsIdentifier)(this.state.type)) {
481
- this.next();
482
- return this.match(14);
483
- }
484
- return false;
485
- }
486
- tsTryParseIndexSignature(node) {
487
- if (!(this.match(0) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) {
488
- return;
489
- }
490
- this.expect(0);
491
- const id = this.parseIdentifier();
492
- id.typeAnnotation = this.tsParseTypeAnnotation();
493
- this.resetEndLocation(id);
494
- this.expect(3);
495
- node.parameters = [id];
496
- const type = this.tsTryParseTypeAnnotation();
497
- if (type) node.typeAnnotation = type;
498
- this.tsParseTypeMemberSemicolon();
499
- return this.finishNode(node, "TSIndexSignature");
500
- }
501
- tsParsePropertyOrMethodSignature(node, readonly) {
502
- if (this.eat(17)) node.optional = true;
503
- const nodeAny = node;
504
- if (this.match(10) || this.match(47)) {
505
- if (readonly) {
506
- this.raise(TSErrors.ReadonlyForMethodSignature, {
507
- at: node
508
- });
509
- }
510
- const method = nodeAny;
511
- if (method.kind && this.match(47)) {
512
- this.raise(TSErrors.AccesorCannotHaveTypeParameters, {
513
- at: this.state.curPosition()
514
- });
515
- }
516
- this.tsFillSignature(14, method);
517
- this.tsParseTypeMemberSemicolon();
518
- const paramsKey = "parameters";
519
- const returnTypeKey = "typeAnnotation";
520
- if (method.kind === "get") {
521
- if (method[paramsKey].length > 0) {
522
- this.raise(_parseError.Errors.BadGetterArity, {
523
- at: this.state.curPosition()
524
- });
525
- if (this.isThisParam(method[paramsKey][0])) {
526
- this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
527
- at: this.state.curPosition()
528
- });
529
- }
530
- }
531
- } else if (method.kind === "set") {
532
- if (method[paramsKey].length !== 1) {
533
- this.raise(_parseError.Errors.BadSetterArity, {
534
- at: this.state.curPosition()
535
- });
536
- } else {
537
- const firstParameter = method[paramsKey][0];
538
- if (this.isThisParam(firstParameter)) {
539
- this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
540
- at: this.state.curPosition()
541
- });
542
- }
543
- if (firstParameter.type === "Identifier" && firstParameter.optional) {
544
- this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, {
545
- at: this.state.curPosition()
546
- });
547
- }
548
- if (firstParameter.type === "RestElement") {
549
- this.raise(TSErrors.SetAccesorCannotHaveRestParameter, {
550
- at: this.state.curPosition()
551
- });
552
- }
553
- }
554
- if (method[returnTypeKey]) {
555
- this.raise(TSErrors.SetAccesorCannotHaveReturnType, {
556
- at: method[returnTypeKey]
557
- });
558
- }
559
- } else {
560
- method.kind = "method";
561
- }
562
- return this.finishNode(method, "TSMethodSignature");
563
- } else {
564
- const property = nodeAny;
565
- if (readonly) property.readonly = true;
566
- const type = this.tsTryParseTypeAnnotation();
567
- if (type) property.typeAnnotation = type;
568
- this.tsParseTypeMemberSemicolon();
569
- return this.finishNode(property, "TSPropertySignature");
570
- }
571
- }
572
- tsParseTypeMember() {
573
- const node = this.startNode();
574
- if (this.match(10) || this.match(47)) {
575
- return this.tsParseSignatureMember("TSCallSignatureDeclaration", node);
576
- }
577
- if (this.match(77)) {
578
- const id = this.startNode();
579
- this.next();
580
- if (this.match(10) || this.match(47)) {
581
- return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node);
582
- } else {
583
- node.key = this.createIdentifier(id, "new");
584
- return this.tsParsePropertyOrMethodSignature(node, false);
585
- }
586
- }
587
- this.tsParseModifiers({
588
- allowedModifiers: ["readonly"],
589
- disallowedModifiers: ["declare", "abstract", "private", "protected", "public", "static", "override"]
590
- }, node);
591
- const idx = this.tsTryParseIndexSignature(node);
592
- if (idx) {
593
- return idx;
594
- }
595
- super.parsePropertyName(node);
596
- if (!node.computed && node.key.type === "Identifier" && (node.key.name === "get" || node.key.name === "set") && this.tsTokenCanFollowModifier()) {
597
- node.kind = node.key.name;
598
- super.parsePropertyName(node);
599
- }
600
- return this.tsParsePropertyOrMethodSignature(node, !!node.readonly);
601
- }
602
- tsParseTypeLiteral() {
603
- const node = this.startNode();
604
- node.members = this.tsParseObjectTypeMembers();
605
- return this.finishNode(node, "TSTypeLiteral");
606
- }
607
- tsParseObjectTypeMembers() {
608
- this.expect(5);
609
- const members = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this));
610
- this.expect(8);
611
- return members;
612
- }
613
- tsIsStartOfMappedType() {
614
- this.next();
615
- if (this.eat(53)) {
616
- return this.isContextual(120);
617
- }
618
- if (this.isContextual(120)) {
619
- this.next();
620
- }
621
- if (!this.match(0)) {
622
- return false;
623
- }
624
- this.next();
625
- if (!this.tsIsIdentifier()) {
626
- return false;
627
- }
628
- this.next();
629
- return this.match(58);
630
- }
631
- tsParseMappedTypeParameter() {
632
- const node = this.startNode();
633
- node.name = this.tsParseTypeParameterName();
634
- node.constraint = this.tsExpectThenParseType(58);
635
- return this.finishNode(node, "TSTypeParameter");
636
- }
637
- tsParseMappedType() {
638
- const node = this.startNode();
639
- this.expect(5);
640
- if (this.match(53)) {
641
- node.readonly = this.state.value;
642
- this.next();
643
- this.expectContextual(120);
644
- } else if (this.eatContextual(120)) {
645
- node.readonly = true;
646
- }
647
- this.expect(0);
648
- node.typeParameter = this.tsParseMappedTypeParameter();
649
- node.nameType = this.eatContextual(93) ? this.tsParseType() : null;
650
- this.expect(3);
651
- if (this.match(53)) {
652
- node.optional = this.state.value;
653
- this.next();
654
- this.expect(17);
655
- } else if (this.eat(17)) {
656
- node.optional = true;
657
- }
658
- node.typeAnnotation = this.tsTryParseType();
659
- this.semicolon();
660
- this.expect(8);
661
- return this.finishNode(node, "TSMappedType");
662
- }
663
- tsParseTupleType() {
664
- const node = this.startNode();
665
- node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false);
666
- let seenOptionalElement = false;
667
- let labeledElements = null;
668
- node.elementTypes.forEach(elementNode => {
669
- var _labeledElements;
670
- const {
671
- type
672
- } = elementNode;
673
- if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
674
- this.raise(TSErrors.OptionalTypeBeforeRequired, {
675
- at: elementNode
676
- });
677
- }
678
- seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
679
- let checkType = type;
680
- if (type === "TSRestType") {
681
- elementNode = elementNode.typeAnnotation;
682
- checkType = elementNode.type;
683
- }
684
- const isLabeled = checkType === "TSNamedTupleMember";
685
- (_labeledElements = labeledElements) != null ? _labeledElements : labeledElements = isLabeled;
686
- if (labeledElements !== isLabeled) {
687
- this.raise(TSErrors.MixedLabeledAndUnlabeledElements, {
688
- at: elementNode
689
- });
690
- }
691
- });
692
- return this.finishNode(node, "TSTupleType");
693
- }
694
- tsParseTupleElementType() {
695
- const {
696
- startLoc
697
- } = this.state;
698
- const rest = this.eat(21);
699
- let labeled;
700
- let label;
701
- let optional;
702
- let type;
703
- const isWord = (0, _types.tokenIsKeywordOrIdentifier)(this.state.type);
704
- const chAfterWord = isWord ? this.lookaheadCharCode() : null;
705
- if (chAfterWord === 58) {
706
- labeled = true;
707
- optional = false;
708
- label = this.parseIdentifier(true);
709
- this.expect(14);
710
- type = this.tsParseType();
711
- } else if (chAfterWord === 63) {
712
- optional = true;
713
- const startLoc = this.state.startLoc;
714
- const wordName = this.state.value;
715
- const typeOrLabel = this.tsParseNonArrayType();
716
- if (this.lookaheadCharCode() === 58) {
717
- labeled = true;
718
- label = this.createIdentifier(this.startNodeAt(startLoc), wordName);
719
- this.expect(17);
720
- this.expect(14);
721
- type = this.tsParseType();
722
- } else {
723
- labeled = false;
724
- type = typeOrLabel;
725
- this.expect(17);
726
- }
727
- } else {
728
- type = this.tsParseType();
729
- optional = this.eat(17);
730
- labeled = this.eat(14);
731
- }
732
- if (labeled) {
733
- let labeledNode;
734
- if (label) {
735
- labeledNode = this.startNodeAtNode(label);
736
- labeledNode.optional = optional;
737
- labeledNode.label = label;
738
- labeledNode.elementType = type;
739
- if (this.eat(17)) {
740
- labeledNode.optional = true;
741
- this.raise(TSErrors.TupleOptionalAfterType, {
742
- at: this.state.lastTokStartLoc
743
- });
744
- }
745
- } else {
746
- labeledNode = this.startNodeAtNode(type);
747
- labeledNode.optional = optional;
748
- this.raise(TSErrors.InvalidTupleMemberLabel, {
749
- at: type
750
- });
751
- labeledNode.label = type;
752
- labeledNode.elementType = this.tsParseType();
753
- }
754
- type = this.finishNode(labeledNode, "TSNamedTupleMember");
755
- } else if (optional) {
756
- const optionalTypeNode = this.startNodeAtNode(type);
757
- optionalTypeNode.typeAnnotation = type;
758
- type = this.finishNode(optionalTypeNode, "TSOptionalType");
759
- }
760
- if (rest) {
761
- const restNode = this.startNodeAt(startLoc);
762
- restNode.typeAnnotation = type;
763
- type = this.finishNode(restNode, "TSRestType");
764
- }
765
- return type;
766
- }
767
- tsParseParenthesizedType() {
768
- const node = this.startNode();
769
- this.expect(10);
770
- node.typeAnnotation = this.tsParseType();
771
- this.expect(11);
772
- return this.finishNode(node, "TSParenthesizedType");
773
- }
774
- tsParseFunctionOrConstructorType(type, abstract) {
775
- const node = this.startNode();
776
- if (type === "TSConstructorType") {
777
- node.abstract = !!abstract;
778
- if (abstract) this.next();
779
- this.next();
780
- }
781
- this.tsInAllowConditionalTypesContext(() => this.tsFillSignature(19, node));
782
- return this.finishNode(node, type);
783
- }
784
- tsParseLiteralTypeNode() {
785
- const node = this.startNode();
786
- switch (this.state.type) {
787
- case 132:
788
- case 133:
789
- case 131:
790
- case 85:
791
- case 86:
792
- node.literal = super.parseExprAtom();
793
- break;
794
- default:
795
- this.unexpected();
796
- }
797
- return this.finishNode(node, "TSLiteralType");
798
- }
799
- tsParseTemplateLiteralType() {
800
- const node = this.startNode();
801
- node.literal = super.parseTemplate(false);
802
- return this.finishNode(node, "TSLiteralType");
803
- }
804
- parseTemplateSubstitution() {
805
- if (this.state.inType) return this.tsParseType();
806
- return super.parseTemplateSubstitution();
807
- }
808
- tsParseThisTypeOrThisTypePredicate() {
809
- const thisKeyword = this.tsParseThisTypeNode();
810
- if (this.isContextual(114) && !this.hasPrecedingLineBreak()) {
811
- return this.tsParseThisTypePredicate(thisKeyword);
812
- } else {
813
- return thisKeyword;
814
- }
815
- }
816
- tsParseNonArrayType() {
817
- switch (this.state.type) {
818
- case 131:
819
- case 132:
820
- case 133:
821
- case 85:
822
- case 86:
823
- return this.tsParseLiteralTypeNode();
824
- case 53:
825
- if (this.state.value === "-") {
826
- const node = this.startNode();
827
- const nextToken = this.lookahead();
828
- if (nextToken.type !== 132 && nextToken.type !== 133) {
829
- this.unexpected();
830
- }
831
- node.literal = this.parseMaybeUnary();
832
- return this.finishNode(node, "TSLiteralType");
833
- }
834
- break;
835
- case 78:
836
- return this.tsParseThisTypeOrThisTypePredicate();
837
- case 87:
838
- return this.tsParseTypeQuery();
839
- case 83:
840
- return this.tsParseImportType();
841
- case 5:
842
- return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral();
843
- case 0:
844
- return this.tsParseTupleType();
845
- case 10:
846
- ;
847
- return this.tsParseParenthesizedType();
848
- case 25:
849
- case 24:
850
- return this.tsParseTemplateLiteralType();
851
- default:
852
- {
853
- const {
854
- type
855
- } = this.state;
856
- if ((0, _types.tokenIsIdentifier)(type) || type === 88 || type === 84) {
857
- const nodeType = type === 88 ? "TSVoidKeyword" : type === 84 ? "TSNullKeyword" : keywordTypeFromName(this.state.value);
858
- if (nodeType !== undefined && this.lookaheadCharCode() !== 46) {
859
- const node = this.startNode();
860
- this.next();
861
- return this.finishNode(node, nodeType);
862
- }
863
- return this.tsParseTypeReference();
864
- }
865
- }
866
- }
867
- this.unexpected();
868
- }
869
- tsParseArrayTypeOrHigher() {
870
- let type = this.tsParseNonArrayType();
871
- while (!this.hasPrecedingLineBreak() && this.eat(0)) {
872
- if (this.match(3)) {
873
- const node = this.startNodeAtNode(type);
874
- node.elementType = type;
875
- this.expect(3);
876
- type = this.finishNode(node, "TSArrayType");
877
- } else {
878
- const node = this.startNodeAtNode(type);
879
- node.objectType = type;
880
- node.indexType = this.tsParseType();
881
- this.expect(3);
882
- type = this.finishNode(node, "TSIndexedAccessType");
883
- }
884
- }
885
- return type;
886
- }
887
- tsParseTypeOperator() {
888
- const node = this.startNode();
889
- const operator = this.state.value;
890
- this.next();
891
- node.operator = operator;
892
- node.typeAnnotation = this.tsParseTypeOperatorOrHigher();
893
- if (operator === "readonly") {
894
- this.tsCheckTypeAnnotationForReadOnly(node);
895
- }
896
- return this.finishNode(node, "TSTypeOperator");
897
- }
898
- tsCheckTypeAnnotationForReadOnly(node) {
899
- switch (node.typeAnnotation.type) {
900
- case "TSTupleType":
901
- case "TSArrayType":
902
- return;
903
- default:
904
- this.raise(TSErrors.UnexpectedReadonly, {
905
- at: node
906
- });
907
- }
908
- }
909
- tsParseInferType() {
910
- const node = this.startNode();
911
- this.expectContextual(113);
912
- const typeParameter = this.startNode();
913
- typeParameter.name = this.tsParseTypeParameterName();
914
- typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType());
915
- node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
916
- return this.finishNode(node, "TSInferType");
917
- }
918
- tsParseConstraintForInferType() {
919
- if (this.eat(81)) {
920
- const constraint = this.tsInDisallowConditionalTypesContext(() => this.tsParseType());
921
- if (this.state.inDisallowConditionalTypesContext || !this.match(17)) {
922
- return constraint;
923
- }
924
- }
925
- }
926
- tsParseTypeOperatorOrHigher() {
927
- const isTypeOperator = (0, _types.tokenIsTSTypeOperator)(this.state.type) && !this.state.containsEsc;
928
- return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(113) ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher());
929
- }
930
- tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
931
- const node = this.startNode();
932
- const hasLeadingOperator = this.eat(operator);
933
- const types = [];
934
- do {
935
- types.push(parseConstituentType());
936
- } while (this.eat(operator));
937
- if (types.length === 1 && !hasLeadingOperator) {
938
- return types[0];
939
- }
940
- node.types = types;
941
- return this.finishNode(node, kind);
942
- }
943
- tsParseIntersectionTypeOrHigher() {
944
- return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 45);
945
- }
946
- tsParseUnionTypeOrHigher() {
947
- return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 43);
948
- }
949
- tsIsStartOfFunctionType() {
950
- if (this.match(47)) {
951
- return true;
952
- }
953
- return this.match(10) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this));
954
- }
955
- tsSkipParameterStart() {
956
- if ((0, _types.tokenIsIdentifier)(this.state.type) || this.match(78)) {
957
- this.next();
958
- return true;
959
- }
960
- if (this.match(5)) {
961
- const {
962
- errors
963
- } = this.state;
964
- const previousErrorCount = errors.length;
965
- try {
966
- this.parseObjectLike(8, true);
967
- return errors.length === previousErrorCount;
968
- } catch (_unused) {
969
- return false;
970
- }
971
- }
972
- if (this.match(0)) {
973
- this.next();
974
- const {
975
- errors
976
- } = this.state;
977
- const previousErrorCount = errors.length;
978
- try {
979
- super.parseBindingList(3, 93, _lval.ParseBindingListFlags.ALLOW_EMPTY);
980
- return errors.length === previousErrorCount;
981
- } catch (_unused2) {
982
- return false;
983
- }
984
- }
985
- return false;
986
- }
987
- tsIsUnambiguouslyStartOfFunctionType() {
988
- this.next();
989
- if (this.match(11) || this.match(21)) {
990
- return true;
991
- }
992
- if (this.tsSkipParameterStart()) {
993
- if (this.match(14) || this.match(12) || this.match(17) || this.match(29)) {
994
- return true;
995
- }
996
- if (this.match(11)) {
997
- this.next();
998
- if (this.match(19)) {
999
- return true;
1000
- }
1001
- }
1002
- }
1003
- return false;
1004
- }
1005
- tsParseTypeOrTypePredicateAnnotation(returnToken) {
1006
- return this.tsInType(() => {
1007
- const t = this.startNode();
1008
- this.expect(returnToken);
1009
- const node = this.startNode();
1010
- const asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
1011
- if (asserts && this.match(78)) {
1012
- let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate();
1013
- if (thisTypePredicate.type === "TSThisType") {
1014
- node.parameterName = thisTypePredicate;
1015
- node.asserts = true;
1016
- node.typeAnnotation = null;
1017
- thisTypePredicate = this.finishNode(node, "TSTypePredicate");
1018
- } else {
1019
- this.resetStartLocationFromNode(thisTypePredicate, node);
1020
- thisTypePredicate.asserts = true;
1021
- }
1022
- t.typeAnnotation = thisTypePredicate;
1023
- return this.finishNode(t, "TSTypeAnnotation");
1024
- }
1025
- const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));
1026
- if (!typePredicateVariable) {
1027
- if (!asserts) {
1028
- return this.tsParseTypeAnnotation(false, t);
1029
- }
1030
- node.parameterName = this.parseIdentifier();
1031
- node.asserts = asserts;
1032
- node.typeAnnotation = null;
1033
- t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
1034
- return this.finishNode(t, "TSTypeAnnotation");
1035
- }
1036
- const type = this.tsParseTypeAnnotation(false);
1037
- node.parameterName = typePredicateVariable;
1038
- node.typeAnnotation = type;
1039
- node.asserts = asserts;
1040
- t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
1041
- return this.finishNode(t, "TSTypeAnnotation");
1042
- });
1043
- }
1044
- tsTryParseTypeOrTypePredicateAnnotation() {
1045
- if (this.match(14)) {
1046
- return this.tsParseTypeOrTypePredicateAnnotation(14);
1047
- }
1048
- }
1049
- tsTryParseTypeAnnotation() {
1050
- if (this.match(14)) {
1051
- return this.tsParseTypeAnnotation();
1052
- }
1053
- }
1054
- tsTryParseType() {
1055
- return this.tsEatThenParseType(14);
1056
- }
1057
- tsParseTypePredicatePrefix() {
1058
- const id = this.parseIdentifier();
1059
- if (this.isContextual(114) && !this.hasPrecedingLineBreak()) {
1060
- this.next();
1061
- return id;
1062
- }
1063
- }
1064
- tsParseTypePredicateAsserts() {
1065
- if (this.state.type !== 107) {
1066
- return false;
1067
- }
1068
- const containsEsc = this.state.containsEsc;
1069
- this.next();
1070
- if (!(0, _types.tokenIsIdentifier)(this.state.type) && !this.match(78)) {
1071
- return false;
1072
- }
1073
- if (containsEsc) {
1074
- this.raise(_parseError.Errors.InvalidEscapedReservedWord, {
1075
- at: this.state.lastTokStartLoc,
1076
- reservedWord: "asserts"
1077
- });
1078
- }
1079
- return true;
1080
- }
1081
- tsParseTypeAnnotation(eatColon = true, t = this.startNode()) {
1082
- this.tsInType(() => {
1083
- if (eatColon) this.expect(14);
1084
- t.typeAnnotation = this.tsParseType();
1085
- });
1086
- return this.finishNode(t, "TSTypeAnnotation");
1087
- }
1088
- tsParseType() {
1089
- assert(this.state.inType);
1090
- const type = this.tsParseNonConditionalType();
1091
- if (this.state.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(81)) {
1092
- return type;
1093
- }
1094
- const node = this.startNodeAtNode(type);
1095
- node.checkType = type;
1096
- node.extendsType = this.tsInDisallowConditionalTypesContext(() => this.tsParseNonConditionalType());
1097
- this.expect(17);
1098
- node.trueType = this.tsInAllowConditionalTypesContext(() => this.tsParseType());
1099
- this.expect(14);
1100
- node.falseType = this.tsInAllowConditionalTypesContext(() => this.tsParseType());
1101
- return this.finishNode(node, "TSConditionalType");
1102
- }
1103
- isAbstractConstructorSignature() {
1104
- return this.isContextual(122) && this.lookahead().type === 77;
1105
- }
1106
- tsParseNonConditionalType() {
1107
- if (this.tsIsStartOfFunctionType()) {
1108
- return this.tsParseFunctionOrConstructorType("TSFunctionType");
1109
- }
1110
- if (this.match(77)) {
1111
- return this.tsParseFunctionOrConstructorType("TSConstructorType");
1112
- } else if (this.isAbstractConstructorSignature()) {
1113
- return this.tsParseFunctionOrConstructorType("TSConstructorType", true);
1114
- }
1115
- return this.tsParseUnionTypeOrHigher();
1116
- }
1117
- tsParseTypeAssertion() {
1118
- if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
1119
- this.raise(TSErrors.ReservedTypeAssertion, {
1120
- at: this.state.startLoc
1121
- });
1122
- }
1123
- const node = this.startNode();
1124
- node.typeAnnotation = this.tsInType(() => {
1125
- this.next();
1126
- return this.match(75) ? this.tsParseTypeReference() : this.tsParseType();
1127
- });
1128
- this.expect(48);
1129
- node.expression = this.parseMaybeUnary();
1130
- return this.finishNode(node, "TSTypeAssertion");
1131
- }
1132
- tsParseHeritageClause(token) {
1133
- const originalStartLoc = this.state.startLoc;
1134
- const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
1135
- const node = this.startNode();
1136
- node.expression = this.tsParseEntityName();
1137
- if (this.match(47)) {
1138
- node.typeParameters = this.tsParseTypeArguments();
1139
- }
1140
- return this.finishNode(node, "TSExpressionWithTypeArguments");
1141
- });
1142
- if (!delimitedList.length) {
1143
- this.raise(TSErrors.EmptyHeritageClauseType, {
1144
- at: originalStartLoc,
1145
- token
1146
- });
1147
- }
1148
- return delimitedList;
1149
- }
1150
- tsParseInterfaceDeclaration(node, properties = {}) {
1151
- if (this.hasFollowingLineBreak()) return null;
1152
- this.expectContextual(127);
1153
- if (properties.declare) node.declare = true;
1154
- if ((0, _types.tokenIsIdentifier)(this.state.type)) {
1155
- node.id = this.parseIdentifier();
1156
- this.checkIdentifier(node.id, _scopeflags.BindingFlag.TYPE_TS_INTERFACE);
1157
- } else {
1158
- node.id = null;
1159
- this.raise(TSErrors.MissingInterfaceName, {
1160
- at: this.state.startLoc
1161
- });
1162
- }
1163
- node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
1164
- if (this.eat(81)) {
1165
- node.extends = this.tsParseHeritageClause("extends");
1166
- }
1167
- const body = this.startNode();
1168
- body.body = this.tsInType(this.tsParseObjectTypeMembers.bind(this));
1169
- node.body = this.finishNode(body, "TSInterfaceBody");
1170
- return this.finishNode(node, "TSInterfaceDeclaration");
1171
- }
1172
- tsParseTypeAliasDeclaration(node) {
1173
- node.id = this.parseIdentifier();
1174
- this.checkIdentifier(node.id, _scopeflags.BindingFlag.TYPE_TS_TYPE);
1175
- node.typeAnnotation = this.tsInType(() => {
1176
- node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers);
1177
- this.expect(29);
1178
- if (this.isContextual(112) && this.lookahead().type !== 16) {
1179
- const node = this.startNode();
1180
- this.next();
1181
- return this.finishNode(node, "TSIntrinsicKeyword");
1182
- }
1183
- return this.tsParseType();
1184
- });
1185
- this.semicolon();
1186
- return this.finishNode(node, "TSTypeAliasDeclaration");
1187
- }
1188
- tsInNoContext(cb) {
1189
- const oldContext = this.state.context;
1190
- this.state.context = [oldContext[0]];
1191
- try {
1192
- return cb();
1193
- } finally {
1194
- this.state.context = oldContext;
1195
- }
1196
- }
1197
- tsInType(cb) {
1198
- const oldInType = this.state.inType;
1199
- this.state.inType = true;
1200
- try {
1201
- return cb();
1202
- } finally {
1203
- this.state.inType = oldInType;
1204
- }
1205
- }
1206
- tsInDisallowConditionalTypesContext(cb) {
1207
- const oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
1208
- this.state.inDisallowConditionalTypesContext = true;
1209
- try {
1210
- return cb();
1211
- } finally {
1212
- this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
1213
- }
1214
- }
1215
- tsInAllowConditionalTypesContext(cb) {
1216
- const oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
1217
- this.state.inDisallowConditionalTypesContext = false;
1218
- try {
1219
- return cb();
1220
- } finally {
1221
- this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
1222
- }
1223
- }
1224
- tsEatThenParseType(token) {
1225
- if (this.match(token)) {
1226
- return this.tsNextThenParseType();
1227
- }
1228
- }
1229
- tsExpectThenParseType(token) {
1230
- return this.tsInType(() => {
1231
- this.expect(token);
1232
- return this.tsParseType();
1233
- });
1234
- }
1235
- tsNextThenParseType() {
1236
- return this.tsInType(() => {
1237
- this.next();
1238
- return this.tsParseType();
1239
- });
1240
- }
1241
- tsParseEnumMember() {
1242
- const node = this.startNode();
1243
- node.id = this.match(131) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
1244
- if (this.eat(29)) {
1245
- node.initializer = super.parseMaybeAssignAllowIn();
1246
- }
1247
- return this.finishNode(node, "TSEnumMember");
1248
- }
1249
- tsParseEnumDeclaration(node, properties = {}) {
1250
- if (properties.const) node.const = true;
1251
- if (properties.declare) node.declare = true;
1252
- this.expectContextual(124);
1253
- node.id = this.parseIdentifier();
1254
- this.checkIdentifier(node.id, node.const ? _scopeflags.BindingFlag.TYPE_TS_CONST_ENUM : _scopeflags.BindingFlag.TYPE_TS_ENUM);
1255
- this.expect(5);
1256
- node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
1257
- this.expect(8);
1258
- return this.finishNode(node, "TSEnumDeclaration");
1259
- }
1260
- tsParseModuleBlock() {
1261
- const node = this.startNode();
1262
- this.scope.enter(_scopeflags.ScopeFlag.OTHER);
1263
- this.expect(5);
1264
- super.parseBlockOrModuleBlockBody(node.body = [], undefined, true, 8);
1265
- this.scope.exit();
1266
- return this.finishNode(node, "TSModuleBlock");
1267
- }
1268
- tsParseModuleOrNamespaceDeclaration(node, nested = false) {
1269
- node.id = this.parseIdentifier();
1270
- if (!nested) {
1271
- this.checkIdentifier(node.id, _scopeflags.BindingFlag.TYPE_TS_NAMESPACE);
1272
- }
1273
- if (this.eat(16)) {
1274
- const inner = this.startNode();
1275
- this.tsParseModuleOrNamespaceDeclaration(inner, true);
1276
- node.body = inner;
1277
- } else {
1278
- this.scope.enter(_scopeflags.ScopeFlag.TS_MODULE);
1279
- this.prodParam.enter(_productionParameter.PARAM);
1280
- node.body = this.tsParseModuleBlock();
1281
- this.prodParam.exit();
1282
- this.scope.exit();
1283
- }
1284
- return this.finishNode(node, "TSModuleDeclaration");
1285
- }
1286
- tsParseAmbientExternalModuleDeclaration(node) {
1287
- if (this.isContextual(110)) {
1288
- node.global = true;
1289
- node.id = this.parseIdentifier();
1290
- } else if (this.match(131)) {
1291
- node.id = super.parseStringLiteral(this.state.value);
1292
- } else {
1293
- this.unexpected();
1294
- }
1295
- if (this.match(5)) {
1296
- this.scope.enter(_scopeflags.ScopeFlag.TS_MODULE);
1297
- this.prodParam.enter(_productionParameter.PARAM);
1298
- node.body = this.tsParseModuleBlock();
1299
- this.prodParam.exit();
1300
- this.scope.exit();
1301
- } else {
1302
- this.semicolon();
1303
- }
1304
- return this.finishNode(node, "TSModuleDeclaration");
1305
- }
1306
- tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, isExport) {
1307
- node.isExport = isExport || false;
1308
- node.id = maybeDefaultIdentifier || this.parseIdentifier();
1309
- this.checkIdentifier(node.id, _scopeflags.BindingFlag.TYPE_TS_VALUE_IMPORT);
1310
- this.expect(29);
1311
- const moduleReference = this.tsParseModuleReference();
1312
- if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
1313
- this.raise(TSErrors.ImportAliasHasImportType, {
1314
- at: moduleReference
1315
- });
1316
- }
1317
- node.moduleReference = moduleReference;
1318
- this.semicolon();
1319
- return this.finishNode(node, "TSImportEqualsDeclaration");
1320
- }
1321
- tsIsExternalModuleReference() {
1322
- return this.isContextual(117) && this.lookaheadCharCode() === 40;
1323
- }
1324
- tsParseModuleReference() {
1325
- return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(false);
1326
- }
1327
- tsParseExternalModuleReference() {
1328
- const node = this.startNode();
1329
- this.expectContextual(117);
1330
- this.expect(10);
1331
- if (!this.match(131)) {
1332
- this.unexpected();
1333
- }
1334
- node.expression = super.parseExprAtom();
1335
- this.expect(11);
1336
- this.sawUnambiguousESM = true;
1337
- return this.finishNode(node, "TSExternalModuleReference");
1338
- }
1339
- tsLookAhead(f) {
1340
- const state = this.state.clone();
1341
- const res = f();
1342
- this.state = state;
1343
- return res;
1344
- }
1345
- tsTryParseAndCatch(f) {
1346
- const result = this.tryParse(abort => f() || abort());
1347
- if (result.aborted || !result.node) return;
1348
- if (result.error) this.state = result.failState;
1349
- return result.node;
1350
- }
1351
- tsTryParse(f) {
1352
- const state = this.state.clone();
1353
- const result = f();
1354
- if (result !== undefined && result !== false) {
1355
- return result;
1356
- }
1357
- this.state = state;
1358
- }
1359
- tsTryParseDeclare(nany) {
1360
- if (this.isLineTerminator()) {
1361
- return;
1362
- }
1363
- let startType = this.state.type;
1364
- let kind;
1365
- if (this.isContextual(99)) {
1366
- startType = 74;
1367
- kind = "let";
1368
- }
1369
- return this.tsInAmbientContext(() => {
1370
- switch (startType) {
1371
- case 68:
1372
- nany.declare = true;
1373
- return super.parseFunctionStatement(nany, false, false);
1374
- case 80:
1375
- nany.declare = true;
1376
- return this.parseClass(nany, true, false);
1377
- case 124:
1378
- return this.tsParseEnumDeclaration(nany, {
1379
- declare: true
1380
- });
1381
- case 110:
1382
- return this.tsParseAmbientExternalModuleDeclaration(nany);
1383
- case 75:
1384
- case 74:
1385
- if (!this.match(75) || !this.isLookaheadContextual("enum")) {
1386
- nany.declare = true;
1387
- return this.parseVarStatement(nany, kind || this.state.value, true);
1388
- }
1389
- this.expect(75);
1390
- return this.tsParseEnumDeclaration(nany, {
1391
- const: true,
1392
- declare: true
1393
- });
1394
- case 127:
1395
- {
1396
- const result = this.tsParseInterfaceDeclaration(nany, {
1397
- declare: true
1398
- });
1399
- if (result) return result;
1400
- }
1401
- default:
1402
- if ((0, _types.tokenIsIdentifier)(startType)) {
1403
- return this.tsParseDeclaration(nany, this.state.value, true, null);
1404
- }
1405
- }
1406
- });
1407
- }
1408
- tsTryParseExportDeclaration() {
1409
- return this.tsParseDeclaration(this.startNode(), this.state.value, true, null);
1410
- }
1411
- tsParseExpressionStatement(node, expr, decorators) {
1412
- switch (expr.name) {
1413
- case "declare":
1414
- {
1415
- const declaration = this.tsTryParseDeclare(node);
1416
- if (declaration) {
1417
- declaration.declare = true;
1418
- }
1419
- return declaration;
1420
- }
1421
- case "global":
1422
- if (this.match(5)) {
1423
- this.scope.enter(_scopeflags.ScopeFlag.TS_MODULE);
1424
- this.prodParam.enter(_productionParameter.PARAM);
1425
- const mod = node;
1426
- mod.global = true;
1427
- mod.id = expr;
1428
- mod.body = this.tsParseModuleBlock();
1429
- this.scope.exit();
1430
- this.prodParam.exit();
1431
- return this.finishNode(mod, "TSModuleDeclaration");
1432
- }
1433
- break;
1434
- default:
1435
- return this.tsParseDeclaration(node, expr.name, false, decorators);
1436
- }
1437
- }
1438
- tsParseDeclaration(node, value, next, decorators) {
1439
- switch (value) {
1440
- case "abstract":
1441
- if (this.tsCheckLineTerminator(next) && (this.match(80) || (0, _types.tokenIsIdentifier)(this.state.type))) {
1442
- return this.tsParseAbstractDeclaration(node, decorators);
1443
- }
1444
- break;
1445
- case "module":
1446
- if (this.tsCheckLineTerminator(next)) {
1447
- if (this.match(131)) {
1448
- return this.tsParseAmbientExternalModuleDeclaration(node);
1449
- } else if ((0, _types.tokenIsIdentifier)(this.state.type)) {
1450
- return this.tsParseModuleOrNamespaceDeclaration(node);
1451
- }
1452
- }
1453
- break;
1454
- case "namespace":
1455
- if (this.tsCheckLineTerminator(next) && (0, _types.tokenIsIdentifier)(this.state.type)) {
1456
- return this.tsParseModuleOrNamespaceDeclaration(node);
1457
- }
1458
- break;
1459
- case "type":
1460
- if (this.tsCheckLineTerminator(next) && (0, _types.tokenIsIdentifier)(this.state.type)) {
1461
- return this.tsParseTypeAliasDeclaration(node);
1462
- }
1463
- break;
1464
- }
1465
- }
1466
- tsCheckLineTerminator(next) {
1467
- if (next) {
1468
- if (this.hasFollowingLineBreak()) return false;
1469
- this.next();
1470
- return true;
1471
- }
1472
- return !this.isLineTerminator();
1473
- }
1474
- tsTryParseGenericAsyncArrowFunction(startLoc) {
1475
- if (!this.match(47)) return;
1476
- const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
1477
- this.state.maybeInArrowParameters = true;
1478
- const res = this.tsTryParseAndCatch(() => {
1479
- const node = this.startNodeAt(startLoc);
1480
- node.typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier);
1481
- super.parseFunctionParams(node);
1482
- node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation();
1483
- this.expect(19);
1484
- return node;
1485
- });
1486
- this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
1487
- if (!res) return;
1488
- return super.parseArrowExpression(res, null, true);
1489
- }
1490
- tsParseTypeArgumentsInExpression() {
1491
- if (this.reScan_lt() !== 47) return;
1492
- return this.tsParseTypeArguments();
1493
- }
1494
- tsParseTypeArguments() {
1495
- const node = this.startNode();
1496
- node.params = this.tsInType(() => this.tsInNoContext(() => {
1497
- this.expect(47);
1498
- return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
1499
- }));
1500
- if (node.params.length === 0) {
1501
- this.raise(TSErrors.EmptyTypeArguments, {
1502
- at: node
1503
- });
1504
- } else if (!this.state.inType && this.curContext() === _context.types.brace) {
1505
- this.reScan_lt_gt();
1506
- }
1507
- this.expect(48);
1508
- return this.finishNode(node, "TSTypeParameterInstantiation");
1509
- }
1510
- tsIsDeclarationStart() {
1511
- return (0, _types.tokenIsTSDeclarationStart)(this.state.type);
1512
- }
1513
- isExportDefaultSpecifier() {
1514
- if (this.tsIsDeclarationStart()) return false;
1515
- return super.isExportDefaultSpecifier();
1516
- }
1517
- parseAssignableListItem(flags, decorators) {
1518
- const startLoc = this.state.startLoc;
1519
- const modified = {};
1520
- this.tsParseModifiers({
1521
- allowedModifiers: ["public", "private", "protected", "override", "readonly"]
1522
- }, modified);
1523
- const accessibility = modified.accessibility;
1524
- const override = modified.override;
1525
- const readonly = modified.readonly;
1526
- if (!(flags & _lval.ParseBindingListFlags.IS_CONSTRUCTOR_PARAMS) && (accessibility || readonly || override)) {
1527
- this.raise(TSErrors.UnexpectedParameterModifier, {
1528
- at: startLoc
1529
- });
1530
- }
1531
- const left = this.parseMaybeDefault();
1532
- this.parseAssignableListItemTypes(left, flags);
1533
- const elt = this.parseMaybeDefault(left.loc.start, left);
1534
- if (accessibility || readonly || override) {
1535
- const pp = this.startNodeAt(startLoc);
1536
- if (decorators.length) {
1537
- pp.decorators = decorators;
1538
- }
1539
- if (accessibility) pp.accessibility = accessibility;
1540
- if (readonly) pp.readonly = readonly;
1541
- if (override) pp.override = override;
1542
- if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
1543
- this.raise(TSErrors.UnsupportedParameterPropertyKind, {
1544
- at: pp
1545
- });
1546
- }
1547
- pp.parameter = elt;
1548
- return this.finishNode(pp, "TSParameterProperty");
1549
- }
1550
- if (decorators.length) {
1551
- left.decorators = decorators;
1552
- }
1553
- return elt;
1554
- }
1555
- isSimpleParameter(node) {
1556
- return node.type === "TSParameterProperty" && super.isSimpleParameter(node.parameter) || super.isSimpleParameter(node);
1557
- }
1558
- tsDisallowOptionalPattern(node) {
1559
- for (const param of node.params) {
1560
- if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) {
1561
- this.raise(TSErrors.PatternIsOptional, {
1562
- at: param
1563
- });
1564
- }
1565
- }
1566
- }
1567
- setArrowFunctionParameters(node, params, trailingCommaLoc) {
1568
- super.setArrowFunctionParameters(node, params, trailingCommaLoc);
1569
- this.tsDisallowOptionalPattern(node);
1570
- }
1571
- parseFunctionBodyAndFinish(node, type, isMethod = false) {
1572
- if (this.match(14)) {
1573
- node.returnType = this.tsParseTypeOrTypePredicateAnnotation(14);
1574
- }
1575
- const bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" || type === "ClassPrivateMethod" ? "TSDeclareMethod" : undefined;
1576
- if (bodilessType && !this.match(5) && this.isLineTerminator()) {
1577
- return this.finishNode(node, bodilessType);
1578
- }
1579
- if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
1580
- this.raise(TSErrors.DeclareFunctionHasImplementation, {
1581
- at: node
1582
- });
1583
- if (node.declare) {
1584
- return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
1585
- }
1586
- }
1587
- this.tsDisallowOptionalPattern(node);
1588
- return super.parseFunctionBodyAndFinish(node, type, isMethod);
1589
- }
1590
- registerFunctionStatementId(node) {
1591
- if (!node.body && node.id) {
1592
- this.checkIdentifier(node.id, _scopeflags.BindingFlag.TYPE_TS_AMBIENT);
1593
- } else {
1594
- super.registerFunctionStatementId(node);
1595
- }
1596
- }
1597
- tsCheckForInvalidTypeCasts(items) {
1598
- items.forEach(node => {
1599
- if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
1600
- this.raise(TSErrors.UnexpectedTypeAnnotation, {
1601
- at: node.typeAnnotation
1602
- });
1603
- }
1604
- });
1605
- }
1606
- toReferencedList(exprList, isInParens) {
1607
- this.tsCheckForInvalidTypeCasts(exprList);
1608
- return exprList;
1609
- }
1610
- parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
1611
- const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);
1612
- if (node.type === "ArrayExpression") {
1613
- this.tsCheckForInvalidTypeCasts(node.elements);
1614
- }
1615
- return node;
1616
- }
1617
- parseSubscript(base, startLoc, noCalls, state) {
1618
- if (!this.hasPrecedingLineBreak() && this.match(35)) {
1619
- this.state.canStartJSXElement = false;
1620
- this.next();
1621
- const nonNullExpression = this.startNodeAt(startLoc);
1622
- nonNullExpression.expression = base;
1623
- return this.finishNode(nonNullExpression, "TSNonNullExpression");
1624
- }
1625
- let isOptionalCall = false;
1626
- if (this.match(18) && this.lookaheadCharCode() === 60) {
1627
- if (noCalls) {
1628
- state.stop = true;
1629
- return base;
1630
- }
1631
- state.optionalChainMember = isOptionalCall = true;
1632
- this.next();
1633
- }
1634
- if (this.match(47) || this.match(51)) {
1635
- let missingParenErrorLoc;
1636
- const result = this.tsTryParseAndCatch(() => {
1637
- if (!noCalls && this.atPossibleAsyncArrow(base)) {
1638
- const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startLoc);
1639
- if (asyncArrowFn) {
1640
- return asyncArrowFn;
1641
- }
1642
- }
1643
- const typeArguments = this.tsParseTypeArgumentsInExpression();
1644
- if (!typeArguments) return;
1645
- if (isOptionalCall && !this.match(10)) {
1646
- missingParenErrorLoc = this.state.curPosition();
1647
- return;
1648
- }
1649
- if ((0, _types.tokenIsTemplate)(this.state.type)) {
1650
- const result = super.parseTaggedTemplateExpression(base, startLoc, state);
1651
- result.typeParameters = typeArguments;
1652
- return result;
1653
- }
1654
- if (!noCalls && this.eat(10)) {
1655
- const node = this.startNodeAt(startLoc);
1656
- node.callee = base;
1657
- node.arguments = this.parseCallExpressionArguments(11, false);
1658
- this.tsCheckForInvalidTypeCasts(node.arguments);
1659
- node.typeParameters = typeArguments;
1660
- if (state.optionalChainMember) {
1661
- node.optional = isOptionalCall;
1662
- }
1663
- return this.finishCallExpression(node, state.optionalChainMember);
1664
- }
1665
- const tokenType = this.state.type;
1666
- if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && (0, _types.tokenCanStartExpression)(tokenType) && !this.hasPrecedingLineBreak()) {
1667
- return;
1668
- }
1669
- const node = this.startNodeAt(startLoc);
1670
- node.expression = base;
1671
- node.typeParameters = typeArguments;
1672
- return this.finishNode(node, "TSInstantiationExpression");
1673
- });
1674
- if (missingParenErrorLoc) {
1675
- this.unexpected(missingParenErrorLoc, 10);
1676
- }
1677
- if (result) {
1678
- if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
1679
- this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, {
1680
- at: this.state.startLoc
1681
- });
1682
- }
1683
- return result;
1684
- }
1685
- }
1686
- return super.parseSubscript(base, startLoc, noCalls, state);
1687
- }
1688
- parseNewCallee(node) {
1689
- var _callee$extra;
1690
- super.parseNewCallee(node);
1691
- const {
1692
- callee
1693
- } = node;
1694
- if (callee.type === "TSInstantiationExpression" && !((_callee$extra = callee.extra) != null && _callee$extra.parenthesized)) {
1695
- node.typeParameters = callee.typeParameters;
1696
- node.callee = callee.expression;
1697
- }
1698
- }
1699
- parseExprOp(left, leftStartLoc, minPrec) {
1700
- let isSatisfies;
1701
- if ((0, _types.tokenOperatorPrecedence)(58) > minPrec && !this.hasPrecedingLineBreak() && (this.isContextual(93) || (isSatisfies = this.isContextual(118)))) {
1702
- const node = this.startNodeAt(leftStartLoc);
1703
- node.expression = left;
1704
- node.typeAnnotation = this.tsInType(() => {
1705
- this.next();
1706
- if (this.match(75)) {
1707
- if (isSatisfies) {
1708
- this.raise(_parseError.Errors.UnexpectedKeyword, {
1709
- at: this.state.startLoc,
1710
- keyword: "const"
1711
- });
1712
- }
1713
- return this.tsParseTypeReference();
1714
- }
1715
- return this.tsParseType();
1716
- });
1717
- this.finishNode(node, isSatisfies ? "TSSatisfiesExpression" : "TSAsExpression");
1718
- this.reScan_lt_gt();
1719
- return this.parseExprOp(node, leftStartLoc, minPrec);
1720
- }
1721
- return super.parseExprOp(left, leftStartLoc, minPrec);
1722
- }
1723
- checkReservedWord(word, startLoc, checkKeywords, isBinding) {
1724
- if (!this.state.isAmbientContext) {
1725
- super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
1726
- }
1727
- }
1728
- checkImportReflection(node) {
1729
- super.checkImportReflection(node);
1730
- if (node.module && node.importKind !== "value") {
1731
- this.raise(TSErrors.ImportReflectionHasImportType, {
1732
- at: node.specifiers[0].loc.start
1733
- });
1734
- }
1735
- }
1736
- checkDuplicateExports() {}
1737
- isPotentialImportPhase(isExport) {
1738
- if (super.isPotentialImportPhase(isExport)) return true;
1739
- if (this.isContextual(128)) {
1740
- const ch = this.lookaheadCharCode();
1741
- return isExport ? ch === 123 || ch === 42 : ch !== 61;
1742
- }
1743
- return !isExport && this.isContextual(87);
1744
- }
1745
- applyImportPhase(node, isExport, phase, loc) {
1746
- super.applyImportPhase(node, isExport, phase, loc);
1747
- if (isExport) {
1748
- node.exportKind = phase === "type" ? "type" : "value";
1749
- } else {
1750
- node.importKind = phase === "type" || phase === "typeof" ? phase : "value";
1751
- }
1752
- }
1753
- parseImport(node) {
1754
- if (this.match(131)) {
1755
- node.importKind = "value";
1756
- return super.parseImport(node);
1757
- }
1758
- let importNode;
1759
- if ((0, _types.tokenIsIdentifier)(this.state.type) && this.lookaheadCharCode() === 61) {
1760
- node.importKind = "value";
1761
- return this.tsParseImportEqualsDeclaration(node);
1762
- } else if (this.isContextual(128)) {
1763
- const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false);
1764
- if (this.lookaheadCharCode() === 61) {
1765
- return this.tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier);
1766
- } else {
1767
- importNode = super.parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier);
1768
- }
1769
- } else {
1770
- importNode = super.parseImport(node);
1771
- }
1772
- if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
1773
- this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, {
1774
- at: importNode
1775
- });
1776
- }
1777
- return importNode;
1778
- }
1779
- parseExport(node, decorators) {
1780
- if (this.match(83)) {
1781
- this.next();
1782
- let maybeDefaultIdentifier = null;
1783
- if (this.isContextual(128) && this.isPotentialImportPhase(false)) {
1784
- maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false);
1785
- } else {
1786
- node.importKind = "value";
1787
- }
1788
- return this.tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, true);
1789
- } else if (this.eat(29)) {
1790
- const assign = node;
1791
- assign.expression = super.parseExpression();
1792
- this.semicolon();
1793
- this.sawUnambiguousESM = true;
1794
- return this.finishNode(assign, "TSExportAssignment");
1795
- } else if (this.eatContextual(93)) {
1796
- const decl = node;
1797
- this.expectContextual(126);
1798
- decl.id = this.parseIdentifier();
1799
- this.semicolon();
1800
- return this.finishNode(decl, "TSNamespaceExportDeclaration");
1801
- } else {
1802
- return super.parseExport(node, decorators);
1803
- }
1804
- }
1805
- isAbstractClass() {
1806
- return this.isContextual(122) && this.lookahead().type === 80;
1807
- }
1808
- parseExportDefaultExpression() {
1809
- if (this.isAbstractClass()) {
1810
- const cls = this.startNode();
1811
- this.next();
1812
- cls.abstract = true;
1813
- return this.parseClass(cls, true, true);
1814
- }
1815
- if (this.match(127)) {
1816
- const result = this.tsParseInterfaceDeclaration(this.startNode());
1817
- if (result) return result;
1818
- }
1819
- return super.parseExportDefaultExpression();
1820
- }
1821
- parseVarStatement(node, kind, allowMissingInitializer = false) {
1822
- const {
1823
- isAmbientContext
1824
- } = this.state;
1825
- const declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext);
1826
- if (!isAmbientContext) return declaration;
1827
- for (const {
1828
- id,
1829
- init
1830
- } of declaration.declarations) {
1831
- if (!init) continue;
1832
- if (kind !== "const" || !!id.typeAnnotation) {
1833
- this.raise(TSErrors.InitializerNotAllowedInAmbientContext, {
1834
- at: init
1835
- });
1836
- } else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
1837
- this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, {
1838
- at: init
1839
- });
1840
- }
1841
- }
1842
- return declaration;
1843
- }
1844
- parseStatementContent(flags, decorators) {
1845
- if (this.match(75) && this.isLookaheadContextual("enum")) {
1846
- const node = this.startNode();
1847
- this.expect(75);
1848
- return this.tsParseEnumDeclaration(node, {
1849
- const: true
1850
- });
1851
- }
1852
- if (this.isContextual(124)) {
1853
- return this.tsParseEnumDeclaration(this.startNode());
1854
- }
1855
- if (this.isContextual(127)) {
1856
- const result = this.tsParseInterfaceDeclaration(this.startNode());
1857
- if (result) return result;
1858
- }
1859
- return super.parseStatementContent(flags, decorators);
1860
- }
1861
- parseAccessModifier() {
1862
- return this.tsParseModifier(["public", "protected", "private"]);
1863
- }
1864
- tsHasSomeModifiers(member, modifiers) {
1865
- return modifiers.some(modifier => {
1866
- if (tsIsAccessModifier(modifier)) {
1867
- return member.accessibility === modifier;
1868
- }
1869
- return !!member[modifier];
1870
- });
1871
- }
1872
- tsIsStartOfStaticBlocks() {
1873
- return this.isContextual(104) && this.lookaheadCharCode() === 123;
1874
- }
1875
- parseClassMember(classBody, member, state) {
1876
- const modifiers = ["declare", "private", "public", "protected", "override", "abstract", "readonly", "static"];
1877
- this.tsParseModifiers({
1878
- allowedModifiers: modifiers,
1879
- disallowedModifiers: ["in", "out"],
1880
- stopOnStartOfClassStaticBlock: true,
1881
- errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
1882
- }, member);
1883
- const callParseClassMemberWithIsStatic = () => {
1884
- if (this.tsIsStartOfStaticBlocks()) {
1885
- this.next();
1886
- this.next();
1887
- if (this.tsHasSomeModifiers(member, modifiers)) {
1888
- this.raise(TSErrors.StaticBlockCannotHaveModifier, {
1889
- at: this.state.curPosition()
1890
- });
1891
- }
1892
- super.parseClassStaticBlock(classBody, member);
1893
- } else {
1894
- this.parseClassMemberWithIsStatic(classBody, member, state, !!member.static);
1895
- }
1896
- };
1897
- if (member.declare) {
1898
- this.tsInAmbientContext(callParseClassMemberWithIsStatic);
1899
- } else {
1900
- callParseClassMemberWithIsStatic();
1901
- }
1902
- }
1903
- parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
1904
- const idx = this.tsTryParseIndexSignature(member);
1905
- if (idx) {
1906
- classBody.body.push(idx);
1907
- if (member.abstract) {
1908
- this.raise(TSErrors.IndexSignatureHasAbstract, {
1909
- at: member
1910
- });
1911
- }
1912
- if (member.accessibility) {
1913
- this.raise(TSErrors.IndexSignatureHasAccessibility, {
1914
- at: member,
1915
- modifier: member.accessibility
1916
- });
1917
- }
1918
- if (member.declare) {
1919
- this.raise(TSErrors.IndexSignatureHasDeclare, {
1920
- at: member
1921
- });
1922
- }
1923
- if (member.override) {
1924
- this.raise(TSErrors.IndexSignatureHasOverride, {
1925
- at: member
1926
- });
1927
- }
1928
- return;
1929
- }
1930
- if (!this.state.inAbstractClass && member.abstract) {
1931
- this.raise(TSErrors.NonAbstractClassHasAbstractMethod, {
1932
- at: member
1933
- });
1934
- }
1935
- if (member.override) {
1936
- if (!state.hadSuperClass) {
1937
- this.raise(TSErrors.OverrideNotInSubClass, {
1938
- at: member
1939
- });
1940
- }
1941
- }
1942
- super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
1943
- }
1944
- parsePostMemberNameModifiers(methodOrProp) {
1945
- const optional = this.eat(17);
1946
- if (optional) methodOrProp.optional = true;
1947
- if (methodOrProp.readonly && this.match(10)) {
1948
- this.raise(TSErrors.ClassMethodHasReadonly, {
1949
- at: methodOrProp
1950
- });
1951
- }
1952
- if (methodOrProp.declare && this.match(10)) {
1953
- this.raise(TSErrors.ClassMethodHasDeclare, {
1954
- at: methodOrProp
1955
- });
1956
- }
1957
- }
1958
- parseExpressionStatement(node, expr, decorators) {
1959
- const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr, decorators) : undefined;
1960
- return decl || super.parseExpressionStatement(node, expr, decorators);
1961
- }
1962
- shouldParseExportDeclaration() {
1963
- if (this.tsIsDeclarationStart()) return true;
1964
- return super.shouldParseExportDeclaration();
1965
- }
1966
- parseConditional(expr, startLoc, refExpressionErrors) {
1967
- if (!this.state.maybeInArrowParameters || !this.match(17)) {
1968
- return super.parseConditional(expr, startLoc, refExpressionErrors);
1969
- }
1970
- const result = this.tryParse(() => super.parseConditional(expr, startLoc));
1971
- if (!result.node) {
1972
- if (result.error) {
1973
- super.setOptionalParametersError(refExpressionErrors, result.error);
1974
- }
1975
- return expr;
1976
- }
1977
- if (result.error) this.state = result.failState;
1978
- return result.node;
1979
- }
1980
- parseParenItem(node, startLoc) {
1981
- node = super.parseParenItem(node, startLoc);
1982
- if (this.eat(17)) {
1983
- node.optional = true;
1984
- this.resetEndLocation(node);
1985
- }
1986
- if (this.match(14)) {
1987
- const typeCastNode = this.startNodeAt(startLoc);
1988
- typeCastNode.expression = node;
1989
- typeCastNode.typeAnnotation = this.tsParseTypeAnnotation();
1990
- return this.finishNode(typeCastNode, "TSTypeCastExpression");
1991
- }
1992
- return node;
1993
- }
1994
- parseExportDeclaration(node) {
1995
- if (!this.state.isAmbientContext && this.isContextual(123)) {
1996
- return this.tsInAmbientContext(() => this.parseExportDeclaration(node));
1997
- }
1998
- const startLoc = this.state.startLoc;
1999
- const isDeclare = this.eatContextual(123);
2000
- if (isDeclare && (this.isContextual(123) || !this.shouldParseExportDeclaration())) {
2001
- throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, {
2002
- at: this.state.startLoc
2003
- });
2004
- }
2005
- const isIdentifier = (0, _types.tokenIsIdentifier)(this.state.type);
2006
- const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
2007
- if (!declaration) return null;
2008
- if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) {
2009
- node.exportKind = "type";
2010
- }
2011
- if (isDeclare) {
2012
- this.resetStartLocation(declaration, startLoc);
2013
- declaration.declare = true;
2014
- }
2015
- return declaration;
2016
- }
2017
- parseClassId(node, isStatement, optionalId, bindingType) {
2018
- if ((!isStatement || optionalId) && this.isContextual(111)) {
2019
- return;
2020
- }
2021
- super.parseClassId(node, isStatement, optionalId, node.declare ? _scopeflags.BindingFlag.TYPE_TS_AMBIENT : _scopeflags.BindingFlag.TYPE_CLASS);
2022
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
2023
- if (typeParameters) node.typeParameters = typeParameters;
2024
- }
2025
- parseClassPropertyAnnotation(node) {
2026
- if (!node.optional) {
2027
- if (this.eat(35)) {
2028
- node.definite = true;
2029
- } else if (this.eat(17)) {
2030
- node.optional = true;
2031
- }
2032
- }
2033
- const type = this.tsTryParseTypeAnnotation();
2034
- if (type) node.typeAnnotation = type;
2035
- }
2036
- parseClassProperty(node) {
2037
- this.parseClassPropertyAnnotation(node);
2038
- if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
2039
- this.raise(TSErrors.DeclareClassFieldHasInitializer, {
2040
- at: this.state.startLoc
2041
- });
2042
- }
2043
- if (node.abstract && this.match(29)) {
2044
- const {
2045
- key
2046
- } = node;
2047
- this.raise(TSErrors.AbstractPropertyHasInitializer, {
2048
- at: this.state.startLoc,
2049
- propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
2050
- });
2051
- }
2052
- return super.parseClassProperty(node);
2053
- }
2054
- parseClassPrivateProperty(node) {
2055
- if (node.abstract) {
2056
- this.raise(TSErrors.PrivateElementHasAbstract, {
2057
- at: node
2058
- });
2059
- }
2060
- if (node.accessibility) {
2061
- this.raise(TSErrors.PrivateElementHasAccessibility, {
2062
- at: node,
2063
- modifier: node.accessibility
2064
- });
2065
- }
2066
- this.parseClassPropertyAnnotation(node);
2067
- return super.parseClassPrivateProperty(node);
2068
- }
2069
- parseClassAccessorProperty(node) {
2070
- this.parseClassPropertyAnnotation(node);
2071
- if (node.optional) {
2072
- this.raise(TSErrors.AccessorCannotBeOptional, {
2073
- at: node
2074
- });
2075
- }
2076
- return super.parseClassAccessorProperty(node);
2077
- }
2078
- pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
2079
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
2080
- if (typeParameters && isConstructor) {
2081
- this.raise(TSErrors.ConstructorHasTypeParameters, {
2082
- at: typeParameters
2083
- });
2084
- }
2085
- const {
2086
- declare = false,
2087
- kind
2088
- } = method;
2089
- if (declare && (kind === "get" || kind === "set")) {
2090
- this.raise(TSErrors.DeclareAccessor, {
2091
- at: method,
2092
- kind
2093
- });
2094
- }
2095
- if (typeParameters) method.typeParameters = typeParameters;
2096
- super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
2097
- }
2098
- pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
2099
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
2100
- if (typeParameters) method.typeParameters = typeParameters;
2101
- super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
2102
- }
2103
- declareClassPrivateMethodInScope(node, kind) {
2104
- if (node.type === "TSDeclareMethod") return;
2105
- if (node.type === "MethodDefinition" && !node.value.body) return;
2106
- super.declareClassPrivateMethodInScope(node, kind);
2107
- }
2108
- parseClassSuper(node) {
2109
- super.parseClassSuper(node);
2110
- if (node.superClass && (this.match(47) || this.match(51))) {
2111
- node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
2112
- }
2113
- if (this.eatContextual(111)) {
2114
- node.implements = this.tsParseHeritageClause("implements");
2115
- }
2116
- }
2117
- parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
2118
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
2119
- if (typeParameters) prop.typeParameters = typeParameters;
2120
- return super.parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
2121
- }
2122
- parseFunctionParams(node, isConstructor) {
2123
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
2124
- if (typeParameters) node.typeParameters = typeParameters;
2125
- super.parseFunctionParams(node, isConstructor);
2126
- }
2127
- parseVarId(decl, kind) {
2128
- super.parseVarId(decl, kind);
2129
- if (decl.id.type === "Identifier" && !this.hasPrecedingLineBreak() && this.eat(35)) {
2130
- decl.definite = true;
2131
- }
2132
- const type = this.tsTryParseTypeAnnotation();
2133
- if (type) {
2134
- decl.id.typeAnnotation = type;
2135
- this.resetEndLocation(decl.id);
2136
- }
2137
- }
2138
- parseAsyncArrowFromCallExpression(node, call) {
2139
- if (this.match(14)) {
2140
- node.returnType = this.tsParseTypeAnnotation();
2141
- }
2142
- return super.parseAsyncArrowFromCallExpression(node, call);
2143
- }
2144
- parseMaybeAssign(refExpressionErrors, afterLeftParse) {
2145
- var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2;
2146
- let state;
2147
- let jsx;
2148
- let typeCast;
2149
- if (this.hasPlugin("jsx") && (this.match(140) || this.match(47))) {
2150
- state = this.state.clone();
2151
- jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
2152
- if (!jsx.error) return jsx.node;
2153
- const {
2154
- context
2155
- } = this.state;
2156
- const currentContext = context[context.length - 1];
2157
- if (currentContext === _context.types.j_oTag || currentContext === _context.types.j_expr) {
2158
- context.pop();
2159
- }
2160
- }
2161
- if (!((_jsx = jsx) != null && _jsx.error) && !this.match(47)) {
2162
- return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
2163
- }
2164
- if (!state || state === this.state) state = this.state.clone();
2165
- let typeParameters;
2166
- const arrow = this.tryParse(abort => {
2167
- var _expr$extra, _typeParameters;
2168
- typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier);
2169
- const expr = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
2170
- if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
2171
- abort();
2172
- }
2173
- if (((_typeParameters = typeParameters) == null ? void 0 : _typeParameters.params.length) !== 0) {
2174
- this.resetStartLocationFromNode(expr, typeParameters);
2175
- }
2176
- expr.typeParameters = typeParameters;
2177
- ;
2178
- return expr;
2179
- }, state);
2180
- if (!arrow.error && !arrow.aborted) {
2181
- if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
2182
- return arrow.node;
2183
- }
2184
- if (!jsx) {
2185
- assert(!this.hasPlugin("jsx"));
2186
- typeCast = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
2187
- if (!typeCast.error) return typeCast.node;
2188
- }
2189
- if ((_jsx2 = jsx) != null && _jsx2.node) {
2190
- this.state = jsx.failState;
2191
- return jsx.node;
2192
- }
2193
- if (arrow.node) {
2194
- this.state = arrow.failState;
2195
- if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
2196
- return arrow.node;
2197
- }
2198
- if ((_typeCast = typeCast) != null && _typeCast.node) {
2199
- this.state = typeCast.failState;
2200
- return typeCast.node;
2201
- }
2202
- throw ((_jsx3 = jsx) == null ? void 0 : _jsx3.error) || arrow.error || ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.error);
2203
- }
2204
- reportReservedArrowTypeParam(node) {
2205
- var _node$extra;
2206
- if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
2207
- this.raise(TSErrors.ReservedArrowTypeParam, {
2208
- at: node
2209
- });
2210
- }
2211
- }
2212
- parseMaybeUnary(refExpressionErrors, sawUnary) {
2213
- if (!this.hasPlugin("jsx") && this.match(47)) {
2214
- return this.tsParseTypeAssertion();
2215
- }
2216
- return super.parseMaybeUnary(refExpressionErrors, sawUnary);
2217
- }
2218
- parseArrow(node) {
2219
- if (this.match(14)) {
2220
- const result = this.tryParse(abort => {
2221
- const returnType = this.tsParseTypeOrTypePredicateAnnotation(14);
2222
- if (this.canInsertSemicolon() || !this.match(19)) abort();
2223
- return returnType;
2224
- });
2225
- if (result.aborted) return;
2226
- if (!result.thrown) {
2227
- if (result.error) this.state = result.failState;
2228
- node.returnType = result.node;
2229
- }
2230
- }
2231
- return super.parseArrow(node);
2232
- }
2233
- parseAssignableListItemTypes(param, flags) {
2234
- if (!(flags & _lval.ParseBindingListFlags.IS_FUNCTION_PARAMS)) return param;
2235
- if (this.eat(17)) {
2236
- param.optional = true;
2237
- }
2238
- const type = this.tsTryParseTypeAnnotation();
2239
- if (type) param.typeAnnotation = type;
2240
- this.resetEndLocation(param);
2241
- return param;
2242
- }
2243
- isAssignable(node, isBinding) {
2244
- switch (node.type) {
2245
- case "TSTypeCastExpression":
2246
- return this.isAssignable(node.expression, isBinding);
2247
- case "TSParameterProperty":
2248
- return true;
2249
- default:
2250
- return super.isAssignable(node, isBinding);
2251
- }
2252
- }
2253
- toAssignable(node, isLHS = false) {
2254
- switch (node.type) {
2255
- case "ParenthesizedExpression":
2256
- this.toAssignableParenthesizedExpression(node, isLHS);
2257
- break;
2258
- case "TSAsExpression":
2259
- case "TSSatisfiesExpression":
2260
- case "TSNonNullExpression":
2261
- case "TSTypeAssertion":
2262
- if (isLHS) {
2263
- this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, {
2264
- at: node
2265
- });
2266
- } else {
2267
- this.raise(TSErrors.UnexpectedTypeCastInParameter, {
2268
- at: node
2269
- });
2270
- }
2271
- this.toAssignable(node.expression, isLHS);
2272
- break;
2273
- case "AssignmentExpression":
2274
- if (!isLHS && node.left.type === "TSTypeCastExpression") {
2275
- node.left = this.typeCastToParameter(node.left);
2276
- }
2277
- default:
2278
- super.toAssignable(node, isLHS);
2279
- }
2280
- }
2281
- toAssignableParenthesizedExpression(node, isLHS) {
2282
- switch (node.expression.type) {
2283
- case "TSAsExpression":
2284
- case "TSSatisfiesExpression":
2285
- case "TSNonNullExpression":
2286
- case "TSTypeAssertion":
2287
- case "ParenthesizedExpression":
2288
- this.toAssignable(node.expression, isLHS);
2289
- break;
2290
- default:
2291
- super.toAssignable(node, isLHS);
2292
- }
2293
- }
2294
- checkToRestConversion(node, allowPattern) {
2295
- switch (node.type) {
2296
- case "TSAsExpression":
2297
- case "TSSatisfiesExpression":
2298
- case "TSTypeAssertion":
2299
- case "TSNonNullExpression":
2300
- this.checkToRestConversion(node.expression, false);
2301
- break;
2302
- default:
2303
- super.checkToRestConversion(node, allowPattern);
2304
- }
2305
- }
2306
- isValidLVal(type, isUnparenthesizedInAssign, binding) {
2307
- return getOwn({
2308
- TSTypeCastExpression: true,
2309
- TSParameterProperty: "parameter",
2310
- TSNonNullExpression: "expression",
2311
- TSAsExpression: (binding !== _scopeflags.BindingFlag.TYPE_NONE || !isUnparenthesizedInAssign) && ["expression", true],
2312
- TSSatisfiesExpression: (binding !== _scopeflags.BindingFlag.TYPE_NONE || !isUnparenthesizedInAssign) && ["expression", true],
2313
- TSTypeAssertion: (binding !== _scopeflags.BindingFlag.TYPE_NONE || !isUnparenthesizedInAssign) && ["expression", true]
2314
- }, type) || super.isValidLVal(type, isUnparenthesizedInAssign, binding);
2315
- }
2316
- parseBindingAtom() {
2317
- if (this.state.type === 78) {
2318
- return this.parseIdentifier(true);
2319
- }
2320
- return super.parseBindingAtom();
2321
- }
2322
- parseMaybeDecoratorArguments(expr) {
2323
- if (this.match(47) || this.match(51)) {
2324
- const typeArguments = this.tsParseTypeArgumentsInExpression();
2325
- if (this.match(10)) {
2326
- const call = super.parseMaybeDecoratorArguments(expr);
2327
- call.typeParameters = typeArguments;
2328
- return call;
2329
- }
2330
- this.unexpected(null, 10);
2331
- }
2332
- return super.parseMaybeDecoratorArguments(expr);
2333
- }
2334
- checkCommaAfterRest(close) {
2335
- if (this.state.isAmbientContext && this.match(12) && this.lookaheadCharCode() === close) {
2336
- this.next();
2337
- return false;
2338
- }
2339
- return super.checkCommaAfterRest(close);
2340
- }
2341
- isClassMethod() {
2342
- return this.match(47) || super.isClassMethod();
2343
- }
2344
- isClassProperty() {
2345
- return this.match(35) || this.match(14) || super.isClassProperty();
2346
- }
2347
- parseMaybeDefault(startLoc, left) {
2348
- const node = super.parseMaybeDefault(startLoc, left);
2349
- if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
2350
- this.raise(TSErrors.TypeAnnotationAfterAssign, {
2351
- at: node.typeAnnotation
2352
- });
2353
- }
2354
- return node;
2355
- }
2356
- getTokenFromCode(code) {
2357
- if (this.state.inType) {
2358
- if (code === 62) {
2359
- this.finishOp(48, 1);
2360
- return;
2361
- }
2362
- if (code === 60) {
2363
- this.finishOp(47, 1);
2364
- return;
2365
- }
2366
- }
2367
- super.getTokenFromCode(code);
2368
- }
2369
- reScan_lt_gt() {
2370
- const {
2371
- type
2372
- } = this.state;
2373
- if (type === 47) {
2374
- this.state.pos -= 1;
2375
- this.readToken_lt();
2376
- } else if (type === 48) {
2377
- this.state.pos -= 1;
2378
- this.readToken_gt();
2379
- }
2380
- }
2381
- reScan_lt() {
2382
- const {
2383
- type
2384
- } = this.state;
2385
- if (type === 51) {
2386
- this.state.pos -= 2;
2387
- this.finishOp(47, 1);
2388
- return 47;
2389
- }
2390
- return type;
2391
- }
2392
- toAssignableList(exprList, trailingCommaLoc, isLHS) {
2393
- for (let i = 0; i < exprList.length; i++) {
2394
- const expr = exprList[i];
2395
- if ((expr == null ? void 0 : expr.type) === "TSTypeCastExpression") {
2396
- exprList[i] = this.typeCastToParameter(expr);
2397
- }
2398
- }
2399
- super.toAssignableList(exprList, trailingCommaLoc, isLHS);
2400
- }
2401
- typeCastToParameter(node) {
2402
- node.expression.typeAnnotation = node.typeAnnotation;
2403
- this.resetEndLocation(node.expression, node.typeAnnotation.loc.end);
2404
- return node.expression;
2405
- }
2406
- shouldParseArrow(params) {
2407
- if (this.match(14)) {
2408
- return params.every(expr => this.isAssignable(expr, true));
2409
- }
2410
- return super.shouldParseArrow(params);
2411
- }
2412
- shouldParseAsyncArrow() {
2413
- return this.match(14) || super.shouldParseAsyncArrow();
2414
- }
2415
- canHaveLeadingDecorator() {
2416
- return super.canHaveLeadingDecorator() || this.isAbstractClass();
2417
- }
2418
- jsxParseOpeningElementAfterName(node) {
2419
- if (this.match(47) || this.match(51)) {
2420
- const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression());
2421
- if (typeArguments) node.typeParameters = typeArguments;
2422
- }
2423
- return super.jsxParseOpeningElementAfterName(node);
2424
- }
2425
- getGetterSetterExpectedParamCount(method) {
2426
- const baseCount = super.getGetterSetterExpectedParamCount(method);
2427
- const params = this.getObjectOrClassMethodParams(method);
2428
- const firstParam = params[0];
2429
- const hasContextParam = firstParam && this.isThisParam(firstParam);
2430
- return hasContextParam ? baseCount + 1 : baseCount;
2431
- }
2432
- parseCatchClauseParam() {
2433
- const param = super.parseCatchClauseParam();
2434
- const type = this.tsTryParseTypeAnnotation();
2435
- if (type) {
2436
- param.typeAnnotation = type;
2437
- this.resetEndLocation(param);
2438
- }
2439
- return param;
2440
- }
2441
- tsInAmbientContext(cb) {
2442
- const oldIsAmbientContext = this.state.isAmbientContext;
2443
- this.state.isAmbientContext = true;
2444
- try {
2445
- return cb();
2446
- } finally {
2447
- this.state.isAmbientContext = oldIsAmbientContext;
2448
- }
2449
- }
2450
- parseClass(node, isStatement, optionalId) {
2451
- const oldInAbstractClass = this.state.inAbstractClass;
2452
- this.state.inAbstractClass = !!node.abstract;
2453
- try {
2454
- return super.parseClass(node, isStatement, optionalId);
2455
- } finally {
2456
- this.state.inAbstractClass = oldInAbstractClass;
2457
- }
2458
- }
2459
- tsParseAbstractDeclaration(node, decorators) {
2460
- if (this.match(80)) {
2461
- node.abstract = true;
2462
- return this.maybeTakeDecorators(decorators, this.parseClass(node, true, false));
2463
- } else if (this.isContextual(127)) {
2464
- if (!this.hasFollowingLineBreak()) {
2465
- node.abstract = true;
2466
- this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, {
2467
- at: node
2468
- });
2469
- return this.tsParseInterfaceDeclaration(node);
2470
- }
2471
- } else {
2472
- this.unexpected(null, 80);
2473
- }
2474
- }
2475
- parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
2476
- const method = super.parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
2477
- if (method.abstract) {
2478
- const hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body;
2479
- if (hasBody) {
2480
- const {
2481
- key
2482
- } = method;
2483
- this.raise(TSErrors.AbstractMethodHasImplementation, {
2484
- at: method,
2485
- methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
2486
- });
2487
- }
2488
- }
2489
- return method;
2490
- }
2491
- tsParseTypeParameterName() {
2492
- const typeName = this.parseIdentifier();
2493
- return typeName.name;
2494
- }
2495
- shouldParseAsAmbientContext() {
2496
- return !!this.getPluginOption("typescript", "dts");
2497
- }
2498
- parse() {
2499
- if (this.shouldParseAsAmbientContext()) {
2500
- this.state.isAmbientContext = true;
2501
- }
2502
- return super.parse();
2503
- }
2504
- getExpression() {
2505
- if (this.shouldParseAsAmbientContext()) {
2506
- this.state.isAmbientContext = true;
2507
- }
2508
- return super.getExpression();
2509
- }
2510
- parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
2511
- if (!isString && isMaybeTypeOnly) {
2512
- this.parseTypeOnlyImportExportSpecifier(node, false, isInTypeExport);
2513
- return this.finishNode(node, "ExportSpecifier");
2514
- }
2515
- node.exportKind = "value";
2516
- return super.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly);
2517
- }
2518
- parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
2519
- if (!importedIsString && isMaybeTypeOnly) {
2520
- this.parseTypeOnlyImportExportSpecifier(specifier, true, isInTypeOnlyImport);
2521
- return this.finishNode(specifier, "ImportSpecifier");
2522
- }
2523
- specifier.importKind = "value";
2524
- return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, isInTypeOnlyImport ? _scopeflags.BindingFlag.TYPE_TS_TYPE_IMPORT : _scopeflags.BindingFlag.TYPE_TS_VALUE_IMPORT);
2525
- }
2526
- parseTypeOnlyImportExportSpecifier(node, isImport, isInTypeOnlyImportExport) {
2527
- const leftOfAsKey = isImport ? "imported" : "local";
2528
- const rightOfAsKey = isImport ? "local" : "exported";
2529
- let leftOfAs = node[leftOfAsKey];
2530
- let rightOfAs;
2531
- let hasTypeSpecifier = false;
2532
- let canParseAsKeyword = true;
2533
- const loc = leftOfAs.loc.start;
2534
- if (this.isContextual(93)) {
2535
- const firstAs = this.parseIdentifier();
2536
- if (this.isContextual(93)) {
2537
- const secondAs = this.parseIdentifier();
2538
- if ((0, _types.tokenIsKeywordOrIdentifier)(this.state.type)) {
2539
- hasTypeSpecifier = true;
2540
- leftOfAs = firstAs;
2541
- rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
2542
- canParseAsKeyword = false;
2543
- } else {
2544
- rightOfAs = secondAs;
2545
- canParseAsKeyword = false;
2546
- }
2547
- } else if ((0, _types.tokenIsKeywordOrIdentifier)(this.state.type)) {
2548
- canParseAsKeyword = false;
2549
- rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
2550
- } else {
2551
- hasTypeSpecifier = true;
2552
- leftOfAs = firstAs;
2553
- }
2554
- } else if ((0, _types.tokenIsKeywordOrIdentifier)(this.state.type)) {
2555
- hasTypeSpecifier = true;
2556
- if (isImport) {
2557
- leftOfAs = this.parseIdentifier(true);
2558
- if (!this.isContextual(93)) {
2559
- this.checkReservedWord(leftOfAs.name, leftOfAs.loc.start, true, true);
2560
- }
2561
- } else {
2562
- leftOfAs = this.parseModuleExportName();
2563
- }
2564
- }
2565
- if (hasTypeSpecifier && isInTypeOnlyImportExport) {
2566
- this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, {
2567
- at: loc
2568
- });
2569
- }
2570
- node[leftOfAsKey] = leftOfAs;
2571
- node[rightOfAsKey] = rightOfAs;
2572
- const kindKey = isImport ? "importKind" : "exportKind";
2573
- node[kindKey] = hasTypeSpecifier ? "type" : "value";
2574
- if (canParseAsKeyword && this.eatContextual(93)) {
2575
- node[rightOfAsKey] = isImport ? this.parseIdentifier() : this.parseModuleExportName();
2576
- }
2577
- if (!node[rightOfAsKey]) {
2578
- node[rightOfAsKey] = (0, _node.cloneIdentifier)(node[leftOfAsKey]);
2579
- }
2580
- if (isImport) {
2581
- this.checkIdentifier(node[rightOfAsKey], hasTypeSpecifier ? _scopeflags.BindingFlag.TYPE_TS_TYPE_IMPORT : _scopeflags.BindingFlag.TYPE_TS_VALUE_IMPORT);
2582
- }
2583
- }
2584
- };
2585
- exports.default = _default;
2586
- function isPossiblyLiteralEnum(expression) {
2587
- if (expression.type !== "MemberExpression") return false;
2588
- const {
2589
- computed,
2590
- property
2591
- } = expression;
2592
- if (computed && property.type !== "StringLiteral" && (property.type !== "TemplateLiteral" || property.expressions.length > 0)) {
2593
- return false;
2594
- }
2595
- return isUncomputedMemberExpressionChain(expression.object);
2596
- }
2597
- function isValidAmbientConstInitializer(expression, estree) {
2598
- var _expression$extra;
2599
- const {
2600
- type
2601
- } = expression;
2602
- if ((_expression$extra = expression.extra) != null && _expression$extra.parenthesized) {
2603
- return false;
2604
- }
2605
- if (estree) {
2606
- if (type === "Literal") {
2607
- const {
2608
- value
2609
- } = expression;
2610
- if (typeof value === "string" || typeof value === "boolean") {
2611
- return true;
2612
- }
2613
- }
2614
- } else {
2615
- if (type === "StringLiteral" || type === "BooleanLiteral") {
2616
- return true;
2617
- }
2618
- }
2619
- if (isNumber(expression, estree) || isNegativeNumber(expression, estree)) {
2620
- return true;
2621
- }
2622
- if (type === "TemplateLiteral" && expression.expressions.length === 0) {
2623
- return true;
2624
- }
2625
- if (isPossiblyLiteralEnum(expression)) {
2626
- return true;
2627
- }
2628
- return false;
2629
- }
2630
- function isNumber(expression, estree) {
2631
- if (estree) {
2632
- return expression.type === "Literal" && (typeof expression.value === "number" || "bigint" in expression);
2633
- }
2634
- return expression.type === "NumericLiteral" || expression.type === "BigIntLiteral";
2635
- }
2636
- function isNegativeNumber(expression, estree) {
2637
- if (expression.type === "UnaryExpression") {
2638
- const {
2639
- operator,
2640
- argument
2641
- } = expression;
2642
- if (operator === "-" && isNumber(argument, estree)) {
2643
- return true;
2644
- }
2645
- }
2646
- return false;
2647
- }
2648
- function isUncomputedMemberExpressionChain(expression) {
2649
- if (expression.type === "Identifier") return true;
2650
- if (expression.type !== "MemberExpression" || expression.computed) {
2651
- return false;
2652
- }
2653
- return isUncomputedMemberExpressionChain(expression.object);
2654
- }
2655
-
2656
- //# sourceMappingURL=index.js.map