@eagleoutice/flowr 2.11.1 → 2.12.0

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 (255) hide show
  1. package/README.md +193 -263
  2. package/abstract-interpretation/data-frame/mappers/arguments.js +7 -1
  3. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  4. package/abstract-interpretation/domains/set-upper-bound-domain.js +6 -2
  5. package/benchmark/slicer.d.ts +1 -1
  6. package/benchmark/slicer.js +3 -1
  7. package/benchmark/summarizer/second-phase/graph.js +5 -0
  8. package/cli/common/options.d.ts +8 -0
  9. package/cli/common/options.js +2 -0
  10. package/cli/common/scripts-info.d.ts +8 -0
  11. package/cli/repl/commands/repl-commands.d.ts +1 -0
  12. package/cli/repl/commands/repl-commands.js +66 -15
  13. package/cli/repl/commands/repl-dataflow.js +48 -4
  14. package/cli/repl/commands/repl-main.d.ts +2 -0
  15. package/cli/repl/commands/repl-main.js +5 -0
  16. package/cli/repl/commands/repl-query.d.ts +4 -1
  17. package/cli/repl/commands/repl-query.js +72 -22
  18. package/cli/repl/commands/repl-signature.d.ts +7 -0
  19. package/cli/repl/commands/repl-signature.js +119 -0
  20. package/cli/repl/core.d.ts +8 -1
  21. package/cli/repl/core.js +46 -6
  22. package/cli/repl/ghost-hint.d.ts +37 -0
  23. package/cli/repl/ghost-hint.js +72 -0
  24. package/cli/repl/parser/slice-query-parser.d.ts +11 -1
  25. package/cli/repl/parser/slice-query-parser.js +45 -16
  26. package/cli/repl/print-version.d.ts +2 -4
  27. package/cli/repl/print-version.js +41 -23
  28. package/cli/repl/server/connection.js +19 -17
  29. package/cli/slicer-app.d.ts +2 -0
  30. package/cli/slicer-app.js +3 -3
  31. package/cli/wiki.d.ts +2 -2
  32. package/cli/wiki.js +2 -2
  33. package/config.d.ts +63 -2
  34. package/config.js +64 -8
  35. package/control-flow/cfg-dead-code.js +0 -1
  36. package/control-flow/control-flow-graph.js +6 -6
  37. package/control-flow/diff-cfg.js +2 -2
  38. package/control-flow/semantic-cfg-guided-visitor.js +2 -0
  39. package/core/print/slice-diff-ansi.js +8 -8
  40. package/core/steps/all/core/20-dataflow.d.ts +2 -2
  41. package/core/steps/all/static-slicing/00-slice.d.ts +5 -0
  42. package/core/steps/all/static-slicing/00-slice.js +1 -1
  43. package/core/steps/all/static-slicing/10-reconstruct.d.ts +7 -0
  44. package/core/steps/all/static-slicing/10-reconstruct.js +6 -2
  45. package/core/steps/pipeline/default-pipelines.d.ts +20 -16
  46. package/data/r-base-packages.generated.d.ts +44 -0
  47. package/data/r-base-packages.generated.js +32 -0
  48. package/data/r-base-primitives.generated.d.ts +1 -0
  49. package/data/r-base-primitives.generated.js +15 -0
  50. package/data/sigdb/sigdb.remote.json +112 -0
  51. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  52. package/dataflow/environments/built-in-proc-name.js +4 -0
  53. package/dataflow/environments/built-in.d.ts +14 -4
  54. package/dataflow/environments/built-in.js +13 -2
  55. package/dataflow/environments/data-masking-functions.d.ts +12 -0
  56. package/dataflow/environments/data-masking-functions.js +46 -0
  57. package/dataflow/environments/default-builtin-config.d.ts +72 -19
  58. package/dataflow/environments/default-builtin-config.js +48 -14
  59. package/dataflow/environments/diff.js +1 -1
  60. package/dataflow/environments/environment.js +1 -2
  61. package/dataflow/environments/identifier.d.ts +11 -4
  62. package/dataflow/environments/identifier.js +28 -10
  63. package/dataflow/environments/resolve-by-name.js +16 -2
  64. package/dataflow/extractor.js +6 -3
  65. package/dataflow/graph/call-graph.d.ts +2 -2
  66. package/dataflow/graph/df-helper.d.ts +4 -4
  67. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  68. package/dataflow/graph/edge.d.ts +3 -3
  69. package/dataflow/graph/edge.js +3 -3
  70. package/dataflow/graph/graph-helper.d.ts +2 -2
  71. package/dataflow/internal/linker.js +1 -1
  72. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -0
  73. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -0
  74. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -49
  76. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +7 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +19 -0
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +111 -6
  80. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +13 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
  82. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -0
  83. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +19 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +12 -4
  85. package/dataflow/internal/process/functions/call/common.js +8 -1
  86. package/dataflow/internal/process/functions/call/default-call-handling.js +6 -0
  87. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +17 -0
  88. package/dataflow/internal/process/functions/call/known-call-handling.js +32 -0
  89. package/dataflow/internal/process/functions/call/named-call-handling.js +29 -7
  90. package/dataflow/internal/process/functions/process-argument.js +12 -1
  91. package/dataflow/internal/process/process-named-call.d.ts +18 -1
  92. package/dataflow/internal/process/process-named-call.js +94 -0
  93. package/dataflow/processor.d.ts +18 -0
  94. package/documentation/data/faq/faqs.js +5 -1
  95. package/documentation/doc-capabilities.js +1 -1
  96. package/documentation/doc-util/doc-cli-option.d.ts +10 -0
  97. package/documentation/doc-util/doc-cli-option.js +23 -0
  98. package/documentation/doc-util/doc-dfg.js +2 -1
  99. package/documentation/doc-util/doc-query.d.ts +9 -3
  100. package/documentation/doc-util/doc-query.js +9 -4
  101. package/documentation/wiki-dataflow-graph.js +8 -5
  102. package/documentation/wiki-interface.js +3 -1
  103. package/documentation/wiki-linter.js +1 -1
  104. package/documentation/wiki-linting-and-testing.js +4 -1
  105. package/documentation/wiki-mk/doc-context.d.ts +14 -0
  106. package/documentation/wiki-mk/doc-context.js +3 -0
  107. package/documentation/wiki-mk/doc-maker.js +3 -1
  108. package/documentation/wiki-query.js +19 -1
  109. package/documentation/wiki-setup.js +10 -7
  110. package/documentation/wiki-signature-database.d.ts +16 -0
  111. package/documentation/wiki-signature-database.js +293 -0
  112. package/linter/linter-format.d.ts +7 -0
  113. package/linter/linter-rules.d.ts +10 -9
  114. package/linter/rules/naming-convention.d.ts +1 -0
  115. package/linter/rules/naming-convention.js +2 -0
  116. package/linter/rules/no-leaked-credentials.js +1 -2
  117. package/linter/rules/roxygen-arguments.js +18 -5
  118. package/linter/rules/stop-with-call-arg.js +2 -2
  119. package/linter/rules/undefined-symbol-util.d.ts +36 -0
  120. package/linter/rules/undefined-symbol-util.js +149 -0
  121. package/linter/rules/undefined-symbol.d.ts +58 -17
  122. package/linter/rules/undefined-symbol.js +143 -33
  123. package/linter/rules/unused-definition.d.ts +8 -1
  124. package/linter/rules/unused-definition.js +126 -1
  125. package/package.json +22 -10
  126. package/project/context/abstract-flowr-analyzer-context.js +7 -1
  127. package/project/context/flowr-analyzer-context.d.ts +8 -0
  128. package/project/context/flowr-analyzer-context.js +10 -0
  129. package/project/context/flowr-analyzer-dependencies-context.d.ts +28 -4
  130. package/project/context/flowr-analyzer-dependencies-context.js +51 -2
  131. package/project/context/flowr-analyzer-files-context.d.ts +1 -0
  132. package/project/context/flowr-analyzer-files-context.js +2 -1
  133. package/project/context/flowr-analyzer-functions-context.js +1 -1
  134. package/project/context/flowr-file.d.ts +5 -0
  135. package/project/context/flowr-file.js +5 -0
  136. package/project/flowr-analyzer-builder.js +12 -2
  137. package/project/plugins/file-plugins/files/flowr-description-file.js +6 -3
  138. package/project/plugins/file-plugins/files/flowr-namespace-file.js +9 -3
  139. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -3
  140. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +26 -0
  141. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +39 -0
  142. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  143. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
  144. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -0
  145. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +18 -2
  146. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +19 -0
  147. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +120 -0
  148. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +518 -0
  149. package/project/plugins/package-version-plugins/package.d.ts +5 -3
  150. package/project/plugins/package-version-plugins/package.js +27 -25
  151. package/project/plugins/plugin-registry.d.ts +3 -2
  152. package/project/plugins/plugin-registry.js +4 -2
  153. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +7 -2
  154. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +3 -1
  155. package/project/sigdb/build.d.ts +131 -0
  156. package/project/sigdb/build.js +628 -0
  157. package/project/sigdb/codec.d.ts +51 -0
  158. package/project/sigdb/codec.js +122 -0
  159. package/project/sigdb/decode.d.ts +58 -0
  160. package/project/sigdb/decode.js +129 -0
  161. package/project/sigdb/decompress.d.ts +44 -0
  162. package/project/sigdb/decompress.js +176 -0
  163. package/project/sigdb/hash.d.ts +9 -0
  164. package/project/sigdb/hash.js +54 -0
  165. package/project/sigdb/index-format.d.ts +40 -0
  166. package/project/sigdb/index-format.js +28 -0
  167. package/project/sigdb/manifest.d.ts +68 -0
  168. package/project/sigdb/manifest.js +146 -0
  169. package/project/sigdb/reader.d.ts +250 -0
  170. package/project/sigdb/reader.js +692 -0
  171. package/project/sigdb/schema.d.ts +196 -0
  172. package/project/sigdb/schema.js +33 -0
  173. package/project/sigdb/sigdb-download.d.ts +65 -0
  174. package/project/sigdb/sigdb-download.js +237 -0
  175. package/project/sigdb/signature-match.d.ts +26 -0
  176. package/project/sigdb/signature-match.js +40 -0
  177. package/project/sigdb/version.d.ts +20 -0
  178. package/project/sigdb/version.js +55 -0
  179. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -3
  180. package/queries/catalog/config-query/config-query-format.d.ts +3 -1
  181. package/queries/catalog/config-query/config-query-format.js +68 -9
  182. package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -1
  183. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  184. package/queries/catalog/linter-query/linter-query-executor.d.ts +2 -0
  185. package/queries/catalog/linter-query/linter-query-executor.js +6 -1
  186. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -1
  187. package/queries/catalog/linter-query/linter-query-format.js +40 -8
  188. package/queries/catalog/project-query/project-query-executor.d.ts +15 -0
  189. package/queries/catalog/project-query/project-query-executor.js +96 -4
  190. package/queries/catalog/project-query/project-query-format.d.ts +44 -0
  191. package/queries/catalog/project-query/project-query-format.js +33 -2
  192. package/queries/catalog/signature-query/signature-query-executor.d.ts +29 -0
  193. package/queries/catalog/signature-query/signature-query-executor.js +461 -0
  194. package/queries/catalog/signature-query/signature-query-format.d.ts +138 -0
  195. package/queries/catalog/signature-query/signature-query-format.js +76 -0
  196. package/queries/catalog/signature-query/signature-query-render.d.ts +15 -0
  197. package/queries/catalog/signature-query/signature-query-render.js +155 -0
  198. package/queries/catalog/static-slice-query/static-slice-query-executor.js +9 -3
  199. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +10 -0
  200. package/queries/catalog/static-slice-query/static-slice-query-format.js +19 -1
  201. package/queries/query-print.js +5 -0
  202. package/queries/query.d.ts +10 -1
  203. package/queries/query.js +5 -2
  204. package/r-bridge/init.js +5 -1
  205. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +10 -0
  206. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +55 -0
  207. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +16 -0
  208. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +27 -0
  209. package/r-bridge/lang-4.x/ast/parser/json/format.js +89 -2
  210. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -4
  211. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -1
  212. package/r-bridge/parser.d.ts +2 -0
  213. package/r-bridge/retriever.js +4 -1
  214. package/r-bridge/roxygen2/documentation-provider.js +2 -1
  215. package/r-bridge/shell.d.ts +5 -0
  216. package/r-bridge/shell.js +17 -1
  217. package/reconstruct/inline/source-inline-map.d.ts +48 -0
  218. package/reconstruct/inline/source-inline-map.js +94 -0
  219. package/reconstruct/reconstruct.d.ts +19 -2
  220. package/reconstruct/reconstruct.js +79 -16
  221. package/search/search-executor/search-generators.js +5 -22
  222. package/search/search-executor/search-transformer.js +10 -6
  223. package/slicing/criterion/parse.d.ts +22 -4
  224. package/slicing/criterion/parse.js +125 -18
  225. package/slicing/static/slice-call.d.ts +24 -1
  226. package/slicing/static/slice-call.js +90 -0
  227. package/slicing/static/static-slicer.d.ts +7 -0
  228. package/slicing/static/static-slicer.js +38 -3
  229. package/util/collections/arrays.d.ts +4 -5
  230. package/util/collections/arrays.js +7 -18
  231. package/util/hash.d.ts +14 -0
  232. package/util/hash.js +31 -0
  233. package/util/mermaid/dfg.d.ts +7 -2
  234. package/util/mermaid/dfg.js +53 -13
  235. package/util/r-base-packages.d.ts +19 -0
  236. package/util/r-base-packages.js +72 -0
  237. package/util/r-license.js +2 -10
  238. package/util/r-version.d.ts +45 -15
  239. package/util/r-version.js +97 -36
  240. package/util/range.d.ts +15 -0
  241. package/util/range.js +39 -0
  242. package/util/schema.d.ts +10 -0
  243. package/util/schema.js +22 -0
  244. package/util/text/ansi.d.ts +3 -0
  245. package/util/text/ansi.js +10 -0
  246. package/util/text/args.js +1 -2
  247. package/util/version.js +28 -8
  248. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  249. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  250. package/documentation/wiki-package-database.d.ts +0 -9
  251. package/documentation/wiki-package-database.js +0 -63
  252. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +0 -63
  253. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +0 -176
  254. package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
  255. package/project/plugins/package-version-plugins/pkgdb.js +0 -370
package/util/r-version.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseRVersion = parseRVersion;
4
- exports.parseRRange = parseRRange;
3
+ exports.RRange = exports.RVersion = void 0;
5
4
  const semver_1 = require("semver");
6
- const assert_1 = require("./assert");
7
5
  function makeVersion(version, original) {
8
6
  const semver = new semver_1.SemVer(version);
9
7
  semver.str = original;
@@ -67,43 +65,106 @@ function normalizeVersions(versions) {
67
65
  }
68
66
  return parts.join('');
69
67
  }
70
- /**
71
- * This parses an R version string and returns a SemVer object.
72
- * In contrast to just using `new SemVer(version)`, this function also tries to
73
- * normalize R's much free-er versioning scheme into valid SemVer versions.
74
- * You can always access the original version string via the `str` property on the returned object.
75
- */
76
- function parseRVersion(version) {
77
- try {
78
- return makeVersion(version, version);
79
- }
80
- catch { /* do nothing */ }
81
- try {
82
- const normalized = normalizeVersions(version);
83
- return makeVersion(normalized, version);
84
- }
85
- catch { /* do nothing */ }
86
- const coerced = (0, semver_1.coerce)(version, { loose: true, includePrerelease: true });
87
- (0, assert_1.guard)(coerced !== null, `Could not coerce R version "${version}" to SemVer`);
88
- return makeVersion(coerced.version, version);
89
- }
90
68
  function makeRange(range, original) {
91
69
  const semverRange = new semver_1.Range(range);
92
70
  semverRange.str = original;
93
71
  return semverRange;
94
72
  }
95
- /**
96
- * This parses an R version range string and returns a SemVer Range object.
97
- * In contrast to just using `new Range(range)`, this function also tries to
98
- * normalize R's much free-er versioning scheme into valid SemVer ranges.
99
- * You can always access the original range string via the `str` property on the returned object.
100
- */
101
- function parseRRange(range) {
102
- try {
103
- return makeRange(range, range);
73
+ /** Helpers for R package versions (`1.2-3` style), which are freer than SemVer. */
74
+ exports.RVersion = {
75
+ /**
76
+ * Parse an R version string into a {@link SemVer}, normalizing R's freer scheme (e.g. `0.4-9`). Unlike
77
+ * `new SemVer(version)` this coerces where needed; the original string is available via `.str`. Returns
78
+ * undefined (never throws) when the string cannot be coerced to a version at all.
79
+ * @see {@link RVersion.parseOrZero}
80
+ */
81
+ parse(version) {
82
+ try {
83
+ return makeVersion(version, version);
84
+ }
85
+ catch { /* try to normalize */ }
86
+ try {
87
+ return makeVersion(normalizeVersions(version), version);
88
+ }
89
+ catch { /* fall back to coercion */ }
90
+ // like {@link RRange.parse}, this never throws: a truly un-coercible version (e.g. an empty `Version:`
91
+ // field or pure text) yields undefined so the caller can detect it rather than crashing
92
+ const coerced = (0, semver_1.coerce)(version, { loose: true, includePrerelease: true });
93
+ return coerced === null ? undefined : makeVersion(coerced.version, version);
94
+ },
95
+ /**
96
+ * Compare two R version strings following R's `numeric_version` scheme: split on `.` and `-`, compare
97
+ * numerically, shorter versions padded with zeros (`0.4-9 < 0.4.10 < 1.0`). Negative/zero/positive for
98
+ * `a` less than/equal to/greater than `b`.
99
+ */
100
+ compare(a, b) {
101
+ const pa = a.split(/[.-]/), pb = b.split(/[.-]/);
102
+ for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
103
+ const x = Number(pa[i] ?? 0) || 0, y = Number(pb[i] ?? 0) || 0;
104
+ if (x !== y) {
105
+ return x - y;
106
+ }
107
+ }
108
+ return 0;
109
+ },
110
+ /**
111
+ * Like {@link parse} but never undefined: a truly un-coercible version sorts as `0.0.0` while keeping its
112
+ * original string as `.str`, so it stays usable as a sort key.
113
+ * @see {@link RVersion.parse}
114
+ */
115
+ parseOrZero(version) {
116
+ const parsed = exports.RVersion.parse(version);
117
+ if (parsed !== undefined) {
118
+ return parsed;
119
+ }
120
+ const fallback = exports.RVersion.parse('0.0.0'); // `0.0.0` always parses
121
+ fallback.str = version;
122
+ return fallback;
123
+ },
124
+ /** The highest of some version strings by R's `numeric_version` order (`0.9.0 < 0.10.0`); undefined if none. */
125
+ highest(versions) {
126
+ let best;
127
+ for (const v of versions) {
128
+ if (best === undefined || exports.RVersion.compare(v, best) > 0) {
129
+ best = v;
130
+ }
131
+ }
132
+ return best;
104
133
  }
105
- catch { /* try to normalize R range to SemVer */ }
106
- const normalized = normalizeVersions(range);
107
- return makeRange(normalized, range);
108
- }
134
+ };
135
+ /** Helpers for R package version ranges (DESCRIPTION constraints like `>= 0.4-9`). */
136
+ exports.RRange = {
137
+ /**
138
+ * Parse an R version range string into a {@link Range}, normalizing R's freer scheme. The original range
139
+ * string is available via `.str`.
140
+ *
141
+ * This never throws: an unparseable constraint (e.g. `>= abc`, or a git/URL "version" from a lockfile) yields
142
+ * `undefined` rather than aborting the caller, so a malformed constraint is *detectable* and simply contributes
143
+ * no version bound. Parsing is attempted first verbatim, then after normalizing R's scheme to SemVer.
144
+ */
145
+ parse(range) {
146
+ try {
147
+ return makeRange(range, range);
148
+ }
149
+ catch { /* try to normalize R range to SemVer */ }
150
+ try {
151
+ return makeRange(normalizeVersions(range), range);
152
+ }
153
+ catch { /* unparseable even after normalization -> report as "no constraint" */ }
154
+ return undefined;
155
+ },
156
+ /**
157
+ * Whether an R version string satisfies a range constraint, normalizing R's freer scheme on both sides.
158
+ * `range` may be a parsed {@link Range} or a raw constraint string. Returns `false` if either is unparseable
159
+ * (never throws), so a malformed version/constraint simply does not match.
160
+ */
161
+ satisfies(version, range) {
162
+ const v = exports.RVersion.parse(version);
163
+ if (v === undefined) {
164
+ return false;
165
+ }
166
+ const r = typeof range === 'string' ? exports.RRange.parse(range) : range;
167
+ return r !== undefined && (0, semver_1.satisfies)(v, r, { loose: true, includePrerelease: true });
168
+ }
169
+ };
109
170
  //# sourceMappingURL=r-version.js.map
package/util/range.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { RNode } from '../r-bridge/lang-4.x/ast/model/model';
2
+ import type { RNodeWithParent } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
2
3
  /**
3
4
  * A source position in a file.
4
5
  *
@@ -135,6 +136,20 @@ export declare const SourceRange: {
135
136
  */
136
137
  readonly combineRanges: (this: void, ...ranges: SourceRange[]) => SourceRange[];
137
138
  readonly fromNode: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => SourceRange | undefined;
139
+ /**
140
+ * "Fuzzy" position match, as opposed to requiring a node to *start* exactly at the position.
141
+ * @see {@link SourceRange.innermostNodes} to narrow the result down to the deepest matches
142
+ */
143
+ readonly nodesContaining: <OtherInfo>(this: void, nodes: readonly RNodeWithParent<OtherInfo>[], line: number, column?: number) => RNodeWithParent<OtherInfo>[];
144
+ /**
145
+ * Collects all nodes satisfying the innermost condition: those containing no other of the given nodes.
146
+ *
147
+ * Nodes may share a range (a function call and the symbol naming it do), so `treatChildAsInner` decides that
148
+ * tie: with it, a node sharing its parent's range counts as the inner one and the parent drops out; without
149
+ * it, both are kept and the caller may pick between them (e.g. by node type).
150
+ * @see {@link SourceRange.nodesContaining} which this usually narrows down
151
+ */
152
+ readonly innermostNodes: <OtherInfo>(this: void, nodes: readonly RNodeWithParent<OtherInfo>[], treatChildAsInner?: boolean) => RNodeWithParent<OtherInfo>[];
138
153
  };
139
154
  /**
140
155
  * A source location consisting of a source range and an optional file name.
package/util/range.js CHANGED
@@ -195,6 +195,45 @@ exports.SourceRange = {
195
195
  },
196
196
  fromNode(node) {
197
197
  return node?.info.fullRange ?? node?.location;
198
+ },
199
+ /**
200
+ * "Fuzzy" position match, as opposed to requiring a node to *start* exactly at the position.
201
+ * @see {@link SourceRange.innermostNodes} to narrow the result down to the deepest matches
202
+ */
203
+ nodesContaining(nodes, line, column) {
204
+ return nodes.filter(node => {
205
+ const range = exports.SourceRange.fromNode(node);
206
+ if (range === undefined) {
207
+ return false;
208
+ }
209
+ return column === undefined ? range[0] <= line && line <= range[2] : exports.SourceRange.containsPosition(range, line, column);
210
+ });
211
+ },
212
+ /**
213
+ * Collects all nodes satisfying the innermost condition: those containing no other of the given nodes.
214
+ *
215
+ * Nodes may share a range (a function call and the symbol naming it do), so `treatChildAsInner` decides that
216
+ * tie: with it, a node sharing its parent's range counts as the inner one and the parent drops out; without
217
+ * it, both are kept and the caller may pick between them (e.g. by node type).
218
+ * @see {@link SourceRange.nodesContaining} which this usually narrows down
219
+ */
220
+ innermostNodes(nodes, treatChildAsInner = true) {
221
+ if (nodes.length <= 1) {
222
+ return [...nodes];
223
+ }
224
+ return nodes.filter(node => {
225
+ const range = exports.SourceRange.fromNode(node);
226
+ return range !== undefined && !nodes.some(other => {
227
+ if (other === node) {
228
+ return false;
229
+ }
230
+ else if (treatChildAsInner && other.info.parent === node.info.id) {
231
+ return true;
232
+ }
233
+ const otherRange = exports.SourceRange.fromNode(other);
234
+ return otherRange !== undefined && exports.SourceRange.isStrictSubsetOf(otherRange, range);
235
+ });
236
+ });
198
237
  }
199
238
  };
200
239
  /**
package/util/schema.d.ts CHANGED
@@ -4,6 +4,16 @@ interface SchemaLine {
4
4
  level: number;
5
5
  text: string;
6
6
  }
7
+ /** the leaf type, description, and any enumerated valid values of a schema path */
8
+ export interface SchemaPathInfo {
9
+ readonly type?: string;
10
+ readonly description?: string;
11
+ readonly valids?: readonly unknown[];
12
+ }
13
+ /** walk a Joi schema {@link Joi.Description|description} down a key path, returning the leaf's {@link SchemaPathInfo} (empty if the path does not exist) */
14
+ export declare function descriptionPathInfo(description: Joi.Description, path: readonly string[]): SchemaPathInfo;
15
+ /** {@link descriptionPathInfo} straight from a schema (describes it once per call) */
16
+ export declare function schemaPathInfo(schema: Joi.Schema, path: readonly string[]): SchemaPathInfo;
7
17
  /**
8
18
  * Describes a Joi schema in a human-readable way.
9
19
  */
package/util/schema.js CHANGED
@@ -1,10 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.descriptionPathInfo = descriptionPathInfo;
4
+ exports.schemaPathInfo = schemaPathInfo;
3
5
  exports.describeSchema = describeSchema;
4
6
  exports.genericDescription = genericDescription;
5
7
  exports.headerLine = headerLine;
6
8
  exports.describeObject = describeObject;
7
9
  const ansi_1 = require("./text/ansi");
10
+ /** walk a Joi schema {@link Joi.Description|description} down a key path, returning the leaf's {@link SchemaPathInfo} (empty if the path does not exist) */
11
+ function descriptionPathInfo(description, path) {
12
+ let node = description;
13
+ for (const key of path) {
14
+ node = node?.keys?.[key];
15
+ if (node === undefined) {
16
+ return {};
17
+ }
18
+ }
19
+ const allow = node.allow;
20
+ return {
21
+ type: node.type,
22
+ description: node.flags?.description,
23
+ valids: allow && allow.length > 0 ? allow : undefined
24
+ };
25
+ }
26
+ /** {@link descriptionPathInfo} straight from a schema (describes it once per call) */
27
+ function schemaPathInfo(schema, path) {
28
+ return descriptionPathInfo(schema.describe(), path);
29
+ }
8
30
  /**
9
31
  * Describes a Joi schema in a human-readable way.
10
32
  */
@@ -32,6 +32,8 @@ export interface OutputFormatter {
32
32
  format(input: string, options?: FormatOptions): string;
33
33
  getFormatString(options?: FormatOptions): string;
34
34
  reset(): string;
35
+ /** render `text` as a link to `url` in whatever form this output supports (OSC 8, markdown, or plain text) */
36
+ hyperlink(text: string, url: string): string;
35
37
  }
36
38
  export declare const voidFormatter: OutputFormatter;
37
39
  export declare const markdownFormatter: OutputFormatter;
@@ -57,6 +59,7 @@ export declare function ansiInfo(s: string, f?: OutputFormatter): string;
57
59
  export declare const escape = "\u001B[";
58
60
  export declare const ansiFormatter: {
59
61
  reset(): string;
62
+ hyperlink(text: string, url: string): string;
60
63
  format(input: string, options?: FormatOptions): string;
61
64
  getFormatString(options?: FormatOptions): string;
62
65
  };
package/util/text/ansi.js CHANGED
@@ -22,6 +22,9 @@ exports.voidFormatter = new class {
22
22
  reset() {
23
23
  return '';
24
24
  }
25
+ hyperlink(text, _url) {
26
+ return text;
27
+ }
25
28
  }();
26
29
  exports.markdownFormatter = new class {
27
30
  format(input, options) {
@@ -52,6 +55,9 @@ exports.markdownFormatter = new class {
52
55
  reset() {
53
56
  return '';
54
57
  }
58
+ hyperlink(text, url) {
59
+ return `[${text}](${url})`;
60
+ }
55
61
  }();
56
62
  /**
57
63
  * This does not work if the {@link setFormatter|formatter} is void. Tries to format the text with a bold font weight.
@@ -83,6 +89,10 @@ exports.ansiFormatter = {
83
89
  reset() {
84
90
  return `${exports.escape}0${colorSuffix}`;
85
91
  },
92
+ hyperlink(text, url) {
93
+ // OSC 8 hyperlink, BEL-terminated (\x07) -- more widely supported than the ST form (Konsole, tmux, ...)
94
+ return `\x1b]8;;${url}\x07${text}\x1b]8;;\x07`;
95
+ },
86
96
  format(input, options) {
87
97
  return `${this.getFormatString(options)}${input}${this.reset()}`;
88
98
  },
package/util/text/args.js CHANGED
@@ -24,7 +24,6 @@ function splitAtEscapeSensitive(inputString, escapeQuote = true, split = ' ') {
24
24
  let escaped = false;
25
25
  for (let i = 0; i < inputString.length; i++) {
26
26
  const c = inputString[i];
27
- const sub = inputString.slice(i);
28
27
  if (escaped) {
29
28
  escaped = false;
30
29
  switch (c) {
@@ -51,7 +50,7 @@ function splitAtEscapeSensitive(inputString, escapeQuote = true, split = ' ') {
51
50
  }
52
51
  else if (!inQuotes
53
52
  && current !== ''
54
- && (split instanceof RegExp ? split.test(sub) : inputString.slice(i, i + split.length) === split)) {
53
+ && (split instanceof RegExp ? split.test(inputString.slice(i)) : inputString.slice(i, i + split.length) === split)) {
55
54
  args.push(current);
56
55
  current = '';
57
56
  }
package/util/version.js CHANGED
@@ -5,8 +5,11 @@ exports.retrieveVersionInformation = retrieveVersionInformation;
5
5
  exports.printVersionInformation = printVersionInformation;
6
6
  const semver_1 = require("semver");
7
7
  const assert_1 = require("./assert");
8
+ const sigdb_download_1 = require("../project/sigdb/sigdb-download");
8
9
  // this is automatically replaced with the current version by release-it
9
- const version = '2.11.1';
10
+ const version = '2.12.0';
11
+ // this is automatically replaced with the release date by release-it (regex-bumper, see package.json)
12
+ const versionDate = '2026-07-15T07:13:44Z';
10
13
  /**
11
14
  * Retrieves the current flowR version as a new {@link SemVer} object.
12
15
  */
@@ -40,15 +43,32 @@ async function retrieveVersionInformation(input) {
40
43
  async function printVersionInformation(output, input) {
41
44
  const { flowr, r, engine } = await retrieveVersionInformation(input);
42
45
  const faint = (s) => output.formatter.format(s, { style: 2 /* FontStyles.Faint */ });
43
- output.stdout(`Engine: ${engine}`);
44
- output.stdout(` flowR: ${flowr}`);
45
- // gray out R when it is not actually available
46
- output.stdout((r === 'none' || r === 'unknown') ? faint(` R: ${r}`) : ` R: ${r}`);
46
+ const rReason = r === 'none' ? ' (no R interpreter available)'
47
+ : r === 'unknown' ? (engine === 'tree-sitter' ? ' (not queried, using the tree-sitter engine)' : ' (could not be determined)')
48
+ : '';
49
+ const flowrValue = versionRegex.test(flowr) ? output.formatter.hyperlink(flowr, `https://github.com/flowr-analysis/flowr/releases/tag/v${flowr}`) : flowr;
50
+ const rows = [
51
+ ['engine', engine],
52
+ ['flowR', `${flowrValue} ${faint(`(${versionDate})`)}`],
53
+ ['R', `${r}${rReason}`, r === 'none' || r === 'unknown']
54
+ ];
47
55
  if (typeof input !== 'function' && 'inspectContext' in input) {
48
56
  // reads the current analyzer, so it reflects the databases in use (and adapts to config changes)
49
- const dbs = input.inspectContext().deps.loadedPackageDatabases();
50
- const line = ` package databases: ${dbs.length === 0 ? 'none' : dbs.map(d => `${d.scope} (v${d.version}, ${d.date})`).join(', ')}`;
51
- output.stdout(dbs.length === 0 ? faint(line) : line);
57
+ const ctx = input.inspectContext();
58
+ const setting = ctx.config.solver.sigdb.assumedRVersion ?? 'auto';
59
+ rows.push(['assumed R', `${ctx.resolvedRVersion} ${faint(`(solver.sigdb.assumedRVersion = "${setting}")`)}`]);
60
+ const dbs = ctx.deps.loadedPackageDatabases();
61
+ const sigDbUrl = (0, sigdb_download_1.sigDbRemoteRelease)()?.url;
62
+ const describe = (d) => {
63
+ const entry = `${d.scope} (v${d.version}, ${d.date}${d.format ? `, ${d.format}` : ''})`;
64
+ return sigDbUrl ? output.formatter.hyperlink(entry, sigDbUrl) : entry;
65
+ };
66
+ rows.push(['databases', dbs.length === 0 ? 'none' : dbs.map(describe).join(', '), dbs.length === 0]);
67
+ }
68
+ const width = Math.max(...rows.map(([label]) => label.length));
69
+ for (const [label, value, faded] of rows) {
70
+ const line = `${label.padEnd(width)} : ${value}`;
71
+ output.stdout(faded ? faint(line) : line);
52
72
  }
53
73
  }
54
74
  //# sourceMappingURL=version.js.map
Binary file
Binary file
@@ -1,9 +0,0 @@
1
- import type { DocMakerArgs } from './wiki-mk/doc-maker';
2
- import { DocMaker } from './wiki-mk/doc-maker';
3
- /**
4
- * https://github.com/flowr-analysis/flowr/wiki/Package-Database
5
- */
6
- export declare class WikiPackageDatabase extends DocMaker<'wiki/Package Database.md'> {
7
- constructor();
8
- text({ ctx }: DocMakerArgs): string;
9
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WikiPackageDatabase = void 0;
4
- const doc_maker_1 = require("./wiki-mk/doc-maker");
5
- const doc_files_1 = require("./doc-util/doc-files");
6
- const pkgdb_1 = require("../project/plugins/package-version-plugins/pkgdb");
7
- const flowr_analyzer_package_versions_pkgdb_plugin_1 = require("../project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin");
8
- const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
9
- /** point the resolver at your own database (a file path or http(s) URL) */
10
- function usePackageDatabase(parser) {
11
- const pkgdb = new flowr_analyzer_package_versions_pkgdb_plugin_1.FlowrAnalyzerPackageVersionsPkgDbPlugin('/path/to/pkgdb-all.json.br');
12
- return new flowr_analyzer_builder_1.FlowrAnalyzerBuilder().setParser(parser).registerPlugins(pkgdb).build();
13
- }
14
- /** link a built-in plugin key (e.g. `versions:pkgdb`) to its registration */
15
- function pluginLink(key) {
16
- return `[\`${key}\`](${doc_files_1.RemoteFlowrFilePathBaseRef}src/project/plugins/plugin-registry.ts)`;
17
- }
18
- /**
19
- * https://github.com/flowr-analysis/flowr/wiki/Package-Database
20
- */
21
- class WikiPackageDatabase extends doc_maker_1.DocMaker {
22
- constructor() {
23
- super('wiki/Package Database.md', module.filename, 'bundled CRAN package database that resolves `library()` calls');
24
- }
25
- text({ ctx }) {
26
- return `
27
- # Package Database
28
-
29
- flowR ships a database of CRAN package exports so it can resolve calls into the packages you load.
30
- After \`library(ggplot2)\`, a call to \`ggplot()\` resolves to \`ggplot2::ggplot\`. This also backs
31
- qualified names (a bare \`map()\` after \`library(purrr)\` is \`purrr::map\`, not the \`maps\` plot), the
32
- ${ctx.linkPage('wiki/Query API', 'dependencies and call-context queries')}, and the ${ctx.linkPage('wiki/Linter', '`undefined-symbol` rule')}.
33
-
34
- ## Configuration
35
-
36
- The exports come from ${pluginLink('versions:pkgdb')}, which reads the bundled database (on by default;
37
- see ${ctx.linkPage('wiki/Interface', 'configuring flowR', 'configuring-flowr')}).
38
-
39
- *Which* version's exports are resolved is decided by the version-reading plugins that pin the packages
40
- used in a project. These are only examples - more may be registered:
41
-
42
- - ${pluginLink('versions:description')} reads a package's \`DESCRIPTION\` (\`Depends\` / \`Imports\`, ${(0, doc_files_1.linkFlowRSourceFile)('src/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.ts')}).
43
- - ${pluginLink('versions:renv')} and ${pluginLink('versions:rv')} read a project's \`renv.lock\` / \`rv.lock\`
44
- to pin exact versions (${(0, doc_files_1.linkFlowRSourceFile)('src/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.ts')}).
45
-
46
- So \`library(pkg)\` resolves the pinned version's exports. To override or extend the bundle, hand
47
- ${pluginLink('versions:pkgdb')} extra sources (file paths, parsed objects, or \`http(s)\` URLs).
48
-
49
- ${ctx.code(usePackageDatabase, { dropLinesStart: 1 })}
50
-
51
- File sources load lazily on the first package load, so scripts without \`library()\`/\`use()\` calls never
52
- pay for parsing them (set \`solver.pkgdb.eagerlyLoad\` to mount the database up front, or \`solver.pkgdb.enabled: false\` to switch it off entirely).
53
- For a URL source call ${ctx.linkM(flowr_analyzer_package_versions_pkgdb_plugin_1.FlowrAnalyzerPackageVersionsPkgDbPlugin, 'preload', { hideClass: true, codeFont: true })} (\`await pkgdb.preload()\`) before analysis to download it.
54
-
55
- ## Format
56
-
57
- One JSON object (\`flowr-pkgdb\`, schema ${pkgdb_1.PkgDbSchema}) with a pooled string table.
58
- Reader and writer both live in ${(0, doc_files_1.linkFlowRSourceFile)('src/project/plugins/package-version-plugins/pkgdb.ts')}.
59
- `.trim();
60
- }
61
- }
62
- exports.WikiPackageDatabase = WikiPackageDatabase;
63
- //# sourceMappingURL=wiki-package-database.js.map
@@ -1,63 +0,0 @@
1
- import { FlowrAnalyzerPackageVersionsPlugin, type PkgDbLoadedInfo } from './flowr-analyzer-package-versions-plugin';
2
- import { SemVer } from 'semver';
3
- import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
4
- import { PkgDatabase, type PkgDb } from './pkgdb';
5
- /** the plugin's instance name (pass to `unregisterPlugins` to disable the default pkgdb resolver) */
6
- export declare const PkgDbPluginName = "flowr-analyzer-package-versions-pkgdb-plugin";
7
- export declare const pkgDbLog: import("tslog").Logger<import("tslog").ILogObj>;
8
- /** a database, a parsed object, or a local file path */
9
- export type PkgDbSource = PkgDatabase | PkgDb | string;
10
- /**
11
- * The database flattens S3 methods into the export list, so we recover the `generic -> classes` map for
12
- * dispatch: an export `generic.class` is a method when the `generic` is itself exported (e.g. `print.foo`).
13
- */
14
- export declare function reconstructS3Generics(exported: readonly string[]): Map<string, string[]>;
15
- /**
16
- * Resolves `library(pkg)` / `use(pkg, fn)` from precomputed `flowr-pkgdb` databases: the one bundled
17
- * with flowR plus any extra sources (constructor args or `$FLOWR_PKGDB`). Extra sources are consulted
18
- * first, so they override the bundle; packages only in the bundle still resolve. Everything is loaded
19
- * lazily on the first miss (never touched if a project uses no external packages). On by default; opt
20
- * out via `unregisterPlugins(PkgDbPluginName)` or `$FLOWR_DISABLE_DEFAULT_PKGDB`.
21
- *
22
- * A source may be an `http(s)` URL to a downloadable summary; call {@link preload} once at the
23
- * analyzer boundary to fetch it, so resolution falls through to it for packages not in the bundle.
24
- */
25
- export declare class FlowrAnalyzerPackageVersionsPkgDbPlugin extends FlowrAnalyzerPackageVersionsPlugin {
26
- readonly name = "flowr-analyzer-package-versions-pkgdb-plugin";
27
- readonly description = "Resolves library exports from precomputed flowr-pkgdb databases.";
28
- readonly version: SemVer;
29
- /**
30
- * Process-wide cache of parsed file databases, keyed by their source path, so a flowR session parses
31
- * each file once. Parsing the bundled database is ~25ms and a fresh plugin instance is created per
32
- * analyzer, so without this every analysis touching a `library()` call would re-parse the multi-MB file.
33
- */
34
- private static readonly fileCache;
35
- private readonly extraSources;
36
- private databases;
37
- constructor(...sources: PkgDbSource[]);
38
- process(ctx: FlowrAnalyzerContext): void;
39
- /** Mount the databases up front (see `solver.pkgdb.eagerlyLoad`) instead of on the first library load. */
40
- preloadDatabasesSync(): void;
41
- /** metadata of the databases currently loaded (the synchronously available, non-URL sources) */
42
- loadedDatabases(): PkgDbLoadedInfo[];
43
- /**
44
- * Sources in priority order: explicit constructor sources, then `$FLOWR_PKGDB`, then the bundled
45
- * default. The bundled default is skipped when `$FLOWR_DISABLE_DEFAULT_PKGDB` is set (explicit
46
- * sources are always honored) - the env opt-out for the shipped database.
47
- */
48
- private sources;
49
- private static isUrl;
50
- /** synchronously loaded databases; remote (URL) summaries are only added by {@link preload}. */
51
- private loadDatabases;
52
- /**
53
- * Download and load every source, including remote (URL) summaries. Call this once at the
54
- * analyzer boundary to let `library()` resolution fall through to additional downloaded databases
55
- * (e.g. the full `all` summary or a richer `latest`). Without it, only local sources are used.
56
- */
57
- preload(): Promise<void>;
58
- private load;
59
- private mustLoad;
60
- /** Load a file source once per session, reusing the parsed database across analyzer instances. */
61
- private static loadFileCached;
62
- private resolve;
63
- }