brighterscript 0.66.0-alpha.0 → 0.66.0-alpha.10

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 (383) hide show
  1. package/CHANGELOG.md +223 -10
  2. package/README.md +13 -3
  3. package/bsconfig.schema.json +15 -0
  4. package/dist/ActionPipeline.d.ts +10 -0
  5. package/dist/ActionPipeline.js +40 -0
  6. package/dist/ActionPipeline.js.map +1 -0
  7. package/dist/AstValidationSegmenter.d.ts +25 -0
  8. package/dist/AstValidationSegmenter.js +150 -0
  9. package/dist/AstValidationSegmenter.js.map +1 -0
  10. package/dist/BsConfig.d.ts +13 -4
  11. package/dist/BusyStatusTracker.d.ts +31 -0
  12. package/dist/BusyStatusTracker.js +83 -0
  13. package/dist/BusyStatusTracker.js.map +1 -0
  14. package/dist/Cache.js +3 -3
  15. package/dist/Cache.js.map +1 -1
  16. package/dist/CacheVerifier.d.ts +0 -1
  17. package/dist/CodeActionUtil.d.ts +2 -2
  18. package/dist/CommentFlagProcessor.d.ts +4 -3
  19. package/dist/CommentFlagProcessor.js.map +1 -1
  20. package/dist/DiagnosticCollection.js +8 -5
  21. package/dist/DiagnosticCollection.js.map +1 -1
  22. package/dist/DiagnosticMessages.d.ts +34 -4
  23. package/dist/DiagnosticMessages.js +59 -4
  24. package/dist/DiagnosticMessages.js.map +1 -1
  25. package/dist/FunctionScope.d.ts +1 -1
  26. package/dist/LanguageServer.d.ts +23 -1
  27. package/dist/LanguageServer.js +139 -57
  28. package/dist/LanguageServer.js.map +1 -1
  29. package/dist/Logger.d.ts +3 -2
  30. package/dist/Logger.js +10 -2
  31. package/dist/Logger.js.map +1 -1
  32. package/dist/PluginInterface.d.ts +11 -2
  33. package/dist/PluginInterface.js +69 -10
  34. package/dist/PluginInterface.js.map +1 -1
  35. package/dist/Program.d.ts +138 -49
  36. package/dist/Program.js +656 -340
  37. package/dist/Program.js.map +1 -1
  38. package/dist/ProgramBuilder.d.ts +10 -4
  39. package/dist/ProgramBuilder.js +83 -66
  40. package/dist/ProgramBuilder.js.map +1 -1
  41. package/dist/Scope.d.ts +52 -49
  42. package/dist/Scope.js +312 -247
  43. package/dist/Scope.js.map +1 -1
  44. package/dist/SymbolTable.d.ts +35 -14
  45. package/dist/SymbolTable.js +89 -26
  46. package/dist/SymbolTable.js.map +1 -1
  47. package/dist/Throttler.d.ts +12 -0
  48. package/dist/Throttler.js +39 -0
  49. package/dist/Throttler.js.map +1 -1
  50. package/dist/XmlScope.d.ts +7 -4
  51. package/dist/XmlScope.js +52 -12
  52. package/dist/XmlScope.js.map +1 -1
  53. package/dist/astUtils/{AstEditor.d.ts → Editor.d.ts} +6 -1
  54. package/dist/astUtils/{AstEditor.js → Editor.js} +9 -3
  55. package/dist/astUtils/Editor.js.map +1 -0
  56. package/dist/astUtils/{AstEditor.spec.js → Editor.spec.js} +10 -6
  57. package/dist/astUtils/Editor.spec.js.map +1 -0
  58. package/dist/astUtils/creators.d.ts +3 -1
  59. package/dist/astUtils/creators.js +14 -4
  60. package/dist/astUtils/creators.js.map +1 -1
  61. package/dist/astUtils/reflection.d.ts +37 -9
  62. package/dist/astUtils/reflection.js +83 -14
  63. package/dist/astUtils/reflection.js.map +1 -1
  64. package/dist/astUtils/reflection.spec.js +87 -5
  65. package/dist/astUtils/reflection.spec.js.map +1 -1
  66. package/dist/astUtils/visitors.d.ts +14 -3
  67. package/dist/astUtils/visitors.js +22 -2
  68. package/dist/astUtils/visitors.js.map +1 -1
  69. package/dist/astUtils/visitors.spec.js +58 -7
  70. package/dist/astUtils/visitors.spec.js.map +1 -1
  71. package/dist/bscPlugin/BscPlugin.d.ts +11 -4
  72. package/dist/bscPlugin/BscPlugin.js +26 -6
  73. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  74. package/dist/bscPlugin/CallExpressionInfo.d.ts +3 -3
  75. package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
  76. package/dist/bscPlugin/FileWriter.d.ts +6 -0
  77. package/dist/bscPlugin/FileWriter.js +24 -0
  78. package/dist/bscPlugin/FileWriter.js.map +1 -0
  79. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +8 -8
  80. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  81. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +4 -4
  82. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  83. package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +50 -1
  84. package/dist/bscPlugin/completions/CompletionsProcessor.js +442 -23
  85. package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
  86. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +1737 -0
  87. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -0
  88. package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
  89. package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
  90. package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
  91. package/dist/bscPlugin/hover/HoverProcessor.d.ts +7 -3
  92. package/dist/bscPlugin/hover/HoverProcessor.js +133 -103
  93. package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
  94. package/dist/bscPlugin/hover/HoverProcessor.spec.js +241 -29
  95. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -1
  96. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +1 -0
  97. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +43 -0
  98. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
  99. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +22 -0
  100. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
  101. package/dist/bscPlugin/serialize/BslibInjector.spec.js +19 -0
  102. package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
  103. package/dist/bscPlugin/serialize/BslibManager.d.ts +9 -0
  104. package/dist/bscPlugin/serialize/BslibManager.js +40 -0
  105. package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
  106. package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
  107. package/dist/bscPlugin/serialize/FileSerializer.js +72 -0
  108. package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
  109. package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.d.ts → BrsFileTranspileProcessor.d.ts} +4 -2
  110. package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.js → BrsFileTranspileProcessor.js} +29 -5
  111. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
  112. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
  113. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +41 -0
  114. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
  115. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +2 -2
  116. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -1
  117. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +0 -4
  118. package/dist/bscPlugin/validation/BrsFileValidator.js +35 -65
  119. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
  120. package/dist/bscPlugin/validation/BrsFileValidator.spec.js +1 -1
  121. package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -1
  122. package/dist/bscPlugin/validation/ProgramValidator.d.ts +3 -3
  123. package/dist/bscPlugin/validation/ProgramValidator.js +6 -6
  124. package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -1
  125. package/dist/bscPlugin/validation/ScopeValidator.d.ts +28 -7
  126. package/dist/bscPlugin/validation/ScopeValidator.js +393 -205
  127. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
  128. package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
  129. package/dist/bscPlugin/validation/ScopeValidator.spec.js +2038 -0
  130. package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
  131. package/dist/bscPlugin/validation/XmlFileValidator.js +2 -2
  132. package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
  133. package/dist/cli.js +104 -13
  134. package/dist/cli.js.map +1 -1
  135. package/dist/deferred.d.ts +3 -3
  136. package/dist/deferred.js.map +1 -1
  137. package/dist/diagnosticUtils.d.ts +8 -2
  138. package/dist/diagnosticUtils.js +45 -16
  139. package/dist/diagnosticUtils.js.map +1 -1
  140. package/dist/examples/plugins/removePrint.js +1 -1
  141. package/dist/examples/plugins/removePrint.js.map +1 -1
  142. package/dist/files/AssetFile.d.ts +26 -0
  143. package/dist/files/AssetFile.js +26 -0
  144. package/dist/files/AssetFile.js.map +1 -0
  145. package/dist/files/BrsFile.Class.spec.js +383 -56
  146. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  147. package/dist/files/BrsFile.d.ts +73 -46
  148. package/dist/files/BrsFile.js +370 -534
  149. package/dist/files/BrsFile.js.map +1 -1
  150. package/dist/files/BrsFile.spec.js +1139 -682
  151. package/dist/files/BrsFile.spec.js.map +1 -1
  152. package/dist/files/Factory.d.ts +25 -0
  153. package/dist/files/Factory.js +22 -0
  154. package/dist/files/Factory.js.map +1 -0
  155. package/dist/files/File.d.ts +106 -0
  156. package/dist/files/File.js +16 -0
  157. package/dist/files/File.js.map +1 -0
  158. package/dist/files/LazyFileData.d.ts +20 -0
  159. package/dist/files/LazyFileData.js +54 -0
  160. package/dist/files/LazyFileData.js.map +1 -0
  161. package/dist/files/LazyFileData.spec.d.ts +1 -0
  162. package/dist/files/LazyFileData.spec.js +27 -0
  163. package/dist/files/LazyFileData.spec.js.map +1 -0
  164. package/dist/files/XmlFile.d.ts +56 -23
  165. package/dist/files/XmlFile.js +88 -60
  166. package/dist/files/XmlFile.js.map +1 -1
  167. package/dist/files/XmlFile.spec.js +63 -91
  168. package/dist/files/XmlFile.spec.js.map +1 -1
  169. package/dist/files/tests/imports.spec.js +21 -8
  170. package/dist/files/tests/imports.spec.js.map +1 -1
  171. package/dist/files/tests/optionalChaning.spec.js +14 -14
  172. package/dist/files/tests/optionalChaning.spec.js.map +1 -1
  173. package/dist/globalCallables.js +88 -84
  174. package/dist/globalCallables.js.map +1 -1
  175. package/dist/index.d.ts +9 -1
  176. package/dist/index.js +9 -1
  177. package/dist/index.js.map +1 -1
  178. package/dist/interfaces.d.ts +436 -81
  179. package/dist/interfaces.js +13 -2
  180. package/dist/interfaces.js.map +1 -1
  181. package/dist/lexer/Lexer.d.ts +12 -0
  182. package/dist/lexer/Lexer.js +28 -8
  183. package/dist/lexer/Lexer.js.map +1 -1
  184. package/dist/lexer/Lexer.spec.js +40 -0
  185. package/dist/lexer/Lexer.spec.js.map +1 -1
  186. package/dist/lexer/Token.d.ts +4 -0
  187. package/dist/lexer/Token.js.map +1 -1
  188. package/dist/lexer/TokenKind.d.ts +5 -0
  189. package/dist/lexer/TokenKind.js +14 -2
  190. package/dist/lexer/TokenKind.js.map +1 -1
  191. package/dist/parser/AstNode.d.ts +9 -2
  192. package/dist/parser/AstNode.js +16 -0
  193. package/dist/parser/AstNode.js.map +1 -1
  194. package/dist/parser/BrsTranspileState.d.ts +3 -2
  195. package/dist/parser/BrsTranspileState.js +3 -2
  196. package/dist/parser/BrsTranspileState.js.map +1 -1
  197. package/dist/parser/Expression.d.ts +21 -5
  198. package/dist/parser/Expression.js +128 -35
  199. package/dist/parser/Expression.js.map +1 -1
  200. package/dist/parser/Parser.Class.spec.js +103 -1
  201. package/dist/parser/Parser.Class.spec.js.map +1 -1
  202. package/dist/parser/Parser.d.ts +7 -0
  203. package/dist/parser/Parser.js +117 -21
  204. package/dist/parser/Parser.js.map +1 -1
  205. package/dist/parser/Parser.spec.js +557 -5
  206. package/dist/parser/Parser.spec.js.map +1 -1
  207. package/dist/parser/SGParser.d.ts +4 -4
  208. package/dist/parser/SGParser.js +3 -3
  209. package/dist/parser/SGParser.js.map +1 -1
  210. package/dist/parser/SGParser.spec.js +2 -2
  211. package/dist/parser/SGParser.spec.js.map +1 -1
  212. package/dist/parser/SGTypes.d.ts +2 -2
  213. package/dist/parser/Statement.d.ts +37 -12
  214. package/dist/parser/Statement.js +153 -46
  215. package/dist/parser/Statement.js.map +1 -1
  216. package/dist/parser/tests/Parser.spec.js +2 -1
  217. package/dist/parser/tests/Parser.spec.js.map +1 -1
  218. package/dist/parser/tests/controlFlow/For.spec.js +16 -8
  219. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  220. package/dist/parser/tests/controlFlow/ForEach.spec.js +12 -6
  221. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  222. package/dist/parser/tests/controlFlow/While.spec.js +8 -4
  223. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  224. package/dist/parser/tests/expression/Call.spec.js +4 -4
  225. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  226. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +29 -29
  227. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  228. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +10 -10
  229. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -1
  230. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +24 -24
  231. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
  232. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +75 -36
  233. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  234. package/dist/parser/tests/expression/TernaryExpression.spec.js +36 -36
  235. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  236. package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
  237. package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
  238. package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
  239. package/dist/parser/tests/statement/ConstStatement.spec.js +71 -22
  240. package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
  241. package/dist/parser/tests/statement/Continue.spec.js +2 -2
  242. package/dist/parser/tests/statement/Continue.spec.js.map +1 -1
  243. package/dist/parser/tests/statement/Enum.spec.js +38 -285
  244. package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
  245. package/dist/parser/tests/statement/For.spec.js +6 -6
  246. package/dist/parser/tests/statement/For.spec.js.map +1 -1
  247. package/dist/parser/tests/statement/ForEach.spec.js +4 -4
  248. package/dist/parser/tests/statement/ForEach.spec.js.map +1 -1
  249. package/dist/parser/tests/statement/InterfaceStatement.spec.js +26 -10
  250. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
  251. package/dist/parser/tests/statement/PrintStatement.spec.js +16 -13
  252. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  253. package/dist/parser/tests/statement/ReturnStatement.spec.js +5 -3
  254. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  255. package/dist/parser/tests/statement/Set.spec.js +26 -13
  256. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  257. package/dist/preprocessor/Manifest.d.ts +1 -1
  258. package/dist/preprocessor/Manifest.js +2 -2
  259. package/dist/preprocessor/Manifest.js.map +1 -1
  260. package/dist/roku-types/data.json +243 -293
  261. package/dist/roku-types/index.d.ts +17 -38
  262. package/dist/types/ArrayType.d.ts +4 -1
  263. package/dist/types/ArrayType.js +46 -6
  264. package/dist/types/ArrayType.js.map +1 -1
  265. package/dist/types/ArrayType.spec.js +32 -3
  266. package/dist/types/ArrayType.spec.js.map +1 -1
  267. package/dist/types/AssociativeArrayType.d.ts +11 -0
  268. package/dist/types/AssociativeArrayType.js +52 -0
  269. package/dist/types/AssociativeArrayType.js.map +1 -0
  270. package/dist/types/BaseFunctionType.d.ts +9 -0
  271. package/dist/types/BaseFunctionType.js +25 -0
  272. package/dist/types/BaseFunctionType.js.map +1 -0
  273. package/dist/types/BooleanType.d.ts +2 -1
  274. package/dist/types/BooleanType.js +8 -2
  275. package/dist/types/BooleanType.js.map +1 -1
  276. package/dist/types/BscType.d.ts +10 -6
  277. package/dist/types/BscType.js +69 -16
  278. package/dist/types/BscType.js.map +1 -1
  279. package/dist/types/BscTypeKind.d.ts +3 -0
  280. package/dist/types/BscTypeKind.js +3 -0
  281. package/dist/types/BscTypeKind.js.map +1 -1
  282. package/dist/types/BuiltInInterfaceAdder.d.ts +23 -0
  283. package/dist/types/BuiltInInterfaceAdder.js +157 -0
  284. package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
  285. package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
  286. package/dist/types/BuiltInInterfaceAdder.spec.js +116 -0
  287. package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
  288. package/dist/types/ClassType.d.ts +10 -4
  289. package/dist/types/ClassType.js +32 -5
  290. package/dist/types/ClassType.js.map +1 -1
  291. package/dist/types/ClassType.spec.js +5 -3
  292. package/dist/types/ClassType.spec.js.map +1 -1
  293. package/dist/types/ComponentType.d.ts +26 -0
  294. package/dist/types/ComponentType.js +83 -0
  295. package/dist/types/ComponentType.js.map +1 -0
  296. package/dist/types/DoubleType.d.ts +2 -1
  297. package/dist/types/DoubleType.js +9 -2
  298. package/dist/types/DoubleType.js.map +1 -1
  299. package/dist/types/DynamicType.d.ts +2 -2
  300. package/dist/types/DynamicType.js +3 -1
  301. package/dist/types/DynamicType.js.map +1 -1
  302. package/dist/types/EnumType.d.ts +24 -6
  303. package/dist/types/EnumType.js +29 -7
  304. package/dist/types/EnumType.js.map +1 -1
  305. package/dist/types/FloatType.d.ts +2 -1
  306. package/dist/types/FloatType.js +9 -2
  307. package/dist/types/FloatType.js.map +1 -1
  308. package/dist/types/FunctionType.d.ts +8 -20
  309. package/dist/types/FunctionType.js +17 -45
  310. package/dist/types/FunctionType.js.map +1 -1
  311. package/dist/types/InheritableType.d.ts +7 -4
  312. package/dist/types/InheritableType.js +67 -3
  313. package/dist/types/InheritableType.js.map +1 -1
  314. package/dist/types/IntegerType.d.ts +2 -1
  315. package/dist/types/IntegerType.js +9 -2
  316. package/dist/types/IntegerType.js.map +1 -1
  317. package/dist/types/InterfaceType.d.ts +6 -4
  318. package/dist/types/InterfaceType.js +8 -11
  319. package/dist/types/InterfaceType.js.map +1 -1
  320. package/dist/types/InterfaceType.spec.js +30 -2
  321. package/dist/types/InterfaceType.spec.js.map +1 -1
  322. package/dist/types/InvalidType.d.ts +2 -1
  323. package/dist/types/InvalidType.js +7 -1
  324. package/dist/types/InvalidType.js.map +1 -1
  325. package/dist/types/LongIntegerType.d.ts +2 -1
  326. package/dist/types/LongIntegerType.js +9 -2
  327. package/dist/types/LongIntegerType.js.map +1 -1
  328. package/dist/types/NamespaceType.d.ts +2 -1
  329. package/dist/types/NamespaceType.js +3 -0
  330. package/dist/types/NamespaceType.js.map +1 -1
  331. package/dist/types/ObjectType.d.ts +2 -2
  332. package/dist/types/ObjectType.js +5 -10
  333. package/dist/types/ObjectType.js.map +1 -1
  334. package/dist/types/ReferenceType.d.ts +15 -3
  335. package/dist/types/ReferenceType.js +173 -24
  336. package/dist/types/ReferenceType.js.map +1 -1
  337. package/dist/types/ReferenceType.spec.js +21 -6
  338. package/dist/types/ReferenceType.spec.js.map +1 -1
  339. package/dist/types/StringType.d.ts +2 -1
  340. package/dist/types/StringType.js +9 -2
  341. package/dist/types/StringType.js.map +1 -1
  342. package/dist/types/TypedFunctionType.d.ts +33 -0
  343. package/dist/types/TypedFunctionType.js +106 -0
  344. package/dist/types/TypedFunctionType.js.map +1 -0
  345. package/dist/types/TypedFunctionType.spec.d.ts +1 -0
  346. package/dist/types/TypedFunctionType.spec.js +122 -0
  347. package/dist/types/TypedFunctionType.spec.js.map +1 -0
  348. package/dist/types/UninitializedType.d.ts +2 -1
  349. package/dist/types/UninitializedType.js +1 -1
  350. package/dist/types/UninitializedType.js.map +1 -1
  351. package/dist/types/UnionType.d.ts +4 -2
  352. package/dist/types/UnionType.js +36 -4
  353. package/dist/types/UnionType.js.map +1 -1
  354. package/dist/types/UnionType.spec.js +46 -19
  355. package/dist/types/UnionType.spec.js.map +1 -1
  356. package/dist/types/VoidType.d.ts +2 -1
  357. package/dist/types/VoidType.js +7 -2
  358. package/dist/types/VoidType.js.map +1 -1
  359. package/dist/types/helper.spec.js +15 -0
  360. package/dist/types/helper.spec.js.map +1 -1
  361. package/dist/types/helpers.d.ts +5 -0
  362. package/dist/types/helpers.js +50 -3
  363. package/dist/types/helpers.js.map +1 -1
  364. package/dist/types/index.d.ts +1 -1
  365. package/dist/types/index.js +1 -1
  366. package/dist/types/index.js.map +1 -1
  367. package/dist/util.d.ts +71 -15
  368. package/dist/util.js +578 -150
  369. package/dist/util.js.map +1 -1
  370. package/dist/validators/ClassValidator.d.ts +0 -1
  371. package/dist/validators/ClassValidator.js +0 -22
  372. package/dist/validators/ClassValidator.js.map +1 -1
  373. package/package.json +3 -2
  374. package/dist/astUtils/AstEditor.js.map +0 -1
  375. package/dist/astUtils/AstEditor.spec.js.map +0 -1
  376. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +0 -1
  377. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +0 -31
  378. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +0 -1
  379. package/dist/types/FunctionType.spec.js +0 -23
  380. package/dist/types/FunctionType.spec.js.map +0 -1
  381. /package/dist/astUtils/{AstEditor.spec.d.ts → Editor.spec.d.ts} +0 -0
  382. /package/dist/bscPlugin/{transpile/BrsFilePreTranspileProcessor.spec.d.ts → completions/CompletionsProcessor.spec.d.ts} +0 -0
  383. /package/dist/{types/FunctionType.spec.d.ts → bscPlugin/serialize/BslibInjector.spec.d.ts} +0 -0
@@ -1,36 +1,50 @@
1
+ /// <reference types="node" />
1
2
  import type { Range, Diagnostic, CodeAction, SemanticTokenTypes, SemanticTokenModifiers, Position, CompletionItem } from 'vscode-languageserver';
2
3
  import type { Scope } from './Scope';
3
4
  import type { BrsFile } from './files/BrsFile';
4
5
  import type { XmlFile } from './files/XmlFile';
5
6
  import type { FunctionScope } from './FunctionScope';
6
- import type { FunctionType } from './types/FunctionType';
7
+ import type { TypedFunctionType } from './types/TypedFunctionType';
7
8
  import type { ParseMode } from './parser/Parser';
8
- import type { Program, SourceObj, TranspileObj } from './Program';
9
+ import type { Program } from './Program';
9
10
  import type { ProgramBuilder } from './ProgramBuilder';
10
- import type { FunctionStatement } from './parser/Statement';
11
- import type { Expression } from './parser/AstNode';
11
+ import type { ClassStatement, ConstStatement, EnumStatement, FunctionStatement, NamespaceStatement } from './parser/Statement';
12
+ import type { AstNode, Expression, Statement } from './parser/AstNode';
12
13
  import type { TranspileState } from './parser/TranspileState';
13
- import type { SourceMapGenerator, SourceNode } from 'source-map';
14
+ import type { SourceNode } from 'source-map';
14
15
  import type { BscType } from './types/BscType';
15
- import type { AstEditor } from './astUtils/AstEditor';
16
- import type { Token } from './lexer/Token';
17
- import type { SymbolTypeFlag } from './SymbolTable';
16
+ import type { Editor } from './astUtils/Editor';
17
+ import type { Identifier, Token } from './lexer/Token';
18
+ import type { File } from './files/File';
19
+ import type { FileFactory } from './files/Factory';
20
+ import type { LazyFileData } from './files/LazyFileData';
21
+ import type { SymbolTable, SymbolTypeFlag } from './SymbolTable';
22
+ import type { CallExpression } from './parser/Expression';
18
23
  export interface BsDiagnostic extends Diagnostic {
19
- file: BscFile;
24
+ file: File;
20
25
  /**
21
26
  * A generic data container where additional details of the diagnostic can be stored. These are stripped out before being sent to a languageclient, and not printed to the console.
22
27
  */
23
28
  data?: any;
24
29
  }
25
- export declare type BscFile = BrsFile | XmlFile;
30
+ export declare enum DiagnosticOrigin {
31
+ Program = "Program",
32
+ Scope = "Scope",
33
+ File = "File",
34
+ ASTSegment = "AstSegment"
35
+ }
36
+ export interface BsDiagnosticWithOrigin extends BsDiagnostic {
37
+ origin: DiagnosticOrigin;
38
+ astSegment?: AstNode;
39
+ }
26
40
  export interface Callable {
27
- file: BscFile;
41
+ file: File;
28
42
  name: string;
29
43
  /**
30
44
  * Is the callable declared as "sub". If falsey, assumed declared as "function"
31
45
  */
32
46
  isSub: boolean;
33
- type: FunctionType;
47
+ type: TypedFunctionType;
34
48
  /**
35
49
  * A short description of the callable. Should be a short sentence.
36
50
  */
@@ -64,6 +78,7 @@ export interface FunctionCall {
64
78
  * The full range of this function call (from the start of the function name to its closing paren)
65
79
  */
66
80
  range: Range;
81
+ expression: CallExpression;
67
82
  functionScope: FunctionScope;
68
83
  file: File;
69
84
  name: string;
@@ -101,12 +116,12 @@ export interface FileObj {
101
116
  */
102
117
  export interface FileReference {
103
118
  /**
104
- * The pkgPath to the referenced file.
119
+ * The destPath for the referenced file.
105
120
  */
106
- pkgPath: string;
121
+ destPath: string;
107
122
  text: string;
108
123
  /**
109
- * The file that is doing the import. Note this is NOT the file the pkgPath points to.
124
+ * The file that is doing the import. Note this is NOT the file the destPath points to.
110
125
  */
111
126
  sourceFile: XmlFile | BrsFile;
112
127
  /**
@@ -117,14 +132,6 @@ export interface FileReference {
117
132
  */
118
133
  filePathRange?: Range;
119
134
  }
120
- export interface File {
121
- /**
122
- * The absolute path to the file, relative to the pkg
123
- */
124
- pkgPath: string;
125
- srcPath: string;
126
- getDiagnostics(): BsDiagnostic[];
127
- }
128
135
  export interface VariableDeclaration {
129
136
  name: string;
130
137
  getType: () => BscType;
@@ -158,7 +165,7 @@ export interface CallableContainer {
158
165
  }
159
166
  export declare type CallableContainerMap = Map<string, CallableContainer[]>;
160
167
  export interface CommentFlag {
161
- file: BscFile;
168
+ file: File;
162
169
  /**
163
170
  * The location of the ignore comment.
164
171
  */
@@ -169,21 +176,45 @@ export interface CommentFlag {
169
176
  affectedRange: Range;
170
177
  codes: DiagnosticCode[] | null;
171
178
  }
172
- declare type ValidateHandler = (scope: Scope, files: BscFile[], callables: CallableContainerMap) => void;
173
179
  export declare type CompilerPluginFactory = () => CompilerPlugin;
174
180
  export interface CompilerPlugin {
175
181
  name: string;
176
- beforeProgramCreate?: (builder: ProgramBuilder) => void;
177
- beforePrepublish?: (builder: ProgramBuilder, files: FileObj[]) => void;
178
- afterPrepublish?: (builder: ProgramBuilder, files: FileObj[]) => void;
179
- beforePublish?: (builder: ProgramBuilder, files: FileObj[]) => void;
180
- afterPublish?: (builder: ProgramBuilder, files: FileObj[]) => void;
181
- afterProgramCreate?: (program: Program) => void;
182
- beforeProgramValidate?: (program: Program) => void;
183
- afterProgramValidate?: (program: Program) => void;
184
- beforeProgramTranspile?: (program: Program, entries: TranspileObj[], editor: AstEditor) => void;
185
- afterProgramTranspile?: (program: Program, entries: TranspileObj[], editor: AstEditor) => void;
186
- onGetCodeActions?: PluginHandler<OnGetCodeActionsEvent>;
182
+ /**
183
+ * Called before a new program is created
184
+ */
185
+ beforeProgramCreate?: PluginHandler<BeforeProgramCreateEvent>;
186
+ /**
187
+ * Called after a new program is created
188
+ */
189
+ afterProgramCreate?: PluginHandler<AfterProgramCreateEvent>;
190
+ /**
191
+ * Called before the program gets prepared for building
192
+ */
193
+ beforePrepareProgram?: PluginHandler<BeforePrepareProgramEvent>;
194
+ /**
195
+ * Called when the program gets prepared for building
196
+ */
197
+ prepareProgram?: PluginHandler<PrepareProgramEvent>;
198
+ /**
199
+ * Called after the program gets prepared for building
200
+ */
201
+ afterPrepareProgram?: PluginHandler<AfterPrepareProgramEvent>;
202
+ /**
203
+ * Called before the entire program is validated
204
+ */
205
+ beforeProgramValidate?: PluginHandler<BeforeProgramValidateEvent>;
206
+ /**
207
+ * Called before the entire program is validated
208
+ */
209
+ onProgramValidate?: PluginHandler<OnProgramValidateEvent>;
210
+ /**
211
+ * Called after the program has been validated
212
+ */
213
+ afterProgramValidate?: PluginHandler<AfterProgramValidateEvent>;
214
+ /**
215
+ * Called right before the program is disposed/destroyed
216
+ */
217
+ beforeProgramDispose?: PluginHandler<BeforeProgramDisposeEvent>;
187
218
  /**
188
219
  * Emitted before the program starts collecting completions
189
220
  */
@@ -208,15 +239,49 @@ export interface CompilerPlugin {
208
239
  * Called after the `provideHover` hook. Use this if you want to intercept or sanitize the hover data (even from other plugins) before it gets sent to the client.
209
240
  */
210
241
  afterProvideHover?: PluginHandler<AfterProvideHoverEvent>;
211
- onGetSemanticTokens?: PluginHandler<OnGetSemanticTokensEvent>;
212
- afterScopeCreate?: (scope: Scope) => void;
213
- beforeScopeDispose?: (scope: Scope) => void;
214
- afterScopeDispose?: (scope: Scope) => void;
215
- beforeScopeValidate?: ValidateHandler;
242
+ /**
243
+ * Called after a scope was created
244
+ */
245
+ afterScopeCreate?: PluginHandler<AfterScopeCreateEvent>;
246
+ beforeScopeDispose?: PluginHandler<BeforeScopeDisposeEvent>;
247
+ onScopeDispose?: PluginHandler<OnScopeDisposeEvent>;
248
+ afterScopeDispose?: PluginHandler<AfterScopeDisposeEvent>;
249
+ beforeScopeValidate?: PluginHandler<BeforeScopeValidateEvent>;
216
250
  onScopeValidate?: PluginHandler<OnScopeValidateEvent>;
217
- afterScopeValidate?: ValidateHandler;
218
- beforeFileParse?: (source: SourceObj) => void;
219
- afterFileParse?: (file: BscFile) => void;
251
+ afterScopeValidate?: PluginHandler<BeforeScopeValidateEvent>;
252
+ onGetCodeActions?: PluginHandler<OnGetCodeActionsEvent>;
253
+ onGetSemanticTokens?: PluginHandler<OnGetSemanticTokensEvent>;
254
+ /**
255
+ * Called before plugins are asked to provide files to the program. (excludes virtual files produced by `provideFile` events).
256
+ * Call the `setFileData()` method to override the file contents.
257
+ */
258
+ beforeProvideFile?: PluginHandler<BeforeProvideFileEvent>;
259
+ /**
260
+ * Give plugins the opportunity to handle processing a file. (excludes virtual files produced by `provideFile` events)
261
+ */
262
+ provideFile?: PluginHandler<ProvideFileEvent>;
263
+ /**
264
+ * Called after a file was added to the program. (excludes virtual files produced by `provideFile` events)
265
+ */
266
+ afterProvideFile?: PluginHandler<AfterProvideFileEvent>;
267
+ /**
268
+ * Called before a file is added to the program.
269
+ * Includes physical files as well as any virtual files produced by `provideFile` events
270
+ */
271
+ beforeFileAdd?: PluginHandler<BeforeFileAddEvent>;
272
+ /**
273
+ * Called after a file has been added to the program.
274
+ * Includes physical files as well as any virtual files produced by `provideFile` events
275
+ */
276
+ afterFileAdd?: PluginHandler<AfterFileAddEvent>;
277
+ /**
278
+ * Called before a file is removed from the program. This includes physical and virtual files
279
+ */
280
+ beforeFileRemove?: PluginHandler<BeforeFileRemoveEvent>;
281
+ /**
282
+ * Called after a file has been removed from the program. This includes physical and virtual files
283
+ */
284
+ afterFileRemove?: PluginHandler<AfterFileRemoveEvent>;
220
285
  /**
221
286
  * Called before each file is validated
222
287
  */
@@ -228,33 +293,112 @@ export interface CompilerPlugin {
228
293
  /**
229
294
  * Called after each file is validated
230
295
  */
231
- afterFileValidate?: (file: BscFile) => void;
232
- beforeFileTranspile?: PluginHandler<BeforeFileTranspileEvent>;
233
- afterFileTranspile?: PluginHandler<AfterFileTranspileEvent>;
234
- beforeFileDispose?: (file: BscFile) => void;
235
- afterFileDispose?: (file: BscFile) => void;
296
+ afterFileValidate?: PluginHandler<AfterFileValidateEvent>;
297
+ /**
298
+ * Called right before the program builds (i.e. generates the code and puts it in the stagingDir
299
+ */
300
+ beforeBuildProgram?: PluginHandler<BeforeBuildProgramEvent>;
301
+ /**
302
+ * Called right after the program builds (i.e. generates the code and puts it in the stagingDir
303
+ */
304
+ afterBuildProgram?: PluginHandler<AfterBuildProgramEvent>;
305
+ /**
306
+ * Before preparing the file for building
307
+ */
308
+ beforePrepareFile?: PluginHandler<BeforePrepareFileEvent>;
309
+ /**
310
+ * Prepare the file for building
311
+ */
312
+ prepareFile?: PluginHandler<PrepareFileEvent>;
313
+ /**
314
+ * After preparing the file for building
315
+ */
316
+ afterPrepareFile?: PluginHandler<AfterPrepareFileEvent>;
317
+ /**
318
+ * Before the program turns all file objects into their final buffers
319
+ */
320
+ beforeSerializeProgram?: PluginHandler<BeforeSerializeProgramEvent>;
321
+ /**
322
+ * Emitted right at the start of the program turning all file objects into their final buffers
323
+ */
324
+ onSerializeProgram?: PluginHandler<OnSerializeProgramEvent>;
325
+ /**
326
+ * After the program turns all file objects into their final buffers
327
+ */
328
+ afterSerializeProgram?: PluginHandler<AfterSerializeProgramEvent>;
329
+ /**
330
+ * Before turning the file into its final contents
331
+ */
332
+ beforeSerializeFile?: PluginHandler<BeforeSerializeFileEvent>;
333
+ /**
334
+ * Turn the file into its final contents (i.e. transpile a bs file, compress a jpeg, etc)
335
+ */
336
+ serializeFile?: PluginHandler<SerializeFileEvent>;
337
+ /**
338
+ * After turning the file into its final contents
339
+ */
340
+ afterSerializeFile?: PluginHandler<AfterSerializeFileEvent>;
341
+ /**
342
+ * Called before any files are written
343
+ */
344
+ beforeWriteProgram?: PluginHandler<BeforeWriteProgramEvent>;
345
+ /**
346
+ * Called after all files are written
347
+ */
348
+ afterWriteProgram?: PluginHandler<AfterWriteProgramEvent>;
349
+ /**
350
+ * Before a file is written to disk. These are raw files that contain the final output. One `File` may produce several of these
351
+ */
352
+ beforeWriteFile?: PluginHandler<BeforeWriteFileEvent>;
353
+ /**
354
+ * Called when a file should be persisted (usually writing to storage). These are raw files that contain the final output. One `File` may produce several of these.
355
+ * When a plugin has handled a file, it should be pushed to the `handledFiles` set so future plugins don't write the file multiple times
356
+ */
357
+ writeFile?: PluginHandler<WriteFileEvent>;
358
+ /**
359
+ * Before a file is written to disk. These are raw files that contain the final output. One `File` may produce several of these
360
+ */
361
+ afterWriteFile?: PluginHandler<AfterWriteFileEvent>;
236
362
  }
237
363
  export declare type PluginHandler<T, R = void> = (event: T) => R;
238
- export interface OnGetCodeActionsEvent {
364
+ export interface OnGetCodeActionsEvent<TFile extends File = File> {
239
365
  program: Program;
240
- file: BscFile;
366
+ file: TFile;
241
367
  range: Range;
242
368
  scopes: Scope[];
243
369
  diagnostics: BsDiagnostic[];
244
370
  codeActions: CodeAction[];
245
371
  }
246
- export interface ProvideCompletionsEvent<TFile extends BscFile = BscFile> {
372
+ export interface BeforeProgramCreateEvent {
373
+ builder: ProgramBuilder;
374
+ }
375
+ export interface AfterProgramCreateEvent {
376
+ builder: ProgramBuilder;
377
+ program: Program;
378
+ }
379
+ export interface BeforeProgramValidateEvent {
380
+ program: Program;
381
+ }
382
+ export declare type OnProgramValidateEvent = BeforeProgramValidateEvent;
383
+ export declare type AfterProgramValidateEvent = BeforeProgramValidateEvent;
384
+ export interface ProvideCompletionsEvent<TFile extends File = File> {
247
385
  program: Program;
248
386
  file: TFile;
249
387
  scopes: Scope[];
250
388
  position: Position;
251
389
  completions: CompletionItem[];
252
390
  }
253
- export declare type BeforeProvideCompletionsEvent<TFile extends BscFile = BscFile> = ProvideCompletionsEvent<TFile>;
254
- export declare type AfterProvideCompletionsEvent<TFile extends BscFile = BscFile> = ProvideCompletionsEvent<TFile>;
391
+ export declare type BeforeProvideCompletionsEvent<TFile extends File = File> = ProvideCompletionsEvent<TFile>;
392
+ export declare type AfterProvideCompletionsEvent<TFile extends File = File> = ProvideCompletionsEvent<TFile>;
393
+ export interface BeforeBuildProgramEvent {
394
+ program: Program;
395
+ files: File[];
396
+ editor: Editor;
397
+ }
398
+ export declare type AfterBuildProgramEvent = BeforeBuildProgramEvent;
255
399
  export interface ProvideHoverEvent {
256
400
  program: Program;
257
- file: BscFile;
401
+ file: File;
258
402
  position: Position;
259
403
  scopes: Scope[];
260
404
  hovers: Hover[];
@@ -276,7 +420,42 @@ export interface Hover {
276
420
  }
277
421
  export declare type BeforeProvideHoverEvent = ProvideHoverEvent;
278
422
  export declare type AfterProvideHoverEvent = ProvideHoverEvent;
279
- export interface OnGetSemanticTokensEvent<T extends BscFile = BscFile> {
423
+ export interface AfterScopeCreateEvent {
424
+ program: Program;
425
+ scope: Scope;
426
+ }
427
+ export interface BeforeScopeDisposeEvent {
428
+ program: Program;
429
+ scope: Scope;
430
+ }
431
+ export interface OnScopeDisposeEvent {
432
+ program: Program;
433
+ scope: Scope;
434
+ }
435
+ export interface AfterScopeDisposeEvent {
436
+ program: Program;
437
+ scope: Scope;
438
+ }
439
+ export interface BeforeScopeValidateEvent {
440
+ program: Program;
441
+ scope: Scope;
442
+ }
443
+ export declare type AfterScopeValidateEvent = BeforeScopeValidateEvent;
444
+ export interface BeforeFileParseEvent {
445
+ program: Program;
446
+ srcPath: string;
447
+ source: string;
448
+ }
449
+ export interface OnFileParseEvent {
450
+ program: Program;
451
+ srcPath: string;
452
+ source: string;
453
+ }
454
+ export interface AfterFileParseEvent {
455
+ program: Program;
456
+ file: File;
457
+ }
458
+ export interface OnGetSemanticTokensEvent<T extends File = File> {
280
459
  /**
281
460
  * The program this file is from
282
461
  */
@@ -294,31 +473,32 @@ export interface OnGetSemanticTokensEvent<T extends BscFile = BscFile> {
294
473
  */
295
474
  semanticTokens: SemanticToken[];
296
475
  }
297
- export interface BeforeFileValidateEvent<T extends BscFile = BscFile> {
476
+ export declare type BeforeFileValidateEvent = OnFileValidateEvent;
477
+ export interface OnFileValidateEvent<T extends File = File> {
298
478
  program: Program;
299
479
  file: T;
300
480
  }
301
- export interface OnFileValidateEvent<T extends BscFile = BscFile> {
481
+ export declare type AfterFileValidateEvent = OnFileValidateEvent;
482
+ export interface OnFileValidateEvent<T extends File = File> {
302
483
  program: Program;
303
484
  file: T;
304
485
  }
486
+ export interface TranspileEntry {
487
+ file: File;
488
+ outputPath: string;
489
+ }
490
+ export interface ScopeValidationOptions {
491
+ changedFiles?: File[];
492
+ changedSymbols?: Map<SymbolTypeFlag, Set<string>>;
493
+ force?: boolean;
494
+ }
305
495
  export interface OnScopeValidateEvent {
306
496
  program: Program;
307
497
  scope: Scope;
498
+ changedFiles?: File[];
499
+ changedSymbols?: Map<SymbolTypeFlag, Set<string>>;
308
500
  }
309
- export declare type Editor = Pick<AstEditor, 'addToArray' | 'hasChanges' | 'removeFromArray' | 'setArrayValue' | 'setProperty' | 'overrideTranspileResult' | 'arrayPop' | 'arrayPush' | 'arrayShift' | 'arraySplice' | 'arrayUnshift' | 'removeProperty' | 'edit'>;
310
- export interface BeforeFileTranspileEvent<TFile extends BscFile = BscFile> {
311
- program: Program;
312
- file: TFile;
313
- outputPath: string;
314
- /**
315
- * An editor that can be used to transform properties or arrays. Once the `afterFileTranspile` event has fired, these changes will be reverted,
316
- * restoring the objects to their prior state. This is useful for changing code right before a file gets transpiled, but when you don't want
317
- * the changes to persist in the in-memory file.
318
- */
319
- editor: Editor;
320
- }
321
- export interface AfterFileTranspileEvent<TFile extends BscFile = BscFile> {
501
+ export interface AfterFileTranspileEvent<TFile extends File = File> {
322
502
  /**
323
503
  * The program this event was triggered for
324
504
  */
@@ -332,18 +512,150 @@ export interface AfterFileTranspileEvent<TFile extends BscFile = BscFile> {
332
512
  /**
333
513
  * The sourceMaps for the generated code (if emitting source maps is enabled)
334
514
  */
335
- map?: SourceMapGenerator;
515
+ map?: string;
336
516
  /**
337
517
  * The generated type definition file contents (if emitting type definitions are enabled)
338
518
  */
339
519
  typedef?: string;
520
+ }
521
+ export declare type BeforeProvideFileEvent<TFile extends File = File> = ProvideFileEvent<TFile>;
522
+ export interface ProvideFileEvent<TFile extends File = File> {
523
+ /**
524
+ * The lower-case file extension for the srcPath. (i.e. ".brs", ".xml")
525
+ */
526
+ srcExtension: string;
340
527
  /**
341
- * An editor that can be used to transform properties or arrays. Once the `afterFileTranspile` event has fired, these changes will be reverted,
342
- * restoring the objects to their prior state. This is useful for changing code right before a file gets transpiled, but when you don't want
343
- * the changes to persist in the in-memory file.
528
+ * The srcPath for the file. (i.e. `/user/bob/projects/VideoApp/source/main.bs`)
344
529
  */
530
+ srcPath: string;
531
+ /**
532
+ * The destPath for the file. (i.e. for `/user/bob/projects/VideoApp/source/main.bs`, destPath would be `source/main.bs`)
533
+ */
534
+ destPath: string;
535
+ /**
536
+ * A lazy-loading container for this file's data. Call `.get()` to lazy load the data, and `.set()` to override file contents
537
+ */
538
+ data: LazyFileData;
539
+ /**
540
+ * An array of files that should be added to the program as a result of this event
541
+ */
542
+ files: TFile[];
543
+ /**
544
+ * The program for this event
545
+ */
546
+ program: Program;
547
+ /**
548
+ * A factory used to create new instances of the BrighterScript built-in file types. This mitigates the issue
549
+ * of a plugin's version of a File not being the same as the LanguageServer or CLI version of BrighterScript
550
+ * (due to npm installing multiple versions of brighterscript)
551
+ */
552
+ fileFactory: FileFactory;
553
+ }
554
+ export declare type AfterProvideFileEvent<TFile extends File = File> = ProvideFileEvent<TFile>;
555
+ export interface BeforeFileAddEvent<TFile extends File = File> {
556
+ file: TFile;
557
+ program: Program;
558
+ }
559
+ export declare type AfterFileAddEvent<TFile extends File = File> = BeforeFileAddEvent<TFile>;
560
+ export interface BeforeFileRemoveEvent<TFile extends File = File> {
561
+ file: TFile;
562
+ program: Program;
563
+ }
564
+ export declare type AfterFileRemoveEvent<TFile extends File = File> = BeforeFileRemoveEvent<TFile>;
565
+ export declare type BeforePrepareProgramEvent = PrepareProgramEvent;
566
+ /**
567
+ * Event for when the program prepares itself for building
568
+ */
569
+ export interface PrepareProgramEvent {
570
+ program: Program;
345
571
  editor: Editor;
346
572
  }
573
+ export declare type AfterPrepareProgramEvent = PrepareProgramEvent;
574
+ export declare type BeforePrepareFileEvent<TFile extends File = File> = PrepareFileEvent<TFile>;
575
+ /**
576
+ * Prepare the file for building
577
+ */
578
+ export interface PrepareFileEvent<TFile extends File = File> {
579
+ program: Program;
580
+ file: TFile;
581
+ editor: Editor;
582
+ }
583
+ export declare type OnPrepareFileEvent<TFile extends File = File> = PrepareFileEvent<TFile>;
584
+ export declare type AfterPrepareFileEvent<TFile extends File = File> = PrepareFileEvent<TFile>;
585
+ /**
586
+ * A container that holds the code, map, and typedef for serialized code files.
587
+ */
588
+ export interface SerializedCodeFile {
589
+ code?: string;
590
+ map?: string;
591
+ typedef?: string;
592
+ }
593
+ export interface BeforeSerializeProgramEvent {
594
+ program: Program;
595
+ files: File[];
596
+ result: Map<File, SerializedFile[]>;
597
+ }
598
+ export declare type OnSerializeProgramEvent = BeforeSerializeProgramEvent;
599
+ export declare type AfterSerializeProgramEvent = BeforeSerializeProgramEvent;
600
+ /**
601
+ * During the `SerializeFile` events, this is how plugins will contribute file data for a specific file
602
+ */
603
+ export interface SerializedFile {
604
+ /**
605
+ * The raw data for this file (i.e. a binary buffer for a .jpeg file, or the transpiled code for a .bs file)
606
+ */
607
+ data: Buffer;
608
+ /**
609
+ * The pkgPath for this chunk of data.
610
+ */
611
+ pkgPath: string;
612
+ }
613
+ export declare type BeforeSerializeFileEvent<TFile extends File = File> = SerializeFileEvent<TFile>;
614
+ export interface SerializeFileEvent<TFile extends File = File> {
615
+ program: Program;
616
+ file: TFile;
617
+ /**
618
+ * The list of all files created across all the `SerializeFile` events.
619
+ * The key is the pkgPath of the file, and the
620
+ */
621
+ result: Map<TFile, SerializedFile[]>;
622
+ }
623
+ export declare type AfterSerializeFileEvent<TFile extends File = File> = SerializeFileEvent<TFile>;
624
+ export interface BeforeWriteProgramEvent {
625
+ program: Program;
626
+ stagingDir: string;
627
+ files: Map<File, SerializedFile[]>;
628
+ }
629
+ export declare type AfterWriteProgramEvent = BeforeWriteProgramEvent;
630
+ export declare type BeforeWriteFileEvent = WriteFileEvent;
631
+ export interface WriteFileEvent {
632
+ program: Program;
633
+ file: SerializedFile;
634
+ /**
635
+ * The full path to where the file was (or will be) written to.
636
+ */
637
+ outputPath: string;
638
+ /**
639
+ * A set of all files that have been properly written. Plugins should add any handled files to this list so future plugins don't write then again
640
+ */
641
+ processedFiles: Set<SerializedFile>;
642
+ }
643
+ export declare type AfterWriteFileEvent = BeforeWriteFileEvent;
644
+ export interface TranspileObj {
645
+ file: File;
646
+ /**
647
+ * The absolute path to where the file should be written during build. (i.e. somewhere inside the stagingDir)
648
+ */
649
+ outputPath: string;
650
+ }
651
+ export interface BeforeFileDisposeEvent {
652
+ program: Program;
653
+ file: File;
654
+ }
655
+ export declare type AfterFileDisposeEvent = BeforeFileDisposeEvent;
656
+ export interface BeforeProgramDisposeEvent {
657
+ program: Program;
658
+ }
347
659
  export interface SemanticToken {
348
660
  range: Range;
349
661
  tokenType: SemanticTokenTypes;
@@ -356,7 +668,7 @@ export interface TypedefProvider {
356
668
  getTypedef(state: TranspileState): Array<SourceNode | string>;
357
669
  }
358
670
  export declare type TranspileResult = Array<(string | SourceNode)>;
359
- export declare type FileResolver = (srcPath: string) => string | undefined | Thenable<string | undefined> | void;
671
+ export declare type FileResolver = (srcPath: string) => string | Buffer | undefined | Thenable<string | Buffer | undefined> | void;
360
672
  export interface ExpressionInfo {
361
673
  expressions: Expression[];
362
674
  varExpressions: Expression[];
@@ -367,22 +679,65 @@ export interface FileLink<T> {
367
679
  item: T;
368
680
  file: BrsFile;
369
681
  }
682
+ export interface ExtraSymbolData {
683
+ definingNode?: AstNode;
684
+ description?: string;
685
+ completionPriority?: number;
686
+ flags?: SymbolTypeFlag;
687
+ }
370
688
  export interface GetTypeOptions {
371
689
  flags: SymbolTypeFlag;
372
690
  typeChain?: TypeChainEntry[];
691
+ data?: ExtraSymbolData;
692
+ ignoreCall?: boolean;
693
+ onlyCacheResolvedTypes?: boolean;
694
+ ignoreCacheForRetrieval?: boolean;
373
695
  }
374
696
  export declare class TypeChainEntry {
375
697
  name: string;
376
698
  type: BscType;
699
+ flags: SymbolTypeFlag;
377
700
  range: Range;
378
- constructor(name: string, type: BscType, range: Range);
701
+ separatorToken: Token;
702
+ constructor(name: string, type: BscType, flags: SymbolTypeFlag, range: Range, separatorToken?: Token);
379
703
  get isResolved(): boolean;
380
704
  }
381
705
  export interface TypeChainProcessResult {
382
- missingItemName: string;
383
- missingItemParentTypeName: string;
384
- fullNameOfMissingItem: string;
706
+ itemName: string;
707
+ itemParentTypeName: string;
708
+ fullNameOfItem: string;
385
709
  fullChainName: string;
386
710
  range: Range;
711
+ containsDynamic: boolean;
712
+ }
713
+ export interface TypeCompatibilityData {
714
+ missingFields?: {
715
+ name: string;
716
+ expectedType: BscType;
717
+ }[];
718
+ fieldMismatches?: {
719
+ name: string;
720
+ expectedType: BscType;
721
+ actualType: BscType;
722
+ }[];
723
+ depth?: number;
724
+ }
725
+ export interface NamespaceContainer {
726
+ file: File;
727
+ fullName: string;
728
+ fullNameLower: string;
729
+ parentNameLower: string;
730
+ nameParts: Identifier[];
731
+ nameRange: Range;
732
+ lastPartName: string;
733
+ lastPartNameLower: string;
734
+ functionStatements: Map<string, FunctionStatement>;
735
+ isTopLevel: boolean;
736
+ namespaceStatements?: NamespaceStatement[];
737
+ statements?: Statement[];
738
+ classStatements?: Map<string, ClassStatement>;
739
+ enumStatements?: Map<string, EnumStatement>;
740
+ constStatements?: Map<string, ConstStatement>;
741
+ namespaces?: Map<string, NamespaceContainer>;
742
+ symbolTable: SymbolTable;
387
743
  }
388
- export {};