@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
@@ -88,6 +88,8 @@ class FlowRServerConnection {
88
88
  this.allowRSessionAccess = allowRSessionAccess;
89
89
  }
90
90
  currentMessageBuffer = '';
91
+ /* requests of a single client share one analyzer, so we handle them one after another to avoid racing on it */
92
+ requestQueue = Promise.resolve();
91
93
  handleData(message) {
92
94
  if (!message.endsWith('\n')) {
93
95
  this.currentMessageBuffer += message;
@@ -104,27 +106,31 @@ class FlowRServerConnection {
104
106
  (0, validate_1.answerForValidationError)(this.socket, request);
105
107
  return;
106
108
  }
107
- switch (request.message.type) {
109
+ this.requestQueue = this.requestQueue
110
+ .then(() => this.dispatch(request.message))
111
+ .catch(e => {
112
+ this.logger.error(`[${this.name}] Error while handling request: ${String(e)}`);
113
+ });
114
+ }
115
+ dispatch(message) {
116
+ switch (message.type) {
108
117
  case 'request-file-analysis':
109
- void this.handleFileAnalysisRequest(request.message);
110
- break;
118
+ return this.handleFileAnalysisRequest(message);
111
119
  case 'request-slice':
112
- this.handleSliceRequest(request.message);
113
- break;
120
+ return this.handleSliceRequest(message);
114
121
  case 'request-repl-execution':
115
- this.handleRepl(request.message);
116
- break;
122
+ return this.handleRepl(message);
117
123
  case 'request-query':
118
- this.handleQueryRequest(request.message);
119
- break;
124
+ return this.handleQueryRequest(message);
120
125
  default:
121
126
  (0, send_1.sendMessage)(this.socket, {
122
- id: request.message.id,
127
+ id: message.id,
123
128
  type: 'error',
124
129
  fatal: true,
125
- reason: `The message type ${JSON.stringify(request.message.type ?? 'undefined')} is not supported.`
130
+ reason: `The message type ${JSON.stringify(message.type ?? 'undefined')} is not supported.`
126
131
  });
127
132
  this.socket.end();
133
+ return Promise.resolve();
128
134
  }
129
135
  }
130
136
  async handleFileAnalysisRequest(base) {
@@ -135,6 +141,16 @@ class FlowRServerConnection {
135
141
  }
136
142
  const message = requestResult.message;
137
143
  this.logger.info(`[${this.name}] Received file analysis request for ${message.filename ?? 'unknown file'}${message.filetoken ? ' with token: ' + message.filetoken : ''}`);
144
+ if (message.content === undefined && message.filepath === undefined) {
145
+ (0, send_1.sendMessage)(this.socket, {
146
+ type: 'response-file-analysis',
147
+ format: 'json',
148
+ id: message.id,
149
+ results: {}
150
+ });
151
+ this.invalidateTokens(message.invalidateToken);
152
+ return;
153
+ }
138
154
  if (message.filetoken && this.fileMap.has(message.filetoken)) {
139
155
  this.logger.warn(`File token ${message.filetoken} already exists. Overwriting.`);
140
156
  // explicitly delete the previous store
@@ -156,6 +172,21 @@ class FlowRServerConnection {
156
172
  }
157
173
  // this is an interestingly named function that means "I am a callback that removes a file" - so this deletes the file
158
174
  tempFile.removeCallback();
175
+ this.invalidateTokens(message.invalidateToken);
176
+ }
177
+ invalidateTokens(invalidateToken) {
178
+ if (!invalidateToken) {
179
+ return;
180
+ }
181
+ const tokens = typeof invalidateToken === 'string' ? [invalidateToken] : invalidateToken;
182
+ for (const token of tokens) {
183
+ if (this.fileMap.delete(token)) {
184
+ this.logger.info(`[${this.name}] Invalidated file token ${token}`);
185
+ }
186
+ else {
187
+ this.logger.warn(`[${this.name}] Cannot invalidate unknown file token ${token}`);
188
+ }
189
+ }
159
190
  }
160
191
  async sendFileAnalysisResponse(analyzer, message) {
161
192
  let cfg = undefined;
@@ -228,7 +259,7 @@ class FlowRServerConnection {
228
259
  }
229
260
  return analyzer;
230
261
  }
231
- handleSliceRequest(base) {
262
+ async handleSliceRequest(base) {
232
263
  const requestResult = (0, validate_1.validateMessage)(base, message_slice_1.requestSliceMessage);
233
264
  if (requestResult.type === 'error') {
234
265
  (0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
@@ -246,19 +277,21 @@ class FlowRServerConnection {
246
277
  });
247
278
  return;
248
279
  }
249
- void fileInformation.analyzer.query([{
250
- type: 'static-slice',
251
- criteria: request.criterion,
252
- noMagicComments: request.noMagicComments,
253
- direction: request.direction
254
- }]).then(result => {
280
+ try {
281
+ const result = await fileInformation.analyzer.query([{
282
+ type: 'static-slice',
283
+ criteria: request.criterion,
284
+ noMagicComments: request.noMagicComments,
285
+ direction: request.direction
286
+ }]);
255
287
  (0, send_1.sendMessage)(this.socket, {
256
288
  type: 'response-slice',
257
289
  id: request.id,
258
290
  results: Object.fromEntries(Object.entries(result)
259
291
  .filter(([k]) => default_pipelines_1.DEFAULT_SLICING_PIPELINE.steps.get(k)?.executed === 1 /* PipelineStepStage.OncePerRequest */))
260
292
  });
261
- }).catch(e => {
293
+ }
294
+ catch (e) {
262
295
  this.logger.error(`[${this.name}] Error while analyzing file for token ${request.filetoken}: ${String(e)}`);
263
296
  (0, send_1.sendMessage)(this.socket, {
264
297
  id: request.id,
@@ -266,9 +299,9 @@ class FlowRServerConnection {
266
299
  fatal: false,
267
300
  reason: `Error while analyzing file for token ${request.filetoken}: ${String(e)}`
268
301
  });
269
- });
302
+ }
270
303
  }
271
- handleRepl(base) {
304
+ async handleRepl(base) {
272
305
  const requestResult = (0, validate_1.validateMessage)(base, message_repl_1.requestExecuteReplExpressionMessage);
273
306
  if (requestResult.type === 'error') {
274
307
  (0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
@@ -287,18 +320,17 @@ class FlowRServerConnection {
287
320
  .setConfig(this.config)
288
321
  .setParser(this.parser)
289
322
  .buildSync();
290
- void (0, core_1.replProcessAnswer)(analyzer, {
323
+ await (0, core_1.replProcessAnswer)(analyzer, {
291
324
  formatter: request.ansi ? ansi_1.ansiFormatter : ansi_1.voidFormatter,
292
325
  stdout: msg => out('stdout', msg),
293
326
  stderr: msg => out('stderr', msg)
294
- }, request.expression, this.allowRSessionAccess).then(() => {
295
- (0, send_1.sendMessage)(this.socket, {
296
- type: 'end-repl-execution',
297
- id: request.id
298
- });
327
+ }, request.expression, this.allowRSessionAccess);
328
+ (0, send_1.sendMessage)(this.socket, {
329
+ type: 'end-repl-execution',
330
+ id: request.id
299
331
  });
300
332
  }
301
- handleQueryRequest(base) {
333
+ async handleQueryRequest(base) {
302
334
  const requestResult = (0, validate_1.validateMessage)(base, message_query_1.requestQueryMessage);
303
335
  if (requestResult.type === 'error') {
304
336
  (0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
@@ -316,13 +348,15 @@ class FlowRServerConnection {
316
348
  });
317
349
  return;
318
350
  }
319
- void Promise.resolve(fileInformation.analyzer.query(request.query)).then(results => {
351
+ try {
352
+ const results = await fileInformation.analyzer.query(request.query);
320
353
  (0, send_1.sendMessage)(this.socket, {
321
354
  type: 'response-query',
322
355
  id: request.id,
323
356
  results
324
357
  });
325
- }).catch(e => {
358
+ }
359
+ catch (e) {
326
360
  this.logger.error(`[${this.name}] Error while executing query: ${String(e)}`);
327
361
  (0, send_1.sendMessage)(this.socket, {
328
362
  id: request.id,
@@ -330,7 +364,7 @@ class FlowRServerConnection {
330
364
  fatal: false,
331
365
  reason: `Error while executing query: ${String(e)}`
332
366
  });
333
- });
367
+ }
334
368
  }
335
369
  }
336
370
  exports.FlowRServerConnection = FlowRServerConnection;
@@ -34,6 +34,16 @@ export interface FileAnalysisRequestMessage extends IdMessageBase {
34
34
  cfg?: boolean;
35
35
  /** Controls the serialization of the `results` (and the {@link ControlFlowGraph} if the corresponding flag is set). If missing, we assume _json_. */
36
36
  format?: 'compact' | 'json' | 'n-quads';
37
+ /**
38
+ * One or more previously stored file tokens that the server should drop after it has answered this request.
39
+ * Use this to free the memory of analyses you no longer need.
40
+ *
41
+ * You may send a request that contains _only_ this field (without `content` or `filepath`) to drop tokens
42
+ * without performing a new analysis. In that case the server answers with an empty `results` object.
43
+ * As the tokens are dropped only after the response, you may also pass the request's own `filetoken` here to
44
+ * analyze a file once and have the server forget it immediately afterward.
45
+ */
46
+ invalidateToken?: string | readonly string[];
37
47
  }
38
48
  export declare const requestAnalysisMessage: MessageDefinition<FileAnalysisRequestMessage>;
39
49
  /**
@@ -15,8 +15,12 @@ exports.requestAnalysisMessage = {
15
15
  content: joi_1.default.string().optional().description('The content of the file or an R expression (either give this or the filepath).'),
16
16
  filepath: joi_1.default.alternatives(joi_1.default.string(), joi_1.default.array().items(joi_1.default.string())).optional().description('The path to the file(s) on the local machine (either give this or the content).'),
17
17
  cfg: joi_1.default.boolean().optional().description('If you want to extract the control flow information of the file.'),
18
- format: joi_1.default.string().valid('json', 'n-quads', 'compact').optional().description('The format of the results, if missing we assume json.')
19
- }).xor('content', 'filepath')
18
+ format: joi_1.default.string().valid('json', 'n-quads', 'compact').optional().description('The format of the results, if missing we assume json.'),
19
+ invalidateToken: joi_1.default.alternatives(joi_1.default.string(), joi_1.default.array().items(joi_1.default.string())).optional().description('One or more file tokens to drop from the server store after this request has been answered.')
20
+ }).when(joi_1.default.object({ invalidateToken: joi_1.default.exist() }).unknown(), {
21
+ then: joi_1.default.object().oxor('content', 'filepath'),
22
+ otherwise: joi_1.default.object().xor('content', 'filepath')
23
+ })
20
24
  };
21
25
  const jsonSchema = joi_1.default.object({
22
26
  type: joi_1.default.string().valid('response-file-analysis').required().description('The type of the message.'),
@@ -23,7 +23,7 @@ export interface SliceRequestMessage extends IdMessageBase {
23
23
  }
24
24
  export declare const requestSliceMessage: MessageDefinition<SliceRequestMessage>;
25
25
  /**
26
- * Similar to {@link FileAnalysisResponseMessage} this only contains the results of
26
+ * Similar to {@link FileAnalysisResponseMessageJson} this only contains the results of
27
27
  * the slice steps.
28
28
  */
29
29
  export interface SliceResponseMessage extends IdMessageBase {
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flowrScriptSummarizer = flowrScriptSummarizer;
4
- const summarizer_1 = require("../../statistics/summarizer/summarizer");
5
- const summarizer_2 = require("../../benchmark/summarizer/summarizer");
6
- const auto_detect_1 = require("../../statistics/summarizer/auto-detect");
7
- const feature_1 = require("../../statistics/features/feature");
4
+ const summarizer_1 = require("../../benchmark/summarizer/summarizer");
8
5
  function getBenchmarkSummarizer(options, outputBase) {
9
- return new summarizer_2.BenchmarkSummarizer({
6
+ return new summarizer_1.BenchmarkSummarizer({
10
7
  graphOutputPath: options.graph ? `${outputBase}-graph.json` : undefined,
11
8
  inputPath: options.input,
12
9
  intermediateOutputPath: outputBase,
@@ -14,40 +11,24 @@ function getBenchmarkSummarizer(options, outputBase) {
14
11
  logger: console.log
15
12
  });
16
13
  }
17
- function getStatisticsSummarizer(options, outputBase) {
18
- return new summarizer_1.StatisticsSummarizer({
19
- inputPath: options.input,
20
- outputPath: `${outputBase}-final`,
21
- intermediateOutputPath: `${outputBase}-intermediate/`,
22
- projectSkip: options['project-skip'],
23
- featuresToUse: feature_1.allFeatureNames,
24
- logger: console.log
25
- });
26
- }
27
- async function retrieveSummarizer(options, outputBase) {
28
- const type = options.type === 'auto' ? await (0, auto_detect_1.detectSummarizationType)(options.input) : options.type;
29
- if (type === "benchmark" /* SummarizerType.Benchmark */) {
30
- console.log('Summarizing benchmark');
31
- return getBenchmarkSummarizer(options, outputBase);
32
- }
33
- else if (type === "statistics" /* SummarizerType.Statistics */) {
34
- console.log('Summarizing statistics');
35
- return getStatisticsSummarizer(options, outputBase);
36
- }
37
- else {
38
- console.error('Unknown type', type, 'either give "benchmark" or "statistics"');
39
- process.exit(1);
40
- }
41
- }
42
14
  /**
43
15
  * The core function for the 'flowr summarize' script.
44
16
  */
45
17
  async function flowrScriptSummarizer(options) {
18
+ if (options.type && options.type !== 'benchmark') {
19
+ console.error(`Warning: --type ${options.type} is no longer supported. The summarizer only produces benchmark summaries.`);
20
+ }
21
+ if (options.categorize) {
22
+ console.error('Warning: --categorize is no longer supported.');
23
+ }
24
+ if (options['project-skip'] && options['project-skip'] > 0) {
25
+ console.error(`Warning: --project-skip ${options['project-skip']} is no longer supported.`);
26
+ }
46
27
  const outputBase = (options.output ?? options.input).replace(/\.json$|\/$/, '-summary');
47
28
  console.log(`Writing outputs to base ${outputBase}`);
48
- const summarizer = await retrieveSummarizer(options, outputBase);
29
+ const summarizer = getBenchmarkSummarizer(options, outputBase);
49
30
  if (!options['ultimate-only']) {
50
- await summarizer.preparationPhase(options.categorize);
31
+ await summarizer.preparationPhase();
51
32
  }
52
33
  await summarizer.summarizePhase();
53
34
  }
package/cli/wiki.d.ts CHANGED
@@ -9,7 +9,9 @@ import { WikiLinter } from '../documentation/wiki-linter';
9
9
  import { WikiSetup } from '../documentation/wiki-setup';
10
10
  import { WikiOverview } from '../documentation/wiki-overview';
11
11
  import { WikiAbsint } from '../documentation/wiki-absint';
12
- export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, IssueLintingRule, DocReadme, DocCapabilities];
12
+ import { WikiCreateLintingRules } from '../documentation/wiki-create-linting-rules';
13
+ import { WikiPackageDatabase } from '../documentation/wiki-package-database';
14
+ export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, WikiCreateLintingRules, WikiPackageDatabase, IssueLintingRule, DocReadme, DocCapabilities];
13
15
  export type ValidWikiDocumentTargets = ReturnType<typeof AllWikiDocuments[number]['getTarget']>;
14
16
  export type ValidWikiDocumentTargetsNoSuffix = ValidWikiDocumentTargets extends `${infer Name}.${string}` ? Name : never;
15
17
  /**
package/cli/wiki.js CHANGED
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AllWikiDocuments = void 0;
7
7
  exports.makeAllWikis = makeAllWikis;
8
+ const proc_1 = require("../util/proc");
8
9
  const doc_context_1 = require("../documentation/wiki-mk/doc-context");
9
10
  const shell_1 = require("../r-bridge/shell");
10
11
  const tree_sitter_executor_1 = require("../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor");
@@ -26,6 +27,8 @@ const os_1 = __importDefault(require("os"));
26
27
  const wiki_setup_1 = require("../documentation/wiki-setup");
27
28
  const wiki_overview_1 = require("../documentation/wiki-overview");
28
29
  const wiki_absint_1 = require("../documentation/wiki-absint");
30
+ const wiki_create_linting_rules_1 = require("../documentation/wiki-create-linting-rules");
31
+ const wiki_package_database_1 = require("../documentation/wiki-package-database");
29
32
  exports.AllWikiDocuments = [
30
33
  new wiki_faq_1.WikiFaq(),
31
34
  new documentation_1.WikiSearch(),
@@ -43,6 +46,8 @@ exports.AllWikiDocuments = [
43
46
  new documentation_1.WikiLintingAndTesting(),
44
47
  new wiki_linter_1.WikiLinter(),
45
48
  new wiki_absint_1.WikiAbsint(),
49
+ new wiki_create_linting_rules_1.WikiCreateLintingRules(),
50
+ new wiki_package_database_1.WikiPackageDatabase(),
46
51
  new issue_linting_rule_1.IssueLintingRule(),
47
52
  new doc_readme_1.DocReadme(),
48
53
  new documentation_1.DocCapabilities()
@@ -159,7 +164,7 @@ if (require.main === module) {
159
164
  }
160
165
  void makeAllWikis(options.force, options.filter).catch(err => {
161
166
  console.error('Error while generating wikis:', err);
162
- process.exit(1);
167
+ (0, proc_1.exitSafe)(1);
163
168
  }).then(() => {
164
169
  if (options['keep-alive']) {
165
170
  console.log('Wiki generator running in keep-alive mode...');
package/config.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { DataflowProcessors } from './dataflow/processor';
7
7
  import type { ParentInformation } from './r-bridge/lang-4.x/ast/model/processing/decorate';
8
8
  import type { FlowrAnalyzerContext } from './project/context/flowr-analyzer-context';
9
9
  import type { BuiltInFlowrPluginArgs, BuiltInFlowrPluginName } from './project/plugins/plugin-registry';
10
+ import { type FlowrGasConfig } from './gas';
10
11
  export declare enum VariableResolve {
11
12
  /** Don't resolve constants at all */
12
13
  Disabled = "disabled",
@@ -83,16 +84,6 @@ export interface FlowrLaxSourcingOptions extends MergeableRecord {
83
84
  * - `faa-bar.R` (replaced spaces and oo)
84
85
  */
85
86
  readonly applyReplacements?: Record<string, string>[];
86
- /**
87
- * Whether to check the heap memory usage before analyzing a sourced file,
88
- * skipping the analysis when memory pressure exceeds {@link memoryThreshold}.
89
- */
90
- readonly checkMemoryOnSource?: boolean;
91
- /**
92
- * Fraction of the V8 heap limit at which source analysis is skipped (0-1).
93
- * Only effective when {@link checkMemoryOnSource} is true.
94
- */
95
- readonly memoryThreshold?: number;
96
87
  }
97
88
  export type ConfigPlugin<T extends BuiltInFlowrPluginName | string> = T | string | (T extends BuiltInFlowrPluginName ? [T, BuiltInFlowrPluginArgs<T>] : [string, unknown[]]);
98
89
  /**
@@ -158,6 +149,19 @@ export interface FlowrConfig extends MergeableRecord {
158
149
  * When disabled all envir-style calls fall through to the conservative global treatment.
159
150
  */
160
151
  readonly trackEnvironments: boolean;
152
+ /**
153
+ * Materialize a built-in function-definition vertex for every export when a package is loaded
154
+ * (`library()`, `use()`, ...). By default (`false`) exports are only added to the environment
155
+ * and their vertices are created on demand, when a call actually resolves to one, keeping the
156
+ * dataflow graph small for large packages.
157
+ */
158
+ readonly eagerlyLoadPackages: boolean;
159
+ /**
160
+ * Mount the package database (e.g. the bundled `flowr-pkgdb`) up front instead of lazily on the
161
+ * first package load. By default (`false`) the database is parsed only when a `library()`/`use()`
162
+ * call first needs it, so scripts without package loads never pay for it.
163
+ */
164
+ readonly eagerlyLoadPackageDatabase: boolean;
161
165
  /** These keys are only intended for use within code, allowing to instrument the dataflow analyzer! */
162
166
  readonly instrument: {
163
167
  /**
@@ -218,6 +222,14 @@ export interface FlowrConfig extends MergeableRecord {
218
222
  };
219
223
  };
220
224
  };
225
+ /**
226
+ * Resource-usage guard (gas) configuration.
227
+ * Gas checks are disabled by default (all feature factors are `0`).
228
+ * Set a `feature factor > 0` to enable checking for that feature.
229
+ * @see {@link FlowrGasConfig}
230
+ * @see {@link ReadOnlyFlowrAnalyzerGasContext}
231
+ */
232
+ readonly gas: FlowrGasConfig;
221
233
  }
222
234
  export type ValidFlowrConfigPaths = Paths<FlowrConfig, {
223
235
  depth: 9;
package/config.js CHANGED
@@ -11,6 +11,7 @@ const log_1 = require("./util/log");
11
11
  const files_1 = require("./util/files");
12
12
  const joi_1 = __importDefault(require("joi"));
13
13
  const object_path_1 = __importDefault(require("object-path"));
14
+ const gas_1 = require("./gas");
14
15
  var VariableResolve;
15
16
  (function (VariableResolve) {
16
17
  /** Don't resolve constants at all */
@@ -53,6 +54,9 @@ const defaultEngineConfigs = {
53
54
  exports.FlowrDefaultPlugins = [
54
55
  'file:description',
55
56
  'versions:description',
57
+ 'versions:pkgdb',
58
+ 'versions:renv',
59
+ 'versions:rv',
56
60
  'loading-order:description',
57
61
  'meta:description',
58
62
  'files:vignette',
@@ -64,6 +68,7 @@ exports.FlowrDefaultPlugins = [
64
68
  'file:namespace',
65
69
  'file:news',
66
70
  'file:license',
71
+ 'file:virtualenv',
67
72
  ];
68
73
  /**
69
74
  * Helper Object to work with {@link FlowrConfig}, provides the default config and the Joi schema for validation.
@@ -100,14 +105,14 @@ exports.FlowrConfig = {
100
105
  variables: VariableResolve.Alias,
101
106
  evalStrings: true,
102
107
  trackEnvironments: true,
108
+ eagerlyLoadPackages: false,
109
+ eagerlyLoadPackageDatabase: false,
103
110
  resolveSource: {
104
111
  dropPaths: DropPathsOption.No,
105
112
  ignoreCapitalization: true,
106
113
  inferWorkingDirectory: InferWorkingDirectory.ActiveScript,
107
114
  searchPath: [],
108
- repeatedSourceLimit: 2,
109
- checkMemoryOnSource: true,
110
- memoryThreshold: 0.9
115
+ repeatedSourceLimit: 2
111
116
  },
112
117
  instrument: {
113
118
  dataflowExtractors: undefined
@@ -126,6 +131,13 @@ exports.FlowrConfig = {
126
131
  maxReadLines: 1e6
127
132
  }
128
133
  }
134
+ },
135
+ gas: {
136
+ thresholds: {
137
+ memory: { problematic: 0.7, critical: 0.9 },
138
+ timeMs: { problematic: 100_000, critical: 120_000 }
139
+ },
140
+ features: {}
129
141
  }
130
142
  };
131
143
  },
@@ -165,6 +177,8 @@ exports.FlowrConfig = {
165
177
  variables: joi_1.default.string().valid(...Object.values(VariableResolve)).description('How to resolve variables and their values.'),
166
178
  evalStrings: joi_1.default.boolean().description('Should we include eval(parse(text="...")) calls in the dataflow graph?'),
167
179
  trackEnvironments: joi_1.default.boolean().optional().description('Track user-created environments (new.env, assign/get/local with envir=, dollar-assign, attach). When false, all envir-style calls fall through conservatively.'),
180
+ eagerlyLoadPackages: joi_1.default.boolean().optional().description('Create a built-in vertex for every export when a package is loaded. When false (default), export vertices are created on demand as calls resolve to them, keeping the dataflow graph small.'),
181
+ eagerlyLoadPackageDatabase: joi_1.default.boolean().optional().description('Mount the package database up front instead of lazily on the first package load. When false (default), it is parsed only when a library()/use() call first needs it.'),
168
182
  instrument: joi_1.default.object({
169
183
  dataflowExtractors: joi_1.default.any().optional().description('These keys are only intended for use within code, allowing to instrument the dataflow analyzer!')
170
184
  }),
@@ -174,9 +188,7 @@ exports.FlowrConfig = {
174
188
  inferWorkingDirectory: joi_1.default.string().valid(...Object.values(InferWorkingDirectory)).description('Try to infer the working directory from the main or any script to analyze.'),
175
189
  searchPath: joi_1.default.array().items(joi_1.default.string()).description('Additionally search in these paths.'),
176
190
  repeatedSourceLimit: joi_1.default.number().optional().description('How often the same file can be sourced within a single run? Please be aware: in case of cyclic sources this may not reach a fixpoint so give this a sensible limit.'),
177
- applyReplacements: joi_1.default.array().items(joi_1.default.object()).description('Provide name replacements for loaded files'),
178
- checkMemoryOnSource: joi_1.default.boolean().optional().description('Check heap memory usage before analyzing a sourced file, skipping when memory pressure exceeds the configured threshold.'),
179
- memoryThreshold: joi_1.default.number().min(0).max(1).optional().description('Fraction of the V8 heap limit (0-1) at which source analysis is skipped. Only effective when checkMemoryOnSource is true.')
191
+ applyReplacements: joi_1.default.array().items(joi_1.default.object()).description('Provide name replacements for loaded files')
180
192
  }).optional().description('If lax source calls are active, flowR searches for sourced files much more freely, based on the configurations you give it. This option is only in effect if `ignoreSourceCalls` is set to false.'),
181
193
  slicer: joi_1.default.object({
182
194
  threshold: joi_1.default.number().optional().description('The maximum number of iterations to perform on a single function call during slicing.'),
@@ -192,7 +204,21 @@ exports.FlowrConfig = {
192
204
  maxReadLines: joi_1.default.number().min(1).description('The maximum number of lines to read when extracting data frame shapes from loaded files, such as CSV files.')
193
205
  }).description('Configuration options for reading data frame shapes from loaded external data files, such as CSV files.')
194
206
  }).description('The configuration of the shape inference for data frames.')
195
- }).description('The configuration options for abstract interpretation.')
207
+ }).description('The configuration options for abstract interpretation.'),
208
+ gas: joi_1.default.object({
209
+ thresholds: joi_1.default.object({
210
+ memory: joi_1.default.object({
211
+ problematic: joi_1.default.number().min(0).max(1).optional().description('Heap fraction (0-1) above which Problematic is returned.'),
212
+ critical: joi_1.default.number().min(0).max(1).optional().description('Heap fraction (0-1) above which Critical is returned.')
213
+ }).optional().description('Heap-usage fraction thresholds (0-1).'),
214
+ timeMs: joi_1.default.object({
215
+ problematic: joi_1.default.number().min(0).optional().description('Elapsed ms above which Problematic is returned.'),
216
+ critical: joi_1.default.number().min(0).optional().description('Elapsed ms above which Critical is returned.')
217
+ }).optional().description('Elapsed analysis time thresholds in milliseconds.')
218
+ }).optional().description('Shared thresholds for all gas checks (scaled by per-feature factor).'),
219
+ features: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.number().min(0).optional()).optional().description('Per-feature sensitivity factors. 0 or absent disables gas checking for that feature. A factor of 2 makes the feature twice as sensitive. Recognised keys: `source`, `side-effect-linking`, `linter`.'),
220
+ heapProvider: joi_1.default.function().optional().description('Custom heap statistics source (programmatic configs only), overriding the built-in v8/performance.memory detection.')
221
+ }).optional().description(`Resource-usage guard (gas) configuration. All feature factors default to 0 (disabled). See ${gas_1.GasWikiRef}.`)
196
222
  }).description('The configuration file format for flowR.'),
197
223
  /**
198
224
  * Parses the given JSON string as a flowR config file, returning the resulting config object if the parsing and validation were successful, or `undefined` if there was an error.
@@ -4,6 +4,6 @@ import { type ControlFlowGraph } from './control-flow-graph';
4
4
  /**
5
5
  * Compare two control flow graphs and return a report on the differences.
6
6
  * If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
7
- * @see {@link diffOfDataflowGraphs} - for dataflow graphs
7
+ * @see {@link diffDataflowGraph} - for dataflow graphs
8
8
  */
9
9
  export declare function diffOfControlFlowGraphs(left: NamedGraph<ControlFlowGraph>, right: NamedGraph<ControlFlowGraph>, config?: Partial<GenericDiffConfiguration>): GraphDifferenceReport;
@@ -9,7 +9,7 @@ const arrays_1 = require("../util/collections/arrays");
9
9
  /**
10
10
  * Compare two control flow graphs and return a report on the differences.
11
11
  * If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
12
- * @see {@link diffOfDataflowGraphs} - for dataflow graphs
12
+ * @see {@link diffDataflowGraph} - for dataflow graphs
13
13
  */
14
14
  function diffOfControlFlowGraphs(left, right, config) {
15
15
  if (left.graph === right.graph) {
@@ -253,7 +253,9 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
253
253
  return this.onRecallCall({ call });
254
254
  case built_in_proc_name_1.BuiltInProcName.PurrrFormula:
255
255
  return this.onPurrFormulaCall({ call });
256
+ case built_in_proc_name_1.BuiltInProcName.NamespaceAccess:
256
257
  case built_in_proc_name_1.BuiltInProcName.NewEnv:
258
+ case built_in_proc_name_1.BuiltInProcName.StackEnv:
257
259
  case built_in_proc_name_1.BuiltInProcName.With:
258
260
  case built_in_proc_name_1.BuiltInProcName.Attach:
259
261
  case built_in_proc_name_1.BuiltInProcName.Default:
@@ -4,6 +4,7 @@ exports.visitCfgInReverseOrder = visitCfgInReverseOrder;
4
4
  exports.visitCfgInOrder = visitCfgInOrder;
5
5
  exports.canReach = canReach;
6
6
  const control_flow_graph_1 = require("./control-flow-graph");
7
+ const queue_1 = require("../util/collections/queue");
7
8
  /**
8
9
  * Visit all nodes reachable from the start node in the control flow graph, traversing the dependencies but ignoring cycles.
9
10
  * @param graph - The control flow graph.
@@ -58,10 +59,10 @@ function visitCfgInOrder(graph, startNodes,
58
59
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type -- void is used to indicate that the return value is ignored/we never stop
59
60
  visitor) {
60
61
  const visited = new Set();
61
- const queue = startNodes.slice();
62
+ const queue = new queue_1.ArrayQueue(startNodes);
62
63
  const hasBb = graph.mayHaveBasicBlocks();
63
- while (queue.length > 0) {
64
- const current = queue.shift();
64
+ while (!queue.isEmpty()) {
65
+ const current = queue.dequeue();
65
66
  if (visited.has(current)) {
66
67
  continue;
67
68
  }
@@ -74,13 +75,13 @@ visitor) {
74
75
  if (control_flow_graph_1.CfgVertex.isBlock(get)) {
75
76
  const elems = control_flow_graph_1.CfgVertex.getBasicBlockElements(get);
76
77
  for (const e of elems.toReversed()) {
77
- queue.push(control_flow_graph_1.CfgVertex.getId(e));
78
+ queue.enqueue(control_flow_graph_1.CfgVertex.getId(e));
78
79
  }
79
80
  }
80
81
  }
81
82
  const outgoing = graph.ingoingEdges(current) ?? [];
82
83
  for (const [to] of outgoing) {
83
- queue.push(to);
84
+ queue.enqueue(to);
84
85
  }
85
86
  }
86
87
  return visited;
@@ -93,14 +93,14 @@ class CfgSingleIterationLoopDetector extends semantic_cfg_guided_visitor_1.Seman
93
93
  (0, assert_1.guard)(exits.size !== 0, "Can't find end of loop");
94
94
  const stack = [this.loopToCheck];
95
95
  while (stack.length > 0) {
96
- const current = stack.shift();
96
+ const current = stack.pop();
97
97
  if (!this.visitNode(current)) {
98
98
  continue;
99
99
  }
100
100
  if (!exits.has(current)) {
101
101
  const next = ingoing(current) ?? [];
102
102
  for (const [to] of next) {
103
- stack.unshift(to);
103
+ stack.push(to);
104
104
  }
105
105
  }
106
106
  this.onlyLoopyOnce ||= this.encounteredLoopBreaker && (0, info_1.happensInEveryBranch)(this.loopCds?.filter(c => !c.byIteration));
@@ -5,8 +5,8 @@ export declare function dataflowGraphToJson(df: DataflowInformation): string;
5
5
  /**
6
6
  * Transforms the dataflow graph into a quad serialization.
7
7
  * @see {@link df2quads}
8
- * @see {@link dataflowGraphToMermaidUrl}
9
- * @see {@link dataflowGraphToMermaid}
8
+ * @see {@link DataflowMermaid.url}
9
+ * @see {@link DataflowMermaid.convert}
10
10
  * @see {@link dataflowGraphToJson}
11
11
  */
12
12
  export declare function dataflowGraphToQuads(df: DataflowInformation, config: QuadSerializationConfiguration): string;
@@ -52,8 +52,8 @@ function dataflowGraphToJson(df) {
52
52
  /**
53
53
  * Transforms the dataflow graph into a quad serialization.
54
54
  * @see {@link df2quads}
55
- * @see {@link dataflowGraphToMermaidUrl}
56
- * @see {@link dataflowGraphToMermaid}
55
+ * @see {@link DataflowMermaid.url}
56
+ * @see {@link DataflowMermaid.convert}
57
57
  * @see {@link dataflowGraphToJson}
58
58
  */
59
59
  function dataflowGraphToQuads(df, config) {
@@ -9,7 +9,7 @@ function processor(results, input) {
9
9
  const direction = input.direction ?? slice_direction_1.SliceDirection.Backward;
10
10
  const threshold = input.threshold ?? input.context?.config.solver.slicer?.threshold;
11
11
  const n = results.normalize;
12
- return (0, static_slicer_1.staticSlice)(input.context, results.dataflow, n, parse_1.SlicingCriteria.convertAll(input.criterion, n.idMap), direction, threshold);
12
+ return (0, static_slicer_1.staticSlice)({ ctx: input.context, info: results.dataflow, ast: n, ids: parse_1.SlicingCriteria.convertAll(input.criterion, n.idMap), direction, threshold });
13
13
  }
14
14
  exports.STATIC_SLICE = {
15
15
  name: 'slice',
Binary file
Binary file