@eagleoutice/flowr 2.11.0 → 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.
- package/README.md +190 -260
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +6 -2
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +3 -1
- package/benchmark/summarizer/second-phase/graph.js +5 -0
- package/cli/common/options.d.ts +8 -0
- package/cli/common/options.js +2 -0
- package/cli/common/scripts-info.d.ts +8 -0
- package/cli/flowr.js +1 -1
- package/cli/repl/commands/repl-commands.d.ts +1 -0
- package/cli/repl/commands/repl-commands.js +69 -17
- package/cli/repl/commands/repl-dataflow.js +48 -4
- package/cli/repl/commands/repl-main.d.ts +2 -0
- package/cli/repl/commands/repl-main.js +5 -0
- package/cli/repl/commands/repl-query.d.ts +4 -1
- package/cli/repl/commands/repl-query.js +72 -22
- package/cli/repl/commands/repl-signature.d.ts +7 -0
- package/cli/repl/commands/repl-signature.js +119 -0
- package/cli/repl/core.d.ts +8 -1
- package/cli/repl/core.js +46 -6
- package/cli/repl/ghost-hint.d.ts +37 -0
- package/cli/repl/ghost-hint.js +72 -0
- package/cli/repl/parser/slice-query-parser.d.ts +11 -1
- package/cli/repl/parser/slice-query-parser.js +45 -16
- package/cli/repl/print-version.d.ts +2 -4
- package/cli/repl/print-version.js +41 -23
- package/cli/repl/server/connection.js +19 -17
- package/cli/slicer-app.d.ts +2 -0
- package/cli/slicer-app.js +3 -3
- package/cli/wiki.d.ts +2 -2
- package/cli/wiki.js +2 -2
- package/config.d.ts +70 -13
- package/config.js +65 -7
- package/control-flow/cfg-dead-code.js +0 -1
- package/control-flow/control-flow-graph.js +6 -6
- package/control-flow/diff-cfg.js +2 -2
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/core/print/slice-diff-ansi.js +8 -8
- package/core/steps/all/core/20-dataflow.d.ts +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +5 -0
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +7 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +6 -2
- package/core/steps/pipeline/default-pipelines.d.ts +20 -16
- package/data/r-base-packages.generated.d.ts +44 -0
- package/data/r-base-packages.generated.js +32 -0
- package/data/r-base-primitives.generated.d.ts +1 -0
- package/data/r-base-primitives.generated.js +15 -0
- package/data/sigdb/sigdb.remote.json +112 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in.d.ts +14 -4
- package/dataflow/environments/built-in.js +13 -2
- package/dataflow/environments/data-masking-functions.d.ts +12 -0
- package/dataflow/environments/data-masking-functions.js +46 -0
- package/dataflow/environments/default-builtin-config.d.ts +72 -19
- package/dataflow/environments/default-builtin-config.js +48 -14
- package/dataflow/environments/diff.js +1 -1
- package/dataflow/environments/environment.js +1 -2
- package/dataflow/environments/identifier.d.ts +11 -4
- package/dataflow/environments/identifier.js +28 -10
- package/dataflow/environments/resolve-by-name.js +16 -2
- package/dataflow/extractor.js +6 -3
- package/dataflow/graph/call-graph.d.ts +2 -2
- package/dataflow/graph/df-helper.d.ts +4 -4
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/edge.d.ts +3 -3
- package/dataflow/graph/edge.js +3 -3
- package/dataflow/graph/graph-helper.d.ts +2 -2
- package/dataflow/internal/linker.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -49
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +111 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +12 -4
- package/dataflow/internal/process/functions/call/common.js +8 -1
- package/dataflow/internal/process/functions/call/default-call-handling.js +6 -0
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +17 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +32 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +29 -7
- package/dataflow/internal/process/functions/process-argument.js +12 -1
- package/dataflow/internal/process/process-named-call.d.ts +18 -1
- package/dataflow/internal/process/process-named-call.js +94 -0
- package/dataflow/processor.d.ts +18 -0
- package/documentation/data/faq/faqs.js +5 -1
- package/documentation/doc-capabilities.js +1 -1
- package/documentation/doc-util/doc-cli-option.d.ts +10 -0
- package/documentation/doc-util/doc-cli-option.js +23 -0
- package/documentation/doc-util/doc-dfg.js +2 -1
- package/documentation/doc-util/doc-query.d.ts +9 -3
- package/documentation/doc-util/doc-query.js +9 -4
- package/documentation/wiki-dataflow-graph.js +8 -5
- package/documentation/wiki-interface.js +3 -2
- package/documentation/wiki-linter.js +1 -1
- package/documentation/wiki-linting-and-testing.js +4 -1
- package/documentation/wiki-mk/doc-context.d.ts +14 -0
- package/documentation/wiki-mk/doc-context.js +3 -0
- package/documentation/wiki-mk/doc-maker.js +3 -1
- package/documentation/wiki-query.js +19 -1
- package/documentation/wiki-setup.js +10 -7
- package/documentation/wiki-signature-database.d.ts +16 -0
- package/documentation/wiki-signature-database.js +293 -0
- package/linter/linter-format.d.ts +7 -0
- package/linter/linter-rules.d.ts +10 -9
- package/linter/rules/naming-convention.d.ts +1 -0
- package/linter/rules/naming-convention.js +2 -0
- package/linter/rules/no-leaked-credentials.js +1 -2
- package/linter/rules/roxygen-arguments.js +18 -5
- package/linter/rules/stop-with-call-arg.js +2 -2
- package/linter/rules/undefined-symbol-util.d.ts +36 -0
- package/linter/rules/undefined-symbol-util.js +149 -0
- package/linter/rules/undefined-symbol.d.ts +58 -17
- package/linter/rules/undefined-symbol.js +143 -33
- package/linter/rules/unused-definition.d.ts +8 -1
- package/linter/rules/unused-definition.js +126 -1
- package/package.json +23 -10
- package/project/context/abstract-flowr-analyzer-context.js +7 -1
- package/project/context/flowr-analyzer-context.d.ts +8 -0
- package/project/context/flowr-analyzer-context.js +10 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +28 -4
- package/project/context/flowr-analyzer-dependencies-context.js +53 -1
- package/project/context/flowr-analyzer-files-context.d.ts +1 -0
- package/project/context/flowr-analyzer-files-context.js +2 -1
- package/project/context/flowr-analyzer-functions-context.js +1 -1
- package/project/context/flowr-file.d.ts +5 -0
- package/project/context/flowr-file.js +5 -0
- package/project/flowr-analyzer-builder.js +12 -2
- package/project/plugins/file-plugins/files/flowr-description-file.js +6 -3
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +9 -3
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +26 -0
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +39 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +18 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +19 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +120 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +518 -0
- package/project/plugins/package-version-plugins/package.d.ts +5 -3
- package/project/plugins/package-version-plugins/package.js +27 -25
- package/project/plugins/plugin-registry.d.ts +3 -2
- package/project/plugins/plugin-registry.js +4 -2
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +7 -2
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +3 -1
- package/project/sigdb/build.d.ts +131 -0
- package/project/sigdb/build.js +628 -0
- package/project/sigdb/codec.d.ts +51 -0
- package/project/sigdb/codec.js +122 -0
- package/project/sigdb/decode.d.ts +58 -0
- package/project/sigdb/decode.js +129 -0
- package/project/sigdb/decompress.d.ts +44 -0
- package/project/sigdb/decompress.js +176 -0
- package/project/sigdb/hash.d.ts +9 -0
- package/project/sigdb/hash.js +54 -0
- package/project/sigdb/index-format.d.ts +40 -0
- package/project/sigdb/index-format.js +28 -0
- package/project/sigdb/manifest.d.ts +68 -0
- package/project/sigdb/manifest.js +146 -0
- package/project/sigdb/reader.d.ts +250 -0
- package/project/sigdb/reader.js +692 -0
- package/project/sigdb/schema.d.ts +196 -0
- package/project/sigdb/schema.js +33 -0
- package/project/sigdb/sigdb-download.d.ts +65 -0
- package/project/sigdb/sigdb-download.js +237 -0
- package/project/sigdb/signature-match.d.ts +26 -0
- package/project/sigdb/signature-match.js +40 -0
- package/project/sigdb/version.d.ts +20 -0
- package/project/sigdb/version.js +55 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -3
- package/queries/catalog/config-query/config-query-format.d.ts +3 -1
- package/queries/catalog/config-query/config-query-format.js +68 -9
- package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +2 -0
- package/queries/catalog/linter-query/linter-query-executor.js +6 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +2 -1
- package/queries/catalog/linter-query/linter-query-format.js +40 -8
- package/queries/catalog/project-query/project-query-executor.d.ts +15 -0
- package/queries/catalog/project-query/project-query-executor.js +96 -4
- package/queries/catalog/project-query/project-query-format.d.ts +44 -0
- package/queries/catalog/project-query/project-query-format.js +33 -2
- package/queries/catalog/signature-query/signature-query-executor.d.ts +29 -0
- package/queries/catalog/signature-query/signature-query-executor.js +461 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +138 -0
- package/queries/catalog/signature-query/signature-query-format.js +76 -0
- package/queries/catalog/signature-query/signature-query-render.d.ts +15 -0
- package/queries/catalog/signature-query/signature-query-render.js +155 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +9 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +10 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +19 -1
- package/queries/query-print.js +5 -0
- package/queries/query.d.ts +10 -1
- package/queries/query.js +5 -2
- package/r-bridge/init.js +5 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +10 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +55 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +16 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +27 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +89 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -1
- package/r-bridge/parser.d.ts +2 -0
- package/r-bridge/retriever.js +4 -1
- package/r-bridge/roxygen2/documentation-provider.js +2 -1
- package/r-bridge/shell.d.ts +5 -0
- package/r-bridge/shell.js +17 -1
- package/reconstruct/inline/source-inline-map.d.ts +48 -0
- package/reconstruct/inline/source-inline-map.js +94 -0
- package/reconstruct/reconstruct.d.ts +19 -2
- package/reconstruct/reconstruct.js +79 -16
- package/search/search-executor/search-generators.js +5 -22
- package/search/search-executor/search-transformer.js +10 -6
- package/slicing/criterion/parse.d.ts +22 -4
- package/slicing/criterion/parse.js +125 -18
- package/slicing/static/slice-call.d.ts +24 -1
- package/slicing/static/slice-call.js +90 -0
- package/slicing/static/static-slicer.d.ts +7 -0
- package/slicing/static/static-slicer.js +38 -3
- package/util/collections/arrays.d.ts +4 -5
- package/util/collections/arrays.js +7 -18
- package/util/hash.d.ts +14 -0
- package/util/hash.js +31 -0
- package/util/mermaid/dfg.d.ts +7 -2
- package/util/mermaid/dfg.js +53 -13
- package/util/r-base-packages.d.ts +19 -0
- package/util/r-base-packages.js +72 -0
- package/util/r-license.js +2 -10
- package/util/r-version.d.ts +45 -15
- package/util/r-version.js +97 -36
- package/util/range.d.ts +15 -0
- package/util/range.js +39 -0
- package/util/schema.d.ts +10 -0
- package/util/schema.js +22 -0
- package/util/text/ansi.d.ts +13 -1
- package/util/text/ansi.js +27 -4
- package/util/text/args.js +1 -2
- package/util/version.js +28 -8
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/documentation/wiki-package-database.d.ts +0 -9
- package/documentation/wiki-package-database.js +0 -63
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +0 -63
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +0 -174
- package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
- 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.
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
*/
|
package/util/text/ansi.d.ts
CHANGED
|
@@ -22,14 +22,18 @@ export type FormatOptions = ColorFormatOptions | WeightFormatOptions | ColorForm
|
|
|
22
22
|
export interface ColorFormatOptions {
|
|
23
23
|
color: Colors;
|
|
24
24
|
effect: ColorEffect;
|
|
25
|
+
/** use the high-intensity variant */
|
|
26
|
+
bright?: boolean;
|
|
25
27
|
}
|
|
26
28
|
export interface WeightFormatOptions {
|
|
27
|
-
style: FontStyles;
|
|
29
|
+
style: FontStyles | readonly FontStyles[];
|
|
28
30
|
}
|
|
29
31
|
export interface OutputFormatter {
|
|
30
32
|
format(input: string, options?: FormatOptions): string;
|
|
31
33
|
getFormatString(options?: FormatOptions): string;
|
|
32
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;
|
|
33
37
|
}
|
|
34
38
|
export declare const voidFormatter: OutputFormatter;
|
|
35
39
|
export declare const markdownFormatter: OutputFormatter;
|
|
@@ -41,6 +45,13 @@ export declare function italic(s: string, f?: OutputFormatter, options?: FormatO
|
|
|
41
45
|
* This does not work if the {@link setFormatter|formatter} is void. Tries to format the text with an italic font shape.
|
|
42
46
|
*/
|
|
43
47
|
export declare function bold(s: string, f?: OutputFormatter, options?: FormatOptions): string;
|
|
48
|
+
/**
|
|
49
|
+
* Color the text in the given foreground color.
|
|
50
|
+
*/
|
|
51
|
+
export declare function color(s: string, c: Colors, f?: OutputFormatter, opts?: {
|
|
52
|
+
bright?: boolean;
|
|
53
|
+
style?: FontStyles | readonly FontStyles[];
|
|
54
|
+
}): string;
|
|
44
55
|
/**
|
|
45
56
|
* This does not work if the {@link setFormatter|formatter} is void. Tries to format the text as informational message.
|
|
46
57
|
*/
|
|
@@ -48,6 +59,7 @@ export declare function ansiInfo(s: string, f?: OutputFormatter): string;
|
|
|
48
59
|
export declare const escape = "\u001B[";
|
|
49
60
|
export declare const ansiFormatter: {
|
|
50
61
|
reset(): string;
|
|
62
|
+
hyperlink(text: string, url: string): string;
|
|
51
63
|
format(input: string, options?: FormatOptions): string;
|
|
52
64
|
getFormatString(options?: FormatOptions): string;
|
|
53
65
|
};
|
package/util/text/ansi.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.formatter = exports.ansiFormatter = exports.escape = exports.markdownFormatter = exports.voidFormatter = exports.ColorEffect = void 0;
|
|
4
4
|
exports.italic = italic;
|
|
5
5
|
exports.bold = bold;
|
|
6
|
+
exports.color = color;
|
|
6
7
|
exports.ansiInfo = ansiInfo;
|
|
7
8
|
exports.setFormatter = setFormatter;
|
|
8
9
|
// noinspection JSUnusedGlobalSymbols
|
|
@@ -21,6 +22,9 @@ exports.voidFormatter = new class {
|
|
|
21
22
|
reset() {
|
|
22
23
|
return '';
|
|
23
24
|
}
|
|
25
|
+
hyperlink(text, _url) {
|
|
26
|
+
return text;
|
|
27
|
+
}
|
|
24
28
|
}();
|
|
25
29
|
exports.markdownFormatter = new class {
|
|
26
30
|
format(input, options) {
|
|
@@ -32,7 +36,7 @@ exports.markdownFormatter = new class {
|
|
|
32
36
|
input = `_${input}_`;
|
|
33
37
|
}
|
|
34
38
|
else {
|
|
35
|
-
throw new Error(`Unsupported font style: ${options.style}`);
|
|
39
|
+
throw new Error(`Unsupported font style: ${String(options.style)}`);
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
let source = input.replaceAll(/\\"/g, '\'').replaceAll(/\\/g, '\\\\').replaceAll(/\n/g, '\\\n');
|
|
@@ -51,6 +55,9 @@ exports.markdownFormatter = new class {
|
|
|
51
55
|
reset() {
|
|
52
56
|
return '';
|
|
53
57
|
}
|
|
58
|
+
hyperlink(text, url) {
|
|
59
|
+
return `[${text}](${url})`;
|
|
60
|
+
}
|
|
54
61
|
}();
|
|
55
62
|
/**
|
|
56
63
|
* This does not work if the {@link setFormatter|formatter} is void. Tries to format the text with a bold font weight.
|
|
@@ -64,6 +71,12 @@ function italic(s, f = exports.formatter, options) {
|
|
|
64
71
|
function bold(s, f = exports.formatter, options) {
|
|
65
72
|
return f.format(s, { style: 1 /* FontStyles.Bold */, ...options });
|
|
66
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Color the text in the given foreground color.
|
|
76
|
+
*/
|
|
77
|
+
function color(s, c, f = exports.formatter, opts) {
|
|
78
|
+
return f.format(s, { color: c, effect: ColorEffect.Foreground, ...opts });
|
|
79
|
+
}
|
|
67
80
|
/**
|
|
68
81
|
* This does not work if the {@link setFormatter|formatter} is void. Tries to format the text as informational message.
|
|
69
82
|
*/
|
|
@@ -76,6 +89,10 @@ exports.ansiFormatter = {
|
|
|
76
89
|
reset() {
|
|
77
90
|
return `${exports.escape}0${colorSuffix}`;
|
|
78
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
|
+
},
|
|
79
96
|
format(input, options) {
|
|
80
97
|
return `${this.getFormatString(options)}${input}${this.reset()}`;
|
|
81
98
|
},
|
|
@@ -83,9 +100,15 @@ exports.ansiFormatter = {
|
|
|
83
100
|
if (options === undefined) {
|
|
84
101
|
return '';
|
|
85
102
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
const params = [];
|
|
104
|
+
if ('style' in options) {
|
|
105
|
+
const styles = Array.isArray(options.style) ? options.style : [options.style];
|
|
106
|
+
params.push(...styles);
|
|
107
|
+
}
|
|
108
|
+
if ('color' in options) {
|
|
109
|
+
params.push((options.bright ? options.effect + 60 : options.effect) + options.color);
|
|
110
|
+
}
|
|
111
|
+
return params.length === 0 ? '' : `${exports.escape}${params.join(';')}${colorSuffix}`;
|
|
89
112
|
}
|
|
90
113
|
};
|
|
91
114
|
exports.formatter = exports.ansiFormatter;
|
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(
|
|
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.
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
|
50
|
-
const
|
|
51
|
-
|
|
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.eagerlyLoadPackageDatabase\` to mount the database up front instead).
|
|
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
|
package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts
DELETED
|
@@ -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.eagerlyLoadPackageDatabase`) 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
|
-
}
|