@eagleoutice/flowr 2.13.4 → 2.13.6

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 (133) hide show
  1. package/README.md +29 -29
  2. package/cli/repl/core.js +10 -2
  3. package/config.d.ts +4 -1
  4. package/config.js +10 -1
  5. package/control-flow/cfg-dead-code.js +19 -4
  6. package/control-flow/extract-cfg.js +12 -4
  7. package/dataflow/environments/built-in-config.d.ts +6 -3
  8. package/dataflow/environments/built-in-eval-name.d.ts +20 -0
  9. package/dataflow/environments/built-in-eval-name.js +25 -0
  10. package/dataflow/environments/built-in-props.d.ts +175 -0
  11. package/dataflow/environments/built-in-props.js +207 -0
  12. package/dataflow/environments/built-in.d.ts +26 -22
  13. package/dataflow/environments/built-in.js +37 -10
  14. package/dataflow/environments/default-builtin-config.d.ts +1068 -95
  15. package/dataflow/environments/default-builtin-config.js +549 -216
  16. package/dataflow/environments/identifier.d.ts +24 -1
  17. package/dataflow/environments/identifier.js +24 -2
  18. package/dataflow/environments/query-fn-props.d.ts +102 -0
  19. package/dataflow/environments/query-fn-props.js +188 -0
  20. package/dataflow/eval/resolve/alias-tracking.d.ts +6 -5
  21. package/dataflow/eval/resolve/alias-tracking.js +45 -12
  22. package/dataflow/eval/resolve/match-arguments.d.ts +15 -0
  23. package/dataflow/eval/resolve/match-arguments.js +77 -0
  24. package/dataflow/eval/resolve/resolve-numbers.d.ts +202 -0
  25. package/dataflow/eval/resolve/resolve-numbers.js +163 -0
  26. package/dataflow/eval/resolve/resolve-operators.d.ts +60 -0
  27. package/dataflow/eval/resolve/resolve-operators.js +115 -0
  28. package/dataflow/eval/resolve/resolve-strings.d.ts +98 -0
  29. package/dataflow/eval/resolve/resolve-strings.js +116 -0
  30. package/dataflow/eval/resolve/resolve.d.ts +5 -37
  31. package/dataflow/eval/resolve/resolve.js +56 -134
  32. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -1
  33. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +5 -4
  34. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +1 -4
  35. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
  36. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -1
  37. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
  38. package/documentation/data/faq/faqs.js +11 -0
  39. package/documentation/doc-util/doc-types.js +1 -1
  40. package/documentation/wiki-analyzer.js +75 -0
  41. package/documentation/wiki-core.js +81 -16
  42. package/documentation/wiki-interface.js +3 -0
  43. package/linter/linter-rules.d.ts +10 -11
  44. package/linter/rules/deprecated-functions.js +5 -3
  45. package/linter/rules/function-finder-util.d.ts +2 -2
  46. package/linter/rules/function-finder-util.js +10 -3
  47. package/linter/rules/network-functions.d.ts +25 -5
  48. package/linter/rules/network-functions.js +51 -11
  49. package/linter/rules/problematic-inputs.d.ts +1 -1
  50. package/linter/rules/problematic-inputs.js +7 -1
  51. package/linter/rules/seeded-randomness.d.ts +5 -8
  52. package/linter/rules/seeded-randomness.js +18 -10
  53. package/linter/rules/unused-definition.js +29 -17
  54. package/package.json +4 -2
  55. package/project/cache/flowr-analyzer-cache.d.ts +4 -3
  56. package/project/cache/flowr-analyzer-cache.js +32 -13
  57. package/project/cache/flowr-cache.d.ts +39 -12
  58. package/project/cache/flowr-cache.js +5 -3
  59. package/project/context/flowr-analyzer-context.d.ts +8 -1
  60. package/project/context/flowr-analyzer-context.js +11 -1
  61. package/project/context/flowr-analyzer-dependencies-context.d.ts +8 -2
  62. package/project/context/flowr-analyzer-dependencies-context.js +43 -11
  63. package/project/context/flowr-analyzer-files-context.d.ts +8 -4
  64. package/project/context/flowr-analyzer-files-context.js +20 -1
  65. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +33 -0
  66. package/project/context/flowr-analyzer-incremental-analysis-context.js +63 -0
  67. package/project/context/flowr-analyzer-meta-context.d.ts +3 -1
  68. package/project/context/flowr-analyzer-meta-context.js +14 -0
  69. package/project/context/flowr-file.d.ts +25 -3
  70. package/project/context/flowr-file.js +24 -2
  71. package/project/dependency-version-space.d.ts +37 -0
  72. package/project/dependency-version-space.js +118 -26
  73. package/project/flowr-analyzer.d.ts +6 -0
  74. package/project/flowr-analyzer.js +6 -2
  75. package/project/incremental/incremental-parse/edit-computation.d.ts +7 -0
  76. package/project/incremental/incremental-parse/edit-computation.js +61 -0
  77. package/project/incremental/incremental-parse/incremental-parse.d.ts +12 -0
  78. package/project/incremental/incremental-parse/incremental-parse.js +37 -0
  79. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +1 -1
  80. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +57 -0
  81. package/project/plugins/file-plugins/files/flowr-manifest-files.js +121 -0
  82. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -2
  83. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
  84. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +1 -1
  85. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +33 -0
  86. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +53 -0
  87. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +1 -1
  88. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -3
  89. package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.d.ts +27 -0
  90. package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.js +47 -0
  91. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +7 -0
  92. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +31 -3
  93. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +10 -4
  94. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +17 -4
  95. package/project/plugins/plugin-registry.d.ts +4 -4
  96. package/project/plugins/plugin-registry.js +7 -4
  97. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +4 -4
  98. package/project/sigdb/reader.d.ts +7 -0
  99. package/project/sigdb/reader.js +12 -0
  100. package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +10 -0
  101. package/queries/catalog/dependencies-query/function-info/derived-functions.js +41 -0
  102. package/queries/catalog/dependencies-query/function-info/read-functions.js +13 -12
  103. package/queries/catalog/dependencies-query/function-info/write-functions.js +16 -23
  104. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +33 -3
  105. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +31 -0
  106. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +9 -2
  107. package/queries/catalog/input-sources-query/input-source-functions.d.ts +8 -10
  108. package/queries/catalog/input-sources-query/input-source-functions.js +23 -388
  109. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -0
  110. package/queries/catalog/input-sources-query/input-sources-query-format.js +27 -10
  111. package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -1
  112. package/queries/catalog/signature-query/signature-query-executor.js +79 -3
  113. package/queries/catalog/signature-query/signature-query-format.d.ts +27 -0
  114. package/queries/catalog/signature-query/signature-query-render.js +21 -3
  115. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +6 -2
  116. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +21 -2
  117. package/r-bridge/parser.d.ts +11 -1
  118. package/r-bridge/parser.js +7 -4
  119. package/r-bridge/shell-executor.d.ts +1 -0
  120. package/r-bridge/shell-executor.js +1 -0
  121. package/r-bridge/shell.d.ts +1 -0
  122. package/r-bridge/shell.js +1 -0
  123. package/search/flowr-search-filters.d.ts +1 -6
  124. package/search/flowr-search-filters.js +1 -8
  125. package/search/search-executor/search-enrichers.d.ts +2 -0
  126. package/search/search-executor/search-enrichers.js +29 -12
  127. package/util/version.js +1 -1
  128. package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +0 -31
  129. package/project/plugins/file-plugins/files/flowr-rproject-file.js +0 -66
  130. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +0 -22
  131. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +0 -36
  132. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +0 -13
  133. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +0 -32
@@ -71,12 +71,18 @@ export declare class FlowrAnalyzerPackageVersionsSigDbPlugin extends FlowrAnalyz
71
71
  signatureSources(config?: FlowrConfig): readonly PackageSignatureSource[];
72
72
  loadedDatabases(): SigDbLoadedInfo[];
73
73
  /**
74
- * Packages in the loaded sources (respecting `self`-package exclusion) that export `name`. Backed by a
75
- * reverse index built once per source set, so repeated hint lookups (e.g. from the `undefined-symbol` linter)
76
- * do not re-scan every package. The first call still pays one full pass over the sources.
74
+ * Packages in the loaded sources (respecting `self`-package exclusion) that export `name`, **most downloaded
75
+ * first**, so whoever has to pick one (or show only a few) starts with the package a script most likely means.
76
+ * Backed by a reverse index built once per source set, so repeated hint lookups (e.g. from the
77
+ * `undefined-symbol` linter) do not re-scan every package. The first call still pays one full pass over the
78
+ * sources.
77
79
  */
78
80
  packagesExporting(name: string): readonly string[];
79
- /** one pass over every loaded source building `export name -> packages`, honoring self-package exclusion */
81
+ /**
82
+ * One pass over every loaded source building `export name -> packages`, honoring self-package exclusion.
83
+ * Each list ends up sorted by download count (descending, ties by name), which the sort at the end does
84
+ * once per name rather than at every lookup.
85
+ */
80
86
  private buildExportIndex;
81
87
  /**
82
88
  * The raw sources in priority order: explicit constructor sources, `$FLOWR_SIGDB`, then **every** bundled
@@ -252,9 +252,11 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
252
252
  return this.loadSources().map(describeLoadedDatabase);
253
253
  }
254
254
  /**
255
- * Packages in the loaded sources (respecting `self`-package exclusion) that export `name`. Backed by a
256
- * reverse index built once per source set, so repeated hint lookups (e.g. from the `undefined-symbol` linter)
257
- * do not re-scan every package. The first call still pays one full pass over the sources.
255
+ * Packages in the loaded sources (respecting `self`-package exclusion) that export `name`, **most downloaded
256
+ * first**, so whoever has to pick one (or show only a few) starts with the package a script most likely means.
257
+ * Backed by a reverse index built once per source set, so repeated hint lookups (e.g. from the
258
+ * `undefined-symbol` linter) do not re-scan every package. The first call still pays one full pass over the
259
+ * sources.
258
260
  */
259
261
  packagesExporting(name) {
260
262
  if (!(0, config_1.isSigDbEnabled)(this.analyzerCtx?.config)) {
@@ -263,14 +265,20 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
263
265
  this.exportIndex ??= this.buildExportIndex();
264
266
  return this.exportIndex.get(name) ?? [];
265
267
  }
266
- /** one pass over every loaded source building `export name -> packages`, honoring self-package exclusion */
268
+ /**
269
+ * One pass over every loaded source building `export name -> packages`, honoring self-package exclusion.
270
+ * Each list ends up sorted by download count (descending, ties by name), which the sort at the end does
271
+ * once per name rather than at every lookup.
272
+ */
267
273
  buildExportIndex() {
268
274
  const index = new Map();
275
+ const downloads = new Map();
269
276
  for (const src of this.loadSources()) {
270
277
  for (const pkg of src.packageNames()) {
271
278
  if (this.isSelfPackage(pkg)) {
272
279
  continue;
273
280
  }
281
+ downloads.set(pkg, Math.max(downloads.get(pkg) ?? 0, src.downloads(pkg)));
274
282
  for (const exp of src.lookup(pkg)?.exported ?? []) {
275
283
  const owners = index.get(exp);
276
284
  if (owners === undefined) {
@@ -282,6 +290,11 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
282
290
  }
283
291
  }
284
292
  }
293
+ for (const owners of index.values()) {
294
+ if (owners.length > 1) {
295
+ owners.sort((a, b) => (downloads.get(b) ?? 0) - (downloads.get(a) ?? 0) || a.localeCompare(b));
296
+ }
297
+ }
285
298
  return index;
286
299
  }
287
300
  /**
@@ -2,7 +2,7 @@ import type { FlowrAnalyzerPlugin } from './flowr-analyzer-plugin';
2
2
  import { FlowrAnalyzerDescriptionFilePlugin } from './file-plugins/flowr-analyzer-description-file-plugin';
3
3
  import { FlowrAnalyzerPackageVersionsDescriptionFilePlugin } from './package-version-plugins/flowr-analyzer-package-versions-description-file-plugin';
4
4
  import { FlowrAnalyzerPackageVersionsSigDbPlugin } from './package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin';
5
- import { FlowrAnalyzerPackageVersionsPackratPlugin, FlowrAnalyzerPackageVersionsRenvPlugin, FlowrAnalyzerPackageVersionsRvPlugin } from './package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin';
5
+ import { FlowrAnalyzerPackageVersionsPackratPlugin, FlowrAnalyzerPackageVersionsRenvPlugin, FlowrAnalyzerPackageVersionsRvPlugin, FlowrAnalyzerPackageVersionsUvrPlugin } from './package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin';
6
6
  import { FlowrAnalyzerPackageVersionsSessionInfoPlugin } from './package-version-plugins/flowr-analyzer-package-versions-session-info-plugin';
7
7
  import { FlowrAnalyzerLoadingOrderDescriptionFilePlugin } from './loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin';
8
8
  import { FlowrAnalyzerLoadingOrderImplicitSourcesPlugin } from './loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin';
@@ -18,8 +18,8 @@ import { FlowrAnalyzerMetaTestFilesPlugin } from './file-plugins/flowr-analyzer-
18
18
  import { FlowrAnalyzerMetaInstFilesPlugin } from './file-plugins/flowr-analyzer-inst-file-plugin';
19
19
  import { FlowrAnalyzerLicenseFilePlugin } from './file-plugins/flowr-analyzer-license-file-plugin';
20
20
  import { FlowrAnalyzerVirtualEnvFilePlugin } from './file-plugins/flowr-analyzer-virtualenv-file-plugin';
21
- import { FlowrAnalyzerRProjectFilePlugin } from './file-plugins/flowr-analyzer-rproject-file-plugin';
22
- import { FlowrAnalyzerMetaRProjectFilePlugin } from './package-version-plugins/flowr-analyzer-meta-rproject-file-plugin';
21
+ import { FlowrAnalyzerRProjectFilePlugin, FlowrAnalyzerUvrManifestFilePlugin } from './file-plugins/flowr-analyzer-manifest-file-plugin';
22
+ import { FlowrAnalyzerMetaRProjectFilePlugin, FlowrAnalyzerMetaUvrManifestFilePlugin } from './package-version-plugins/flowr-analyzer-meta-manifest-file-plugin';
23
23
  import { FlowrAnalyzerMetaDescriptionFilePlugin } from './package-version-plugins/flowr-analyzer-meta-description-file-plugin';
24
24
  import { FlowrAnalyzerSweaveFilePlugin } from './file-plugins/notebooks/flowr-analyzer-sweave-file-plugin';
25
25
  import { FlowrAnalyzerGitignoreProjectDiscoveryPlugin, FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin, FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin } from './project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin';
@@ -29,7 +29,7 @@ import { FlowrAnalyzerLoadingOrderRprofilePlugin } from './loading-order-plugins
29
29
  /**
30
30
  * The built-in Flowr Analyzer plugins that are always available.
31
31
  */
32
- export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["versions:sigdb", typeof FlowrAnalyzerPackageVersionsSigDbPlugin], ["versions:renv", typeof FlowrAnalyzerPackageVersionsRenvPlugin], ["versions:rv", typeof FlowrAnalyzerPackageVersionsRvPlugin], ["versions:packrat", typeof FlowrAnalyzerPackageVersionsPackratPlugin], ["versions:session-info", typeof FlowrAnalyzerPackageVersionsSessionInfoPlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["loading-order:implicit-sources", typeof FlowrAnalyzerLoadingOrderImplicitSourcesPlugin], ["loading-order:rprofile", typeof FlowrAnalyzerLoadingOrderRprofilePlugin], ["meta:description", typeof FlowrAnalyzerMetaDescriptionFilePlugin], ["meta:rproject", typeof FlowrAnalyzerMetaRProjectFilePlugin], ["file-roles:vignette", typeof FlowrAnalyzerMetaVignetteFilesPlugin], ["file-roles:test", typeof FlowrAnalyzerMetaTestFilesPlugin], ["file-roles:inst", typeof FlowrAnalyzerMetaInstFilesPlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:rnw", typeof FlowrAnalyzerSweaveFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilesPlugin], ["versions:namespace", typeof FlowrAnalyzerPackageVersionsNamespaceFilePlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin], ["file:rda", typeof FlowrAnalyzerRdaFilePlugin], ["file:license", typeof FlowrAnalyzerLicenseFilePlugin], ["file:virtualenv", typeof FlowrAnalyzerVirtualEnvFilePlugin], ["file:rproject", typeof FlowrAnalyzerRProjectFilePlugin], ["file:rprofile", typeof FlowrAnalyzerRprofileFilePlugin], ["project-discovery:gitignore", typeof FlowrAnalyzerGitignoreProjectDiscoveryPlugin], ["project-discovery:rbuildignore", typeof FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin], ["project-discovery:ignore-files", typeof FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin], ["project-discovery:default", typeof FlowrAnalyzerDefaultProjectDiscoveryPlugin], ["project-discovery:full", typeof FlowrAnalyzerFullProjectDiscoveryPlugin]];
32
+ export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["versions:sigdb", typeof FlowrAnalyzerPackageVersionsSigDbPlugin], ["versions:renv", typeof FlowrAnalyzerPackageVersionsRenvPlugin], ["versions:rv", typeof FlowrAnalyzerPackageVersionsRvPlugin], ["versions:uvr", typeof FlowrAnalyzerPackageVersionsUvrPlugin], ["versions:packrat", typeof FlowrAnalyzerPackageVersionsPackratPlugin], ["versions:session-info", typeof FlowrAnalyzerPackageVersionsSessionInfoPlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["loading-order:implicit-sources", typeof FlowrAnalyzerLoadingOrderImplicitSourcesPlugin], ["loading-order:rprofile", typeof FlowrAnalyzerLoadingOrderRprofilePlugin], ["meta:description", typeof FlowrAnalyzerMetaDescriptionFilePlugin], ["meta:rproject", typeof FlowrAnalyzerMetaRProjectFilePlugin], ["meta:uvr", typeof FlowrAnalyzerMetaUvrManifestFilePlugin], ["file-roles:vignette", typeof FlowrAnalyzerMetaVignetteFilesPlugin], ["file-roles:test", typeof FlowrAnalyzerMetaTestFilesPlugin], ["file-roles:inst", typeof FlowrAnalyzerMetaInstFilesPlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:rnw", typeof FlowrAnalyzerSweaveFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilesPlugin], ["versions:namespace", typeof FlowrAnalyzerPackageVersionsNamespaceFilePlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin], ["file:rda", typeof FlowrAnalyzerRdaFilePlugin], ["file:license", typeof FlowrAnalyzerLicenseFilePlugin], ["file:virtualenv", typeof FlowrAnalyzerVirtualEnvFilePlugin], ["file:rproject", typeof FlowrAnalyzerRProjectFilePlugin], ["file:uvr", typeof FlowrAnalyzerUvrManifestFilePlugin], ["file:rprofile", typeof FlowrAnalyzerRprofileFilePlugin], ["project-discovery:gitignore", typeof FlowrAnalyzerGitignoreProjectDiscoveryPlugin], ["project-discovery:rbuildignore", typeof FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin], ["project-discovery:ignore-files", typeof FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin], ["project-discovery:default", typeof FlowrAnalyzerDefaultProjectDiscoveryPlugin], ["project-discovery:full", typeof FlowrAnalyzerFullProjectDiscoveryPlugin]];
33
33
  export type BuiltInFlowrPluginName = typeof BuiltInPlugins[number][0];
34
34
  export type BuiltInFlowrPluginArgs<N extends BuiltInFlowrPluginName> = N extends typeof BuiltInPlugins[number][0] ? ConstructorParameters<Extract<typeof BuiltInPlugins[number], [N, PluginProducer]>[1]> : never;
35
35
  type PluginProducer = new (...args: never[]) => FlowrAnalyzerPlugin;
@@ -24,8 +24,8 @@ const flowr_analyzer_test_file_plugin_1 = require("./file-plugins/flowr-analyzer
24
24
  const flowr_analyzer_inst_file_plugin_1 = require("./file-plugins/flowr-analyzer-inst-file-plugin");
25
25
  const flowr_analyzer_license_file_plugin_1 = require("./file-plugins/flowr-analyzer-license-file-plugin");
26
26
  const flowr_analyzer_virtualenv_file_plugin_1 = require("./file-plugins/flowr-analyzer-virtualenv-file-plugin");
27
- const flowr_analyzer_rproject_file_plugin_1 = require("./file-plugins/flowr-analyzer-rproject-file-plugin");
28
- const flowr_analyzer_meta_rproject_file_plugin_1 = require("./package-version-plugins/flowr-analyzer-meta-rproject-file-plugin");
27
+ const flowr_analyzer_manifest_file_plugin_1 = require("./file-plugins/flowr-analyzer-manifest-file-plugin");
28
+ const flowr_analyzer_meta_manifest_file_plugin_1 = require("./package-version-plugins/flowr-analyzer-meta-manifest-file-plugin");
29
29
  const flowr_analyzer_meta_description_file_plugin_1 = require("./package-version-plugins/flowr-analyzer-meta-description-file-plugin");
30
30
  const flowr_analyzer_sweave_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-sweave-file-plugin");
31
31
  const flowr_analyzer_ignore_file_project_discovery_plugin_1 = require("./project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin");
@@ -41,13 +41,15 @@ exports.BuiltInPlugins = [
41
41
  ['versions:sigdb', flowr_analyzer_package_versions_sigdb_plugin_1.FlowrAnalyzerPackageVersionsSigDbPlugin],
42
42
  ['versions:renv', flowr_analyzer_package_versions_lockfile_plugin_1.FlowrAnalyzerPackageVersionsRenvPlugin],
43
43
  ['versions:rv', flowr_analyzer_package_versions_lockfile_plugin_1.FlowrAnalyzerPackageVersionsRvPlugin],
44
+ ['versions:uvr', flowr_analyzer_package_versions_lockfile_plugin_1.FlowrAnalyzerPackageVersionsUvrPlugin],
44
45
  ['versions:packrat', flowr_analyzer_package_versions_lockfile_plugin_1.FlowrAnalyzerPackageVersionsPackratPlugin],
45
46
  ['versions:session-info', flowr_analyzer_package_versions_session_info_plugin_1.FlowrAnalyzerPackageVersionsSessionInfoPlugin],
46
47
  ['loading-order:description', flowr_analyzer_loading_order_description_file_plugin_1.FlowrAnalyzerLoadingOrderDescriptionFilePlugin],
47
48
  ['loading-order:implicit-sources', flowr_analyzer_loading_order_implicit_sources_plugin_1.FlowrAnalyzerLoadingOrderImplicitSourcesPlugin],
48
49
  ['loading-order:rprofile', flowr_analyzer_loading_order_rprofile_plugin_1.FlowrAnalyzerLoadingOrderRprofilePlugin],
49
50
  ['meta:description', flowr_analyzer_meta_description_file_plugin_1.FlowrAnalyzerMetaDescriptionFilePlugin],
50
- ['meta:rproject', flowr_analyzer_meta_rproject_file_plugin_1.FlowrAnalyzerMetaRProjectFilePlugin],
51
+ ['meta:rproject', flowr_analyzer_meta_manifest_file_plugin_1.FlowrAnalyzerMetaRProjectFilePlugin],
52
+ ['meta:uvr', flowr_analyzer_meta_manifest_file_plugin_1.FlowrAnalyzerMetaUvrManifestFilePlugin],
51
53
  ['file-roles:vignette', flowr_analyzer_vignette_file_plugin_1.FlowrAnalyzerMetaVignetteFilesPlugin],
52
54
  ['file-roles:test', flowr_analyzer_test_file_plugin_1.FlowrAnalyzerMetaTestFilesPlugin],
53
55
  ['file-roles:inst', flowr_analyzer_inst_file_plugin_1.FlowrAnalyzerMetaInstFilesPlugin],
@@ -61,7 +63,8 @@ exports.BuiltInPlugins = [
61
63
  ['file:rda', flowr_analyzer_rda_file_plugin_1.FlowrAnalyzerRdaFilePlugin],
62
64
  ['file:license', flowr_analyzer_license_file_plugin_1.FlowrAnalyzerLicenseFilePlugin],
63
65
  ['file:virtualenv', flowr_analyzer_virtualenv_file_plugin_1.FlowrAnalyzerVirtualEnvFilePlugin],
64
- ['file:rproject', flowr_analyzer_rproject_file_plugin_1.FlowrAnalyzerRProjectFilePlugin],
66
+ ['file:rproject', flowr_analyzer_manifest_file_plugin_1.FlowrAnalyzerRProjectFilePlugin],
67
+ ['file:uvr', flowr_analyzer_manifest_file_plugin_1.FlowrAnalyzerUvrManifestFilePlugin],
65
68
  ['file:rprofile', flowr_analyzer_rprofile_file_plugin_1.FlowrAnalyzerRprofileFilePlugin],
66
69
  ['project-discovery:gitignore', flowr_analyzer_ignore_file_project_discovery_plugin_1.FlowrAnalyzerGitignoreProjectDiscoveryPlugin],
67
70
  ['project-discovery:rbuildignore', flowr_analyzer_ignore_file_project_discovery_plugin_1.FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin],
@@ -32,7 +32,7 @@ exports.FlowrAnalyzerProjectDiscoveryPlugin = FlowrAnalyzerProjectDiscoveryPlugi
32
32
  // `.Rprofile`/`Rprofile.site` carry no extension but are plain R sources
33
33
  exports.discoverRSourcesRegex = /(\.(r|rmd|ipynb|qmd|rnw)|(^|[\\/])\.?Rprofile(\.site)?)$/i;
34
34
  // matched against the posix path relative to the project root
35
- exports.ignorePathsWith = /(^|\/)(\.git|\.svn|\.hg|node_modules|__pycache__|\.Rproj\.user|Rtmp[^/]*|(packrat|renv|rv)\/(lib|library|src|staging|sandbox|bundles)[^/]*)(\/|$)/i;
35
+ exports.ignorePathsWith = /(^|\/)(\.git|\.svn|\.hg|node_modules|__pycache__|\.Rproj\.user|\.uvr|Rtmp[^/]*|(packrat|renv|rv)\/(lib|library|src|staging|sandbox|bundles)[^/]*)(\/|$)/i;
36
36
  exports.excludeRequestsForPaths = /vignettes?|tests?|revdep|inst|data/i;
37
37
  /**
38
38
  * Turn the walked `files` (absolute paths under `root`) into the discovery result: R sources become
@@ -97,7 +97,7 @@ class FlowrAnalyzerFullProjectDiscoveryPlugin extends FlowrAnalyzerProjectDiscov
97
97
  }
98
98
  exports.FlowrAnalyzerFullProjectDiscoveryPlugin = FlowrAnalyzerFullProjectDiscoveryPlugin;
99
99
  // noise directories pruned from the scoped walk on top of `ignorePathsWith`: build output, checks, rendered docs and packaged data
100
- const noiseDirs = /(^|\/)(\.git|\.svn|\.hg|node_modules|__pycache__|\.Rproj\.user|[^/]*\.Rcheck|(packrat|renv|rv)\/(lib|library|src|staging|sandbox|bundles|cache)[^/]*|build|dist|_build|_site|_book|\.quarto|\.cache|Rtmp[^/]*|man|inst\/(extdata|doc))(\/|$)/i;
100
+ const noiseDirs = /(^|\/)(\.git|\.svn|\.hg|node_modules|__pycache__|\.Rproj\.user|\.uvr|[^/]*\.Rcheck|(packrat|renv|rv)\/(lib|library|src|staging|sandbox|bundles|cache)[^/]*|build|dist|_build|_site|_book|\.quarto|\.cache|Rtmp[^/]*|man|inst\/(extdata|doc))(\/|$)/i;
101
101
  // binary/data blobs, dropped even inside an otherwise kept directory
102
102
  const noiseFiles = /\.(rds|rda|rdata|rd|png|jpe?g|gif|svg|pdf|ico|zip|tar|t?gz|bz2|xz|so|o|a|dll|dylib|exe|jar|woff2?|ttf|eot|feather|parquet|xls[xm]?|docx?|pptx?)$/i;
103
103
  const descriptionFilePattern = /^DESCRIPTION(\.(txt|in))?$/i;
@@ -106,8 +106,8 @@ const metadataFilePatterns = [
106
106
  descriptionFilePattern,
107
107
  /^NAMESPACE(\.txt)?$/i,
108
108
  /^NEWS(\.(rd|md))?$/i,
109
- /^(renv|rv|packrat)\.lock$/i,
110
- /^rproject\.toml$/i,
109
+ /^(renv|rv|uvr|packrat)\.lock$/i,
110
+ /^(rproject|uvr)\.toml$/i,
111
111
  /license(\.md|\.txt)?$/i,
112
112
  flowr_analyzer_rprofile_file_plugin_1.RprofileFilePattern,
113
113
  flowr_analyzer_rprofile_file_plugin_1.RenvironFilePattern
@@ -39,6 +39,8 @@ export interface PackageSignatureSource {
39
39
  packageNames(): string[];
40
40
  /** whether the package is an R-core / base package (its versions are the R releases it shipped with) */
41
41
  isBaseR(pkg: string): boolean;
42
+ /** how often the package was downloaded when the database was built, the popularity {@link SigDbPkgMeta} records */
43
+ downloads(pkg: string): number;
42
44
  /** for a base package, the R versions it was part of core (ascending); `undefined` otherwise */
43
45
  coreVersions(pkg: string): RVersion[] | undefined;
44
46
  /** the release date of a package version (defaulting to the newest release), or `undefined` if unknown */
@@ -99,6 +101,7 @@ export declare class MergedSignatureSource implements PackageSignatureSource {
99
101
  dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
100
102
  packageNames(): string[];
101
103
  isBaseR(pkg: string): boolean;
104
+ downloads(pkg: string): number;
102
105
  coreVersions(pkg: string): RVersion[] | undefined;
103
106
  releaseDate(pkg: string, version?: string): Date | undefined;
104
107
  releaseDates(pkg: string): VersionRelease[];
@@ -181,6 +184,8 @@ export declare class SigDatabase implements PackageSignatureSource {
181
184
  dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
182
185
  /** whether this is an R-core / base package (its versions are the R releases it shipped with; see {@link SigDbPkgMeta}) */
183
186
  isBaseR(pkg: string): boolean;
187
+ /** the download count recorded for the package, `0` when this source does not carry it */
188
+ downloads(pkg: string): number;
184
189
  /**
185
190
  * The R versions a base package was part of core, in ascending R-version order (exactly its stored
186
191
  * versions). `undefined` for a non-base package. E.g. `mva` returns `…1.9.1`, `parallel` `2.14.0…`.
@@ -278,6 +283,8 @@ export declare class SigDatabaseSet implements PackageSignatureSource {
278
283
  dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
279
284
  /** whether this is an R-core / base package (see {@link SigDatabase.isBaseR}); O(1) via the hoisted metadata */
280
285
  isBaseR(pkg: string): boolean;
286
+ /** the download count of the package; O(1) via the hoisted metadata, so no shard has to be unpacked for it */
287
+ downloads(pkg: string): number;
281
288
  /** the R versions a base package was part of core (ascending); `undefined` if not a base package */
282
289
  coreVersions(pkg: string): RVersion[] | undefined;
283
290
  /** every known release of a package (version + date), ascending, read once from the most complete shard */
@@ -210,6 +210,9 @@ class MergedSignatureSource {
210
210
  isBaseR(pkg) {
211
211
  return this.sources.some(s => s.has(pkg) && s.isBaseR(pkg));
212
212
  }
213
+ downloads(pkg) {
214
+ return Math.max(0, ...this.sources.map(s => s.downloads(pkg)));
215
+ }
213
216
  coreVersions(pkg) {
214
217
  return this.sources.find(s => s.has(pkg))?.coreVersions(pkg);
215
218
  }
@@ -442,6 +445,10 @@ class SigDatabase {
442
445
  isBaseR(pkg) {
443
446
  return this.index.meta[pkg]?.[3] === 1;
444
447
  }
448
+ /** the download count recorded for the package, `0` when this source does not carry it */
449
+ downloads(pkg) {
450
+ return this.index.meta[pkg]?.[2] ?? 0;
451
+ }
445
452
  /**
446
453
  * The R versions a base package was part of core, in ascending R-version order (exactly its stored
447
454
  * versions). `undefined` for a non-base package. E.g. `mva` returns `…1.9.1`, `parallel` `2.14.0…`.
@@ -757,6 +764,11 @@ class SigDatabaseSet {
757
764
  }
758
765
  return this.route(pkg).some(i => this.shard(i).isBaseR(pkg));
759
766
  }
767
+ /** the download count of the package; O(1) via the hoisted metadata, so no shard has to be unpacked for it */
768
+ downloads(pkg) {
769
+ const meta = this.manifest.meta?.[pkg];
770
+ return meta ? meta[2] : Math.max(0, ...this.route(pkg).map(i => this.shard(i).downloads(pkg)));
771
+ }
760
772
  /** the R versions a base package was part of core (ascending); `undefined` if not a base package */
761
773
  coreVersions(pkg) {
762
774
  if (!this.isBaseR(pkg)) {
@@ -0,0 +1,10 @@
1
+ import type { FunctionInfo } from './function-info';
2
+ import type { CallProps } from '../../../../dataflow/environments/built-in-props';
3
+ /**
4
+ * The built-ins that carry all of `props` and name the resource they act on, as entries of a dependency
5
+ * category. This is what the {@link DefaultBuiltinConfig} already states, so only the functions it does not
6
+ * know (most package functions) and the ones needing more than a resource argument (`ignoreIf`, `linkTo`,
7
+ * a default, ...) have to be written down in the category itself. Names in `except` stay with whoever
8
+ * wrote them down.
9
+ */
10
+ export declare function functionInfosFromProps(props: CallProps, except: readonly FunctionInfo[]): FunctionInfo[];
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.functionInfosFromProps = functionInfosFromProps;
4
+ const built_in_props_1 = require("../../../../dataflow/environments/built-in-props");
5
+ const default_builtin_config_1 = require("../../../../dataflow/environments/default-builtin-config");
6
+ const query_fn_props_1 = require("../../../../dataflow/environments/query-fn-props");
7
+ const identifier_1 = require("../../../../dataflow/environments/identifier");
8
+ /** what an entry links to, like `sink` for `cat`: the link reports it already, so it is not an entry of its own */
9
+ function linkTargets(f) {
10
+ return (f.linkTo ?? []).flatMap(l => typeof l.callName === 'string' ? [l.callName]
11
+ : Array.isArray(l.callName) ? l.callName.map(n => identifier_1.Identifier.getName(n)) : []);
12
+ }
13
+ /**
14
+ * The built-ins that carry all of `props` and name the resource they act on, as entries of a dependency
15
+ * category. This is what the {@link DefaultBuiltinConfig} already states, so only the functions it does not
16
+ * know (most package functions) and the ones needing more than a resource argument (`ignoreIf`, `linkTo`,
17
+ * a default, ...) have to be written down in the category itself. Names in `except` stay with whoever
18
+ * wrote them down.
19
+ */
20
+ function functionInfosFromProps(props, except) {
21
+ const taken = new Set(except.flatMap(f => [f.name, ...linkTargets(f)]));
22
+ const found = [];
23
+ for (const d of default_builtin_config_1.DefaultBuiltinConfig) {
24
+ const info = d.type !== 'constant' ? d.config : undefined;
25
+ if (info?.props === undefined || (info.props & props) !== props || info.sig === undefined) {
26
+ continue;
27
+ }
28
+ const argIdx = info.sig.findIndex(([, p]) => (p & built_in_props_1.ArgProp.Resource) !== 0);
29
+ if (argIdx < 0) {
30
+ continue;
31
+ }
32
+ for (const id of (0, query_fn_props_1.builtInNames)(d)) {
33
+ const name = identifier_1.Identifier.getName(id);
34
+ if (!taken.has(name)) {
35
+ found.push({ package: identifier_1.Identifier.getNamespace(id), name, argIdx, argName: info.sig[argIdx][0], resolveValue: true });
36
+ }
37
+ }
38
+ }
39
+ return found;
40
+ }
41
+ //# sourceMappingURL=derived-functions.js.map
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReadFunctions = void 0;
4
- exports.ReadFunctions = [
4
+ const built_in_props_1 = require("../../../../dataflow/environments/built-in-props");
5
+ const derived_functions_1 = require("./derived-functions");
6
+ const other_path_functions_1 = require("./other-path-functions");
7
+ const ReadFunctionsWithMore = [
5
8
  { package: 'base', name: 'parse', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
6
9
  { package: 'base', name: 'read.table', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
7
10
  { package: 'utils', name: 'read.csv', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
@@ -9,22 +12,16 @@ exports.ReadFunctions = [
9
12
  { package: 'utils', name: 'read.delim', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
10
13
  { package: 'utils', name: 'read.delim2', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
11
14
  { package: 'base', name: 'read.dcf', argIdx: 0, argName: 'file', resolveValue: true },
12
- { package: 'base', name: 'scan', argIdx: 0, argName: 'file', resolveValue: true },
13
15
  { package: 'utils', name: 'read.fwf', argIdx: 0, argName: 'file', resolveValue: true },
14
16
  { package: 'base', name: 'file', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
15
17
  { package: 'base', name: 'url', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
16
- { package: 'base', name: 'load', argIdx: 0, argName: 'file', resolveValue: true },
17
- { package: 'base', name: 'gzfile', argIdx: 1, argName: 'open', resolveValue: true },
18
- { package: 'base', name: 'bzfile', argIdx: 1, argName: 'open', resolveValue: true },
18
+ { package: 'base', name: 'gzfile', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
19
+ { package: 'base', name: 'bzfile', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
19
20
  { package: 'utils', name: 'download.file', argIdx: 0, argName: 'url', resolveValue: true },
20
- { package: 'base', name: 'pipe', argIdx: 1, argName: 'open', resolveValue: true },
21
- { package: 'base', name: 'fifo', argIdx: 1, argName: 'open', resolveValue: true },
22
- { package: 'base', name: 'unz', argIdx: 1, argName: 'open', resolveValue: true },
21
+ { package: 'base', name: 'pipe', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
22
+ { package: 'base', name: 'fifo', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
23
+ { package: 'base', name: 'unz', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
23
24
  { package: 'base', name: 'matrix', argIdx: 0, argName: 'data', resolveValue: true },
24
- { package: 'base', name: 'readRDS', argIdx: 0, argName: 'file', resolveValue: true },
25
- { package: 'base', name: 'readLines', argIdx: 0, argName: 'con', resolveValue: true },
26
- { package: 'base', name: 'readChar', argIdx: 0, argName: 'con', resolveValue: true },
27
- { package: 'base', name: 'readBin', argIdx: 0, argName: 'con', resolveValue: true },
28
25
  { package: 'base', name: 'readRenviron', argIdx: 0, argName: 'path', resolveValue: true },
29
26
  { package: 'readr', name: 'read_csv', argIdx: 0, argName: 'file', resolveValue: true },
30
27
  { package: 'readr', name: 'read_csv2', argIdx: 0, argName: 'file', resolveValue: true },
@@ -138,4 +135,8 @@ exports.ReadFunctions = [
138
135
  /* shinyjs - loads an external JavaScript file */
139
136
  { package: 'shinyjs', name: 'extendShinyjs', argIdx: 0, argName: 'script', resolveValue: true, ignoreIf: 'arg-missing' }
140
137
  ];
138
+ exports.ReadFunctions = [
139
+ ...ReadFunctionsWithMore,
140
+ ...(0, derived_functions_1.functionInfosFromProps)(built_in_props_1.CallProp.File | built_in_props_1.CallProp.Reads, [...ReadFunctionsWithMore, ...other_path_functions_1.OtherPathFunctions])
141
+ ];
141
142
  //# sourceMappingURL=read-functions.js.map
@@ -2,18 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WriteFunctions = void 0;
4
4
  const function_info_1 = require("./function-info");
5
+ const built_in_props_1 = require("../../../../dataflow/environments/built-in-props");
6
+ const derived_functions_1 = require("./derived-functions");
7
+ const other_path_functions_1 = require("./other-path-functions");
8
+ const read_functions_1 = require("./read-functions");
5
9
  const OutputRedirects = [
6
10
  { type: 'link-to-last-call', callName: 'sink', attachLinkInfo: { argIdx: 0, argName: 'file', when: function_info_1.DependencyInfoLinkConstraint.IfUnknown, resolveValue: true } }
7
11
  ];
8
- exports.WriteFunctions = [
9
- { package: 'base', name: 'save', argName: 'file', resolveValue: true },
10
- { package: 'base', name: 'save.image', argIdx: 1, argName: 'file', resolveValue: true, defaultValue: '.RData' },
11
- { package: 'base', name: 'write', argIdx: 1, argName: 'file', resolveValue: true },
12
- { package: 'base', name: 'dput', argIdx: 1, argName: 'file', resolveValue: true },
12
+ const WriteFunctionsWithMore = [
13
+ { package: 'base', name: 'save.image', argIdx: 0, argName: 'file', resolveValue: true, defaultValue: '.RData' },
13
14
  { package: 'base', name: 'dump', argIdx: 1, argName: 'file', resolveValue: true },
14
- { package: 'utils', name: 'write.table', argIdx: 1, argName: 'file', resolveValue: true },
15
15
  { package: 'utils', name: 'write.csv', argIdx: 1, argName: 'file', resolveValue: true },
16
- { package: 'base', name: 'saveRDS', argIdx: 1, argName: 'file', resolveValue: true },
17
16
  {
18
17
  package: 'base',
19
18
  name: 'try',
@@ -36,9 +35,6 @@ exports.WriteFunctions = [
36
35
  { package: 'rlang', name: 'inform', linkTo: OutputRedirects, resolveValue: false },
37
36
  { package: 'cli', name: 'cli_warn', linkTo: OutputRedirects, resolveValue: false },
38
37
  { package: 'cli', name: 'cli_abort', linkTo: OutputRedirects, resolveValue: false },
39
- { package: 'base', name: 'writeLines', argIdx: 1, argName: 'con', resolveValue: true },
40
- { package: 'base', name: 'writeChar', argIdx: 1, argName: 'con', resolveValue: true },
41
- { package: 'base', name: 'writeBin', argIdx: 1, argName: 'con', resolveValue: true },
42
38
  { package: 'base', name: 'file', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-read', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
43
39
  { package: 'base', name: 'url', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-read', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
44
40
  { package: 'readr', name: 'write_csv', argIdx: 1, argName: 'file', resolveValue: true },
@@ -62,18 +58,13 @@ exports.WriteFunctions = [
62
58
  { package: 'foreign', name: 'write.foreign', argIdx: 1, argName: 'file', resolveValue: true },
63
59
  { package: 'xlsx', name: 'write.xlsx', argIdx: 1, argName: 'file', resolveValue: true },
64
60
  { package: 'xlsx', name: 'write.xlsx2', argIdx: 1, argName: 'file', resolveValue: true },
65
- { package: 'grDevices', name: 'pdf', argIdx: 0, argName: 'file', resolveValue: true },
66
- { package: 'grDevices', name: 'jpeg', argIdx: 0, argName: 'file', resolveValue: true },
67
- { package: 'grDevices', name: 'png', argIdx: 0, argName: 'file', resolveValue: true },
61
+ { package: 'grDevices', name: 'jpeg', argIdx: 0, argName: 'filename', resolveValue: true },
62
+ { package: 'grDevices', name: 'png', argIdx: 0, argName: 'filename', resolveValue: true },
68
63
  { package: 'grDevices', name: 'windows', argIdx: 0, argName: 'file', resolveValue: true },
69
- { package: 'grDevices', name: 'postscript', argIdx: 0, argName: 'file', resolveValue: true },
70
- { package: 'grDevices', name: 'xfig', argIdx: 0, argName: 'file', resolveValue: true },
71
- { package: 'grDevices', name: 'bitmap', argIdx: 0, argName: 'file', resolveValue: true },
72
- { package: 'grDevices', name: 'pictex', argIdx: 0, argName: 'file', resolveValue: true },
73
- { package: 'grDevices', name: 'cairo_pdf', argIdx: 0, argName: 'file', resolveValue: true },
74
- { package: 'grDevices', name: 'svg', argIdx: 0, argName: 'file', resolveValue: true },
75
- { package: 'grDevices', name: 'bmp', argIdx: 0, argName: 'file', resolveValue: true },
76
- { package: 'grDevices', name: 'tiff', argIdx: 0, argName: 'file', resolveValue: true },
64
+ { package: 'grDevices', name: 'cairo_pdf', argIdx: 0, argName: 'filename', resolveValue: true },
65
+ { package: 'grDevices', name: 'svg', argIdx: 0, argName: 'filename', resolveValue: true },
66
+ { package: 'grDevices', name: 'bmp', argIdx: 0, argName: 'filename', resolveValue: true },
67
+ { package: 'grDevices', name: 'tiff', argIdx: 0, argName: 'filename', resolveValue: true },
77
68
  { package: 'grDevices', name: 'X11', argIdx: 0, argName: 'file', resolveValue: true },
78
69
  { package: 'grDevices', name: 'quartz', argIdx: 0, argName: 'file', resolveValue: true },
79
70
  { package: 'car', name: 'Export', argIdx: 0, argName: 'file', resolveValue: true },
@@ -101,8 +92,6 @@ exports.WriteFunctions = [
101
92
  { package: 'cowplot', name: 'ggsave2', argIdx: 0, argName: 'filename', resolveValue: true },
102
93
  { package: 'tinyplot', name: 'tinyplot', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
103
94
  { package: 'tinyplot', name: 'plt', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
104
- { package: 'rasterpdf', name: 'raster_pdf', argIdx: 0, argName: 'filename', resolveValue: true },
105
- { package: 'rasterpdf', name: 'agg_pdf', argIdx: 0, argName: 'filename', resolveValue: true },
106
95
  { package: 'highcharter', name: 'hc_exporting', argName: 'filename', resolveValue: true },
107
96
  { package: 'jsonlite', name: 'write_json', argIdx: 1, argName: 'path', resolveValue: true },
108
97
  { package: 'rpolars', name: 'sink_ipc', argIdx: 0, argName: 'path', resolveValue: true, ignoreIf: 'arg-missing' },
@@ -141,4 +130,8 @@ exports.WriteFunctions = [
141
130
  { package: 'seewave', name: 'savewav', argName: 'filename', resolveValue: true, defaultValue: '<wave-name>' },
142
131
  { package: 'audio', name: 'save.wave', argIdx: 1, argName: 'where', resolveValue: true }
143
132
  ];
133
+ exports.WriteFunctions = [
134
+ ...WriteFunctionsWithMore,
135
+ ...(0, derived_functions_1.functionInfosFromProps)(built_in_props_1.CallProp.File | built_in_props_1.CallProp.Writes, [...WriteFunctionsWithMore, ...other_path_functions_1.OtherPathFunctions, ...read_functions_1.ReadFunctions])
136
+ ];
144
137
  //# sourceMappingURL=write-functions.js.map
@@ -4,7 +4,10 @@ exports.executeGuessDepVersionsQuery = executeGuessDepVersionsQuery;
4
4
  const guess_dep_versions_query_format_1 = require("./guess-dep-versions-query-format");
5
5
  const r_version_1 = require("../../../util/r-version");
6
6
  const objects_1 = require("../../../util/objects");
7
+ const visualize_functions_1 = require("../dependencies-query/function-info/visualize-functions");
7
8
  const dependency_version_space_1 = require("../../../project/dependency-version-space");
9
+ /** flowR's curated builtin-library function to package map (e.g. `ggplot` to `ggplot2`), disambiguating an orphan call several packages re-export */
10
+ const BuiltinLibraryByFunction = new Map(visualize_functions_1.VisualizeFunctions.filter(f => f.package !== undefined).map(f => [f.name, f.package]));
8
11
  /** the sources `query` disables: `clean` is sugar for disabling `declared`+`transitive`, `disabled` adds any others by name */
9
12
  function disabledSources(query) {
10
13
  if (!query.clean && !query.disabled?.length) {
@@ -99,7 +102,7 @@ function rangeString(survivors, nonContiguous, unsatisfiable, declaredRange, dec
99
102
  return survivors.length <= cap ? survivors.join(', ') : `${min}...${max} (${survivors.length} discrete)`;
100
103
  }
101
104
  /** build the reported guess for one package from its already-computed surviving versions and provenance */
102
- function guessPackage(name, cap, surviving, evidence, { used, linkedWith, coupledWith }) {
105
+ function guessPackage(name, cap, surviving, evidence, { used, linkedWith, coupledWith, orphanFunctions, orphanAlternatives }) {
103
106
  const { declaredRange, declaredConstraints, unsatisfiable } = surviving;
104
107
  const survivors = surviving.survivors.map(e => e.ver);
105
108
  const preSignature = surviving.preSignature.map(e => e.ver);
@@ -121,6 +124,10 @@ function guessPackage(name, cap, surviving, evidence, { used, linkedWith, couple
121
124
  unsatisfiable: unsatisfiable ? true : undefined,
122
125
  linkedWith: linkedWith && linkedWith.length > 0 ? linkedWith : undefined,
123
126
  coupledWith: coupledWith && coupledWith.length > 0 ? coupledWith : undefined,
127
+ known: surviving.known ? undefined : false,
128
+ orphan: orphanFunctions && orphanFunctions.length > 0 ? true : undefined,
129
+ orphanFunctions: orphanFunctions && orphanFunctions.length > 0 ? orphanFunctions : undefined,
130
+ orphanAlternatives: orphanAlternatives && orphanAlternatives.length > 0 ? orphanAlternatives : undefined,
124
131
  used
125
132
  });
126
133
  }
@@ -150,9 +157,14 @@ async function executeGuessDepVersionsQuery({ analyzer }, queries) {
150
157
  }
151
158
  // bound base packages by R only when the version is genuinely known; in `auto` mode with nothing detected, base tries every R release
152
159
  const rVersion = ctx.rVersionKnown ? (ctx.meta.getRVersion() ?? ctx.resolvedRVersion) : undefined;
153
- const usage = (0, dependency_version_space_1.collectUsage)((await analyzer.dataflow()).graph, deps);
154
160
  // the analyzed package guesses versions for its dependencies, not for itself
155
161
  const self = ctx.meta.getNamespace();
162
+ const graph = (await analyzer.dataflow()).graph;
163
+ const usage = (0, dependency_version_space_1.collectUsage)(graph, deps);
164
+ // fold orphan calls (`ggplot()` with ggplot2 neither declared nor loaded) into usage; a package the project does
165
+ // not already know is flagged for downstream attachment (see collectOrphanUsage)
166
+ const known = new Set([...deps.getDependencies().map(d => d.name), ...deps.declaredPackageNames()]);
167
+ const orphans = (0, dependency_version_space_1.collectOrphanUsage)(graph, deps, usage, pkg => known.has(pkg), { self, builtinLibraryOf: name => BuiltinLibraryByFunction.get(name) });
156
168
  const sorted = (query.packages && query.packages.length > 0 ? [...query.packages] : (0, dependency_version_space_1.defaultTargets)(deps, usage)).filter(name => name !== self).sort();
157
169
  const disabled = disabledSources(query);
158
170
  const space = new dependency_version_space_1.VersionSpace({ deps, usage, cutoff, rVersion, disabled });
@@ -222,13 +234,31 @@ async function executeGuessDepVersionsQuery({ analyzer }, queries) {
222
234
  coupledWith.set(pkg, [...coupledWith.get(pkg) ?? [], c.always ? partner : `${partner} (partial)`]);
223
235
  }
224
236
  }
237
+ // the packages an orphan could have meant instead, resolved in a space of their own so that reporting them
238
+ // does not turn them into dependencies of the project; built only when an orphan actually had a choice
239
+ const altSpace = orphans.alternativeUsage.size > 0
240
+ ? new dependency_version_space_1.VersionSpace({ deps, usage: orphans.alternativeUsage, cutoff, rVersion, disabled }) : undefined;
241
+ const orphanAlternatives = (pkg) => (orphans.alternatives.get(pkg) ?? []).map(alt => {
242
+ const s = altSpace.survivors(alt, []);
243
+ const versions = s.survivors.map(e => e.ver);
244
+ return (0, objects_1.compactRecord)({
245
+ package: alt,
246
+ range: rangeString(versions, false, s.unsatisfiable, s.declaredRange, s.declaredConstraints, cap),
247
+ minVersion: versions[0],
248
+ maxVersion: versions[versions.length - 1],
249
+ candidateCount: versions.length,
250
+ totalVersions: s.total
251
+ });
252
+ });
225
253
  const dependencies = [];
226
254
  const ordered = [];
227
255
  for (const g of guessedAll) {
228
256
  dependencies.push(guessPackage(g.name, cap, g.surviving, g.evidence, {
229
257
  used: usage.has(g.name),
230
258
  linkedWith: linkedWith.get(g.name),
231
- coupledWith: coupledWith.get(g.name)
259
+ coupledWith: coupledWith.get(g.name),
260
+ orphanFunctions: [...orphans.attributed.get(g.name) ?? []].sort(),
261
+ orphanAlternatives: orphanAlternatives(g.name)
232
262
  }));
233
263
  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;
234
264
  if (oc) {
@@ -56,6 +56,16 @@ export type GuessEvidenceSource = ConstraintSource;
56
56
  * it can answer "it must be `>= 4.2.0` because ...". This is the resolver's {@link DerivedConstraint}.
57
57
  */
58
58
  export type GuessVersionEvidence = DerivedConstraint;
59
+ /** one package an orphan call could have meant instead, with the versions of it that fit those calls */
60
+ export interface OrphanAlternativeView {
61
+ readonly package: string;
62
+ /** the version range of this package that would accept the orphan calls, in the notation {@link GuessedDependency.range} uses */
63
+ readonly range: string;
64
+ readonly minVersion?: string;
65
+ readonly maxVersion?: string;
66
+ readonly candidateCount: number;
67
+ readonly totalVersions: number;
68
+ }
59
69
  /** the guessed version range of one dependency */
60
70
  export interface GuessedDependency {
61
71
  readonly package: string;
@@ -93,6 +103,27 @@ export interface GuessedDependency {
93
103
  * no direct `zoo::`/`library(zoo)` call.
94
104
  */
95
105
  readonly used?: boolean;
106
+ /**
107
+ * Set to `false` when the signature database has no record of the package at all (e.g. a Bioconductor package),
108
+ * distinguishing it from one the database carries but cannot constrain. Such a package has no `minVersion`/`maxVersion`
109
+ * and never appears in {@link GuessDepVersionsQueryResult.assignments}, so a consumer should resolve it by other means.
110
+ */
111
+ readonly known?: boolean;
112
+ /**
113
+ * Set when this package was inferred purely from *orphan* calls: bare calls (`ggplot()`) that flowR could not
114
+ * resolve and that no loaded package defines, but whose name is exported by exactly this one package in the
115
+ * signature database. The symbol would be undefined were the package not loaded, so a downstream handler may
116
+ * attach `library(package)`. See {@link orphanFunctions} for the calls that implicated it.
117
+ */
118
+ readonly orphan?: boolean;
119
+ /** the undefined orphan function names that inferred this package (only set when {@link orphan}), e.g. `['ggplot']` */
120
+ readonly orphanFunctions?: readonly string[];
121
+ /**
122
+ * The other packages that export the {@link orphanFunctions}, each with the versions of it that would fit the
123
+ * calls. Attributing an orphan is a guess: the most downloaded exporter wins, and these are the ones it beat,
124
+ * so whoever reads the result can pick another. Ordered as the guess ranked them, best first.
125
+ */
126
+ readonly orphanAlternatives?: readonly OrphanAlternativeView[];
96
127
  }
97
128
  export interface GuessDepVersionsQueryResult extends BaseQueryResult {
98
129
  readonly dependencies: readonly GuessedDependency[];
@@ -278,9 +278,11 @@ exports.GuessDepVersionsQueryDefinition = {
278
278
  const coupled = dep.coupledWith ?? [];
279
279
  const groupTag = (dep.base ? ' ' + (0, ansi_1.italic)('[base]', formatter)
280
280
  : dep.linkedWith ? ' ' + (0, ansi_1.italic)(`[linked: ${dep.linkedWith.join(', ')}]`, formatter) : '')
281
- + (coupled.length > 0 ? ' ' + (0, ansi_1.italic)(`[coupled: ${truncatedList(coupled, 3)}]`, formatter) : '');
281
+ + (coupled.length > 0 ? ' ' + (0, ansi_1.italic)(`[coupled: ${truncatedList(coupled, 3)}]`, formatter) : '')
282
+ + (dep.orphan ? ' ' + (0, ansi_1.color)(`[orphan: attach library(${dep.package}) for ${truncatedList(dep.orphanFunctions ?? [], 3)}]`, 3 /* Colors.Yellow */, formatter) : '');
282
283
  const anyVersion = coupled.length > 0 ? '(any version on its own)' : '(any version)';
283
- const note = dep.base ? '' : dep.used === false ? ' ' + (0, ansi_1.faint)('(not called)', formatter) : !isConstrained(dep) && dep.totalVersions ? ' ' + (0, ansi_1.faint)(anyVersion, formatter) : '';
284
+ const note = dep.known === false ? ' ' + (0, ansi_1.color)('(not in database)', 1 /* Colors.Red */, formatter)
285
+ : dep.base ? '' : dep.used === false ? ' ' + (0, ansi_1.faint)('(not called)', formatter) : !isConstrained(dep) && dep.totalVersions ? ' ' + (0, ansi_1.faint)(anyVersion, formatter) : '';
284
286
  const tag = groupTag + note;
285
287
  const range = dep.unsatisfiable ? (0, ansi_1.color)('unsatisfiable', 1 /* Colors.Red */, formatter) : (0, ansi_1.bold)(dep.range, formatter);
286
288
  const count = dep.totalVersions !== undefined ? `${dep.candidateCount}/${dep.totalVersions} versions` : `${dep.candidateCount} candidate${dep.candidateCount === 1 ? '' : 's'}`;
@@ -288,6 +290,11 @@ exports.GuessDepVersionsQueryDefinition = {
288
290
  const dbGe = versionBound(tightestBound(avail, '>='))?.ver, dbLe = versionBound(tightestBound(avail, '<='))?.ver;
289
291
  const dbRange = dbGe !== undefined && dbLe !== undefined ? `, db ${dbGe} - ${dbLe}` : '';
290
292
  result.push(` ${(0, ansi_1.bold)('━ ' + dep.package, formatter)}${tag} ${range} ${(0, ansi_1.faint)('(' + count + dbRange + ')', formatter)}`);
293
+ if (dep.orphanAlternatives?.length) {
294
+ // attributing an orphan is a guess, so name the exporters it beat and what each of them would fit
295
+ const alts = dep.orphanAlternatives.map(a => `${a.package} ${a.range}`);
296
+ result.push(` ${(0, ansi_1.italic)('or instead', formatter)}: ${truncatedList(alts, 4)}`);
297
+ }
291
298
  // only enforced evidence sets the tightest bound; a partial one narrows nothing and must not hide a real bound
292
299
  const enforced = dep.evidence.filter(e => !e.partial);
293
300
  const tightestGe = versionBound(tightestBound(enforced, '>='))?.ver;