@eagleoutice/flowr 2.7.5 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/README.md +68 -65
  2. package/cli/wiki.js +1 -1
  3. package/control-flow/extract-cfg.js +3 -3
  4. package/control-flow/useless-loop.d.ts +1 -1
  5. package/control-flow/useless-loop.js +2 -2
  6. package/dataflow/cluster.js +3 -3
  7. package/dataflow/environments/built-in-config.d.ts +8 -4
  8. package/dataflow/environments/built-in.d.ts +27 -14
  9. package/dataflow/environments/built-in.js +27 -12
  10. package/dataflow/environments/default-builtin-config.d.ts +614 -3
  11. package/dataflow/environments/default-builtin-config.js +50 -15
  12. package/dataflow/environments/environment.js +3 -2
  13. package/dataflow/environments/identifier.d.ts +5 -1
  14. package/dataflow/environments/reference-to-maybe.d.ts +2 -2
  15. package/dataflow/environments/reference-to-maybe.js +23 -14
  16. package/dataflow/environments/resolve-by-name.d.ts +6 -2
  17. package/dataflow/environments/resolve-by-name.js +5 -1
  18. package/dataflow/environments/scoping.js +1 -3
  19. package/dataflow/eval/resolve/alias-tracking.js +5 -1
  20. package/dataflow/extractor.js +3 -3
  21. package/dataflow/fn/exceptions-of-function.d.ts +13 -0
  22. package/dataflow/fn/exceptions-of-function.js +47 -0
  23. package/dataflow/fn/higher-order-function.d.ts +1 -1
  24. package/dataflow/fn/higher-order-function.js +3 -3
  25. package/dataflow/fn/recursive-function.d.ts +6 -0
  26. package/dataflow/fn/recursive-function.js +32 -0
  27. package/dataflow/graph/call-graph.d.ts +10 -0
  28. package/dataflow/graph/call-graph.js +209 -0
  29. package/dataflow/graph/dataflowgraph-builder.d.ts +7 -2
  30. package/dataflow/graph/dataflowgraph-builder.js +14 -9
  31. package/dataflow/graph/diff-dataflow-graph.js +96 -2
  32. package/dataflow/graph/graph.d.ts +10 -7
  33. package/dataflow/graph/graph.js +7 -8
  34. package/dataflow/graph/vertex.d.ts +6 -3
  35. package/dataflow/hooks.d.ts +30 -0
  36. package/dataflow/hooks.js +38 -0
  37. package/dataflow/info.d.ts +28 -5
  38. package/dataflow/info.js +66 -31
  39. package/dataflow/internal/linker.d.ts +13 -3
  40. package/dataflow/internal/linker.js +155 -53
  41. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +4 -0
  42. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +7 -0
  43. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  44. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +19 -3
  45. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +14 -0
  46. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +30 -0
  47. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
  48. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +24 -17
  49. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
  50. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +5 -1
  51. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +59 -21
  52. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
  53. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +34 -0
  54. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +92 -0
  55. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -0
  56. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.d.ts +21 -0
  57. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +129 -0
  58. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +16 -0
  59. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +127 -0
  60. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -3
  61. package/dataflow/internal/process/functions/call/common.d.ts +13 -1
  62. package/dataflow/internal/process/functions/call/common.js +33 -2
  63. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -1
  64. package/dataflow/internal/process/functions/call/known-call-handling.js +29 -3
  65. package/dataflow/internal/process/functions/call/named-call-handling.js +2 -1
  66. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
  67. package/dataflow/internal/process/functions/process-argument.js +7 -6
  68. package/dataflow/internal/process/functions/process-parameter.js +2 -1
  69. package/dataflow/internal/process/process-named-call.d.ts +2 -2
  70. package/dataflow/internal/process/process-symbol.js +3 -2
  71. package/dataflow/internal/process/process-value.d.ts +3 -2
  72. package/dataflow/internal/process/process-value.js +8 -6
  73. package/dataflow/origin/dfg-get-origin.js +2 -1
  74. package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
  75. package/documentation/doc-readme.d.ts +1 -1
  76. package/documentation/doc-readme.js +6 -6
  77. package/documentation/doc-util/doc-code.js +1 -1
  78. package/documentation/doc-util/doc-dfg.d.ts +1 -0
  79. package/documentation/doc-util/doc-dfg.js +7 -4
  80. package/documentation/doc-util/doc-query.d.ts +1 -0
  81. package/documentation/doc-util/doc-query.js +1 -1
  82. package/documentation/doc-util/doc-repl.d.ts +2 -1
  83. package/documentation/doc-util/doc-repl.js +11 -3
  84. package/documentation/wiki-analyzer.js +2 -0
  85. package/documentation/wiki-dataflow-graph.js +59 -16
  86. package/documentation/wiki-interface.js +33 -5
  87. package/documentation/wiki-mk/doc-context.d.ts +2 -1
  88. package/documentation/wiki-mk/doc-context.js +2 -2
  89. package/documentation/wiki-mk/doc-maker.js +4 -3
  90. package/documentation/wiki-normalized-ast.js +6 -0
  91. package/documentation/wiki-query.js +109 -1
  92. package/linter/linter-rules.d.ts +1 -1
  93. package/linter/rules/seeded-randomness.js +17 -12
  94. package/linter/rules/useless-loop.d.ts +1 -1
  95. package/package.json +9 -11
  96. package/project/cache/flowr-analyzer-cache.d.ts +11 -0
  97. package/project/cache/flowr-analyzer-cache.js +19 -0
  98. package/project/context/flowr-analyzer-dependencies-context.d.ts +6 -1
  99. package/project/context/flowr-analyzer-dependencies-context.js +6 -0
  100. package/project/context/flowr-analyzer-files-context.d.ts +5 -2
  101. package/project/context/flowr-analyzer-files-context.js +24 -17
  102. package/project/context/flowr-file.d.ts +9 -4
  103. package/project/context/flowr-file.js +20 -6
  104. package/project/flowr-analyzer.d.ts +11 -0
  105. package/project/flowr-analyzer.js +6 -0
  106. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +11 -3
  107. package/project/plugins/file-plugins/files/flowr-description-file.js +38 -28
  108. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +1 -1
  109. package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
  110. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
  111. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -1
  112. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  113. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +4 -1
  114. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -0
  115. package/project/plugins/file-plugins/{flowr-analyzer-namespace-file-plugin.d.ts → flowr-analyzer-namespace-files-plugin.d.ts} +1 -1
  116. package/project/plugins/file-plugins/{flowr-analyzer-namespace-file-plugin.js → flowr-analyzer-namespace-files-plugin.js} +4 -4
  117. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +26 -0
  118. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +39 -0
  119. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +26 -0
  120. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +39 -0
  121. package/project/plugins/flowr-analyzer-plugin-defaults.js +6 -2
  122. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +3 -13
  123. package/project/plugins/package-version-plugins/package.d.ts +1 -1
  124. package/project/plugins/package-version-plugins/package.js +3 -3
  125. package/project/plugins/plugin-registry.d.ts +4 -2
  126. package/project/plugins/plugin-registry.js +6 -2
  127. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +11 -0
  128. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +5 -2
  129. package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -12
  130. package/queries/catalog/call-graph-query/call-graph-query-executor.d.ts +6 -0
  131. package/queries/catalog/call-graph-query/call-graph-query-executor.js +21 -0
  132. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +21 -0
  133. package/queries/catalog/call-graph-query/call-graph-query-format.js +32 -0
  134. package/queries/catalog/dataflow-query/dataflow-query-executor.js +4 -3
  135. package/queries/catalog/dependencies-query/dependencies-query-executor.js +29 -3
  136. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -0
  137. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +8 -1
  138. package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -0
  139. package/queries/catalog/does-call-query/does-call-query-executor.d.ts +6 -0
  140. package/queries/catalog/does-call-query/does-call-query-executor.js +100 -0
  141. package/queries/catalog/does-call-query/does-call-query-format.d.ts +51 -0
  142. package/queries/catalog/does-call-query/does-call-query-format.js +102 -0
  143. package/queries/catalog/files-query/files-query-executor.js +4 -4
  144. package/queries/catalog/files-query/files-query-format.d.ts +2 -1
  145. package/queries/catalog/files-query/files-query-format.js +18 -2
  146. package/queries/catalog/id-map-query/id-map-query-executor.js +4 -3
  147. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +18 -0
  148. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +56 -0
  149. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +34 -0
  150. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +54 -0
  151. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -28
  152. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -0
  153. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +12 -0
  154. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +6 -0
  155. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +23 -0
  156. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +28 -0
  157. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +44 -0
  158. package/queries/catalog/linter-query/linter-query-format.js +4 -1
  159. package/queries/catalog/location-map-query/location-map-query-executor.js +1 -1
  160. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +4 -3
  161. package/queries/catalog/project-query/project-query-executor.js +9 -3
  162. package/queries/catalog/project-query/project-query-format.d.ts +8 -3
  163. package/queries/catalog/project-query/project-query-format.js +35 -9
  164. package/queries/query.d.ts +34 -2
  165. package/queries/query.js +9 -0
  166. package/r-bridge/data/data.d.ts +10 -5
  167. package/r-bridge/data/data.js +11 -5
  168. package/r-bridge/lang-4.x/ast/model/model.d.ts +7 -7
  169. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -2
  170. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -2
  171. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -2
  172. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +5 -2
  173. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +8 -0
  174. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
  175. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -2
  176. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +3 -3
  177. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -2
  178. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -2
  179. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -2
  180. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
  181. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -2
  182. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -2
  183. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -2
  184. package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-comment.js +0 -1
  185. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +0 -2
  186. package/r-bridge/roxygen2/roxygen-ast.d.ts +218 -0
  187. package/r-bridge/roxygen2/roxygen-ast.js +82 -0
  188. package/r-bridge/roxygen2/roxygen-parse.d.ts +24 -0
  189. package/r-bridge/roxygen2/roxygen-parse.js +214 -0
  190. package/reconstruct/auto-select/magic-comments.js +4 -4
  191. package/slicing/static/slice-call.js +3 -4
  192. package/slicing/static/static-slicer.js +2 -2
  193. package/statistics/features/supported/defined-functions/defined-functions.js +1 -1
  194. package/util/collections/defaultmap.d.ts +3 -3
  195. package/util/mermaid/dfg.js +5 -5
  196. package/util/objects.js +1 -1
  197. package/util/r-author.d.ts +5 -0
  198. package/util/r-author.js +110 -0
  199. package/util/r-license.d.ts +32 -0
  200. package/util/r-license.js +217 -0
  201. package/util/r-version.d.ts +19 -0
  202. package/util/r-version.js +106 -0
  203. package/util/range.d.ts +6 -0
  204. package/util/range.js +7 -0
  205. package/util/simple-df/dfg-ascii.js +2 -2
  206. package/util/text/args.d.ts +9 -0
  207. package/util/text/args.js +65 -0
  208. package/util/version.js +1 -1
@@ -15,6 +15,7 @@ import type { RAnalysisRequest } from './context/flowr-analyzer-files-context';
15
15
  import type { RParseRequestFromFile } from '../r-bridge/retriever';
16
16
  import { fileProtocol } from '../r-bridge/retriever';
17
17
  import type { FlowrFileProvider } from './context/flowr-file';
18
+ import type { CallGraph } from '../dataflow/graph/call-graph';
18
19
  /**
19
20
  * Extends the {@link ReadonlyFlowrAnalysisProvider} with methods that allow modifying the analyzer state.
20
21
  */
@@ -102,6 +103,14 @@ export interface ReadonlyFlowrAnalysisProvider<Parser extends KnownParser = Know
102
103
  * Peek at the control flow graph (CFG) for the request, if it was already computed.
103
104
  */
104
105
  peekControlflow(simplifications?: readonly CfgSimplificationPassName[], kind?: CfgKind): ControlFlowInformation | undefined;
106
+ /**
107
+ * Calculate the call graph for the request.
108
+ */
109
+ callGraph(force?: boolean): Promise<CallGraph>;
110
+ /**
111
+ * Peek at the call graph for the request, if it was already computed.
112
+ */
113
+ peekCallGraph(): CallGraph | undefined;
105
114
  /**
106
115
  * Access the query API for the request.
107
116
  * @param query - The list of queries.
@@ -167,6 +176,8 @@ export declare class FlowrAnalyzer<Parser extends KnownParser = KnownParser> imp
167
176
  runFull(force?: boolean): Promise<void>;
168
177
  controlflow(simplifications?: readonly CfgSimplificationPassName[], kind?: CfgKind, force?: boolean): Promise<ControlFlowInformation>;
169
178
  peekControlflow(simplifications?: readonly CfgSimplificationPassName[], kind?: CfgKind): ControlFlowInformation | undefined;
179
+ callGraph(force?: boolean): Promise<CallGraph>;
180
+ peekCallGraph(): CallGraph | undefined;
170
181
  query<Types extends SupportedQueryTypes = SupportedQueryTypes>(query: Queries<Types>): Promise<QueryResults<Types>>;
171
182
  runSearch<Search extends FlowrSearchLike>(search: Search): Promise<GetSearchElements<SearchOutput<Search>>>;
172
183
  /**
@@ -115,6 +115,12 @@ class FlowrAnalyzer {
115
115
  peekControlflow(simplifications, kind) {
116
116
  return this.cache.peekControlflow(kind ?? cfg_kind_1.CfgKind.NoDataflow, simplifications);
117
117
  }
118
+ async callGraph(force) {
119
+ return this.cache.callGraph(force);
120
+ }
121
+ peekCallGraph() {
122
+ return this.cache.peekCallGraph();
123
+ }
118
124
  async query(query) {
119
125
  return (0, query_1.executeQueries)({ analyzer: this }, query);
120
126
  }
@@ -1,7 +1,8 @@
1
1
  import { type FlowrFileProvider, type FileRole, FlowrFile } from '../../../context/flowr-file';
2
- import type { Info } from 'spdx-expression-parse';
3
2
  import type { RAuthorInfo } from '../../../../util/r-author';
4
3
  import type { DeepReadonly } from 'ts-essentials';
4
+ import type { RLicenseElementInfo } from '../../../../util/r-license';
5
+ import { Package, type PackageType } from '../../package-version-plugins/package';
5
6
  export type DCF = Map<string, string[]>;
6
7
  /**
7
8
  * This decorates a text file and provides access to its content as a DCF (Debian Control File)-like structure.
@@ -25,15 +26,22 @@ export declare class FlowrDescriptionFile extends FlowrFile<DeepReadonly<DCF>> {
25
26
  /**
26
27
  * Returns the parsed license information from the 'License' field in the DESCRIPTION file.
27
28
  */
28
- license(): Info[] | undefined;
29
+ license(): RLicenseElementInfo[] | undefined;
29
30
  /**
30
31
  * Returns the parsed authors from the `Authors@R` field in the DESCRIPTION file.
31
32
  */
32
33
  authors(): RAuthorInfo[] | undefined;
34
+ suggests(): Package[] | undefined;
33
35
  }
34
36
  /**
35
37
  * Parses the 'License' field from an R DESCRIPTION file into SPDX license expressions.
36
38
  * @param licenseField - The 'License' field from the DESCRIPTION file as an array of strings.
37
39
  * @returns An array of SPDX license information objects if parsing was successful.
38
40
  */
39
- export declare function parseRLicenseField(...licenseField: string[]): Info[];
41
+ export declare function parseRLicenseField(...licenseField: string[]): RLicenseElementInfo[];
42
+ /**
43
+ * Parses package strings with optional version constraints into Package objects.
44
+ * @param packageStrings - The package strings to parse
45
+ * @param type - The type of the packages (e.g., 'r' or 'package')
46
+ */
47
+ export declare function parsePackagesWithVersions(packageStrings: readonly string[], type?: PackageType): Package[];
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.FlowrDescriptionFile = void 0;
7
4
  exports.parseRLicenseField = parseRLicenseField;
5
+ exports.parsePackagesWithVersions = parsePackagesWithVersions;
8
6
  const flowr_file_1 = require("../../../context/flowr-file");
9
- const spdx_expression_parse_1 = __importDefault(require("spdx-expression-parse"));
10
- const log_1 = require("../../../../util/log");
11
7
  const r_author_1 = require("../../../../util/r-author");
12
8
  const args_1 = require("../../../../util/text/args");
9
+ const r_license_1 = require("../../../../util/r-license");
10
+ const package_1 = require("../../package-version-plugins/package");
13
11
  /**
14
12
  * This decorates a text file and provides access to its content as a DCF (Debian Control File)-like structure.
15
13
  */
@@ -20,7 +18,7 @@ class FlowrDescriptionFile extends flowr_file_1.FlowrFile {
20
18
  * and handle role assignments.
21
19
  */
22
20
  constructor(file) {
23
- super(file.path(), file.role);
21
+ super(file.path(), file.roles);
24
22
  this.wrapped = file;
25
23
  }
26
24
  /**
@@ -53,37 +51,27 @@ class FlowrDescriptionFile extends flowr_file_1.FlowrFile {
53
51
  * Returns the parsed authors from the `Authors@R` field in the DESCRIPTION file.
54
52
  */
55
53
  authors() {
56
- const authors = this.content().get('Authors@R');
57
- return authors ? authors.flatMap(r_author_1.parseRAuthorString) : undefined;
54
+ let authors = this.content().get('Authors@R');
55
+ if (authors) {
56
+ return authors.flatMap(r_author_1.parseRAuthorString);
57
+ }
58
+ authors = this.content().get('Author');
59
+ const parsedAuthors = authors?.flatMap(a => (0, r_author_1.parseTextualAuthorString)(a, [r_author_1.AuthorRole.Author])) ?? [];
60
+ return parsedAuthors.concat(this.content().get('Maintainer')?.flatMap(m => (0, r_author_1.parseTextualAuthorString)(m, [r_author_1.AuthorRole.Creator])) ?? []);
61
+ }
62
+ suggests() {
63
+ const suggests = this.content().get('Suggests');
64
+ return suggests ? parsePackagesWithVersions(suggests, 'package') : undefined;
58
65
  }
59
66
  }
60
67
  exports.FlowrDescriptionFile = FlowrDescriptionFile;
61
- function cleanUpDescLicense(licenseStr) {
62
- // we have to replace '\s[|+&]\s' with ' OR ' or ' AND ' respectively
63
- return licenseStr
64
- .replaceAll(/\s*\|\s*/g, ' OR ')
65
- .replaceAll(/\s*[&+,]\s*/g, ' AND ')
66
- // we have to replace any variant of 'file LICENSE' with just LicenseRef-FILE
67
- .replaceAll(/file(\s+|-)LICENSE/gi, 'LicenseRef-FILE');
68
- }
69
68
  /**
70
69
  * Parses the 'License' field from an R DESCRIPTION file into SPDX license expressions.
71
70
  * @param licenseField - The 'License' field from the DESCRIPTION file as an array of strings.
72
71
  * @returns An array of SPDX license information objects if parsing was successful.
73
72
  */
74
73
  function parseRLicenseField(...licenseField) {
75
- const licenses = [];
76
- for (const licenseEntry of licenseField) {
77
- const cleanedLicense = cleanUpDescLicense(licenseEntry);
78
- try {
79
- const parsed = (0, spdx_expression_parse_1.default)(cleanedLicense);
80
- licenses.push(parsed);
81
- }
82
- catch (e) {
83
- log_1.log.warn(`Failed to parse license expression '${cleanedLicense}': ${e.message}`);
84
- }
85
- }
86
- return licenses;
74
+ return licenseField.map(r_license_1.parseRLicense);
87
75
  }
88
76
  function emplaceDCF(key, val, result) {
89
77
  if (!key) {
@@ -129,4 +117,26 @@ function cleanValues(values) {
129
117
  .map(s => s.trim())
130
118
  .filter(s => s.length > 0);
131
119
  }
120
+ const VersionRegex = /^([a-zA-Z0-9.]+)(?:\s*\(([><=~!]+)\s*([^)]+)\))?$/;
121
+ /**
122
+ * Parses package strings with optional version constraints into Package objects.
123
+ * @param packageStrings - The package strings to parse
124
+ * @param type - The type of the packages (e.g., 'r' or 'package')
125
+ */
126
+ function parsePackagesWithVersions(packageStrings, type) {
127
+ const packages = [];
128
+ for (const entry of packageStrings) {
129
+ const match = VersionRegex.exec(entry);
130
+ if (match) {
131
+ const [, name, operator, version] = match;
132
+ const range = package_1.Package.parsePackageVersionRange(operator, version);
133
+ packages.push(new package_1.Package({
134
+ name: name,
135
+ type: type,
136
+ versionConstraints: range ? [range] : undefined
137
+ }));
138
+ }
139
+ }
140
+ return packages;
141
+ }
132
142
  //# sourceMappingURL=flowr-description-file.js.map
@@ -13,7 +13,7 @@ class FlowrJupyterFile extends flowr_file_1.FlowrFile {
13
13
  * @param file - the file to load as R Markdown
14
14
  */
15
15
  constructor(file) {
16
- super(file.path(), flowr_file_1.FileRole.Source);
16
+ super(file.path(), file.roles ? [...file.roles, flowr_file_1.FileRole.Source] : [flowr_file_1.FileRole.Source]);
17
17
  this.wrapped = file;
18
18
  }
19
19
  /**
@@ -12,7 +12,7 @@ class FlowrNamespaceFile extends flowr_file_1.FlowrFile {
12
12
  * and handle role assignments.
13
13
  */
14
14
  constructor(file) {
15
- super(file.path(), file.role);
15
+ super(file.path(), file.roles);
16
16
  this.wrapped = file;
17
17
  }
18
18
  /**
@@ -14,7 +14,7 @@ class FlowrNewsFile extends flowr_file_1.FlowrFile {
14
14
  * and handle role assignments.
15
15
  */
16
16
  constructor(file) {
17
- super(file.path(), file.role);
17
+ super(file.path(), file.roles);
18
18
  this.wrapped = file;
19
19
  }
20
20
  /**
@@ -24,7 +24,7 @@ class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
24
24
  * @param file - the file to load as R Markdown
25
25
  */
26
26
  constructor(file) {
27
- super(file.path(), flowr_file_1.FileRole.Source);
27
+ super(file.path(), file.roles ? [...file.roles, flowr_file_1.FileRole.Source] : [flowr_file_1.FileRole.Source]);
28
28
  this.wrapped = file;
29
29
  }
30
30
  get rmd() {
@@ -8,7 +8,7 @@ const flowr_description_file_1 = require("./files/flowr-description-file");
8
8
  const flowr_file_1 = require("../../context/flowr-file");
9
9
  const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
10
10
  exports.descriptionFileLog = log_1.log.getSubLogger({ name: 'flowr-analyzer-loading-order-description-file-plugin' });
11
- const DescriptionFilePattern = /^(DESCRIPTION|DESCRIPTION\.txt)$/i;
11
+ const DescriptionFilePattern = /^DESCRIPTION(\.(txt|in))?$/i;
12
12
  /**
13
13
  * This plugin provides support for R `DESCRIPTION` files.
14
14
  */
@@ -8,10 +8,13 @@ import type { FlowrFileProvider } from '../../context/flowr-file';
8
8
  *
9
9
  * It is up to the construction to ensure that no two file plugins {@link applies} to the same file, otherwise, the loading order
10
10
  * of these plugins will determine which plugin gets to process the file.
11
+ * On transforming a file, your plugin can indicate whether other plugins should still get to process the file,
12
+ * by returning a tuple of `[transformedFile, <boolean>]` where a boolean `true` indicates that other plugins should still get to process the file.
13
+ * One example of a plugin doing this is the {@link FlowrAnalyzerMetaVignetteFilesPlugin}.
11
14
  *
12
15
  * See {@link DefaultFlowrAnalyzerFilePlugin} for the no-op default implementation.
13
16
  */
14
- export declare abstract class FlowrAnalyzerFilePlugin extends FlowrAnalyzerPlugin<FlowrFileProvider, FlowrFileProvider> {
17
+ export declare abstract class FlowrAnalyzerFilePlugin extends FlowrAnalyzerPlugin<FlowrFileProvider, FlowrFileProvider | [file: FlowrFileProvider, cont: boolean]> {
15
18
  readonly type = PluginType.FileLoad;
16
19
  /**
17
20
  * Determine whether this plugin applies to the given file.
@@ -11,6 +11,9 @@ const semver_1 = require("semver");
11
11
  *
12
12
  * It is up to the construction to ensure that no two file plugins {@link applies} to the same file, otherwise, the loading order
13
13
  * of these plugins will determine which plugin gets to process the file.
14
+ * On transforming a file, your plugin can indicate whether other plugins should still get to process the file,
15
+ * by returning a tuple of `[transformedFile, <boolean>]` where a boolean `true` indicates that other plugins should still get to process the file.
16
+ * One example of a plugin doing this is the {@link FlowrAnalyzerMetaVignetteFilesPlugin}.
14
17
  *
15
18
  * See {@link DefaultFlowrAnalyzerFilePlugin} for the no-op default implementation.
16
19
  */
@@ -7,7 +7,7 @@ import { FlowrNamespaceFile } from './files/flowr-namespace-file';
7
7
  /**
8
8
  * This plugin provides support for R `NAMESPACE` files.
9
9
  */
10
- export declare class FlowrAnalyzerNamespaceFilePlugin extends FlowrAnalyzerFilePlugin {
10
+ export declare class FlowrAnalyzerNamespaceFilesPlugin extends FlowrAnalyzerFilePlugin {
11
11
  readonly name = "flowr-analyzer-namespace-file-plugin";
12
12
  readonly description = "This plugin provides support for NAMESPACE files and extracts their content into the NAMESPACEFormat.";
13
13
  readonly version: SemVer;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowrAnalyzerNamespaceFilePlugin = void 0;
3
+ exports.FlowrAnalyzerNamespaceFilesPlugin = void 0;
4
4
  const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
5
5
  const semver_1 = require("semver");
6
6
  const flowr_file_1 = require("../../context/flowr-file");
@@ -10,7 +10,7 @@ const NamespaceFilePattern = /^NAMESPACE(\.txt)?$/i;
10
10
  /**
11
11
  * This plugin provides support for R `NAMESPACE` files.
12
12
  */
13
- class FlowrAnalyzerNamespaceFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
13
+ class FlowrAnalyzerNamespaceFilesPlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
14
14
  name = 'flowr-analyzer-namespace-file-plugin';
15
15
  description = 'This plugin provides support for NAMESPACE files and extracts their content into the NAMESPACEFormat.';
16
16
  version = new semver_1.SemVer('0.1.0');
@@ -30,5 +30,5 @@ class FlowrAnalyzerNamespaceFilePlugin extends flowr_analyzer_file_plugin_1.Flow
30
30
  return flowr_namespace_file_1.FlowrNamespaceFile.from(file, flowr_file_1.FileRole.Namespace);
31
31
  }
32
32
  }
33
- exports.FlowrAnalyzerNamespaceFilePlugin = FlowrAnalyzerNamespaceFilePlugin;
34
- //# sourceMappingURL=flowr-analyzer-namespace-file-plugin.js.map
33
+ exports.FlowrAnalyzerNamespaceFilesPlugin = FlowrAnalyzerNamespaceFilesPlugin;
34
+ //# sourceMappingURL=flowr-analyzer-namespace-files-plugin.js.map
@@ -0,0 +1,26 @@
1
+ import { FlowrAnalyzerFilePlugin } from './flowr-analyzer-file-plugin';
2
+ import { SemVer } from 'semver';
3
+ import type { PathLike } from 'fs';
4
+ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
5
+ import type { FlowrFileProvider } from '../../context/flowr-file';
6
+ /**
7
+ * This plugin provides supports for the identification of test files.
8
+ * If you use multiple plugins, this should be included *before* other plugins.
9
+ */
10
+ export declare class FlowrAnalyzerMetaTestFilesPlugin extends FlowrAnalyzerFilePlugin {
11
+ readonly name = "flowr-analyzer-test-files-plugin";
12
+ readonly description = "This plugin provides support for loading test files.";
13
+ readonly version: SemVer;
14
+ private readonly pathPattern;
15
+ /**
16
+ * Creates a new instance of the TEST file plugin.
17
+ * @param pathPattern - The pathPattern to identify TEST files, see {@link TestPathPattern} for the default pathPattern.
18
+ */
19
+ constructor(pathPattern?: RegExp);
20
+ applies(file: PathLike): boolean;
21
+ /**
22
+ * Processes the given file, assigning it the {@link FileRole.Test} role.
23
+ * Given that the file may still need to be processed by other plugins, this method returns the `true` flag for that purpose.
24
+ */
25
+ process(_ctx: FlowrAnalyzerContext, file: FlowrFileProvider): [FlowrFileProvider, true];
26
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerMetaTestFilesPlugin = void 0;
4
+ const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
5
+ const semver_1 = require("semver");
6
+ const flowr_file_1 = require("../../context/flowr-file");
7
+ const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
8
+ const TestPathPattern = /tests?/i;
9
+ /**
10
+ * This plugin provides supports for the identification of test files.
11
+ * If you use multiple plugins, this should be included *before* other plugins.
12
+ */
13
+ class FlowrAnalyzerMetaTestFilesPlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
14
+ name = 'flowr-analyzer-test-files-plugin';
15
+ description = 'This plugin provides support for loading test files.';
16
+ version = new semver_1.SemVer('0.1.0');
17
+ pathPattern;
18
+ /**
19
+ * Creates a new instance of the TEST file plugin.
20
+ * @param pathPattern - The pathPattern to identify TEST files, see {@link TestPathPattern} for the default pathPattern.
21
+ */
22
+ constructor(pathPattern = TestPathPattern) {
23
+ super();
24
+ this.pathPattern = pathPattern;
25
+ }
26
+ applies(file) {
27
+ return this.pathPattern.test((0, built_in_source_1.platformDirname)(file.toString()));
28
+ }
29
+ /**
30
+ * Processes the given file, assigning it the {@link FileRole.Test} role.
31
+ * Given that the file may still need to be processed by other plugins, this method returns the `true` flag for that purpose.
32
+ */
33
+ process(_ctx, file) {
34
+ file.assignRole(flowr_file_1.FileRole.Test);
35
+ return [file, true];
36
+ }
37
+ }
38
+ exports.FlowrAnalyzerMetaTestFilesPlugin = FlowrAnalyzerMetaTestFilesPlugin;
39
+ //# sourceMappingURL=flowr-analyzer-test-file-plugin.js.map
@@ -0,0 +1,26 @@
1
+ import { FlowrAnalyzerFilePlugin } from './flowr-analyzer-file-plugin';
2
+ import { SemVer } from 'semver';
3
+ import type { PathLike } from 'fs';
4
+ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
5
+ import type { FlowrFileProvider } from '../../context/flowr-file';
6
+ /**
7
+ * This plugin provides supports for the loading of Vignette files.
8
+ * If you use multiple plugins, this should be included *before* other plugins.
9
+ */
10
+ export declare class FlowrAnalyzerMetaVignetteFilesPlugin extends FlowrAnalyzerFilePlugin {
11
+ readonly name = "flowr-analyzer-vignette-files-plugin";
12
+ readonly description = "This plugin provides support for loading vignette files.";
13
+ readonly version: SemVer;
14
+ private readonly pathPattern;
15
+ /**
16
+ * Creates a new instance of the VIGNETTE file plugin.
17
+ * @param pathPattern - The pathPattern to identify VIGNETTE files, see {@link VignettePathPattern} for the default pathPattern.
18
+ */
19
+ constructor(pathPattern?: RegExp);
20
+ applies(file: PathLike): boolean;
21
+ /**
22
+ * Processes the given file, assigning it the {@link FileRole.Vignette} role.
23
+ * Given that the file may still need to be processed by other plugins, this method returns the `true` flag for that purpose.
24
+ */
25
+ process(_ctx: FlowrAnalyzerContext, file: FlowrFileProvider): [FlowrFileProvider, true];
26
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowrAnalyzerMetaVignetteFilesPlugin = void 0;
4
+ const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
5
+ const semver_1 = require("semver");
6
+ const flowr_file_1 = require("../../context/flowr-file");
7
+ const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
8
+ const VignettePathPattern = /vignettes?/i;
9
+ /**
10
+ * This plugin provides supports for the loading of Vignette files.
11
+ * If you use multiple plugins, this should be included *before* other plugins.
12
+ */
13
+ class FlowrAnalyzerMetaVignetteFilesPlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
14
+ name = 'flowr-analyzer-vignette-files-plugin';
15
+ description = 'This plugin provides support for loading vignette files.';
16
+ version = new semver_1.SemVer('0.1.0');
17
+ pathPattern;
18
+ /**
19
+ * Creates a new instance of the VIGNETTE file plugin.
20
+ * @param pathPattern - The pathPattern to identify VIGNETTE files, see {@link VignettePathPattern} for the default pathPattern.
21
+ */
22
+ constructor(pathPattern = VignettePathPattern) {
23
+ super();
24
+ this.pathPattern = pathPattern;
25
+ }
26
+ applies(file) {
27
+ return this.pathPattern.test((0, built_in_source_1.platformDirname)(file.toString()));
28
+ }
29
+ /**
30
+ * Processes the given file, assigning it the {@link FileRole.Vignette} role.
31
+ * Given that the file may still need to be processed by other plugins, this method returns the `true` flag for that purpose.
32
+ */
33
+ process(_ctx, file) {
34
+ file.assignRole(flowr_file_1.FileRole.Vignette);
35
+ return [file, true];
36
+ }
37
+ }
38
+ exports.FlowrAnalyzerMetaVignetteFilesPlugin = FlowrAnalyzerMetaVignetteFilesPlugin;
39
+ //# sourceMappingURL=flowr-analyzer-vignette-file-plugin.js.map
@@ -7,20 +7,24 @@ const flowr_analyzer_loading_order_description_file_plugin_1 = require("./loadin
7
7
  const flowr_analyzer_rmd_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-rmd-file-plugin");
8
8
  const flowr_analyzer_qmd_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-qmd-file-plugin");
9
9
  const flowr_analyzer_jupyter_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin");
10
- const flowr_analyzer_namespace_file_plugin_1 = require("./file-plugins/flowr-analyzer-namespace-file-plugin");
10
+ const flowr_analyzer_namespace_files_plugin_1 = require("./file-plugins/flowr-analyzer-namespace-files-plugin");
11
11
  const flowr_analyzer_news_file_plugin_1 = require("./file-plugins/flowr-analyzer-news-file-plugin");
12
+ const flowr_analyzer_vignette_file_plugin_1 = require("./file-plugins/flowr-analyzer-vignette-file-plugin");
13
+ const flowr_analyzer_test_file_plugin_1 = require("./file-plugins/flowr-analyzer-test-file-plugin");
12
14
  /**
13
15
  * Provides the default set of Flowr Analyzer plugins.
14
16
  */
15
17
  function FlowrAnalyzerPluginDefaults() {
16
18
  return [
19
+ new flowr_analyzer_vignette_file_plugin_1.FlowrAnalyzerMetaVignetteFilesPlugin(),
20
+ new flowr_analyzer_test_file_plugin_1.FlowrAnalyzerMetaTestFilesPlugin(),
17
21
  new flowr_analyzer_description_file_plugin_1.FlowrAnalyzerDescriptionFilePlugin(),
18
22
  new flowr_analyzer_package_versions_description_file_plugin_1.FlowrAnalyzerPackageVersionsDescriptionFilePlugin(),
19
23
  new flowr_analyzer_loading_order_description_file_plugin_1.FlowrAnalyzerLoadingOrderDescriptionFilePlugin(),
20
24
  new flowr_analyzer_rmd_file_plugin_1.FlowrAnalyzerRmdFilePlugin(),
21
25
  new flowr_analyzer_qmd_file_plugin_1.FlowrAnalyzerQmdFilePlugin(),
22
26
  new flowr_analyzer_jupyter_file_plugin_1.FlowrAnalyzerJupyterFilePlugin(),
23
- new flowr_analyzer_namespace_file_plugin_1.FlowrAnalyzerNamespaceFilePlugin(),
27
+ new flowr_analyzer_namespace_files_plugin_1.FlowrAnalyzerNamespaceFilesPlugin(),
24
28
  new flowr_analyzer_news_file_plugin_1.FlowrAnalyzerNewsFilePlugin()
25
29
  ];
26
30
  }
@@ -4,9 +4,8 @@ exports.FlowrAnalyzerPackageVersionsDescriptionFilePlugin = void 0;
4
4
  const flowr_analyzer_package_versions_plugin_1 = require("./flowr-analyzer-package-versions-plugin");
5
5
  const flowr_analyzer_description_file_plugin_1 = require("../file-plugins/flowr-analyzer-description-file-plugin");
6
6
  const semver_1 = require("semver");
7
- const package_1 = require("./package");
8
7
  const flowr_file_1 = require("../../context/flowr-file");
9
- const VersionRegex = /^([a-zA-Z0-9.]+)(?:\s*\(([><=~!]+)\s*([\d.]+)\))?$/;
8
+ const flowr_description_file_1 = require("../file-plugins/files/flowr-description-file");
10
9
  /**
11
10
  * This plugin extracts package versions from R `DESCRIPTION` files.
12
11
  * It looks at the `Depends` and `Imports` fields to find package names and their version constraints.
@@ -30,17 +29,8 @@ class FlowrAnalyzerPackageVersionsDescriptionFilePlugin extends flowr_analyzer_p
30
29
  this.retrieveVersionsFromField(ctx, deps, 'Imports', 'package');
31
30
  }
32
31
  retrieveVersionsFromField(ctx, file, field, type) {
33
- for (const entry of file.get(field) ?? []) {
34
- const match = VersionRegex.exec(entry);
35
- if (match) {
36
- const [, name, operator, version] = match;
37
- const range = package_1.Package.parsePackageVersionRange(operator, version);
38
- ctx.deps.addDependency(new package_1.Package({
39
- name: name,
40
- type: type,
41
- versionConstraints: range ? [range] : undefined
42
- }));
43
- }
32
+ for (const pkg of (0, flowr_description_file_1.parsePackagesWithVersions)(file.get(field) ?? [], type)) {
33
+ ctx.deps.addDependency(pkg);
44
34
  }
45
35
  }
46
36
  }
@@ -1,4 +1,4 @@
1
- import { Range } from 'semver';
1
+ import type { Range } from 'semver';
2
2
  import type { NamespaceInfo } from '../file-plugins/files/flowr-namespace-file';
3
3
  export type PackageType = 'package' | 'system' | 'r';
4
4
  export type PackageOptions = {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Package = void 0;
4
- const semver_1 = require("semver");
5
4
  const assert_1 = require("../../../util/assert");
5
+ const r_version_1 = require("../../../util/r-version");
6
6
  class Package {
7
7
  name;
8
8
  derivedVersion;
@@ -68,12 +68,12 @@ class Package {
68
68
  }
69
69
  deriveVersion() {
70
70
  return this.versionConstraints.length > 0
71
- ? new semver_1.Range(this.versionConstraints.map(c => c.raw).join(' '))
71
+ ? (0, r_version_1.parseRRange)(this.versionConstraints.map(c => c.raw).join(' '))
72
72
  : undefined;
73
73
  }
74
74
  static parsePackageVersionRange(constraint, version) {
75
75
  if (version) {
76
- return constraint ? new semver_1.Range(constraint + version) : new semver_1.Range(version);
76
+ return constraint ? (0, r_version_1.parseRRange)(constraint + version) : (0, r_version_1.parseRRange)(version);
77
77
  }
78
78
  else {
79
79
  return undefined;
@@ -5,12 +5,14 @@ import { FlowrAnalyzerLoadingOrderDescriptionFilePlugin } from './loading-order-
5
5
  import { FlowrAnalyzerRmdFilePlugin } from './file-plugins/notebooks/flowr-analyzer-rmd-file-plugin';
6
6
  import { FlowrAnalyzerQmdFilePlugin } from './file-plugins/notebooks/flowr-analyzer-qmd-file-plugin';
7
7
  import { FlowrAnalyzerJupyterFilePlugin } from './file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin';
8
- import { FlowrAnalyzerNamespaceFilePlugin } from './file-plugins/flowr-analyzer-namespace-file-plugin';
8
+ import { FlowrAnalyzerNamespaceFilesPlugin } from './file-plugins/flowr-analyzer-namespace-files-plugin';
9
9
  import { FlowrAnalyzerNewsFilePlugin } from './file-plugins/flowr-analyzer-news-file-plugin';
10
+ import { FlowrAnalyzerMetaVignetteFilesPlugin } from './file-plugins/flowr-analyzer-vignette-file-plugin';
11
+ import { FlowrAnalyzerMetaTestFilesPlugin } from './file-plugins/flowr-analyzer-test-file-plugin';
10
12
  /**
11
13
  * The built-in Flowr Analyzer plugins that are always available.
12
14
  */
13
- export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilePlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin]];
15
+ export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["files:vignette", typeof FlowrAnalyzerMetaVignetteFilesPlugin], ["files:test", typeof FlowrAnalyzerMetaTestFilesPlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilesPlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin]];
14
16
  export type BuiltInFlowrPluginName = typeof BuiltInPlugins[number][0];
15
17
  export type BuiltInFlowrPluginArgs<N extends BuiltInFlowrPluginName> = N extends typeof BuiltInPlugins[number][0] ? ConstructorParameters<Extract<typeof BuiltInPlugins[number], [N, PluginProducer]>[1]> : never;
16
18
  type PluginProducer = new (...args: never[]) => FlowrAnalyzerPlugin;
@@ -11,8 +11,10 @@ const flowr_analyzer_rmd_file_plugin_1 = require("./file-plugins/notebooks/flowr
11
11
  const flowr_analyzer_qmd_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-qmd-file-plugin");
12
12
  const assert_1 = require("../../util/assert");
13
13
  const flowr_analyzer_jupyter_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin");
14
- const flowr_analyzer_namespace_file_plugin_1 = require("./file-plugins/flowr-analyzer-namespace-file-plugin");
14
+ const flowr_analyzer_namespace_files_plugin_1 = require("./file-plugins/flowr-analyzer-namespace-files-plugin");
15
15
  const flowr_analyzer_news_file_plugin_1 = require("./file-plugins/flowr-analyzer-news-file-plugin");
16
+ const flowr_analyzer_vignette_file_plugin_1 = require("./file-plugins/flowr-analyzer-vignette-file-plugin");
17
+ const flowr_analyzer_test_file_plugin_1 = require("./file-plugins/flowr-analyzer-test-file-plugin");
16
18
  /**
17
19
  * The built-in Flowr Analyzer plugins that are always available.
18
20
  */
@@ -20,10 +22,12 @@ exports.BuiltInPlugins = [
20
22
  ['file:description', flowr_analyzer_description_file_plugin_1.FlowrAnalyzerDescriptionFilePlugin],
21
23
  ['versions:description', flowr_analyzer_package_versions_description_file_plugin_1.FlowrAnalyzerPackageVersionsDescriptionFilePlugin],
22
24
  ['loading-order:description', flowr_analyzer_loading_order_description_file_plugin_1.FlowrAnalyzerLoadingOrderDescriptionFilePlugin],
25
+ ['files:vignette', flowr_analyzer_vignette_file_plugin_1.FlowrAnalyzerMetaVignetteFilesPlugin],
26
+ ['files:test', flowr_analyzer_test_file_plugin_1.FlowrAnalyzerMetaTestFilesPlugin],
23
27
  ['file:rmd', flowr_analyzer_rmd_file_plugin_1.FlowrAnalyzerRmdFilePlugin],
24
28
  ['file:qmd', flowr_analyzer_qmd_file_plugin_1.FlowrAnalyzerQmdFilePlugin],
25
29
  ['file:ipynb', flowr_analyzer_jupyter_file_plugin_1.FlowrAnalyzerJupyterFilePlugin],
26
- ['file:namespace', flowr_analyzer_namespace_file_plugin_1.FlowrAnalyzerNamespaceFilePlugin],
30
+ ['file:namespace', flowr_analyzer_namespace_files_plugin_1.FlowrAnalyzerNamespaceFilesPlugin],
27
31
  ['file:news', flowr_analyzer_news_file_plugin_1.FlowrAnalyzerNewsFilePlugin]
28
32
  ];
29
33
  /**
@@ -13,3 +13,14 @@ export declare abstract class FlowrAnalyzerProjectDiscoveryPlugin extends FlowrA
13
13
  readonly type = PluginType.ProjectDiscovery;
14
14
  static defaultPlugin(): FlowrAnalyzerProjectDiscoveryPlugin;
15
15
  }
16
+ /** Configuration options for the {@link DefaultFlowrAnalyzerProjectDiscoveryPlugin}. */
17
+ export interface ProjectDiscoveryConfig {
18
+ /** the regex to trigger R source file discovery on (and hence analyze them as R files) */
19
+ triggerOnExtensions?: RegExp;
20
+ /** the regex to ignore certain paths entirely */
21
+ ignorePathsRegex?: RegExp;
22
+ /** the regex to exclude certain paths from being requested as R files (they are still collected as text files) */
23
+ excludePathsRegex?: RegExp;
24
+ /** if set, only paths matching this regex are traversed */
25
+ onlyTraversePaths?: RegExp;
26
+ }
@@ -34,17 +34,20 @@ class DefaultFlowrAnalyzerProjectDiscoveryPlugin extends FlowrAnalyzerProjectDis
34
34
  supportedExtensions;
35
35
  ignorePathsRegex;
36
36
  excludePathsRegex = excludeRequestsForPaths;
37
+ onlyTraversePaths;
37
38
  /**
38
39
  * Creates a new instance of the default project discovery plugin.
39
40
  * @param triggerOnExtensions - the regex to trigger R source file discovery on (and hence analyze them as R files)
40
41
  * @param ignorePathsRegex - the regex to ignore certain paths entirely
41
42
  * @param excludePathsRegex - the regex to exclude certain paths from being requested as R files (they are still collected as text files)
43
+ * @param onlyTraversePaths - if set, only paths matching this regex are traversed
42
44
  */
43
- constructor(triggerOnExtensions = discoverRSourcesRegex, ignorePathsRegex = ignorePathsWith, excludePathsRegex = excludeRequestsForPaths) {
45
+ constructor({ triggerOnExtensions = discoverRSourcesRegex, ignorePathsRegex = ignorePathsWith, excludePathsRegex = excludeRequestsForPaths, onlyTraversePaths } = {}) {
44
46
  super();
45
47
  this.supportedExtensions = triggerOnExtensions;
46
48
  this.ignorePathsRegex = ignorePathsRegex;
47
49
  this.excludePathsRegex = excludePathsRegex;
50
+ this.onlyTraversePaths = onlyTraversePaths;
48
51
  }
49
52
  process(_context, args) {
50
53
  const requests = [];
@@ -53,7 +56,7 @@ class DefaultFlowrAnalyzerProjectDiscoveryPlugin extends FlowrAnalyzerProjectDis
53
56
  if (this.ignorePathsRegex.test(file)) {
54
57
  continue;
55
58
  }
56
- if (this.supportedExtensions.test(file) && !this.excludePathsRegex.test((0, built_in_source_1.platformDirname)(file))) {
59
+ if (this.supportedExtensions.test(file) && (!this.onlyTraversePaths || this.onlyTraversePaths.test(file)) && !this.excludePathsRegex.test((0, built_in_source_1.platformDirname)(file))) {
57
60
  requests.push({ content: file, request: 'file' });
58
61
  }
59
62
  else {