@eagleoutice/flowr 2.12.2 → 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
@@ -0,0 +1,564 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DefaultFixpointIterations = exports.DefaultExplodeLimit = void 0;
4
+ exports.dateCutoff = dateCutoff;
5
+ exports.isoDay = isoDay;
6
+ exports.collectUsage = collectUsage;
7
+ exports.intersectSurvivors = intersectSurvivors;
8
+ exports.collectTransitiveConstraints = collectTransitiveConstraints;
9
+ exports.iterateToFixpoint = iterateToFixpoint;
10
+ exports.enforceArcConsistency = enforceArcConsistency;
11
+ exports.countRunnableCombinations = countRunnableCombinations;
12
+ exports.versionMeetsPartners = versionMeetsPartners;
13
+ exports.survivingEntries = survivingEntries;
14
+ exports.timelinePackageKey = timelinePackageKey;
15
+ exports.orderedCandidatesOf = orderedCandidatesOf;
16
+ exports.defaultTargets = defaultTargets;
17
+ exports.assignmentsOf = assignmentsOf;
18
+ exports.explodeDependencyVersions = explodeDependencyVersions;
19
+ /**
20
+ * The dependency version space: for each dependency, the set of signature-database versions that survive the
21
+ * project's constraints (declared ranges, transitive requirements, the base-R/assumed-R bound, a date cutoff, and
22
+ * how the code actually calls the package), and the explosion of that space into concrete per-dependency version
23
+ * assignments. This is a source-agnostic resolver over {@link PackageSignatureSource} and the dependencies context;
24
+ * the `guess-dep-versions` query presents it, but it is usable on its own (e.g. for compatibility-matrix tooling).
25
+ */
26
+ const semver_1 = require("semver");
27
+ const r_version_1 = require("../util/r-version");
28
+ const prefix_1 = require("../util/prefix");
29
+ const r_base_primitives_generated_1 = require("../data/r-base-primitives.generated");
30
+ const reader_1 = require("./sigdb/reader");
31
+ const signature_match_1 = require("./sigdb/signature-match");
32
+ const sigdb_version_1 = require("./sigdb/sigdb-version");
33
+ const identifier_1 = require("../dataflow/environments/identifier");
34
+ const vertex_1 = require("../dataflow/graph/vertex");
35
+ const graph_1 = require("../dataflow/graph/graph");
36
+ const df_helper_1 = require("../dataflow/graph/df-helper");
37
+ const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
38
+ /** default safety cap on how many assignments {@link explodeDependencyVersions} yields */
39
+ exports.DefaultExplodeLimit = 256;
40
+ /** the date cutoff (end of the named day/month/year) for a `YYYY.MM.DD` spec, or `undefined` if malformed */
41
+ function dateCutoff(spec) {
42
+ const window = (0, sigdb_version_1.parseDateWindow)(spec);
43
+ return window ? new Date(window.upper) : undefined;
44
+ }
45
+ /** an ISO `YYYY-MM-DD` day */
46
+ function isoDay(date) {
47
+ return date.toISOString().slice(0, 10);
48
+ }
49
+ /** memoizing resolver for one function's signature, one decode per (function, version) pair */
50
+ function makeFnResolver(src, name) {
51
+ const cache = new Map();
52
+ return (fn, version) => {
53
+ const key = version + '\0' + fn;
54
+ if (!cache.has(key)) {
55
+ cache.set(key, src?.functionByName(name, fn, version));
56
+ }
57
+ return cache.get(key);
58
+ };
59
+ }
60
+ /**
61
+ * Every S3 class the analyzed project's own NAMESPACE registers a method for (its `S3method(generic, class)`
62
+ * directives, flattened across every generic), deduplicated.
63
+ */
64
+ function projectS3Classes(deps) {
65
+ const generics = deps.getDependency('current')?.namespaceInfo?.exportS3Generics;
66
+ return new Set([...(generics?.values() ?? [])].flat());
67
+ }
68
+ /** builtins whose string-literal argument names an S3/S4 class in use, and which slot carries it */
69
+ const ClassUsageArgs = {
70
+ inherits: { positional: 1, named: 'what' },
71
+ is: { positional: 1, named: 'class2' },
72
+ as: { positional: 1, named: 'Class' },
73
+ new: { positional: 0, named: 'Class' },
74
+ structure: { named: 'class' }
75
+ };
76
+ function argStringLiteral(graph, arg) {
77
+ const id = graph_1.FunctionArgument.isNamed(arg) ? arg.valueId : graph_1.FunctionArgument.getId(arg);
78
+ if (id === undefined) {
79
+ return undefined;
80
+ }
81
+ const node = graph.idMap?.get(id);
82
+ return node?.type === type_1.RType.String ? node.content.str : undefined;
83
+ }
84
+ /** class names used as a string literal in the code (`inherits(x, "zoo")`, `new("Foo")`, ...); only direct literals, not variables or `c(...)` */
85
+ function collectCodeClassUses(graph) {
86
+ const classes = new Set();
87
+ for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
88
+ const qualified = df_helper_1.Dataflow.qualify(id, graph, true);
89
+ const fn = qualified === undefined ? undefined : identifier_1.Identifier.getName(qualified);
90
+ const spec = fn === undefined ? undefined : ClassUsageArgs[fn];
91
+ if (spec === undefined) {
92
+ continue;
93
+ }
94
+ let positional = 0;
95
+ for (const arg of vertex.args) {
96
+ if (graph_1.FunctionArgument.isEmpty(arg)) {
97
+ continue;
98
+ }
99
+ const named = graph_1.FunctionArgument.isNamed(arg);
100
+ const target = named ? arg.name === spec.named : spec.positional === positional;
101
+ if (!named) {
102
+ positional++;
103
+ }
104
+ if (target) {
105
+ const literal = argStringLiteral(graph, arg);
106
+ if (literal !== undefined && literal.length > 0) {
107
+ classes.add(literal);
108
+ }
109
+ }
110
+ }
111
+ }
112
+ return classes;
113
+ }
114
+ /**
115
+ * Mark the package that OWNS a used S3/S4 class as used, from the project's NAMESPACE `S3method`/`exportClasses`
116
+ * registrations and from class-name literals in the code. The same-named constructor is recorded as a synthetic
117
+ * use so the version is bounded by its function-export history, not by the pre-NAMESPACE-biased `s3Classes` set.
118
+ */
119
+ function addClassOwnershipUsage(usage, deps, graph) {
120
+ const namespaceClasses = projectS3Classes(deps);
121
+ const codeClasses = collectCodeClassUses(graph);
122
+ if (namespaceClasses.size === 0 && codeClasses.size === 0) {
123
+ return;
124
+ }
125
+ const sources = deps.signatureSources();
126
+ // a class-name literal in code is weak (names collide across CRAN): it may only refine an existing dependency,
127
+ // never introduce one; a NAMESPACE registration is deliberate wiring, so it may introduce the owner
128
+ const anchored = new Set([...usage.keys(), ...deps.getDependencies().map(d => d.name)]);
129
+ const attribute = (cls, mayIntroduce) => {
130
+ for (const src of sources) {
131
+ const owner = src.classOwner(cls);
132
+ if (owner === undefined) {
133
+ continue;
134
+ }
135
+ if (!mayIntroduce && !anchored.has(owner)) {
136
+ return;
137
+ }
138
+ let pkgUsage = usage.get(owner);
139
+ if (pkgUsage === undefined) {
140
+ pkgUsage = new Map();
141
+ usage.set(owner, pkgUsage);
142
+ }
143
+ // narrow by the same-named constructor's presence only when it actually resolves (else just mark used)
144
+ if (!pkgUsage.has(cls) && src.functionByName(owner, cls) !== undefined) {
145
+ pkgUsage.set(cls, { named: new Set(), calls: new Map([['#0', []]]) });
146
+ }
147
+ return;
148
+ }
149
+ };
150
+ for (const cls of namespaceClasses) {
151
+ attribute(cls, true);
152
+ }
153
+ for (const cls of codeClasses) {
154
+ attribute(cls, false);
155
+ }
156
+ }
157
+ /** scan the dataflow graph for every call that resolves (via {@link Dataflow.qualify}) to a package export */
158
+ function collectUsage(graph, deps) {
159
+ const usage = new Map();
160
+ for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
161
+ // use canonical qualification to reconstruct pkg::fn identifier
162
+ const qualified = df_helper_1.Dataflow.qualify(id, graph, true);
163
+ if (qualified === undefined) {
164
+ continue;
165
+ }
166
+ const pkg = identifier_1.Identifier.getNamespace(qualified);
167
+ if (pkg === undefined) {
168
+ continue;
169
+ }
170
+ const fn = identifier_1.Identifier.getName(qualified);
171
+ let pkgUsage = usage.get(pkg);
172
+ if (pkgUsage === undefined) {
173
+ pkgUsage = new Map();
174
+ usage.set(pkg, pkgUsage);
175
+ }
176
+ let entry = pkgUsage.get(fn);
177
+ if (entry === undefined) {
178
+ entry = { named: new Set(), calls: new Map() };
179
+ pkgUsage.set(fn, entry);
180
+ }
181
+ const named = [];
182
+ let positional = 0;
183
+ for (const arg of vertex.args) {
184
+ if (graph_1.FunctionArgument.isNamed(arg)) {
185
+ entry.named.add(arg.name);
186
+ named.push(arg.name);
187
+ }
188
+ else if (graph_1.FunctionArgument.isPositional(arg)) {
189
+ positional++;
190
+ }
191
+ }
192
+ // dedupe by call shape: named names + positional count
193
+ const key = named.sort().join(',') + '#' + positional;
194
+ if (!entry.calls.has(key)) {
195
+ entry.calls.set(key, [...vertex.args]);
196
+ }
197
+ }
198
+ if (deps) {
199
+ addClassOwnershipUsage(usage, deps, graph);
200
+ }
201
+ return usage;
202
+ }
203
+ /** the dated releases + base-R core releases + latest of a package, ascending by R-version order */
204
+ function versionTimeline(src, pkg) {
205
+ return (0, reader_1.availableVersionEntries)(src, pkg).map(e => ({ ver: e.version, ...(e.date ? { date: e.date } : {}) }));
206
+ }
207
+ /** the number of arguments a call actually supplies (empty positional slots do not count) */
208
+ function suppliedArgs(args) {
209
+ return args.reduce((n, a) => n + (graph_1.FunctionArgument.isEmpty(a) ? 0 : 1), 0);
210
+ }
211
+ /** whether a version's signatures accept how the code calls it; tracked names absent here are removals, untracked names are unknown primitives */
212
+ function isCompatible(getFn, version, usage, tracked) {
213
+ for (const [fn, use] of usage) {
214
+ const decoded = getFn(fn, version);
215
+ if (decoded === undefined) {
216
+ if (tracked.has(fn)) {
217
+ return false; // a tracked function removed in this version
218
+ }
219
+ continue; // an untracked primitive: unknown, not a removal
220
+ }
221
+ if (decoded.signature.length === 0) {
222
+ continue; // an empty capture is uninformative (a generic like `seq`, or a data gap): it cannot disprove a call
223
+ }
224
+ for (const args of use.calls.values()) {
225
+ // R's matching: exact, pmatch prefix, or positional; `...` absorbs the rest
226
+ const bound = (0, signature_match_1.matchArgumentsToSignature)(args, decoded.signature);
227
+ let placed = 0;
228
+ for (const ids of bound.values()) {
229
+ placed += ids.length;
230
+ }
231
+ if (placed < suppliedArgs(args)) {
232
+ return false;
233
+ }
234
+ }
235
+ }
236
+ return true;
237
+ }
238
+ /**
239
+ * Whether a named argument would bind to a parameter of `decoded` under R's matching (exact, pmatch, or `...`).
240
+ * `undefined` (the function is absent) is a no; an empty capture -- a generic like `seq` whose formals became
241
+ * `UseMethod`, or a data gap -- is uninformative and treated as accepting (so it never reports a false removal).
242
+ */
243
+ function argumentSupported(decoded, arg) {
244
+ if (decoded === undefined) {
245
+ return false;
246
+ }
247
+ const names = decoded.signature.map(p => p.name);
248
+ return names.length === 0 || names.includes('...') || names.includes((0, prefix_1.findByPrefixIfUnique)(arg, names) ?? arg);
249
+ }
250
+ /** the earliest *carried* version in `timeline` (ascending) whose signature satisfies `predicate` */
251
+ function earliestSupporting(src, pkg, timeline, predicate) {
252
+ for (const entry of timeline) {
253
+ if (src.hasVersion(pkg, entry.ver) && predicate(entry.ver)) {
254
+ return entry.ver;
255
+ }
256
+ }
257
+ return undefined;
258
+ }
259
+ /** the latest *carried* version in `timeline` (ascending) whose signature satisfies `predicate` */
260
+ function latestSupporting(src, pkg, timeline, predicate) {
261
+ for (let i = timeline.length - 1; i >= 0; i--) {
262
+ if (src.hasVersion(pkg, timeline[i].ver) && predicate(timeline[i].ver)) {
263
+ return timeline[i].ver;
264
+ }
265
+ }
266
+ return undefined;
267
+ }
268
+ /** emit one signature bound: `>=v` only when `v` is after the floor, `<=v` only when before the ceiling */
269
+ function emitSignatureBound(observe, fn, v, op, ref, verb, parameter) {
270
+ if (v !== undefined && (op === '>=' ? r_version_1.RVersion.compare(v, ref) > 0 : r_version_1.RVersion.compare(v, ref) < 0)) {
271
+ const qualified = identifier_1.Identifier.toString(fn);
272
+ observe({ source: 'signature', origin: qualified, detail: `${qualified} ${verb} ${v}`, bound: `${op}${v}`, function: qualified, parameter });
273
+ }
274
+ }
275
+ /** emit signature bounds from a package's version history: when functions/parameters appear or vanish */
276
+ function addSignatureEvidence(observe, src, getFn, pkg, usage, timeline) {
277
+ const floor = earliestSupporting(src, pkg, timeline, () => true);
278
+ const ceiling = latestSupporting(src, pkg, timeline, () => true);
279
+ if (floor === undefined || ceiling === undefined) {
280
+ return; // no carried version to compare against
281
+ }
282
+ for (const [fn, use] of usage) {
283
+ const qualified = identifier_1.Identifier.make(fn, pkg);
284
+ const present = (v) => getFn(fn, v) !== undefined;
285
+ emitSignatureBound(observe, qualified, earliestSupporting(src, pkg, timeline, present), '>=', floor, 'exists only from');
286
+ emitSignatureBound(observe, qualified, latestSupporting(src, pkg, timeline, present), '<=', ceiling, 'removed after');
287
+ for (const arg of use.named) {
288
+ const supported = (v) => argumentSupported(getFn(fn, v), arg);
289
+ emitSignatureBound(observe, qualified, earliestSupporting(src, pkg, timeline, supported), '>=', floor, `has parameter '${arg}' only from`, arg);
290
+ emitSignatureBound(observe, qualified, latestSupporting(src, pkg, timeline, supported), '<=', ceiling, `dropped parameter '${arg}' after`, arg);
291
+ }
292
+ }
293
+ }
294
+ /** intersection of multiple survivor sets -- versions that survive in every set */
295
+ function intersectSurvivors(survivorSets) {
296
+ if (survivorSets.length === 0) {
297
+ return [];
298
+ }
299
+ const [first, ...rest] = survivorSets;
300
+ const restVersions = rest.map(set => new Set(set.map(e => e.ver)));
301
+ return first.filter(e => restVersions.every(set => set.has(e.ver)));
302
+ }
303
+ /**
304
+ * The transitive constraints declared packages place on their own dependencies (one level deep). `versionOf` overrides
305
+ * which version of each declaring package to read the requirements from -- passing the previous pass's guessed versions
306
+ * lets two packages tighten each other (a bounded fixpoint over mutual constraints).
307
+ */
308
+ function collectTransitiveConstraints(deps, sources, versionOf) {
309
+ const out = new Map();
310
+ for (const pkg of deps.getDependencies()) {
311
+ const src = sources.find(s => s.has(pkg.name));
312
+ if (!src) {
313
+ continue;
314
+ }
315
+ const version = versionOf?.(pkg.name) ?? pkg.resolvedVersion;
316
+ for (const dep of src.dependencies(pkg.name, version) ?? []) {
317
+ if (!dep.constraint) {
318
+ continue;
319
+ }
320
+ const range = r_version_1.RRange.parse(dep.constraint);
321
+ if (!range) {
322
+ continue;
323
+ }
324
+ const arr = out.get(dep.name) ?? [];
325
+ arr.push({ range, from: `${pkg.name}${version ? ' ' + version : ''}` });
326
+ out.set(dep.name, arr);
327
+ }
328
+ }
329
+ return out;
330
+ }
331
+ /** the default bound for the fixpoint loops, overridable per query with {@link GuessDepVersionsQuery.maxIterations} */
332
+ exports.DefaultFixpointIterations = 8;
333
+ /** repeatedly run `step` until it reports no further change (returns `false`) or `maxIterations` is reached */
334
+ function iterateToFixpoint(maxIterations, step) {
335
+ for (let i = 0; i < maxIterations && step(); i++) { /* repeat until a step makes no change */ }
336
+ }
337
+ /** drop, to a fixpoint, versions no co-guessed dependency can satisfy; returns the blocking partners per package */
338
+ function enforceArcConsistency(entries, maxIterations = exports.DefaultFixpointIterations) {
339
+ const blockers = new Map();
340
+ iterateToFixpoint(maxIterations, () => {
341
+ const survivorsByName = new Map(entries.map(e => [e.name, e.survivors.map(s => s.ver)]));
342
+ let changed = false;
343
+ for (const e of entries) {
344
+ const src = e.src;
345
+ if (src === undefined) {
346
+ continue;
347
+ }
348
+ const kept = e.survivors.filter(v => versionMeetsPartners(src, e.key, v.ver, survivorsByName, e.name, (partner, constraint) => {
349
+ const forPkg = blockers.get(e.name) ?? new Map();
350
+ forPkg.set(partner, constraint);
351
+ blockers.set(e.name, forPkg);
352
+ }));
353
+ if (kept.length !== e.survivors.length) {
354
+ changed = true;
355
+ e.survivors = kept;
356
+ }
357
+ }
358
+ return changed;
359
+ });
360
+ return blockers;
361
+ }
362
+ /**
363
+ * The runnable-combination count. Everything depends on the shared base/R `hub`, so for each hub version take the
364
+ * product of how many versions of every other factor are compatible with it, and sum over the hub. With no hub the
365
+ * factors are independent, so it is the plain product. (Constraints between two non-hub factors are not modelled.)
366
+ */
367
+ function countRunnableCombinations(hub, others) {
368
+ if (hub === undefined) {
369
+ return others.reduce((p, f) => p * f.survivors.length, 1);
370
+ }
371
+ // each factor version's constraint on the hub, resolved once (it does not depend on which hub version we count against)
372
+ const hubRanges = others.map(f => f.survivors.map(v => {
373
+ const dep = f.src?.dependencies(f.key, v)?.find(d => d.name === hub.name && d.constraint);
374
+ return dep?.constraint ? r_version_1.RRange.parse(dep.constraint) : undefined;
375
+ }));
376
+ return hub.survivors.reduce((sum, h) => sum + hubRanges.reduce((prod, ranges) => prod * ranges.filter(r => !r || r_version_1.RRange.satisfies(h, r)).length, 1), 0);
377
+ }
378
+ /** whether every requirement `pkg@ver` places on a co-guessed dependency is met by one of that partner's surviving versions */
379
+ function versionMeetsPartners(src, pkg, ver, partnerSurvivors, selfName, onReject) {
380
+ for (const dep of src.dependencies(pkg, ver) ?? []) {
381
+ if (dep.name === selfName || !dep.constraint) {
382
+ continue;
383
+ }
384
+ const partner = partnerSurvivors.get(dep.name);
385
+ if (partner === undefined || partner.length === 0) {
386
+ continue;
387
+ }
388
+ const req = r_version_1.RRange.parse(dep.constraint);
389
+ if (req && !partner.some(v => r_version_1.RRange.satisfies(v, req))) {
390
+ onReject?.(dep.name, dep.constraint);
391
+ return false;
392
+ }
393
+ }
394
+ return true;
395
+ }
396
+ /**
397
+ * Filter a version timeline by the declared range, transitive constraints, base-R version bound, and date cutoff,
398
+ * emitting each constraint to `observe` (when given) as it is applied -- so the filtering and its explanation cannot
399
+ * drift apart.
400
+ */
401
+ function applyConstraints(timeline, name, declaredRange, declaredConstraints, transitive, base, rVersion, cutoff, observe) {
402
+ for (const c of declaredConstraints) {
403
+ observe?.({ source: 'declared', origin: 'project metadata', detail: `declared as ${c}`, bound: c });
404
+ }
405
+ let t = declaredRange ? timeline.filter(e => r_version_1.RRange.satisfies(e.ver, declaredRange)) : [...timeline];
406
+ for (const c of transitive) {
407
+ observe?.({ source: 'transitive', origin: c.from, detail: `${c.from} requires ${name} ${c.range.raw}`, bound: c.range.raw });
408
+ t = t.filter(e => r_version_1.RRange.satisfies(e.ver, c.range));
409
+ }
410
+ // a base package's version *is* the R version, so it is bounded by the assumed/declared R (only when that is known)
411
+ const rv = base && rVersion ? r_version_1.RVersion.parse(rVersion) : undefined;
412
+ if (rv) {
413
+ observe?.({ source: 'base-r', origin: `R ${rVersion}`, detail: `base package bounded by R ${rVersion}`, bound: `<=${rVersion}` });
414
+ t = t.filter(e => r_version_1.RVersion.compare(e.ver, rv.str) <= 0);
415
+ }
416
+ if (cutoff) {
417
+ observe?.({ source: 'date', origin: isoDay(cutoff), detail: `only releases up to ${isoDay(cutoff)}`, bound: `<=${isoDay(cutoff)}` });
418
+ // base R is stored undated, so fall back to its R release date; a dated release must predate the cutoff, and an
419
+ // undated one is dropped -- except base R older than the release table (kept, as it predates any real cutoff)
420
+ t = t.filter(e => {
421
+ const date = e.date ?? (base ? (0, r_version_1.rReleaseDate)(e.ver) : undefined);
422
+ return date !== undefined ? date.getTime() <= cutoff.getTime() : base;
423
+ });
424
+ }
425
+ return t;
426
+ }
427
+ /**
428
+ * Apply every constraint (declared, transitive, base-R, date, then signature usage) to a package's timeline. When an
429
+ * `observe` callback is given, emits the provenance of each constraint (including the signature lower bounds).
430
+ */
431
+ function survivingEntries(name, src, deps, usage, transitive, cutoff, rVersion, observe, ignoreDeclared = false, packageKey = name) {
432
+ // packageKey: sigdb package (R reuses base, others use themselves)
433
+ const getFn = makeFnResolver(src, packageKey);
434
+ // clean mode ignores declared/transitive constraints, guessing purely from usage and date/R bounds
435
+ const declaredRange = ignoreDeclared ? undefined : deps.inferredVersion(name);
436
+ const declaredConstraints = ignoreDeclared ? [] : (deps.getDependency(name)?.versionConstraints.map(c => c.raw) ?? []);
437
+ const effectiveTransitive = ignoreDeclared ? [] : transitive;
438
+ // contradiction is a constraint property, not an empty database
439
+ const unsatisfiable = constraintsContradict(declaredConstraints, declaredRange, effectiveTransitive);
440
+ if (!src) {
441
+ return { survivors: [], preSignature: [], getFn, declaredRange, declaredConstraints, base: false, unsatisfiable, total: 0 };
442
+ }
443
+ const base = src.isBaseR(packageKey);
444
+ const timeline = versionTimeline(src, packageKey);
445
+ const total = timeline.length;
446
+ // emit database coverage envelope as outer bounds
447
+ if (observe && timeline.length > 0) {
448
+ observe({ source: 'available', origin: 'signature database', detail: `data available from ${timeline[0].ver}`, bound: `>=${timeline[0].ver}` });
449
+ observe({ source: 'available', origin: 'signature database', detail: `data available up to ${timeline[timeline.length - 1].ver}`, bound: `<=${timeline[timeline.length - 1].ver}` });
450
+ }
451
+ const preSignature = applyConstraints(timeline, name, declaredRange, declaredConstraints, effectiveTransitive, base, rVersion, cutoff, observe);
452
+ if (!usage) {
453
+ return { survivors: preSignature, preSignature, getFn, declaredRange, declaredConstraints, base, unsatisfiable, total };
454
+ }
455
+ // exclude base primitives from base packages (captured inconsistently, so absence is data gap not removal)
456
+ const relevant = base ? new Map([...usage].filter(([fn]) => !r_base_primitives_generated_1.RBasePrimitives.has(fn))) : usage;
457
+ if (observe) {
458
+ addSignatureEvidence(observe, src, getFn, packageKey, relevant, preSignature);
459
+ }
460
+ // tracked names appear in some carried version; untracked names must not reject all versions
461
+ const tracked = new Set([...relevant.keys()].filter(fn => preSignature.some(e => getFn(fn, e.ver) !== undefined)));
462
+ const survivors = preSignature.filter(e => !src.hasVersion(packageKey, e.ver) || isCompatible(getFn, e.ver, relevant, tracked));
463
+ return { survivors, preSignature, getFn, declaredRange, declaredConstraints, base, unsatisfiable, total };
464
+ }
465
+ /** the sigdb package a target's version history is drawn from: `R` reuses `base` (their releases coincide), everything else is itself */
466
+ function timelinePackageKey(name, sources) {
467
+ return name === 'R' && !sources.some(s => s.has(name)) ? 'base' : name;
468
+ }
469
+ /** whether the (combined) declared and transitive constraints can be satisfied by no version at all */
470
+ function constraintsContradict(declaredConstraints, declaredRange, transitive) {
471
+ // declared constraints exist but do not combine into a satisfiable range
472
+ if (declaredConstraints.length > 0 && declaredRange === undefined) {
473
+ return true;
474
+ }
475
+ const ranges = [declaredRange, ...transitive.map(t => t.range)].filter((r) => r !== undefined);
476
+ if (ranges.length === 0) {
477
+ return false;
478
+ }
479
+ const combined = r_version_1.RRange.parse(ranges.map(r => r.raw).join(' '));
480
+ return combined === undefined || (0, semver_1.minVersion)(combined) === null;
481
+ }
482
+ /**
483
+ * Order a package's surviving versions by preference: an explicitly {@link VersionExplodeOptions.prefer|preferred}
484
+ * version first, then still-on-CRAN (non-archived) releases before archived ones, then by release (newest or oldest
485
+ * first per {@link VersionExplodeOptions.order}).
486
+ */
487
+ function orderCandidates(src, name, survivors, prefer, order) {
488
+ const preferred = prefer !== undefined && survivors.some(e => e.ver === prefer) ? prefer : undefined;
489
+ // decide archived/non-CRAN status once per version (a cheap `noncran` check), not inside the O(n log n) comparator
490
+ const archived = new Set(survivors.filter(e => !src.isCranVersion(name, e.ver)).map(e => e.ver));
491
+ const rest = survivors.filter(e => e.ver !== preferred).sort((a, b) => (archived.has(a.ver) ? 1 : 0) - (archived.has(b.ver) ? 1 : 0) || (order === 'oldest' ? r_version_1.RVersion.compare(a.ver, b.ver) : r_version_1.RVersion.compare(b.ver, a.ver)));
492
+ return preferred !== undefined ? [preferred, ...rest.map(e => e.ver)] : rest.map(e => e.ver);
493
+ }
494
+ /** the ordered candidate list for one package, or `undefined` when nothing survives (shared by the query and the iterator) */
495
+ function orderedCandidatesOf(src, name, surviving, prefer, order) {
496
+ return src && surviving.survivors.length > 0 ? { pkg: name, versions: orderCandidates(src, name, surviving.survivors, prefer, order) } : undefined;
497
+ }
498
+ /** the default explosion targets: every declared and used dependency (excluding `current`, the analyzed package's own namespace) */
499
+ function defaultTargets(deps, usage) {
500
+ return [...new Set([...deps.getDependencies().map(d => d.name), ...usage.keys()])].filter(name => name !== 'current');
501
+ }
502
+ /** lazily yield concrete version assignments (one version per package) in odometer order over the per-package lists */
503
+ function* assignmentsOf(perPackage, limit) {
504
+ if (perPackage.length === 0 || perPackage.some(p => p.versions.length === 0)) {
505
+ return;
506
+ }
507
+ const idx = perPackage.map(() => 0);
508
+ for (let count = 0; count < limit; count++) {
509
+ const versions = new Map();
510
+ for (let i = 0; i < perPackage.length; i++) {
511
+ versions.set(perPackage[i].pkg, perPackage[i].versions[idx[i]]);
512
+ }
513
+ yield { versions };
514
+ // advance the odometer: the last package varies fastest
515
+ let k = perPackage.length - 1;
516
+ for (; k >= 0; k--) {
517
+ if (++idx[k] < perPackage[k].versions.length) {
518
+ break;
519
+ }
520
+ idx[k] = 0;
521
+ }
522
+ if (k < 0) {
523
+ return; // wrapped around: the whole space is exhausted
524
+ }
525
+ }
526
+ }
527
+ /** the per-package ordered candidate lists for the constraint-space explosion (only packages with a surviving version) */
528
+ async function orderedCandidatesFor(analyzer, options) {
529
+ const ctx = analyzer.inspectContext();
530
+ const deps = ctx.deps;
531
+ const sources = deps.signatureSources();
532
+ if (sources.length === 0) {
533
+ return [];
534
+ }
535
+ const cutoff = options.date ? dateCutoff(options.date) : undefined;
536
+ // bound base packages by R only when genuinely known (a config pin, metadata, or detection); `auto` with nothing detected imposes no R ceiling
537
+ const rVersion = ctx.rVersionKnown ? (ctx.meta.getRVersion() ?? ctx.resolvedRVersion) : undefined;
538
+ const usage = collectUsage((await analyzer.dataflow()).graph, deps);
539
+ const transitive = collectTransitiveConstraints(deps, sources);
540
+ const targets = options.packages && options.packages.length > 0 ? [...options.packages] : defaultTargets(deps, usage);
541
+ const order = options.order ?? 'newest';
542
+ const out = [];
543
+ for (const name of targets.sort()) {
544
+ const packageKey = timelinePackageKey(name, sources);
545
+ const src = (0, reader_1.sourceForPackage)(sources, packageKey);
546
+ const surviving = survivingEntries(name, src, deps, usage.get(name), transitive.get(name) ?? [], cutoff, rVersion, undefined, false, packageKey);
547
+ const oc = orderedCandidatesOf(src, name, surviving, options.prefer?.[name], order);
548
+ if (oc) {
549
+ out.push(oc);
550
+ }
551
+ }
552
+ return out;
553
+ }
554
+ /**
555
+ * Explode the guessed constraint space into concrete, signature-database-available version assignments: a lazy
556
+ * iterator over one chosen version per resolvable dependency. Each package's versions are ordered by preference
557
+ * (an explicitly {@link VersionExplodeOptions.prefer|preferred} version, then non-archived releases, then newest or
558
+ * oldest first), so the first assignments are the most preferred. The iterator is bounded by
559
+ * {@link VersionExplodeOptions.limit} so an enormous product cannot run away.
560
+ */
561
+ async function* explodeDependencyVersions(analyzer, options = {}) {
562
+ yield* assignmentsOf(await orderedCandidatesFor(analyzer, options), options.limit ?? exports.DefaultExplodeLimit);
563
+ }
564
+ //# sourceMappingURL=dependency-version-space.js.map
@@ -170,7 +170,7 @@ class FlowrAnalyzerBuilder {
170
170
  (0, assert_1.guard)(this.parser !== undefined, 'No parser set, please use the setParser or setEngine method to set a parser before building the analyzer');
171
171
  const context = new flowr_analyzer_context_1.FlowrAnalyzerContext(this.flowrConfig, this.plugins);
172
172
  if (this.flowrConfig.solver.sigdb.enabled && this.flowrConfig.solver.sigdb.eagerlyLoad) {
173
- context.deps.eagerlyLoadPackageDatabases();
173
+ context.deps.eagerlyLoadSignatureDatabases();
174
174
  }
175
175
  const cache = flowr_analyzer_cache_1.FlowrAnalyzerCache.create({
176
176
  parser: this.parser,
@@ -1,4 +1,5 @@
1
1
  import type { FlowrConfig } from '../config';
2
+ import type { DeepPartial } from 'ts-essentials';
2
3
  import type { KnownParser, KnownParserInformation } from '../r-bridge/parser';
3
4
  import { type Queries, type QueryResults, type SupportedQueryTypes } from '../queries/query';
4
5
  import type { ControlFlowInformation } from '../control-flow/control-flow-graph';
@@ -140,6 +141,8 @@ export interface ReadonlyFlowrAnalysisProvider<Parser extends KnownParser = Know
140
141
  runFull(force?: boolean): Promise<void>;
141
142
  /** This is the config used for the analyzer */
142
143
  flowrConfig: FlowrConfig;
144
+ /** Merge a runtime update into the base config and invalidate the derived config and cached analysis, so it takes effect. */
145
+ updateConfig(update: DeepPartial<FlowrConfig>): void;
143
146
  }
144
147
  /**
145
148
  * Central class for conducting analyses with FlowR.
@@ -170,6 +173,7 @@ export declare class FlowrAnalyzer<Parser extends KnownParser = KnownParser> imp
170
173
  parserInformation(): KnownParserInformation;
171
174
  inspectContext(): ReadOnlyFlowrAnalyzerContext;
172
175
  reset(): void;
176
+ updateConfig(update: DeepPartial<FlowrConfig>): void;
173
177
  parseStandalone(data: `${typeof fileProtocol}${string}` | string | RParseRequest): Tree;
174
178
  normalizeStandalone(data: `${typeof fileProtocol}${string}` | string | RParseRequest): NormalizedAst;
175
179
  addRequest(...request: (RAnalysisRequest | readonly RAnalysisRequest[] | `${typeof fileProtocol}${string}` | string)[]): this;
@@ -55,6 +55,11 @@ class FlowrAnalyzer {
55
55
  this.ctx.reset();
56
56
  this.cache.reset();
57
57
  }
58
+ updateConfig(update) {
59
+ this.ctx.updateConfig(update);
60
+ // the parse/dataflow results were computed under the previous config, so they must be recomputed
61
+ this.cache.reset();
62
+ }
58
63
  parseStandalone(data) {
59
64
  const request = (0, retriever_1.isParseRequest)(data) ? data : (0, retriever_1.requestFromInput)(data);
60
65
  if (this.parser.name === 'tree-sitter') {
@@ -76,6 +76,10 @@ export declare class FlowrDescriptionFile extends FlowrFile<DeepReadonly<DCF>> {
76
76
  * Returns the package title from the 'Title' field in the DESCRIPTION file.
77
77
  */
78
78
  packageTitle(): string | undefined;
79
+ /**
80
+ * Returns the (lower-cased) 'Type' field of the DESCRIPTION file, e.g. `package`, `shiny`, or `compendium`.
81
+ */
82
+ type(): string | undefined;
79
83
  }
80
84
  /**
81
85
  * Parses the 'License' field from an R DESCRIPTION file into SPDX license expressions.
@@ -136,6 +136,13 @@ class FlowrDescriptionFile extends flowr_file_1.FlowrFile {
136
136
  const titles = this.content().get('Title');
137
137
  return titles && titles.length > 0 ? titles[0] : titles?.join(' ');
138
138
  }
139
+ /**
140
+ * Returns the (lower-cased) 'Type' field of the DESCRIPTION file, e.g. `package`, `shiny`, or `compendium`.
141
+ */
142
+ type() {
143
+ const types = this.content().get('Type');
144
+ return types && types.length > 0 ? types[0].trim().toLowerCase() : undefined;
145
+ }
139
146
  }
140
147
  exports.FlowrDescriptionFile = FlowrDescriptionFile;
141
148
  /**
@@ -179,6 +179,8 @@ function parseNamespaceComplex(file, ctx) {
179
179
  case 'import':
180
180
  return handleImportCall(g, call.arguments);
181
181
  case 'importFrom':
182
+ case 'importClassesFrom':
183
+ case 'importMethodsFrom':
182
184
  return handleImportFromCall(g, call.arguments);
183
185
  case 'useDynLib':
184
186
  return handleUseDynLibCall(g, call.arguments);
@@ -487,7 +489,9 @@ function parseNamespaceSimple(file) {
487
489
  result.current.importedPackages?.set(pkg, 'all');
488
490
  break;
489
491
  }
490
- case 'importFrom': {
492
+ case 'importFrom':
493
+ case 'importClassesFrom':
494
+ case 'importMethodsFrom': {
491
495
  const parts = args.split(',').map(s => s.trim());
492
496
  if (parts.length < 2) {
493
497
  continue;