@eagleoutice/flowr 2.13.2 → 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 (97) 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/config.d.ts +8 -0
  7. package/config.js +9 -1
  8. package/control-flow/control-flow-graph.js +2 -1
  9. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  10. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +1 -1
  11. package/dataflow/environments/append.d.ts +1 -1
  12. package/dataflow/environments/clone.d.ts +1 -1
  13. package/dataflow/environments/environment.d.ts +28 -4
  14. package/dataflow/environments/environment.js +66 -11
  15. package/dataflow/environments/overwrite.d.ts +1 -1
  16. package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
  17. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  18. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
  19. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +1 -1
  20. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  21. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +51 -0
  22. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  23. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -1
  24. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
  25. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -2
  26. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +15 -9
  27. package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
  28. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
  29. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +1 -1
  30. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +1 -1
  31. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -1
  32. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +9 -2
  33. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  34. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +2 -2
  35. package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +1 -1
  36. package/documentation/doc-readme.js +14 -12
  37. package/documentation/doc-util/doc-normalized-ast.d.ts +1 -1
  38. package/documentation/wiki-dataflow-graph.js +4 -24
  39. package/documentation/wiki-query.js +47 -0
  40. package/documentation/wiki-signature-database.js +3 -2
  41. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  42. package/linter/rules/undefined-symbol-util.js +3 -1
  43. package/linter/rules/undefined-symbol.js +3 -4
  44. package/package.json +21 -9
  45. package/project/context/flowr-analyzer-context.d.ts +4 -4
  46. package/project/context/flowr-analyzer-context.js +3 -3
  47. package/project/context/flowr-analyzer-dependencies-context.d.ts +11 -5
  48. package/project/context/flowr-analyzer-dependencies-context.js +8 -3
  49. package/project/context/flowr-analyzer-meta-context.d.ts +1 -0
  50. package/project/dependency-version-space.d.ts +118 -26
  51. package/project/dependency-version-space.js +343 -87
  52. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  53. package/project/plugins/file-plugins/files/flowr-description-file.js +8 -1
  54. package/project/plugins/file-plugins/files/flowr-rda-file.js +27 -25
  55. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
  56. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +1 -1
  57. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -1
  58. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -1
  59. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +4 -4
  60. package/project/plugins/package-version-plugins/package.d.ts +27 -10
  61. package/project/plugins/package-version-plugins/package.js +50 -25
  62. package/project/sigdb/reader.d.ts +26 -16
  63. package/project/sigdb/reader.js +52 -21
  64. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  65. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -2
  66. package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -2
  67. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
  68. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +39 -77
  69. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +12 -0
  70. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +53 -23
  71. package/queries/catalog/input-sources-query/input-source-functions.d.ts +13 -0
  72. package/queries/catalog/input-sources-query/input-source-functions.js +96 -1
  73. package/queries/catalog/input-sources-query/input-sources-query-executor.js +40 -4
  74. package/queries/catalog/input-sources-query/input-sources-query-format.js +21 -3
  75. package/queries/catalog/input-sources-query/input-types.d.ts +58 -0
  76. package/queries/catalog/input-sources-query/input-types.js +64 -0
  77. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +62 -52
  78. package/queries/catalog/input-sources-query/simple-input-classifier.js +334 -101
  79. package/queries/catalog/project-query/project-query-executor.js +1 -1
  80. package/queries/catalog/signature-query/signature-query-executor.d.ts +7 -1
  81. package/queries/catalog/signature-query/signature-query-executor.js +112 -39
  82. package/queries/catalog/signature-query/signature-query-format.d.ts +5 -1
  83. package/queries/catalog/signature-query/signature-query-format.js +1 -1
  84. package/queries/catalog/signature-query/signature-query-render.js +8 -3
  85. package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
  86. package/r-bridge/retriever.d.ts +1 -1
  87. package/search/flowr-search-printer.js +10 -8
  88. package/slicing/static/static-slicer.d.ts +2 -2
  89. package/util/objects.js +6 -4
  90. package/util/r-base-packages.d.ts +2 -0
  91. package/util/r-base-packages.js +3 -0
  92. package/util/r-license.js +1 -4
  93. package/util/r-version.d.ts +12 -0
  94. package/util/r-version.js +16 -0
  95. package/util/range.d.ts +6 -2
  96. package/util/range.js +33 -15
  97. package/util/version.js +1 -1
package/README.md CHANGED
@@ -12,6 +12,25 @@ available for [VSCode](https://marketplace.visualstudio.com/items?itemName=code-
12
12
  and [Docker](https://hub.docker.com/r/eagleoutice/flowr).
13
13
  It offers a wide variety of features, for example:
14
14
 
15
+ * 📚 **dependency analysis**\
16
+ Given your analysis project, flowR offers a plethora of so-called [queries](https://github.com/flowr-analysis/flowr/wiki/query-api) to get more information about your code.
17
+ An important query is the [dependencies query](https://github.com/flowr-analysis/flowr/wiki/%5BQuery%5D-Dependencies), which shows you the library your project needs,
18
+ the data files it reads, the scripts it sources, and the data it outputs.
19
+ Building on it, the [guess dependency versions query](https://github.com/flowr-analysis/flowr/wiki/%5BQuery%5D-Guess-Dependency-Versions) narrows down the version range each
20
+ of these libraries has to have, by combining the constraints your project declares with the functions your code actually calls.
21
+
22
+
23
+ <details><summary>Example: Dependency Analysis with flowR</summary>
24
+
25
+
26
+ The following showcases the dependency view of the [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr):
27
+
28
+ ![Dependency Analysis](https://raw.githubusercontent.com/flowr-analysis/vscode-flowr/refs/heads/main/media/dependencies.png)
29
+
30
+
31
+
32
+ </details>
33
+
15
34
  * 🐞 **code linting**\
16
35
  Analyze your R scripts for common issues and potential bugs (see the [wiki page](https://github.com/flowr-analysis/flowr/wiki/linter) for more information on the currently supported linters).
17
36
 
@@ -24,7 +43,7 @@ It offers a wide variety of features, for example:
24
43
 
25
44
  ```shell
26
45
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
27
- flowR repl v2.13.0, R grammar v14 (tree-sitter engine)
46
+ flowR repl v2.13.2, R grammar v14 (tree-sitter engine)
28
47
  R> :query @linter "read.csv(\"/root/x.txt\")"
29
48
  ```
30
49
 
@@ -33,17 +52,17 @@ It offers a wide variety of features, for example:
33
52
 
34
53
 
35
54
  ```text
36
- Query: linter (9 ms)
55
+ Query: linter (3 ms)
37
56
  ╰ Deprecated Functions (deprecated-functions): no findings
38
57
  ╰ File Path Validity (file-path-validity):
39
58
  ╰ certain:
40
59
  ╰ Path `/root/x.txt` at 1.1-23
41
- ╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 0
60
+ ╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs: 1
42
61
  ╰ Seeded Randomness (seeded-randomness): no findings
43
62
  ╰ Absolute Paths (absolute-file-paths):
44
63
  ╰ certain:
45
64
  ╰ Path `/root/x.txt` at 1.1-23
46
- ╰ Metadata: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 1, processTimeMs: 0
65
+ ╰ Metadata: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 0, processTimeMs: 0
47
66
  ╰ Unused Definitions (unused-definitions): no findings
48
67
  ╰ Network Functions (network-functions): no findings
49
68
  ╰ Dataframe Access Validation (dataframe-access-validation): no findings
@@ -54,7 +73,7 @@ It offers a wide variety of features, for example:
54
73
  ╰ Roxygen Arguments (roxygen-arguments): no findings
55
74
  ╰ No Leaked Credentials (no-leaked-credentials): no findings
56
75
  ╰ Undefined Symbol (undefined-symbol): no findings
57
- All queries together required ≈9 ms (1ms accuracy, total 9 ms)
76
+ All queries together required ≈4 ms (1ms accuracy, total 4 ms)
58
77
  ```
59
78
 
60
79
 
@@ -76,17 +95,17 @@ It offers a wide variety of features, for example:
76
95
 
77
96
  _Results (prettified and summarized):_
78
97
 
79
- Query: **linter** (11 ms)\
98
+ Query: **linter** (5 ms)\
80
99
  &nbsp;&nbsp;&nbsp;╰ **Deprecated Functions** (deprecated-functions): _no findings_\
81
100
  &nbsp;&nbsp;&nbsp;╰ **File Path Validity** (file-path-validity):\
82
101
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ certain:\
83
102
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ Path `/root/x.txt` at 1.1-23\
84
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 0\
103
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs: 1\
85
104
  &nbsp;&nbsp;&nbsp;╰ **Seeded Randomness** (seeded-randomness): _no findings_\
86
105
  &nbsp;&nbsp;&nbsp;╰ **Absolute Paths** (absolute-file-paths):\
87
106
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ certain:\
88
107
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ Path `/root/x.txt` at 1.1-23\
89
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 0, processTimeMs: 0\
108
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 1, processTimeMs: 0\
90
109
  &nbsp;&nbsp;&nbsp;╰ **Unused Definitions** (unused-definitions): _no findings_\
91
110
  &nbsp;&nbsp;&nbsp;╰ **Network Functions** (network-functions): _no findings_\
92
111
  &nbsp;&nbsp;&nbsp;╰ **Dataframe Access Validation** (dataframe-access-validation): _no findings_\
@@ -97,11 +116,11 @@ It offers a wide variety of features, for example:
97
116
  &nbsp;&nbsp;&nbsp;╰ **Roxygen Arguments** (roxygen-arguments): _no findings_\
98
117
  &nbsp;&nbsp;&nbsp;╰ **No Leaked Credentials** (no-leaked-credentials): _no findings_\
99
118
  &nbsp;&nbsp;&nbsp;╰ **Undefined Symbol** (undefined-symbol): _no findings_\
100
- _All queries together required ≈11 ms (1ms accuracy, total 12 ms)_
119
+ _All queries together required ≈5 ms (1ms accuracy, total 5 ms)_
101
120
 
102
121
  <details> <summary style="color:gray">Show Detailed Results as Json</summary>
103
122
 
104
- The analysis required _12.4 ms_ (including parsing and normalization and the query) within the generation environment.
123
+ The analysis required _4.8 ms_ (including parsing and normalization and the query) within the generation environment.
105
124
 
106
125
  In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
107
126
  Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
@@ -118,8 +137,8 @@ It offers a wide variety of features, for example:
118
137
  ".meta": {
119
138
  "totalCalls": 0,
120
139
  "totalFunctionDefinitions": 0,
121
- "searchTimeMs": 3,
122
- "processTimeMs": 1
140
+ "searchTimeMs": 2,
141
+ "processTimeMs": 0
123
142
  }
124
143
  },
125
144
  "file-path-validity": {
@@ -141,8 +160,8 @@ It offers a wide variety of features, for example:
141
160
  "totalUnknown": 0,
142
161
  "totalWritesBeforeAlways": 0,
143
162
  "totalValid": 0,
144
- "searchTimeMs": 1,
145
- "processTimeMs": 0
163
+ "searchTimeMs": 0,
164
+ "processTimeMs": 1
146
165
  }
147
166
  },
148
167
  "seeded-randomness": {
@@ -153,7 +172,7 @@ It offers a wide variety of features, for example:
153
172
  "callsWithAssignmentProducers": 0,
154
173
  "callsWithNonConstantProducers": 0,
155
174
  "callsWithOtherBranchProducers": 0,
156
- "searchTimeMs": 1,
175
+ "searchTimeMs": 0,
157
176
  "processTimeMs": 0
158
177
  }
159
178
  },
@@ -173,7 +192,7 @@ It offers a wide variety of features, for example:
173
192
  ".meta": {
174
193
  "totalConsidered": 1,
175
194
  "totalUnknown": 0,
176
- "searchTimeMs": 0,
195
+ "searchTimeMs": 1,
177
196
  "processTimeMs": 0
178
197
  }
179
198
  },
@@ -182,7 +201,7 @@ It offers a wide variety of features, for example:
182
201
  ".meta": {
183
202
  "totalConsidered": 0,
184
203
  "searchTimeMs": 0,
185
- "processTimeMs": 1
204
+ "processTimeMs": 0
186
205
  }
187
206
  },
188
207
  "network-functions": {
@@ -201,7 +220,7 @@ It offers a wide variety of features, for example:
201
220
  "numAccesses": 0,
202
221
  "totalAccessed": 0,
203
222
  "searchTimeMs": 0,
204
- "processTimeMs": 1
223
+ "processTimeMs": 0
205
224
  }
206
225
  },
207
226
  "dead-code": {
@@ -223,7 +242,7 @@ It offers a wide variety of features, for example:
223
242
  "results": [],
224
243
  ".meta": {
225
244
  "searchTimeMs": 0,
226
- "processTimeMs": 0
245
+ "processTimeMs": 1
227
246
  }
228
247
  },
229
248
  "stop-call": {
@@ -262,16 +281,16 @@ It offers a wide variety of features, for example:
262
281
  "subscript": 0
263
282
  },
264
283
  "searchTimeMs": 0,
265
- "processTimeMs": 3
284
+ "processTimeMs": 0
266
285
  }
267
286
  }
268
287
  },
269
288
  ".meta": {
270
- "timing": 11
289
+ "timing": 5
271
290
  }
272
291
  },
273
292
  ".meta": {
274
- "timing": 11
293
+ "timing": 5
275
294
  }
276
295
  }
277
296
  ```
@@ -335,7 +354,7 @@ It offers a wide variety of features, for example:
335
354
 
336
355
  ```shell
337
356
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
338
- flowR repl v2.13.0, R grammar v14 (tree-sitter engine)
357
+ flowR repl v2.13.2, R grammar v14 (tree-sitter engine)
339
358
  R> :query @static-slice (11@sum) file://test/testfiles/example.R
340
359
  ```
341
360
 
@@ -349,7 +368,7 @@ It offers a wide variety of features, for example:
349
368
  N <- 10
350
369
  for(i in 1:(N-1)) sum <- sum + i + w
351
370
  sum
352
- All queries together required ≈6 ms (1ms accuracy, total 7 ms)
371
+ All queries together required ≈3 ms (1ms accuracy, total 3 ms)
353
372
  ```
354
373
 
355
374
 
@@ -363,25 +382,8 @@ It offers a wide variety of features, for example:
363
382
 
364
383
  </details>
365
384
 
366
- * 📚 **dependency analysis**\
367
- Given your analysis project, flowR offers a plethora of so-called [queries](https://github.com/flowr-analysis/flowr/wiki/query-api) to get more information about your code.
368
- An important query is the [dependencies query](https://github.com/flowr-analysis/flowr/wiki/%5BQuery%5D-Dependencies), which shows you the library your project needs,
369
- the data files it reads, the scripts it sources, and the data it outputs.
370
-
371
-
372
- <details><summary>Example: Dependency Analysis with flowR</summary>
373
-
374
-
375
- The following showcases the dependency view of the [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr):
376
-
377
- ![Dependency Analysis](https://raw.githubusercontent.com/flowr-analysis/vscode-flowr/refs/heads/main/media/dependencies.png)
378
-
379
-
380
-
381
- </details>
382
-
383
385
  * 🚀 **fast call-graph, data-, and control-flow graphs**\
384
- Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">104.8 ms</span></i> (as of Jul 20, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
386
+ Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">106.7 ms</span></i> (as of Jul 23, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
385
387
  _flowR_ can analyze the data- and control-flow of the average real-world R&nbsp;script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
386
388
  and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph#perspectives-cg).
387
389
 
@@ -417,7 +419,7 @@ It offers a wide variety of features, for example:
417
419
 
418
420
  ```shell
419
421
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
420
- flowR repl v2.13.0, R grammar v14 (tree-sitter engine)
422
+ flowR repl v2.13.2, R grammar v14 (tree-sitter engine)
421
423
  R> :dataflow* test/testfiles/example.R
422
424
  ```
423
425
 
@@ -690,7 +692,7 @@ It offers a wide variety of features, for example:
690
692
  ```
691
693
 
692
694
 
693
- (The analysis required _3.4 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
695
+ (The analysis required _1.9 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
694
696
 
695
697
 
696
698
 
@@ -136,6 +136,7 @@ function mapDataFrameIndexColRowAccess(access, inference, info) {
136
136
  colnames: columns?.map(col => typeof col === 'string' ? col : undefined)
137
137
  });
138
138
  }
139
+ // eslint-disable-next-line no-useless-assignment -- ends the chain
139
140
  operand = undefined;
140
141
  }
141
142
  }
@@ -1,4 +1,4 @@
1
- import { type ResolveInfo } from '../../../dataflow/eval/resolve/alias-tracking';
1
+ import type { ResolveInfo } from '../../../dataflow/eval/resolve/alias-tracking';
2
2
  import type { DataflowGraph } from '../../../dataflow/graph/graph';
3
3
  import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
4
4
  import type { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
@@ -851,6 +851,7 @@ function mapDataFrameSubset(args, params, inference, info) {
851
851
  colnames: selectedCols?.map(col => typeof col === 'string' ? col : undefined),
852
852
  ...(duplicateCols || mixedAccess ? { options: { duplicateCols: true } } : {})
853
853
  });
854
+ // eslint-disable-next-line no-useless-assignment -- ends the chain
854
855
  operand = undefined;
855
856
  }
856
857
  }
@@ -932,6 +933,7 @@ function mapDataFrameSelect(args, params, inference, info) {
932
933
  colnames: selectedCols?.map(col => typeof col === 'string' ? col : undefined),
933
934
  ...(renamedCols ? { options: { renamedCols: true } } : {})
934
935
  });
936
+ // eslint-disable-next-line no-useless-assignment -- ends the chain
935
937
  operand = undefined;
936
938
  }
937
939
  return result;
@@ -982,6 +984,7 @@ function mapDataFrameMutate(args, params, inference, info) {
982
984
  colnames: deletedCols,
983
985
  options: { maybe: true }
984
986
  });
987
+ // eslint-disable-next-line no-useless-assignment -- ends the chain
985
988
  operand = undefined;
986
989
  }
987
990
  return result;
@@ -1,5 +1,5 @@
1
1
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
- import { type AnyAbstractDomain } from './abstract-domain';
2
+ import type { AnyAbstractDomain } from './abstract-domain';
3
3
  /**
4
4
  * An interface for state-like domains that store abstract values for AST nodes.
5
5
  */
package/config.d.ts CHANGED
@@ -10,6 +10,7 @@ import type { FlowrAnalyzerContext } from './project/context/flowr-analyzer-cont
10
10
  import { ProjectKind } from './project/context/project-kind';
11
11
  import type { BuiltInFlowrPluginArgs, BuiltInFlowrPluginName } from './project/plugins/plugin-registry';
12
12
  import { type FlowrGasConfig } from './gas';
13
+ import type { InputClassifierConfig } from './queries/catalog/input-sources-query/simple-input-classifier';
13
14
  export declare enum VariableResolve {
14
15
  /** Don't resolve constants at all */
15
16
  Disabled = "disabled",
@@ -201,6 +202,13 @@ export interface FlowrConfig extends MergeableRecord {
201
202
  /** Rule names excluded from the *default* rule set (a rule requested explicitly still runs). */
202
203
  readonly disabledRules: string[];
203
204
  };
205
+ /**
206
+ * Teaches the {@link InputSourcesQuery|input-sources} analysis (and with it the `problematic-inputs` linter)
207
+ * about further frameworks. Everything here is *added* to what flowR already knows, so a shiny app keeps its
208
+ * `input` even when you declare your own. Usually set per {@link ProjectKind} via {@link specializeConfig}.
209
+ * @see {@link InputClassifierConfig} - for what the entries mean
210
+ */
211
+ readonly inputSources?: DeepWritable<InputClassifierConfig<string[]>>;
204
212
  /**
205
213
  * Overwrite (parts of) this configuration depending on the {@link ProjectKind} flowR detects for the project,
206
214
  * e.g. to give a shiny app its implicit sources. An entry may `inherit` another kind's overwrite (merged first,
package/config.js CHANGED
@@ -18,6 +18,7 @@ const joi_1 = __importDefault(require("joi"));
18
18
  const project_kind_1 = require("./project/context/project-kind");
19
19
  const object_path_1 = __importDefault(require("object-path"));
20
20
  const gas_1 = require("./gas");
21
+ const input_types_1 = require("./queries/catalog/input-sources-query/input-types");
21
22
  var VariableResolve;
22
23
  (function (VariableResolve) {
23
24
  /** Don't resolve constants at all */
@@ -221,7 +222,8 @@ exports.FlowrConfig = {
221
222
  [project_kind_1.ProjectKind.Package]: { solver: { resolveSource: { assumeFilesExist: true } } },
222
223
  [project_kind_1.ProjectKind.Project]: { solver: { resolveSource: { assumeFilesExist: true } } },
223
224
  [project_kind_1.ProjectKind.ShinyApp]: {
224
- project: { implicitSources: ['global.R', 'ui.R', 'server.R', 'app.R'] },
225
+ /* shiny evaluates global.R before the supporting files in R/, and the app itself last */
226
+ project: { implicitSources: ['global.R', 'R/*.R', 'ui.R', 'server.R', 'app.R'] },
225
227
  solver: { resolveSource: { assumeFilesExist: true } }
226
228
  },
227
229
  [project_kind_1.ProjectKind.Script]: { inherit: project_kind_1.ProjectKind.Unknown },
@@ -320,6 +322,12 @@ exports.FlowrConfig = {
320
322
  linter: joi_1.default.object({
321
323
  disabledRules: joi_1.default.array().items(joi_1.default.string()).description('Linting rule names excluded from the default rule set (a rule requested explicitly via a linter query still runs). Usually set per project kind via specializeConfig.')
322
324
  }).description('Linter configuration options.'),
325
+ inputSources: joi_1.default.object({
326
+ pure: joi_1.default.array().items(joi_1.default.string()).optional().description('Functions that only pass the constantness of their arguments on.'),
327
+ ...Object.fromEntries(Object.values(input_types_1.InputType).map(t => [t, joi_1.default.array().items(joi_1.default.string()).optional().description(`Functions whose result is a '${t}' input.`)])),
328
+ linkedObjects: joi_1.default.array().items(joi_1.default.object()).optional().description('Objects a framework provides without a definition in the code, e.g. shiny\'s input.'),
329
+ linkedEntryPoints: joi_1.default.array().items(joi_1.default.object()).optional().description('Calls that hand a function to a framework, which binds its objects to the parameters by position.')
330
+ }).optional().description('Further frameworks the input-sources analysis should know about; entries are added to flowR\'s defaults.'),
323
331
  specializeConfig: joi_1.default.object().pattern(joi_1.default.string().valid(...Object.values(project_kind_1.ProjectKind)), joi_1.default.object({
324
332
  inherit: joi_1.default.string().valid(...Object.values(project_kind_1.ProjectKind)).optional().description('Inherit another kind\'s overwrite first (merged before this entry\'s own keys, which win).')
325
333
  }).unknown(true)).optional()
@@ -224,7 +224,8 @@ exports.CfgVertex = {
224
224
  * @see {@link CfgVertex#getRootId|getRootId()} - for a way to get the root id of a vertex
225
225
  */
226
226
  getId(vertex) {
227
- return vertex === undefined ? undefined : (Array.isArray(vertex) ? vertex[1] : vertex);
227
+ const id = vertex === undefined ? undefined : (Array.isArray(vertex) ? vertex[1] : vertex);
228
+ return id;
228
229
  },
229
230
  /**
230
231
  * Check whether two vertices are equal, i.e., they have the same type, id, and if they are basic block vertices, they also have the same elements in the same order.
@@ -3,7 +3,7 @@ import { DataflowAwareCfgGuidedVisitor, type DataflowCfgGuidedVisitorConfigurati
3
3
  import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
4
4
  import type { SyntaxCfgGuidedVisitorConfiguration } from './syntax-cfg-guided-visitor';
5
5
  import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
6
- import { type Origin } from '../dataflow/origin/dfg-get-origin';
6
+ import type { Origin } from '../dataflow/origin/dfg-get-origin';
7
7
  import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexFunctionDefinition, DataflowGraphVertexUse, DataflowGraphVertexValue, DataflowGraphVertexVariableDefinition } from '../dataflow/graph/vertex';
8
8
  import type { RString } from '../r-bridge/lang-4.x/ast/model/nodes/r-string';
9
9
  import type { RNumber } from '../r-bridge/lang-4.x/ast/model/nodes/r-number';
@@ -1,7 +1,7 @@
1
1
  import { internalPrinter } from '../../../print/print';
2
2
  import { normalizedAstToJson, normalizedAstToQuads, printNormalizedAstToMermaid, printNormalizedAstToMermaidUrl } from '../../../print/normalize-printer';
3
3
  import { PipelineStepStage } from '../../pipeline-step';
4
- import { type NormalizeRequiredInput } from './10-normalize';
4
+ import type { NormalizeRequiredInput } from './10-normalize';
5
5
  import type { ParseStepOutput } from '../../../../r-bridge/parser';
6
6
  import type { Tree } from 'web-tree-sitter';
7
7
  declare function processor(results: {
@@ -1,4 +1,4 @@
1
- import { type REnvironmentInformation } from './environment';
1
+ import type { REnvironmentInformation } from './environment';
2
2
  import type { IdentifierDefinition } from './identifier';
3
3
  /**
4
4
  * Merges two arrays of identifier definitions into a fresh array, unique by `nodeId` and `definedAt`.
@@ -1,4 +1,4 @@
1
- import { type REnvironmentInformation } from './environment';
1
+ import type { REnvironmentInformation } from './environment';
2
2
  /**
3
3
  * Produce a clone of the given environment information.
4
4
  * @param environment - The environment information to clone.
@@ -102,10 +102,30 @@ export declare class Environment implements IEnvironment {
102
102
  }
103
103
  /** Walks up to the global environment (see {@link Environment#globalEnv}), falling back to the last non-builtin env. */
104
104
  declare function findGlobalEnvironment(this: void, env: Environment): Environment;
105
+ /** The `search()` position directly below the global environment; where R attaches by default. */
106
+ export declare const DefaultAttachPosition = 2;
107
+ /** Prefix of a package's entry in R's `search()` list. */
108
+ export declare const SearchPathPackagePrefix = "package:";
109
+ /** Name of the global environment in R's `search()` list. */
110
+ export declare const GlobalEnvEntryName = ".GlobalEnv";
105
111
  /**
106
- * Splices a package block (`blockTop`..`blockBottom`) directly below the global environment. Returns a fresh `current`, cloning only the path down to global.
112
+ * Splices a package block (`blockTop`..`blockBottom`) into the search path at the 1-based `search()` position `pos`
113
+ * ({@link DefaultAttachPosition|2} being directly below the global environment, the default). A position past the end
114
+ * of the search path attaches directly above the built-in environment, mirroring R's clamping. Returns a fresh
115
+ * `current`, cloning only the path down to the insertion point.
107
116
  */
108
- declare function attachPackageBelowGlobal(this: void, current: Environment, blockTop: Environment, blockBottom: Environment): Environment;
117
+ declare function attachPackageAt(this: void, current: Environment, blockTop: Environment, blockBottom: Environment, pos?: number): Environment;
118
+ /**
119
+ * The 1-based `search()` position of the entry called `name` (`.GlobalEnv`, `package:x`, or a bare package name),
120
+ * or `undefined` if no such entry is on the search path. `package:base` resolves to the built-in environment at the
121
+ * very bottom if base R is not attached as its own layer.
122
+ */
123
+ declare function searchPositionOf(this: void, env: Environment, name: string): number | undefined;
124
+ /**
125
+ * The packages attached below the global environment, i.e. those whose exports R resolves without a namespace.
126
+ * Base is always among them, as it backs the built-in environment even when it is no layer of its own.
127
+ */
128
+ declare function attachedPackagesOf(this: void, env: Environment): Set<string>;
109
129
  /**
110
130
  * Helpers for navigating and manipulating {@link REnvironmentInformation|environments} around the global environment and attached-package search path.
111
131
  */
@@ -113,8 +133,12 @@ export declare const REnvironment: {
113
133
  readonly name: "REnvironment";
114
134
  /** Walks up to the global environment (`.GlobalEnv`); see {@link findGlobalEnvironment}. */
115
135
  readonly findGlobal: typeof findGlobalEnvironment;
116
- /** Attaches a package block below the global environment; see {@link attachPackageBelowGlobal}. */
117
- readonly attachBelowGlobal: typeof attachPackageBelowGlobal;
136
+ /** Attaches a package block at a `search()` position, below the global by default; see {@link attachPackageAt}. */
137
+ readonly attachAt: typeof attachPackageAt;
138
+ /** The `search()` position of a named entry; see {@link searchPositionOf}. */
139
+ readonly searchPosition: typeof searchPositionOf;
140
+ /** The packages on the search path; see {@link attachedPackagesOf}. */
141
+ readonly attachedPackages: typeof attachedPackagesOf;
118
142
  };
119
143
  /**
120
144
  * An environment describes a ({@link IEnvironment#parent|scoped}) mapping of names to their definitions ({@link BuiltIns}).
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REnvironment = exports.Environment = exports.EnvType = void 0;
3
+ exports.REnvironment = exports.GlobalEnvEntryName = exports.SearchPathPackagePrefix = exports.DefaultAttachPosition = exports.Environment = exports.EnvType = void 0;
4
4
  exports.isDefaultBuiltInEnvironment = isDefaultBuiltInEnvironment;
5
5
  exports.builtInEnvJsonReplacer = builtInEnvJsonReplacer;
6
6
  /**
@@ -381,20 +381,71 @@ function findGlobalEnvironment(env) {
381
381
  }
382
382
  return current;
383
383
  }
384
+ /** The `search()` position directly below the global environment; where R attaches by default. */
385
+ exports.DefaultAttachPosition = 2;
386
+ /** Prefix of a package's entry in R's `search()` list. */
387
+ exports.SearchPathPackagePrefix = 'package:';
388
+ /** Name of the global environment in R's `search()` list. */
389
+ exports.GlobalEnvEntryName = '.GlobalEnv';
384
390
  /**
385
- * Splices a package block (`blockTop`..`blockBottom`) directly below the global environment. Returns a fresh `current`, cloning only the path down to global.
391
+ * Splices a package block (`blockTop`..`blockBottom`) into the search path at the 1-based `search()` position `pos`
392
+ * ({@link DefaultAttachPosition|2} being directly below the global environment, the default). A position past the end
393
+ * of the search path attaches directly above the built-in environment, mirroring R's clamping. Returns a fresh
394
+ * `current`, cloning only the path down to the insertion point.
386
395
  */
387
- function attachPackageBelowGlobal(current, blockTop, blockBottom) {
396
+ function attachPackageAt(current, blockTop, blockBottom, pos = exports.DefaultAttachPosition) {
388
397
  const clonedCurrent = current.clone(false);
389
- let global = clonedCurrent;
390
- while (!global.globalEnv && !global.parent.builtInEnv) {
391
- global.parent = global.parent.clone(false);
392
- global = global.parent;
398
+ let anchor = clonedCurrent;
399
+ while (!anchor.globalEnv && !anchor.parent.builtInEnv) {
400
+ anchor.parent = anchor.parent.clone(false);
401
+ anchor = anchor.parent;
393
402
  }
394
- blockBottom.parent = global.parent; // the built-in env, or the previously attached packages
395
- global.parent = blockTop;
403
+ /* walk past the `pos - 2` search entries below the global; an imports layer belongs to the entry above it and is never one itself */
404
+ for (let skip = pos - exports.DefaultAttachPosition; skip > 0 && !anchor.parent.builtInEnv; skip--) {
405
+ do {
406
+ anchor.parent = anchor.parent.clone(false);
407
+ anchor = anchor.parent;
408
+ } while (anchor.parent.t === EnvType.Imports);
409
+ }
410
+ blockBottom.parent = anchor.parent; // the built-in env, or the packages attached further down
411
+ anchor.parent = blockTop;
396
412
  return clonedCurrent;
397
413
  }
414
+ /**
415
+ * The 1-based `search()` position of the entry called `name` (`.GlobalEnv`, `package:x`, or a bare package name),
416
+ * or `undefined` if no such entry is on the search path. `package:base` resolves to the built-in environment at the
417
+ * very bottom if base R is not attached as its own layer.
418
+ */
419
+ function searchPositionOf(env, name) {
420
+ const target = name.startsWith(exports.SearchPathPackagePrefix) ? name.slice(exports.SearchPathPackagePrefix.length) : name;
421
+ if (target === exports.GlobalEnvEntryName) {
422
+ return 1;
423
+ }
424
+ let pos = 1;
425
+ for (let e = findGlobalEnvironment(env).parent; !e.builtInEnv; e = e.parent) {
426
+ if (e.t === EnvType.Imports) {
427
+ continue; // internal layer, not a search-path entry
428
+ }
429
+ pos++;
430
+ if (e.n === target) {
431
+ return pos;
432
+ }
433
+ }
434
+ return target === "base" /* PkgName.Base */ ? pos + 1 : undefined; // base is the built-in env when it is not attached as a layer
435
+ }
436
+ /**
437
+ * The packages attached below the global environment, i.e. those whose exports R resolves without a namespace.
438
+ * Base is always among them, as it backs the built-in environment even when it is no layer of its own.
439
+ */
440
+ function attachedPackagesOf(env) {
441
+ const attached = new Set(["base" /* PkgName.Base */]);
442
+ for (let e = findGlobalEnvironment(env).parent; !e.builtInEnv; e = e.parent) {
443
+ if (e.t !== EnvType.Imports && e.n !== undefined) {
444
+ attached.add(e.n);
445
+ }
446
+ }
447
+ return attached;
448
+ }
398
449
  /**
399
450
  * Helpers for navigating and manipulating {@link REnvironmentInformation|environments} around the global environment and attached-package search path.
400
451
  */
@@ -402,8 +453,12 @@ exports.REnvironment = {
402
453
  name: 'REnvironment',
403
454
  /** Walks up to the global environment (`.GlobalEnv`); see {@link findGlobalEnvironment}. */
404
455
  findGlobal: findGlobalEnvironment,
405
- /** Attaches a package block below the global environment; see {@link attachPackageBelowGlobal}. */
406
- attachBelowGlobal: attachPackageBelowGlobal,
456
+ /** Attaches a package block at a `search()` position, below the global by default; see {@link attachPackageAt}. */
457
+ attachAt: attachPackageAt,
458
+ /** The `search()` position of a named entry; see {@link searchPositionOf}. */
459
+ searchPosition: searchPositionOf,
460
+ /** The packages on the search path; see {@link attachedPackagesOf}. */
461
+ attachedPackages: attachedPackagesOf,
407
462
  };
408
463
  /** Splits a package block (a contiguous run of attached-package layers, see {@link EnvType}) into its layers and the env below them. */
409
464
  function splitLibraryLayers(env) {
@@ -1,4 +1,4 @@
1
- import { type REnvironmentInformation } from './environment';
1
+ import type { REnvironmentInformation } from './environment';
2
2
  import type { ControlDependency } from '../info';
3
3
  export declare function overwriteEnvironment(base: REnvironmentInformation, next: REnvironmentInformation | undefined, applyCds?: readonly ControlDependency[]): REnvironmentInformation;
4
4
  export declare function overwriteEnvironment(base: REnvironmentInformation | undefined, next: REnvironmentInformation, applyCds?: readonly ControlDependency[]): REnvironmentInformation;
@@ -1,7 +1,7 @@
1
1
  import { VariableResolve } from '../../../config';
2
2
  import type { AstIdMap, RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
3
  import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
- import { type REnvironmentInformation } from '../../environments/environment';
4
+ import type { REnvironmentInformation } from '../../environments/environment';
5
5
  import { Identifier } from '../../environments/identifier';
6
6
  import type { DataflowGraph } from '../../graph/graph';
7
7
  import { type Lift, type Value, type ValueSet } from '../values/r-value';
@@ -1,7 +1,7 @@
1
1
  import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
2
  import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
3
  import { type DataflowFunctionFlowInformation, DataflowGraph, FunctionArgument } from './graph';
4
- import { type IEnvironment, type REnvironmentInformation } from '../environments/environment';
4
+ import type { IEnvironment, REnvironmentInformation } from '../environments/environment';
5
5
  import { type DataflowGraphVertexFunctionDefinition, type DataflowGraphVertexArgument, type DataflowGraphVertexAstLink, type DataflowGraphVertexInfo, type DataflowGraphVertexUse, type FunctionOriginInformation } from './vertex';
6
6
  import type { ControlDependency, ExitPoint } from '../info';
7
7
  import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
@@ -4,7 +4,7 @@ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/
4
4
  import type { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
5
5
  import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
6
  import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
7
- import { type NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
8
8
  import { Identifier, type InGraphIdentifierDefinition } from '../../../../../environments/identifier';
9
9
  import type { DataflowGraphVertexFunctionDefinition } from '../../../../../graph/vertex';
10
10
  import type { ForceArguments } from '../common';
@@ -41,7 +41,7 @@ function processAttach(name, args, rootId, data) {
41
41
  const attachedLayer = new environment_1.Environment(result.environment.current).defineAll(injected);
42
42
  /* R attaches below `.GlobalEnv`, so existing global bindings shadow the attached ones */
43
43
  return { ...result, environment: {
44
- current: environment_1.REnvironment.attachBelowGlobal(result.environment.current, attachedLayer, attachedLayer),
44
+ current: environment_1.REnvironment.attachAt(result.environment.current, attachedLayer, attachedLayer),
45
45
  level: result.environment.level
46
46
  } };
47
47
  }
@@ -42,3 +42,10 @@ export declare function resolveSymbolToEnvir<OtherInfo>(symbolName: Identifier,
42
42
  export declare function routeWrittenToCustomEnv(result: DataflowInformation, envDef: NamedInGraphIdentifierDefinition & {
43
43
  envState: REnvironmentInformation;
44
44
  }, newDefAt: NodeId, definedAt?: NodeId): DataflowInformation;
45
+ /**
46
+ * The `search()` position the `pos` argument of a `library()` call requests, either given as a number or as the name of
47
+ * an existing entry (`pos = "package:base"`). Returns `undefined` when there is no such argument, its value is unknown
48
+ * or ambiguous, or it names an entry that is not on the search path; callers then attach at {@link DefaultAttachPosition}
49
+ * (as R does, which warns in the last case).
50
+ */
51
+ export declare function resolveAttachPosition<OtherInfo>(posId: NodeId | undefined, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): number | undefined;