@eagleoutice/flowr 2.4.8 → 2.6.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 (234) hide show
  1. package/README.md +66 -45
  2. package/benchmark/slicer.js +1 -1
  3. package/benchmark/summarizer/second-phase/graph.js +2 -2
  4. package/cli/flowr.js +3 -29
  5. package/cli/repl/commands/repl-cfg.d.ts +5 -5
  6. package/cli/repl/commands/repl-cfg.js +21 -22
  7. package/cli/repl/commands/repl-commands.d.ts +3 -3
  8. package/cli/repl/commands/repl-commands.js +2 -0
  9. package/cli/repl/commands/repl-dataflow.d.ts +5 -5
  10. package/cli/repl/commands/repl-dataflow.js +27 -30
  11. package/cli/repl/commands/repl-execute.js +1 -0
  12. package/cli/repl/commands/repl-lineage.js +1 -0
  13. package/cli/repl/commands/repl-main.d.ts +34 -3
  14. package/cli/repl/commands/repl-normalize.d.ts +3 -3
  15. package/cli/repl/commands/repl-normalize.js +15 -19
  16. package/cli/repl/commands/repl-parse.d.ts +2 -2
  17. package/cli/repl/commands/repl-parse.js +13 -8
  18. package/cli/repl/commands/repl-query.d.ts +3 -3
  19. package/cli/repl/commands/repl-query.js +29 -19
  20. package/cli/repl/commands/repl-quit.js +1 -0
  21. package/cli/repl/commands/repl-version.js +1 -0
  22. package/cli/repl/core.d.ts +4 -1
  23. package/cli/repl/core.js +21 -1
  24. package/cli/repl/server/connection.d.ts +7 -3
  25. package/cli/repl/server/connection.js +40 -48
  26. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  27. package/cli/slicer-app.js +8 -3
  28. package/config.d.ts +1 -1
  29. package/config.js +4 -1
  30. package/control-flow/extract-cfg.d.ts +1 -1
  31. package/control-flow/extract-cfg.js +1 -1
  32. package/core/pipeline-executor.d.ts +5 -0
  33. package/core/pipeline-executor.js +5 -0
  34. package/core/steps/pipeline/create-pipeline.js +1 -1
  35. package/core/steps/pipeline/default-pipelines.d.ts +42 -42
  36. package/core/steps/pipeline/default-pipelines.js +4 -1
  37. package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
  38. package/dataflow/graph/dataflowgraph-builder.js +6 -6
  39. package/documentation/doc-util/doc-query.d.ts +3 -6
  40. package/documentation/doc-util/doc-query.js +5 -17
  41. package/documentation/doc-util/doc-search.js +7 -10
  42. package/documentation/doc-util/doc-structure.d.ts +4 -0
  43. package/documentation/doc-util/doc-structure.js +28 -0
  44. package/documentation/doc-util/doc-types.d.ts +5 -1
  45. package/documentation/doc-util/doc-types.js +29 -3
  46. package/documentation/print-analyzer-wiki.d.ts +1 -0
  47. package/documentation/print-analyzer-wiki.js +137 -0
  48. package/documentation/print-core-wiki.d.ts +2 -1
  49. package/documentation/print-core-wiki.js +58 -4
  50. package/documentation/print-dataflow-graph-wiki.js +15 -22
  51. package/documentation/print-interface-wiki.js +18 -1
  52. package/documentation/print-linter-wiki.js +5 -1
  53. package/documentation/print-linting-and-testing-wiki.js +4 -0
  54. package/documentation/print-normalized-ast-wiki.js +6 -8
  55. package/documentation/print-readme.js +6 -0
  56. package/engines.d.ts +9 -0
  57. package/engines.js +38 -0
  58. package/linter/linter-executor.d.ts +2 -8
  59. package/linter/linter-executor.js +9 -4
  60. package/linter/linter-format.d.ts +8 -9
  61. package/linter/linter-rules.d.ts +57 -15
  62. package/linter/linter-rules.js +2 -0
  63. package/linter/rules/absolute-path.d.ts +1 -0
  64. package/linter/rules/dataframe-access-validation.d.ts +4 -3
  65. package/linter/rules/dataframe-access-validation.js +7 -4
  66. package/linter/rules/dead-code.d.ts +2 -1
  67. package/linter/rules/deprecated-functions.d.ts +15 -28
  68. package/linter/rules/deprecated-functions.js +5 -43
  69. package/linter/rules/file-path-validity.d.ts +2 -1
  70. package/linter/rules/file-path-validity.js +1 -1
  71. package/linter/rules/function-finder-util.d.ts +51 -0
  72. package/linter/rules/function-finder-util.js +77 -0
  73. package/linter/rules/naming-convention.d.ts +2 -1
  74. package/linter/rules/network-functions.d.ts +40 -0
  75. package/linter/rules/network-functions.js +24 -0
  76. package/linter/rules/seeded-randomness.d.ts +2 -1
  77. package/linter/rules/unused-definition.d.ts +2 -1
  78. package/linter/rules/useless-loop.d.ts +3 -2
  79. package/linter/rules/useless-loop.js +4 -6
  80. package/package.json +5 -1
  81. package/project/cache/flowr-analyzer-cache.d.ts +93 -0
  82. package/project/cache/flowr-analyzer-cache.js +156 -0
  83. package/project/cache/flowr-cache.d.ts +28 -0
  84. package/project/cache/flowr-cache.js +49 -0
  85. package/project/context/abstract-flowr-analyzer-context.d.ts +35 -0
  86. package/project/context/abstract-flowr-analyzer-context.js +46 -0
  87. package/project/context/flowr-analyzer-context.d.ts +48 -0
  88. package/project/context/flowr-analyzer-context.js +47 -0
  89. package/project/context/flowr-analyzer-dependencies-context.d.ts +38 -0
  90. package/project/context/flowr-analyzer-dependencies-context.js +39 -0
  91. package/project/context/flowr-analyzer-files-context.d.ts +86 -0
  92. package/project/context/flowr-analyzer-files-context.js +130 -0
  93. package/project/context/flowr-analyzer-loading-order-context.d.ts +76 -0
  94. package/project/context/flowr-analyzer-loading-order-context.js +90 -0
  95. package/project/context/flowr-file.d.ts +89 -0
  96. package/project/context/flowr-file.js +78 -0
  97. package/project/flowr-analyzer-builder.d.ts +106 -0
  98. package/project/flowr-analyzer-builder.js +197 -0
  99. package/project/flowr-analyzer.d.ts +125 -0
  100. package/project/flowr-analyzer.js +81 -0
  101. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
  102. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
  103. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
  104. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
  105. package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
  106. package/project/plugins/file-plugins/flowr-description-file.js +38 -0
  107. package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
  108. package/project/plugins/flowr-analyzer-plugin.js +82 -0
  109. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
  110. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
  111. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
  112. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
  113. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
  114. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
  115. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  116. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
  117. package/project/plugins/package-version-plugins/package.d.ts +15 -0
  118. package/project/plugins/package-version-plugins/package.js +56 -0
  119. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
  120. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
  121. package/queries/base-query-format.d.ts +2 -8
  122. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  123. package/queries/catalog/call-context-query/call-context-query-executor.js +20 -13
  124. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
  125. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  126. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
  127. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
  128. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
  129. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  130. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  131. package/queries/catalog/config-query/config-query-executor.js +5 -5
  132. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  133. package/queries/catalog/config-query/config-query-format.js +1 -1
  134. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  135. package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
  136. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
  137. package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
  138. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
  139. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
  140. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
  141. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
  142. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
  143. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  144. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
  145. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
  146. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
  147. package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
  148. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
  149. package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
  150. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  151. package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
  152. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
  153. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  154. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  155. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
  156. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
  157. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
  158. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
  159. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
  160. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
  161. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  162. package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
  163. package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
  164. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
  165. package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
  166. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  167. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  168. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
  169. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  170. package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
  171. package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
  172. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  173. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  174. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
  175. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
  176. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
  177. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
  178. package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
  179. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  180. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
  181. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  182. package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
  183. package/queries/catalog/project-query/project-query-executor.js +2 -2
  184. package/queries/catalog/project-query/project-query-format.d.ts +1 -54
  185. package/queries/catalog/project-query/project-query-format.js +1 -1
  186. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  187. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
  188. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
  189. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  190. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  191. package/queries/catalog/search-query/search-query-executor.js +3 -3
  192. package/queries/catalog/search-query/search-query-format.d.ts +1 -54
  193. package/queries/catalog/search-query/search-query-format.js +1 -1
  194. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  195. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
  196. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
  197. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
  198. package/queries/query-print.d.ts +4 -4
  199. package/queries/query-print.js +12 -12
  200. package/queries/query.d.ts +29 -885
  201. package/queries/query.js +1 -1
  202. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
  203. package/r-bridge/retriever.d.ts +15 -2
  204. package/r-bridge/retriever.js +15 -5
  205. package/search/flowr-search-executor.d.ts +3 -5
  206. package/search/flowr-search-executor.js +6 -4
  207. package/search/flowr-search-filters.d.ts +12 -6
  208. package/search/flowr-search-filters.js +1 -1
  209. package/search/flowr-search.d.ts +5 -16
  210. package/search/flowr-search.js +14 -5
  211. package/search/search-executor/search-enrichers.d.ts +37 -36
  212. package/search/search-executor/search-enrichers.js +4 -4
  213. package/search/search-executor/search-generators.d.ts +12 -12
  214. package/search/search-executor/search-generators.js +27 -19
  215. package/search/search-executor/search-mappers.d.ts +5 -5
  216. package/search/search-executor/search-transformer.d.ts +17 -17
  217. package/search/search-executor/search-transformer.js +14 -7
  218. package/util/collections/arrays.d.ts +1 -0
  219. package/util/collections/arrays.js +15 -0
  220. package/util/collections/objectmap.d.ts +17 -0
  221. package/util/collections/objectmap.js +28 -0
  222. package/util/containers.d.ts +0 -1
  223. package/util/containers.js +0 -1
  224. package/util/files.d.ts +17 -0
  225. package/util/files.js +65 -0
  226. package/util/formats/adapter-format.d.ts +6 -0
  227. package/util/formats/adapter-format.js +3 -0
  228. package/util/formats/adapter.d.ts +18 -0
  229. package/util/formats/adapter.js +49 -0
  230. package/util/formats/adapters/r-adapter.d.ts +4 -0
  231. package/util/formats/adapters/r-adapter.js +7 -0
  232. package/util/formats/adapters/rmd-adapter.d.ts +26 -0
  233. package/util/formats/adapters/rmd-adapter.js +91 -0
  234. package/util/version.js +1 -1
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerPlugin = exports.PluginType = void 0;
4
+ const log_1 = require("../../util/log");
5
+ /**
6
+ * Based on *when* and *what-for* the plugin is applied during the analysis,
7
+ * plugins are categorized into different types.
8
+ *
9
+ * Consult this diagram for an overview of orders and (implicit or explicit) dependencies:
10
+ *
11
+ * ```text
12
+ * ┌───────────┐ ┌───────────────────┐ ┌─────────────┐ ┌───────────────┐ ┌───────┐
13
+ * │ │ │ │ │ │ │ │ │ │
14
+ * │ *Builder* ├──▶│ Project Discovery ├──▶│ File Loader ├──▶│ Dependencies ├──▶│ *DFA* │
15
+ * │ │ │ (if necessary) │ │ │ │ (static) │ │ │
16
+ * └───────────┘ └───────────────────┘ └──────┬──────┘ └───────────────┘ └───────┘
17
+ * │ ▲
18
+ * │ ┌───────────────┐ │
19
+ * │ │ │ │
20
+ * └─────────▶│ Loading Order ├───────┘
21
+ * │ │
22
+ * └───────────────┘
23
+ *```
24
+ *
25
+ */
26
+ var PluginType;
27
+ (function (PluginType) {
28
+ /**
29
+ * Plugins that are applied right after the builder has been created and before any analysis is done.
30
+ * @see {@link FlowrAnalyzerPackageVersionsPlugin} - for the base class to implement such a plugin.
31
+ */
32
+ PluginType["DependencyIdentification"] = "package-versions";
33
+ /**
34
+ * Plugins that are used to determine the order in which files are loaded and analyzed.
35
+ * @see {@link FlowrAnalyzerLoadingOrderPlugin} - for the base class to implement such a plugin.
36
+ */
37
+ PluginType["LoadingOrder"] = "loading-order";
38
+ /**
39
+ * Plugins that are applied to discover the project structure, files, and folders to analyze.
40
+ * @see {@link FlowrAnalyzerProjectDiscoveryPlugin} - for the base class to implement such a plugin.
41
+ */
42
+ PluginType["ProjectDiscovery"] = "project-discovery";
43
+ /**
44
+ * Plugins that are applied to load and parse files.
45
+ * @see {@link FlowrAnalyzerFilePlugin} - for the base class to implement such a plugin.
46
+ */
47
+ PluginType["FileLoad"] = "file-load";
48
+ })(PluginType || (exports.PluginType = PluginType = {}));
49
+ const generalPluginLog = log_1.log.getSubLogger({ name: 'plugins' });
50
+ /**
51
+ * The base class every plugin to be used with the {@link FlowrAnalyzer} must extend.
52
+ * **Please do not create plugins directly based on this class, but use the classes referenced alongside the {@link PluginType} values!**
53
+ * For example, if you want to create a plugin that determines the loading order of files, extend {@link FlowrAnalyzerLoadingOrderPlugin} instead.
54
+ * These classes also provide sensible overrides of {@link FlowrAnalyzerPlugin.defaultPlugin} to be used when no plugin of this type is registered or triggered.
55
+ */
56
+ class FlowrAnalyzerPlugin {
57
+ /**
58
+ * Returns a default/dummy implementation to be used when no plugin of this type is registered or triggered.
59
+ */
60
+ static defaultPlugin() {
61
+ throw new Error('This is to be implemented by every Plugin Layer');
62
+ }
63
+ /**
64
+ * Run the plugin with the given context and arguments.
65
+ */
66
+ processor(context, args) {
67
+ const now = Date.now();
68
+ try {
69
+ const result = this.process(context, args);
70
+ const duration = Date.now() - now;
71
+ (0, log_1.expensiveTrace)(generalPluginLog, () => `Plugin ${this.name} (v${this.version.format()}, ${this.type}) executed in ${duration}ms.`);
72
+ return result;
73
+ }
74
+ catch (error) {
75
+ const duration = Date.now() - now;
76
+ generalPluginLog.error(`Plugin ${this.name} (v${this.version.format()}, {this.type}) failed after ${duration}ms. Error: ${error.message}`);
77
+ throw error;
78
+ }
79
+ }
80
+ }
81
+ exports.FlowrAnalyzerPlugin = FlowrAnalyzerPlugin;
82
+ //# sourceMappingURL=flowr-analyzer-plugin.js.map
@@ -0,0 +1,14 @@
1
+ import { SemVer } from 'semver';
2
+ import { FlowrAnalyzerLoadingOrderPlugin } from './flowr-analyzer-loading-order-plugin';
3
+ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
4
+ /**
5
+ * This plugin extracts loading order information from R `DESCRIPTION` files.
6
+ * It looks at the `Collate` field to determine the order in which files should be loaded.
7
+ * If no `Collate` field is present, it does nothing.
8
+ */
9
+ export declare class FlowrAnalyzerLoadingOrderDescriptionFilePlugin extends FlowrAnalyzerLoadingOrderPlugin {
10
+ readonly name = "flowr-analyzer-package-version-description-file-plugin";
11
+ readonly description = "This plugin determines loading order based on the Collate field in DESCRIPTION files.";
12
+ readonly version: SemVer;
13
+ process(ctx: FlowrAnalyzerContext): void;
14
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerLoadingOrderDescriptionFilePlugin = void 0;
4
+ const flowr_analyzer_description_file_plugin_1 = require("../file-plugins/flowr-analyzer-description-file-plugin");
5
+ const semver_1 = require("semver");
6
+ const flowr_analyzer_loading_order_plugin_1 = require("./flowr-analyzer-loading-order-plugin");
7
+ const flowr_file_1 = require("../../context/flowr-file");
8
+ /**
9
+ * This plugin extracts loading order information from R `DESCRIPTION` files.
10
+ * It looks at the `Collate` field to determine the order in which files should be loaded.
11
+ * If no `Collate` field is present, it does nothing.
12
+ */
13
+ class FlowrAnalyzerLoadingOrderDescriptionFilePlugin extends flowr_analyzer_loading_order_plugin_1.FlowrAnalyzerLoadingOrderPlugin {
14
+ name = 'flowr-analyzer-package-version-description-file-plugin';
15
+ description = 'This plugin determines loading order based on the Collate field in DESCRIPTION files.';
16
+ version = new semver_1.SemVer('0.1.0');
17
+ process(ctx) {
18
+ const descFiles = ctx.files.getFilesByRole(flowr_file_1.SpecialFileRole.Description);
19
+ if (descFiles.length !== 1) {
20
+ flowr_analyzer_description_file_plugin_1.descriptionFileLog.warn(`Supporting only exactly one DESCRIPTION file, found ${descFiles.length}`);
21
+ return;
22
+ }
23
+ /** this will do the caching etc. for me */
24
+ const deps = descFiles[0].content();
25
+ if (deps.has('Collate')) {
26
+ const collate = deps.get('Collate') ?? [];
27
+ /* we probably have to do some more guesswork here */
28
+ const unordered = ctx.files.loadingOrder.getUnorderedRequests();
29
+ // sort them by their path index in the Collate field
30
+ const sorted = unordered.slice().sort((a, b) => {
31
+ const aPath = a.request === 'file' ? a.content : undefined;
32
+ const bPath = b.request === 'file' ? b.content : undefined;
33
+ const aIndex = aPath ? collate.findIndex(c => aPath.endsWith(c.trim())) : -1;
34
+ const bIndex = bPath ? collate.findIndex(c => bPath.endsWith(c.trim())) : -1;
35
+ if (aIndex === -1 && bIndex === -1) {
36
+ return 0; // both not found, keep original order
37
+ }
38
+ else if (aIndex === -1) {
39
+ return 1; // a not found, b found -> a after b
40
+ }
41
+ else if (bIndex === -1) {
42
+ return -1; // b not found, a found -> a before b
43
+ }
44
+ else {
45
+ return aIndex - bIndex; // both found, sort by index
46
+ }
47
+ });
48
+ ctx.files.loadingOrder.addGuess(sorted, true);
49
+ }
50
+ else {
51
+ flowr_analyzer_description_file_plugin_1.descriptionFileLog.info(`No Collate field in DESCRIPTION file ${descFiles[0].path().toString()}`);
52
+ }
53
+ }
54
+ }
55
+ exports.FlowrAnalyzerLoadingOrderDescriptionFilePlugin = FlowrAnalyzerLoadingOrderDescriptionFilePlugin;
56
+ //# sourceMappingURL=flowr-analyzer-loading-order-description-file-plugin.js.map
@@ -0,0 +1,13 @@
1
+ import { FlowrAnalyzerPlugin, PluginType } from '../flowr-analyzer-plugin';
2
+ /**
3
+ * This is the base class for all plugins that determine the loading order of files in a project.
4
+ * These plugins interplay with the {@link FlowrAnalyzerFilesContext} to gather information about the files in the project and determine their loading order.
5
+ * See {@link DefaultFlowrAnalyzerLoadingOrderPlugin} for the dummy default implementation.
6
+ *
7
+ * In general, these plugins only trigger for a full project analysis after all files have been discovered and loaded.
8
+ * Otherwise, they may trigger multiple times (if for some reason, discovery reveals new files during the analysis).
9
+ */
10
+ export declare abstract class FlowrAnalyzerLoadingOrderPlugin extends FlowrAnalyzerPlugin<undefined, void> {
11
+ readonly type = PluginType.LoadingOrder;
12
+ static defaultPlugin(): FlowrAnalyzerLoadingOrderPlugin;
13
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerLoadingOrderPlugin = void 0;
4
+ const flowr_analyzer_plugin_1 = require("../flowr-analyzer-plugin");
5
+ const semver_1 = require("semver");
6
+ /**
7
+ * This is the base class for all plugins that determine the loading order of files in a project.
8
+ * These plugins interplay with the {@link FlowrAnalyzerFilesContext} to gather information about the files in the project and determine their loading order.
9
+ * See {@link DefaultFlowrAnalyzerLoadingOrderPlugin} for the dummy default implementation.
10
+ *
11
+ * In general, these plugins only trigger for a full project analysis after all files have been discovered and loaded.
12
+ * Otherwise, they may trigger multiple times (if for some reason, discovery reveals new files during the analysis).
13
+ */
14
+ class FlowrAnalyzerLoadingOrderPlugin extends flowr_analyzer_plugin_1.FlowrAnalyzerPlugin {
15
+ type = flowr_analyzer_plugin_1.PluginType.LoadingOrder;
16
+ static defaultPlugin() {
17
+ return new DefaultFlowrAnalyzerLoadingOrderPlugin();
18
+ }
19
+ }
20
+ exports.FlowrAnalyzerLoadingOrderPlugin = FlowrAnalyzerLoadingOrderPlugin;
21
+ /**
22
+ * This is the default dummy implementation of the {@link FlowrAnalyzerLoadingOrderPlugin}.
23
+ * It does nothing and relies on the chronological order of file discovery.
24
+ */
25
+ class DefaultFlowrAnalyzerLoadingOrderPlugin extends FlowrAnalyzerLoadingOrderPlugin {
26
+ name = 'default-loading-order-plugin';
27
+ description = 'This is the default loading order plugin that does nothing.';
28
+ version = new semver_1.SemVer('0.0.0');
29
+ process() {
30
+ /* we always *have* to have a loading order, this plugin does not have to guess to rely on chronological order */
31
+ }
32
+ }
33
+ //# sourceMappingURL=flowr-analyzer-loading-order-plugin.js.map
@@ -0,0 +1,14 @@
1
+ import { FlowrAnalyzerPackageVersionsPlugin } from './flowr-analyzer-package-versions-plugin';
2
+ import { SemVer } from 'semver';
3
+ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
4
+ /**
5
+ * This plugin extracts package versions from R `DESCRIPTION` files.
6
+ * It looks at the `Depends` and `Imports` fields to find package names and their version constraints.
7
+ */
8
+ export declare class FlowrAnalyzerPackageVersionsDescriptionFilePlugin extends FlowrAnalyzerPackageVersionsPlugin {
9
+ readonly name = "flowr-analyzer-package-version-description-file-plugin";
10
+ readonly description = "This plugin does...";
11
+ readonly version: SemVer;
12
+ process(ctx: FlowrAnalyzerContext): void;
13
+ private retrieveVersionsFromField;
14
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerPackageVersionsDescriptionFilePlugin = void 0;
4
+ const flowr_analyzer_package_versions_plugin_1 = require("./flowr-analyzer-package-versions-plugin");
5
+ const flowr_analyzer_description_file_plugin_1 = require("../file-plugins/flowr-analyzer-description-file-plugin");
6
+ const semver_1 = require("semver");
7
+ const package_1 = require("./package");
8
+ const flowr_file_1 = require("../../context/flowr-file");
9
+ const VersionRegex = /^([a-zA-Z0-9.]+)(?:\s*\(([><=~!]+)\s*([\d.]+)\))?$/;
10
+ /**
11
+ * This plugin extracts package versions from R `DESCRIPTION` files.
12
+ * It looks at the `Depends` and `Imports` fields to find package names and their version constraints.
13
+ */
14
+ class FlowrAnalyzerPackageVersionsDescriptionFilePlugin extends flowr_analyzer_package_versions_plugin_1.FlowrAnalyzerPackageVersionsPlugin {
15
+ name = 'flowr-analyzer-package-version-description-file-plugin';
16
+ description = 'This plugin does...';
17
+ version = new semver_1.SemVer('0.1.0');
18
+ process(ctx) {
19
+ const descFiles = ctx.files.getFilesByRole(flowr_file_1.SpecialFileRole.Description);
20
+ if (descFiles.length !== 1) {
21
+ flowr_analyzer_description_file_plugin_1.descriptionFileLog.warn(`Supporting only exactly one DESCRIPTION file, found ${descFiles.length}`);
22
+ return;
23
+ }
24
+ /** this will do the caching etc. for me */
25
+ const deps = descFiles[0].content();
26
+ this.retrieveVersionsFromField(ctx, deps, 'Depends', 'r');
27
+ this.retrieveVersionsFromField(ctx, deps, 'Imports', 'package');
28
+ }
29
+ retrieveVersionsFromField(ctx, file, field, type) {
30
+ for (const entry of file.get(field) ?? []) {
31
+ const match = VersionRegex.exec(entry);
32
+ if (match) {
33
+ const [, name, operator, version] = match;
34
+ const range = package_1.Package.parsePackageVersionRange(operator, version);
35
+ ctx.deps.addDependency(new package_1.Package(name, type, undefined, range));
36
+ }
37
+ }
38
+ }
39
+ }
40
+ exports.FlowrAnalyzerPackageVersionsDescriptionFilePlugin = FlowrAnalyzerPackageVersionsDescriptionFilePlugin;
41
+ //# sourceMappingURL=flowr-analyzer-package-versions-description-file-plugin.js.map
@@ -0,0 +1,10 @@
1
+ import { FlowrAnalyzerPlugin, PluginType } from '../flowr-analyzer-plugin';
2
+ /**
3
+ * This is the base class for all plugins that identify package and dependency versions used in the project.
4
+ * These plugins interplay with the {@link FlowrAnalyzerDependenciesContext} to gather information about the packages used in the project.
5
+ * See {@link DefaultFlowrAnalyzerPackageVersionsPlugin} for the no-op default implementation.
6
+ */
7
+ export declare abstract class FlowrAnalyzerPackageVersionsPlugin extends FlowrAnalyzerPlugin<undefined, void> {
8
+ readonly type = PluginType.DependencyIdentification;
9
+ static defaultPlugin(): FlowrAnalyzerPackageVersionsPlugin;
10
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerPackageVersionsPlugin = void 0;
4
+ const flowr_analyzer_plugin_1 = require("../flowr-analyzer-plugin");
5
+ const semver_1 = require("semver");
6
+ /**
7
+ * This is the base class for all plugins that identify package and dependency versions used in the project.
8
+ * These plugins interplay with the {@link FlowrAnalyzerDependenciesContext} to gather information about the packages used in the project.
9
+ * See {@link DefaultFlowrAnalyzerPackageVersionsPlugin} for the no-op default implementation.
10
+ */
11
+ class FlowrAnalyzerPackageVersionsPlugin extends flowr_analyzer_plugin_1.FlowrAnalyzerPlugin {
12
+ type = flowr_analyzer_plugin_1.PluginType.DependencyIdentification;
13
+ static defaultPlugin() {
14
+ return new DefaultFlowrAnalyzerPackageVersionsPlugin();
15
+ }
16
+ }
17
+ exports.FlowrAnalyzerPackageVersionsPlugin = FlowrAnalyzerPackageVersionsPlugin;
18
+ /**
19
+ * This is the default no-op implementation of the {@link FlowrAnalyzerPackageVersionsPlugin}.
20
+ */
21
+ class DefaultFlowrAnalyzerPackageVersionsPlugin extends FlowrAnalyzerPackageVersionsPlugin {
22
+ name = 'default-package-versions-plugin';
23
+ description = 'This is the default package versions plugin that does nothing.';
24
+ version = new semver_1.SemVer('0.0.0');
25
+ process() {
26
+ /* we do not need package versions for the analysis to do things! */
27
+ }
28
+ }
29
+ //# sourceMappingURL=flowr-analyzer-package-versions-plugin.js.map
@@ -0,0 +1,15 @@
1
+ import { Range } from 'semver';
2
+ export type PackageType = 'package' | 'system' | 'r';
3
+ export declare class Package {
4
+ name: string;
5
+ derivedVersion?: Range;
6
+ type?: PackageType;
7
+ dependencies?: Package[];
8
+ versionConstraints: Range[];
9
+ constructor(name: string, type?: PackageType, dependencies?: Package[], ...versionConstraints: readonly (Range | undefined)[]);
10
+ mergeInPlace(other: Package): void;
11
+ addInfo(type?: PackageType, dependencies?: Package[], ...versionConstraints: readonly Range[]): void;
12
+ getInfo(): this;
13
+ deriveVersion(): Range | undefined;
14
+ static parsePackageVersionRange(constraint?: string, version?: string): Range | undefined;
15
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Package = void 0;
4
+ const semver_1 = require("semver");
5
+ const assert_1 = require("../../../util/assert");
6
+ class Package {
7
+ name;
8
+ derivedVersion;
9
+ type;
10
+ dependencies;
11
+ versionConstraints = [];
12
+ constructor(name, type, dependencies, ...versionConstraints) {
13
+ this.name = name;
14
+ this.addInfo(type, dependencies, ...(versionConstraints ?? []).filter(assert_1.isNotUndefined));
15
+ }
16
+ mergeInPlace(other) {
17
+ (0, assert_1.guard)(this.name === other.name, 'Can only merge packages with the same name');
18
+ this.addInfo(other.type, other.dependencies, ...other.versionConstraints);
19
+ }
20
+ addInfo(type, dependencies, ...versionConstraints) {
21
+ if (type !== undefined) {
22
+ this.type = type;
23
+ }
24
+ if (dependencies !== undefined) {
25
+ this.dependencies = dependencies;
26
+ }
27
+ if (versionConstraints !== undefined) {
28
+ this.derivedVersion ??= versionConstraints[0];
29
+ for (const constraint of versionConstraints) {
30
+ if (!this.derivedVersion?.intersects(constraint)) {
31
+ throw Error('Version constraint mismatch!');
32
+ }
33
+ this.versionConstraints.push(constraint);
34
+ this.derivedVersion = this.deriveVersion();
35
+ }
36
+ }
37
+ }
38
+ getInfo() {
39
+ return this;
40
+ }
41
+ deriveVersion() {
42
+ return this.versionConstraints.length > 0
43
+ ? new semver_1.Range(this.versionConstraints.map(c => c.raw).join(' '))
44
+ : undefined;
45
+ }
46
+ static parsePackageVersionRange(constraint, version) {
47
+ if (version) {
48
+ return constraint ? new semver_1.Range(constraint + version) : new semver_1.Range(version);
49
+ }
50
+ else {
51
+ return undefined;
52
+ }
53
+ }
54
+ }
55
+ exports.Package = Package;
56
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1,15 @@
1
+ import { FlowrAnalyzerPlugin, PluginType } from '../flowr-analyzer-plugin';
2
+ import type { RParseRequest } from '../../../r-bridge/retriever';
3
+ import type { RProjectAnalysisRequest } from '../../context/flowr-analyzer-files-context';
4
+ import type { FlowrFile } from '../../context/flowr-file';
5
+ /**
6
+ * This is the base class for all plugins that discover files in a project for analysis.
7
+ * These plugins interplay with the {@link FlowrAnalyzerFilesContext} to gather information about the files in the project.
8
+ * See {@link DefaultFlowrAnalyzerProjectDiscoveryPlugin} for the dummy default implementation.
9
+ *
10
+ * In general, these plugins only trigger for a {@link RProjectAnalysisRequest} with the idea to discover all files in a project.
11
+ */
12
+ export declare abstract class FlowrAnalyzerProjectDiscoveryPlugin extends FlowrAnalyzerPlugin<RProjectAnalysisRequest, (RParseRequest | FlowrFile<string>)[]> {
13
+ readonly type = PluginType.ProjectDiscovery;
14
+ static defaultPlugin(): FlowrAnalyzerProjectDiscoveryPlugin;
15
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerProjectDiscoveryPlugin = void 0;
4
+ const flowr_analyzer_plugin_1 = require("../flowr-analyzer-plugin");
5
+ const semver_1 = require("semver");
6
+ const flowr_file_1 = require("../../context/flowr-file");
7
+ const files_1 = require("../../../util/files");
8
+ /**
9
+ * This is the base class for all plugins that discover files in a project for analysis.
10
+ * These plugins interplay with the {@link FlowrAnalyzerFilesContext} to gather information about the files in the project.
11
+ * See {@link DefaultFlowrAnalyzerProjectDiscoveryPlugin} for the dummy default implementation.
12
+ *
13
+ * In general, these plugins only trigger for a {@link RProjectAnalysisRequest} with the idea to discover all files in a project.
14
+ */
15
+ class FlowrAnalyzerProjectDiscoveryPlugin extends flowr_analyzer_plugin_1.FlowrAnalyzerPlugin {
16
+ type = flowr_analyzer_plugin_1.PluginType.ProjectDiscovery;
17
+ static defaultPlugin() {
18
+ return new DefaultFlowrAnalyzerProjectDiscoveryPlugin();
19
+ }
20
+ }
21
+ exports.FlowrAnalyzerProjectDiscoveryPlugin = FlowrAnalyzerProjectDiscoveryPlugin;
22
+ /**
23
+ * This is the default dummy implementation of the {@link FlowrAnalyzerProjectDiscoveryPlugin}.
24
+ * It simply collects all files in the given folder and returns them as either {@link RParseRequest} (for R and Rmd files) or {@link FlowrTextFile} (for all other files).
25
+ */
26
+ class DefaultFlowrAnalyzerProjectDiscoveryPlugin extends FlowrAnalyzerProjectDiscoveryPlugin {
27
+ name = 'default-project-discovery-plugin';
28
+ description = 'This is the default project discovery plugin that does nothing.';
29
+ version = new semver_1.SemVer('0.0.0');
30
+ process(_context, args) {
31
+ const requests = [];
32
+ /* the dummy approach of collecting all files, group R and Rmd files, and be done with it */
33
+ for (const file of (0, files_1.getAllFilesSync)(args.content)) {
34
+ if (file.endsWith('.R') || file.endsWith('.r') || file.endsWith('.Rmd') || file.endsWith('.rmd')) {
35
+ requests.push({ content: file, request: 'file' });
36
+ }
37
+ else {
38
+ requests.push(new flowr_file_1.FlowrTextFile(file));
39
+ }
40
+ }
41
+ return requests;
42
+ }
43
+ }
44
+ //# sourceMappingURL=flowr-analyzer-project-discovery-plugin.js.map
@@ -1,7 +1,4 @@
1
- import type { NormalizedAst } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
2
- import type { DataflowInformation } from '../dataflow/info';
3
- import type { FlowrConfigOptions } from '../config';
4
- import type { SemVer } from 'semver';
1
+ import type { FlowrAnalysisProvider } from '../project/flowr-analyzer';
5
2
  export interface BaseQueryFormat {
6
3
  /** used to select the query type :) */
7
4
  readonly type: string;
@@ -14,8 +11,5 @@ export interface BaseQueryResult {
14
11
  readonly '.meta': BaseQueryMeta;
15
12
  }
16
13
  export interface BasicQueryData {
17
- readonly lib?: Record<string, SemVer>;
18
- readonly ast: NormalizedAst;
19
- readonly dataflow: DataflowInformation;
20
- readonly config: FlowrConfigOptions;
14
+ readonly analyzer: FlowrAnalysisProvider;
21
15
  }
@@ -13,4 +13,4 @@ export type PromotedLinkTo = Omit<LinkTo, 'callName'> & {
13
13
  * This happens during the main resolution!
14
14
  * 4. Attach `linkTo` calls to the respective calls.
15
15
  */
16
- export declare function executeCallContextQueries({ dataflow: { graph }, ast, config }: BasicQueryData, queries: readonly CallContextQuery[]): CallContextQueryResult;
16
+ export declare function executeCallContextQueries({ analyzer }: BasicQueryData, queries: readonly CallContextQuery[]): Promise<CallContextQueryResult>;
@@ -5,7 +5,6 @@ exports.executeCallContextQueries = executeCallContextQueries;
5
5
  const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
6
6
  const vertex_1 = require("../../../dataflow/graph/vertex");
7
7
  const edge_1 = require("../../../dataflow/graph/edge");
8
- const extract_cfg_1 = require("../../../control-flow/extract-cfg");
9
8
  const two_layer_collector_1 = require("../../two-layer-collector");
10
9
  const objects_1 = require("../../../util/objects");
11
10
  const identify_link_to_last_call_relation_1 = require("./identify-link-to-last-call-relation");
@@ -15,7 +14,7 @@ function isQuoted(node, graph) {
15
14
  if (vertex === undefined) {
16
15
  return false;
17
16
  }
18
- return [...vertex.values()].some(({ types }) => (0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.NonStandardEvaluation));
17
+ return vertex.values().some(({ types }) => (0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.NonStandardEvaluation));
19
18
  }
20
19
  function makeReport(collector) {
21
20
  const result = {};
@@ -109,9 +108,10 @@ function retrieveAllCallAliases(nodeId, graph) {
109
108
  }
110
109
  const [info, outgoing] = vertex;
111
110
  if (info.tag !== vertex_1.VertexType.FunctionCall) {
112
- const x = [...outgoing]
111
+ const x = outgoing.entries()
113
112
  .filter(([, { types }]) => (0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall))
114
- .map(([t]) => [(0, node_id_1.recoverContent)(t, graph) ?? '', t]);
113
+ .map(([t]) => [(0, node_id_1.recoverContent)(t, graph) ?? '', t])
114
+ .toArray();
115
115
  /** only follow defined-by and reads */
116
116
  queue = queue.concat(x);
117
117
  continue;
@@ -120,7 +120,7 @@ function retrieveAllCallAliases(nodeId, graph) {
120
120
  if (id !== nodeId) {
121
121
  track |= edge_1.EdgeType.Returns;
122
122
  }
123
- const out = [...outgoing]
123
+ const out = outgoing.entries()
124
124
  .filter(([, e]) => (0, edge_1.edgeIncludesType)(e.types, track) && (nodeId !== id || !(0, edge_1.edgeIncludesType)(e.types, edge_1.EdgeType.Argument)))
125
125
  .map(([t]) => t);
126
126
  for (const call of out) {
@@ -173,7 +173,9 @@ function isParameterDefaultValue(nodeId, ast) {
173
173
  * This happens during the main resolution!
174
174
  * 4. Attach `linkTo` calls to the respective calls.
175
175
  */
176
- function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries) {
176
+ async function executeCallContextQueries({ analyzer }, queries) {
177
+ const dataflow = await analyzer.dataflow();
178
+ const ast = await analyzer.normalize();
177
179
  /* omit performance page load */
178
180
  const now = Date.now();
179
181
  /* the node id and call targets if present */
@@ -182,10 +184,10 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
182
184
  const { promotedQueries, requiresCfg } = promoteQueryCallNames(queries);
183
185
  let cfg = undefined;
184
186
  if (requiresCfg) {
185
- cfg = (0, extract_cfg_1.extractCfg)(ast, config, graph, []);
187
+ cfg = await analyzer.controlflow([], true);
186
188
  }
187
189
  const queriesWhichWantAliases = promotedQueries.filter(q => q.includeAliases);
188
- for (const [nodeId, info] of graph.vertices(true)) {
190
+ for (const [nodeId, info] of dataflow.graph.vertices(true)) {
189
191
  if (info.tag !== vertex_1.VertexType.FunctionCall) {
190
192
  continue;
191
193
  }
@@ -196,7 +198,7 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
196
198
  * by checking all of these queries would be satisfied otherwise,
197
199
  * in general, we first want a call to happen, i.e., trace the called targets of this!
198
200
  */
199
- const targets = retrieveAllCallAliases(nodeId, graph);
201
+ const targets = retrieveAllCallAliases(nodeId, dataflow.graph);
200
202
  for (const [l, ids] of targets.entries()) {
201
203
  for (const query of queriesWhichWantAliases) {
202
204
  if (query.callName instanceof RegExp ? query.callName.test(l) : query.callName.has(l)) {
@@ -212,12 +214,12 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
212
214
  }
213
215
  let targets = undefined;
214
216
  if (query.callTargets) {
215
- targets = (0, identify_link_to_last_call_relation_1.satisfiesCallTargets)(nodeId, graph, query.callTargets);
217
+ targets = (0, identify_link_to_last_call_relation_1.satisfiesCallTargets)(nodeId, dataflow.graph, query.callTargets);
216
218
  if (targets === 'no') {
217
219
  continue;
218
220
  }
219
221
  }
220
- if (isQuoted(nodeId, graph)) {
222
+ if (isQuoted(nodeId, dataflow.graph)) {
221
223
  /* if the call is quoted, we do not want to link to it */
222
224
  continue;
223
225
  }
@@ -229,7 +231,7 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
229
231
  const linked = Array.isArray(query.linkTo) ? query.linkTo : [query.linkTo];
230
232
  for (const link of linked) {
231
233
  /* if we have a linkTo query, we have to find the last call */
232
- const lastCall = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(nodeId, cfg.graph, graph, link);
234
+ const lastCall = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(nodeId, cfg.graph, dataflow.graph, link);
233
235
  if (lastCall) {
234
236
  linkedIds ??= new Set();
235
237
  for (const l of lastCall) {
@@ -243,7 +245,12 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
243
245
  }
244
246
  }
245
247
  }
246
- initialIdCollector.add(query.kind ?? '.', query.subkind ?? '.', (0, objects_1.compactRecord)({ id: nodeId, name: info.name, calls: targets, linkedIds: linkedIds ? [...linkedIds] : undefined }));
248
+ initialIdCollector.add(query.kind ?? '.', query.subkind ?? '.', (0, objects_1.compactRecord)({
249
+ id: nodeId,
250
+ name: info.name,
251
+ calls: targets,
252
+ linkedIds: linkedIds ? [...linkedIds] : undefined
253
+ }));
247
254
  }
248
255
  }
249
256
  removeIdenticalDuplicates(initialIdCollector);
@@ -3,13 +3,12 @@ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/nod
3
3
  import { executeCallContextQueries } from './call-context-query-executor';
4
4
  import type { OutputFormatter } from '../../../util/text/ansi';
5
5
  import Joi from 'joi';
6
- import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
7
- import type { DEFAULT_DATAFLOW_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
8
6
  import { CallTargets } from './identify-link-to-last-call-relation';
9
7
  import type { DataflowGraph } from '../../../dataflow/graph/graph';
10
8
  import type { DataflowGraphVertexInfo } from '../../../dataflow/graph/vertex';
11
9
  import type { CascadeAction } from './cascade-action';
12
10
  import type { NoInfo } from '../../../r-bridge/lang-4.x/ast/model/model';
11
+ import type { FlowrAnalysisProvider } from '../../../project/flowr-analyzer';
13
12
  export interface FileFilter<FilterType> {
14
13
  /**
15
14
  * Regex that a node's file attribute must match to be considered
@@ -109,7 +108,7 @@ export interface CallContextQueryResult extends BaseQueryResult {
109
108
  export type CallContextQuery<CallName extends CallNameTypes = CallNameTypes, AttachLinkInfo = NoInfo> = DefaultCallContextQueryFormat<CallName> | SubCallContextQueryFormat<CallName, AttachLinkInfo>;
110
109
  export declare const CallContextQueryDefinition: {
111
110
  readonly executor: typeof executeCallContextQueries;
112
- readonly asciiSummarizer: (formatter: OutputFormatter, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>, queryResults: BaseQueryResult, result: string[]) => boolean;
111
+ readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: FlowrAnalysisProvider, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
113
112
  readonly schema: Joi.ObjectSchema<any>;
114
113
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
115
114
  };
@@ -19,10 +19,10 @@ const CallContextQueryLinkTo = joi_1.default.object({
19
19
  });
20
20
  exports.CallContextQueryDefinition = {
21
21
  executor: call_context_query_executor_1.executeCallContextQueries,
22
- asciiSummarizer: (formatter, processed, queryResults, result) => {
22
+ asciiSummarizer: async (formatter, analyzer, queryResults, result) => {
23
23
  const out = queryResults;
24
24
  result.push(`Query: ${(0, ansi_1.bold)('call-context', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
25
- result.push((0, query_print_1.asciiCallContext)(formatter, out, processed));
25
+ result.push((0, query_print_1.asciiCallContext)(formatter, out, (await analyzer.normalize()).idMap));
26
26
  return true;
27
27
  },
28
28
  schema: joi_1.default.object({
@@ -1,3 +1,3 @@
1
1
  import type { DataflowClusterQuery, DataflowClusterQueryResult } from './cluster-query-format';
2
2
  import type { BasicQueryData } from '../../base-query-format';
3
- export declare function executeDataflowClusterQuery({ dataflow: { graph } }: BasicQueryData, queries: readonly DataflowClusterQuery[]): DataflowClusterQueryResult;
3
+ export declare function executeDataflowClusterQuery({ analyzer }: BasicQueryData, queries: readonly DataflowClusterQuery[]): Promise<DataflowClusterQueryResult>;
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeDataflowClusterQuery = executeDataflowClusterQuery;
4
4
  const log_1 = require("../../../util/log");
5
5
  const cluster_1 = require("../../../dataflow/cluster");
6
- function executeDataflowClusterQuery({ dataflow: { graph } }, queries) {
6
+ async function executeDataflowClusterQuery({ analyzer }, queries) {
7
7
  if (queries.length !== 1) {
8
8
  log_1.log.warn('The dataflow cluster query expects only up to one query, but got', queries.length);
9
9
  }
10
10
  const start = Date.now();
11
- const clusters = (0, cluster_1.findAllClusters)(graph);
11
+ const clusters = (0, cluster_1.findAllClusters)((await analyzer.dataflow()).graph);
12
12
  return {
13
13
  '.meta': {
14
14
  timing: Date.now() - start