@eagleoutice/flowr 2.11.1 → 2.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +187 -257
- package/abstract-interpretation/absint-visitor.d.ts +1 -0
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +6 -2
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +3 -1
- package/benchmark/summarizer/second-phase/graph.js +5 -0
- package/cli/common/options.d.ts +8 -0
- package/cli/common/options.js +2 -0
- package/cli/common/scripts-info.d.ts +8 -0
- package/cli/repl/commands/repl-commands.d.ts +1 -0
- package/cli/repl/commands/repl-commands.js +66 -15
- package/cli/repl/commands/repl-dataflow.js +48 -4
- package/cli/repl/commands/repl-main.d.ts +2 -0
- package/cli/repl/commands/repl-main.js +5 -0
- package/cli/repl/commands/repl-query.d.ts +4 -1
- package/cli/repl/commands/repl-query.js +72 -22
- package/cli/repl/commands/repl-signature.d.ts +7 -0
- package/cli/repl/commands/repl-signature.js +119 -0
- package/cli/repl/core.d.ts +8 -1
- package/cli/repl/core.js +46 -6
- package/cli/repl/ghost-hint.d.ts +37 -0
- package/cli/repl/ghost-hint.js +72 -0
- package/cli/repl/parser/slice-query-parser.d.ts +11 -1
- package/cli/repl/parser/slice-query-parser.js +45 -16
- package/cli/repl/print-version.d.ts +2 -4
- package/cli/repl/print-version.js +41 -23
- package/cli/repl/server/connection.js +19 -17
- package/cli/slicer-app.d.ts +2 -0
- package/cli/slicer-app.js +3 -3
- package/cli/wiki.d.ts +2 -2
- package/cli/wiki.js +2 -2
- package/config.d.ts +63 -2
- package/config.js +64 -8
- package/control-flow/cfg-dead-code.js +0 -1
- package/control-flow/control-flow-graph.js +6 -6
- package/control-flow/diff-cfg.js +2 -2
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/core/print/slice-diff-ansi.js +8 -8
- package/core/steps/all/core/20-dataflow.d.ts +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +5 -0
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +7 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +6 -2
- package/core/steps/pipeline/default-pipelines.d.ts +20 -16
- package/data/r-base-packages.generated.d.ts +44 -0
- package/data/r-base-packages.generated.js +32 -0
- package/data/r-base-primitives.generated.d.ts +1 -0
- package/data/r-base-primitives.generated.js +15 -0
- package/data/sigdb/sigdb.remote.json +112 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in.d.ts +14 -4
- package/dataflow/environments/built-in.js +13 -2
- package/dataflow/environments/data-masking-functions.d.ts +12 -0
- package/dataflow/environments/data-masking-functions.js +46 -0
- package/dataflow/environments/default-builtin-config.d.ts +72 -19
- package/dataflow/environments/default-builtin-config.js +48 -14
- package/dataflow/environments/diff.js +1 -1
- package/dataflow/environments/environment.js +1 -2
- package/dataflow/environments/identifier.d.ts +11 -4
- package/dataflow/environments/identifier.js +28 -10
- package/dataflow/environments/resolve-by-name.js +16 -2
- package/dataflow/extractor.js +6 -3
- package/dataflow/graph/call-graph.d.ts +2 -2
- package/dataflow/graph/df-helper.d.ts +4 -4
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/edge.d.ts +3 -3
- package/dataflow/graph/edge.js +3 -3
- package/dataflow/graph/graph-helper.d.ts +2 -2
- package/dataflow/internal/linker.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -49
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +111 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +12 -4
- package/dataflow/internal/process/functions/call/common.js +8 -1
- package/dataflow/internal/process/functions/call/default-call-handling.js +6 -0
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +17 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +32 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +29 -7
- package/dataflow/internal/process/functions/process-argument.js +12 -1
- package/dataflow/internal/process/process-named-call.d.ts +18 -1
- package/dataflow/internal/process/process-named-call.js +94 -0
- package/dataflow/processor.d.ts +18 -0
- package/documentation/data/faq/faqs.js +5 -1
- package/documentation/doc-capabilities.js +1 -1
- package/documentation/doc-util/doc-cli-option.d.ts +10 -0
- package/documentation/doc-util/doc-cli-option.js +23 -0
- package/documentation/doc-util/doc-dfg.js +2 -1
- package/documentation/doc-util/doc-query.d.ts +9 -3
- package/documentation/doc-util/doc-query.js +9 -4
- package/documentation/wiki-dataflow-graph.js +8 -5
- package/documentation/wiki-interface.js +4 -2
- package/documentation/wiki-linter.js +1 -1
- package/documentation/wiki-linting-and-testing.js +4 -1
- package/documentation/wiki-mk/doc-context.d.ts +14 -0
- package/documentation/wiki-mk/doc-context.js +3 -0
- package/documentation/wiki-mk/doc-maker.js +3 -1
- package/documentation/wiki-query.js +36 -15
- package/documentation/wiki-setup.js +10 -7
- package/documentation/wiki-signature-database.d.ts +16 -0
- package/documentation/wiki-signature-database.js +293 -0
- package/linter/linter-format.d.ts +7 -0
- package/linter/linter-rules.d.ts +10 -9
- package/linter/rules/naming-convention.d.ts +1 -0
- package/linter/rules/naming-convention.js +2 -0
- package/linter/rules/no-leaked-credentials.js +1 -2
- package/linter/rules/roxygen-arguments.js +18 -5
- package/linter/rules/stop-with-call-arg.js +2 -2
- package/linter/rules/undefined-symbol-util.d.ts +36 -0
- package/linter/rules/undefined-symbol-util.js +149 -0
- package/linter/rules/undefined-symbol.d.ts +58 -17
- package/linter/rules/undefined-symbol.js +143 -33
- package/linter/rules/unused-definition.d.ts +8 -1
- package/linter/rules/unused-definition.js +126 -1
- package/package.json +22 -10
- package/project/context/abstract-flowr-analyzer-context.js +7 -1
- package/project/context/flowr-analyzer-context.d.ts +8 -0
- package/project/context/flowr-analyzer-context.js +10 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +28 -4
- package/project/context/flowr-analyzer-dependencies-context.js +51 -2
- package/project/context/flowr-analyzer-files-context.d.ts +1 -0
- package/project/context/flowr-analyzer-files-context.js +2 -1
- package/project/context/flowr-analyzer-functions-context.js +1 -1
- package/project/context/flowr-file.d.ts +5 -0
- package/project/context/flowr-file.js +5 -0
- package/project/flowr-analyzer-builder.js +12 -2
- package/project/plugins/file-plugins/files/flowr-description-file.js +6 -3
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +9 -3
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +26 -0
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +39 -0
- 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.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +18 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +19 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +120 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +518 -0
- package/project/plugins/package-version-plugins/package.d.ts +5 -3
- package/project/plugins/package-version-plugins/package.js +27 -25
- package/project/plugins/plugin-registry.d.ts +3 -2
- package/project/plugins/plugin-registry.js +4 -2
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +7 -2
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +3 -1
- package/project/sigdb/build.d.ts +131 -0
- package/project/sigdb/build.js +628 -0
- package/project/sigdb/codec.d.ts +51 -0
- package/project/sigdb/codec.js +122 -0
- package/project/sigdb/decode.d.ts +58 -0
- package/project/sigdb/decode.js +129 -0
- package/project/sigdb/decompress.d.ts +44 -0
- package/project/sigdb/decompress.js +176 -0
- package/project/sigdb/hash.d.ts +9 -0
- package/project/sigdb/hash.js +54 -0
- package/project/sigdb/index-format.d.ts +40 -0
- package/project/sigdb/index-format.js +28 -0
- package/project/sigdb/manifest.d.ts +68 -0
- package/project/sigdb/manifest.js +146 -0
- package/project/sigdb/reader.d.ts +250 -0
- package/project/sigdb/reader.js +692 -0
- package/project/sigdb/schema.d.ts +196 -0
- package/project/sigdb/schema.js +33 -0
- package/project/sigdb/sigdb-download.d.ts +65 -0
- package/project/sigdb/sigdb-download.js +237 -0
- package/project/sigdb/signature-match.d.ts +26 -0
- package/project/sigdb/signature-match.js +40 -0
- package/project/sigdb/version.d.ts +20 -0
- package/project/sigdb/version.js +55 -0
- package/queries/catalog/absint-query/absint-query-executor.d.ts +6 -0
- package/queries/catalog/absint-query/absint-query-executor.js +63 -0
- package/queries/catalog/absint-query/absint-query-format.d.ts +37 -0
- package/queries/catalog/absint-query/absint-query-format.js +102 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -3
- package/queries/catalog/config-query/config-query-format.d.ts +3 -1
- package/queries/catalog/config-query/config-query-format.js +68 -9
- package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +2 -0
- package/queries/catalog/linter-query/linter-query-executor.js +6 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +2 -1
- package/queries/catalog/linter-query/linter-query-format.js +40 -8
- package/queries/catalog/project-query/project-query-executor.d.ts +15 -0
- package/queries/catalog/project-query/project-query-executor.js +96 -4
- package/queries/catalog/project-query/project-query-format.d.ts +44 -0
- package/queries/catalog/project-query/project-query-format.js +33 -2
- package/queries/catalog/signature-query/signature-query-executor.d.ts +29 -0
- package/queries/catalog/signature-query/signature-query-executor.js +461 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +138 -0
- package/queries/catalog/signature-query/signature-query-format.js +76 -0
- package/queries/catalog/signature-query/signature-query-render.d.ts +15 -0
- package/queries/catalog/signature-query/signature-query-render.js +155 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +9 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +10 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +19 -1
- package/queries/query-print.js +5 -0
- package/queries/query.d.ts +15 -5
- package/queries/query.js +7 -4
- package/r-bridge/init.js +5 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +10 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +55 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +16 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +27 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +89 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -1
- package/r-bridge/parser.d.ts +2 -0
- package/r-bridge/retriever.js +4 -1
- package/r-bridge/roxygen2/documentation-provider.js +2 -1
- package/r-bridge/shell.d.ts +5 -0
- package/r-bridge/shell.js +17 -1
- package/reconstruct/inline/source-inline-map.d.ts +48 -0
- package/reconstruct/inline/source-inline-map.js +94 -0
- package/reconstruct/reconstruct.d.ts +19 -2
- package/reconstruct/reconstruct.js +79 -16
- package/search/search-executor/search-generators.js +5 -22
- package/search/search-executor/search-transformer.js +10 -6
- package/slicing/criterion/parse.d.ts +28 -4
- package/slicing/criterion/parse.js +133 -18
- package/slicing/static/slice-call.d.ts +24 -1
- package/slicing/static/slice-call.js +90 -0
- package/slicing/static/static-slicer.d.ts +7 -0
- package/slicing/static/static-slicer.js +38 -3
- package/util/collections/arrays.d.ts +4 -5
- package/util/collections/arrays.js +7 -18
- package/util/hash.d.ts +14 -0
- package/util/hash.js +31 -0
- package/util/mermaid/dfg.d.ts +7 -2
- package/util/mermaid/dfg.js +53 -13
- package/util/r-base-packages.d.ts +19 -0
- package/util/r-base-packages.js +72 -0
- package/util/r-license.js +2 -10
- package/util/r-version.d.ts +45 -15
- package/util/r-version.js +97 -36
- package/util/range.d.ts +15 -0
- package/util/range.js +39 -0
- package/util/schema.d.ts +10 -0
- package/util/schema.js +22 -0
- package/util/text/ansi.d.ts +3 -0
- package/util/text/ansi.js +10 -0
- package/util/text/args.js +1 -2
- package/util/version.js +28 -8
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/documentation/wiki-package-database.d.ts +0 -9
- package/documentation/wiki-package-database.js +0 -63
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +0 -63
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +0 -176
- package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
- package/project/plugins/package-version-plugins/pkgdb.js +0 -370
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +0 -6
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +0 -58
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +0 -27
- package/queries/catalog/df-shape-query/df-shape-query-format.js +0 -56
|
@@ -1,8 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.classifyProject = classifyProject;
|
|
3
7
|
exports.executeProjectQuery = executeProjectQuery;
|
|
4
8
|
const log_1 = require("../../../util/log");
|
|
9
|
+
const project_query_format_1 = require("./project-query-format");
|
|
5
10
|
const flowr_file_1 = require("../../../project/context/flowr-file");
|
|
11
|
+
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
/**
|
|
14
|
+
* Collects dependency statistics from the project's `DESCRIPTION` file, cross-referenced with the
|
|
15
|
+
* loaded package database(s) to report how many dependencies we can cover.
|
|
16
|
+
*/
|
|
17
|
+
function collectDependencyStats(desc, deps, basePackages) {
|
|
18
|
+
const imports = desc.imports() ?? [];
|
|
19
|
+
const dependsAll = desc.depends() ?? [];
|
|
20
|
+
const rEntry = dependsAll.find(d => d.name === 'R');
|
|
21
|
+
const rVersion = rEntry?.derivedVersion?.raw;
|
|
22
|
+
const depends = dependsAll.filter(d => d.name !== 'R');
|
|
23
|
+
const suggests = desc.suggests() ?? [];
|
|
24
|
+
const linkingTo = desc.linkingTo() ?? [];
|
|
25
|
+
const runtime = new Set([...imports, ...depends, ...linkingTo].map(p => p.name));
|
|
26
|
+
let base = 0;
|
|
27
|
+
let covered = 0;
|
|
28
|
+
const first = [];
|
|
29
|
+
for (const name of runtime) {
|
|
30
|
+
const isBase = basePackages.has(name);
|
|
31
|
+
const resolved = isBase ? undefined : deps.getDependency(name);
|
|
32
|
+
if (isBase) {
|
|
33
|
+
base++;
|
|
34
|
+
}
|
|
35
|
+
else if (resolved?.namespaceInfo) {
|
|
36
|
+
covered++;
|
|
37
|
+
}
|
|
38
|
+
if (first.length < 3) {
|
|
39
|
+
first.push({ name, base: isBase, dbVersion: resolved?.resolvedVersion });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
imports: imports.length,
|
|
44
|
+
depends: depends.length,
|
|
45
|
+
suggests: suggests.length,
|
|
46
|
+
linkingTo: linkingTo.length,
|
|
47
|
+
runtime: runtime.size,
|
|
48
|
+
base,
|
|
49
|
+
covered,
|
|
50
|
+
first,
|
|
51
|
+
rVersion: rVersion && /\d/.test(rVersion) ? rVersion : undefined
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const notebookExtension = /\.(ipynb|rmd|qmd|rnw)$/;
|
|
55
|
+
/**
|
|
56
|
+
* Classifies the {@link ProjectKind} of the given files context.
|
|
57
|
+
*
|
|
58
|
+
* A `DESCRIPTION` file unambiguously marks an R {@link ProjectKind.Package | package} and is available as soon
|
|
59
|
+
* as the project is loaded. The finer distinctions ({@link ProjectKind.ShinyApp | shiny app},
|
|
60
|
+
* {@link ProjectKind.Notebook | notebook}, {@link ProjectKind.Script | script} vs.
|
|
61
|
+
* {@link ProjectKind.Project | multi-file project}) rely on the project's source files, which are only known
|
|
62
|
+
* once the dataflow analysis has run; before that a non-package project reports {@link ProjectKind.Unknown}.
|
|
63
|
+
*
|
|
64
|
+
* This is a pure inspection of the files context and can be used standalone, independently of the project query.
|
|
65
|
+
* @param files - the (read-only) files context of an analyzer to classify
|
|
66
|
+
*/
|
|
67
|
+
function classifyProject(files) {
|
|
68
|
+
if (files.getFilesByRole(flowr_file_1.FileRole.Description).length > 0) {
|
|
69
|
+
return project_query_format_1.ProjectKind.Package;
|
|
70
|
+
}
|
|
71
|
+
const names = new Set([
|
|
72
|
+
...files.getAllFiles().map(f => path_1.default.basename(f.path()).toLowerCase()),
|
|
73
|
+
...files.consideredFilesList().map(p => path_1.default.basename(p).toLowerCase())
|
|
74
|
+
]);
|
|
75
|
+
if (names.size === 0) {
|
|
76
|
+
return project_query_format_1.ProjectKind.Unknown;
|
|
77
|
+
}
|
|
78
|
+
if (names.has('app.r') || (names.has('ui.r') && names.has('server.r'))) {
|
|
79
|
+
return project_query_format_1.ProjectKind.ShinyApp;
|
|
80
|
+
}
|
|
81
|
+
for (const name of names) {
|
|
82
|
+
if (notebookExtension.test(name)) {
|
|
83
|
+
return project_query_format_1.ProjectKind.Notebook;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
let rSources = 0;
|
|
87
|
+
for (const name of names) {
|
|
88
|
+
if (name.endsWith('.r')) {
|
|
89
|
+
rSources++;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return rSources <= 1 ? project_query_format_1.ProjectKind.Script : project_query_format_1.ProjectKind.Project;
|
|
93
|
+
}
|
|
6
94
|
/**
|
|
7
95
|
* Executes the given project queries.
|
|
8
96
|
*/
|
|
@@ -16,23 +104,27 @@ async function executeProjectQuery({ analyzer }, queries) {
|
|
|
16
104
|
if (withDf) {
|
|
17
105
|
await analyzer.dataflow();
|
|
18
106
|
}
|
|
19
|
-
const
|
|
107
|
+
const ctx = analyzer.inspectContext();
|
|
108
|
+
const basePackages = new Set(ctx.config.project.basePackages ?? (0, r_base_packages_1.baseRPackages)(ctx.resolvedRVersion));
|
|
109
|
+
const descFile = ctx.files.getFilesByRole(flowr_file_1.FileRole.Description);
|
|
20
110
|
const desc = descFile[0];
|
|
21
111
|
const roleCounts = {};
|
|
22
112
|
for (const file of Object.values(flowr_file_1.FileRole)) {
|
|
23
|
-
roleCounts[file] =
|
|
113
|
+
roleCounts[file] = ctx.files.getFilesByRole(file).length;
|
|
24
114
|
}
|
|
25
115
|
return {
|
|
26
116
|
'.meta': {
|
|
27
117
|
timing: Date.now() - startTime
|
|
28
118
|
},
|
|
29
119
|
name: desc?.content().get('Package')?.[0] ?? desc?.content()?.get('Title')?.[0],
|
|
30
|
-
files: Array.from(
|
|
120
|
+
files: Array.from(ctx.files.consideredFilesList()),
|
|
31
121
|
authors: desc?.authors(),
|
|
32
122
|
encoding: desc?.content().get('Encoding')?.[0],
|
|
33
123
|
version: desc?.content().get('Version')?.[0],
|
|
34
124
|
licenses: desc?.license(),
|
|
35
|
-
roleCounts: roleCounts
|
|
125
|
+
roleCounts: roleCounts,
|
|
126
|
+
kind: classifyProject(ctx.files),
|
|
127
|
+
dependencies: desc ? collectDependencyStats(desc, ctx.deps, basePackages) : undefined
|
|
36
128
|
};
|
|
37
129
|
}
|
|
38
130
|
//# sourceMappingURL=project-query-executor.js.map
|
|
@@ -9,6 +9,46 @@ export interface ProjectQuery extends BaseQueryFormat {
|
|
|
9
9
|
/** Whether to include Dataflow information in the result. */
|
|
10
10
|
readonly withDf?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/** The kind of project that flowR is analyzing. */
|
|
13
|
+
export declare enum ProjectKind {
|
|
14
|
+
/** An R package (has a `DESCRIPTION` file). */
|
|
15
|
+
Package = "package",
|
|
16
|
+
/** A single R script. */
|
|
17
|
+
Script = "script",
|
|
18
|
+
/** A Shiny application (`app.R`, or `ui.R` together with `server.R`). */
|
|
19
|
+
ShinyApp = "shiny-app",
|
|
20
|
+
/** A notebook or literate document (`.ipynb`, `.Rmd`, `.qmd`, `.rnw`). */
|
|
21
|
+
Notebook = "notebook",
|
|
22
|
+
/** A multi-file project that is not a package. */
|
|
23
|
+
Project = "project",
|
|
24
|
+
/** The kind could not be determined (e.g. before the files are known). */
|
|
25
|
+
Unknown = "unknown"
|
|
26
|
+
}
|
|
27
|
+
/** Statistics on the project's declared dependencies, cross-referenced with the package database. */
|
|
28
|
+
export interface ProjectDependencyStats {
|
|
29
|
+
/** Number of packages in the `Imports` field. */
|
|
30
|
+
readonly imports: number;
|
|
31
|
+
/** Number of packages in the `Depends` field (excluding the `R` version pseudo-package). */
|
|
32
|
+
readonly depends: number;
|
|
33
|
+
/** Number of packages in the `Suggests` field. */
|
|
34
|
+
readonly suggests: number;
|
|
35
|
+
/** Number of packages in the `LinkingTo` field. */
|
|
36
|
+
readonly linkingTo: number;
|
|
37
|
+
/** Number of unique runtime dependencies (`Imports`, `Depends`, and `LinkingTo` combined). */
|
|
38
|
+
readonly runtime: number;
|
|
39
|
+
/** How many of the runtime dependencies are base or recommended R packages. */
|
|
40
|
+
readonly base: number;
|
|
41
|
+
/** How many of the non-base runtime dependencies are covered by the loaded package database(s). */
|
|
42
|
+
readonly covered: number;
|
|
43
|
+
/** The first few runtime dependencies with the version the package database resolved them to, if any. */
|
|
44
|
+
readonly first: {
|
|
45
|
+
name: string;
|
|
46
|
+
base: boolean;
|
|
47
|
+
dbVersion?: string;
|
|
48
|
+
}[];
|
|
49
|
+
/** The required R version derived from the `Depends` field, if declared. */
|
|
50
|
+
readonly rVersion?: string;
|
|
51
|
+
}
|
|
12
52
|
export interface ProjectQueryResult extends BaseQueryResult {
|
|
13
53
|
/** The name of the project, if available. */
|
|
14
54
|
readonly name?: string;
|
|
@@ -24,6 +64,10 @@ export interface ProjectQueryResult extends BaseQueryResult {
|
|
|
24
64
|
readonly encoding?: string;
|
|
25
65
|
/** The version of the project, if available. */
|
|
26
66
|
readonly version?: string;
|
|
67
|
+
/** The classified kind of the project (e.g. package, script, shiny app). */
|
|
68
|
+
readonly kind?: ProjectKind;
|
|
69
|
+
/** Statistics on the project's declared dependencies, if a `DESCRIPTION` file is available. */
|
|
70
|
+
readonly dependencies?: ProjectDependencyStats;
|
|
27
71
|
}
|
|
28
72
|
export declare const ProjectQueryDefinition: {
|
|
29
73
|
readonly executor: typeof executeProjectQuery;
|
|
@@ -3,13 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ProjectQueryDefinition = void 0;
|
|
6
|
+
exports.ProjectQueryDefinition = exports.ProjectKind = void 0;
|
|
7
7
|
const project_query_executor_1 = require("./project-query-executor");
|
|
8
8
|
const ansi_1 = require("../../../util/text/ansi");
|
|
9
9
|
const time_1 = require("../../../util/text/time");
|
|
10
10
|
const joi_1 = __importDefault(require("joi"));
|
|
11
11
|
const r_author_1 = require("../../../util/r-author");
|
|
12
12
|
const r_license_1 = require("../../../util/r-license");
|
|
13
|
+
/** The kind of project that flowR is analyzing. */
|
|
14
|
+
var ProjectKind;
|
|
15
|
+
(function (ProjectKind) {
|
|
16
|
+
/** An R package (has a `DESCRIPTION` file). */
|
|
17
|
+
ProjectKind["Package"] = "package";
|
|
18
|
+
/** A single R script. */
|
|
19
|
+
ProjectKind["Script"] = "script";
|
|
20
|
+
/** A Shiny application (`app.R`, or `ui.R` together with `server.R`). */
|
|
21
|
+
ProjectKind["ShinyApp"] = "shiny-app";
|
|
22
|
+
/** A notebook or literate document (`.ipynb`, `.Rmd`, `.qmd`, `.rnw`). */
|
|
23
|
+
ProjectKind["Notebook"] = "notebook";
|
|
24
|
+
/** A multi-file project that is not a package. */
|
|
25
|
+
ProjectKind["Project"] = "project";
|
|
26
|
+
/** The kind could not be determined (e.g. before the files are known). */
|
|
27
|
+
ProjectKind["Unknown"] = "unknown";
|
|
28
|
+
})(ProjectKind || (exports.ProjectKind = ProjectKind = {}));
|
|
13
29
|
function addSuffix(count, singular = '', plural = 's') {
|
|
14
30
|
return `${count === 1 ? singular : plural}`;
|
|
15
31
|
}
|
|
@@ -21,6 +37,9 @@ exports.ProjectQueryDefinition = {
|
|
|
21
37
|
if (out.name) {
|
|
22
38
|
result.push(` ╰ Project Name: ${out.name}`);
|
|
23
39
|
}
|
|
40
|
+
if (out.kind) {
|
|
41
|
+
result.push(` ╰ Kind: ${out.kind}`);
|
|
42
|
+
}
|
|
24
43
|
if (out.version) {
|
|
25
44
|
result.push(` ╰ Version: ${out.version}`);
|
|
26
45
|
}
|
|
@@ -53,8 +72,20 @@ exports.ProjectQueryDefinition = {
|
|
|
53
72
|
}
|
|
54
73
|
}
|
|
55
74
|
}
|
|
75
|
+
if (out.dependencies) {
|
|
76
|
+
const d = out.dependencies;
|
|
77
|
+
result.push(` ╰ Dependencies: ${d.runtime} runtime (${d.imports} imports, ${d.depends} depends, ${d.linkingTo} linkingTo), ${d.suggests} suggested`);
|
|
78
|
+
result.push(` ╰ ${d.base} base/recommended, ${d.covered}/${Math.max(d.runtime - d.base, 0)} non-base covered by the package database`);
|
|
79
|
+
if (d.first.length > 0) {
|
|
80
|
+
const names = d.first.map(f => f.dbVersion ? `${f.name}@${f.dbVersion}` : f.name).join(', ');
|
|
81
|
+
result.push(` ╰ e.g. ${names}${d.runtime > d.first.length ? ', ...' : ''}`);
|
|
82
|
+
}
|
|
83
|
+
if (d.rVersion) {
|
|
84
|
+
result.push(` ╰ Requires R ${d.rVersion}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
56
87
|
if (analyzer.peekDataflow() === undefined) {
|
|
57
|
-
result.push(formatter.format(' ╰ Dataflow
|
|
88
|
+
result.push(formatter.format(' ╰ Dataflow not performed (run `:df#`, then re-run this query, or pass "withDf": true)', { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground }));
|
|
58
89
|
}
|
|
59
90
|
else {
|
|
60
91
|
result.push(` ╰ Dataflow Analysis considered ${out.files.length} file${out.files.length === 1 ? '' : 's'}`);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BasicQueryData } from '../../base-query-format';
|
|
2
|
+
import type { SignatureQuery, SignatureQueryResult, SignaturePackageView, SignatureFunctionView } from './signature-query-format';
|
|
3
|
+
import { type PackageSignatureSource } from '../../../project/sigdb/reader';
|
|
4
|
+
import type { CommandCompletions } from '../../../cli/repl/core';
|
|
5
|
+
/** the CRAN package landing page (only meaningful for CRAN packages, not base R) */
|
|
6
|
+
export declare function cranPageUrl(pkg: string): string;
|
|
7
|
+
/** deep-link a definition into the CRAN mirror at the package's version tag (falling back to `HEAD`) */
|
|
8
|
+
export declare function cranMirrorSourceUrl(pkg: string, version: string | undefined, file: string, line?: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* The detailed view of a single function within a package: its signature (parameters, forced/optional,
|
|
11
|
+
* defaults), properties, definition location, call graph, and -- for a CRAN package -- a deep link into the
|
|
12
|
+
* read-only CRAN GitHub mirror. `version` defaults to the source's latest; `undefined` when the source does
|
|
13
|
+
* not carry that function.
|
|
14
|
+
*/
|
|
15
|
+
export declare function signatureFunctionInfo(src: PackageSignatureSource, pkg: string, fnName: string, version?: string): SignatureFunctionView | undefined;
|
|
16
|
+
/** the full view of a package: version, kind, export breakdown, dependencies, and every function's view */
|
|
17
|
+
export declare function signaturePackageInfo(src: PackageSignatureSource, pkg: string, resolved?: string): SignaturePackageView | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Tab-completer for `:query \@signature` / `:signature query`: package names in the first position, a package's
|
|
20
|
+
* function names in the second (and after `pkg::`). Version specs and flags are left alone. Enumerating functions
|
|
21
|
+
* decompresses the package's shard once (then cached); enumerating packages reads only the manifest.
|
|
22
|
+
*/
|
|
23
|
+
export declare function signatureQueryCompleter(line: readonly string[], startingNewArg: boolean): CommandCompletions;
|
|
24
|
+
/**
|
|
25
|
+
* Executes the signature query. With no `package` it summarizes the loaded databases. A glob in `package`/`function`
|
|
26
|
+
* or a multi-version `version` triggers a wildcard search (matching packages or functions). Otherwise a single
|
|
27
|
+
* exact package (optionally at an exact `version`) yields its full view, or the detailed function view.
|
|
28
|
+
*/
|
|
29
|
+
export declare function executeSignatureQuery({ analyzer }: BasicQueryData, queries: readonly SignatureQuery[]): Promise<SignatureQueryResult>;
|