@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
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cranPageUrl = cranPageUrl;
|
|
4
4
|
exports.cranMirrorSourceUrl = cranMirrorSourceUrl;
|
|
5
|
+
exports.rdrrDocUrl = rdrrDocUrl;
|
|
5
6
|
exports.signatureFunctionInfo = signatureFunctionInfo;
|
|
6
7
|
exports.signaturePackageInfo = signaturePackageInfo;
|
|
7
8
|
exports.signatureQueryCompleter = signatureQueryCompleter;
|
|
8
9
|
exports.executeSignatureQuery = executeSignatureQuery;
|
|
9
10
|
const semver_1 = require("semver");
|
|
10
11
|
const reader_1 = require("../../../project/sigdb/reader");
|
|
12
|
+
const sigdb_version_1 = require("../../../project/sigdb/sigdb-version");
|
|
11
13
|
const schema_1 = require("../../../project/sigdb/schema");
|
|
12
14
|
const manifest_1 = require("../../../project/sigdb/manifest");
|
|
13
15
|
const r_version_1 = require("../../../util/r-version");
|
|
16
|
+
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
17
|
+
const mermaid_1 = require("../../../util/mermaid/mermaid");
|
|
14
18
|
/** the CRAN package landing page (only meaningful for CRAN packages, not base R) */
|
|
15
19
|
function cranPageUrl(pkg) {
|
|
16
20
|
return `https://cran.r-project.org/package=${encodeURIComponent(pkg)}`;
|
|
@@ -51,20 +55,37 @@ function versionMatcher(spec) {
|
|
|
51
55
|
}
|
|
52
56
|
return v => v === spec;
|
|
53
57
|
}
|
|
54
|
-
/** the
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
/** whether the query narrows results by parameter shape (parameter names and/or a required-parameter count) */
|
|
59
|
+
function hasParameterFilter(q) {
|
|
60
|
+
return (q.parameters?.length ?? 0) > 0 || q.requiredParameters !== undefined;
|
|
61
|
+
}
|
|
62
|
+
/** a predicate over a decoded function for the query's parameter filters, or `undefined` when none are set */
|
|
63
|
+
function parameterFilter(q) {
|
|
64
|
+
if (!hasParameterFilter(q)) {
|
|
65
|
+
return undefined;
|
|
62
66
|
}
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
const nameMatchers = q.parameters?.map(nameMatcher);
|
|
68
|
+
const required = q.requiredParameters;
|
|
69
|
+
return fn => {
|
|
70
|
+
if (nameMatchers && !nameMatchers.every(m => fn.signature.some(p => m(p.name)))) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
// required = no default; `...` is never a required parameter to provide
|
|
74
|
+
return required === undefined || fn.signature.filter(p => p.name !== '...' && !p.optional).length === required;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** the version strings of a package the loaded source can answer (dated releases, base-R core releases, and the latest) */
|
|
78
|
+
function availableVersions(src, pkg) {
|
|
79
|
+
return (0, reader_1.availableVersionEntries)(src, pkg).map(e => e.version);
|
|
80
|
+
}
|
|
81
|
+
/** a predicate selecting a package release by the `@version` spec: a date bound (`<=2026`, `>=2021.05`) or a version (exact/glob/range) */
|
|
82
|
+
function releaseMatcher(spec) {
|
|
83
|
+
const byDate = (0, sigdb_version_1.releaseDateBound)(spec);
|
|
84
|
+
if (byDate) {
|
|
85
|
+
return e => byDate(e.date);
|
|
66
86
|
}
|
|
67
|
-
|
|
87
|
+
const byVersion = versionMatcher(spec);
|
|
88
|
+
return e => byVersion(e.version);
|
|
68
89
|
}
|
|
69
90
|
/** read-only CRAN GitHub mirror base; `github.com/cran/<pkg>` mirrors every CRAN package and tags each release */
|
|
70
91
|
const CranGithubMirror = 'https://github.com/cran';
|
|
@@ -78,8 +99,8 @@ function cranMirrorSourceUrl(pkg, version, file, line) {
|
|
|
78
99
|
const anchor = line !== undefined && line >= 0 ? `#L${line}` : '';
|
|
79
100
|
return `${cranMirrorRepoUrl(pkg)}/blob/${ref}/${file}${anchor}`;
|
|
80
101
|
}
|
|
81
|
-
/** function/topic names that map cleanly to an rdrr.io man page (skip operators like `+.gg`, `[.data.frame`) */
|
|
82
|
-
const RdrrTopicName = /^[A-Za-z.][A-Za-z0-9._]*$/;
|
|
102
|
+
/** function/topic names that map cleanly to an rdrr.io man page (skip operators like `+.gg`, `[.data.frame`; Rd topics allow hyphens, e.g. `dplyr-package`) */
|
|
103
|
+
const RdrrTopicName = /^[A-Za-z.][A-Za-z0-9._-]*$/;
|
|
83
104
|
/** best-effort rdrr.io documentation link: `/r/<pkg>/<fn>` for base R, `/cran/<pkg>/man/<fn>` for CRAN */
|
|
84
105
|
function rdrrDocUrl(pkg, fn, opts) {
|
|
85
106
|
if (!RdrrTopicName.test(fn)) {
|
|
@@ -93,9 +114,13 @@ function rdrrDocUrl(pkg, fn, opts) {
|
|
|
93
114
|
}
|
|
94
115
|
return undefined;
|
|
95
116
|
}
|
|
96
|
-
/** the
|
|
117
|
+
/** the doc link for a function: its help topic (else its name), or none when it is proven undocumented (`no-doc`) */
|
|
118
|
+
function docUrlFor(pkg, fn, base, cran) {
|
|
119
|
+
return fn.props.includes('no-doc') ? undefined : rdrrDocUrl(pkg, fn.topic ?? fn.name, { base, cran });
|
|
120
|
+
}
|
|
121
|
+
/** the trailing fields shared by every function view: definition location, CRAN-mirror source link, and rdrr.io doc link */
|
|
97
122
|
function locationFields(pkg, fn, version, base, cran) {
|
|
98
|
-
const doc =
|
|
123
|
+
const doc = docUrlFor(pkg, fn, base, cran);
|
|
99
124
|
return {
|
|
100
125
|
...(fn.file ? { file: fn.file } : {}),
|
|
101
126
|
...(fn.line >= 0 ? { line: fn.line } : {}),
|
|
@@ -103,7 +128,7 @@ function locationFields(pkg, fn, version, base, cran) {
|
|
|
103
128
|
...(doc ? { docUrl: doc } : {})
|
|
104
129
|
};
|
|
105
130
|
}
|
|
106
|
-
/** the decoded view of one function, adding the CRAN-mirror source link
|
|
131
|
+
/** the decoded view of one function, adding the CRAN-mirror source link */
|
|
107
132
|
function decodedToView(pkg, fn, version, opts) {
|
|
108
133
|
return {
|
|
109
134
|
name: fn.name,
|
|
@@ -135,17 +160,130 @@ function signatureFunctionInfo(src, pkg, fnName, version) {
|
|
|
135
160
|
}
|
|
136
161
|
const exports = src.lookup(pkg, version) ?? src.lookup(pkg);
|
|
137
162
|
const view = decodedToView(pkg, fn, exports?.version, { cran: exports?.cran ?? false, base: src.isBaseR(pkg) });
|
|
138
|
-
// S3
|
|
139
|
-
//
|
|
140
|
-
// aggregate transitively and so cannot distinguish a real generic from one that merely reaches a dispatch.
|
|
163
|
+
// an S3 generic's methods are the same-package `<generic>.<class>` functions that are themselves registered
|
|
164
|
+
// S3 methods; the reverse links a registered method back to the generic it dispatches for
|
|
141
165
|
const methods = (fns ?? [])
|
|
142
|
-
.filter(f => f.name !== fn.name && f.name.startsWith(fn.name + '.'))
|
|
166
|
+
.filter(f => f.name !== fn.name && f.name.startsWith(fn.name + '.') && isS3Method(f))
|
|
143
167
|
.map(f => f.name)
|
|
144
168
|
.sort();
|
|
145
|
-
|
|
146
|
-
|
|
169
|
+
const s3method = isS3Method(fn) ? s3MethodParts(src, pkg, fns, fn.name) : undefined;
|
|
170
|
+
return {
|
|
171
|
+
...view,
|
|
172
|
+
...(methods.length > 0 ? { s3generic: true, s3methods: methods } : {}),
|
|
173
|
+
...(s3method ? { s3method } : {})
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/** whether a function is a registered S3 method (the `s3-method` property, set from its NAMESPACE at build time) */
|
|
177
|
+
function isS3Method(fn) {
|
|
178
|
+
return fn.props.includes('s3-method');
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The generic and dispatch class of a registered S3 method named `generic.class`: the longest dotted prefix that
|
|
182
|
+
* names a function in the same package or base R is the generic, the remainder is the class, and the owning package
|
|
183
|
+
* is returned too (`print.rema` gives `print` in `base`, class `rema`). Only ever called for names flagged
|
|
184
|
+
* {@link isS3Method}, so ordinary dotted names like `data.frame` never reach here and are not mistaken for methods.
|
|
185
|
+
*/
|
|
186
|
+
function s3MethodParts(src, pkg, fns, name) {
|
|
187
|
+
const bases = (0, r_base_packages_1.baseRPackages)();
|
|
188
|
+
for (let dot = name.lastIndexOf('.'); dot > 0; dot = name.lastIndexOf('.', dot - 1)) {
|
|
189
|
+
const generic = name.slice(0, dot);
|
|
190
|
+
if (fns?.some(f => f.name === generic)) {
|
|
191
|
+
return { generic, class: name.slice(dot + 1), package: pkg };
|
|
192
|
+
}
|
|
193
|
+
for (const base of bases) {
|
|
194
|
+
if (base !== pkg && src.functionByName(base, generic) !== undefined) {
|
|
195
|
+
return { generic, class: name.slice(dot + 1), package: base };
|
|
196
|
+
}
|
|
197
|
+
}
|
|
147
198
|
}
|
|
148
|
-
return
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
/** how many nodes the call-graph render is capped at (cross-package expansion could otherwise explode into base R) */
|
|
202
|
+
const CallGraphMaxNodes = 300;
|
|
203
|
+
/**
|
|
204
|
+
* A mermaid.live link for the transitive call graph reachable from `pkg::root`, resolved across package borders:
|
|
205
|
+
* a bare callee is attributed to the first namespace that exports it (the calling package, then its attached
|
|
206
|
+
* `Depends`/`Imports`, then base R), qualified as `owner::fn`, and expanded there. Base R calls are qualified leaves
|
|
207
|
+
* (their internals are noise); explicit `pkg::fn` calls resolve directly. Bounded by {@link CallGraphMaxNodes}.
|
|
208
|
+
*/
|
|
209
|
+
function signatureCallGraphUrl(src, pkg, version, root) {
|
|
210
|
+
const bases = new Set((0, r_base_packages_1.baseRPackages)());
|
|
211
|
+
const exportsCache = new Map();
|
|
212
|
+
const exportsOf = (p, v) => {
|
|
213
|
+
const key = `${p}\0${v ?? ''}`;
|
|
214
|
+
let s = exportsCache.get(key);
|
|
215
|
+
if (s === undefined) {
|
|
216
|
+
exportsCache.set(key, s = new Set(src.functions(p, v)?.map(f => f.name) ?? src.lookup(p, v)?.exported ?? []));
|
|
217
|
+
}
|
|
218
|
+
return s;
|
|
219
|
+
};
|
|
220
|
+
const attachedDeps = (p, v) => (src.dependencies(p, v) ?? []).filter(d => d.type === 0 /* DepType.Depends */ || d.type === 1 /* DepType.Imports */).map(d => d.name);
|
|
221
|
+
/** resolve a callee named in `p@v` to its owning `{ owner, name }`, or undefined when no loaded namespace exports it */
|
|
222
|
+
const resolve = (p, v, callee) => {
|
|
223
|
+
const q = /^([A-Za-z][\w.]*):::?(.+)$/.exec(callee);
|
|
224
|
+
if (q) {
|
|
225
|
+
return { owner: q[1], name: q[2] };
|
|
226
|
+
}
|
|
227
|
+
if (exportsOf(p, v).has(callee)) {
|
|
228
|
+
return { owner: p, name: callee };
|
|
229
|
+
}
|
|
230
|
+
for (const dep of attachedDeps(p, v)) {
|
|
231
|
+
if (exportsOf(dep, src.latestVersion(dep)?.str).has(callee)) {
|
|
232
|
+
return { owner: dep, name: callee };
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// base R (incl. C-level primitives absent from the sigdb: `c`, `is.na`, ...) via flowR's base export/primitive store
|
|
236
|
+
const base = (0, r_base_packages_1.baseRExportOwner)(callee);
|
|
237
|
+
return base !== undefined ? { owner: base, name: callee } : undefined;
|
|
238
|
+
};
|
|
239
|
+
// each distinct node is keyed by `owner::name`, remembering its owning package (for the subgraph) and short label
|
|
240
|
+
const nodes = new Map();
|
|
241
|
+
const node = (owner, short) => {
|
|
242
|
+
const key = owner ? `${owner}::${short}` : short;
|
|
243
|
+
let n = nodes.get(key);
|
|
244
|
+
if (n === undefined) {
|
|
245
|
+
nodes.set(key, n = { id: `n${nodes.size}`, owner, short });
|
|
246
|
+
}
|
|
247
|
+
return n.id;
|
|
248
|
+
};
|
|
249
|
+
const rootId = node(pkg, root);
|
|
250
|
+
const edges = [];
|
|
251
|
+
const seen = new Set();
|
|
252
|
+
const queue = [{ owner: pkg, ver: version, name: root, id: rootId }];
|
|
253
|
+
while (queue.length > 0 && nodes.size < CallGraphMaxNodes) {
|
|
254
|
+
const cur = queue.pop();
|
|
255
|
+
const key = `${cur.owner}::${cur.name}`;
|
|
256
|
+
if (seen.has(key)) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
seen.add(key);
|
|
260
|
+
for (const callee of src.functionByName(cur.owner, cur.name, cur.ver)?.callees ?? []) {
|
|
261
|
+
const r = resolve(cur.owner, cur.ver, callee);
|
|
262
|
+
edges.push(` ${cur.id} --> ${node(r?.owner, r ? r.name : callee)}`);
|
|
263
|
+
// expand into a resolved same/other CRAN package (not base R -- its internals explode the graph), avoiding cycles
|
|
264
|
+
if (r && !bases.has(r.owner) && !seen.has(`${r.owner}::${r.name}`) && nodes.size < CallGraphMaxNodes) {
|
|
265
|
+
queue.push({ owner: r.owner, ver: r.owner === cur.owner ? cur.ver : src.latestVersion(r.owner)?.str, name: r.name, id: node(r.owner, r.name) });
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
// group nodes into a `subgraph` per owning package; unqualified/unresolved calls stay ungrouped
|
|
270
|
+
const byOwner = new Map();
|
|
271
|
+
const ungrouped = [];
|
|
272
|
+
for (const { id, owner, short } of nodes.values()) {
|
|
273
|
+
const decl = `${id}["${short.replace(/"/g, '"')}"]`;
|
|
274
|
+
if (owner === undefined) {
|
|
275
|
+
ungrouped.push(` ${decl}`);
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
let decls = byOwner.get(owner);
|
|
279
|
+
if (decls === undefined) {
|
|
280
|
+
byOwner.set(owner, decls = []);
|
|
281
|
+
}
|
|
282
|
+
decls.push(` ${decl}`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const subgraphs = [...byOwner].flatMap(([owner, decls]) => [` subgraph ${owner}`, ...decls, ' end']);
|
|
286
|
+
return mermaid_1.Mermaid.codeToUrl(['flowchart LR', ...subgraphs, ...ungrouped, ...edges].join('\n'));
|
|
149
287
|
}
|
|
150
288
|
/** the full view of a package: version, kind, export breakdown, dependencies, and every function's view */
|
|
151
289
|
function signaturePackageInfo(src, pkg, resolved) {
|
|
@@ -195,9 +333,38 @@ function suggest(candidates, query, limit = 6) {
|
|
|
195
333
|
}
|
|
196
334
|
/** cap on wildcard-search hits, so a `* *` search cannot exhaust memory */
|
|
197
335
|
const MaxMatches = 500;
|
|
336
|
+
/** how many parameter names a match preview shows before eliding the rest with `…` */
|
|
337
|
+
const ParamPreviewCap = 4;
|
|
338
|
+
/**
|
|
339
|
+
* A short preview of a function's parameters for a match, when the query filters by parameter, kept in signature
|
|
340
|
+
* order (highlighting never reorders it): the matched parameters are always shown, padded with leading parameters
|
|
341
|
+
* for context up to {@link ParamPreviewCap} and elided with `…` when any are dropped. Also returns the matched names
|
|
342
|
+
* so the renderer can highlight them. `undefined` when no parameter filter is set.
|
|
343
|
+
*/
|
|
344
|
+
function matchedParamPreview(fn, q) {
|
|
345
|
+
if (!hasParameterFilter(q)) {
|
|
346
|
+
return undefined;
|
|
347
|
+
}
|
|
348
|
+
const names = fn.signature.map(p => p.name);
|
|
349
|
+
const matched = q.parameters?.length
|
|
350
|
+
? names.filter(n => q.parameters?.some(pat => nameMatcher(pat)(n)))
|
|
351
|
+
: [];
|
|
352
|
+
const show = new Set(matched.length > 0 ? matched : fn.signature.filter(p => p.name !== '...' && !p.optional).map(p => p.name));
|
|
353
|
+
for (const n of names) {
|
|
354
|
+
if (show.size >= ParamPreviewCap) {
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
show.add(n);
|
|
358
|
+
}
|
|
359
|
+
const preview = names.filter(n => show.has(n));
|
|
360
|
+
if (preview.length < names.length) {
|
|
361
|
+
preview.push('…');
|
|
362
|
+
}
|
|
363
|
+
return { preview, matched };
|
|
364
|
+
}
|
|
198
365
|
/** a compact view for a wildcard search hit (signature/call-graph omitted; the JSON dump carries those per name) */
|
|
199
|
-
function compactMatch(pkg, fn, version, base, cran) {
|
|
200
|
-
const doc =
|
|
366
|
+
function compactMatch(pkg, fn, version, base, cran, params) {
|
|
367
|
+
const doc = docUrlFor(pkg, fn, base, cran);
|
|
201
368
|
return {
|
|
202
369
|
package: pkg,
|
|
203
370
|
name: fn.name,
|
|
@@ -206,7 +373,9 @@ function compactMatch(pkg, fn, version, base, cran) {
|
|
|
206
373
|
...(fn.file ? { file: fn.file } : {}),
|
|
207
374
|
...(fn.line >= 0 ? { line: fn.line } : {}),
|
|
208
375
|
...(cran && !base && fn.file ? { sourceUrl: cranMirrorSourceUrl(pkg, version, fn.file, fn.line) } : {}),
|
|
209
|
-
...(doc ? { docUrl: doc } : {})
|
|
376
|
+
...(doc ? { docUrl: doc } : {}),
|
|
377
|
+
...(params && params.preview.length > 0 ? { parameters: params.preview } : {}),
|
|
378
|
+
...(params && params.matched.length > 0 ? { matchedParameters: params.matched } : {})
|
|
210
379
|
};
|
|
211
380
|
}
|
|
212
381
|
/** the versions of a package across every loaded source that holds it (current + history + any mounted extra) */
|
|
@@ -245,12 +414,14 @@ function searchSources(sources, allNames, q) {
|
|
|
245
414
|
const cap = MaxMatches;
|
|
246
415
|
const pkgMatch = nameMatcher(q.package);
|
|
247
416
|
const matchedPkgs = [...allNames].filter(pkgMatch).sort();
|
|
248
|
-
const
|
|
417
|
+
const relMatch = q.version ? releaseMatcher(q.version) : undefined;
|
|
249
418
|
// every source holding a package (its latest lives in `current`, its older releases in `history`)
|
|
250
419
|
const owningOf = (pkg) => sources.filter(s => s.has(pkg));
|
|
251
|
-
// the versions of `pkg` matching
|
|
252
|
-
const matchingVersions = (owners, pkg, m) => [...new Set(owners.flatMap(s =>
|
|
253
|
-
|
|
420
|
+
// the versions of `pkg` matching the spec, unioned across all owning sources (so a `3.*`/date filter reaches history)
|
|
421
|
+
const matchingVersions = (owners, pkg, m) => [...new Set(owners.flatMap(s => (0, reader_1.availableVersionEntries)(s, pkg).filter(m).map(e => e.version)))];
|
|
422
|
+
const paramPred = parameterFilter(q);
|
|
423
|
+
// a parameter filter (with no function name) still means "search functions", not "list packages"
|
|
424
|
+
if (!q.function && paramPred === undefined) {
|
|
254
425
|
const packages = [];
|
|
255
426
|
let truncated = false;
|
|
256
427
|
for (const pkg of matchedPkgs) {
|
|
@@ -259,9 +430,9 @@ function searchSources(sources, allNames, q) {
|
|
|
259
430
|
continue;
|
|
260
431
|
}
|
|
261
432
|
const base = owners[0].isBaseR(pkg);
|
|
262
|
-
// with a version filter, union the matching versions across all sources (so a `3
|
|
263
|
-
const versions =
|
|
264
|
-
? matchingVersions(owners, pkg,
|
|
433
|
+
// with a version filter, union the matching versions across all sources (so a `3.*`/date reaches history)
|
|
434
|
+
const versions = relMatch
|
|
435
|
+
? matchingVersions(owners, pkg, relMatch).sort((a, b) => r_version_1.RVersion.compare(a, b))
|
|
265
436
|
: undefined;
|
|
266
437
|
if (versions !== undefined && versions.length === 0) {
|
|
267
438
|
continue;
|
|
@@ -276,8 +447,12 @@ function searchSources(sources, allNames, q) {
|
|
|
276
447
|
}
|
|
277
448
|
return { packages, truncated };
|
|
278
449
|
}
|
|
279
|
-
const fnMatch = nameMatcher(q.function);
|
|
450
|
+
const fnMatch = q.function ? nameMatcher(q.function) : () => true;
|
|
451
|
+
// an exact function name lets us seek that one record (decoding only it) instead of decoding every function of
|
|
452
|
+
// every package -- the difference between a fast `* ggplot` and one that decodes the whole database
|
|
453
|
+
const exactName = q.function !== undefined && !hasGlob(q.function);
|
|
280
454
|
const matches = [];
|
|
455
|
+
let searched = 0;
|
|
281
456
|
let truncated = false;
|
|
282
457
|
for (const pkg of matchedPkgs) {
|
|
283
458
|
const owners = owningOf(pkg);
|
|
@@ -285,25 +460,48 @@ function searchSources(sources, allNames, q) {
|
|
|
285
460
|
continue;
|
|
286
461
|
}
|
|
287
462
|
const base = owners[0].isBaseR(pkg);
|
|
288
|
-
//
|
|
289
|
-
//
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
const exports = s.lookup(pkg, v) ?? s.lookup(pkg);
|
|
297
|
-
const cran = (exports?.cran ?? false) && !base;
|
|
298
|
-
for (const fn of s.functions(pkg, v) ?? s.functions(pkg) ?? []) {
|
|
299
|
-
if (fnMatch(fn.name)) {
|
|
300
|
-
if (matches.length >= cap) {
|
|
301
|
-
truncated = true;
|
|
302
|
-
break;
|
|
463
|
+
// map each version to the single source that owns it (current before history), computed once per package so a
|
|
464
|
+
// version-filtered function search does not rebuild the release list per candidate version
|
|
465
|
+
const ownerOf = new Map();
|
|
466
|
+
if (relMatch) {
|
|
467
|
+
for (const o of owners) {
|
|
468
|
+
for (const e of (0, reader_1.availableVersionEntries)(o, pkg)) {
|
|
469
|
+
if (!ownerOf.has(e.version) && relMatch(e)) {
|
|
470
|
+
ownerOf.set(e.version, o);
|
|
303
471
|
}
|
|
304
|
-
matches.push(compactMatch(pkg, fn, exports?.version, base, cran));
|
|
305
472
|
}
|
|
306
473
|
}
|
|
474
|
+
}
|
|
475
|
+
// versions to scan: with a filter, each matching release newest-first (scanned in its single owning source, so a
|
|
476
|
+
// release in more than one source is not double-counted, and the truncation cap keeps the newest); else just the latest
|
|
477
|
+
const versionsToScan = relMatch ? [...ownerOf.keys()].sort((a, b) => r_version_1.RVersion.compare(b, a)) : [undefined];
|
|
478
|
+
for (const v of versionsToScan) {
|
|
479
|
+
const s = v === undefined ? owners[0] : ownerOf.get(v) ?? owners[0];
|
|
480
|
+
const candidates = exactName
|
|
481
|
+
? (fn => fn ? [fn] : [])(s.functionByName(pkg, q.function, v))
|
|
482
|
+
: (s.functions(pkg, v) ?? s.functions(pkg) ?? []);
|
|
483
|
+
// resolve the (heavier) package export view only once a function actually matches, so non-matching
|
|
484
|
+
// packages in a wildcard search cost just the name lookup, not a full export derivation
|
|
485
|
+
let exports;
|
|
486
|
+
let looked = false;
|
|
487
|
+
for (const fn of candidates) {
|
|
488
|
+
if (!fnMatch(fn.name)) {
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
searched++;
|
|
492
|
+
if (paramPred && !paramPred(fn)) {
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
if (matches.length >= cap) {
|
|
496
|
+
truncated = true;
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
if (!looked) {
|
|
500
|
+
exports = s.lookup(pkg, v) ?? s.lookup(pkg);
|
|
501
|
+
looked = true;
|
|
502
|
+
}
|
|
503
|
+
matches.push(compactMatch(pkg, fn, exports?.version, base, (exports?.cran ?? false) && !base, matchedParamPreview(fn, q)));
|
|
504
|
+
}
|
|
307
505
|
if (truncated) {
|
|
308
506
|
break;
|
|
309
507
|
}
|
|
@@ -312,7 +510,7 @@ function searchSources(sources, allNames, q) {
|
|
|
312
510
|
break;
|
|
313
511
|
}
|
|
314
512
|
}
|
|
315
|
-
return { matches, matchCount: matches.length, truncated };
|
|
513
|
+
return { matches, matchCount: matches.length, searched, truncated, latestOnly: relMatch === undefined };
|
|
316
514
|
}
|
|
317
515
|
/** the discoverable bundle sources for Tab completion (process-wide cached; opening the manifest reads no shard) */
|
|
318
516
|
function completionSources() {
|
|
@@ -385,6 +583,15 @@ function signatureQueryCompleter(line, startingNewArg) {
|
|
|
385
583
|
}
|
|
386
584
|
return { completions: [] };
|
|
387
585
|
}
|
|
586
|
+
/** the deduped shard load-state across all sharded sources (a shard id mounted by several sources folds into one, accessed/unpacked if any source is) */
|
|
587
|
+
function collectShardStatus(sources) {
|
|
588
|
+
const byId = new Map();
|
|
589
|
+
for (const s of sources.flatMap(src => src instanceof reader_1.SigDatabaseSet ? src.shardStatus() : [])) {
|
|
590
|
+
const prev = byId.get(s.id);
|
|
591
|
+
byId.set(s.id, prev ? { ...prev, accessed: prev.accessed || s.accessed, unpacked: prev.unpacked || s.unpacked } : s);
|
|
592
|
+
}
|
|
593
|
+
return [...byId.values()];
|
|
594
|
+
}
|
|
388
595
|
/**
|
|
389
596
|
* Executes the signature query. With no `package` it summarizes the loaded databases. A glob in `package`/`function`
|
|
390
597
|
* or a multi-version `version` triggers a wildcard search (matching packages or functions). Otherwise a single
|
|
@@ -395,7 +602,7 @@ async function executeSignatureQuery({ analyzer }, queries) {
|
|
|
395
602
|
const start = Date.now();
|
|
396
603
|
const q = queries[queries.length - 1] ?? { type: 'signature' };
|
|
397
604
|
const deps = analyzer.inspectContext().deps;
|
|
398
|
-
const databases = deps.
|
|
605
|
+
const databases = deps.loadedSignatureDatabases()
|
|
399
606
|
.map(d => ({ scope: d.scope, version: d.version, date: d.date }));
|
|
400
607
|
// the plugin's loaded sources (bundled default + $FLOWR_SIGDB + anything added at runtime), so the query
|
|
401
608
|
// reflects dynamically-mounted sources
|
|
@@ -408,10 +615,12 @@ async function executeSignatureQuery({ analyzer }, queries) {
|
|
|
408
615
|
}
|
|
409
616
|
const meta = () => ({ '.meta': { timing: Date.now() - start }, databases, packageCount: packages.size, sourceCount: sources.length });
|
|
410
617
|
if (!q.package) {
|
|
411
|
-
|
|
618
|
+
// shard load-state is only shown in the summary, so it is only worth its filesystem probes here
|
|
619
|
+
return { ...meta(), shards: collectShardStatus(sources) };
|
|
412
620
|
}
|
|
413
|
-
// wildcard search: a glob in the package/function name,
|
|
414
|
-
|
|
621
|
+
// wildcard search: a glob in the package/function name, a version spec matching more than one release (a range or
|
|
622
|
+
// a date bound), or a parameter filter (which narrows a set of functions and so always goes through the search path)
|
|
623
|
+
if (hasGlob(q.package) || (q.function !== undefined && hasGlob(q.function)) || (q.version !== undefined && (isMultiVersion(q.version) || (0, sigdb_version_1.isDateBound)(q.version))) || hasParameterFilter(q)) {
|
|
415
624
|
const found = searchSources(sources, packages, q);
|
|
416
625
|
// a version glob against a single concrete, known package that matched no release: point at the available versions
|
|
417
626
|
// (the same guidance the exact-version path gives) instead of a bare "0 matched"
|
|
@@ -442,7 +651,8 @@ async function executeSignatureQuery({ analyzer }, queries) {
|
|
|
442
651
|
if (q.function) {
|
|
443
652
|
const fn = signatureFunctionInfo(resolvedSrc, q.package, q.function, version);
|
|
444
653
|
if (fn) {
|
|
445
|
-
|
|
654
|
+
const cg = q.callGraph ? signatureCallGraphUrl(resolvedSrc, q.package, version, fn.name) : undefined;
|
|
655
|
+
return { ...meta(), function: cg ? { ...fn, callGraph: cg } : fn };
|
|
446
656
|
}
|
|
447
657
|
const exports = resolvedSrc.lookup(q.package, version) ?? resolvedSrc.lookup(q.package);
|
|
448
658
|
const universe = new Set([
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
2
|
+
import type { ShardStatus } from '../../../project/sigdb/reader';
|
|
2
3
|
import Joi from 'joi';
|
|
3
4
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
5
|
import type { ParsedQueryLine } from '../../query';
|
|
@@ -6,11 +7,14 @@ import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
|
6
7
|
import type { FlowrConfig } from '../../../config';
|
|
7
8
|
import { executeSignatureQuery, signatureQueryCompleter } from './signature-query-executor';
|
|
8
9
|
/**
|
|
9
|
-
* Inspects the loaded signature database(s) (see the {@link https://github.com/flowr-analysis/flowr/wiki/
|
|
10
|
+
* Inspects the loaded signature database(s) (see the {@link https://github.com/flowr-analysis/flowr/wiki/Signature-Database|Signature Database wiki}).
|
|
10
11
|
* The `package` and `function` fields accept glob wildcards (`*`, `?`), and `version` accepts an exact version,
|
|
11
|
-
* a glob (`3.*`),
|
|
12
|
-
* a single exact package/function yields the full view
|
|
13
|
-
*
|
|
12
|
+
* a glob (`3.*`), a semver range (`>=3.0.0`, `3.x`), or a release-date bound (`<=2026`, `>=2021.05`, YYYY.MM.DD).
|
|
13
|
+
* With no `package` it summarizes the loaded databases; a single exact package/function yields the full view
|
|
14
|
+
* (signature, definition location, CRAN-mirror source link); a wildcard yields the matching set. `parameters` and `requiredParameters` further filter to
|
|
15
|
+
* functions that have a parameter matching *every* given name (position-independent) or an exact required-parameter
|
|
16
|
+
* count (a parameter filter alone, e.g. `--param fuzz`, searches every package; repeat `--param` or comma-separate
|
|
17
|
+
* to require several, e.g. `--param data --param mapping`).
|
|
14
18
|
*/
|
|
15
19
|
export interface SignatureQuery extends BaseQueryFormat {
|
|
16
20
|
readonly type: 'signature';
|
|
@@ -18,8 +22,14 @@ export interface SignatureQuery extends BaseQueryFormat {
|
|
|
18
22
|
readonly package?: string;
|
|
19
23
|
/** the function/symbol within {@link package} to inspect (glob wildcards allowed) */
|
|
20
24
|
readonly function?: string;
|
|
21
|
-
/** a version spec: an exact version, a glob (`3.*`),
|
|
25
|
+
/** a version spec: an exact version, a glob (`3.*`), a semver range (`>=3.0.0`, `3.x`), or a release-date bound (`<=2026`, `>=2021.05` in YYYY.MM.DD) */
|
|
22
26
|
readonly version?: string;
|
|
27
|
+
/** keep only functions that have a parameter matching *every* one of these names (glob wildcards allowed, position-independent, e.g. `fuzz`, `.*data`) */
|
|
28
|
+
readonly parameters?: readonly string[];
|
|
29
|
+
/** keep only functions with exactly this many required (no-default) parameters, excluding `...` */
|
|
30
|
+
readonly requiredParameters?: number;
|
|
31
|
+
/** for a single function, also render its transitive call graph as a mermaid.live link (`--cg`) */
|
|
32
|
+
readonly callGraph?: boolean;
|
|
23
33
|
}
|
|
24
34
|
/** one parameter of a function signature */
|
|
25
35
|
export interface SignatureParameterView {
|
|
@@ -41,12 +51,20 @@ export interface SignatureFunctionView {
|
|
|
41
51
|
readonly line?: number;
|
|
42
52
|
/** deep link into the read-only CRAN GitHub mirror, when the definition location + a CRAN version are known */
|
|
43
53
|
readonly sourceUrl?: string;
|
|
44
|
-
/** rdrr.io documentation link
|
|
54
|
+
/** best-effort rdrr.io documentation link, when the function name maps to a documentable topic */
|
|
45
55
|
readonly docUrl?: string;
|
|
46
56
|
/** whether the function looks like an S3 generic (has `<generic>.<class>` dispatch targets in the same package) */
|
|
47
57
|
readonly s3generic?: boolean;
|
|
48
58
|
/** the `<generic>.<class>` dispatch targets found in the same package */
|
|
49
59
|
readonly s3methods?: readonly string[];
|
|
60
|
+
/** when the function is an S3 method, the generic it dispatches for (`print.rema` is `print` in `base`, class `rema`); lazily computed */
|
|
61
|
+
readonly s3method?: {
|
|
62
|
+
readonly generic: string;
|
|
63
|
+
readonly class: string;
|
|
64
|
+
readonly package: string;
|
|
65
|
+
};
|
|
66
|
+
/** a mermaid.live link visualizing the transitive call graph from this function (only when requested with `--cg`) */
|
|
67
|
+
readonly callGraph?: string;
|
|
50
68
|
}
|
|
51
69
|
/** one declared dependency of a package */
|
|
52
70
|
export interface SignatureDependencyView {
|
|
@@ -88,7 +106,12 @@ export interface SignatureMatchView {
|
|
|
88
106
|
readonly file?: string;
|
|
89
107
|
readonly line?: number;
|
|
90
108
|
readonly sourceUrl?: string;
|
|
109
|
+
/** best-effort rdrr.io documentation link, when the function name maps to a documentable topic */
|
|
91
110
|
readonly docUrl?: string;
|
|
111
|
+
/** a preview of the function's parameters (the ones a parameter/required filter matched first), when such a filter is active */
|
|
112
|
+
readonly parameters?: readonly string[];
|
|
113
|
+
/** the subset of {@link parameters} that the `--param` filter actually matched, so the renderer can highlight them */
|
|
114
|
+
readonly matchedParameters?: readonly string[];
|
|
92
115
|
}
|
|
93
116
|
/** a hit from a wildcard package search */
|
|
94
117
|
export interface SignaturePackageMatch {
|
|
@@ -110,6 +133,8 @@ export interface SignatureQueryResult extends BaseQueryResult {
|
|
|
110
133
|
readonly databases: readonly SignatureDatabaseView[];
|
|
111
134
|
readonly packageCount: number;
|
|
112
135
|
readonly sourceCount: number;
|
|
136
|
+
/** per-shard load state of the sharded sources (which shards this session has opened and unpacked); summary only */
|
|
137
|
+
readonly shards?: readonly ShardStatus[];
|
|
113
138
|
/** set when a single package was requested and found */
|
|
114
139
|
readonly package?: SignaturePackageView;
|
|
115
140
|
/** set when a single function was requested and found */
|
|
@@ -117,6 +142,10 @@ export interface SignatureQueryResult extends BaseQueryResult {
|
|
|
117
142
|
/** function hits from a wildcard search */
|
|
118
143
|
readonly matches?: readonly SignatureMatchView[];
|
|
119
144
|
readonly matchCount?: number;
|
|
145
|
+
/** how many functions the search examined against the filters (only interesting when it exceeds the hit count) */
|
|
146
|
+
readonly searched?: number;
|
|
147
|
+
/** whether the search covered only the latest version of each package, so historical releases were skipped */
|
|
148
|
+
readonly latestOnly?: boolean;
|
|
120
149
|
/** package hits from a wildcard package search (no function given) */
|
|
121
150
|
readonly packages?: readonly SignaturePackageMatch[];
|
|
122
151
|
/** whether the match list was capped */
|
|
@@ -128,10 +157,12 @@ export interface SignatureQueryResult extends BaseQueryResult {
|
|
|
128
157
|
/** parse a signature-query repl line into a query: `pkg`, `pkg fn`, `pkg::fn`, `pkg@ver`, globs */
|
|
129
158
|
declare function signatureQueryLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'signature'>;
|
|
130
159
|
export declare const SignatureQueryDefinition: {
|
|
160
|
+
readonly title: "Signature Query";
|
|
131
161
|
readonly executor: typeof executeSignatureQuery;
|
|
132
162
|
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[], _query: readonly import("../../query").Query[]) => true;
|
|
133
163
|
readonly fromLine: typeof signatureQueryLineParser;
|
|
134
164
|
readonly completer: typeof signatureQueryCompleter;
|
|
165
|
+
readonly syntax: "@signature [<pkg>[@<version>]] [<pkg>::<fn> | <fn>] [--param <name>[,...]] [--required <n>] [--cg] [--help]";
|
|
135
166
|
readonly schema: Joi.ObjectSchema<any>;
|
|
136
167
|
readonly flattenInvolvedNodes: () => NodeId[];
|
|
137
168
|
};
|