@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.
- package/README.md +193 -263
- 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/repl/commands/repl-commands.d.ts +1 -0
- package/cli/repl/commands/repl-commands.js +66 -15
- 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 +63 -2
- package/config.js +64 -8
- 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 -1
- 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 +22 -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 +51 -2
- 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 +3 -0
- package/util/text/ansi.js +10 -0
- 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 -176
- package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
- package/project/plugins/package-version-plugins/pkgdb.js +0 -370
|
@@ -33,6 +33,8 @@ class FlowrAnalyzerContext {
|
|
|
33
33
|
env;
|
|
34
34
|
gas;
|
|
35
35
|
_analyzer;
|
|
36
|
+
/** an auto-detected R version (from the engine), recorded once at the analyzer boundary; see {@link resolvedRVersion} */
|
|
37
|
+
_detectedR;
|
|
36
38
|
config;
|
|
37
39
|
constructor(config, plugins) {
|
|
38
40
|
this.config = config;
|
|
@@ -55,6 +57,14 @@ class FlowrAnalyzerContext {
|
|
|
55
57
|
setAnalyzer(analyzer) {
|
|
56
58
|
this._analyzer = analyzer;
|
|
57
59
|
}
|
|
60
|
+
/** Record the engine's auto-detected R version (used when `solver.sigdb.assumedRVersion` is `"auto"`). */
|
|
61
|
+
setDetectedRVersion(version) {
|
|
62
|
+
this._detectedR = version;
|
|
63
|
+
}
|
|
64
|
+
/** The R version analysis assumes when resolving versioned (base-R) exports (see {@link resolveAssumedRVersion}). */
|
|
65
|
+
get resolvedRVersion() {
|
|
66
|
+
return (0, config_1.resolveAssumedRVersion)(this.config, this._detectedR);
|
|
67
|
+
}
|
|
58
68
|
/** delegate request addition */
|
|
59
69
|
addRequests(requests) {
|
|
60
70
|
this.files.addRequests(requests);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AbstractFlowrAnalyzerContext } from './abstract-flowr-analyzer-context';
|
|
2
|
-
import { FlowrAnalyzerPackageVersionsPlugin, type
|
|
2
|
+
import { FlowrAnalyzerPackageVersionsPlugin, type SigDbLoadedInfo } from '../plugins/package-version-plugins/flowr-analyzer-package-versions-plugin';
|
|
3
3
|
import type { Package } from '../plugins/package-version-plugins/package';
|
|
4
|
+
import type { PackageSignatureSource } from '../sigdb/reader';
|
|
4
5
|
import type { FlowrAnalyzerFunctionsContext, ReadOnlyFlowrAnalyzerFunctionsContext } from './flowr-analyzer-functions-context';
|
|
5
6
|
/**
|
|
6
7
|
* Read-only interface to the {@link FlowrAnalyzerDependenciesContext} for inspecting dependencies without modifying them.
|
|
@@ -29,7 +30,15 @@ export interface ReadOnlyFlowrAnalyzerDependenciesContext {
|
|
|
29
30
|
/**
|
|
30
31
|
* Metadata of the package databases the version plugins currently have loaded.
|
|
31
32
|
*/
|
|
32
|
-
loadedPackageDatabases():
|
|
33
|
+
loadedPackageDatabases(): SigDbLoadedInfo[];
|
|
34
|
+
/**
|
|
35
|
+
* The names of known packages that export `name` (from the version plugins' package databases). Used to
|
|
36
|
+
* hint which `library()`/`::` might be missing for an otherwise-undefined symbol. Empty if no database is
|
|
37
|
+
* available or the package db is disabled.
|
|
38
|
+
*/
|
|
39
|
+
packagesExporting(name: string): readonly string[];
|
|
40
|
+
/** The signature sources the version plugins currently have loaded (backs the signature query). */
|
|
41
|
+
signatureSources(): readonly PackageSignatureSource[];
|
|
33
42
|
}
|
|
34
43
|
/**
|
|
35
44
|
* Manages the project's dependencies, their versions, and their interplay with {@link FlowrAnalyzerPackageVersionsPlugin}s.
|
|
@@ -45,11 +54,26 @@ export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnaly
|
|
|
45
54
|
reset(): void;
|
|
46
55
|
/** Register a resolver consulted by {@link getDependency} to fill in a package's exports lazily. */
|
|
47
56
|
addLazyResolver(resolver: (name: string, existing?: Package) => Package | undefined): void;
|
|
48
|
-
loadedPackageDatabases():
|
|
49
|
-
|
|
57
|
+
loadedPackageDatabases(): SigDbLoadedInfo[];
|
|
58
|
+
packagesExporting(name: string): readonly string[];
|
|
59
|
+
signatureSources(): readonly PackageSignatureSource[];
|
|
60
|
+
/** Whether any version plugin can resolve the base-R packages (a versioned signature source is available). */
|
|
61
|
+
hasBaseRSource(): boolean;
|
|
62
|
+
/** Cheap fingerprint of only the base-R-providing databases, so base-R-derived caches survive unrelated database changes. */
|
|
63
|
+
baseRSourceFingerprint(): string;
|
|
64
|
+
/** Mount an additional signature database/source by path (a plain `.sigs.ndjson`, a `.br`, or a manifest). */
|
|
65
|
+
addDatabaseSource(source: string): Promise<void>;
|
|
66
|
+
/** Eagerly mount every version plugin's package database up front (see `solver.sigdb.eagerlyLoad`). */
|
|
50
67
|
eagerlyLoadPackageDatabases(): void;
|
|
51
68
|
constructor(functionsContext: FlowrAnalyzerFunctionsContext, plugins?: readonly FlowrAnalyzerPackageVersionsPlugin[]);
|
|
52
69
|
resolveStaticDependencies(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Register a dependency declared by a project metadata file (`DESCRIPTION`, `renv.lock`, `rv.lock`). Gated by
|
|
72
|
+
* `solver.sigdb.loadProjectDependencies`: when project-dependency loading is disabled this is a no-op, so the
|
|
73
|
+
* declared deps never enter the context (unlike {@link addDependency}, used for on-demand signature-database
|
|
74
|
+
* resolution).
|
|
75
|
+
*/
|
|
76
|
+
addDeclaredDependency(pkg: Package): this;
|
|
53
77
|
addDependency(pkg: Package): this;
|
|
54
78
|
getDependency(name: string): Package | undefined;
|
|
55
79
|
getDependencies(): Package[];
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FlowrAnalyzerDependenciesContext = void 0;
|
|
4
4
|
const abstract_flowr_analyzer_context_1 = require("./abstract-flowr-analyzer-context");
|
|
5
5
|
const flowr_analyzer_package_versions_plugin_1 = require("../plugins/package-version-plugins/flowr-analyzer-package-versions-plugin");
|
|
6
|
+
const config_1 = require("../../config");
|
|
6
7
|
/**
|
|
7
8
|
* Manages the project's dependencies, their versions, and their interplay with {@link FlowrAnalyzerPackageVersionsPlugin}s.
|
|
8
9
|
*/
|
|
@@ -25,12 +26,48 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
25
26
|
this.lazyResolvers.push(resolver);
|
|
26
27
|
}
|
|
27
28
|
loadedPackageDatabases() {
|
|
28
|
-
if (!this.ctx.config
|
|
29
|
+
if (!(0, config_1.isSigDbEnabled)(this.ctx.config)) {
|
|
29
30
|
return [];
|
|
30
31
|
}
|
|
31
32
|
return this.plugins.flatMap(p => p.loadedDatabases());
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
packagesExporting(name) {
|
|
35
|
+
if (!(0, config_1.isSigDbEnabled)(this.ctx.config)) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const out = new Set();
|
|
39
|
+
for (const p of this.plugins) {
|
|
40
|
+
for (const pkg of p.packagesExporting(name)) {
|
|
41
|
+
out.add(pkg);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return [...out];
|
|
45
|
+
}
|
|
46
|
+
signatureSources() {
|
|
47
|
+
if (!(0, config_1.isSigDbEnabled)(this.ctx.config)) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
return this.plugins.flatMap(p => [...p.signatureSources(this.ctx.config)]);
|
|
51
|
+
}
|
|
52
|
+
/** Whether any version plugin can resolve the base-R packages (a versioned signature source is available). */
|
|
53
|
+
hasBaseRSource() {
|
|
54
|
+
return (0, config_1.isSigDbEnabled)(this.ctx.config) && this.plugins.some(p => p.providesBaseRPackages());
|
|
55
|
+
}
|
|
56
|
+
/** Cheap fingerprint of only the base-R-providing databases, so base-R-derived caches survive unrelated database changes. */
|
|
57
|
+
baseRSourceFingerprint() {
|
|
58
|
+
if (!(0, config_1.isSigDbEnabled)(this.ctx.config)) {
|
|
59
|
+
return '';
|
|
60
|
+
}
|
|
61
|
+
return this.plugins.filter(p => p.providesBaseRPackages())
|
|
62
|
+
.flatMap(p => p.loadedDatabases()).map(d => d.hash).join(',');
|
|
63
|
+
}
|
|
64
|
+
/** Mount an additional signature database/source by path (a plain `.sigs.ndjson`, a `.br`, or a manifest). */
|
|
65
|
+
async addDatabaseSource(source) {
|
|
66
|
+
for (const p of this.plugins) {
|
|
67
|
+
await p.addDatabaseSource(source);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Eagerly mount every version plugin's package database up front (see `solver.sigdb.eagerlyLoad`). */
|
|
34
71
|
eagerlyLoadPackageDatabases() {
|
|
35
72
|
for (const p of this.plugins) {
|
|
36
73
|
p.preloadDatabasesSync();
|
|
@@ -44,6 +81,18 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
44
81
|
this.applyPlugins(undefined);
|
|
45
82
|
this.staticsLoaded = true;
|
|
46
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Register a dependency declared by a project metadata file (`DESCRIPTION`, `renv.lock`, `rv.lock`). Gated by
|
|
86
|
+
* `solver.sigdb.loadProjectDependencies`: when project-dependency loading is disabled this is a no-op, so the
|
|
87
|
+
* declared deps never enter the context (unlike {@link addDependency}, used for on-demand signature-database
|
|
88
|
+
* resolution).
|
|
89
|
+
*/
|
|
90
|
+
addDeclaredDependency(pkg) {
|
|
91
|
+
if (!this.ctx.config.solver.sigdb.loadProjectDependencies) {
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
return this.addDependency(pkg);
|
|
95
|
+
}
|
|
47
96
|
addDependency(pkg) {
|
|
48
97
|
const p = this.dependencies.get(pkg.name);
|
|
49
98
|
if (p) {
|
|
@@ -24,6 +24,7 @@ export type RoleBasedFiles = {
|
|
|
24
24
|
[FileRole.Namespace]: FlowrNamespaceFile[];
|
|
25
25
|
[FileRole.Vignette]: FlowrFileProvider[];
|
|
26
26
|
[FileRole.Test]: FlowrFileProvider[];
|
|
27
|
+
[FileRole.Install]: FlowrFileProvider[];
|
|
27
28
|
[FileRole.License]: FlowrFileProvider[];
|
|
28
29
|
[FileRole.VirtualEnv]: FlowrFileProvider[];
|
|
29
30
|
[FileRole.Source]: FlowrFileProvider[];
|
|
@@ -143,10 +143,11 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
143
143
|
}
|
|
144
144
|
// walk the directory and find the first match
|
|
145
145
|
const dir = path_1.default.dirname(p);
|
|
146
|
+
const dirLower = dir.toLowerCase();
|
|
146
147
|
const file = path_1.default.basename(p).toLowerCase();
|
|
147
148
|
// try to find in local known files first
|
|
148
149
|
for (const f of this.files.keys()) {
|
|
149
|
-
if (path_1.default.dirname(f).toLowerCase() !==
|
|
150
|
+
if (path_1.default.dirname(f).toLowerCase() !== dirLower) {
|
|
150
151
|
continue;
|
|
151
152
|
}
|
|
152
153
|
const lf = path_1.default.basename(f).toLowerCase();
|
|
@@ -54,7 +54,7 @@ class FlowrAnalyzerFunctionsContext extends abstract_flowr_analyzer_context_1.Ab
|
|
|
54
54
|
}
|
|
55
55
|
getFunctionInfo(pkg, name, s3TypeDispatch) {
|
|
56
56
|
if (s3TypeDispatch) {
|
|
57
|
-
return this.functionInfo.get(
|
|
57
|
+
return this.functionInfo.get(name)?.find(e => e.packageOrigin === pkg && e.s3TypeDispatch === s3TypeDispatch);
|
|
58
58
|
}
|
|
59
59
|
else if (name.includes('.')) {
|
|
60
60
|
const parts = name.split('.');
|
|
@@ -21,6 +21,11 @@ export declare enum FileRole {
|
|
|
21
21
|
Vignette = "vignette",
|
|
22
22
|
/** Test source files, e.g., files in the `tests/` folder */
|
|
23
23
|
Test = "test",
|
|
24
|
+
/**
|
|
25
|
+
* Files below an `inst/` folder, which R installs verbatim into the package root (resources/scripts, e.g., `inst/REFERENCES.R`, `inst/CITATION`, `inst/extdata/...`).
|
|
26
|
+
* These are not part of the package namespace source, so tooling may want to treat them separately.
|
|
27
|
+
*/
|
|
28
|
+
Install = "install",
|
|
24
29
|
/** Data files, e.g., `R/sysdata.rda`, currently not specially supported. */
|
|
25
30
|
Data = "data",
|
|
26
31
|
/** Signals separate license files, but please note, that DESCRIPTION files may contain license info too */
|
|
@@ -22,6 +22,11 @@ var FileRole;
|
|
|
22
22
|
FileRole["Vignette"] = "vignette";
|
|
23
23
|
/** Test source files, e.g., files in the `tests/` folder */
|
|
24
24
|
FileRole["Test"] = "test";
|
|
25
|
+
/**
|
|
26
|
+
* Files below an `inst/` folder, which R installs verbatim into the package root (resources/scripts, e.g., `inst/REFERENCES.R`, `inst/CITATION`, `inst/extdata/...`).
|
|
27
|
+
* These are not part of the package namespace source, so tooling may want to treat them separately.
|
|
28
|
+
*/
|
|
29
|
+
FileRole["Install"] = "install";
|
|
25
30
|
/** Data files, e.g., `R/sysdata.rda`, currently not specially supported. */
|
|
26
31
|
FileRole["Data"] = "data";
|
|
27
32
|
/** Signals separate license files, but please note, that DESCRIPTION files may contain license info too */
|
|
@@ -150,7 +150,17 @@ class FlowrAnalyzerBuilder {
|
|
|
150
150
|
const engines = await (0, engines_1.retrieveEngineInstances)(this.flowrConfig, true);
|
|
151
151
|
this.parser = engines.engines[engines.default];
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
const analyzer = this.buildSync();
|
|
154
|
+
// when the assumed R version is auto (the default), detect the engine's R version once and record it, so
|
|
155
|
+
// versioned (base-R) resolution and `:version` reflect the installed R (or the default when it reports none)
|
|
156
|
+
const assumed = this.flowrConfig.solver.sigdb.assumedRVersion;
|
|
157
|
+
if (assumed === undefined || assumed === 'auto') {
|
|
158
|
+
try {
|
|
159
|
+
analyzer.context().setDetectedRVersion(await this.parser.rVersion());
|
|
160
|
+
}
|
|
161
|
+
catch { /* leave undetected: resolveAssumedRVersion falls back to the default assumed version */ }
|
|
162
|
+
}
|
|
163
|
+
return analyzer;
|
|
154
164
|
}
|
|
155
165
|
/**
|
|
156
166
|
* Synchronous version of {@link FlowrAnalyzerBuilder#build}, please only use this if you have set the parser using
|
|
@@ -159,7 +169,7 @@ class FlowrAnalyzerBuilder {
|
|
|
159
169
|
buildSync() {
|
|
160
170
|
(0, assert_1.guard)(this.parser !== undefined, 'No parser set, please use the setParser or setEngine method to set a parser before building the analyzer');
|
|
161
171
|
const context = new flowr_analyzer_context_1.FlowrAnalyzerContext(this.flowrConfig, this.plugins);
|
|
162
|
-
if (this.flowrConfig.solver.
|
|
172
|
+
if (this.flowrConfig.solver.sigdb.enabled && this.flowrConfig.solver.sigdb.eagerlyLoad) {
|
|
163
173
|
context.deps.eagerlyLoadPackageDatabases();
|
|
164
174
|
}
|
|
165
175
|
const cache = flowr_analyzer_cache_1.FlowrAnalyzerCache.create({
|
|
@@ -71,7 +71,7 @@ class FlowrDescriptionFile extends flowr_file_1.FlowrFile {
|
|
|
71
71
|
return undefined;
|
|
72
72
|
}
|
|
73
73
|
const verStr = v[0].trim();
|
|
74
|
-
return
|
|
74
|
+
return r_version_1.RVersion.parse(verStr);
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Returns the parsed authors from the `Authors@R` field in the DESCRIPTION file.
|
|
@@ -169,7 +169,10 @@ function parseDCF(file) {
|
|
|
169
169
|
let currentValue = '';
|
|
170
170
|
const indentRegex = new RegExp(/^\s/);
|
|
171
171
|
const firstColonRegex = new RegExp(/:(.*)/s);
|
|
172
|
-
|
|
172
|
+
// strip a leading UTF-8 BOM (U+FEFF): it matches `indentRegex` (JS `\s` includes U+FEFF), so without this
|
|
173
|
+
// the first field (typically `Package:`) would be misread as a continuation line and silently dropped
|
|
174
|
+
const raw = file.content().toString();
|
|
175
|
+
const fileContent = (raw.charCodeAt(0) === 0xFEFF ? raw.slice(1) : raw).split(/\r?\n/);
|
|
173
176
|
for (const line of fileContent) {
|
|
174
177
|
if (indentRegex.test(line)) {
|
|
175
178
|
currentValue += '\n' + line.trim();
|
|
@@ -203,7 +206,7 @@ function parsePackagesWithVersions(packageStrings, type) {
|
|
|
203
206
|
// match until exhaustion
|
|
204
207
|
while ((match = VersionRegex.exec(str)) !== null) {
|
|
205
208
|
const [, name, operator, version] = match;
|
|
206
|
-
const range = package_1.Package.
|
|
209
|
+
const range = package_1.Package.parsePkgVersionRange(operator, version);
|
|
207
210
|
packages.push(new package_1.Package({
|
|
208
211
|
name: name,
|
|
209
212
|
type: type,
|
|
@@ -91,7 +91,7 @@ function isExportedInInfo(name, nsInfo) {
|
|
|
91
91
|
}
|
|
92
92
|
if (name.includes('.')) {
|
|
93
93
|
for (const [k, m] of nsInfo.exportS3Generics.entries()) {
|
|
94
|
-
if (m.
|
|
94
|
+
if (m.some(method => `${k}.${method}` === name)) {
|
|
95
95
|
return true;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -419,6 +419,10 @@ function mergeNamespaceInfo(target, source) {
|
|
|
419
419
|
conditional: mergedConditional.size > 0 ? mergedConditional : undefined,
|
|
420
420
|
};
|
|
421
421
|
}
|
|
422
|
+
/** Split a NAMESPACE directive's argument list (`a, "b", c`) into individual, quote-stripped names. */
|
|
423
|
+
function splitNamespaceArgs(args) {
|
|
424
|
+
return args.split(',').map(s => (0, retriever_1.removeRQuotes)(s.trim())).filter(s => s.length > 0);
|
|
425
|
+
}
|
|
422
426
|
/**
|
|
423
427
|
* Parses the given NAMESPACE file
|
|
424
428
|
*/
|
|
@@ -435,7 +439,8 @@ function parseNamespaceSimple(file) {
|
|
|
435
439
|
switch (type) {
|
|
436
440
|
case 'exportClasses':
|
|
437
441
|
case 'exportMethods':
|
|
438
|
-
|
|
442
|
+
// a single directive may list several symbols, e.g. `exportMethods(show, summary)`
|
|
443
|
+
result.current.exportedFunctions.push(...splitNamespaceArgs(args));
|
|
439
444
|
break;
|
|
440
445
|
case 'S3method':
|
|
441
446
|
{
|
|
@@ -453,7 +458,8 @@ function parseNamespaceSimple(file) {
|
|
|
453
458
|
break;
|
|
454
459
|
}
|
|
455
460
|
case 'export':
|
|
456
|
-
|
|
461
|
+
// `export(a, b)` exports both `a` and `b`, so split rather than storing the literal `"a, b"`
|
|
462
|
+
result.current.exportedSymbols.push(...splitNamespaceArgs(args));
|
|
457
463
|
break;
|
|
458
464
|
case 'useDynLib':
|
|
459
465
|
{
|
|
@@ -109,10 +109,8 @@ function parseNews(file) {
|
|
|
109
109
|
.filter(l => !noiseRegex.test(l));
|
|
110
110
|
// this is a port of the incredible complex R NEWS regex, but luckily it is not too liberal :D
|
|
111
111
|
const regexVersion = makeRversionRegex();
|
|
112
|
-
// filter lines that match the version regex
|
|
113
|
-
const versionLines = lines.map(line => regexVersion.test(line));
|
|
114
112
|
// drop the header by removing everything before the first match
|
|
115
|
-
const firstVersionIndex =
|
|
113
|
+
const firstVersionIndex = lines.findIndex(line => regexVersion.test(line));
|
|
116
114
|
const relevantLines = lines.slice(firstVersionIndex);
|
|
117
115
|
// split at every version line
|
|
118
116
|
const lineChunks = splitLinesRegex(relevantLines, regexVersion);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FlowrAnalyzerFilePlugin } from './flowr-analyzer-file-plugin';
|
|
2
|
+
import { SemVer } from 'semver';
|
|
3
|
+
import type { PathLike } from 'fs';
|
|
4
|
+
import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
|
|
5
|
+
import type { FlowrFileProvider } from '../../context/flowr-file';
|
|
6
|
+
/**
|
|
7
|
+
* This plugin provides supports for the identification of installed files (files below an `inst/` folder).
|
|
8
|
+
* If you use multiple plugins, this should be included *before* other plugins.
|
|
9
|
+
*/
|
|
10
|
+
export declare class FlowrAnalyzerMetaInstFilesPlugin extends FlowrAnalyzerFilePlugin {
|
|
11
|
+
readonly name = "flowr-analyzer-inst-files-plugin";
|
|
12
|
+
readonly description = "This plugin provides support for loading installed files.";
|
|
13
|
+
readonly version: SemVer;
|
|
14
|
+
private readonly pathPattern;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new instance of the INST file plugin.
|
|
17
|
+
* @param pathPattern - The pathPattern to identify INST files, see {@link InstPathPattern} for the default pathPattern.
|
|
18
|
+
*/
|
|
19
|
+
constructor(pathPattern?: RegExp);
|
|
20
|
+
applies(file: PathLike): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Processes the given file, assigning it the {@link FileRole.Install} role.
|
|
23
|
+
* Given that the file may still need to be processed by other plugins, this method returns the `true` flag for that purpose.
|
|
24
|
+
*/
|
|
25
|
+
process(_ctx: FlowrAnalyzerContext, file: FlowrFileProvider): [FlowrFileProvider, true];
|
|
26
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowrAnalyzerMetaInstFilesPlugin = void 0;
|
|
4
|
+
const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
const flowr_file_1 = require("../../context/flowr-file");
|
|
7
|
+
const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
8
|
+
const InstPathPattern = /(^|\/)inst(\/|$)/;
|
|
9
|
+
/**
|
|
10
|
+
* This plugin provides supports for the identification of installed files (files below an `inst/` folder).
|
|
11
|
+
* If you use multiple plugins, this should be included *before* other plugins.
|
|
12
|
+
*/
|
|
13
|
+
class FlowrAnalyzerMetaInstFilesPlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
|
|
14
|
+
name = 'flowr-analyzer-inst-files-plugin';
|
|
15
|
+
description = 'This plugin provides support for loading installed files.';
|
|
16
|
+
version = new semver_1.SemVer('0.1.0');
|
|
17
|
+
pathPattern;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new instance of the INST file plugin.
|
|
20
|
+
* @param pathPattern - The pathPattern to identify INST files, see {@link InstPathPattern} for the default pathPattern.
|
|
21
|
+
*/
|
|
22
|
+
constructor(pathPattern = InstPathPattern) {
|
|
23
|
+
super();
|
|
24
|
+
this.pathPattern = pathPattern;
|
|
25
|
+
}
|
|
26
|
+
applies(file) {
|
|
27
|
+
return this.pathPattern.test((0, built_in_source_1.platformDirname)(file.toString()));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Processes the given file, assigning it the {@link FileRole.Install} role.
|
|
31
|
+
* Given that the file may still need to be processed by other plugins, this method returns the `true` flag for that purpose.
|
|
32
|
+
*/
|
|
33
|
+
process(_ctx, file) {
|
|
34
|
+
file.assignRole(flowr_file_1.FileRole.Install);
|
|
35
|
+
return [file, true];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.FlowrAnalyzerMetaInstFilesPlugin = FlowrAnalyzerMetaInstFilesPlugin;
|
|
39
|
+
//# sourceMappingURL=flowr-analyzer-inst-file-plugin.js.map
|
package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js
CHANGED
|
@@ -13,8 +13,8 @@ function virtualEnvFiles(ctx, name) {
|
|
|
13
13
|
return ctx.files.getFilesByRole(flowr_file_1.FileRole.VirtualEnv).filter(f => (0, built_in_source_1.platformBasename)(f.path()) === name);
|
|
14
14
|
}
|
|
15
15
|
function pin(ctx, name, version) {
|
|
16
|
-
const range = package_1.Package.
|
|
17
|
-
ctx.deps.
|
|
16
|
+
const range = package_1.Package.parsePkgVersionRange(undefined, version);
|
|
17
|
+
ctx.deps.addDeclaredDependency(new package_1.Package({ name, versionConstraints: range ? [range] : undefined }));
|
|
18
18
|
}
|
|
19
19
|
/** Reads package versions from an `renv.lock` (JSON). renv pins are exact. */
|
|
20
20
|
class FlowrAnalyzerPackageVersionsRenvPlugin extends flowr_analyzer_package_versions_plugin_1.FlowrAnalyzerPackageVersionsPlugin {
|
|
@@ -15,6 +15,7 @@ class FlowrAnalyzerPackageVersionsNamespaceFilePlugin extends flowr_analyzer_pac
|
|
|
15
15
|
const nmspcFiles = ctx.files.getFilesByRole(flowr_file_1.FileRole.Namespace);
|
|
16
16
|
if (nmspcFiles.length === 0) {
|
|
17
17
|
exports.namespaceFileLog.debug('No namespace file found, cannot extract package versions.');
|
|
18
|
+
return;
|
|
18
19
|
}
|
|
19
20
|
else if (nmspcFiles.length > 1) {
|
|
20
21
|
exports.namespaceFileLog.warn(`Found ${nmspcFiles.length} namespace files, expected exactly one.`);
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { FlowrAnalyzerPlugin, PluginType } from '../flowr-analyzer-plugin';
|
|
2
|
+
import type { PackageSignatureSource } from '../../sigdb/reader';
|
|
3
|
+
import type { FlowrConfig } from '../../../config';
|
|
2
4
|
/** metadata of a package database a plugin currently has loaded */
|
|
3
|
-
export interface
|
|
5
|
+
export interface SigDbLoadedInfo {
|
|
4
6
|
scope: string;
|
|
5
7
|
version: number;
|
|
6
8
|
date: string;
|
|
9
|
+
hash: string;
|
|
10
|
+
/** the on-disk compression codec of the resolved source(s): `zstd`, `brotli`, `gzip`, `plain`, or `mixed` for a set spanning several */
|
|
11
|
+
readonly format?: string;
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
9
14
|
* This is the base class for all plugins that identify package and dependency versions used in the project.
|
|
@@ -14,7 +19,18 @@ export declare abstract class FlowrAnalyzerPackageVersionsPlugin extends FlowrAn
|
|
|
14
19
|
readonly type = PluginType.DependencyIdentification;
|
|
15
20
|
static defaultPlugin(): FlowrAnalyzerPackageVersionsPlugin;
|
|
16
21
|
/** metadata of the databases this plugin currently has loaded (empty for plugins without any) */
|
|
17
|
-
loadedDatabases():
|
|
22
|
+
loadedDatabases(): SigDbLoadedInfo[];
|
|
23
|
+
/** Packages known to this plugin that export `name` (empty for plugins without a database). */
|
|
24
|
+
packagesExporting(_name: string): readonly string[];
|
|
25
|
+
/** The signature sources this plugin currently has loaded (empty for plugins without any). `config` lets a query resolve config-driven sources before any analysis has set the plugin's context. */
|
|
26
|
+
signatureSources(_config?: FlowrConfig): readonly PackageSignatureSource[];
|
|
27
|
+
/** Mount an extra signature source by path (a `.sigs.ndjson`, `.br`, or `*.manifest.json(.br)`); no-op by default. */
|
|
28
|
+
addDatabaseSource(_source: string): Promise<void>;
|
|
18
29
|
/** Eagerly parse and mount this plugin's databases up front (no-op for plugins without any). */
|
|
19
30
|
preloadDatabasesSync(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Whether this plugin can resolve the always-available base-R packages (so their exports can be attached
|
|
33
|
+
* eagerly for bare base calls). `false` for plugins without a versioned base-R signature source.
|
|
34
|
+
*/
|
|
35
|
+
providesBaseRPackages(): boolean;
|
|
20
36
|
}
|
|
@@ -17,8 +17,27 @@ class FlowrAnalyzerPackageVersionsPlugin extends flowr_analyzer_plugin_1.FlowrAn
|
|
|
17
17
|
loadedDatabases() {
|
|
18
18
|
return [];
|
|
19
19
|
}
|
|
20
|
+
/** Packages known to this plugin that export `name` (empty for plugins without a database). */
|
|
21
|
+
packagesExporting(_name) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
/** The signature sources this plugin currently has loaded (empty for plugins without any). `config` lets a query resolve config-driven sources before any analysis has set the plugin's context. */
|
|
25
|
+
signatureSources(_config) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
/** Mount an extra signature source by path (a `.sigs.ndjson`, `.br`, or `*.manifest.json(.br)`); no-op by default. */
|
|
29
|
+
addDatabaseSource(_source) {
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
}
|
|
20
32
|
/** Eagerly parse and mount this plugin's databases up front (no-op for plugins without any). */
|
|
21
33
|
preloadDatabasesSync() { }
|
|
34
|
+
/**
|
|
35
|
+
* Whether this plugin can resolve the always-available base-R packages (so their exports can be attached
|
|
36
|
+
* eagerly for bare base calls). `false` for plugins without a versioned base-R signature source.
|
|
37
|
+
*/
|
|
38
|
+
providesBaseRPackages() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
22
41
|
}
|
|
23
42
|
exports.FlowrAnalyzerPackageVersionsPlugin = FlowrAnalyzerPackageVersionsPlugin;
|
|
24
43
|
/**
|
package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { FlowrAnalyzerPackageVersionsPlugin, type SigDbLoadedInfo } from './flowr-analyzer-package-versions-plugin';
|
|
2
|
+
import { SemVer } from 'semver';
|
|
3
|
+
import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
|
|
4
|
+
import { type PackageSignatureSource } from '../../sigdb/reader';
|
|
5
|
+
import { type FlowrConfig } from '../../../config';
|
|
6
|
+
/** the plugin's instance name (pass to `unregisterPlugins` to disable the default sigdb resolver) */
|
|
7
|
+
export declare const SigDbPluginName = "flowr-analyzer-package-versions-sigdb-plugin";
|
|
8
|
+
export declare const sigDbLog: import("tslog").Logger<import("tslog").ILogObj>;
|
|
9
|
+
/** an opened signature source, or a local file path (a plain `.sigs.ndjson`, or a `.br`/manifest via {@link FlowrAnalyzerPackageVersionsSigDbPlugin.preload}) */
|
|
10
|
+
export type SigDbSource = PackageSignatureSource | string;
|
|
11
|
+
/**
|
|
12
|
+
* The database flattens S3 methods into the export list, so we recover the `generic -> classes` map for
|
|
13
|
+
* dispatch: an export `generic.class` is a method when the `generic` is itself exported (e.g. `print.foo`).
|
|
14
|
+
*/
|
|
15
|
+
export declare function reconstructS3Generics(exported: readonly string[]): Map<string, string[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves `library(pkg)` / `use(pkg, fn)` from precomputed `flowr-sigdb` databases via the
|
|
18
|
+
* {@link PackageSignatureSource} contract. For an R-core package it picks the version shipped with the assumed
|
|
19
|
+
* R release (`solver.sigdb.assumedRVersion`), so `library(stats)` attaches that release's exports. Plain-file
|
|
20
|
+
* sources load lazily; a `.br` or manifest source is mounted by {@link preload}. On by default.
|
|
21
|
+
*/
|
|
22
|
+
export declare class FlowrAnalyzerPackageVersionsSigDbPlugin extends FlowrAnalyzerPackageVersionsPlugin {
|
|
23
|
+
readonly name = "flowr-analyzer-package-versions-sigdb-plugin";
|
|
24
|
+
readonly description = "Resolves library exports (and versioned base R) from precomputed flowr-sigdb databases.";
|
|
25
|
+
readonly version: SemVer;
|
|
26
|
+
private readonly extraSources;
|
|
27
|
+
private sources;
|
|
28
|
+
/** the `additionalPaths` the current {@link sources} were assembled with, so a later config resolves a rebuild */
|
|
29
|
+
private sourcesKey;
|
|
30
|
+
private analyzerCtx;
|
|
31
|
+
/** cached reverse index `export name -> packages exporting it`, built once per source set (see {@link packagesExporting}) */
|
|
32
|
+
private exportIndex;
|
|
33
|
+
/** `pkg@assumedR` keys already reported via {@link baseVersionFor}'s fallback, so the info is logged once */
|
|
34
|
+
private readonly baseFallbacksLogged;
|
|
35
|
+
/** installed package versions for `versionSelection: 'system'`, read once from R (see {@link warmInstalledVersions}) */
|
|
36
|
+
private installedVersions;
|
|
37
|
+
/** guards the one-time async warm-up of {@link installedVersions} */
|
|
38
|
+
private installedVersionsPromise;
|
|
39
|
+
/** invalidate the assembled source list and derived caches (after a source or config change) */
|
|
40
|
+
private resetAssembled;
|
|
41
|
+
constructor(...sources: SigDbSource[]);
|
|
42
|
+
/**
|
|
43
|
+
* Dynamically add signature sources after construction (opened instances, plain `.sigs.ndjson`, or `.br`/
|
|
44
|
+
* manifest paths). Added sources take precedence over the bundled default, so they can override or extend it.
|
|
45
|
+
*/
|
|
46
|
+
addSource(...sources: readonly SigDbSource[]): void;
|
|
47
|
+
process(ctx: FlowrAnalyzerContext): void;
|
|
48
|
+
private syncPromise;
|
|
49
|
+
/**
|
|
50
|
+
* Opt-in (`solver.sigdb.autoSync`) startup re-sync.
|
|
51
|
+
* If the committed `sigdb.remote.json` link file lists shards whose cached copies are missing or hash-mismatched,
|
|
52
|
+
* this will sync them.
|
|
53
|
+
*/
|
|
54
|
+
private startBackgroundSync;
|
|
55
|
+
private warmPromise;
|
|
56
|
+
/**
|
|
57
|
+
* Warm the hot shards (base + most-downloaded packages) of any sharded source in a background task, so the
|
|
58
|
+
* first `library()` lookup no longer blocks on decompression. Idempotent.
|
|
59
|
+
*/
|
|
60
|
+
private startBackgroundWarm;
|
|
61
|
+
/**
|
|
62
|
+
* Read the system's installed package versions once (for `versionSelection: 'system'`), off the hot path. Only
|
|
63
|
+
* an R-backed parser exposes `installedPackageVersions`; a tree-sitter (no-R) parser skips this, so `system`
|
|
64
|
+
* gracefully falls back to `newest` in {@link resolve}. Idempotent; failures leave the map empty (same fallback).
|
|
65
|
+
*/
|
|
66
|
+
private warmInstalledVersions;
|
|
67
|
+
/** Mount the databases up front instead of on the first library load (see `solver.sigdb.eagerlyLoad`). */
|
|
68
|
+
preloadDatabasesSync(): void;
|
|
69
|
+
/** whether any loaded source carries a versioned base-R package (so base namespaces can be attached eagerly) */
|
|
70
|
+
providesBaseRPackages(): boolean;
|
|
71
|
+
signatureSources(config?: FlowrConfig): readonly PackageSignatureSource[];
|
|
72
|
+
loadedDatabases(): SigDbLoadedInfo[];
|
|
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.
|
|
77
|
+
*/
|
|
78
|
+
packagesExporting(name: string): readonly string[];
|
|
79
|
+
/** one pass over every loaded source building `export name -> packages`, honoring self-package exclusion */
|
|
80
|
+
private buildExportIndex;
|
|
81
|
+
/**
|
|
82
|
+
* The raw sources in priority order: explicit constructor sources, `$FLOWR_SIGDB`, then **every** bundled
|
|
83
|
+
* database discovered in the data dirs (see {@link defaultSigDbPaths}) -- so an extra bundle dropped next to
|
|
84
|
+
* the default (e.g. a downloaded full-history one) is mounted automatically. All bundled defaults are skipped
|
|
85
|
+
* when `$FLOWR_DISABLE_DEFAULT_SIGDB` is set; explicit sources are always honored.
|
|
86
|
+
*/
|
|
87
|
+
private rawSources;
|
|
88
|
+
/** synchronously openable sources (instances + plain `.sigs.ndjson`); `.br`/manifests are added by {@link preload}. */
|
|
89
|
+
private loadSources;
|
|
90
|
+
private loadSync;
|
|
91
|
+
/**
|
|
92
|
+
* Open every source, including compressed bundles (`.br`/`.gz`) and manifests (`*.manifest.json`).
|
|
93
|
+
* Call once at the analyzer boundary so resolution can fall through to them.
|
|
94
|
+
*/
|
|
95
|
+
preload(): Promise<void>;
|
|
96
|
+
addDatabaseSource(source: string): Promise<void>;
|
|
97
|
+
/** Whether the given name is the analyzed project itself (so we must not shadow its own definitions). */
|
|
98
|
+
private isSelfPackage;
|
|
99
|
+
/**
|
|
100
|
+
* For a base package, the newest core version `<=` the assumed R version (see
|
|
101
|
+
* {@link FlowrAnalyzerContext.resolvedRVersion}). If the assumed version predates every recorded core
|
|
102
|
+
* release, the closest supported one (the earliest) is used and the substitution is logged once as info.
|
|
103
|
+
*/
|
|
104
|
+
private baseVersionFor;
|
|
105
|
+
private resolve;
|
|
106
|
+
/** the concrete export view for a non-base package under the active {@link VersionSelection} policy, or `undefined` if none satisfies */
|
|
107
|
+
private selectVersion;
|
|
108
|
+
/**
|
|
109
|
+
* Newest version satisfying the constraint. Fast path: prefer the source's latest (no history decompression for
|
|
110
|
+
* the common `>=` case) and accept it when it satisfies; only otherwise enumerate the stored versions and pick
|
|
111
|
+
* the highest satisfying one (e.g. an upper-bound or exact-old pin).
|
|
112
|
+
*/
|
|
113
|
+
private newestSatisfying;
|
|
114
|
+
/** Lowest stored version satisfying the constraint (using the store's actual R-form version strings). */
|
|
115
|
+
private oldestSatisfying;
|
|
116
|
+
/** the versions the source can answer for a package (dated releases, base-R core releases, and the latest), ascending */
|
|
117
|
+
private availableVersions;
|
|
118
|
+
/** build the resolved {@link Package} (namespace + version) from a source's export view */
|
|
119
|
+
private toResolvedPackage;
|
|
120
|
+
}
|