@eagleoutice/flowr 2.12.2 → 2.13.0
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 +38 -91
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
- package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
- package/abstract-interpretation/data-frame/semantics.js +12 -16
- package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
- package/abstract-interpretation/domains/abstract-domain.js +146 -6
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
- package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
- package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
- package/abstract-interpretation/domains/interval-domain.js +111 -146
- package/abstract-interpretation/domains/lattice.d.ts +3 -3
- package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
- package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
- package/abstract-interpretation/domains/partial-product-domain.js +21 -54
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
- package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
- package/abstract-interpretation/domains/product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/product-domain.js +4 -4
- package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
- package/abstract-interpretation/domains/set-range-domain.js +141 -200
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
- package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
- package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
- package/abstract-interpretation/domains/singleton-domain.js +33 -72
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
- package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
- package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
- package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
- package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
- package/benchmark/slicer.d.ts +2 -2
- package/benchmark/slicer.js +6 -5
- package/cli/common/options.d.ts +10 -0
- package/cli/common/options.js +2 -0
- package/cli/common/scripts-info.d.ts +10 -0
- package/cli/flowr-main-options.d.ts +4 -0
- package/cli/flowr-main-options.js +5 -0
- package/cli/flowr.d.ts +5 -0
- package/cli/flowr.js +15 -7
- package/cli/repl/commands/repl-query.js +42 -20
- package/cli/repl/commands/repl-signature.js +2 -2
- package/cli/repl/core.d.ts +14 -5
- package/cli/repl/core.js +32 -17
- package/cli/repl/parser/slice-query-parser.d.ts +69 -8
- package/cli/repl/parser/slice-query-parser.js +82 -13
- package/cli/repl/path-input.d.ts +6 -0
- package/cli/repl/path-input.js +41 -0
- package/cli/repl/print-version.js +3 -5
- package/cli/slicer-app.d.ts +2 -0
- package/cli/slicer-app.js +2 -1
- package/config.d.ts +54 -6
- package/config.js +133 -12
- package/control-flow/control-flow-graph.d.ts +3 -2
- package/control-flow/control-flow-graph.js +34 -14
- package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
- package/control-flow/semantic-cfg-guided-visitor.js +3 -0
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
- package/data/r-base-packages.generated.d.ts +1 -1
- package/data/r-base-packages.generated.js +3 -3
- package/data/sigdb/sigdb.remote.json +53 -53
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +3 -5
- package/dataflow/environments/default-builtin-config.js +2 -2
- package/dataflow/environments/environment.d.ts +9 -0
- package/dataflow/environments/environment.js +28 -7
- package/dataflow/environments/identifier.d.ts +1 -2
- package/dataflow/environments/identifier.js +1 -5
- package/dataflow/extractor.js +1 -2
- package/dataflow/graph/dataflowgraph-builder.js +42 -3
- package/dataflow/graph/df-helper.d.ts +15 -0
- package/dataflow/graph/df-helper.js +20 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
- package/documentation/data/faq/faqs.js +12 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-files.d.ts +2 -2
- package/documentation/doc-util/doc-files.js +4 -7
- package/documentation/doc-util/doc-query.d.ts +12 -9
- package/documentation/doc-util/doc-query.js +63 -28
- package/documentation/wiki-absint.js +1 -4
- package/documentation/wiki-analyzer.js +8 -3
- package/documentation/wiki-cfg.js +3 -2
- package/documentation/wiki-dataflow-graph.js +14 -4
- package/documentation/wiki-interface.js +29 -16
- package/documentation/wiki-mk/doc-maker.js +1 -1
- package/documentation/wiki-query.js +189 -30
- package/documentation/wiki-signature-database.d.ts +1 -1
- package/documentation/wiki-signature-database.js +53 -27
- package/linter/linter-output.d.ts +24 -0
- package/linter/linter-output.js +117 -0
- package/linter/linter-rules.d.ts +2 -4
- package/linter/rules/dataframe-access-validation.js +4 -4
- package/linter/rules/deprecated-functions.d.ts +2 -4
- package/linter/rules/deprecated-functions.js +58 -3
- package/linter/rules/undefined-symbol.js +18 -10
- package/linter/rules/unused-definition.js +24 -0
- package/package.json +5 -2
- package/project/context/flowr-analyzer-context.d.ts +59 -1
- package/project/context/flowr-analyzer-context.js +118 -3
- package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
- package/project/context/flowr-analyzer-dependencies-context.js +33 -3
- package/project/context/flowr-analyzer-files-context.d.ts +32 -0
- package/project/context/flowr-analyzer-files-context.js +132 -14
- package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
- package/project/context/flowr-analyzer-loading-order-context.js +20 -0
- package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
- package/project/context/flowr-analyzer-meta-context.js +64 -23
- package/project/context/flowr-file.d.ts +7 -0
- package/project/context/flowr-file.js +7 -0
- package/project/context/project-kind.d.ts +22 -0
- package/project/context/project-kind.js +27 -0
- package/project/dependency-version-space.d.ts +166 -0
- package/project/dependency-version-space.js +564 -0
- package/project/flowr-analyzer-builder.js +1 -1
- package/project/flowr-analyzer.d.ts +4 -0
- package/project/flowr-analyzer.js +5 -0
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
- package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
- package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
- package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
- package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
- package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
- package/project/plugins/flowr-analyzer-plugin.js +5 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
- package/project/plugins/package-version-plugins/package.d.ts +4 -1
- package/project/plugins/package-version-plugins/package.js +8 -5
- package/project/plugins/plugin-registry.d.ts +11 -3
- package/project/plugins/plugin-registry.js +24 -5
- package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
- package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
- package/project/sigdb/build.js +12 -2
- package/project/sigdb/decode.d.ts +7 -0
- package/project/sigdb/decode.js +35 -4
- package/project/sigdb/decompress.d.ts +2 -0
- package/project/sigdb/decompress.js +5 -0
- package/project/sigdb/manifest.d.ts +5 -0
- package/project/sigdb/manifest.js +37 -6
- package/project/sigdb/reader.d.ts +82 -2
- package/project/sigdb/reader.js +226 -14
- package/project/sigdb/schema.d.ts +31 -5
- package/project/sigdb/schema.js +7 -3
- package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
- package/project/sigdb/sigdb-version.js +119 -0
- package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
- package/queries/catalog/absint-query/absint-query-format.js +2 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
- package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
- package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
- package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
- package/queries/catalog/config-query/config-query-executor.js +15 -6
- package/queries/catalog/config-query/config-query-format.d.ts +18 -4
- package/queries/catalog/config-query/config-query-format.js +246 -96
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
- package/queries/catalog/dice-query/dice-query-executor.js +6 -9
- package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
- package/queries/catalog/dice-query/dice-query-format.js +10 -6
- package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
- package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
- package/queries/catalog/files-query/files-query-format.d.ts +2 -0
- package/queries/catalog/files-query/files-query-format.js +2 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +277 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +119 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +331 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
- package/queries/catalog/linter-query/linter-query-executor.js +11 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
- package/queries/catalog/linter-query/linter-query-format.js +44 -21
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +2 -0
- package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
- package/queries/catalog/project-query/project-query-executor.js +19 -62
- package/queries/catalog/project-query/project-query-format.d.ts +7 -18
- package/queries/catalog/project-query/project-query-format.js +3 -18
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
- package/queries/catalog/search-query/search-query-format.d.ts +1 -0
- package/queries/catalog/search-query/search-query-format.js +1 -0
- package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
- package/queries/catalog/signature-query/signature-query-executor.js +267 -57
- package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
- package/queries/catalog/signature-query/signature-query-format.js +41 -5
- package/queries/catalog/signature-query/signature-query-render.js +48 -6
- package/queries/catalog/slice-query-options.d.ts +49 -0
- package/queries/catalog/slice-query-options.js +50 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
- package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
- package/queries/query-print.js +3 -1
- package/queries/query.d.ts +63 -3
- package/queries/query.js +9 -2
- package/r-bridge/data/data.d.ts +16 -0
- package/r-bridge/data/data.js +20 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
- package/reconstruct/reconstruct.d.ts +18 -1
- package/reconstruct/reconstruct.js +42 -19
- package/slicing/criterion/parse.d.ts +4 -0
- package/slicing/criterion/parse.js +4 -0
- package/slicing/static/slice-call.js +17 -9
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +5 -4
- package/util/files.d.ts +19 -1
- package/util/files.js +45 -3
- package/util/glob.d.ts +19 -0
- package/util/glob.js +67 -0
- package/util/log.d.ts +12 -0
- package/util/log.js +17 -1
- package/util/logic.d.ts +6 -0
- package/util/logic.js +31 -1
- package/util/mermaid/dfg.js +17 -12
- package/util/mermaid/mermaid.js +2 -2
- package/util/objects.d.ts +5 -0
- package/util/objects.js +8 -0
- package/util/r-version.d.ts +9 -1
- package/util/r-version.js +27 -2
- package/util/schema.d.ts +16 -0
- package/util/schema.js +89 -4
- package/util/text/ansi.d.ts +4 -0
- package/util/text/ansi.js +27 -3
- package/util/text/strings.d.ts +9 -0
- package/util/text/strings.js +29 -0
- package/util/version.js +79 -6
- package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
- package/project/sigdb/version.js +0 -55
package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin = exports.FlowrAnalyzerGitignoreProjectDiscoveryPlugin = exports.FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin = exports.IgnoreFileKind = void 0;
|
|
7
|
+
const flowr_analyzer_project_discovery_plugin_1 = require("./flowr-analyzer-project-discovery-plugin");
|
|
8
|
+
const semver_1 = require("semver");
|
|
9
|
+
const retriever_1 = require("../../../r-bridge/retriever");
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const fs_1 = __importDefault(require("fs"));
|
|
12
|
+
const glob_1 = require("../../../util/glob");
|
|
13
|
+
/**
|
|
14
|
+
* The ignore files a {@link FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin} can respect.
|
|
15
|
+
* They differ in their pattern language, see {@link ignoreMatcher}.
|
|
16
|
+
*/
|
|
17
|
+
var IgnoreFileKind;
|
|
18
|
+
(function (IgnoreFileKind) {
|
|
19
|
+
/** `.gitignore`, gitignore-style globs */
|
|
20
|
+
IgnoreFileKind["Gitignore"] = "gitignore";
|
|
21
|
+
/** `.Rbuildignore`, one (Perl-compatible) regular expression per line, as used by `R CMD build` */
|
|
22
|
+
IgnoreFileKind["Rbuildignore"] = "rbuildignore";
|
|
23
|
+
})(IgnoreFileKind || (exports.IgnoreFileKind = IgnoreFileKind = {}));
|
|
24
|
+
const ignoreFileNames = {
|
|
25
|
+
[IgnoreFileKind.Gitignore]: '.gitignore',
|
|
26
|
+
[IgnoreFileKind.Rbuildignore]: '.Rbuildignore'
|
|
27
|
+
};
|
|
28
|
+
/** Reads the ignore file of `kind` at `root` and returns a matcher for paths relative to `root`, if it exists. */
|
|
29
|
+
function ignoreMatcher(kind, root) {
|
|
30
|
+
const file = path_1.default.join(root, ignoreFileNames[kind]);
|
|
31
|
+
if (!fs_1.default.existsSync(file)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const content = fs_1.default.readFileSync(file, 'utf-8');
|
|
35
|
+
if (kind === IgnoreFileKind.Rbuildignore) {
|
|
36
|
+
return (0, glob_1.rbuildignoreMatcher)(content);
|
|
37
|
+
}
|
|
38
|
+
const ig = (0, glob_1.loadIgnore)()().add(content);
|
|
39
|
+
return relativePath => ig.ignores(relativePath);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Decorator around any {@link FlowrAnalyzerProjectDiscoveryPlugin} that filters the discovered files
|
|
43
|
+
* by the ignore files found at the project root. Ignore files that do not exist are skipped, so with
|
|
44
|
+
* none of them present the inner plugin's results are returned unchanged.
|
|
45
|
+
*
|
|
46
|
+
* Use {@link FlowrAnalyzerGitignoreProjectDiscoveryPlugin} (`'project-discovery:gitignore'`),
|
|
47
|
+
* {@link FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin} (`'project-discovery:rbuildignore'`), or
|
|
48
|
+
* `'project-discovery:ignore-files'` for both. As every variant wraps an inner discovery plugin, they
|
|
49
|
+
* can also be nested to combine them with a custom discovery plugin.
|
|
50
|
+
*/
|
|
51
|
+
class FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin extends flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin {
|
|
52
|
+
name = 'flowr-analyzer-ignore-file-project-discovery-plugin';
|
|
53
|
+
description = 'Wraps a project discovery plugin and filters results by .gitignore and .Rbuildignore rules.';
|
|
54
|
+
version = new semver_1.SemVer('0.1.0');
|
|
55
|
+
inner;
|
|
56
|
+
kinds;
|
|
57
|
+
/**
|
|
58
|
+
* @param kinds - the ignore files to respect
|
|
59
|
+
* @param inner - the discovery plugin providing the files to filter
|
|
60
|
+
*/
|
|
61
|
+
constructor(kinds = [IgnoreFileKind.Gitignore, IgnoreFileKind.Rbuildignore], inner = flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin()) {
|
|
62
|
+
super();
|
|
63
|
+
this.kinds = kinds;
|
|
64
|
+
this.inner = inner;
|
|
65
|
+
}
|
|
66
|
+
process(context, args) {
|
|
67
|
+
const matchers = this.kinds.map(k => ignoreMatcher(k, args.content)).filter(m => m !== undefined);
|
|
68
|
+
const inner = this.inner.processor(context, args);
|
|
69
|
+
if (matchers.length === 0) {
|
|
70
|
+
return inner;
|
|
71
|
+
}
|
|
72
|
+
return inner.filter(r => {
|
|
73
|
+
const filePath = (0, retriever_1.isParseRequest)(r) && r.request === 'file' ? r.content : !(0, retriever_1.isParseRequest)(r) ? r.path() : undefined;
|
|
74
|
+
if (filePath === undefined) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
const relative = path_1.default.relative(args.content, filePath);
|
|
78
|
+
return relative === '' || !matchers.some(m => m(relative));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin = FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin;
|
|
83
|
+
/** Filters the discovered files by the `.gitignore` at the project root, see {@link FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin}. */
|
|
84
|
+
class FlowrAnalyzerGitignoreProjectDiscoveryPlugin extends FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin {
|
|
85
|
+
name = 'flowr-analyzer-gitignore-project-discovery-plugin';
|
|
86
|
+
description = 'Wraps a project discovery plugin and filters results by .gitignore rules.';
|
|
87
|
+
constructor(inner = flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin()) {
|
|
88
|
+
super([IgnoreFileKind.Gitignore], inner);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.FlowrAnalyzerGitignoreProjectDiscoveryPlugin = FlowrAnalyzerGitignoreProjectDiscoveryPlugin;
|
|
92
|
+
/** Filters the discovered files by the `.Rbuildignore` at the package root, see {@link FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin}. */
|
|
93
|
+
class FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin extends FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin {
|
|
94
|
+
name = 'flowr-analyzer-rbuildignore-project-discovery-plugin';
|
|
95
|
+
description = 'Wraps a project discovery plugin and filters results by .Rbuildignore rules.';
|
|
96
|
+
constructor(inner = flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin()) {
|
|
97
|
+
super([IgnoreFileKind.Rbuildignore], inner);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin = FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin;
|
|
101
|
+
//# sourceMappingURL=flowr-analyzer-ignore-file-project-discovery-plugin.js.map
|
|
@@ -10,6 +10,7 @@ const flowr_file_1 = require("../../context/flowr-file");
|
|
|
10
10
|
const files_1 = require("../../../util/files");
|
|
11
11
|
const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
12
12
|
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const flowr_analyzer_rprofile_file_plugin_1 = require("../file-plugins/flowr-analyzer-rprofile-file-plugin");
|
|
13
14
|
/**
|
|
14
15
|
* This is the base class for all plugins that discover files in a project for analysis.
|
|
15
16
|
* These plugins interplay with the {@link FlowrAnalyzerFilesContext} to gather information about the files in the project.
|
|
@@ -24,10 +25,10 @@ class FlowrAnalyzerProjectDiscoveryPlugin extends flowr_analyzer_plugin_1.FlowrA
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
exports.FlowrAnalyzerProjectDiscoveryPlugin = FlowrAnalyzerProjectDiscoveryPlugin;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
const ignorePathsWith =
|
|
28
|
+
// `.Rprofile`/`Rprofile.site` carry no extension but are plain R sources
|
|
29
|
+
const discoverRSourcesRegex = /(\.(r|rmd|ipynb|qmd|rnw)|(^|[\\/])\.?Rprofile(\.site)?)$/i;
|
|
30
|
+
// matched against the posix path relative to the project root
|
|
31
|
+
const ignorePathsWith = /(^|\/)(\.git|\.svn|\.hg|node_modules|__pycache__|\.Rproj\.user|(packrat|renv|rv)\/(lib|library|src|staging|sandbox|bundles)[^/]*)(\/|$)/i;
|
|
31
32
|
const excludeRequestsForPaths = /vignettes?|tests?|revdep|inst|data/i;
|
|
32
33
|
/**
|
|
33
34
|
* This is the default dummy implementation of the {@link FlowrAnalyzerProjectDiscoveryPlugin}.
|
|
@@ -35,7 +36,7 @@ const excludeRequestsForPaths = /vignettes?|tests?|revdep|inst|data/i;
|
|
|
35
36
|
*/
|
|
36
37
|
class DefaultFlowrAnalyzerProjectDiscoveryPlugin extends FlowrAnalyzerProjectDiscoveryPlugin {
|
|
37
38
|
name = 'default-project-discovery-plugin';
|
|
38
|
-
description = '
|
|
39
|
+
description = 'Does nothing, the default project discovery plugin.';
|
|
39
40
|
version = new semver_1.SemVer('0.0.0');
|
|
40
41
|
supportedExtensions;
|
|
41
42
|
ignorePathsRegex;
|
|
@@ -62,6 +63,10 @@ class DefaultFlowrAnalyzerProjectDiscoveryPlugin extends FlowrAnalyzerProjectDis
|
|
|
62
63
|
const relativePath = path_1.default.relative(args.content, file);
|
|
63
64
|
if (this.supportedExtensions.test(relativePath) && (!this.onlyTraversePaths || this.onlyTraversePaths.test(relativePath)) && !this.excludePathsRegex.test((0, built_in_source_1.platformDirname)(relativePath))) {
|
|
64
65
|
requests.push({ content: file, request: 'file' });
|
|
66
|
+
if (flowr_analyzer_rprofile_file_plugin_1.RprofileFilePattern.test((0, built_in_source_1.platformBasename)(relativePath))) {
|
|
67
|
+
// parse requests skip the file plugins, so emit a file too to have the profile tagged
|
|
68
|
+
requests.push(new flowr_file_1.FlowrTextFile(file));
|
|
69
|
+
}
|
|
65
70
|
}
|
|
66
71
|
else {
|
|
67
72
|
requests.push(new flowr_file_1.FlowrTextFile(file));
|
package/project/sigdb/build.js
CHANGED
|
@@ -125,8 +125,9 @@ function buildBlob(p, strings, tier, feats) {
|
|
|
125
125
|
return cgs.intern(idxs.join(','), deltaEncode(idxs));
|
|
126
126
|
};
|
|
127
127
|
const fn = (f) => {
|
|
128
|
-
const
|
|
128
|
+
const base = [strings.str(f.name), sig(f.params), cg(f.callees), f.props,
|
|
129
129
|
feats.locations && f.file ? strings.str(f.file) : -1, feats.locations ? f.line ?? -1 : -1];
|
|
130
|
+
const rec = f.topic && f.topic !== f.name ? [...base, strings.str(f.topic)] : base;
|
|
130
131
|
return fns.intern(rec.join(','), rec);
|
|
131
132
|
};
|
|
132
133
|
const depList = (list) => {
|
|
@@ -328,7 +329,10 @@ class StringPool {
|
|
|
328
329
|
strings = [];
|
|
329
330
|
idx = new Map();
|
|
330
331
|
str(s) {
|
|
331
|
-
|
|
332
|
+
// the dictionary is newline-delimited on disk, so a stored string must never contain one -- otherwise it splits
|
|
333
|
+
// on read and shifts every later index. Flatten defensively here so no field (name, file, topic, ...) can corrupt it.
|
|
334
|
+
const safe = s.includes('\n') || s.includes('\r') ? s.replace(/[\r\n]+/g, ' ') : s;
|
|
335
|
+
return internalize(this.strings, this.idx, safe, safe);
|
|
332
336
|
}
|
|
333
337
|
}
|
|
334
338
|
/** renumber the dictionary so the most-referenced strings get the smallest indices (a pure bijection) */
|
|
@@ -364,6 +368,9 @@ function optimizeStringOrder(strings, blobs) {
|
|
|
364
368
|
for (const f of blob.fns) {
|
|
365
369
|
bump(f[0]);
|
|
366
370
|
bump(f[4]);
|
|
371
|
+
if (f[6] !== undefined) {
|
|
372
|
+
bump(f[6]);
|
|
373
|
+
}
|
|
367
374
|
}
|
|
368
375
|
for (const list of blob.deps) {
|
|
369
376
|
for (const d of list) {
|
|
@@ -409,6 +416,9 @@ function optimizeStringOrder(strings, blobs) {
|
|
|
409
416
|
if (f[4] >= 0) {
|
|
410
417
|
f[4] = remap[f[4]];
|
|
411
418
|
}
|
|
419
|
+
if (f[6] !== undefined && f[6] >= 0) {
|
|
420
|
+
f[6] = remap[f[6]];
|
|
421
|
+
}
|
|
412
422
|
}
|
|
413
423
|
for (const list of blob.deps) {
|
|
414
424
|
for (const d of list) {
|
|
@@ -35,12 +35,19 @@ export interface DecodedFunction {
|
|
|
35
35
|
readonly props: readonly string[];
|
|
36
36
|
readonly signature: readonly SigParameter[];
|
|
37
37
|
readonly callees: readonly string[];
|
|
38
|
+
/** the Rd help topic (man-page name) documenting this function, when it differs from {@link name} */
|
|
39
|
+
readonly topic?: string;
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* The formal parameter names of a known signature, ready for `RFunctionCall.matchArgumentsToParameters`: the
|
|
41
43
|
* `...` parameter is excluded so partial (`pmatch`) matches against the remaining names stay unambiguous.
|
|
42
44
|
*/
|
|
43
45
|
export declare function signatureParameterNames(signature: readonly SigParameter[]): string[];
|
|
46
|
+
/**
|
|
47
|
+
* The transitive callees of `name`. Each local callee that is itself a function of `functions` (one package
|
|
48
|
+
* version's set) is expanded, names outside the set stay as leaves. Deduplicated and ascending.
|
|
49
|
+
*/
|
|
50
|
+
export declare function transitiveCallees(functions: readonly DecodedFunction[], name: string): string[];
|
|
44
51
|
/** decode one of a blob's function records against the global string dictionary */
|
|
45
52
|
export declare function decodeFunction(strings: readonly string[], blob: Readonly<PkgBlob>, fnIdx: number): DecodedFunction;
|
|
46
53
|
/** a decoded package dependency of one version (`type` is the compact {@link DepType} enum; map to a label via {@link DepTypeNames}) */
|
package/project/sigdb/decode.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.blobTuple = void 0;
|
|
|
4
4
|
exports.cranBlobUrl = cranBlobUrl;
|
|
5
5
|
exports.tupleToBlob = tupleToBlob;
|
|
6
6
|
exports.signatureParameterNames = signatureParameterNames;
|
|
7
|
+
exports.transitiveCallees = transitiveCallees;
|
|
7
8
|
exports.decodeFunction = decodeFunction;
|
|
8
9
|
exports.decodeDependencies = decodeDependencies;
|
|
9
10
|
exports.versionFnIndices = versionFnIndices;
|
|
@@ -14,7 +15,7 @@ exports.deriveLibraryExports = deriveLibraryExports;
|
|
|
14
15
|
* Split out of `../sigdb` so the reader/writer there does not carry the per-record decoding.
|
|
15
16
|
*/
|
|
16
17
|
const schema_1 = require("./schema");
|
|
17
|
-
const
|
|
18
|
+
const sigdb_version_1 = require("./sigdb-version");
|
|
18
19
|
/**
|
|
19
20
|
* Reconstruct the CRAN source blob link which is the newest non-archived version lives under `src/contrib`,
|
|
20
21
|
* every other under `Archive`.
|
|
@@ -44,9 +45,30 @@ function tupleToBlob(t) {
|
|
|
44
45
|
function signatureParameterNames(signature) {
|
|
45
46
|
return signature.map(p => p.name).filter(n => n !== '...');
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* The transitive callees of `name`. Each local callee that is itself a function of `functions` (one package
|
|
50
|
+
* version's set) is expanded, names outside the set stay as leaves. Deduplicated and ascending.
|
|
51
|
+
*/
|
|
52
|
+
function transitiveCallees(functions, name) {
|
|
53
|
+
const local = new Map(functions.map(f => [f.name, f.callees]));
|
|
54
|
+
const reached = new Set();
|
|
55
|
+
const queue = [...(local.get(name) ?? [])];
|
|
56
|
+
while (queue.length > 0) {
|
|
57
|
+
const callee = queue.pop();
|
|
58
|
+
if (reached.has(callee)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
reached.add(callee);
|
|
62
|
+
const inner = local.get(callee);
|
|
63
|
+
if (inner !== undefined) {
|
|
64
|
+
queue.push(...inner);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return [...reached].sort();
|
|
68
|
+
}
|
|
47
69
|
/** decode one of a blob's function records against the global string dictionary */
|
|
48
70
|
function decodeFunction(strings, blob, fnIdx) {
|
|
49
|
-
const [nameIdx, sigIdx, cgIdx, bits, fileIdx, line] = blob.fns[fnIdx];
|
|
71
|
+
const [nameIdx, sigIdx, cgIdx, bits, fileIdx, line, topicIdx] = blob.fns[fnIdx];
|
|
50
72
|
const signature = (sigIdx >= 0 ? blob.sigs[sigIdx] : []).map(p => {
|
|
51
73
|
const [n, flags, def] = Array.isArray(p) ? [p[0], p[1], p.length === 3 ? p[2] : -1] : [p, 0, -1];
|
|
52
74
|
return {
|
|
@@ -63,6 +85,7 @@ function decodeFunction(strings, blob, fnIdx) {
|
|
|
63
85
|
}
|
|
64
86
|
return {
|
|
65
87
|
name: strings[nameIdx],
|
|
88
|
+
...(topicIdx !== undefined && topicIdx >= 0 ? { topic: strings[topicIdx] } : {}),
|
|
66
89
|
...(fileIdx >= 0 ? { file: strings[fileIdx] } : {}),
|
|
67
90
|
line,
|
|
68
91
|
exported: Boolean(bits & 1 /* FnProp.Exported */),
|
|
@@ -99,7 +122,7 @@ function versionFnIndices(blob, ver) {
|
|
|
99
122
|
/** derive the {@link LibraryExports} export view of one package version from its blob + metadata */
|
|
100
123
|
function deriveLibraryExports(strings, blob, meta, pkg, version, cranBase = schema_1.DefaultCranBase) {
|
|
101
124
|
const [latest, archived] = meta;
|
|
102
|
-
const ver = (0,
|
|
125
|
+
const ver = (0, sigdb_version_1.resolveVersion)(blob, latest, version);
|
|
103
126
|
if (ver === undefined) {
|
|
104
127
|
return undefined;
|
|
105
128
|
}
|
|
@@ -107,6 +130,8 @@ function deriveLibraryExports(strings, blob, meta, pkg, version, cranBase = sche
|
|
|
107
130
|
const exported = [];
|
|
108
131
|
const internal = [];
|
|
109
132
|
const deprecated = [];
|
|
133
|
+
const s3Classes = [];
|
|
134
|
+
const s4Classes = [];
|
|
110
135
|
const locations = new Map();
|
|
111
136
|
for (const i of idxs) {
|
|
112
137
|
const [nameIdx, , , bits, fileIdx, line] = blob.fns[i];
|
|
@@ -115,13 +140,19 @@ function deriveLibraryExports(strings, blob, meta, pkg, version, cranBase = sche
|
|
|
115
140
|
if (bits & 32 /* FnProp.Deprecated */) {
|
|
116
141
|
deprecated.push(name);
|
|
117
142
|
}
|
|
143
|
+
if (bits & 1024 /* FnProp.S3Owner */) {
|
|
144
|
+
s3Classes.push(name);
|
|
145
|
+
}
|
|
146
|
+
if (bits & 2048 /* FnProp.S4Owner */) {
|
|
147
|
+
s4Classes.push(name);
|
|
148
|
+
}
|
|
118
149
|
if (fileIdx >= 0) {
|
|
119
150
|
locations.set(name, { file: strings[fileIdx], line });
|
|
120
151
|
}
|
|
121
152
|
}
|
|
122
153
|
const cran = !blob.noncran?.includes(ver);
|
|
123
154
|
return {
|
|
124
|
-
version: ver, exported, internal, deprecated, cran,
|
|
155
|
+
version: ver, exported, internal, deprecated, s3Classes, s4Classes, cran,
|
|
125
156
|
cranUrl: cranBlobUrl(cranBase, pkg, ver, { latest, archived: archived === 1, cran }),
|
|
126
157
|
...(locations.size > 0 ? { locations } : {})
|
|
127
158
|
};
|
|
@@ -30,6 +30,8 @@ export interface EnsureOptions {
|
|
|
30
30
|
/** the source is not a seekable bundle (e.g. a shared dictionary file) -- decompress only, write no `.idx` */
|
|
31
31
|
indexless?: boolean;
|
|
32
32
|
}
|
|
33
|
+
/** whether a compressed source with the given content hash has already been unpacked into its decompressed cache */
|
|
34
|
+
export declare function isUnpacked(hash: string, cacheDir?: string): boolean;
|
|
33
35
|
/**
|
|
34
36
|
* Ensure a seekable plain `.sigs.ndjson` (+ its `.idx`) exists for `source`, decompressing a `.br`/`.zst`/`.gz`
|
|
35
37
|
* once into a hash-keyed cache the first time and reusing it on every later startup. The index may be
|
|
@@ -9,6 +9,7 @@ exports.sigDbStream = sigDbStream;
|
|
|
9
9
|
exports.resolveSource = resolveSource;
|
|
10
10
|
exports.sigDbCacheDir = sigDbCacheDir;
|
|
11
11
|
exports.readHeaderOf = readHeaderOf;
|
|
12
|
+
exports.isUnpacked = isUnpacked;
|
|
12
13
|
exports.ensurePlain = ensurePlain;
|
|
13
14
|
exports.ensurePlainSync = ensurePlainSync;
|
|
14
15
|
/**
|
|
@@ -116,6 +117,10 @@ function cachePaths(hash, cacheDir) {
|
|
|
116
117
|
const plain = node_path_1.default.join(sigDbCacheDir(cacheDir), `sigdb-${hash}${schema_1.SigDbExt}`);
|
|
117
118
|
return { plain, idx: `${plain}.idx` };
|
|
118
119
|
}
|
|
120
|
+
/** whether a compressed source with the given content hash has already been unpacked into its decompressed cache */
|
|
121
|
+
function isUnpacked(hash, cacheDir) {
|
|
122
|
+
return node_fs_1.default.existsSync(cachePaths(hash, cacheDir).plain);
|
|
123
|
+
}
|
|
119
124
|
/** materialize the `.idx` for a freshly decompressed cache file -- from the supplied index or the source's sibling */
|
|
120
125
|
function writeCacheIndex(source, idx, index) {
|
|
121
126
|
if (index) {
|
|
@@ -48,6 +48,11 @@ export interface SigDbManifest {
|
|
|
48
48
|
export declare function writeManifest(file: string, manifest: SigDbManifest): void;
|
|
49
49
|
/** read a manifest file (transparently decompressing a `.br`/`.zst`/`.gz`) */
|
|
50
50
|
export declare function readManifestFile(manifestFile: string): SigDbManifest;
|
|
51
|
+
/**
|
|
52
|
+
* The `date` of a manifest without parsing the rest of it, whose `meta` is megabytes of packages.
|
|
53
|
+
* Falls back to a full parse if the date is not where we expect it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function readManifestDate(manifestFile: string): string | undefined;
|
|
51
56
|
/** breadth/temporal scope of a bundled sigdb: base R only, `current` (latest CRAN + base R), or the `full` history */
|
|
52
57
|
export type SigDbScope = 'base' | 'current' | 'full';
|
|
53
58
|
/**
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SigDbManifestSchema = exports.SigDbManifestMagic = void 0;
|
|
7
7
|
exports.writeManifest = writeManifest;
|
|
8
8
|
exports.readManifestFile = readManifestFile;
|
|
9
|
+
exports.readManifestDate = readManifestDate;
|
|
9
10
|
exports.defaultSigDbPath = defaultSigDbPath;
|
|
10
11
|
exports.defaultSigDbPaths = defaultSigDbPaths;
|
|
11
12
|
/**
|
|
@@ -28,11 +29,31 @@ function writeManifest(file, manifest) {
|
|
|
28
29
|
node_fs_1.default.writeFileSync(`${file}${spec.ext}`, spec.compressSync(json, { level: 11, sizeHint: json.length }));
|
|
29
30
|
}
|
|
30
31
|
}
|
|
32
|
+
/** how cheap a file is to read (lower is better); one we cannot decompress here sorts last */
|
|
33
|
+
function codecRank(file) {
|
|
34
|
+
const ext = (0, codec_1.compressedExtOf)(file);
|
|
35
|
+
if (ext === undefined) {
|
|
36
|
+
return -1;
|
|
37
|
+
}
|
|
38
|
+
const preferred = (0, codec_1.readableExtsPreferred)().indexOf(ext);
|
|
39
|
+
return preferred < 0 ? Number.MAX_SAFE_INTEGER : preferred;
|
|
40
|
+
}
|
|
31
41
|
/** read a manifest file (transparently decompressing a `.br`/`.zst`/`.gz`) */
|
|
32
42
|
function readManifestFile(manifestFile) {
|
|
43
|
+
return JSON.parse(readManifestText(manifestFile));
|
|
44
|
+
}
|
|
45
|
+
function readManifestText(manifestFile) {
|
|
33
46
|
const raw = node_fs_1.default.readFileSync(manifestFile);
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
return (0, codec_1.compressedExtOf)(manifestFile) ? (0, codec_1.decompressSyncFor)(manifestFile, raw).toString('utf8') : raw.toString('utf8');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The `date` of a manifest without parsing the rest of it, whose `meta` is megabytes of packages.
|
|
51
|
+
* Falls back to a full parse if the date is not where we expect it.
|
|
52
|
+
*/
|
|
53
|
+
function readManifestDate(manifestFile) {
|
|
54
|
+
const text = readManifestText(manifestFile);
|
|
55
|
+
return /"date"\s*:\s*"([^"]*)"/.exec(text.slice(0, 4096))?.[1]
|
|
56
|
+
?? JSON.parse(text).date;
|
|
36
57
|
}
|
|
37
58
|
/** richest first: a container shipping the full set uses it, else the slim `current`, else the `base` floor */
|
|
38
59
|
const SigDbScopeOrder = ['full', 'current', 'base'];
|
|
@@ -99,6 +120,18 @@ function defaultSigDbPaths(searchRoots) {
|
|
|
99
120
|
}
|
|
100
121
|
const manifests = new Map(); // `<name>.manifest.json` (ignoring compression ext) -> first-found path
|
|
101
122
|
const standalones = new Map(); // `<name>.sigs.ndjson` (ignoring compression ext) -> first-found path
|
|
123
|
+
const foundIn = new Map(); // where a key was first found, to only compare codecs within one directory
|
|
124
|
+
/** keeps the first location, but picks the cheapest readable codec among the copies that location offers */
|
|
125
|
+
const keep = (into, key, file, dir) => {
|
|
126
|
+
const previous = into.get(key);
|
|
127
|
+
if (previous === undefined) {
|
|
128
|
+
into.set(key, file);
|
|
129
|
+
foundIn.set(key, dir);
|
|
130
|
+
}
|
|
131
|
+
else if (foundIn.get(key) === dir && codecRank(file) < codecRank(previous)) {
|
|
132
|
+
into.set(key, file);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
102
135
|
for (const root of sigDbSearchRoots(searchRoots)) {
|
|
103
136
|
for (let dir = root, i = 0; i < 10; i++) {
|
|
104
137
|
for (const sub of SigDbSubDirs) {
|
|
@@ -112,12 +145,10 @@ function defaultSigDbPaths(searchRoots) {
|
|
|
112
145
|
for (const file of entries) {
|
|
113
146
|
const full = node_path_1.default.join(dir, sub, file);
|
|
114
147
|
if (new RegExp(`\\.manifest\\.json${codec_1.CompressedExtPattern}$`).test(file)) {
|
|
115
|
-
|
|
116
|
-
manifests.set(key, manifests.get(key) ?? full);
|
|
148
|
+
keep(manifests, (0, codec_1.stripCompressedExt)(file), full, node_path_1.default.join(dir, sub));
|
|
117
149
|
}
|
|
118
150
|
else if (new RegExp(`${schema_1.SigDbExt.replace(/\./g, '\\.')}${codec_1.CompressedExtPattern}$`).test(file) && !file.includes('.dict' + schema_1.SigDbExt)) {
|
|
119
|
-
|
|
120
|
-
standalones.set(key, standalones.get(key) ?? full);
|
|
151
|
+
keep(standalones, (0, codec_1.stripCompressedExt)(file), full, node_path_1.default.join(dir, sub));
|
|
121
152
|
}
|
|
122
153
|
}
|
|
123
154
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RVersion } from '../../util/r-version';
|
|
1
|
+
import { RVersion, type VersionString } from '../../util/r-version';
|
|
2
2
|
import { type LibraryExports, type PkgBlob, type SigDb, type SigDbContent } from './schema';
|
|
3
|
-
import { type VersionRelease } from './version';
|
|
3
|
+
import { type VersionRelease } from './sigdb-version';
|
|
4
4
|
import { type SigDbIndex } from './index-format';
|
|
5
5
|
import { type DecodedFunction, type ResolvedDependency } from './decode';
|
|
6
6
|
import { type SigDbManifest, type SigDbShardRef } from './manifest';
|
|
@@ -14,10 +14,25 @@ export declare function readSignatureDb(file: string): Promise<SigDb>;
|
|
|
14
14
|
export interface PackageSignatureSource {
|
|
15
15
|
/** whether the source can resolve the package at all */
|
|
16
16
|
has(pkg: string): boolean;
|
|
17
|
+
/** whether the source actually carries the given version of a package (not just the package itself) */
|
|
18
|
+
hasVersion(pkg: string, version: string): boolean;
|
|
19
|
+
/** whether a version is a current CRAN release (i.e. not in the package's `noncran`/removed set) */
|
|
20
|
+
isCranVersion(pkg: string, version: string): boolean;
|
|
17
21
|
/** the export view of a package version (defaults to its latest) */
|
|
18
22
|
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The package that OWNS the class `className` -- an S3 class (a same-named constructor plus a registered method,
|
|
25
|
+
* see {@link LibraryExports.s3Classes}) or an S4 class (exported via `exportClasses`, see
|
|
26
|
+
* {@link LibraryExports.s4Classes}); S3 ownership wins a tie. `undefined` if none does. Without `version`, backed
|
|
27
|
+
* by a reverse index over every package's latest version, built once and cached.
|
|
28
|
+
*/
|
|
29
|
+
classOwner(className: string, version?: string): string | undefined;
|
|
19
30
|
/** rich per-function view (signatures + call graphs) of a package version */
|
|
20
31
|
functions(pkg: string, version?: string): DecodedFunction[] | undefined;
|
|
32
|
+
/** the rich view of a single function by name, decoding only it (unlike {@link functions}, which decodes the whole package) */
|
|
33
|
+
functionByName(pkg: string, name: string, version?: string): DecodedFunction | undefined;
|
|
34
|
+
/** the transitive callees of a function within one package version, expanding the stored local call graphs */
|
|
35
|
+
transitiveCallees(pkg: string, name: string, version?: string): string[] | undefined;
|
|
21
36
|
/** declared dependencies (Depends/Imports/…) of a package version, with version qualifiers */
|
|
22
37
|
dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
|
|
23
38
|
/** every package name this source can resolve */
|
|
@@ -35,6 +50,53 @@ export interface PackageSignatureSource {
|
|
|
35
50
|
/** release any held file handles */
|
|
36
51
|
close(): void;
|
|
37
52
|
}
|
|
53
|
+
/** one version a source can answer for a package, with its release date when known */
|
|
54
|
+
export interface AvailableVersion {
|
|
55
|
+
readonly version: VersionString;
|
|
56
|
+
readonly date?: Date;
|
|
57
|
+
}
|
|
58
|
+
/** the on-demand load state of one shard of a {@link SigDatabaseSet} */
|
|
59
|
+
export interface ShardStatus {
|
|
60
|
+
/** the shard id, e.g. `current-top` (its `base`/`current`/`history` prefix is the scope it belongs to) */
|
|
61
|
+
readonly id: string;
|
|
62
|
+
/** whether the shard ships only as a compressed `.br`/`.zst` bundle (so it must be unpacked to be read) */
|
|
63
|
+
readonly compressed: boolean;
|
|
64
|
+
/** whether this session has opened (mounted) the shard */
|
|
65
|
+
readonly accessed: boolean;
|
|
66
|
+
/** whether the shard's decompressed cache exists on disk (unpacked, this session or an earlier one) */
|
|
67
|
+
readonly unpacked: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The versions a source can answer for a package (dated releases, base-R core releases, and the recorded latest),
|
|
71
|
+
* deduplicated and ascending by R-version order. This is the single enumeration both the signature query and the
|
|
72
|
+
* version-guessing query build on.
|
|
73
|
+
*/
|
|
74
|
+
export declare function availableVersionEntries(src: PackageSignatureSource, pkg: string): AvailableVersion[];
|
|
75
|
+
/** union view over multiple sources for the same package; routes queries to the appropriate source */
|
|
76
|
+
export declare class MergedSignatureSource implements PackageSignatureSource {
|
|
77
|
+
private readonly sources;
|
|
78
|
+
constructor(sources: readonly PackageSignatureSource[]);
|
|
79
|
+
/** source carrying a version, or the one with the newest release when unpinned */
|
|
80
|
+
private pick;
|
|
81
|
+
has(pkg: string): boolean;
|
|
82
|
+
hasVersion(pkg: string, version: string): boolean;
|
|
83
|
+
isCranVersion(pkg: string, version: string): boolean;
|
|
84
|
+
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
85
|
+
classOwner(className: string, version?: string): string | undefined;
|
|
86
|
+
functions(pkg: string, version?: string): DecodedFunction[] | undefined;
|
|
87
|
+
functionByName(pkg: string, name: string, version?: string): DecodedFunction | undefined;
|
|
88
|
+
transitiveCallees(pkg: string, name: string, version?: string): string[] | undefined;
|
|
89
|
+
dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
|
|
90
|
+
packageNames(): string[];
|
|
91
|
+
isBaseR(pkg: string): boolean;
|
|
92
|
+
coreVersions(pkg: string): RVersion[] | undefined;
|
|
93
|
+
releaseDate(pkg: string, version?: string): Date | undefined;
|
|
94
|
+
releaseDates(pkg: string): VersionRelease[];
|
|
95
|
+
latestVersion(pkg: string): RVersion | undefined;
|
|
96
|
+
close(): void;
|
|
97
|
+
}
|
|
98
|
+
/** source that answers for pkg, merging all sources that carry it; undefined if none do */
|
|
99
|
+
export declare function sourceForPackage(sources: readonly PackageSignatureSource[], pkg: string): PackageSignatureSource | undefined;
|
|
38
100
|
/** options controlling where {@link SigDatabase}/{@link SigDatabaseSet} materialize decompressed caches */
|
|
39
101
|
export interface SigDbOpenOptions {
|
|
40
102
|
/** directory for the decompressed, hash-keyed cache (default: see {@link sigDbCacheDir}) */
|
|
@@ -64,6 +126,8 @@ export declare class SigDatabase implements PackageSignatureSource {
|
|
|
64
126
|
/** parsed blobs by blob index so repeated lookups skip the re-read + JSON.parse; FIFO-bounded to cap memory */
|
|
65
127
|
private readonly blobCache;
|
|
66
128
|
private static readonly BlobCacheCap;
|
|
129
|
+
/** reverse index `S3 class -> owning package`, over every package's latest version; built once (see {@link classOwner}) */
|
|
130
|
+
private classIndex;
|
|
67
131
|
private readonly fd;
|
|
68
132
|
readonly strings: string[];
|
|
69
133
|
readonly index: SigDbIndex;
|
|
@@ -95,8 +159,15 @@ export declare class SigDatabase implements PackageSignatureSource {
|
|
|
95
159
|
contentHash(blobs?: PkgBlob[]): string;
|
|
96
160
|
/** whether this bundle actually carries the given version of a package (not just the package) */
|
|
97
161
|
hasVersion(pkg: string, version: string): boolean;
|
|
162
|
+
/** whether a version is a current CRAN release (not in the package's `noncran`/removed set) */
|
|
163
|
+
isCranVersion(pkg: string, version: string): boolean;
|
|
98
164
|
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
165
|
+
classOwner(className: string, version?: string): string | undefined;
|
|
166
|
+
/** resolve a package version to its blob and the function-record indices of that version (the shared prologue of {@link functions}/{@link functionByName}) */
|
|
167
|
+
private versionFns;
|
|
99
168
|
functions(pkg: string, version?: string): DecodedFunction[] | undefined;
|
|
169
|
+
functionByName(pkg: string, name: string, version?: string): DecodedFunction | undefined;
|
|
170
|
+
transitiveCallees(pkg: string, name: string, version?: string): string[] | undefined;
|
|
100
171
|
dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
|
|
101
172
|
/** whether this is an R-core / base package (its versions are the R releases it shipped with; see {@link SigDbPkgMeta}) */
|
|
102
173
|
isBaseR(pkg: string): boolean;
|
|
@@ -140,6 +211,8 @@ export declare class SigDatabaseSet implements PackageSignatureSource {
|
|
|
140
211
|
/** package name to shard indices, ordered by preference (current before full) */
|
|
141
212
|
private readonly routes;
|
|
142
213
|
private readonly cacheDir?;
|
|
214
|
+
/** reverse index `S3 class -> owning package`, over every package's latest version; built once (see {@link classOwner}) */
|
|
215
|
+
private classIndex;
|
|
143
216
|
private constructor();
|
|
144
217
|
/** read + validate a manifest and apply the include/exclude shard filter */
|
|
145
218
|
private static prepManifest;
|
|
@@ -176,7 +249,11 @@ export declare class SigDatabaseSet implements PackageSignatureSource {
|
|
|
176
249
|
has(pkg: string): boolean;
|
|
177
250
|
/** whether any active shard actually carries the given version of a package (not just the package) */
|
|
178
251
|
hasVersion(pkg: string, version: string): boolean;
|
|
252
|
+
/** whether a version is a current CRAN release (not in the package's `noncran`/removed set) */
|
|
253
|
+
isCranVersion(pkg: string, version: string): boolean;
|
|
179
254
|
packageNames(): string[];
|
|
255
|
+
/** the on-demand load state (opened + unpacked) of every shard in this set */
|
|
256
|
+
shardStatus(): ShardStatus[];
|
|
180
257
|
/** open (blocking) and return every shard database with its manifest ref -- used for whole-set verification */
|
|
181
258
|
allShards(): MountedShard[];
|
|
182
259
|
/** load (and cache) a shared dictionary's strings by id -- for verification/inspection */
|
|
@@ -184,7 +261,10 @@ export declare class SigDatabaseSet implements PackageSignatureSource {
|
|
|
184
261
|
/** the first non-empty result from the shards that can serve `pkg` (in preferred order: current before full) */
|
|
185
262
|
private firstOf;
|
|
186
263
|
lookup(pkg: string, version?: string): LibraryExports | undefined;
|
|
264
|
+
classOwner(className: string, version?: string): string | undefined;
|
|
187
265
|
functions(pkg: string, version?: string): DecodedFunction[] | undefined;
|
|
266
|
+
functionByName(pkg: string, name: string, version?: string): DecodedFunction | undefined;
|
|
267
|
+
transitiveCallees(pkg: string, name: string, version?: string): string[] | undefined;
|
|
188
268
|
dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
|
|
189
269
|
/** whether this is an R-core / base package (see {@link SigDatabase.isBaseR}); O(1) via the hoisted metadata */
|
|
190
270
|
isBaseR(pkg: string): boolean;
|