@eagleoutice/flowr 2.10.9 → 2.11.0

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 (417) hide show
  1. package/README.md +116 -38
  2. package/abstract-interpretation/absint-visitor.js +6 -3
  3. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
  4. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
  5. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  6. package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
  7. package/abstract-interpretation/domains/interval-domain.js +1 -1
  8. package/abstract-interpretation/domains/lattice.d.ts +1 -1
  9. package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
  10. package/abstract-interpretation/domains/partial-product-domain.js +2 -2
  11. package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
  12. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  13. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
  14. package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
  15. package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
  16. package/abstract-interpretation/domains/singleton-domain.js +1 -1
  17. package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
  19. package/abstract-interpretation/unsupported-functions.d.ts +3 -2
  20. package/abstract-interpretation/unsupported-functions.js +38 -28
  21. package/cli/benchmark-app.js +2 -1
  22. package/cli/common/options.d.ts +2 -108
  23. package/cli/common/options.js +3 -27
  24. package/cli/common/script.js +3 -2
  25. package/cli/common/scripts-info.d.ts +2 -123
  26. package/cli/common/scripts-info.js +0 -17
  27. package/cli/flowr-main-options.d.ts +5 -0
  28. package/cli/flowr-main-options.js +10 -0
  29. package/cli/flowr.js +48 -11
  30. package/cli/repl/commands/repl-cfg.js +9 -9
  31. package/cli/repl/commands/repl-commands.js +5 -0
  32. package/cli/repl/commands/repl-dataflow.js +31 -24
  33. package/cli/repl/commands/repl-main.d.ts +6 -0
  34. package/cli/repl/commands/repl-normalize.js +15 -12
  35. package/cli/repl/commands/repl-parse.js +1 -1
  36. package/cli/repl/commands/repl-query.js +4 -5
  37. package/cli/repl/commands/repl-quit.js +2 -1
  38. package/cli/repl/core.d.ts +11 -0
  39. package/cli/repl/core.js +101 -3
  40. package/cli/repl/execute.js +3 -2
  41. package/cli/repl/parser/slice-query-parser.d.ts +16 -0
  42. package/cli/repl/parser/slice-query-parser.js +52 -0
  43. package/cli/repl/print-version.d.ts +3 -1
  44. package/cli/repl/print-version.js +21 -2
  45. package/cli/repl/server/connection.d.ts +3 -0
  46. package/cli/repl/server/connection.js +65 -31
  47. package/cli/repl/server/messages/message-analysis.d.ts +10 -0
  48. package/cli/repl/server/messages/message-analysis.js +6 -2
  49. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  50. package/cli/script-core/summarizer-core.js +13 -32
  51. package/cli/wiki.d.ts +3 -1
  52. package/cli/wiki.js +6 -1
  53. package/config.d.ts +22 -10
  54. package/config.js +33 -7
  55. package/control-flow/diff-cfg.d.ts +1 -1
  56. package/control-flow/diff-cfg.js +1 -1
  57. package/control-flow/semantic-cfg-guided-visitor.js +2 -0
  58. package/control-flow/simple-visitor.js +6 -5
  59. package/control-flow/useless-loop.js +2 -2
  60. package/core/print/dataflow-printer.d.ts +2 -2
  61. package/core/print/dataflow-printer.js +2 -2
  62. package/core/steps/all/static-slicing/00-slice.js +1 -1
  63. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  64. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  65. package/dataflow/environments/append.d.ts +2 -2
  66. package/dataflow/environments/append.js +4 -10
  67. package/dataflow/environments/apply-kill.d.ts +21 -0
  68. package/dataflow/environments/apply-kill.js +155 -0
  69. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  70. package/dataflow/environments/built-in-proc-name.js +4 -0
  71. package/dataflow/environments/built-in.d.ts +4 -0
  72. package/dataflow/environments/built-in.js +4 -0
  73. package/dataflow/environments/default-builtin-config.d.ts +183 -67
  74. package/dataflow/environments/default-builtin-config.js +358 -147
  75. package/dataflow/environments/environment.d.ts +49 -31
  76. package/dataflow/environments/environment.js +144 -25
  77. package/dataflow/environments/identifier.d.ts +65 -2
  78. package/dataflow/environments/identifier.js +37 -2
  79. package/dataflow/environments/overwrite.js +2 -10
  80. package/dataflow/environments/reference-to-maybe.d.ts +2 -0
  81. package/dataflow/environments/reference-to-maybe.js +56 -11
  82. package/dataflow/environments/resolve-by-name.d.ts +1 -1
  83. package/dataflow/environments/resolve-by-name.js +23 -9
  84. package/dataflow/environments/scoping.d.ts +9 -2
  85. package/dataflow/environments/scoping.js +15 -2
  86. package/dataflow/eval/values/general.js +4 -0
  87. package/dataflow/extractor.js +35 -4
  88. package/dataflow/graph/df-helper.d.ts +14 -0
  89. package/dataflow/graph/df-helper.js +41 -0
  90. package/dataflow/graph/graph.d.ts +4 -1
  91. package/dataflow/graph/graph.js +6 -2
  92. package/dataflow/info.d.ts +27 -1
  93. package/dataflow/internal/linker.d.ts +5 -1
  94. package/dataflow/internal/linker.js +34 -9
  95. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
  96. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
  97. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
  98. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
  99. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
  100. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
  101. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
  102. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +7 -2
  103. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
  104. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +61 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
  106. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
  107. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
  108. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
  109. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
  110. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  111. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +3 -2
  112. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +132 -25
  113. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
  114. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
  115. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
  116. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +11 -4
  117. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
  118. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
  119. package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
  120. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  121. package/dataflow/internal/process/functions/call/named-call-handling.js +23 -0
  122. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  123. package/dataflow/origin/dfg-get-origin.js +1 -1
  124. package/dataflow/processor.d.ts +6 -0
  125. package/documentation/data/faq/faqs.d.ts +2 -1
  126. package/documentation/data/faq/faqs.js +78 -57
  127. package/documentation/data/interface/doc-writing-code.js +4 -80
  128. package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
  129. package/documentation/data/server/doc-data-server-messages.js +15 -7
  130. package/documentation/doc-readme.js +15 -15
  131. package/documentation/doc-util/doc-cfg.d.ts +3 -1
  132. package/documentation/doc-util/doc-cfg.js +3 -3
  133. package/documentation/doc-util/doc-dfg.d.ts +3 -1
  134. package/documentation/doc-util/doc-dfg.js +3 -3
  135. package/documentation/doc-util/doc-files.d.ts +3 -1
  136. package/documentation/doc-util/doc-files.js +9 -6
  137. package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
  138. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  139. package/documentation/doc-util/doc-query.d.ts +2 -1
  140. package/documentation/doc-util/doc-query.js +2 -2
  141. package/documentation/doc-util/doc-repl.js +1 -0
  142. package/documentation/doc-util/doc-structure.js +1 -2
  143. package/documentation/doc-util/doc-types.d.ts +6 -6
  144. package/documentation/doc-util/doc-types.js +11 -9
  145. package/documentation/issue-linting-rule.js +1 -2
  146. package/documentation/wiki-analyzer.js +9 -9
  147. package/documentation/wiki-cfg.js +40 -41
  148. package/documentation/wiki-core.js +121 -32
  149. package/documentation/wiki-create-linting-rules.d.ts +6 -0
  150. package/documentation/wiki-create-linting-rules.js +95 -0
  151. package/documentation/wiki-dataflow-graph.js +112 -77
  152. package/documentation/wiki-engine.js +1 -2
  153. package/documentation/wiki-faq.d.ts +2 -1
  154. package/documentation/wiki-faq.js +4 -4
  155. package/documentation/wiki-interface.js +22 -8
  156. package/documentation/wiki-linter.d.ts +1 -1
  157. package/documentation/wiki-linter.js +16 -6
  158. package/documentation/wiki-linting-and-testing.js +2 -2
  159. package/documentation/wiki-mk/doc-context.d.ts +3 -3
  160. package/documentation/wiki-mk/doc-maker.d.ts +2 -0
  161. package/documentation/wiki-mk/doc-maker.js +7 -1
  162. package/documentation/wiki-normalized-ast.js +5 -5
  163. package/documentation/wiki-onboarding.d.ts +2 -1
  164. package/documentation/wiki-onboarding.js +5 -5
  165. package/documentation/wiki-overview.js +4 -17
  166. package/documentation/wiki-package-database.d.ts +9 -0
  167. package/documentation/wiki-package-database.js +63 -0
  168. package/documentation/wiki-query.js +86 -84
  169. package/documentation/wiki-search.js +4 -5
  170. package/documentation/wiki-setup.js +6 -7
  171. package/gas.d.ts +74 -0
  172. package/gas.js +18 -0
  173. package/linter/linter-executor.js +2 -8
  174. package/linter/linter-format.d.ts +4 -11
  175. package/linter/linter-rules.d.ts +111 -86
  176. package/linter/linter-rules.js +9 -1
  177. package/linter/rules/absolute-path.d.ts +2 -7
  178. package/linter/rules/absolute-path.js +8 -5
  179. package/linter/rules/dataframe-access-validation.d.ts +1 -6
  180. package/linter/rules/dataframe-access-validation.js +8 -6
  181. package/linter/rules/dead-code.d.ts +2 -11
  182. package/linter/rules/dead-code.js +16 -11
  183. package/linter/rules/deprecated-functions.d.ts +3 -3
  184. package/linter/rules/file-path-validity.d.ts +1 -6
  185. package/linter/rules/file-path-validity.js +5 -5
  186. package/linter/rules/function-finder-util.d.ts +7 -11
  187. package/linter/rules/function-finder-util.js +9 -6
  188. package/linter/rules/naming-convention.d.ts +2 -7
  189. package/linter/rules/naming-convention.js +3 -2
  190. package/linter/rules/network-functions.d.ts +2 -7
  191. package/linter/rules/network-functions.js +14 -12
  192. package/linter/rules/no-leaked-credentials.d.ts +36 -0
  193. package/linter/rules/no-leaked-credentials.js +75 -0
  194. package/linter/rules/problematic-inputs.d.ts +1 -8
  195. package/linter/rules/problematic-inputs.js +5 -4
  196. package/linter/rules/roxygen-arguments.d.ts +2 -7
  197. package/linter/rules/roxygen-arguments.js +13 -20
  198. package/linter/rules/seeded-randomness.d.ts +2 -7
  199. package/linter/rules/seeded-randomness.js +7 -4
  200. package/linter/rules/software-has-license.d.ts +31 -0
  201. package/linter/rules/software-has-license.js +46 -0
  202. package/linter/rules/software-has-tests.d.ts +38 -0
  203. package/linter/rules/software-has-tests.js +48 -0
  204. package/linter/rules/stop-with-call-arg.d.ts +2 -7
  205. package/linter/rules/stop-with-call-arg.js +3 -2
  206. package/linter/rules/undefined-symbol.d.ts +39 -0
  207. package/linter/rules/undefined-symbol.js +80 -0
  208. package/linter/rules/unused-definition.d.ts +3 -8
  209. package/linter/rules/unused-definition.js +7 -5
  210. package/linter/rules/useless-loop.d.ts +2 -7
  211. package/linter/rules/useless-loop.js +5 -2
  212. package/package.json +5 -5
  213. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  214. package/project/cache/flowr-analyzer-cache.js +9 -1
  215. package/project/context/flowr-analyzer-context.d.ts +13 -14
  216. package/project/context/flowr-analyzer-context.js +4 -0
  217. package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
  218. package/project/context/flowr-analyzer-dependencies-context.js +36 -4
  219. package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
  220. package/project/context/flowr-analyzer-environment-context.js +3 -4
  221. package/project/context/flowr-analyzer-files-context.d.ts +13 -0
  222. package/project/context/flowr-analyzer-files-context.js +12 -2
  223. package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
  224. package/project/context/flowr-analyzer-gas-context.js +101 -0
  225. package/project/context/flowr-file.d.ts +2 -0
  226. package/project/context/flowr-file.js +2 -0
  227. package/project/flowr-analyzer-builder.js +3 -0
  228. package/project/flowr-analyzer.d.ts +2 -1
  229. package/project/flowr-analyzer.js +3 -1
  230. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
  231. package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
  232. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
  233. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
  234. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
  235. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
  236. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  237. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
  238. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
  239. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
  240. package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
  241. package/project/plugins/flowr-analyzer-plugin.js +14 -7
  242. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
  243. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
  244. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
  245. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
  246. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
  247. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
  248. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  249. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
  250. package/project/plugins/package-version-plugins/package.d.ts +3 -0
  251. package/project/plugins/package-version-plugins/package.js +12 -0
  252. package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
  253. package/project/plugins/package-version-plugins/pkgdb.js +370 -0
  254. package/project/plugins/plugin-registry.d.ts +5 -1
  255. package/project/plugins/plugin-registry.js +10 -1
  256. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
  257. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
  258. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
  259. package/queries/catalog/call-context-query/call-context-query-executor.js +62 -8
  260. package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -2
  261. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  262. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
  263. package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
  264. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
  265. package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
  266. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
  267. package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
  268. package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
  269. package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
  270. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  271. package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
  272. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
  273. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  274. package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
  275. package/queries/catalog/dice-query/dice-query-executor.js +52 -0
  276. package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
  277. package/queries/catalog/dice-query/dice-query-format.js +102 -0
  278. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  279. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  280. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
  281. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  282. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
  283. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  284. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
  285. package/queries/catalog/linter-query/linter-query-executor.js +8 -0
  286. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  287. package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
  288. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  289. package/queries/catalog/origin-query/origin-query-format.js +1 -0
  290. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  291. package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
  292. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  293. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
  294. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  295. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
  296. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  297. package/queries/query.d.ts +18 -1
  298. package/queries/query.js +3 -1
  299. package/r-bridge/data/data.d.ts +7 -2
  300. package/r-bridge/data/data.js +8 -2
  301. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
  302. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
  303. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  304. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
  305. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
  306. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
  307. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
  308. package/r-bridge/parser.js +2 -9
  309. package/r-bridge/shell.d.ts +8 -1
  310. package/r-bridge/shell.js +26 -7
  311. package/search/flowr-search-builder.d.ts +2 -2
  312. package/search/flowr-search-builder.js +1 -1
  313. package/search/flowr-search-filters.d.ts +30 -9
  314. package/search/flowr-search-filters.js +26 -21
  315. package/search/search-executor/search-enrichers.d.ts +601 -1
  316. package/search/search-executor/search-enrichers.js +30 -6
  317. package/slicing/static/static-slicer.d.ts +39 -11
  318. package/slicing/static/static-slicer.js +44 -14
  319. package/util/collections/queue.d.ts +16 -0
  320. package/util/collections/queue.js +38 -0
  321. package/util/log.d.ts +1 -1
  322. package/util/log.js +1 -1
  323. package/util/mermaid/dfg.d.ts +2 -2
  324. package/util/mermaid/dfg.js +2 -2
  325. package/util/mermaid/mermaid.d.ts +4 -0
  326. package/util/mermaid/mermaid.js +8 -1
  327. package/util/objects.d.ts +9 -0
  328. package/util/objects.js +54 -0
  329. package/util/proc.d.ts +6 -0
  330. package/util/proc.js +20 -0
  331. package/util/version.js +10 -2
  332. package/cli/common/features.d.ts +0 -9
  333. package/cli/common/features.js +0 -35
  334. package/cli/script-core/statistics-core.d.ts +0 -6
  335. package/cli/script-core/statistics-core.js +0 -103
  336. package/cli/script-core/statistics-helper-core.d.ts +0 -6
  337. package/cli/script-core/statistics-helper-core.js +0 -85
  338. package/cli/statistics-app.d.ts +0 -11
  339. package/cli/statistics-app.js +0 -16
  340. package/cli/statistics-helper-app.d.ts +0 -11
  341. package/cli/statistics-helper-app.js +0 -14
  342. package/statistics/features/common-syntax-probability.d.ts +0 -38
  343. package/statistics/features/common-syntax-probability.js +0 -169
  344. package/statistics/features/feature.d.ts +0 -179
  345. package/statistics/features/feature.js +0 -38
  346. package/statistics/features/post-processing.d.ts +0 -18
  347. package/statistics/features/post-processing.js +0 -26
  348. package/statistics/features/supported/assignments/assignments.d.ts +0 -12
  349. package/statistics/features/supported/assignments/assignments.js +0 -56
  350. package/statistics/features/supported/assignments/post-process.d.ts +0 -6
  351. package/statistics/features/supported/assignments/post-process.js +0 -126
  352. package/statistics/features/supported/comments/comments.d.ts +0 -18
  353. package/statistics/features/supported/comments/comments.js +0 -143
  354. package/statistics/features/supported/comments/post-process.d.ts +0 -6
  355. package/statistics/features/supported/comments/post-process.js +0 -51
  356. package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
  357. package/statistics/features/supported/control-flow/control-flow.js +0 -69
  358. package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
  359. package/statistics/features/supported/control-flow/post-process.js +0 -66
  360. package/statistics/features/supported/data-access/data-access.d.ts +0 -15
  361. package/statistics/features/supported/data-access/data-access.js +0 -122
  362. package/statistics/features/supported/data-access/post-process.d.ts +0 -6
  363. package/statistics/features/supported/data-access/post-process.js +0 -108
  364. package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
  365. package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
  366. package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
  367. package/statistics/features/supported/defined-functions/post-process.js +0 -168
  368. package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
  369. package/statistics/features/supported/expression-list/post-process.js +0 -45
  370. package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
  371. package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
  372. package/statistics/features/supported/loops/loops.d.ts +0 -20
  373. package/statistics/features/supported/loops/loops.js +0 -81
  374. package/statistics/features/supported/loops/post-process.d.ts +0 -6
  375. package/statistics/features/supported/loops/post-process.js +0 -73
  376. package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
  377. package/statistics/features/supported/used-functions/post-process.js +0 -176
  378. package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
  379. package/statistics/features/supported/used-functions/used-functions.js +0 -99
  380. package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
  381. package/statistics/features/supported/used-packages/post-process.js +0 -122
  382. package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
  383. package/statistics/features/supported/used-packages/used-packages.js +0 -140
  384. package/statistics/features/supported/values/post-process.d.ts +0 -6
  385. package/statistics/features/supported/values/post-process.js +0 -73
  386. package/statistics/features/supported/values/values.d.ts +0 -14
  387. package/statistics/features/supported/values/values.js +0 -111
  388. package/statistics/features/supported/variables/post-process.d.ts +0 -15
  389. package/statistics/features/supported/variables/post-process.js +0 -126
  390. package/statistics/features/supported/variables/variables.d.ts +0 -15
  391. package/statistics/features/supported/variables/variables.js +0 -62
  392. package/statistics/meta-statistics.d.ts +0 -32
  393. package/statistics/meta-statistics.js +0 -16
  394. package/statistics/output/file-provider.d.ts +0 -36
  395. package/statistics/output/file-provider.js +0 -96
  396. package/statistics/output/print-stats.d.ts +0 -29
  397. package/statistics/output/print-stats.js +0 -81
  398. package/statistics/output/statistics-file.d.ts +0 -36
  399. package/statistics/output/statistics-file.js +0 -68
  400. package/statistics/statistics.d.ts +0 -29
  401. package/statistics/statistics.js +0 -108
  402. package/statistics/summarizer/auto-detect.d.ts +0 -5
  403. package/statistics/summarizer/auto-detect.js +0 -34
  404. package/statistics/summarizer/first-phase/process.d.ts +0 -6
  405. package/statistics/summarizer/first-phase/process.js +0 -81
  406. package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
  407. package/statistics/summarizer/post-process/clusterer.js +0 -40
  408. package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
  409. package/statistics/summarizer/post-process/file-based-count.js +0 -47
  410. package/statistics/summarizer/post-process/histogram.d.ts +0 -57
  411. package/statistics/summarizer/post-process/histogram.js +0 -126
  412. package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
  413. package/statistics/summarizer/post-process/post-process-output.js +0 -102
  414. package/statistics/summarizer/second-phase/process.d.ts +0 -15
  415. package/statistics/summarizer/second-phase/process.js +0 -118
  416. package/statistics/summarizer/summarizer.d.ts +0 -34
  417. package/statistics/summarizer/summarizer.js +0 -141
@@ -9,14 +9,17 @@ const linter_format_1 = require("../linter-format");
9
9
  const linter_tags_1 = require("../linter-tags");
10
10
  exports.USELESS_LOOP = {
11
11
  createSearch: () => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall),
12
- processSearchResult: (elements, useLessLoopConfig, { analyzer, dataflow, normalize, cfg }) => {
12
+ processSearchResult: async (elements, useLessLoopConfig, data) => {
13
+ const normalize = await data.normalize();
14
+ const dataflow = await data.dataflow();
15
+ const cfg = await data.controlflow();
13
16
  const results = elements.getElements().filter(e => {
14
17
  const vertex = dataflow.graph.getVertex(e.node.info.id);
15
18
  return vertex
16
19
  && (0, vertex_1.isFunctionCallVertex)(vertex)
17
20
  && vertex.origin !== 'unnamed'
18
21
  && useLessLoopConfig.loopyFunctions.has(vertex.origin[0]);
19
- }).filter(loop => (0, useless_loop_1.onlyLoopsOnce)(loop.node.info.id, dataflow.graph, cfg, normalize, analyzer.inspectContext())).map(res => ({
22
+ }).filter(loop => (0, useless_loop_1.onlyLoopsOnce)(loop.node.info.id, dataflow.graph, cfg, normalize, data.inspectContext())).map(res => ({
20
23
  certainty: linter_format_1.LintingResultCertainty.Certain,
21
24
  name: res.node.lexeme,
22
25
  loc: range_1.SourceLocation.fromNode(res.node) ?? range_1.SourceLocation.invalid(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.10.9",
3
+ "version": "2.11.0",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "repository": {
@@ -19,8 +19,6 @@
19
19
  "main-dev": "node -r ts-node/register --watch src/cli/flowr.ts",
20
20
  "publish-library": "cp .npmignore package.json README.md LICENSE dist/src/ && cd dist/src && npm publish --access public",
21
21
  "release": "npx release-it --ci",
22
- "stats": "ts-node src/cli/statistics-app.ts",
23
- "stats-helper": "ts-node src/cli/statistics-helper-app.ts",
24
22
  "slicer": "ts-node src/cli/slicer-app.ts",
25
23
  "benchmark-helper": "ts-node src/cli/benchmark-helper-app.ts",
26
24
  "benchmark": "npm run build-dev && node dist/src/cli/benchmark-app.js",
@@ -29,7 +27,8 @@
29
27
  "capabilities-markdown": "ts-node src/documentation/doc-capabilities.ts",
30
28
  "wiki": "ts-node src/cli/wiki.ts",
31
29
  "wiki:watch": "node -r ts-node/register --watch src/cli/wiki.ts --keep-alive",
32
- "build": "tsc --project .",
30
+ "build": "tsc --project . && npm run build:copy-data",
31
+ "build:copy-data": "node scripts/pkgdb-compress.mjs",
33
32
  "build-dev": "npm run build && npm run build:copy-wasm",
34
33
  "build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --tree-shaking=true --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm",
35
34
  "build:copy-wasm": "mkdir -p dist/node_modules/@davisvaughan/tree-sitter-r/ && mkdir -p dist/node_modules/web-tree-sitter && cp node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm dist/node_modules/@davisvaughan/tree-sitter-r/ && cp node_modules/web-tree-sitter/tree-sitter.wasm dist/node_modules/web-tree-sitter/",
@@ -38,6 +37,7 @@
38
37
  "license-compat": "license-checker-rseidelsohn --onlyAllow 'MIT;MPL-2.0;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD'",
39
38
  "doc": "typedoc",
40
39
  "test": "vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
40
+ "test:verbose": "FLOWR_VERBOSE=true vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
41
41
  "test:system": "vitest --dir test/system-tests --config test/system-tests/vitest.config.mts",
42
42
  "test:coverage": "npm run test -- --coverage",
43
43
  "test:full": "npm run test-full",
@@ -168,7 +168,7 @@
168
168
  "devDependencies": {
169
169
  "@commitlint/cli": "^20.5.0",
170
170
  "@commitlint/config-angular": "^20.5.0",
171
- "@eagleoutice/eslint-config-flowr": "^1.0.40",
171
+ "@eagleoutice/eslint-config-flowr": "^1.0.43",
172
172
  "@eslint/eslintrc": "^3.3.3",
173
173
  "@eslint/js": "^9.39.2",
174
174
  "@j-ulrich/release-it-regex-bumper": "^5.4.0",
@@ -27,6 +27,8 @@ export declare class FlowrAnalyzerCache<Parser extends KnownParser> extends Flow
27
27
  private callGraphCache;
28
28
  protected constructor(args: FlowrAnalyzerCacheOptions<Parser>);
29
29
  private initCacheProviders;
30
+ /** Free the current parse trees: tree-sitter trees live on the WASM heap, which the GC does not reclaim. */
31
+ private disposeParse;
30
32
  static create<Parser extends KnownParser>(data: FlowrAnalyzerCacheOptions<Parser>): FlowrAnalyzerCache<Parser>;
31
33
  receive(event: CacheInvalidationEvent): void;
32
34
  private get;
@@ -28,13 +28,21 @@ class FlowrAnalyzerCache extends flowr_cache_1.FlowrCache {
28
28
  this.controlFlowCache = new flowr_analyzer_controlflow_cache_1.FlowrAnalyzerControlFlowCache();
29
29
  this.callGraphCache = undefined;
30
30
  }
31
+ /** Free the current parse trees: tree-sitter trees live on the WASM heap, which the GC does not reclaim. */
32
+ disposeParse() {
33
+ const files = this.peekParse()?.files;
34
+ for (const file of files ?? []) {
35
+ file.parsed?.delete?.();
36
+ }
37
+ }
31
38
  static create(data) {
32
39
  return new FlowrAnalyzerCache(data);
33
40
  }
34
41
  receive(event) {
35
- super.receive(event);
36
42
  switch (event.type) {
37
43
  case "full" /* CacheInvalidationEventType.Full */:
44
+ this.disposeParse();
45
+ super.receive(event);
38
46
  this.initCacheProviders();
39
47
  break;
40
48
  default:
@@ -9,32 +9,30 @@ import { FlowrAnalyzerEnvironmentContext } from './flowr-analyzer-environment-co
9
9
  import type { ReadOnlyFlowrAnalyzerMetaContext } from './flowr-analyzer-meta-context';
10
10
  import { FlowrAnalyzerMetaContext } from './flowr-analyzer-meta-context';
11
11
  import type { FlowrAnalyzer } from '../flowr-analyzer';
12
+ import { FlowrAnalyzerGasContext, type ReadOnlyFlowrAnalyzerGasContext } from './flowr-analyzer-gas-context';
12
13
  /**
13
14
  * This is a read-only interface to the {@link FlowrAnalyzerContext}.
14
15
  * It prevents you from modifying the context, but allows you to inspect it (which is probably what you want when using the {@link FlowrAnalyzer}).
15
16
  * If you are a {@link FlowrAnalyzerPlugin} and want to modify the context, you can use the {@link FlowrAnalyzerContext} directly.
16
17
  */
17
18
  export interface ReadOnlyFlowrAnalyzerContext {
18
- /**
19
- * The meta context provides access to the project metadata such as name, version, and namespace.
20
- */
19
+ /** Project metadata such as name, version, and namespace. */
21
20
  readonly meta: ReadOnlyFlowrAnalyzerMetaContext;
22
- /**
23
- * The files context provides access to the files to be analyzed and their loading order.
24
- */
21
+ /** Files to be analyzed and their loading order. */
25
22
  readonly files: ReadOnlyFlowrAnalyzerFilesContext;
26
- /**
27
- * The dependencies context provides access to the identified dependencies and their versions.
28
- */
23
+ /** Identified dependencies and their versions. */
29
24
  readonly deps: ReadOnlyFlowrAnalyzerDependenciesContext;
30
- /**
31
- * The environment context provides access to the environment information used during analysis.
32
- */
25
+ /** Environment information used during analysis. */
33
26
  readonly env: ReadOnlyFlowrAnalyzerEnvironmentContext;
27
+ /** The configuration options used by the analyzer. */
28
+ readonly config: FlowrConfig;
34
29
  /**
35
- * The configuration options used by the analyzer.
30
+ * Resource-usage guard (gas).
31
+ * Call `ctx.gas.checkGas(key)` at expensive analysis sites to obtain the current pressure level.
32
+ * Returns `GasLevel.Normal` with zero overhead when gas is disabled for `key`.
33
+ * @see {@link ReadOnlyFlowrAnalyzerGasContext}
36
34
  */
37
- readonly config: FlowrConfig;
35
+ readonly gas: ReadOnlyFlowrAnalyzerGasContext;
38
36
  }
39
37
  /**
40
38
  * This summarizes the other context layers used by the {@link FlowrAnalyzer}.
@@ -52,6 +50,7 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
52
50
  readonly files: FlowrAnalyzerFilesContext;
53
51
  readonly deps: FlowrAnalyzerDependenciesContext;
54
52
  readonly env: FlowrAnalyzerEnvironmentContext;
53
+ readonly gas: FlowrAnalyzerGasContext;
55
54
  private _analyzer;
56
55
  readonly config: FlowrConfig;
57
56
  constructor(config: FlowrConfig, plugins: ReadonlyMap<PluginType, readonly FlowrAnalyzerPlugin[]>);
@@ -14,6 +14,7 @@ const config_1 = require("../../config");
14
14
  const flowr_file_1 = require("./flowr-file");
15
15
  const flowr_analyzer_environment_context_1 = require("./flowr-analyzer-environment-context");
16
16
  const flowr_analyzer_meta_context_1 = require("./flowr-analyzer-meta-context");
17
+ const flowr_analyzer_gas_context_1 = require("./flowr-analyzer-gas-context");
17
18
  /**
18
19
  * This summarizes the other context layers used by the {@link FlowrAnalyzer}.
19
20
  * Have a look at the attributes and layers listed below (e.g., {@link files} and {@link deps})
@@ -30,6 +31,7 @@ class FlowrAnalyzerContext {
30
31
  files;
31
32
  deps;
32
33
  env;
34
+ gas;
33
35
  _analyzer;
34
36
  config;
35
37
  constructor(config, plugins) {
@@ -40,6 +42,7 @@ class FlowrAnalyzerContext {
40
42
  const functions = new flowr_analyzer_functions_context_1.FlowrAnalyzerFunctionsContext(this);
41
43
  this.deps = new flowr_analyzer_dependencies_context_1.FlowrAnalyzerDependenciesContext(functions, (plugins.get(flowr_analyzer_plugin_1.PluginType.DependencyIdentification) ?? []));
42
44
  this.meta = new flowr_analyzer_meta_context_1.FlowrAnalyzerMetaContext();
45
+ this.gas = new flowr_analyzer_gas_context_1.FlowrAnalyzerGasContext(this, config.gas, (plugins.get(flowr_analyzer_plugin_1.PluginType.Gas) ?? []));
43
46
  }
44
47
  /**
45
48
  * Provides the analyzer associated with this context, if any.
@@ -77,6 +80,7 @@ class FlowrAnalyzerContext {
77
80
  this.files.reset();
78
81
  this.deps.reset();
79
82
  this.meta.reset();
83
+ this.gas.reset();
80
84
  }
81
85
  }
82
86
  exports.FlowrAnalyzerContext = FlowrAnalyzerContext;
@@ -1,11 +1,9 @@
1
1
  import { AbstractFlowrAnalyzerContext } from './abstract-flowr-analyzer-context';
2
- import { FlowrAnalyzerPackageVersionsPlugin } from '../plugins/package-version-plugins/flowr-analyzer-package-versions-plugin';
2
+ import { FlowrAnalyzerPackageVersionsPlugin, type PkgDbLoadedInfo } from '../plugins/package-version-plugins/flowr-analyzer-package-versions-plugin';
3
3
  import type { Package } from '../plugins/package-version-plugins/package';
4
4
  import type { FlowrAnalyzerFunctionsContext, ReadOnlyFlowrAnalyzerFunctionsContext } from './flowr-analyzer-functions-context';
5
5
  /**
6
- * This is a read-only interface to the {@link FlowrAnalyzerDependenciesContext}.
7
- * It prevents you from modifying the dependencies, but allows you to inspect them (which is probably what you want when using the {@link FlowrAnalyzer}).
8
- * If you are a {@link FlowrAnalyzerPackageVersionsPlugin} and want to modify the dependencies, you can use the {@link FlowrAnalyzerDependenciesContext} directly.
6
+ * Read-only interface to the {@link FlowrAnalyzerDependenciesContext} for inspecting dependencies without modifying them.
9
7
  */
10
8
  export interface ReadOnlyFlowrAnalyzerDependenciesContext {
11
9
  /**
@@ -28,21 +26,31 @@ export interface ReadOnlyFlowrAnalyzerDependenciesContext {
28
26
  * Get all dependencies known to this context.
29
27
  */
30
28
  getDependencies(): readonly Readonly<Package>[];
29
+ /**
30
+ * Metadata of the package databases the version plugins currently have loaded.
31
+ */
32
+ loadedPackageDatabases(): PkgDbLoadedInfo[];
31
33
  }
32
34
  /**
33
- * This context is responsible for managing the dependencies of the project, including their versions and interplays with {@link FlowrAnalyzerPackageVersionsPlugin}s.
34
- *
35
- * If you are interested in inspecting these dependencies, refer to {@link ReadOnlyFlowrAnalyzerDependenciesContext}.
35
+ * Manages the project's dependencies, their versions, and their interplay with {@link FlowrAnalyzerPackageVersionsPlugin}s.
36
36
  */
37
37
  export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnalyzerContext<undefined, void, FlowrAnalyzerPackageVersionsPlugin> implements ReadOnlyFlowrAnalyzerDependenciesContext {
38
38
  readonly name = "flowr-analyzer-dependencies-context";
39
39
  readonly functionsContext: FlowrAnalyzerFunctionsContext;
40
40
  private dependencies;
41
41
  private staticsLoaded;
42
+ /** resolvers consulted lazily to fill in exports; `existing` carries version info from other plugins */
43
+ private lazyResolvers;
44
+ private resolvedMisses;
42
45
  reset(): void;
46
+ /** Register a resolver consulted by {@link getDependency} to fill in a package's exports lazily. */
47
+ addLazyResolver(resolver: (name: string, existing?: Package) => Package | undefined): void;
48
+ loadedPackageDatabases(): PkgDbLoadedInfo[];
49
+ /** Eagerly mount every version plugin's package database up front (see `solver.eagerlyLoadPackageDatabase`). */
50
+ eagerlyLoadPackageDatabases(): void;
43
51
  constructor(functionsContext: FlowrAnalyzerFunctionsContext, plugins?: readonly FlowrAnalyzerPackageVersionsPlugin[]);
44
52
  resolveStaticDependencies(): void;
45
- addDependency(pkg: Package): void;
53
+ addDependency(pkg: Package): this;
46
54
  getDependency(name: string): Package | undefined;
47
55
  getDependencies(): Package[];
48
56
  }
@@ -4,18 +4,34 @@ exports.FlowrAnalyzerDependenciesContext = void 0;
4
4
  const abstract_flowr_analyzer_context_1 = require("./abstract-flowr-analyzer-context");
5
5
  const flowr_analyzer_package_versions_plugin_1 = require("../plugins/package-version-plugins/flowr-analyzer-package-versions-plugin");
6
6
  /**
7
- * This context is responsible for managing the dependencies of the project, including their versions and interplays with {@link FlowrAnalyzerPackageVersionsPlugin}s.
8
- *
9
- * If you are interested in inspecting these dependencies, refer to {@link ReadOnlyFlowrAnalyzerDependenciesContext}.
7
+ * Manages the project's dependencies, their versions, and their interplay with {@link FlowrAnalyzerPackageVersionsPlugin}s.
10
8
  */
11
9
  class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1.AbstractFlowrAnalyzerContext {
12
10
  name = 'flowr-analyzer-dependencies-context';
13
11
  functionsContext;
14
12
  dependencies = new Map();
15
13
  staticsLoaded = false;
14
+ /** resolvers consulted lazily to fill in exports; `existing` carries version info from other plugins */
15
+ lazyResolvers = [];
16
+ resolvedMisses = new Set();
16
17
  reset() {
17
18
  this.dependencies = new Map();
18
19
  this.staticsLoaded = false;
20
+ this.lazyResolvers = [];
21
+ this.resolvedMisses = new Set();
22
+ }
23
+ /** Register a resolver consulted by {@link getDependency} to fill in a package's exports lazily. */
24
+ addLazyResolver(resolver) {
25
+ this.lazyResolvers.push(resolver);
26
+ }
27
+ loadedPackageDatabases() {
28
+ return this.plugins.flatMap(p => p.loadedDatabases());
29
+ }
30
+ /** Eagerly mount every version plugin's package database up front (see `solver.eagerlyLoadPackageDatabase`). */
31
+ eagerlyLoadPackageDatabases() {
32
+ for (const p of this.plugins) {
33
+ p.preloadDatabasesSync();
34
+ }
19
35
  }
20
36
  constructor(functionsContext, plugins) {
21
37
  super(functionsContext.getAttachedContext(), flowr_analyzer_package_versions_plugin_1.FlowrAnalyzerPackageVersionsPlugin.defaultPlugin(), plugins);
@@ -33,12 +49,28 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
33
49
  else {
34
50
  this.dependencies.set(pkg.name, pkg);
35
51
  }
52
+ return this;
36
53
  }
37
54
  getDependency(name) {
38
55
  if (!this.staticsLoaded) {
39
56
  this.resolveStaticDependencies();
40
57
  }
41
- return this.dependencies.get(name);
58
+ const existing = this.dependencies.get(name);
59
+ // a package already carrying exports is complete; a version-only one is still enriched below
60
+ if (existing?.namespaceInfo || (!existing && this.resolvedMisses.has(name))) {
61
+ return existing;
62
+ }
63
+ if (!this.resolvedMisses.has(name)) {
64
+ for (const resolve of this.lazyResolvers) {
65
+ const resolved = resolve(name, existing);
66
+ if (resolved) {
67
+ this.addDependency(resolved); // merges exports into any existing version info
68
+ return this.dependencies.get(name);
69
+ }
70
+ }
71
+ this.resolvedMisses.add(name);
72
+ }
73
+ return existing;
42
74
  }
43
75
  getDependencies() {
44
76
  if (!this.staticsLoaded) {
@@ -3,8 +3,7 @@ import type { IEnvironment, REnvironmentInformation } from '../../dataflow/envir
3
3
  import type { DeepReadonly } from 'ts-essentials';
4
4
  import type { Fingerprint } from '../../slicing/static/fingerprint';
5
5
  /**
6
- * This is the read-only interface to the {@link FlowrAnalyzerEnvironmentContext},
7
- * which provides access to the built-in environment used during analysis.
6
+ * Read-only interface to the {@link FlowrAnalyzerEnvironmentContext}.
8
7
  */
9
8
  export interface ReadOnlyFlowrAnalyzerEnvironmentContext {
10
9
  /**
@@ -34,8 +33,7 @@ export interface ReadOnlyFlowrAnalyzerEnvironmentContext {
34
33
  makeEmptyEnv(): REnvironmentInformation;
35
34
  }
36
35
  /**
37
- * This context is responsible for providing the built-in environment.
38
- * It creates the built-in environment based on the configuration provided in the {@link FlowrAnalyzerContext}.
36
+ * Provides the built-in environment, created from the {@link FlowrAnalyzerContext} configuration.
39
37
  */
40
38
  export declare class FlowrAnalyzerEnvironmentContext implements ReadOnlyFlowrAnalyzerEnvironmentContext {
41
39
  readonly name = "flowr-analyzer-environment-context";
@@ -5,8 +5,7 @@ const environment_1 = require("../../dataflow/environments/environment");
5
5
  const built_in_config_1 = require("../../dataflow/environments/built-in-config");
6
6
  const fingerprint_1 = require("../../slicing/static/fingerprint");
7
7
  /**
8
- * This context is responsible for providing the built-in environment.
9
- * It creates the built-in environment based on the configuration provided in the {@link FlowrAnalyzerContext}.
8
+ * Provides the built-in environment, created from the {@link FlowrAnalyzerContext} configuration.
10
9
  */
11
10
  class FlowrAnalyzerEnvironmentContext {
12
11
  name = 'flowr-analyzer-environment-context';
@@ -29,7 +28,7 @@ class FlowrAnalyzerEnvironmentContext {
29
28
  }
30
29
  makeCleanEnv() {
31
30
  return {
32
- current: new environment_1.Environment(this.builtInEnv),
31
+ current: new environment_1.Environment(this.builtInEnv).asGlobal(),
33
32
  level: 0
34
33
  };
35
34
  }
@@ -41,7 +40,7 @@ class FlowrAnalyzerEnvironmentContext {
41
40
  }
42
41
  makeCleanEnvWithEmptyBuiltIns() {
43
42
  return {
44
- current: new environment_1.Environment(this.emptyBuiltInEnv),
43
+ current: new environment_1.Environment(this.emptyBuiltInEnv).asGlobal(),
45
44
  level: 0
46
45
  };
47
46
  }
@@ -25,6 +25,7 @@ export type RoleBasedFiles = {
25
25
  [FileRole.Vignette]: FlowrFileProvider[];
26
26
  [FileRole.Test]: FlowrFileProvider[];
27
27
  [FileRole.License]: FlowrFileProvider[];
28
+ [FileRole.VirtualEnv]: FlowrFileProvider[];
28
29
  [FileRole.Source]: FlowrFileProvider[];
29
30
  [FileRole.Data]: FlowrFileProvider[];
30
31
  [FileRole.Other]: FlowrFileProvider[];
@@ -56,6 +57,14 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
56
57
  * @returns An array of all files.
57
58
  */
58
59
  getAllFiles(): FlowrFileProvider[];
60
+ /**
61
+ * Get a file by its path.
62
+ * Checks both disk-backed files and inline files.
63
+ * However, this will not load new files that have not yet been requested by flowR.
64
+ * @param path - The exact path of the file.
65
+ * @returns The file if found, otherwise `undefined`.
66
+ */
67
+ getFileByPath(path: string): FlowrFileProvider | undefined;
59
68
  /**
60
69
  * Check if the context has a cached file with the given path.
61
70
  * @param path - The path to the file.
@@ -105,6 +114,8 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
105
114
  private readonly fileLoaders;
106
115
  /** these are all the paths of files that have been considered by the dataflow graph (even if not added) */
107
116
  private readonly consideredFiles;
117
+ /** User-registered project discovery plugins; if non-empty, they replace the default. */
118
+ private readonly discoveryPlugins;
108
119
  private byRole;
109
120
  constructor(loadingOrder: FlowrAnalyzerLoadingOrderContext, plugins: readonly FlowrAnalyzerProjectDiscoveryPlugin[], fileLoaders: readonly FlowrAnalyzerFilePlugin[]);
110
121
  reset(): void;
@@ -122,6 +133,7 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
122
133
  addRequests(requests: readonly RAnalysisRequest[]): void;
123
134
  /**
124
135
  * Add a request to the context. If the request is of type `project`, it will be expanded using the registered {@link FlowrAnalyzerProjectDiscoveryPlugin}s.
136
+ * User-registered discovery plugins replace the built-in default; if none are registered, the default runs.
125
137
  */
126
138
  private addRequest;
127
139
  /**
@@ -150,4 +162,5 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
150
162
  computeLoadingOrder(): readonly RParseRequest[];
151
163
  getFilesByRole<Role extends FileRole>(role: Role): RoleBasedFiles[Role];
152
164
  getAllFiles(): FlowrFileProvider[];
165
+ getFileByPath(path: string): FlowrFileProvider | undefined;
153
166
  }
@@ -39,10 +39,13 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
39
39
  fileLoaders;
40
40
  /** these are all the paths of files that have been considered by the dataflow graph (even if not added) */
41
41
  consideredFiles = [];
42
+ /** User-registered project discovery plugins; if non-empty, they replace the default. */
43
+ discoveryPlugins;
42
44
  /* files that are part of the analysis, e.g. source files */
43
45
  byRole = Object.fromEntries(Object.values(flowr_file_1.FileRole).map(k => [k, []]));
44
46
  constructor(loadingOrder, plugins, fileLoaders) {
45
- super(loadingOrder.getAttachedContext(), flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin(), plugins);
47
+ super(loadingOrder.getAttachedContext(), flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin(), []);
48
+ this.discoveryPlugins = plugins;
46
49
  this.fileLoaders = [...fileLoaders, flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin.defaultPlugin()];
47
50
  this.loadingOrder = loadingOrder;
48
51
  }
@@ -75,13 +78,17 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
75
78
  }
76
79
  /**
77
80
  * Add a request to the context. If the request is of type `project`, it will be expanded using the registered {@link FlowrAnalyzerProjectDiscoveryPlugin}s.
81
+ * User-registered discovery plugins replace the built-in default; if none are registered, the default runs.
78
82
  */
79
83
  addRequest(request) {
80
84
  if (request.request !== 'project') {
81
85
  this.loadingOrder.addRequest(request);
82
86
  return;
83
87
  }
84
- const expandedRequests = this.applyPlugins(request).flat();
88
+ const active = this.discoveryPlugins.length > 0
89
+ ? this.discoveryPlugins
90
+ : [flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin()];
91
+ const expandedRequests = active.flatMap(p => p.processor(this.ctx, request));
85
92
  for (const req of expandedRequests) {
86
93
  if ((0, retriever_1.isParseRequest)(req)) {
87
94
  this.addRequest(req);
@@ -233,6 +240,9 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
233
240
  getAllFiles() {
234
241
  return [...this.files.values(), ...this.inlineFiles];
235
242
  }
243
+ getFileByPath(path) {
244
+ return this.files.get(path) ?? this.inlineFiles.find(f => f.path() === path);
245
+ }
236
246
  }
237
247
  exports.FlowrAnalyzerFilesContext = FlowrAnalyzerFilesContext;
238
248
  //# sourceMappingURL=flowr-analyzer-files-context.js.map
@@ -0,0 +1,28 @@
1
+ import { type FlowrGasConfig, GasLevel } from '../../gas';
2
+ import type { FlowrAnalyzerGasPlugin } from '../plugins/gas-plugins/flowr-analyzer-gas-plugin';
3
+ import type { FlowrAnalyzerContext } from './flowr-analyzer-context';
4
+ /** Read-only gas context exposed via `ctx.gas`. */
5
+ export interface ReadOnlyFlowrAnalyzerGasContext {
6
+ readonly name: string;
7
+ /**
8
+ * Returns the resource-pressure level for `key` (`config.gas.features[key]`).
9
+ * Returns `GasLevel.Normal` with zero overhead when the feature factor is 0 or absent
10
+ * and no gas plugins are registered (plugins are always consulted and may escalate any key).
11
+ */
12
+ checkGas(key: string): GasLevel;
13
+ }
14
+ /** Checks heap and elapsed-time pressure for named analysis features. See {@link ReadOnlyFlowrAnalyzerGasContext}. */
15
+ export declare class FlowrAnalyzerGasContext implements ReadOnlyFlowrAnalyzerGasContext {
16
+ readonly name = "flowr-analyzer-gas-context";
17
+ private startTime;
18
+ private readonly config;
19
+ private readonly ctx;
20
+ private readonly plugins;
21
+ constructor(ctx: FlowrAnalyzerContext, config: FlowrGasConfig | undefined, plugins: readonly FlowrAnalyzerGasPlugin[]);
22
+ /** Restart the elapsed-time counter (called when the owning context is reset). */
23
+ reset(): void;
24
+ private memoryLevel;
25
+ private static maxLevel;
26
+ private timeLevel;
27
+ checkGas(key: string): GasLevel;
28
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerGasContext = void 0;
4
+ const log_1 = require("../../util/log");
5
+ let heapStatisticsProvider = undefined;
6
+ /**
7
+ * Heap statistics come from the v8 module (Node.js, Electron, VS Code extension host) or,
8
+ * as a fallback, from Chromium's non-standard performance.memory (browsers, web workers).
9
+ * If neither exists, this returns undefined and gas skips the memory check
10
+ * (use {@link FlowrGasConfig#heapProvider} or a gas plugin to supply a custom source).
11
+ */
12
+ function tryGetHeapStatistics() {
13
+ if (heapStatisticsProvider === undefined) {
14
+ const v8 = globalThis.process?.getBuiltinModule?.('v8');
15
+ if (v8) {
16
+ heapStatisticsProvider = v8.getHeapStatistics;
17
+ }
18
+ else if (globalThis.performance?.memory) {
19
+ heapStatisticsProvider = () => {
20
+ const m = globalThis.performance.memory;
21
+ return { used_heap_size: m.usedJSHeapSize, heap_size_limit: m.jsHeapSizeLimit };
22
+ };
23
+ }
24
+ else {
25
+ heapStatisticsProvider = null;
26
+ log_1.log.info('no heap statistics source available in this runtime, gas skips the memory check');
27
+ }
28
+ }
29
+ return heapStatisticsProvider ? heapStatisticsProvider() : undefined;
30
+ }
31
+ /** Checks heap and elapsed-time pressure for named analysis features. See {@link ReadOnlyFlowrAnalyzerGasContext}. */
32
+ class FlowrAnalyzerGasContext {
33
+ name = 'flowr-analyzer-gas-context';
34
+ startTime;
35
+ config;
36
+ ctx;
37
+ plugins;
38
+ constructor(ctx, config, plugins) {
39
+ this.ctx = ctx;
40
+ this.config = config;
41
+ this.plugins = plugins;
42
+ this.startTime = Date.now();
43
+ }
44
+ /** Restart the elapsed-time counter (called when the owning context is reset). */
45
+ reset() {
46
+ this.startTime = Date.now();
47
+ }
48
+ memoryLevel(factor, t) {
49
+ const stats = this.config?.heapProvider ? this.config.heapProvider() : tryGetHeapStatistics();
50
+ if (stats === undefined || stats.heap_size_limit <= 0) {
51
+ return 0 /* GasLevel.Normal */;
52
+ }
53
+ const ratio = (stats.used_heap_size / stats.heap_size_limit) * factor;
54
+ if (ratio >= t.memory.critical) {
55
+ return 2 /* GasLevel.Critical */;
56
+ }
57
+ if (ratio >= t.memory.problematic) {
58
+ return 1 /* GasLevel.Problematic */;
59
+ }
60
+ return 0 /* GasLevel.Normal */;
61
+ }
62
+ static maxLevel(a, b) {
63
+ return a >= b ? a : b;
64
+ }
65
+ timeLevel(factor, t) {
66
+ const elapsed = (Date.now() - this.startTime) * factor;
67
+ if (elapsed >= t.timeMs.critical) {
68
+ return 2 /* GasLevel.Critical */;
69
+ }
70
+ if (elapsed >= t.timeMs.problematic) {
71
+ return 1 /* GasLevel.Problematic */;
72
+ }
73
+ return 0 /* GasLevel.Normal */;
74
+ }
75
+ checkGas(key) {
76
+ const factor = this.config?.features?.[key];
77
+ if (!factor && this.plugins.length === 0) {
78
+ return 0 /* GasLevel.Normal */;
79
+ }
80
+ let level = 0 /* GasLevel.Normal */;
81
+ if (factor) {
82
+ const t = this.config.thresholds;
83
+ level = FlowrAnalyzerGasContext.maxLevel(level, this.memoryLevel(factor, t));
84
+ if (level < 2 /* GasLevel.Critical */) {
85
+ level = FlowrAnalyzerGasContext.maxLevel(level, this.timeLevel(factor, t));
86
+ }
87
+ }
88
+ for (const plugin of this.plugins) {
89
+ if (level >= 2 /* GasLevel.Critical */) {
90
+ break;
91
+ }
92
+ const override = plugin.processor(this.ctx, key);
93
+ if (override !== undefined) {
94
+ level = FlowrAnalyzerGasContext.maxLevel(level, override);
95
+ }
96
+ }
97
+ return level;
98
+ }
99
+ }
100
+ exports.FlowrAnalyzerGasContext = FlowrAnalyzerGasContext;
101
+ //# sourceMappingURL=flowr-analyzer-gas-context.js.map
@@ -25,6 +25,8 @@ export declare enum FileRole {
25
25
  Data = "data",
26
26
  /** Signals separate license files, but please note, that DESCRIPTION files may contain license info too */
27
27
  License = "license",
28
+ /** Files describing a project's virtual/pinned package environment, e.g., `renv.lock` or `rv.lock`. */
29
+ VirtualEnv = "virtual-env",
28
30
  /**
29
31
  * Catch-all for any file that provides usable R source code to incorporate into the analysis.
30
32
  * Please note, that the loading order/inclusion and even potential relevance of these source files
@@ -26,6 +26,8 @@ var FileRole;
26
26
  FileRole["Data"] = "data";
27
27
  /** Signals separate license files, but please note, that DESCRIPTION files may contain license info too */
28
28
  FileRole["License"] = "license";
29
+ /** Files describing a project's virtual/pinned package environment, e.g., `renv.lock` or `rv.lock`. */
30
+ FileRole["VirtualEnv"] = "virtual-env";
29
31
  /**
30
32
  * Catch-all for any file that provides usable R source code to incorporate into the analysis.
31
33
  * Please note, that the loading order/inclusion and even potential relevance of these source files
@@ -159,6 +159,9 @@ class FlowrAnalyzerBuilder {
159
159
  buildSync() {
160
160
  (0, assert_1.guard)(this.parser !== undefined, 'No parser set, please use the setParser or setEngine method to set a parser before building the analyzer');
161
161
  const context = new flowr_analyzer_context_1.FlowrAnalyzerContext(this.flowrConfig, this.plugins);
162
+ if (this.flowrConfig.solver.eagerlyLoadPackageDatabase) {
163
+ context.deps.eagerlyLoadPackageDatabases();
164
+ }
162
165
  const cache = flowr_analyzer_cache_1.FlowrAnalyzerCache.create({
163
166
  parser: this.parser,
164
167
  context,
@@ -197,7 +197,8 @@ export declare class FlowrAnalyzer<Parser extends KnownParser = KnownParser> imp
197
197
  query<Types extends SupportedQueryTypes = SupportedQueryTypes>(query: Queries<Types>): Promise<QueryResults<Types>>;
198
198
  runSearch<Search extends FlowrSearchLike>(search: Search): Promise<GetSearchElements<SearchOutput<Search>>>;
199
199
  /**
200
- * Close the parser if it was created by this builder. This is only required if you rely on an RShell/remote engine.
200
+ * Free the cached analyses (including any WASM-backed parse trees) and close the parser.
201
+ * Closing is only required for an RShell/remote engine, but this also frees the cached parse trees.
201
202
  */
202
203
  close(): boolean | void;
203
204
  }
@@ -146,9 +146,11 @@ class FlowrAnalyzer {
146
146
  return (0, flowr_search_executor_1.runSearch)(search, this);
147
147
  }
148
148
  /**
149
- * Close the parser if it was created by this builder. This is only required if you rely on an RShell/remote engine.
149
+ * Free the cached analyses (including any WASM-backed parse trees) and close the parser.
150
+ * Closing is only required for an RShell/remote engine, but this also frees the cached parse trees.
150
151
  */
151
152
  close() {
153
+ this.cache.reset();
152
154
  return this.parser?.close();
153
155
  }
154
156
  }