@eagleoutice/flowr 2.5.0 → 2.6.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 (254) hide show
  1. package/README.md +46 -35
  2. package/abstract-interpretation/data-frame/absint-visitor.d.ts +1 -1
  3. package/abstract-interpretation/data-frame/absint-visitor.js +1 -1
  4. package/cli/flowr.js +11 -33
  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.d.ts +1 -1
  12. package/cli/repl/commands/repl-execute.js +8 -7
  13. package/cli/repl/commands/repl-lineage.d.ts +2 -2
  14. package/cli/repl/commands/repl-lineage.js +11 -11
  15. package/cli/repl/commands/repl-main.d.ts +35 -7
  16. package/cli/repl/commands/repl-normalize.d.ts +3 -3
  17. package/cli/repl/commands/repl-normalize.js +15 -19
  18. package/cli/repl/commands/repl-parse.d.ts +2 -2
  19. package/cli/repl/commands/repl-parse.js +14 -8
  20. package/cli/repl/commands/repl-query.d.ts +3 -3
  21. package/cli/repl/commands/repl-query.js +29 -19
  22. package/cli/repl/commands/repl-quit.js +1 -0
  23. package/cli/repl/commands/repl-version.d.ts +1 -16
  24. package/cli/repl/commands/repl-version.js +2 -18
  25. package/cli/repl/core.d.ts +12 -9
  26. package/cli/repl/core.js +26 -12
  27. package/cli/repl/print-version.js +2 -2
  28. package/cli/repl/server/connection.d.ts +7 -3
  29. package/cli/repl/server/connection.js +46 -50
  30. package/cli/repl/server/messages/message-hello.d.ts +1 -1
  31. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  32. package/cli/repl/server/server.js +2 -2
  33. package/cli/slicer-app.js +1 -1
  34. package/config.d.ts +1 -1
  35. package/config.js +4 -1
  36. package/control-flow/extract-cfg.d.ts +1 -1
  37. package/control-flow/extract-cfg.js +1 -1
  38. package/core/pipeline-executor.d.ts +5 -0
  39. package/core/pipeline-executor.js +5 -0
  40. package/core/steps/all/core/20-dataflow.d.ts +3 -1
  41. package/core/steps/pipeline/create-pipeline.js +1 -1
  42. package/core/steps/pipeline/default-pipelines.d.ts +24 -8
  43. package/core/steps/pipeline/default-pipelines.js +4 -1
  44. package/dataflow/environments/default-builtin-config.js +8 -0
  45. package/dataflow/eval/resolve/alias-tracking.js +2 -0
  46. package/dataflow/eval/resolve/resolve.js +3 -0
  47. package/dataflow/eval/values/r-value.d.ts +4 -1
  48. package/dataflow/eval/values/r-value.js +2 -0
  49. package/dataflow/extractor.d.ts +4 -1
  50. package/dataflow/extractor.js +7 -5
  51. package/dataflow/fn/higher-order-function.d.ts +9 -0
  52. package/dataflow/fn/higher-order-function.js +75 -0
  53. package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
  54. package/dataflow/graph/dataflowgraph-builder.js +6 -6
  55. package/documentation/doc-util/doc-query.d.ts +3 -6
  56. package/documentation/doc-util/doc-query.js +5 -17
  57. package/documentation/doc-util/doc-repl.js +5 -2
  58. package/documentation/doc-util/doc-search.js +7 -10
  59. package/documentation/doc-util/doc-structure.d.ts +4 -0
  60. package/documentation/doc-util/doc-structure.js +28 -0
  61. package/documentation/doc-util/doc-types.d.ts +5 -1
  62. package/documentation/doc-util/doc-types.js +29 -3
  63. package/documentation/print-analyzer-wiki.d.ts +1 -0
  64. package/documentation/print-analyzer-wiki.js +137 -0
  65. package/documentation/print-core-wiki.d.ts +2 -1
  66. package/documentation/print-core-wiki.js +58 -4
  67. package/documentation/print-dataflow-graph-wiki.js +16 -23
  68. package/documentation/print-interface-wiki.js +18 -1
  69. package/documentation/print-linter-wiki.js +5 -1
  70. package/documentation/print-normalized-ast-wiki.js +6 -8
  71. package/documentation/print-query-wiki.js +20 -0
  72. package/documentation/print-readme.js +1 -1
  73. package/engines.d.ts +9 -0
  74. package/engines.js +38 -0
  75. package/linter/linter-executor.d.ts +2 -8
  76. package/linter/linter-executor.js +9 -4
  77. package/linter/linter-format.d.ts +8 -9
  78. package/linter/linter-rules.d.ts +57 -15
  79. package/linter/linter-rules.js +2 -0
  80. package/linter/rules/absolute-path.d.ts +1 -0
  81. package/linter/rules/dataframe-access-validation.d.ts +4 -3
  82. package/linter/rules/dataframe-access-validation.js +7 -4
  83. package/linter/rules/dead-code.d.ts +2 -1
  84. package/linter/rules/deprecated-functions.d.ts +15 -28
  85. package/linter/rules/deprecated-functions.js +5 -43
  86. package/linter/rules/file-path-validity.d.ts +2 -1
  87. package/linter/rules/file-path-validity.js +1 -1
  88. package/linter/rules/function-finder-util.d.ts +51 -0
  89. package/linter/rules/function-finder-util.js +77 -0
  90. package/linter/rules/naming-convention.d.ts +2 -1
  91. package/linter/rules/network-functions.d.ts +40 -0
  92. package/linter/rules/network-functions.js +24 -0
  93. package/linter/rules/seeded-randomness.d.ts +2 -1
  94. package/linter/rules/unused-definition.d.ts +2 -1
  95. package/linter/rules/useless-loop.d.ts +3 -2
  96. package/linter/rules/useless-loop.js +4 -6
  97. package/package.json +2 -1
  98. package/project/cache/flowr-analyzer-cache.d.ts +94 -0
  99. package/project/cache/flowr-analyzer-cache.js +164 -0
  100. package/project/cache/flowr-cache.d.ts +28 -0
  101. package/project/cache/flowr-cache.js +49 -0
  102. package/project/cfg-kind.d.ts +17 -0
  103. package/project/cfg-kind.js +22 -0
  104. package/project/context/abstract-flowr-analyzer-context.d.ts +39 -0
  105. package/project/context/abstract-flowr-analyzer-context.js +46 -0
  106. package/project/context/flowr-analyzer-context.d.ts +54 -0
  107. package/project/context/flowr-analyzer-context.js +58 -0
  108. package/project/context/flowr-analyzer-dependencies-context.d.ts +39 -0
  109. package/project/context/flowr-analyzer-dependencies-context.js +43 -0
  110. package/project/context/flowr-analyzer-files-context.d.ts +87 -0
  111. package/project/context/flowr-analyzer-files-context.js +134 -0
  112. package/project/context/flowr-analyzer-loading-order-context.d.ts +77 -0
  113. package/project/context/flowr-analyzer-loading-order-context.js +96 -0
  114. package/project/context/flowr-file.d.ts +89 -0
  115. package/project/context/flowr-file.js +78 -0
  116. package/project/flowr-analyzer-builder.d.ts +106 -0
  117. package/project/flowr-analyzer-builder.js +197 -0
  118. package/project/flowr-analyzer.d.ts +126 -0
  119. package/project/flowr-analyzer.js +88 -0
  120. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
  121. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
  122. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
  123. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
  124. package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
  125. package/project/plugins/file-plugins/flowr-description-file.js +38 -0
  126. package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
  127. package/project/plugins/flowr-analyzer-plugin.js +82 -0
  128. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
  129. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
  130. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
  131. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
  132. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
  133. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
  134. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  135. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
  136. package/project/plugins/package-version-plugins/package.d.ts +15 -0
  137. package/project/plugins/package-version-plugins/package.js +56 -0
  138. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
  139. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
  140. package/queries/base-query-format.d.ts +2 -8
  141. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  142. package/queries/catalog/call-context-query/call-context-query-executor.js +21 -13
  143. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
  144. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  145. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
  146. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
  147. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
  148. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  149. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  150. package/queries/catalog/config-query/config-query-executor.js +5 -5
  151. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  152. package/queries/catalog/config-query/config-query-format.js +1 -1
  153. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  154. package/queries/catalog/control-flow-query/control-flow-query-executor.js +3 -3
  155. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
  156. package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
  157. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
  158. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
  159. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
  160. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
  161. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
  162. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  163. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
  164. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
  165. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
  166. package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
  167. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
  168. package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
  169. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  170. package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
  171. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
  172. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  173. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  174. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
  175. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
  176. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
  177. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
  178. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
  179. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
  180. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  181. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -0
  182. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +45 -0
  183. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +22 -0
  184. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +32 -0
  185. package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
  186. package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
  187. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
  188. package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
  189. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  190. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  191. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
  192. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  193. package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
  194. package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
  195. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  196. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  197. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
  198. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
  199. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
  200. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
  201. package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
  202. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  203. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
  204. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  205. package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
  206. package/queries/catalog/project-query/project-query-executor.js +2 -2
  207. package/queries/catalog/project-query/project-query-format.d.ts +1 -54
  208. package/queries/catalog/project-query/project-query-format.js +1 -1
  209. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  210. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
  211. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
  212. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  213. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  214. package/queries/catalog/search-query/search-query-executor.js +3 -3
  215. package/queries/catalog/search-query/search-query-format.d.ts +1 -54
  216. package/queries/catalog/search-query/search-query-format.js +1 -1
  217. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  218. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
  219. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
  220. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
  221. package/queries/query-print.d.ts +4 -4
  222. package/queries/query-print.js +12 -12
  223. package/queries/query.d.ts +37 -885
  224. package/queries/query.js +3 -1
  225. package/r-bridge/parser.d.ts +7 -0
  226. package/r-bridge/retriever.d.ts +6 -5
  227. package/r-bridge/retriever.js +9 -5
  228. package/search/flowr-search-executor.d.ts +3 -5
  229. package/search/flowr-search-executor.js +6 -4
  230. package/search/flowr-search-filters.d.ts +12 -6
  231. package/search/flowr-search-filters.js +1 -1
  232. package/search/flowr-search.d.ts +5 -16
  233. package/search/flowr-search.js +14 -5
  234. package/search/search-executor/search-enrichers.d.ts +37 -36
  235. package/search/search-executor/search-enrichers.js +5 -4
  236. package/search/search-executor/search-generators.d.ts +12 -12
  237. package/search/search-executor/search-generators.js +27 -19
  238. package/search/search-executor/search-mappers.d.ts +5 -5
  239. package/search/search-executor/search-transformer.d.ts +17 -17
  240. package/search/search-executor/search-transformer.js +14 -7
  241. package/util/collections/arrays.d.ts +1 -0
  242. package/util/collections/arrays.js +15 -0
  243. package/util/collections/objectmap.d.ts +17 -0
  244. package/util/collections/objectmap.js +28 -0
  245. package/util/containers.d.ts +0 -1
  246. package/util/containers.js +0 -1
  247. package/util/files.d.ts +17 -0
  248. package/util/files.js +65 -0
  249. package/util/formats/adapter.d.ts +4 -2
  250. package/util/formats/adapter.js +11 -4
  251. package/util/r-value.d.ts +1 -1
  252. package/util/r-value.js +2 -0
  253. package/util/version.d.ts +17 -0
  254. package/util/version.js +28 -1
@@ -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,17 +5,17 @@ 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");
11
+ const cfg_kind_1 = require("../../../project/cfg-kind");
12
12
  /* if the node is effected by nse, we have an ingoing nse edge */
13
13
  function isQuoted(node, graph) {
14
14
  const vertex = graph.ingoingEdges(node);
15
15
  if (vertex === undefined) {
16
16
  return false;
17
17
  }
18
- return [...vertex.values()].some(({ types }) => (0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.NonStandardEvaluation));
18
+ return vertex.values().some(({ types }) => (0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.NonStandardEvaluation));
19
19
  }
20
20
  function makeReport(collector) {
21
21
  const result = {};
@@ -109,9 +109,10 @@ function retrieveAllCallAliases(nodeId, graph) {
109
109
  }
110
110
  const [info, outgoing] = vertex;
111
111
  if (info.tag !== vertex_1.VertexType.FunctionCall) {
112
- const x = [...outgoing]
112
+ const x = outgoing.entries()
113
113
  .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]);
114
+ .map(([t]) => [(0, node_id_1.recoverContent)(t, graph) ?? '', t])
115
+ .toArray();
115
116
  /** only follow defined-by and reads */
116
117
  queue = queue.concat(x);
117
118
  continue;
@@ -120,7 +121,7 @@ function retrieveAllCallAliases(nodeId, graph) {
120
121
  if (id !== nodeId) {
121
122
  track |= edge_1.EdgeType.Returns;
122
123
  }
123
- const out = [...outgoing]
124
+ const out = outgoing.entries()
124
125
  .filter(([, e]) => (0, edge_1.edgeIncludesType)(e.types, track) && (nodeId !== id || !(0, edge_1.edgeIncludesType)(e.types, edge_1.EdgeType.Argument)))
125
126
  .map(([t]) => t);
126
127
  for (const call of out) {
@@ -173,7 +174,9 @@ function isParameterDefaultValue(nodeId, ast) {
173
174
  * This happens during the main resolution!
174
175
  * 4. Attach `linkTo` calls to the respective calls.
175
176
  */
176
- function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries) {
177
+ async function executeCallContextQueries({ analyzer }, queries) {
178
+ const dataflow = await analyzer.dataflow();
179
+ const ast = await analyzer.normalize();
177
180
  /* omit performance page load */
178
181
  const now = Date.now();
179
182
  /* the node id and call targets if present */
@@ -182,10 +185,10 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
182
185
  const { promotedQueries, requiresCfg } = promoteQueryCallNames(queries);
183
186
  let cfg = undefined;
184
187
  if (requiresCfg) {
185
- cfg = (0, extract_cfg_1.extractCfg)(ast, config, graph, []);
188
+ cfg = await analyzer.controlflow([], cfg_kind_1.CfgKind.WithDataflow);
186
189
  }
187
190
  const queriesWhichWantAliases = promotedQueries.filter(q => q.includeAliases);
188
- for (const [nodeId, info] of graph.vertices(true)) {
191
+ for (const [nodeId, info] of dataflow.graph.vertices(true)) {
189
192
  if (info.tag !== vertex_1.VertexType.FunctionCall) {
190
193
  continue;
191
194
  }
@@ -196,7 +199,7 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
196
199
  * by checking all of these queries would be satisfied otherwise,
197
200
  * in general, we first want a call to happen, i.e., trace the called targets of this!
198
201
  */
199
- const targets = retrieveAllCallAliases(nodeId, graph);
202
+ const targets = retrieveAllCallAliases(nodeId, dataflow.graph);
200
203
  for (const [l, ids] of targets.entries()) {
201
204
  for (const query of queriesWhichWantAliases) {
202
205
  if (query.callName instanceof RegExp ? query.callName.test(l) : query.callName.has(l)) {
@@ -212,12 +215,12 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
212
215
  }
213
216
  let targets = undefined;
214
217
  if (query.callTargets) {
215
- targets = (0, identify_link_to_last_call_relation_1.satisfiesCallTargets)(nodeId, graph, query.callTargets);
218
+ targets = (0, identify_link_to_last_call_relation_1.satisfiesCallTargets)(nodeId, dataflow.graph, query.callTargets);
216
219
  if (targets === 'no') {
217
220
  continue;
218
221
  }
219
222
  }
220
- if (isQuoted(nodeId, graph)) {
223
+ if (isQuoted(nodeId, dataflow.graph)) {
221
224
  /* if the call is quoted, we do not want to link to it */
222
225
  continue;
223
226
  }
@@ -229,7 +232,7 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
229
232
  const linked = Array.isArray(query.linkTo) ? query.linkTo : [query.linkTo];
230
233
  for (const link of linked) {
231
234
  /* 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);
235
+ const lastCall = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(nodeId, cfg.graph, dataflow.graph, link);
233
236
  if (lastCall) {
234
237
  linkedIds ??= new Set();
235
238
  for (const l of lastCall) {
@@ -243,7 +246,12 @@ function executeCallContextQueries({ dataflow: { graph }, ast, config }, queries
243
246
  }
244
247
  }
245
248
  }
246
- initialIdCollector.add(query.kind ?? '.', query.subkind ?? '.', (0, objects_1.compactRecord)({ id: nodeId, name: info.name, calls: targets, linkedIds: linkedIds ? [...linkedIds] : undefined }));
249
+ initialIdCollector.add(query.kind ?? '.', query.subkind ?? '.', (0, objects_1.compactRecord)({
250
+ id: nodeId,
251
+ name: info.name,
252
+ calls: targets,
253
+ linkedIds: linkedIds ? [...linkedIds] : undefined
254
+ }));
247
255
  }
248
256
  }
249
257
  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
@@ -15,60 +15,7 @@ export interface DataflowClusterQueryResult extends BaseQueryResult {
15
15
  }
16
16
  export declare const ClusterQueryDefinition: {
17
17
  readonly executor: typeof executeDataflowClusterQuery;
18
- readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
19
- readonly name: "parse";
20
- readonly humanReadableName: "parse with R shell";
21
- readonly description: "Parse the given R code into an AST";
22
- readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
23
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
24
- readonly printer: {
25
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
26
- readonly 2: {
27
- (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
28
- (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
29
- };
30
- readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
31
- };
32
- readonly dependencies: readonly [];
33
- readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
34
- } | {
35
- readonly name: "normalize";
36
- readonly humanReadableName: "normalize";
37
- readonly description: "Normalize the AST to flowR's AST";
38
- readonly processor: (results: {
39
- parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
40
- }, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
41
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
42
- readonly printer: {
43
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
44
- readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
45
- readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
46
- readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
47
- readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
48
- };
49
- readonly dependencies: readonly ["parse"];
50
- readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
51
- } | {
52
- readonly humanReadableName: "dataflow";
53
- readonly processor: (results: {
54
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
55
- }, input: {
56
- request?: import("../../../r-bridge/retriever").RParseRequests;
57
- parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
58
- }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
59
- readonly requiredInput: {};
60
- readonly name: "dataflow";
61
- readonly description: "Construct the dataflow graph";
62
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
63
- readonly printer: {
64
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
65
- readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
66
- readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
67
- readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
68
- readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
69
- };
70
- readonly dependencies: readonly ["normalize"];
71
- }>>, queryResults: BaseQueryResult, result: string[]) => true;
18
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, analyzer: import("../../../project/flowr-analyzer").FlowrAnalysisProvider, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
72
19
  readonly schema: Joi.ObjectSchema<any>;
73
20
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
74
21
  };
@@ -11,7 +11,7 @@ const dfg_1 = require("../../../util/mermaid/dfg");
11
11
  const query_print_1 = require("../../query-print");
12
12
  exports.ClusterQueryDefinition = {
13
13
  executor: cluster_query_executor_1.executeDataflowClusterQuery,
14
- asciiSummarizer: (formatter, processed, queryResults, result) => {
14
+ asciiSummarizer: async (formatter, analyzer, queryResults, result) => {
15
15
  const out = queryResults;
16
16
  result.push(`Query: ${(0, ansi_1.bold)('dataflow-cluster', formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
17
17
  result.push(` ╰ Found ${out.clusters.length} cluster${out.clusters.length === 1 ? '' : 's'}`);
@@ -19,7 +19,7 @@ exports.ClusterQueryDefinition = {
19
19
  const unknownSideEffects = cluster.hasUnknownSideEffects ? '(has unknown side effect)' : '';
20
20
  let suffix = '';
21
21
  if (formatter === ansi_1.markdownFormatter) {
22
- suffix = `([marked](${(0, dfg_1.graphToMermaidUrl)(processed.dataflow.graph, false, new Set(cluster.members))}))`;
22
+ suffix = `([marked](${(0, dfg_1.graphToMermaidUrl)((await analyzer.dataflow()).graph, false, new Set(cluster.members))}))`;
23
23
  }
24
24
  result.push(` ╰ ${unknownSideEffects} {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, cluster.members)}} ${suffix}`);
25
25
  }
@@ -1,3 +1,3 @@
1
1
  import type { ConfigQuery, ConfigQueryResult } from './config-query-format';
2
2
  import type { BasicQueryData } from '../../base-query-format';
3
- export declare function executeConfigQuery({ config }: BasicQueryData, queries: readonly ConfigQuery[]): ConfigQueryResult;
3
+ export declare function executeConfigQuery({ analyzer }: BasicQueryData, queries: readonly ConfigQuery[]): Promise<ConfigQueryResult>;
@@ -4,20 +4,20 @@ exports.executeConfigQuery = executeConfigQuery;
4
4
  const log_1 = require("../../../util/log");
5
5
  const assert_1 = require("../../../util/assert");
6
6
  const objects_1 = require("../../../util/objects");
7
- function executeConfigQuery({ config }, queries) {
7
+ function executeConfigQuery({ analyzer }, queries) {
8
8
  if (queries.length !== 1) {
9
9
  log_1.log.warn('Config query usually expects only up to one query, but got', queries.length);
10
10
  }
11
11
  const updates = queries.map(q => q.update).filter(assert_1.isNotUndefined);
12
12
  for (const update of updates) {
13
- (0, objects_1.deepMergeObjectInPlace)(config, update);
13
+ (0, objects_1.deepMergeObjectInPlace)(analyzer.flowrConfig, update);
14
14
  }
15
- return {
15
+ return Promise.resolve({
16
16
  '.meta': {
17
17
  /* there is no sense in measuring a get */
18
18
  timing: 0
19
19
  },
20
- config: config
21
- };
20
+ config: analyzer.flowrConfig
21
+ });
22
22
  }
23
23
  //# sourceMappingURL=config-query-executor.js.map
@@ -15,7 +15,7 @@ declare function configReplCompleter(partialLine: readonly string[], config: Flo
15
15
  declare function configQueryLineParser(line: readonly string[], _config: FlowrConfigOptions): [ConfigQuery];
16
16
  export declare const ConfigQueryDefinition: {
17
17
  readonly executor: typeof executeConfigQuery;
18
- readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
18
+ readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[]) => true;
19
19
  readonly completer: typeof configReplCompleter;
20
20
  readonly fromLine: typeof configQueryLineParser;
21
21
  readonly schema: Joi.ObjectSchema<any>;
@@ -79,7 +79,7 @@ function configQueryLineParser(line, _config) {
79
79
  }
80
80
  exports.ConfigQueryDefinition = {
81
81
  executor: config_query_executor_1.executeConfigQuery,
82
- asciiSummarizer: (formatter, _processed, queryResults, result) => {
82
+ asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
83
83
  const out = queryResults;
84
84
  result.push(`Query: ${(0, ansi_1.bold)('config', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
85
85
  result.push(` ╰ Config:\n${JSON.stringify(out.config, json_1.jsonReplacer, 4)}`);
@@ -1,3 +1,3 @@
1
1
  import type { ControlFlowQuery, ControlFlowQueryResult } from './control-flow-query-format';
2
2
  import type { BasicQueryData } from '../../base-query-format';
3
- export declare function executeControlFlowQuery({ dataflow: { graph }, ast, config }: BasicQueryData, queries: readonly ControlFlowQuery[]): ControlFlowQueryResult;
3
+ export declare function executeControlFlowQuery({ analyzer }: BasicQueryData, queries: readonly ControlFlowQuery[]): Promise<ControlFlowQueryResult>;
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeControlFlowQuery = executeControlFlowQuery;
4
4
  const log_1 = require("../../../util/log");
5
- const extract_cfg_1 = require("../../../control-flow/extract-cfg");
6
- function executeControlFlowQuery({ dataflow: { graph }, ast, config }, queries) {
5
+ const cfg_kind_1 = require("../../../project/cfg-kind");
6
+ async function executeControlFlowQuery({ analyzer }, queries) {
7
7
  if (queries.length !== 1) {
8
8
  log_1.log.warn('The control flow query expects only up to one query, but got', queries.length);
9
9
  }
10
10
  const query = queries[0];
11
11
  const start = Date.now();
12
- const controlFlow = (0, extract_cfg_1.extractCfg)(ast, config, graph, query.config?.simplificationPasses);
12
+ const controlFlow = await analyzer.controlflow(query.config?.simplificationPasses, cfg_kind_1.CfgKind.WithDataflow);
13
13
  return {
14
14
  '.meta': {
15
15
  timing: Date.now() - start
@@ -22,60 +22,7 @@ export interface ControlFlowQueryResult extends BaseQueryResult {
22
22
  }
23
23
  export declare const ControlFlowQueryDefinition: {
24
24
  readonly executor: typeof executeControlFlowQuery;
25
- readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
26
- readonly name: "parse";
27
- readonly humanReadableName: "parse with R shell";
28
- readonly description: "Parse the given R code into an AST";
29
- readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
30
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
31
- readonly printer: {
32
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
33
- readonly 2: {
34
- (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
35
- (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
36
- };
37
- readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
38
- };
39
- readonly dependencies: readonly [];
40
- readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
41
- } | {
42
- readonly name: "normalize";
43
- readonly humanReadableName: "normalize";
44
- readonly description: "Normalize the AST to flowR's AST";
45
- readonly processor: (results: {
46
- parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
47
- }, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
48
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
49
- readonly printer: {
50
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
51
- readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
52
- readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
53
- readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
54
- readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
55
- };
56
- readonly dependencies: readonly ["parse"];
57
- readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
58
- } | {
59
- readonly humanReadableName: "dataflow";
60
- readonly processor: (results: {
61
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
62
- }, input: {
63
- request?: import("../../../r-bridge/retriever").RParseRequests;
64
- parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
65
- }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
66
- readonly requiredInput: {};
67
- readonly name: "dataflow";
68
- readonly description: "Construct the dataflow graph";
69
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
70
- readonly printer: {
71
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
72
- readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
73
- readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
74
- readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
75
- readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
76
- };
77
- readonly dependencies: readonly ["normalize"];
78
- }>>, queryResults: BaseQueryResult, result: string[]) => true;
25
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, analyzer: import("../../../project/flowr-analyzer").FlowrAnalysisProvider, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
79
26
  readonly schema: Joi.ObjectSchema<any>;
80
27
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
81
28
  };
@@ -12,10 +12,10 @@ const cfg_1 = require("../../../util/mermaid/cfg");
12
12
  const cfg_simplification_1 = require("../../../control-flow/cfg-simplification");
13
13
  exports.ControlFlowQueryDefinition = {
14
14
  executor: control_flow_query_executor_1.executeControlFlowQuery,
15
- asciiSummarizer: (formatter, processed, queryResults, result) => {
15
+ asciiSummarizer: async (formatter, analyzer, queryResults, result) => {
16
16
  const out = queryResults;
17
17
  result.push(`Query: ${(0, ansi_1.bold)('control-flow', formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
18
- result.push(` ╰ CFG: ${(0, cfg_1.cfgToMermaidUrl)(out.controlFlow, processed.normalize)}`);
18
+ result.push(` ╰ CFG: ${(0, cfg_1.cfgToMermaidUrl)(out.controlFlow, await analyzer.normalize())}`);
19
19
  return true;
20
20
  },
21
21
  schema: joi_1.default.object({
@@ -1,3 +1,3 @@
1
1
  import type { DataflowLensQuery, DataflowLensQueryResult } from './dataflow-lens-query-format';
2
2
  import type { BasicQueryData } from '../../base-query-format';
3
- export declare function executeDataflowLensQuery({ dataflow: { graph } }: BasicQueryData, queries: readonly DataflowLensQuery[]): DataflowLensQueryResult;
3
+ export declare function executeDataflowLensQuery({ analyzer }: BasicQueryData, queries: readonly DataflowLensQuery[]): Promise<DataflowLensQueryResult>;
@@ -4,12 +4,12 @@ exports.executeDataflowLensQuery = executeDataflowLensQuery;
4
4
  const log_1 = require("../../../util/log");
5
5
  const dfg_view_1 = require("../../../util/simple-df/dfg-view");
6
6
  const vertex_1 = require("../../../dataflow/graph/vertex");
7
- function executeDataflowLensQuery({ dataflow: { graph } }, queries) {
7
+ async function executeDataflowLensQuery({ analyzer }, queries) {
8
8
  if (queries.length !== 1) {
9
9
  log_1.log.warn('Dataflow query expects only up to one query, but got', queries.length);
10
10
  }
11
11
  const now = Date.now();
12
- const simplifiedGraph = (0, dfg_view_1.reduceDfg)(graph, {
12
+ const simplifiedGraph = (0, dfg_view_1.reduceDfg)((await analyzer.dataflow()).graph, {
13
13
  vertices: {
14
14
  keepEnv: false,
15
15
  keepCd: true,