@eagleoutice/flowr 2.13.8 → 2.13.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/config.d.ts +50 -2
  2. package/config.js +37 -6
  3. package/dataflow/cluster.js +48 -24
  4. package/dataflow/environments/apply-kill.js +4 -4
  5. package/dataflow/environments/built-in-props.d.ts +28 -4
  6. package/dataflow/environments/built-in-props.js +31 -8
  7. package/dataflow/environments/built-in.d.ts +7 -2
  8. package/dataflow/environments/built-in.js +10 -12
  9. package/dataflow/environments/default-builtin-config.d.ts +76 -6
  10. package/dataflow/environments/default-builtin-config.js +39 -16
  11. package/dataflow/environments/environment.d.ts +16 -0
  12. package/dataflow/environments/environment.js +70 -18
  13. package/dataflow/environments/identifier.d.ts +6 -0
  14. package/dataflow/environments/identifier.js +18 -5
  15. package/dataflow/environments/query-fn-props.js +34 -2
  16. package/dataflow/environments/reference-to-maybe.js +1 -1
  17. package/dataflow/eval/resolve/alias-tracking.js +45 -1
  18. package/dataflow/eval/resolve/resolve-argument.js +25 -17
  19. package/dataflow/eval/resolve/resolve-strings.d.ts +17 -0
  20. package/dataflow/eval/resolve/resolve-strings.js +16 -9
  21. package/dataflow/eval/resolve/resolve.js +3 -1
  22. package/dataflow/graph/call-graph.d.ts +7 -0
  23. package/dataflow/graph/call-graph.js +103 -0
  24. package/dataflow/graph/df-helper.d.ts +2 -0
  25. package/dataflow/graph/graph.d.ts +6 -8
  26. package/dataflow/graph/graph.js +21 -6
  27. package/dataflow/internal/linker.d.ts +5 -5
  28. package/dataflow/internal/linker.js +31 -92
  29. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  30. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +3 -9
  31. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +4 -30
  32. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
  33. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
  34. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -1
  35. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
  36. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
  37. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +5 -1
  38. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +2 -2
  39. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -6
  40. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +32 -14
  41. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +16 -4
  42. package/dataflow/internal/process/functions/call/known-call-handling.js +29 -8
  43. package/documentation/doc-util/doc-sigdb.d.ts +9 -0
  44. package/documentation/doc-util/doc-sigdb.js +32 -0
  45. package/documentation/wiki-interface.js +13 -2
  46. package/documentation/wiki-query.js +3 -0
  47. package/documentation/wiki-signature-database.js +2 -5
  48. package/gas.d.ts +6 -0
  49. package/gas.js +7 -1
  50. package/package.json +2 -2
  51. package/project/attached-packages.d.ts +13 -0
  52. package/project/attached-packages.js +30 -0
  53. package/project/context/flowr-analyzer-context.d.ts +15 -0
  54. package/project/context/flowr-analyzer-context.js +14 -3
  55. package/project/context/flowr-analyzer-files-context.d.ts +11 -0
  56. package/project/context/flowr-analyzer-files-context.js +3 -0
  57. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -0
  58. package/project/context/flowr-analyzer-incremental-analysis-context.js +69 -0
  59. package/project/dependency-version-space.d.ts +45 -8
  60. package/project/dependency-version-space.js +86 -26
  61. package/project/plugins/file-plugins/files/flowr-namespace-file.js +52 -24
  62. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.d.ts +22 -0
  63. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +101 -0
  64. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +30 -11
  65. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +79 -37
  66. package/project/plugins/package-version-plugins/package.d.ts +2 -0
  67. package/project/plugins/package-version-plugins/package.js +4 -0
  68. package/project/plugins/plugin-registry.d.ts +2 -1
  69. package/project/plugins/plugin-registry.js +2 -0
  70. package/project/sigdb/manifest.js +9 -5
  71. package/project/sigdb/signature-match.d.ts +5 -18
  72. package/project/sigdb/signature-match.js +5 -18
  73. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +4 -2
  74. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +25 -0
  75. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  76. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +4 -0
  77. package/queries/catalog/call-graph-query/call-graph-query-format.js +4 -0
  78. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +11 -1
  79. package/queries/catalog/dependencies-query/dependencies-query-executor.js +13 -5
  80. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +27 -1
  81. package/queries/catalog/dependencies-query/dependencies-query-format.js +69 -7
  82. package/queries/catalog/dependencies-query/function-info/library-functions.js +9 -2
  83. package/queries/catalog/dependencies-query/function-info/read-functions.js +31 -5
  84. package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +18 -0
  85. package/queries/catalog/dependencies-query/function-info/remote-functions.js +46 -0
  86. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  87. package/queries/catalog/dependencies-query/function-info/test-functions.js +33 -31
  88. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +52 -2
  89. package/queries/catalog/dependencies-query/function-info/write-functions.js +28 -5
  90. package/queries/catalog/dependencies-query/link-devices.d.ts +12 -0
  91. package/queries/catalog/dependencies-query/link-devices.js +58 -0
  92. package/queries/catalog/dice-query/dice-query-format.d.ts +2 -0
  93. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +25 -6
  94. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +38 -7
  95. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +18 -5
  96. package/queries/catalog/happens-before-query/happens-before-query-format.js +3 -2
  97. package/queries/catalog/input-sources-query/input-sources-query-format.js +4 -0
  98. package/queries/catalog/input-sources-query/input-types.d.ts +10 -0
  99. package/queries/catalog/input-sources-query/input-types.js +10 -0
  100. package/queries/catalog/location-map-query/location-map-query-executor.js +16 -6
  101. package/queries/catalog/location-map-query/location-map-query-format.d.ts +15 -1
  102. package/queries/catalog/location-map-query/location-map-query-format.js +22 -5
  103. package/queries/catalog/signature-query/signature-query-executor.js +3 -0
  104. package/queries/catalog/signature-query/signature-query-format.d.ts +5 -0
  105. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  106. package/queries/query.d.ts +1 -1
  107. package/r-bridge/data/data.d.ts +1 -1
  108. package/r-bridge/data/data.js +1 -1
  109. package/r-bridge/lang-4.x/ast/model/model.d.ts +14 -2
  110. package/r-bridge/lang-4.x/ast/model/model.js +32 -0
  111. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
  112. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -0
  113. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
  114. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
  115. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
  116. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
  117. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
  118. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +7 -8
  119. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +9 -46
  120. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
  121. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
  122. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
  123. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
  124. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
  125. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
  126. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
  127. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
  128. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
  129. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +2 -0
  130. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
  131. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
  132. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
  133. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +0 -5
  134. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +6 -3
  135. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
  136. package/search/flowr-search-filters.d.ts +17 -1
  137. package/search/flowr-search-filters.js +23 -0
  138. package/slicing/criterion/parse.d.ts +6 -25
  139. package/slicing/criterion/parse.js +50 -19
  140. package/slicing/static/fingerprint.d.ts +1 -1
  141. package/slicing/static/fingerprint.js +52 -8
  142. package/slicing/static/slicer-types.d.ts +10 -0
  143. package/slicing/static/static-slicer.d.ts +1 -1
  144. package/slicing/static/static-slicer.js +29 -6
  145. package/slicing/static/visiting-queue.d.ts +15 -3
  146. package/slicing/static/visiting-queue.js +37 -3
  147. package/util/arg-matching.d.ts +18 -0
  148. package/util/arg-matching.js +70 -0
  149. package/util/r-regex.js +19 -1
  150. package/util/range.d.ts +7 -8
  151. package/util/range.js +10 -11
  152. package/util/version.js +1 -1
@@ -1,26 +1,13 @@
1
1
  import type { FunctionArgument } from '../../dataflow/graph/graph';
2
2
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
3
  import type { SigParameter } from './decode';
4
- /**
5
- * The {@link pMatch} parameter spec for a *known* signature (e.g. one resolved from the signature database):
6
- * every formal parameter name maps to itself as its own target. A `...` parameter is kept as-is, so `pMatch`
7
- * collects the overflow/unmatched arguments into it exactly as R does; a signature without `...` simply leaves
8
- * extra arguments unbound.
9
- */
4
+ /** the {@link pMatch} parameter spec of a *known* signature: every formal maps to itself as its own target */
10
5
  export declare function signatureParameterSpec(signature: readonly SigParameter[]): Record<string, string>;
11
6
  /**
12
- * Match a call's `args` against a *known* signature using R's argument-matching rules via the canonical
13
- * {@link pMatch} (exact name, then partial `pmatch`, then positional; `...` collects the rest). Returns a map
14
- * from parameter name to the id(s) of the argument(s) bound to it, so
15
- * `matchArgumentsToSignature(ggplotCall.args, ggplotSignature).get('data')` yields the node(s) passed as
16
- * ggplot's `data` argument. The signature typically comes from the signature database (a {@link SigParameter}
17
- * list, e.g. via `PackageSignatureSource.functions(pkg)`).
7
+ * {@link pMatch|Matches} a call's `args` against a *known* signature (typically from the signature database via
8
+ * `PackageSignatureSource.functions(pkg)`), returning per parameter name the id(s) bound to it, e.g.
9
+ * `matchArgumentsToSignature(ggplotCall.args, ggplotSignature).get('data')`.
18
10
  */
19
11
  export declare function matchArgumentsToSignature(args: readonly FunctionArgument[], signature: readonly SigParameter[]): Map<string, NodeId[]>;
20
- /**
21
- * The id(s) of the argument bound to a single named `parameter` of a *known* signature, or `undefined` when
22
- * nothing is bound to it. A convenience over {@link matchArgumentsToSignature} for the common
23
- * "give me one parameter's argument" query, e.g.
24
- * `argumentForParameter(ggplotCall.args, ggplotSignature, 'data')` returns ggplot's `data` argument node(s).
25
- */
12
+ /** the id(s) {@link matchArgumentsToSignature} binds to a single `parameter`, `undefined` if nothing is */
26
13
  export declare function argumentForParameter(args: readonly FunctionArgument[], signature: readonly SigParameter[], parameter: string): NodeId[] | undefined;
@@ -4,12 +4,7 @@ exports.signatureParameterSpec = signatureParameterSpec;
4
4
  exports.matchArgumentsToSignature = matchArgumentsToSignature;
5
5
  exports.argumentForParameter = argumentForParameter;
6
6
  const linker_1 = require("../../dataflow/internal/linker");
7
- /**
8
- * The {@link pMatch} parameter spec for a *known* signature (e.g. one resolved from the signature database):
9
- * every formal parameter name maps to itself as its own target. A `...` parameter is kept as-is, so `pMatch`
10
- * collects the overflow/unmatched arguments into it exactly as R does; a signature without `...` simply leaves
11
- * extra arguments unbound.
12
- */
7
+ /** the {@link pMatch} parameter spec of a *known* signature: every formal maps to itself as its own target */
13
8
  function signatureParameterSpec(signature) {
14
9
  const spec = {};
15
10
  for (const p of signature) {
@@ -18,22 +13,14 @@ function signatureParameterSpec(signature) {
18
13
  return spec;
19
14
  }
20
15
  /**
21
- * Match a call's `args` against a *known* signature using R's argument-matching rules via the canonical
22
- * {@link pMatch} (exact name, then partial `pmatch`, then positional; `...` collects the rest). Returns a map
23
- * from parameter name to the id(s) of the argument(s) bound to it, so
24
- * `matchArgumentsToSignature(ggplotCall.args, ggplotSignature).get('data')` yields the node(s) passed as
25
- * ggplot's `data` argument. The signature typically comes from the signature database (a {@link SigParameter}
26
- * list, e.g. via `PackageSignatureSource.functions(pkg)`).
16
+ * {@link pMatch|Matches} a call's `args` against a *known* signature (typically from the signature database via
17
+ * `PackageSignatureSource.functions(pkg)`), returning per parameter name the id(s) bound to it, e.g.
18
+ * `matchArgumentsToSignature(ggplotCall.args, ggplotSignature).get('data')`.
27
19
  */
28
20
  function matchArgumentsToSignature(args, signature) {
29
21
  return (0, linker_1.pMatch)(args, signatureParameterSpec(signature));
30
22
  }
31
- /**
32
- * The id(s) of the argument bound to a single named `parameter` of a *known* signature, or `undefined` when
33
- * nothing is bound to it. A convenience over {@link matchArgumentsToSignature} for the common
34
- * "give me one parameter's argument" query, e.g.
35
- * `argumentForParameter(ggplotCall.args, ggplotSignature, 'data')` returns ggplot's `data` argument node(s).
36
- */
23
+ /** the id(s) {@link matchArgumentsToSignature} binds to a single `parameter`, `undefined` if nothing is */
37
24
  function argumentForParameter(args, signature, parameter) {
38
25
  return matchArgumentsToSignature(args, signature).get(parameter);
39
26
  }
@@ -7,6 +7,7 @@ import type { LinkToLastCall } from './call-context-query-format';
7
7
  import type { PromotedLinkTo } from './call-context-query-executor';
8
8
  import type { ReadonlyFlowrAnalysisProvider } from '../../../project/flowr-analyzer';
9
9
  import type { ControlFlowGraph } from '../../../control-flow/control-flow-graph';
10
+ type KnownCalls = Map<NodeId, Required<DataflowGraphVertexFunctionCall>>;
10
11
  export declare enum CallTargets {
11
12
  /** call targets a function that is not defined locally in the script (e.g., the call targets a library function) */
12
13
  OnlyGlobal = "global",
@@ -41,8 +42,9 @@ export declare function getValueOfArgument<Types extends readonly RType[] = read
41
42
  * the known calls available.
42
43
  * @see {@link identifyLinkToLastCallRelationSync} for the synchronous version.
43
44
  */
44
- export declare function identifyLinkToLastCallRelation(from: NodeId, analyzer: ReadonlyFlowrAnalysisProvider, l: LinkToLastCall<RegExp> | PromotedLinkTo<LinkToLastCall<RegExp>>, knownCalls?: Map<NodeId, Required<DataflowGraphVertexFunctionCall>>): Promise<NodeId[]>;
45
+ export declare function identifyLinkToLastCallRelation(from: NodeId, analyzer: ReadonlyFlowrAnalysisProvider, l: LinkToLastCall<RegExp> | PromotedLinkTo<LinkToLastCall<RegExp>>, knownCalls?: KnownCalls): Promise<NodeId[]>;
45
46
  /**
46
47
  * Synchronous version of {@link identifyLinkToLastCallRelation}.
47
48
  */
48
- export declare function identifyLinkToLastCallRelationSync(from: NodeId, cfg: ControlFlowGraph, graph: DataflowGraph, { callName, cascadeIf, ignoreIf }: LinkToLastCall<RegExp> | PromotedLinkTo<LinkToLastCall<RegExp>>, knownCalls?: Map<NodeId, Required<DataflowGraphVertexFunctionCall>>): NodeId[];
49
+ export declare function identifyLinkToLastCallRelationSync(from: NodeId, cfg: ControlFlowGraph, graph: DataflowGraph, { callName, cascadeIf, ignoreIf }: LinkToLastCall<RegExp> | PromotedLinkTo<LinkToLastCall<RegExp>>, knownCalls?: KnownCalls): NodeId[];
50
+ export {};
@@ -133,6 +133,25 @@ async function identifyLinkToLastCallRelation(from, analyzer, l, knownCalls) {
133
133
  const cfg = (await analyzer.controlflow([], cfg_kind_1.CfgKind.WithDataflow)).graph;
134
134
  return identifyLinkToLastCallRelationSync(from, cfg, graph, l, knownCalls);
135
135
  }
136
+ /**
137
+ * Memoizes, per set of known calls and per `callName`, whether any call can match it at all. One link keeps the same
138
+ * `callName` object across every call site it is evaluated against, so identity is enough to key it.
139
+ */
140
+ const candidatesPerCallSet = new WeakMap();
141
+ function anyCallMatches(knownCalls, callName, matches) {
142
+ let perName = candidatesPerCallSet.get(knownCalls);
143
+ if (perName === undefined) {
144
+ perName = new Map();
145
+ candidatesPerCallSet.set(knownCalls, perName);
146
+ }
147
+ const cached = perName.get(callName);
148
+ if (cached !== undefined) {
149
+ return cached;
150
+ }
151
+ const matched = knownCalls.values().some(matches);
152
+ perName.set(callName, matched);
153
+ return matched;
154
+ }
136
155
  /**
137
156
  * Synchronous version of {@link identifyLinkToLastCallRelation}.
138
157
  */
@@ -143,6 +162,12 @@ function identifyLinkToLastCallRelationSync(from, cfg, graph, { callName, cascad
143
162
  const found = [];
144
163
  const cNameCheck = callName instanceof RegExp ? ({ name }) => callName.test(identifier_1.Identifier.getName(name))
145
164
  : ({ name }) => callName(identifier_1.Identifier.getName(name));
165
+ /* only a call matching `callName` is ever collected, so with none in the whole graph every walk below returns
166
+ * nothing: skipping them turns one reverse walk per call site into a single scan (a `sink` redirect in a
167
+ * script that never sinks is the common case) */
168
+ if (knownCalls !== undefined && !anyCallMatches(knownCalls, callName, cNameCheck)) {
169
+ return [];
170
+ }
146
171
  const getVertex = knownCalls ?
147
172
  (node) => knownCalls.get(node) :
148
173
  (node) => {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeCallGraphQuery = executeCallGraphQuery;
4
4
  const log_1 = require("../../../util/log");
5
5
  const expand_library_internals_1 = require("./expand-library-internals");
6
+ const call_graph_1 = require("../../../dataflow/graph/call-graph");
6
7
  /**
7
8
  * Executes the given call graph queries.
8
9
  */
@@ -17,7 +18,8 @@ async function executeCallGraphQuery({ analyzer }, queries) {
17
18
  '.meta': {
18
19
  timing: Date.now() - startTime
19
20
  },
20
- graph: expand ? (0, expand_library_internals_1.expandCallGraphLibraryInternals)(graph, analyzer.inspectContext().deps) : graph
21
+ graph: expand ? (0, expand_library_internals_1.expandCallGraphLibraryInternals)(graph, analyzer.inspectContext().deps) : graph,
22
+ unreachable: queries.some(q => q.reportUnreachable) ? call_graph_1.CallGraph.unreachableCalls(graph) : undefined
21
23
  };
22
24
  }
23
25
  //# sourceMappingURL=call-graph-query-executor.js.map
@@ -13,10 +13,14 @@ export interface CallGraphQuery extends BaseQueryFormat {
13
13
  * `transitiveCallees` (a no-op if no signature database is loaded). Default false.
14
14
  */
15
15
  readonly expandLibraryInternals?: boolean;
16
+ /** If set, also report the calls top-level execution never reaches. Default false. */
17
+ readonly reportUnreachable?: boolean;
16
18
  }
17
19
  export interface CallGraphQueryResult extends BaseQueryResult {
18
20
  /** Please be aware that this is the graph in its JSON representation, use {@link DataflowGraph#fromJson} if the result is serialized */
19
21
  readonly graph: CallGraph;
22
+ /** the calls no top-level execution reaches, only present if {@link CallGraphQuery#reportUnreachable} was set */
23
+ readonly unreachable?: readonly NodeId[];
20
24
  }
21
25
  export declare const CallGraphQueryDefinition: {
22
26
  readonly title: "Call-Graph Query";
@@ -16,11 +16,15 @@ exports.CallGraphQueryDefinition = {
16
16
  const out = queryResults;
17
17
  result.push(`Query: ${(0, ansi_1.bold)('call-graph', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
18
18
  result.push(` ╰ [Call Graph](${call_graph_1.CallGraph.visualize.mermaid.url(out.graph)})`);
19
+ if (out.unreachable !== undefined) {
20
+ result.push(` ╰ Unreachable calls: {${out.unreachable.join(', ')}}`);
21
+ }
19
22
  return true;
20
23
  },
21
24
  schema: joi_1.default.object({
22
25
  type: joi_1.default.string().valid('call-graph').required().description('The type of the query.'),
23
26
  expandLibraryInternals: joi_1.default.boolean().optional().description('Expand library/built-in leaf calls into their internal callees via the signature database (default false).'),
27
+ reportUnreachable: joi_1.default.boolean().optional().description('Also report the calls that top-level execution never reaches (default false).'),
24
28
  }).description('A query to compute the Call Graph of the analyzed project.'),
25
29
  flattenInvolvedNodes: queryResults => {
26
30
  const flattened = [];
@@ -4,6 +4,16 @@ exports.executeDataflowLensQuery = executeDataflowLensQuery;
4
4
  const log_1 = require("../../../util/log");
5
5
  const dfg_view_1 = require("../../../util/simple-df/dfg-view");
6
6
  const vertex_1 = require("../../../dataflow/graph/vertex");
7
+ const arguments_1 = require("../../../abstract-interpretation/data-frame/mappers/arguments");
8
+ const operators_1 = require("../../../r-bridge/lang-4.x/ast/model/operators");
9
+ /**
10
+ * The lens hides syntax: every operator R has, the native pipe (which {@link OperatorDatabase} does not list), and the
11
+ * control-flow keywords. None of them names anything, unlike the built-in *functions* (`print`, `ifelse`) it keeps.
12
+ * Anchored and escaped, as most of these are regex syntax themselves and an unanchored alternative would also drop
13
+ * every lexeme merely *containing* one (`if` in `identifier`).
14
+ */
15
+ const HiddenLexemes = `^(${[...Object.keys(operators_1.OperatorDatabase), '|>', 'function', 'repeat', 'if', 'next', 'break']
16
+ .map(name => (0, arguments_1.escapeRegExp)(name)).join('|')})$`;
7
17
  /**
8
18
  * Executes the given dataflow lens queries using the provided analyzer.
9
19
  */
@@ -17,7 +27,7 @@ async function executeDataflowLensQuery({ analyzer }, queries) {
17
27
  keepEnv: false,
18
28
  keepCd: true,
19
29
  tags: [vertex_1.VertexType.Use, vertex_1.VertexType.VariableDefinition, vertex_1.VertexType.FunctionDefinition, vertex_1.VertexType.FunctionCall],
20
- nameRegex: '<-|<<-|->|->>|=|+|-|*|/|\\|>|function|repeat|if|next|break',
30
+ nameRegex: HiddenLexemes,
21
31
  blacklistWithName: true
22
32
  }
23
33
  }, analyzer.inspectContext().env.makeCleanEnv());
@@ -15,6 +15,7 @@ const assert_1 = require("../../../util/assert");
15
15
  const log_1 = require("../../../util/log");
16
16
  const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
17
17
  const graph_1 = require("../../../dataflow/graph/graph");
18
+ const link_devices_1 = require("./link-devices");
18
19
  /**
19
20
  * Executes a dependencies query.
20
21
  */
@@ -48,7 +49,8 @@ async function executeDependenciesQuery({ analyzer, }, queries) {
48
49
  if (query.additionalCategories !== undefined) {
49
50
  for (const [category, value] of Object.entries(query.additionalCategories)) {
50
51
  // custom categories only use the "functions" collection and do not allow specifying additional functions in the object itself, so we "undefined" a lot here
51
- functions.set(category, getFunctionsToCheck(undefined, category, undefined, false, value.functions));
52
+ const custom = getFunctionsToCheck(undefined, category, undefined, false, value.functions);
53
+ functions.set(category, [...(functions.get(category) ?? []), ...custom]);
52
54
  }
53
55
  }
54
56
  const queryResults = !functions.values().toArray().some(f => f.length > 0) ? { kinds: {}, '.meta': { timing: 0 } } :
@@ -63,6 +65,9 @@ async function executeDependenciesQuery({ analyzer, }, queries) {
63
65
  }
64
66
  return [c, results];
65
67
  })));
68
+ if (results.visualize?.length && results.write?.length) {
69
+ (0, link_devices_1.linkPlotsToDevices)(results.write, results.visualize, dataflow, normalize);
70
+ }
66
71
  return {
67
72
  '.meta': {
68
73
  timing: Date.now() - now
@@ -190,14 +195,17 @@ function getResults(queries, { dataflow, config, normalize }, results, kind, fun
190
195
  resolvedValue = info.stringReplacements[resolvedValue];
191
196
  }
192
197
  const dep = resolvedValue ? d.getDependency(resolvedValue) ?? undefined : undefined;
198
+ const lexeme = getLexeme(value, arg);
193
199
  finalResults.push((0, objects_1.compactRecord)({
194
200
  nodeId: id,
195
201
  functionName,
196
- lexemeOfArgument: getLexeme(value, arg),
202
+ /* only a value we could not make sense of is worth asking about further */
203
+ argumentId: lexeme === undefined ? undefined : arg,
204
+ lexemeOfArgument: lexeme,
197
205
  linkedIds: linked?.length ? linked : undefined,
198
206
  value: resolvedValue ?? info.defaultValue ?? defaultValue,
199
207
  versionConstraints: dep?.versionConstraints,
200
- derivedRange: dep?.derivedRange,
208
+ derivedRange: dep?.effectiveRange,
201
209
  namespaceInfo: dep?.namespaceInfo
202
210
  }));
203
211
  }
@@ -206,7 +214,7 @@ function getResults(queries, { dataflow, config, normalize }, results, kind, fun
206
214
  }
207
215
  return finalResults;
208
216
  function getLexeme(argument, id) {
209
- if ((argument && argument !== dependencies_query_format_1.Unknown) || !id) {
217
+ if ((argument && argument !== dependencies_query_format_1.Unknown && argument !== dependencies_query_format_1.Constant) || !id) {
210
218
  return undefined;
211
219
  }
212
220
  let get = normalize.idMap.get(id);
@@ -220,7 +228,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
220
228
  if (!linkedIds || linkedIds.length === 0) {
221
229
  return undefined;
222
230
  }
223
- const hasAtLeastAValue = args !== undefined && args.values().flatMap(x => Array.from(x)).toArray().some(v => v !== dependencies_query_format_1.Unknown && v !== undefined);
231
+ const hasAtLeastAValue = args !== undefined && args.values().flatMap(x => Array.from(x)).toArray().some(v => v !== dependencies_query_format_1.Unknown && v !== dependencies_query_format_1.Constant && v !== undefined);
224
232
  const map = new Map();
225
233
  for (const linkedId of linkedIds) {
226
234
  if (typeof linkedId !== 'object' || !linkedId.info) {
@@ -9,7 +9,10 @@ import type { Range } from 'semver';
9
9
  import type { AsyncOrSync, MarkOptional } from 'ts-essentials';
10
10
  import type { NamespaceInfo } from '../../../project/plugins/file-plugins/files/flowr-namespace-file';
11
11
  import { Identifier } from '../../../dataflow/environments/identifier';
12
+ /** The value could not be resolved, e.g. a path assembled at runtime. Such a dependency may be missing or fetchable. */
12
13
  export declare const Unknown = "unknown";
14
+ /** The value resolved, but to data given inline rather than to a path (`matrix(0, 2, 2)`, `data.frame(a = 1)`). */
15
+ export declare const Constant = "constant";
13
16
  export interface DependencyCategorySettings {
14
17
  queryDisplayName?: string;
15
18
  functions: FunctionInfo[];
@@ -33,6 +36,12 @@ export declare const DefaultDependencyCategories: {
33
36
  readonly defaultValue: "unknown";
34
37
  readonly additionalAnalysis: (data: BasicQueryData, ignoreDefault: boolean, _functions: FunctionInfo[], _queryResults: CallContextQueryResult, result: DependencyInfo[]) => Promise<void>;
35
38
  };
39
+ readonly remote: {
40
+ readonly queryDisplayName: "Remote Installs";
41
+ readonly functions: FunctionInfo[];
42
+ readonly defaultValue: "unknown";
43
+ readonly additionalAnalysis: (_data: BasicQueryData, _ignoreDefault: boolean, _functions: FunctionInfo[], _queryResults: CallContextQueryResult, result: DependencyInfo[]) => void;
44
+ };
36
45
  readonly source: {
37
46
  readonly queryDisplayName: "Sourced Files";
38
47
  readonly functions: FunctionInfo[];
@@ -48,6 +57,12 @@ export declare const DefaultDependencyCategories: {
48
57
  readonly functions: FunctionInfo[];
49
58
  readonly defaultValue: "stdout";
50
59
  };
60
+ readonly print: {
61
+ readonly queryDisplayName: "Auto-printed Results";
62
+ readonly functions: [];
63
+ readonly defaultValue: "stdout";
64
+ readonly additionalAnalysis: (data: BasicQueryData, ignoreDefault: boolean, _functions: FunctionInfo[], queryResults: CallContextQueryResult, result: DependencyInfo[]) => Promise<void>;
65
+ };
51
66
  readonly visualize: {
52
67
  readonly queryDisplayName: "Visualizations";
53
68
  readonly functions: FunctionInfo[];
@@ -63,6 +78,7 @@ export interface DependenciesQuery extends BaseQueryFormat, Partial<Record<`${De
63
78
  readonly type: 'dependencies';
64
79
  readonly enabledCategories?: DependencyCategoryName[];
65
80
  readonly ignoreDefaultFunctions?: boolean;
81
+ /** Naming a built-in category extends it; use `ignoreDefaultFunctions` to drop the built-in functions. */
66
82
  readonly additionalCategories?: Record<string, MarkOptional<DependencyCategorySettings, 'additionalAnalysis'>>;
67
83
  }
68
84
  export type DependenciesQueryResult = BaseQueryResult & {
@@ -75,16 +91,26 @@ export interface DependencyInfo extends Record<string, unknown> {
75
91
  /** the called name; an {@link Identifier}, so a namespaced call like `maps::map` keeps its package */
76
92
  functionName: Identifier;
77
93
  linkedIds?: readonly NodeId[];
78
- /** the lexeme is presented whenever the specific info is of {@link Unknown} */
94
+ /**
95
+ * the argument the value was read from, under the id the {@link InputSourcesQuery} reports it with: ask that
96
+ * query about {@link nodeId} and this entry of its answer says whether the value is a glob, a prompt, ...
97
+ */
98
+ argumentId?: NodeId;
99
+ /** the lexeme is presented whenever the specific info is {@link Unknown} or {@link Constant} */
79
100
  lexemeOfArgument?: string;
80
101
  /** The library name, file, source, destination etc. being sourced, read from, or written to. */
81
102
  value?: string;
82
103
  versionConstraints?: readonly Range[];
83
104
  derivedRange?: Range;
84
105
  namespaceInfo?: NamespaceInfo;
106
+ /** the package the dependency provides, when the {@link value} names it only implicitly (a `user/repo` slug, a clone url) */
107
+ packageName?: string;
108
+ /** the revision such a reference pins, the `v1.2` of `user/repo@v1.2` */
109
+ revision?: string;
85
110
  }
86
111
  /**
87
112
  * Gets all dependency categories, including user-defined additional categories.
113
+ * A category named like a built-in one extends it instead of replacing it.
88
114
  */
89
115
  export declare function getAllCategories(queries: readonly DependenciesQuery[]): Record<DependencyCategoryName, DependencyCategorySettings>;
90
116
  export declare const DependenciesQueryDefinition: {
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DependenciesQueryDefinition = exports.DefaultDependencyCategories = exports.Unknown = void 0;
6
+ exports.DependenciesQueryDefinition = exports.DefaultDependencyCategories = exports.Constant = exports.Unknown = void 0;
7
7
  exports.getAllCategories = getAllCategories;
8
8
  const ansi_1 = require("../../../util/text/ansi");
9
9
  const time_1 = require("../../../util/text/time");
@@ -11,6 +11,7 @@ const joi_1 = __importDefault(require("joi"));
11
11
  const dependencies_query_executor_1 = require("./dependencies-query-executor");
12
12
  const library_functions_1 = require("./function-info/library-functions");
13
13
  const source_functions_1 = require("./function-info/source-functions");
14
+ const remote_functions_1 = require("./function-info/remote-functions");
14
15
  const read_functions_1 = require("./function-info/read-functions");
15
16
  const write_functions_1 = require("./function-info/write-functions");
16
17
  const visualize_functions_1 = require("./function-info/visualize-functions");
@@ -19,7 +20,15 @@ const test_functions_1 = require("./function-info/test-functions");
19
20
  const identifier_1 = require("../../../dataflow/environments/identifier");
20
21
  const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
21
22
  const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
23
+ const objects_1 = require("../../../util/objects");
24
+ const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
25
+ const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
26
+ const vertex_1 = require("../../../dataflow/graph/vertex");
27
+ const df_helper_1 = require("../../../dataflow/graph/df-helper");
28
+ /** The value could not be resolved, e.g. a path assembled at runtime. Such a dependency may be missing or fetchable. */
22
29
  exports.Unknown = 'unknown';
30
+ /** The value resolved, but to data given inline rather than to a path (`matrix(0, 2, 2)`, `data.frame(a = 1)`). */
31
+ exports.Constant = 'constant';
23
32
  exports.DefaultDependencyCategories = {
24
33
  'library': {
25
34
  queryDisplayName: 'Libraries',
@@ -38,7 +47,7 @@ exports.DefaultDependencyCategories = {
38
47
  functionName: model_1.RNode.lexeme(node).includes(':::') ? ':::' : '::',
39
48
  value: ns,
40
49
  versionConstraints: dep?.versionConstraints,
41
- derivedRange: dep?.derivedRange,
50
+ derivedRange: dep?.effectiveRange,
42
51
  namespaceInfo: dep?.namespaceInfo
43
52
  });
44
53
  }
@@ -46,6 +55,20 @@ exports.DefaultDependencyCategories = {
46
55
  }
47
56
  }
48
57
  },
58
+ 'remote': {
59
+ queryDisplayName: 'Remote Installs',
60
+ functions: remote_functions_1.RemoteFunctions,
61
+ defaultValue: exports.Unknown,
62
+ /* the value is the reference as written, which names the package only implicitly */
63
+ additionalAnalysis: (_data, _ignoreDefault, _functions, _queryResults, result) => {
64
+ for (const [at, info] of result.entries()) {
65
+ const target = (0, remote_functions_1.remoteTarget)(info.value);
66
+ if (target !== undefined) {
67
+ result[at] = { ...info, ...target };
68
+ }
69
+ }
70
+ }
71
+ },
49
72
  'source': {
50
73
  queryDisplayName: 'Sourced Files',
51
74
  functions: source_functions_1.SourceFunctions,
@@ -61,6 +84,37 @@ exports.DefaultDependencyCategories = {
61
84
  functions: write_functions_1.WriteFunctions,
62
85
  defaultValue: 'stdout'
63
86
  },
87
+ 'print': {
88
+ queryDisplayName: 'Auto-printed Results',
89
+ functions: [],
90
+ defaultValue: 'stdout',
91
+ additionalAnalysis: async (data, ignoreDefault, _functions, queryResults, result) => {
92
+ if (ignoreDefault) {
93
+ return;
94
+ }
95
+ const [{ ast }, dataflow] = await Promise.all([data.analyzer.normalize(), data.analyzer.dataflow()]);
96
+ const accountedFor = new Set(Object.values(queryResults?.kinds ?? {})
97
+ .flatMap(k => Object.values(k.subkinds).flat()).map(r => r.id));
98
+ for (const file of ast.files) {
99
+ for (const statement of file.root.children) {
100
+ if (statement.type !== type_1.RType.FunctionCall || accountedFor.has(statement.info.id)) {
101
+ continue;
102
+ }
103
+ const vertex = dataflow.graph.getVertex(statement.info.id);
104
+ const functionName = vertex?.tag === vertex_1.VertexType.FunctionCall
105
+ ? df_helper_1.Dataflow.qualify(statement.info.id, dataflow.graph, false) ?? vertex.name : undefined;
106
+ if (functionName === undefined) {
107
+ continue;
108
+ }
109
+ const props = (0, query_fn_props_1.queryFnProps)(functionName, { environment: dataflow.environment })?.props ?? 0;
110
+ if ((props & (built_in_props_1.CallProp.Invisible | built_in_props_1.CallProp.Graphics)) !== 0 || test_functions_1.ExpectFunctionNames.test(identifier_1.Identifier.getName(functionName))) {
111
+ continue;
112
+ }
113
+ result.push({ nodeId: statement.info.id, functionName, value: 'stdout' });
114
+ }
115
+ }
116
+ }
117
+ },
64
118
  'visualize': {
65
119
  queryDisplayName: 'Visualizations',
66
120
  functions: visualize_functions_1.VisualizeFunctions
@@ -78,7 +132,9 @@ function printResultSection(title, infos, result, formatter) {
78
132
  // one line per dependency: the value (package/file) up front, its function + node as a faint provenance suffix
79
133
  for (const i of infos) {
80
134
  const fn = identifier_1.Identifier.getName(i.functionName);
81
- const value = i.value !== undefined ? (0, ansi_1.bold)(i.value, formatter) : (0, ansi_1.faint)('<unresolved>', formatter);
135
+ /* neither names a resource: inline data is resolved but no path, `unknown` is a path we could not resolve */
136
+ const stands = i.value === exports.Constant ? '<inline data>' : i.value === exports.Unknown || i.value === undefined ? '<unresolved>' : undefined;
137
+ const value = stands !== undefined ? (0, ansi_1.faint)(stands, formatter) : (0, ansi_1.bold)(i.value, formatter);
82
138
  const version = i.derivedRange !== undefined ? ` ${(0, ansi_1.faint)(i.derivedRange.format(), formatter)}` : '';
83
139
  const linked = i.linkedIds ? `, linked ${i.linkedIds.join(', ')}` : '';
84
140
  result.push(` ${value}${version} ${(0, ansi_1.faint)(`via ${fn} (node ${i.nodeId}${linked})`, formatter)}`);
@@ -86,12 +142,18 @@ function printResultSection(title, infos, result, formatter) {
86
142
  }
87
143
  /**
88
144
  * Gets all dependency categories, including user-defined additional categories.
145
+ * A category named like a built-in one extends it instead of replacing it.
89
146
  */
90
147
  function getAllCategories(queries) {
91
- let categories = exports.DefaultDependencyCategories;
148
+ const categories = { ...exports.DefaultDependencyCategories };
92
149
  for (const query of queries) {
93
- if (query.additionalCategories) {
94
- categories = { ...categories, ...query.additionalCategories };
150
+ for (const [name, settings] of Object.entries(query.additionalCategories ?? {})) {
151
+ const known = categories[name];
152
+ categories[name] = known === undefined ? settings : {
153
+ ...known,
154
+ ...(0, objects_1.compactRecord)(settings),
155
+ functions: [...known.functions, ...settings.functions]
156
+ };
95
157
  }
96
158
  }
97
159
  return categories;
@@ -122,7 +184,7 @@ exports.DependenciesQueryDefinition = {
122
184
  queryDisplayName: joi_1.default.string().description('The display name in the query result.'),
123
185
  functions: functionInfoSchema.description('The functions that this additional category should search for.'),
124
186
  defaultValue: joi_1.default.string().description('The default value to return when there is no value to gather from the function information.').optional()
125
- })).description('A set of additional, user-supplied dependency categories, whose results will be included in the query return value.').optional()
187
+ })).description('A set of additional, user-supplied dependency categories, whose results will be included in the query return value. Using the name of a built-in category extends it instead of replacing it.').optional()
126
188
  }).description('The dependencies query retrieves and returns the set of all dependencies in the dataflow graph, which includes libraries, sourced files, read data, and written data.'),
127
189
  flattenInvolvedNodes: (queryResults, query) => {
128
190
  const out = queryResults;
@@ -5,17 +5,24 @@ exports.LibraryFunctions = [
5
5
  { package: 'base', name: 'library', argIdx: 0, argName: 'package', resolveValue: 'library' },
6
6
  { package: 'base', name: 'require', argIdx: 0, argName: 'package', resolveValue: 'library' },
7
7
  { package: 'base', name: 'loadNamespace', argIdx: 0, argName: 'package', resolveValue: true },
8
+ { package: 'base', name: 'requireNamespace', argIdx: 0, argName: 'package', resolveValue: true },
8
9
  { package: 'base', name: 'attachNamespace', argIdx: 0, argName: 'ns', resolveValue: true },
9
10
  { package: 'base', name: 'attach', argIdx: 0, argName: 'what', resolveValue: true },
10
11
  { package: 'base', name: 'use', argIdx: 0, argName: 'package', resolveValue: 'library' },
11
12
  { package: 'groundhog', name: 'groundhog.library', argIdx: 0, argName: 'pkg', resolveValue: true },
12
13
  { package: 'pacman', name: 'p_load', argIdx: 'unnamed', resolveValue: 'library' },
13
14
  { package: 'pacman', name: 'p_load_gh', argIdx: 'unnamed', resolveValue: 'library' },
15
+ { package: 'pacman', name: 'p_load_current_gh', argIdx: 'unnamed', resolveValue: 'library' },
16
+ { package: 'xfun', name: 'pkg_attach', argIdx: 'unnamed', resolveValue: true },
17
+ { package: 'xfun', name: 'pkg_attach2', argIdx: 'unnamed', resolveValue: true },
18
+ { package: 'needs', name: 'needs', argIdx: 'unnamed', resolveValue: 'library' },
19
+ { package: 'modules', name: 'import', argIdx: 0, argName: 'from', resolveValue: 'library' },
14
20
  { package: 'easypackages', name: 'from_import', argIdx: 0, argName: 'package', resolveValue: true },
15
21
  { package: 'easypackages', name: 'libraries', argIdx: 'unnamed', resolveValue: true },
16
22
  { package: 'librarian', name: 'shelf', argIdx: 'unnamed', resolveValue: true },
17
23
  { package: 'devtools', name: 'load_all', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
18
- { package: 'devtools', name: 'load_code', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
19
- { package: 'import', name: 'from', argIdx: 0, argName: 'package', resolveValue: true }
24
+ { package: 'pkgload', name: 'load_code', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
25
+ { package: 'import', name: 'from', argIdx: 0, argName: 'package', resolveValue: true },
26
+ { package: 'rlang', name: 'on_package_load', argIdx: 0, argName: 'pkg', resolveValue: true }
20
27
  ];
21
28
  //# sourceMappingURL=library-functions.js.map
@@ -6,7 +6,7 @@ const derived_functions_1 = require("./derived-functions");
6
6
  const other_path_functions_1 = require("./other-path-functions");
7
7
  const ReadFunctionsWithMore = [
8
8
  { package: 'base', name: 'parse', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
9
- { package: 'base', name: 'read.table', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
9
+ { package: 'utils', name: 'read.table', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
10
10
  { package: 'utils', name: 'read.csv', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
11
11
  { package: 'utils', name: 'read.csv2', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
12
12
  { package: 'utils', name: 'read.delim', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
@@ -22,12 +22,13 @@ const ReadFunctionsWithMore = [
22
22
  { package: 'base', name: 'fifo', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
23
23
  { package: 'base', name: 'unz', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
24
24
  { package: 'base', name: 'matrix', argIdx: 0, argName: 'data', resolveValue: true },
25
+ /* `data(mtcars)` names the dataset as a symbol (or as a string with `character.only`), just like `library` */
26
+ { package: 'utils', name: 'data', argIdx: 0, resolveValue: 'library', ignoreIf: 'arg-missing' },
25
27
  { package: 'base', name: 'readRenviron', argIdx: 0, argName: 'path', resolveValue: true },
26
28
  { package: 'readr', name: 'read_csv', argIdx: 0, argName: 'file', resolveValue: true },
27
29
  { package: 'readr', name: 'read_csv2', argIdx: 0, argName: 'file', resolveValue: true },
28
30
  { package: 'readr', name: 'read_lines', argIdx: 0, argName: 'file', resolveValue: true },
29
31
  { package: 'readr', name: 'read_delim', argIdx: 0, argName: 'file', resolveValue: true },
30
- { package: 'readr', name: 'read_dsv', argIdx: 0, argName: 'file', resolveValue: true },
31
32
  { package: 'readr', name: 'read_fwf', argIdx: 0, argName: 'file', resolveValue: true },
32
33
  { package: 'readr', name: 'read_tsv', argIdx: 0, argName: 'file', resolveValue: true },
33
34
  { package: 'readr', name: 'read_table', argIdx: 0, argName: 'file', resolveValue: true },
@@ -68,7 +69,6 @@ const ReadFunctionsWithMore = [
68
69
  { package: 'sourcetools', name: 'tokenize', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
69
70
  { package: 'sourcetools', name: 'tokenize_file', argIdx: 0, argName: 'path', resolveValue: true },
70
71
  { package: 'expss', name: 'read_spss', argIdx: 0, argName: 'file', resolveValue: true },
71
- { package: 'expss', name: 'read_spss_to_list', argIdx: 0, argName: 'file', resolveValue: true },
72
72
  { package: 'SimPhe', name: 'read.geno', argIdx: 0, argName: 'fname', resolveValue: true },
73
73
  { package: 'ape', name: 'read.tree', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
74
74
  { package: 'geomorph', name: 'readland.tps', argIdx: 0, argName: 'file', resolveValue: true },
@@ -92,7 +92,7 @@ const ReadFunctionsWithMore = [
92
92
  { package: 'DiagrammeR', name: 'import_graph', argIdx: 0, argName: 'graph_file', resolveValue: true },
93
93
  { package: 'DiagrammeR', name: 'open_graph', argIdx: 0, argName: 'file', resolveValue: true },
94
94
  { package: 'highcharter', name: 'download_map_data', argIdx: 0, argName: 'url', resolveValue: true, defaultValue: 'custom/world.js' },
95
- { package: 'rvest', name: 'read_html', argIdx: 0, argName: 'x', resolveValue: true },
95
+ { name: 'read_html', argIdx: 0, argName: 'x', resolveValue: true },
96
96
  { package: 'rvest', name: 'read_html_live', argIdx: 0, argName: 'url', resolveValue: true },
97
97
  { package: 'stats', name: 'read.ftable', argIdx: 0, argName: 'file', resolveValue: true },
98
98
  { package: 'DBI', name: 'dbReadTable', argIdx: 1, argName: 'name', resolveValue: true },
@@ -108,7 +108,7 @@ const ReadFunctionsWithMore = [
108
108
  { package: 'rpolars', name: 'pl_scan_parquet', argIdx: 0, argName: 'source', resolveValue: true, ignoreIf: 'arg-missing' },
109
109
  { package: 'rio', name: 'import', argIdx: 0, argName: 'file', resolveValue: true },
110
110
  { package: 'rio', name: 'import_list', argIdx: 0, argName: 'file', resolveValue: true },
111
- { package: 'openxlsx', name: 'read.xlsx', argIdx: 0, argName: 'file', resolveValue: true },
111
+ { package: 'openxlsx', name: 'read.xlsx', argIdx: 0, argName: 'xlsxFile', resolveValue: true },
112
112
  { package: 'openxlsx', name: 'loadWorkbook', argIdx: 0, argName: 'file', resolveValue: true },
113
113
  { package: 'readODS', name: 'read_ods', argIdx: 0, argName: 'path', resolveValue: true },
114
114
  { package: 'vroom', name: 'vroom', argIdx: 0, argName: 'file', resolveValue: true },
@@ -132,6 +132,32 @@ const ReadFunctionsWithMore = [
132
132
  { package: 'tuneR', name: 'readMidi', argIdx: 0, argName: 'file', resolveValue: true },
133
133
  { package: 'seewave', name: 'read.audacity', argIdx: 0, argName: 'file', resolveValue: true },
134
134
  { package: 'audio', name: 'load.wave', argIdx: 0, argName: 'where', resolveValue: true },
135
+ /* geospatial (no `raster::stack`: only the name is matched on and `utils::stack` shares it) */
136
+ { package: 'terra', name: 'rast', argIdx: 0, argName: 'x', resolveValue: true },
137
+ { package: 'terra', name: 'vect', argIdx: 0, argName: 'x', resolveValue: true },
138
+ { package: 'raster', name: 'raster', argIdx: 0, argName: 'x', resolveValue: true },
139
+ { package: 'raster', name: 'brick', argIdx: 0, argName: 'x', resolveValue: true },
140
+ { package: 'raster', name: 'shapefile', argIdx: 0, argName: 'x', resolveValue: true },
141
+ { package: 'stars', name: 'read_stars', argIdx: 0, argName: '.x', resolveValue: true },
142
+ { package: 'stars', name: 'read_ncdf', argIdx: 0, argName: '.x', resolveValue: true },
143
+ { package: 'maptools', name: 'readShapeLines', argIdx: 0, argName: 'fn', resolveValue: true },
144
+ { package: 'maptools', name: 'readShapePoints', argIdx: 0, argName: 'fn', resolveValue: true },
145
+ { package: 'maptools', name: 'readShapeSpatial', argIdx: 0, argName: 'fn', resolveValue: true },
146
+ /* array / binary science formats */
147
+ { package: 'ncdf4', name: 'nc_open', argIdx: 0, argName: 'filename', resolveValue: true },
148
+ { package: 'RNetCDF', name: 'open.nc', argIdx: 0, argName: 'con', resolveValue: true },
149
+ { package: 'R.matlab', name: 'readMat', argIdx: 0, argName: 'con', resolveValue: true },
150
+ { package: 'rhdf5', name: 'h5read', argIdx: 0, argName: 'file', resolveValue: true },
151
+ { package: 'rhdf5', name: 'h5ls', argIdx: 0, argName: 'file', resolveValue: true },
152
+ { package: 'fst', name: 'read_fst', argIdx: 0, argName: 'path', resolveValue: true },
153
+ { package: 'qs', name: 'qread', argIdx: 0, argName: 'file', resolveValue: true },
154
+ { package: 'yaml', name: 'read_yaml', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
155
+ /* phylogeny / sequence */
156
+ { package: 'ape', name: 'read.nexus', argIdx: 0, argName: 'file', resolveValue: true },
157
+ { package: 'ape', name: 'read.nexus.data', argIdx: 0, argName: 'file', resolveValue: true },
158
+ { package: 'ape', name: 'read.dna', argIdx: 0, argName: 'file', resolveValue: true },
159
+ { package: 'ape', name: 'read.FASTA', argIdx: 0, argName: 'file', resolveValue: true },
160
+ { package: 'seqinr', name: 'read.fasta', argIdx: 0, argName: 'file', resolveValue: true },
135
161
  /* shinyjs - loads an external JavaScript file */
136
162
  { package: 'shinyjs', name: 'extendShinyjs', argIdx: 0, argName: 'script', resolveValue: true, ignoreIf: 'arg-missing' }
137
163
  ];