@eagleoutice/flowr 2.11.0 → 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 +25 -25
- package/cli/flowr.js +1 -1
- package/cli/repl/commands/repl-commands.js +7 -6
- package/config.d.ts +9 -13
- package/config.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +1 -1
- package/documentation/wiki-interface.js +1 -2
- package/documentation/wiki-package-database.js +1 -1
- package/package.json +2 -1
- package/project/context/flowr-analyzer-dependencies-context.d.ts +1 -1
- package/project/context/flowr-analyzer-dependencies-context.js +4 -1
- package/project/flowr-analyzer-builder.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +4 -2
- package/util/text/ansi.d.ts +10 -1
- package/util/text/ansi.js +17 -4
- package/util/version.js +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ It offers a wide variety of features, for example:
|
|
|
24
24
|
|
|
25
25
|
```shell
|
|
26
26
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
27
|
-
flowR repl v2.
|
|
27
|
+
flowR repl v2.11.0, R grammar v14 (tree-sitter engine, pkg-db: latest/2026-05-23)
|
|
28
28
|
R> :query @linter "read.csv(\"/root/x.txt\")"
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -33,13 +33,13 @@ It offers a wide variety of features, for example:
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
```text
|
|
36
|
-
Query: linter (
|
|
36
|
+
Query: linter (3 ms)
|
|
37
37
|
╰ Deprecated Functions (deprecated-functions):
|
|
38
|
-
╰ Metadata: totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs:
|
|
38
|
+
╰ Metadata: totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0
|
|
39
39
|
╰ File Path Validity (file-path-validity):
|
|
40
40
|
╰ certain:
|
|
41
41
|
╰ Path `/root/x.txt` at 1.1-23
|
|
42
|
-
╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs:
|
|
42
|
+
╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 0
|
|
43
43
|
╰ Seeded Randomness (seeded-randomness):
|
|
44
44
|
╰ Metadata: consumerCalls: 0, callsWithFunctionProducers: 0, callsWithAssignmentProducers: 0, callsWithNonConstantProducers: 0, callsWithOtherBranchProducers: 0, searchTimeMs: 0, processTimeMs: 0
|
|
45
45
|
╰ Absolute Paths (absolute-file-paths):
|
|
@@ -76,7 +76,7 @@ It offers a wide variety of features, for example:
|
|
|
76
76
|
╰ Metadata: totalChecked: 0, searchTimeMs: 0, processTimeMs: 0
|
|
77
77
|
╰ Undefined Symbol (undefined-symbol):
|
|
78
78
|
╰ Metadata: totalCalls: 1, searchTimeMs: 0, processTimeMs: 0
|
|
79
|
-
All queries together required ≈
|
|
79
|
+
All queries together required ≈3 ms (1ms accuracy, total 3 ms)
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
|
|
@@ -98,13 +98,13 @@ It offers a wide variety of features, for example:
|
|
|
98
98
|
|
|
99
99
|
_Results (prettified and summarized):_
|
|
100
100
|
|
|
101
|
-
Query: **linter** (
|
|
101
|
+
Query: **linter** (4 ms)\
|
|
102
102
|
╰ **Deprecated Functions** (deprecated-functions):\
|
|
103
|
-
╰ _Metadata_: <code>totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs:
|
|
103
|
+
╰ _Metadata_: <code>totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
104
104
|
╰ **File Path Validity** (file-path-validity):\
|
|
105
105
|
╰ certain:\
|
|
106
106
|
╰ Path `/root/x.txt` at 1.1-23\
|
|
107
|
-
╰ _Metadata_: <code>totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs:
|
|
107
|
+
╰ _Metadata_: <code>totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 0</code>\
|
|
108
108
|
╰ **Seeded Randomness** (seeded-randomness):\
|
|
109
109
|
╰ _Metadata_: <code>consumerCalls: 0, callsWithFunctionProducers: 0, callsWithAssignmentProducers: 0, callsWithNonConstantProducers: 0, callsWithOtherBranchProducers: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
110
110
|
╰ **Absolute Paths** (absolute-file-paths):\
|
|
@@ -114,11 +114,11 @@ It offers a wide variety of features, for example:
|
|
|
114
114
|
╰ **Unused Definitions** (unused-definitions):\
|
|
115
115
|
╰ _Metadata_: <code>totalConsidered: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
116
116
|
╰ **Naming Convention** (naming-convention):\
|
|
117
|
-
╰ _Metadata_: <code>numMatches: 0, numBreak: 0, searchTimeMs:
|
|
117
|
+
╰ _Metadata_: <code>numMatches: 0, numBreak: 0, searchTimeMs: 1, processTimeMs: 0</code>\
|
|
118
118
|
╰ **Network Functions** (network-functions):\
|
|
119
119
|
╰ _Metadata_: <code>totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
120
120
|
╰ **Dataframe Access Validation** (dataframe-access-validation):\
|
|
121
|
-
╰ _Metadata_: <code>numOperations: 0, numAccesses: 0, totalAccessed: 0, searchTimeMs: 0, processTimeMs:
|
|
121
|
+
╰ _Metadata_: <code>numOperations: 0, numAccesses: 0, totalAccessed: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
122
122
|
╰ **Dead Code** (dead-code):\
|
|
123
123
|
╰ _Metadata_: <code>searchTimeMs: 0, processTimeMs: 0</code>\
|
|
124
124
|
╰ **Useless Loops** (useless-loop):\
|
|
@@ -136,16 +136,16 @@ It offers a wide variety of features, for example:
|
|
|
136
136
|
╰ **Software Has Tests** (software-has-tests):\
|
|
137
137
|
╰ certain:\
|
|
138
138
|
╰ No tests found in the project\
|
|
139
|
-
╰ _Metadata_: <code>testFilesFound: 0, testCallsFound: 0, searchTimeMs:
|
|
139
|
+
╰ _Metadata_: <code>testFilesFound: 0, testCallsFound: 0, searchTimeMs: 1, processTimeMs: 0</code>\
|
|
140
140
|
╰ **No Leaked Credentials** (no-leaked-credentials):\
|
|
141
141
|
╰ _Metadata_: <code>totalChecked: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
142
142
|
╰ **Undefined Symbol** (undefined-symbol):\
|
|
143
143
|
╰ _Metadata_: <code>totalCalls: 1, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
144
|
-
_All queries together required ≈
|
|
144
|
+
_All queries together required ≈4 ms (1ms accuracy, total 4 ms)_
|
|
145
145
|
|
|
146
146
|
<details> <summary style="color:gray">Show Detailed Results as Json</summary>
|
|
147
147
|
|
|
148
|
-
The analysis required
|
|
148
|
+
The analysis required _3.5 ms_ (including parsing and normalization and the query) within the generation environment.
|
|
149
149
|
|
|
150
150
|
In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
|
|
151
151
|
Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
|
|
@@ -162,7 +162,7 @@ It offers a wide variety of features, for example:
|
|
|
162
162
|
".meta": {
|
|
163
163
|
"totalCalls": 0,
|
|
164
164
|
"totalFunctionDefinitions": 0,
|
|
165
|
-
"searchTimeMs":
|
|
165
|
+
"searchTimeMs": 0,
|
|
166
166
|
"processTimeMs": 0
|
|
167
167
|
}
|
|
168
168
|
},
|
|
@@ -185,7 +185,7 @@ It offers a wide variety of features, for example:
|
|
|
185
185
|
"totalUnknown": 0,
|
|
186
186
|
"totalWritesBeforeAlways": 0,
|
|
187
187
|
"totalValid": 0,
|
|
188
|
-
"searchTimeMs":
|
|
188
|
+
"searchTimeMs": 1,
|
|
189
189
|
"processTimeMs": 0
|
|
190
190
|
}
|
|
191
191
|
},
|
|
@@ -234,7 +234,7 @@ It offers a wide variety of features, for example:
|
|
|
234
234
|
".meta": {
|
|
235
235
|
"numMatches": 0,
|
|
236
236
|
"numBreak": 0,
|
|
237
|
-
"searchTimeMs":
|
|
237
|
+
"searchTimeMs": 1,
|
|
238
238
|
"processTimeMs": 0
|
|
239
239
|
}
|
|
240
240
|
},
|
|
@@ -254,7 +254,7 @@ It offers a wide variety of features, for example:
|
|
|
254
254
|
"numAccesses": 0,
|
|
255
255
|
"totalAccessed": 0,
|
|
256
256
|
"searchTimeMs": 0,
|
|
257
|
-
"processTimeMs":
|
|
257
|
+
"processTimeMs": 0
|
|
258
258
|
}
|
|
259
259
|
},
|
|
260
260
|
"dead-code": {
|
|
@@ -328,7 +328,7 @@ It offers a wide variety of features, for example:
|
|
|
328
328
|
".meta": {
|
|
329
329
|
"testFilesFound": 0,
|
|
330
330
|
"testCallsFound": 0,
|
|
331
|
-
"searchTimeMs":
|
|
331
|
+
"searchTimeMs": 1,
|
|
332
332
|
"processTimeMs": 0
|
|
333
333
|
}
|
|
334
334
|
},
|
|
@@ -350,11 +350,11 @@ It offers a wide variety of features, for example:
|
|
|
350
350
|
}
|
|
351
351
|
},
|
|
352
352
|
".meta": {
|
|
353
|
-
"timing":
|
|
353
|
+
"timing": 4
|
|
354
354
|
}
|
|
355
355
|
},
|
|
356
356
|
".meta": {
|
|
357
|
-
"timing":
|
|
357
|
+
"timing": 4
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
```
|
|
@@ -418,7 +418,7 @@ It offers a wide variety of features, for example:
|
|
|
418
418
|
|
|
419
419
|
```shell
|
|
420
420
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
421
|
-
flowR repl v2.
|
|
421
|
+
flowR repl v2.11.0, R grammar v14 (tree-sitter engine, pkg-db: latest/2026-05-23)
|
|
422
422
|
R> :query @static-slice (11@sum) file://test/testfiles/example.R
|
|
423
423
|
```
|
|
424
424
|
|
|
@@ -432,7 +432,7 @@ It offers a wide variety of features, for example:
|
|
|
432
432
|
N <- 10
|
|
433
433
|
for(i in 1:(N-1)) sum <- sum + i + w
|
|
434
434
|
sum
|
|
435
|
-
All queries together required ≈
|
|
435
|
+
All queries together required ≈2 ms (1ms accuracy, total 3 ms)
|
|
436
436
|
```
|
|
437
437
|
|
|
438
438
|
|
|
@@ -464,7 +464,7 @@ It offers a wide variety of features, for example:
|
|
|
464
464
|
</details>
|
|
465
465
|
|
|
466
466
|
* 🚀 **fast call-graph, data-, and control-flow graphs**\
|
|
467
|
-
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">
|
|
467
|
+
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">109.7 ms</span></i> (as of Jul 6, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
|
|
468
468
|
_flowR_ can analyze the data- and control-flow of the average real-world R script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
|
|
469
469
|
and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph#perspectives-cg).
|
|
470
470
|
|
|
@@ -500,7 +500,7 @@ It offers a wide variety of features, for example:
|
|
|
500
500
|
|
|
501
501
|
```shell
|
|
502
502
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
503
|
-
flowR repl v2.
|
|
503
|
+
flowR repl v2.11.0, R grammar v14 (tree-sitter engine, pkg-db: latest/2026-05-23)
|
|
504
504
|
R> :dataflow* test/testfiles/example.R
|
|
505
505
|
```
|
|
506
506
|
|
|
@@ -813,7 +813,7 @@ It offers a wide variety of features, for example:
|
|
|
813
813
|
```
|
|
814
814
|
|
|
815
815
|
|
|
816
|
-
(The analysis required _1.
|
|
816
|
+
(The analysis required _1.9 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment.)
|
|
817
817
|
|
|
818
818
|
|
|
819
819
|
|
package/cli/flowr.js
CHANGED
|
@@ -79,7 +79,7 @@ exports.optionHelp = [
|
|
|
79
79
|
const options = (0, command_line_args_1.default)(flowr_main_options_1.flowrMainOptionDefinitions);
|
|
80
80
|
log_1.log.updateSettings(l => l.settings.minLevel = options.verbose ? 1 /* LogLevel.Trace */ : 5 /* LogLevel.Error */);
|
|
81
81
|
log_1.log.info('running with options', options);
|
|
82
|
-
if (options['no-ansi']) {
|
|
82
|
+
if (options['no-ansi'] || (process.env.NO_COLOR !== undefined && process.env.NO_COLOR !== '')) {
|
|
83
83
|
log_1.log.info('disabling ansi colors');
|
|
84
84
|
(0, ansi_1.setFormatter)(ansi_1.voidFormatter);
|
|
85
85
|
}
|
|
@@ -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
|
}
|
package/config.d.ts
CHANGED
|
@@ -149,19 +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
|
-
/**
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
* first package load. By default (`false`) the database is parsed only when a `library()`/`use()`
|
|
162
|
-
* call first needs it, so scripts without package loads never pay for it.
|
|
163
|
-
*/
|
|
164
|
-
readonly eagerlyLoadPackageDatabase: 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
|
+
};
|
|
165
161
|
/** These keys are only intended for use within code, allowing to instrument the dataflow analyzer! */
|
|
166
162
|
readonly instrument: {
|
|
167
163
|
/**
|
package/config.js
CHANGED
|
@@ -105,8 +105,7 @@ exports.FlowrConfig = {
|
|
|
105
105
|
variables: VariableResolve.Alias,
|
|
106
106
|
evalStrings: true,
|
|
107
107
|
trackEnvironments: true,
|
|
108
|
-
|
|
109
|
-
eagerlyLoadPackageDatabase: false,
|
|
108
|
+
pkgdb: { enabled: true, eagerlyLoad: false, eagerlyLoadExports: false },
|
|
110
109
|
resolveSource: {
|
|
111
110
|
dropPaths: DropPathsOption.No,
|
|
112
111
|
ignoreCapitalization: true,
|
|
@@ -177,8 +176,11 @@ exports.FlowrConfig = {
|
|
|
177
176
|
variables: joi_1.default.string().valid(...Object.values(VariableResolve)).description('How to resolve variables and their values.'),
|
|
178
177
|
evalStrings: joi_1.default.boolean().description('Should we include eval(parse(text="...")) calls in the dataflow graph?'),
|
|
179
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.'),
|
|
180
|
-
|
|
181
|
-
|
|
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.'),
|
|
182
184
|
instrument: joi_1.default.object({
|
|
183
185
|
dataflowExtractors: joi_1.default.any().optional().description('These keys are only intended for use within code, allowing to instrument the dataflow analyzer!')
|
|
184
186
|
}),
|
|
@@ -302,7 +302,7 @@ function linkLibrary(dependency, info, rootId, data, spec = {}) {
|
|
|
302
302
|
}
|
|
303
303
|
// by default only the environment carries the exports; their built-in vertices are materialized on
|
|
304
304
|
// demand when a call resolves to one (see attachExportVertex). Eager mode registers them all upfront.
|
|
305
|
-
if (data.ctx.config.solver.
|
|
305
|
+
if (data.ctx.config.solver.pkgdb.eagerlyLoadExports) {
|
|
306
306
|
for (const { exported: func } of selectExports((0, flowr_namespace_file_1.getCallables)(dependency.namespaceInfo), spec)) {
|
|
307
307
|
const builtInId = node_id_1.NodeId.toBuiltIn(package_1.Package.funcIdentif(pack, func));
|
|
308
308
|
attachExportVertex(info.graph, builtInId, info.environment, data.ctx, data.cds);
|
|
@@ -263,8 +263,7 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
|
|
|
263
263
|
variables: config_1.VariableResolve.Alias,
|
|
264
264
|
evalStrings: true,
|
|
265
265
|
trackEnvironments: true,
|
|
266
|
-
|
|
267
|
-
eagerlyLoadPackageDatabase: false,
|
|
266
|
+
pkgdb: { enabled: true, eagerlyLoad: false, eagerlyLoadExports: false },
|
|
268
267
|
resolveSource: {
|
|
269
268
|
dropPaths: config_1.DropPathsOption.No,
|
|
270
269
|
ignoreCapitalization: true,
|
|
@@ -49,7 +49,7 @@ ${pluginLink('versions:pkgdb')} extra sources (file paths, parsed objects, or \`
|
|
|
49
49
|
${ctx.code(usePackageDatabase, { dropLinesStart: 1 })}
|
|
50
50
|
|
|
51
51
|
File sources load lazily on the first package load, so scripts without \`library()\`/\`use()\` calls never
|
|
52
|
-
pay for parsing them (set \`solver.
|
|
52
|
+
pay for parsing them (set \`solver.pkgdb.eagerlyLoad\` to mount the database up front, or \`solver.pkgdb.enabled: false\` to switch it off entirely).
|
|
53
53
|
For a URL source call ${ctx.linkM(flowr_analyzer_package_versions_pkgdb_plugin_1.FlowrAnalyzerPackageVersionsPkgDbPlugin, 'preload', { hideClass: true, codeFont: true })} (\`await pkgdb.preload()\`) before analysis to download it.
|
|
54
54
|
|
|
55
55
|
## Format
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagleoutice/flowr",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"test-full": "npm run test:coverage -- --no-watch -- --make-summary --test-installation",
|
|
46
46
|
"performance-test": "func() { cd test/performance/ && bash run-all-suites.sh $1 $2 $3 $4; cd ../../; }; func",
|
|
47
47
|
"test:performance": "npm run performance-test --",
|
|
48
|
+
"test:docker": "func() { for df in scripts/Dockerfile scripts/Dockerfile-NoR; do echo \"=== building $df ===\"; docker build -t flowr-docker-test -f \"$df\" . || return 1; echo \"=== smoke-testing $df ===\"; docker run --rm flowr-docker-test --version || return 1; done; }; func",
|
|
48
49
|
"detect-circular-deps": "npx madge --extensions ts,tsx --circular src/",
|
|
49
50
|
"checkup": "npm run flowr -- --execute \":version\" && npm run lint && npm run test-full -- --allowOnly=false && npm run test:system -- --no-watch && docker build -t test-flowr -f scripts/Dockerfile . && npm run doc && npm run wiki"
|
|
50
51
|
},
|
|
@@ -46,7 +46,7 @@ export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnaly
|
|
|
46
46
|
/** Register a resolver consulted by {@link getDependency} to fill in a package's exports lazily. */
|
|
47
47
|
addLazyResolver(resolver: (name: string, existing?: Package) => Package | undefined): void;
|
|
48
48
|
loadedPackageDatabases(): PkgDbLoadedInfo[];
|
|
49
|
-
/** Eagerly mount every version plugin's package database up front (see `solver.
|
|
49
|
+
/** Eagerly mount every version plugin's package database up front (see `solver.pkgdb.eagerlyLoad`). */
|
|
50
50
|
eagerlyLoadPackageDatabases(): void;
|
|
51
51
|
constructor(functionsContext: FlowrAnalyzerFunctionsContext, plugins?: readonly FlowrAnalyzerPackageVersionsPlugin[]);
|
|
52
52
|
resolveStaticDependencies(): void;
|
|
@@ -25,9 +25,12 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
25
25
|
this.lazyResolvers.push(resolver);
|
|
26
26
|
}
|
|
27
27
|
loadedPackageDatabases() {
|
|
28
|
+
if (!this.ctx.config.solver.pkgdb.enabled) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
28
31
|
return this.plugins.flatMap(p => p.loadedDatabases());
|
|
29
32
|
}
|
|
30
|
-
/** Eagerly mount every version plugin's package database up front (see `solver.
|
|
33
|
+
/** Eagerly mount every version plugin's package database up front (see `solver.pkgdb.eagerlyLoad`). */
|
|
31
34
|
eagerlyLoadPackageDatabases() {
|
|
32
35
|
for (const p of this.plugins) {
|
|
33
36
|
p.preloadDatabasesSync();
|
|
@@ -159,7 +159,7 @@ class FlowrAnalyzerBuilder {
|
|
|
159
159
|
buildSync() {
|
|
160
160
|
(0, assert_1.guard)(this.parser !== undefined, 'No parser set, please use the setParser or setEngine method to set a parser before building the analyzer');
|
|
161
161
|
const context = new flowr_analyzer_context_1.FlowrAnalyzerContext(this.flowrConfig, this.plugins);
|
|
162
|
-
if (this.flowrConfig.solver.
|
|
162
|
+
if (this.flowrConfig.solver.pkgdb.enabled && this.flowrConfig.solver.pkgdb.eagerlyLoad) {
|
|
163
163
|
context.deps.eagerlyLoadPackageDatabases();
|
|
164
164
|
}
|
|
165
165
|
const cache = flowr_analyzer_cache_1.FlowrAnalyzerCache.create({
|
package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare class FlowrAnalyzerPackageVersionsPkgDbPlugin extends FlowrAnalyz
|
|
|
36
36
|
private databases;
|
|
37
37
|
constructor(...sources: PkgDbSource[]);
|
|
38
38
|
process(ctx: FlowrAnalyzerContext): void;
|
|
39
|
-
/** Mount the databases up front (see `solver.
|
|
39
|
+
/** Mount the databases up front (see `solver.pkgdb.eagerlyLoad`) instead of on the first library load. */
|
|
40
40
|
preloadDatabasesSync(): void;
|
|
41
41
|
/** metadata of the databases currently loaded (the synchronously available, non-URL sources) */
|
|
42
42
|
loadedDatabases(): PkgDbLoadedInfo[];
|
package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js
CHANGED
|
@@ -65,9 +65,11 @@ class FlowrAnalyzerPackageVersionsPkgDbPlugin extends flowr_analyzer_package_ver
|
|
|
65
65
|
}
|
|
66
66
|
process(ctx) {
|
|
67
67
|
this.databases = undefined; // reload on (re)registration so config/source changes take effect
|
|
68
|
-
ctx.
|
|
68
|
+
if (ctx.config.solver.pkgdb.enabled) {
|
|
69
|
+
ctx.deps.addLazyResolver((name, existing) => this.resolve(name, existing));
|
|
70
|
+
}
|
|
69
71
|
}
|
|
70
|
-
/** Mount the databases up front (see `solver.
|
|
72
|
+
/** Mount the databases up front (see `solver.pkgdb.eagerlyLoad`) instead of on the first library load. */
|
|
71
73
|
preloadDatabasesSync() {
|
|
72
74
|
this.loadDatabases();
|
|
73
75
|
}
|
package/util/text/ansi.d.ts
CHANGED
|
@@ -22,9 +22,11 @@ export type FormatOptions = ColorFormatOptions | WeightFormatOptions | ColorForm
|
|
|
22
22
|
export interface ColorFormatOptions {
|
|
23
23
|
color: Colors;
|
|
24
24
|
effect: ColorEffect;
|
|
25
|
+
/** use the high-intensity variant */
|
|
26
|
+
bright?: boolean;
|
|
25
27
|
}
|
|
26
28
|
export interface WeightFormatOptions {
|
|
27
|
-
style: FontStyles;
|
|
29
|
+
style: FontStyles | readonly FontStyles[];
|
|
28
30
|
}
|
|
29
31
|
export interface OutputFormatter {
|
|
30
32
|
format(input: string, options?: FormatOptions): string;
|
|
@@ -41,6 +43,13 @@ export declare function italic(s: string, f?: OutputFormatter, options?: FormatO
|
|
|
41
43
|
* This does not work if the {@link setFormatter|formatter} is void. Tries to format the text with an italic font shape.
|
|
42
44
|
*/
|
|
43
45
|
export declare function bold(s: string, f?: OutputFormatter, options?: FormatOptions): string;
|
|
46
|
+
/**
|
|
47
|
+
* Color the text in the given foreground color.
|
|
48
|
+
*/
|
|
49
|
+
export declare function color(s: string, c: Colors, f?: OutputFormatter, opts?: {
|
|
50
|
+
bright?: boolean;
|
|
51
|
+
style?: FontStyles | readonly FontStyles[];
|
|
52
|
+
}): string;
|
|
44
53
|
/**
|
|
45
54
|
* This does not work if the {@link setFormatter|formatter} is void. Tries to format the text as informational message.
|
|
46
55
|
*/
|
package/util/text/ansi.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.formatter = exports.ansiFormatter = exports.escape = exports.markdownFormatter = exports.voidFormatter = exports.ColorEffect = void 0;
|
|
4
4
|
exports.italic = italic;
|
|
5
5
|
exports.bold = bold;
|
|
6
|
+
exports.color = color;
|
|
6
7
|
exports.ansiInfo = ansiInfo;
|
|
7
8
|
exports.setFormatter = setFormatter;
|
|
8
9
|
// noinspection JSUnusedGlobalSymbols
|
|
@@ -32,7 +33,7 @@ exports.markdownFormatter = new class {
|
|
|
32
33
|
input = `_${input}_`;
|
|
33
34
|
}
|
|
34
35
|
else {
|
|
35
|
-
throw new Error(`Unsupported font style: ${options.style}`);
|
|
36
|
+
throw new Error(`Unsupported font style: ${String(options.style)}`);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
let source = input.replaceAll(/\\"/g, '\'').replaceAll(/\\/g, '\\\\').replaceAll(/\n/g, '\\\n');
|
|
@@ -64,6 +65,12 @@ function italic(s, f = exports.formatter, options) {
|
|
|
64
65
|
function bold(s, f = exports.formatter, options) {
|
|
65
66
|
return f.format(s, { style: 1 /* FontStyles.Bold */, ...options });
|
|
66
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Color the text in the given foreground color.
|
|
70
|
+
*/
|
|
71
|
+
function color(s, c, f = exports.formatter, opts) {
|
|
72
|
+
return f.format(s, { color: c, effect: ColorEffect.Foreground, ...opts });
|
|
73
|
+
}
|
|
67
74
|
/**
|
|
68
75
|
* This does not work if the {@link setFormatter|formatter} is void. Tries to format the text as informational message.
|
|
69
76
|
*/
|
|
@@ -83,9 +90,15 @@ exports.ansiFormatter = {
|
|
|
83
90
|
if (options === undefined) {
|
|
84
91
|
return '';
|
|
85
92
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
const params = [];
|
|
94
|
+
if ('style' in options) {
|
|
95
|
+
const styles = Array.isArray(options.style) ? options.style : [options.style];
|
|
96
|
+
params.push(...styles);
|
|
97
|
+
}
|
|
98
|
+
if ('color' in options) {
|
|
99
|
+
params.push((options.bright ? options.effect + 60 : options.effect) + options.color);
|
|
100
|
+
}
|
|
101
|
+
return params.length === 0 ? '' : `${exports.escape}${params.join(';')}${colorSuffix}`;
|
|
89
102
|
}
|
|
90
103
|
};
|
|
91
104
|
exports.formatter = exports.ansiFormatter;
|
package/util/version.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
|
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
7
|
const assert_1 = require("./assert");
|
|
8
8
|
// this is automatically replaced with the current version by release-it
|
|
9
|
-
const version = '2.11.
|
|
9
|
+
const version = '2.11.1';
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
12
12
|
*/
|