@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
@@ -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
@@ -1,4 +1,6 @@
1
1
  import type { FunctionInfo } from './function-info';
2
2
  import type { LinkToNestedCall } from '../../call-context-query/call-context-query-format';
3
+ /** the assertion helpers of the test frameworks; each hands its input back invisibly, so none reaches stdout */
4
+ export declare const ExpectFunctionNames: RegExp;
3
5
  export declare const ExpectFunctions: LinkToNestedCall;
4
6
  export declare const TestFunctions: FunctionInfo[];
@@ -1,38 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestFunctions = exports.ExpectFunctions = void 0;
3
+ exports.TestFunctions = exports.ExpectFunctions = exports.ExpectFunctionNames = void 0;
4
+ /** the assertion helpers of the test frameworks; each hands its input back invisibly, so none reaches stdout */
5
+ exports.ExpectFunctionNames = new RegExp(/* testthat */ '^(expect_equal|expect_identical|expect_error|expect_warning|expect_message|expect_condition|' +
6
+ 'expect_true|expect_false|expect_all_equal|expect_all_true|expect_all_false|expect_lt|expect_lte|expect_gt|expect_gte|' +
7
+ 'expect_length|expect_shape|expect_match|expect_no_match|expect_named|expect_null|expect_setequal|expect_mapequal|' +
8
+ 'expect_contains|expect_in|expect_disjoint|expect_type|expect_s3_class|expect_s4_class|expect_r6_class|expect_s7_class|' +
9
+ 'expect_vector|expect_no_error|expect_no_warning|expect_no_message|expect_no_condition|expect_invisible|expect_visible|' +
10
+ 'expect_output|expect_silent|expect_snapshot|expect_snapshot_value|expect_snapshot_file|announce_snapshot_file|' +
11
+ 'compare_file_binary|compare_file_text|snapshot_accept|snapshot_reject|snapshot_review|' +
12
+ 'fail|pass|expect_success|expect_failure|expect_snapshot_failure|show_failure|' +
13
+ /* tinytest */
14
+ 'exit_file|exit_if_not|expect_equal|expect_identical|expect_equivalent|expect_true|expect_false|expect_silent|expect_null|' +
15
+ 'expect_inherits|expect_error|expect_warning|expect_message|expect_stdout|expect_equal_to_reference|' +
16
+ 'expect_equivalent_to_reference|expect_length|expect_match|ignore|report_side_effects|' +
17
+ /* testit */
18
+ 'assert|' +
19
+ /* RUnit */
20
+ 'checkEquals|checkEqualsNumeric|checkIdentical|checkTrue|checkException|' +
21
+ /* checkmate */
22
+ 'assertAccess|assert_access|assertArray|assert_array|assert_atomic|assertAtomic|assert_atomic_vector|assertAtomicVector|' +
23
+ 'assert_character|assertCharacter|assert_choice|assertChoice|assert_class|assertClass|assert_complex|assertComplex|' +
24
+ 'assert_count|assertCount|assert_data_frame|assertDataFrame|assert_data_table|assertDataTable|assert_date|assertDate|' +
25
+ 'assert_directory|assertDirectory|assert_directory_exists|assertDirectoryExists|assert_disjunct|assertDisjunct|assert_double|' +
26
+ 'assertDouble|assert_environment|assertEnvironment|assert_factor|assertFactor|assert_false|assertFalse|assert_file|assertFile|' +
27
+ 'assert_file_exists|assertFileExists|assert_flag|assertFlag|assert_formula|assertFormula|assert_function|assertFunction|' +
28
+ 'assert_int|assertInt|assert_integer|assertInteger|assert_list|assertList|assert_logical|assertLogical|assert_matrix|' +
29
+ 'assertMatrix|assert_multi_class|assertMultiClass|assert_named|assertNamed|assert_names|assertNames|assert_null|assertNull|' +
30
+ 'assert_number|assertNumber|assert_numeric|assertNumeric|assert_os|assertOs|assert_path_for_output|assertPathForOutput|' +
31
+ 'assert_permutation|assertPermutation|assert_posixct|assertPOSIXct|assert_r6|assertR6|assert_raw|assertRaw|assert_scalar|' +
32
+ 'assertScalar|assert_scalar_na|assertScalarNA|assert_set_equal|assertSetEqual|assert_string|assertString|assert_subset|' +
33
+ 'assertSubset|assert_tibble|assertTibble|assert_true|assertTrue|assert_vector|assertVector' +
34
+ ')$');
4
35
  exports.ExpectFunctions = {
5
36
  type: 'link-to-nested-call',
6
- callName: new RegExp(/* testthat */ '^(expect_equal|expect_identical|expect_error|expect_warning|expect_message|expect_condition|' +
7
- 'expect_true|expect_false|expect_all_equal|expect_all_true|expect_all_false|expect_lt|expect_lte|expect_gt|expect_gte|' +
8
- 'expect_length|expect_shape|expect_match|expect_no_match|expect_named|expect_null|expect_setequal|expect_mapequal|' +
9
- 'expect_contains|expect_in|expect_disjoint|expect_type|expect_s3_class|expect_s4_class|expect_r6_class|expect_s7_class|' +
10
- 'expect_vector|expect_no_error|expect_no_warning|expect_no_message|expect_no_condition|expect_invisible|expect_visible|' +
11
- 'expect_output|expect_silent|expect_snapshot|expect_snapshot_value|expect_snapshot_file|announce_snapshot_file|' +
12
- 'compare_file_binary|compare_file_text|snapshot_accept|snapshot_reject|snapshot_review|' +
13
- 'fail|pass|expect_success|expect_failure|expect_snapshot_failure|show_failure|' +
14
- /* tinytest */
15
- 'exit_file|exit_if_not|expect_equal|expect_identical|expect_equivalent|expect_true|expect_false|expect_silent|expect_null|' +
16
- 'expect_inherits|expect_error|expect_warning|expect_message|expect_stdout|expect_equal_to_reference|' +
17
- 'expect_equivalent_to_reference|expect_length|expect_match|ignore|report_side_effects|' +
18
- /* testit */
19
- 'assert|' +
20
- /* RUnit */
21
- 'checkEquals|checkEqualsNumeric|checkIdentical|checkTrue|checkException|' +
22
- /* checkmate */
23
- 'assertAccess|assert_access|assertArray|assert_array|assert_atomic|assertAtomic|assert_atomic_vector|assertAtomicVector|' +
24
- 'assert_character|assertCharacter|assert_choice|assertChoice|assert_class|assertClass|assert_complex|assertComplex|' +
25
- 'assert_count|assertCount|assert_data_frame|assertDataFrame|assert_data_table|assertDataTable|assert_date|assertDate|' +
26
- 'assert_directory|assertDirectory|assert_directory_exists|assertDirectoryExists|assert_disjunct|assertDisjunct|assert_double|' +
27
- 'assertDouble|assert_environment|assertEnvironment|assert_factor|assertFactor|assert_false|assertFalse|assert_file|assertFile|' +
28
- 'assert_file_exists|assertFileExists|assert_flag|assertFlag|assert_formula|assertFormula|assert_function|assertFunction|' +
29
- 'assert_int|assertInt|assert_integer|assertInteger|assert_list|assertList|assert_logical|assertLogical|assert_matrix|' +
30
- 'assertMatrix|assert_multi_class|assertMultiClass|assert_named|assertNamed|assert_names|assertNames|assert_null|assertNull|' +
31
- 'assert_number|assertNumber|assert_numeric|assertNumeric|assert_os|assertOs|assert_path_for_output|assertPathForOutput|' +
32
- 'assert_permutation|assertPermutation|assert_posixct|assertPOSIXct|assert_r6|assertR6|assert_raw|assertRaw|assert_scalar|' +
33
- 'assertScalar|assert_scalar_na|assertScalarNA|assert_set_equal|assertSetEqual|assert_string|assertString|assert_subset|' +
34
- 'assertSubset|assert_tibble|assertTibble|assert_true|assertTrue|assert_vector|assertVector' +
35
- ')$')
37
+ callName: exports.ExpectFunctionNames
36
38
  };
37
39
  const ContextFunctions = {
38
40
  type: 'link-to-last-call',
@@ -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
@@ -128,7 +132,26 @@ const WriteFunctionsWithMore = [
128
132
  { package: 'av', name: 'av_capture_graphics', argIdx: 1, argName: 'output', resolveValue: true },
129
133
  { package: 'tuneR', name: 'writeWave', argIdx: 1, argName: 'filename', resolveValue: true },
130
134
  { package: 'seewave', name: 'savewav', argName: 'filename', resolveValue: true, defaultValue: '<wave-name>' },
131
- { package: 'audio', name: 'save.wave', argIdx: 1, argName: 'where', resolveValue: true }
135
+ { package: 'audio', name: 'save.wave', argIdx: 1, argName: 'where', resolveValue: true },
136
+ /* geospatial */
137
+ { package: 'terra', name: 'writeRaster', argIdx: 1, argName: 'filename', resolveValue: true },
138
+ { package: 'terra', name: 'writeVector', argIdx: 1, argName: 'filename', resolveValue: true },
139
+ { package: 'terra', name: 'writeCDF', argIdx: 1, argName: 'filename', resolveValue: true },
140
+ { package: 'raster', name: 'writeRaster', argIdx: 1, argName: 'filename', resolveValue: true },
141
+ { package: 'stars', name: 'write_stars', argIdx: 1, argName: 'dsn', resolveValue: true },
142
+ /* array / binary science formats */
143
+ { package: 'ncdf4', name: 'nc_create', argIdx: 0, argName: 'filename', resolveValue: true },
144
+ { package: 'RNetCDF', name: 'create.nc', argIdx: 0, argName: 'filename', resolveValue: true },
145
+ { package: 'R.matlab', name: 'writeMat', argIdx: 0, argName: 'con', resolveValue: true },
146
+ { package: 'rhdf5', name: 'h5write', argIdx: 1, argName: 'file', resolveValue: true },
147
+ { package: 'rhdf5', name: 'h5createFile', argIdx: 0, argName: 'file', resolveValue: true },
148
+ { package: 'fst', name: 'write_fst', argIdx: 1, argName: 'path', resolveValue: true },
149
+ { package: 'qs', name: 'qsave', argIdx: 1, argName: 'file', resolveValue: true },
150
+ { package: 'yaml', name: 'write_yaml', argIdx: 1, argName: 'file', resolveValue: true },
151
+ /* phylogeny / sequence */
152
+ { package: 'ape', name: 'write.dna', argIdx: 1, argName: 'file', resolveValue: true },
153
+ { package: 'ape', name: 'write.nexus.data', argIdx: 1, argName: 'file', resolveValue: true },
154
+ { package: 'seqinr', name: 'write.fasta', argIdx: 2, argName: 'file.out', resolveValue: true }
132
155
  ];
133
156
  exports.WriteFunctions = [
134
157
  ...WriteFunctionsWithMore,
@@ -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)].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
@@ -39,23 +41,38 @@ export interface GuessExplodeOptions {
39
41
  readonly order?: 'newest' | 'oldest';
40
42
  /** a version to prefer per dependency when it survives the constraints (package name to version) */
41
43
  readonly prefer?: Readonly<Record<string, VersionString>>;
42
- /** cap the number of assignments produced */
44
+ /** cap the number of combinations considered; the ones that cannot be loaded together are skipped, not returned */
43
45
  readonly limit?: number;
44
46
  }
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>;