@eagleoutice/flowr 2.11.1 → 2.12.1

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 (264) hide show
  1. package/README.md +187 -257
  2. package/abstract-interpretation/absint-visitor.d.ts +1 -0
  3. package/abstract-interpretation/data-frame/mappers/arguments.js +7 -1
  4. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  5. package/abstract-interpretation/domains/set-upper-bound-domain.js +6 -2
  6. package/benchmark/slicer.d.ts +1 -1
  7. package/benchmark/slicer.js +3 -1
  8. package/benchmark/summarizer/second-phase/graph.js +5 -0
  9. package/cli/common/options.d.ts +8 -0
  10. package/cli/common/options.js +2 -0
  11. package/cli/common/scripts-info.d.ts +8 -0
  12. package/cli/repl/commands/repl-commands.d.ts +1 -0
  13. package/cli/repl/commands/repl-commands.js +66 -15
  14. package/cli/repl/commands/repl-dataflow.js +48 -4
  15. package/cli/repl/commands/repl-main.d.ts +2 -0
  16. package/cli/repl/commands/repl-main.js +5 -0
  17. package/cli/repl/commands/repl-query.d.ts +4 -1
  18. package/cli/repl/commands/repl-query.js +72 -22
  19. package/cli/repl/commands/repl-signature.d.ts +7 -0
  20. package/cli/repl/commands/repl-signature.js +119 -0
  21. package/cli/repl/core.d.ts +8 -1
  22. package/cli/repl/core.js +46 -6
  23. package/cli/repl/ghost-hint.d.ts +37 -0
  24. package/cli/repl/ghost-hint.js +72 -0
  25. package/cli/repl/parser/slice-query-parser.d.ts +11 -1
  26. package/cli/repl/parser/slice-query-parser.js +45 -16
  27. package/cli/repl/print-version.d.ts +2 -4
  28. package/cli/repl/print-version.js +41 -23
  29. package/cli/repl/server/connection.js +19 -17
  30. package/cli/slicer-app.d.ts +2 -0
  31. package/cli/slicer-app.js +3 -3
  32. package/cli/wiki.d.ts +2 -2
  33. package/cli/wiki.js +2 -2
  34. package/config.d.ts +63 -2
  35. package/config.js +64 -8
  36. package/control-flow/cfg-dead-code.js +0 -1
  37. package/control-flow/control-flow-graph.js +6 -6
  38. package/control-flow/diff-cfg.js +2 -2
  39. package/control-flow/semantic-cfg-guided-visitor.js +2 -0
  40. package/core/print/slice-diff-ansi.js +8 -8
  41. package/core/steps/all/core/20-dataflow.d.ts +2 -2
  42. package/core/steps/all/static-slicing/00-slice.d.ts +5 -0
  43. package/core/steps/all/static-slicing/00-slice.js +1 -1
  44. package/core/steps/all/static-slicing/10-reconstruct.d.ts +7 -0
  45. package/core/steps/all/static-slicing/10-reconstruct.js +6 -2
  46. package/core/steps/pipeline/default-pipelines.d.ts +20 -16
  47. package/data/r-base-packages.generated.d.ts +44 -0
  48. package/data/r-base-packages.generated.js +32 -0
  49. package/data/r-base-primitives.generated.d.ts +1 -0
  50. package/data/r-base-primitives.generated.js +15 -0
  51. package/data/sigdb/sigdb.remote.json +112 -0
  52. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  53. package/dataflow/environments/built-in-proc-name.js +4 -0
  54. package/dataflow/environments/built-in.d.ts +14 -4
  55. package/dataflow/environments/built-in.js +13 -2
  56. package/dataflow/environments/data-masking-functions.d.ts +12 -0
  57. package/dataflow/environments/data-masking-functions.js +46 -0
  58. package/dataflow/environments/default-builtin-config.d.ts +72 -19
  59. package/dataflow/environments/default-builtin-config.js +48 -14
  60. package/dataflow/environments/diff.js +1 -1
  61. package/dataflow/environments/environment.js +1 -2
  62. package/dataflow/environments/identifier.d.ts +11 -4
  63. package/dataflow/environments/identifier.js +28 -10
  64. package/dataflow/environments/resolve-by-name.js +16 -2
  65. package/dataflow/extractor.js +6 -3
  66. package/dataflow/graph/call-graph.d.ts +2 -2
  67. package/dataflow/graph/df-helper.d.ts +4 -4
  68. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  69. package/dataflow/graph/edge.d.ts +3 -3
  70. package/dataflow/graph/edge.js +3 -3
  71. package/dataflow/graph/graph-helper.d.ts +2 -2
  72. package/dataflow/internal/linker.js +1 -1
  73. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -0
  74. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -0
  76. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -49
  77. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +7 -1
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +19 -0
  80. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +111 -6
  81. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +13 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
  83. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +19 -0
  85. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +12 -4
  86. package/dataflow/internal/process/functions/call/common.js +8 -1
  87. package/dataflow/internal/process/functions/call/default-call-handling.js +6 -0
  88. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +17 -0
  89. package/dataflow/internal/process/functions/call/known-call-handling.js +32 -0
  90. package/dataflow/internal/process/functions/call/named-call-handling.js +29 -7
  91. package/dataflow/internal/process/functions/process-argument.js +12 -1
  92. package/dataflow/internal/process/process-named-call.d.ts +18 -1
  93. package/dataflow/internal/process/process-named-call.js +94 -0
  94. package/dataflow/processor.d.ts +18 -0
  95. package/documentation/data/faq/faqs.js +5 -1
  96. package/documentation/doc-capabilities.js +1 -1
  97. package/documentation/doc-util/doc-cli-option.d.ts +10 -0
  98. package/documentation/doc-util/doc-cli-option.js +23 -0
  99. package/documentation/doc-util/doc-dfg.js +2 -1
  100. package/documentation/doc-util/doc-query.d.ts +9 -3
  101. package/documentation/doc-util/doc-query.js +9 -4
  102. package/documentation/wiki-dataflow-graph.js +8 -5
  103. package/documentation/wiki-interface.js +4 -2
  104. package/documentation/wiki-linter.js +1 -1
  105. package/documentation/wiki-linting-and-testing.js +4 -1
  106. package/documentation/wiki-mk/doc-context.d.ts +14 -0
  107. package/documentation/wiki-mk/doc-context.js +3 -0
  108. package/documentation/wiki-mk/doc-maker.js +3 -1
  109. package/documentation/wiki-query.js +36 -15
  110. package/documentation/wiki-setup.js +10 -7
  111. package/documentation/wiki-signature-database.d.ts +16 -0
  112. package/documentation/wiki-signature-database.js +293 -0
  113. package/linter/linter-format.d.ts +7 -0
  114. package/linter/linter-rules.d.ts +10 -9
  115. package/linter/rules/naming-convention.d.ts +1 -0
  116. package/linter/rules/naming-convention.js +2 -0
  117. package/linter/rules/no-leaked-credentials.js +1 -2
  118. package/linter/rules/roxygen-arguments.js +18 -5
  119. package/linter/rules/stop-with-call-arg.js +2 -2
  120. package/linter/rules/undefined-symbol-util.d.ts +36 -0
  121. package/linter/rules/undefined-symbol-util.js +149 -0
  122. package/linter/rules/undefined-symbol.d.ts +58 -17
  123. package/linter/rules/undefined-symbol.js +143 -33
  124. package/linter/rules/unused-definition.d.ts +8 -1
  125. package/linter/rules/unused-definition.js +126 -1
  126. package/package.json +22 -10
  127. package/project/context/abstract-flowr-analyzer-context.js +7 -1
  128. package/project/context/flowr-analyzer-context.d.ts +8 -0
  129. package/project/context/flowr-analyzer-context.js +10 -0
  130. package/project/context/flowr-analyzer-dependencies-context.d.ts +28 -4
  131. package/project/context/flowr-analyzer-dependencies-context.js +51 -2
  132. package/project/context/flowr-analyzer-files-context.d.ts +1 -0
  133. package/project/context/flowr-analyzer-files-context.js +2 -1
  134. package/project/context/flowr-analyzer-functions-context.js +1 -1
  135. package/project/context/flowr-file.d.ts +5 -0
  136. package/project/context/flowr-file.js +5 -0
  137. package/project/flowr-analyzer-builder.js +12 -2
  138. package/project/plugins/file-plugins/files/flowr-description-file.js +6 -3
  139. package/project/plugins/file-plugins/files/flowr-namespace-file.js +9 -3
  140. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -3
  141. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +26 -0
  142. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +39 -0
  143. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  144. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
  145. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -0
  146. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +18 -2
  147. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +19 -0
  148. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +120 -0
  149. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +518 -0
  150. package/project/plugins/package-version-plugins/package.d.ts +5 -3
  151. package/project/plugins/package-version-plugins/package.js +27 -25
  152. package/project/plugins/plugin-registry.d.ts +3 -2
  153. package/project/plugins/plugin-registry.js +4 -2
  154. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +7 -2
  155. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +3 -1
  156. package/project/sigdb/build.d.ts +131 -0
  157. package/project/sigdb/build.js +628 -0
  158. package/project/sigdb/codec.d.ts +51 -0
  159. package/project/sigdb/codec.js +122 -0
  160. package/project/sigdb/decode.d.ts +58 -0
  161. package/project/sigdb/decode.js +129 -0
  162. package/project/sigdb/decompress.d.ts +44 -0
  163. package/project/sigdb/decompress.js +176 -0
  164. package/project/sigdb/hash.d.ts +9 -0
  165. package/project/sigdb/hash.js +54 -0
  166. package/project/sigdb/index-format.d.ts +40 -0
  167. package/project/sigdb/index-format.js +28 -0
  168. package/project/sigdb/manifest.d.ts +68 -0
  169. package/project/sigdb/manifest.js +146 -0
  170. package/project/sigdb/reader.d.ts +250 -0
  171. package/project/sigdb/reader.js +692 -0
  172. package/project/sigdb/schema.d.ts +196 -0
  173. package/project/sigdb/schema.js +33 -0
  174. package/project/sigdb/sigdb-download.d.ts +65 -0
  175. package/project/sigdb/sigdb-download.js +237 -0
  176. package/project/sigdb/signature-match.d.ts +26 -0
  177. package/project/sigdb/signature-match.js +40 -0
  178. package/project/sigdb/version.d.ts +20 -0
  179. package/project/sigdb/version.js +55 -0
  180. package/queries/catalog/absint-query/absint-query-executor.d.ts +6 -0
  181. package/queries/catalog/absint-query/absint-query-executor.js +63 -0
  182. package/queries/catalog/absint-query/absint-query-format.d.ts +37 -0
  183. package/queries/catalog/absint-query/absint-query-format.js +102 -0
  184. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -3
  185. package/queries/catalog/config-query/config-query-format.d.ts +3 -1
  186. package/queries/catalog/config-query/config-query-format.js +68 -9
  187. package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -1
  188. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  189. package/queries/catalog/linter-query/linter-query-executor.d.ts +2 -0
  190. package/queries/catalog/linter-query/linter-query-executor.js +6 -1
  191. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -1
  192. package/queries/catalog/linter-query/linter-query-format.js +40 -8
  193. package/queries/catalog/project-query/project-query-executor.d.ts +15 -0
  194. package/queries/catalog/project-query/project-query-executor.js +96 -4
  195. package/queries/catalog/project-query/project-query-format.d.ts +44 -0
  196. package/queries/catalog/project-query/project-query-format.js +33 -2
  197. package/queries/catalog/signature-query/signature-query-executor.d.ts +29 -0
  198. package/queries/catalog/signature-query/signature-query-executor.js +461 -0
  199. package/queries/catalog/signature-query/signature-query-format.d.ts +138 -0
  200. package/queries/catalog/signature-query/signature-query-format.js +76 -0
  201. package/queries/catalog/signature-query/signature-query-render.d.ts +15 -0
  202. package/queries/catalog/signature-query/signature-query-render.js +155 -0
  203. package/queries/catalog/static-slice-query/static-slice-query-executor.js +9 -3
  204. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +10 -0
  205. package/queries/catalog/static-slice-query/static-slice-query-format.js +19 -1
  206. package/queries/query-print.js +5 -0
  207. package/queries/query.d.ts +15 -5
  208. package/queries/query.js +7 -4
  209. package/r-bridge/init.js +5 -1
  210. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +10 -0
  211. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +55 -0
  212. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +16 -0
  213. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +27 -0
  214. package/r-bridge/lang-4.x/ast/parser/json/format.js +89 -2
  215. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -4
  216. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -1
  217. package/r-bridge/parser.d.ts +2 -0
  218. package/r-bridge/retriever.js +4 -1
  219. package/r-bridge/roxygen2/documentation-provider.js +2 -1
  220. package/r-bridge/shell.d.ts +5 -0
  221. package/r-bridge/shell.js +17 -1
  222. package/reconstruct/inline/source-inline-map.d.ts +48 -0
  223. package/reconstruct/inline/source-inline-map.js +94 -0
  224. package/reconstruct/reconstruct.d.ts +19 -2
  225. package/reconstruct/reconstruct.js +79 -16
  226. package/search/search-executor/search-generators.js +5 -22
  227. package/search/search-executor/search-transformer.js +10 -6
  228. package/slicing/criterion/parse.d.ts +28 -4
  229. package/slicing/criterion/parse.js +133 -18
  230. package/slicing/static/slice-call.d.ts +24 -1
  231. package/slicing/static/slice-call.js +90 -0
  232. package/slicing/static/static-slicer.d.ts +7 -0
  233. package/slicing/static/static-slicer.js +38 -3
  234. package/util/collections/arrays.d.ts +4 -5
  235. package/util/collections/arrays.js +7 -18
  236. package/util/hash.d.ts +14 -0
  237. package/util/hash.js +31 -0
  238. package/util/mermaid/dfg.d.ts +7 -2
  239. package/util/mermaid/dfg.js +53 -13
  240. package/util/r-base-packages.d.ts +19 -0
  241. package/util/r-base-packages.js +72 -0
  242. package/util/r-license.js +2 -10
  243. package/util/r-version.d.ts +45 -15
  244. package/util/r-version.js +97 -36
  245. package/util/range.d.ts +15 -0
  246. package/util/range.js +39 -0
  247. package/util/schema.d.ts +10 -0
  248. package/util/schema.js +22 -0
  249. package/util/text/ansi.d.ts +3 -0
  250. package/util/text/ansi.js +10 -0
  251. package/util/text/args.js +1 -2
  252. package/util/version.js +28 -8
  253. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  254. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  255. package/documentation/wiki-package-database.d.ts +0 -9
  256. package/documentation/wiki-package-database.js +0 -63
  257. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +0 -63
  258. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +0 -176
  259. package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
  260. package/project/plugins/package-version-plugins/pkgdb.js +0 -370
  261. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +0 -6
  262. package/queries/catalog/df-shape-query/df-shape-query-executor.js +0 -58
  263. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +0 -27
  264. package/queries/catalog/df-shape-query/df-shape-query-format.js +0 -56
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerMetaInstFilesPlugin = void 0;
4
+ const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
5
+ const semver_1 = require("semver");
6
+ const flowr_file_1 = require("../../context/flowr-file");
7
+ const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
8
+ const InstPathPattern = /(^|\/)inst(\/|$)/;
9
+ /**
10
+ * This plugin provides supports for the identification of installed files (files below an `inst/` folder).
11
+ * If you use multiple plugins, this should be included *before* other plugins.
12
+ */
13
+ class FlowrAnalyzerMetaInstFilesPlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
14
+ name = 'flowr-analyzer-inst-files-plugin';
15
+ description = 'This plugin provides support for loading installed files.';
16
+ version = new semver_1.SemVer('0.1.0');
17
+ pathPattern;
18
+ /**
19
+ * Creates a new instance of the INST file plugin.
20
+ * @param pathPattern - The pathPattern to identify INST files, see {@link InstPathPattern} for the default pathPattern.
21
+ */
22
+ constructor(pathPattern = InstPathPattern) {
23
+ super();
24
+ this.pathPattern = pathPattern;
25
+ }
26
+ applies(file) {
27
+ return this.pathPattern.test((0, built_in_source_1.platformDirname)(file.toString()));
28
+ }
29
+ /**
30
+ * Processes the given file, assigning it the {@link FileRole.Install} role.
31
+ * Given that the file may still need to be processed by other plugins, this method returns the `true` flag for that purpose.
32
+ */
33
+ process(_ctx, file) {
34
+ file.assignRole(flowr_file_1.FileRole.Install);
35
+ return [file, true];
36
+ }
37
+ }
38
+ exports.FlowrAnalyzerMetaInstFilesPlugin = FlowrAnalyzerMetaInstFilesPlugin;
39
+ //# sourceMappingURL=flowr-analyzer-inst-file-plugin.js.map
@@ -29,7 +29,7 @@ class FlowrAnalyzerPackageVersionsDescriptionFilePlugin extends flowr_analyzer_p
29
29
  }
30
30
  retrieveVersionsFromField(ctx, pkgs) {
31
31
  for (const pkg of pkgs) {
32
- ctx.deps.addDependency(pkg);
32
+ ctx.deps.addDeclaredDependency(pkg);
33
33
  }
34
34
  }
35
35
  }
@@ -13,8 +13,8 @@ function virtualEnvFiles(ctx, name) {
13
13
  return ctx.files.getFilesByRole(flowr_file_1.FileRole.VirtualEnv).filter(f => (0, built_in_source_1.platformBasename)(f.path()) === name);
14
14
  }
15
15
  function pin(ctx, name, version) {
16
- const range = package_1.Package.parsePackageVersionRange(undefined, version);
17
- ctx.deps.addDependency(new package_1.Package({ name, versionConstraints: range ? [range] : undefined }));
16
+ const range = package_1.Package.parsePkgVersionRange(undefined, version);
17
+ ctx.deps.addDeclaredDependency(new package_1.Package({ name, versionConstraints: range ? [range] : undefined }));
18
18
  }
19
19
  /** Reads package versions from an `renv.lock` (JSON). renv pins are exact. */
20
20
  class FlowrAnalyzerPackageVersionsRenvPlugin extends flowr_analyzer_package_versions_plugin_1.FlowrAnalyzerPackageVersionsPlugin {
@@ -15,6 +15,7 @@ class FlowrAnalyzerPackageVersionsNamespaceFilePlugin extends flowr_analyzer_pac
15
15
  const nmspcFiles = ctx.files.getFilesByRole(flowr_file_1.FileRole.Namespace);
16
16
  if (nmspcFiles.length === 0) {
17
17
  exports.namespaceFileLog.debug('No namespace file found, cannot extract package versions.');
18
+ return;
18
19
  }
19
20
  else if (nmspcFiles.length > 1) {
20
21
  exports.namespaceFileLog.warn(`Found ${nmspcFiles.length} namespace files, expected exactly one.`);
@@ -1,9 +1,14 @@
1
1
  import { FlowrAnalyzerPlugin, PluginType } from '../flowr-analyzer-plugin';
2
+ import type { PackageSignatureSource } from '../../sigdb/reader';
3
+ import type { FlowrConfig } from '../../../config';
2
4
  /** metadata of a package database a plugin currently has loaded */
3
- export interface PkgDbLoadedInfo {
5
+ export interface SigDbLoadedInfo {
4
6
  scope: string;
5
7
  version: number;
6
8
  date: string;
9
+ hash: string;
10
+ /** the on-disk compression codec of the resolved source(s): `zstd`, `brotli`, `gzip`, `plain`, or `mixed` for a set spanning several */
11
+ readonly format?: string;
7
12
  }
8
13
  /**
9
14
  * This is the base class for all plugins that identify package and dependency versions used in the project.
@@ -14,7 +19,18 @@ export declare abstract class FlowrAnalyzerPackageVersionsPlugin extends FlowrAn
14
19
  readonly type = PluginType.DependencyIdentification;
15
20
  static defaultPlugin(): FlowrAnalyzerPackageVersionsPlugin;
16
21
  /** metadata of the databases this plugin currently has loaded (empty for plugins without any) */
17
- loadedDatabases(): PkgDbLoadedInfo[];
22
+ loadedDatabases(): SigDbLoadedInfo[];
23
+ /** Packages known to this plugin that export `name` (empty for plugins without a database). */
24
+ packagesExporting(_name: string): readonly string[];
25
+ /** The signature sources this plugin currently has loaded (empty for plugins without any). `config` lets a query resolve config-driven sources before any analysis has set the plugin's context. */
26
+ signatureSources(_config?: FlowrConfig): readonly PackageSignatureSource[];
27
+ /** Mount an extra signature source by path (a `.sigs.ndjson`, `.br`, or `*.manifest.json(.br)`); no-op by default. */
28
+ addDatabaseSource(_source: string): Promise<void>;
18
29
  /** Eagerly parse and mount this plugin's databases up front (no-op for plugins without any). */
19
30
  preloadDatabasesSync(): void;
31
+ /**
32
+ * Whether this plugin can resolve the always-available base-R packages (so their exports can be attached
33
+ * eagerly for bare base calls). `false` for plugins without a versioned base-R signature source.
34
+ */
35
+ providesBaseRPackages(): boolean;
20
36
  }
@@ -17,8 +17,27 @@ class FlowrAnalyzerPackageVersionsPlugin extends flowr_analyzer_plugin_1.FlowrAn
17
17
  loadedDatabases() {
18
18
  return [];
19
19
  }
20
+ /** Packages known to this plugin that export `name` (empty for plugins without a database). */
21
+ packagesExporting(_name) {
22
+ return [];
23
+ }
24
+ /** The signature sources this plugin currently has loaded (empty for plugins without any). `config` lets a query resolve config-driven sources before any analysis has set the plugin's context. */
25
+ signatureSources(_config) {
26
+ return [];
27
+ }
28
+ /** Mount an extra signature source by path (a `.sigs.ndjson`, `.br`, or `*.manifest.json(.br)`); no-op by default. */
29
+ addDatabaseSource(_source) {
30
+ return Promise.resolve();
31
+ }
20
32
  /** Eagerly parse and mount this plugin's databases up front (no-op for plugins without any). */
21
33
  preloadDatabasesSync() { }
34
+ /**
35
+ * Whether this plugin can resolve the always-available base-R packages (so their exports can be attached
36
+ * eagerly for bare base calls). `false` for plugins without a versioned base-R signature source.
37
+ */
38
+ providesBaseRPackages() {
39
+ return false;
40
+ }
22
41
  }
23
42
  exports.FlowrAnalyzerPackageVersionsPlugin = FlowrAnalyzerPackageVersionsPlugin;
24
43
  /**
@@ -0,0 +1,120 @@
1
+ import { FlowrAnalyzerPackageVersionsPlugin, type SigDbLoadedInfo } from './flowr-analyzer-package-versions-plugin';
2
+ import { SemVer } from 'semver';
3
+ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
4
+ import { type PackageSignatureSource } from '../../sigdb/reader';
5
+ import { type FlowrConfig } from '../../../config';
6
+ /** the plugin's instance name (pass to `unregisterPlugins` to disable the default sigdb resolver) */
7
+ export declare const SigDbPluginName = "flowr-analyzer-package-versions-sigdb-plugin";
8
+ export declare const sigDbLog: import("tslog").Logger<import("tslog").ILogObj>;
9
+ /** an opened signature source, or a local file path (a plain `.sigs.ndjson`, or a `.br`/manifest via {@link FlowrAnalyzerPackageVersionsSigDbPlugin.preload}) */
10
+ export type SigDbSource = PackageSignatureSource | string;
11
+ /**
12
+ * The database flattens S3 methods into the export list, so we recover the `generic -> classes` map for
13
+ * dispatch: an export `generic.class` is a method when the `generic` is itself exported (e.g. `print.foo`).
14
+ */
15
+ export declare function reconstructS3Generics(exported: readonly string[]): Map<string, string[]>;
16
+ /**
17
+ * Resolves `library(pkg)` / `use(pkg, fn)` from precomputed `flowr-sigdb` databases via the
18
+ * {@link PackageSignatureSource} contract. For an R-core package it picks the version shipped with the assumed
19
+ * R release (`solver.sigdb.assumedRVersion`), so `library(stats)` attaches that release's exports. Plain-file
20
+ * sources load lazily; a `.br` or manifest source is mounted by {@link preload}. On by default.
21
+ */
22
+ export declare class FlowrAnalyzerPackageVersionsSigDbPlugin extends FlowrAnalyzerPackageVersionsPlugin {
23
+ readonly name = "flowr-analyzer-package-versions-sigdb-plugin";
24
+ readonly description = "Resolves library exports (and versioned base R) from precomputed flowr-sigdb databases.";
25
+ readonly version: SemVer;
26
+ private readonly extraSources;
27
+ private sources;
28
+ /** the `additionalPaths` the current {@link sources} were assembled with, so a later config resolves a rebuild */
29
+ private sourcesKey;
30
+ private analyzerCtx;
31
+ /** cached reverse index `export name -> packages exporting it`, built once per source set (see {@link packagesExporting}) */
32
+ private exportIndex;
33
+ /** `pkg@assumedR` keys already reported via {@link baseVersionFor}'s fallback, so the info is logged once */
34
+ private readonly baseFallbacksLogged;
35
+ /** installed package versions for `versionSelection: 'system'`, read once from R (see {@link warmInstalledVersions}) */
36
+ private installedVersions;
37
+ /** guards the one-time async warm-up of {@link installedVersions} */
38
+ private installedVersionsPromise;
39
+ /** invalidate the assembled source list and derived caches (after a source or config change) */
40
+ private resetAssembled;
41
+ constructor(...sources: SigDbSource[]);
42
+ /**
43
+ * Dynamically add signature sources after construction (opened instances, plain `.sigs.ndjson`, or `.br`/
44
+ * manifest paths). Added sources take precedence over the bundled default, so they can override or extend it.
45
+ */
46
+ addSource(...sources: readonly SigDbSource[]): void;
47
+ process(ctx: FlowrAnalyzerContext): void;
48
+ private syncPromise;
49
+ /**
50
+ * Opt-in (`solver.sigdb.autoSync`) startup re-sync.
51
+ * If the committed `sigdb.remote.json` link file lists shards whose cached copies are missing or hash-mismatched,
52
+ * this will sync them.
53
+ */
54
+ private startBackgroundSync;
55
+ private warmPromise;
56
+ /**
57
+ * Warm the hot shards (base + most-downloaded packages) of any sharded source in a background task, so the
58
+ * first `library()` lookup no longer blocks on decompression. Idempotent.
59
+ */
60
+ private startBackgroundWarm;
61
+ /**
62
+ * Read the system's installed package versions once (for `versionSelection: 'system'`), off the hot path. Only
63
+ * an R-backed parser exposes `installedPackageVersions`; a tree-sitter (no-R) parser skips this, so `system`
64
+ * gracefully falls back to `newest` in {@link resolve}. Idempotent; failures leave the map empty (same fallback).
65
+ */
66
+ private warmInstalledVersions;
67
+ /** Mount the databases up front instead of on the first library load (see `solver.sigdb.eagerlyLoad`). */
68
+ preloadDatabasesSync(): void;
69
+ /** whether any loaded source carries a versioned base-R package (so base namespaces can be attached eagerly) */
70
+ providesBaseRPackages(): boolean;
71
+ signatureSources(config?: FlowrConfig): readonly PackageSignatureSource[];
72
+ loadedDatabases(): SigDbLoadedInfo[];
73
+ /**
74
+ * Packages in the loaded sources (respecting `self`-package exclusion) that export `name`. Backed by a
75
+ * reverse index built once per source set, so repeated hint lookups (e.g. from the `undefined-symbol` linter)
76
+ * do not re-scan every package. The first call still pays one full pass over the sources.
77
+ */
78
+ packagesExporting(name: string): readonly string[];
79
+ /** one pass over every loaded source building `export name -> packages`, honoring self-package exclusion */
80
+ private buildExportIndex;
81
+ /**
82
+ * The raw sources in priority order: explicit constructor sources, `$FLOWR_SIGDB`, then **every** bundled
83
+ * database discovered in the data dirs (see {@link defaultSigDbPaths}) -- so an extra bundle dropped next to
84
+ * the default (e.g. a downloaded full-history one) is mounted automatically. All bundled defaults are skipped
85
+ * when `$FLOWR_DISABLE_DEFAULT_SIGDB` is set; explicit sources are always honored.
86
+ */
87
+ private rawSources;
88
+ /** synchronously openable sources (instances + plain `.sigs.ndjson`); `.br`/manifests are added by {@link preload}. */
89
+ private loadSources;
90
+ private loadSync;
91
+ /**
92
+ * Open every source, including compressed bundles (`.br`/`.gz`) and manifests (`*.manifest.json`).
93
+ * Call once at the analyzer boundary so resolution can fall through to them.
94
+ */
95
+ preload(): Promise<void>;
96
+ addDatabaseSource(source: string): Promise<void>;
97
+ /** Whether the given name is the analyzed project itself (so we must not shadow its own definitions). */
98
+ private isSelfPackage;
99
+ /**
100
+ * For a base package, the newest core version `<=` the assumed R version (see
101
+ * {@link FlowrAnalyzerContext.resolvedRVersion}). If the assumed version predates every recorded core
102
+ * release, the closest supported one (the earliest) is used and the substitution is logged once as info.
103
+ */
104
+ private baseVersionFor;
105
+ private resolve;
106
+ /** the concrete export view for a non-base package under the active {@link VersionSelection} policy, or `undefined` if none satisfies */
107
+ private selectVersion;
108
+ /**
109
+ * Newest version satisfying the constraint. Fast path: prefer the source's latest (no history decompression for
110
+ * the common `>=` case) and accept it when it satisfies; only otherwise enumerate the stored versions and pick
111
+ * the highest satisfying one (e.g. an upper-bound or exact-old pin).
112
+ */
113
+ private newestSatisfying;
114
+ /** Lowest stored version satisfying the constraint (using the store's actual R-form version strings). */
115
+ private oldestSatisfying;
116
+ /** the versions the source can answer for a package (dated releases, base-R core releases, and the latest), ascending */
117
+ private availableVersions;
118
+ /** build the resolved {@link Package} (namespace + version) from a source's export view */
119
+ private toResolvedPackage;
120
+ }