@eagleoutice/flowr 2.15.10 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -26
- package/abstract-interpretation/data-frame/arguments.js +11 -7
- package/control-flow/happens-before.d.ts +5 -0
- package/control-flow/happens-before.js +48 -34
- package/control-flow/useless-loop.d.ts +1 -1
- package/control-flow/useless-loop.js +29 -42
- package/dataflow/environments/built-in-props.d.ts +9 -0
- package/dataflow/environments/built-in-props.js +25 -19
- package/dataflow/environments/built-in.d.ts +2 -2
- package/dataflow/environments/built-in.js +41 -77
- package/dataflow/environments/default-builtin-config.d.ts +181 -29
- package/dataflow/environments/default-builtin-config.js +38 -24
- package/dataflow/environments/environment.d.ts +6 -4
- package/dataflow/environments/environment.js +54 -121
- package/dataflow/environments/identifier.d.ts +4 -2
- package/dataflow/environments/identifier.js +23 -69
- package/dataflow/environments/reference-to-maybe.d.ts +9 -0
- package/dataflow/environments/reference-to-maybe.js +23 -51
- package/dataflow/environments/resolve-by-name.js +37 -76
- package/dataflow/eval/resolve/resolve-argument.d.ts +3 -1
- package/dataflow/eval/resolve/resolve-argument.js +61 -64
- package/dataflow/eval/resolve/resolve-working-directory.d.ts +8 -2
- package/dataflow/eval/resolve/resolve-working-directory.js +12 -20
- package/dataflow/eval/resolve/resolve.d.ts +4 -0
- package/dataflow/eval/resolve/resolve.js +23 -14
- package/dataflow/extractor.js +176 -59
- package/dataflow/fn/class-declaration.d.ts +8 -2
- package/dataflow/fn/class-declaration.js +96 -97
- package/dataflow/fn/exceptions-of-function.js +68 -37
- package/dataflow/fn/frame-reflection.d.ts +12 -4
- package/dataflow/fn/frame-reflection.js +51 -41
- package/dataflow/fn/function-props.js +15 -33
- package/dataflow/fn/function-semantics.d.ts +11 -3
- package/dataflow/fn/function-semantics.js +6 -0
- package/dataflow/fn/higher-order-function.js +13 -17
- package/dataflow/fn/strict-function.d.ts +13 -0
- package/dataflow/fn/strict-function.js +285 -122
- package/dataflow/graph/call-graph.d.ts +7 -6
- package/dataflow/graph/call-graph.js +35 -46
- package/dataflow/graph/graph.d.ts +6 -1
- package/dataflow/graph/graph.js +57 -66
- package/dataflow/info.d.ts +8 -1
- package/dataflow/info.js +24 -30
- package/dataflow/internal/control-flow.d.ts +31 -4
- package/dataflow/internal/control-flow.js +61 -39
- package/dataflow/internal/linker.d.ts +15 -9
- package/dataflow/internal/linker.js +253 -241
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +80 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +446 -78
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +51 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +119 -185
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +7 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +122 -147
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +55 -25
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +289 -251
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +30 -32
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +68 -67
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +72 -126
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +10 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -35
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +8 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +12 -28
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +40 -118
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +16 -24
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +93 -102
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +173 -114
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +22 -27
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +119 -93
- package/dataflow/internal/process/functions/call/common.d.ts +1 -3
- package/dataflow/internal/process/functions/call/common.js +36 -76
- package/dataflow/internal/process/functions/call/deferred.d.ts +6 -2
- package/dataflow/internal/process/functions/call/deferred.js +54 -57
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +65 -68
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +3 -5
- package/dataflow/internal/process/functions/call/named-call-handling.js +35 -21
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
- package/dataflow/internal/process/functions/call/quoted.js +162 -172
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +17 -38
- package/dataflow/internal/process/functions/process-parameter.js +25 -32
- package/dataflow/internal/process/process-symbol.js +3 -6
- package/dataflow/internal/program-order.d.ts +26 -0
- package/dataflow/internal/program-order.js +49 -0
- package/documentation/wiki-setup.js +23 -0
- package/linter/linter-rules.d.ts +17 -8
- package/linter/rules/absolute-path.js +63 -87
- package/linter/rules/file-path-validity.d.ts +4 -2
- package/linter/rules/file-path-validity.js +114 -80
- package/linter/rules/namespace-access.js +21 -33
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +60 -48
- package/linter/rules/network-functions.js +11 -7
- package/linter/rules/no-leaked-credentials.js +15 -18
- package/linter/rules/problematic-inputs.d.ts +2 -1
- package/linter/rules/problematic-inputs.js +39 -59
- package/linter/rules/roxygen-arguments.d.ts +9 -4
- package/linter/rules/roxygen-arguments.js +29 -48
- package/linter/rules/seeded-randomness.d.ts +7 -4
- package/linter/rules/seeded-randomness.js +128 -89
- package/linter/rules/stop-with-call-arg.d.ts +4 -2
- package/linter/rules/stop-with-call-arg.js +25 -22
- package/linter/rules/unclosed-connection.js +31 -24
- package/linter/rules/undefined-symbol.d.ts +4 -6
- package/linter/rules/undefined-symbol.js +58 -75
- package/linter/rules/unescaped-arguments.js +18 -44
- package/linter/rules/unused-definition.d.ts +6 -0
- package/linter/rules/unused-definition.js +105 -145
- package/linter/rules/unused-import.d.ts +3 -0
- package/linter/rules/unused-import.js +25 -43
- package/package.json +5 -2
- package/project/flowr-analyzer.js +6 -2
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -2
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +8 -12
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +7 -5
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +34 -56
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +16 -41
- package/queries/base-query-format.js +1 -2
- package/queries/catalog/absint-query/absint-query-format.js +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +4 -7
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -114
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +5 -9
- package/queries/catalog/dependencies-query/function-info/library-functions.js +6 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/write-functions.js +7 -3
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +4 -4
- package/queries/catalog/input-sources-query/simple-input-classifier.js +192 -301
- package/r-bridge/lang-4.x/ast/model/model.d.ts +3 -1
- package/r-bridge/lang-4.x/ast/model/model.js +19 -43
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -12
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- package/r-bridge/roxygen2/roxygen-parse.js +28 -42
- package/r-bridge/shell.js +6 -0
- package/search/search-executor/search-enrichers.js +25 -37
- package/slicing/static/slice-call.d.ts +4 -3
- package/slicing/static/slice-call.js +56 -88
- package/slicing/static/static-slicer.js +115 -79
- package/slicing/static/visiting-queue.d.ts +4 -6
- package/slicing/static/visiting-queue.js +9 -13
- package/util/proc.js +2 -1
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +23 -13
- package/util/text/playground-link.d.ts +12 -3
- package/util/text/playground-link.js +18 -27
- package/util/version.js +4 -10
|
@@ -7,17 +7,17 @@ import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-conte
|
|
|
7
7
|
* Finally, it provides access to the single cells, and all cells fused together as one R file.
|
|
8
8
|
*/
|
|
9
9
|
export declare class FlowrRMarkdownFile extends FlowrFile {
|
|
10
|
-
private data?;
|
|
11
|
-
private mergedCode?;
|
|
12
10
|
private readonly wrapped;
|
|
13
11
|
private readonly context;
|
|
12
|
+
private data?;
|
|
13
|
+
private mergedCode?;
|
|
14
14
|
private readonly included;
|
|
15
15
|
/**
|
|
16
16
|
* Prefer the static {@link FlowrRMarkdownFile.from} method
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
17
|
+
* @param wrapped - the file to load as R Markdown
|
|
18
|
+
* @param context - the analyzer context the chunks are read with
|
|
19
19
|
*/
|
|
20
|
-
constructor(
|
|
20
|
+
constructor(wrapped: FlowrFileProvider<string>, context: FlowrAnalyzerContext);
|
|
21
21
|
/**
|
|
22
22
|
* Gets the parsed R Markdown information
|
|
23
23
|
*/
|
|
@@ -74,6 +74,8 @@ export declare function globalChunkOptions(frontmatter: object): CodeBlockOption
|
|
|
74
74
|
* @returns Rmd Info
|
|
75
75
|
*/
|
|
76
76
|
export declare function parseRMarkdownFile(raw: string): RmdInfo;
|
|
77
|
+
/** The info string of an R chunk, `{r}` or `{r label, eval = FALSE}`; the `[\s,]` keeps `{rust}` out */
|
|
78
|
+
export declare const RTagRegex: RegExp;
|
|
77
79
|
/**
|
|
78
80
|
* Checks whether a CommonMark node is an R code block
|
|
79
81
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowrRMarkdownFile = void 0;
|
|
3
|
+
exports.RTagRegex = exports.FlowrRMarkdownFile = void 0;
|
|
4
4
|
exports.isExecutableCell = isExecutableCell;
|
|
5
5
|
exports.continuesAfterError = continuesAfterError;
|
|
6
6
|
exports.globalChunkOptions = globalChunkOptions;
|
|
@@ -19,20 +19,20 @@ const built_in_source_1 = require("../../../../dataflow/internal/process/functio
|
|
|
19
19
|
* Finally, it provides access to the single cells, and all cells fused together as one R file.
|
|
20
20
|
*/
|
|
21
21
|
class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
|
|
22
|
-
data;
|
|
23
|
-
mergedCode;
|
|
24
22
|
wrapped;
|
|
25
23
|
context;
|
|
24
|
+
data;
|
|
25
|
+
mergedCode;
|
|
26
26
|
included = [];
|
|
27
27
|
/**
|
|
28
28
|
* Prefer the static {@link FlowrRMarkdownFile.from} method
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
29
|
+
* @param wrapped - the file to load as R Markdown
|
|
30
|
+
* @param context - the analyzer context the chunks are read with
|
|
31
31
|
*/
|
|
32
|
-
constructor(
|
|
33
|
-
super(
|
|
34
|
-
this.wrapped =
|
|
35
|
-
this.context =
|
|
32
|
+
constructor(wrapped, context) {
|
|
33
|
+
super(wrapped.path(), wrapped.roles ? [...wrapped.roles, flowr_file_1.FileRole.Source] : [flowr_file_1.FileRole.Source]);
|
|
34
|
+
this.wrapped = wrapped;
|
|
35
|
+
this.context = context;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Gets the parsed R Markdown information
|
|
@@ -68,10 +68,7 @@ class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
|
|
|
68
68
|
(0, assert_1.guard)(this.data !== undefined);
|
|
69
69
|
for (const block of this.data.blocks) {
|
|
70
70
|
const childOpt = block.options.get('child');
|
|
71
|
-
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
const childPath = (0, built_in_source_1.findSource)(this.context.config.solver.resolveSource, childOpt, {
|
|
71
|
+
const childPath = childOpt === undefined ? undefined : (0, built_in_source_1.findSource)(this.context.config.solver.resolveSource, childOpt, {
|
|
75
72
|
ctx: this.context,
|
|
76
73
|
referenceChain: [this.path()]
|
|
77
74
|
});
|
|
@@ -138,8 +135,12 @@ function wrapErrorTolerant(code) {
|
|
|
138
135
|
*/
|
|
139
136
|
function globalChunkOptions(frontmatter) {
|
|
140
137
|
const knitr = frontmatter.knitr;
|
|
138
|
+
return scalarOptions([frontmatter.execute, knitr?.opts_chunk]);
|
|
139
|
+
}
|
|
140
|
+
/** The scalar entries of the given yaml objects as options, later ones overriding earlier ones. */
|
|
141
|
+
function scalarOptions(sources) {
|
|
141
142
|
const options = new Map();
|
|
142
|
-
for (const source of
|
|
143
|
+
for (const source of sources) {
|
|
143
144
|
if (typeof source !== 'object' || source === null) {
|
|
144
145
|
continue;
|
|
145
146
|
}
|
|
@@ -183,20 +184,14 @@ function parseFrontmatter(raw) {
|
|
|
183
184
|
* @returns Rmd Info
|
|
184
185
|
*/
|
|
185
186
|
function parseRMarkdownFile(raw) {
|
|
186
|
-
// Read and Parse Markdown
|
|
187
|
-
const parser = new commonmark_1.Parser();
|
|
188
|
-
const ast = parser.parse(raw);
|
|
189
|
-
// Parse Frontmatter
|
|
190
187
|
let frontmatter;
|
|
191
188
|
try {
|
|
192
189
|
frontmatter = parseFrontmatter(raw);
|
|
193
190
|
}
|
|
194
191
|
catch (e) {
|
|
195
192
|
log_1.log.warn(`Failed to parse frontmatter of Rmd file, ignoring it. Error was: ${JSON.stringify(e)}`);
|
|
196
|
-
frontmatter = undefined;
|
|
197
193
|
}
|
|
198
|
-
|
|
199
|
-
const walker = ast.walker();
|
|
194
|
+
const walker = new commonmark_1.Parser().parse(raw).walker();
|
|
200
195
|
const blocks = [];
|
|
201
196
|
let e;
|
|
202
197
|
while ((e = walker.next())) {
|
|
@@ -206,48 +201,42 @@ function parseRMarkdownFile(raw) {
|
|
|
206
201
|
}
|
|
207
202
|
const options = parseCodeBlockOptions(node.info, node.literal);
|
|
208
203
|
const engineOpt = options.get('engine');
|
|
209
|
-
if (engineOpt
|
|
210
|
-
|
|
204
|
+
if (engineOpt === undefined || engineOpt.trim().toLowerCase() === 'r') {
|
|
205
|
+
blocks.push({
|
|
206
|
+
code: node.literal,
|
|
207
|
+
options,
|
|
208
|
+
header: node.info,
|
|
209
|
+
startpos: { line: node.sourcepos[0][0] + 1, col: 0 }
|
|
210
|
+
});
|
|
211
211
|
}
|
|
212
|
-
blocks.push({
|
|
213
|
-
code: node.literal,
|
|
214
|
-
options: options,
|
|
215
|
-
header: node.info,
|
|
216
|
-
startpos: { line: node.sourcepos[0][0] + 1, col: 0 }
|
|
217
|
-
});
|
|
218
212
|
}
|
|
219
213
|
blocks.push(...parseIncludeShortcodes(raw));
|
|
220
214
|
blocks.sort((a, b) => a.startpos.line - b.startpos.line);
|
|
221
215
|
return {
|
|
222
|
-
blocks
|
|
216
|
+
blocks,
|
|
223
217
|
options: typeof frontmatter === 'object' && frontmatter !== null ? frontmatter : {}
|
|
224
218
|
};
|
|
225
219
|
}
|
|
226
220
|
const IncludeShortcodeRegex = /{{<\s*include\s+["']?(.+?)["']?\s*>}}/;
|
|
227
221
|
/** Collects quarto's `{{< include other.qmd >}}` as blocks carrying a `child`, resolved like knitr's option */
|
|
228
222
|
function parseIncludeShortcodes(raw) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
const match = IncludeShortcodeRegex.exec(lines[i]);
|
|
233
|
-
if (match) {
|
|
234
|
-
blocks.push({
|
|
223
|
+
return raw.split(LineRegex).flatMap((line, i) => {
|
|
224
|
+
const match = IncludeShortcodeRegex.exec(line);
|
|
225
|
+
return match ? [{
|
|
235
226
|
code: '',
|
|
236
227
|
options: new Map([['child', match[1]]]),
|
|
237
228
|
header: '',
|
|
238
229
|
startpos: { line: i + 1, col: 0 }
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
return blocks;
|
|
230
|
+
}] : [];
|
|
231
|
+
});
|
|
243
232
|
}
|
|
244
|
-
|
|
245
|
-
|
|
233
|
+
/** The info string of an R chunk, `{r}` or `{r label, eval = FALSE}`; the `[\s,]` keeps `{rust}` out */
|
|
234
|
+
exports.RTagRegex = /{[rR](?:[\s,][^}]*)?}/;
|
|
246
235
|
/**
|
|
247
236
|
* Checks whether a CommonMark node is an R code block
|
|
248
237
|
*/
|
|
249
238
|
function isRCodeBlock(node) {
|
|
250
|
-
return node.type === 'code_block' && node.literal !== null && node.info !== null && RTagRegex.test(node.info);
|
|
239
|
+
return node.type === 'code_block' && node.literal !== null && node.info !== null && exports.RTagRegex.test(node.info);
|
|
251
240
|
}
|
|
252
241
|
const LineRegex = /\r\n|\r|\n/;
|
|
253
242
|
function countNewlines(str) {
|
|
@@ -269,7 +258,6 @@ function restoreBlocksWithoutMd(blocks, totalLines) {
|
|
|
269
258
|
output += block.code;
|
|
270
259
|
line += countNewlines(block.code);
|
|
271
260
|
}
|
|
272
|
-
// Add remainder of file
|
|
273
261
|
goToLine(totalLines + 1);
|
|
274
262
|
return output;
|
|
275
263
|
}
|
|
@@ -289,11 +277,7 @@ function parseCodeBlockOptions(header, content) {
|
|
|
289
277
|
// keep the indentation, yaml block scalars rely on it
|
|
290
278
|
cellLines.push(line.trim().slice(2).replace(/^ /, ''));
|
|
291
279
|
}
|
|
292
|
-
|
|
293
|
-
for (const [key, value] of parseCellOptions(cellLines)) {
|
|
294
|
-
options.set(key, value);
|
|
295
|
-
}
|
|
296
|
-
return options;
|
|
280
|
+
return new Map([...parseOptionString(headerOpts), ...parseCellOptions(cellLines)]);
|
|
297
281
|
}
|
|
298
282
|
/** Parses knitr's `key=value` option syntax as used in the chunk header */
|
|
299
283
|
function parseOptionString(opts) {
|
|
@@ -314,13 +298,7 @@ function parseCellOptions(lines) {
|
|
|
314
298
|
const parsed = parseFrontmatter(`---\n${lines.join('\n')}\n---\n`);
|
|
315
299
|
// a bare scalar is knitr's `key=value` syntax, not yaml
|
|
316
300
|
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed) && Object.keys(parsed).length > 0) {
|
|
317
|
-
|
|
318
|
-
for (const [key, value] of Object.entries(parsed)) {
|
|
319
|
-
if (value !== null && typeof value !== 'object') {
|
|
320
|
-
options.set(key, String(value));
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return options;
|
|
301
|
+
return scalarOptions([parsed]);
|
|
324
302
|
}
|
|
325
303
|
}
|
|
326
304
|
catch (e) {
|
package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js
CHANGED
|
@@ -57,22 +57,15 @@ const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
|
57
57
|
const arrays_1 = require("../../../util/collections/arrays");
|
|
58
58
|
/** the plugin's instance name (pass to `unregisterPlugins` to disable the default sigdb resolver) */
|
|
59
59
|
exports.SigDbPluginName = 'flowr-analyzer-package-versions-sigdb-plugin';
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
switch (ext) {
|
|
63
|
-
case '.zst': return 'zstd';
|
|
64
|
-
case '.br': return 'brotli';
|
|
65
|
-
case '.gz': return 'gzip';
|
|
66
|
-
default: return 'plain';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
60
|
+
/** a resolved source's compressed extension as a codec name for display, a file without one is `plain` */
|
|
61
|
+
const CodecNames = { '.zst': 'zstd', '.br': 'brotli', '.gz': 'gzip' };
|
|
69
62
|
/** the codec name of a manifest's resolved shard + dict sources, or `mixed` when they do not all agree */
|
|
70
63
|
function manifestFormat(set) {
|
|
71
64
|
const paths = [
|
|
72
65
|
...set.manifest.shards.map(s => s.path),
|
|
73
66
|
...(set.manifest.dicts?.map(d => d.path) ?? [])
|
|
74
67
|
];
|
|
75
|
-
const codecs = (0, arrays_1.uniqueArray)(paths.map(p =>
|
|
68
|
+
const codecs = (0, arrays_1.uniqueArray)(paths.map(p => CodecNames[(0, codec_1.compressedExtOf)((0, decompress_1.resolveSource)(set.baseDir, p)) ?? ''] ?? 'plain'));
|
|
76
69
|
return codecs.length === 1 ? codecs[0] : 'mixed';
|
|
77
70
|
}
|
|
78
71
|
/** describe one loaded source for `:version` / diagnostics: a single bundle, a sharded set, or an in-memory source */
|
|
@@ -285,16 +278,7 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
285
278
|
/* the historical bundle is not asked: a name is hinted so a `library()` can be added for it, and a package
|
|
286
279
|
only that bundle carries is one nothing can attach today */
|
|
287
280
|
const sources = this.loadSources().filter(s => describeLoadedDatabase(s).scope !== 'history');
|
|
288
|
-
const
|
|
289
|
-
const owners = [];
|
|
290
|
-
for (const src of sources) {
|
|
291
|
-
for (const pkg of exportOwners(src, name)) {
|
|
292
|
-
if (!seen.has(pkg) && !this.isSelfPackage(pkg)) {
|
|
293
|
-
seen.add(pkg);
|
|
294
|
-
owners.push(pkg);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
281
|
+
const owners = (0, arrays_1.uniqueArray)(sources.flatMap(src => exportOwners(src, name))).filter(pkg => !this.isSelfPackage(pkg));
|
|
298
282
|
// each source's list is already sorted; a merge of several needs one more pass to be globally ordered
|
|
299
283
|
if (owners.length > 1 && sources.length > 1) {
|
|
300
284
|
/* the comparator runs O(n log n) times, so each package is counted once up front */
|
|
@@ -395,12 +379,8 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
395
379
|
return undefined;
|
|
396
380
|
}
|
|
397
381
|
const target = this.analyzerCtx?.resolvedRVersion ?? (0, config_1.resolveAssumedRVersion)(undefined);
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (r_version_1.RVersion.compare(v.str, target) <= 0) {
|
|
401
|
-
chosen = v;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
382
|
+
// versions are ascending; keep the newest core release <= target
|
|
383
|
+
let chosen = versions.findLast(v => r_version_1.RVersion.compare(v.str, target) <= 0);
|
|
404
384
|
if (chosen === undefined) {
|
|
405
385
|
// the assumed R version is older than the earliest recorded core release: fall back to the closest one
|
|
406
386
|
chosen = versions[0];
|
|
@@ -481,24 +461,17 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
481
461
|
if (info && (range === undefined || r_version_1.RRange.satisfies(info.version, range))) {
|
|
482
462
|
return info;
|
|
483
463
|
}
|
|
484
|
-
if (range
|
|
485
|
-
|
|
486
|
-
for (let i = versions.length - 1; i >= 0; i--) {
|
|
487
|
-
if (r_version_1.RRange.satisfies(versions[i], range)) {
|
|
488
|
-
return src.lookup(name, versions[i]);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
464
|
+
if (range === undefined) {
|
|
465
|
+
return undefined;
|
|
491
466
|
}
|
|
492
|
-
|
|
467
|
+
const satisfying = this.availableVersions(src, name).findLast(version => r_version_1.RRange.satisfies(version, range));
|
|
468
|
+
return satisfying === undefined ? undefined : src.lookup(name, satisfying);
|
|
493
469
|
}
|
|
494
470
|
/** Lowest stored version satisfying the constraint (using the store's actual R-form version strings). */
|
|
495
471
|
oldestSatisfying(src, name, range) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return undefined;
|
|
472
|
+
// versions are ascending, so the first satisfying one is the oldest
|
|
473
|
+
const satisfying = this.availableVersions(src, name).find(version => range === undefined || r_version_1.RRange.satisfies(version, range));
|
|
474
|
+
return satisfying === undefined ? undefined : src.lookup(name, satisfying);
|
|
502
475
|
}
|
|
503
476
|
/**
|
|
504
477
|
* The versions the source can answer for a package (dated releases, base-R core releases, and the latest),
|
|
@@ -509,7 +482,9 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
509
482
|
}
|
|
510
483
|
/** build the resolved {@link Package} (namespace + version) from a source's export view */
|
|
511
484
|
toResolvedPackage(name, info) {
|
|
512
|
-
|
|
485
|
+
/* what the configuration states for the package is part of its interface, even where the database misses it */
|
|
486
|
+
const stated = this.analyzerCtx?.env.statedFor(name);
|
|
487
|
+
const exported = stated === undefined ? info.exported.slice() : (0, arrays_1.uniqueArray)([...info.exported, ...[...stated.keys()].map(String)]);
|
|
513
488
|
const namespaceInfo = {
|
|
514
489
|
exportedSymbols: exported,
|
|
515
490
|
exportedFunctions: [],
|
|
@@ -18,13 +18,12 @@ function filterLineParser(type) {
|
|
|
18
18
|
function singleCriterionLineParser(type, label, extra) {
|
|
19
19
|
return function (output, line, _config) {
|
|
20
20
|
const criterion = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
|
|
21
|
-
const fields = extra?.(line);
|
|
22
21
|
if (!criterion || criterion.length !== 1) {
|
|
23
22
|
output.stderr(output.formatter.format(`Invalid ${label} query format, a single slicing criterion must be given in the form "(criterion1)"`, { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
24
23
|
return { query: [] };
|
|
25
24
|
}
|
|
26
25
|
return {
|
|
27
|
-
query: [{ type, criterion: criterion[0], ...
|
|
26
|
+
query: [{ type, criterion: criterion[0], ...extra?.(line) }],
|
|
28
27
|
rCode: (0, slice_query_parser_1.queryLineCode)(line)
|
|
29
28
|
};
|
|
30
29
|
};
|
|
@@ -45,7 +45,7 @@ function absintQueryCompleter(line, startingNewArg, _config) {
|
|
|
45
45
|
return { completions: [] };
|
|
46
46
|
}
|
|
47
47
|
function absintQueryLineParser(output, line, _config) {
|
|
48
|
-
const type = line[0].toLowerCase();
|
|
48
|
+
const type = (line[0] ?? '').toLowerCase();
|
|
49
49
|
if (!record_1.Record.has(exports.AbsintQueryInferences, type)) {
|
|
50
50
|
output.stderr(output.formatter.format(`Invalid inference type "${type}", must be one of ${record_1.Record.keys(exports.AbsintQueryInferences).map(type => `"${type}"`).join(', ')}`, { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
51
51
|
return { query: [] };
|
|
@@ -10,12 +10,12 @@ async function executeDataflowQuery({ analyzer }, queries) {
|
|
|
10
10
|
log_1.log.warn('Dataflow query expects only up to one query, but got', queries.length);
|
|
11
11
|
}
|
|
12
12
|
const startTime = Date.now();
|
|
13
|
-
const graph =
|
|
13
|
+
const { graph } = await analyzer.dataflow();
|
|
14
14
|
return {
|
|
15
15
|
'.meta': {
|
|
16
16
|
timing: Date.now() - startTime
|
|
17
17
|
},
|
|
18
|
-
graph
|
|
18
|
+
graph: queries.every(q => q.environments === false) ? graph.withoutEnvironments() : graph
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=dataflow-query-executor.js.map
|
|
@@ -8,6 +8,8 @@ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/nod
|
|
|
8
8
|
*/
|
|
9
9
|
export interface DataflowQuery extends BaseQueryFormat {
|
|
10
10
|
readonly type: 'dataflow';
|
|
11
|
+
/** Whether to include the environments of the vertices and function definitions (default), see {@link DataflowGraph#withoutEnvironments}. */
|
|
12
|
+
readonly environments?: boolean;
|
|
11
13
|
}
|
|
12
14
|
export interface DataflowQueryResult extends BaseQueryResult {
|
|
13
15
|
/** Please be aware that this is the graph in its JSON representation, use {@link DataflowGraph#fromJson} if the result is serialized */
|
|
@@ -22,7 +22,7 @@ exports.DataflowQueryDefinition = {
|
|
|
22
22
|
result.push(` ╰ [Dataflow Graph](${url})`);
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
|
-
const vertices =
|
|
25
|
+
const vertices = out.graph.vertices(true).toArray().length;
|
|
26
26
|
const edges = Array.from(out.graph.edges()).length;
|
|
27
27
|
result.push(` ╰ Dataflow Graph too large to link (${vertices} vertices, ${edges} edges, url would be ${url.length} chars); use ':df#' for more detail.`);
|
|
28
28
|
}
|
|
@@ -30,14 +30,11 @@ exports.DataflowQueryDefinition = {
|
|
|
30
30
|
},
|
|
31
31
|
schema: joi_1.default.object({
|
|
32
32
|
type: joi_1.default.string().valid('dataflow').required().description('The type of the query.'),
|
|
33
|
+
environments: joi_1.default.boolean().optional().description('Whether to include the environments of the vertices and function definitions (default: true). They make up most of the answer, so leave them out if only the graph itself is of interest.'),
|
|
33
34
|
}).description('The dataflow query simply returns the dataflow graph, there is no need to pass it multiple times!'),
|
|
34
|
-
flattenInvolvedNodes: queryResults => {
|
|
35
|
-
const flattened = [];
|
|
35
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
36
36
|
const out = queryResults;
|
|
37
|
-
|
|
38
|
-
flattened.push(id);
|
|
39
|
-
}
|
|
40
|
-
return flattened;
|
|
37
|
+
return [...out.graph.idMap?.keys() ?? []];
|
|
41
38
|
}
|
|
42
39
|
};
|
|
43
40
|
//# sourceMappingURL=dataflow-query-format.js.map
|