@eagleoutice/flowr 2.13.1 → 2.13.3

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 (158) hide show
  1. package/README.md +46 -44
  2. package/abstract-interpretation/data-frame/mappers/access-mapper.js +1 -0
  3. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +1 -1
  4. package/abstract-interpretation/data-frame/mappers/function-mapper.js +3 -0
  5. package/abstract-interpretation/domains/state-domain-like.d.ts +1 -1
  6. package/cli/flowr.js +21 -5
  7. package/cli/repl/commands/repl-commands.js +11 -9
  8. package/cli/repl/commands/repl-query.js +1 -1
  9. package/cli/repl/commands/repl-signature.js +8 -1
  10. package/cli/repl/core.js +13 -10
  11. package/cli/repl/print-version.js +1 -1
  12. package/cli/repl/server/connection.d.ts +1 -1
  13. package/cli/repl/server/net.js +15 -0
  14. package/config.d.ts +37 -0
  15. package/config.js +63 -3
  16. package/control-flow/control-flow-graph.js +2 -1
  17. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  18. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +1 -1
  19. package/data/sigdb/sigdb.remote.json +1 -1
  20. package/dataflow/environments/append.d.ts +1 -1
  21. package/dataflow/environments/clone.d.ts +1 -1
  22. package/dataflow/environments/environment.d.ts +28 -4
  23. package/dataflow/environments/environment.js +66 -11
  24. package/dataflow/environments/identifier.d.ts +9 -8
  25. package/dataflow/environments/identifier.js +21 -13
  26. package/dataflow/environments/overwrite.d.ts +1 -1
  27. package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
  28. package/dataflow/eval/resolve/resolve-working-directory.d.ts +29 -0
  29. package/dataflow/eval/resolve/resolve-working-directory.js +168 -0
  30. package/dataflow/extractor.js +2 -1
  31. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  32. package/dataflow/graph/df-helper.d.ts +3 -2
  33. package/dataflow/graph/df-helper.js +11 -15
  34. package/dataflow/graph/diff-dataflow-graph.js +1 -1
  35. package/dataflow/graph/graph-helper.js +2 -6
  36. package/dataflow/graph/graph.d.ts +24 -0
  37. package/dataflow/graph/graph.js +25 -1
  38. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
  39. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +1 -1
  40. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  41. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +51 -0
  42. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  43. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -1
  44. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
  45. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -2
  46. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +15 -9
  47. package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
  48. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
  49. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +1 -1
  50. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +1 -1
  51. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -1
  52. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +9 -2
  53. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  54. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +2 -2
  55. package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +1 -1
  56. package/documentation/doc-readme.js +14 -12
  57. package/documentation/doc-util/doc-normalized-ast.d.ts +1 -1
  58. package/documentation/wiki-dataflow-graph.js +4 -24
  59. package/documentation/wiki-linter.js +1 -0
  60. package/documentation/wiki-mk/doc-context.d.ts +10 -0
  61. package/documentation/wiki-mk/doc-context.js +3 -0
  62. package/documentation/wiki-query.js +47 -0
  63. package/documentation/wiki-signature-database.js +18 -7
  64. package/linter/linter-rules.d.ts +24 -2
  65. package/linter/linter-rules.js +3 -1
  66. package/linter/rules/absolute-path.d.ts +4 -4
  67. package/linter/rules/absolute-path.js +7 -5
  68. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  69. package/linter/rules/file-path-validity.d.ts +1 -1
  70. package/linter/rules/file-path-validity.js +48 -8
  71. package/linter/rules/function-finder-util.d.ts +2 -1
  72. package/linter/rules/syntactically-valid.d.ts +58 -0
  73. package/linter/rules/syntactically-valid.js +203 -0
  74. package/linter/rules/undefined-symbol-util.js +3 -1
  75. package/linter/rules/undefined-symbol.js +6 -6
  76. package/package.json +25 -12
  77. package/project/context/classify-project-kind.d.ts +40 -0
  78. package/project/context/classify-project-kind.js +76 -0
  79. package/project/context/flowr-analyzer-context.d.ts +4 -4
  80. package/project/context/flowr-analyzer-context.js +3 -3
  81. package/project/context/flowr-analyzer-dependencies-context.d.ts +34 -9
  82. package/project/context/flowr-analyzer-dependencies-context.js +30 -3
  83. package/project/context/flowr-analyzer-files-context.d.ts +10 -8
  84. package/project/context/flowr-analyzer-files-context.js +26 -67
  85. package/project/context/flowr-analyzer-meta-context.d.ts +1 -0
  86. package/project/context/flowr-file.d.ts +5 -0
  87. package/project/context/flowr-file.js +5 -0
  88. package/project/dependency-version-space.d.ts +118 -26
  89. package/project/dependency-version-space.js +343 -87
  90. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  91. package/project/plugins/file-plugins/files/flowr-description-file.js +8 -1
  92. package/project/plugins/file-plugins/files/flowr-rda-file.js +27 -25
  93. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +12 -4
  94. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +25 -10
  95. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
  96. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +1 -1
  97. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -1
  98. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -1
  99. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +4 -4
  100. package/project/plugins/package-version-plugins/package.d.ts +27 -10
  101. package/project/plugins/package-version-plugins/package.js +50 -25
  102. package/project/plugins/plugin-registry.d.ts +2 -1
  103. package/project/plugins/plugin-registry.js +4 -1
  104. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +57 -2
  105. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +150 -28
  106. package/project/sigdb/decompress.d.ts +1 -1
  107. package/project/sigdb/decompress.js +4 -1
  108. package/project/sigdb/manifest.js +60 -26
  109. package/project/sigdb/reader.d.ts +26 -16
  110. package/project/sigdb/reader.js +52 -21
  111. package/project/sigdb/sigdb-download.d.ts +6 -7
  112. package/project/sigdb/sigdb-download.js +30 -9
  113. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  114. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -12
  115. package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -108
  116. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
  117. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +39 -77
  118. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +12 -0
  119. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +54 -24
  120. package/queries/catalog/input-sources-query/input-source-functions.d.ts +13 -0
  121. package/queries/catalog/input-sources-query/input-source-functions.js +96 -1
  122. package/queries/catalog/input-sources-query/input-sources-query-executor.js +40 -4
  123. package/queries/catalog/input-sources-query/input-sources-query-format.js +21 -3
  124. package/queries/catalog/input-sources-query/input-types.d.ts +58 -0
  125. package/queries/catalog/input-sources-query/input-types.js +64 -0
  126. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +62 -52
  127. package/queries/catalog/input-sources-query/simple-input-classifier.js +334 -101
  128. package/queries/catalog/linter-query/linter-query-format.js +9 -2
  129. package/queries/catalog/project-query/project-query-executor.js +1 -1
  130. package/queries/catalog/signature-query/signature-query-executor.d.ts +7 -1
  131. package/queries/catalog/signature-query/signature-query-executor.js +115 -39
  132. package/queries/catalog/signature-query/signature-query-format.d.ts +5 -1
  133. package/queries/catalog/signature-query/signature-query-format.js +1 -1
  134. package/queries/catalog/signature-query/signature-query-render.js +12 -7
  135. package/queries/query.js +9 -2
  136. package/r-bridge/data/data.d.ts +5 -0
  137. package/r-bridge/data/data.js +6 -0
  138. package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
  139. package/r-bridge/retriever.d.ts +1 -1
  140. package/r-bridge/retriever.js +6 -1
  141. package/r-bridge/shell.js +5 -0
  142. package/search/flowr-search-filters.d.ts +2 -1
  143. package/search/flowr-search-printer.js +10 -8
  144. package/slicing/static/static-slicer.d.ts +2 -2
  145. package/util/files.d.ts +6 -4
  146. package/util/files.js +30 -8
  147. package/util/mermaid/dfg.js +1 -1
  148. package/util/objects.js +6 -4
  149. package/util/r-base-packages.d.ts +2 -0
  150. package/util/r-base-packages.js +3 -0
  151. package/util/r-license.js +1 -4
  152. package/util/r-version.d.ts +12 -0
  153. package/util/r-version.js +16 -0
  154. package/util/range.d.ts +6 -2
  155. package/util/range.js +33 -15
  156. package/util/text/ansi.d.ts +7 -3
  157. package/util/text/ansi.js +8 -5
  158. package/util/version.js +4 -4
@@ -92,6 +92,13 @@ class FlowrDescriptionFile extends flowr_file_1.FlowrFile {
92
92
  const suggests = this.content().get('Suggests');
93
93
  return suggests ? parsePackagesWithVersions(suggests, 'package') : undefined;
94
94
  }
95
+ /**
96
+ * Returns the parsed enhanced packages from the 'Enhances' field in the DESCRIPTION file.
97
+ */
98
+ enhances() {
99
+ const enhances = this.content().get('Enhances');
100
+ return enhances ? parsePackagesWithVersions(enhances, 'package') : undefined;
101
+ }
95
102
  /**
96
103
  * Returns the 'Collate' field from the DESCRIPTION file.
97
104
  */
@@ -157,7 +164,7 @@ function emplaceDCF(key, val, result) {
157
164
  if (!key) {
158
165
  return;
159
166
  }
160
- let values = [];
167
+ let values;
161
168
  if (key.includes('@')) {
162
169
  values = [val.trim()];
163
170
  }
@@ -1235,13 +1235,13 @@ class RDAParser {
1235
1235
  }
1236
1236
  break;
1237
1237
  default: {
1238
- let t = 0;
1239
- for (let done = 0; done < len; done += t) {
1240
- t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1238
+ for (let done = 0; done < len;) {
1239
+ const t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1241
1240
  for (let i = 0; i < t; i++) {
1242
1241
  result[done + i] = this.buffer[this.offset];
1243
1242
  this.offset += 1;
1244
1243
  }
1244
+ done += t;
1245
1245
  }
1246
1246
  }
1247
1247
  }
@@ -1260,12 +1260,12 @@ class RDAParser {
1260
1260
  }
1261
1261
  }
1262
1262
  else {
1263
- let t = 0;
1264
- for (let done = 0; done < len; done += t) {
1265
- t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1263
+ for (let done = 0; done < len;) {
1264
+ const t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1266
1265
  for (let i = 0; i < t; i++) {
1267
1266
  this.offset += 1;
1268
1267
  }
1268
+ done += t;
1269
1269
  }
1270
1270
  }
1271
1271
  }
@@ -1619,10 +1619,9 @@ class RDAParser {
1619
1619
  switch (this.format) {
1620
1620
  case SerializationFormat.Xdr:
1621
1621
  {
1622
- let t = 0;
1623
1622
  const result = [];
1624
- for (let done = 0; done < len; done += t) {
1625
- t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1623
+ for (let done = 0; done < len;) {
1624
+ const t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1626
1625
  for (let cnt = 0; cnt < t; cnt++) {
1627
1626
  if (this.offset + 4 > this.buffer.length) {
1628
1627
  throw new Error('XDR read failed');
@@ -1630,6 +1629,7 @@ class RDAParser {
1630
1629
  result[done + cnt] = this.buffer.readInt32BE(this.offset);
1631
1630
  this.offset += 4;
1632
1631
  }
1632
+ done += t;
1633
1633
  }
1634
1634
  return result;
1635
1635
  }
@@ -1658,15 +1658,15 @@ class RDAParser {
1658
1658
  switch (this.format) {
1659
1659
  case SerializationFormat.Xdr:
1660
1660
  {
1661
- let t = 0;
1662
- for (let done = 0; done < len; done += t) {
1663
- t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1661
+ for (let done = 0; done < len;) {
1662
+ const t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1664
1663
  for (let cnt = 0; cnt < t; cnt++) {
1665
1664
  if (this.offset + 4 > this.buffer.length) {
1666
1665
  throw new Error('XDR read failed');
1667
1666
  }
1668
1667
  this.offset += 4;
1669
1668
  }
1669
+ done += t;
1670
1670
  }
1671
1671
  break;
1672
1672
  }
@@ -1693,9 +1693,8 @@ class RDAParser {
1693
1693
  switch (this.format) {
1694
1694
  case SerializationFormat.Xdr: {
1695
1695
  const result = [];
1696
- let t = 0;
1697
- for (let done = 0; done < len; done += t) {
1698
- t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1696
+ for (let done = 0; done < len;) {
1697
+ const t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1699
1698
  const chunkBytes = t * RDAParser.SIZE_OF_DOUBLE;
1700
1699
  const chunk = this.buffer.subarray(this.offset, this.offset + chunkBytes);
1701
1700
  this.offset += chunkBytes;
@@ -1703,6 +1702,7 @@ class RDAParser {
1703
1702
  const value = chunk.readDoubleBE(i * RDAParser.SIZE_OF_DOUBLE);
1704
1703
  result.push(value);
1705
1704
  }
1705
+ done += t;
1706
1706
  }
1707
1707
  return result;
1708
1708
  }
@@ -1730,11 +1730,11 @@ class RDAParser {
1730
1730
  skipRealVec(len) {
1731
1731
  switch (this.format) {
1732
1732
  case SerializationFormat.Xdr: {
1733
- let t = 0;
1734
- for (let done = 0; done < len; done += t) {
1735
- t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1733
+ for (let done = 0; done < len;) {
1734
+ const t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1736
1735
  const chunkBytes = t * RDAParser.SIZE_OF_DOUBLE;
1737
1736
  this.offset += chunkBytes;
1737
+ done += t;
1738
1738
  }
1739
1739
  break;
1740
1740
  }
@@ -1822,12 +1822,12 @@ class RDAParser {
1822
1822
  switch (this.format) {
1823
1823
  case SerializationFormat.Xdr: {
1824
1824
  const result = [];
1825
- let t = 0;
1826
- for (let done = 0; done < len; done += t) {
1827
- t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1825
+ for (let done = 0; done < len;) {
1826
+ const t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1828
1827
  for (let cnt = 0; cnt < t; cnt++) {
1829
1828
  result[done] = this.inComplex();
1830
1829
  }
1830
+ done += t;
1831
1831
  }
1832
1832
  return result;
1833
1833
  }
@@ -1853,12 +1853,12 @@ class RDAParser {
1853
1853
  skipComplexVec(len) {
1854
1854
  switch (this.format) {
1855
1855
  case SerializationFormat.Xdr: {
1856
- let t = 0;
1857
- for (let done = 0; done < len; done += t) {
1858
- t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1856
+ for (let done = 0; done < len;) {
1857
+ const t = Math.min(RDAParser.CHUNK_SIZE, len - done);
1859
1858
  for (let cnt = 0; cnt < t; cnt++) {
1860
1859
  this.skipComplex();
1861
1860
  }
1861
+ done += t;
1862
1862
  }
1863
1863
  break;
1864
1864
  }
@@ -2146,6 +2146,7 @@ class RDAParser {
2146
2146
  this.skipInteger();
2147
2147
  type = this.assertInteger(this.inInteger());
2148
2148
  }
2149
+ /* eslint-disable no-useless-assignment -- mirrors the read path */
2149
2150
  switch (type) {
2150
2151
  case SexpType.AltLangSxp:
2151
2152
  type = SexpType.LangSxp;
@@ -2156,6 +2157,7 @@ class RDAParser {
2156
2157
  hasAttr = true;
2157
2158
  break;
2158
2159
  }
2160
+ /* eslint-enable no-useless-assignment */
2159
2161
  this.currentDepth++;
2160
2162
  if (hasAttr) {
2161
2163
  this.skipItem();
@@ -2376,7 +2378,7 @@ class RDAParser {
2376
2378
  }
2377
2379
  const name = n.tag?.name;
2378
2380
  if (name !== undefined) {
2379
- let copy = {};
2381
+ let copy;
2380
2382
  if (shortcut) {
2381
2383
  copy = {
2382
2384
  name: n.tag.name,
@@ -5,13 +5,21 @@ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context'
5
5
  import type { FlowrFileProvider } from '../../context/flowr-file';
6
6
  /** `Rprofile.site` is the site-wide, `.Rprofile` the user/project profile. */
7
7
  export declare const RprofileFilePattern: RegExp;
8
- /** {@link FlowrAnalyzerLoadingOrderRprofilePlugin} moves the tagged files to the front of the loading order. */
8
+ /** `.Renviron` is the user/project environment file, `Renviron.site` the site-wide one. */
9
+ export declare const RenvironFilePattern: RegExp;
10
+ /**
11
+ * Marks R startup files: profiles (`.Rprofile`, `Rprofile.site`) are R source, so they get
12
+ * {@link FileRole.Startup} and {@link FileRole.Source}; environment files (`.Renviron`, `Renviron.site`) hold
13
+ * `KEY=value` definitions rather than R code, so they only get {@link FileRole.Environment}.
14
+ * The {@link FlowrAnalyzerLoadingOrderRprofilePlugin} moves the profile files to the front of the loading order.
15
+ */
9
16
  export declare class FlowrAnalyzerRprofileFilePlugin extends FlowrAnalyzerFilePlugin {
10
17
  readonly name = "flowr-analyzer-rprofile-file-plugin";
11
- readonly description = "Marks R startup profiles (.Rprofile, Rprofile.site).";
18
+ readonly description = "Marks R startup files (.Rprofile, Rprofile.site, .Renviron, Renviron.site).";
12
19
  readonly version: SemVer;
13
- private readonly pathPattern;
14
- constructor(pathPattern?: RegExp);
20
+ private readonly profilePattern;
21
+ private readonly environPattern;
22
+ constructor(profilePattern?: RegExp, environPattern?: RegExp);
15
23
  applies(file: PathLike): boolean;
16
24
  process(_ctx: FlowrAnalyzerContext, file: FlowrFileProvider): [FlowrFileProvider, true];
17
25
  }
@@ -1,28 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowrAnalyzerRprofileFilePlugin = exports.RprofileFilePattern = void 0;
3
+ exports.FlowrAnalyzerRprofileFilePlugin = exports.RenvironFilePattern = exports.RprofileFilePattern = 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");
7
7
  const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
8
8
  /** `Rprofile.site` is the site-wide, `.Rprofile` the user/project profile. */
9
9
  exports.RprofileFilePattern = /^(\.Rprofile|Rprofile\.site)$/i;
10
- /** {@link FlowrAnalyzerLoadingOrderRprofilePlugin} moves the tagged files to the front of the loading order. */
10
+ /** `.Renviron` is the user/project environment file, `Renviron.site` the site-wide one. */
11
+ exports.RenvironFilePattern = /^(\.Renviron|Renviron\.site)$/i;
12
+ /**
13
+ * Marks R startup files: profiles (`.Rprofile`, `Rprofile.site`) are R source, so they get
14
+ * {@link FileRole.Startup} and {@link FileRole.Source}; environment files (`.Renviron`, `Renviron.site`) hold
15
+ * `KEY=value` definitions rather than R code, so they only get {@link FileRole.Environment}.
16
+ * The {@link FlowrAnalyzerLoadingOrderRprofilePlugin} moves the profile files to the front of the loading order.
17
+ */
11
18
  class FlowrAnalyzerRprofileFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
12
19
  name = 'flowr-analyzer-rprofile-file-plugin';
13
- description = 'Marks R startup profiles (.Rprofile, Rprofile.site).';
14
- version = new semver_1.SemVer('0.1.0');
15
- pathPattern;
16
- constructor(pathPattern = exports.RprofileFilePattern) {
20
+ description = 'Marks R startup files (.Rprofile, Rprofile.site, .Renviron, Renviron.site).';
21
+ version = new semver_1.SemVer('0.2.0');
22
+ profilePattern;
23
+ environPattern;
24
+ constructor(profilePattern = exports.RprofileFilePattern, environPattern = exports.RenvironFilePattern) {
17
25
  super();
18
- this.pathPattern = pathPattern;
26
+ this.profilePattern = profilePattern;
27
+ this.environPattern = environPattern;
19
28
  }
20
29
  applies(file) {
21
- return this.pathPattern.test((0, built_in_source_1.platformBasename)(file.toString()));
30
+ const base = (0, built_in_source_1.platformBasename)(file.toString());
31
+ return this.profilePattern.test(base) || this.environPattern.test(base);
22
32
  }
23
33
  process(_ctx, file) {
24
- file.assignRole(flowr_file_1.FileRole.Startup);
25
- file.assignRole(flowr_file_1.FileRole.Source);
34
+ if (this.environPattern.test((0, built_in_source_1.platformBasename)(file.path()))) {
35
+ file.assignRole(flowr_file_1.FileRole.Environment);
36
+ }
37
+ else {
38
+ file.assignRole(flowr_file_1.FileRole.Startup);
39
+ file.assignRole(flowr_file_1.FileRole.Source);
40
+ }
26
41
  return [file, true];
27
42
  }
28
43
  }
@@ -1,7 +1,7 @@
1
1
  import type { PathLike } from 'fs';
2
2
  import { SemVer } from 'semver';
3
3
  import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-context';
4
- import { type FlowrFileProvider } from '../../../context/flowr-file';
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
7
  export declare const RmdPattern: RegExp;
@@ -1,7 +1,7 @@
1
1
  import type { PathLike } from 'fs';
2
2
  import { SemVer } from 'semver';
3
3
  import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-context';
4
- import { type FlowrFileProvider } from '../../../context/flowr-file';
4
+ import type { FlowrFileProvider } from '../../../context/flowr-file';
5
5
  import { FlowrAnalyzerFilePlugin } from '../flowr-analyzer-file-plugin';
6
6
  import { FlowrSweaveFile } from '../files/flowr-sweave-file';
7
7
  /**
@@ -38,7 +38,8 @@ class FlowrAnalyzerMetaDescriptionFilePlugin extends flowr_analyzer_package_vers
38
38
  imports: deps.imports(),
39
39
  depends: deps.depends(),
40
40
  suggests: deps.suggests(),
41
- linkingTo: deps.linkingTo()
41
+ linkingTo: deps.linkingTo(),
42
+ enhances: deps.enhances()
42
43
  }
43
44
  }, flowr_analyzer_meta_context_1.MetaPriority.Description);
44
45
  }
@@ -80,7 +80,7 @@ export declare class FlowrAnalyzerPackageVersionsSigDbPlugin extends FlowrAnalyz
80
80
  private buildExportIndex;
81
81
  /**
82
82
  * The raw sources in priority order: explicit constructor sources, `$FLOWR_SIGDB`, then **every** bundled
83
- * database discovered in the data dirs (see {@link defaultSigDbPaths}) -- so an extra bundle dropped next to
83
+ * database discovered in the data dirs (see {@link defaultSigDbPaths}), so an extra bundle dropped next to
84
84
  * the default (e.g. a downloaded full-history one) is mounted automatically. All bundled defaults are skipped
85
85
  * when `$FLOWR_DISABLE_DEFAULT_SIGDB` is set; explicit sources are always honored.
86
86
  */
@@ -183,7 +183,7 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
183
183
  if (!dl.sigDbNeedsSync()) {
184
184
  return;
185
185
  }
186
- exports.sigDbLog.info('sigdb: committed link file changed -- re-syncing shards in the background');
186
+ exports.sigDbLog.info('sigdb: committed link file changed, re-syncing shards in the background');
187
187
  const { files } = await dl.downloadFullSigDb({
188
188
  repo: ctx.config.solver.sigdb.downloadRepo,
189
189
  onProgress: msg => exports.sigDbLog.info(`sigdb sync: ${msg}`)
@@ -286,7 +286,7 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
286
286
  }
287
287
  /**
288
288
  * The raw sources in priority order: explicit constructor sources, `$FLOWR_SIGDB`, then **every** bundled
289
- * database discovered in the data dirs (see {@link defaultSigDbPaths}) -- so an extra bundle dropped next to
289
+ * database discovered in the data dirs (see {@link defaultSigDbPaths}), so an extra bundle dropped next to
290
290
  * the default (e.g. a downloaded full-history one) is mounted automatically. All bundled defaults are skipped
291
291
  * when `$FLOWR_DISABLE_DEFAULT_SIGDB` is set; explicit sources are always honored.
292
292
  */
@@ -305,7 +305,7 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
305
305
  loadSources(config) {
306
306
  const cfg = config ?? this.analyzerCtx?.config;
307
307
  // `solver.sigdb.enabled: false` disables the database for this analyzer only: drop any loaded sources so it
308
- // frees memory and every consumer (resolve, base-R link, queries) sees nothing -- other analyzers are untouched.
308
+ // frees memory and every consumer (resolve, base-R link, queries) sees nothing; other analyzers are untouched.
309
309
  // An absent config is the pre-analysis query path (default enabled), so only an explicit `false` disables.
310
310
  if (cfg !== undefined && !(0, config_1.isSigDbEnabled)(cfg)) {
311
311
  if (this.sources !== undefined) {
@@ -402,7 +402,7 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
402
402
  const sigdb = this.analyzerCtx?.config.solver.sigdb;
403
403
  const override = sigdb?.versionOverrides?.[name];
404
404
  const selection = sigdb?.versionSelection ?? config_1.VersionSelection.Newest;
405
- const range = existing?.derivedVersion;
405
+ const range = existing?.derivedRange;
406
406
  let fallback;
407
407
  for (const src of this.loadSources()) {
408
408
  if (!src.has(name)) {
@@ -1,23 +1,40 @@
1
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
+ /** what a source can contribute about a package; everything else a {@link Package} exposes is derived from these */
4
5
  export type PackageOptions = {
5
- derivedVersion?: Range;
6
6
  type?: PackageType;
7
7
  dependencies?: Package[];
8
8
  namespaceInfo?: NamespaceInfo;
9
+ /** what this source declared for the package (a `DESCRIPTION` range, a lockfile pin, ...) */
9
10
  versionConstraints?: Range[];
10
11
  /** the concrete version the exports were resolved from (e.g. the package database entry), for information only */
11
12
  resolvedVersion?: string;
12
13
  };
14
+ /**
15
+ * A package as the sources describe it, accumulated with {@link addInfo}/{@link mergeInPlace}: only those may
16
+ * change it, everything else reads. Its three version views run from the rawest to the most concrete:
17
+ * - {@link versionConstraints}: what each source declared, unmerged.
18
+ * - {@link derivedRange}: their intersection, whether or not a version can satisfy it (see
19
+ * {@link hasSatisfiableVersion}, and `inferredRange` on the dependencies context for the range that is only
20
+ * handed out once it is).
21
+ * - {@link resolvedVersion}: the one concrete version the exports were read from.
22
+ */
13
23
  export declare class Package {
14
- name: string;
15
- derivedVersion?: Range;
16
- type?: PackageType;
17
- dependencies?: Package[];
18
- namespaceInfo?: NamespaceInfo;
19
- versionConstraints: Range[];
20
- resolvedVersion?: string;
24
+ readonly name: string;
25
+ private _type?;
26
+ private _dependencies?;
27
+ private _namespaceInfo?;
28
+ private _resolvedVersion?;
29
+ private readonly _versionConstraints;
30
+ /** the intersection of {@link versionConstraints}, computed on demand and dropped whenever one is added */
31
+ private _derivedRange?;
32
+ get type(): PackageType | undefined;
33
+ get dependencies(): readonly Package[] | undefined;
34
+ get namespaceInfo(): NamespaceInfo | undefined;
35
+ get resolvedVersion(): string | undefined;
36
+ get versionConstraints(): readonly Range[];
37
+ get derivedRange(): Range | undefined;
21
38
  constructor(info: {
22
39
  name: string;
23
40
  } & PackageOptions);
@@ -26,9 +43,9 @@ export declare class Package {
26
43
  has(name: string, className?: string): boolean;
27
44
  s3For(generic: string): string[];
28
45
  mergeInPlace(other: Package): void;
29
- addInfo(info: PackageOptions): void;
46
+ addInfo({ type, dependencies, namespaceInfo, versionConstraints, resolvedVersion }: PackageOptions): void;
30
47
  /** The combined (intersected) range of all recorded constraints, or `undefined` if none were given. */
31
- deriveVersion(): Range | undefined;
48
+ private deriveRange;
32
49
  /** Whether some concrete version can satisfy every recorded constraint at once. */
33
50
  hasSatisfiableVersion(): boolean;
34
51
  static parsePkgVersionRange(constraint?: string, version?: string): Range | undefined;
@@ -7,14 +7,43 @@ const flowr_namespace_file_1 = require("../file-plugins/files/flowr-namespace-fi
7
7
  const flowr_file_1 = require("../../context/flowr-file");
8
8
  const r_version_1 = require("../../../util/r-version");
9
9
  const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
10
+ /**
11
+ * A package as the sources describe it, accumulated with {@link addInfo}/{@link mergeInPlace}: only those may
12
+ * change it, everything else reads. Its three version views run from the rawest to the most concrete:
13
+ * - {@link versionConstraints}: what each source declared, unmerged.
14
+ * - {@link derivedRange}: their intersection, whether or not a version can satisfy it (see
15
+ * {@link hasSatisfiableVersion}, and `inferredRange` on the dependencies context for the range that is only
16
+ * handed out once it is).
17
+ * - {@link resolvedVersion}: the one concrete version the exports were read from.
18
+ */
10
19
  class Package {
11
20
  name;
12
- derivedVersion;
13
- type;
14
- dependencies;
15
- namespaceInfo;
16
- versionConstraints = [];
17
- resolvedVersion;
21
+ _type;
22
+ _dependencies;
23
+ _namespaceInfo;
24
+ _resolvedVersion;
25
+ _versionConstraints = [];
26
+ /** the intersection of {@link versionConstraints}, computed on demand and dropped whenever one is added */
27
+ _derivedRange;
28
+ get type() {
29
+ return this._type;
30
+ }
31
+ get dependencies() {
32
+ return this._dependencies;
33
+ }
34
+ get namespaceInfo() {
35
+ return this._namespaceInfo;
36
+ }
37
+ get resolvedVersion() {
38
+ return this._resolvedVersion;
39
+ }
40
+ get versionConstraints() {
41
+ return this._versionConstraints;
42
+ }
43
+ get derivedRange() {
44
+ this._derivedRange ??= this.deriveRange();
45
+ return this._derivedRange;
46
+ }
18
47
  constructor(info) {
19
48
  this.name = info.name;
20
49
  this.addInfo(info);
@@ -55,35 +84,31 @@ class Package {
55
84
  (0, assert_1.guard)(this.name === other.name, 'Can only merge packages with the same name');
56
85
  this.addInfo({
57
86
  type: other.type,
58
- dependencies: other.dependencies,
87
+ dependencies: other._dependencies,
59
88
  namespaceInfo: other.namespaceInfo,
60
- versionConstraints: other.versionConstraints,
89
+ versionConstraints: other._versionConstraints,
61
90
  resolvedVersion: other.resolvedVersion
62
91
  });
63
92
  }
64
- addInfo(info) {
65
- const { type, dependencies, namespaceInfo, versionConstraints, resolvedVersion } = info;
66
- this.resolvedVersion = resolvedVersion ?? this.resolvedVersion;
67
- this.type = type ?? this.type;
68
- this.dependencies = dependencies ?? this.dependencies;
69
- this.namespaceInfo = namespaceInfo ?? this.namespaceInfo;
70
- if (versionConstraints !== undefined) {
71
- for (const constraint of versionConstraints) {
72
- this.versionConstraints.push(constraint);
73
- }
74
- // sources may disagree, which `hasSatisfiableVersion` reports rather than this failing
75
- this.derivedVersion = this.deriveVersion() ?? this.derivedVersion;
93
+ addInfo({ type, dependencies, namespaceInfo, versionConstraints, resolvedVersion }) {
94
+ this._resolvedVersion = resolvedVersion ?? this._resolvedVersion;
95
+ this._type = type ?? this._type;
96
+ this._dependencies = dependencies ?? this._dependencies;
97
+ this._namespaceInfo = namespaceInfo ?? this._namespaceInfo;
98
+ if (versionConstraints !== undefined && versionConstraints.length > 0) {
99
+ this._versionConstraints.push(...versionConstraints);
100
+ this._derivedRange = undefined; // re-derived on the next read, once every source has had its say
76
101
  }
77
102
  }
78
103
  /** The combined (intersected) range of all recorded constraints, or `undefined` if none were given. */
79
- deriveVersion() {
80
- return this.versionConstraints.length > 0
81
- ? r_version_1.RRange.parse(this.versionConstraints.map(c => c.raw).join(' '))
82
- : undefined;
104
+ deriveRange() {
105
+ // sources may disagree, which `hasSatisfiableVersion` reports rather than this failing
106
+ return r_version_1.RRange.intersect(this._versionConstraints);
83
107
  }
84
108
  /** Whether some concrete version can satisfy every recorded constraint at once. */
85
109
  hasSatisfiableVersion() {
86
- return this.derivedVersion !== undefined && (0, semver_1.minVersion)(this.derivedVersion) !== null;
110
+ const range = this.derivedRange;
111
+ return range !== undefined && (0, semver_1.minVersion)(range) !== null;
87
112
  }
88
113
  static parsePkgVersionRange(constraint, version) {
89
114
  if (version) {
@@ -23,12 +23,13 @@ import { FlowrAnalyzerMetaRProjectFilePlugin } from './package-version-plugins/f
23
23
  import { FlowrAnalyzerMetaDescriptionFilePlugin } from './package-version-plugins/flowr-analyzer-meta-description-file-plugin';
24
24
  import { FlowrAnalyzerSweaveFilePlugin } from './file-plugins/notebooks/flowr-analyzer-sweave-file-plugin';
25
25
  import { FlowrAnalyzerGitignoreProjectDiscoveryPlugin, FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin, FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin } from './project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin';
26
+ import { FlowrAnalyzerDefaultProjectDiscoveryPlugin, FlowrAnalyzerFullProjectDiscoveryPlugin } from './project-discovery/flowr-analyzer-project-discovery-plugin';
26
27
  import { FlowrAnalyzerRprofileFilePlugin } from './file-plugins/flowr-analyzer-rprofile-file-plugin';
27
28
  import { FlowrAnalyzerLoadingOrderRprofilePlugin } from './loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin';
28
29
  /**
29
30
  * The built-in Flowr Analyzer plugins that are always available.
30
31
  */
31
- export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["versions:sigdb", typeof FlowrAnalyzerPackageVersionsSigDbPlugin], ["versions:renv", typeof FlowrAnalyzerPackageVersionsRenvPlugin], ["versions:rv", typeof FlowrAnalyzerPackageVersionsRvPlugin], ["versions:packrat", typeof FlowrAnalyzerPackageVersionsPackratPlugin], ["versions:session-info", typeof FlowrAnalyzerPackageVersionsSessionInfoPlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["loading-order:implicit-sources", typeof FlowrAnalyzerLoadingOrderImplicitSourcesPlugin], ["loading-order:rprofile", typeof FlowrAnalyzerLoadingOrderRprofilePlugin], ["meta:description", typeof FlowrAnalyzerMetaDescriptionFilePlugin], ["meta:rproject", typeof FlowrAnalyzerMetaRProjectFilePlugin], ["file-roles:vignette", typeof FlowrAnalyzerMetaVignetteFilesPlugin], ["file-roles:test", typeof FlowrAnalyzerMetaTestFilesPlugin], ["file-roles:inst", typeof FlowrAnalyzerMetaInstFilesPlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:rnw", typeof FlowrAnalyzerSweaveFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilesPlugin], ["versions:namespace", typeof FlowrAnalyzerPackageVersionsNamespaceFilePlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin], ["file:rda", typeof FlowrAnalyzerRdaFilePlugin], ["file:license", typeof FlowrAnalyzerLicenseFilePlugin], ["file:virtualenv", typeof FlowrAnalyzerVirtualEnvFilePlugin], ["file:rproject", typeof FlowrAnalyzerRProjectFilePlugin], ["file:rprofile", typeof FlowrAnalyzerRprofileFilePlugin], ["project-discovery:gitignore", typeof FlowrAnalyzerGitignoreProjectDiscoveryPlugin], ["project-discovery:rbuildignore", typeof FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin], ["project-discovery:ignore-files", typeof FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin]];
32
+ export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["versions:sigdb", typeof FlowrAnalyzerPackageVersionsSigDbPlugin], ["versions:renv", typeof FlowrAnalyzerPackageVersionsRenvPlugin], ["versions:rv", typeof FlowrAnalyzerPackageVersionsRvPlugin], ["versions:packrat", typeof FlowrAnalyzerPackageVersionsPackratPlugin], ["versions:session-info", typeof FlowrAnalyzerPackageVersionsSessionInfoPlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["loading-order:implicit-sources", typeof FlowrAnalyzerLoadingOrderImplicitSourcesPlugin], ["loading-order:rprofile", typeof FlowrAnalyzerLoadingOrderRprofilePlugin], ["meta:description", typeof FlowrAnalyzerMetaDescriptionFilePlugin], ["meta:rproject", typeof FlowrAnalyzerMetaRProjectFilePlugin], ["file-roles:vignette", typeof FlowrAnalyzerMetaVignetteFilesPlugin], ["file-roles:test", typeof FlowrAnalyzerMetaTestFilesPlugin], ["file-roles:inst", typeof FlowrAnalyzerMetaInstFilesPlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:rnw", typeof FlowrAnalyzerSweaveFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilesPlugin], ["versions:namespace", typeof FlowrAnalyzerPackageVersionsNamespaceFilePlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin], ["file:rda", typeof FlowrAnalyzerRdaFilePlugin], ["file:license", typeof FlowrAnalyzerLicenseFilePlugin], ["file:virtualenv", typeof FlowrAnalyzerVirtualEnvFilePlugin], ["file:rproject", typeof FlowrAnalyzerRProjectFilePlugin], ["file:rprofile", typeof FlowrAnalyzerRprofileFilePlugin], ["project-discovery:gitignore", typeof FlowrAnalyzerGitignoreProjectDiscoveryPlugin], ["project-discovery:rbuildignore", typeof FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin], ["project-discovery:ignore-files", typeof FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin], ["project-discovery:default", typeof FlowrAnalyzerDefaultProjectDiscoveryPlugin], ["project-discovery:full", typeof FlowrAnalyzerFullProjectDiscoveryPlugin]];
32
33
  export type BuiltInFlowrPluginName = typeof BuiltInPlugins[number][0];
33
34
  export type BuiltInFlowrPluginArgs<N extends BuiltInFlowrPluginName> = N extends typeof BuiltInPlugins[number][0] ? ConstructorParameters<Extract<typeof BuiltInPlugins[number], [N, PluginProducer]>[1]> : never;
34
35
  type PluginProducer = new (...args: never[]) => FlowrAnalyzerPlugin;
@@ -29,6 +29,7 @@ const flowr_analyzer_meta_rproject_file_plugin_1 = require("./package-version-pl
29
29
  const flowr_analyzer_meta_description_file_plugin_1 = require("./package-version-plugins/flowr-analyzer-meta-description-file-plugin");
30
30
  const flowr_analyzer_sweave_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-sweave-file-plugin");
31
31
  const flowr_analyzer_ignore_file_project_discovery_plugin_1 = require("./project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin");
32
+ const flowr_analyzer_project_discovery_plugin_1 = require("./project-discovery/flowr-analyzer-project-discovery-plugin");
32
33
  const flowr_analyzer_rprofile_file_plugin_1 = require("./file-plugins/flowr-analyzer-rprofile-file-plugin");
33
34
  const flowr_analyzer_loading_order_rprofile_plugin_1 = require("./loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin");
34
35
  /**
@@ -64,7 +65,9 @@ exports.BuiltInPlugins = [
64
65
  ['file:rprofile', flowr_analyzer_rprofile_file_plugin_1.FlowrAnalyzerRprofileFilePlugin],
65
66
  ['project-discovery:gitignore', flowr_analyzer_ignore_file_project_discovery_plugin_1.FlowrAnalyzerGitignoreProjectDiscoveryPlugin],
66
67
  ['project-discovery:rbuildignore', flowr_analyzer_ignore_file_project_discovery_plugin_1.FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin],
67
- ['project-discovery:ignore-files', flowr_analyzer_ignore_file_project_discovery_plugin_1.FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin]
68
+ ['project-discovery:ignore-files', flowr_analyzer_ignore_file_project_discovery_plugin_1.FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin],
69
+ ['project-discovery:default', flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerDefaultProjectDiscoveryPlugin],
70
+ ['project-discovery:full', flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerFullProjectDiscoveryPlugin]
68
71
  ];
69
72
  /**
70
73
  * The registry of built-in and user-registered Flowr Analyzer plugins.
@@ -1,11 +1,13 @@
1
1
  import { FlowrAnalyzerPlugin, PluginType } from '../flowr-analyzer-plugin';
2
+ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
2
3
  import type { RParseRequest } from '../../../r-bridge/retriever';
3
4
  import type { RProjectAnalysisRequest } from '../../context/flowr-analyzer-files-context';
5
+ import { SemVer } from 'semver';
4
6
  import { type FlowrFile } from '../../context/flowr-file';
5
7
  /**
6
8
  * This is the base class for all plugins that discover files in a project for analysis.
7
9
  * These plugins interplay with the {@link FlowrAnalyzerFilesContext} to gather information about the files in the project.
8
- * See {@link DefaultFlowrAnalyzerProjectDiscoveryPlugin} for the dummy default implementation.
10
+ * See {@link FlowrAnalyzerDefaultProjectDiscoveryPlugin} for the default implementation.
9
11
  *
10
12
  * In general, these plugins only trigger for a {@link RProjectAnalysisRequest} with the idea to discover all files in a project.
11
13
  */
@@ -13,7 +15,26 @@ export declare abstract class FlowrAnalyzerProjectDiscoveryPlugin extends FlowrA
13
15
  readonly type = PluginType.ProjectDiscovery;
14
16
  static defaultPlugin(): FlowrAnalyzerProjectDiscoveryPlugin;
15
17
  }
16
- /** Configuration options for the {@link DefaultFlowrAnalyzerProjectDiscoveryPlugin}. */
18
+ export declare const discoverRSourcesRegex: RegExp;
19
+ export declare const ignorePathsWith: RegExp;
20
+ export declare const excludeRequestsForPaths: RegExp;
21
+ /** Options for {@link collectRequests}; unset fields fall back to the module defaults. */
22
+ export interface CollectRequestOptions {
23
+ /** the regex marking a path as an R source to parse (default {@link discoverRSourcesRegex}) */
24
+ readonly supportedExtensions?: RegExp;
25
+ /** directories whose R sources are collected as text rather than parsed (default {@link excludeRequestsForPaths}) */
26
+ readonly excludePathsRegex?: RegExp;
27
+ /** if set, only paths matching this regex are parsed as R */
28
+ readonly onlyTraversePaths?: RegExp;
29
+ }
30
+ /**
31
+ * Turn the walked `files` (absolute paths under `root`) into the discovery result: R sources become
32
+ * {@link RParseRequest}s, everything else -- and R sources under an excluded directory -- becomes a
33
+ * {@link FlowrTextFile}; `.Rprofile` files get both so they are tagged. This is the single emit implementation
34
+ * shared by the greedy and the intelligent discovery plugins.
35
+ */
36
+ export declare function collectRequests(files: Iterable<string>, root: string, opts?: CollectRequestOptions): (RParseRequest | FlowrFile<string>)[];
37
+ /** Configuration options for the {@link FlowrAnalyzerFullProjectDiscoveryPlugin}. */
17
38
  export interface ProjectDiscoveryConfig {
18
39
  /** the regex to trigger R source file discovery on (and hence analyze them as R files) */
19
40
  triggerOnExtensions?: RegExp;
@@ -24,3 +45,37 @@ export interface ProjectDiscoveryConfig {
24
45
  /** if set, only paths matching this regex are traversed */
25
46
  onlyTraversePaths?: RegExp;
26
47
  }
48
+ /**
49
+ * The greedy discovery implementation: every file below the root becomes a {@link RParseRequest} (R and Rmd files)
50
+ * or a {@link FlowrTextFile} (the rest). This is what {@link FlowrAnalyzerDefaultProjectDiscoveryPlugin} falls back
51
+ * to in `full` mode.
52
+ */
53
+ export declare class FlowrAnalyzerFullProjectDiscoveryPlugin extends FlowrAnalyzerProjectDiscoveryPlugin {
54
+ readonly name = "full-project-discovery-plugin";
55
+ readonly description = "Collects every file below the project root (greedy discovery).";
56
+ readonly version: SemVer;
57
+ private readonly supportedExtensions;
58
+ private readonly ignorePathsRegex;
59
+ private readonly excludePathsRegex;
60
+ private readonly onlyTraversePaths;
61
+ /**
62
+ * Creates a new instance of the greedy project discovery plugin.
63
+ * @param triggerOnExtensions - the regex to trigger R source file discovery on (and hence analyze them as R files)
64
+ * @param ignorePathsRegex - the regex to ignore certain paths entirely
65
+ * @param excludePathsRegex - the regex to exclude certain paths from being requested as R files (they are still collected as text files)
66
+ * @param onlyTraversePaths - if set, only paths matching this regex are traversed
67
+ */
68
+ constructor({ triggerOnExtensions, ignorePathsRegex, excludePathsRegex, onlyTraversePaths }?: ProjectDiscoveryConfig);
69
+ process(context: FlowrAnalyzerContext, args: RProjectAnalysisRequest): (RParseRequest | FlowrFile<string>)[];
70
+ }
71
+ /**
72
+ * flowR's default discovery: walk the project once (pruning noise directories), classify the {@link ProjectKind}
73
+ * from what the walk sees, then keep only the files that kind needs. `project.discovery.full` restores the greedy
74
+ * {@link FlowrAnalyzerFullProjectDiscoveryPlugin}, `project.discovery.perKind` overrides the kept set per kind.
75
+ */
76
+ export declare class FlowrAnalyzerDefaultProjectDiscoveryPlugin extends FlowrAnalyzerProjectDiscoveryPlugin {
77
+ readonly name = "default-project-discovery-plugin";
78
+ readonly description = "Detects the project kind and discovers only the files it needs (unless project.discovery.full).";
79
+ readonly version: SemVer;
80
+ process(context: FlowrAnalyzerContext, args: RProjectAnalysisRequest): (RParseRequest | FlowrFile<string>)[];
81
+ }