@eagleoutice/flowr 2.13.2 → 2.13.4
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 +45 -43
- package/abstract-interpretation/absint-visitor.js +2 -2
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +1 -0
- package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
- 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/data-frame/mappers/replacement-mapper.js +1 -1
- package/abstract-interpretation/domains/state-domain-like.d.ts +1 -1
- package/abstract-interpretation/unsupported-functions.js +1 -1
- package/config.d.ts +8 -0
- package/config.js +9 -1
- package/control-flow/cfg-dead-code.js +72 -11
- package/control-flow/control-flow-graph.js +2 -1
- package/control-flow/extract-cfg.js +85 -8
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +1 -1
- package/dataflow/environments/append.d.ts +1 -1
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in.d.ts +5 -1
- package/dataflow/environments/built-in.js +5 -1
- package/dataflow/environments/clone.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.d.ts +59 -4
- package/dataflow/environments/default-builtin-config.js +23 -11
- package/dataflow/environments/environment.d.ts +28 -4
- package/dataflow/environments/environment.js +66 -11
- package/dataflow/environments/identifier.d.ts +1 -0
- package/dataflow/environments/overwrite.d.ts +1 -1
- package/dataflow/eval/resolve/alias-tracking.d.ts +3 -1
- package/dataflow/eval/resolve/alias-tracking.js +8 -1
- package/dataflow/eval/resolve/resolve.d.ts +14 -0
- package/dataflow/eval/resolve/resolve.js +47 -0
- package/dataflow/fn/higher-order-function.js +3 -3
- package/dataflow/fn/recursive-function.js +1 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/df-helper.js +1 -1
- package/dataflow/graph/vertex.d.ts +32 -25
- package/dataflow/graph/vertex.js +40 -36
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +14 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +28 -29
- 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-assignment.js +41 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +14 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +45 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +14 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +80 -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 +63 -3
- 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-function-definition.js +63 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +29 -9
- 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 +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +35 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +2 -2
- 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-recall.js +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 +9 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +55 -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 +5 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +24 -0
- package/dataflow/internal/process/functions/process-parameter.js +2 -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/absolute-path.js +1 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/function-finder-util.js +1 -1
- package/linter/rules/no-leaked-credentials.js +1 -1
- package/linter/rules/undefined-symbol-util.js +3 -1
- package/linter/rules/undefined-symbol.js +4 -5
- package/linter/rules/unused-definition.js +15 -10
- package/linter/rules/useless-loop.js +1 -1
- 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/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -1
- 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/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/write-functions.js +23 -24
- 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 +14 -0
- package/queries/catalog/input-sources-query/input-source-functions.js +109 -20
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +45 -4
- package/queries/catalog/input-sources-query/input-sources-query-format.js +22 -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 +76 -53
- package/queries/catalog/input-sources-query/simple-input-classifier.js +358 -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/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
- package/r-bridge/retriever.d.ts +1 -1
- package/reconstruct/inline/source-inline-map.js +1 -1
- package/search/flowr-search-printer.js +10 -8
- package/slicing/static/static-slicer.d.ts +2 -2
- package/util/mermaid/dfg.js +1 -1
- 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/project/sigdb/reader.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SigDatabaseSet = exports.SigDatabase = exports.MergedSignatureSource = void 0;
|
|
7
7
|
exports.readSignatureDb = readSignatureDb;
|
|
8
8
|
exports.availableVersionEntries = availableVersionEntries;
|
|
9
|
+
exports.classOwnerIndexFor = classOwnerIndexFor;
|
|
9
10
|
exports.sourceForPackage = sourceForPackage;
|
|
10
11
|
exports.getSharedSigSourceSync = getSharedSigSourceSync;
|
|
11
12
|
exports.getSharedSigSource = getSharedSigSource;
|
|
@@ -115,13 +116,22 @@ function availableVersionEntries(src, pkg) {
|
|
|
115
116
|
.sort((a, b) => r_version_1.RVersion.compare(a.version, b.version) || (a.date && b.date ? a.date.getTime() - b.date.getTime() : 0));
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
118
|
-
* The reverse index `class -> owning package` over
|
|
119
|
-
* constructor plus a registered method) is a stronger signal than an S4 `exportClasses`, so S3-owned
|
|
120
|
-
* indexed first and an S4 class only claims a name no S3 owner already took.
|
|
119
|
+
* The reverse index `class -> owning package` over `candidates`, at each one's latest version. S3 ownership (a
|
|
120
|
+
* same-named constructor plus a registered method) is a stronger signal than an S4 `exportClasses`, so S3-owned
|
|
121
|
+
* classes are indexed first and an S4 class only claims a name no S3 owner already took.
|
|
122
|
+
*
|
|
123
|
+
* Restricting the candidates is the targeted counterpart of {@link PackageSignatureSource.classOwner}: class names
|
|
124
|
+
* collide heavily across CRAN, so a whole-database answer is decided by database order, and deriving one means
|
|
125
|
+
* reading every package in the database.
|
|
121
126
|
*/
|
|
122
|
-
function
|
|
127
|
+
function classOwnerIndexFor(src, candidates) {
|
|
123
128
|
const index = new Map();
|
|
124
|
-
const libs =
|
|
129
|
+
const libs = [];
|
|
130
|
+
for (const pkg of candidates) {
|
|
131
|
+
if (src.has(pkg)) {
|
|
132
|
+
libs.push({ pkg, lib: src.lookup(pkg) });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
125
135
|
for (const pick of [(l) => l?.s3Classes, (l) => l?.s4Classes]) {
|
|
126
136
|
for (const { pkg, lib } of libs) {
|
|
127
137
|
for (const cls of pick(lib) ?? []) {
|
|
@@ -238,10 +248,12 @@ function sourceForPackage(sources, pkg) {
|
|
|
238
248
|
}
|
|
239
249
|
/**
|
|
240
250
|
* Fast, partial reader for a single bundle. `open()`/`openSync()` load the string dictionary + `.idx`
|
|
241
|
-
* once (a single ranged read of the dictionary section
|
|
251
|
+
* once (a single ranged read of the dictionary section, no full parse), then every query seeks straight
|
|
242
252
|
* to one package blob on demand. `open()` additionally decompresses a `.br`/`.gz` source into a
|
|
243
253
|
* hash-keyed cache and reuses it on later startups. Implements {@link PackageSignatureSource}.
|
|
244
254
|
*/
|
|
255
|
+
/** the {@link SigDatabase.fd} of a database that has no file behind it (see {@link SigDatabase.fromMemory}) */
|
|
256
|
+
const NoFile = -1;
|
|
245
257
|
class SigDatabase {
|
|
246
258
|
closed = false;
|
|
247
259
|
/** parsed blobs by blob index so repeated lookups skip the re-read + JSON.parse; FIFO-bounded to cap memory */
|
|
@@ -261,10 +273,21 @@ class SigDatabase {
|
|
|
261
273
|
this.content = content;
|
|
262
274
|
this.cranBase = cranBase;
|
|
263
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Use an already-built {@link SigDb} directly, without writing or reading a file: its blobs simply start out in
|
|
278
|
+
* the cache. It holds exactly what a bundle carries, so every query answers as it would from disk; the
|
|
279
|
+
* {@link SigDbBuilder} plus this is all a test needs.
|
|
280
|
+
*/
|
|
281
|
+
static fromMemory(db) {
|
|
282
|
+
const index = { byteCount: 0, dict: [0, 0], blobs: [], pkgs: db.pkgs, meta: db.meta };
|
|
283
|
+
const source = new SigDatabase(NoFile, db.strings, index, db.content, db.cranBase ?? schema_1.DefaultCranBase);
|
|
284
|
+
db.blobs.forEach((blob, i) => source.blobCache.set(i, blob));
|
|
285
|
+
return source;
|
|
286
|
+
}
|
|
264
287
|
/**
|
|
265
288
|
* Open a plain, seekable `.sigs.ndjson` synchronously. Pass `index` to skip reading the `.idx`,
|
|
266
289
|
* and `strings` to use an already-loaded shared dictionary instead of the file's own `d` section (for a
|
|
267
|
-
* blob-only shard). One ranged read loads the dictionary
|
|
290
|
+
* blob-only shard). One ranged read loads the dictionary, no readline overhead.
|
|
268
291
|
*/
|
|
269
292
|
static openSync(plainFile, opts = {}) {
|
|
270
293
|
if ((0, decompress_1.isCompressed)(plainFile)) {
|
|
@@ -321,6 +344,9 @@ class SigDatabase {
|
|
|
321
344
|
if (cached !== undefined) {
|
|
322
345
|
return cached;
|
|
323
346
|
}
|
|
347
|
+
if (this.fd === NoFile) {
|
|
348
|
+
return undefined; // an in-memory database starts out with every blob cached
|
|
349
|
+
}
|
|
324
350
|
const blob = this.readBlobAt(this.index.blobs[blobIdx]);
|
|
325
351
|
if (this.blobCache.size >= SigDatabase.BlobCacheCap) {
|
|
326
352
|
const oldest = this.blobCache.keys().next().value;
|
|
@@ -340,11 +366,14 @@ class SigDatabase {
|
|
|
340
366
|
}
|
|
341
367
|
/** read every unique package blob in index order (used to re-hash a whole shard during verification) */
|
|
342
368
|
allBlobs() {
|
|
343
|
-
|
|
369
|
+
// an in-memory database has no byte ranges to re-read: its blobs are the cached ones, in blob-index order
|
|
370
|
+
return this.fd === NoFile
|
|
371
|
+
? [...this.blobCache.entries()].sort(([a], [b]) => a - b).map(([, blob]) => blob)
|
|
372
|
+
: this.index.blobs.map(range => this.readBlobAt(range));
|
|
344
373
|
}
|
|
345
374
|
/** recompute this bundle's self-contained content hash from its re-read data (matches {@link writeSignatureDb}) */
|
|
346
375
|
contentHash(blobs = this.allBlobs()) {
|
|
347
|
-
// use only this bundle's own package metadata, in package-index order
|
|
376
|
+
// use only this bundle's own package metadata, in package-index order, since a shared manifest may hoist a
|
|
348
377
|
// superset of metadata that the self-contained bundle was NOT hashed over
|
|
349
378
|
const meta = {};
|
|
350
379
|
for (const pkg of Object.keys(this.index.pkgs)) {
|
|
@@ -372,7 +401,7 @@ class SigDatabase {
|
|
|
372
401
|
if (version !== undefined) {
|
|
373
402
|
return classOwnerAtVersion(this, className, version);
|
|
374
403
|
}
|
|
375
|
-
this.classIndex ??=
|
|
404
|
+
this.classIndex ??= classOwnerIndexFor(this, this.packageNames());
|
|
376
405
|
return this.classIndex.get(className);
|
|
377
406
|
}
|
|
378
407
|
/** resolve a package version to its blob and the function-record indices of that version (the shared prologue of {@link functions}/{@link functionByName}) */
|
|
@@ -451,7 +480,9 @@ class SigDatabase {
|
|
|
451
480
|
this.closed = true;
|
|
452
481
|
this.blobCache.clear();
|
|
453
482
|
this.classIndex = undefined;
|
|
454
|
-
|
|
483
|
+
if (this.fd !== NoFile) {
|
|
484
|
+
node_fs_1.default.closeSync(this.fd);
|
|
485
|
+
}
|
|
455
486
|
}
|
|
456
487
|
}
|
|
457
488
|
}
|
|
@@ -529,14 +560,14 @@ class SigDatabaseSet {
|
|
|
529
560
|
return SigDatabaseSet.assemble(manifest, baseDir, indices, opts.cacheDir);
|
|
530
561
|
}
|
|
531
562
|
/**
|
|
532
|
-
* Synchronous {@link openManifest}
|
|
563
|
+
* Synchronous {@link openManifest}, needing every shard to embed its index (the default for the bundles
|
|
533
564
|
* flowR ships). Shards and dictionaries still decompress lazily.
|
|
534
565
|
*/
|
|
535
566
|
static openManifestSync(manifestFile, opts = {}) {
|
|
536
567
|
const { baseDir, manifest } = SigDatabaseSet.prepManifest(manifestFile, opts);
|
|
537
568
|
const indices = manifest.shards.map(s => {
|
|
538
569
|
if (!s.idx) {
|
|
539
|
-
throw new Error(`openManifestSync needs every shard to embed its index; shard '${s.id}' does not
|
|
570
|
+
throw new Error(`openManifestSync needs every shard to embed its index; shard '${s.id}' does not, use openManifest`);
|
|
540
571
|
}
|
|
541
572
|
return (0, index_format_1.decodeIndex)(s.idx, manifest.meta);
|
|
542
573
|
});
|
|
@@ -569,7 +600,7 @@ class SigDatabaseSet {
|
|
|
569
600
|
this.dictCache.set(dictId, strings);
|
|
570
601
|
return strings;
|
|
571
602
|
}
|
|
572
|
-
/** lazily open a shard
|
|
603
|
+
/** lazily open a shard, decompressing its `.br` (and its shared dictionary) into the cache on first access */
|
|
573
604
|
shard(i) {
|
|
574
605
|
const existing = this.opened[i];
|
|
575
606
|
if (existing) {
|
|
@@ -628,7 +659,7 @@ class SigDatabaseSet {
|
|
|
628
659
|
});
|
|
629
660
|
await Promise.all([...shardJobs, ...dictJobs]);
|
|
630
661
|
// open each shard from the now-decompressed cache (cheap; parses each shared dictionary once) so later
|
|
631
|
-
// synchronous queries
|
|
662
|
+
// synchronous queries, including historical pinned-version lookups, never block
|
|
632
663
|
for (const i of need) {
|
|
633
664
|
this.shard(i);
|
|
634
665
|
}
|
|
@@ -642,7 +673,7 @@ class SigDatabaseSet {
|
|
|
642
673
|
// keep only shards that actually carry the requested version (current shards may hold only the latest)
|
|
643
674
|
return candidates.filter(i => this.shard(i).hasVersion(pkg, version));
|
|
644
675
|
}
|
|
645
|
-
/** read (once) the blob from the shard with the most complete history
|
|
676
|
+
/** read (once) the blob from the shard with the most complete history: a `full` or `history` tier if present */
|
|
646
677
|
historyBlob(pkg) {
|
|
647
678
|
const candidates = this.routes.get(pkg);
|
|
648
679
|
if (!candidates || candidates.length === 0) {
|
|
@@ -677,11 +708,11 @@ class SigDatabaseSet {
|
|
|
677
708
|
};
|
|
678
709
|
});
|
|
679
710
|
}
|
|
680
|
-
/** open (blocking) and return every shard database with its manifest ref
|
|
711
|
+
/** open (blocking) and return every shard database with its manifest ref, for whole-set verification */
|
|
681
712
|
allShards() {
|
|
682
713
|
return this.manifest.shards.map((ref, i) => ({ ref, db: this.shard(i) }));
|
|
683
714
|
}
|
|
684
|
-
/** load (and cache) a shared dictionary's strings by id
|
|
715
|
+
/** load (and cache) a shared dictionary's strings by id, for verification/inspection */
|
|
685
716
|
sharedDictionary(id) {
|
|
686
717
|
return this.dictionaryStrings(id);
|
|
687
718
|
}
|
|
@@ -702,7 +733,7 @@ class SigDatabaseSet {
|
|
|
702
733
|
if (version !== undefined) {
|
|
703
734
|
return classOwnerAtVersion(this, className, version);
|
|
704
735
|
}
|
|
705
|
-
this.classIndex ??=
|
|
736
|
+
this.classIndex ??= classOwnerIndexFor(this, this.packageNames());
|
|
706
737
|
return this.classIndex.get(className);
|
|
707
738
|
}
|
|
708
739
|
functions(pkg, version) {
|
|
@@ -733,7 +764,7 @@ class SigDatabaseSet {
|
|
|
733
764
|
}
|
|
734
765
|
return Object.keys(this.historyBlob(pkg)?.versions ?? {}).map(r_version_1.RVersion.parseOrZero).sort((a, b) => r_version_1.RVersion.compare(a.str, b.str));
|
|
735
766
|
}
|
|
736
|
-
/** every known release of a package (version + date), ascending
|
|
767
|
+
/** every known release of a package (version + date), ascending, read once from the most complete shard */
|
|
737
768
|
releaseDates(pkg) {
|
|
738
769
|
return (0, sigdb_version_1.releasesOf)(this.historyBlob(pkg));
|
|
739
770
|
}
|
|
@@ -774,7 +805,7 @@ function isSyncOpenable(source) {
|
|
|
774
805
|
}
|
|
775
806
|
/**
|
|
776
807
|
* Open a path-based source once, process-wide, synchronously. Returns the shared instance (opening it on the
|
|
777
|
-
* first call), or `undefined` if the path needs async opening (a `.br`/`.gz` bundle
|
|
808
|
+
* first call), or `undefined` if the path needs async opening (a `.br`/`.gz` bundle, use {@link getSharedSigSource}).
|
|
778
809
|
* Throws only if a sync-openable source fails to open.
|
|
779
810
|
*/
|
|
780
811
|
function getSharedSigSourceSync(source) {
|
|
@@ -147,7 +147,7 @@ function identifyLinkToLastCallRelationSync(from, cfg, graph, { callName, cascad
|
|
|
147
147
|
(node) => knownCalls.get(node) :
|
|
148
148
|
(node) => {
|
|
149
149
|
const v = graph.getVertex(node);
|
|
150
|
-
return
|
|
150
|
+
return vertex_1.FunctionCallVertex.is(v) ? v : undefined;
|
|
151
151
|
};
|
|
152
152
|
(0, simple_visitor_1.visitCfgInReverseOrder)(cfg, [from], node => {
|
|
153
153
|
/* we ignore the start id as it cannot be the last call */
|
|
@@ -21,7 +21,7 @@ async function identifyLinkToNestedRelation(from, analyzer, { callName, ignoreIf
|
|
|
21
21
|
const cg = await analyzer.callGraph();
|
|
22
22
|
const subCg = call_graph_1.CallGraph.computeSubCallGraph(cg, new Set([from]));
|
|
23
23
|
for (const [, t] of subCg.vertices(true)) {
|
|
24
|
-
if (!
|
|
24
|
+
if (!vertex_1.FunctionCallVertex.is(t)) {
|
|
25
25
|
continue;
|
|
26
26
|
}
|
|
27
27
|
if (test(identifier_1.Identifier.toString(t.name))) {
|
|
@@ -197,7 +197,7 @@ function getResults(queries, { dataflow, config, normalize }, results, kind, fun
|
|
|
197
197
|
linkedIds: linked?.length ? linked : undefined,
|
|
198
198
|
value: resolvedValue ?? info.defaultValue ?? defaultValue,
|
|
199
199
|
versionConstraints: dep?.versionConstraints,
|
|
200
|
-
|
|
200
|
+
derivedRange: dep?.derivedRange,
|
|
201
201
|
namespaceInfo: dep?.namespaceInfo
|
|
202
202
|
}));
|
|
203
203
|
}
|
|
@@ -79,8 +79,8 @@ export interface DependencyInfo extends Record<string, unknown> {
|
|
|
79
79
|
lexemeOfArgument?: string;
|
|
80
80
|
/** The library name, file, source, destination etc. being sourced, read from, or written to. */
|
|
81
81
|
value?: string;
|
|
82
|
-
versionConstraints?: Range[];
|
|
83
|
-
|
|
82
|
+
versionConstraints?: readonly Range[];
|
|
83
|
+
derivedRange?: Range;
|
|
84
84
|
namespaceInfo?: NamespaceInfo;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
@@ -38,7 +38,7 @@ exports.DefaultDependencyCategories = {
|
|
|
38
38
|
functionName: model_1.RNode.lexeme(node).includes(':::') ? ':::' : '::',
|
|
39
39
|
value: ns,
|
|
40
40
|
versionConstraints: dep?.versionConstraints,
|
|
41
|
-
|
|
41
|
+
derivedRange: dep?.derivedRange,
|
|
42
42
|
namespaceInfo: dep?.namespaceInfo
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -79,7 +79,7 @@ function printResultSection(title, infos, result, formatter) {
|
|
|
79
79
|
for (const i of infos) {
|
|
80
80
|
const fn = identifier_1.Identifier.getName(i.functionName);
|
|
81
81
|
const value = i.value !== undefined ? (0, ansi_1.bold)(i.value, formatter) : (0, ansi_1.faint)('<unresolved>', formatter);
|
|
82
|
-
const version = i.
|
|
82
|
+
const version = i.derivedRange !== undefined ? ` ${(0, ansi_1.faint)(i.derivedRange.format(), formatter)}` : '';
|
|
83
83
|
const linked = i.linkedIds ? `, linked ${i.linkedIds.join(', ')}` : '';
|
|
84
84
|
result.push(` ${value}${version} ${(0, ansi_1.faint)(`via ${fn} (node ${i.nodeId}${linked})`, formatter)}`);
|
|
85
85
|
}
|
|
@@ -78,7 +78,7 @@ exports.ReadFunctions = [
|
|
|
78
78
|
{ package: 'readxl', name: 'read_excel', argIdx: 0, argName: 'path', resolveValue: true },
|
|
79
79
|
{ package: 'readxl', name: 'read_xls', argIdx: 0, argName: 'path', resolveValue: true },
|
|
80
80
|
{ package: 'readxl', name: 'read_xlsx', argIdx: 0, argName: 'path', resolveValue: true },
|
|
81
|
-
{ package: 'sf', name: '
|
|
81
|
+
{ package: 'sf', name: 'read_sf', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
82
82
|
{ package: 'sf', name: 'st_read', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
83
83
|
{ package: 'rgdal', name: 'readOGR', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
84
84
|
{ package: 'rgdal', name: 'ogrInfo', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
@@ -33,7 +33,7 @@ exports.WriteFunctions = [
|
|
|
33
33
|
{ package: 'base', name: 'message', linkTo: OutputRedirects, resolveValue: false },
|
|
34
34
|
{ package: 'base', name: 'warning', linkTo: OutputRedirects, resolveValue: false },
|
|
35
35
|
{ package: 'rlang', name: 'warn', linkTo: OutputRedirects, resolveValue: false },
|
|
36
|
-
{ package: 'rlang', name: '
|
|
36
|
+
{ package: 'rlang', name: 'inform', linkTo: OutputRedirects, resolveValue: false },
|
|
37
37
|
{ package: 'cli', name: 'cli_warn', linkTo: OutputRedirects, resolveValue: false },
|
|
38
38
|
{ package: 'cli', name: 'cli_abort', linkTo: OutputRedirects, resolveValue: false },
|
|
39
39
|
{ package: 'base', name: 'writeLines', argIdx: 1, argName: 'con', resolveValue: true },
|
|
@@ -51,11 +51,10 @@ exports.WriteFunctions = [
|
|
|
51
51
|
{ package: 'readr', name: 'write_log', argIdx: 1, argName: 'file', resolveValue: true },
|
|
52
52
|
{ package: 'readr', name: 'write_lines', argIdx: 1, argName: 'file', resolveValue: true },
|
|
53
53
|
{ package: 'readr', name: 'write_rds', argIdx: 1, argName: 'file', resolveValue: true },
|
|
54
|
-
{ package: '
|
|
55
|
-
{ package: '
|
|
56
|
-
{ package: '
|
|
57
|
-
{ package: '
|
|
58
|
-
{ package: 'heaven', name: 'write_xpt', argIdx: 1, argName: 'file', resolveValue: true },
|
|
54
|
+
{ package: 'haven', name: 'write_sas', argIdx: 1, argName: 'file', resolveValue: true },
|
|
55
|
+
{ package: 'haven', name: 'write_sav', argIdx: 1, argName: 'file', resolveValue: true },
|
|
56
|
+
{ package: 'haven', name: 'write_dta', argIdx: 1, argName: 'file', resolveValue: true },
|
|
57
|
+
{ package: 'haven', name: 'write_xpt', argIdx: 1, argName: 'file', resolveValue: true },
|
|
59
58
|
{ package: 'feather', name: 'write_feather', argIdx: 1, argName: 'file', resolveValue: true },
|
|
60
59
|
{ package: 'foreign', name: 'write.arff', argIdx: 1, argName: 'file', resolveValue: true },
|
|
61
60
|
{ package: 'foreign', name: 'write.dbf', argIdx: 1, argName: 'file', resolveValue: true },
|
|
@@ -63,25 +62,25 @@ exports.WriteFunctions = [
|
|
|
63
62
|
{ package: 'foreign', name: 'write.foreign', argIdx: 1, argName: 'file', resolveValue: true },
|
|
64
63
|
{ package: 'xlsx', name: 'write.xlsx', argIdx: 1, argName: 'file', resolveValue: true },
|
|
65
64
|
{ package: 'xlsx', name: 'write.xlsx2', argIdx: 1, argName: 'file', resolveValue: true },
|
|
66
|
-
{ package: '
|
|
67
|
-
{ package: '
|
|
68
|
-
{ package: '
|
|
69
|
-
{ package: '
|
|
70
|
-
{ package: '
|
|
71
|
-
{ package: '
|
|
72
|
-
{ package: '
|
|
73
|
-
{ package: '
|
|
74
|
-
{ package: '
|
|
75
|
-
{ package: '
|
|
76
|
-
{ package: '
|
|
77
|
-
{ package: '
|
|
78
|
-
{ package: '
|
|
79
|
-
{ package: '
|
|
65
|
+
{ package: 'grDevices', name: 'pdf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
66
|
+
{ package: 'grDevices', name: 'jpeg', argIdx: 0, argName: 'file', resolveValue: true },
|
|
67
|
+
{ package: 'grDevices', name: 'png', argIdx: 0, argName: 'file', resolveValue: true },
|
|
68
|
+
{ package: 'grDevices', name: 'windows', argIdx: 0, argName: 'file', resolveValue: true },
|
|
69
|
+
{ package: 'grDevices', name: 'postscript', argIdx: 0, argName: 'file', resolveValue: true },
|
|
70
|
+
{ package: 'grDevices', name: 'xfig', argIdx: 0, argName: 'file', resolveValue: true },
|
|
71
|
+
{ package: 'grDevices', name: 'bitmap', argIdx: 0, argName: 'file', resolveValue: true },
|
|
72
|
+
{ package: 'grDevices', name: 'pictex', argIdx: 0, argName: 'file', resolveValue: true },
|
|
73
|
+
{ package: 'grDevices', name: 'cairo_pdf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
74
|
+
{ package: 'grDevices', name: 'svg', argIdx: 0, argName: 'file', resolveValue: true },
|
|
75
|
+
{ package: 'grDevices', name: 'bmp', argIdx: 0, argName: 'file', resolveValue: true },
|
|
76
|
+
{ package: 'grDevices', name: 'tiff', argIdx: 0, argName: 'file', resolveValue: true },
|
|
77
|
+
{ package: 'grDevices', name: 'X11', argIdx: 0, argName: 'file', resolveValue: true },
|
|
78
|
+
{ package: 'grDevices', name: 'quartz', argIdx: 0, argName: 'file', resolveValue: true },
|
|
80
79
|
{ package: 'car', name: 'Export', argIdx: 0, argName: 'file', resolveValue: true },
|
|
81
80
|
{ package: 'LIM', name: 'PrintMat', linkTo: OutputRedirects, resolveValue: true },
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
{
|
|
81
|
+
// write_spss/write_stata moved sjmisc -> sjlabelled, so do not pin a namespace (match either); write_sas also lives in haven
|
|
82
|
+
{ name: 'write_spss', argIdx: 1, argName: 'path', resolveValue: true },
|
|
83
|
+
{ name: 'write_stata', argIdx: 1, argName: 'path', resolveValue: true },
|
|
85
84
|
{ package: 'ape', name: 'write.tree', argIdx: 1, argName: 'file', resolveValue: true },
|
|
86
85
|
{ package: 'ape', name: 'write.nexus', argIdx: 1, argName: 'file', resolveValue: true },
|
|
87
86
|
{ package: 'ape', name: 'write.phyloXML', argIdx: 1, argName: 'file', resolveValue: true },
|
|
@@ -98,7 +97,7 @@ exports.WriteFunctions = [
|
|
|
98
97
|
{ package: 'visNetwork', name: 'visSave', argIdx: 1, argName: 'file', resolveValue: true },
|
|
99
98
|
{ package: 'DiagrammeR', name: 'save_graph', argIdx: 1, argName: 'file', resolveValue: true },
|
|
100
99
|
{ package: 'DiagrammeR', name: 'export_graph', argName: 'file_name', resolveValue: true },
|
|
101
|
-
{ package: '
|
|
100
|
+
{ package: 'ggplot2', name: 'ggsave', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
102
101
|
{ package: 'cowplot', name: 'ggsave2', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
103
102
|
{ package: 'tinyplot', name: 'tinyplot', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
104
103
|
{ package: 'tinyplot', name: 'plt', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
@@ -2,7 +2,7 @@ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
|
2
2
|
import Joi from 'joi';
|
|
3
3
|
import type { ParsedQueryLine } from '../../query';
|
|
4
4
|
import { executeDoesCallQuery } from './does-call-query-executor';
|
|
5
|
-
import {
|
|
5
|
+
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
6
|
import type { SlicingCriterion } from '../../../slicing/criterion/parse';
|
|
7
7
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
8
8
|
import type { FlowrConfig } from '../../../config';
|
|
@@ -4,7 +4,6 @@ exports.executeGuessDepVersionsQuery = executeGuessDepVersionsQuery;
|
|
|
4
4
|
const guess_dep_versions_query_format_1 = require("./guess-dep-versions-query-format");
|
|
5
5
|
const r_version_1 = require("../../../util/r-version");
|
|
6
6
|
const objects_1 = require("../../../util/objects");
|
|
7
|
-
const reader_1 = require("../../../project/sigdb/reader");
|
|
8
7
|
const dependency_version_space_1 = require("../../../project/dependency-version-space");
|
|
9
8
|
/** the sources `query` disables: `clean` is sugar for disabling `declared`+`transitive`, `disabled` adds any others by name */
|
|
10
9
|
function disabledSources(query) {
|
|
@@ -100,7 +99,7 @@ function rangeString(survivors, nonContiguous, unsatisfiable, declaredRange, dec
|
|
|
100
99
|
return survivors.length <= cap ? survivors.join(', ') : `${min}...${max} (${survivors.length} discrete)`;
|
|
101
100
|
}
|
|
102
101
|
/** build the reported guess for one package from its already-computed surviving versions and provenance */
|
|
103
|
-
function guessPackage(name, cap, surviving, evidence, used, linkedWith) {
|
|
102
|
+
function guessPackage(name, cap, surviving, evidence, { used, linkedWith, coupledWith }) {
|
|
104
103
|
const { declaredRange, declaredConstraints, unsatisfiable } = surviving;
|
|
105
104
|
const survivors = surviving.survivors.map(e => e.ver);
|
|
106
105
|
const preSignature = surviving.preSignature.map(e => e.ver);
|
|
@@ -121,6 +120,7 @@ function guessPackage(name, cap, surviving, evidence, used, linkedWith) {
|
|
|
121
120
|
evidence: evidence.list,
|
|
122
121
|
unsatisfiable: unsatisfiable ? true : undefined,
|
|
123
122
|
linkedWith: linkedWith && linkedWith.length > 0 ? linkedWith : undefined,
|
|
123
|
+
coupledWith: coupledWith && coupledWith.length > 0 ? coupledWith : undefined,
|
|
124
124
|
used
|
|
125
125
|
});
|
|
126
126
|
}
|
|
@@ -154,57 +154,23 @@ async function executeGuessDepVersionsQuery({ analyzer }, queries) {
|
|
|
154
154
|
// the analyzed package guesses versions for its dependencies, not for itself
|
|
155
155
|
const self = ctx.meta.getNamespace();
|
|
156
156
|
const sorted = (query.packages && query.packages.length > 0 ? [...query.packages] : (0, dependency_version_space_1.defaultTargets)(deps, usage)).filter(name => name !== self).sort();
|
|
157
|
-
// resolve (and cache) each target's timeline package key + merged source once, reused across both guess passes
|
|
158
|
-
const sourceByName = new Map();
|
|
159
|
-
const sourceFor = (name) => {
|
|
160
|
-
let entry = sourceByName.get(name);
|
|
161
|
-
if (entry === undefined) {
|
|
162
|
-
const key = (0, dependency_version_space_1.timelinePackageKey)(name, sources);
|
|
163
|
-
entry = { key, src: (0, reader_1.sourceForPackage)(sources, key) };
|
|
164
|
-
sourceByName.set(name, entry);
|
|
165
|
-
}
|
|
166
|
-
return entry;
|
|
167
|
-
};
|
|
168
157
|
const disabled = disabledSources(query);
|
|
169
|
-
|
|
170
|
-
const guessLowerBounds = (trans) => {
|
|
171
|
-
const out = new Map();
|
|
172
|
-
for (const name of sorted) {
|
|
173
|
-
const { key, src } = sourceFor(name);
|
|
174
|
-
const s = (0, dependency_version_space_1.survivingEntries)(name, src, deps, usage.get(name), trans.get(name) ?? [], cutoff, rVersion, undefined, disabled, key);
|
|
175
|
-
if (s.survivors.length > 0) {
|
|
176
|
-
out.set(name, s.survivors[0].ver);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return out;
|
|
180
|
-
};
|
|
158
|
+
const space = new dependency_version_space_1.VersionSpace({ deps, usage, cutoff, rVersion, disabled });
|
|
181
159
|
const maxIterations = query.maxIterations ?? dependency_version_space_1.DefaultFixpointIterations;
|
|
182
|
-
|
|
183
|
-
if (!disabled.has('transitive')) {
|
|
184
|
-
let prev = '';
|
|
185
|
-
(0, dependency_version_space_1.iterateToFixpoint)(maxIterations, () => {
|
|
186
|
-
const pass = guessLowerBounds(transitive);
|
|
187
|
-
const signature = Array.from(pass, ([k, v]) => `${k}=${v}`).sort().join(',');
|
|
188
|
-
if (signature === prev) {
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
prev = signature;
|
|
192
|
-
transitive = (0, dependency_version_space_1.collectTransitiveConstraints)(deps, sources, name => pass.get(name));
|
|
193
|
-
return true;
|
|
194
|
-
});
|
|
195
|
-
}
|
|
160
|
+
const transitive = space.refineTransitive(sorted, maxIterations);
|
|
196
161
|
const cap = query.maxCandidates ?? guess_dep_versions_query_format_1.DefaultCandidateCap;
|
|
197
162
|
const explodeOrder = query.explode?.order ?? 'newest';
|
|
198
163
|
const guessedAll = sorted.map(name => {
|
|
199
|
-
const { key, src } = sourceFor(name);
|
|
200
164
|
const evidence = new EvidenceCollector();
|
|
201
|
-
const surviving =
|
|
202
|
-
return { name,
|
|
165
|
+
const surviving = space.survivors(name, transitive.get(name) ?? [], evidence.add);
|
|
166
|
+
return { name, evidence, surviving };
|
|
203
167
|
});
|
|
204
|
-
const
|
|
205
|
-
const blockers = query.clean || disabled.has('indirect')
|
|
206
|
-
|
|
207
|
-
|
|
168
|
+
const initial = new Map(guessedAll.map(g => [g.name, g.surviving.survivors]));
|
|
169
|
+
const { survivors: pruned, blockers } = query.clean || disabled.has('indirect')
|
|
170
|
+
? { survivors: initial, blockers: new Map() }
|
|
171
|
+
: (0, dependency_version_space_1.enforceArcConsistency)(space, initial, maxIterations);
|
|
172
|
+
guessedAll.forEach(g => {
|
|
173
|
+
g.surviving = { ...g.surviving, survivors: pruned.get(g.name) ?? g.surviving.survivors };
|
|
208
174
|
const max = g.surviving.survivors.at(-1)?.ver;
|
|
209
175
|
for (const [partner, constraint] of blockers.get(g.name) ?? []) {
|
|
210
176
|
if (max !== undefined) {
|
|
@@ -232,44 +198,39 @@ async function executeGuessDepVersionsQuery({ analyzer }, queries) {
|
|
|
232
198
|
}
|
|
233
199
|
}
|
|
234
200
|
}
|
|
235
|
-
//
|
|
236
|
-
const grouped = new Set(linkedGroups.flat());
|
|
237
|
-
const factorOf = (g) => ({ name: g.name, src: g.src, key: g.key, survivors: g.surviving.survivors.map(e => e.ver) });
|
|
238
|
-
let hub, hubTotal = 1, othersTotal = 1;
|
|
239
|
-
const others = [];
|
|
240
|
-
for (const group of linkedGroups) {
|
|
241
|
-
const rep = guessedAll.find(g => group.includes(g.name));
|
|
242
|
-
if (rep === undefined) {
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
if (rep.surviving.base && hub === undefined) {
|
|
246
|
-
hub = factorOf(rep);
|
|
247
|
-
hubTotal = rep.surviving.total ?? 1;
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
others.push(factorOf(rep));
|
|
251
|
-
othersTotal *= rep.surviving.total ?? 1;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// a package is a counted factor only when a *real* constraint narrows it (declared/transitive/signature/indirect);
|
|
201
|
+
// a package is a counted factor only when a *real* constraint bears on it (declared/transitive/signature/indirect);
|
|
255
202
|
// date/available narrowing alone must not promote an otherwise any-version package into the product, or a tighter
|
|
256
|
-
// date cutoff could paradoxically grow the count by turning more packages into factors
|
|
203
|
+
// date cutoff could paradoxically grow the count by turning more packages into factors. A partial constraint does
|
|
204
|
+
// count: it does not narrow the package on its own, but it does couple it to the package that declares it
|
|
257
205
|
const reallyConstrained = (g) => g.evidence.list.some(e => e.source === 'declared' || e.source === 'transitive' || e.source === 'signature' || e.source === 'indirect');
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
206
|
+
// one factor per linked group (its members share a version) plus every other constrained package
|
|
207
|
+
const grouped = new Set(linkedGroups.flat());
|
|
208
|
+
const representatives = [
|
|
209
|
+
...linkedGroups.map(group => guessedAll.find(g => group.includes(g.name))).filter(g => g !== undefined),
|
|
210
|
+
...guessedAll.filter(g => !grouped.has(g.name) && (g.surviving.total ?? 0) > 0 && reallyConstrained(g))
|
|
211
|
+
];
|
|
212
|
+
const factors = representatives.map(g => ({ name: g.name, survivors: g.surviving.survivors.map(e => e.ver) }));
|
|
213
|
+
const { total: runnableCombinations, couplings } = (0, dependency_version_space_1.countRunnableCombinations)(space, factors);
|
|
214
|
+
const possibleCombinations = representatives.reduce((p, g) => p * (g.surviving.total ?? 1), 1);
|
|
215
|
+
// the baseline the guess narrows down from: what the project already declares, before usage and interdependencies
|
|
216
|
+
const anyDeclared = !disabled.has('declared') && representatives.some(g => g.surviving.declaredConstraints.length > 0);
|
|
217
|
+
const declaredCombinations = anyDeclared ? representatives.reduce((p, g) => p * g.surviving.declared, 1) : undefined;
|
|
218
|
+
// a coupled package's version is not free: report the partners, flagging one that only some versions impose
|
|
219
|
+
const coupledWith = new Map();
|
|
220
|
+
for (const c of couplings) {
|
|
221
|
+
for (const [pkg, partner] of [[c.a, c.b], [c.b, c.a]]) {
|
|
222
|
+
coupledWith.set(pkg, [...coupledWith.get(pkg) ?? [], c.always ? partner : `${partner} (partial)`]);
|
|
262
223
|
}
|
|
263
|
-
others.push(factorOf(g));
|
|
264
|
-
othersTotal *= total;
|
|
265
224
|
}
|
|
266
|
-
const runnableCombinations = (0, dependency_version_space_1.countRunnableCombinations)(hub, others);
|
|
267
|
-
const possibleCombinations = hubTotal * othersTotal;
|
|
268
225
|
const dependencies = [];
|
|
269
226
|
const ordered = [];
|
|
270
227
|
for (const g of guessedAll) {
|
|
271
|
-
dependencies.push(guessPackage(g.name, cap, g.surviving, g.evidence,
|
|
272
|
-
|
|
228
|
+
dependencies.push(guessPackage(g.name, cap, g.surviving, g.evidence, {
|
|
229
|
+
used: usage.has(g.name),
|
|
230
|
+
linkedWith: linkedWith.get(g.name),
|
|
231
|
+
coupledWith: coupledWith.get(g.name)
|
|
232
|
+
}));
|
|
233
|
+
const oc = query.explode ? (0, dependency_version_space_1.orderedCandidatesOf)(space.resolve(g.name).src, g.name, g.surviving, query.explode.prefer?.[g.name], explodeOrder) : undefined;
|
|
273
234
|
if (oc) {
|
|
274
235
|
ordered.push(oc);
|
|
275
236
|
}
|
|
@@ -285,6 +246,7 @@ async function executeGuessDepVersionsQuery({ analyzer }, queries) {
|
|
|
285
246
|
versionSelection: ctx.config.solver.sigdb.versionSelection,
|
|
286
247
|
runnableCombinations,
|
|
287
248
|
possibleCombinations,
|
|
249
|
+
declaredCombinations,
|
|
288
250
|
linkedGroups: linkedGroups.length > 0 ? linkedGroups : undefined,
|
|
289
251
|
assignments,
|
|
290
252
|
message
|
|
@@ -80,6 +80,12 @@ export interface GuessedDependency {
|
|
|
80
80
|
readonly unsatisfiable?: boolean;
|
|
81
81
|
/** the other packages this one shares a version with, so its range is not independent of theirs */
|
|
82
82
|
readonly linkedWith?: readonly string[];
|
|
83
|
+
/**
|
|
84
|
+
* The other packages whose version requirements this one's version choice interacts with, so the two cannot be
|
|
85
|
+
* picked independently (`A 0.2.5` requiring `B == 0.2.1` while `A 0.3.0` requires `B == 0.3.2`). A partner marked
|
|
86
|
+
* `(partial)` only requires (or is required by) this package in some of their versions.
|
|
87
|
+
*/
|
|
88
|
+
readonly coupledWith?: readonly string[];
|
|
83
89
|
/**
|
|
84
90
|
* Whether the analyzed code actually uses this package (a declared-but-never-used dependency is unconstrained):
|
|
85
91
|
* either a direct call, or the project's own NAMESPACE registering an S3 method for a class this package OWNS
|
|
@@ -100,6 +106,12 @@ export interface GuessDepVersionsQueryResult extends BaseQueryResult {
|
|
|
100
106
|
readonly runnableCombinations?: number;
|
|
101
107
|
/** the whole version space those tuples are drawn from (product of each counted factor's total versions) */
|
|
102
108
|
readonly possibleCombinations?: number;
|
|
109
|
+
/**
|
|
110
|
+
* The tuples the *declared* constraints alone leave, i.e. what the project already pins down before code usage and
|
|
111
|
+
* interdependencies are taken into account. Set only when something is declared and the `declared` source is active,
|
|
112
|
+
* so `runnableCombinations` relative to it says how much the guess added.
|
|
113
|
+
*/
|
|
114
|
+
readonly declaredCombinations?: number;
|
|
103
115
|
/** groups of packages interlinked to one shared version (the base/R group plus any configured groups), so their versions are not independent */
|
|
104
116
|
readonly linkedGroups?: readonly (readonly string[])[];
|
|
105
117
|
/** concrete version assignments, present when {@link GuessDepVersionsQuery.explode} was requested (most-preferred first) */
|