@eagleoutice/flowr 2.13.2 → 2.13.3
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 +46 -44
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +1 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +3 -0
- package/abstract-interpretation/domains/state-domain-like.d.ts +1 -1
- package/config.d.ts +8 -0
- package/config.js +9 -1
- package/control-flow/control-flow-graph.js +2 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +1 -1
- package/dataflow/environments/append.d.ts +1 -1
- package/dataflow/environments/clone.d.ts +1 -1
- package/dataflow/environments/environment.d.ts +28 -4
- package/dataflow/environments/environment.js +66 -11
- package/dataflow/environments/overwrite.d.ts +1 -1
- package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +51 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +15 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +9 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +1 -1
- package/documentation/doc-readme.js +14 -12
- package/documentation/doc-util/doc-normalized-ast.d.ts +1 -1
- package/documentation/wiki-dataflow-graph.js +4 -24
- package/documentation/wiki-query.js +47 -0
- package/documentation/wiki-signature-database.js +3 -2
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/undefined-symbol-util.js +3 -1
- package/linter/rules/undefined-symbol.js +3 -4
- package/package.json +21 -9
- package/project/context/flowr-analyzer-context.d.ts +4 -4
- package/project/context/flowr-analyzer-context.js +3 -3
- package/project/context/flowr-analyzer-dependencies-context.d.ts +11 -5
- package/project/context/flowr-analyzer-dependencies-context.js +8 -3
- package/project/context/flowr-analyzer-meta-context.d.ts +1 -0
- package/project/dependency-version-space.d.ts +118 -26
- package/project/dependency-version-space.js +343 -87
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +8 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +27 -25
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +4 -4
- package/project/plugins/package-version-plugins/package.d.ts +27 -10
- package/project/plugins/package-version-plugins/package.js +50 -25
- package/project/sigdb/reader.d.ts +26 -16
- package/project/sigdb/reader.js +52 -21
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +39 -77
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +12 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +53 -23
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +13 -0
- package/queries/catalog/input-sources-query/input-source-functions.js +96 -1
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +40 -4
- package/queries/catalog/input-sources-query/input-sources-query-format.js +21 -3
- package/queries/catalog/input-sources-query/input-types.d.ts +58 -0
- package/queries/catalog/input-sources-query/input-types.js +64 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +62 -52
- package/queries/catalog/input-sources-query/simple-input-classifier.js +334 -101
- package/queries/catalog/project-query/project-query-executor.js +1 -1
- package/queries/catalog/signature-query/signature-query-executor.d.ts +7 -1
- package/queries/catalog/signature-query/signature-query-executor.js +112 -39
- package/queries/catalog/signature-query/signature-query-format.d.ts +5 -1
- package/queries/catalog/signature-query/signature-query-format.js +1 -1
- package/queries/catalog/signature-query/signature-query-render.js +8 -3
- package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
- package/r-bridge/retriever.d.ts +1 -1
- package/search/flowr-search-printer.js +10 -8
- package/slicing/static/static-slicer.d.ts +2 -2
- package/util/objects.js +6 -4
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +3 -0
- package/util/r-license.js +1 -4
- package/util/r-version.d.ts +12 -0
- package/util/r-version.js +16 -0
- package/util/range.d.ts +6 -2
- package/util/range.js +33 -15
- package/util/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagleoutice/flowr",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.3",
|
|
4
4
|
"description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
"build-dev": "npm run build && npm run build:copy-wasm",
|
|
37
37
|
"build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --tree-shaking=true --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm",
|
|
38
38
|
"build:copy-wasm": "mkdir -p dist/node_modules/@davisvaughan/tree-sitter-r/ && mkdir -p dist/node_modules/web-tree-sitter && cp node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm dist/node_modules/@davisvaughan/tree-sitter-r/ && cp node_modules/web-tree-sitter/tree-sitter.wasm dist/node_modules/web-tree-sitter/",
|
|
39
|
-
"
|
|
40
|
-
"lint": "npm run
|
|
39
|
+
"typecheck": "tsc --noEmit --project .",
|
|
40
|
+
"lint-local": "npm run typecheck && npx eslint --version && npx eslint src/ test/ scripts/ --concurrency=auto --cache --cache-location node_modules/.cache/eslint-local --rule \"no-warning-comments: off\"",
|
|
41
|
+
"lint": "npm run license-compat -- --summary && npm run typecheck && npx eslint --version && npx eslint src/ test/ scripts/ --concurrency=auto --cache --cache-location node_modules/.cache/eslint",
|
|
41
42
|
"license-compat": "license-checker-rseidelsohn --onlyAllow 'MIT;MPL-2.0;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD' --clarificationsFile license-clarifications.json",
|
|
42
43
|
"doc": "typedoc",
|
|
43
44
|
"test": "vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
|
|
@@ -181,10 +182,9 @@
|
|
|
181
182
|
"devDependencies": {
|
|
182
183
|
"@commitlint/cli": "^20.5.0",
|
|
183
184
|
"@commitlint/config-angular": "^20.5.0",
|
|
184
|
-
"@eagleoutice/eslint-config-flowr": "^
|
|
185
|
-
"@eslint/eslintrc": "^3.3.3",
|
|
186
|
-
"@eslint/js": "^9.39.2",
|
|
185
|
+
"@eagleoutice/eslint-config-flowr": "^2.0.1",
|
|
187
186
|
"@j-ulrich/release-it-regex-bumper": "^5.4.0",
|
|
187
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
188
188
|
"@types/command-line-args": "^5.2.3",
|
|
189
189
|
"@types/command-line-usage": "^5.0.4",
|
|
190
190
|
"@types/commonmark": "^0.27.10",
|
|
@@ -198,11 +198,16 @@
|
|
|
198
198
|
"@types/tmp": "^0.2.6",
|
|
199
199
|
"@types/ws": "^8.18.1",
|
|
200
200
|
"@typescript-eslint/eslint-plugin": "^8.40.0",
|
|
201
|
+
"@typescript-eslint/parser": "^8.65.0",
|
|
201
202
|
"@vitest/coverage-v8": "^4.1.8",
|
|
202
203
|
"esbuild": "^0.28.1",
|
|
203
|
-
"eslint": "^
|
|
204
|
-
"
|
|
205
|
-
"
|
|
204
|
+
"eslint": "^10.8.0",
|
|
205
|
+
"eslint-plugin-check-file": "^3.3.2",
|
|
206
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
207
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
208
|
+
"eslint-plugin-tsdoc": "^0.5.2",
|
|
209
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
210
|
+
"license-checker-rseidelsohn": "^5.0.1",
|
|
206
211
|
"release-it": "^20.0.0",
|
|
207
212
|
"ts-node": "^10.9.2",
|
|
208
213
|
"typedoc": "^0.28.17",
|
|
@@ -242,5 +247,12 @@
|
|
|
242
247
|
"web-tree-sitter": "^0.24.7",
|
|
243
248
|
"ws": "^8.18.0",
|
|
244
249
|
"xpath-ts2": "^1.4.2"
|
|
250
|
+
},
|
|
251
|
+
"allowScripts": {
|
|
252
|
+
"@davisvaughan/tree-sitter-r@1.2.0": true,
|
|
253
|
+
"core-js-pure@3.40.0": true,
|
|
254
|
+
"esbuild@0.28.1": true,
|
|
255
|
+
"plantuml-pipe@1.6.0": true,
|
|
256
|
+
"unrs-resolver@1.12.2": true
|
|
245
257
|
}
|
|
246
258
|
}
|
|
@@ -42,8 +42,8 @@ export interface ReadOnlyFlowrAnalyzerContext {
|
|
|
42
42
|
readonly rVersionKnown: boolean;
|
|
43
43
|
/** Classify the {@link ProjectKind} of the project, see {@link ReadOnlyFlowrAnalyzerFilesContext#projectKind}. */
|
|
44
44
|
projectKind(): ProjectKind;
|
|
45
|
-
/** The versions a dependency can possibly have, see {@link ReadOnlyFlowrAnalyzerDependenciesContext#
|
|
46
|
-
|
|
45
|
+
/** The versions a dependency can possibly have, see {@link ReadOnlyFlowrAnalyzerDependenciesContext#inferredRange}. */
|
|
46
|
+
inferredRange(name: string): Range | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* Resource-usage guard (gas).
|
|
49
49
|
* Call `ctx.gas.checkGas(key)` at expensive analysis sites to obtain the current pressure level.
|
|
@@ -127,8 +127,8 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
|
|
|
127
127
|
get rVersionKnown(): boolean;
|
|
128
128
|
/** Classify the {@link ProjectKind} of the project (delegates to the cached {@link FlowrAnalyzerFilesContext#projectKind}). */
|
|
129
129
|
projectKind(): ProjectKind;
|
|
130
|
-
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#
|
|
131
|
-
|
|
130
|
+
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#inferredRange}). */
|
|
131
|
+
inferredRange(name: string): Range | undefined;
|
|
132
132
|
/** delegate request addition */
|
|
133
133
|
addRequests(requests: readonly RAnalysisRequest[]): void;
|
|
134
134
|
addFile(f: string | FlowrFileProvider | RParseRequestFromFile): void;
|
|
@@ -181,9 +181,9 @@ class FlowrAnalyzerContext {
|
|
|
181
181
|
projectKind() {
|
|
182
182
|
return this.files.projectKind();
|
|
183
183
|
}
|
|
184
|
-
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#
|
|
185
|
-
|
|
186
|
-
return this.deps.
|
|
184
|
+
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#inferredRange}). */
|
|
185
|
+
inferredRange(name) {
|
|
186
|
+
return this.deps.inferredRange(name);
|
|
187
187
|
}
|
|
188
188
|
/** delegate request addition */
|
|
189
189
|
addRequests(requests) {
|
|
@@ -31,19 +31,24 @@ export interface ReadOnlyFlowrAnalyzerDependenciesContext {
|
|
|
31
31
|
*/
|
|
32
32
|
getDependency(name: string, version?: string | Range): Readonly<Package> | undefined;
|
|
33
33
|
/**
|
|
34
|
-
* The versions a dependency can possibly have
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* The versions a dependency can possibly have: its {@link Package.derivedRange|derived range}, but only once
|
|
35
|
+
* some version can satisfy it. `undefined` if the dependency is unknown, if nothing constrains it, or if the
|
|
36
|
+
* sources contradict each other, since then no version is possible at all.
|
|
37
37
|
*
|
|
38
38
|
* For *why* it is what it is (the individual constraints, or the version the database resolved to), take the
|
|
39
39
|
* {@link Package} from {@link getDependency}.
|
|
40
40
|
* @param name - The name of the dependency.
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
inferredRange(name: string): Range | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* Get all dependencies known to this context.
|
|
45
45
|
*/
|
|
46
46
|
getDependencies(): readonly Readonly<Package>[];
|
|
47
|
+
/**
|
|
48
|
+
* Every package name the project *declares* (`Depends`/`Imports`/`Suggests`/`LinkingTo`/`Enhances`), whether or
|
|
49
|
+
* not it became a loadable dependency here. `Suggests` do not, yet they still name packages the project may install.
|
|
50
|
+
*/
|
|
51
|
+
declaredPackageNames(): readonly string[];
|
|
47
52
|
/**
|
|
48
53
|
* Metadata of the signature databases the version plugins currently have loaded.
|
|
49
54
|
*/
|
|
@@ -119,6 +124,7 @@ export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnaly
|
|
|
119
124
|
getDependency(name: string, version?: string | Range): Package | undefined;
|
|
120
125
|
/** Resolve `name` constrained to `range` via the plugins (uncached); falls back to the cached dependency. */
|
|
121
126
|
private resolvePinnedDependency;
|
|
122
|
-
|
|
127
|
+
inferredRange(name: string): Range | undefined;
|
|
123
128
|
getDependencies(): Package[];
|
|
129
|
+
declaredPackageNames(): string[];
|
|
124
130
|
}
|
|
@@ -163,7 +163,7 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
163
163
|
}
|
|
164
164
|
/** Resolve `name` constrained to `range` via the plugins (uncached); falls back to the cached dependency. */
|
|
165
165
|
resolvePinnedDependency(name, range) {
|
|
166
|
-
const pin = new package_1.Package({ name,
|
|
166
|
+
const pin = new package_1.Package({ name, versionConstraints: range ? [range] : [] });
|
|
167
167
|
for (const resolve of this.lazyResolvers) {
|
|
168
168
|
const resolved = resolve(name, pin);
|
|
169
169
|
if (resolved) {
|
|
@@ -172,9 +172,9 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
172
172
|
}
|
|
173
173
|
return this.getDependency(name);
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
inferredRange(name) {
|
|
176
176
|
const pkg = this.getDependency(name);
|
|
177
|
-
return pkg?.hasSatisfiableVersion() ? pkg.
|
|
177
|
+
return pkg?.hasSatisfiableVersion() ? pkg.derivedRange : undefined;
|
|
178
178
|
}
|
|
179
179
|
getDependencies() {
|
|
180
180
|
if (!this.staticsLoaded) {
|
|
@@ -182,6 +182,11 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
182
182
|
}
|
|
183
183
|
return Array.from(this.dependencies.values());
|
|
184
184
|
}
|
|
185
|
+
declaredPackageNames() {
|
|
186
|
+
this.ensureStaticsLoaded();
|
|
187
|
+
const declared = Object.values(this.ctx.meta.getDeclaredPackages());
|
|
188
|
+
return [...new Set(declared.flatMap(group => group?.map(p => p.name) ?? []))];
|
|
189
|
+
}
|
|
185
190
|
}
|
|
186
191
|
exports.FlowrAnalyzerDependenciesContext = FlowrAnalyzerDependenciesContext;
|
|
187
192
|
//# sourceMappingURL=flowr-analyzer-dependencies-context.js.map
|
|
@@ -23,6 +23,7 @@ export interface DeclaredPackages {
|
|
|
23
23
|
depends?: readonly Package[];
|
|
24
24
|
suggests?: readonly Package[];
|
|
25
25
|
linkingTo?: readonly Package[];
|
|
26
|
+
enhances?: readonly Package[];
|
|
26
27
|
}
|
|
27
28
|
/** The project metadata a plugin may contribute, see {@link FlowrAnalyzerMetaContext#contribute}. */
|
|
28
29
|
export interface ProjectMetaFields {
|
|
@@ -12,6 +12,8 @@ import type { DecodedFunction } from './sigdb/decode';
|
|
|
12
12
|
import { FunctionArgument, type DataflowGraph } from '../dataflow/graph/graph';
|
|
13
13
|
import type { ReadOnlyFlowrAnalyzerDependenciesContext } from './context/flowr-analyzer-dependencies-context';
|
|
14
14
|
import type { ReadonlyFlowrAnalysisProvider } from './flowr-analyzer';
|
|
15
|
+
/** the pseudo-package standing for the analyzed project itself, never one of its own dependencies */
|
|
16
|
+
export declare const ProjectPackage = "current";
|
|
15
17
|
/** where a single bound on a dependency's version came from */
|
|
16
18
|
export type ConstraintSource = 'declared' | 'transitive' | 'signature' | 'date' | 'base-r' | 'available' | 'indirect';
|
|
17
19
|
/**
|
|
@@ -31,6 +33,12 @@ export interface DerivedConstraint {
|
|
|
31
33
|
readonly parameter?: string;
|
|
32
34
|
/** the version bound this constraint establishes, if any (e.g. `>=1.1.0`, `<=2021-05-31`) */
|
|
33
35
|
readonly bound?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Set when the bound only holds for *some* of the origin's own candidate versions (e.g. only the newer releases
|
|
38
|
+
* of `dplyr` require `R >= 4.1`). Such a constraint is reported but never filters, as picking another version of
|
|
39
|
+
* the origin avoids it.
|
|
40
|
+
*/
|
|
41
|
+
readonly partial?: boolean;
|
|
34
42
|
}
|
|
35
43
|
/** notified of each constraint as it is applied, so a caller can collect provenance (e.g. into the query's evidence) */
|
|
36
44
|
export type ConstraintObserver = (constraint: DerivedConstraint) => void;
|
|
@@ -50,11 +58,19 @@ export interface TimelineEntry {
|
|
|
50
58
|
readonly ver: VersionString;
|
|
51
59
|
readonly date?: Date;
|
|
52
60
|
}
|
|
53
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* The version qualifier a package imposes on one of its own dependencies (a transitive constraint). Because the
|
|
63
|
+
* declaring package's own version is usually a guess too, the requirement is read from *every* version of it that is
|
|
64
|
+
* still in play: {@link ranges} holds one alternative per distinct requirement found, and only a
|
|
65
|
+
* {@link universal} constraint (one that every one of those versions declares) may filter.
|
|
66
|
+
*/
|
|
54
67
|
export interface TransitiveConstraint {
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
/** the alternative requirements; a version satisfying any one of them is acceptable */
|
|
69
|
+
readonly ranges: readonly Range[];
|
|
70
|
+
/** the declaring package + version, e.g. `dplyr 1.1.0`, or just `dplyr` when read from several of its versions */
|
|
57
71
|
readonly from: string;
|
|
72
|
+
/** whether every considered version of the declaring package requires *something*, so the constraint can filter */
|
|
73
|
+
readonly universal: boolean;
|
|
58
74
|
}
|
|
59
75
|
/** the versions of a package before and after the signature-usage filter, plus the declared inputs used to build them */
|
|
60
76
|
export interface SurvivingEntries {
|
|
@@ -64,7 +80,7 @@ export interface SurvivingEntries {
|
|
|
64
80
|
readonly preSignature: TimelineEntry[];
|
|
65
81
|
/** the memoized function resolver used for the signature pass (shared so evidence reuses the decodes) */
|
|
66
82
|
readonly getFn: FnResolver;
|
|
67
|
-
/** the combined, satisfiable declared range (`
|
|
83
|
+
/** the combined, satisfiable declared range (`inferredRange`), or `undefined` if none/contradictory */
|
|
68
84
|
readonly declaredRange: Range | undefined;
|
|
69
85
|
/** the raw declared version constraints */
|
|
70
86
|
readonly declaredConstraints: readonly string[];
|
|
@@ -74,6 +90,8 @@ export interface SurvivingEntries {
|
|
|
74
90
|
readonly unsatisfiable: boolean;
|
|
75
91
|
/** the total number of versions the database carries for the package (the full history the candidates are drawn from) */
|
|
76
92
|
readonly total: number;
|
|
93
|
+
/** how many of those versions the *declared* constraints alone allow, the baseline the guess narrows down from */
|
|
94
|
+
readonly declared: number;
|
|
77
95
|
}
|
|
78
96
|
/** one package's surviving versions, ordered by preference for the constraint-space explosion */
|
|
79
97
|
export interface OrderedCandidates {
|
|
@@ -105,50 +123,124 @@ export declare function dateCutoff(spec: string): Date | undefined;
|
|
|
105
123
|
export declare function isoDay(date: Date): string;
|
|
106
124
|
/** scan the dataflow graph for every call that resolves (via {@link Dataflow.qualify}) to a package export */
|
|
107
125
|
export declare function collectUsage(graph: DataflowGraph, deps?: ReadOnlyFlowrAnalyzerDependenciesContext): Map<string, PackageUsage>;
|
|
108
|
-
/** intersection of multiple survivor sets
|
|
126
|
+
/** intersection of multiple survivor sets: versions that survive in every set */
|
|
109
127
|
export declare function intersectSurvivors(survivorSets: readonly (readonly TimelineEntry[])[]): TimelineEntry[];
|
|
110
128
|
/**
|
|
111
|
-
* The transitive constraints declared packages place on their own dependencies (one level deep). `
|
|
112
|
-
*
|
|
113
|
-
*
|
|
129
|
+
* The transitive constraints declared packages place on their own dependencies (one level deep). `versionsOf` gives
|
|
130
|
+
* the versions of each declaring package that are still in play. The requirements are read from all of them, so a
|
|
131
|
+
* constraint only ever filters when *every* one of them declares it (see {@link TransitiveConstraint}). Without it,
|
|
132
|
+
* the single {@link Package.resolvedVersion|resolved version} is used, which is by definition universal.
|
|
114
133
|
*/
|
|
115
|
-
export declare function collectTransitiveConstraints(deps: ReadOnlyFlowrAnalyzerDependenciesContext, sources: readonly PackageSignatureSource[],
|
|
134
|
+
export declare function collectTransitiveConstraints(deps: ReadOnlyFlowrAnalyzerDependenciesContext, sources: readonly PackageSignatureSource[], versionsOf?: (pkg: string) => readonly VersionString[] | undefined): Map<string, TransitiveConstraint[]>;
|
|
116
135
|
/** the default bound for the fixpoint loops, overridable per query with {@link GuessDepVersionsQuery.maxIterations} */
|
|
117
136
|
export declare const DefaultFixpointIterations = 8;
|
|
118
137
|
/** repeatedly run `step` until it reports no further change (returns `false`) or `maxIterations` is reached */
|
|
119
138
|
export declare function iterateToFixpoint(maxIterations: number, step: () => boolean): void;
|
|
120
|
-
/**
|
|
121
|
-
export interface
|
|
122
|
-
readonly
|
|
123
|
-
|
|
124
|
-
|
|
139
|
+
/** the per-analysis inputs every constraint pass shares, see {@link VersionSpace} */
|
|
140
|
+
export interface VersionSpaceOptions {
|
|
141
|
+
readonly deps: ReadOnlyFlowrAnalyzerDependenciesContext;
|
|
142
|
+
/** how the analyzed code calls each package, from {@link collectUsage} */
|
|
143
|
+
readonly usage: ReadonlyMap<string, PackageUsage>;
|
|
144
|
+
/** only consider releases up to this instant */
|
|
145
|
+
readonly cutoff?: Date;
|
|
146
|
+
/** the assumed R version bounding base packages, when genuinely known */
|
|
147
|
+
readonly rVersion?: string;
|
|
148
|
+
/** constraint sources to skip entirely: neither filtered on nor reported */
|
|
149
|
+
readonly disabled?: ReadonlySet<ConstraintSource>;
|
|
150
|
+
}
|
|
151
|
+
/** a target's sigdb package key, merged source and memoized signature resolver */
|
|
152
|
+
interface PackageResolution {
|
|
125
153
|
readonly key: string;
|
|
126
|
-
|
|
154
|
+
readonly src: PackageSignatureSource | undefined;
|
|
155
|
+
readonly getFn: FnResolver;
|
|
156
|
+
/** the package's release timeline, ascending */
|
|
157
|
+
readonly timeline: readonly TimelineEntry[];
|
|
158
|
+
/** the usage the signature pass judges by (base primitives dropped for a base package), `undefined` if unused */
|
|
159
|
+
readonly usage: PackageUsage | undefined;
|
|
160
|
+
/** whether a version's signatures accept how the code calls it, see {@link makeSignatureFilter} */
|
|
161
|
+
readonly signatureOk: (version: VersionString) => boolean;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The version space of one analysis: the surviving versions of each dependency and the transitive constraints
|
|
165
|
+
* refined to a fixpoint. Holding the shared inputs here keeps the passes to a handful of arguments and lets each
|
|
166
|
+
* package's sigdb key, source and decoded signatures be resolved once. The passes revisit the same versions
|
|
167
|
+
* repeatedly, so that memoization is what makes the fixpoint affordable.
|
|
168
|
+
*/
|
|
169
|
+
export declare class VersionSpace {
|
|
170
|
+
readonly deps: ReadOnlyFlowrAnalyzerDependenciesContext;
|
|
171
|
+
readonly sources: readonly PackageSignatureSource[];
|
|
172
|
+
readonly usage: ReadonlyMap<string, PackageUsage>;
|
|
173
|
+
readonly cutoff: Date | undefined;
|
|
174
|
+
readonly rVersion: string | undefined;
|
|
175
|
+
readonly disabled: ReadonlySet<ConstraintSource>;
|
|
176
|
+
private readonly resolved;
|
|
177
|
+
constructor({ deps, usage, cutoff, rVersion, disabled }: VersionSpaceOptions);
|
|
178
|
+
/** the sigdb package, source and signature resolver of a target, resolved once */
|
|
179
|
+
resolve(name: string): PackageResolution;
|
|
180
|
+
/** the versions of `name` surviving every constraint, see {@link survivingEntries} */
|
|
181
|
+
survivors(name: string, transitive: readonly TransitiveConstraint[], observe?: ConstraintObserver): SurvivingEntries;
|
|
182
|
+
/**
|
|
183
|
+
* The transitive constraints, refined to a fixpoint: each pass re-reads every declaring package's requirements
|
|
184
|
+
* from the versions of it that survived the previous pass, so two packages can tighten each other. Feeding back
|
|
185
|
+
* the whole surviving set (not one representative version) is what keeps a requirement that only *some* of those
|
|
186
|
+
* versions declare from filtering (see {@link TransitiveConstraint}).
|
|
187
|
+
*
|
|
188
|
+
* The first pass runs with *no* transitive constraint at all, so every later pass can only shrink the surviving
|
|
189
|
+
* sets and thus only tighten the constraints: the refinement is monotone and cannot oscillate, and stopping early
|
|
190
|
+
* at `maxIterations` leaves it on the permissive side rather than at an arbitrary point. A declaring package that
|
|
191
|
+
* is not among the `targets` is not being guessed, so its {@link Package.resolvedVersion} stands in.
|
|
192
|
+
*/
|
|
193
|
+
refineTransitive(targets: readonly string[], maxIterations?: number): Map<string, TransitiveConstraint[]>;
|
|
127
194
|
}
|
|
128
|
-
/**
|
|
129
|
-
export
|
|
195
|
+
/** the outcome of {@link enforceArcConsistency}: the pruned version sets, and which partner blocked each package */
|
|
196
|
+
export interface ArcConsistency {
|
|
197
|
+
readonly survivors: Map<string, TimelineEntry[]>;
|
|
198
|
+
/** per package, the partner that rejected a version and the requirement it could not meet */
|
|
199
|
+
readonly blockers: Map<string, Map<string, string>>;
|
|
200
|
+
}
|
|
201
|
+
/** drop, to a fixpoint, the versions of each package that no co-guessed dependency can satisfy */
|
|
202
|
+
export declare function enforceArcConsistency(space: VersionSpace, initial: ReadonlyMap<string, TimelineEntry[]>, maxIterations?: number): ArcConsistency;
|
|
130
203
|
/** a package (or a linked group sharing one version) and its surviving versions, one factor of the combination count */
|
|
131
204
|
export interface CountFactor {
|
|
132
205
|
readonly name: string;
|
|
133
|
-
readonly src: PackageSignatureSource | undefined;
|
|
134
|
-
readonly key: string;
|
|
135
206
|
readonly survivors: readonly string[];
|
|
136
207
|
}
|
|
208
|
+
/** two packages whose version choices are not independent, and whether that holds for all of their versions */
|
|
209
|
+
export interface VersionCoupling {
|
|
210
|
+
readonly a: string;
|
|
211
|
+
readonly b: string;
|
|
212
|
+
/** `false` when only *some* versions of the two require each other, so the coupling does not always apply */
|
|
213
|
+
readonly always: boolean;
|
|
214
|
+
/** whether the coupling was counted; a coupling closing a cycle in the graph is dropped from the count */
|
|
215
|
+
readonly counted: boolean;
|
|
216
|
+
}
|
|
217
|
+
/** the result of {@link countRunnableCombinations} */
|
|
218
|
+
export interface CountedCombinations {
|
|
219
|
+
/** the number of runnable version tuples; an upper bound when {@link couplings} contains uncounted entries */
|
|
220
|
+
readonly total: number;
|
|
221
|
+
/** every coupling found between the counted factors */
|
|
222
|
+
readonly couplings: readonly VersionCoupling[];
|
|
223
|
+
}
|
|
137
224
|
/**
|
|
138
|
-
* The runnable-combination count
|
|
139
|
-
*
|
|
140
|
-
*
|
|
225
|
+
* The runnable-combination count: how many version tuples satisfy the requirements the factors place on each other.
|
|
226
|
+
* A requirement need not hold for every version of the declaring package (`A 0.2.5` may pin `B` to `0.2.1` while
|
|
227
|
+
* `A 0.3.0` pins it to `0.3.2`), so the two are counted as *coupled* rather than as independent factors: a version
|
|
228
|
+
* of `A` only ever multiplies in the versions of `B` it actually admits.
|
|
229
|
+
*
|
|
230
|
+
* Counting all couplings exactly is #CSP-hard, so they are counted over a spanning forest of the coupling graph,
|
|
231
|
+
* preferring the couplings that always apply. That is exact whenever the graph has no cycle, which covers the common
|
|
232
|
+
* shared-hub shape. A coupling that would close a cycle is dropped and reported as uncounted, leaving the result an
|
|
233
|
+
* upper bound. Only the forest's couplings need their compatibility matrix, so the work stays linear in the factors.
|
|
141
234
|
*/
|
|
142
|
-
export declare function countRunnableCombinations(
|
|
143
|
-
/** whether every requirement `pkg@ver` places on a co-guessed dependency is met by one of that partner's surviving versions */
|
|
144
|
-
export declare function versionMeetsPartners(src: PackageSignatureSource, pkg: string, ver: string, partnerSurvivors: ReadonlyMap<string, readonly string[]>, selfName: string, onReject?: (partner: string, constraint: string) => void): boolean;
|
|
235
|
+
export declare function countRunnableCombinations(space: VersionSpace, factors: readonly CountFactor[]): CountedCombinations;
|
|
145
236
|
/** an empty set, shared so callers that do not disable anything need not allocate one */
|
|
146
237
|
export declare const NoDisabledSources: ReadonlySet<ConstraintSource>;
|
|
147
238
|
/**
|
|
148
239
|
* Apply every constraint (declared, transitive, base-R, date, then signature usage) to a package's timeline. When an
|
|
149
240
|
* `observe` callback is given, emits the provenance of each constraint (including the signature lower bounds).
|
|
241
|
+
* Prefer {@link VersionSpace.survivors}, which is the same call with the shared inputs already bound.
|
|
150
242
|
*/
|
|
151
|
-
export declare function survivingEntries(
|
|
243
|
+
export declare function survivingEntries(space: VersionSpace, name: string, transitive: readonly TransitiveConstraint[], observe?: ConstraintObserver): SurvivingEntries;
|
|
152
244
|
/** the sigdb package a target's version history is drawn from: `R` reuses `base` (their releases coincide), everything else is itself */
|
|
153
245
|
export declare function timelinePackageKey(name: string, sources: readonly PackageSignatureSource[]): string;
|
|
154
246
|
/** the ordered candidate list for one package, or `undefined` when nothing survives (shared by the query and the iterator) */
|