brighterscript 1.0.0-alpha.3 → 1.0.0-alpha.31

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 (608) hide show
  1. package/CHANGELOG.md +1249 -285
  2. package/README.md +61 -131
  3. package/bsconfig.schema.json +68 -2
  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 +42 -0
  8. package/dist/AstValidationSegmenter.js +232 -0
  9. package/dist/AstValidationSegmenter.js.map +1 -0
  10. package/dist/BsConfig.d.ts +51 -6
  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.d.ts +5 -6
  15. package/dist/Cache.js +12 -11
  16. package/dist/Cache.js.map +1 -1
  17. package/dist/CacheVerifier.d.ts +7 -0
  18. package/dist/CacheVerifier.js +20 -0
  19. package/dist/CacheVerifier.js.map +1 -0
  20. package/dist/CodeActionUtil.d.ts +11 -2
  21. package/dist/CodeActionUtil.js +17 -3
  22. package/dist/CodeActionUtil.js.map +1 -1
  23. package/dist/CommentFlagProcessor.d.ts +7 -6
  24. package/dist/CommentFlagProcessor.js +10 -7
  25. package/dist/CommentFlagProcessor.js.map +1 -1
  26. package/dist/CrossScopeValidator.d.ts +67 -0
  27. package/dist/CrossScopeValidator.js +625 -0
  28. package/dist/CrossScopeValidator.js.map +1 -0
  29. package/dist/DependencyGraph.d.ts +8 -3
  30. package/dist/DependencyGraph.js +49 -16
  31. package/dist/DependencyGraph.js.map +1 -1
  32. package/dist/DiagnosticCollection.d.ts +5 -3
  33. package/dist/DiagnosticCollection.js +18 -16
  34. package/dist/DiagnosticCollection.js.map +1 -1
  35. package/dist/DiagnosticFilterer.d.ts +8 -4
  36. package/dist/DiagnosticFilterer.js +77 -44
  37. package/dist/DiagnosticFilterer.js.map +1 -1
  38. package/dist/DiagnosticManager.d.ts +56 -0
  39. package/dist/DiagnosticManager.js +218 -0
  40. package/dist/DiagnosticManager.js.map +1 -0
  41. package/dist/DiagnosticMessages.d.ts +187 -20
  42. package/dist/DiagnosticMessages.js +247 -29
  43. package/dist/DiagnosticMessages.js.map +1 -1
  44. package/dist/DiagnosticSeverityAdjuster.d.ts +7 -0
  45. package/dist/DiagnosticSeverityAdjuster.js +41 -0
  46. package/dist/DiagnosticSeverityAdjuster.js.map +1 -0
  47. package/dist/FunctionScope.d.ts +28 -0
  48. package/dist/FunctionScope.js +52 -0
  49. package/dist/FunctionScope.js.map +1 -0
  50. package/dist/KeyedThrottler.d.ts +3 -3
  51. package/dist/KeyedThrottler.js +3 -3
  52. package/dist/KeyedThrottler.js.map +1 -1
  53. package/dist/LanguageServer.d.ts +72 -47
  54. package/dist/LanguageServer.js +544 -312
  55. package/dist/LanguageServer.js.map +1 -1
  56. package/dist/Logger.d.ts +9 -10
  57. package/dist/Logger.js +36 -30
  58. package/dist/Logger.js.map +1 -1
  59. package/dist/PluginInterface.d.ts +29 -7
  60. package/dist/PluginInterface.js +90 -7
  61. package/dist/PluginInterface.js.map +1 -1
  62. package/dist/Program.d.ts +199 -100
  63. package/dist/Program.js +1056 -700
  64. package/dist/Program.js.map +1 -1
  65. package/dist/ProgramBuilder.d.ts +29 -18
  66. package/dist/ProgramBuilder.js +170 -132
  67. package/dist/ProgramBuilder.js.map +1 -1
  68. package/dist/Scope.d.ts +144 -109
  69. package/dist/Scope.js +533 -552
  70. package/dist/Scope.js.map +1 -1
  71. package/dist/SemanticTokenUtils.d.ts +14 -0
  72. package/dist/SemanticTokenUtils.js +85 -0
  73. package/dist/SemanticTokenUtils.js.map +1 -0
  74. package/dist/Stopwatch.d.ts +4 -0
  75. package/dist/Stopwatch.js +8 -1
  76. package/dist/Stopwatch.js.map +1 -1
  77. package/dist/SymbolTable.d.ts +91 -24
  78. package/dist/SymbolTable.js +290 -64
  79. package/dist/SymbolTable.js.map +1 -1
  80. package/dist/SymbolTypeFlag.d.ts +9 -0
  81. package/dist/SymbolTypeFlag.js +14 -0
  82. package/dist/SymbolTypeFlag.js.map +1 -0
  83. package/dist/Throttler.d.ts +12 -0
  84. package/dist/Throttler.js +39 -0
  85. package/dist/Throttler.js.map +1 -1
  86. package/dist/Watcher.d.ts +0 -3
  87. package/dist/Watcher.js +0 -3
  88. package/dist/Watcher.js.map +1 -1
  89. package/dist/XmlScope.d.ts +5 -15
  90. package/dist/XmlScope.js +35 -87
  91. package/dist/XmlScope.js.map +1 -1
  92. package/dist/astUtils/CachedLookups.d.ts +50 -0
  93. package/dist/astUtils/CachedLookups.js +331 -0
  94. package/dist/astUtils/CachedLookups.js.map +1 -0
  95. package/dist/astUtils/Editor.d.ts +69 -0
  96. package/dist/astUtils/Editor.js +245 -0
  97. package/dist/astUtils/Editor.js.map +1 -0
  98. package/dist/astUtils/Editor.spec.js +258 -0
  99. package/dist/astUtils/Editor.spec.js.map +1 -0
  100. package/dist/astUtils/creators.d.ts +33 -10
  101. package/dist/astUtils/creators.js +224 -30
  102. package/dist/astUtils/creators.js.map +1 -1
  103. package/dist/astUtils/creators.spec.js +5 -5
  104. package/dist/astUtils/creators.spec.js.map +1 -1
  105. package/dist/astUtils/reflection.d.ts +146 -82
  106. package/dist/astUtils/reflection.js +308 -132
  107. package/dist/astUtils/reflection.js.map +1 -1
  108. package/dist/astUtils/reflection.spec.js +267 -162
  109. package/dist/astUtils/reflection.spec.js.map +1 -1
  110. package/dist/astUtils/stackedVisitor.js.map +1 -1
  111. package/dist/astUtils/stackedVisitor.spec.js +14 -14
  112. package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
  113. package/dist/astUtils/visitors.d.ts +115 -53
  114. package/dist/astUtils/visitors.js +70 -13
  115. package/dist/astUtils/visitors.js.map +1 -1
  116. package/dist/astUtils/visitors.spec.js +465 -51
  117. package/dist/astUtils/visitors.spec.js.map +1 -1
  118. package/dist/astUtils/xml.d.ts +9 -8
  119. package/dist/astUtils/xml.js +10 -5
  120. package/dist/astUtils/xml.js.map +1 -1
  121. package/dist/bscPlugin/BscPlugin.d.ts +22 -1
  122. package/dist/bscPlugin/BscPlugin.js +88 -0
  123. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  124. package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
  125. package/dist/bscPlugin/CallExpressionInfo.js +131 -0
  126. package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
  127. package/dist/bscPlugin/FileWriter.d.ts +6 -0
  128. package/dist/bscPlugin/FileWriter.js +24 -0
  129. package/dist/bscPlugin/FileWriter.js.map +1 -0
  130. package/dist/bscPlugin/SignatureHelpUtil.d.ts +10 -0
  131. package/dist/bscPlugin/SignatureHelpUtil.js +137 -0
  132. package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -0
  133. package/dist/bscPlugin/codeActions/CodeActionsProcessor.d.ts +1 -1
  134. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +26 -17
  135. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  136. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +94 -20
  137. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  138. package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +60 -0
  139. package/dist/bscPlugin/completions/CompletionsProcessor.js +601 -0
  140. package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -0
  141. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +2139 -0
  142. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -0
  143. package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
  144. package/dist/bscPlugin/definition/DefinitionProvider.js +210 -0
  145. package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
  146. package/dist/bscPlugin/definition/DefinitionProvider.spec.js +88 -0
  147. package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +1 -0
  148. package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
  149. package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
  150. package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
  151. package/dist/bscPlugin/hover/HoverProcessor.d.ts +18 -0
  152. package/dist/bscPlugin/hover/HoverProcessor.js +218 -0
  153. package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
  154. package/dist/bscPlugin/hover/HoverProcessor.spec.d.ts +1 -0
  155. package/dist/bscPlugin/hover/HoverProcessor.spec.js +737 -0
  156. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -0
  157. package/dist/bscPlugin/references/ReferencesProvider.d.ts +12 -0
  158. package/dist/bscPlugin/references/ReferencesProvider.js +56 -0
  159. package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -0
  160. package/dist/bscPlugin/references/ReferencesProvider.spec.d.ts +1 -0
  161. package/dist/bscPlugin/references/ReferencesProvider.spec.js +51 -0
  162. package/dist/bscPlugin/references/ReferencesProvider.spec.js.map +1 -0
  163. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +14 -0
  164. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +144 -0
  165. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
  166. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.d.ts +1 -0
  167. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +504 -0
  168. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -0
  169. package/dist/bscPlugin/serialize/BslibInjector.spec.d.ts +1 -0
  170. package/dist/bscPlugin/serialize/BslibInjector.spec.js +19 -0
  171. package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
  172. package/dist/bscPlugin/serialize/BslibManager.d.ts +9 -0
  173. package/dist/bscPlugin/serialize/BslibManager.js +40 -0
  174. package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
  175. package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
  176. package/dist/bscPlugin/serialize/FileSerializer.js +72 -0
  177. package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
  178. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.d.ts +7 -0
  179. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js +22 -0
  180. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js.map +1 -0
  181. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.d.ts +1 -0
  182. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js +291 -0
  183. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js.map +1 -0
  184. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.d.ts +7 -0
  185. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js +26 -0
  186. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js.map +1 -0
  187. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.d.ts +1 -0
  188. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js +245 -0
  189. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js.map +1 -0
  190. package/dist/bscPlugin/symbols/symbolUtils.d.ts +5 -0
  191. package/dist/bscPlugin/symbols/symbolUtils.js +140 -0
  192. package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -0
  193. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.d.ts +21 -0
  194. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +199 -0
  195. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
  196. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
  197. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +41 -0
  198. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
  199. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +12 -0
  200. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js +99 -0
  201. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -0
  202. package/dist/bscPlugin/validation/BrsFileAfterValidator.d.ts +7 -0
  203. package/dist/bscPlugin/validation/BrsFileAfterValidator.js +18 -0
  204. package/dist/bscPlugin/validation/BrsFileAfterValidator.js.map +1 -0
  205. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +34 -0
  206. package/dist/bscPlugin/validation/BrsFileValidator.js +462 -0
  207. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
  208. package/dist/bscPlugin/validation/BrsFileValidator.spec.d.ts +1 -0
  209. package/dist/bscPlugin/validation/BrsFileValidator.spec.js +758 -0
  210. package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -0
  211. package/dist/bscPlugin/validation/ProgramValidator.d.ts +11 -0
  212. package/dist/bscPlugin/validation/ProgramValidator.js +33 -0
  213. package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -0
  214. package/dist/bscPlugin/validation/ScopeValidator.d.ts +123 -0
  215. package/dist/bscPlugin/validation/ScopeValidator.js +1026 -0
  216. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
  217. package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
  218. package/dist/bscPlugin/validation/ScopeValidator.spec.js +2897 -0
  219. package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
  220. package/dist/bscPlugin/validation/XmlFileValidator.d.ts +8 -0
  221. package/dist/bscPlugin/validation/XmlFileValidator.js +44 -0
  222. package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
  223. package/dist/cli.js +117 -11
  224. package/dist/cli.js.map +1 -1
  225. package/dist/deferred.d.ts +3 -3
  226. package/dist/deferred.js.map +1 -1
  227. package/dist/diagnosticUtils.d.ts +10 -3
  228. package/dist/diagnosticUtils.js +58 -21
  229. package/dist/diagnosticUtils.js.map +1 -1
  230. package/dist/examples/plugins/removePrint.js +8 -12
  231. package/dist/examples/plugins/removePrint.js.map +1 -1
  232. package/dist/files/AssetFile.d.ts +24 -0
  233. package/dist/files/AssetFile.js +25 -0
  234. package/dist/files/AssetFile.js.map +1 -0
  235. package/dist/files/BrsFile.Class.spec.js +858 -153
  236. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  237. package/dist/files/BrsFile.d.ts +147 -82
  238. package/dist/files/BrsFile.js +853 -911
  239. package/dist/files/BrsFile.js.map +1 -1
  240. package/dist/files/BrsFile.spec.js +3056 -836
  241. package/dist/files/BrsFile.spec.js.map +1 -1
  242. package/dist/files/BscFile.d.ts +101 -0
  243. package/dist/files/BscFile.js +15 -0
  244. package/dist/files/BscFile.js.map +1 -0
  245. package/dist/files/Factory.d.ts +25 -0
  246. package/dist/files/Factory.js +22 -0
  247. package/dist/files/Factory.js.map +1 -0
  248. package/dist/files/LazyFileData.d.ts +20 -0
  249. package/dist/files/LazyFileData.js +54 -0
  250. package/dist/files/LazyFileData.js.map +1 -0
  251. package/dist/files/LazyFileData.spec.d.ts +1 -0
  252. package/dist/files/LazyFileData.spec.js +27 -0
  253. package/dist/files/LazyFileData.spec.js.map +1 -0
  254. package/dist/files/XmlFile.d.ts +73 -41
  255. package/dist/files/XmlFile.js +126 -138
  256. package/dist/files/XmlFile.js.map +1 -1
  257. package/dist/files/XmlFile.spec.js +450 -318
  258. package/dist/files/XmlFile.spec.js.map +1 -1
  259. package/dist/files/tests/imports.spec.js +62 -52
  260. package/dist/files/tests/imports.spec.js.map +1 -1
  261. package/dist/files/tests/optionalChaning.spec.d.ts +1 -0
  262. package/dist/files/tests/optionalChaning.spec.js +152 -0
  263. package/dist/files/tests/optionalChaning.spec.js.map +1 -0
  264. package/dist/globalCallables.d.ts +3 -1
  265. package/dist/globalCallables.js +416 -162
  266. package/dist/globalCallables.js.map +1 -1
  267. package/dist/index.d.ts +25 -3
  268. package/dist/index.js +42 -5
  269. package/dist/index.js.map +1 -1
  270. package/dist/interfaces.d.ts +717 -119
  271. package/dist/interfaces.js +21 -0
  272. package/dist/interfaces.js.map +1 -1
  273. package/dist/lexer/Character.spec.js +5 -5
  274. package/dist/lexer/Character.spec.js.map +1 -1
  275. package/dist/lexer/Lexer.d.ts +40 -9
  276. package/dist/lexer/Lexer.js +191 -49
  277. package/dist/lexer/Lexer.js.map +1 -1
  278. package/dist/lexer/Lexer.spec.js +775 -563
  279. package/dist/lexer/Lexer.spec.js.map +1 -1
  280. package/dist/lexer/Token.d.ts +11 -3
  281. package/dist/lexer/Token.js +10 -2
  282. package/dist/lexer/Token.js.map +1 -1
  283. package/dist/lexer/TokenKind.d.ts +27 -1
  284. package/dist/lexer/TokenKind.js +112 -5
  285. package/dist/lexer/TokenKind.js.map +1 -1
  286. package/dist/logging.d.ts +9 -0
  287. package/dist/logging.js +16 -0
  288. package/dist/logging.js.map +1 -0
  289. package/dist/parser/AstNode.d.ts +181 -0
  290. package/dist/parser/AstNode.js +246 -0
  291. package/dist/parser/AstNode.js.map +1 -0
  292. package/dist/parser/AstNode.spec.d.ts +1 -0
  293. package/dist/parser/AstNode.spec.js +165 -0
  294. package/dist/parser/AstNode.spec.js.map +1 -0
  295. package/dist/parser/BrsTranspileState.d.ts +12 -2
  296. package/dist/parser/BrsTranspileState.js +6 -0
  297. package/dist/parser/BrsTranspileState.js.map +1 -1
  298. package/dist/parser/Expression.d.ts +454 -210
  299. package/dist/parser/Expression.js +953 -498
  300. package/dist/parser/Expression.js.map +1 -1
  301. package/dist/parser/Parser.Class.spec.js +200 -95
  302. package/dist/parser/Parser.Class.spec.js.map +1 -1
  303. package/dist/parser/Parser.d.ts +106 -120
  304. package/dist/parser/Parser.js +1432 -931
  305. package/dist/parser/Parser.js.map +1 -1
  306. package/dist/parser/Parser.spec.d.ts +3 -1
  307. package/dist/parser/Parser.spec.js +1383 -456
  308. package/dist/parser/Parser.spec.js.map +1 -1
  309. package/dist/parser/SGParser.d.ts +44 -6
  310. package/dist/parser/SGParser.js +212 -185
  311. package/dist/parser/SGParser.js.map +1 -1
  312. package/dist/parser/SGParser.spec.js +30 -28
  313. package/dist/parser/SGParser.spec.js.map +1 -1
  314. package/dist/parser/SGTypes.d.ts +293 -50
  315. package/dist/parser/SGTypes.js +540 -187
  316. package/dist/parser/SGTypes.js.map +1 -1
  317. package/dist/parser/Statement.d.ts +759 -247
  318. package/dist/parser/Statement.js +1785 -607
  319. package/dist/parser/Statement.js.map +1 -1
  320. package/dist/parser/Statement.spec.js +45 -34
  321. package/dist/parser/Statement.spec.js.map +1 -1
  322. package/dist/parser/TranspileState.d.ts +18 -8
  323. package/dist/parser/TranspileState.js +76 -12
  324. package/dist/parser/TranspileState.js.map +1 -1
  325. package/dist/parser/tests/Parser.spec.d.ts +10 -9
  326. package/dist/parser/tests/Parser.spec.js +18 -14
  327. package/dist/parser/tests/Parser.spec.js.map +1 -1
  328. package/dist/parser/tests/controlFlow/For.spec.js +79 -69
  329. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  330. package/dist/parser/tests/controlFlow/ForEach.spec.js +53 -47
  331. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  332. package/dist/parser/tests/controlFlow/If.spec.js +217 -196
  333. package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
  334. package/dist/parser/tests/controlFlow/While.spec.js +48 -42
  335. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  336. package/dist/parser/tests/expression/Additive.spec.js +31 -31
  337. package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
  338. package/dist/parser/tests/expression/ArrayLiterals.spec.js +157 -120
  339. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
  340. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +202 -139
  341. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  342. package/dist/parser/tests/expression/Boolean.spec.js +25 -25
  343. package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
  344. package/dist/parser/tests/expression/Call.spec.js +150 -41
  345. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  346. package/dist/parser/tests/expression/Exponential.spec.js +18 -18
  347. package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
  348. package/dist/parser/tests/expression/Function.spec.js +257 -257
  349. package/dist/parser/tests/expression/Function.spec.js.map +1 -1
  350. package/dist/parser/tests/expression/Indexing.spec.js +160 -90
  351. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  352. package/dist/parser/tests/expression/Multiplicative.spec.js +38 -38
  353. package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
  354. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +196 -98
  355. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  356. package/dist/parser/tests/expression/PrefixUnary.spec.js +42 -42
  357. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
  358. package/dist/parser/tests/expression/Primary.spec.js +42 -42
  359. package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
  360. package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +1 -0
  361. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +171 -0
  362. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -0
  363. package/dist/parser/tests/expression/Relational.spec.js +44 -44
  364. package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
  365. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +31 -31
  366. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
  367. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +230 -90
  368. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  369. package/dist/parser/tests/expression/TernaryExpression.spec.js +377 -148
  370. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  371. package/dist/parser/tests/expression/TypeExpression.spec.d.ts +1 -0
  372. package/dist/parser/tests/expression/TypeExpression.spec.js +126 -0
  373. package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -0
  374. package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
  375. package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
  376. package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
  377. package/dist/parser/tests/statement/AssignmentOperators.spec.js +37 -37
  378. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
  379. package/dist/parser/tests/statement/ConstStatement.spec.d.ts +1 -0
  380. package/dist/parser/tests/statement/ConstStatement.spec.js +262 -0
  381. package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -0
  382. package/dist/parser/tests/statement/Continue.spec.d.ts +1 -0
  383. package/dist/parser/tests/statement/Continue.spec.js +119 -0
  384. package/dist/parser/tests/statement/Continue.spec.js.map +1 -0
  385. package/dist/parser/tests/statement/Declaration.spec.js +45 -45
  386. package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
  387. package/dist/parser/tests/statement/Dim.spec.js +22 -22
  388. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  389. package/dist/parser/tests/statement/Enum.spec.d.ts +1 -0
  390. package/dist/parser/tests/statement/Enum.spec.js +745 -0
  391. package/dist/parser/tests/statement/Enum.spec.js.map +1 -0
  392. package/dist/parser/tests/statement/For.spec.d.ts +1 -0
  393. package/dist/parser/tests/statement/For.spec.js +45 -0
  394. package/dist/parser/tests/statement/For.spec.js.map +1 -0
  395. package/dist/parser/tests/statement/ForEach.spec.d.ts +1 -0
  396. package/dist/parser/tests/statement/ForEach.spec.js +36 -0
  397. package/dist/parser/tests/statement/ForEach.spec.js.map +1 -0
  398. package/dist/parser/tests/statement/Function.spec.js +208 -198
  399. package/dist/parser/tests/statement/Function.spec.js.map +1 -1
  400. package/dist/parser/tests/statement/Goto.spec.js +16 -15
  401. package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
  402. package/dist/parser/tests/statement/Increment.spec.js +51 -51
  403. package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
  404. package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +1 -0
  405. package/dist/parser/tests/statement/InterfaceStatement.spec.js +110 -0
  406. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
  407. package/dist/parser/tests/statement/LibraryStatement.spec.js +18 -18
  408. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  409. package/dist/parser/tests/statement/Misc.spec.js +123 -163
  410. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  411. package/dist/parser/tests/statement/PrintStatement.spec.js +125 -108
  412. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  413. package/dist/parser/tests/statement/ReturnStatement.spec.js +51 -49
  414. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  415. package/dist/parser/tests/statement/Set.spec.js +110 -97
  416. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  417. package/dist/parser/tests/statement/Stop.spec.js +13 -12
  418. package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
  419. package/dist/parser/tests/statement/Throw.spec.js +6 -6
  420. package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
  421. package/dist/parser/tests/statement/TryCatch.spec.js +26 -15
  422. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  423. package/dist/preprocessor/Manifest.d.ts +6 -6
  424. package/dist/preprocessor/Manifest.js +17 -38
  425. package/dist/preprocessor/Manifest.js.map +1 -1
  426. package/dist/preprocessor/Manifest.spec.d.ts +1 -0
  427. package/dist/preprocessor/Manifest.spec.js +78 -103
  428. package/dist/preprocessor/Manifest.spec.js.map +1 -1
  429. package/dist/roku-types/data.json +19369 -0
  430. package/dist/roku-types/index.d.ts +5497 -0
  431. package/dist/roku-types/index.js +11 -0
  432. package/dist/roku-types/index.js.map +1 -0
  433. package/dist/types/ArrayType.d.ts +9 -5
  434. package/dist/types/ArrayType.js +68 -24
  435. package/dist/types/ArrayType.js.map +1 -1
  436. package/dist/types/ArrayType.spec.js +39 -11
  437. package/dist/types/ArrayType.spec.js.map +1 -1
  438. package/dist/types/AssociativeArrayType.d.ts +14 -0
  439. package/dist/types/AssociativeArrayType.js +60 -0
  440. package/dist/types/AssociativeArrayType.js.map +1 -0
  441. package/dist/types/BaseFunctionType.d.ts +9 -0
  442. package/dist/types/BaseFunctionType.js +25 -0
  443. package/dist/types/BaseFunctionType.js.map +1 -0
  444. package/dist/types/BooleanType.d.ts +10 -5
  445. package/dist/types/BooleanType.js +21 -9
  446. package/dist/types/BooleanType.js.map +1 -1
  447. package/dist/types/BooleanType.spec.js +10 -4
  448. package/dist/types/BooleanType.spec.js.map +1 -1
  449. package/dist/types/BscType.d.ts +29 -3
  450. package/dist/types/BscType.js +121 -0
  451. package/dist/types/BscType.js.map +1 -1
  452. package/dist/types/BscTypeKind.d.ts +25 -0
  453. package/dist/types/BscTypeKind.js +30 -0
  454. package/dist/types/BscTypeKind.js.map +1 -0
  455. package/dist/types/BuiltInInterfaceAdder.d.ts +25 -0
  456. package/dist/types/BuiltInInterfaceAdder.js +201 -0
  457. package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
  458. package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
  459. package/dist/types/BuiltInInterfaceAdder.spec.js +115 -0
  460. package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
  461. package/dist/types/ClassType.d.ts +16 -0
  462. package/dist/types/ClassType.js +57 -0
  463. package/dist/types/ClassType.js.map +1 -0
  464. package/dist/types/ClassType.spec.d.ts +1 -0
  465. package/dist/types/ClassType.spec.js +76 -0
  466. package/dist/types/ClassType.spec.js.map +1 -0
  467. package/dist/types/ComponentType.d.ts +27 -0
  468. package/dist/types/ComponentType.js +83 -0
  469. package/dist/types/ComponentType.js.map +1 -0
  470. package/dist/types/DoubleType.d.ts +10 -5
  471. package/dist/types/DoubleType.js +25 -18
  472. package/dist/types/DoubleType.js.map +1 -1
  473. package/dist/types/DoubleType.spec.js +12 -4
  474. package/dist/types/DoubleType.spec.js.map +1 -1
  475. package/dist/types/DynamicType.d.ts +12 -5
  476. package/dist/types/DynamicType.js +22 -6
  477. package/dist/types/DynamicType.js.map +1 -1
  478. package/dist/types/DynamicType.spec.js +16 -5
  479. package/dist/types/DynamicType.spec.js.map +1 -1
  480. package/dist/types/EnumType.d.ts +40 -0
  481. package/dist/types/EnumType.js +80 -0
  482. package/dist/types/EnumType.js.map +1 -0
  483. package/dist/types/EnumType.spec.d.ts +1 -0
  484. package/dist/types/EnumType.spec.js +33 -0
  485. package/dist/types/EnumType.spec.js.map +1 -0
  486. package/dist/types/FloatType.d.ts +10 -5
  487. package/dist/types/FloatType.js +25 -18
  488. package/dist/types/FloatType.js.map +1 -1
  489. package/dist/types/FloatType.spec.js +4 -4
  490. package/dist/types/FloatType.spec.js.map +1 -1
  491. package/dist/types/FunctionType.d.ts +10 -22
  492. package/dist/types/FunctionType.js +26 -63
  493. package/dist/types/FunctionType.js.map +1 -1
  494. package/dist/types/InheritableType.d.ts +28 -0
  495. package/dist/types/InheritableType.js +157 -0
  496. package/dist/types/InheritableType.js.map +1 -0
  497. package/dist/types/IntegerType.d.ts +10 -5
  498. package/dist/types/IntegerType.js +25 -18
  499. package/dist/types/IntegerType.js.map +1 -1
  500. package/dist/types/IntegerType.spec.js +8 -4
  501. package/dist/types/IntegerType.spec.js.map +1 -1
  502. package/dist/types/InterfaceType.d.ts +14 -6
  503. package/dist/types/InterfaceType.js +26 -15
  504. package/dist/types/InterfaceType.js.map +1 -1
  505. package/dist/types/InterfaceType.spec.d.ts +1 -0
  506. package/dist/types/InterfaceType.spec.js +227 -0
  507. package/dist/types/InterfaceType.spec.js.map +1 -0
  508. package/dist/types/InvalidType.d.ts +9 -5
  509. package/dist/types/InvalidType.js +20 -9
  510. package/dist/types/InvalidType.js.map +1 -1
  511. package/dist/types/InvalidType.spec.js +8 -4
  512. package/dist/types/InvalidType.spec.js.map +1 -1
  513. package/dist/types/LongIntegerType.d.ts +10 -5
  514. package/dist/types/LongIntegerType.js +25 -18
  515. package/dist/types/LongIntegerType.js.map +1 -1
  516. package/dist/types/LongIntegerType.spec.js +10 -4
  517. package/dist/types/LongIntegerType.spec.js.map +1 -1
  518. package/dist/types/NamespaceType.d.ts +12 -0
  519. package/dist/types/NamespaceType.js +28 -0
  520. package/dist/types/NamespaceType.js.map +1 -0
  521. package/dist/types/ObjectType.d.ts +10 -5
  522. package/dist/types/ObjectType.js +23 -9
  523. package/dist/types/ObjectType.js.map +1 -1
  524. package/dist/types/ObjectType.spec.js +3 -3
  525. package/dist/types/ObjectType.spec.js.map +1 -1
  526. package/dist/types/ReferenceType.d.ts +79 -0
  527. package/dist/types/ReferenceType.js +522 -0
  528. package/dist/types/ReferenceType.js.map +1 -0
  529. package/dist/types/ReferenceType.spec.d.ts +1 -0
  530. package/dist/types/ReferenceType.spec.js +151 -0
  531. package/dist/types/ReferenceType.spec.js.map +1 -0
  532. package/dist/types/StringType.d.ts +13 -5
  533. package/dist/types/StringType.js +25 -9
  534. package/dist/types/StringType.js.map +1 -1
  535. package/dist/types/StringType.spec.js +3 -3
  536. package/dist/types/StringType.spec.js.map +1 -1
  537. package/dist/types/TypedFunctionType.d.ts +33 -0
  538. package/dist/types/TypedFunctionType.js +106 -0
  539. package/dist/types/TypedFunctionType.js.map +1 -0
  540. package/dist/types/TypedFunctionType.spec.d.ts +1 -0
  541. package/dist/types/TypedFunctionType.spec.js +122 -0
  542. package/dist/types/TypedFunctionType.spec.js.map +1 -0
  543. package/dist/types/UninitializedType.d.ts +8 -6
  544. package/dist/types/UninitializedType.js +15 -9
  545. package/dist/types/UninitializedType.js.map +1 -1
  546. package/dist/types/UnionType.d.ts +20 -0
  547. package/dist/types/UnionType.js +127 -0
  548. package/dist/types/UnionType.js.map +1 -0
  549. package/dist/types/UnionType.spec.d.ts +1 -0
  550. package/dist/types/UnionType.spec.js +129 -0
  551. package/dist/types/UnionType.spec.js.map +1 -0
  552. package/dist/types/VoidType.d.ts +10 -5
  553. package/dist/types/VoidType.js +20 -9
  554. package/dist/types/VoidType.js.map +1 -1
  555. package/dist/types/VoidType.spec.js +3 -3
  556. package/dist/types/VoidType.spec.js.map +1 -1
  557. package/dist/types/helper.spec.d.ts +1 -0
  558. package/dist/types/helper.spec.js +144 -0
  559. package/dist/types/helper.spec.js.map +1 -0
  560. package/dist/types/helpers.d.ts +26 -0
  561. package/dist/types/helpers.js +191 -0
  562. package/dist/types/helpers.js.map +1 -0
  563. package/dist/types/index.d.ts +22 -0
  564. package/dist/types/index.js +39 -0
  565. package/dist/types/index.js.map +1 -0
  566. package/dist/util.d.ts +218 -106
  567. package/dist/util.js +1310 -320
  568. package/dist/util.js.map +1 -1
  569. package/dist/validators/ClassValidator.d.ts +9 -15
  570. package/dist/validators/ClassValidator.js +81 -134
  571. package/dist/validators/ClassValidator.js.map +1 -1
  572. package/package.json +169 -138
  573. package/dist/astUtils/index.d.ts +0 -7
  574. package/dist/astUtils/index.js +0 -26
  575. package/dist/astUtils/index.js.map +0 -1
  576. package/dist/lexer/index.d.ts +0 -3
  577. package/dist/lexer/index.js +0 -17
  578. package/dist/lexer/index.js.map +0 -1
  579. package/dist/parser/index.d.ts +0 -3
  580. package/dist/parser/index.js +0 -16
  581. package/dist/parser/index.js.map +0 -1
  582. package/dist/preprocessor/Chunk.d.ts +0 -82
  583. package/dist/preprocessor/Chunk.js +0 -77
  584. package/dist/preprocessor/Chunk.js.map +0 -1
  585. package/dist/preprocessor/Preprocessor.d.ts +0 -60
  586. package/dist/preprocessor/Preprocessor.js +0 -156
  587. package/dist/preprocessor/Preprocessor.js.map +0 -1
  588. package/dist/preprocessor/Preprocessor.spec.js +0 -152
  589. package/dist/preprocessor/Preprocessor.spec.js.map +0 -1
  590. package/dist/preprocessor/PreprocessorParser.d.ts +0 -61
  591. package/dist/preprocessor/PreprocessorParser.js +0 -194
  592. package/dist/preprocessor/PreprocessorParser.js.map +0 -1
  593. package/dist/preprocessor/PreprocessorParser.spec.js +0 -116
  594. package/dist/preprocessor/PreprocessorParser.spec.js.map +0 -1
  595. package/dist/preprocessor/index.d.ts +0 -3
  596. package/dist/preprocessor/index.js +0 -16
  597. package/dist/preprocessor/index.js.map +0 -1
  598. package/dist/types/CustomType.d.ts +0 -10
  599. package/dist/types/CustomType.js +0 -35
  600. package/dist/types/CustomType.js.map +0 -1
  601. package/dist/types/FunctionType.spec.js +0 -29
  602. package/dist/types/FunctionType.spec.js.map +0 -1
  603. package/dist/types/LazyType.d.ts +0 -15
  604. package/dist/types/LazyType.js +0 -32
  605. package/dist/types/LazyType.js.map +0 -1
  606. /package/dist/{preprocessor/Preprocessor.spec.d.ts → astUtils/Editor.spec.d.ts} +0 -0
  607. /package/dist/{preprocessor/PreprocessorParser.spec.d.ts → bscPlugin/completions/CompletionsProcessor.spec.d.ts} +0 -0
  608. /package/dist/{types/FunctionType.spec.d.ts → bscPlugin/definition/DefinitionProvider.spec.d.ts} +0 -0
package/dist/Program.d.ts CHANGED
@@ -1,44 +1,47 @@
1
- import type { CodeAction, CompletionItem, Position, Range, SignatureInformation, SymbolInformation } from 'vscode-languageserver';
2
- import { Location } from 'vscode-languageserver';
3
- import type { BsConfig } from './BsConfig';
1
+ import type { CodeAction, Position, Range, SignatureInformation, Location, DocumentSymbol } from 'vscode-languageserver';
2
+ import type { BsConfig, FinalizedBsConfig } from './BsConfig';
4
3
  import { Scope } from './Scope';
5
- import { BrsFile } from './files/BrsFile';
6
- import { XmlFile } from './files/XmlFile';
7
- import type { BsDiagnostic, FileReference, FileObj, BscFile } from './interfaces';
4
+ import type { FileObj, SemanticToken, FileLink, Hover } from './interfaces';
8
5
  import { XmlScope } from './XmlScope';
9
- import { Logger } from './Logger';
6
+ import type { Logger } from './logging';
10
7
  import PluginInterface from './PluginInterface';
11
- import type { FunctionStatement, Statement } from './parser/Statement';
12
- export interface SourceObj {
13
- srcPath: string;
14
- source: string;
15
- definitions?: string;
16
- }
17
- export interface TranspileObj {
18
- file: BscFile;
19
- outputPath: string;
20
- }
8
+ import type { FunctionStatement } from './parser/Statement';
9
+ import { Editor } from './astUtils/Editor';
10
+ import type { Statement } from './parser/AstNode';
11
+ import type { FileData } from './files/LazyFileData';
12
+ import type { UnresolvedSymbol } from './AstValidationSegmenter';
13
+ import type { BscFile } from './files/BscFile';
14
+ import { CrossScopeValidator } from './CrossScopeValidator';
15
+ import { DiagnosticManager } from './DiagnosticManager';
16
+ import type { ProvidedSymbolInfo, BrsFile } from './files/BrsFile';
17
+ import type { XmlFile } from './files/XmlFile';
21
18
  export interface SignatureInfoObj {
22
19
  index: number;
23
20
  key: string;
24
21
  signature: SignatureInformation;
25
22
  }
26
- export interface FileLink<T> {
27
- item: T;
28
- file: BrsFile;
29
- }
30
23
  export declare class Program {
31
- /**
32
- * The root directory for this program
33
- */
34
- options: BsConfig;
35
24
  constructor(
36
25
  /**
37
26
  * The root directory for this program
38
27
  */
39
- options: BsConfig, logger?: Logger, plugins?: PluginInterface);
28
+ options: BsConfig, logger?: Logger, plugins?: PluginInterface, diagnosticsManager?: DiagnosticManager);
29
+ options: FinalizedBsConfig;
40
30
  logger: Logger;
31
+ /**
32
+ * An editor that plugins can use to modify program-level things during the build flow. Don't use this to edit files (they have their own `.editor`)
33
+ */
34
+ editor: Editor;
35
+ /**
36
+ * A factory that creates `File` instances
37
+ */
38
+ private fileFactory;
41
39
  private createGlobalScope;
40
+ private recursivelyAddNodeToSymbolTable;
41
+ /**
42
+ * Do all setup required for the global symbol table.
43
+ */
44
+ private populateGlobalSymbolTable;
42
45
  /**
43
46
  * A graph of all files and their dependencies.
44
47
  * For example:
@@ -46,7 +49,7 @@ export declare class Program {
46
49
  * lib2.brs -> [lib3.brs] //via an import statement
47
50
  */
48
51
  private dependencyGraph;
49
- private diagnosticFilterer;
52
+ diagnostics: DiagnosticManager;
50
53
  /**
51
54
  * A scope that contains all built-in global functions.
52
55
  * All scopes should directly or indirectly inherit from this scope
@@ -56,28 +59,31 @@ export declare class Program {
56
59
  * Plugins which can provide extra diagnostics or transform AST
57
60
  */
58
61
  plugins: PluginInterface;
59
- /**
60
- * A set of diagnostics. This does not include any of the scope diagnostics.
61
- * Should only be set from `this.validate()`
62
- */
63
- private diagnostics;
62
+ private fileSymbolInformation;
63
+ addFileSymbolInfo(file: BrsFile): void;
64
+ getFileSymbolInfo(file: BrsFile): {
65
+ provides: ProvidedSymbolInfo;
66
+ requires: UnresolvedSymbol[];
67
+ };
64
68
  /**
65
69
  * The path to bslib.brs (the BrightScript runtime for certain BrighterScript features)
66
70
  */
67
- get bslibPkgPath(): "pkg:/source/roku_modules/bslib/bslib.brs" | "pkg:/source/roku_modules/rokucommunity_bslib/bslib.brs" | "pkg:/source/bslib.brs";
71
+ get bslibPkgPath(): string;
68
72
  get bslibPrefix(): "rokucommunity_bslib" | "bslib";
69
73
  /**
70
- * A map of every file loaded ino this program, indexed by its lower-case pkgPath
74
+ * A map of every file loaded into this program, indexed by its original file location
71
75
  */
72
- private pkgMap;
76
+ files: Record<string, BscFile>;
73
77
  /**
74
- * A map of every file loaded into this program, indexed by its lower-case srcPath
78
+ * A map of every file loaded into this program, indexed by its destPath
75
79
  */
76
- private files;
80
+ private destMap;
77
81
  /**
78
- * Get a copy of the list of files currently loaded in the program
82
+ * Plugins can contribute multiple virtual files for a single physical file.
83
+ * This collection links the virtual files back to the physical file that produced them.
84
+ * The key is the standardized and lower-cased srcPath
79
85
  */
80
- getFiles(): (BrsFile | XmlFile)[];
86
+ private fileClusters;
81
87
  private scopes;
82
88
  protected addScope(scope: Scope): void;
83
89
  /**
@@ -94,6 +100,14 @@ export declare class Program {
94
100
  file: XmlFile;
95
101
  scope: XmlScope;
96
102
  };
103
+ /**
104
+ * Get the sorted names of custom components
105
+ */
106
+ getSortedComponentNames(): string[];
107
+ /**
108
+ * Keeps a set of all the components that need to have their types updated during the current validation cycle
109
+ */
110
+ private componentSymbolsToUpdate;
97
111
  /**
98
112
  * Register (or replace) the reference to a component in the component map
99
113
  */
@@ -102,6 +116,18 @@ export declare class Program {
102
116
  * Remove the specified component from the components map
103
117
  */
104
118
  private unregisterComponent;
119
+ /**
120
+ * Adds a component described in an XML to the set of components that needs to be updated this validation cycle.
121
+ * @param xmlFile XML file with <component> tag
122
+ */
123
+ private addDeferredComponentTypeSymbolCreation;
124
+ private getComponentKey;
125
+ /**
126
+ * Updates the global symbol table with the first component in this.components to have the same name as the component in the file
127
+ * @param componentKey key getting a component from `this.components`
128
+ * @param componentName the unprefixed name of the component that will be added (e.g. 'MyLabel' NOT 'roSgNodeMyLabel')
129
+ */
130
+ private updateComponentSymbolInGlobalScope;
105
131
  /**
106
132
  * re-attach the dependency graph with a new key for any component who changed
107
133
  * their position in their own named array (only matters when there are multiple
@@ -112,24 +138,22 @@ export declare class Program {
112
138
  * Get a list of all files that are included in the project but are not referenced
113
139
  * by any scope in the program.
114
140
  */
115
- getUnreferencedFiles(): (BrsFile | XmlFile)[];
141
+ getUnreferencedFiles(): BscFile[];
116
142
  /**
117
- * Get the list of errors for the entire program. It's calculated on the fly
118
- * by walking through every file, so call this sparingly.
143
+ * Get the list of errors for the entire program.
119
144
  */
120
- getDiagnostics(): BsDiagnostic[];
121
- addDiagnostics(diagnostics: BsDiagnostic[]): void;
145
+ getDiagnostics(): import("./interfaces").BsDiagnostic[];
122
146
  /**
123
147
  * Determine if the specified file is loaded in this program right now.
124
- * @param filePath
148
+ * @param filePath the absolute or relative path to the file
125
149
  * @param normalizePath should the provided path be normalized before use
126
150
  */
127
151
  hasFile(filePath: string, normalizePath?: boolean): boolean;
128
152
  /**
129
153
  * roku filesystem is case INsensitive, so find the scope by key case insensitive
130
- * @param scopeName
154
+ * @param scopeName xml scope names are their `destPath`. Source scope is stored with the key `"source"`
131
155
  */
132
- getScopeByName(scopeName: string): Scope;
156
+ getScopeByName(scopeName: string): Scope | undefined;
133
157
  /**
134
158
  * Return all scopes
135
159
  */
@@ -149,16 +173,34 @@ export declare class Program {
149
173
  /**
150
174
  * Load a file into the program. If that file already exists, it is replaced.
151
175
  * If file contents are provided, those are used, Otherwise, the file is loaded from the file system
152
- * @param srcDestOrPkgPath the absolute path, or the pkg path (i.e. `pkg:/path/to/file.brs`) or the destPath (i.e. `path/to/file.brs` relative to `pkg:/`)
153
- * @param fileContents the file contents
176
+ * @param srcDestOrPkgPath the absolute path, the pkg path (i.e. `pkg:/path/to/file.brs`), or the destPath (i.e. `path/to/file.brs` relative to `pkg:/`)
177
+ * @param fileData the file contents. omit or pass `undefined` to prevent loading the data at this time
154
178
  */
155
- setFile<T extends BscFile>(srcDestOrPkgPath: string, fileContents: string): T;
179
+ setFile<T extends BscFile>(srcDestOrPkgPath: string, fileData?: FileData): T;
156
180
  /**
157
181
  * Load a file into the program. If that file already exists, it is replaced.
158
182
  * @param fileEntry an object that specifies src and dest for the file.
159
- * @param fileContents the file contents. If not provided, the file will be loaded from disk
183
+ * @param fileData the file contents. omit or pass `undefined` to prevent loading the data at this time
184
+ */
185
+ setFile<T extends BscFile>(fileEntry: FileObj, fileData: FileData): T;
186
+ /**
187
+ * Given a srcPath, a destPath, or both, resolve whichever is missing, relative to rootDir.
188
+ * @param fileParam an object representing file paths
189
+ * @param rootDir must be a pre-normalized path
160
190
  */
161
- setFile<T extends BscFile>(fileEntry: FileObj, fileContents: string): T;
191
+ private getPaths;
192
+ /**
193
+ * Remove any leading `pkg:/` found in the path
194
+ */
195
+ private removePkgPrefix;
196
+ /**
197
+ * Is this file a .brs file found somewhere within the `pkg:/source/` folder?
198
+ */
199
+ private isSourceBrsFile;
200
+ /**
201
+ * Is this file a .brs file found somewhere within the `pkg:/source/` folder?
202
+ */
203
+ private isComponentsXmlFile;
162
204
  /**
163
205
  * Ensure source scope is created.
164
206
  * Note: automatically called internally, and no-op if it exists already.
@@ -166,110 +208,167 @@ export declare class Program {
166
208
  createSourceScope(): void;
167
209
  /**
168
210
  * Remove a set of files from the program
169
- * @param srcPaths
211
+ * @param srcPaths can be an array of srcPath or destPath strings
212
+ * @param normalizePath should this function repair and standardize the filePaths? Passing false should have a performance boost if you can guarantee your paths are already sanitized
170
213
  */
171
- removeFiles(srcPaths: string[]): void;
214
+ removeFiles(srcPaths: string[], normalizePath?: boolean): void;
172
215
  /**
173
216
  * Remove a file from the program
174
- * @param filePath can be a srcPath, a pkgPath, or a destPath (same as pkgPath but without `pkg:/`)
217
+ * @param filePath can be a srcPath, a destPath, or a destPath with leading `pkg:/`
175
218
  * @param normalizePath should this function repair and standardize the path? Passing false should have a performance boost if you can guarantee your path is already sanitized
176
-
177
- */
178
- removeFile(filePath: string, normalizePath?: boolean): void;
179
- /**
180
- * Remove all files from the program that are in the specified folder path (recursive)
181
- * @param folderSrcPath The absolute path to the folder on disk
182
- * @param normalizePath should the provided path be normalized before use?
183
219
  */
184
- removeFilesInFolder(folderSrcPath: string, normalizePath?: boolean): void;
220
+ removeFile(filePath: string, normalizePath?: boolean, keepSymbolInformation?: boolean): void;
221
+ crossScopeValidation: CrossScopeValidator;
222
+ private isFirstValidation;
185
223
  /**
186
224
  * Traverse the entire project, and validate all scopes
187
- * @param force - if true, then all scopes are force to validate, even if they aren't marked as dirty
188
225
  */
189
226
  validate(): void;
227
+ private logValidationMetrics;
228
+ private getScopesForCrossScopeValidation;
190
229
  /**
191
230
  * Flag all duplicate component names
192
231
  */
193
232
  private detectDuplicateComponentNames;
194
233
  /**
195
- * Determine at least one scope has the file
234
+ * Get the files for a list of filePaths
235
+ * @param filePaths can be an array of srcPath or a destPath strings
236
+ * @param normalizePath should this function repair and standardize the paths? Passing false should have a performance boost if you can guarantee your paths are already sanitized
196
237
  */
197
- private fileIsIncludedInAnyScope;
238
+ getFiles<T extends BscFile>(filePaths: string[], normalizePath?: boolean): T[];
198
239
  /**
199
240
  * Get the file at the given path
200
- * @param filePath can be a srcPath, a pkgPath, or a destPath (same as pkgPath but without `pkg:/`)
241
+ * @param filePath can be a srcPath or a destPath
201
242
  * @param normalizePath should this function repair and standardize the path? Passing false should have a performance boost if you can guarantee your path is already sanitized
202
243
  */
203
244
  getFile<T extends BscFile>(filePath: string, normalizePath?: boolean): T;
245
+ /**
246
+ * Gets a sorted list of all scopeNames, always beginning with "global", "source", then any others in alphabetical order
247
+ */
248
+ private getSortedScopeNames;
204
249
  /**
205
250
  * Get a list of all scopes the file is loaded into
206
- * @param file
251
+ * @param file the file
207
252
  */
208
- getScopesForFile(file: XmlFile | BrsFile): Scope[];
253
+ getScopesForFile(file: BscFile | string): Scope[];
254
+ /**
255
+ * Get the first found scope for a file.
256
+ */
257
+ getFirstScopeForFile(file: BscFile): Scope | undefined;
209
258
  getStatementsByName(name: string, originFile: BrsFile, namespaceName?: string): FileLink<Statement>[];
210
259
  getStatementsForXmlFile(scope: XmlScope, filterName?: string): FileLink<FunctionStatement>[];
211
260
  /**
212
261
  * Find all available completion items at the given position
213
- * @param srcPath The absolute path to the source file on disk
214
- * @param lineIndex
215
- * @param columnIndex
262
+ * @param filePath can be a srcPath or a destPath
263
+ * @param position the position (line & column) where completions should be found
216
264
  */
217
- getCompletions(srcPath: string, position: Position): CompletionItem[];
265
+ getCompletions(filePath: string, position: Position): import("vscode-languageserver-types").CompletionItem[];
218
266
  /**
219
267
  * Goes through each file and builds a list of workspace symbols for the program. Used by LanguageServer's onWorkspaceSymbol functionality
220
268
  */
221
- getWorkspaceSymbols(): SymbolInformation[];
269
+ getWorkspaceSymbols(): import("vscode-languageserver-types").WorkspaceSymbol[];
222
270
  /**
223
271
  * Given a position in a file, if the position is sitting on some type of identifier,
224
272
  * go to the definition of that identifier (where this thing was first defined)
225
- * @param srcPath The absolute path to the source file on disk
226
273
  */
227
274
  getDefinition(srcPath: string, position: Position): Location[];
228
275
  /**
229
- * @param srcPath The absolute path to the source file on disk
276
+ * Get hover information for a file and position
230
277
  */
231
- getHover(srcPath: string, position: Position): Promise<import("vscode-languageserver-types").Hover>;
278
+ getHover(srcPath: string, position: Position): Hover[];
279
+ /**
280
+ * Get full list of document symbols for a file
281
+ * @param srcPath path to the file
282
+ */
283
+ getDocumentSymbols(srcPath: string): DocumentSymbol[] | undefined;
232
284
  /**
233
285
  * Compute code actions for the given file and range
234
- * @param srcPath The absolute path to the source file on disk
235
286
  */
236
287
  getCodeActions(srcPath: string, range: Range): CodeAction[];
288
+ /**
289
+ * Get semantic tokens for the specified file
290
+ */
291
+ getSemanticTokens(srcPath: string): SemanticToken[] | undefined;
237
292
  getSignatureHelp(filepath: string, position: Position): SignatureInfoObj[];
238
- private getPartialStatementInfo;
239
- private getPartialItemCounts;
293
+ getReferences(srcPath: string, position: Position): Location[];
240
294
  /**
241
- * @param srcPath The absolute path to the source file on disk
295
+ * Transpile a single file and get the result as a string.
296
+ * This does not write anything to the file system.
297
+ *
298
+ * This should only be called by `LanguageServer`.
299
+ * Internal usage should call `_getTranspiledFileContents` instead.
300
+ * @param filePath can be a srcPath or a destPath
242
301
  */
243
- getReferences(srcPath: string, position: Position): Location[] | Promise<Location[]>;
302
+ getTranspiledFileContents(filePath: string): Promise<FileTranspileResult>;
303
+ private getTranspiledFileContentsPipeline;
244
304
  /**
245
- * Get a list of all script imports, relative to the specified pkgPath
246
- * @param sourcePkgPath - the pkgPath of the source that wants to resolve script imports.
305
+ * Get the absolute output path for a file
247
306
  */
248
- getScriptImportCompletions(sourcePkgPath: string, scriptImport: FileReference): CompletionItem[];
307
+ private getOutputPath;
308
+ private getStagingDir;
249
309
  /**
250
- * Transpile a single file and get the result as a string.
251
- * This does not write anything to the file system.
252
- * @param srcPath The absolute path to the source file on disk
310
+ * Prepare the program for building
311
+ * @param files the list of files that should be prepared
253
312
  */
254
- getTranspiledFileContents(srcPath: string): {
255
- srcPath: string;
256
- pkgPath: string;
257
- code: string;
258
- map: import("source-map").SourceMapGenerator;
259
- };
260
- transpile(fileEntries: FileObj[], stagingFolderPath: string): Promise<void>;
313
+ private prepare;
261
314
  /**
262
- * Find a list of files in the program that have a function with the given name (case INsensitive)
315
+ * Generate the contents of every file
316
+ */
317
+ private serialize;
318
+ /**
319
+ * Write the entire project to disk
263
320
  */
264
- findFilesForFunction(functionName: string): (BrsFile | XmlFile)[];
321
+ private write;
322
+ private buildPipeline;
323
+ /**
324
+ * Build the project. This transpiles/transforms/copies all files and moves them to the staging directory
325
+ * @param options the list of options used to build the program
326
+ */
327
+ build(options?: ProgramBuildOptions): Promise<void>;
265
328
  /**
266
329
  * Find a list of files in the program that have a function with the given name (case INsensitive)
267
330
  */
268
- findFilesForClass(className: string): (BrsFile | XmlFile)[];
331
+ findFilesForFunction(functionName: string): BscFile[];
269
332
  /**
270
- * Get a map of the manifest information
333
+ * Find a list of files in the program that have a class with the given name (case INsensitive)
271
334
  */
272
- getManifest(): Map<string, string | number | boolean>;
335
+ findFilesForClass(className: string): BscFile[];
336
+ findFilesForNamespace(name: string): BscFile[];
337
+ findFilesForEnum(name: string): BscFile[];
273
338
  private _manifest;
339
+ /**
340
+ * Modify a parsed manifest map by reading `bs_const` and injecting values from `options.manifest.bs_const`
341
+ * @param parsedManifest The manifest map to read from and modify
342
+ */
343
+ private buildBsConstsIntoParsedManifest;
344
+ /**
345
+ * Try to find and load the manifest into memory
346
+ * @param manifestFileObj A pointer to a potential manifest file object found during loading
347
+ * @param replaceIfAlreadyLoaded should we overwrite the internal `_manifest` if it already exists
348
+ */
349
+ loadManifest(manifestFileObj?: FileObj, replaceIfAlreadyLoaded?: boolean): void;
350
+ /**
351
+ * Get a map of the manifest information
352
+ */
353
+ getManifest(): Map<string, string>;
274
354
  dispose(): void;
275
355
  }
356
+ export interface FileTranspileResult {
357
+ srcPath: string;
358
+ destPath: string;
359
+ pkgPath: string;
360
+ code: string;
361
+ map: string;
362
+ typedef: string;
363
+ }
364
+ export interface ProgramBuildOptions {
365
+ /**
366
+ * The directory where the final built files should be placed. This directory will be cleared before running
367
+ */
368
+ stagingDir?: string;
369
+ /**
370
+ * An array of files to build. If omitted, the entire list of files from the program will be used instead.
371
+ * Typically you will want to leave this blank
372
+ */
373
+ files?: BscFile[];
374
+ }