@eagleoutice/flowr 2.10.10 → 2.11.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 +35 -27
- package/cli/common/options.d.ts +2 -108
- package/cli/common/options.js +3 -27
- package/cli/common/scripts-info.d.ts +2 -123
- package/cli/common/scripts-info.js +0 -17
- package/cli/flowr-main-options.d.ts +5 -0
- package/cli/flowr-main-options.js +10 -0
- package/cli/flowr.js +2 -2
- package/cli/repl/commands/repl-commands.js +7 -6
- package/cli/repl/print-version.d.ts +3 -1
- package/cli/repl/print-version.js +21 -2
- package/cli/repl/server/connection.d.ts +2 -0
- package/cli/repl/server/connection.js +40 -31
- package/cli/script-core/summarizer-core.js +13 -32
- package/cli/wiki.d.ts +2 -1
- package/cli/wiki.js +2 -0
- package/config.d.ts +9 -0
- package/config.js +10 -0
- package/control-flow/semantic-cfg-guided-visitor.js +1 -0
- package/core/steps/pipeline/default-pipelines.d.ts +146 -146
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/dataflow/environments/append.d.ts +1 -2
- package/dataflow/environments/append.js +3 -10
- package/dataflow/environments/apply-kill.d.ts +21 -0
- package/dataflow/environments/apply-kill.js +155 -0
- 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 +63 -3
- package/dataflow/environments/default-builtin-config.js +40 -8
- package/dataflow/environments/environment.d.ts +49 -32
- package/dataflow/environments/environment.js +133 -18
- package/dataflow/environments/identifier.d.ts +10 -0
- package/dataflow/environments/identifier.js +23 -0
- package/dataflow/environments/overwrite.js +2 -10
- package/dataflow/environments/resolve-by-name.d.ts +1 -1
- package/dataflow/environments/resolve-by-name.js +10 -2
- package/dataflow/environments/scoping.d.ts +9 -2
- package/dataflow/environments/scoping.js +15 -2
- package/dataflow/extractor.js +23 -2
- package/dataflow/graph/df-helper.d.ts +8 -0
- package/dataflow/graph/df-helper.js +8 -0
- package/dataflow/graph/graph.d.ts +4 -1
- package/dataflow/graph/graph.js +5 -1
- package/dataflow/info.d.ts +26 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +8 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +131 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +10 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +17 -0
- package/documentation/data/faq/faqs.js +3 -0
- package/documentation/data/interface/doc-writing-code.js +4 -80
- package/documentation/doc-util/doc-structure.js +1 -2
- package/documentation/wiki-core.js +2 -1
- package/documentation/wiki-dataflow-graph.js +35 -1
- package/documentation/wiki-interface.js +2 -2
- package/documentation/wiki-linter.js +2 -0
- package/documentation/wiki-overview.js +1 -14
- package/documentation/wiki-package-database.d.ts +9 -0
- package/documentation/wiki-package-database.js +63 -0
- package/documentation/wiki-query.js +1 -0
- package/linter/linter-rules.d.ts +23 -0
- package/linter/linter-rules.js +3 -1
- package/linter/rules/absolute-path.js +2 -1
- package/linter/rules/undefined-symbol.d.ts +39 -0
- package/linter/rules/undefined-symbol.js +80 -0
- package/package.json +4 -4
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +9 -1
- package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
- package/project/context/flowr-analyzer-dependencies-context.js +39 -4
- package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
- package/project/context/flowr-analyzer-environment-context.js +3 -4
- package/project/context/flowr-analyzer-files-context.d.ts +1 -0
- package/project/context/flowr-file.d.ts +2 -0
- package/project/context/flowr-file.js +2 -0
- package/project/flowr-analyzer-builder.js +3 -0
- package/project/flowr-analyzer.d.ts +2 -1
- package/project/flowr-analyzer.js +3 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +176 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
- package/project/plugins/package-version-plugins/package.d.ts +3 -0
- package/project/plugins/package-version-plugins/package.js +12 -0
- package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
- package/project/plugins/package-version-plugins/pkgdb.js +370 -0
- package/project/plugins/plugin-registry.d.ts +4 -1
- package/project/plugins/plugin-registry.js +7 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +8 -0
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -0
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
- package/queries/catalog/linter-query/linter-query-executor.js +1 -0
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
- package/search/search-executor/search-enrichers.d.ts +1 -1
- package/search/search-executor/search-enrichers.js +7 -4
- package/util/mermaid/mermaid.d.ts +4 -0
- package/util/mermaid/mermaid.js +8 -1
- package/util/text/ansi.d.ts +10 -1
- package/util/text/ansi.js +17 -4
- package/util/version.js +10 -2
- package/cli/common/features.d.ts +0 -9
- package/cli/common/features.js +0 -35
- package/cli/script-core/statistics-core.d.ts +0 -6
- package/cli/script-core/statistics-core.js +0 -104
- package/cli/script-core/statistics-helper-core.d.ts +0 -6
- package/cli/script-core/statistics-helper-core.js +0 -86
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -16
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -14
- package/statistics/features/common-syntax-probability.d.ts +0 -38
- package/statistics/features/common-syntax-probability.js +0 -169
- package/statistics/features/feature.d.ts +0 -179
- package/statistics/features/feature.js +0 -38
- package/statistics/features/post-processing.d.ts +0 -18
- package/statistics/features/post-processing.js +0 -26
- package/statistics/features/supported/assignments/assignments.d.ts +0 -12
- package/statistics/features/supported/assignments/assignments.js +0 -56
- package/statistics/features/supported/assignments/post-process.d.ts +0 -6
- package/statistics/features/supported/assignments/post-process.js +0 -126
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -143
- package/statistics/features/supported/comments/post-process.d.ts +0 -6
- package/statistics/features/supported/comments/post-process.js +0 -51
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -69
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
- package/statistics/features/supported/control-flow/post-process.js +0 -66
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -122
- package/statistics/features/supported/data-access/post-process.d.ts +0 -6
- package/statistics/features/supported/data-access/post-process.js +0 -108
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -168
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
- package/statistics/features/supported/expression-list/post-process.js +0 -45
- package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -81
- package/statistics/features/supported/loops/post-process.d.ts +0 -6
- package/statistics/features/supported/loops/post-process.js +0 -73
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -176
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -99
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
- package/statistics/features/supported/used-packages/post-process.js +0 -122
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -140
- package/statistics/features/supported/values/post-process.d.ts +0 -6
- package/statistics/features/supported/values/post-process.js +0 -73
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -111
- package/statistics/features/supported/variables/post-process.d.ts +0 -15
- package/statistics/features/supported/variables/post-process.js +0 -126
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -62
- package/statistics/meta-statistics.d.ts +0 -32
- package/statistics/meta-statistics.js +0 -16
- package/statistics/output/file-provider.d.ts +0 -36
- package/statistics/output/file-provider.js +0 -96
- package/statistics/output/print-stats.d.ts +0 -29
- package/statistics/output/print-stats.js +0 -81
- package/statistics/output/statistics-file.d.ts +0 -36
- package/statistics/output/statistics-file.js +0 -68
- package/statistics/statistics.d.ts +0 -29
- package/statistics/statistics.js +0 -108
- package/statistics/summarizer/auto-detect.d.ts +0 -5
- package/statistics/summarizer/auto-detect.js +0 -34
- package/statistics/summarizer/first-phase/process.d.ts +0 -6
- package/statistics/summarizer/first-phase/process.js +0 -81
- package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
- package/statistics/summarizer/post-process/clusterer.js +0 -40
- package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
- package/statistics/summarizer/post-process/file-based-count.js +0 -47
- package/statistics/summarizer/post-process/histogram.d.ts +0 -57
- package/statistics/summarizer/post-process/histogram.js +0 -126
- package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
- package/statistics/summarizer/post-process/post-process-output.js +0 -102
- package/statistics/summarizer/second-phase/process.d.ts +0 -15
- package/statistics/summarizer/second-phase/process.js +0 -118
- package/statistics/summarizer/summarizer.d.ts +0 -34
- package/statistics/summarizer/summarizer.js +0 -141
|
@@ -21,16 +21,17 @@ const args_1 = require("../../../util/text/args");
|
|
|
21
21
|
const assert_1 = require("../../../util/assert");
|
|
22
22
|
const scripts_info_1 = require("../../common/scripts-info");
|
|
23
23
|
const repl_query_1 = require("./repl-query");
|
|
24
|
+
const cmd = (name, f) => (0, ansi_1.color)(name, 6 /* Colors.Cyan */, f, { style: 1 /* FontStyles.Bold */ });
|
|
24
25
|
function printHelpForScript(script, f, starredVersion) {
|
|
25
|
-
let base = ` ${(
|
|
26
|
+
let base = ` ${cmd(padCmd(':' + script[0] + (starredVersion ? '[*]' : '')), f)}${script[1].description}`;
|
|
26
27
|
if (starredVersion) {
|
|
27
|
-
base += ` (star: ${starredVersion.description})`;
|
|
28
|
+
base += ` ${(0, ansi_1.italic)(`(star: ${starredVersion.description})`, f)}`;
|
|
28
29
|
}
|
|
29
30
|
if (script[1].aliases.length === 0) {
|
|
30
31
|
return base;
|
|
31
32
|
}
|
|
32
33
|
const aliases = script[1].aliases;
|
|
33
|
-
return `${base} (alias${aliases.length > 1 ? 'es' : ''}
|
|
34
|
+
return `${base} ${(0, ansi_1.italic)(`(alias${aliases.length > 1 ? 'es' : ''}:`, f)} ${aliases.map(a => cmd(':' + a, f)).join(', ')}${(0, ansi_1.italic)(')', f)}`;
|
|
34
35
|
}
|
|
35
36
|
function printCommandHelp(formatter) {
|
|
36
37
|
const scriptHelp = [];
|
|
@@ -62,13 +63,13 @@ There are the following basic commands:
|
|
|
62
63
|
${printCommandHelp(output.formatter)}
|
|
63
64
|
|
|
64
65
|
Furthermore, you can directly call the following scripts which accept arguments. If you are unsure, try to add ${(0, ansi_1.italic)('--help', output.formatter)} after the command.
|
|
65
|
-
${Array.from(Object.entries(getReplCommands())).filter(([, { script }]) => script).map(([command, { description }]) => ` ${(
|
|
66
|
+
${Array.from(Object.entries(getReplCommands())).filter(([, { script }]) => script).map(([command, { description }]) => ` ${cmd(padCmd(':' + command), output.formatter)}${description}`).sort().join('\n')}
|
|
66
67
|
|
|
67
68
|
You can combine commands by separating them with a semicolon ${(0, ansi_1.bold)(';', output.formatter)}.
|
|
68
69
|
|
|
69
70
|
Commands that accept a file path support two path prefixes:
|
|
70
|
-
${(0, ansi_1.
|
|
71
|
-
${(0, ansi_1.
|
|
71
|
+
${(0, ansi_1.color)('file://<path>', 2 /* Colors.Green */, output.formatter, { style: 1 /* FontStyles.Bold */ })} run the command once on the given file or folder
|
|
72
|
+
${(0, ansi_1.color)('watch://<path>', 3 /* Colors.Yellow */, output.formatter, { style: 1 /* FontStyles.Bold */ })} re-run the command whenever the file (or any file in the folder) changes
|
|
72
73
|
Press Ctrl+C or enter any other command to leave watch mode.
|
|
73
74
|
`);
|
|
74
75
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { KnownParser } from '../../r-bridge/parser';
|
|
2
|
+
/** a short `, package database: <scope> <date>` suffix for the bundled database, or empty if none */
|
|
3
|
+
export declare function pkgDbReplSuffix(): string;
|
|
2
4
|
/**
|
|
3
|
-
* Returns a version string for the REPL including flowR and
|
|
5
|
+
* Returns a version string for the REPL including flowR, R, and the package database in use.
|
|
4
6
|
*/
|
|
5
7
|
export declare function versionReplString(parser: KnownParser): Promise<string>;
|
|
6
8
|
/**
|
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pkgDbReplSuffix = pkgDbReplSuffix;
|
|
3
4
|
exports.versionReplString = versionReplString;
|
|
4
5
|
exports.printVersionRepl = printVersionRepl;
|
|
5
6
|
const version_1 = require("../../util/version");
|
|
7
|
+
const pkgdb_1 = require("../../project/plugins/package-version-plugins/pkgdb");
|
|
8
|
+
/** a short `, package database: <scope> <date>` suffix for the bundled database, or empty if none */
|
|
9
|
+
function pkgDbReplSuffix() {
|
|
10
|
+
try {
|
|
11
|
+
if (typeof process !== 'undefined' && process.env?.FLOWR_DISABLE_DEFAULT_PKGDB) {
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
const path = (0, pkgdb_1.defaultPkgDbPath)();
|
|
15
|
+
if (path === undefined) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
const db = pkgdb_1.PkgDatabase.fromFileSync(path);
|
|
19
|
+
return `, pkg-db: ${db.scope}/${db.content.date}`;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
6
25
|
/**
|
|
7
|
-
* Returns a version string for the REPL including flowR and
|
|
26
|
+
* Returns a version string for the REPL including flowR, R, and the package database in use.
|
|
8
27
|
*/
|
|
9
28
|
async function versionReplString(parser) {
|
|
10
29
|
const version = await (0, version_1.retrieveVersionInformation)(parser);
|
|
11
30
|
const rVersion = version.r === 'none' ? '' : version.r === 'unknown' ? ', R version unknown' : `, R v${version.r}`;
|
|
12
31
|
const treeSitterVer = parser.name === 'tree-sitter' ? `, R grammar v${parser.treeSitterVersion()}` : '';
|
|
13
|
-
return `flowR repl
|
|
32
|
+
return `flowR repl v${version.flowr}${rVersion}${treeSitterVer} (${version.engine} engine${pkgDbReplSuffix()})`;
|
|
14
33
|
}
|
|
15
34
|
/**
|
|
16
35
|
* Prints the version information for the REPL including flowR and R version.
|
|
@@ -21,7 +21,9 @@ export declare class FlowRServerConnection {
|
|
|
21
21
|
private readonly fileMap;
|
|
22
22
|
constructor(socket: Socket, name: string, parser: KnownParser, allowRSessionAccess: boolean, config: FlowrConfig);
|
|
23
23
|
private currentMessageBuffer;
|
|
24
|
+
private requestQueue;
|
|
24
25
|
private handleData;
|
|
26
|
+
private dispatch;
|
|
25
27
|
private handleFileAnalysisRequest;
|
|
26
28
|
private invalidateTokens;
|
|
27
29
|
private sendFileAnalysisResponse;
|
|
@@ -88,6 +88,8 @@ class FlowRServerConnection {
|
|
|
88
88
|
this.allowRSessionAccess = allowRSessionAccess;
|
|
89
89
|
}
|
|
90
90
|
currentMessageBuffer = '';
|
|
91
|
+
/* requests of a single client share one analyzer, so we handle them one after another to avoid racing on it */
|
|
92
|
+
requestQueue = Promise.resolve();
|
|
91
93
|
handleData(message) {
|
|
92
94
|
if (!message.endsWith('\n')) {
|
|
93
95
|
this.currentMessageBuffer += message;
|
|
@@ -104,27 +106,31 @@ class FlowRServerConnection {
|
|
|
104
106
|
(0, validate_1.answerForValidationError)(this.socket, request);
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
|
-
|
|
109
|
+
this.requestQueue = this.requestQueue
|
|
110
|
+
.then(() => this.dispatch(request.message))
|
|
111
|
+
.catch(e => {
|
|
112
|
+
this.logger.error(`[${this.name}] Error while handling request: ${String(e)}`);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
dispatch(message) {
|
|
116
|
+
switch (message.type) {
|
|
108
117
|
case 'request-file-analysis':
|
|
109
|
-
|
|
110
|
-
break;
|
|
118
|
+
return this.handleFileAnalysisRequest(message);
|
|
111
119
|
case 'request-slice':
|
|
112
|
-
this.handleSliceRequest(
|
|
113
|
-
break;
|
|
120
|
+
return this.handleSliceRequest(message);
|
|
114
121
|
case 'request-repl-execution':
|
|
115
|
-
this.handleRepl(
|
|
116
|
-
break;
|
|
122
|
+
return this.handleRepl(message);
|
|
117
123
|
case 'request-query':
|
|
118
|
-
this.handleQueryRequest(
|
|
119
|
-
break;
|
|
124
|
+
return this.handleQueryRequest(message);
|
|
120
125
|
default:
|
|
121
126
|
(0, send_1.sendMessage)(this.socket, {
|
|
122
|
-
id:
|
|
127
|
+
id: message.id,
|
|
123
128
|
type: 'error',
|
|
124
129
|
fatal: true,
|
|
125
|
-
reason: `The message type ${JSON.stringify(
|
|
130
|
+
reason: `The message type ${JSON.stringify(message.type ?? 'undefined')} is not supported.`
|
|
126
131
|
});
|
|
127
132
|
this.socket.end();
|
|
133
|
+
return Promise.resolve();
|
|
128
134
|
}
|
|
129
135
|
}
|
|
130
136
|
async handleFileAnalysisRequest(base) {
|
|
@@ -253,7 +259,7 @@ class FlowRServerConnection {
|
|
|
253
259
|
}
|
|
254
260
|
return analyzer;
|
|
255
261
|
}
|
|
256
|
-
handleSliceRequest(base) {
|
|
262
|
+
async handleSliceRequest(base) {
|
|
257
263
|
const requestResult = (0, validate_1.validateMessage)(base, message_slice_1.requestSliceMessage);
|
|
258
264
|
if (requestResult.type === 'error') {
|
|
259
265
|
(0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
|
|
@@ -271,19 +277,21 @@ class FlowRServerConnection {
|
|
|
271
277
|
});
|
|
272
278
|
return;
|
|
273
279
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
+
try {
|
|
281
|
+
const result = await fileInformation.analyzer.query([{
|
|
282
|
+
type: 'static-slice',
|
|
283
|
+
criteria: request.criterion,
|
|
284
|
+
noMagicComments: request.noMagicComments,
|
|
285
|
+
direction: request.direction
|
|
286
|
+
}]);
|
|
280
287
|
(0, send_1.sendMessage)(this.socket, {
|
|
281
288
|
type: 'response-slice',
|
|
282
289
|
id: request.id,
|
|
283
290
|
results: Object.fromEntries(Object.entries(result)
|
|
284
291
|
.filter(([k]) => default_pipelines_1.DEFAULT_SLICING_PIPELINE.steps.get(k)?.executed === 1 /* PipelineStepStage.OncePerRequest */))
|
|
285
292
|
});
|
|
286
|
-
}
|
|
293
|
+
}
|
|
294
|
+
catch (e) {
|
|
287
295
|
this.logger.error(`[${this.name}] Error while analyzing file for token ${request.filetoken}: ${String(e)}`);
|
|
288
296
|
(0, send_1.sendMessage)(this.socket, {
|
|
289
297
|
id: request.id,
|
|
@@ -291,9 +299,9 @@ class FlowRServerConnection {
|
|
|
291
299
|
fatal: false,
|
|
292
300
|
reason: `Error while analyzing file for token ${request.filetoken}: ${String(e)}`
|
|
293
301
|
});
|
|
294
|
-
}
|
|
302
|
+
}
|
|
295
303
|
}
|
|
296
|
-
handleRepl(base) {
|
|
304
|
+
async handleRepl(base) {
|
|
297
305
|
const requestResult = (0, validate_1.validateMessage)(base, message_repl_1.requestExecuteReplExpressionMessage);
|
|
298
306
|
if (requestResult.type === 'error') {
|
|
299
307
|
(0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
|
|
@@ -312,18 +320,17 @@ class FlowRServerConnection {
|
|
|
312
320
|
.setConfig(this.config)
|
|
313
321
|
.setParser(this.parser)
|
|
314
322
|
.buildSync();
|
|
315
|
-
|
|
323
|
+
await (0, core_1.replProcessAnswer)(analyzer, {
|
|
316
324
|
formatter: request.ansi ? ansi_1.ansiFormatter : ansi_1.voidFormatter,
|
|
317
325
|
stdout: msg => out('stdout', msg),
|
|
318
326
|
stderr: msg => out('stderr', msg)
|
|
319
|
-
}, request.expression, this.allowRSessionAccess)
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
});
|
|
327
|
+
}, request.expression, this.allowRSessionAccess);
|
|
328
|
+
(0, send_1.sendMessage)(this.socket, {
|
|
329
|
+
type: 'end-repl-execution',
|
|
330
|
+
id: request.id
|
|
324
331
|
});
|
|
325
332
|
}
|
|
326
|
-
handleQueryRequest(base) {
|
|
333
|
+
async handleQueryRequest(base) {
|
|
327
334
|
const requestResult = (0, validate_1.validateMessage)(base, message_query_1.requestQueryMessage);
|
|
328
335
|
if (requestResult.type === 'error') {
|
|
329
336
|
(0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
|
|
@@ -341,13 +348,15 @@ class FlowRServerConnection {
|
|
|
341
348
|
});
|
|
342
349
|
return;
|
|
343
350
|
}
|
|
344
|
-
|
|
351
|
+
try {
|
|
352
|
+
const results = await fileInformation.analyzer.query(request.query);
|
|
345
353
|
(0, send_1.sendMessage)(this.socket, {
|
|
346
354
|
type: 'response-query',
|
|
347
355
|
id: request.id,
|
|
348
356
|
results
|
|
349
357
|
});
|
|
350
|
-
}
|
|
358
|
+
}
|
|
359
|
+
catch (e) {
|
|
351
360
|
this.logger.error(`[${this.name}] Error while executing query: ${String(e)}`);
|
|
352
361
|
(0, send_1.sendMessage)(this.socket, {
|
|
353
362
|
id: request.id,
|
|
@@ -355,7 +364,7 @@ class FlowRServerConnection {
|
|
|
355
364
|
fatal: false,
|
|
356
365
|
reason: `Error while executing query: ${String(e)}`
|
|
357
366
|
});
|
|
358
|
-
}
|
|
367
|
+
}
|
|
359
368
|
}
|
|
360
369
|
}
|
|
361
370
|
exports.FlowRServerConnection = FlowRServerConnection;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.flowrScriptSummarizer = flowrScriptSummarizer;
|
|
4
|
-
const summarizer_1 = require("../../
|
|
5
|
-
const summarizer_2 = require("../../benchmark/summarizer/summarizer");
|
|
6
|
-
const auto_detect_1 = require("../../statistics/summarizer/auto-detect");
|
|
7
|
-
const feature_1 = require("../../statistics/features/feature");
|
|
4
|
+
const summarizer_1 = require("../../benchmark/summarizer/summarizer");
|
|
8
5
|
function getBenchmarkSummarizer(options, outputBase) {
|
|
9
|
-
return new
|
|
6
|
+
return new summarizer_1.BenchmarkSummarizer({
|
|
10
7
|
graphOutputPath: options.graph ? `${outputBase}-graph.json` : undefined,
|
|
11
8
|
inputPath: options.input,
|
|
12
9
|
intermediateOutputPath: outputBase,
|
|
@@ -14,40 +11,24 @@ function getBenchmarkSummarizer(options, outputBase) {
|
|
|
14
11
|
logger: console.log
|
|
15
12
|
});
|
|
16
13
|
}
|
|
17
|
-
function getStatisticsSummarizer(options, outputBase) {
|
|
18
|
-
return new summarizer_1.StatisticsSummarizer({
|
|
19
|
-
inputPath: options.input,
|
|
20
|
-
outputPath: `${outputBase}-final`,
|
|
21
|
-
intermediateOutputPath: `${outputBase}-intermediate/`,
|
|
22
|
-
projectSkip: options['project-skip'],
|
|
23
|
-
featuresToUse: feature_1.allFeatureNames,
|
|
24
|
-
logger: console.log
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
async function retrieveSummarizer(options, outputBase) {
|
|
28
|
-
const type = options.type === 'auto' ? await (0, auto_detect_1.detectSummarizationType)(options.input) : options.type;
|
|
29
|
-
if (type === "benchmark" /* SummarizerType.Benchmark */) {
|
|
30
|
-
console.log('Summarizing benchmark');
|
|
31
|
-
return getBenchmarkSummarizer(options, outputBase);
|
|
32
|
-
}
|
|
33
|
-
else if (type === "statistics" /* SummarizerType.Statistics */) {
|
|
34
|
-
console.log('Summarizing statistics');
|
|
35
|
-
return getStatisticsSummarizer(options, outputBase);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
console.error('Unknown type', type, 'either give "benchmark" or "statistics"');
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
14
|
/**
|
|
43
15
|
* The core function for the 'flowr summarize' script.
|
|
44
16
|
*/
|
|
45
17
|
async function flowrScriptSummarizer(options) {
|
|
18
|
+
if (options.type && options.type !== 'benchmark') {
|
|
19
|
+
console.error(`Warning: --type ${options.type} is no longer supported. The summarizer only produces benchmark summaries.`);
|
|
20
|
+
}
|
|
21
|
+
if (options.categorize) {
|
|
22
|
+
console.error('Warning: --categorize is no longer supported.');
|
|
23
|
+
}
|
|
24
|
+
if (options['project-skip'] && options['project-skip'] > 0) {
|
|
25
|
+
console.error(`Warning: --project-skip ${options['project-skip']} is no longer supported.`);
|
|
26
|
+
}
|
|
46
27
|
const outputBase = (options.output ?? options.input).replace(/\.json$|\/$/, '-summary');
|
|
47
28
|
console.log(`Writing outputs to base ${outputBase}`);
|
|
48
|
-
const summarizer =
|
|
29
|
+
const summarizer = getBenchmarkSummarizer(options, outputBase);
|
|
49
30
|
if (!options['ultimate-only']) {
|
|
50
|
-
await summarizer.preparationPhase(
|
|
31
|
+
await summarizer.preparationPhase();
|
|
51
32
|
}
|
|
52
33
|
await summarizer.summarizePhase();
|
|
53
34
|
}
|
package/cli/wiki.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ import { WikiSetup } from '../documentation/wiki-setup';
|
|
|
10
10
|
import { WikiOverview } from '../documentation/wiki-overview';
|
|
11
11
|
import { WikiAbsint } from '../documentation/wiki-absint';
|
|
12
12
|
import { WikiCreateLintingRules } from '../documentation/wiki-create-linting-rules';
|
|
13
|
-
|
|
13
|
+
import { WikiPackageDatabase } from '../documentation/wiki-package-database';
|
|
14
|
+
export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, WikiCreateLintingRules, WikiPackageDatabase, IssueLintingRule, DocReadme, DocCapabilities];
|
|
14
15
|
export type ValidWikiDocumentTargets = ReturnType<typeof AllWikiDocuments[number]['getTarget']>;
|
|
15
16
|
export type ValidWikiDocumentTargetsNoSuffix = ValidWikiDocumentTargets extends `${infer Name}.${string}` ? Name : never;
|
|
16
17
|
/**
|
package/cli/wiki.js
CHANGED
|
@@ -28,6 +28,7 @@ const wiki_setup_1 = require("../documentation/wiki-setup");
|
|
|
28
28
|
const wiki_overview_1 = require("../documentation/wiki-overview");
|
|
29
29
|
const wiki_absint_1 = require("../documentation/wiki-absint");
|
|
30
30
|
const wiki_create_linting_rules_1 = require("../documentation/wiki-create-linting-rules");
|
|
31
|
+
const wiki_package_database_1 = require("../documentation/wiki-package-database");
|
|
31
32
|
exports.AllWikiDocuments = [
|
|
32
33
|
new wiki_faq_1.WikiFaq(),
|
|
33
34
|
new documentation_1.WikiSearch(),
|
|
@@ -46,6 +47,7 @@ exports.AllWikiDocuments = [
|
|
|
46
47
|
new wiki_linter_1.WikiLinter(),
|
|
47
48
|
new wiki_absint_1.WikiAbsint(),
|
|
48
49
|
new wiki_create_linting_rules_1.WikiCreateLintingRules(),
|
|
50
|
+
new wiki_package_database_1.WikiPackageDatabase(),
|
|
49
51
|
new issue_linting_rule_1.IssueLintingRule(),
|
|
50
52
|
new doc_readme_1.DocReadme(),
|
|
51
53
|
new documentation_1.DocCapabilities()
|
package/config.d.ts
CHANGED
|
@@ -149,6 +149,15 @@ export interface FlowrConfig extends MergeableRecord {
|
|
|
149
149
|
* When disabled all envir-style calls fall through to the conservative global treatment.
|
|
150
150
|
*/
|
|
151
151
|
readonly trackEnvironments: boolean;
|
|
152
|
+
/** Resolving `library()`/`use()` exports from a package database (e.g. the bundled `flowr-pkgdb`). */
|
|
153
|
+
readonly pkgdb: {
|
|
154
|
+
/** Resolve library exports from a package database (default `true`); when `false` no database is consulted. */
|
|
155
|
+
readonly enabled: boolean;
|
|
156
|
+
/** Parse the database up front rather than on the first package load (default `false`, ignored if disabled). */
|
|
157
|
+
readonly eagerlyLoad: boolean;
|
|
158
|
+
/** Add a vertex for every export on load rather than on demand (default `false`); keeps the graph small. */
|
|
159
|
+
readonly eagerlyLoadExports: boolean;
|
|
160
|
+
};
|
|
152
161
|
/** These keys are only intended for use within code, allowing to instrument the dataflow analyzer! */
|
|
153
162
|
readonly instrument: {
|
|
154
163
|
/**
|
package/config.js
CHANGED
|
@@ -54,6 +54,9 @@ const defaultEngineConfigs = {
|
|
|
54
54
|
exports.FlowrDefaultPlugins = [
|
|
55
55
|
'file:description',
|
|
56
56
|
'versions:description',
|
|
57
|
+
'versions:pkgdb',
|
|
58
|
+
'versions:renv',
|
|
59
|
+
'versions:rv',
|
|
57
60
|
'loading-order:description',
|
|
58
61
|
'meta:description',
|
|
59
62
|
'files:vignette',
|
|
@@ -65,6 +68,7 @@ exports.FlowrDefaultPlugins = [
|
|
|
65
68
|
'file:namespace',
|
|
66
69
|
'file:news',
|
|
67
70
|
'file:license',
|
|
71
|
+
'file:virtualenv',
|
|
68
72
|
];
|
|
69
73
|
/**
|
|
70
74
|
* Helper Object to work with {@link FlowrConfig}, provides the default config and the Joi schema for validation.
|
|
@@ -101,6 +105,7 @@ exports.FlowrConfig = {
|
|
|
101
105
|
variables: VariableResolve.Alias,
|
|
102
106
|
evalStrings: true,
|
|
103
107
|
trackEnvironments: true,
|
|
108
|
+
pkgdb: { enabled: true, eagerlyLoad: false, eagerlyLoadExports: false },
|
|
104
109
|
resolveSource: {
|
|
105
110
|
dropPaths: DropPathsOption.No,
|
|
106
111
|
ignoreCapitalization: true,
|
|
@@ -171,6 +176,11 @@ exports.FlowrConfig = {
|
|
|
171
176
|
variables: joi_1.default.string().valid(...Object.values(VariableResolve)).description('How to resolve variables and their values.'),
|
|
172
177
|
evalStrings: joi_1.default.boolean().description('Should we include eval(parse(text="...")) calls in the dataflow graph?'),
|
|
173
178
|
trackEnvironments: joi_1.default.boolean().optional().description('Track user-created environments (new.env, assign/get/local with envir=, dollar-assign, attach). When false, all envir-style calls fall through conservatively.'),
|
|
179
|
+
pkgdb: joi_1.default.object({
|
|
180
|
+
enabled: joi_1.default.boolean().optional().description('Resolve library()/use() exports from a package database (default true); when false no database is consulted.'),
|
|
181
|
+
eagerlyLoad: joi_1.default.boolean().optional().description('Parse the database up front rather than on the first package load (default false, ignored if disabled).'),
|
|
182
|
+
eagerlyLoadExports: joi_1.default.boolean().optional().description('Add a vertex for every export on load rather than on demand (default false); keeps the dataflow graph small.')
|
|
183
|
+
}).description('Resolving library exports from a package database.'),
|
|
174
184
|
instrument: joi_1.default.object({
|
|
175
185
|
dataflowExtractors: joi_1.default.any().optional().description('These keys are only intended for use within code, allowing to instrument the dataflow analyzer!')
|
|
176
186
|
}),
|
|
@@ -255,6 +255,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
255
255
|
return this.onPurrFormulaCall({ call });
|
|
256
256
|
case built_in_proc_name_1.BuiltInProcName.NamespaceAccess:
|
|
257
257
|
case built_in_proc_name_1.BuiltInProcName.NewEnv:
|
|
258
|
+
case built_in_proc_name_1.BuiltInProcName.StackEnv:
|
|
258
259
|
case built_in_proc_name_1.BuiltInProcName.With:
|
|
259
260
|
case built_in_proc_name_1.BuiltInProcName.Attach:
|
|
260
261
|
case built_in_proc_name_1.BuiltInProcName.Default:
|