@eagleoutice/flowr 2.13.1 → 2.13.3

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.
Files changed (158) hide show
  1. package/README.md +46 -44
  2. package/abstract-interpretation/data-frame/mappers/access-mapper.js +1 -0
  3. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +1 -1
  4. package/abstract-interpretation/data-frame/mappers/function-mapper.js +3 -0
  5. package/abstract-interpretation/domains/state-domain-like.d.ts +1 -1
  6. package/cli/flowr.js +21 -5
  7. package/cli/repl/commands/repl-commands.js +11 -9
  8. package/cli/repl/commands/repl-query.js +1 -1
  9. package/cli/repl/commands/repl-signature.js +8 -1
  10. package/cli/repl/core.js +13 -10
  11. package/cli/repl/print-version.js +1 -1
  12. package/cli/repl/server/connection.d.ts +1 -1
  13. package/cli/repl/server/net.js +15 -0
  14. package/config.d.ts +37 -0
  15. package/config.js +63 -3
  16. package/control-flow/control-flow-graph.js +2 -1
  17. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  18. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +1 -1
  19. package/data/sigdb/sigdb.remote.json +1 -1
  20. package/dataflow/environments/append.d.ts +1 -1
  21. package/dataflow/environments/clone.d.ts +1 -1
  22. package/dataflow/environments/environment.d.ts +28 -4
  23. package/dataflow/environments/environment.js +66 -11
  24. package/dataflow/environments/identifier.d.ts +9 -8
  25. package/dataflow/environments/identifier.js +21 -13
  26. package/dataflow/environments/overwrite.d.ts +1 -1
  27. package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
  28. package/dataflow/eval/resolve/resolve-working-directory.d.ts +29 -0
  29. package/dataflow/eval/resolve/resolve-working-directory.js +168 -0
  30. package/dataflow/extractor.js +2 -1
  31. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  32. package/dataflow/graph/df-helper.d.ts +3 -2
  33. package/dataflow/graph/df-helper.js +11 -15
  34. package/dataflow/graph/diff-dataflow-graph.js +1 -1
  35. package/dataflow/graph/graph-helper.js +2 -6
  36. package/dataflow/graph/graph.d.ts +24 -0
  37. package/dataflow/graph/graph.js +25 -1
  38. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
  39. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +1 -1
  40. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  41. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +51 -0
  42. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  43. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -1
  44. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
  45. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -2
  46. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +15 -9
  47. package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
  48. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
  49. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +1 -1
  50. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +1 -1
  51. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -1
  52. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +9 -2
  53. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  54. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +2 -2
  55. package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +1 -1
  56. package/documentation/doc-readme.js +14 -12
  57. package/documentation/doc-util/doc-normalized-ast.d.ts +1 -1
  58. package/documentation/wiki-dataflow-graph.js +4 -24
  59. package/documentation/wiki-linter.js +1 -0
  60. package/documentation/wiki-mk/doc-context.d.ts +10 -0
  61. package/documentation/wiki-mk/doc-context.js +3 -0
  62. package/documentation/wiki-query.js +47 -0
  63. package/documentation/wiki-signature-database.js +18 -7
  64. package/linter/linter-rules.d.ts +24 -2
  65. package/linter/linter-rules.js +3 -1
  66. package/linter/rules/absolute-path.d.ts +4 -4
  67. package/linter/rules/absolute-path.js +7 -5
  68. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  69. package/linter/rules/file-path-validity.d.ts +1 -1
  70. package/linter/rules/file-path-validity.js +48 -8
  71. package/linter/rules/function-finder-util.d.ts +2 -1
  72. package/linter/rules/syntactically-valid.d.ts +58 -0
  73. package/linter/rules/syntactically-valid.js +203 -0
  74. package/linter/rules/undefined-symbol-util.js +3 -1
  75. package/linter/rules/undefined-symbol.js +6 -6
  76. package/package.json +25 -12
  77. package/project/context/classify-project-kind.d.ts +40 -0
  78. package/project/context/classify-project-kind.js +76 -0
  79. package/project/context/flowr-analyzer-context.d.ts +4 -4
  80. package/project/context/flowr-analyzer-context.js +3 -3
  81. package/project/context/flowr-analyzer-dependencies-context.d.ts +34 -9
  82. package/project/context/flowr-analyzer-dependencies-context.js +30 -3
  83. package/project/context/flowr-analyzer-files-context.d.ts +10 -8
  84. package/project/context/flowr-analyzer-files-context.js +26 -67
  85. package/project/context/flowr-analyzer-meta-context.d.ts +1 -0
  86. package/project/context/flowr-file.d.ts +5 -0
  87. package/project/context/flowr-file.js +5 -0
  88. package/project/dependency-version-space.d.ts +118 -26
  89. package/project/dependency-version-space.js +343 -87
  90. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  91. package/project/plugins/file-plugins/files/flowr-description-file.js +8 -1
  92. package/project/plugins/file-plugins/files/flowr-rda-file.js +27 -25
  93. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +12 -4
  94. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +25 -10
  95. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
  96. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +1 -1
  97. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -1
  98. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -1
  99. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +4 -4
  100. package/project/plugins/package-version-plugins/package.d.ts +27 -10
  101. package/project/plugins/package-version-plugins/package.js +50 -25
  102. package/project/plugins/plugin-registry.d.ts +2 -1
  103. package/project/plugins/plugin-registry.js +4 -1
  104. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +57 -2
  105. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +150 -28
  106. package/project/sigdb/decompress.d.ts +1 -1
  107. package/project/sigdb/decompress.js +4 -1
  108. package/project/sigdb/manifest.js +60 -26
  109. package/project/sigdb/reader.d.ts +26 -16
  110. package/project/sigdb/reader.js +52 -21
  111. package/project/sigdb/sigdb-download.d.ts +6 -7
  112. package/project/sigdb/sigdb-download.js +30 -9
  113. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  114. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -12
  115. package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -108
  116. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
  117. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +39 -77
  118. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +12 -0
  119. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +54 -24
  120. package/queries/catalog/input-sources-query/input-source-functions.d.ts +13 -0
  121. package/queries/catalog/input-sources-query/input-source-functions.js +96 -1
  122. package/queries/catalog/input-sources-query/input-sources-query-executor.js +40 -4
  123. package/queries/catalog/input-sources-query/input-sources-query-format.js +21 -3
  124. package/queries/catalog/input-sources-query/input-types.d.ts +58 -0
  125. package/queries/catalog/input-sources-query/input-types.js +64 -0
  126. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +62 -52
  127. package/queries/catalog/input-sources-query/simple-input-classifier.js +334 -101
  128. package/queries/catalog/linter-query/linter-query-format.js +9 -2
  129. package/queries/catalog/project-query/project-query-executor.js +1 -1
  130. package/queries/catalog/signature-query/signature-query-executor.d.ts +7 -1
  131. package/queries/catalog/signature-query/signature-query-executor.js +115 -39
  132. package/queries/catalog/signature-query/signature-query-format.d.ts +5 -1
  133. package/queries/catalog/signature-query/signature-query-format.js +1 -1
  134. package/queries/catalog/signature-query/signature-query-render.js +12 -7
  135. package/queries/query.js +9 -2
  136. package/r-bridge/data/data.d.ts +5 -0
  137. package/r-bridge/data/data.js +6 -0
  138. package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
  139. package/r-bridge/retriever.d.ts +1 -1
  140. package/r-bridge/retriever.js +6 -1
  141. package/r-bridge/shell.js +5 -0
  142. package/search/flowr-search-filters.d.ts +2 -1
  143. package/search/flowr-search-printer.js +10 -8
  144. package/slicing/static/static-slicer.d.ts +2 -2
  145. package/util/files.d.ts +6 -4
  146. package/util/files.js +30 -8
  147. package/util/mermaid/dfg.js +1 -1
  148. package/util/objects.js +6 -4
  149. package/util/r-base-packages.d.ts +2 -0
  150. package/util/r-base-packages.js +3 -0
  151. package/util/r-license.js +1 -4
  152. package/util/r-version.d.ts +12 -0
  153. package/util/r-version.js +16 -0
  154. package/util/range.d.ts +6 -2
  155. package/util/range.js +33 -15
  156. package/util/text/ansi.d.ts +7 -3
  157. package/util/text/ansi.js +8 -5
  158. package/util/version.js +4 -4
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The classification lattice of the {@link InputSourcesQuery|input-sources} analysis, kept free of any imports so
3
+ * that the configuration can name its members without pulling the analysis in.
4
+ * @module
5
+ */
6
+ /**
7
+ * Lattice flattening until we have a taint engine :)
8
+ * Please note that the classifier considers this basis with a set-lift,
9
+ * joining differing lattice elements.
10
+ *
11
+ *```
12
+ * [ Unknown ]
13
+ * |
14
+ * [Param] [File] [Net] [User], ...
15
+ * | | | |
16
+ * | [TempFile] | |
17
+ * +---------+------+------+- ...
18
+ * |
19
+ * [ DerivedConstant ]
20
+ * |
21
+ * [ Constant ]
22
+ *```
23
+ *
24
+ */
25
+ export declare enum InputType {
26
+ Parameter = "param",
27
+ File = "file",
28
+ /** Temporary file paths produced by tempfile()/tempdir() and equivalents; a sub-type of {@link File} */
29
+ TempFile = "tempfile",
30
+ Network = "net",
31
+ Random = "rand",
32
+ /** Calls to system/system2 and similar */
33
+ System = "system",
34
+ /** Calls to .C / Fortran interfaces (foreign function interfaces) */
35
+ Ffi = "ffi",
36
+ /** Language objects (quote/substitute/etc.) */
37
+ Lang = "lang",
38
+ /** Global options / option accessors (options, getOption) */
39
+ Options = "options",
40
+ /** Interactive user input (file choosers, prompts, dialogs, menu selections) */
41
+ User = "user",
42
+ Constant = "const",
43
+ /** Read from environment/call scope */
44
+ Scope = "scope",
45
+ /** Pure calculations from constants that lead to a constant */
46
+ DerivedConstant = "dconst",
47
+ Unknown = "unknown"
48
+ }
49
+ export declare enum InputTraceType {
50
+ /** Derived only from aliasing */
51
+ Alias = "alias",
52
+ /** Derived from pure function chains */
53
+ Pure = "pure",
54
+ /** Derived from known but not necessarily all pure function chains */
55
+ Known = "known",
56
+ /** Not fully known origin */
57
+ Unknown = "unknown"
58
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /**
3
+ * The classification lattice of the {@link InputSourcesQuery|input-sources} analysis, kept free of any imports so
4
+ * that the configuration can name its members without pulling the analysis in.
5
+ * @module
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.InputTraceType = exports.InputType = void 0;
9
+ /**
10
+ * Lattice flattening until we have a taint engine :)
11
+ * Please note that the classifier considers this basis with a set-lift,
12
+ * joining differing lattice elements.
13
+ *
14
+ *```
15
+ * [ Unknown ]
16
+ * |
17
+ * [Param] [File] [Net] [User], ...
18
+ * | | | |
19
+ * | [TempFile] | |
20
+ * +---------+------+------+- ...
21
+ * |
22
+ * [ DerivedConstant ]
23
+ * |
24
+ * [ Constant ]
25
+ *```
26
+ *
27
+ */
28
+ var InputType;
29
+ (function (InputType) {
30
+ InputType["Parameter"] = "param";
31
+ InputType["File"] = "file";
32
+ /** Temporary file paths produced by tempfile()/tempdir() and equivalents; a sub-type of {@link File} */
33
+ InputType["TempFile"] = "tempfile";
34
+ InputType["Network"] = "net";
35
+ InputType["Random"] = "rand";
36
+ /** Calls to system/system2 and similar */
37
+ InputType["System"] = "system";
38
+ /** Calls to .C / Fortran interfaces (foreign function interfaces) */
39
+ InputType["Ffi"] = "ffi";
40
+ /** Language objects (quote/substitute/etc.) */
41
+ InputType["Lang"] = "lang";
42
+ /** Global options / option accessors (options, getOption) */
43
+ InputType["Options"] = "options";
44
+ /** Interactive user input (file choosers, prompts, dialogs, menu selections) */
45
+ InputType["User"] = "user";
46
+ InputType["Constant"] = "const";
47
+ /** Read from environment/call scope */
48
+ InputType["Scope"] = "scope";
49
+ /** Pure calculations from constants that lead to a constant */
50
+ InputType["DerivedConstant"] = "dconst";
51
+ InputType["Unknown"] = "unknown";
52
+ })(InputType || (exports.InputType = InputType = {}));
53
+ var InputTraceType;
54
+ (function (InputTraceType) {
55
+ /** Derived only from aliasing */
56
+ InputTraceType["Alias"] = "alias";
57
+ /** Derived from pure function chains */
58
+ InputTraceType["Pure"] = "pure";
59
+ /** Derived from known but not necessarily all pure function chains */
60
+ InputTraceType["Known"] = "known";
61
+ /** Not fully known origin */
62
+ InputTraceType["Unknown"] = "unknown";
63
+ })(InputTraceType || (exports.InputTraceType = InputTraceType = {}));
64
+ //# sourceMappingURL=input-types.js.map
@@ -1,60 +1,54 @@
1
1
  import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
+ import { InputTraceType, InputType } from './input-types';
3
+ export { InputTraceType, InputType } from './input-types';
2
4
  import type { DataflowGraph } from '../../../dataflow/graph/graph';
3
5
  import type { MergeableRecord } from '../../../util/objects';
4
6
  import { Identifier } from '../../../dataflow/environments/identifier';
5
7
  import type { FlowrSearchLike } from '../../../search/flowr-search-builder';
6
8
  /**
7
- * Lattice flattening until we have a taint engine :)
8
- * Please note that the classifier considers this basis with a set-lift,
9
- * joining differing lattice elements.
10
- *
11
- *```
12
- * [ Unknown ]
13
- * |
14
- * [Param] [File] [Net] [User], ...
15
- * | | | |
16
- * | [TempFile] | |
17
- * +---------+------+------+- ...
18
- * |
19
- * [ DerivedConstant ]
20
- * |
21
- * [ Constant ]
22
- *```
23
- *
9
+ * An object that a framework hands to its users without any visible definition, like the `input` of a
10
+ * shiny server function. Reads of such an object (and of its fields) are classified as its given type,
11
+ * so traces link up to the framework instead of stopping at an opaque parameter.
24
12
  */
25
- export declare enum InputType {
26
- Parameter = "param",
27
- File = "file",
28
- /** Temporary file paths produced by tempfile()/tempdir() and equivalents; a sub-type of {@link File} */
29
- TempFile = "tempfile",
30
- Network = "net",
31
- Random = "rand",
32
- /** Calls to system/system2 and similar */
33
- System = "system",
34
- /** Calls to .C / Fortran interfaces (foreign function interfaces) */
35
- Ffi = "ffi",
36
- /** Language objects (quote/substitute/etc.) */
37
- Lang = "lang",
38
- /** Global options / option accessors (options, getOption) */
39
- Options = "options",
40
- /** Interactive user input (file choosers, prompts, dialogs, menu selections) */
41
- User = "user",
42
- Constant = "const",
43
- /** Read from environment/call scope */
44
- Scope = "scope",
45
- /** Pure calculations from constants that lead to a constant */
46
- DerivedConstant = "dconst",
47
- Unknown = "unknown"
13
+ export interface LinkedInputObject {
14
+ /** the name of the object, e.g. `input` */
15
+ readonly name: string;
16
+ /** how reads of the object (or of its fields) are to be classified */
17
+ readonly type: InputType;
18
+ /**
19
+ * If given, the object only counts as linked if the function binding it declares all of these parameters as well
20
+ * (e.g., shiny's `function(input, output, session)`). Without this, every `input` would be treated as the framework's.
21
+ */
22
+ readonly withParams?: readonly string[];
23
+ /** the package that has to be attached for this object to exist, e.g. `shiny` */
24
+ readonly requires?: string;
25
+ /** if given, only these fields are inputs (`session$clientData` is, `session$userData` is not) and the object itself is none */
26
+ readonly fields?: readonly string[];
27
+ /** how the framework declares the entries of this object, so a read of `input$n` links to the `textInput("n", …)` defining it */
28
+ readonly declaredBy?: LinkedInputDeclaration;
48
29
  }
49
- export declare enum InputTraceType {
50
- /** Derived only from aliasing */
51
- Alias = "alias",
52
- /** Derived from pure function chains */
53
- Pure = "pure",
54
- /** Derived from known but not necessarily all pure function chains */
55
- Known = "known",
56
- /** Not fully known origin */
57
- Unknown = "unknown"
30
+ /** The calls that declare the entries of a {@link LinkedInputObject}, and where they carry the entry's name. */
31
+ export interface LinkedInputDeclaration {
32
+ /** the declaring calls, e.g. shiny's `textInput`, `selectInput`, … */
33
+ readonly calls: readonly Identifier[];
34
+ /** the name of the argument holding the entry's name */
35
+ readonly argName: string;
36
+ /** the index of that argument when it is passed positionally */
37
+ readonly argIdx: number;
38
+ }
39
+ /**
40
+ * A call a framework is given a function through, binding its parameters *by position* - which is how R passes
41
+ * them, so this catches a `shinyApp(ui, function(i, o, s))` that no name-based rule can.
42
+ */
43
+ export interface LinkedInputEntryPoint {
44
+ /** the call taking the function, e.g. `shiny::shinyApp` */
45
+ readonly call: Identifier;
46
+ /** the name of the argument holding the function */
47
+ readonly argName: string;
48
+ /** the index of that argument when it is passed positionally */
49
+ readonly argIdx: number;
50
+ /** which {@link LinkedInputObject} the framework binds to each parameter, by position; `undefined` leaves one alone */
51
+ readonly params: readonly (string | undefined)[];
58
52
  }
59
53
  /**
60
54
  * Scalar R constant values representable in TypeScript.
@@ -72,10 +66,15 @@ export interface InputSource extends MergeableRecord {
72
66
  trace: InputTraceType;
73
67
  /** if the trace is affected by control dependencies, they are classified too, this is a duplicate free array */
74
68
  cds?: InputType[];
75
- /** argument name when this source originates from a named argument of the criterion function call */
69
+ /**
70
+ * Argument name when this source originates from a named argument of the criterion function call,
71
+ * or the accessed field when it originates from a {@link LinkedInputObject} (e.g. `n` for `input$n`).
72
+ */
76
73
  name?: string;
77
74
  /** the concrete scalar value when the source is a constant or a pure alias of one */
78
75
  value?: ConstantValue;
76
+ /** where the framework entry this source reads is declared, e.g. the `textInput("n", …)` behind an `input$n` */
77
+ declaredAt?: NodeId[];
79
78
  }
80
79
  /**
81
80
  * Map of input sources, keyed by the node id of the input source. Each input source is classified with an {@link InputSource} object.
@@ -94,6 +93,16 @@ export interface InputClassifierConfig<Functions extends InputClassifierFunction
94
93
  * Functions which are considered to be pure (i.e., deterministic, trusted, safe, idempotent on the lub of the input types)
95
94
  */
96
95
  [InputTraceType.Pure]?: Functions;
96
+ /**
97
+ * Objects provided by a framework rather than by the code itself, like shiny's `input`.
98
+ * @see {@link LinkedInputObject}
99
+ */
100
+ linkedObjects?: readonly LinkedInputObject[];
101
+ /**
102
+ * Calls that hand a function to a framework, which then binds {@link linkedObjects} to its parameters by position.
103
+ * @see {@link LinkedInputEntryPoint}
104
+ */
105
+ linkedEntryPoints?: readonly LinkedInputEntryPoint[];
97
106
  }
98
107
  /**
99
108
  * Takes the given id which is expected to either be:
@@ -101,6 +110,7 @@ export interface InputClassifierConfig<Functions extends InputClassifierFunction
101
110
  * - anything else - in that case the node itself is considered as an "input" - please note that in these scenarios the *return* value will only contain one mapping - that for the id you passed in.
102
111
  *
103
112
  * This method traces the dependencies in the dataflow graph using the specification of functions passed in.
104
- * For the scope escape analysis, pass on the full, non-reduced DFG as `fullDfg`.
113
+ * For the scope escape analysis, pass on the full, non-reduced DFG as `fullDfg`, and the packages attached in the
114
+ * program as `packages` so that bare calls only match the entries of packages that are actually in scope.
105
115
  */
106
- export declare function classifyInput(id: NodeId, dfg: DataflowGraph, config: InputClassifierConfig<InputClassifierFunctionIdentifiers>, fullDfg?: DataflowGraph): InputSources;
116
+ export declare function classifyInput(id: NodeId, dfg: DataflowGraph, config: InputClassifierConfig<InputClassifierFunctionIdentifiers>, fullDfg?: DataflowGraph, packages?: ReadonlySet<string>): InputSources;