@eagleoutice/flowr 2.9.12 → 2.9.14
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 -23
- package/abstract-interpretation/absint-visitor.d.ts +1 -1
- package/abstract-interpretation/absint-visitor.js +20 -20
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -2
- package/benchmark/slicer.d.ts +5 -3
- package/benchmark/slicer.js +26 -10
- package/benchmark/stats/print.js +12 -0
- package/benchmark/stats/stats.d.ts +3 -2
- package/benchmark/stats/stats.js +1 -1
- package/benchmark/summarizer/data.d.ts +1 -0
- package/benchmark/summarizer/second-phase/process.js +5 -0
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +1 -0
- package/cli/benchmark-helper-app.d.ts +2 -1
- package/cli/benchmark-helper-app.js +6 -3
- package/cli/common/options.d.ts +8 -0
- package/cli/common/options.js +3 -1
- package/cli/common/scripts-info.d.ts +8 -0
- package/cli/export-quads-app.js +1 -1
- package/cli/flowr.js +3 -3
- package/cli/repl/commands/repl-dataflow.js +5 -5
- package/cli/repl/core.d.ts +3 -3
- package/cli/repl/parser/slice-query-parser.d.ts +1 -1
- package/cli/repl/parser/slice-query-parser.js +2 -2
- package/cli/repl/server/connection.d.ts +2 -2
- package/cli/repl/server/connection.js +2 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/repl/server/messages/message-slice.js +2 -2
- package/cli/repl/server/server.d.ts +2 -2
- package/cli/script-core/statistics-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.js +1 -1
- package/cli/slicer-app.js +2 -2
- package/cli/statistics-app.js +1 -1
- package/cli/statistics-helper-app.js +1 -1
- package/cli/wiki.js +2 -2
- package/config.d.ts +65 -24
- package/config.js +197 -161
- package/control-flow/extract-cfg.js +7 -10
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +43 -43
- package/control-flow/useless-loop.d.ts +1 -1
- package/control-flow/useless-loop.js +3 -3
- package/core/print/dataflow-printer.d.ts +0 -14
- package/core/print/dataflow-printer.js +0 -21
- package/core/steps/all/core/20-dataflow.d.ts +3 -3
- package/core/steps/all/core/20-dataflow.js +3 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +2 -5
- package/core/steps/all/static-slicing/00-slice.js +6 -8
- package/core/steps/pipeline/default-pipelines.d.ts +89 -89
- package/core/steps/pipeline-step.d.ts +2 -2
- package/dataflow/environments/built-in-proc-name.d.ts +83 -0
- package/dataflow/environments/built-in-proc-name.js +88 -0
- package/dataflow/environments/built-in.d.ts +1 -83
- package/dataflow/environments/built-in.js +37 -120
- package/dataflow/environments/default-builtin-config.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.js +75 -75
- package/dataflow/environments/identifier.d.ts +1 -0
- package/dataflow/environments/identifier.js +1 -0
- package/dataflow/eval/resolve/alias-tracking.js +12 -15
- package/dataflow/eval/resolve/resolve.js +2 -2
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/exceptions-of-function.js +2 -2
- package/dataflow/graph/call-graph.d.ts +49 -19
- package/dataflow/graph/call-graph.js +117 -114
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.js +2 -2
- package/dataflow/graph/df-helper.d.ts +132 -0
- package/dataflow/graph/df-helper.js +131 -0
- package/dataflow/graph/diff-dataflow-graph.d.ts +5 -10
- package/dataflow/graph/diff-dataflow-graph.js +3 -28
- package/dataflow/graph/edge.d.ts +1 -0
- package/dataflow/graph/edge.js +1 -0
- package/dataflow/graph/graph-helper.d.ts +55 -0
- package/dataflow/graph/graph-helper.js +105 -0
- package/dataflow/graph/graph.d.ts +6 -1
- package/dataflow/graph/graph.js +14 -9
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/info.d.ts +14 -4
- package/dataflow/info.js +28 -16
- package/dataflow/internal/linker.d.ts +14 -10
- package/dataflow/internal/linker.js +29 -32
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +23 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
- package/dataflow/internal/process/process-uninteresting-leaf.d.ts +1 -1
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -1
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.js +6 -6
- package/documentation/doc-readme.js +2 -2
- package/documentation/doc-util/doc-dfg.d.ts +3 -0
- package/documentation/doc-util/doc-dfg.js +5 -7
- package/documentation/doc-util/doc-normalized-ast.d.ts +0 -6
- package/documentation/doc-util/doc-normalized-ast.js +0 -23
- package/documentation/doc-util/doc-structure.js +3 -3
- package/documentation/doc-util/doc-types.js +3 -3
- package/documentation/wiki-analyzer.js +7 -5
- package/documentation/wiki-core.js +6 -7
- package/documentation/wiki-dataflow-graph.js +15 -13
- package/documentation/wiki-interface.js +8 -6
- package/documentation/wiki-linter.js +6 -5
- package/documentation/wiki-mk/doc-context.js +3 -4
- package/documentation/wiki-normalized-ast.js +5 -4
- package/documentation/wiki-query.js +28 -3
- package/engines.d.ts +2 -2
- package/engines.js +4 -4
- package/linter/linter-rules.d.ts +24 -1
- package/linter/linter-rules.js +3 -1
- package/linter/rules/dataframe-access-validation.js +5 -5
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +7 -3
- package/linter/rules/seeded-randomness.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +35 -0
- package/linter/rules/stop-with-call-arg.js +72 -0
- package/linter/rules/useless-loop.d.ts +1 -1
- package/package.json +3 -1
- package/project/cache/flowr-analyzer-cache.d.ts +1 -1
- package/project/cache/flowr-analyzer-cache.js +1 -1
- package/project/context/flowr-analyzer-context.d.ts +6 -6
- package/project/context/flowr-analyzer-context.js +2 -2
- package/project/context/flowr-analyzer-files-context.d.ts +2 -2
- package/project/context/flowr-analyzer-files-context.js +28 -8
- package/project/flowr-analyzer-builder.d.ts +13 -6
- package/project/flowr-analyzer-builder.js +12 -3
- package/project/flowr-analyzer.d.ts +4 -4
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +2 -2
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
- package/queries/catalog/config-query/config-query-format.d.ts +5 -5
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -2
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
- package/queries/catalog/files-query/files-query-format.d.ts +3 -3
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +3 -3
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -2
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/provenance-query/provenance-query-executor.d.ts +9 -0
- package/queries/catalog/provenance-query/provenance-query-executor.js +37 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +35 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +62 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -4
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -0
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -4
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -3
- package/queries/query.d.ts +27 -19
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +13 -2
- package/r-bridge/lang-4.x/ast/model/model.js +20 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +8 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +13 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -2
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-printer.js +3 -3
- package/search/search-executor/search-enrichers.js +2 -2
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +40 -16
- package/slicing/criterion/parse.js +67 -63
- package/slicing/static/slicer-types.d.ts +2 -3
- package/slicing/static/static-slicer.d.ts +3 -4
- package/slicing/static/static-slicer.js +9 -12
- package/statistics/statistics.d.ts +2 -2
- package/util/diff.d.ts +2 -2
- package/util/mermaid/ast.js +4 -4
- package/util/mermaid/cfg.js +5 -5
- package/util/mermaid/dfg.d.ts +33 -18
- package/util/mermaid/dfg.js +46 -31
- package/util/mermaid/mermaid.d.ts +57 -12
- package/util/mermaid/mermaid.js +74 -67
- package/util/objects.d.ts +12 -0
- package/util/objects.js +28 -0
- package/util/range.d.ts +8 -0
- package/util/range.js +13 -1
- package/util/slice-direction.d.ts +7 -0
- package/util/slice-direction.js +12 -0
- package/util/summarizer.js +1 -1
- package/util/version.js +1 -1
- package/dataflow/graph/invert-dfg.d.ts +0 -6
- package/dataflow/graph/invert-dfg.js +0 -20
- package/dataflow/graph/resolve-graph.d.ts +0 -8
- package/dataflow/graph/resolve-graph.js +0 -59
|
@@ -31,14 +31,14 @@ async function benchmark() {
|
|
|
31
31
|
(0, assert_1.guard)(options.output !== undefined, 'No output file given');
|
|
32
32
|
(0, assert_1.guard)((options['file-id'] === undefined) === (options['run-num'] === undefined), 'When giving a file-id or run-num, both have to be given');
|
|
33
33
|
// prefix for printing to console, includes file id and run number if present
|
|
34
|
-
const prefix = `[${options.input}${options['file-id']
|
|
34
|
+
const prefix = `[${options.input}${options['file-id'] === undefined ? '' : ` (file ${options['file-id']}, run ${options['run-num']})`}]`;
|
|
35
35
|
console.log(`${prefix} Appending output to ${options.output}`);
|
|
36
36
|
const directory = path_1.default.parse(options.output).dir;
|
|
37
37
|
// ensure the directory exists if the path contains one
|
|
38
38
|
if (directory !== '') {
|
|
39
39
|
fs_1.default.mkdirSync(directory, { recursive: true });
|
|
40
40
|
}
|
|
41
|
-
const config =
|
|
41
|
+
const config = config_1.FlowrConfig.fromFile();
|
|
42
42
|
// ensure the file exists
|
|
43
43
|
const fileStat = fs_1.default.statSync(options.input);
|
|
44
44
|
(0, assert_1.guard)(fileStat.isFile(), `File ${options.input} does not exist or is no file`);
|
|
@@ -58,7 +58,7 @@ async function benchmark() {
|
|
|
58
58
|
console.log(`${prefix} Skipping Slicing due to --slice=${options.slice}`);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
const limit = parseInt(options.slice);
|
|
61
|
+
const limit = Number.parseInt(options.slice);
|
|
62
62
|
console.log(`${prefix} Slicing up to ${limit} possible slices`);
|
|
63
63
|
const count = await slicer.sliceForAll(all_variables_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(`${prefix} Slicing ${i + 1}/${total} [${JSON.stringify(arr[i])}]`), { sampleCount: limit, maxSliceCount: maxSlices, sampleStrategy: options['sampling-strategy'], seed: options.seed });
|
|
64
64
|
console.log(`${prefix} Completed Slicing`);
|
|
@@ -68,6 +68,9 @@ async function benchmark() {
|
|
|
68
68
|
if (options['cfg'] || options['dataframe-shape-inference']) {
|
|
69
69
|
slicer.extractCFG();
|
|
70
70
|
}
|
|
71
|
+
if (options['cg']) {
|
|
72
|
+
slicer.extractCG();
|
|
73
|
+
}
|
|
71
74
|
if (options['dataframe-shape-inference']) {
|
|
72
75
|
console.log(`${prefix} Performing shape inference for data frames`);
|
|
73
76
|
slicer.inferDataFrameShapes();
|
package/cli/common/options.d.ts
CHANGED
|
@@ -105,6 +105,10 @@ export declare const benchmarkOptions: [{
|
|
|
105
105
|
readonly alias: "c";
|
|
106
106
|
readonly type: BooleanConstructor;
|
|
107
107
|
readonly description: "Extract the control flow graph of the file (benchmark it too)";
|
|
108
|
+
}, {
|
|
109
|
+
readonly name: "cg";
|
|
110
|
+
readonly type: BooleanConstructor;
|
|
111
|
+
readonly description: "Extract the call graph of the file (benchmark it too)";
|
|
108
112
|
}];
|
|
109
113
|
export declare const benchmarkHelperOptions: [{
|
|
110
114
|
readonly name: "verbose";
|
|
@@ -146,6 +150,10 @@ export declare const benchmarkHelperOptions: [{
|
|
|
146
150
|
readonly alias: "c";
|
|
147
151
|
readonly type: BooleanConstructor;
|
|
148
152
|
readonly description: "Extract the control flow graph of the file (benchmark it too)";
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "cg";
|
|
155
|
+
readonly type: BooleanConstructor;
|
|
156
|
+
readonly description: "Extract the call graph of the file (benchmark it too)";
|
|
149
157
|
}, {
|
|
150
158
|
readonly name: "output";
|
|
151
159
|
readonly alias: "o";
|
package/cli/common/options.js
CHANGED
|
@@ -27,7 +27,8 @@ exports.benchmarkOptions = [
|
|
|
27
27
|
{ name: 'threshold', alias: 't', type: Number, description: 'How many re-visits of the same node are ok?', defaultValue: undefined, typeLabel: '{underline number}' },
|
|
28
28
|
{ name: 'per-file-time-limit', type: Number, description: 'Time limit in milliseconds to process single file (disabled by default)', defaultValue: undefined, typeLabel: '{underline number}' },
|
|
29
29
|
{ name: 'sampling-strategy', type: String, description: 'Which strategy to use, when sampling is enabled', defaultValue: 'random', typeLabel: '{underline random/equidistant}' },
|
|
30
|
-
{ name: 'cfg', alias: 'c', type: Boolean, description: 'Extract the control flow graph of the file (benchmark it too)' }
|
|
30
|
+
{ name: 'cfg', alias: 'c', type: Boolean, description: 'Extract the control flow graph of the file (benchmark it too)' },
|
|
31
|
+
{ name: 'cg', type: Boolean, description: 'Extract the call graph of the file (benchmark it too)' }
|
|
31
32
|
];
|
|
32
33
|
exports.benchmarkHelperOptions = [
|
|
33
34
|
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging [do not use for the real benchmark as this affects the time measurements, but only to find errors]' },
|
|
@@ -37,6 +38,7 @@ exports.benchmarkHelperOptions = [
|
|
|
37
38
|
{ name: 'run-num', alias: 'r', type: Number, description: 'The n-th time that the file with the given file-id is being benchmarked' },
|
|
38
39
|
{ name: 'slice', alias: 's', type: String, description: 'Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction. Numbers will indicate: sample X random slices from all.', defaultValue: 'all', typeLabel: '{underline all/no}' },
|
|
39
40
|
{ name: 'cfg', alias: 'c', type: Boolean, description: 'Extract the control flow graph of the file (benchmark it too)' },
|
|
41
|
+
{ name: 'cg', type: Boolean, description: 'Extract the call graph of the file (benchmark it too)' },
|
|
40
42
|
{ name: 'output', alias: 'o', type: String, description: 'File to write the measurements to (appends a single line in JSON format)', typeLabel: '{underline file}' },
|
|
41
43
|
{ name: 'parser', type: String, description: 'The parser to use for the benchmark', defaultValue: 'r-shell', typeLabel: '{underline parser}' },
|
|
42
44
|
{ name: 'dataframe-shape-inference', type: Boolean, description: 'Infer the shape of data frames using abstract interpretation (includes control flow graph extraction)', defaultValue: false },
|
|
@@ -192,6 +192,10 @@ declare const _scripts: {
|
|
|
192
192
|
readonly alias: "c";
|
|
193
193
|
readonly type: BooleanConstructor;
|
|
194
194
|
readonly description: "Extract the control flow graph of the file (benchmark it too)";
|
|
195
|
+
}, {
|
|
196
|
+
readonly name: "cg";
|
|
197
|
+
readonly type: BooleanConstructor;
|
|
198
|
+
readonly description: "Extract the call graph of the file (benchmark it too)";
|
|
195
199
|
}];
|
|
196
200
|
};
|
|
197
201
|
'benchmark-helper': {
|
|
@@ -239,6 +243,10 @@ declare const _scripts: {
|
|
|
239
243
|
readonly alias: "c";
|
|
240
244
|
readonly type: BooleanConstructor;
|
|
241
245
|
readonly description: "Extract the control flow graph of the file (benchmark it too)";
|
|
246
|
+
}, {
|
|
247
|
+
readonly name: "cg";
|
|
248
|
+
readonly type: BooleanConstructor;
|
|
249
|
+
readonly description: "Extract the call graph of the file (benchmark it too)";
|
|
242
250
|
}, {
|
|
243
251
|
readonly name: "output";
|
|
244
252
|
readonly alias: "o";
|
package/cli/export-quads-app.js
CHANGED
|
@@ -18,7 +18,7 @@ const options = (0, script_1.processCommandLineArgs)('export-quads', [], {
|
|
|
18
18
|
'{bold --help}'
|
|
19
19
|
]
|
|
20
20
|
});
|
|
21
|
-
const shell = new shell_1.RShell(
|
|
21
|
+
const shell = new shell_1.RShell(config_1.FlowrConfig.getForEngine(config_1.FlowrConfig.fromFile(), 'r-shell'));
|
|
22
22
|
async function writeQuadForSingleFile(request, output) {
|
|
23
23
|
const normalized = await (0, retriever_1.retrieveNormalizedAstFromRCode)(request, shell);
|
|
24
24
|
const serialized = (0, quads_1.serialize2quads)(normalized.ast.files[0].root, { context: request.content });
|
package/cli/flowr.js
CHANGED
|
@@ -54,7 +54,7 @@ if (options['no-ansi']) {
|
|
|
54
54
|
function createConfig() {
|
|
55
55
|
let config;
|
|
56
56
|
if (options['config-json']) {
|
|
57
|
-
const passedConfig =
|
|
57
|
+
const passedConfig = config_1.FlowrConfig.parse(options['config-json']);
|
|
58
58
|
if (passedConfig) {
|
|
59
59
|
log_1.log.info(`Using passed config ${JSON.stringify(passedConfig)}`);
|
|
60
60
|
config = passedConfig;
|
|
@@ -68,10 +68,10 @@ function createConfig() {
|
|
|
68
68
|
process.exit(1);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
config =
|
|
71
|
+
config = config_1.FlowrConfig.fromFile(options['config-file'] ?? flowr_main_options_1.defaultConfigFile);
|
|
72
72
|
}
|
|
73
73
|
// for all options that we manually supply that have a config equivalent, set them in the config
|
|
74
|
-
config =
|
|
74
|
+
config = config_1.FlowrConfig.amend(config, c => {
|
|
75
75
|
c.engines ??= [];
|
|
76
76
|
if (!options['engine.r-shell.disabled']) {
|
|
77
77
|
c.engines.push({ type: 'r-shell', rPath: options['r-path'] || options['engine.r-shell.r-path'] });
|
|
@@ -35,11 +35,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.dataflowSimpleStarCommand = exports.dataflowSimplifiedCommand = exports.dataflowSilentCommand = exports.dataflowAsciiCommand = exports.dataflowStarCommand = exports.dataflowCommand = void 0;
|
|
37
37
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
38
|
-
const dfg_1 = require("../../../util/mermaid/dfg");
|
|
39
38
|
const ansi_1 = require("../../../util/text/ansi");
|
|
40
39
|
const core_1 = require("../core");
|
|
41
40
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
42
41
|
const dfg_ascii_1 = require("../../../util/simple-df/dfg-ascii");
|
|
42
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
43
43
|
function formatInfo(out, type, meta) {
|
|
44
44
|
return out.formatter.format(`Copied ${type} to clipboard (dataflow: ${meta['.meta'].timing + 'ms'}).`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ });
|
|
45
45
|
}
|
|
@@ -52,7 +52,7 @@ exports.dataflowCommand = {
|
|
|
52
52
|
argsParser: (args) => (0, core_1.handleString)(args),
|
|
53
53
|
fn: async ({ output, analyzer }) => {
|
|
54
54
|
const result = await analyzer.dataflow();
|
|
55
|
-
const mermaid =
|
|
55
|
+
const mermaid = df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false }).string;
|
|
56
56
|
output.stdout(mermaid);
|
|
57
57
|
try {
|
|
58
58
|
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
@@ -72,7 +72,7 @@ exports.dataflowStarCommand = {
|
|
|
72
72
|
argsParser: (args) => (0, core_1.handleString)(args),
|
|
73
73
|
fn: async ({ output, analyzer }) => {
|
|
74
74
|
const result = await analyzer.dataflow();
|
|
75
|
-
const mermaid =
|
|
75
|
+
const mermaid = df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false);
|
|
76
76
|
output.stdout(mermaid);
|
|
77
77
|
try {
|
|
78
78
|
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
@@ -126,7 +126,7 @@ exports.dataflowSimplifiedCommand = {
|
|
|
126
126
|
argsParser: (args) => (0, core_1.handleString)(args),
|
|
127
127
|
fn: async ({ output, analyzer }) => {
|
|
128
128
|
const result = await analyzer.dataflow();
|
|
129
|
-
const mermaid =
|
|
129
|
+
const mermaid = df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false, simplified: true }).string;
|
|
130
130
|
output.stdout(mermaid);
|
|
131
131
|
try {
|
|
132
132
|
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
@@ -145,7 +145,7 @@ exports.dataflowSimpleStarCommand = {
|
|
|
145
145
|
argsParser: (args) => (0, core_1.handleString)(args),
|
|
146
146
|
fn: async ({ output, analyzer }) => {
|
|
147
147
|
const result = await analyzer.dataflow();
|
|
148
|
-
const mermaid =
|
|
148
|
+
const mermaid = df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false, undefined, true);
|
|
149
149
|
output.stdout(mermaid);
|
|
150
150
|
try {
|
|
151
151
|
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
package/cli/repl/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as readline from 'readline';
|
|
2
2
|
import { type ReplOutput } from './commands/repl-main';
|
|
3
3
|
import type { MergeableRecord } from '../../util/objects';
|
|
4
|
-
import type {
|
|
4
|
+
import type { FlowrConfig } from '../../config';
|
|
5
5
|
import type { FlowrAnalyzer } from '../../project/flowr-analyzer';
|
|
6
6
|
/**
|
|
7
7
|
* Completion suggestions for a specific REPL command
|
|
@@ -18,11 +18,11 @@ export interface CommandCompletions {
|
|
|
18
18
|
/**
|
|
19
19
|
* Used by the repl to provide automatic completions for a given (partial) input line
|
|
20
20
|
*/
|
|
21
|
-
export declare function replCompleter(line: string, config:
|
|
21
|
+
export declare function replCompleter(line: string, config: FlowrConfig): [string[], string];
|
|
22
22
|
/**
|
|
23
23
|
* Produces default readline options for the flowR REPL
|
|
24
24
|
*/
|
|
25
|
-
export declare function makeDefaultReplReadline(config:
|
|
25
|
+
export declare function makeDefaultReplReadline(config: FlowrConfig): readline.ReadLineOptions;
|
|
26
26
|
/**
|
|
27
27
|
* Handles a string input for the REPL, returning the parsed string and any remaining input.
|
|
28
28
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SliceDirection } from '../../../core/steps/all/static-slicing/00-slice';
|
|
2
1
|
import type { SingleSlicingCriterion, SlicingCriteria } from '../../../slicing/criterion/parse';
|
|
2
|
+
import { SliceDirection } from '../../../util/slice-direction';
|
|
3
3
|
/**
|
|
4
4
|
* Checks whether the given argument represents a slicing direction with an `f` suffix.
|
|
5
5
|
*/
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.sliceDirectionParser = sliceDirectionParser;
|
|
4
4
|
exports.sliceCriterionParser = sliceCriterionParser;
|
|
5
5
|
exports.sliceCriteriaParser = sliceCriteriaParser;
|
|
6
|
-
const
|
|
6
|
+
const slice_direction_1 = require("../../../util/slice-direction");
|
|
7
7
|
/**
|
|
8
8
|
* Checks whether the given argument represents a slicing direction with an `f` suffix.
|
|
9
9
|
*/
|
|
10
10
|
function sliceDirectionParser(argument) {
|
|
11
11
|
const endBracket = argument.indexOf(')');
|
|
12
|
-
return argument[endBracket + 1] === 'f' ?
|
|
12
|
+
return argument[endBracket + 1] === 'f' ? slice_direction_1.SliceDirection.Forward : slice_direction_1.SliceDirection.Backward;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Parses a single slicing criterion from the given argument.
|
|
@@ -3,7 +3,7 @@ import { type TREE_SITTER_DATAFLOW_PIPELINE, DEFAULT_SLICING_PIPELINE } from '..
|
|
|
3
3
|
import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
|
|
4
4
|
import type { DeepPartial } from 'ts-essentials';
|
|
5
5
|
import type { KnownParser, ParseStepOutput } from '../../../r-bridge/parser';
|
|
6
|
-
import type {
|
|
6
|
+
import type { FlowrConfig } from '../../../config';
|
|
7
7
|
import type { NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
8
|
import type { DataflowInformation } from '../../../dataflow/info';
|
|
9
9
|
import type { Tree } from 'web-tree-sitter';
|
|
@@ -19,7 +19,7 @@ export declare class FlowRServerConnection {
|
|
|
19
19
|
private readonly allowRSessionAccess;
|
|
20
20
|
private readonly config;
|
|
21
21
|
private readonly fileMap;
|
|
22
|
-
constructor(socket: Socket, name: string, parser: KnownParser, allowRSessionAccess: boolean, config:
|
|
22
|
+
constructor(socket: Socket, name: string, parser: KnownParser, allowRSessionAccess: boolean, config: FlowrConfig);
|
|
23
23
|
private currentMessageBuffer;
|
|
24
24
|
private handleData;
|
|
25
25
|
private handleFileAnalysisRequest;
|
|
@@ -58,8 +58,8 @@ const tmp = __importStar(require("tmp"));
|
|
|
58
58
|
const fs_1 = __importDefault(require("fs"));
|
|
59
59
|
const message_query_1 = require("./messages/message-query");
|
|
60
60
|
const compact_1 = require("./compact");
|
|
61
|
-
const _00_slice_1 = require("../../../core/steps/all/static-slicing/00-slice");
|
|
62
61
|
const flowr_analyzer_builder_1 = require("../../../project/flowr-analyzer-builder");
|
|
62
|
+
const slice_direction_1 = require("../../../util/slice-direction");
|
|
63
63
|
/**
|
|
64
64
|
* Each connection handles a single client, answering to its requests.
|
|
65
65
|
* There is no need to construct this class manually, {@link FlowRServer} will do it for you.
|
|
@@ -235,7 +235,7 @@ class FlowRServerConnection {
|
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
const request = requestResult.message;
|
|
238
|
-
this.logger.info(`[${request.filetoken}] Received ${request.direction ??
|
|
238
|
+
this.logger.info(`[${request.filetoken}] Received ${request.direction ?? slice_direction_1.SliceDirection.Backward} slice request with criteria ${JSON.stringify(request.criterion)}`);
|
|
239
239
|
const fileInformation = this.fileMap.get(request.filetoken);
|
|
240
240
|
if (!fileInformation) {
|
|
241
241
|
(0, send_1.sendMessage)(this.socket, {
|
|
@@ -2,7 +2,7 @@ import type { IdMessageBase, MessageDefinition } from './all-messages';
|
|
|
2
2
|
import type { SlicingCriteria } from '../../../../slicing/criterion/parse';
|
|
3
3
|
import type { PipelineOutput } from '../../../../core/steps/pipeline/pipeline';
|
|
4
4
|
import type { DEFAULT_DATAFLOW_PIPELINE, DEFAULT_SLICING_PIPELINE } from '../../../../core/steps/pipeline/default-pipelines';
|
|
5
|
-
import { SliceDirection } from '../../../../
|
|
5
|
+
import { SliceDirection } from '../../../../util/slice-direction';
|
|
6
6
|
/**
|
|
7
7
|
* Can only be sent after you have sent the {@link FileAnalysisRequestMessage}.
|
|
8
8
|
* Using the same `filetoken` as in the {@link FileAnalysisRequestMessage} you
|
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.responseSliceMessage = exports.requestSliceMessage = void 0;
|
|
37
37
|
const Joi = __importStar(require("joi"));
|
|
38
|
-
const
|
|
38
|
+
const slice_direction_1 = require("../../../../util/slice-direction");
|
|
39
39
|
exports.requestSliceMessage = {
|
|
40
40
|
type: 'request-slice',
|
|
41
41
|
schema: Joi.object({
|
|
@@ -43,7 +43,7 @@ exports.requestSliceMessage = {
|
|
|
43
43
|
id: Joi.string().optional().description('The id of the message, if you passed one in the request.'),
|
|
44
44
|
filetoken: Joi.string().required().description('The filetoken of the file to slice must be the same as with the analysis request.'),
|
|
45
45
|
criterion: Joi.array().items(Joi.string()).min(0).required().required().description('The slicing criteria to use.'),
|
|
46
|
-
direction: Joi.string().valid(...Object.values(
|
|
46
|
+
direction: Joi.string().valid(...Object.values(slice_direction_1.SliceDirection)).description('The direction to slice in. Defaults to backward slicing if unset.')
|
|
47
47
|
})
|
|
48
48
|
};
|
|
49
49
|
exports.responseSliceMessage = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Server } from './net';
|
|
2
2
|
import { FlowrLogger } from '../../../util/log';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FlowrConfig, KnownEngines } from '../../../config';
|
|
4
4
|
export declare const serverLog: FlowrLogger;
|
|
5
5
|
/**
|
|
6
6
|
* This class controls the TCP server, which can be started by calling {@link start}.
|
|
@@ -17,7 +17,7 @@ export declare class FlowRServer {
|
|
|
17
17
|
/** maps names to the respective connection */
|
|
18
18
|
private readonly connections;
|
|
19
19
|
private nameCounter;
|
|
20
|
-
constructor(engines: KnownEngines, defaultEngine: keyof KnownEngines, allowRSessionAccess: boolean, config:
|
|
20
|
+
constructor(engines: KnownEngines, defaultEngine: keyof KnownEngines, allowRSessionAccess: boolean, config: FlowrConfig, server?: Server);
|
|
21
21
|
start(port: number): Promise<void>;
|
|
22
22
|
private onConnect;
|
|
23
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StatsCliOptions } from '../statistics-app';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FlowrConfig } from '../../config';
|
|
3
3
|
/**
|
|
4
4
|
* The core function for the 'flowr stats' script.
|
|
5
5
|
*/
|
|
6
|
-
export declare function flowrScriptGetStats(options: StatsCliOptions, config:
|
|
6
|
+
export declare function flowrScriptGetStats(options: StatsCliOptions, config: FlowrConfig): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StatsHelperCliOptions } from '../statistics-helper-app';
|
|
2
|
-
import {
|
|
2
|
+
import { FlowrConfig } from '../../config';
|
|
3
3
|
/**
|
|
4
4
|
* Get statistics for a single file
|
|
5
5
|
*/
|
|
6
|
-
export declare function getStatsForSingleFile(options: StatsHelperCliOptions, config:
|
|
6
|
+
export declare function getStatsForSingleFile(options: StatsHelperCliOptions, config: FlowrConfig): Promise<void>;
|
|
@@ -55,7 +55,7 @@ async function getStatsForSingleFile(options, config) {
|
|
|
55
55
|
}
|
|
56
56
|
// assume correct
|
|
57
57
|
const processedFeatures = new Set(options.features);
|
|
58
|
-
const shell = new shell_1.RShell(
|
|
58
|
+
const shell = new shell_1.RShell(config_1.FlowrConfig.getForEngine(config, 'r-shell'));
|
|
59
59
|
(0, statistics_file_1.initFileProvider)(options['output-dir']);
|
|
60
60
|
await shell.obtainTmpDir();
|
|
61
61
|
const stats = await (0, statistics_1.extractUsageStatistics)(shell, config, () => { }, processedFeatures, (0, statistics_1.staticRequests)({ request: 'file', content: options.input }), options['root-dir']);
|
package/cli/slicer-app.js
CHANGED
|
@@ -29,7 +29,7 @@ async function getSlice() {
|
|
|
29
29
|
const slicer = new slicer_1.BenchmarkSlicer('r-shell');
|
|
30
30
|
(0, assert_1.guard)(options.input !== undefined, 'input must be given');
|
|
31
31
|
(0, assert_1.guard)(options.criterion !== undefined, 'a slicing criterion must be given');
|
|
32
|
-
const config =
|
|
32
|
+
const config = config_1.FlowrConfig.fromFile();
|
|
33
33
|
await slicer.init(options['input-is-text']
|
|
34
34
|
? { request: 'text', content: options.input.replaceAll('\\n', '\n') }
|
|
35
35
|
: { request: 'file', content: options.input }, config, options['no-magic-comments'] ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect));
|
|
@@ -60,7 +60,7 @@ async function getSlice() {
|
|
|
60
60
|
const { stats, normalize, parse, tokenMap, dataflow } = slicer.finish();
|
|
61
61
|
const mappedCriteria = mappedSlices.map(c => ` ${c.criterion} => ${c.id} (${JSON.stringify(normalize.idMap.get(c.id)?.location)})`).join('\n');
|
|
62
62
|
log_1.log.info(`Mapped criteria:\n${mappedCriteria}`);
|
|
63
|
-
const sliceStatsAsString = (0, print_1.stats2string)(await (0, process_1.summarizeSlicerStats)(stats, undefined,
|
|
63
|
+
const sliceStatsAsString = (0, print_1.stats2string)(await (0, process_1.summarizeSlicerStats)(stats, undefined, config_1.FlowrConfig.getForEngine(config, 'r-shell')));
|
|
64
64
|
if (options.api) {
|
|
65
65
|
const output = {
|
|
66
66
|
tokenMap,
|
package/cli/statistics-app.js
CHANGED
|
@@ -12,5 +12,5 @@ const scriptOptions = (0, script_1.processCommandLineArgs)('stats', [], {
|
|
|
12
12
|
'{bold --help}'
|
|
13
13
|
]
|
|
14
14
|
});
|
|
15
|
-
void (0, statistics_core_1.flowrScriptGetStats)(scriptOptions,
|
|
15
|
+
void (0, statistics_core_1.flowrScriptGetStats)(scriptOptions, config_1.FlowrConfig.fromFile());
|
|
16
16
|
//# sourceMappingURL=statistics-app.js.map
|
|
@@ -10,5 +10,5 @@ const scriptOptions = (0, script_1.processCommandLineArgs)('stats-helper', [], {
|
|
|
10
10
|
'{bold --help}'
|
|
11
11
|
]
|
|
12
12
|
});
|
|
13
|
-
void (0, statistics_helper_core_1.getStatsForSingleFile)(scriptOptions,
|
|
13
|
+
void (0, statistics_helper_core_1.getStatsForSingleFile)(scriptOptions, config_1.FlowrConfig.fromFile());
|
|
14
14
|
//# sourceMappingURL=statistics-helper-app.js.map
|
package/cli/wiki.js
CHANGED
|
@@ -86,7 +86,7 @@ async function makeAllWikis(force, filter) {
|
|
|
86
86
|
},
|
|
87
87
|
writeFileSync: fs_1.default.writeFileSync
|
|
88
88
|
};
|
|
89
|
-
console.log(`Setup for wiki generation took ${(
|
|
89
|
+
console.log(`Setup for wiki generation took ${(Date.now() - setupStart.getTime())}ms`);
|
|
90
90
|
const changedWikis = new Set();
|
|
91
91
|
try {
|
|
92
92
|
const sortedDocs = sortByLeastRecentChanged(exports.AllWikiDocuments);
|
|
@@ -105,7 +105,7 @@ async function makeAllWikis(force, filter) {
|
|
|
105
105
|
changedWikis.add(doc.getTarget());
|
|
106
106
|
}
|
|
107
107
|
const color = changed ? 2 /* Colors.Green */ : 7 /* Colors.White */;
|
|
108
|
-
console.log(ansi_1.ansiFormatter.format(` [${doc.getTarget()}] ${text}: ${doc.getTarget()} (took ${
|
|
108
|
+
console.log(ansi_1.ansiFormatter.format(` [${doc.getTarget()}] ${text}: ${doc.getTarget()} (took ${Date.now() - now.getTime()}ms)`, { color, effect: ansi_1.ColorEffect.Foreground }));
|
|
109
109
|
for (const out of doc.getWrittenSubfiles()) {
|
|
110
110
|
changedWikis.add(out);
|
|
111
111
|
console.log(` - Also updated: ${out}`);
|
package/config.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type MergeableRecord } from './util/objects';
|
|
|
2
2
|
import Joi from 'joi';
|
|
3
3
|
import type { BuiltInDefinitions } from './dataflow/environments/built-in-config';
|
|
4
4
|
import type { KnownParser } from './r-bridge/parser';
|
|
5
|
-
import type { DeepWritable } from 'ts-essentials';
|
|
5
|
+
import type { DeepWritable, Paths, PathValue } from 'ts-essentials';
|
|
6
6
|
import type { DataflowProcessors } from './dataflow/processor';
|
|
7
7
|
import type { ParentInformation } from './r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
8
|
import type { FlowrAnalyzerContext } from './project/context/flowr-analyzer-context';
|
|
@@ -83,7 +83,12 @@ export interface FlowrLaxSourcingOptions extends MergeableRecord {
|
|
|
83
83
|
*/
|
|
84
84
|
readonly applyReplacements?: Record<string, string>[];
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
/**
|
|
87
|
+
* The configuration file format for flowR.
|
|
88
|
+
* @see {@link FlowrConfig.default} for the default configuration.
|
|
89
|
+
* @see {@link FlowrConfig.Schema} for the Joi schema for validation.
|
|
90
|
+
*/
|
|
91
|
+
export interface FlowrConfig extends MergeableRecord {
|
|
87
92
|
/**
|
|
88
93
|
* Whether source calls should be ignored, causing {@link processSourceCall}'s behavior to be skipped
|
|
89
94
|
*/
|
|
@@ -188,6 +193,9 @@ export interface FlowrConfigOptions extends MergeableRecord {
|
|
|
188
193
|
};
|
|
189
194
|
};
|
|
190
195
|
}
|
|
196
|
+
export type ValidFlowrConfigPaths = Paths<FlowrConfig, {
|
|
197
|
+
depth: 9;
|
|
198
|
+
}>;
|
|
191
199
|
export interface TreeSitterEngineConfig extends MergeableRecord {
|
|
192
200
|
readonly type: 'tree-sitter';
|
|
193
201
|
/**
|
|
@@ -214,27 +222,60 @@ export type EngineConfig = TreeSitterEngineConfig | RShellEngineConfig;
|
|
|
214
222
|
export type KnownEngines = {
|
|
215
223
|
[T in EngineConfig['type']]?: KnownParser;
|
|
216
224
|
};
|
|
217
|
-
export declare const defaultConfigOptions: FlowrConfigOptions;
|
|
218
|
-
export declare const flowrConfigFileSchema: Joi.ObjectSchema<any>;
|
|
219
|
-
/**
|
|
220
|
-
* Parses the given JSON string as a flowR config file.
|
|
221
|
-
*/
|
|
222
|
-
export declare function parseConfig(jsonString: string): FlowrConfigOptions | undefined;
|
|
223
|
-
/**
|
|
224
|
-
* Creates a new flowr config that has the updated values.
|
|
225
|
-
*/
|
|
226
|
-
export declare function amendConfig(config: FlowrConfigOptions, amendmentFunc: (config: DeepWritable<FlowrConfigOptions>) => FlowrConfigOptions | void): FlowrConfigOptions;
|
|
227
|
-
/**
|
|
228
|
-
* Clones the given flowr config object.
|
|
229
|
-
*/
|
|
230
|
-
export declare function cloneConfig(config: FlowrConfigOptions): FlowrConfigOptions;
|
|
231
225
|
/**
|
|
232
|
-
*
|
|
226
|
+
* Helper Object to work with {@link FlowrConfig}, provides the default config and the Joi schema for validation.
|
|
233
227
|
*/
|
|
234
|
-
export declare
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
228
|
+
export declare const FlowrConfig: {
|
|
229
|
+
readonly name: "FlowrConfig";
|
|
230
|
+
/**
|
|
231
|
+
* The default configuration for flowR, used when no config file is found or when a config file is missing some options.
|
|
232
|
+
* You can use this as a base for your own config and only specify the options you want to change.
|
|
233
|
+
*/
|
|
234
|
+
readonly default: (this: void) => FlowrConfig;
|
|
235
|
+
/**
|
|
236
|
+
* The Joi schema for validating a config file, use this to validate your config file before using it. You can also use this to generate documentation for the config file format.
|
|
237
|
+
*/
|
|
238
|
+
readonly Schema: Joi.ObjectSchema<any>;
|
|
239
|
+
/**
|
|
240
|
+
* Parses the given JSON string as a flowR config file, returning the resulting config object if the parsing and validation were successful, or `undefined` if there was an error.
|
|
241
|
+
*/
|
|
242
|
+
readonly parse: (this: void, jsonString: string) => FlowrConfig | undefined;
|
|
243
|
+
/**
|
|
244
|
+
* Creates a new flowr config that has the updated values.
|
|
245
|
+
*/
|
|
246
|
+
readonly amend: (this: void, config: FlowrConfig, amendmentFunc: (config: DeepWritable<FlowrConfig>) => FlowrConfig | void) => FlowrConfig;
|
|
247
|
+
/**
|
|
248
|
+
* Clones the given flowr config object.
|
|
249
|
+
*/
|
|
250
|
+
readonly clone: (this: void, config: FlowrConfig) => FlowrConfig;
|
|
251
|
+
/**
|
|
252
|
+
* Loads the flowr config from the given file or the default locations.
|
|
253
|
+
* Please note that you can also use this without a path parameter to
|
|
254
|
+
* infer the config from flowR's default locations.
|
|
255
|
+
* This is mostly useful for user-facing features.
|
|
256
|
+
*/
|
|
257
|
+
readonly fromFile: (this: void, configFile?: string, configWorkingDirectory?: string) => FlowrConfig;
|
|
258
|
+
/**
|
|
259
|
+
* Gets the configuration for the given engine type from the config.
|
|
260
|
+
*/
|
|
261
|
+
readonly getForEngine: <T extends EngineConfig["type"]>(this: void, config: FlowrConfig, engine: T) => (EngineConfig & {
|
|
262
|
+
type: T;
|
|
263
|
+
}) | undefined;
|
|
264
|
+
/**
|
|
265
|
+
* Returns a new config object with the given value set at the given key, where the key is a dot-separated path to the value in the config object.
|
|
266
|
+
* @see {@link setInConfigInPlace} for a version that modifies the config object in place instead of returning a new one.
|
|
267
|
+
* @example
|
|
268
|
+
* ```ts
|
|
269
|
+
* const config = FlowrConfig.default();
|
|
270
|
+
* const newConfig = FlowrConfig.setInConfig(config, 'solver.variables', VariableResolve.Builtin);
|
|
271
|
+
* console.log(config.solver.variables); // Output: "alias"
|
|
272
|
+
* console.log(newConfig.solver.variables); // Output: "builtin"
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
readonly setInConfig: <Path extends ValidFlowrConfigPaths>(this: void, config: FlowrConfig, key: Path, value: PathValue<FlowrConfig, Path>) => FlowrConfig;
|
|
276
|
+
/**
|
|
277
|
+
* Modifies the given config object in place by setting the given value at the given key, where the key is a dot-separated path to the value in the config object.
|
|
278
|
+
* @see {@link setInConfig} for a version that returns a new config object instead of modifying the given one in place.
|
|
279
|
+
*/
|
|
280
|
+
readonly setInConfigInPlace: <Path extends ValidFlowrConfigPaths>(this: void, config: FlowrConfig, key: Path, value: PathValue<FlowrConfig, Path>) => void;
|
|
281
|
+
};
|