@eagleoutice/flowr 2.13.4 → 2.13.5
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 +31 -31
- package/cli/repl/core.js +10 -2
- package/config.d.ts +4 -1
- package/config.js +10 -1
- package/control-flow/cfg-dead-code.js +19 -4
- package/control-flow/extract-cfg.js +12 -4
- package/dataflow/environments/built-in-config.d.ts +6 -3
- package/dataflow/environments/built-in-eval-name.d.ts +20 -0
- package/dataflow/environments/built-in-eval-name.js +25 -0
- package/dataflow/environments/built-in-props.d.ts +175 -0
- package/dataflow/environments/built-in-props.js +207 -0
- package/dataflow/environments/built-in.d.ts +26 -22
- package/dataflow/environments/built-in.js +37 -10
- package/dataflow/environments/default-builtin-config.d.ts +1046 -93
- package/dataflow/environments/default-builtin-config.js +485 -213
- package/dataflow/environments/identifier.d.ts +24 -1
- package/dataflow/environments/identifier.js +24 -2
- package/dataflow/environments/query-fn-props.d.ts +102 -0
- package/dataflow/environments/query-fn-props.js +188 -0
- package/dataflow/eval/resolve/alias-tracking.js +4 -1
- package/dataflow/eval/resolve/match-arguments.d.ts +15 -0
- package/dataflow/eval/resolve/match-arguments.js +77 -0
- package/dataflow/eval/resolve/resolve-numbers.d.ts +202 -0
- package/dataflow/eval/resolve/resolve-numbers.js +163 -0
- package/dataflow/eval/resolve/resolve-operators.d.ts +60 -0
- package/dataflow/eval/resolve/resolve-operators.js +115 -0
- package/dataflow/eval/resolve/resolve-strings.d.ts +98 -0
- package/dataflow/eval/resolve/resolve-strings.js +116 -0
- package/dataflow/eval/resolve/resolve.d.ts +5 -37
- package/dataflow/eval/resolve/resolve.js +56 -134
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
- package/documentation/data/faq/faqs.js +11 -0
- package/documentation/doc-util/doc-types.js +1 -1
- package/documentation/wiki-analyzer.js +75 -0
- package/documentation/wiki-core.js +65 -16
- package/documentation/wiki-interface.js +3 -0
- package/linter/linter-rules.d.ts +10 -11
- package/linter/rules/deprecated-functions.js +5 -3
- package/linter/rules/function-finder-util.d.ts +2 -2
- package/linter/rules/function-finder-util.js +10 -3
- package/linter/rules/network-functions.d.ts +25 -5
- package/linter/rules/network-functions.js +51 -11
- package/linter/rules/problematic-inputs.d.ts +1 -1
- package/linter/rules/problematic-inputs.js +7 -1
- package/linter/rules/seeded-randomness.d.ts +5 -8
- package/linter/rules/seeded-randomness.js +17 -9
- package/package.json +3 -2
- package/project/cache/flowr-analyzer-cache.d.ts +4 -3
- package/project/cache/flowr-analyzer-cache.js +32 -13
- package/project/cache/flowr-cache.d.ts +39 -12
- package/project/cache/flowr-cache.js +5 -3
- package/project/context/flowr-analyzer-context.d.ts +8 -1
- package/project/context/flowr-analyzer-context.js +11 -1
- package/project/context/flowr-analyzer-dependencies-context.d.ts +4 -2
- package/project/context/flowr-analyzer-dependencies-context.js +15 -1
- package/project/context/flowr-analyzer-files-context.d.ts +8 -4
- package/project/context/flowr-analyzer-files-context.js +20 -1
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +33 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.js +63 -0
- package/project/context/flowr-analyzer-meta-context.d.ts +3 -1
- package/project/context/flowr-analyzer-meta-context.js +14 -0
- package/project/context/flowr-file.d.ts +25 -3
- package/project/context/flowr-file.js +24 -2
- package/project/dependency-version-space.d.ts +37 -0
- package/project/dependency-version-space.js +118 -26
- package/project/flowr-analyzer.d.ts +6 -0
- package/project/flowr-analyzer.js +6 -2
- package/project/incremental/incremental-parse/edit-computation.d.ts +7 -0
- package/project/incremental/incremental-parse/edit-computation.js +61 -0
- package/project/incremental/incremental-parse/incremental-parse.d.ts +12 -0
- package/project/incremental/incremental-parse/incremental-parse.js +37 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +57 -0
- package/project/plugins/file-plugins/files/flowr-manifest-files.js +121 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -2
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +33 -0
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +53 -0
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.d.ts +27 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.js +47 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +7 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +31 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +10 -4
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +17 -4
- package/project/plugins/plugin-registry.d.ts +4 -4
- package/project/plugins/plugin-registry.js +7 -4
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +4 -4
- package/project/sigdb/reader.d.ts +7 -0
- package/project/sigdb/reader.js +12 -0
- package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +10 -0
- package/queries/catalog/dependencies-query/function-info/derived-functions.js +41 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +13 -12
- package/queries/catalog/dependencies-query/function-info/write-functions.js +16 -23
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +33 -3
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +31 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +9 -2
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +8 -10
- package/queries/catalog/input-sources-query/input-source-functions.js +23 -388
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +27 -10
- package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -1
- package/queries/catalog/signature-query/signature-query-executor.js +79 -3
- package/queries/catalog/signature-query/signature-query-format.d.ts +27 -0
- package/queries/catalog/signature-query/signature-query-render.js +21 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +6 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +21 -2
- package/r-bridge/parser.d.ts +11 -1
- package/r-bridge/parser.js +7 -4
- package/r-bridge/shell-executor.d.ts +1 -0
- package/r-bridge/shell-executor.js +1 -0
- package/r-bridge/shell.d.ts +1 -0
- package/r-bridge/shell.js +1 -0
- package/search/flowr-search-filters.d.ts +1 -6
- package/search/flowr-search-filters.js +1 -8
- package/search/search-executor/search-enrichers.d.ts +2 -0
- package/search/search-executor/search-enrichers.js +29 -12
- package/util/version.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +0 -31
- package/project/plugins/file-plugins/files/flowr-rproject-file.js +0 -66
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +0 -22
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +0 -36
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +0 -13
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +0 -32
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PathLike } from 'fs';
|
|
2
2
|
import type { RParseRequest } from '../../r-bridge/retriever';
|
|
3
|
+
import type { InvalidationEventHandler } from '../cache/flowr-cache';
|
|
3
4
|
/**
|
|
4
5
|
* Just a readable alias for file paths, mostly for documentation purposes.
|
|
5
6
|
* We separate {@link PathLike} types from string paths that are used for project paths.
|
|
@@ -30,9 +31,9 @@ export declare enum FileRole {
|
|
|
30
31
|
Data = "data",
|
|
31
32
|
/** Signals separate license files, but please note, that DESCRIPTION files may contain license info too */
|
|
32
33
|
License = "license",
|
|
33
|
-
/** Files describing a project's virtual/pinned package environment, e.g., `renv.lock` or `
|
|
34
|
+
/** Files describing a project's virtual/pinned package environment, e.g., `renv.lock`, `rv.lock` or `uvr.lock`. */
|
|
34
35
|
VirtualEnv = "virtual-env",
|
|
35
|
-
/** A project manifest that is no `DESCRIPTION`, e.g. the `rproject.toml` of an rv project. */
|
|
36
|
+
/** A project manifest that is no `DESCRIPTION`, e.g. the `rproject.toml` of an rv project or the `uvr.toml` of a uvr project. */
|
|
36
37
|
Manifest = "manifest",
|
|
37
38
|
/**
|
|
38
39
|
* R sources evaluated at startup, before any project code (`.Rprofile`, `Rprofile.site`).
|
|
@@ -96,6 +97,18 @@ export interface FlowrFileProvider<Content extends {
|
|
|
96
97
|
* **Do not call this method yourself unless you are a file-loader plugin and/or really know what you are doing, this may break plugin assumptions!**
|
|
97
98
|
*/
|
|
98
99
|
assignRole(role: FileRole): void;
|
|
100
|
+
/**
|
|
101
|
+
* Set the appropriate callback to trigger updates in case of an 'invalidate'
|
|
102
|
+
*/
|
|
103
|
+
addOnInvalidate(callback: InvalidationEventHandler<Content>): void;
|
|
104
|
+
/**
|
|
105
|
+
* Remove a previously added callback
|
|
106
|
+
*/
|
|
107
|
+
removeOnInvalidate(callback: InvalidationEventHandler<Content>): void;
|
|
108
|
+
/**
|
|
109
|
+
* Reload the file content because something has changed.
|
|
110
|
+
*/
|
|
111
|
+
invalidate(): void;
|
|
99
112
|
}
|
|
100
113
|
/**
|
|
101
114
|
* A basic implementation of the {@link FlowrFileProvider} interface that caches the content after the first load (i.e., updates on disk are ignored).
|
|
@@ -106,6 +119,7 @@ export declare abstract class FlowrFile<Content extends StringableContent = Stri
|
|
|
106
119
|
private contentCache;
|
|
107
120
|
protected filePath: PathLike;
|
|
108
121
|
private _roles?;
|
|
122
|
+
private onInvalidate;
|
|
109
123
|
static readonly INLINE_PATH = "@inline";
|
|
110
124
|
constructor(filePath: PathLike, roles?: readonly FileRole[]);
|
|
111
125
|
get roles(): readonly FileRole[] | undefined;
|
|
@@ -124,6 +138,9 @@ export declare abstract class FlowrFile<Content extends StringableContent = Stri
|
|
|
124
138
|
* @see {@link FlowrInlineTextFile}
|
|
125
139
|
*/
|
|
126
140
|
static fromRequest(request: RParseRequest): FlowrFile<string>;
|
|
141
|
+
addOnInvalidate(callback: InvalidationEventHandler<Content>): void;
|
|
142
|
+
removeOnInvalidate(callback: InvalidationEventHandler<Content>): void;
|
|
143
|
+
invalidate(): void;
|
|
127
144
|
}
|
|
128
145
|
/**
|
|
129
146
|
* A basic implementation of the {@link FlowrFileProvider} interface for text files that caches the content after the first load (i.e., updates on disk are ignored).
|
|
@@ -137,7 +154,12 @@ export declare class FlowrTextFile extends FlowrFile<string> {
|
|
|
137
154
|
* These will be handled by the {@link FlowrAnalyzerDescriptionFilePlugin} (e.g., by using the {@link FlowrDescriptionFile#from} method decorator).
|
|
138
155
|
*/
|
|
139
156
|
export declare class FlowrInlineTextFile extends FlowrFile<string> {
|
|
140
|
-
private
|
|
157
|
+
private contentStr;
|
|
141
158
|
constructor(path: PathLike, content: string);
|
|
142
159
|
protected loadContent(): string;
|
|
160
|
+
/**
|
|
161
|
+
* Update the content of this inline file and invalidate the cache to trigger updates in the analysis.
|
|
162
|
+
* @see {@link FlowrFile#invalidate}
|
|
163
|
+
*/
|
|
164
|
+
updateInlineContent(newContent: string): void;
|
|
143
165
|
}
|
|
@@ -31,9 +31,9 @@ var FileRole;
|
|
|
31
31
|
FileRole["Data"] = "data";
|
|
32
32
|
/** Signals separate license files, but please note, that DESCRIPTION files may contain license info too */
|
|
33
33
|
FileRole["License"] = "license";
|
|
34
|
-
/** Files describing a project's virtual/pinned package environment, e.g., `renv.lock` or `
|
|
34
|
+
/** Files describing a project's virtual/pinned package environment, e.g., `renv.lock`, `rv.lock` or `uvr.lock`. */
|
|
35
35
|
FileRole["VirtualEnv"] = "virtual-env";
|
|
36
|
-
/** A project manifest that is no `DESCRIPTION`, e.g. the `rproject.toml` of an rv project. */
|
|
36
|
+
/** A project manifest that is no `DESCRIPTION`, e.g. the `rproject.toml` of an rv project or the `uvr.toml` of a uvr project. */
|
|
37
37
|
FileRole["Manifest"] = "manifest";
|
|
38
38
|
/**
|
|
39
39
|
* R sources evaluated at startup, before any project code (`.Rprofile`, `Rprofile.site`).
|
|
@@ -64,6 +64,7 @@ class FlowrFile {
|
|
|
64
64
|
contentCache;
|
|
65
65
|
filePath;
|
|
66
66
|
_roles;
|
|
67
|
+
onInvalidate = [];
|
|
67
68
|
static INLINE_PATH = '@inline';
|
|
68
69
|
constructor(filePath, roles) {
|
|
69
70
|
this.filePath = filePath;
|
|
@@ -113,6 +114,19 @@ class FlowrFile {
|
|
|
113
114
|
return new FlowrInlineTextFile(FlowrFile.INLINE_PATH, request.content);
|
|
114
115
|
}
|
|
115
116
|
}
|
|
117
|
+
addOnInvalidate(callback) {
|
|
118
|
+
this.onInvalidate.push(callback);
|
|
119
|
+
}
|
|
120
|
+
removeOnInvalidate(callback) {
|
|
121
|
+
this.onInvalidate = this.onInvalidate.filter(cb => cb !== callback);
|
|
122
|
+
}
|
|
123
|
+
invalidate() {
|
|
124
|
+
const oldContent = this.contentCache;
|
|
125
|
+
this.contentCache = undefined;
|
|
126
|
+
for (const invalidator of this.onInvalidate) {
|
|
127
|
+
invalidator({ type: "single-file-invalidate" /* InvalidationEventType.SingleFileInvalidate */, oldContent, filePath: this.path() });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
116
130
|
}
|
|
117
131
|
exports.FlowrFile = FlowrFile;
|
|
118
132
|
/**
|
|
@@ -138,6 +152,14 @@ class FlowrInlineTextFile extends FlowrFile {
|
|
|
138
152
|
loadContent() {
|
|
139
153
|
return this.contentStr;
|
|
140
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Update the content of this inline file and invalidate the cache to trigger updates in the analysis.
|
|
157
|
+
* @see {@link FlowrFile#invalidate}
|
|
158
|
+
*/
|
|
159
|
+
updateInlineContent(newContent) {
|
|
160
|
+
this.contentStr = newContent;
|
|
161
|
+
this.invalidate();
|
|
162
|
+
}
|
|
141
163
|
}
|
|
142
164
|
exports.FlowrInlineTextFile = FlowrInlineTextFile;
|
|
143
165
|
//# sourceMappingURL=flowr-file.js.map
|
|
@@ -90,6 +90,8 @@ export interface SurvivingEntries {
|
|
|
90
90
|
readonly unsatisfiable: boolean;
|
|
91
91
|
/** the total number of versions the database carries for the package (the full history the candidates are drawn from) */
|
|
92
92
|
readonly total: number;
|
|
93
|
+
/** whether the database carries the package at all: `false` means "no record", not "no constraint" */
|
|
94
|
+
readonly known: boolean;
|
|
93
95
|
/** how many of those versions the *declared* constraints alone allow, the baseline the guess narrows down from */
|
|
94
96
|
readonly declared: number;
|
|
95
97
|
}
|
|
@@ -123,6 +125,41 @@ export declare function dateCutoff(spec: string): Date | undefined;
|
|
|
123
125
|
export declare function isoDay(date: Date): string;
|
|
124
126
|
/** scan the dataflow graph for every call that resolves (via {@link Dataflow.qualify}) to a package export */
|
|
125
127
|
export declare function collectUsage(graph: DataflowGraph, deps?: ReadOnlyFlowrAnalyzerDependenciesContext): Map<string, PackageUsage>;
|
|
128
|
+
/**
|
|
129
|
+
* What the orphan calls of one analyzed program implicated, as {@link collectOrphanUsage} reports it.
|
|
130
|
+
*/
|
|
131
|
+
export interface OrphanUsage {
|
|
132
|
+
/** per package the project does not already know: the orphan function names that pointed at it */
|
|
133
|
+
readonly attributed: Map<string, Set<string>>;
|
|
134
|
+
/** per such package: the other exporters of those names that lost the pick, most downloaded first */
|
|
135
|
+
readonly alternatives: Map<string, string[]>;
|
|
136
|
+
/** the same calls recorded against every alternative, so a caller can ask which of its versions would fit */
|
|
137
|
+
readonly alternativeUsage: Map<string, PackageUsage>;
|
|
138
|
+
}
|
|
139
|
+
/** options for {@link collectOrphanUsage} */
|
|
140
|
+
export interface OrphanUsageOptions {
|
|
141
|
+
/** the analyzed project's own namespace, never inferred as one of its own orphan dependencies */
|
|
142
|
+
readonly self?: string;
|
|
143
|
+
/** flowR's curated map of a builtin-modeled library function to its package (e.g. `ggplot` to `ggplot2`), the authoritative disambiguator when several packages export the name */
|
|
144
|
+
readonly builtinLibraryOf?: (name: string) => string | undefined;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Fold the analyzed code's *orphan* calls into `usage` and report which functions implicated each **unknown**
|
|
148
|
+
* package. An orphan is a bare call (`ggplot()`) whose name is not bound to a local/parameter/closure/import
|
|
149
|
+
* definition and is not a default-attached base export, but is exported by exactly one signature-database package.
|
|
150
|
+
* Such a call never qualifies to `pkg::fn`, so {@link collectUsage} is blind to it (even when flowR models the
|
|
151
|
+
* function as a builtin, as it does for `ggplot`), yet it pins the package's version just as a qualified call
|
|
152
|
+
* would; folding it into `usage` makes the package a guess target. The returned map lists, per package the project
|
|
153
|
+
* does not already declare or load (`isKnown` is `false`), the orphan function names that pointed at it (e.g.
|
|
154
|
+
* `ggplot2` from `ggplot()`) -- a note for a downstream handler to attach the library, since the symbol would be
|
|
155
|
+
* undefined were the package not loaded. Disambiguation is `options.builtinLibraryOf` (flowR's curated map, e.g.
|
|
156
|
+
* `ggplot` to `ggplot2`, authoritative even when several packages re-export the name), then a package the project
|
|
157
|
+
* already declares or loads, and finally the most downloaded of at most {@link MaxOrphanProviders} exporters; a
|
|
158
|
+
* name beyond that many packages export says nothing about which one is meant and is skipped, as are quoted (NSE)
|
|
159
|
+
* uses and forward-referenced closures. The exporters that lost the pick are kept as
|
|
160
|
+
* {@link OrphanUsage.alternatives}, since the guess is exactly that -- a guess.
|
|
161
|
+
*/
|
|
162
|
+
export declare function collectOrphanUsage(graph: DataflowGraph, deps: ReadOnlyFlowrAnalyzerDependenciesContext, usage: Map<string, PackageUsage>, isKnown: (pkg: string) => boolean, options?: OrphanUsageOptions): OrphanUsage;
|
|
126
163
|
/** intersection of multiple survivor sets: versions that survive in every set */
|
|
127
164
|
export declare function intersectSurvivors(survivorSets: readonly (readonly TimelineEntry[])[]): TimelineEntry[];
|
|
128
165
|
/**
|
|
@@ -4,6 +4,7 @@ exports.NoDisabledSources = exports.VersionSpace = exports.DefaultFixpointIterat
|
|
|
4
4
|
exports.dateCutoff = dateCutoff;
|
|
5
5
|
exports.isoDay = isoDay;
|
|
6
6
|
exports.collectUsage = collectUsage;
|
|
7
|
+
exports.collectOrphanUsage = collectOrphanUsage;
|
|
7
8
|
exports.intersectSurvivors = intersectSurvivors;
|
|
8
9
|
exports.collectTransitiveConstraints = collectTransitiveConstraints;
|
|
9
10
|
exports.iterateToFixpoint = iterateToFixpoint;
|
|
@@ -33,6 +34,9 @@ const identifier_1 = require("../dataflow/environments/identifier");
|
|
|
33
34
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
34
35
|
const graph_1 = require("../dataflow/graph/graph");
|
|
35
36
|
const df_helper_1 = require("../dataflow/graph/df-helper");
|
|
37
|
+
const dfg_get_origin_1 = require("../dataflow/origin/dfg-get-origin");
|
|
38
|
+
const r_base_packages_1 = require("../util/r-base-packages");
|
|
39
|
+
const undefined_symbol_util_1 = require("../linter/rules/undefined-symbol-util");
|
|
36
40
|
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
37
41
|
const built_in_s_seven_new_generic_1 = require("../dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic");
|
|
38
42
|
/** the pseudo-package standing for the analyzed project itself, never one of its own dependencies */
|
|
@@ -171,6 +175,31 @@ function addClassOwnershipUsage(usage, deps, graph) {
|
|
|
171
175
|
function isSyntheticArgument(arg) {
|
|
172
176
|
return !graph_1.FunctionArgument.isEmpty(arg) && String(arg.nodeId).endsWith(built_in_s_seven_new_generic_1.S7SyntheticFunArgSuffix);
|
|
173
177
|
}
|
|
178
|
+
/** record one call of `fn` into `pkgUsage`: union its named argument names and keep one representative per call shape */
|
|
179
|
+
function recordCallUsage(pkgUsage, fn, rawArgs) {
|
|
180
|
+
let entry = pkgUsage.get(fn);
|
|
181
|
+
if (entry === undefined) {
|
|
182
|
+
entry = { named: new Set(), calls: new Map() };
|
|
183
|
+
pkgUsage.set(fn, entry);
|
|
184
|
+
}
|
|
185
|
+
const args = rawArgs.some(isSyntheticArgument) ? rawArgs.filter(a => !isSyntheticArgument(a)) : rawArgs;
|
|
186
|
+
const named = [];
|
|
187
|
+
let positional = 0;
|
|
188
|
+
for (const arg of args) {
|
|
189
|
+
if (graph_1.FunctionArgument.isNamed(arg)) {
|
|
190
|
+
entry.named.add(arg.name);
|
|
191
|
+
named.push(arg.name);
|
|
192
|
+
}
|
|
193
|
+
else if (graph_1.FunctionArgument.isPositional(arg)) {
|
|
194
|
+
positional++;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// dedupe by call shape: named names + positional count
|
|
198
|
+
const key = named.sort().join(',') + '#' + positional;
|
|
199
|
+
if (!entry.calls.has(key)) {
|
|
200
|
+
entry.calls.set(key, [...args]);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
174
203
|
/** scan the dataflow graph for every call that resolves (via {@link Dataflow.qualify}) to a package export */
|
|
175
204
|
function collectUsage(graph, deps) {
|
|
176
205
|
const usage = new Map();
|
|
@@ -184,40 +213,102 @@ function collectUsage(graph, deps) {
|
|
|
184
213
|
if (pkg === undefined) {
|
|
185
214
|
continue;
|
|
186
215
|
}
|
|
187
|
-
const fn = identifier_1.Identifier.getName(qualified);
|
|
188
216
|
let pkgUsage = usage.get(pkg);
|
|
189
217
|
if (pkgUsage === undefined) {
|
|
190
218
|
pkgUsage = new Map();
|
|
191
219
|
usage.set(pkg, pkgUsage);
|
|
192
220
|
}
|
|
193
|
-
|
|
194
|
-
if (entry === undefined) {
|
|
195
|
-
entry = { named: new Set(), calls: new Map() };
|
|
196
|
-
pkgUsage.set(fn, entry);
|
|
197
|
-
}
|
|
198
|
-
const args = vertex.args.some(isSyntheticArgument) ? vertex.args.filter(a => !isSyntheticArgument(a)) : vertex.args;
|
|
199
|
-
const named = [];
|
|
200
|
-
let positional = 0;
|
|
201
|
-
for (const arg of args) {
|
|
202
|
-
if (graph_1.FunctionArgument.isNamed(arg)) {
|
|
203
|
-
entry.named.add(arg.name);
|
|
204
|
-
named.push(arg.name);
|
|
205
|
-
}
|
|
206
|
-
else if (graph_1.FunctionArgument.isPositional(arg)) {
|
|
207
|
-
positional++;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
// dedupe by call shape: named names + positional count
|
|
211
|
-
const key = named.sort().join(',') + '#' + positional;
|
|
212
|
-
if (!entry.calls.has(key)) {
|
|
213
|
-
entry.calls.set(key, [...args]);
|
|
214
|
-
}
|
|
221
|
+
recordCallUsage(pkgUsage, identifier_1.Identifier.getName(qualified), vertex.args);
|
|
215
222
|
}
|
|
216
223
|
if (deps) {
|
|
217
224
|
addClassOwnershipUsage(usage, deps, graph);
|
|
218
225
|
}
|
|
219
226
|
return usage;
|
|
220
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* How many packages may export an orphan's name before it is dropped as too generic. Up to this many, the most
|
|
230
|
+
* downloaded one is taken (see {@link collectOrphanUsage}); beyond it the name carries no information.
|
|
231
|
+
*/
|
|
232
|
+
const MaxOrphanProviders = 5;
|
|
233
|
+
/**
|
|
234
|
+
* Fold the analyzed code's *orphan* calls into `usage` and report which functions implicated each **unknown**
|
|
235
|
+
* package. An orphan is a bare call (`ggplot()`) whose name is not bound to a local/parameter/closure/import
|
|
236
|
+
* definition and is not a default-attached base export, but is exported by exactly one signature-database package.
|
|
237
|
+
* Such a call never qualifies to `pkg::fn`, so {@link collectUsage} is blind to it (even when flowR models the
|
|
238
|
+
* function as a builtin, as it does for `ggplot`), yet it pins the package's version just as a qualified call
|
|
239
|
+
* would; folding it into `usage` makes the package a guess target. The returned map lists, per package the project
|
|
240
|
+
* does not already declare or load (`isKnown` is `false`), the orphan function names that pointed at it (e.g.
|
|
241
|
+
* `ggplot2` from `ggplot()`) -- a note for a downstream handler to attach the library, since the symbol would be
|
|
242
|
+
* undefined were the package not loaded. Disambiguation is `options.builtinLibraryOf` (flowR's curated map, e.g.
|
|
243
|
+
* `ggplot` to `ggplot2`, authoritative even when several packages re-export the name), then a package the project
|
|
244
|
+
* already declares or loads, and finally the most downloaded of at most {@link MaxOrphanProviders} exporters; a
|
|
245
|
+
* name beyond that many packages export says nothing about which one is meant and is skipped, as are quoted (NSE)
|
|
246
|
+
* uses and forward-referenced closures. The exporters that lost the pick are kept as
|
|
247
|
+
* {@link OrphanUsage.alternatives}, since the guess is exactly that -- a guess.
|
|
248
|
+
*/
|
|
249
|
+
function collectOrphanUsage(graph, deps, usage, isKnown, options = {}) {
|
|
250
|
+
const { self, builtinLibraryOf } = options;
|
|
251
|
+
const attributed = new Map();
|
|
252
|
+
const alternatives = new Map();
|
|
253
|
+
const alternativeUsage = new Map();
|
|
254
|
+
const scopeDefined = (0, undefined_symbol_util_1.collectScopeDefinedNames)(graph);
|
|
255
|
+
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
256
|
+
// an anonymous callee, or an already-qualified `pkg::fn` (handled by collectUsage)
|
|
257
|
+
if (vertex.origin === 'unnamed' || identifier_1.Identifier.getNamespace(vertex.name) !== undefined) {
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const name = identifier_1.Identifier.getName(vertex.name);
|
|
261
|
+
// a call bound to a real definition (local, parameter, closure, or import) *is* that definition, not a package
|
|
262
|
+
// export; only an unresolved or builtin-modeled call can be an orphan (flowR models e.g. `ggplot` as a builtin)
|
|
263
|
+
if ((0, dfg_get_origin_1.getOriginInDfg)(graph, id)?.some(o => o.type === 2 /* OriginType.FunctionCallOrigin */) === true) {
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
// a bare name from a default-attached base package (or a base primitive) is defined without a library() call
|
|
267
|
+
const baseOwner = (0, r_base_packages_1.baseRExportOwner)(name);
|
|
268
|
+
if (baseOwner !== undefined && r_base_packages_1.AttachedBasePackages.includes(baseOwner)) {
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
// a quoted use, or a forward-referenced closure binding flowR did not statically link, is not a real orphan call
|
|
272
|
+
if ((0, undefined_symbol_util_1.isNonStandardEvaluated)(graph, id) || (0, undefined_symbol_util_1.isDefinedInEnclosingScope)(graph, scopeDefined, id, name)) {
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
// flowR's curated map disambiguates a name several packages export (ggplot to ggplot2); failing that, a
|
|
276
|
+
// package the project already declares or loads explains the call and needs no library attached (dplyr
|
|
277
|
+
// re-exports tidyselect's `everything`); failing that the most downloaded exporter wins, as
|
|
278
|
+
// `packagesExporting` hands them over in that order and a script calling a bare name almost always means
|
|
279
|
+
// the popular package. A name half of CRAN exports says nothing, so it is skipped.
|
|
280
|
+
const mapped = builtinLibraryOf?.(name);
|
|
281
|
+
const providers = deps.packagesExporting(name).filter(p => p !== self);
|
|
282
|
+
const known = providers.filter(isKnown);
|
|
283
|
+
const pkg = mapped !== undefined && mapped !== self ? mapped
|
|
284
|
+
: known.length === 1 ? known[0]
|
|
285
|
+
: known.length === 0 && providers.length > 0 && providers.length <= MaxOrphanProviders ? providers[0] : undefined;
|
|
286
|
+
if (pkg === undefined) {
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
recordCallUsage(atKey(usage, pkg, () => new Map()), name, vertex.args);
|
|
290
|
+
// a package the project already declares or loads is a normal target, not an orphan needing attachment
|
|
291
|
+
if (isKnown(pkg)) {
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
atKey(attributed, pkg, () => new Set()).add(name);
|
|
295
|
+
// the exporters that lost, with the same calls recorded, so the guess can report what each of them would fit
|
|
296
|
+
const losers = providers.filter(p => p !== pkg);
|
|
297
|
+
alternatives.set(pkg, [...new Set([...alternatives.get(pkg) ?? [], ...losers])]);
|
|
298
|
+
for (const alt of losers) {
|
|
299
|
+
recordCallUsage(atKey(alternativeUsage, alt, () => new Map()), name, vertex.args);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return { attributed, alternatives, alternativeUsage };
|
|
303
|
+
}
|
|
304
|
+
/** the entry of `key`, inserting what `make` builds when the map has none yet */
|
|
305
|
+
function atKey(map, key, make) {
|
|
306
|
+
let found = map.get(key);
|
|
307
|
+
if (found === undefined) {
|
|
308
|
+
map.set(key, found = make());
|
|
309
|
+
}
|
|
310
|
+
return found;
|
|
311
|
+
}
|
|
221
312
|
/** the dated releases + base-R core releases + latest of a package, ascending by R-version order */
|
|
222
313
|
function versionTimeline(src, pkg) {
|
|
223
314
|
return (0, reader_1.availableVersionEntries)(src, pkg).map(e => ({ ver: e.version, ...(e.date ? { date: e.date } : {}) }));
|
|
@@ -704,10 +795,11 @@ function survivingEntries(space, name, transitive, observe) {
|
|
|
704
795
|
// contradiction is a constraint property, not an empty database
|
|
705
796
|
const unsatisfiable = constraintsContradict(declaredConstraints, declaredRange, effectiveTransitive);
|
|
706
797
|
if (!src) {
|
|
707
|
-
return { survivors: [], preSignature: [], getFn, declaredRange, declaredConstraints, base: false, unsatisfiable, total: 0, declared: 0 };
|
|
798
|
+
return { survivors: [], preSignature: [], getFn, declaredRange, declaredConstraints, base: false, unsatisfiable, total: 0, declared: 0, known: false };
|
|
708
799
|
}
|
|
709
800
|
const base = src.isBaseR(packageKey);
|
|
710
801
|
const total = timeline.length;
|
|
802
|
+
const known = total > 0;
|
|
711
803
|
const declared = declaredRange ? timeline.filter(e => r_version_1.RRange.satisfies(e.ver, declaredRange)).length : total;
|
|
712
804
|
// emit database coverage envelope as outer bounds
|
|
713
805
|
if (observe && timeline.length > 0 && !disabled.has('available')) {
|
|
@@ -716,13 +808,13 @@ function survivingEntries(space, name, transitive, observe) {
|
|
|
716
808
|
}
|
|
717
809
|
const preSignature = applyConstraints(space, name, timeline, { declaredRange, declaredConstraints, transitive: effectiveTransitive, base }, observe);
|
|
718
810
|
if (!usage || disabled.has('signature')) {
|
|
719
|
-
return { survivors: preSignature, preSignature, getFn, declaredRange, declaredConstraints, base, unsatisfiable, total, declared };
|
|
811
|
+
return { survivors: preSignature, preSignature, getFn, declaredRange, declaredConstraints, base, unsatisfiable, total, declared, known };
|
|
720
812
|
}
|
|
721
813
|
if (observe) {
|
|
722
814
|
addSignatureEvidence(observe, src, getFn, packageKey, usage, preSignature);
|
|
723
815
|
}
|
|
724
816
|
const survivors = preSignature.filter(e => signatureOk(e.ver));
|
|
725
|
-
return { survivors, preSignature, getFn, declaredRange, declaredConstraints, base, unsatisfiable, total, declared };
|
|
817
|
+
return { survivors, preSignature, getFn, declaredRange, declaredConstraints, base, unsatisfiable, total, declared, known };
|
|
726
818
|
}
|
|
727
819
|
/** the sigdb package a target's version history is drawn from: `R` reuses `base` (their releases coincide), everything else is itself */
|
|
728
820
|
function timelinePackageKey(name, sources) {
|
|
@@ -18,6 +18,7 @@ import { fileProtocol } from '../r-bridge/retriever';
|
|
|
18
18
|
import type { FlowrFileProvider } from './context/flowr-file';
|
|
19
19
|
import type { Tree } from 'web-tree-sitter';
|
|
20
20
|
import type { CallGraph } from '../dataflow/graph/call-graph';
|
|
21
|
+
import type { InvalidationEvent } from './cache/flowr-cache';
|
|
21
22
|
/**
|
|
22
23
|
* Extends the {@link ReadonlyFlowrAnalysisProvider} with methods that allow modifying the analyzer state.
|
|
23
24
|
*/
|
|
@@ -45,6 +46,10 @@ export interface FlowrAnalysisProvider<Parser extends KnownParser = KnownParser>
|
|
|
45
46
|
* Reset the analyzer state, including the context and the cache.
|
|
46
47
|
*/
|
|
47
48
|
reset(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Receive cache invalidation events from the cache and propagate them to the context and other relevant components.
|
|
51
|
+
*/
|
|
52
|
+
receive(event: InvalidationEvent): void;
|
|
48
53
|
}
|
|
49
54
|
/**
|
|
50
55
|
* Exposes the central analyses and information provided by the {@link FlowrAnalyzer} to the linter, search, and query APIs.
|
|
@@ -175,6 +180,7 @@ export declare class FlowrAnalyzer<Parser extends KnownParser = KnownParser> imp
|
|
|
175
180
|
parserInformation(): KnownParserInformation;
|
|
176
181
|
inspectContext(): ReadOnlyFlowrAnalyzerContext;
|
|
177
182
|
reset(): void;
|
|
183
|
+
receive(event: InvalidationEvent): void;
|
|
178
184
|
updateConfig(update: DeepPartial<FlowrConfig>): void;
|
|
179
185
|
resetConfig(): void;
|
|
180
186
|
parseStandalone(data: `${typeof fileProtocol}${string}` | string | RParseRequest): Tree;
|
|
@@ -55,6 +55,10 @@ class FlowrAnalyzer {
|
|
|
55
55
|
this.ctx.reset();
|
|
56
56
|
this.cache.reset();
|
|
57
57
|
}
|
|
58
|
+
receive(event) {
|
|
59
|
+
this.ctx.receive(event);
|
|
60
|
+
this.cache.receive(event);
|
|
61
|
+
}
|
|
58
62
|
updateConfig(update) {
|
|
59
63
|
this.ctx.updateConfig(update);
|
|
60
64
|
// the parse/dataflow results were computed under the previous config, so they must be recomputed
|
|
@@ -67,11 +71,11 @@ class FlowrAnalyzer {
|
|
|
67
71
|
parseStandalone(data) {
|
|
68
72
|
const request = (0, retriever_1.isParseRequest)(data) ? data : (0, retriever_1.requestFromInput)(data);
|
|
69
73
|
if (this.parser.name === 'tree-sitter') {
|
|
70
|
-
return this.parser.parse(request);
|
|
74
|
+
return this.parser.parse(request, this.ctx);
|
|
71
75
|
}
|
|
72
76
|
else {
|
|
73
77
|
const ts = new tree_sitter_executor_1.TreeSitterExecutor();
|
|
74
|
-
return ts.parse(request);
|
|
78
|
+
return ts.parse(request, this.ctx);
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
81
|
normalizeStandalone(data) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type Parser from 'web-tree-sitter';
|
|
2
|
+
/**
|
|
3
|
+
* Computes a single minimal change region ({@link Parser.Edit}) that contains all modifications.
|
|
4
|
+
* @param oldContent - The original content.
|
|
5
|
+
* @param newContent - The changed content.
|
|
6
|
+
*/
|
|
7
|
+
export declare function computeEditRegion(oldContent: string, newContent: string): Parser.Edit;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeEditRegion = computeEditRegion;
|
|
4
|
+
/**
|
|
5
|
+
* Computes a single minimal change region ({@link Parser.Edit}) that contains all modifications.
|
|
6
|
+
* @param oldContent - The original content.
|
|
7
|
+
* @param newContent - The changed content.
|
|
8
|
+
*/
|
|
9
|
+
function computeEditRegion(oldContent, newContent) {
|
|
10
|
+
const oldLen = oldContent.length;
|
|
11
|
+
const newLen = newContent.length;
|
|
12
|
+
// 1) Longest common prefix
|
|
13
|
+
let startIndex = 0;
|
|
14
|
+
while (startIndex < oldLen &&
|
|
15
|
+
startIndex < newLen &&
|
|
16
|
+
oldContent[startIndex] === newContent[startIndex]) {
|
|
17
|
+
startIndex++;
|
|
18
|
+
}
|
|
19
|
+
// 2) Longest common suffix, without overlapping the prefix
|
|
20
|
+
let oldSuffixIndex = oldLen;
|
|
21
|
+
let newSuffixIndex = newLen;
|
|
22
|
+
while (oldSuffixIndex > startIndex &&
|
|
23
|
+
newSuffixIndex > startIndex &&
|
|
24
|
+
oldContent[oldSuffixIndex - 1] === newContent[newSuffixIndex - 1]) {
|
|
25
|
+
oldSuffixIndex--;
|
|
26
|
+
newSuffixIndex--;
|
|
27
|
+
}
|
|
28
|
+
const oldEndIndex = oldSuffixIndex;
|
|
29
|
+
const newEndIndex = newSuffixIndex;
|
|
30
|
+
const [startPosition, oldEndPosition] = indexesToPoints(oldContent, [startIndex, oldEndIndex]);
|
|
31
|
+
const [newEndPosition] = indexesToPoints(newContent, [newEndIndex]);
|
|
32
|
+
return {
|
|
33
|
+
startIndex,
|
|
34
|
+
oldEndIndex,
|
|
35
|
+
newEndIndex,
|
|
36
|
+
startPosition,
|
|
37
|
+
oldEndPosition,
|
|
38
|
+
newEndPosition,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function indexesToPoints(text, orderedIndexes) {
|
|
42
|
+
let row = 0;
|
|
43
|
+
let column = 0;
|
|
44
|
+
let currentIndex = 0;
|
|
45
|
+
const points = [];
|
|
46
|
+
for (const targetIndex of orderedIndexes) {
|
|
47
|
+
while (currentIndex < targetIndex) {
|
|
48
|
+
if (text[currentIndex] === '\n') {
|
|
49
|
+
row++;
|
|
50
|
+
column = 0;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
column++;
|
|
54
|
+
}
|
|
55
|
+
currentIndex++;
|
|
56
|
+
}
|
|
57
|
+
points.push({ row, column });
|
|
58
|
+
}
|
|
59
|
+
return points;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=edit-computation.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
|
|
2
|
+
import type Parser from 'web-tree-sitter';
|
|
3
|
+
import type { FilePath } from '../../context/flowr-file';
|
|
4
|
+
export interface ReparseInfo {
|
|
5
|
+
readonly previousTree: Parser.Tree;
|
|
6
|
+
readonly editRegion: Parser.Edit | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Computes the information needed to reparse a file incrementally with tree-sitter.
|
|
10
|
+
* Returns `undefined` if incremental reparsing is not possible.
|
|
11
|
+
*/
|
|
12
|
+
export declare function computeReparseInfo(ctx: FlowrAnalyzerContext, filePath: FilePath): ReparseInfo | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeReparseInfo = computeReparseInfo;
|
|
4
|
+
const edit_computation_1 = require("./edit-computation");
|
|
5
|
+
/**
|
|
6
|
+
* Computes the information needed to reparse a file incrementally with tree-sitter.
|
|
7
|
+
* Returns `undefined` if incremental reparsing is not possible.
|
|
8
|
+
*/
|
|
9
|
+
function computeReparseInfo(ctx, filePath) {
|
|
10
|
+
const previousTree = ctx.inc.getOldParseResultOf(filePath);
|
|
11
|
+
if (!previousTree) {
|
|
12
|
+
// this file was not parsed before
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const oldContent = ctx.inc.getOldContentOf(filePath);
|
|
16
|
+
if (oldContent === undefined) {
|
|
17
|
+
// this file has not been invalidated since the last parse, no reparse needed
|
|
18
|
+
return {
|
|
19
|
+
previousTree,
|
|
20
|
+
editRegion: undefined
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const newContent = ctx.files.resolveRequest({ request: 'file', content: filePath }).r.content;
|
|
24
|
+
if (newContent === oldContent) {
|
|
25
|
+
// this file was invalidated, but the content did not change, no reparse needed
|
|
26
|
+
return {
|
|
27
|
+
previousTree,
|
|
28
|
+
editRegion: undefined
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const editRegion = (0, edit_computation_1.computeEditRegion)(oldContent, newContent);
|
|
32
|
+
return {
|
|
33
|
+
previousTree,
|
|
34
|
+
editRegion
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=incremental-parse.js.map
|
|
@@ -4,7 +4,7 @@ import { FlowrFile } from '../../../context/flowr-file';
|
|
|
4
4
|
* This decorates a text file and parses its contents as a Jupyter file.
|
|
5
5
|
* Finnaly, it provides access to the single cells, and all cells fused together as one R file.
|
|
6
6
|
*/
|
|
7
|
-
export declare class FlowrJupyterFile extends FlowrFile
|
|
7
|
+
export declare class FlowrJupyterFile extends FlowrFile {
|
|
8
8
|
private readonly wrapped;
|
|
9
9
|
/**
|
|
10
10
|
* Prefer the static {@link FlowrRMarkdownFile.from} method
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type FlowrFileProvider, type FileRole, type StringableContent, FlowrFile } from '../../../context/flowr-file';
|
|
2
|
+
import type { DeepReadonly } from 'ts-essentials';
|
|
3
|
+
import type { DeclaredPackages } from '../../../context/flowr-analyzer-meta-context';
|
|
4
|
+
import { Package } from '../../package-version-plugins/package';
|
|
5
|
+
export declare const manifestFileLog: import("tslog").Logger<import("tslog").ILogObj>;
|
|
6
|
+
/** A project manifest that is no `DESCRIPTION` (an rv `rproject.toml`, a uvr `uvr.toml`). */
|
|
7
|
+
export declare abstract class FlowrManifestFile<Content extends StringableContent = StringableContent> extends FlowrFile<Content> {
|
|
8
|
+
protected readonly wrapped: FlowrFileProvider;
|
|
9
|
+
constructor(file: FlowrFileProvider);
|
|
10
|
+
/** unlike the `Package` of a `DESCRIPTION` this is no namespace, such a project is no package */
|
|
11
|
+
abstract projectName(): string | undefined;
|
|
12
|
+
/** `undefined` if the manifest only states a requirement like `>=4.0.0` */
|
|
13
|
+
abstract rVersion(): string | undefined;
|
|
14
|
+
/** grouped as a `DESCRIPTION` groups them */
|
|
15
|
+
abstract declares(): DeclaredPackages;
|
|
16
|
+
}
|
|
17
|
+
/** the `[project]` table of an `rproject.toml`, see https://a2-ai.github.io/rv-docs/config/ */
|
|
18
|
+
interface RvProject {
|
|
19
|
+
name?: unknown;
|
|
20
|
+
r_version?: unknown;
|
|
21
|
+
dependencies?: unknown;
|
|
22
|
+
}
|
|
23
|
+
/** The `rproject.toml` of an [rv](https://a2-ai.github.io/rv-docs/) project, lifted by {@link FlowrRProjectFile.from}. */
|
|
24
|
+
export declare class FlowrRProjectFile extends FlowrManifestFile<DeepReadonly<RvProject>> {
|
|
25
|
+
protected loadContent(): RvProject;
|
|
26
|
+
/** rproject lifter, this does not re-create if already an rproject file */
|
|
27
|
+
static from(file: FlowrFileProvider | FlowrRProjectFile, role?: FileRole): FlowrRProjectFile;
|
|
28
|
+
projectName(): string | undefined;
|
|
29
|
+
/** rv pins a concrete `r_version`, e.g. `4.5` */
|
|
30
|
+
rVersion(): string | undefined;
|
|
31
|
+
/** either a plain name or a table carrying it (`{ name = "ggplot2", repository = "new-rspm" }`) */
|
|
32
|
+
dependencies(): Package[];
|
|
33
|
+
/** rv does not group its dependencies, they are all needed to run the project */
|
|
34
|
+
declares(): DeclaredPackages;
|
|
35
|
+
}
|
|
36
|
+
/** the parts of a `uvr.toml` we read, see https://github.com/nbafrank/uvr */
|
|
37
|
+
interface UvrManifest {
|
|
38
|
+
project?: {
|
|
39
|
+
name?: unknown;
|
|
40
|
+
r_version?: unknown;
|
|
41
|
+
};
|
|
42
|
+
dependencies?: unknown;
|
|
43
|
+
'dev-dependencies'?: unknown;
|
|
44
|
+
}
|
|
45
|
+
/** The `uvr.toml` of a [uvr](https://github.com/nbafrank/uvr) project, lifted by {@link FlowrUvrManifestFile.from}. */
|
|
46
|
+
export declare class FlowrUvrManifestFile extends FlowrManifestFile<DeepReadonly<UvrManifest>> {
|
|
47
|
+
protected loadContent(): UvrManifest;
|
|
48
|
+
/** uvr manifest lifter, this does not re-create if already a uvr manifest file */
|
|
49
|
+
static from(file: FlowrFileProvider | FlowrUvrManifestFile, role?: FileRole): FlowrUvrManifestFile;
|
|
50
|
+
projectName(): string | undefined;
|
|
51
|
+
/** uvr usually states a requirement (`>=4.0.0`), which pins nothing; the `uvr.lock` holds the resolved version */
|
|
52
|
+
rVersion(): string | undefined;
|
|
53
|
+
declares(): DeclaredPackages;
|
|
54
|
+
/** a table mapping the name to a bare requirement (`">=3.0.0"`, `"*"`) or to one with its origin (`{ version = ..., git = ... }`) */
|
|
55
|
+
private packagesOf;
|
|
56
|
+
}
|
|
57
|
+
export {};
|