@eagleoutice/flowr 2.13.9 → 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 (138) hide show
  1. package/config.d.ts +50 -2
  2. package/config.js +37 -6
  3. package/dataflow/environments/apply-kill.js +4 -4
  4. package/dataflow/environments/built-in-props.d.ts +28 -4
  5. package/dataflow/environments/built-in-props.js +31 -8
  6. package/dataflow/environments/built-in.d.ts +7 -2
  7. package/dataflow/environments/built-in.js +10 -12
  8. package/dataflow/environments/default-builtin-config.d.ts +46 -6
  9. package/dataflow/environments/default-builtin-config.js +30 -16
  10. package/dataflow/environments/environment.d.ts +16 -0
  11. package/dataflow/environments/environment.js +70 -18
  12. package/dataflow/environments/identifier.d.ts +6 -0
  13. package/dataflow/environments/identifier.js +18 -5
  14. package/dataflow/environments/query-fn-props.js +34 -2
  15. package/dataflow/environments/reference-to-maybe.js +1 -1
  16. package/dataflow/eval/resolve/alias-tracking.js +45 -1
  17. package/dataflow/eval/resolve/resolve-argument.js +25 -17
  18. package/dataflow/eval/resolve/resolve-strings.d.ts +17 -0
  19. package/dataflow/eval/resolve/resolve-strings.js +16 -9
  20. package/dataflow/eval/resolve/resolve.js +3 -1
  21. package/dataflow/graph/call-graph.d.ts +7 -0
  22. package/dataflow/graph/call-graph.js +103 -0
  23. package/dataflow/graph/df-helper.d.ts +2 -0
  24. package/dataflow/graph/graph.d.ts +5 -8
  25. package/dataflow/internal/linker.d.ts +5 -5
  26. package/dataflow/internal/linker.js +31 -92
  27. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  28. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +3 -9
  29. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +4 -30
  30. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
  31. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
  32. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -1
  33. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
  34. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
  35. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +5 -1
  36. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +2 -2
  37. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -6
  38. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +32 -14
  39. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +16 -4
  40. package/dataflow/internal/process/functions/call/known-call-handling.js +29 -8
  41. package/documentation/doc-util/doc-sigdb.d.ts +9 -0
  42. package/documentation/doc-util/doc-sigdb.js +32 -0
  43. package/documentation/wiki-interface.js +13 -2
  44. package/documentation/wiki-query.js +3 -0
  45. package/documentation/wiki-signature-database.js +2 -5
  46. package/gas.d.ts +6 -0
  47. package/gas.js +7 -1
  48. package/package.json +1 -1
  49. package/project/attached-packages.d.ts +13 -0
  50. package/project/attached-packages.js +30 -0
  51. package/project/context/flowr-analyzer-context.d.ts +15 -0
  52. package/project/context/flowr-analyzer-context.js +14 -3
  53. package/project/context/flowr-analyzer-files-context.d.ts +11 -0
  54. package/project/context/flowr-analyzer-files-context.js +3 -0
  55. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -0
  56. package/project/context/flowr-analyzer-incremental-analysis-context.js +69 -0
  57. package/project/dependency-version-space.d.ts +33 -11
  58. package/project/dependency-version-space.js +58 -32
  59. package/project/plugins/file-plugins/files/flowr-namespace-file.js +52 -24
  60. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.d.ts +22 -0
  61. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +101 -0
  62. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +30 -11
  63. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +79 -37
  64. package/project/plugins/plugin-registry.d.ts +2 -1
  65. package/project/plugins/plugin-registry.js +2 -0
  66. package/project/sigdb/manifest.js +9 -5
  67. package/project/sigdb/signature-match.d.ts +5 -18
  68. package/project/sigdb/signature-match.js +5 -18
  69. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  70. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +4 -0
  71. package/queries/catalog/call-graph-query/call-graph-query-format.js +4 -0
  72. package/queries/catalog/dependencies-query/dependencies-query-executor.js +10 -3
  73. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +19 -1
  74. package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -2
  75. package/queries/catalog/dependencies-query/function-info/library-functions.js +7 -1
  76. package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -5
  77. package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +18 -0
  78. package/queries/catalog/dependencies-query/function-info/remote-functions.js +46 -0
  79. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +52 -2
  80. package/queries/catalog/dependencies-query/function-info/write-functions.js +8 -4
  81. package/queries/catalog/dependencies-query/link-devices.d.ts +12 -0
  82. package/queries/catalog/dependencies-query/link-devices.js +58 -0
  83. package/queries/catalog/dice-query/dice-query-format.d.ts +2 -0
  84. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +25 -6
  85. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +37 -6
  86. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +17 -4
  87. package/queries/catalog/input-sources-query/input-sources-query-format.js +4 -0
  88. package/queries/catalog/input-sources-query/input-types.d.ts +10 -0
  89. package/queries/catalog/input-sources-query/input-types.js +10 -0
  90. package/queries/catalog/location-map-query/location-map-query-executor.js +16 -6
  91. package/queries/catalog/location-map-query/location-map-query-format.d.ts +15 -1
  92. package/queries/catalog/location-map-query/location-map-query-format.js +22 -5
  93. package/queries/catalog/signature-query/signature-query-executor.js +3 -0
  94. package/queries/catalog/signature-query/signature-query-format.d.ts +5 -0
  95. package/queries/query.d.ts +1 -1
  96. package/r-bridge/lang-4.x/ast/model/model.d.ts +14 -2
  97. package/r-bridge/lang-4.x/ast/model/model.js +32 -0
  98. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
  99. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -0
  100. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
  101. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
  102. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
  103. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
  104. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
  105. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +7 -8
  106. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +9 -46
  107. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
  108. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
  109. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
  110. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
  111. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
  112. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
  113. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
  114. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
  115. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
  116. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +2 -0
  117. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
  118. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
  119. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
  120. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +0 -5
  121. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +6 -3
  122. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
  123. package/search/flowr-search-filters.d.ts +17 -1
  124. package/search/flowr-search-filters.js +23 -0
  125. package/slicing/criterion/parse.d.ts +5 -25
  126. package/slicing/criterion/parse.js +15 -20
  127. package/slicing/static/fingerprint.js +18 -6
  128. package/slicing/static/slicer-types.d.ts +10 -0
  129. package/slicing/static/static-slicer.d.ts +1 -1
  130. package/slicing/static/static-slicer.js +29 -6
  131. package/slicing/static/visiting-queue.d.ts +12 -2
  132. package/slicing/static/visiting-queue.js +28 -3
  133. package/util/arg-matching.d.ts +18 -0
  134. package/util/arg-matching.js +70 -0
  135. package/util/r-regex.js +19 -1
  136. package/util/range.d.ts +7 -8
  137. package/util/range.js +10 -11
  138. package/util/version.js +1 -1
@@ -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");
@@ -24,7 +25,10 @@ const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props"
24
25
  const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
25
26
  const vertex_1 = require("../../../dataflow/graph/vertex");
26
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. */
27
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';
28
32
  exports.DefaultDependencyCategories = {
29
33
  'library': {
30
34
  queryDisplayName: 'Libraries',
@@ -51,6 +55,20 @@ exports.DefaultDependencyCategories = {
51
55
  }
52
56
  }
53
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
+ },
54
72
  'source': {
55
73
  queryDisplayName: 'Sourced Files',
56
74
  functions: source_functions_1.SourceFunctions,
@@ -114,7 +132,9 @@ function printResultSection(title, infos, result, formatter) {
114
132
  // one line per dependency: the value (package/file) up front, its function + node as a faint provenance suffix
115
133
  for (const i of infos) {
116
134
  const fn = identifier_1.Identifier.getName(i.functionName);
117
- 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);
118
138
  const version = i.derivedRange !== undefined ? ` ${(0, ansi_1.faint)(i.derivedRange.format(), formatter)}` : '';
119
139
  const linked = i.linkedIds ? `, linked ${i.linkedIds.join(', ')}` : '';
120
140
  result.push(` ${value}${version} ${(0, ansi_1.faint)(`via ${fn} (node ${i.nodeId}${linked})`, formatter)}`);
@@ -5,17 +5,23 @@ 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: '.' },
24
+ { package: 'pkgload', name: 'load_code', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
19
25
  { package: 'import', name: 'from', argIdx: 0, argName: 'package', resolveValue: true },
20
26
  { package: 'rlang', name: 'on_package_load', argIdx: 0, argName: 'pkg', resolveValue: true }
21
27
  ];
@@ -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 },
@@ -0,0 +1,18 @@
1
+ import type { FunctionInfo } from './function-info';
2
+ /**
3
+ * The installers that fetch a package from somewhere other than a configured CRAN-like repository, with the
4
+ * argument naming what they fetch: a `user/repo` slug for the forge installers, a url or path for the rest.
5
+ * `remotes` implements them and `devtools` re-exports the whole API, so the entries state no package and match
6
+ * either spelling as well as the bare name.
7
+ */
8
+ export declare const RemoteFunctions: FunctionInfo[];
9
+ /**
10
+ * What a remote reference installs, as the installers spell it: `user/repo` (the package is `repo`),
11
+ * `user/repo/subdir` (the package sits in `subdir`), `user/repo@v1.2` or `user/repo#42` (pinned to a revision),
12
+ * `github::user/repo` (a `pak` source prefix), and a clone url whose last segment names the package.
13
+ * `undefined` for a value that never resolved, which names nothing.
14
+ */
15
+ export declare function remoteTarget(value: string | undefined): {
16
+ packageName: string;
17
+ revision?: string;
18
+ } | undefined;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RemoteFunctions = void 0;
4
+ exports.remoteTarget = remoteTarget;
5
+ const dependencies_query_format_1 = require("../dependencies-query-format");
6
+ /**
7
+ * The installers that fetch a package from somewhere other than a configured CRAN-like repository, with the
8
+ * argument naming what they fetch: a `user/repo` slug for the forge installers, a url or path for the rest.
9
+ * `remotes` implements them and `devtools` re-exports the whole API, so the entries state no package and match
10
+ * either spelling as well as the bare name.
11
+ */
12
+ exports.RemoteFunctions = [
13
+ { name: 'install_github', argIdx: 0, argName: 'repo', resolveValue: true },
14
+ { name: 'install_gitlab', argIdx: 0, argName: 'repo', resolveValue: true },
15
+ { name: 'install_bitbucket', argIdx: 0, argName: 'repo', resolveValue: true },
16
+ { name: 'install_git', argIdx: 0, argName: 'url', resolveValue: true },
17
+ { name: 'install_svn', argIdx: 0, argName: 'url', resolveValue: true },
18
+ { name: 'install_url', argIdx: 0, argName: 'url', resolveValue: true },
19
+ { name: 'install_bioc', argIdx: 0, argName: 'repo', resolveValue: true },
20
+ { package: 'pak', name: 'pkg_install', argIdx: 0, argName: 'pkg', resolveValue: true },
21
+ { package: 'pak', name: 'pak', argIdx: 0, argName: 'pkg', resolveValue: true },
22
+ { package: 'renv', name: 'install', argIdx: 0, argName: 'packages', resolveValue: true }
23
+ ];
24
+ /** `github::`, `bioc::`, ... prefixes of a `pak` reference, and the `.git` a clone url ends in */
25
+ const RemotePrefix = /^[a-z]+::/;
26
+ const RemoteRevision = /[@#](?<revision>[^/]+)$/;
27
+ /**
28
+ * What a remote reference installs, as the installers spell it: `user/repo` (the package is `repo`),
29
+ * `user/repo/subdir` (the package sits in `subdir`), `user/repo@v1.2` or `user/repo#42` (pinned to a revision),
30
+ * `github::user/repo` (a `pak` source prefix), and a clone url whose last segment names the package.
31
+ * `undefined` for a value that never resolved, which names nothing.
32
+ */
33
+ function remoteTarget(value) {
34
+ if (value === undefined || value === dependencies_query_format_1.Unknown || value === dependencies_query_format_1.Constant || value.length === 0) {
35
+ return undefined;
36
+ }
37
+ const revision = RemoteRevision.exec(value)?.groups?.revision;
38
+ const path = value.replace(RemoteRevision, '').replace(RemotePrefix, '').replace(/\/+$/, '');
39
+ /* a url carries a host we have to drop first, everything else is already the path of the reference */
40
+ const segments = (path.includes('://') ? path.slice(path.indexOf('://') + 3).split('/').slice(1) : path.split('/'))
41
+ .filter(s => s.length > 0);
42
+ /* a clone url ends in `.git`, an archive in its extension and often a version (`pkg_1.0.tar.gz`) */
43
+ const packageName = segments.at(-1)?.replace(/\.git$|\.(tar\.(gz|bz2|xz)|tgz|zip)$/, '').replace(/_[\d.-]+$/, '');
44
+ return packageName ? { packageName, ...(revision ? { revision } : {}) } : undefined;
45
+ }
46
+ //# sourceMappingURL=remote-functions.js.map
@@ -5,13 +5,63 @@ const default_builtin_config_1 = require("../../../../dataflow/environments/defa
5
5
  const LinkToPlotCreation = [
6
6
  { type: 'link-to-last-call', callName: default_builtin_config_1.PlotCreate }
7
7
  ];
8
+ /**
9
+ * The package that actually exports a plotting call that flowR groups with ggplot2's: a namespaced call is only
10
+ * counted when it names the package the function belongs to, so `ggthemes::theme_wsj()` would otherwise be dropped.
11
+ * A name several packages define (`theme_map` in both cowplot and ggthemes) is left out and matches either way.
12
+ */
13
+ const PlotFunctionsByPackage = {
14
+ factoextra: ['fviz_cluster', 'fviz_dend', 'fviz_mca', 'fviz_mca_biplot', 'fviz_mca_ind', 'fviz_mca_var', 'fviz_pca',
15
+ 'fviz_pca_biplot', 'fviz_pca_ind', 'fviz_pca_var', 'fviz_screeplot'],
16
+ ggExtra: ['ggMarginal', 'removeGrid', 'removeGridX', 'removeGridY', 'rotateTextX'],
17
+ survminer: ['ggsurvplot', 'ggsurvplot_add_all', 'theme_survminer'],
18
+ cowplot: ['ggdraw'],
19
+ forecast: ['ggseasonplot'],
20
+ ggcorrplot: ['ggcorrplot'],
21
+ ggdendro: ['ggdendrogram'],
22
+ plotly: ['ggplotly'],
23
+ gridExtra: ['grid.arrange'],
24
+ ggmap: ['qmap'],
25
+ ggpubr: ['gradient_color'],
26
+ ggalt: ['geom_dumbbell', 'geom_encircle'],
27
+ ggthemes: [
28
+ 'scale_color_calc', 'scale_color_canva', 'scale_color_colorblind', 'scale_color_continuous_tableau',
29
+ 'scale_color_economist', 'scale_color_excel', 'scale_color_excel_new', 'scale_color_few',
30
+ 'scale_color_fivethirtyeight', 'scale_color_gdocs', 'scale_color_gradient2_tableau',
31
+ 'scale_color_gradient_tableau', 'scale_color_hc', 'scale_color_pander', 'scale_color_ptol',
32
+ 'scale_color_solarized', 'scale_color_stata', 'scale_color_tableau', 'scale_color_wsj', 'scale_colour_calc',
33
+ 'scale_colour_canva', 'scale_colour_colorblind', 'scale_colour_economist', 'scale_colour_excel',
34
+ 'scale_colour_excel_new', 'scale_colour_few', 'scale_colour_fivethirtyeight', 'scale_colour_gdocs',
35
+ 'scale_colour_gradient2_tableau', 'scale_colour_gradient_tableau', 'scale_colour_hc', 'scale_colour_pander',
36
+ 'scale_colour_ptol', 'scale_colour_solarized', 'scale_colour_stata', 'scale_colour_tableau', 'scale_colour_wsj',
37
+ 'scale_fill_calc', 'scale_fill_canva', 'scale_fill_colorblind', 'scale_fill_continuous_tableau',
38
+ 'scale_fill_economist', 'scale_fill_excel', 'scale_fill_excel_new', 'scale_fill_few',
39
+ 'scale_fill_fivethirtyeight', 'scale_fill_gdocs', 'scale_fill_gradient2_tableau', 'scale_fill_gradient_tableau',
40
+ 'scale_fill_hc', 'scale_fill_pander', 'scale_fill_ptol', 'scale_fill_solarized', 'scale_fill_stata',
41
+ 'scale_fill_tableau', 'scale_fill_wsj', 'scale_linetype_stata', 'scale_shape_calc', 'scale_shape_circlefill',
42
+ 'scale_shape_cleveland', 'scale_shape_few', 'scale_shape_stata', 'scale_shape_tableau', 'scale_shape_tremmel',
43
+ 'theme_base', 'theme_calc', 'theme_clean', 'theme_economist', 'theme_economist_white', 'theme_excel',
44
+ 'theme_excel_new', 'theme_few', 'theme_fivethirtyeight', 'theme_foundation', 'theme_gdocs', 'theme_hc',
45
+ 'theme_igray', 'theme_pander', 'theme_par', 'theme_solarized', 'theme_solarized_2', 'theme_solid',
46
+ 'theme_stata', 'theme_tufte', 'theme_wsj'
47
+ ]
48
+ };
49
+ /** {@link PlotFunctionsByPackage} inverted: the owning package of a name, `ggplot2` unless another package claims it */
50
+ const PlotFunctionOwner = new Map(Object.entries(PlotFunctionsByPackage).flatMap(([pkg, names]) => names.map(name => [name, pkg])));
51
+ /** Names that several packages define, so pinning any of them would drop the calls to the others. */
52
+ const AmbiguousPlotFunctions = new Set(['theme_map', 'wrap_by']);
53
+ /** the {@link FunctionInfo} for a ggplot-style call, qualified with the package that really exports it */
54
+ function ggStyle(name, linkTo) {
55
+ const owner = AmbiguousPlotFunctions.has(name) ? undefined : PlotFunctionOwner.get(name) ?? 'ggplot2';
56
+ return { ...(owner ? { package: owner } : {}), name, ...(linkTo ? { linkTo } : {}) };
57
+ }
8
58
  exports.VisualizeFunctions =
9
59
  // plot creation
10
- default_builtin_config_1.GgPlotCreate.map(f => ({ package: 'ggplot2', name: f })).concat(default_builtin_config_1.TinyPlotCrate.map(f => ({ package: 'tinyplot', name: f })),
60
+ (default_builtin_config_1.GgPlotCreate.map(f => ggStyle(f))).concat(default_builtin_config_1.TinyPlotCrate.map(f => ({ package: 'tinyplot', name: f })),
11
61
  // `map` is the maps-package plot; qualify it so it does not swallow purrr::map/dplyr::map etc.
12
62
  default_builtin_config_1.GraphicsPlotCreate.map(f => f === 'map' ? { name: f, package: 'maps' } : { name: f }),
13
63
  // plot modification
14
- default_builtin_config_1.GgPlotImplicitAddons.concat(default_builtin_config_1.GgPlotAddons).map(f => ({ package: 'ggplot2', name: f, linkTo: LinkToPlotCreation })), default_builtin_config_1.TinyPlotAddons.map(f => ({ package: 'tinyplot', name: f, linkTo: LinkToPlotCreation })), default_builtin_config_1.GraphicsPlotAddons.map(f => ({ name: f, linkTo: LinkToPlotCreation }))).map(f => {
64
+ default_builtin_config_1.GgPlotImplicitAddons.concat(default_builtin_config_1.GgPlotAddons).map(f => ggStyle(f, LinkToPlotCreation)), default_builtin_config_1.TinyPlotAddons.map(f => ({ package: 'tinyplot', name: f, linkTo: LinkToPlotCreation })), default_builtin_config_1.GraphicsPlotAddons.map(f => ({ name: f, linkTo: LinkToPlotCreation }))).map(f => {
15
65
  if (f.name !== 'hist') {
16
66
  return f;
17
67
  }
@@ -40,11 +40,10 @@ const WriteFunctionsWithMore = [
40
40
  { package: 'readr', name: 'write_csv', argIdx: 1, argName: 'file', resolveValue: true },
41
41
  { package: 'readr', name: 'write_csv2', argIdx: 1, argName: 'file', resolveValue: true },
42
42
  { package: 'readr', name: 'write_delim', argIdx: 1, argName: 'file', resolveValue: true },
43
- { package: 'readr', name: 'write_dsv', argIdx: 1, argName: 'file', resolveValue: true },
44
- { package: 'readr', name: 'write_fwf', argIdx: 1, argName: 'file', resolveValue: true },
43
+ { package: 'readr', name: 'write_excel_csv', argIdx: 1, argName: 'file', resolveValue: true },
44
+ { package: 'readr', name: 'write_excel_csv2', argIdx: 1, argName: 'file', resolveValue: true },
45
+ { package: 'readr', name: 'write_file', argIdx: 1, argName: 'file', resolveValue: true },
45
46
  { package: 'readr', name: 'write_tsv', argIdx: 1, argName: 'file', resolveValue: true },
46
- { package: 'readr', name: 'write_table', argIdx: 1, argName: 'file', resolveValue: true },
47
- { package: 'readr', name: 'write_log', argIdx: 1, argName: 'file', resolveValue: true },
48
47
  { package: 'readr', name: 'write_lines', argIdx: 1, argName: 'file', resolveValue: true },
49
48
  { package: 'readr', name: 'write_rds', argIdx: 1, argName: 'file', resolveValue: true },
50
49
  { package: 'haven', name: 'write_sas', argIdx: 1, argName: 'file', resolveValue: true },
@@ -67,6 +66,11 @@ const WriteFunctionsWithMore = [
67
66
  { package: 'grDevices', name: 'tiff', argIdx: 0, argName: 'filename', resolveValue: true },
68
67
  { package: 'grDevices', name: 'X11', argIdx: 0, argName: 'file', resolveValue: true },
69
68
  { package: 'grDevices', name: 'quartz', argIdx: 0, argName: 'file', resolveValue: true },
69
+ { package: 'ragg', name: 'agg_png', argIdx: 0, argName: 'filename', resolveValue: true },
70
+ { package: 'ragg', name: 'agg_jpeg', argIdx: 0, argName: 'filename', resolveValue: true },
71
+ { package: 'ragg', name: 'agg_tiff', argIdx: 0, argName: 'filename', resolveValue: true },
72
+ { package: 'ragg', name: 'agg_ppm', argIdx: 0, argName: 'filename', resolveValue: true },
73
+ { package: 'ragg', name: 'agg_webp', argIdx: 0, argName: 'filename', resolveValue: true },
70
74
  { package: 'car', name: 'Export', argIdx: 0, argName: 'file', resolveValue: true },
71
75
  { package: 'LIM', name: 'PrintMat', linkTo: OutputRedirects, resolveValue: true },
72
76
  // write_spss/write_stata moved sjmisc -> sjlabelled, so do not pin a namespace (match either); write_sas also lives in haven
@@ -0,0 +1,12 @@
1
+ import type { DependencyInfo } from './dependencies-query-format';
2
+ import type { NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
+ import type { DataflowInformation } from '../../../dataflow/info';
4
+ /**
5
+ * Names the file each visualization lands in: a device opener (`pdf("a.pdf")`) takes every plot until the
6
+ * device is closed (`dev.off()`), so those plots end up in its file instead of on screen. A plot outside any
7
+ * open device keeps the value it had.
8
+ *
9
+ * Openers are the `write` entries that draw ({@link CallProp.Graphics}), closers the calls that end a device
10
+ * ({@link CallProp.Closes}), and the order is the one the source states.
11
+ */
12
+ export declare function linkPlotsToDevices(written: readonly DependencyInfo[], plots: DependencyInfo[], dataflow: DataflowInformation, ast: NormalizedAst): void;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.linkPlotsToDevices = linkPlotsToDevices;
4
+ const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
5
+ const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
6
+ const vertex_1 = require("../../../dataflow/graph/vertex");
7
+ const df_helper_1 = require("../../../dataflow/graph/df-helper");
8
+ const range_1 = require("../../../util/range");
9
+ /** the {@link CallProp} bits of the call `id` makes */
10
+ function propsOf(id, { graph, environment }) {
11
+ const vertex = graph.getVertex(id);
12
+ if (vertex?.tag !== vertex_1.VertexType.FunctionCall) {
13
+ return 0;
14
+ }
15
+ const name = df_helper_1.Dataflow.qualify(id, graph, false) ?? vertex.name;
16
+ return (0, query_fn_props_1.queryFnProps)(name, { environment: vertex.environment ?? environment })?.props ?? 0;
17
+ }
18
+ /**
19
+ * Names the file each visualization lands in: a device opener (`pdf("a.pdf")`) takes every plot until the
20
+ * device is closed (`dev.off()`), so those plots end up in its file instead of on screen. A plot outside any
21
+ * open device keeps the value it had.
22
+ *
23
+ * Openers are the `write` entries that draw ({@link CallProp.Graphics}), closers the calls that end a device
24
+ * ({@link CallProp.Closes}), and the order is the one the source states.
25
+ */
26
+ function linkPlotsToDevices(written, plots, dataflow, ast) {
27
+ const opened = new Map(written
28
+ .filter(w => w.value !== undefined && (propsOf(w.nodeId, dataflow) & built_in_props_1.CallProp.Graphics) !== 0)
29
+ .map(w => [w.nodeId, w.value]));
30
+ if (opened.size === 0) {
31
+ return;
32
+ }
33
+ const closed = new Set(dataflow.graph.vertices(true)
34
+ .filter(([id, v]) => v.tag === vertex_1.VertexType.FunctionCall && (propsOf(id, dataflow) & built_in_props_1.CallProp.Closes) !== 0)
35
+ .map(([id]) => id));
36
+ const plotAt = new Map(plots.map((p, index) => [p.nodeId, index]));
37
+ const located = [...opened.keys(), ...closed, ...plotAt.keys()]
38
+ .flatMap(id => {
39
+ const at = ast.idMap.get(id)?.location;
40
+ return at ? [[id, at]] : [];
41
+ })
42
+ .sort(([, a], [, b]) => range_1.SourceRange.compare(a, b));
43
+ const devices = [];
44
+ for (const [id] of located) {
45
+ const file = opened.get(id);
46
+ const plot = plotAt.get(id);
47
+ if (file !== undefined) {
48
+ devices.push(file);
49
+ }
50
+ else if (closed.has(id)) {
51
+ devices.pop();
52
+ }
53
+ else if (plot !== undefined && devices.length > 0) {
54
+ plots[plot] = { ...plots[plot], value: devices[devices.length - 1] };
55
+ }
56
+ }
57
+ }
58
+ //# sourceMappingURL=link-devices.js.map
@@ -25,6 +25,8 @@ export interface DiceQueryResult extends BaseQueryResult {
25
25
  timesHitThreshold: number;
26
26
  result: ReadonlySet<NodeId>;
27
27
  slicedFor: readonly NodeId[];
28
+ /** see {@link SliceResult.stoppedEarly} */
29
+ stoppedEarly?: boolean;
28
30
  '.meta': {
29
31
  timing: number;
30
32
  };
@@ -15,17 +15,28 @@ function disabledSources(query) {
15
15
  }
16
16
  return new Set([...(query.clean ? ['declared', 'transitive'] : []), ...(query.disabled ?? [])]);
17
17
  }
18
- /** collects and deduplicates provenance-carrying constraints */
18
+ function locatorOf(idMap) {
19
+ return id => {
20
+ const node = id === undefined ? undefined : idMap.get(id);
21
+ const at = node?.location ?? node?.info.fullRange;
22
+ return at === undefined ? undefined : `${node?.info.file ? node.info.file + ':' : ''}${at[0]}:${at[1]}`;
23
+ };
24
+ }
25
+ /** collects and deduplicates provenance-carrying constraints, resolving their call site to a location */
19
26
  class EvidenceCollector {
27
+ locate;
20
28
  seen = new Set();
21
29
  list = [];
30
+ constructor(locate) {
31
+ this.locate = locate;
32
+ }
22
33
  add = (c) => {
23
34
  const key = `${c.source}|${c.origin}|${c.bound ?? ''}|${c.detail}`;
24
35
  if (this.seen.has(key)) {
25
36
  return;
26
37
  }
27
38
  this.seen.add(key);
28
- this.list.push((0, objects_1.compactRecord)({ ...c }));
39
+ this.list.push((0, objects_1.compactRecord)({ ...c, location: this.locate(c.at) }));
29
40
  };
30
41
  }
31
42
  /** merge several guess-dep-versions queries into one: union the packages, keep the tightest (earliest date, smallest cap) */
@@ -102,7 +113,7 @@ function rangeString(survivors, nonContiguous, unsatisfiable, declaredRange, dec
102
113
  return survivors.length <= cap ? survivors.join(', ') : `${min}...${max} (${survivors.length} discrete)`;
103
114
  }
104
115
  /** build the reported guess for one package from its already-computed surviving versions and provenance */
105
- function guessPackage(name, cap, surviving, evidence, { used, linkedWith, coupledWith, orphanFunctions, orphanAlternatives }) {
116
+ function guessPackage(name, cap, surviving, evidence, { used, linkedWith, coupledWith, orphanFunctions, orphanEvidence, orphanAlternatives }) {
106
117
  const { declaredRange, declaredConstraints, unsatisfiable } = surviving;
107
118
  const survivors = surviving.survivors.map(e => e.ver);
108
119
  const preSignature = surviving.preSignature.map(e => e.ver);
@@ -118,6 +129,7 @@ function guessPackage(name, cap, surviving, evidence, { used, linkedWith, couple
118
129
  maxVersion: survivors.length > 0 ? survivors[survivors.length - 1] : undefined,
119
130
  candidateCount: survivors.length,
120
131
  totalVersions: surviving.total,
132
+ constrained: surviving.total !== undefined && survivors.length === surviving.total ? false : undefined,
121
133
  candidates: candidates.length > 0 ? candidates : undefined,
122
134
  truncated: survivors.length > cap ? true : undefined,
123
135
  evidence: evidence.list,
@@ -127,6 +139,7 @@ function guessPackage(name, cap, surviving, evidence, { used, linkedWith, couple
127
139
  known: surviving.known ? undefined : false,
128
140
  orphan: orphanFunctions && orphanFunctions.length > 0 ? true : undefined,
129
141
  orphanFunctions: orphanFunctions && orphanFunctions.length > 0 ? orphanFunctions : undefined,
142
+ orphanEvidence: orphanEvidence && orphanEvidence.length > 0 ? orphanEvidence : undefined,
130
143
  orphanAlternatives: orphanAlternatives && orphanAlternatives.length > 0 ? orphanAlternatives : undefined,
131
144
  used
132
145
  });
@@ -157,9 +170,11 @@ async function executeGuessDepVersionsQuery({ analyzer }, queries) {
157
170
  }
158
171
  // bound base packages by R only when the version is genuinely known; in `auto` mode with nothing detected, base tries every R release
159
172
  const rVersion = ctx.rVersionKnown ? (ctx.meta.getRVersion() ?? ctx.resolvedRVersion) : undefined;
173
+ const rVersionOrigin = rVersion !== undefined ? ctx.rVersionOrigin : undefined;
160
174
  // the analyzed package guesses versions for its dependencies, not for itself
161
175
  const self = ctx.meta.getNamespace();
162
176
  const graph = (await analyzer.dataflow()).graph;
177
+ const locate = locatorOf((await analyzer.normalize()).idMap);
163
178
  const usage = (0, dependency_version_space_1.collectUsage)(graph, deps);
164
179
  // fold orphan calls (`ggplot()` with ggplot2 neither declared nor loaded) into usage; a package the project does
165
180
  // not already know is flagged for downstream attachment (see collectOrphanUsage)
@@ -173,7 +188,7 @@ async function executeGuessDepVersionsQuery({ analyzer }, queries) {
173
188
  const cap = query.maxCandidates ?? guess_dep_versions_query_format_1.DefaultCandidateCap;
174
189
  const explodeOrder = query.explode?.order ?? 'newest';
175
190
  const guessedAll = sorted.map(name => {
176
- const evidence = new EvidenceCollector();
191
+ const evidence = new EvidenceCollector(locate);
177
192
  const surviving = space.survivors(name, transitive.get(name) ?? [], evidence.add);
178
193
  return { name, evidence, surviving };
179
194
  });
@@ -253,11 +268,13 @@ async function executeGuessDepVersionsQuery({ analyzer }, queries) {
253
268
  const dependencies = [];
254
269
  const ordered = [];
255
270
  for (const g of guessedAll) {
271
+ const orphanCalls = [...orphans.attributed.get(g.name) ?? []].sort(([a], [b]) => a.localeCompare(b));
256
272
  dependencies.push(guessPackage(g.name, cap, g.surviving, g.evidence, {
257
273
  used: usage.has(g.name),
258
274
  linkedWith: linkedWith.get(g.name),
259
275
  coupledWith: coupledWith.get(g.name),
260
- orphanFunctions: [...orphans.attributed.get(g.name) ?? []].sort(),
276
+ orphanFunctions: orphanCalls.map(([fn]) => fn),
277
+ orphanEvidence: orphanCalls.map(([fn, call]) => (0, objects_1.compactRecord)({ function: fn, location: locate(call.at), reason: call.reason, exporters: call.exporters })),
261
278
  orphanAlternatives: orphanAlternatives(g.name)
262
279
  }));
263
280
  const oc = query.explode ? (0, dependency_version_space_1.orderedCandidatesOf)(space.resolve(g.name).src, g.name, g.surviving, query.explode.prefer?.[g.name], explodeOrder) : undefined;
@@ -266,13 +283,15 @@ async function executeGuessDepVersionsQuery({ analyzer }, queries) {
266
283
  }
267
284
  }
268
285
  const assignments = query.explode
269
- ? [...(0, dependency_version_space_1.assignmentsOf)(ordered, query.explode.limit ?? dependency_version_space_1.DefaultExplodeLimit, (0, dependency_version_space_1.declaredDependenciesOf)(space))].map(a => ({ versions: Object.fromEntries(a.versions) }))
286
+ ? [...(0, dependency_version_space_1.assignmentsOf)(ordered, query.explode.limit ?? dependency_version_space_1.DefaultExplodeLimit, (0, dependency_version_space_1.declaredDependenciesOf)(space))]
287
+ .map(a => (0, objects_1.compactRecord)({ versions: Object.fromEntries(a.versions), unverified: a.unverified }))
270
288
  : undefined;
271
289
  return (0, objects_1.compactRecord)({
272
290
  '.meta': { timing: Date.now() - start },
273
291
  dependencies,
274
292
  dateCutoff: cutoff ? (0, dependency_version_space_1.isoDay)(cutoff) : undefined,
275
293
  rVersion,
294
+ rVersionOrigin,
276
295
  versionSelection: ctx.config.solver.sigdb.versionSelection,
277
296
  runnableCombinations,
278
297
  possibleCombinations,
@@ -2,11 +2,13 @@ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
2
  import Joi from 'joi';
3
3
  import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
4
  import type { ParsedQueryLine } from '../../query';
5
+ import { type OutputFormatter } from '../../../util/text/ansi';
5
6
  import { type VersionString } from '../../../util/r-version';
6
7
  import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
7
8
  import { VersionSelection, type FlowrConfig } from '../../../config';
8
9
  import { executeGuessDepVersionsQuery } from './guess-dep-versions-query-executor';
9
- import type { ConstraintSource, DerivedConstraint } from '../../../project/dependency-version-space';
10
+ import type { ConstraintSource, DerivedConstraint, OrphanReason } from '../../../project/dependency-version-space';
11
+ import type { RVersionOrigin } from '../../../project/context/flowr-analyzer-context';
10
12
  /**
11
13
  * Guesses the possible version range of every dependency of a project by combining what the project *declares*
12
14
  * (a `DESCRIPTION` range, an `rproject.toml` entry, a lockfile pin, and their transitive constraints) with what
@@ -45,17 +47,32 @@ export interface GuessExplodeOptions {
45
47
  /** one concrete version choice per resolvable dependency (`package -> version`) */
46
48
  export interface VersionAssignmentView {
47
49
  readonly versions: Readonly<Record<string, VersionString>>;
50
+ /** see {@link VersionAssignment.unverified}: requirements on packages this assignment does not choose */
51
+ readonly unverified?: readonly string[];
48
52
  }
49
53
  /** the default cap on how many surviving candidate versions are listed per dependency */
50
54
  export declare const DefaultCandidateCap = 16;
51
55
  /** where a single bound on a dependency's version came from (the {@link DerivedConstraint} source, from the resolver) */
52
56
  export type GuessEvidenceSource = ConstraintSource;
53
57
  /**
54
- * One provenance-carrying constraint on a dependency's version: where it comes from (`source`/`origin`) and what
55
- * it requires (`bound`). The set of these on a {@link GuessedDependency} is exactly why the range is what it is, so
56
- * it can answer "it must be `>= 4.2.0` because ...". This is the resolver's {@link DerivedConstraint}.
58
+ * The resolver's {@link DerivedConstraint} with its {@link DerivedConstraint.at|call site} resolved to a readable
59
+ * location, so the evidence answers not only "it must be `>= 4.2.0` because it calls `filter(.by=)`" but also where.
57
60
  */
58
- export type GuessVersionEvidence = DerivedConstraint;
61
+ export interface GuessVersionEvidence extends DerivedConstraint {
62
+ /** the location of the call that carried the evidence, e.g. `12:3` or `helper.R:12:3` */
63
+ readonly location?: string;
64
+ }
65
+ /** why a package is reported as an orphan: the call that would be undefined without it, and how it was picked */
66
+ export interface OrphanEvidenceView {
67
+ /** the undefined function that is called, e.g. `ggplot` */
68
+ readonly function: string;
69
+ /** where it is called, e.g. `12:3` */
70
+ readonly location?: string;
71
+ /** why this package and not another exporter of the name */
72
+ readonly reason: OrphanReason;
73
+ /** how many packages export the name */
74
+ readonly exporters: number;
75
+ }
59
76
  /** one package an orphan call could have meant instead, with the versions of it that fit those calls */
60
77
  export interface OrphanAlternativeView {
61
78
  readonly package: string;
@@ -109,6 +126,13 @@ export interface GuessedDependency {
109
126
  * and never appears in {@link GuessDepVersionsQueryResult.assignments}, so a consumer should resolve it by other means.
110
127
  */
111
128
  readonly known?: boolean;
129
+ /**
130
+ * Set to `false` when nothing narrowed the package: every version the database holds survives, so the range
131
+ * merely restates what is available. Its {@link minVersion}/{@link maxVersion} then say nothing about the code
132
+ * (an era read off the minimum would be the database's oldest release, not the script's), which a range that
133
+ * happens to end at the newest version does not reveal on its own.
134
+ */
135
+ readonly constrained?: boolean;
112
136
  /**
113
137
  * Set when this package was inferred purely from *orphan* calls: bare calls (`ggplot()`) that flowR could not
114
138
  * resolve and that no loaded package defines, but whose name is exported by exactly this one package in the
@@ -118,6 +142,8 @@ export interface GuessedDependency {
118
142
  readonly orphan?: boolean;
119
143
  /** the undefined orphan function names that inferred this package (only set when {@link orphan}), e.g. `['ggplot']` */
120
144
  readonly orphanFunctions?: readonly string[];
145
+ /** per {@link orphanFunctions} entry, where the undefined call is and why it was pinned on this package */
146
+ readonly orphanEvidence?: readonly OrphanEvidenceView[];
121
147
  /**
122
148
  * The other packages that export the {@link orphanFunctions}, each with the versions of it that would fit the
123
149
  * calls. Attributing an orphan is a guess: the most downloaded exporter wins, and these are the ones it beat,
@@ -131,6 +157,11 @@ export interface GuessDepVersionsQueryResult extends BaseQueryResult {
131
157
  readonly dateCutoff?: string;
132
158
  /** the R version the guess assumed when bounding base-R packages, if known */
133
159
  readonly rVersion?: string;
160
+ /**
161
+ * Where {@link rVersion} comes from. An `engine` version is the R installation running the analysis, which
162
+ * bounds the guess without saying anything about the analyzed code, unlike a `config` pin or project `metadata`.
163
+ */
164
+ readonly rVersionOrigin?: RVersionOrigin;
134
165
  /** the configured version-selection policy the sample illustrates (newest by default; see `solver.sigdb.versionSelection`) */
135
166
  readonly versionSelection?: VersionSelection;
136
167
  /** version tuples that satisfy every interdependency (the base/R hub counted against each dependency) */
@@ -155,7 +186,7 @@ declare function guessDepVersionsLineParser(_output: ReplOutput, line: readonly
155
186
  export declare const GuessDepVersionsQueryDefinition: {
156
187
  readonly title: "Guess Dependency Versions Query";
157
188
  readonly executor: typeof executeGuessDepVersionsQuery;
158
- readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[], _query: readonly import("../../query").Query[]) => true;
189
+ readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[], _query: readonly import("../../query").Query[]) => true;
159
190
  readonly fromLine: typeof guessDepVersionsLineParser;
160
191
  readonly syntax: "@guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--disabled <letters>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>";
161
192
  readonly schema: Joi.ObjectSchema<any>;