@eagleoutice/flowr 2.10.8 → 2.10.10

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 (260) hide show
  1. package/README.md +106 -36
  2. package/abstract-interpretation/absint-visitor.js +6 -3
  3. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
  4. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
  5. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  6. package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
  7. package/abstract-interpretation/domains/interval-domain.js +1 -1
  8. package/abstract-interpretation/domains/lattice.d.ts +1 -1
  9. package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
  10. package/abstract-interpretation/domains/partial-product-domain.js +2 -2
  11. package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
  12. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  13. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
  14. package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
  15. package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
  16. package/abstract-interpretation/domains/singleton-domain.js +1 -1
  17. package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
  19. package/abstract-interpretation/unsupported-functions.d.ts +3 -2
  20. package/abstract-interpretation/unsupported-functions.js +38 -28
  21. package/cli/benchmark-app.js +2 -1
  22. package/cli/common/script.js +3 -2
  23. package/cli/flowr.js +47 -10
  24. package/cli/repl/commands/repl-cfg.js +9 -9
  25. package/cli/repl/commands/repl-commands.js +5 -0
  26. package/cli/repl/commands/repl-dataflow.js +31 -24
  27. package/cli/repl/commands/repl-main.d.ts +6 -0
  28. package/cli/repl/commands/repl-normalize.js +15 -12
  29. package/cli/repl/commands/repl-parse.js +1 -1
  30. package/cli/repl/commands/repl-query.js +4 -5
  31. package/cli/repl/commands/repl-quit.js +2 -1
  32. package/cli/repl/core.d.ts +11 -0
  33. package/cli/repl/core.js +101 -3
  34. package/cli/repl/execute.js +3 -2
  35. package/cli/repl/parser/slice-query-parser.d.ts +16 -0
  36. package/cli/repl/parser/slice-query-parser.js +52 -0
  37. package/cli/repl/server/connection.d.ts +1 -0
  38. package/cli/repl/server/connection.js +25 -0
  39. package/cli/repl/server/messages/message-analysis.d.ts +10 -0
  40. package/cli/repl/server/messages/message-analysis.js +6 -2
  41. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  42. package/cli/script-core/statistics-core.js +2 -1
  43. package/cli/script-core/statistics-helper-core.js +2 -1
  44. package/cli/wiki.d.ts +2 -1
  45. package/cli/wiki.js +4 -1
  46. package/config.d.ts +9 -0
  47. package/config.js +23 -1
  48. package/control-flow/diff-cfg.d.ts +1 -1
  49. package/control-flow/diff-cfg.js +1 -1
  50. package/control-flow/extract-cfg.js +9 -3
  51. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  52. package/control-flow/simple-visitor.js +6 -5
  53. package/control-flow/useless-loop.js +2 -2
  54. package/core/print/dataflow-printer.d.ts +2 -2
  55. package/core/print/dataflow-printer.js +2 -2
  56. package/core/steps/all/static-slicing/00-slice.js +1 -1
  57. package/core/steps/pipeline/default-pipelines.d.ts +146 -146
  58. package/dataflow/environments/append.d.ts +2 -1
  59. package/dataflow/environments/append.js +2 -1
  60. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  61. package/dataflow/environments/built-in-proc-name.js +2 -0
  62. package/dataflow/environments/built-in.d.ts +2 -0
  63. package/dataflow/environments/built-in.js +2 -0
  64. package/dataflow/environments/default-builtin-config.d.ts +122 -66
  65. package/dataflow/environments/default-builtin-config.js +324 -145
  66. package/dataflow/environments/environment.d.ts +2 -1
  67. package/dataflow/environments/environment.js +13 -9
  68. package/dataflow/environments/identifier.d.ts +55 -2
  69. package/dataflow/environments/identifier.js +14 -2
  70. package/dataflow/environments/reference-to-maybe.d.ts +2 -0
  71. package/dataflow/environments/reference-to-maybe.js +56 -11
  72. package/dataflow/environments/resolve-by-name.js +13 -7
  73. package/dataflow/eval/values/general.js +4 -0
  74. package/dataflow/extractor.js +22 -3
  75. package/dataflow/graph/df-helper.d.ts +6 -0
  76. package/dataflow/graph/df-helper.js +33 -0
  77. package/dataflow/graph/graph.js +7 -3
  78. package/dataflow/info.d.ts +1 -1
  79. package/dataflow/info.js +3 -1
  80. package/dataflow/internal/linker.d.ts +5 -1
  81. package/dataflow/internal/linker.js +34 -9
  82. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
  84. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +53 -0
  85. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
  86. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
  87. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  88. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
  89. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +38 -14
  90. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -0
  91. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
  92. package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
  93. package/dataflow/internal/process/functions/call/named-call-handling.js +6 -0
  94. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  95. package/dataflow/origin/dfg-get-origin.js +1 -1
  96. package/dataflow/processor.d.ts +6 -0
  97. package/documentation/data/faq/faqs.d.ts +2 -1
  98. package/documentation/data/faq/faqs.js +75 -57
  99. package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
  100. package/documentation/data/server/doc-data-server-messages.js +15 -7
  101. package/documentation/doc-readme.js +15 -15
  102. package/documentation/doc-util/doc-cfg.d.ts +3 -1
  103. package/documentation/doc-util/doc-cfg.js +3 -3
  104. package/documentation/doc-util/doc-dfg.d.ts +3 -1
  105. package/documentation/doc-util/doc-dfg.js +3 -3
  106. package/documentation/doc-util/doc-files.d.ts +3 -1
  107. package/documentation/doc-util/doc-files.js +9 -6
  108. package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
  109. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  110. package/documentation/doc-util/doc-query.d.ts +2 -1
  111. package/documentation/doc-util/doc-query.js +2 -2
  112. package/documentation/doc-util/doc-repl.js +1 -0
  113. package/documentation/doc-util/doc-types.d.ts +6 -6
  114. package/documentation/doc-util/doc-types.js +11 -9
  115. package/documentation/issue-linting-rule.js +1 -2
  116. package/documentation/wiki-analyzer.js +9 -9
  117. package/documentation/wiki-cfg.js +40 -41
  118. package/documentation/wiki-core.js +119 -31
  119. package/documentation/wiki-create-linting-rules.d.ts +6 -0
  120. package/documentation/wiki-create-linting-rules.js +95 -0
  121. package/documentation/wiki-dataflow-graph.js +77 -76
  122. package/documentation/wiki-engine.js +1 -2
  123. package/documentation/wiki-faq.d.ts +2 -1
  124. package/documentation/wiki-faq.js +4 -4
  125. package/documentation/wiki-interface.js +19 -6
  126. package/documentation/wiki-linter.d.ts +1 -1
  127. package/documentation/wiki-linter.js +14 -6
  128. package/documentation/wiki-linting-and-testing.js +2 -2
  129. package/documentation/wiki-mk/doc-context.d.ts +3 -3
  130. package/documentation/wiki-mk/doc-maker.d.ts +2 -0
  131. package/documentation/wiki-mk/doc-maker.js +7 -1
  132. package/documentation/wiki-normalized-ast.js +5 -5
  133. package/documentation/wiki-onboarding.d.ts +2 -1
  134. package/documentation/wiki-onboarding.js +5 -5
  135. package/documentation/wiki-overview.js +3 -3
  136. package/documentation/wiki-query.js +85 -84
  137. package/documentation/wiki-search.js +4 -5
  138. package/documentation/wiki-setup.js +6 -7
  139. package/gas.d.ts +74 -0
  140. package/gas.js +18 -0
  141. package/linter/linter-executor.js +2 -8
  142. package/linter/linter-format.d.ts +4 -11
  143. package/linter/linter-rules.d.ts +88 -86
  144. package/linter/linter-rules.js +7 -1
  145. package/linter/rules/absolute-path.d.ts +2 -7
  146. package/linter/rules/absolute-path.js +6 -4
  147. package/linter/rules/dataframe-access-validation.d.ts +1 -6
  148. package/linter/rules/dataframe-access-validation.js +8 -6
  149. package/linter/rules/dead-code.d.ts +2 -11
  150. package/linter/rules/dead-code.js +16 -11
  151. package/linter/rules/deprecated-functions.d.ts +3 -3
  152. package/linter/rules/file-path-validity.d.ts +1 -6
  153. package/linter/rules/file-path-validity.js +5 -5
  154. package/linter/rules/function-finder-util.d.ts +7 -11
  155. package/linter/rules/function-finder-util.js +9 -6
  156. package/linter/rules/naming-convention.d.ts +2 -7
  157. package/linter/rules/naming-convention.js +3 -2
  158. package/linter/rules/network-functions.d.ts +2 -7
  159. package/linter/rules/network-functions.js +14 -12
  160. package/linter/rules/no-leaked-credentials.d.ts +36 -0
  161. package/linter/rules/no-leaked-credentials.js +75 -0
  162. package/linter/rules/problematic-inputs.d.ts +1 -8
  163. package/linter/rules/problematic-inputs.js +5 -4
  164. package/linter/rules/roxygen-arguments.d.ts +2 -7
  165. package/linter/rules/roxygen-arguments.js +13 -20
  166. package/linter/rules/seeded-randomness.d.ts +2 -7
  167. package/linter/rules/seeded-randomness.js +7 -4
  168. package/linter/rules/software-has-license.d.ts +31 -0
  169. package/linter/rules/software-has-license.js +46 -0
  170. package/linter/rules/software-has-tests.d.ts +38 -0
  171. package/linter/rules/software-has-tests.js +48 -0
  172. package/linter/rules/stop-with-call-arg.d.ts +2 -7
  173. package/linter/rules/stop-with-call-arg.js +3 -2
  174. package/linter/rules/unused-definition.d.ts +3 -8
  175. package/linter/rules/unused-definition.js +7 -5
  176. package/linter/rules/useless-loop.d.ts +2 -7
  177. package/linter/rules/useless-loop.js +5 -2
  178. package/package.json +3 -2
  179. package/project/context/flowr-analyzer-context.d.ts +13 -14
  180. package/project/context/flowr-analyzer-context.js +4 -0
  181. package/project/context/flowr-analyzer-files-context.d.ts +12 -0
  182. package/project/context/flowr-analyzer-files-context.js +12 -2
  183. package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
  184. package/project/context/flowr-analyzer-gas-context.js +101 -0
  185. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
  186. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
  187. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  188. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
  189. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
  190. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
  191. package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
  192. package/project/plugins/flowr-analyzer-plugin.js +14 -7
  193. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
  194. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
  195. package/project/plugins/plugin-registry.d.ts +2 -1
  196. package/project/plugins/plugin-registry.js +3 -1
  197. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
  198. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
  199. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
  200. package/queries/catalog/call-context-query/call-context-query-executor.js +54 -8
  201. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
  202. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  203. package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
  204. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  205. package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
  206. package/queries/catalog/dice-query/dice-query-executor.js +52 -0
  207. package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
  208. package/queries/catalog/dice-query/dice-query-format.js +102 -0
  209. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  210. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  211. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
  212. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  213. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
  214. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  215. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
  216. package/queries/catalog/linter-query/linter-query-executor.js +7 -0
  217. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  218. package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
  219. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  220. package/queries/catalog/origin-query/origin-query-format.js +1 -0
  221. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  222. package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
  223. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  224. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
  225. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  226. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
  227. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  228. package/queries/query.d.ts +18 -1
  229. package/queries/query.js +3 -1
  230. package/r-bridge/data/data.d.ts +5 -0
  231. package/r-bridge/data/data.js +6 -0
  232. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
  233. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +10 -1
  234. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
  235. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  236. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
  237. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
  238. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +63 -44
  239. package/r-bridge/parser.js +2 -9
  240. package/r-bridge/shell.d.ts +8 -1
  241. package/r-bridge/shell.js +26 -7
  242. package/search/flowr-search-builder.d.ts +2 -2
  243. package/search/flowr-search-builder.js +1 -1
  244. package/search/flowr-search-filters.d.ts +30 -9
  245. package/search/flowr-search-filters.js +26 -21
  246. package/search/search-executor/search-enrichers.d.ts +600 -0
  247. package/search/search-executor/search-enrichers.js +23 -2
  248. package/slicing/static/static-slicer.d.ts +39 -11
  249. package/slicing/static/static-slicer.js +44 -14
  250. package/util/collections/queue.d.ts +16 -0
  251. package/util/collections/queue.js +38 -0
  252. package/util/log.d.ts +1 -1
  253. package/util/log.js +1 -1
  254. package/util/mermaid/dfg.d.ts +2 -2
  255. package/util/mermaid/dfg.js +2 -2
  256. package/util/objects.d.ts +9 -0
  257. package/util/objects.js +57 -1
  258. package/util/proc.d.ts +6 -0
  259. package/util/proc.js +20 -0
  260. package/util/version.js +1 -1
@@ -39,10 +39,13 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
39
39
  fileLoaders;
40
40
  /** these are all the paths of files that have been considered by the dataflow graph (even if not added) */
41
41
  consideredFiles = [];
42
+ /** User-registered project discovery plugins; if non-empty, they replace the default. */
43
+ discoveryPlugins;
42
44
  /* files that are part of the analysis, e.g. source files */
43
45
  byRole = Object.fromEntries(Object.values(flowr_file_1.FileRole).map(k => [k, []]));
44
46
  constructor(loadingOrder, plugins, fileLoaders) {
45
- super(loadingOrder.getAttachedContext(), flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin(), plugins);
47
+ super(loadingOrder.getAttachedContext(), flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin(), []);
48
+ this.discoveryPlugins = plugins;
46
49
  this.fileLoaders = [...fileLoaders, flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin.defaultPlugin()];
47
50
  this.loadingOrder = loadingOrder;
48
51
  }
@@ -75,13 +78,17 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
75
78
  }
76
79
  /**
77
80
  * Add a request to the context. If the request is of type `project`, it will be expanded using the registered {@link FlowrAnalyzerProjectDiscoveryPlugin}s.
81
+ * User-registered discovery plugins replace the built-in default; if none are registered, the default runs.
78
82
  */
79
83
  addRequest(request) {
80
84
  if (request.request !== 'project') {
81
85
  this.loadingOrder.addRequest(request);
82
86
  return;
83
87
  }
84
- const expandedRequests = this.applyPlugins(request).flat();
88
+ const active = this.discoveryPlugins.length > 0
89
+ ? this.discoveryPlugins
90
+ : [flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin()];
91
+ const expandedRequests = active.flatMap(p => p.processor(this.ctx, request));
85
92
  for (const req of expandedRequests) {
86
93
  if ((0, retriever_1.isParseRequest)(req)) {
87
94
  this.addRequest(req);
@@ -233,6 +240,9 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
233
240
  getAllFiles() {
234
241
  return [...this.files.values(), ...this.inlineFiles];
235
242
  }
243
+ getFileByPath(path) {
244
+ return this.files.get(path) ?? this.inlineFiles.find(f => f.path() === path);
245
+ }
236
246
  }
237
247
  exports.FlowrAnalyzerFilesContext = FlowrAnalyzerFilesContext;
238
248
  //# sourceMappingURL=flowr-analyzer-files-context.js.map
@@ -0,0 +1,28 @@
1
+ import { type FlowrGasConfig, GasLevel } from '../../gas';
2
+ import type { FlowrAnalyzerGasPlugin } from '../plugins/gas-plugins/flowr-analyzer-gas-plugin';
3
+ import type { FlowrAnalyzerContext } from './flowr-analyzer-context';
4
+ /** Read-only gas context exposed via `ctx.gas`. */
5
+ export interface ReadOnlyFlowrAnalyzerGasContext {
6
+ readonly name: string;
7
+ /**
8
+ * Returns the resource-pressure level for `key` (`config.gas.features[key]`).
9
+ * Returns `GasLevel.Normal` with zero overhead when the feature factor is 0 or absent
10
+ * and no gas plugins are registered (plugins are always consulted and may escalate any key).
11
+ */
12
+ checkGas(key: string): GasLevel;
13
+ }
14
+ /** Checks heap and elapsed-time pressure for named analysis features. See {@link ReadOnlyFlowrAnalyzerGasContext}. */
15
+ export declare class FlowrAnalyzerGasContext implements ReadOnlyFlowrAnalyzerGasContext {
16
+ readonly name = "flowr-analyzer-gas-context";
17
+ private startTime;
18
+ private readonly config;
19
+ private readonly ctx;
20
+ private readonly plugins;
21
+ constructor(ctx: FlowrAnalyzerContext, config: FlowrGasConfig | undefined, plugins: readonly FlowrAnalyzerGasPlugin[]);
22
+ /** Restart the elapsed-time counter (called when the owning context is reset). */
23
+ reset(): void;
24
+ private memoryLevel;
25
+ private static maxLevel;
26
+ private timeLevel;
27
+ checkGas(key: string): GasLevel;
28
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerGasContext = void 0;
4
+ const log_1 = require("../../util/log");
5
+ let heapStatisticsProvider = undefined;
6
+ /**
7
+ * Heap statistics come from the v8 module (Node.js, Electron, VS Code extension host) or,
8
+ * as a fallback, from Chromium's non-standard performance.memory (browsers, web workers).
9
+ * If neither exists, this returns undefined and gas skips the memory check
10
+ * (use {@link FlowrGasConfig#heapProvider} or a gas plugin to supply a custom source).
11
+ */
12
+ function tryGetHeapStatistics() {
13
+ if (heapStatisticsProvider === undefined) {
14
+ const v8 = globalThis.process?.getBuiltinModule?.('v8');
15
+ if (v8) {
16
+ heapStatisticsProvider = v8.getHeapStatistics;
17
+ }
18
+ else if (globalThis.performance?.memory) {
19
+ heapStatisticsProvider = () => {
20
+ const m = globalThis.performance.memory;
21
+ return { used_heap_size: m.usedJSHeapSize, heap_size_limit: m.jsHeapSizeLimit };
22
+ };
23
+ }
24
+ else {
25
+ heapStatisticsProvider = null;
26
+ log_1.log.info('no heap statistics source available in this runtime, gas skips the memory check');
27
+ }
28
+ }
29
+ return heapStatisticsProvider ? heapStatisticsProvider() : undefined;
30
+ }
31
+ /** Checks heap and elapsed-time pressure for named analysis features. See {@link ReadOnlyFlowrAnalyzerGasContext}. */
32
+ class FlowrAnalyzerGasContext {
33
+ name = 'flowr-analyzer-gas-context';
34
+ startTime;
35
+ config;
36
+ ctx;
37
+ plugins;
38
+ constructor(ctx, config, plugins) {
39
+ this.ctx = ctx;
40
+ this.config = config;
41
+ this.plugins = plugins;
42
+ this.startTime = Date.now();
43
+ }
44
+ /** Restart the elapsed-time counter (called when the owning context is reset). */
45
+ reset() {
46
+ this.startTime = Date.now();
47
+ }
48
+ memoryLevel(factor, t) {
49
+ const stats = this.config?.heapProvider ? this.config.heapProvider() : tryGetHeapStatistics();
50
+ if (stats === undefined || stats.heap_size_limit <= 0) {
51
+ return 0 /* GasLevel.Normal */;
52
+ }
53
+ const ratio = (stats.used_heap_size / stats.heap_size_limit) * factor;
54
+ if (ratio >= t.memory.critical) {
55
+ return 2 /* GasLevel.Critical */;
56
+ }
57
+ if (ratio >= t.memory.problematic) {
58
+ return 1 /* GasLevel.Problematic */;
59
+ }
60
+ return 0 /* GasLevel.Normal */;
61
+ }
62
+ static maxLevel(a, b) {
63
+ return a >= b ? a : b;
64
+ }
65
+ timeLevel(factor, t) {
66
+ const elapsed = (Date.now() - this.startTime) * factor;
67
+ if (elapsed >= t.timeMs.critical) {
68
+ return 2 /* GasLevel.Critical */;
69
+ }
70
+ if (elapsed >= t.timeMs.problematic) {
71
+ return 1 /* GasLevel.Problematic */;
72
+ }
73
+ return 0 /* GasLevel.Normal */;
74
+ }
75
+ checkGas(key) {
76
+ const factor = this.config?.features?.[key];
77
+ if (!factor && this.plugins.length === 0) {
78
+ return 0 /* GasLevel.Normal */;
79
+ }
80
+ let level = 0 /* GasLevel.Normal */;
81
+ if (factor) {
82
+ const t = this.config.thresholds;
83
+ level = FlowrAnalyzerGasContext.maxLevel(level, this.memoryLevel(factor, t));
84
+ if (level < 2 /* GasLevel.Critical */) {
85
+ level = FlowrAnalyzerGasContext.maxLevel(level, this.timeLevel(factor, t));
86
+ }
87
+ }
88
+ for (const plugin of this.plugins) {
89
+ if (level >= 2 /* GasLevel.Critical */) {
90
+ break;
91
+ }
92
+ const override = plugin.processor(this.ctx, key);
93
+ if (override !== undefined) {
94
+ level = FlowrAnalyzerGasContext.maxLevel(level, override);
95
+ }
96
+ }
97
+ return level;
98
+ }
99
+ }
100
+ exports.FlowrAnalyzerGasContext = FlowrAnalyzerGasContext;
101
+ //# sourceMappingURL=flowr-analyzer-gas-context.js.map
@@ -1,42 +1,48 @@
1
1
  import type { FlowrFileProvider } from '../../../context/flowr-file';
2
2
  import { FlowrFile } from '../../../context/flowr-file';
3
3
  import { type Node } from 'commonmark';
4
+ import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-context';
4
5
  /**
5
6
  * This decorates a text file and parses its contents as a R Markdown file.
6
7
  * Finally, it provides access to the single cells, and all cells fused together as one R file.
7
8
  */
8
9
  export declare class FlowrRMarkdownFile extends FlowrFile<string> {
9
10
  private data?;
11
+ private mergedCode?;
10
12
  private readonly wrapped;
13
+ private readonly context;
11
14
  /**
12
15
  * Prefer the static {@link FlowrRMarkdownFile.from} method
13
16
  * @param file - the file to load as R Markdown
14
17
  */
15
- constructor(file: FlowrFileProvider<string>);
18
+ constructor(file: FlowrFileProvider<string>, ctx: FlowrAnalyzerContext);
16
19
  /**
17
20
  * Gets the parsed R Markdown information
18
21
  */
19
22
  get rmd(): RmdInfo;
23
+ get executableCells(): CodeBlock[];
20
24
  /**
21
25
  * Loads and parses the content of the wrapped file.
22
26
  * @returns RmdInfo
23
27
  */
24
28
  protected loadContent(): string;
25
- static from(file: FlowrFileProvider<string> | FlowrRMarkdownFile): FlowrRMarkdownFile;
29
+ /**
30
+ * Postprocess blocks with options like child='other.Rmd'
31
+ */
32
+ private postProcessCodeBlocks;
33
+ static from(file: FlowrFileProvider<string> | FlowrRMarkdownFile, ctx: FlowrAnalyzerContext): FlowrRMarkdownFile;
26
34
  }
27
35
  export type CodeBlockOptions = Map<string, string>;
28
36
  export interface CodeBlock {
29
37
  options: CodeBlockOptions;
30
38
  code: string;
31
- }
32
- export type CodeBlockEx = CodeBlock & {
39
+ header: string;
33
40
  startpos: {
34
41
  line: number;
35
42
  col: number;
36
43
  };
37
- };
44
+ }
38
45
  export interface RmdInfo {
39
- content: string;
40
46
  blocks: CodeBlock[];
41
47
  options: object;
42
48
  }
@@ -56,7 +62,7 @@ export declare function isRCodeBlock(node: Node): node is Node & {
56
62
  /**
57
63
  * Restores an Rmd file from code blocks, filling non-code lines with empty lines
58
64
  */
59
- export declare function restoreBlocksWithoutMd(blocks: CodeBlockEx[], totalLines: number): string;
65
+ export declare function restoreBlocksWithoutMd(blocks: readonly CodeBlock[], totalLines: number): string;
60
66
  /**
61
67
  * Parses the options of an R code block from its header and content
62
68
  */
@@ -13,20 +13,24 @@ const assert_1 = require("../../../../util/assert");
13
13
  const commonmark_1 = require("commonmark");
14
14
  const gray_matter_1 = __importDefault(require("gray-matter"));
15
15
  const log_1 = require("../../../../util/log");
16
+ const built_in_source_1 = require("../../../../dataflow/internal/process/functions/call/built-in/built-in-source");
16
17
  /**
17
18
  * This decorates a text file and parses its contents as a R Markdown file.
18
19
  * Finally, it provides access to the single cells, and all cells fused together as one R file.
19
20
  */
20
21
  class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
21
22
  data;
23
+ mergedCode;
22
24
  wrapped;
25
+ context;
23
26
  /**
24
27
  * Prefer the static {@link FlowrRMarkdownFile.from} method
25
28
  * @param file - the file to load as R Markdown
26
29
  */
27
- constructor(file) {
30
+ constructor(file, ctx) {
28
31
  super(file.path(), file.roles ? [...file.roles, flowr_file_1.FileRole.Source] : [flowr_file_1.FileRole.Source]);
29
32
  this.wrapped = file;
33
+ this.context = ctx;
30
34
  }
31
35
  /**
32
36
  * Gets the parsed R Markdown information
@@ -35,19 +39,62 @@ class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
35
39
  if (!this.data) {
36
40
  this.loadContent();
37
41
  }
38
- (0, assert_1.guard)(this.data);
42
+ (0, assert_1.guard)(this.data !== undefined);
39
43
  return this.data;
40
44
  }
45
+ get executableCells() {
46
+ return this.rmd.blocks.filter(b => {
47
+ const opt = b.options.get('eval');
48
+ return opt !== 'F' && opt !== 'FALSE';
49
+ });
50
+ }
41
51
  /**
42
52
  * Loads and parses the content of the wrapped file.
43
53
  * @returns RmdInfo
44
54
  */
45
55
  loadContent() {
46
- this.data = parseRMarkdownFile(this.wrapped.content());
47
- return this.data.content;
56
+ const raw = this.wrapped.content();
57
+ this.data = parseRMarkdownFile(raw);
58
+ this.postProcessCodeBlocks();
59
+ this.mergedCode = restoreBlocksWithoutMd(this.data.blocks, countNewlines(raw));
60
+ (0, assert_1.guard)(this.mergedCode !== undefined);
61
+ return this.mergedCode;
62
+ }
63
+ /**
64
+ * Postprocess blocks with options like child='other.Rmd'
65
+ */
66
+ postProcessCodeBlocks() {
67
+ (0, assert_1.guard)(this.data !== undefined);
68
+ for (const block of this.data.blocks) {
69
+ const childOpt = block.options.get('child');
70
+ if (childOpt === undefined) {
71
+ continue;
72
+ }
73
+ const childPath = (0, built_in_source_1.findSource)(this.context.config.solver.resolveSource, childOpt, {
74
+ ctx: this.context,
75
+ referenceChain: [this.path()]
76
+ });
77
+ if (childPath === undefined) {
78
+ continue;
79
+ }
80
+ if (childPath.length > 1) {
81
+ log_1.log.warn(`Found more than one path for child '${childOpt}' in rmd file '${this.path()}'. Only using the first path: '${childPath[0]}'`);
82
+ }
83
+ this.context.files.resolveRequest({
84
+ request: 'file',
85
+ content: childPath[0]
86
+ });
87
+ const rawChildFile = this.context.files.getFileByPath(childPath[0]);
88
+ if (rawChildFile !== undefined) {
89
+ block.code = FlowrRMarkdownFile.from(rawChildFile, this.context).content();
90
+ }
91
+ else {
92
+ log_1.log.warn(`Child file '${childPath[0]}' of '${this.path()}' did not load as RMD.`);
93
+ }
94
+ }
48
95
  }
49
- static from(file) {
50
- return file instanceof FlowrRMarkdownFile ? file : new FlowrRMarkdownFile(file);
96
+ static from(file, ctx) {
97
+ return file instanceof FlowrRMarkdownFile ? file : new FlowrRMarkdownFile(file, ctx);
51
98
  }
52
99
  }
53
100
  exports.FlowrRMarkdownFile = FlowrRMarkdownFile;
@@ -86,13 +133,12 @@ function parseRMarkdownFile(raw) {
86
133
  blocks.push({
87
134
  code: node.literal,
88
135
  options: options,
136
+ header: node.info,
89
137
  startpos: { line: node.sourcepos[0][0] + 1, col: 0 }
90
138
  });
91
139
  }
92
140
  return {
93
- content: restoreBlocksWithoutMd(blocks, countNewlines(raw)),
94
- // eslint-disable-next-line unused-imports/no-unused-vars
95
- blocks: blocks.map(({ startpos, ...block }) => block),
141
+ blocks: blocks,
96
142
  options: frontmatter?.data ?? {}
97
143
  };
98
144
  }
@@ -115,8 +161,7 @@ function restoreBlocksWithoutMd(blocks, totalLines) {
115
161
  let line = 1;
116
162
  let output = '';
117
163
  const goToLine = (n) => {
118
- const diff = n - line;
119
- (0, assert_1.guard)(diff >= 0);
164
+ const diff = Math.max(n - line, 0);
120
165
  line += diff;
121
166
  output += '\n'.repeat(diff);
122
167
  };
@@ -18,5 +18,5 @@ export declare class FlowrAnalyzerQmdFilePlugin extends FlowrAnalyzerFilePlugin
18
18
  */
19
19
  constructor(filePattern?: RegExp);
20
20
  applies(file: PathLike): boolean;
21
- protected process(_ctx: FlowrAnalyzerContext, arg: FlowrFileProvider<string>): FlowrRMarkdownFile;
21
+ protected process(ctx: FlowrAnalyzerContext, arg: FlowrFileProvider<string>): FlowrRMarkdownFile;
22
22
  }
@@ -25,8 +25,8 @@ class FlowrAnalyzerQmdFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnaly
25
25
  applies(file) {
26
26
  return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
27
27
  }
28
- process(_ctx, arg) {
29
- return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg);
28
+ process(ctx, arg) {
29
+ return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg, ctx);
30
30
  }
31
31
  }
32
32
  exports.FlowrAnalyzerQmdFilePlugin = FlowrAnalyzerQmdFilePlugin;
@@ -4,6 +4,7 @@ import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-conte
4
4
  import { type FlowrFileProvider } from '../../../context/flowr-file';
5
5
  import { FlowrAnalyzerFilePlugin } from '../flowr-analyzer-file-plugin';
6
6
  import { FlowrRMarkdownFile } from '../files/flowr-rmarkdown-file';
7
+ export declare const RmdPattern: RegExp;
7
8
  /**
8
9
  * The plugin provides support for R Markdown (`.rmd`) files
9
10
  */
@@ -18,5 +19,5 @@ export declare class FlowrAnalyzerRmdFilePlugin extends FlowrAnalyzerFilePlugin
18
19
  */
19
20
  constructor(filePattern?: RegExp);
20
21
  applies(file: PathLike): boolean;
21
- protected process(_ctx: FlowrAnalyzerContext, arg: FlowrFileProvider<string>): FlowrRMarkdownFile;
22
+ protected process(ctx: FlowrAnalyzerContext, arg: FlowrFileProvider<string>): FlowrRMarkdownFile;
22
23
  }
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowrAnalyzerRmdFilePlugin = void 0;
3
+ exports.FlowrAnalyzerRmdFilePlugin = exports.RmdPattern = void 0;
4
4
  const semver_1 = require("semver");
5
5
  const flowr_analyzer_file_plugin_1 = require("../flowr-analyzer-file-plugin");
6
6
  const flowr_rmarkdown_file_1 = require("../files/flowr-rmarkdown-file");
7
7
  const built_in_source_1 = require("../../../../dataflow/internal/process/functions/call/built-in/built-in-source");
8
- const RmdPattern = /\.rmd$/i;
8
+ exports.RmdPattern = /\.rmd$/i;
9
9
  /**
10
10
  * The plugin provides support for R Markdown (`.rmd`) files
11
11
  */
@@ -18,15 +18,15 @@ class FlowrAnalyzerRmdFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnaly
18
18
  * Creates a new instance of the R Markdown file plugin.
19
19
  * @param filePattern - The pattern to identify R Markdown files, see {@link RmdPattern} for the default pattern.
20
20
  */
21
- constructor(filePattern = RmdPattern) {
21
+ constructor(filePattern = exports.RmdPattern) {
22
22
  super();
23
23
  this.pattern = filePattern;
24
24
  }
25
25
  applies(file) {
26
26
  return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
27
27
  }
28
- process(_ctx, arg) {
29
- return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg);
28
+ process(ctx, arg) {
29
+ return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg, ctx);
30
30
  }
31
31
  }
32
32
  exports.FlowrAnalyzerRmdFilePlugin = FlowrAnalyzerRmdFilePlugin;
@@ -12,13 +12,14 @@ import type { FlowrAnalyzerContext } from '../context/flowr-analyzer-context';
12
12
  * │ │ │ │ │ │ │ │ │ │
13
13
  * │ *Builder* ├──▶│ Project Discovery ├──▶│ File Loader ├──▶│ Dependencies ├──▶│ *DFA* │
14
14
  * │ │ │ (if necessary) │ │ │ │ (static) │ │ │
15
- * └───────────┘ └───────────────────┘ └──────┬──────┘ └───────────────┘ └───────┘
16
- * │ ▲
17
- * │ ┌───────────────┐ │
18
- * │ │ │ │
19
- * └─────────▶│ Loading Order ├───────┘
20
- * │ │
21
- * └───────────────┘
15
+ * └───────────┘ └───────────────────┘ └──────┬──────┘ └───────────────┘ └────┬──┘
16
+ * │ ▲│
17
+ * │ ┌───────────────┐ ││
18
+ * │ │ │ ││ on-demand
19
+ * └─────────▶│ Loading Order ├───────┘│
20
+ * │ │ │ ┌───────────┐
21
+ * └───────────────┘ └─▶│ Gas │
22
+ * └───────────┘
22
23
  *```
23
24
  *
24
25
  */
@@ -42,7 +43,13 @@ export declare enum PluginType {
42
43
  * Plugins that are applied to load and parse files.
43
44
  * @see {@link FlowrAnalyzerFilePlugin} - for the base class to implement such a plugin.
44
45
  */
45
- FileLoad = "file-load"
46
+ FileLoad = "file-load",
47
+ /**
48
+ * Plugins that are queried on-demand during analysis to report the current resource-usage pressure level.
49
+ * Multiple Gas plugins are combined by taking the maximum level returned.
50
+ * @see {@link FlowrAnalyzerGasPlugin} - for the base class to implement such a plugin.
51
+ */
52
+ Gas = "gas"
46
53
  }
47
54
  /**
48
55
  * This is the main interface that every plugin to be used with the {@link FlowrAnalyzer} must comply with.
@@ -13,13 +13,14 @@ const log_1 = require("../../util/log");
13
13
  * │ │ │ │ │ │ │ │ │ │
14
14
  * │ *Builder* ├──▶│ Project Discovery ├──▶│ File Loader ├──▶│ Dependencies ├──▶│ *DFA* │
15
15
  * │ │ │ (if necessary) │ │ │ │ (static) │ │ │
16
- * └───────────┘ └───────────────────┘ └──────┬──────┘ └───────────────┘ └───────┘
17
- * │ ▲
18
- * │ ┌───────────────┐ │
19
- * │ │ │ │
20
- * └─────────▶│ Loading Order ├───────┘
21
- * │ │
22
- * └───────────────┘
16
+ * └───────────┘ └───────────────────┘ └──────┬──────┘ └───────────────┘ └────┬──┘
17
+ * │ ▲│
18
+ * │ ┌───────────────┐ ││
19
+ * │ │ │ ││ on-demand
20
+ * └─────────▶│ Loading Order ├───────┘│
21
+ * │ │ │ ┌───────────┐
22
+ * └───────────────┘ └─▶│ Gas │
23
+ * └───────────┘
23
24
  *```
24
25
  *
25
26
  */
@@ -45,6 +46,12 @@ var PluginType;
45
46
  * @see {@link FlowrAnalyzerFilePlugin} - for the base class to implement such a plugin.
46
47
  */
47
48
  PluginType["FileLoad"] = "file-load";
49
+ /**
50
+ * Plugins that are queried on-demand during analysis to report the current resource-usage pressure level.
51
+ * Multiple Gas plugins are combined by taking the maximum level returned.
52
+ * @see {@link FlowrAnalyzerGasPlugin} - for the base class to implement such a plugin.
53
+ */
54
+ PluginType["Gas"] = "gas";
48
55
  })(PluginType || (exports.PluginType = PluginType = {}));
49
56
  const generalPluginLog = log_1.log.getSubLogger({ name: 'plugins' });
50
57
  /**
@@ -0,0 +1,19 @@
1
+ import { FlowrAnalyzerPlugin, PluginType } from '../flowr-analyzer-plugin';
2
+ import type { GasLevel } from '../../../gas';
3
+ /**
4
+ * Base class for gas plugins, queried on-demand by {@link FlowrAnalyzerGasContext.checkGas}.
5
+ *
6
+ * Override {@link process} to provide a custom resource-pressure assessment for a feature key.
7
+ * Return `undefined` to defer to the built-in memory and time checks.
8
+ * Multiple Gas plugins are combined by taking the maximum ({@link GasLevel}) returned by any plugin
9
+ * or by the built-in checks.
10
+ *
11
+ * A gas plugin is the right place to add domain-specific checks (e.g., CPU, I/O, quota limits)
12
+ * or to override default behavior for testing by returning a hardcoded level.
13
+ * @see {@link PluginType.Gas}
14
+ * @see {@link FlowrAnalyzerGasContext}
15
+ */
16
+ export declare abstract class FlowrAnalyzerGasPlugin extends FlowrAnalyzerPlugin<string, GasLevel | undefined> {
17
+ readonly type = PluginType.Gas;
18
+ static defaultPlugin(): FlowrAnalyzerGasPlugin;
19
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerGasPlugin = void 0;
4
+ const flowr_analyzer_plugin_1 = require("../flowr-analyzer-plugin");
5
+ const semver_1 = require("semver");
6
+ /**
7
+ * Base class for gas plugins, queried on-demand by {@link FlowrAnalyzerGasContext.checkGas}.
8
+ *
9
+ * Override {@link process} to provide a custom resource-pressure assessment for a feature key.
10
+ * Return `undefined` to defer to the built-in memory and time checks.
11
+ * Multiple Gas plugins are combined by taking the maximum ({@link GasLevel}) returned by any plugin
12
+ * or by the built-in checks.
13
+ *
14
+ * A gas plugin is the right place to add domain-specific checks (e.g., CPU, I/O, quota limits)
15
+ * or to override default behavior for testing by returning a hardcoded level.
16
+ * @see {@link PluginType.Gas}
17
+ * @see {@link FlowrAnalyzerGasContext}
18
+ */
19
+ class FlowrAnalyzerGasPlugin extends flowr_analyzer_plugin_1.FlowrAnalyzerPlugin {
20
+ type = flowr_analyzer_plugin_1.PluginType.Gas;
21
+ static defaultPlugin() {
22
+ return new DefaultFlowrAnalyzerGasPlugin();
23
+ }
24
+ }
25
+ exports.FlowrAnalyzerGasPlugin = FlowrAnalyzerGasPlugin;
26
+ /** Default no-op gas plugin that defers all checks to the built-in memory and time logic. */
27
+ class DefaultFlowrAnalyzerGasPlugin extends FlowrAnalyzerGasPlugin {
28
+ name = 'default-gas-plugin';
29
+ description = 'Defers to built-in memory and time checks.';
30
+ version = new semver_1.SemVer('0.0.0');
31
+ process(_ctx, _key) {
32
+ return undefined;
33
+ }
34
+ }
35
+ //# sourceMappingURL=flowr-analyzer-gas-plugin.js.map
@@ -12,10 +12,11 @@ import { FlowrAnalyzerMetaTestFilesPlugin } from './file-plugins/flowr-analyzer-
12
12
  import { FlowrAnalyzerLicenseFilePlugin } from './file-plugins/flowr-analyzer-license-file-plugin';
13
13
  import { FlowrAnalyzerMetaDescriptionFilePlugin } from './package-version-plugins/flowr-analyzer-meta-description-file-plugin';
14
14
  import { FlowrAnalyzerSweaveFilePlugin } from './file-plugins/notebooks/flowr-analyzer-sweave-file-plugin';
15
+ import { FlowrAnalyzerGitignoreProjectDiscoveryPlugin } from './project-discovery/flowr-analyzer-gitignore-project-discovery-plugin';
15
16
  /**
16
17
  * The built-in Flowr Analyzer plugins that are always available.
17
18
  */
18
- export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["meta:description", typeof FlowrAnalyzerMetaDescriptionFilePlugin], ["files:vignette", typeof FlowrAnalyzerMetaVignetteFilesPlugin], ["files:test", typeof FlowrAnalyzerMetaTestFilesPlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:rnw", typeof FlowrAnalyzerSweaveFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilesPlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin], ["file:license", typeof FlowrAnalyzerLicenseFilePlugin]];
19
+ export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["meta:description", typeof FlowrAnalyzerMetaDescriptionFilePlugin], ["files:vignette", typeof FlowrAnalyzerMetaVignetteFilesPlugin], ["files:test", typeof FlowrAnalyzerMetaTestFilesPlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:rnw", typeof FlowrAnalyzerSweaveFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilesPlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin], ["file:license", typeof FlowrAnalyzerLicenseFilePlugin], ["project-discovery:gitignore", typeof FlowrAnalyzerGitignoreProjectDiscoveryPlugin]];
19
20
  export type BuiltInFlowrPluginName = typeof BuiltInPlugins[number][0];
20
21
  export type BuiltInFlowrPluginArgs<N extends BuiltInFlowrPluginName> = N extends typeof BuiltInPlugins[number][0] ? ConstructorParameters<Extract<typeof BuiltInPlugins[number], [N, PluginProducer]>[1]> : never;
21
22
  type PluginProducer = new (...args: never[]) => FlowrAnalyzerPlugin;
@@ -18,6 +18,7 @@ const flowr_analyzer_test_file_plugin_1 = require("./file-plugins/flowr-analyzer
18
18
  const flowr_analyzer_license_file_plugin_1 = require("./file-plugins/flowr-analyzer-license-file-plugin");
19
19
  const flowr_analyzer_meta_description_file_plugin_1 = require("./package-version-plugins/flowr-analyzer-meta-description-file-plugin");
20
20
  const flowr_analyzer_sweave_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-sweave-file-plugin");
21
+ const flowr_analyzer_gitignore_project_discovery_plugin_1 = require("./project-discovery/flowr-analyzer-gitignore-project-discovery-plugin");
21
22
  /**
22
23
  * The built-in Flowr Analyzer plugins that are always available.
23
24
  */
@@ -34,7 +35,8 @@ exports.BuiltInPlugins = [
34
35
  ['file:ipynb', flowr_analyzer_jupyter_file_plugin_1.FlowrAnalyzerJupyterFilePlugin],
35
36
  ['file:namespace', flowr_analyzer_namespace_files_plugin_1.FlowrAnalyzerNamespaceFilesPlugin],
36
37
  ['file:news', flowr_analyzer_news_file_plugin_1.FlowrAnalyzerNewsFilePlugin],
37
- ['file:license', flowr_analyzer_license_file_plugin_1.FlowrAnalyzerLicenseFilePlugin]
38
+ ['file:license', flowr_analyzer_license_file_plugin_1.FlowrAnalyzerLicenseFilePlugin],
39
+ ['project-discovery:gitignore', flowr_analyzer_gitignore_project_discovery_plugin_1.FlowrAnalyzerGitignoreProjectDiscoveryPlugin]
38
40
  ];
39
41
  /**
40
42
  * The registry of built-in and user-registered Flowr Analyzer plugins.
@@ -0,0 +1,22 @@
1
+ import { FlowrAnalyzerProjectDiscoveryPlugin } from './flowr-analyzer-project-discovery-plugin';
2
+ import { SemVer } from 'semver';
3
+ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
4
+ import type { RProjectAnalysisRequest } from '../../context/flowr-analyzer-files-context';
5
+ import type { RParseRequest } from '../../../r-bridge/retriever';
6
+ import type { FlowrFile } from '../../context/flowr-file';
7
+ /**
8
+ * Decorator around any {@link FlowrAnalyzerProjectDiscoveryPlugin} that filters discovered files
9
+ * by the rules in a `.gitignore` file found at the project root.
10
+ * If no `.gitignore` exists, the inner plugin's results are returned unchanged.
11
+ *
12
+ * Register as `'project-discovery:gitignore'` (see {@link BuiltInPlugins}) to replace the
13
+ * default discovery plugin with a gitignore-aware variant.
14
+ */
15
+ export declare class FlowrAnalyzerGitignoreProjectDiscoveryPlugin extends FlowrAnalyzerProjectDiscoveryPlugin {
16
+ readonly name = "flowr-analyzer-gitignore-project-discovery-plugin";
17
+ readonly description = "Wraps a project discovery plugin and filters results by .gitignore rules.";
18
+ readonly version: SemVer;
19
+ private readonly inner;
20
+ constructor(inner?: FlowrAnalyzerProjectDiscoveryPlugin);
21
+ protected process(context: FlowrAnalyzerContext, args: RProjectAnalysisRequest): (RParseRequest | FlowrFile<string>)[];
22
+ }