@eagleoutice/flowr 2.15.9 → 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 +47 -41
- package/abstract-interpretation/absint-inference.d.ts +2 -2
- package/abstract-interpretation/absint-inference.js +32 -79
- package/abstract-interpretation/data-frame/arguments.js +11 -7
- package/benchmark/slicer.d.ts +0 -1
- package/benchmark/slicer.js +1 -2
- package/cli/repl/commands/repl-signature.js +12 -3
- package/config.d.ts +5 -1
- package/control-flow/cfg-properties.js +0 -22
- package/control-flow/happens-before.d.ts +7 -2
- package/control-flow/happens-before.js +55 -31
- package/control-flow/useless-loop.d.ts +1 -1
- package/control-flow/useless-loop.js +29 -42
- package/dataflow/environments/apply-kill.js +6 -2
- package/dataflow/environments/built-in-config.d.ts +2 -0
- package/dataflow/environments/built-in-props.d.ts +16 -1
- package/dataflow/environments/built-in-props.js +33 -20
- package/dataflow/environments/built-in.d.ts +8 -3
- package/dataflow/environments/built-in.js +52 -82
- package/dataflow/environments/default-builtin-config.d.ts +551 -21
- package/dataflow/environments/default-builtin-config.js +121 -45
- package/dataflow/environments/define.d.ts +3 -2
- package/dataflow/environments/define.js +4 -3
- package/dataflow/environments/deprecation-info.d.ts +45 -0
- package/dataflow/environments/deprecation-info.js +13 -0
- package/dataflow/environments/environment.d.ts +7 -5
- package/dataflow/environments/environment.js +55 -121
- package/dataflow/environments/identifier.d.ts +6 -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 +180 -58
- package/dataflow/fn/class-declaration.d.ts +8 -13
- package/dataflow/fn/class-declaration.js +95 -116
- 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.d.ts +9 -1
- package/dataflow/fn/higher-order-function.js +27 -24
- package/dataflow/fn/strict-function.d.ts +13 -0
- package/dataflow/fn/strict-function.js +291 -123
- package/dataflow/graph/call-graph.d.ts +7 -6
- package/dataflow/graph/call-graph.js +35 -46
- package/dataflow/graph/graph.d.ts +13 -1
- package/dataflow/graph/graph.js +74 -66
- package/dataflow/graph/vertex.d.ts +1 -1
- 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 +17 -8
- package/dataflow/internal/linker.js +286 -213
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +179 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +874 -0
- 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 +60 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +135 -198
- 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-envir-utils.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +21 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
- 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 +141 -146
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +56 -24
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +292 -253
- 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 +91 -129
- 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 +16 -12
- 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-repeat-loop.js +2 -0
- 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 +5 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +13 -31
- 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 +42 -119
- 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 +21 -21
- 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 +23 -26
- 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 +4 -4
- package/dataflow/internal/process/functions/call/common.js +49 -71
- package/dataflow/internal/process/functions/call/deferred.d.ts +12 -2
- package/dataflow/internal/process/functions/call/deferred.js +81 -63
- 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 +48 -19
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
- package/dataflow/internal/process/functions/call/quoted.js +257 -154
- 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 +4 -3
- package/dataflow/internal/program-order.d.ts +26 -0
- package/dataflow/internal/program-order.js +49 -0
- package/documentation/data/faq/faqs.js +3 -3
- package/documentation/data/interface/doc-writing-code.js +1 -2
- package/documentation/data/server/doc-data-server-messages.js +7 -7
- package/documentation/doc-capabilities.js +80 -34
- package/documentation/doc-util/doc-query.d.ts +0 -3
- package/documentation/doc-util/doc-query.js +4 -3
- package/documentation/wiki-analyzer.js +1 -1
- package/documentation/wiki-cfg.js +5 -6
- package/documentation/wiki-core.js +8 -8
- package/documentation/wiki-dataflow-graph.js +10 -11
- package/documentation/wiki-interface.js +2 -2
- package/documentation/wiki-linting-and-testing.js +3 -3
- package/documentation/wiki-overview.js +6 -6
- package/documentation/wiki-query.js +9 -101
- package/documentation/wiki-setup.js +23 -0
- package/documentation/wiki-signature-database.js +1 -1
- package/linter/linter-rules.d.ts +18 -9
- package/linter/rules/absolute-path.js +63 -87
- package/linter/rules/deprecated-functions.d.ts +1 -45
- package/linter/rules/deprecated-functions.js +24 -33
- 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.d.ts +2 -0
- package/project/flowr-analyzer.js +28 -1
- 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-rda-file.d.ts +0 -2
- package/project/plugins/file-plugins/files/flowr-rda-file.js +10 -55
- 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/file-plugins/flowr-analyzer-file-plugin.js +2 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +22 -45
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- package/project/sigdb/build.js +4 -0
- package/project/sigdb/manifest.d.ts +2 -0
- package/project/sigdb/manifest.js +10 -1
- package/project/sigdb/reader.js +23 -61
- package/project/sigdb/sigdb-download.d.ts +29 -6
- package/project/sigdb/sigdb-download.js +212 -64
- package/queries/base-query-format.js +1 -2
- package/queries/catalog/absint-query/absint-query-format.js +1 -1
- package/queries/catalog/call-context-query/cascade-action.d.ts +3 -1
- package/queries/catalog/call-context-query/cascade-action.js +2 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -0
- 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/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -1
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +2 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/query.d.ts +1 -1
- package/r-bridge/data/data.d.ts +21 -14
- package/r-bridge/data/data.js +28 -20
- 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/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +11 -2
- 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/files.d.ts +2 -0
- package/util/files.js +3 -1
- package/util/mermaid/mermaid.js +6 -2
- 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
|
@@ -10,11 +10,11 @@ class FlowrJupyterFile extends flowr_file_1.FlowrFile {
|
|
|
10
10
|
wrapped;
|
|
11
11
|
/**
|
|
12
12
|
* Prefer the static {@link FlowrJupyterFile.from} method
|
|
13
|
-
* @param
|
|
13
|
+
* @param wrapped - the file to load as Jupyter
|
|
14
14
|
*/
|
|
15
|
-
constructor(
|
|
16
|
-
super(
|
|
17
|
-
this.wrapped =
|
|
15
|
+
constructor(wrapped) {
|
|
16
|
+
super(wrapped.path(), wrapped.roles ? [...wrapped.roles, flowr_file_1.FileRole.Source] : [flowr_file_1.FileRole.Source]);
|
|
17
|
+
this.wrapped = wrapped;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Loads and parses the content of the wrapped file.
|
|
@@ -37,14 +37,10 @@ class FlowrJupyterFile extends flowr_file_1.FlowrFile {
|
|
|
37
37
|
}
|
|
38
38
|
exports.FlowrJupyterFile = FlowrJupyterFile;
|
|
39
39
|
function loadJupyter(content) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return typeof cell.source === 'object' ? cell.source.map(s => `# ${s}`).join('') : `# ${cell.source}`;
|
|
47
|
-
}
|
|
40
|
+
return JSON.parse(content).cells.map(cell => {
|
|
41
|
+
const source = typeof cell.source === 'object' ? cell.source.join('') : cell.source;
|
|
42
|
+
/* every line of a text cell becomes a comment, whether the notebook stores the cell as lines or as one string */
|
|
43
|
+
return cell.cell_type === 'code' ? source : source.replace(/^/gm, '# ');
|
|
48
44
|
}).join('\n');
|
|
49
45
|
}
|
|
50
46
|
//# sourceMappingURL=flowr-jupyter-file.js.map
|
|
@@ -403,8 +403,6 @@ export declare class RDAParser {
|
|
|
403
403
|
* See {@link https://github.com/wch/r-source/blob/2196e6982a8f49082ee5c3d3521f6dd6596ea72c/src/main/memory.c#L4122-L4142 | R source: VECTOR_ELT}
|
|
404
404
|
*/
|
|
405
405
|
VECTOR_ELT(x: RObjectData, i: number): RObject;
|
|
406
|
-
/** Whether a {@link SexpType.BcodesSxp}'s version is within the supported range. See {@link https://github.com/wch/r-source/blob/2196e6982a8f49082ee5c3d3521f6dd6596ea72c/src/main/eval.c#L7166-L7175 | R source: R_BCVersionOK} */
|
|
407
|
-
R_BCVersionOK(s: RObjectData): boolean;
|
|
408
406
|
/** Source-language expression for an unsupported bytecode object: its first constant pool entry, or {@link RValues.NilValue}. See {@link https://github.com/wch/r-source/blob/2196e6982a8f49082ee5c3d3521f6dd6596ea72c/src/main/eval.c#L5566-L5574 | R source: bytecodeExpr} */
|
|
409
407
|
R_BytecodeExpr(s: RObjectData): RObject;
|
|
410
408
|
/**
|
|
@@ -121,6 +121,8 @@ const BareStreamFormats = new Set(['A', 'B', 'X']);
|
|
|
121
121
|
function isBareSerializationStream(buf) {
|
|
122
122
|
return buf.length >= 2 && buf[1] === 0x0a && BareStreamFormats.has(String.fromCodePoint(buf[0]));
|
|
123
123
|
}
|
|
124
|
+
/** The control characters an ASCII-format string spells with a backslash escape; any other escaped character stands for itself. */
|
|
125
|
+
const AsciiEscapes = { n: '\n', t: '\t', v: '\v', b: '\b', r: '\r', f: '\f', a: '\x07' };
|
|
124
126
|
/** The variants {@link RDAParser.deserialize} handles. */
|
|
125
127
|
const SupportedSerializationTypes = new Set([
|
|
126
128
|
SerializationTypeTag.MagicAsciiV2, SerializationTypeTag.MagicBinaryV2, SerializationTypeTag.MagicXdrV2,
|
|
@@ -406,7 +408,7 @@ class RDAParser {
|
|
|
406
408
|
if (neLen > RDAParser.R_CODE_SET_MAX || neLen < 0) {
|
|
407
409
|
throw new Error('invalid length of encoding name');
|
|
408
410
|
}
|
|
409
|
-
|
|
411
|
+
this.inString(neLen);
|
|
410
412
|
break;
|
|
411
413
|
}
|
|
412
414
|
default:
|
|
@@ -536,37 +538,13 @@ class RDAParser {
|
|
|
536
538
|
c = String.fromCodePoint(this.buffer[this.offset++]);
|
|
537
539
|
switch (c) {
|
|
538
540
|
case 'n':
|
|
539
|
-
result.push('\n');
|
|
540
|
-
break;
|
|
541
541
|
case 't':
|
|
542
|
-
result.push('\t');
|
|
543
|
-
break;
|
|
544
542
|
case 'v':
|
|
545
|
-
result.push('\v');
|
|
546
|
-
break;
|
|
547
543
|
case 'b':
|
|
548
|
-
result.push('\b');
|
|
549
|
-
break;
|
|
550
544
|
case 'r':
|
|
551
|
-
result.push('\r');
|
|
552
|
-
break;
|
|
553
545
|
case 'f':
|
|
554
|
-
result.push('\f');
|
|
555
|
-
break;
|
|
556
546
|
case 'a':
|
|
557
|
-
result.push(
|
|
558
|
-
break; // \a
|
|
559
|
-
case '\\':
|
|
560
|
-
result.push('\\');
|
|
561
|
-
break;
|
|
562
|
-
case '?':
|
|
563
|
-
result.push('?');
|
|
564
|
-
break;
|
|
565
|
-
case '\'':
|
|
566
|
-
result.push('\'');
|
|
567
|
-
break;
|
|
568
|
-
case '"':
|
|
569
|
-
result.push('"');
|
|
547
|
+
result.push(AsciiEscapes[c]);
|
|
570
548
|
break;
|
|
571
549
|
case '0':
|
|
572
550
|
case '1':
|
|
@@ -641,28 +619,21 @@ class RDAParser {
|
|
|
641
619
|
const shell = new shell_executor_1.RShellExecutor();
|
|
642
620
|
const result = shell.run(code);
|
|
643
621
|
shell.close();
|
|
644
|
-
|
|
645
|
-
if (result === '<environment: R_GlobalEnv>') {
|
|
646
|
-
val.value = RValues.GlobalEnv;
|
|
647
|
-
}
|
|
648
|
-
return val;
|
|
622
|
+
return result === '<environment: R_GlobalEnv>' ? { type: SexpType.EnvSxp, value: RValues.GlobalEnv } : { type: SexpType.EnvSxp };
|
|
649
623
|
}
|
|
650
624
|
/**
|
|
651
625
|
* Resolves a namespace reference by name via `getNamespace()` in R. Simpler variant of {@link R_FindNamespace1}.
|
|
652
626
|
* @see {@link https://github.com/wch/r-source/blob/2196e6982a8f49082ee5c3d3521f6dd6596ea72c/src/main/envir.c#L3795-L3804 | R source: R_FindNamespace}
|
|
653
627
|
*/
|
|
654
628
|
R_FindNamespace(info) {
|
|
655
|
-
|
|
656
|
-
return this.runNamespaceLookup(`getNamespace("${namespaceName}")`);
|
|
629
|
+
return this.runNamespaceLookup(`getNamespace("${info.value.name}")`);
|
|
657
630
|
}
|
|
658
631
|
/**
|
|
659
632
|
* Resolves a serialized namespace reference by executing R at runtime. See {@link R_FindNamespace} for the result shape.
|
|
660
633
|
* @see {@link https://github.com/wch/r-source/blob/2196e6982a8f49082ee5c3d3521f6dd6596ea72c/src/main/serialize.c#L1785-L1796 | R source: R_FindNamespace1}
|
|
661
634
|
*/
|
|
662
635
|
R_FindNamespace1(info) {
|
|
663
|
-
|
|
664
|
-
const code = `..getNamespace("${info.value[0].name}", "${where}")`;
|
|
665
|
-
return this.runNamespaceLookup(code);
|
|
636
|
+
return this.runNamespaceLookup(`..getNamespace("${info.value[0].name}", "${this.lastName}")`);
|
|
666
637
|
}
|
|
667
638
|
/**
|
|
668
639
|
* Deserializes a single SEXP node, dispatching on its encoded {@link SexpType}.
|
|
@@ -933,7 +904,7 @@ class RDAParser {
|
|
|
933
904
|
s.attributes = hasAttribute ? [skip ? this.skipItem() : this.assertRObjectData(this.readItem())] : undefined;
|
|
934
905
|
this.currentDepth--;
|
|
935
906
|
}
|
|
936
|
-
if (!skip && s.type === SexpType.BcodesSxp
|
|
907
|
+
if (!skip && s.type === SexpType.BcodesSxp) {
|
|
937
908
|
return this.R_BytecodeExpr(s);
|
|
938
909
|
}
|
|
939
910
|
return s;
|
|
@@ -1597,28 +1568,12 @@ class RDAParser {
|
|
|
1597
1568
|
return x.value[i];
|
|
1598
1569
|
}
|
|
1599
1570
|
}
|
|
1600
|
-
/** Whether a {@link SexpType.BcodesSxp}'s version is within the supported range. See {@link https://github.com/wch/r-source/blob/2196e6982a8f49082ee5c3d3521f6dd6596ea72c/src/main/eval.c#L7166-L7175 | R source: R_BCVersionOK} */
|
|
1601
|
-
R_BCVersionOK(s) {
|
|
1602
|
-
if (s.type !== SexpType.BcodesSxp) {
|
|
1603
|
-
return false;
|
|
1604
|
-
}
|
|
1605
|
-
// const version = s.code;
|
|
1606
|
-
const version = 0;
|
|
1607
|
-
return version >= 9 && version <= 12;
|
|
1608
|
-
}
|
|
1609
1571
|
/** Source-language expression for an unsupported bytecode object: its first constant pool entry, or {@link RValues.NilValue}. See {@link https://github.com/wch/r-source/blob/2196e6982a8f49082ee5c3d3521f6dd6596ea72c/src/main/eval.c#L5566-L5574 | R source: bytecodeExpr} */
|
|
1610
1572
|
R_BytecodeExpr(s) {
|
|
1611
|
-
if (s.type
|
|
1612
|
-
if (s.cdr.value?.length > 0) {
|
|
1613
|
-
return this.VECTOR_ELT(s.cdr, 0);
|
|
1614
|
-
}
|
|
1615
|
-
else {
|
|
1616
|
-
return RValues.NilValue;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
else {
|
|
1573
|
+
if (s.type !== SexpType.BcodesSxp) {
|
|
1620
1574
|
return s;
|
|
1621
1575
|
}
|
|
1576
|
+
return s.cdr.value?.length > 0 ? this.VECTOR_ELT(s.cdr, 0) : RValues.NilValue;
|
|
1622
1577
|
}
|
|
1623
1578
|
/**
|
|
1624
1579
|
* Attempts to unserialize an ALTREP object. Throws error if the base type is not a supported vector type.
|
|
@@ -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) {
|
|
@@ -4,6 +4,7 @@ exports.FlowrAnalyzerRoleFilePlugin = exports.FlowrAnalyzerPatternFilePlugin = e
|
|
|
4
4
|
const flowr_analyzer_plugin_1 = require("../flowr-analyzer-plugin");
|
|
5
5
|
const flowr_file_1 = require("../../context/flowr-file");
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
|
+
const files_1 = require("../../../util/files");
|
|
7
8
|
const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
8
9
|
/**
|
|
9
10
|
* This is the base class for all plugins that load and possibly transform files when they are loaded.
|
|
@@ -34,7 +35,7 @@ class DefaultFlowrAnalyzerFilePlugin extends FlowrAnalyzerFilePlugin {
|
|
|
34
35
|
}
|
|
35
36
|
process(_ctx, arg) {
|
|
36
37
|
const path = arg.path().toString();
|
|
37
|
-
if (/\.r$/i.test(path)) {
|
|
38
|
+
if (/\.r$/i.test(path) || files_1.rPackageSourceRegex.test(path)) {
|
|
38
39
|
// we just assign the role :D
|
|
39
40
|
arg.assignRole(flowr_file_1.FileRole.Source);
|
|
40
41
|
}
|
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 */
|
|
@@ -201,16 +194,18 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
201
194
|
if (!dl.sigDbNeedsSync()) {
|
|
202
195
|
return;
|
|
203
196
|
}
|
|
204
|
-
exports.sigDbLog.info('sigdb: committed link file
|
|
205
|
-
const { files } = await dl.downloadFullSigDb({
|
|
197
|
+
exports.sigDbLog.info('sigdb: the committed link file names shards missing from the cache, syncing them in the background');
|
|
198
|
+
const { tag, files, downloaded, stale } = await dl.downloadFullSigDb({
|
|
206
199
|
repo: ctx.config.solver.sigdb.downloadRepo,
|
|
207
200
|
onProgress: msg => exports.sigDbLog.info(`sigdb sync: ${msg}`)
|
|
208
201
|
});
|
|
209
|
-
|
|
202
|
+
const manifests = files.filter(f => dl.isManifestFile(f));
|
|
203
|
+
for (const manifest of manifests) {
|
|
210
204
|
await ctx.deps.addDatabaseSource(manifest);
|
|
211
205
|
}
|
|
206
|
+
exports.sigDbLog.info(`sigdb sync: ${tag} ready (${downloaded.length} file(s) fetched, ${manifests.length} manifest(s) mounted${stale.length > 0 ? `, ${stale.length} older bundle(s) still cached` : ''})`);
|
|
212
207
|
})().catch((e) => {
|
|
213
|
-
exports.sigDbLog.warn(`background sigdb sync failed
|
|
208
|
+
exports.sigDbLog.warn(`background sigdb sync failed, analyzing with the signatures already cached: ${e.message}`);
|
|
214
209
|
});
|
|
215
210
|
}
|
|
216
211
|
warmPromise;
|
|
@@ -283,16 +278,7 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
283
278
|
/* the historical bundle is not asked: a name is hinted so a `library()` can be added for it, and a package
|
|
284
279
|
only that bundle carries is one nothing can attach today */
|
|
285
280
|
const sources = this.loadSources().filter(s => describeLoadedDatabase(s).scope !== 'history');
|
|
286
|
-
const
|
|
287
|
-
const owners = [];
|
|
288
|
-
for (const src of sources) {
|
|
289
|
-
for (const pkg of exportOwners(src, name)) {
|
|
290
|
-
if (!seen.has(pkg) && !this.isSelfPackage(pkg)) {
|
|
291
|
-
seen.add(pkg);
|
|
292
|
-
owners.push(pkg);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
281
|
+
const owners = (0, arrays_1.uniqueArray)(sources.flatMap(src => exportOwners(src, name))).filter(pkg => !this.isSelfPackage(pkg));
|
|
296
282
|
// each source's list is already sorted; a merge of several needs one more pass to be globally ordered
|
|
297
283
|
if (owners.length > 1 && sources.length > 1) {
|
|
298
284
|
/* the comparator runs O(n log n) times, so each package is counted once up front */
|
|
@@ -393,12 +379,8 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
393
379
|
return undefined;
|
|
394
380
|
}
|
|
395
381
|
const target = this.analyzerCtx?.resolvedRVersion ?? (0, config_1.resolveAssumedRVersion)(undefined);
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
if (r_version_1.RVersion.compare(v.str, target) <= 0) {
|
|
399
|
-
chosen = v;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
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);
|
|
402
384
|
if (chosen === undefined) {
|
|
403
385
|
// the assumed R version is older than the earliest recorded core release: fall back to the closest one
|
|
404
386
|
chosen = versions[0];
|
|
@@ -479,24 +461,17 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
479
461
|
if (info && (range === undefined || r_version_1.RRange.satisfies(info.version, range))) {
|
|
480
462
|
return info;
|
|
481
463
|
}
|
|
482
|
-
if (range
|
|
483
|
-
|
|
484
|
-
for (let i = versions.length - 1; i >= 0; i--) {
|
|
485
|
-
if (r_version_1.RRange.satisfies(versions[i], range)) {
|
|
486
|
-
return src.lookup(name, versions[i]);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
464
|
+
if (range === undefined) {
|
|
465
|
+
return undefined;
|
|
489
466
|
}
|
|
490
|
-
|
|
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);
|
|
491
469
|
}
|
|
492
470
|
/** Lowest stored version satisfying the constraint (using the store's actual R-form version strings). */
|
|
493
471
|
oldestSatisfying(src, name, range) {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
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);
|
|
500
475
|
}
|
|
501
476
|
/**
|
|
502
477
|
* The versions the source can answer for a package (dated releases, base-R core releases, and the latest),
|
|
@@ -507,7 +482,9 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
|
|
|
507
482
|
}
|
|
508
483
|
/** build the resolved {@link Package} (namespace + version) from a source's export view */
|
|
509
484
|
toResolvedPackage(name, info) {
|
|
510
|
-
|
|
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)]);
|
|
511
488
|
const namespaceInfo = {
|
|
512
489
|
exportedSymbols: exported,
|
|
513
490
|
exportedFunctions: [],
|
|
@@ -29,8 +29,8 @@ class FlowrAnalyzerProjectDiscoveryPlugin extends flowr_analyzer_plugin_1.FlowrA
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.FlowrAnalyzerProjectDiscoveryPlugin = FlowrAnalyzerProjectDiscoveryPlugin;
|
|
32
|
-
// `.Rprofile`/`Rprofile.site` carry no extension but are plain R sources
|
|
33
|
-
exports.discoverRSourcesRegex =
|
|
32
|
+
// `.Rprofile`/`Rprofile.site` carry no extension but are plain R sources, as are the `.S`/`.s`/`.q` files below `R/`
|
|
33
|
+
exports.discoverRSourcesRegex = new RegExp(`(\\.(r|rmd|rmarkdown|ipynb|qmd|rnw)|(^|[\\\\/])\\.?Rprofile(\\.site)?)$|${files_1.rPackageSourceRegex.source}`, 'i');
|
|
34
34
|
// matched against the posix path relative to the project root
|
|
35
35
|
exports.ignorePathsWith = /(^|\/)(\.git|\.svn|\.hg|node_modules|__pycache__|\.Rproj\.user|\.uvr|Rtmp[^/]*|(packrat|renv|rv)\/(lib|library|src|staging|sandbox|bundles)[^/]*)(\/|$)/i;
|
|
36
36
|
exports.excludeRequestsForPaths = /vignettes?|tests?|revdep|inst|data/i;
|
package/project/sigdb/build.js
CHANGED
|
@@ -502,6 +502,10 @@ const NdjsonBatchBytes = 8_000_000;
|
|
|
502
502
|
* rather than a JSON array of quoted strings, which loads as a single `split('\n')` instead of parsing ~1.4M elements.
|
|
503
503
|
*/
|
|
504
504
|
function* dictLines(strings) {
|
|
505
|
+
/* a line holding no names would read back as one empty name */
|
|
506
|
+
if (strings.length === 0) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
505
509
|
let start = 0;
|
|
506
510
|
let parts = [];
|
|
507
511
|
let bytes = 0;
|
|
@@ -55,6 +55,8 @@ export declare function readManifestFile(manifestFile: string): SigDbManifest;
|
|
|
55
55
|
export declare function readManifestDate(manifestFile: string): string | undefined;
|
|
56
56
|
/** breadth/temporal scope of a bundled sigdb: base R only, `current` (latest CRAN + base R), or the `full` history */
|
|
57
57
|
export type SigDbScope = 'base' | 'current' | 'full';
|
|
58
|
+
/** the bundle directories in the cache, the most recently synced first (it takes precedence) */
|
|
59
|
+
export declare function sigDbBundleDirs(watched?: [string, number][]): string[];
|
|
58
60
|
/**
|
|
59
61
|
* Location of a bundled sigdb **manifest**, found by walking up from several roots (this module,
|
|
60
62
|
* `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`), and data-mount
|
|
@@ -7,6 +7,7 @@ exports.SigDbManifestSchema = exports.SigDbManifestMagic = void 0;
|
|
|
7
7
|
exports.writeManifest = writeManifest;
|
|
8
8
|
exports.readManifestFile = readManifestFile;
|
|
9
9
|
exports.readManifestDate = readManifestDate;
|
|
10
|
+
exports.sigDbBundleDirs = sigDbBundleDirs;
|
|
10
11
|
exports.defaultSigDbPath = defaultSigDbPath;
|
|
11
12
|
exports.defaultSigDbPaths = defaultSigDbPaths;
|
|
12
13
|
/**
|
|
@@ -65,6 +66,7 @@ const SigDbSubDirs = ['', 'data/sigdb', 'src/data/sigdb', 'dist/src/data/sigdb']
|
|
|
65
66
|
const ManifestFilePattern = new RegExp(`\\.manifest\\.json${codec_1.CompressedExtPattern}$`);
|
|
66
67
|
/** a `<name>.sigs.ndjson` bundle, in any of the codecs we can read */
|
|
67
68
|
const BundleFilePattern = new RegExp(`${schema_1.SigDbExt.replace(/\./g, '\\.')}${codec_1.CompressedExtPattern}$`);
|
|
69
|
+
/** the bundle directories in the cache, the most recently synced first (it takes precedence) */
|
|
68
70
|
function sigDbBundleDirs(watched) {
|
|
69
71
|
if (typeof fs_1.default?.readdirSync !== 'function') {
|
|
70
72
|
return [];
|
|
@@ -72,9 +74,16 @@ function sigDbBundleDirs(watched) {
|
|
|
72
74
|
try {
|
|
73
75
|
const bundles = path_1.default.join((0, decompress_1.sigDbCacheDir)(undefined, false), 'bundles');
|
|
74
76
|
const mtimeMs = fs_1.default.statSync(bundles).mtimeMs;
|
|
77
|
+
/* a bundle of every release synced so far stays in the cache, and the first one found wins: the most recently
|
|
78
|
+
synced comes first, or an update to a release that happens to sort before the old one would be ignored */
|
|
75
79
|
const dirs = fs_1.default.readdirSync(bundles, { withFileTypes: true })
|
|
76
80
|
.filter(e => e.isDirectory())
|
|
77
|
-
.map(e =>
|
|
81
|
+
.map(e => {
|
|
82
|
+
const dir = path_1.default.join(bundles, e.name);
|
|
83
|
+
return { dir, mtimeMs: fs_1.default.statSync(dir).mtimeMs };
|
|
84
|
+
})
|
|
85
|
+
.sort((a, b) => b.mtimeMs - a.mtimeMs)
|
|
86
|
+
.map(e => e.dir);
|
|
78
87
|
watched?.push([bundles, mtimeMs]); // a bundle directory appearing here has to be picked up too
|
|
79
88
|
return dirs;
|
|
80
89
|
}
|