@eagleoutice/flowr 2.13.8 → 2.13.10
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/config.d.ts +50 -2
- package/config.js +37 -6
- package/dataflow/cluster.js +48 -24
- package/dataflow/environments/apply-kill.js +4 -4
- package/dataflow/environments/built-in-props.d.ts +28 -4
- package/dataflow/environments/built-in-props.js +31 -8
- package/dataflow/environments/built-in.d.ts +7 -2
- package/dataflow/environments/built-in.js +10 -12
- package/dataflow/environments/default-builtin-config.d.ts +76 -6
- package/dataflow/environments/default-builtin-config.js +39 -16
- package/dataflow/environments/environment.d.ts +16 -0
- package/dataflow/environments/environment.js +70 -18
- package/dataflow/environments/identifier.d.ts +6 -0
- package/dataflow/environments/identifier.js +18 -5
- package/dataflow/environments/query-fn-props.js +34 -2
- package/dataflow/environments/reference-to-maybe.js +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +45 -1
- package/dataflow/eval/resolve/resolve-argument.js +25 -17
- package/dataflow/eval/resolve/resolve-strings.d.ts +17 -0
- package/dataflow/eval/resolve/resolve-strings.js +16 -9
- package/dataflow/eval/resolve/resolve.js +3 -1
- package/dataflow/graph/call-graph.d.ts +7 -0
- package/dataflow/graph/call-graph.js +103 -0
- package/dataflow/graph/df-helper.d.ts +2 -0
- package/dataflow/graph/graph.d.ts +6 -8
- package/dataflow/graph/graph.js +21 -6
- package/dataflow/internal/linker.d.ts +5 -5
- package/dataflow/internal/linker.js +31 -92
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +3 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +4 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +32 -14
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +16 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +29 -8
- package/documentation/doc-util/doc-sigdb.d.ts +9 -0
- package/documentation/doc-util/doc-sigdb.js +32 -0
- package/documentation/wiki-interface.js +13 -2
- package/documentation/wiki-query.js +3 -0
- package/documentation/wiki-signature-database.js +2 -5
- package/gas.d.ts +6 -0
- package/gas.js +7 -1
- package/package.json +2 -2
- package/project/attached-packages.d.ts +13 -0
- package/project/attached-packages.js +30 -0
- package/project/context/flowr-analyzer-context.d.ts +15 -0
- package/project/context/flowr-analyzer-context.js +14 -3
- package/project/context/flowr-analyzer-files-context.d.ts +11 -0
- package/project/context/flowr-analyzer-files-context.js +3 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.js +69 -0
- package/project/dependency-version-space.d.ts +45 -8
- package/project/dependency-version-space.js +86 -26
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +52 -24
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.d.ts +22 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +101 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +30 -11
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +79 -37
- package/project/plugins/package-version-plugins/package.d.ts +2 -0
- package/project/plugins/package-version-plugins/package.js +4 -0
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/project/sigdb/manifest.js +9 -5
- package/project/sigdb/signature-match.d.ts +5 -18
- package/project/sigdb/signature-match.js +5 -18
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +4 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +25 -0
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +4 -0
- package/queries/catalog/call-graph-query/call-graph-query-format.js +4 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +11 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +13 -5
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +27 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +69 -7
- package/queries/catalog/dependencies-query/function-info/library-functions.js +9 -2
- package/queries/catalog/dependencies-query/function-info/read-functions.js +31 -5
- package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +18 -0
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +46 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +33 -31
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +52 -2
- package/queries/catalog/dependencies-query/function-info/write-functions.js +28 -5
- package/queries/catalog/dependencies-query/link-devices.d.ts +12 -0
- package/queries/catalog/dependencies-query/link-devices.js +58 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +2 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +25 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +38 -7
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +18 -5
- package/queries/catalog/happens-before-query/happens-before-query-format.js +3 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.js +4 -0
- package/queries/catalog/input-sources-query/input-types.d.ts +10 -0
- package/queries/catalog/input-sources-query/input-types.js +10 -0
- package/queries/catalog/location-map-query/location-map-query-executor.js +16 -6
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +15 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +22 -5
- package/queries/catalog/signature-query/signature-query-executor.js +3 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +5 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
- package/queries/query.d.ts +1 -1
- package/r-bridge/data/data.d.ts +1 -1
- package/r-bridge/data/data.js +1 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +14 -2
- package/r-bridge/lang-4.x/ast/model/model.js +32 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +7 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +9 -46
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +6 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
- package/search/flowr-search-filters.d.ts +17 -1
- package/search/flowr-search-filters.js +23 -0
- package/slicing/criterion/parse.d.ts +6 -25
- package/slicing/criterion/parse.js +50 -19
- package/slicing/static/fingerprint.d.ts +1 -1
- package/slicing/static/fingerprint.js +52 -8
- package/slicing/static/slicer-types.d.ts +10 -0
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +29 -6
- package/slicing/static/visiting-queue.d.ts +15 -3
- package/slicing/static/visiting-queue.js +37 -3
- package/util/arg-matching.d.ts +18 -0
- package/util/arg-matching.js +70 -0
- package/util/r-regex.js +19 -1
- package/util/range.d.ts +7 -8
- package/util/range.js +10 -11
- package/util/version.js +1 -1
|
@@ -45,6 +45,8 @@ export interface ReadOnlyFlowrAnalyzerContext {
|
|
|
45
45
|
readonly resolvedRVersion: string;
|
|
46
46
|
/** Whether {@link resolvedRVersion} is a genuine signal (a config pin, project metadata, or an engine-detected version) rather than the fallback default. */
|
|
47
47
|
readonly rVersionKnown: boolean;
|
|
48
|
+
/** Where {@link resolvedRVersion} comes from, as only {@link RVersionOrigin.Config} and {@link RVersionOrigin.Metadata} say anything about the analyzed code. */
|
|
49
|
+
readonly rVersionOrigin: RVersionOrigin;
|
|
48
50
|
/** Classify the {@link ProjectKind} of the project, see {@link ReadOnlyFlowrAnalyzerFilesContext#projectKind}. */
|
|
49
51
|
projectKind(): ProjectKind;
|
|
50
52
|
/** The versions a dependency can possibly have, see {@link ReadOnlyFlowrAnalyzerDependenciesContext#inferredRange}. */
|
|
@@ -57,6 +59,17 @@ export interface ReadOnlyFlowrAnalyzerContext {
|
|
|
57
59
|
*/
|
|
58
60
|
readonly gas: ReadOnlyFlowrAnalyzerGasContext;
|
|
59
61
|
}
|
|
62
|
+
/** Where the R version an analysis assumes comes from, see {@link ReadOnlyFlowrAnalyzerContext.rVersionOrigin}. */
|
|
63
|
+
export declare const enum RVersionOrigin {
|
|
64
|
+
/** pinned via `solver.sigdb.assumedRVersion` */
|
|
65
|
+
Config = "config",
|
|
66
|
+
/** stated by the project itself (e.g. a `DESCRIPTION` `Depends: R (>= x)`) */
|
|
67
|
+
Metadata = "metadata",
|
|
68
|
+
/** detected from the R installation running the analysis, which says nothing about the analyzed code */
|
|
69
|
+
Engine = "engine",
|
|
70
|
+
/** nothing said anything, so the fallback default is used */
|
|
71
|
+
Default = "default"
|
|
72
|
+
}
|
|
60
73
|
/**
|
|
61
74
|
* This summarizes the other context layers used by the {@link FlowrAnalyzer}.
|
|
62
75
|
* Have a look at the attributes and layers listed below (e.g., {@link files} and {@link deps})
|
|
@@ -131,6 +144,8 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
|
|
|
131
144
|
get resolvedRVersion(): string;
|
|
132
145
|
/** Whether {@link resolvedRVersion} is a genuine signal (a config pin, project metadata, or engine detection) rather than the fallback default. */
|
|
133
146
|
get rVersionKnown(): boolean;
|
|
147
|
+
/** Where {@link resolvedRVersion} comes from, which decides what it says about the analyzed code. */
|
|
148
|
+
get rVersionOrigin(): RVersionOrigin;
|
|
134
149
|
/** Classify the {@link ProjectKind} of the project (delegates to the cached {@link FlowrAnalyzerFilesContext#projectKind}). */
|
|
135
150
|
projectKind(): ProjectKind;
|
|
136
151
|
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#inferredRange}). */
|
|
@@ -175,10 +175,21 @@ class FlowrAnalyzerContext {
|
|
|
175
175
|
}
|
|
176
176
|
/** Whether {@link resolvedRVersion} is a genuine signal (a config pin, project metadata, or engine detection) rather than the fallback default. */
|
|
177
177
|
get rVersionKnown() {
|
|
178
|
+
return this.rVersionOrigin !== "default" /* RVersionOrigin.Default */;
|
|
179
|
+
}
|
|
180
|
+
/** Where {@link resolvedRVersion} comes from, which decides what it says about the analyzed code. */
|
|
181
|
+
get rVersionOrigin() {
|
|
178
182
|
const setting = this.config.solver.sigdb.assumedRVersion;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
183
|
+
if (setting !== undefined && setting !== 'auto') {
|
|
184
|
+
return "config" /* RVersionOrigin.Config */;
|
|
185
|
+
}
|
|
186
|
+
else if (this.meta.getRVersion() !== undefined) {
|
|
187
|
+
return "metadata" /* RVersionOrigin.Metadata */;
|
|
188
|
+
}
|
|
189
|
+
else if (this._detectedR !== undefined && this._detectedR !== 'none' && this._detectedR !== 'unknown') {
|
|
190
|
+
return "engine" /* RVersionOrigin.Engine */;
|
|
191
|
+
}
|
|
192
|
+
return "default" /* RVersionOrigin.Default */;
|
|
182
193
|
}
|
|
183
194
|
/** Classify the {@link ProjectKind} of the project (delegates to the cached {@link FlowrAnalyzerFilesContext#projectKind}). */
|
|
184
195
|
projectKind() {
|
|
@@ -122,6 +122,16 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
|
|
|
122
122
|
* folder for a single-file request. Useful to report back which inputs did not resolve to anything.
|
|
123
123
|
*/
|
|
124
124
|
getRequestedRoots(): readonly string[];
|
|
125
|
+
/**
|
|
126
|
+
* The total number of files known to this context (every file added via {@link addFile}, both disk-backed and inline).
|
|
127
|
+
*
|
|
128
|
+
* This is unrelated to {@link getFilesByRole}: A file counted here may have no role, one role, or several
|
|
129
|
+
* (summing `getFilesByRole(role).length` over all roles can both over-count (multi-role files) and under-count (roleless files) relative to this method).
|
|
130
|
+
*
|
|
131
|
+
* Files that were merely considered during dataflow analysis (see {@link consideredFilesList}) but never actually added to the context are not included.
|
|
132
|
+
* @returns The number of files currently held by this context.
|
|
133
|
+
*/
|
|
134
|
+
getFileCount(): number;
|
|
125
135
|
}
|
|
126
136
|
/**
|
|
127
137
|
* This is the analyzer file context to be modified by all plugins that affect the files.
|
|
@@ -210,4 +220,5 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
|
|
|
210
220
|
getFilesByRole<Role extends FileRole>(role: Role): RoleBasedFiles[Role];
|
|
211
221
|
getAllFiles(): FlowrFileProvider[];
|
|
212
222
|
getFileByPath(path: string): FlowrFileProvider | undefined;
|
|
223
|
+
getFileCount(): number;
|
|
213
224
|
}
|
|
@@ -379,6 +379,9 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
379
379
|
getFileByPath(path) {
|
|
380
380
|
return this.files.get(path) ?? this.inlineFiles.find(f => f.path() === path);
|
|
381
381
|
}
|
|
382
|
+
getFileCount() {
|
|
383
|
+
return this.files.size + this.inlineFiles.length;
|
|
384
|
+
}
|
|
382
385
|
}
|
|
383
386
|
exports.FlowrAnalyzerFilesContext = FlowrAnalyzerFilesContext;
|
|
384
387
|
//# sourceMappingURL=flowr-analyzer-files-context.js.map
|
|
@@ -22,12 +22,16 @@ export declare class FlowrAnalyzerIncrementalAnalysisContext implements ReadOnly
|
|
|
22
22
|
*/
|
|
23
23
|
private changedFilesWithOldContent;
|
|
24
24
|
private oldParseResults;
|
|
25
|
+
private readonly lastKnownMtime;
|
|
25
26
|
constructor(context: FlowrAnalyzerContext);
|
|
26
27
|
reset(): void;
|
|
27
28
|
handleFileInvalidate(filePath: FilePath, oldContent: string | undefined): void;
|
|
29
|
+
handleShouldReparse(filePath: FilePath, ctx: FlowrAnalyzerContext): boolean;
|
|
28
30
|
receive(event: InvalidationEvent): void;
|
|
29
31
|
storeOldParseResults(parseStepOutput: ParseStepOutput<Parser.Tree>): void;
|
|
30
32
|
getOldParseResultOf(filePath: FilePath): Parser.Tree | undefined;
|
|
31
33
|
getOldContentOf(filePath: FilePath): string | undefined;
|
|
32
34
|
deleteOldContentOf(filePath: FilePath): void;
|
|
35
|
+
getLastKnownMtime(filePath: FilePath): number | undefined;
|
|
36
|
+
setLastKnownMtime(filePath: FilePath, mtimeMs: number): void;
|
|
33
37
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.FlowrAnalyzerIncrementalAnalysisContext = void 0;
|
|
4
7
|
const assert_1 = require("../../util/assert");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
5
9
|
/**
|
|
6
10
|
* Information to carry over for future incremental builds
|
|
7
11
|
*/
|
|
@@ -13,6 +17,7 @@ class FlowrAnalyzerIncrementalAnalysisContext {
|
|
|
13
17
|
*/
|
|
14
18
|
changedFilesWithOldContent = new Map();
|
|
15
19
|
oldParseResults = new Map();
|
|
20
|
+
lastKnownMtime = new Map();
|
|
16
21
|
constructor(context) {
|
|
17
22
|
this.context = context;
|
|
18
23
|
}
|
|
@@ -27,6 +32,64 @@ class FlowrAnalyzerIncrementalAnalysisContext {
|
|
|
27
32
|
}
|
|
28
33
|
this.changedFilesWithOldContent.set(filePath, oldContent);
|
|
29
34
|
}
|
|
35
|
+
handleShouldReparse(filePath, ctx) {
|
|
36
|
+
if (ctx.config.incremental.alwaysIncremental) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (!ctx.config.incremental.parsing.activated) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const heuristics = ctx.config.incremental.parsing.heuristics;
|
|
43
|
+
if (!heuristics.activated || heuristics.alwaysWithEdits) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
const checks = [];
|
|
47
|
+
if (heuristics.mtime) {
|
|
48
|
+
checks.push((filePath, ctx) => {
|
|
49
|
+
let currentMtime;
|
|
50
|
+
try {
|
|
51
|
+
currentMtime = fs_1.default.statSync(filePath).mtimeMs;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
const lastMtime = ctx.inc.getLastKnownMtime(filePath);
|
|
57
|
+
const mtimeChanged = !(lastMtime !== undefined && lastMtime === currentMtime);
|
|
58
|
+
if (mtimeChanged) {
|
|
59
|
+
ctx.inc.setLastKnownMtime(filePath, currentMtime);
|
|
60
|
+
}
|
|
61
|
+
return mtimeChanged;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (heuristics.linesFrom !== undefined) {
|
|
65
|
+
checks.push((filePath, ctx) => {
|
|
66
|
+
const content = ctx.files.getFileByPath(filePath)?.content();
|
|
67
|
+
if (typeof content !== 'string') {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const lineCount = content.split('\n').length;
|
|
71
|
+
return lineCount >= heuristics.linesFrom;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (heuristics.bytesFrom) {
|
|
75
|
+
checks.push((filePath) => {
|
|
76
|
+
try {
|
|
77
|
+
return fs_1.default.statSync(filePath).size >= heuristics.bytesFrom;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (heuristics.minFiles !== undefined) {
|
|
85
|
+
checks.push((_filePath, ctx) => {
|
|
86
|
+
return ctx.files.getFileCount() >= heuristics.minFiles;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return checks.length === 0
|
|
90
|
+
? true
|
|
91
|
+
: checks.every(check => check(filePath, ctx));
|
|
92
|
+
}
|
|
30
93
|
receive(event) {
|
|
31
94
|
const type = event.type;
|
|
32
95
|
switch (type) {
|
|
@@ -58,6 +121,12 @@ class FlowrAnalyzerIncrementalAnalysisContext {
|
|
|
58
121
|
deleteOldContentOf(filePath) {
|
|
59
122
|
this.changedFilesWithOldContent.delete(filePath);
|
|
60
123
|
}
|
|
124
|
+
getLastKnownMtime(filePath) {
|
|
125
|
+
return this.lastKnownMtime.get(filePath);
|
|
126
|
+
}
|
|
127
|
+
setLastKnownMtime(filePath, mtimeMs) {
|
|
128
|
+
this.lastKnownMtime.set(filePath, mtimeMs);
|
|
129
|
+
}
|
|
61
130
|
}
|
|
62
131
|
exports.FlowrAnalyzerIncrementalAnalysisContext = FlowrAnalyzerIncrementalAnalysisContext;
|
|
63
132
|
//# sourceMappingURL=flowr-analyzer-incremental-analysis-context.js.map
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
import { type Range } from 'semver';
|
|
9
9
|
import { type VersionString } from '../util/r-version';
|
|
10
10
|
import { type PackageSignatureSource } from './sigdb/reader';
|
|
11
|
-
import type { DecodedFunction } from './sigdb/decode';
|
|
11
|
+
import type { DecodedFunction, ResolvedDependency } 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
|
+
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
15
16
|
/** the pseudo-package standing for the analyzed project itself, never one of its own dependencies */
|
|
16
17
|
export declare const ProjectPackage = "current";
|
|
17
18
|
/** where a single bound on a dependency's version came from */
|
|
@@ -31,6 +32,8 @@ export interface DerivedConstraint {
|
|
|
31
32
|
readonly function?: string;
|
|
32
33
|
/** the argument/parameter that carried the evidence (for signature constraints) */
|
|
33
34
|
readonly parameter?: string;
|
|
35
|
+
/** the call site that carried the evidence, so a bound can point at the line forcing it */
|
|
36
|
+
readonly at?: NodeId;
|
|
34
37
|
/** the version bound this constraint establishes, if any (e.g. `>=1.1.0`, `<=2021-05-31`) */
|
|
35
38
|
readonly bound?: string;
|
|
36
39
|
/**
|
|
@@ -46,10 +49,12 @@ export type ConstraintObserver = (constraint: DerivedConstraint) => void;
|
|
|
46
49
|
export type FnResolver = (fn: string, version: VersionString) => DecodedFunction | undefined;
|
|
47
50
|
/** how a single function of a package is used in the code */
|
|
48
51
|
interface FunctionUsage {
|
|
49
|
-
/**
|
|
50
|
-
readonly named:
|
|
52
|
+
/** per named argument used anywhere, the first call supplying it (drives the lower-bound evidence) */
|
|
53
|
+
readonly named: Map<string, NodeId>;
|
|
51
54
|
/** one representative argument list per distinct call *shape* (drives signature compatibility) */
|
|
52
55
|
readonly calls: Map<string, readonly FunctionArgument[]>;
|
|
56
|
+
/** the first call of the function, absent when only a class use implies it */
|
|
57
|
+
at?: NodeId;
|
|
53
58
|
}
|
|
54
59
|
/** per-package function usage, keyed by the function's (unqualified) name */
|
|
55
60
|
export type PackageUsage = Map<string, FunctionUsage>;
|
|
@@ -116,8 +121,13 @@ export interface VersionExplodeOptions {
|
|
|
116
121
|
/** a concrete, sigdb-available version choice for every resolvable dependency */
|
|
117
122
|
export interface VersionAssignment {
|
|
118
123
|
readonly versions: ReadonlyMap<string, VersionString>;
|
|
124
|
+
/**
|
|
125
|
+
* The requirements of the chosen versions that nothing here could settle, because they bear on a package the
|
|
126
|
+
* assignment does not choose (`dplyr 1.1.0 requires rlang >= 1.0.0`). Such an assignment holds for what it
|
|
127
|
+
* states and may still fail at `library()` time, so it is proposed but not verified.
|
|
128
|
+
*/
|
|
129
|
+
readonly unverified?: readonly string[];
|
|
119
130
|
}
|
|
120
|
-
/** default safety cap on how many assignments {@link explodeDependencyVersions} yields */
|
|
121
131
|
export declare const DefaultExplodeLimit = 256;
|
|
122
132
|
/** the date cutoff (end of the named day/month/year) for a `YYYY.MM.DD` spec, or `undefined` if malformed */
|
|
123
133
|
export declare function dateCutoff(spec: string): Date | undefined;
|
|
@@ -125,12 +135,21 @@ export declare function dateCutoff(spec: string): Date | undefined;
|
|
|
125
135
|
export declare function isoDay(date: Date): string;
|
|
126
136
|
/** scan the dataflow graph for every call that resolves (via {@link Dataflow.qualify}) to a package export */
|
|
127
137
|
export declare function collectUsage(graph: DataflowGraph, deps?: ReadOnlyFlowrAnalyzerDependenciesContext): Map<string, PackageUsage>;
|
|
138
|
+
/** why one orphan call was attributed to its package, given that several may export the name */
|
|
139
|
+
export type OrphanReason = 'builtin' | 'sole exporter' | 'most downloaded';
|
|
140
|
+
/** one orphan call: the undefined name, where it is called, and why it was pinned on the package */
|
|
141
|
+
export interface OrphanCall {
|
|
142
|
+
readonly at: NodeId;
|
|
143
|
+
readonly reason: OrphanReason;
|
|
144
|
+
/** how many packages export the name, the field the {@link OrphanReason} picked from */
|
|
145
|
+
readonly exporters: number;
|
|
146
|
+
}
|
|
128
147
|
/**
|
|
129
148
|
* What the orphan calls of one analyzed program implicated, as {@link collectOrphanUsage} reports it.
|
|
130
149
|
*/
|
|
131
150
|
export interface OrphanUsage {
|
|
132
|
-
/** per package the project does not already know: the orphan
|
|
133
|
-
readonly attributed: Map<string,
|
|
151
|
+
/** per package the project does not already know: the orphan calls that pointed at it, by function name */
|
|
152
|
+
readonly attributed: Map<string, Map<string, OrphanCall>>;
|
|
134
153
|
/** per such package: the other exporters of those names that lost the pick, most downloaded first */
|
|
135
154
|
readonly alternatives: Map<string, string[]>;
|
|
136
155
|
/** the same calls recorded against every alternative, so a caller can ask which of its versions would fit */
|
|
@@ -284,8 +303,26 @@ export declare function timelinePackageKey(name: string, sources: readonly Packa
|
|
|
284
303
|
export declare function orderedCandidatesOf(src: PackageSignatureSource | undefined, name: string, surviving: SurvivingEntries, prefer: string | undefined, order: 'newest' | 'oldest'): OrderedCandidates | undefined;
|
|
285
304
|
/** the default explosion targets: every declared and used dependency (excluding `current`, the analyzed package's own namespace) */
|
|
286
305
|
export declare function defaultTargets(deps: ReadOnlyFlowrAnalyzerDependenciesContext, usage: ReadonlyMap<string, PackageUsage>): string[];
|
|
287
|
-
/**
|
|
288
|
-
export
|
|
306
|
+
/** the requirements one concrete version declares, as {@link coInstallability} reads them */
|
|
307
|
+
export type DependencyResolver = (pkg: string, version: VersionString) => readonly ResolvedDependency[] | undefined;
|
|
308
|
+
/**
|
|
309
|
+
* Whether the chosen versions can be loaded together, checking every requirement the chosen versions declare
|
|
310
|
+
* against the version chosen for the required package (R itself against the chosen base-R version). A requirement
|
|
311
|
+
* on a package the assignment does not choose cannot be settled here and is reported as
|
|
312
|
+
* {@link VersionAssignment.unverified} instead of silently passing, as `library()` still enforces it.
|
|
313
|
+
*/
|
|
314
|
+
export declare function coInstallability(versions: ReadonlyMap<string, VersionString>, declares: DependencyResolver): {
|
|
315
|
+
ok: boolean;
|
|
316
|
+
unverified?: readonly string[];
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* Lazily yield concrete version assignments (one version per package) in odometer order over the per-package lists.
|
|
320
|
+
* With `declares`, a combination whose versions cannot be loaded together is skipped rather than proposed; `limit`
|
|
321
|
+
* bounds the combinations *considered* either way, so fewer than `limit` assignments may come out.
|
|
322
|
+
*/
|
|
323
|
+
export declare function assignmentsOf(perPackage: readonly OrderedCandidates[], limit: number, declares?: DependencyResolver): Generator<VersionAssignment>;
|
|
324
|
+
/** the {@link DependencyResolver} backed by the signature database a version space resolves each package in */
|
|
325
|
+
export declare function declaredDependenciesOf(space: VersionSpace): DependencyResolver;
|
|
289
326
|
/**
|
|
290
327
|
* Explode the guessed constraint space into concrete, signature-database-available version assignments: a lazy
|
|
291
328
|
* iterator over one chosen version per resolvable dependency. Each package's versions are ordered by preference
|
|
@@ -14,7 +14,9 @@ exports.survivingEntries = survivingEntries;
|
|
|
14
14
|
exports.timelinePackageKey = timelinePackageKey;
|
|
15
15
|
exports.orderedCandidatesOf = orderedCandidatesOf;
|
|
16
16
|
exports.defaultTargets = defaultTargets;
|
|
17
|
+
exports.coInstallability = coInstallability;
|
|
17
18
|
exports.assignmentsOf = assignmentsOf;
|
|
19
|
+
exports.declaredDependenciesOf = declaredDependenciesOf;
|
|
18
20
|
exports.explodeDependencyVersions = explodeDependencyVersions;
|
|
19
21
|
/**
|
|
20
22
|
* The dependency version space: for each dependency, the set of signature-database versions that survive the
|
|
@@ -42,6 +44,12 @@ const built_in_s_seven_new_generic_1 = require("../dataflow/internal/process/fun
|
|
|
42
44
|
/** the pseudo-package standing for the analyzed project itself, never one of its own dependencies */
|
|
43
45
|
exports.ProjectPackage = 'current';
|
|
44
46
|
/** default safety cap on how many assignments {@link explodeDependencyVersions} yields */
|
|
47
|
+
/** the dependency kinds a load has to satisfy, as `Suggests`/`Enhances` are not enforced when a package is attached */
|
|
48
|
+
const LoadRelevantDeps = new Set([0 /* DepType.Depends */, 1 /* DepType.Imports */, 2 /* DepType.LinkingTo */]);
|
|
49
|
+
/** The requirements `pkg@version` places on other packages that a load has to satisfy (see {@link LoadRelevantDeps}). */
|
|
50
|
+
function loadRequirements(src, pkg, version) {
|
|
51
|
+
return (src?.dependencies(pkg, version) ?? []).filter(d => LoadRelevantDeps.has(d.type));
|
|
52
|
+
}
|
|
45
53
|
exports.DefaultExplodeLimit = 256;
|
|
46
54
|
/** the date cutoff (end of the named day/month/year) for a `YYYY.MM.DD` spec, or `undefined` if malformed */
|
|
47
55
|
function dateCutoff(spec) {
|
|
@@ -155,7 +163,7 @@ function addClassOwnershipUsage(usage, deps, graph) {
|
|
|
155
163
|
}
|
|
156
164
|
// narrow by the same-named constructor's presence only when it actually resolves (else just mark used)
|
|
157
165
|
if (!pkgUsage.has(cls) && src.functionByName(owner, cls) !== undefined) {
|
|
158
|
-
pkgUsage.set(cls, { named: new
|
|
166
|
+
pkgUsage.set(cls, { named: new Map(), calls: new Map([['#0', []]]) });
|
|
159
167
|
}
|
|
160
168
|
return;
|
|
161
169
|
}
|
|
@@ -175,19 +183,22 @@ function addClassOwnershipUsage(usage, deps, graph) {
|
|
|
175
183
|
function isSyntheticArgument(arg) {
|
|
176
184
|
return !graph_1.FunctionArgument.isEmpty(arg) && String(arg.nodeId).endsWith(built_in_s_seven_new_generic_1.S7SyntheticFunArgSuffix);
|
|
177
185
|
}
|
|
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) {
|
|
186
|
+
/** record one call of `fn` (made at `at`) into `pkgUsage`: union its named argument names and keep one representative per call shape */
|
|
187
|
+
function recordCallUsage(pkgUsage, fn, rawArgs, at) {
|
|
180
188
|
let entry = pkgUsage.get(fn);
|
|
181
189
|
if (entry === undefined) {
|
|
182
|
-
entry = { named: new
|
|
190
|
+
entry = { named: new Map(), calls: new Map() };
|
|
183
191
|
pkgUsage.set(fn, entry);
|
|
184
192
|
}
|
|
193
|
+
entry.at ??= at;
|
|
185
194
|
const args = rawArgs.some(isSyntheticArgument) ? rawArgs.filter(a => !isSyntheticArgument(a)) : rawArgs;
|
|
186
195
|
const named = [];
|
|
187
196
|
let positional = 0;
|
|
188
197
|
for (const arg of args) {
|
|
189
198
|
if (graph_1.FunctionArgument.isNamed(arg)) {
|
|
190
|
-
entry.named.
|
|
199
|
+
if (!entry.named.has(arg.name)) {
|
|
200
|
+
entry.named.set(arg.name, at);
|
|
201
|
+
}
|
|
191
202
|
named.push(arg.name);
|
|
192
203
|
}
|
|
193
204
|
else if (graph_1.FunctionArgument.isPositional(arg)) {
|
|
@@ -218,7 +229,7 @@ function collectUsage(graph, deps) {
|
|
|
218
229
|
pkgUsage = new Map();
|
|
219
230
|
usage.set(pkg, pkgUsage);
|
|
220
231
|
}
|
|
221
|
-
recordCallUsage(pkgUsage, identifier_1.Identifier.getName(qualified), vertex.args);
|
|
232
|
+
recordCallUsage(pkgUsage, identifier_1.Identifier.getName(qualified), vertex.args, id);
|
|
222
233
|
}
|
|
223
234
|
if (deps) {
|
|
224
235
|
addClassOwnershipUsage(usage, deps, graph);
|
|
@@ -280,23 +291,28 @@ function collectOrphanUsage(graph, deps, usage, isKnown, options = {}) {
|
|
|
280
291
|
const mapped = builtinLibraryOf?.(name);
|
|
281
292
|
const providers = deps.packagesExporting(name).filter(p => p !== self);
|
|
282
293
|
const known = providers.filter(isKnown);
|
|
283
|
-
const
|
|
294
|
+
const builtin = mapped !== undefined && mapped !== self;
|
|
295
|
+
const pkg = builtin ? mapped
|
|
284
296
|
: known.length === 1 ? known[0]
|
|
285
297
|
: known.length === 0 && providers.length > 0 && providers.length <= MaxOrphanProviders ? providers[0] : undefined;
|
|
286
298
|
if (pkg === undefined) {
|
|
287
299
|
continue;
|
|
288
300
|
}
|
|
289
|
-
recordCallUsage(atKey(usage, pkg, () => new Map()), name, vertex.args);
|
|
301
|
+
recordCallUsage(atKey(usage, pkg, () => new Map()), name, vertex.args, id);
|
|
290
302
|
// a package the project already declares or loads is a normal target, not an orphan needing attachment
|
|
291
303
|
if (isKnown(pkg)) {
|
|
292
304
|
continue;
|
|
293
305
|
}
|
|
294
|
-
|
|
306
|
+
const reason = builtin ? 'builtin' : providers.length === 1 ? 'sole exporter' : 'most downloaded';
|
|
307
|
+
const calls = atKey(attributed, pkg, () => new Map());
|
|
308
|
+
if (!calls.has(name)) {
|
|
309
|
+
calls.set(name, { at: id, reason, exporters: providers.length });
|
|
310
|
+
}
|
|
295
311
|
// the exporters that lost, with the same calls recorded, so the guess can report what each of them would fit
|
|
296
312
|
const losers = providers.filter(p => p !== pkg);
|
|
297
313
|
alternatives.set(pkg, [...new Set([...alternatives.get(pkg) ?? [], ...losers])]);
|
|
298
314
|
for (const alt of losers) {
|
|
299
|
-
recordCallUsage(atKey(alternativeUsage, alt, () => new Map()), name, vertex.args);
|
|
315
|
+
recordCallUsage(atKey(alternativeUsage, alt, () => new Map()), name, vertex.args, id);
|
|
300
316
|
}
|
|
301
317
|
}
|
|
302
318
|
return { attributed, alternatives, alternativeUsage };
|
|
@@ -375,10 +391,10 @@ function latestSupporting(src, pkg, timeline, predicate) {
|
|
|
375
391
|
return undefined;
|
|
376
392
|
}
|
|
377
393
|
/** emit one signature bound: `>=v` only when `v` is after the floor, `<=v` only when before the ceiling */
|
|
378
|
-
function emitSignatureBound(observe, fn, v, op, ref, verb,
|
|
394
|
+
function emitSignatureBound(observe, fn, v, op, ref, verb, from) {
|
|
379
395
|
if (v !== undefined && (op === '>=' ? r_version_1.RVersion.compare(v, ref) > 0 : r_version_1.RVersion.compare(v, ref) < 0)) {
|
|
380
396
|
const qualified = identifier_1.Identifier.toString(fn);
|
|
381
|
-
observe({ source: 'signature', origin: qualified, detail: `${qualified} ${verb} ${v}`, bound: `${op}${v}`, function: qualified,
|
|
397
|
+
observe({ source: 'signature', origin: qualified, detail: `${qualified} ${verb} ${v}`, bound: `${op}${v}`, function: qualified, ...from });
|
|
382
398
|
}
|
|
383
399
|
}
|
|
384
400
|
/** emit signature bounds from a package's version history: when functions/parameters appear or vanish */
|
|
@@ -391,12 +407,12 @@ function addSignatureEvidence(observe, src, getFn, pkg, usage, timeline) {
|
|
|
391
407
|
for (const [fn, use] of usage) {
|
|
392
408
|
const qualified = identifier_1.Identifier.make(fn, pkg);
|
|
393
409
|
const present = (v) => getFn(fn, v) !== undefined;
|
|
394
|
-
emitSignatureBound(observe, qualified, earliestSupporting(src, pkg, timeline, present), '>=', floor, 'exists only from');
|
|
395
|
-
emitSignatureBound(observe, qualified, latestSupporting(src, pkg, timeline, present), '<=', ceiling, 'removed after');
|
|
396
|
-
for (const arg of use.named) {
|
|
410
|
+
emitSignatureBound(observe, qualified, earliestSupporting(src, pkg, timeline, present), '>=', floor, 'exists only from', { at: use.at });
|
|
411
|
+
emitSignatureBound(observe, qualified, latestSupporting(src, pkg, timeline, present), '<=', ceiling, 'removed after', { at: use.at });
|
|
412
|
+
for (const [arg, at] of use.named) {
|
|
397
413
|
const supported = (v) => argumentSupported(getFn(fn, v), arg);
|
|
398
|
-
emitSignatureBound(observe, qualified, earliestSupporting(src, pkg, timeline, supported), '>=', floor, `has parameter '${arg}' only from`, arg);
|
|
399
|
-
emitSignatureBound(observe, qualified, latestSupporting(src, pkg, timeline, supported), '<=', ceiling, `dropped parameter '${arg}' after`, arg);
|
|
414
|
+
emitSignatureBound(observe, qualified, earliestSupporting(src, pkg, timeline, supported), '>=', floor, `has parameter '${arg}' only from`, { at, parameter: arg });
|
|
415
|
+
emitSignatureBound(observe, qualified, latestSupporting(src, pkg, timeline, supported), '<=', ceiling, `dropped parameter '${arg}' after`, { at, parameter: arg });
|
|
400
416
|
}
|
|
401
417
|
}
|
|
402
418
|
}
|
|
@@ -460,7 +476,7 @@ function collectTransitiveConstraints(deps, sources, versionsOf) {
|
|
|
460
476
|
const perDep = new Map();
|
|
461
477
|
for (const version of versions) {
|
|
462
478
|
const seen = new Set();
|
|
463
|
-
for (const dep of src
|
|
479
|
+
for (const dep of loadRequirements(src, pkg.name, version)) {
|
|
464
480
|
const range = dep.constraint ? r_version_1.RRange.parse(dep.constraint) : undefined;
|
|
465
481
|
if (!range || seen.has(dep.name)) {
|
|
466
482
|
continue;
|
|
@@ -619,7 +635,7 @@ function factorRequirements(space, f) {
|
|
|
619
635
|
const { src, key } = space.resolve(f.name);
|
|
620
636
|
return f.survivors.map(v => {
|
|
621
637
|
const out = new Map();
|
|
622
|
-
for (const dep of src
|
|
638
|
+
for (const dep of loadRequirements(src, key, v)) {
|
|
623
639
|
const range = dep.constraint ? r_version_1.RRange.parse(dep.constraint) : undefined;
|
|
624
640
|
if (range && !out.has(dep.name)) {
|
|
625
641
|
out.set(dep.name, range);
|
|
@@ -719,7 +735,7 @@ function countOverForest(factors, tree) {
|
|
|
719
735
|
}
|
|
720
736
|
/** whether every requirement `pkg@ver` places on a co-guessed dependency is met by one of that partner's surviving versions */
|
|
721
737
|
function versionMeetsPartners(src, pkg, ver, partnerSurvivors, selfName, onReject) {
|
|
722
|
-
for (const dep of src
|
|
738
|
+
for (const dep of loadRequirements(src, pkg, ver)) {
|
|
723
739
|
if (dep.name === selfName || !dep.constraint) {
|
|
724
740
|
continue;
|
|
725
741
|
}
|
|
@@ -854,8 +870,41 @@ function orderedCandidatesOf(src, name, surviving, prefer, order) {
|
|
|
854
870
|
function defaultTargets(deps, usage) {
|
|
855
871
|
return [...new Set([...deps.getDependencies().map(d => d.name), ...usage.keys()])].filter(name => name !== exports.ProjectPackage);
|
|
856
872
|
}
|
|
857
|
-
/**
|
|
858
|
-
|
|
873
|
+
/**
|
|
874
|
+
* Whether the chosen versions can be loaded together, checking every requirement the chosen versions declare
|
|
875
|
+
* against the version chosen for the required package (R itself against the chosen base-R version). A requirement
|
|
876
|
+
* on a package the assignment does not choose cannot be settled here and is reported as
|
|
877
|
+
* {@link VersionAssignment.unverified} instead of silently passing, as `library()` still enforces it.
|
|
878
|
+
*/
|
|
879
|
+
function coInstallability(versions, declares) {
|
|
880
|
+
const unverified = [];
|
|
881
|
+
for (const [pkg, version] of versions) {
|
|
882
|
+
for (const dep of declares(pkg, version) ?? []) {
|
|
883
|
+
if (dep.constraint === undefined || !LoadRelevantDeps.has(dep.type)) {
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
/* R's own version is the version of the base packages, which is what the assignment names it by */
|
|
887
|
+
const chosen = versions.get(dep.name) ?? (dep.name === 'R' ? versions.get('base') : undefined);
|
|
888
|
+
const range = r_version_1.RRange.parse(dep.constraint);
|
|
889
|
+
if (range === undefined) {
|
|
890
|
+
continue;
|
|
891
|
+
}
|
|
892
|
+
else if (chosen === undefined) {
|
|
893
|
+
unverified.push(`${pkg} ${version} requires ${dep.name} ${dep.constraint}`);
|
|
894
|
+
}
|
|
895
|
+
else if (!r_version_1.RRange.satisfies(chosen, range)) {
|
|
896
|
+
return { ok: false };
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return { ok: true, ...(unverified.length > 0 ? { unverified } : {}) };
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Lazily yield concrete version assignments (one version per package) in odometer order over the per-package lists.
|
|
904
|
+
* With `declares`, a combination whose versions cannot be loaded together is skipped rather than proposed; `limit`
|
|
905
|
+
* bounds the combinations *considered* either way, so fewer than `limit` assignments may come out.
|
|
906
|
+
*/
|
|
907
|
+
function* assignmentsOf(perPackage, limit, declares) {
|
|
859
908
|
if (perPackage.length === 0 || perPackage.some(p => p.versions.length === 0)) {
|
|
860
909
|
return;
|
|
861
910
|
}
|
|
@@ -865,7 +914,13 @@ function* assignmentsOf(perPackage, limit) {
|
|
|
865
914
|
for (let i = 0; i < perPackage.length; i++) {
|
|
866
915
|
versions.set(perPackage[i].pkg, perPackage[i].versions[idx[i]]);
|
|
867
916
|
}
|
|
868
|
-
|
|
917
|
+
const checked = declares === undefined ? undefined : coInstallability(versions, declares);
|
|
918
|
+
if (checked === undefined) {
|
|
919
|
+
yield { versions };
|
|
920
|
+
}
|
|
921
|
+
else if (checked.ok) {
|
|
922
|
+
yield { versions, ...(checked.unverified ? { unverified: checked.unverified } : {}) };
|
|
923
|
+
}
|
|
869
924
|
// advance the odometer: the last package varies fastest
|
|
870
925
|
let k = perPackage.length - 1;
|
|
871
926
|
for (; k >= 0; k--) {
|
|
@@ -885,7 +940,7 @@ async function orderedCandidatesFor(analyzer, options) {
|
|
|
885
940
|
const deps = ctx.deps;
|
|
886
941
|
const sources = deps.signatureSources();
|
|
887
942
|
if (sources.length === 0) {
|
|
888
|
-
return [];
|
|
943
|
+
return { candidates: [], declares: () => undefined };
|
|
889
944
|
}
|
|
890
945
|
const cutoff = options.date ? dateCutoff(options.date) : undefined;
|
|
891
946
|
// bound base packages by R only when genuinely known (a config pin, metadata, or detection); `auto` with nothing detected imposes no R ceiling
|
|
@@ -903,7 +958,11 @@ async function orderedCandidatesFor(analyzer, options) {
|
|
|
903
958
|
out.push(oc);
|
|
904
959
|
}
|
|
905
960
|
}
|
|
906
|
-
return out;
|
|
961
|
+
return { candidates: out, declares: declaredDependenciesOf(space) };
|
|
962
|
+
}
|
|
963
|
+
/** the {@link DependencyResolver} backed by the signature database a version space resolves each package in */
|
|
964
|
+
function declaredDependenciesOf(space) {
|
|
965
|
+
return (pkg, version) => space.resolve(pkg).src?.dependencies(pkg, version);
|
|
907
966
|
}
|
|
908
967
|
/**
|
|
909
968
|
* Explode the guessed constraint space into concrete, signature-database-available version assignments: a lazy
|
|
@@ -913,6 +972,7 @@ async function orderedCandidatesFor(analyzer, options) {
|
|
|
913
972
|
* {@link VersionExplodeOptions.limit} so an enormous product cannot run away.
|
|
914
973
|
*/
|
|
915
974
|
async function* explodeDependencyVersions(analyzer, options = {}) {
|
|
916
|
-
|
|
975
|
+
const { candidates, declares } = await orderedCandidatesFor(analyzer, options);
|
|
976
|
+
yield* assignmentsOf(candidates, options.limit ?? exports.DefaultExplodeLimit, declares);
|
|
917
977
|
}
|
|
918
978
|
//# sourceMappingURL=dependency-version-space.js.map
|