@eagleoutice/flowr 2.12.3 → 2.13.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 (319) hide show
  1. package/README.md +38 -91
  2. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
  3. package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
  4. package/abstract-interpretation/data-frame/semantics.js +12 -16
  5. package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
  6. package/abstract-interpretation/domains/abstract-domain.js +146 -6
  7. package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
  8. package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
  9. package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
  10. package/abstract-interpretation/domains/interval-domain.js +111 -146
  11. package/abstract-interpretation/domains/lattice.d.ts +3 -3
  12. package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
  13. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
  14. package/abstract-interpretation/domains/partial-product-domain.js +21 -54
  15. package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
  16. package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
  17. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/product-domain.js +4 -4
  19. package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
  20. package/abstract-interpretation/domains/set-range-domain.js +141 -200
  21. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
  22. package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
  23. package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
  24. package/abstract-interpretation/domains/singleton-domain.js +33 -72
  25. package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
  26. package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
  27. package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
  28. package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
  29. package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
  30. package/benchmark/slicer.d.ts +2 -2
  31. package/benchmark/slicer.js +6 -5
  32. package/cli/common/options.d.ts +10 -0
  33. package/cli/common/options.js +2 -0
  34. package/cli/common/scripts-info.d.ts +10 -0
  35. package/cli/flowr-main-options.d.ts +4 -0
  36. package/cli/flowr-main-options.js +5 -0
  37. package/cli/flowr.d.ts +5 -0
  38. package/cli/flowr.js +15 -7
  39. package/cli/repl/commands/repl-query.js +42 -20
  40. package/cli/repl/commands/repl-signature.js +2 -2
  41. package/cli/repl/core.d.ts +14 -5
  42. package/cli/repl/core.js +32 -17
  43. package/cli/repl/parser/slice-query-parser.d.ts +69 -8
  44. package/cli/repl/parser/slice-query-parser.js +82 -13
  45. package/cli/repl/path-input.d.ts +6 -0
  46. package/cli/repl/path-input.js +41 -0
  47. package/cli/repl/print-version.js +3 -5
  48. package/cli/slicer-app.d.ts +2 -0
  49. package/cli/slicer-app.js +2 -1
  50. package/config.d.ts +54 -6
  51. package/config.js +133 -12
  52. package/control-flow/control-flow-graph.d.ts +3 -2
  53. package/control-flow/control-flow-graph.js +34 -14
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
  55. package/control-flow/semantic-cfg-guided-visitor.js +3 -0
  56. package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
  57. package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
  58. package/data/r-base-packages.generated.d.ts +1 -1
  59. package/data/r-base-packages.generated.js +3 -3
  60. package/data/sigdb/sigdb.remote.json +53 -53
  61. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  62. package/dataflow/environments/built-in-proc-name.js +2 -0
  63. package/dataflow/environments/built-in.d.ts +2 -0
  64. package/dataflow/environments/built-in.js +2 -0
  65. package/dataflow/environments/default-builtin-config.d.ts +3 -5
  66. package/dataflow/environments/default-builtin-config.js +2 -2
  67. package/dataflow/environments/environment.d.ts +9 -0
  68. package/dataflow/environments/environment.js +28 -7
  69. package/dataflow/environments/identifier.d.ts +1 -2
  70. package/dataflow/environments/identifier.js +1 -5
  71. package/dataflow/extractor.js +1 -2
  72. package/dataflow/graph/dataflowgraph-builder.js +42 -3
  73. package/dataflow/graph/df-helper.d.ts +15 -0
  74. package/dataflow/graph/df-helper.js +20 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
  76. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  77. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
  80. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
  84. package/documentation/data/faq/faqs.js +12 -1
  85. package/documentation/doc-readme.js +1 -1
  86. package/documentation/doc-util/doc-files.d.ts +2 -2
  87. package/documentation/doc-util/doc-files.js +4 -7
  88. package/documentation/doc-util/doc-query.d.ts +12 -9
  89. package/documentation/doc-util/doc-query.js +63 -28
  90. package/documentation/wiki-absint.js +1 -4
  91. package/documentation/wiki-analyzer.js +8 -3
  92. package/documentation/wiki-cfg.js +3 -2
  93. package/documentation/wiki-dataflow-graph.js +14 -4
  94. package/documentation/wiki-interface.js +29 -16
  95. package/documentation/wiki-mk/doc-maker.js +1 -1
  96. package/documentation/wiki-query.js +189 -30
  97. package/documentation/wiki-signature-database.d.ts +1 -1
  98. package/documentation/wiki-signature-database.js +53 -27
  99. package/linter/linter-output.d.ts +24 -0
  100. package/linter/linter-output.js +117 -0
  101. package/linter/linter-rules.d.ts +2 -4
  102. package/linter/rules/dataframe-access-validation.js +4 -4
  103. package/linter/rules/deprecated-functions.d.ts +2 -4
  104. package/linter/rules/deprecated-functions.js +58 -3
  105. package/linter/rules/undefined-symbol.js +18 -10
  106. package/linter/rules/unused-definition.js +24 -0
  107. package/package.json +5 -2
  108. package/project/context/flowr-analyzer-context.d.ts +59 -1
  109. package/project/context/flowr-analyzer-context.js +118 -3
  110. package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
  111. package/project/context/flowr-analyzer-dependencies-context.js +33 -3
  112. package/project/context/flowr-analyzer-files-context.d.ts +32 -0
  113. package/project/context/flowr-analyzer-files-context.js +132 -14
  114. package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
  115. package/project/context/flowr-analyzer-loading-order-context.js +20 -0
  116. package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
  117. package/project/context/flowr-analyzer-meta-context.js +64 -23
  118. package/project/context/flowr-file.d.ts +7 -0
  119. package/project/context/flowr-file.js +7 -0
  120. package/project/context/project-kind.d.ts +22 -0
  121. package/project/context/project-kind.js +27 -0
  122. package/project/dependency-version-space.d.ts +166 -0
  123. package/project/dependency-version-space.js +564 -0
  124. package/project/flowr-analyzer-builder.js +1 -1
  125. package/project/flowr-analyzer.d.ts +4 -0
  126. package/project/flowr-analyzer.js +5 -0
  127. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  128. package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
  129. package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
  130. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
  131. package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
  132. package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
  133. package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
  134. package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
  135. package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
  136. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  137. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  138. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
  139. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
  140. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
  141. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
  142. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
  143. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
  144. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
  145. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
  146. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
  147. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
  148. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
  149. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
  150. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
  151. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
  152. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
  153. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
  154. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  155. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
  156. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  157. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
  158. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
  159. package/project/plugins/flowr-analyzer-plugin.js +5 -0
  160. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
  161. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  162. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
  163. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
  164. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
  165. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
  166. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
  167. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
  168. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
  169. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
  170. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
  171. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
  172. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
  175. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
  176. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
  177. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
  178. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
  179. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
  180. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
  181. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
  182. package/project/plugins/package-version-plugins/package.d.ts +4 -1
  183. package/project/plugins/package-version-plugins/package.js +8 -5
  184. package/project/plugins/plugin-registry.d.ts +11 -3
  185. package/project/plugins/plugin-registry.js +24 -5
  186. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
  187. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
  188. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
  189. package/project/sigdb/build.js +12 -2
  190. package/project/sigdb/decode.d.ts +7 -0
  191. package/project/sigdb/decode.js +35 -4
  192. package/project/sigdb/decompress.d.ts +2 -0
  193. package/project/sigdb/decompress.js +5 -0
  194. package/project/sigdb/manifest.d.ts +5 -0
  195. package/project/sigdb/manifest.js +37 -6
  196. package/project/sigdb/reader.d.ts +82 -2
  197. package/project/sigdb/reader.js +226 -14
  198. package/project/sigdb/schema.d.ts +31 -5
  199. package/project/sigdb/schema.js +7 -3
  200. package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
  201. package/project/sigdb/sigdb-version.js +119 -0
  202. package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
  203. package/queries/catalog/absint-query/absint-query-format.js +2 -0
  204. package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
  205. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
  206. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  207. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  208. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
  209. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
  210. package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
  211. package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
  212. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
  213. package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
  214. package/queries/catalog/config-query/config-query-executor.js +15 -6
  215. package/queries/catalog/config-query/config-query-format.d.ts +18 -4
  216. package/queries/catalog/config-query/config-query-format.js +246 -96
  217. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
  218. package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
  219. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
  220. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
  221. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
  222. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
  223. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
  224. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
  225. package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
  226. package/queries/catalog/dice-query/dice-query-executor.js +6 -9
  227. package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
  228. package/queries/catalog/dice-query/dice-query-format.js +10 -6
  229. package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
  230. package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
  231. package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
  232. package/queries/catalog/files-query/files-query-format.d.ts +2 -0
  233. package/queries/catalog/files-query/files-query-format.js +2 -0
  234. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
  235. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +277 -0
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +119 -0
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +331 -0
  238. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
  239. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
  240. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
  241. package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
  242. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  243. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
  244. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  245. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
  246. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  247. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
  248. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
  249. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
  250. package/queries/catalog/linter-query/linter-query-executor.js +11 -2
  251. package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
  252. package/queries/catalog/linter-query/linter-query-format.js +44 -21
  253. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  254. package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
  255. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
  256. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
  257. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  258. package/queries/catalog/origin-query/origin-query-format.js +2 -0
  259. package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
  260. package/queries/catalog/project-query/project-query-executor.js +19 -62
  261. package/queries/catalog/project-query/project-query-format.d.ts +7 -18
  262. package/queries/catalog/project-query/project-query-format.js +3 -18
  263. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  264. package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
  265. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  266. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
  267. package/queries/catalog/search-query/search-query-format.d.ts +1 -0
  268. package/queries/catalog/search-query/search-query-format.js +1 -0
  269. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
  270. package/queries/catalog/signature-query/signature-query-executor.js +267 -57
  271. package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
  272. package/queries/catalog/signature-query/signature-query-format.js +41 -5
  273. package/queries/catalog/signature-query/signature-query-render.js +48 -6
  274. package/queries/catalog/slice-query-options.d.ts +49 -0
  275. package/queries/catalog/slice-query-options.js +50 -0
  276. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
  277. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
  278. package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
  279. package/queries/query-print.js +3 -1
  280. package/queries/query.d.ts +63 -3
  281. package/queries/query.js +9 -2
  282. package/r-bridge/data/data.d.ts +16 -0
  283. package/r-bridge/data/data.js +20 -0
  284. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
  285. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  286. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  287. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
  288. package/reconstruct/reconstruct.d.ts +18 -1
  289. package/reconstruct/reconstruct.js +42 -19
  290. package/slicing/criterion/parse.d.ts +4 -0
  291. package/slicing/criterion/parse.js +4 -0
  292. package/slicing/static/slice-call.js +17 -9
  293. package/slicing/static/static-slicer.d.ts +1 -1
  294. package/slicing/static/static-slicer.js +5 -4
  295. package/util/files.d.ts +19 -1
  296. package/util/files.js +45 -3
  297. package/util/glob.d.ts +19 -0
  298. package/util/glob.js +67 -0
  299. package/util/log.d.ts +12 -0
  300. package/util/log.js +17 -1
  301. package/util/logic.d.ts +6 -0
  302. package/util/logic.js +31 -1
  303. package/util/mermaid/dfg.js +17 -12
  304. package/util/mermaid/mermaid.js +2 -2
  305. package/util/objects.d.ts +5 -0
  306. package/util/objects.js +8 -0
  307. package/util/r-version.d.ts +9 -1
  308. package/util/r-version.js +27 -2
  309. package/util/schema.d.ts +16 -0
  310. package/util/schema.js +89 -4
  311. package/util/text/ansi.d.ts +4 -0
  312. package/util/text/ansi.js +27 -3
  313. package/util/text/strings.d.ts +9 -0
  314. package/util/text/strings.js +29 -0
  315. package/util/version.js +79 -6
  316. package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
  317. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
  318. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
  319. package/project/sigdb/version.js +0 -55
@@ -1,8 +1,11 @@
1
1
  import { FlowrAnalyzerFilesContext, type RAnalysisRequest, type ReadOnlyFlowrAnalyzerFilesContext } from './flowr-analyzer-files-context';
2
+ import type { ProjectKind } from './project-kind';
2
3
  import { FlowrAnalyzerDependenciesContext, type ReadOnlyFlowrAnalyzerDependenciesContext } from './flowr-analyzer-dependencies-context';
4
+ import type { Range } from 'semver';
3
5
  import { type FlowrAnalyzerPlugin, PluginType } from '../plugins/flowr-analyzer-plugin';
4
6
  import type { fileProtocol, RParseRequestFromFile, RParseRequests } from '../../r-bridge/retriever';
5
7
  import { FlowrConfig } from '../../config';
8
+ import type { DeepPartial } from 'ts-essentials';
6
9
  import type { FlowrFileProvider } from './flowr-file';
7
10
  import type { ReadOnlyFlowrAnalyzerEnvironmentContext } from './flowr-analyzer-environment-context';
8
11
  import { FlowrAnalyzerEnvironmentContext } from './flowr-analyzer-environment-context';
@@ -26,8 +29,21 @@ export interface ReadOnlyFlowrAnalyzerContext {
26
29
  readonly env: ReadOnlyFlowrAnalyzerEnvironmentContext;
27
30
  /** The configuration options used by the analyzer. */
28
31
  readonly config: FlowrConfig;
32
+ /** class names of plugins that activated (produced a result) since the last reset; only filled when `config.repl.showPlugins` is set */
33
+ readonly activatedPlugins: ReadonlySet<string>;
34
+ /** The project kind the effective {@link config} is specialized for and the overrides it applies, or `undefined` when no specialization is in effect. */
35
+ configSpecialization(): {
36
+ readonly kind: ProjectKind;
37
+ readonly overwrite: DeepPartial<FlowrConfig>;
38
+ } | undefined;
29
39
  /** The R version analysis assumes when resolving versioned (base-R) exports (see `solver.sigdb.assumedRVersion`). */
30
40
  readonly resolvedRVersion: string;
41
+ /** Whether {@link resolvedRVersion} is a genuine signal (a config pin, project metadata, or an engine-detected version) rather than the fallback default. */
42
+ readonly rVersionKnown: boolean;
43
+ /** Classify the {@link ProjectKind} of the project, see {@link ReadOnlyFlowrAnalyzerFilesContext#projectKind}. */
44
+ projectKind(): ProjectKind;
45
+ /** The versions a dependency can possibly have, see {@link ReadOnlyFlowrAnalyzerDependenciesContext#inferredVersion}. */
46
+ inferredVersion(name: string): Range | undefined;
31
47
  /**
32
48
  * Resource-usage guard (gas).
33
49
  * Call `ctx.gas.checkGas(key)` at expensive analysis sites to obtain the current pressure level.
@@ -52,11 +68,47 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
52
68
  readonly files: FlowrAnalyzerFilesContext;
53
69
  readonly deps: FlowrAnalyzerDependenciesContext;
54
70
  readonly env: FlowrAnalyzerEnvironmentContext;
71
+ /** class names of plugins that activated since the last reset; only filled when `config.repl.showPlugins` is set */
72
+ readonly activatedPlugins: Set<string>;
55
73
  readonly gas: FlowrAnalyzerGasContext;
56
74
  private _analyzer;
57
75
  /** an auto-detected R version (from the engine), recorded once at the analyzer boundary; see {@link resolvedRVersion} */
58
76
  private _detectedR;
59
- readonly config: FlowrConfig;
77
+ /** the configuration as given, i.e. before {@link FlowrConfig.specializeConfig} is applied */
78
+ readonly baseConfig: FlowrConfig;
79
+ /** {@link baseConfig}, specialized for {@link _configKind} */
80
+ private _config;
81
+ /** the {@link ProjectKind} {@link _config} holds, `undefined` as long as it has to be resolved */
82
+ private _configKind;
83
+ /** set while classifying, as the classification must not read the config it decides, see {@link kindToSpecializeFor} */
84
+ private _classifying;
85
+ /** accumulated runtime overrides from {@link updateConfig}, applied on top of the specialized config so they always win */
86
+ private runtimeOverrides;
87
+ /** memoized {@link config}: {@link specializedConfig} merged with {@link runtimeOverrides} */
88
+ private _effective;
89
+ private _appliedLogLevel;
90
+ /** the specialized object {@link _effective} was built from, for identity-based invalidation on a kind change */
91
+ private _effectiveOf;
92
+ /**
93
+ * {@link baseConfig} specialized for the project {@link ProjectKind}, with any {@link updateConfig|runtime
94
+ * overrides} applied on top (those win over both base and specialization).
95
+ */
96
+ get config(): FlowrConfig;
97
+ /** {@link baseConfig} with the {@link FlowrConfig.specializeConfig} of the project's kind applied ({@link FlowrConfig.forKind}), resolved once per kind. */
98
+ private specializedConfig;
99
+ /**
100
+ * Apply a runtime {@link FlowrConfig} update. It is layered on top of the specialized config (so it wins over
101
+ * project-kind specialization) and never mutates the shared {@link baseConfig}. The analysis cache must be
102
+ * invalidated separately (see {@link FlowrAnalyzer.updateConfig}), as the results were computed under the old config.
103
+ */
104
+ updateConfig(update: DeepPartial<FlowrConfig>): void;
105
+ /** The project kind the effective {@link config} is specialized for, plus the overrides it applies, or `undefined` when no specialization is in effect. */
106
+ configSpecialization(): {
107
+ readonly kind: ProjectKind;
108
+ readonly overwrite: DeepPartial<FlowrConfig>;
109
+ } | undefined;
110
+ /** {@link projectKind}, resolved with {@link baseConfig}, as classifying the project reads the config again */
111
+ private kindToSpecializeFor;
60
112
  constructor(config: FlowrConfig, plugins: ReadonlyMap<PluginType, readonly FlowrAnalyzerPlugin[]>);
61
113
  /**
62
114
  * Provides the analyzer associated with this context, if any.
@@ -69,6 +121,12 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
69
121
  setDetectedRVersion(version: string): void;
70
122
  /** The R version analysis assumes when resolving versioned (base-R) exports (see {@link resolveAssumedRVersion}). */
71
123
  get resolvedRVersion(): string;
124
+ /** Whether {@link resolvedRVersion} is a genuine signal (a config pin, project metadata, or engine detection) rather than the fallback default. */
125
+ get rVersionKnown(): boolean;
126
+ /** Classify the {@link ProjectKind} of the project (delegates to the cached {@link FlowrAnalyzerFilesContext#projectKind}). */
127
+ projectKind(): ProjectKind;
128
+ /** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#inferredVersion}). */
129
+ inferredVersion(name: string): Range | undefined;
72
130
  /** delegate request addition */
73
131
  addRequests(requests: readonly RAnalysisRequest[]): void;
74
132
  addFile(f: string | FlowrFileProvider | RParseRequestFromFile): void;
@@ -11,6 +11,8 @@ const flowr_analyzer_functions_context_1 = require("./flowr-analyzer-functions-c
11
11
  const arrays_1 = require("../../util/collections/arrays");
12
12
  const retriever_1 = require("../../r-bridge/retriever");
13
13
  const config_1 = require("../../config");
14
+ const objects_1 = require("../../util/objects");
15
+ const log_1 = require("../../util/log");
14
16
  const flowr_file_1 = require("./flowr-file");
15
17
  const flowr_analyzer_environment_context_1 = require("./flowr-analyzer-environment-context");
16
18
  const flowr_analyzer_meta_context_1 = require("./flowr-analyzer-meta-context");
@@ -31,19 +33,116 @@ class FlowrAnalyzerContext {
31
33
  files;
32
34
  deps;
33
35
  env;
36
+ /** class names of plugins that activated since the last reset; only filled when `config.repl.showPlugins` is set */
37
+ activatedPlugins = new Set();
34
38
  gas;
35
39
  _analyzer;
36
40
  /** an auto-detected R version (from the engine), recorded once at the analyzer boundary; see {@link resolvedRVersion} */
37
41
  _detectedR;
38
- config;
42
+ /** the configuration as given, i.e. before {@link FlowrConfig.specializeConfig} is applied */
43
+ baseConfig;
44
+ /** {@link baseConfig}, specialized for {@link _configKind} */
45
+ _config;
46
+ /** the {@link ProjectKind} {@link _config} holds, `undefined` as long as it has to be resolved */
47
+ _configKind;
48
+ /** set while classifying, as the classification must not read the config it decides, see {@link kindToSpecializeFor} */
49
+ _classifying = false;
50
+ /** accumulated runtime overrides from {@link updateConfig}, applied on top of the specialized config so they always win */
51
+ runtimeOverrides;
52
+ /** memoized {@link config}: {@link specializedConfig} merged with {@link runtimeOverrides} */
53
+ _effective;
54
+ _appliedLogLevel;
55
+ /** the specialized object {@link _effective} was built from, for identity-based invalidation on a kind change */
56
+ _effectiveOf;
57
+ /**
58
+ * {@link baseConfig} specialized for the project {@link ProjectKind}, with any {@link updateConfig|runtime
59
+ * overrides} applied on top (those win over both base and specialization).
60
+ */
61
+ get config() {
62
+ const specialized = this.specializedConfig();
63
+ let cfg;
64
+ if (this.runtimeOverrides === undefined) {
65
+ cfg = specialized;
66
+ }
67
+ else {
68
+ if (this._effective === undefined || this._effectiveOf !== specialized) {
69
+ // a fresh object, so neither the shared base nor the memoized specialized config is mutated
70
+ this._effective = (0, objects_1.deepMergeObject)(specialized, this.runtimeOverrides);
71
+ this._effectiveOf = specialized;
72
+ }
73
+ cfg = this._effective;
74
+ }
75
+ if (cfg.logLevel !== undefined && cfg.logLevel !== this._appliedLogLevel) {
76
+ this._appliedLogLevel = cfg.logLevel;
77
+ (0, log_1.setLogLevel)(cfg.logLevel);
78
+ }
79
+ return cfg;
80
+ }
81
+ /** {@link baseConfig} with the {@link FlowrConfig.specializeConfig} of the project's kind applied ({@link FlowrConfig.forKind}), resolved once per kind. */
82
+ specializedConfig() {
83
+ if (this.baseConfig.specializeConfig === undefined || this._classifying) {
84
+ return this.baseConfig;
85
+ }
86
+ const kind = this.kindToSpecializeFor();
87
+ if (this._configKind !== kind) {
88
+ this._configKind = kind;
89
+ this._config = config_1.FlowrConfig.forKind(this.baseConfig, kind);
90
+ }
91
+ return this._config;
92
+ }
93
+ /**
94
+ * Apply a runtime {@link FlowrConfig} update. It is layered on top of the specialized config (so it wins over
95
+ * project-kind specialization) and never mutates the shared {@link baseConfig}. The analysis cache must be
96
+ * invalidated separately (see {@link FlowrAnalyzer.updateConfig}), as the results were computed under the old config.
97
+ */
98
+ updateConfig(update) {
99
+ const overrides = this.runtimeOverrides;
100
+ const effective = this._effective;
101
+ const effectiveOf = this._effectiveOf;
102
+ this.runtimeOverrides = (0, objects_1.deepMergeObject)(this.runtimeOverrides ?? {}, update);
103
+ this._effective = undefined; // recompute on next `config` access
104
+ try {
105
+ const { error } = config_1.FlowrConfig.Schema.validate(this.config, { allowUnknown: false });
106
+ if (error) {
107
+ throw new Error(`invalid config update: ${error.message}`);
108
+ }
109
+ }
110
+ catch (e) {
111
+ this.runtimeOverrides = overrides;
112
+ this._effective = effective;
113
+ this._effectiveOf = effectiveOf;
114
+ throw e;
115
+ }
116
+ }
117
+ /** The project kind the effective {@link config} is specialized for, plus the overrides it applies, or `undefined` when no specialization is in effect. */
118
+ configSpecialization() {
119
+ if (this.baseConfig.specializeConfig === undefined || this._classifying) {
120
+ return undefined;
121
+ }
122
+ const kind = this.kindToSpecializeFor();
123
+ const overwrite = config_1.FlowrConfig.specializationFor(this.baseConfig, kind);
124
+ return overwrite ? { kind, overwrite } : undefined;
125
+ }
126
+ /** {@link projectKind}, resolved with {@link baseConfig}, as classifying the project reads the config again */
127
+ kindToSpecializeFor() {
128
+ this._classifying = true;
129
+ try {
130
+ return this.projectKind();
131
+ }
132
+ finally {
133
+ this._classifying = false;
134
+ }
135
+ }
39
136
  constructor(config, plugins) {
40
- this.config = config;
137
+ this.baseConfig = config;
138
+ this._config = config;
41
139
  const loadingOrder = new flowr_analyzer_loading_order_context_1.FlowrAnalyzerLoadingOrderContext(this, plugins.get(flowr_analyzer_plugin_1.PluginType.LoadingOrder));
42
140
  this.files = new flowr_analyzer_files_context_1.FlowrAnalyzerFilesContext(loadingOrder, (plugins.get(flowr_analyzer_plugin_1.PluginType.ProjectDiscovery) ?? []), (plugins.get(flowr_analyzer_plugin_1.PluginType.FileLoad) ?? []));
43
141
  this.env = new flowr_analyzer_environment_context_1.FlowrAnalyzerEnvironmentContext(this);
44
142
  const functions = new flowr_analyzer_functions_context_1.FlowrAnalyzerFunctionsContext(this);
45
143
  this.deps = new flowr_analyzer_dependencies_context_1.FlowrAnalyzerDependenciesContext(functions, (plugins.get(flowr_analyzer_plugin_1.PluginType.DependencyIdentification) ?? []));
46
- this.meta = new flowr_analyzer_meta_context_1.FlowrAnalyzerMetaContext();
144
+ // the plugins contributing the metadata are the ones the dependency context runs on demand
145
+ this.meta = new flowr_analyzer_meta_context_1.FlowrAnalyzerMetaContext(() => this.deps.ensureStaticsLoaded());
47
146
  this.gas = new flowr_analyzer_gas_context_1.FlowrAnalyzerGasContext(this, config.gas, (plugins.get(flowr_analyzer_plugin_1.PluginType.Gas) ?? []));
48
147
  }
49
148
  /**
@@ -65,6 +164,21 @@ class FlowrAnalyzerContext {
65
164
  get resolvedRVersion() {
66
165
  return (0, config_1.resolveAssumedRVersion)(this.config, this._detectedR);
67
166
  }
167
+ /** Whether {@link resolvedRVersion} is a genuine signal (a config pin, project metadata, or engine detection) rather than the fallback default. */
168
+ get rVersionKnown() {
169
+ const setting = this.config.solver.sigdb.assumedRVersion;
170
+ return (setting !== undefined && setting !== 'auto')
171
+ || this.meta.getRVersion() !== undefined
172
+ || (this._detectedR !== undefined && this._detectedR !== 'none' && this._detectedR !== 'unknown');
173
+ }
174
+ /** Classify the {@link ProjectKind} of the project (delegates to the cached {@link FlowrAnalyzerFilesContext#projectKind}). */
175
+ projectKind() {
176
+ return this.files.projectKind();
177
+ }
178
+ /** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#inferredVersion}). */
179
+ inferredVersion(name) {
180
+ return this.deps.inferredVersion(name);
181
+ }
68
182
  /** delegate request addition */
69
183
  addRequests(requests) {
70
184
  this.files.addRequests(requests);
@@ -91,6 +205,7 @@ class FlowrAnalyzerContext {
91
205
  this.deps.reset();
92
206
  this.meta.reset();
93
207
  this.gas.reset();
208
+ this.activatedPlugins.clear();
94
209
  }
95
210
  }
96
211
  exports.FlowrAnalyzerContext = FlowrAnalyzerContext;
@@ -2,6 +2,9 @@ import { AbstractFlowrAnalyzerContext } from './abstract-flowr-analyzer-context'
2
2
  import { FlowrAnalyzerPackageVersionsPlugin, type SigDbLoadedInfo } 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 { PackageSignatureSource } from '../sigdb/reader';
5
+ import { Identifier } from '../../dataflow/environments/identifier';
6
+ import type { DecodedFunction } from '../sigdb/decode';
7
+ import type { Range } from 'semver';
5
8
  import type { FlowrAnalyzerFunctionsContext, ReadOnlyFlowrAnalyzerFunctionsContext } from './flowr-analyzer-functions-context';
6
9
  /**
7
10
  * Read-only interface to the {@link FlowrAnalyzerDependenciesContext} for inspecting dependencies without modifying them.
@@ -23,22 +26,40 @@ export interface ReadOnlyFlowrAnalyzerDependenciesContext {
23
26
  * @returns The dependency with the given name, or undefined if it does not exist.
24
27
  */
25
28
  getDependency(name: string): Readonly<Package> | undefined;
29
+ /**
30
+ * The versions a dependency can possibly have, combining everything declared for it (a `DESCRIPTION` range,
31
+ * an `rproject.toml` entry, a lockfile pin, ...). `undefined` if the dependency is unknown, if nothing
32
+ * constrains it, or if the sources contradict each other -- then no version is possible at all.
33
+ *
34
+ * For *why* it is what it is (the individual constraints, or the version the database resolved to), take the
35
+ * {@link Package} from {@link getDependency}.
36
+ * @param name - The name of the dependency.
37
+ */
38
+ inferredVersion(name: string): Range | undefined;
26
39
  /**
27
40
  * Get all dependencies known to this context.
28
41
  */
29
42
  getDependencies(): readonly Readonly<Package>[];
30
43
  /**
31
- * Metadata of the package databases the version plugins currently have loaded.
44
+ * Metadata of the signature databases the version plugins currently have loaded.
32
45
  */
33
- loadedPackageDatabases(): SigDbLoadedInfo[];
46
+ loadedSignatureDatabases(): SigDbLoadedInfo[];
34
47
  /**
35
- * The names of known packages that export `name` (from the version plugins' package databases). Used to
48
+ * The names of known packages that export `name` (from the version plugins' signature databases). Used to
36
49
  * hint which `library()`/`::` might be missing for an otherwise-undefined symbol. Empty if no database is
37
- * available or the package db is disabled.
50
+ * available or the signature database is disabled.
38
51
  */
39
52
  packagesExporting(name: string): readonly string[];
40
53
  /** The signature sources the version plugins currently have loaded (backs the signature query). */
41
54
  signatureSources(): readonly PackageSignatureSource[];
55
+ /**
56
+ * The signature-database entry for the qualified call `id` (a `pkg::fn` {@link Identifier}) from the first
57
+ * {@link signatureSources|source} that has it, resolving the package version from the project's dependency info
58
+ * unless `version` overrides it. This is the easy way to obtain a function's parameters from a context: pass
59
+ * `fn.signature` (or {@link signatureParameterNames}) to {@link RFunctionCall.matchArgsToParams}. `undefined`
60
+ * if `id` is unqualified or no loaded source defines it.
61
+ */
62
+ signatureOf(id: Identifier, version?: string): DecodedFunction | undefined;
42
63
  }
43
64
  /**
44
65
  * Manages the project's dependencies, their versions, and their interplay with {@link FlowrAnalyzerPackageVersionsPlugin}s.
@@ -54,19 +75,22 @@ export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnaly
54
75
  reset(): void;
55
76
  /** Register a resolver consulted by {@link getDependency} to fill in a package's exports lazily. */
56
77
  addLazyResolver(resolver: (name: string, existing?: Package) => Package | undefined): void;
57
- loadedPackageDatabases(): SigDbLoadedInfo[];
78
+ loadedSignatureDatabases(): SigDbLoadedInfo[];
58
79
  packagesExporting(name: string): readonly string[];
59
80
  signatureSources(): readonly PackageSignatureSource[];
81
+ signatureOf(id: Identifier, version?: string): DecodedFunction | undefined;
60
82
  /** Whether any version plugin can resolve the base-R packages (a versioned signature source is available). */
61
83
  hasBaseRSource(): boolean;
62
84
  /** Cheap fingerprint of only the base-R-providing databases, so base-R-derived caches survive unrelated database changes. */
63
85
  baseRSourceFingerprint(): string;
64
86
  /** Mount an additional signature database/source by path (a plain `.sigs.ndjson`, a `.br`, or a manifest). */
65
87
  addDatabaseSource(source: string): Promise<void>;
66
- /** Eagerly mount every version plugin's package database up front (see `solver.sigdb.eagerlyLoad`). */
67
- eagerlyLoadPackageDatabases(): void;
88
+ /** Eagerly mount every version plugin's signature database up front (see `solver.sigdb.eagerlyLoad`). */
89
+ eagerlyLoadSignatureDatabases(): void;
68
90
  constructor(functionsContext: FlowrAnalyzerFunctionsContext, plugins?: readonly FlowrAnalyzerPackageVersionsPlugin[]);
69
91
  resolveStaticDependencies(): void;
92
+ /** Runs the static plugins once. They fill this context and the project metadata, so both gate their reads on it. */
93
+ ensureStaticsLoaded(): void;
70
94
  /**
71
95
  * Register a dependency declared by a project metadata file (`DESCRIPTION`, `renv.lock`, `rv.lock`). Gated by
72
96
  * `solver.sigdb.loadProjectDependencies`: when project-dependency loading is disabled this is a no-op, so the
@@ -76,5 +100,6 @@ export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnaly
76
100
  addDeclaredDependency(pkg: Package): this;
77
101
  addDependency(pkg: Package): this;
78
102
  getDependency(name: string): Package | undefined;
103
+ inferredVersion(name: string): Range | undefined;
79
104
  getDependencies(): Package[];
80
105
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  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
+ const identifier_1 = require("../../dataflow/environments/identifier");
6
7
  const config_1 = require("../../config");
7
8
  /**
8
9
  * Manages the project's dependencies, their versions, and their interplay with {@link FlowrAnalyzerPackageVersionsPlugin}s.
@@ -25,7 +26,7 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
25
26
  addLazyResolver(resolver) {
26
27
  this.lazyResolvers.push(resolver);
27
28
  }
28
- loadedPackageDatabases() {
29
+ loadedSignatureDatabases() {
29
30
  if (!(0, config_1.isSigDbEnabled)(this.ctx.config)) {
30
31
  return [];
31
32
  }
@@ -49,6 +50,25 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
49
50
  }
50
51
  return this.plugins.flatMap(p => [...p.signatureSources(this.ctx.config)]);
51
52
  }
53
+ signatureOf(id, version) {
54
+ const pkg = identifier_1.Identifier.getNamespace(id);
55
+ if (pkg === undefined) {
56
+ return undefined; // a qualified `pkg::fn` identifier is required to know which package to look in
57
+ }
58
+ const name = identifier_1.Identifier.getName(id);
59
+ const ver = version ?? this.getDependency(pkg)?.resolvedVersion;
60
+ for (const src of this.signatureSources()) {
61
+ if (!src.has(pkg)) {
62
+ continue; // avoids touching a package this source lacks
63
+ }
64
+ // decode only the one function (not the whole package), falling back to the source's latest version
65
+ const fn = src.functionByName(pkg, name, ver) ?? src.functionByName(pkg, name);
66
+ if (fn) {
67
+ return fn;
68
+ }
69
+ }
70
+ return undefined;
71
+ }
52
72
  /** Whether any version plugin can resolve the base-R packages (a versioned signature source is available). */
53
73
  hasBaseRSource() {
54
74
  return (0, config_1.isSigDbEnabled)(this.ctx.config) && this.plugins.some(p => p.providesBaseRPackages());
@@ -67,8 +87,8 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
67
87
  await p.addDatabaseSource(source);
68
88
  }
69
89
  }
70
- /** Eagerly mount every version plugin's package database up front (see `solver.sigdb.eagerlyLoad`). */
71
- eagerlyLoadPackageDatabases() {
90
+ /** Eagerly mount every version plugin's signature database up front (see `solver.sigdb.eagerlyLoad`). */
91
+ eagerlyLoadSignatureDatabases() {
72
92
  for (const p of this.plugins) {
73
93
  p.preloadDatabasesSync();
74
94
  }
@@ -81,6 +101,12 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
81
101
  this.applyPlugins(undefined);
82
102
  this.staticsLoaded = true;
83
103
  }
104
+ /** Runs the static plugins once. They fill this context and the project metadata, so both gate their reads on it. */
105
+ ensureStaticsLoaded() {
106
+ if (!this.staticsLoaded) {
107
+ this.resolveStaticDependencies();
108
+ }
109
+ }
84
110
  /**
85
111
  * Register a dependency declared by a project metadata file (`DESCRIPTION`, `renv.lock`, `rv.lock`). Gated by
86
112
  * `solver.sigdb.loadProjectDependencies`: when project-dependency loading is disabled this is a no-op, so the
@@ -124,6 +150,10 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
124
150
  }
125
151
  return existing;
126
152
  }
153
+ inferredVersion(name) {
154
+ const pkg = this.getDependency(name);
155
+ return pkg?.hasSatisfiableVersion() ? pkg.derivedVersion : undefined;
156
+ }
127
157
  getDependencies() {
128
158
  if (!this.staticsLoaded) {
129
159
  this.resolveStaticDependencies();
@@ -7,6 +7,8 @@ import { FlowrFile, type FlowrFileProvider, FileRole } from './flowr-file';
7
7
  import type { FlowrDescriptionFile } from '../plugins/file-plugins/files/flowr-description-file';
8
8
  import type { FlowrNewsFile } from '../plugins/file-plugins/files/flowr-news-file';
9
9
  import type { FlowrNamespaceFile } from '../plugins/file-plugins/files/flowr-namespace-file';
10
+ import type { FlowrRProjectFile } from '../plugins/file-plugins/files/flowr-rproject-file';
11
+ import { ProjectKind } from './project-kind';
10
12
  /**
11
13
  * This is a request to process a folder as a project, which will be expanded by the registered {@link FlowrAnalyzerProjectDiscoveryPlugin}s.
12
14
  */
@@ -22,11 +24,13 @@ export type RoleBasedFiles = {
22
24
  [FileRole.Description]: FlowrDescriptionFile[];
23
25
  [FileRole.News]: FlowrNewsFile[];
24
26
  [FileRole.Namespace]: FlowrNamespaceFile[];
27
+ [FileRole.Manifest]: FlowrRProjectFile[];
25
28
  [FileRole.Vignette]: FlowrFileProvider[];
26
29
  [FileRole.Test]: FlowrFileProvider[];
27
30
  [FileRole.Install]: FlowrFileProvider[];
28
31
  [FileRole.License]: FlowrFileProvider[];
29
32
  [FileRole.VirtualEnv]: FlowrFileProvider[];
33
+ [FileRole.Startup]: FlowrFileProvider[];
30
34
  [FileRole.Source]: FlowrFileProvider[];
31
35
  [FileRole.Data]: FlowrFileProvider[];
32
36
  [FileRole.Other]: FlowrFileProvider[];
@@ -101,6 +105,13 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
101
105
  * Get all files that have been considered during dataflow analysis.
102
106
  */
103
107
  consideredFilesList(): readonly string[];
108
+ /**
109
+ * Classify the {@link ProjectKind} of the project from its files. A {@link ProjectKind.ShinyApp | shiny app}
110
+ * is detected first, as apps commonly ship a `DESCRIPTION` too. The finer distinctions rely on the source
111
+ * files, which are only known once the dataflow ran; before that a non-package project reports
112
+ * {@link ProjectKind.Unknown}. The result is cached and invalidated whenever the files change.
113
+ */
114
+ projectKind(): ProjectKind;
104
115
  }
105
116
  /**
106
117
  * This is the analyzer file context to be modified by all plugins that affect the files.
@@ -118,8 +129,18 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
118
129
  /** User-registered project discovery plugins; if non-empty, they replace the default. */
119
130
  private readonly discoveryPlugins;
120
131
  private byRole;
132
+ /** cached {@link projectKind}, invalidated whenever the files change (added or reset) */
133
+ private projectKindCache;
134
+ private requestedRoots;
135
+ /** cached {@link root}, fixed on first use as the ids built from it have to stay stable */
136
+ private rootCache;
137
+ private rootResolved;
121
138
  constructor(loadingOrder: FlowrAnalyzerLoadingOrderContext, plugins: readonly FlowrAnalyzerProjectDiscoveryPlugin[], fileLoaders: readonly FlowrAnalyzerFilePlugin[]);
122
139
  reset(): void;
140
+ /** The directory the analysis was asked about: a `project`'s folder, or the one holding the requested file(s). */
141
+ root(): string | undefined;
142
+ /** The path of `filePath` seen from the {@link root}, see {@link relativeTo}. */
143
+ relativePath(filePath: string): string;
123
144
  /**
124
145
  * Record that a file has been considered during dataflow analysis.
125
146
  */
@@ -128,6 +149,15 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
128
149
  * Get all files that have been considered during dataflow analysis.
129
150
  */
130
151
  consideredFilesList(): readonly string[];
152
+ projectKind(): ProjectKind;
153
+ private classifyProject;
154
+ /**
155
+ * Whether the project is a shiny app: it has the canonical entry files (a single `app.R`, or the `ui.R`+`server.R`
156
+ * pair -- a lone `server.R` is not enough) and one of them actually loads or calls the shiny stack. The usage
157
+ * check keeps a coincidental `ui.R`/`server.R` pair from being mistaken for an app; only when none of the entry
158
+ * files can be read do we fall back to trusting the file names alone.
159
+ */
160
+ private isShinyApp;
131
161
  /**
132
162
  * Add multiple requests to the context. This is just a convenience method that calls {@link addRequest} for each request.
133
163
  */
@@ -152,6 +182,8 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
152
182
  hasFile(path: string): boolean;
153
183
  exists(p: string, ignoreCase: boolean): string | undefined;
154
184
  private fileLoadPlugins;
185
+ /** Resolve the file at `path`, loading it from disk through the {@link FlowrAnalyzerFilePlugin}s if unknown. */
186
+ resolveFile(path: string): FlowrFileProvider | undefined;
155
187
  resolveRequest(r: RParseRequest): {
156
188
  r: RParseRequestFromText;
157
189
  path?: string;