@eagleoutice/flowr 2.13.16 → 2.14.1
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 +36 -25
- package/abstract-interpretation/absint-visitor.js +1 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +18 -17
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +6 -6
- package/abstract-interpretation/data-frame/resolve-args.d.ts +9 -4
- package/abstract-interpretation/data-frame/resolve-args.js +10 -5
- package/benchmark/calibration.d.ts +16 -7
- package/benchmark/calibration.js +44 -17
- package/benchmark/slicer.d.ts +3 -2
- package/benchmark/slicer.js +9 -5
- package/benchmark/stats/size-of.js +1 -1
- package/benchmark/summarizer/first-phase/process.d.ts +2 -0
- package/benchmark/summarizer/first-phase/process.js +2 -0
- package/cli/benchmark-app.js +4 -1
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +2 -2
- package/cli/common/options.d.ts +5 -31
- package/cli/common/options.js +2 -8
- package/cli/common/scripts-info.d.ts +5 -38
- package/cli/common/scripts-info.js +0 -8
- package/cli/repl/core.js +1 -1
- package/cli/repl/execute.d.ts +2 -2
- package/cli/repl/execute.js +2 -2
- package/cli/repl/parser/slice-query-parser.js +1 -1
- package/cli/repl/print-version.js +2 -2
- package/config.d.ts +16 -0
- package/config.js +83 -5
- package/control-flow/extract-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +1 -1
- package/control-flow/useless-loop.js +1 -1
- package/core/print/slice-diff-ansi.js +1 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/dataflow/cluster.js +2 -2
- package/dataflow/environments/apply-kill.js +1 -1
- package/dataflow/environments/built-in-props.d.ts +13 -2
- package/dataflow/environments/built-in-props.js +23 -1
- package/dataflow/environments/built-in.d.ts +7 -1
- package/dataflow/environments/built-in.js +42 -3
- package/dataflow/environments/default-builtin-config.d.ts +518 -11
- package/dataflow/environments/default-builtin-config.js +218 -23
- package/dataflow/environments/environment.d.ts +10 -2
- package/dataflow/environments/environment.js +25 -7
- package/dataflow/environments/identifier.d.ts +8 -2
- package/dataflow/environments/identifier.js +6 -1
- package/dataflow/environments/query-fn-props.d.ts +6 -0
- package/dataflow/environments/query-fn-props.js +22 -2
- package/dataflow/environments/reference-to-maybe.js +5 -5
- package/dataflow/environments/resolve-by-name.d.ts +3 -0
- package/dataflow/environments/resolve-by-name.js +44 -7
- package/dataflow/environments/resolve-helper.d.ts +6 -0
- package/dataflow/environments/resolve-helper.js +6 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
- package/dataflow/eval/resolve/alias-tracking.js +21 -14
- package/dataflow/eval/resolve/node-value.d.ts +6 -0
- package/dataflow/eval/resolve/node-value.js +15 -9
- package/dataflow/eval/resolve/resolve-argument.js +2 -2
- package/dataflow/eval/resolve/resolve-numbers.js +2 -2
- package/dataflow/eval/resolve/resolve-operators.js +5 -4
- package/dataflow/eval/resolve/resolve-strings.js +3 -3
- package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
- package/dataflow/eval/resolve/resolve-working-directory.js +3 -3
- package/dataflow/eval/resolve/resolve.d.ts +5 -5
- package/dataflow/eval/resolve/resolve.js +10 -11
- package/dataflow/eval/values/general.d.ts +4 -1
- package/dataflow/eval/values/general.js +1 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/fn/exceptions-of-function.d.ts +3 -1
- package/dataflow/fn/exceptions-of-function.js +87 -39
- package/dataflow/fn/higher-order-function.js +5 -4
- package/dataflow/fn/strict-function.d.ts +40 -0
- package/dataflow/fn/strict-function.js +337 -0
- package/dataflow/graph/call-graph.js +14 -14
- package/dataflow/graph/df-helper.d.ts +24 -1
- package/dataflow/graph/df-helper.js +29 -7
- package/dataflow/graph/diff-dataflow-graph.js +6 -6
- package/dataflow/graph/edge.d.ts +27 -0
- package/dataflow/graph/edge.js +33 -0
- package/dataflow/graph/graph-helper.d.ts +3 -4
- package/dataflow/graph/graph-helper.js +4 -5
- package/dataflow/graph/graph.d.ts +39 -3
- package/dataflow/graph/graph.js +75 -7
- package/dataflow/graph/vertex.d.ts +42 -6
- package/dataflow/graph/vertex.js +42 -6
- package/dataflow/info.d.ts +26 -0
- package/dataflow/info.js +28 -1
- package/dataflow/internal/linker.d.ts +1 -0
- package/dataflow/internal/linker.js +11 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +29 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +44 -20
- package/dataflow/internal/process/functions/call/common.d.ts +9 -1
- package/dataflow/internal/process/functions/call/common.js +17 -6
- package/dataflow/internal/process/functions/call/deferred.js +2 -1
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
- package/dataflow/internal/process/functions/call/nse.d.ts +33 -5
- package/dataflow/internal/process/functions/call/nse.js +113 -6
- package/dataflow/internal/process/functions/call/quoted.d.ts +5 -0
- package/dataflow/internal/process/functions/call/quoted.js +21 -9
- package/dataflow/origin/dfg-get-origin.d.ts +1 -0
- package/dataflow/origin/dfg-get-origin.js +9 -6
- package/documentation/data/faq/faqs.js +88 -88
- package/documentation/data/faq/recommended-configs.js +1 -1
- package/documentation/data/faq/wiki-faq-store.js +1 -1
- package/documentation/doc-capabilities.js +1 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-auto-gen.js +6 -2
- package/documentation/doc-util/doc-functions.js +1 -1
- package/documentation/wiki-cfg.js +2 -2
- package/documentation/wiki-core.js +1 -1
- package/documentation/wiki-create-linting-rules.js +45 -45
- package/documentation/wiki-dataflow-graph.js +18 -18
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-linting-and-testing.js +93 -5
- package/documentation/wiki-mk/doc-maker.js +1 -1
- package/documentation/wiki-overview.js +12 -1
- package/documentation/wiki-query.js +53 -0
- package/documentation/wiki-signature-database.js +3 -0
- package/linter/linter-output.js +1 -1
- package/linter/linter-rules.d.ts +24 -0
- package/linter/linter-rules.js +3 -1
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/function-finder-util.js +1 -1
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/no-leaked-credentials.js +2 -1
- package/linter/rules/stop-with-call-arg.js +4 -4
- package/linter/rules/unclosed-connection.d.ts +44 -0
- package/linter/rules/unclosed-connection.js +200 -0
- package/linter/rules/undefined-symbol-util.d.ts +1 -1
- package/linter/rules/undefined-symbol-util.js +5 -4
- package/linter/rules/undefined-symbol.js +3 -3
- package/linter/rules/unused-definition.js +2 -1
- package/package.json +38 -51
- package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
- package/project/context/flowr-analyzer-environment-context.js +25 -0
- package/project/dependency-version-space.d.ts +3 -3
- package/project/dependency-version-space.js +3 -4
- package/project/flowr-analyzer.js +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -4
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +36 -7
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- package/project/sigdb/build.js +16 -16
- package/project/sigdb/codec.d.ts +1 -1
- package/project/sigdb/codec.js +13 -13
- package/project/sigdb/decompress.d.ts +1 -1
- package/project/sigdb/decompress.js +33 -33
- package/project/sigdb/index-format.js +2 -2
- package/project/sigdb/manifest.d.ts +3 -1
- package/project/sigdb/manifest.js +68 -27
- package/project/sigdb/memory-source.d.ts +64 -0
- package/project/sigdb/memory-source.js +133 -0
- package/project/sigdb/reader.js +14 -14
- package/project/sigdb/schema.d.ts +2 -2
- package/project/sigdb/schema.js +2 -2
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/dependencies-query/link-devices.js +3 -9
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
- package/queries/catalog/signature-query/signature-query-executor.js +3 -2
- package/queries/catalog/slice-query-options.d.ts +1 -1
- package/queries/catalog/slice-query-options.js +1 -1
- package/queries/query-function-filter.d.ts +8 -2
- package/queries/query-function-filter.js +11 -1
- package/queries/query.d.ts +11 -1
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/model.js +4 -4
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/retriever.d.ts +2 -1
- package/r-bridge/retriever.js +3 -2
- package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
- package/r-bridge/roxygen2/documentation-provider.js +1 -0
- package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
- package/r-bridge/roxygen2/roxygen-parse.js +1 -1
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-filters.js +2 -14
- package/search/search-executor/search-enrichers.js +4 -4
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +2 -2
- package/slicing/criterion/parse.js +5 -5
- package/slicing/static/fingerprint.js +1 -1
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +2 -2
- package/slicing/static/static-slicer.js +4 -3
- package/util/assert.js +1 -1
- package/util/log.d.ts +4 -1
- package/util/log.js +15 -2
- package/util/logic.js +2 -2
- package/util/mermaid/cfg.js +1 -1
- package/util/mermaid/dfg.js +6 -6
- package/util/mermaid/mermaid.js +3 -1
- package/util/objects.d.ts +12 -0
- package/util/objects.js +48 -0
- package/util/quads.js +19 -6
- package/util/schema.js +2 -2
- package/util/simple-df/dfg-ascii.js +14 -3
- package/util/text/ansi.d.ts +2 -0
- package/util/text/ansi.js +8 -0
- package/util/text/name-rank.d.ts +29 -0
- package/util/text/name-rank.js +39 -0
- package/util/text/url-encoding.d.ts +15 -0
- package/util/text/url-encoding.js +59 -0
- package/util/version.js +1 -1
- package/cli/export-quads-app.d.ts +0 -7
- package/cli/export-quads-app.js +0 -44
|
@@ -57,12 +57,14 @@ export declare function readManifestDate(manifestFile: string): string | undefin
|
|
|
57
57
|
export type SigDbScope = 'base' | 'current' | 'full';
|
|
58
58
|
/**
|
|
59
59
|
* Location of a bundled sigdb **manifest**, found by walking up from several roots (this module,
|
|
60
|
-
* `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`) and data-mount
|
|
60
|
+
* `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`), and data-mount
|
|
61
61
|
* layouts. With no `scope` it returns the richest available (`full` > `current` > `base`), so a
|
|
62
62
|
* container that ships the full set uses it automatically while a plain npm install falls back to the
|
|
63
63
|
* bundled `base`. Node only (needs `fs`); pass `searchRoots` to override where it looks.
|
|
64
64
|
*/
|
|
65
65
|
export declare function defaultSigDbPath(scope?: SigDbScope, searchRoots?: readonly string[]): string | undefined;
|
|
66
|
+
/** Forget what {@link defaultSigDbPaths} discovered, so the next call scans the filesystem again. */
|
|
67
|
+
export declare function clearDefaultSigDbPathsMemo(): void;
|
|
66
68
|
/**
|
|
67
69
|
* Every distinct sigdb bundle discoverable in the search dirs (see {@link defaultSigDbPath}) -- not just the
|
|
68
70
|
* richest scope. So dropping an extra bundle next to the shipped default (a downloaded full-history
|
|
@@ -8,14 +8,15 @@ exports.writeManifest = writeManifest;
|
|
|
8
8
|
exports.readManifestFile = readManifestFile;
|
|
9
9
|
exports.readManifestDate = readManifestDate;
|
|
10
10
|
exports.defaultSigDbPath = defaultSigDbPath;
|
|
11
|
+
exports.clearDefaultSigDbPathsMemo = clearDefaultSigDbPathsMemo;
|
|
11
12
|
exports.defaultSigDbPaths = defaultSigDbPaths;
|
|
12
13
|
/**
|
|
13
14
|
* The sharded-database manifest format (shard/dictionary descriptors that route a set of shard files as one
|
|
14
15
|
* database), reading/writing it, and discovering the bundled manifests/bundles on flowR's search path. Split
|
|
15
16
|
* out of `../sigdb` as pure format + filesystem discovery, with no dependency on the reader/writer classes.
|
|
16
17
|
*/
|
|
17
|
-
const
|
|
18
|
-
const
|
|
18
|
+
const fs_1 = __importDefault(require("fs"));
|
|
19
|
+
const path_1 = __importDefault(require("path"));
|
|
19
20
|
const schema_1 = require("./schema");
|
|
20
21
|
const codec_1 = require("./codec");
|
|
21
22
|
const decompress_1 = require("./decompress");
|
|
@@ -23,11 +24,11 @@ exports.SigDbManifestMagic = 'flowr-sigdb-manifest';
|
|
|
23
24
|
exports.SigDbManifestSchema = 2;
|
|
24
25
|
/** write a {@link SigDbManifest} (compact JSON) plus a compressed copy per available codec (`.br` always, `.zst` when supported) beside it */
|
|
25
26
|
function writeManifest(file, manifest) {
|
|
26
|
-
|
|
27
|
+
fs_1.default.mkdirSync(path_1.default.dirname(path_1.default.resolve(file)), { recursive: true });
|
|
27
28
|
const json = JSON.stringify(manifest);
|
|
28
|
-
|
|
29
|
+
fs_1.default.writeFileSync(file, json);
|
|
29
30
|
for (const spec of (0, codec_1.writeCodecs)()) {
|
|
30
|
-
|
|
31
|
+
fs_1.default.writeFileSync(`${file}${spec.ext}`, spec.compressSync(json, { level: 11, sizeHint: json.length }));
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
/** how cheap a file is to read (lower is better); one we cannot decompress here sorts last */
|
|
@@ -44,7 +45,7 @@ function readManifestFile(manifestFile) {
|
|
|
44
45
|
return JSON.parse(readManifestText(manifestFile));
|
|
45
46
|
}
|
|
46
47
|
function readManifestText(manifestFile) {
|
|
47
|
-
const raw =
|
|
48
|
+
const raw = fs_1.default.readFileSync(manifestFile);
|
|
48
49
|
return (0, codec_1.compressedExtOf)(manifestFile) ? (0, codec_1.decompressSyncFor)(manifestFile, raw).toString('utf8') : raw.toString('utf8');
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
@@ -58,21 +59,24 @@ function readManifestDate(manifestFile) {
|
|
|
58
59
|
}
|
|
59
60
|
/** richest first: a container shipping the full set uses it, else the slim `current`, else the `base` floor */
|
|
60
61
|
const SigDbScopeOrder = ['full', 'current', 'base'];
|
|
61
|
-
/** layouts a bundled sigdb may sit in, relative to a search root -- the root itself (e.g. a `$FLOWR_SIGDB_DIR` data mount), then the dev `src`, build `dist
|
|
62
|
+
/** layouts a bundled sigdb may sit in, relative to a search root -- the root itself (e.g. a `$FLOWR_SIGDB_DIR` data mount), then the dev `src`, build `dist`, and data-dir layouts */
|
|
62
63
|
const SigDbSubDirs = ['', 'data/sigdb', 'src/data/sigdb', 'dist/src/data/sigdb'];
|
|
63
64
|
/** a `<scope>.manifest.json`, in any of the codecs we can read */
|
|
64
65
|
const ManifestFilePattern = new RegExp(`\\.manifest\\.json${codec_1.CompressedExtPattern}$`);
|
|
65
66
|
/** a `<name>.sigs.ndjson` bundle, in any of the codecs we can read */
|
|
66
67
|
const BundleFilePattern = new RegExp(`${schema_1.SigDbExt.replace(/\./g, '\\.')}${codec_1.CompressedExtPattern}$`);
|
|
67
|
-
function sigDbBundleDirs() {
|
|
68
|
-
if (typeof
|
|
68
|
+
function sigDbBundleDirs(watched) {
|
|
69
|
+
if (typeof fs_1.default?.readdirSync !== 'function') {
|
|
69
70
|
return [];
|
|
70
71
|
}
|
|
71
72
|
try {
|
|
72
|
-
const bundles =
|
|
73
|
-
|
|
73
|
+
const bundles = path_1.default.join((0, decompress_1.sigDbCacheDir)(undefined, false), 'bundles');
|
|
74
|
+
const mtimeMs = fs_1.default.statSync(bundles).mtimeMs;
|
|
75
|
+
const dirs = fs_1.default.readdirSync(bundles, { withFileTypes: true })
|
|
74
76
|
.filter(e => e.isDirectory())
|
|
75
|
-
.map(e =>
|
|
77
|
+
.map(e => path_1.default.join(bundles, e.name));
|
|
78
|
+
watched?.push([bundles, mtimeMs]); // a bundle directory appearing here has to be picked up too
|
|
79
|
+
return dirs;
|
|
76
80
|
}
|
|
77
81
|
catch {
|
|
78
82
|
return [];
|
|
@@ -83,7 +87,7 @@ function sigDbSearchRoots(extra) {
|
|
|
83
87
|
const roots = [...(extra ?? [])];
|
|
84
88
|
const env = typeof process !== 'undefined' ? process.env?.FLOWR_SIGDB_DIR : undefined;
|
|
85
89
|
if (env) {
|
|
86
|
-
roots.push(...env.split(
|
|
90
|
+
roots.push(...env.split(path_1.default.delimiter).filter(Boolean));
|
|
87
91
|
}
|
|
88
92
|
if (typeof __dirname !== 'undefined') {
|
|
89
93
|
roots.push(__dirname);
|
|
@@ -95,13 +99,13 @@ function sigDbSearchRoots(extra) {
|
|
|
95
99
|
}
|
|
96
100
|
/**
|
|
97
101
|
* Location of a bundled sigdb **manifest**, found by walking up from several roots (this module,
|
|
98
|
-
* `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`) and data-mount
|
|
102
|
+
* `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`), and data-mount
|
|
99
103
|
* layouts. With no `scope` it returns the richest available (`full` > `current` > `base`), so a
|
|
100
104
|
* container that ships the full set uses it automatically while a plain npm install falls back to the
|
|
101
105
|
* bundled `base`. Node only (needs `fs`); pass `searchRoots` to override where it looks.
|
|
102
106
|
*/
|
|
103
107
|
function defaultSigDbPath(scope, searchRoots) {
|
|
104
|
-
if (typeof
|
|
108
|
+
if (typeof fs_1.default?.existsSync !== 'function') {
|
|
105
109
|
return undefined;
|
|
106
110
|
}
|
|
107
111
|
const scopes = scope ? [scope] : SigDbScopeOrder;
|
|
@@ -109,8 +113,8 @@ function defaultSigDbPath(scope, searchRoots) {
|
|
|
109
113
|
for (const sub of SigDbSubDirs) {
|
|
110
114
|
for (const s of scopes) {
|
|
111
115
|
for (const suffix of ['', ...(0, codec_1.readableExtsPreferred)()]) {
|
|
112
|
-
const candidate =
|
|
113
|
-
if (
|
|
116
|
+
const candidate = path_1.default.join(dir, sub, `${s}.manifest.json${suffix}`);
|
|
117
|
+
if (fs_1.default.existsSync(candidate)) {
|
|
114
118
|
return candidate;
|
|
115
119
|
}
|
|
116
120
|
}
|
|
@@ -124,7 +128,7 @@ function defaultSigDbPath(scope, searchRoots) {
|
|
|
124
128
|
if (hit !== undefined) {
|
|
125
129
|
return hit;
|
|
126
130
|
}
|
|
127
|
-
const parent =
|
|
131
|
+
const parent = path_1.default.dirname(dir);
|
|
128
132
|
if (parent === dir) {
|
|
129
133
|
break;
|
|
130
134
|
}
|
|
@@ -139,6 +143,31 @@ function defaultSigDbPath(scope, searchRoots) {
|
|
|
139
143
|
}
|
|
140
144
|
return undefined;
|
|
141
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Memo for {@link defaultSigDbPaths}, keyed by the resolved search roots. The scan costs ~70 `readdirSync` calls
|
|
148
|
+
* to answer with a handful of paths and an analyzer asks for it once on construction, so a per-analyzer run
|
|
149
|
+
* repeats it for nothing. Kept honest by remembering the modification time of every directory the scan read: a
|
|
150
|
+
* bundle dropped next to the shipped ones bumps that directory and the next call rescans.
|
|
151
|
+
*/
|
|
152
|
+
const defaultSigDbPathsMemo = new Map();
|
|
153
|
+
/** Forget what {@link defaultSigDbPaths} discovered, so the next call scans the filesystem again. */
|
|
154
|
+
function clearDefaultSigDbPathsMemo() {
|
|
155
|
+
defaultSigDbPathsMemo.clear();
|
|
156
|
+
}
|
|
157
|
+
/** Whether every directory the memoized scan read still carries the modification time it had back then */
|
|
158
|
+
function memoizedScanStillCurrent(watched) {
|
|
159
|
+
for (const [dir, mtimeMs] of watched) {
|
|
160
|
+
try {
|
|
161
|
+
if (fs_1.default.statSync(dir).mtimeMs !== mtimeMs) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return false; // the directory went away
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
142
171
|
/**
|
|
143
172
|
* Every distinct sigdb bundle discoverable in the search dirs (see {@link defaultSigDbPath}) -- not just the
|
|
144
173
|
* richest scope. So dropping an extra bundle next to the shipped default (a downloaded full-history
|
|
@@ -147,9 +176,17 @@ function defaultSigDbPath(scope, searchRoots) {
|
|
|
147
176
|
* shard and dictionary files a manifest already owns are skipped. Deduped by filename, first search location wins.
|
|
148
177
|
*/
|
|
149
178
|
function defaultSigDbPaths(searchRoots) {
|
|
150
|
-
if (typeof
|
|
179
|
+
if (typeof fs_1.default?.readdirSync !== 'function') {
|
|
151
180
|
return [];
|
|
152
181
|
}
|
|
182
|
+
const roots = sigDbSearchRoots(searchRoots);
|
|
183
|
+
const memoKey = roots.join('\0');
|
|
184
|
+
const memoized = defaultSigDbPathsMemo.get(memoKey);
|
|
185
|
+
if (memoized !== undefined && memoizedScanStillCurrent(memoized.watched)) {
|
|
186
|
+
return [...memoized.paths];
|
|
187
|
+
}
|
|
188
|
+
/** every directory the scan below read, with its modification time taken _before_ the read so a concurrent write invalidates rather than sticks */
|
|
189
|
+
const watched = [];
|
|
153
190
|
const manifests = new Map(); // `<name>.manifest.json` (ignoring compression ext) -> first-found path
|
|
154
191
|
const standalones = new Map(); // `<name>.sigs.ndjson` (ignoring compression ext) -> first-found path
|
|
155
192
|
const foundIn = new Map(); // where a key was first found, to only compare codecs within one directory
|
|
@@ -166,35 +203,37 @@ function defaultSigDbPaths(searchRoots) {
|
|
|
166
203
|
};
|
|
167
204
|
const scanDir = (base) => {
|
|
168
205
|
for (const sub of SigDbSubDirs) {
|
|
206
|
+
const dir = path_1.default.join(base, sub);
|
|
169
207
|
let entries;
|
|
170
208
|
try {
|
|
171
|
-
|
|
209
|
+
const mtimeMs = fs_1.default.statSync(dir).mtimeMs;
|
|
210
|
+
entries = fs_1.default.readdirSync(dir);
|
|
211
|
+
watched.push([dir, mtimeMs]);
|
|
172
212
|
}
|
|
173
213
|
catch {
|
|
174
214
|
continue; // directory does not exist on this root
|
|
175
215
|
}
|
|
176
|
-
const dir = node_path_1.default.join(base, sub);
|
|
177
216
|
for (const file of entries) {
|
|
178
217
|
if (ManifestFilePattern.test(file)) {
|
|
179
|
-
keep(manifests, (0, codec_1.stripCompressedExt)(file),
|
|
218
|
+
keep(manifests, (0, codec_1.stripCompressedExt)(file), path_1.default.join(dir, file), dir);
|
|
180
219
|
}
|
|
181
220
|
else if (BundleFilePattern.test(file) && !file.includes('.dict' + schema_1.SigDbExt)) {
|
|
182
|
-
keep(standalones, (0, codec_1.stripCompressedExt)(file),
|
|
221
|
+
keep(standalones, (0, codec_1.stripCompressedExt)(file), path_1.default.join(dir, file), dir);
|
|
183
222
|
}
|
|
184
223
|
}
|
|
185
224
|
}
|
|
186
225
|
};
|
|
187
|
-
for (const root of
|
|
226
|
+
for (const root of roots) {
|
|
188
227
|
for (let dir = root, i = 0; i < 10; i++) {
|
|
189
228
|
scanDir(dir);
|
|
190
|
-
const parent =
|
|
229
|
+
const parent = path_1.default.dirname(dir);
|
|
191
230
|
if (parent === dir) {
|
|
192
231
|
break;
|
|
193
232
|
}
|
|
194
233
|
dir = parent;
|
|
195
234
|
}
|
|
196
235
|
}
|
|
197
|
-
for (const bundle of sigDbBundleDirs()) {
|
|
236
|
+
for (const bundle of sigDbBundleDirs(watched)) {
|
|
198
237
|
scanDir(bundle);
|
|
199
238
|
}
|
|
200
239
|
// a standalone bundle is a `.sigs.ndjson` that is not a shard of a discovered manifest (`<manifest>.<shard>...`)
|
|
@@ -210,6 +249,8 @@ function defaultSigDbPaths(searchRoots) {
|
|
|
210
249
|
const orderedManifests = [...manifests.entries()]
|
|
211
250
|
.sort((a, b) => scopeRank(a[0]) - scopeRank(b[0]) || a[0].localeCompare(b[0])).map(([, p]) => p);
|
|
212
251
|
const bundles = standalones.entries().filter(([name]) => !isShard(name)).map(([, p]) => p);
|
|
213
|
-
|
|
252
|
+
const paths = [...orderedManifests, ...bundles];
|
|
253
|
+
defaultSigDbPathsMemo.set(memoKey, { paths, watched });
|
|
254
|
+
return [...paths];
|
|
214
255
|
}
|
|
215
256
|
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { PackageSignatureSource } from './reader';
|
|
2
|
+
import type { VersionRelease } from './sigdb-version';
|
|
3
|
+
import type { LibraryExports } from './schema';
|
|
4
|
+
import type { ResolvedDependency } from './decode';
|
|
5
|
+
import { RVersion } from '../../util/r-version';
|
|
6
|
+
/**
|
|
7
|
+
* One package as {@link MemorySignatureSource} carries it: the exports are what attaching it brings, the rest
|
|
8
|
+
* is what the answers below need to stay honest. Everything but the name and the exports is optional, so a
|
|
9
|
+
* caller may ship no more than it has.
|
|
10
|
+
*/
|
|
11
|
+
export interface MemoryPackage {
|
|
12
|
+
readonly version?: string;
|
|
13
|
+
readonly exported: readonly string[];
|
|
14
|
+
readonly deprecated?: readonly string[];
|
|
15
|
+
readonly s3Classes?: readonly string[];
|
|
16
|
+
readonly s4Classes?: readonly string[];
|
|
17
|
+
readonly downloads?: number;
|
|
18
|
+
readonly deps?: readonly ResolvedDependency[];
|
|
19
|
+
/** when that version was released, which is what makes it a release rather than a label */
|
|
20
|
+
readonly released?: Date;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A signature source held entirely in memory, for the places that cannot open a database file: a browser
|
|
24
|
+
* (the playground bundles its packages rather than reading them) and a test that wants to state a package's
|
|
25
|
+
* exports outright. It answers what a package brings into scope; the per-function view a real database
|
|
26
|
+
* decodes from its blobs is not part of what it can say, so those answers stay empty.
|
|
27
|
+
* @see {@link SigDatabase} - the file-backed source
|
|
28
|
+
*/
|
|
29
|
+
export declare class MemorySignatureSource implements PackageSignatureSource {
|
|
30
|
+
private readonly packages;
|
|
31
|
+
/** reverse index `class -> owning package`, built on first use (see {@link classOwner}) */
|
|
32
|
+
private classIndex;
|
|
33
|
+
constructor(packages: Readonly<Record<string, MemoryPackage>> | ReadonlyMap<string, MemoryPackage>);
|
|
34
|
+
has(pkg: string): boolean;
|
|
35
|
+
hasVersion(pkg: string, version: string): boolean;
|
|
36
|
+
isCranVersion(pkg: string, version: string): boolean;
|
|
37
|
+
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
38
|
+
packagesExporting(name: string): readonly string[];
|
|
39
|
+
classOwner(className: string, version?: string): string | undefined;
|
|
40
|
+
/** no blobs to decode, so the rich per-function view has nothing to give */
|
|
41
|
+
functions(): undefined;
|
|
42
|
+
functionByName(): undefined;
|
|
43
|
+
transitiveCallees(): undefined;
|
|
44
|
+
dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
|
|
45
|
+
packageNames(): string[];
|
|
46
|
+
isBaseR(pkg: string): boolean;
|
|
47
|
+
downloads(pkg: string): number;
|
|
48
|
+
/** the R releases a base package shipped with are a property of the database, which this source has none of */
|
|
49
|
+
coreVersions(): undefined;
|
|
50
|
+
releaseDate(pkg: string): Date | undefined;
|
|
51
|
+
releaseDates(pkg: string): VersionRelease[];
|
|
52
|
+
latestVersion(pkg: string): RVersion | undefined;
|
|
53
|
+
/** nothing is held open */
|
|
54
|
+
close(): void;
|
|
55
|
+
/** whether the package answers a lookup for `version`, which an unversioned one always does */
|
|
56
|
+
private answersFor;
|
|
57
|
+
private versionOf;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A {@link MemorySignatureSource} from what a page can carry: `package -> [version, release date, ...exports]`.
|
|
61
|
+
* The version is what the exports were read from, so recording it is what keeps a consumer from being told
|
|
62
|
+
* the package is unknown when only its history is.
|
|
63
|
+
*/
|
|
64
|
+
export declare function memorySourceOfPackages(packages: Readonly<Record<string, readonly string[]>>): MemorySignatureSource;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemorySignatureSource = void 0;
|
|
4
|
+
exports.memorySourceOfPackages = memorySourceOfPackages;
|
|
5
|
+
const r_version_1 = require("../../util/r-version");
|
|
6
|
+
const reader_1 = require("./reader");
|
|
7
|
+
const r_base_packages_1 = require("../../util/r-base-packages");
|
|
8
|
+
/** what {@link LibraryExports.version} says when the source was given no version to claim */
|
|
9
|
+
const UnknownVersion = '';
|
|
10
|
+
/**
|
|
11
|
+
* A signature source held entirely in memory, for the places that cannot open a database file: a browser
|
|
12
|
+
* (the playground bundles its packages rather than reading them) and a test that wants to state a package's
|
|
13
|
+
* exports outright. It answers what a package brings into scope; the per-function view a real database
|
|
14
|
+
* decodes from its blobs is not part of what it can say, so those answers stay empty.
|
|
15
|
+
* @see {@link SigDatabase} - the file-backed source
|
|
16
|
+
*/
|
|
17
|
+
class MemorySignatureSource {
|
|
18
|
+
packages;
|
|
19
|
+
/** reverse index `class -> owning package`, built on first use (see {@link classOwner}) */
|
|
20
|
+
classIndex;
|
|
21
|
+
constructor(packages) {
|
|
22
|
+
this.packages = packages instanceof Map ? packages : new Map(Object.entries(packages));
|
|
23
|
+
}
|
|
24
|
+
has(pkg) {
|
|
25
|
+
return this.packages.has(pkg);
|
|
26
|
+
}
|
|
27
|
+
hasVersion(pkg, version) {
|
|
28
|
+
const known = this.versionOf(pkg);
|
|
29
|
+
return known !== UnknownVersion && known === version;
|
|
30
|
+
}
|
|
31
|
+
isCranVersion(pkg, version) {
|
|
32
|
+
return this.hasVersion(pkg, version);
|
|
33
|
+
}
|
|
34
|
+
lookup(pkg, version) {
|
|
35
|
+
const found = this.packages.get(pkg);
|
|
36
|
+
/* a source given no version has one answer and gives it whatever is asked for: it cannot say no */
|
|
37
|
+
if (found === undefined || !this.answersFor(pkg, version)) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
version: this.versionOf(pkg),
|
|
42
|
+
exported: found.exported,
|
|
43
|
+
internal: [],
|
|
44
|
+
deprecated: found.deprecated ?? [],
|
|
45
|
+
s3Classes: found.s3Classes ?? [],
|
|
46
|
+
s4Classes: found.s4Classes ?? [],
|
|
47
|
+
cran: true
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
packagesExporting(name) {
|
|
51
|
+
return [...this.packages]
|
|
52
|
+
.filter(([, p]) => p.exported.includes(name))
|
|
53
|
+
.sort(([an, a], [bn, b]) => (b.downloads ?? 0) - (a.downloads ?? 0) || an.localeCompare(bn))
|
|
54
|
+
.map(([pkg]) => pkg);
|
|
55
|
+
}
|
|
56
|
+
classOwner(className, version) {
|
|
57
|
+
if (version !== undefined) {
|
|
58
|
+
return this.packageNames().find(pkg => {
|
|
59
|
+
const lib = this.lookup(pkg, version);
|
|
60
|
+
return (lib?.s3Classes.includes(className) ?? false) || (lib?.s4Classes.includes(className) ?? false);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
this.classIndex ??= (0, reader_1.classOwnerIndexFor)(this, this.packageNames());
|
|
64
|
+
return this.classIndex.get(className);
|
|
65
|
+
}
|
|
66
|
+
/** no blobs to decode, so the rich per-function view has nothing to give */
|
|
67
|
+
functions() {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
functionByName() {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
transitiveCallees() {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
dependencies(pkg, version) {
|
|
77
|
+
const found = this.packages.get(pkg);
|
|
78
|
+
if (found === undefined || !this.answersFor(pkg, version)) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
return [...found.deps ?? []];
|
|
82
|
+
}
|
|
83
|
+
packageNames() {
|
|
84
|
+
return [...this.packages.keys()];
|
|
85
|
+
}
|
|
86
|
+
isBaseR(pkg) {
|
|
87
|
+
return (0, r_base_packages_1.baseRPackages)().includes(pkg);
|
|
88
|
+
}
|
|
89
|
+
downloads(pkg) {
|
|
90
|
+
return this.packages.get(pkg)?.downloads ?? 0;
|
|
91
|
+
}
|
|
92
|
+
/** the R releases a base package shipped with are a property of the database, which this source has none of */
|
|
93
|
+
coreVersions() {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
releaseDate(pkg) {
|
|
97
|
+
return this.packages.get(pkg)?.released;
|
|
98
|
+
}
|
|
99
|
+
releaseDates(pkg) {
|
|
100
|
+
const version = this.latestVersion(pkg);
|
|
101
|
+
const date = this.releaseDate(pkg);
|
|
102
|
+
return version === undefined || date === undefined ? [] : [{ version, date }];
|
|
103
|
+
}
|
|
104
|
+
latestVersion(pkg) {
|
|
105
|
+
const known = this.versionOf(pkg);
|
|
106
|
+
return known === UnknownVersion ? undefined : r_version_1.RVersion.parse(known);
|
|
107
|
+
}
|
|
108
|
+
/** nothing is held open */
|
|
109
|
+
close() {
|
|
110
|
+
/* nothing to release */
|
|
111
|
+
}
|
|
112
|
+
/** whether the package answers a lookup for `version`, which an unversioned one always does */
|
|
113
|
+
answersFor(pkg, version) {
|
|
114
|
+
return version === undefined || this.versionOf(pkg) === UnknownVersion || this.versionOf(pkg) === version;
|
|
115
|
+
}
|
|
116
|
+
versionOf(pkg) {
|
|
117
|
+
return this.packages.get(pkg)?.version ?? UnknownVersion;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.MemorySignatureSource = MemorySignatureSource;
|
|
121
|
+
/**
|
|
122
|
+
* A {@link MemorySignatureSource} from what a page can carry: `package -> [version, release date, ...exports]`.
|
|
123
|
+
* The version is what the exports were read from, so recording it is what keeps a consumer from being told
|
|
124
|
+
* the package is unknown when only its history is.
|
|
125
|
+
*/
|
|
126
|
+
function memorySourceOfPackages(packages) {
|
|
127
|
+
return new MemorySignatureSource(Object.fromEntries(Object.entries(packages).map(([pkg, [version = '', released = '', ...exported]]) => [pkg, {
|
|
128
|
+
exported,
|
|
129
|
+
version: version.length > 0 ? version : undefined,
|
|
130
|
+
released: released.length > 0 ? new Date(released) : undefined
|
|
131
|
+
}])));
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=memory-source.js.map
|
package/project/sigdb/reader.js
CHANGED
|
@@ -17,9 +17,9 @@ exports.verifyShardedDatabase = verifyShardedDatabase;
|
|
|
17
17
|
* whole-bundle reading, and the post-write verification gate. This is the surface the package-version plugin
|
|
18
18
|
* uses; the format/codec/writer building blocks live in the sibling `sigdb/*` modules (imported directly).
|
|
19
19
|
*/
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
20
|
+
const fs_1 = __importDefault(require("fs"));
|
|
21
|
+
const path_1 = __importDefault(require("path"));
|
|
22
|
+
const readline_1 = __importDefault(require("readline"));
|
|
23
23
|
const r_version_1 = require("../../util/r-version");
|
|
24
24
|
const schema_1 = require("./schema");
|
|
25
25
|
const sigdb_version_1 = require("./sigdb-version");
|
|
@@ -52,7 +52,7 @@ function readDictSection(buf, strings) {
|
|
|
52
52
|
}
|
|
53
53
|
/** stream-read a whole bundle into a {@link SigDb} (any size; never one string). Prefer {@link SigDatabase} for partial access. */
|
|
54
54
|
async function readSignatureDb(file) {
|
|
55
|
-
const rl =
|
|
55
|
+
const rl = readline_1.default.createInterface({ input: (0, decompress_1.sigDbStream)(file), crlfDelay: Infinity });
|
|
56
56
|
let header;
|
|
57
57
|
const strings = [];
|
|
58
58
|
const blobs = [];
|
|
@@ -316,9 +316,9 @@ class SigDatabase {
|
|
|
316
316
|
throw new Error('SigDatabase.openSync needs the plain .sigs.ndjson; use open() for .br/.zst/.gz');
|
|
317
317
|
}
|
|
318
318
|
const index = opts.index ?? (0, index_format_1.readSigDbIndex)(plainFile);
|
|
319
|
-
const fd =
|
|
319
|
+
const fd = fs_1.default.openSync(plainFile, 'r');
|
|
320
320
|
const head = Buffer.allocUnsafe(Math.min(65536, index.byteCount));
|
|
321
|
-
|
|
321
|
+
fs_1.default.readSync(fd, head, 0, head.length, 0);
|
|
322
322
|
const header = (0, decompress_1.parseHeader)(head.toString('utf8'));
|
|
323
323
|
let strings = opts.strings;
|
|
324
324
|
if (!strings) {
|
|
@@ -326,7 +326,7 @@ class SigDatabase {
|
|
|
326
326
|
const [dictStart, dictBytes] = index.dict;
|
|
327
327
|
if (dictBytes > 0) {
|
|
328
328
|
const buf = Buffer.allocUnsafe(dictBytes);
|
|
329
|
-
|
|
329
|
+
fs_1.default.readSync(fd, buf, 0, dictBytes, dictStart);
|
|
330
330
|
readDictSection(buf, strings);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
@@ -427,7 +427,7 @@ class SigDatabase {
|
|
|
427
427
|
/** seek to a byte range, read + decode the package blob there (no caching) */
|
|
428
428
|
readBlobAt([start, bytes]) {
|
|
429
429
|
const buf = Buffer.allocUnsafe(bytes);
|
|
430
|
-
|
|
430
|
+
fs_1.default.readSync(this.fd, buf, 0, bytes, start);
|
|
431
431
|
const [, , tuple] = JSON.parse(buf.toString('utf8'));
|
|
432
432
|
return (0, decode_1.tupleToBlob)(tuple);
|
|
433
433
|
}
|
|
@@ -469,7 +469,7 @@ class SigDatabase {
|
|
|
469
469
|
return [];
|
|
470
470
|
}
|
|
471
471
|
const found = [];
|
|
472
|
-
for (const pkg
|
|
472
|
+
for (const pkg in this.index.pkgs) {
|
|
473
473
|
if (this.mayOffer(pkg, name) && this.lookup(pkg)?.exported.includes(name)) {
|
|
474
474
|
found.push(pkg);
|
|
475
475
|
}
|
|
@@ -592,7 +592,7 @@ class SigDatabase {
|
|
|
592
592
|
this.blobCache.clear();
|
|
593
593
|
this.classIndex = undefined;
|
|
594
594
|
if (this.fd !== NoFile) {
|
|
595
|
-
|
|
595
|
+
fs_1.default.closeSync(this.fd);
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
598
|
}
|
|
@@ -636,7 +636,7 @@ class SigDatabaseSet {
|
|
|
636
636
|
}
|
|
637
637
|
/** read + validate a manifest and apply the include/exclude shard filter */
|
|
638
638
|
static prepManifest(manifestFile, opts) {
|
|
639
|
-
const baseDir =
|
|
639
|
+
const baseDir = path_1.default.dirname(manifestFile);
|
|
640
640
|
const full = (0, manifest_1.readManifestFile)(manifestFile);
|
|
641
641
|
if (full.format !== manifest_1.SigDbManifestMagic) {
|
|
642
642
|
throw new Error(`not a ${manifest_1.SigDbManifestMagic} (got ${String(full.format)})`);
|
|
@@ -698,15 +698,15 @@ class SigDatabaseSet {
|
|
|
698
698
|
}
|
|
699
699
|
const plain = (0, decompress_1.ensurePlainSync)((0, decompress_1.resolveSource)(this.baseDir, ref.path), { cacheDir: this.cacheDir, hash: ref.hash, indexless: true });
|
|
700
700
|
const strings = [];
|
|
701
|
-
const fd =
|
|
701
|
+
const fd = fs_1.default.openSync(plain, 'r');
|
|
702
702
|
try {
|
|
703
703
|
const [start, bytes] = ref.range;
|
|
704
704
|
const buf = Buffer.allocUnsafe(bytes);
|
|
705
|
-
|
|
705
|
+
fs_1.default.readSync(fd, buf, 0, bytes, start);
|
|
706
706
|
readDictSection(buf, strings);
|
|
707
707
|
}
|
|
708
708
|
finally {
|
|
709
|
-
|
|
709
|
+
fs_1.default.closeSync(fd);
|
|
710
710
|
}
|
|
711
711
|
this.dictCache.set(dictId, strings);
|
|
712
712
|
return strings;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms
|
|
3
|
-
* data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
|
|
2
|
+
* On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms,
|
|
3
|
+
* and data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
|
|
4
4
|
* operates on these lives in `./sigdb` (which re-exports this module, so `./sigdb` stays the single entry point).
|
|
5
5
|
*/
|
|
6
6
|
/** The definition location of the binding, with a file path usually relative to the package project root. */
|
package/project/sigdb/schema.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms
|
|
4
|
-
* data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
|
|
3
|
+
* On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms,
|
|
4
|
+
* and data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
|
|
5
5
|
* operates on these lives in `./sigdb` (which re-exports this module, so `./sigdb` stays the single entry point).
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -132,7 +132,7 @@ function retrieveAllCallAliases(nodeId, graph) {
|
|
|
132
132
|
continue;
|
|
133
133
|
}
|
|
134
134
|
const [info, outgoing] = vertex;
|
|
135
|
-
if (
|
|
135
|
+
if (!vertex_1.FunctionCallVertex.is(info)) {
|
|
136
136
|
const wantedTypes = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall;
|
|
137
137
|
const x = outgoing.entries()
|
|
138
138
|
.filter(([, e]) => edge_1.DfEdge.includesType(e, wantedTypes))
|
|
@@ -10,12 +10,12 @@ const graph_1 = require("../../../dataflow/graph/graph");
|
|
|
10
10
|
const simple_visitor_1 = require("../../../control-flow/simple-visitor");
|
|
11
11
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
12
12
|
const edge_1 = require("../../../dataflow/graph/edge");
|
|
13
|
-
const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
|
|
14
13
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
15
14
|
const assert_1 = require("../../../util/assert");
|
|
16
15
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
17
16
|
const cascade_action_1 = require("./cascade-action");
|
|
18
17
|
const cfg_kind_1 = require("../../../project/cfg-kind");
|
|
18
|
+
const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
|
|
19
19
|
var CallTargets;
|
|
20
20
|
(function (CallTargets) {
|
|
21
21
|
/** call targets a function that is not defined locally in the script (e.g., the call targets a library function) */
|
|
@@ -55,7 +55,7 @@ function satisfiesCallTargets(info, graph, callTarget) {
|
|
|
55
55
|
* for performance and scoping reasons, flowR will not identify the global linkage,
|
|
56
56
|
* including any potential built-in mapping.
|
|
57
57
|
*/
|
|
58
|
-
const reResolved =
|
|
58
|
+
const reResolved = resolve_helper_1.Resolve.byName(info.name, info.environment);
|
|
59
59
|
if (reResolved?.some(t => node_id_1.NodeId.isBuiltIn(t.definedAt))) {
|
|
60
60
|
builtIn = true;
|
|
61
61
|
}
|
|
@@ -242,7 +242,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
|
|
|
242
242
|
}
|
|
243
243
|
// collect this one!
|
|
244
244
|
const vertex = data.dataflow.graph.getVertex(linkedId.id);
|
|
245
|
-
if (
|
|
245
|
+
if (!vertex_1.FunctionCallVertex.is(vertex)) {
|
|
246
246
|
continue;
|
|
247
247
|
}
|
|
248
248
|
const args = (0, resolve_argument_1.getArgumentStringValue)(data.config.solver.variables, data.dataflow.graph, vertex, info.argIdx, info.argName, info.resolveValue, data.ctx);
|
|
@@ -261,7 +261,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
|
|
|
261
261
|
}
|
|
262
262
|
function getFunctionsToCheck(customFunctions, functionFlag, enabled, ignoreDefaultFunctions, defaultFunctions) {
|
|
263
263
|
// "If unset or empty, all function types are searched for."
|
|
264
|
-
if (enabled !== undefined && (enabled?.length === 0 || enabled.
|
|
264
|
+
if (enabled !== undefined && (enabled?.length === 0 || !enabled.includes(functionFlag))) {
|
|
265
265
|
return [];
|
|
266
266
|
}
|
|
267
267
|
let functions = ignoreDefaultFunctions ? [] : defaultFunctions.slice();
|
|
@@ -101,7 +101,7 @@ exports.DefaultDependencyCategories = {
|
|
|
101
101
|
continue;
|
|
102
102
|
}
|
|
103
103
|
const vertex = dataflow.graph.getVertex(statement.info.id);
|
|
104
|
-
const functionName =
|
|
104
|
+
const functionName = vertex_1.FunctionCallVertex.is(vertex)
|
|
105
105
|
? df_helper_1.Dataflow.qualify(statement.info.id, dataflow.graph, false) ?? vertex.name : undefined;
|
|
106
106
|
if (functionName === undefined) {
|
|
107
107
|
continue;
|
|
@@ -4,16 +4,10 @@ exports.linkPlotsToDevices = linkPlotsToDevices;
|
|
|
4
4
|
const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
|
|
5
5
|
const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
|
|
6
6
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
7
|
-
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
8
7
|
const range_1 = require("../../../util/range");
|
|
9
8
|
/** the {@link CallProp} bits of the call `id` makes */
|
|
10
|
-
function propsOf(id,
|
|
11
|
-
|
|
12
|
-
if (vertex?.tag !== vertex_1.VertexType.FunctionCall) {
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
const name = df_helper_1.Dataflow.qualify(id, graph, false) ?? vertex.name;
|
|
16
|
-
return (0, query_fn_props_1.queryFnProps)(name, { environment: vertex.environment ?? environment })?.props ?? 0;
|
|
9
|
+
function propsOf(id, dataflow) {
|
|
10
|
+
return (0, query_fn_props_1.callFnProps)(id, dataflow)?.props ?? 0;
|
|
17
11
|
}
|
|
18
12
|
/**
|
|
19
13
|
* Names the file each visualization lands in, and the statements that build it.
|
|
@@ -32,7 +26,7 @@ function linkPlotsToDevices(written, plots, dataflow, ast) {
|
|
|
32
26
|
.filter(w => w.value !== undefined && (propsOf(w.nodeId, dataflow) & built_in_props_1.CallProp.Graphics) !== 0)
|
|
33
27
|
.map(w => [w.nodeId, w.value]));
|
|
34
28
|
const closed = new Set(dataflow.graph.vertices(true)
|
|
35
|
-
.filter(([id, v]) =>
|
|
29
|
+
.filter(([id, v]) => vertex_1.FunctionCallVertex.is(v) && (propsOf(id, dataflow) & built_in_props_1.CallProp.Closes) !== 0)
|
|
36
30
|
.map(([id]) => id));
|
|
37
31
|
const plotAt = new Map(plots.map((p, index) => [p.nodeId, index]));
|
|
38
32
|
const located = [...opened.keys(), ...closed, ...plotAt.keys()]
|