@eagleoutice/flowr 2.9.12 → 2.9.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/README.md +35 -23
  2. package/abstract-interpretation/absint-visitor.d.ts +1 -1
  3. package/abstract-interpretation/absint-visitor.js +20 -20
  4. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -2
  5. package/benchmark/slicer.d.ts +5 -3
  6. package/benchmark/slicer.js +26 -10
  7. package/benchmark/stats/print.js +12 -0
  8. package/benchmark/stats/stats.d.ts +3 -2
  9. package/benchmark/stats/stats.js +1 -1
  10. package/benchmark/summarizer/data.d.ts +1 -0
  11. package/benchmark/summarizer/second-phase/process.js +5 -0
  12. package/cli/benchmark-app.d.ts +1 -0
  13. package/cli/benchmark-app.js +1 -0
  14. package/cli/benchmark-helper-app.d.ts +2 -1
  15. package/cli/benchmark-helper-app.js +6 -3
  16. package/cli/common/options.d.ts +8 -0
  17. package/cli/common/options.js +3 -1
  18. package/cli/common/scripts-info.d.ts +8 -0
  19. package/cli/export-quads-app.js +1 -1
  20. package/cli/flowr.js +3 -3
  21. package/cli/repl/commands/repl-dataflow.js +5 -5
  22. package/cli/repl/core.d.ts +3 -3
  23. package/cli/repl/parser/slice-query-parser.d.ts +1 -1
  24. package/cli/repl/parser/slice-query-parser.js +2 -2
  25. package/cli/repl/server/connection.d.ts +2 -2
  26. package/cli/repl/server/connection.js +2 -2
  27. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  28. package/cli/repl/server/messages/message-slice.js +2 -2
  29. package/cli/repl/server/server.d.ts +2 -2
  30. package/cli/script-core/statistics-core.d.ts +2 -2
  31. package/cli/script-core/statistics-helper-core.d.ts +2 -2
  32. package/cli/script-core/statistics-helper-core.js +1 -1
  33. package/cli/slicer-app.js +2 -2
  34. package/cli/statistics-app.js +1 -1
  35. package/cli/statistics-helper-app.js +1 -1
  36. package/cli/wiki.js +2 -2
  37. package/config.d.ts +65 -24
  38. package/config.js +197 -161
  39. package/control-flow/extract-cfg.js +7 -10
  40. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  41. package/control-flow/semantic-cfg-guided-visitor.js +43 -43
  42. package/control-flow/useless-loop.d.ts +1 -1
  43. package/control-flow/useless-loop.js +3 -3
  44. package/core/print/dataflow-printer.d.ts +0 -14
  45. package/core/print/dataflow-printer.js +0 -21
  46. package/core/steps/all/core/20-dataflow.d.ts +3 -3
  47. package/core/steps/all/core/20-dataflow.js +3 -2
  48. package/core/steps/all/static-slicing/00-slice.d.ts +2 -5
  49. package/core/steps/all/static-slicing/00-slice.js +6 -8
  50. package/core/steps/pipeline/default-pipelines.d.ts +89 -89
  51. package/core/steps/pipeline-step.d.ts +2 -2
  52. package/dataflow/environments/built-in-proc-name.d.ts +83 -0
  53. package/dataflow/environments/built-in-proc-name.js +88 -0
  54. package/dataflow/environments/built-in.d.ts +1 -83
  55. package/dataflow/environments/built-in.js +37 -120
  56. package/dataflow/environments/default-builtin-config.d.ts +1 -1
  57. package/dataflow/environments/default-builtin-config.js +75 -75
  58. package/dataflow/environments/identifier.d.ts +1 -0
  59. package/dataflow/environments/identifier.js +1 -0
  60. package/dataflow/eval/resolve/alias-tracking.js +12 -15
  61. package/dataflow/eval/resolve/resolve.js +2 -2
  62. package/dataflow/fn/exceptions-of-function.d.ts +1 -1
  63. package/dataflow/fn/exceptions-of-function.js +2 -2
  64. package/dataflow/graph/call-graph.d.ts +49 -19
  65. package/dataflow/graph/call-graph.js +117 -114
  66. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  67. package/dataflow/graph/dataflowgraph-builder.js +2 -2
  68. package/dataflow/graph/df-helper.d.ts +132 -0
  69. package/dataflow/graph/df-helper.js +131 -0
  70. package/dataflow/graph/diff-dataflow-graph.d.ts +5 -10
  71. package/dataflow/graph/diff-dataflow-graph.js +3 -28
  72. package/dataflow/graph/edge.d.ts +1 -0
  73. package/dataflow/graph/edge.js +1 -0
  74. package/dataflow/graph/graph-helper.d.ts +55 -0
  75. package/dataflow/graph/graph-helper.js +105 -0
  76. package/dataflow/graph/graph.d.ts +6 -1
  77. package/dataflow/graph/graph.js +14 -9
  78. package/dataflow/graph/vertex.d.ts +1 -1
  79. package/dataflow/info.d.ts +14 -4
  80. package/dataflow/info.js +28 -16
  81. package/dataflow/internal/linker.d.ts +14 -10
  82. package/dataflow/internal/linker.js +29 -32
  83. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -5
  84. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +4 -4
  85. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +7 -6
  86. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  87. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +5 -5
  88. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +2 -2
  89. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -2
  90. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +4 -4
  91. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
  92. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
  93. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +2 -2
  94. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  95. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -1
  96. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -5
  97. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  98. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
  99. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  100. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -5
  101. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
  102. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
  103. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
  104. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
  105. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +3 -3
  106. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  107. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  108. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +7 -7
  109. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
  110. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +23 -12
  111. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
  112. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +2 -2
  113. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -9
  114. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
  115. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -2
  116. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -2
  117. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  118. package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
  119. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
  120. package/dataflow/internal/process/process-uninteresting-leaf.d.ts +1 -1
  121. package/dataflow/internal/process/process-uninteresting-leaf.js +1 -1
  122. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  123. package/dataflow/origin/dfg-get-symbol-refs.js +6 -6
  124. package/documentation/doc-readme.js +2 -2
  125. package/documentation/doc-util/doc-dfg.d.ts +3 -0
  126. package/documentation/doc-util/doc-dfg.js +5 -7
  127. package/documentation/doc-util/doc-normalized-ast.d.ts +0 -6
  128. package/documentation/doc-util/doc-normalized-ast.js +0 -23
  129. package/documentation/doc-util/doc-structure.js +3 -3
  130. package/documentation/doc-util/doc-types.js +3 -3
  131. package/documentation/wiki-analyzer.js +7 -5
  132. package/documentation/wiki-core.js +6 -7
  133. package/documentation/wiki-dataflow-graph.js +15 -13
  134. package/documentation/wiki-interface.js +8 -6
  135. package/documentation/wiki-linter.js +6 -5
  136. package/documentation/wiki-mk/doc-context.js +3 -4
  137. package/documentation/wiki-normalized-ast.js +5 -4
  138. package/documentation/wiki-query.js +28 -3
  139. package/engines.d.ts +2 -2
  140. package/engines.js +4 -4
  141. package/linter/linter-rules.d.ts +24 -1
  142. package/linter/linter-rules.js +3 -1
  143. package/linter/rules/dataframe-access-validation.js +5 -5
  144. package/linter/rules/naming-convention.d.ts +1 -1
  145. package/linter/rules/naming-convention.js +7 -3
  146. package/linter/rules/seeded-randomness.js +2 -2
  147. package/linter/rules/stop-with-call-arg.d.ts +35 -0
  148. package/linter/rules/stop-with-call-arg.js +72 -0
  149. package/linter/rules/useless-loop.d.ts +1 -1
  150. package/package.json +3 -1
  151. package/project/cache/flowr-analyzer-cache.d.ts +1 -1
  152. package/project/cache/flowr-analyzer-cache.js +1 -1
  153. package/project/context/flowr-analyzer-context.d.ts +6 -6
  154. package/project/context/flowr-analyzer-context.js +2 -2
  155. package/project/context/flowr-analyzer-files-context.d.ts +2 -2
  156. package/project/context/flowr-analyzer-files-context.js +28 -8
  157. package/project/flowr-analyzer-builder.d.ts +13 -6
  158. package/project/flowr-analyzer-builder.js +12 -3
  159. package/project/flowr-analyzer.d.ts +4 -4
  160. package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +2 -2
  161. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
  162. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -2
  163. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  164. package/queries/catalog/config-query/config-query-format.d.ts +5 -5
  165. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
  166. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
  167. package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -2
  168. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
  169. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -2
  170. package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
  171. package/queries/catalog/files-query/files-query-format.d.ts +3 -3
  172. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  173. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +1 -1
  174. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
  175. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
  176. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
  177. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
  178. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
  179. package/queries/catalog/linter-query/linter-query-format.d.ts +3 -3
  180. package/queries/catalog/location-map-query/location-map-query-executor.js +2 -2
  181. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
  182. package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
  183. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  184. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
  185. package/queries/catalog/provenance-query/provenance-query-executor.d.ts +9 -0
  186. package/queries/catalog/provenance-query/provenance-query-executor.js +37 -0
  187. package/queries/catalog/provenance-query/provenance-query-format.d.ts +35 -0
  188. package/queries/catalog/provenance-query/provenance-query-format.js +62 -0
  189. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -4
  190. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -2
  191. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -0
  192. package/queries/catalog/search-query/search-query-format.js +1 -1
  193. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -2
  194. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -4
  195. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -3
  196. package/queries/query.d.ts +27 -19
  197. package/queries/query.js +2 -0
  198. package/r-bridge/lang-4.x/ast/model/model.d.ts +13 -2
  199. package/r-bridge/lang-4.x/ast/model/model.js +20 -1
  200. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +8 -1
  201. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +13 -0
  202. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -2
  203. package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -2
  204. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -2
  205. package/search/flowr-search-filters.d.ts +1 -1
  206. package/search/flowr-search-printer.js +3 -3
  207. package/search/search-executor/search-enrichers.js +2 -2
  208. package/search/search-executor/search-generators.js +1 -1
  209. package/slicing/criterion/parse.d.ts +40 -16
  210. package/slicing/criterion/parse.js +67 -63
  211. package/slicing/static/slicer-types.d.ts +2 -3
  212. package/slicing/static/static-slicer.d.ts +3 -4
  213. package/slicing/static/static-slicer.js +9 -12
  214. package/statistics/statistics.d.ts +2 -2
  215. package/util/diff.d.ts +2 -2
  216. package/util/mermaid/ast.js +4 -4
  217. package/util/mermaid/cfg.js +5 -5
  218. package/util/mermaid/dfg.d.ts +33 -18
  219. package/util/mermaid/dfg.js +46 -31
  220. package/util/mermaid/mermaid.d.ts +57 -12
  221. package/util/mermaid/mermaid.js +74 -67
  222. package/util/objects.d.ts +12 -0
  223. package/util/objects.js +28 -0
  224. package/util/range.d.ts +8 -0
  225. package/util/range.js +13 -1
  226. package/util/slice-direction.d.ts +7 -0
  227. package/util/slice-direction.js +12 -0
  228. package/util/summarizer.js +1 -1
  229. package/util/version.js +1 -1
  230. package/dataflow/graph/invert-dfg.d.ts +0 -6
  231. package/dataflow/graph/invert-dfg.js +0 -20
  232. package/dataflow/graph/resolve-graph.d.ts +0 -8
  233. package/dataflow/graph/resolve-graph.js +0 -59
@@ -1,14 +1,59 @@
1
1
  /**
2
- * Escapes markdown special characters in a string.
2
+ * Global mermaid helper object with useful functions.
3
3
  */
4
- export declare function escapeMarkdown(text: string): string;
5
- /**
6
- * Escapes a string or number to be used as a mermaid node id.
7
- */
8
- export declare function escapeId(text: string | number): string;
9
- /**
10
- * Converts mermaid code (potentially produced by {@link graphToMermaid}) to an url that presents the graph in the mermaid editor.
11
- * @param code - code to convert
12
- * @param edit - if true, the url will point to the editor, otherwise it will point to the viewer
13
- */
14
- export declare function mermaidCodeToUrl(code: string, edit?: boolean): string;
4
+ export declare const Mermaid: {
5
+ readonly name: "Mermaid";
6
+ /**
7
+ * Replacements applied by escape functions!
8
+ */
9
+ readonly replacements: {
10
+ readonly '\\n': "\n";
11
+ readonly '`': "#96;";
12
+ readonly '[': "#91;";
13
+ readonly ']': "#93;";
14
+ readonly '<': "#60;";
15
+ readonly '>': "#62;";
16
+ readonly '*': "#42;";
17
+ readonly '+': "#43;";
18
+ readonly '-': "#45;";
19
+ readonly '"': "#34;";
20
+ readonly '\\': "#92;";
21
+ readonly _: "#95;";
22
+ readonly '{': "#123;";
23
+ readonly '}': "#125;";
24
+ readonly '&': "#38;";
25
+ readonly '\'': "#39;";
26
+ readonly ':': "#58;";
27
+ readonly '\u2228': "#8744;";
28
+ readonly '\u2227': "#8743;";
29
+ readonly '\u00AC': "#172;";
30
+ readonly '\u2192': "#8594;";
31
+ readonly '\u2194': "#8596;";
32
+ readonly '\u21D2': "#8658;";
33
+ readonly '\u21D4': "#8660;";
34
+ readonly '\u2200': "#8704;";
35
+ readonly '\u2203': "#8707;";
36
+ readonly '\u2208': "#8712;";
37
+ readonly '\u2209': "#8713;";
38
+ readonly '\u220B': "#8715;";
39
+ readonly '\u220C': "#8716;";
40
+ readonly '\u2229': "#8745;";
41
+ readonly '\u222A': "#8746;";
42
+ readonly '\u222B': "#8747;";
43
+ readonly '\u2295': "#8853;";
44
+ };
45
+ /**
46
+ * Escapes markdown special characters in a string.
47
+ */
48
+ readonly escape: (this: void, text: string) => string;
49
+ /**
50
+ * Escapes a string or number to be used as a mermaid node id.
51
+ */
52
+ readonly escapeId: (this: void, text: string | number) => string;
53
+ /**
54
+ * Converts mermaid code (potentially produced by {@link DataflowMermaid.convert}) to an url that presents the graph in the mermaid editor.
55
+ * @param code - code to convert
56
+ * @param edit - if true, the url will point to the editor, otherwise it will point to the viewer
57
+ */
58
+ readonly codeToUrl: (this: void, code: string, edit?: boolean) => string;
59
+ };
@@ -1,73 +1,80 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.escapeMarkdown = escapeMarkdown;
4
- exports.escapeId = escapeId;
5
- exports.mermaidCodeToUrl = mermaidCodeToUrl;
6
- const replacements = {
7
- // keep newlines
8
- '\\n': '\n',
9
- '`': '#96;',
10
- '[': '#91;',
11
- ']': '#93;',
12
- '<': '#60;',
13
- '>': '#62;',
14
- '*': '#42;',
15
- '+': '#43;',
16
- '-': '#45;',
17
- '"': '#34;',
18
- '\\': '#92;',
19
- '_': '#95;',
20
- '{': '#123;',
21
- '}': '#125;',
22
- '&': '#38;',
23
- '\'': '#39;',
24
- ':': '#58;',
25
- '∨': '#8744;',
26
- '∧': '#8743;',
27
- '¬': '#172;',
28
- '→': '#8594;',
29
- '↔': '#8596;',
30
- '⇒': '#8658;',
31
- '⇔': '#8660;',
32
- '∀': '#8704;',
33
- '∃': '#8707;',
34
- '∈': '#8712;',
35
- '∉': '#8713;',
36
- '∋': '#8715;',
37
- '∌': '#8716;',
38
- '∩': '#8745;',
39
- '∪': '#8746;',
40
- '∫': '#8747;',
41
- '⊕': '#8853;',
42
- };
43
- /**
44
- * Escapes markdown special characters in a string.
45
- */
46
- function escapeMarkdown(text) {
47
- for (const [key, value] of Object.entries(replacements)) {
48
- text = text.replaceAll(key, value);
49
- }
50
- return text;
51
- }
3
+ exports.Mermaid = void 0;
52
4
  /**
53
- * Escapes a string or number to be used as a mermaid node id.
5
+ * Global mermaid helper object with useful functions.
54
6
  */
55
- function escapeId(text) {
56
- text = String(text).replace(/[^a-zA-Z0-9:-]/g, '_');
57
- return text;
58
- }
59
- /**
60
- * Converts mermaid code (potentially produced by {@link graphToMermaid}) to an url that presents the graph in the mermaid editor.
61
- * @param code - code to convert
62
- * @param edit - if true, the url will point to the editor, otherwise it will point to the viewer
63
- */
64
- function mermaidCodeToUrl(code, edit = false) {
65
- const obj = {
66
- code,
67
- mermaid: {
68
- autoSync: true
7
+ exports.Mermaid = {
8
+ name: 'Mermaid',
9
+ /**
10
+ * Replacements applied by escape functions!
11
+ */
12
+ replacements: {
13
+ // keep newlines
14
+ '\\n': '\n',
15
+ '`': '#96;',
16
+ '[': '#91;',
17
+ ']': '#93;',
18
+ '<': '#60;',
19
+ '>': '#62;',
20
+ '*': '#42;',
21
+ '+': '#43;',
22
+ '-': '#45;',
23
+ '"': '#34;',
24
+ '\\': '#92;',
25
+ '_': '#95;',
26
+ '{': '#123;',
27
+ '}': '#125;',
28
+ '&': '#38;',
29
+ '\'': '#39;',
30
+ ':': '#58;',
31
+ '∨': '#8744;',
32
+ '∧': '#8743;',
33
+ '¬': '#172;',
34
+ '→': '#8594;',
35
+ '↔': '#8596;',
36
+ '⇒': '#8658;',
37
+ '⇔': '#8660;',
38
+ '∀': '#8704;',
39
+ '∃': '#8707;',
40
+ '∈': '#8712;',
41
+ '∉': '#8713;',
42
+ '∋': '#8715;',
43
+ '∌': '#8716;',
44
+ '∩': '#8745;',
45
+ '∪': '#8746;',
46
+ '∫': '#8747;',
47
+ '⊕': '#8853;',
48
+ },
49
+ /**
50
+ * Escapes markdown special characters in a string.
51
+ */
52
+ escape(text) {
53
+ for (const [key, value] of Object.entries(exports.Mermaid.replacements)) {
54
+ text = text.replaceAll(key, value);
69
55
  }
70
- };
71
- return `https://mermaid.live/${edit ? 'edit' : 'view'}#base64:${Buffer.from(JSON.stringify(obj)).toString('base64')}`;
72
- }
56
+ return text;
57
+ },
58
+ /**
59
+ * Escapes a string or number to be used as a mermaid node id.
60
+ */
61
+ escapeId(text) {
62
+ text = String(text).replace(/[^a-zA-Z0-9:-]/g, '_');
63
+ return text;
64
+ },
65
+ /**
66
+ * Converts mermaid code (potentially produced by {@link DataflowMermaid.convert}) to an url that presents the graph in the mermaid editor.
67
+ * @param code - code to convert
68
+ * @param edit - if true, the url will point to the editor, otherwise it will point to the viewer
69
+ */
70
+ codeToUrl(code, edit = false) {
71
+ const obj = {
72
+ code,
73
+ mermaid: {
74
+ autoSync: true
75
+ }
76
+ };
77
+ return `https://mermaid.live/${edit ? 'edit' : 'view'}#base64:${Buffer.from(JSON.stringify(obj)).toString('base64')}`;
78
+ }
79
+ };
73
80
  //# sourceMappingURL=mermaid.js.map
package/util/objects.d.ts CHANGED
@@ -32,4 +32,16 @@ type DefinedRecord<T> = {
32
32
  export declare function compactRecord<T extends Record<string, unknown>>(record: T): DefinedRecord<T>;
33
33
  export declare function compactRecord(record: undefined): undefined;
34
34
  export declare function compactRecord<T extends Record<string, unknown>>(record: T | undefined): DefinedRecord<T> | undefined;
35
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | Function;
36
+ /**
37
+ * Given an object type `T`, produces a union of string literal types representing all possible paths to primitive values within that object.
38
+ * Sadly, right now, the ts-essential paths property breaks when it comes to deeper nested objects
39
+ */
40
+ export type AutocompletablePaths<T, Prefix extends string = ''> = T extends Primitive | readonly unknown[] ? never : {
41
+ [K in keyof T & string]: `${Prefix}${K}` | (T[K] extends Primitive | readonly unknown[] ? never : AutocompletablePaths<T[K], `${Prefix}${K}.`>);
42
+ }[keyof T & string];
43
+ /**
44
+ * This is a version of a deep clone that preserves unclonable values (like functions, symbols, ...) by keeping the same reference to them.
45
+ */
46
+ export declare function deepClonePreserveUnclonable<T>(obj: T): T;
35
47
  export {};
package/util/objects.js CHANGED
@@ -4,6 +4,7 @@ exports.isObjectOrArray = isObjectOrArray;
4
4
  exports.deepMergeObject = deepMergeObject;
5
5
  exports.deepMergeObjectInPlace = deepMergeObjectInPlace;
6
6
  exports.compactRecord = compactRecord;
7
+ exports.deepClonePreserveUnclonable = deepClonePreserveUnclonable;
7
8
  const json_1 = require("./json");
8
9
  /**
9
10
  * checks if `item` is an object (it may be an array, ...)
@@ -100,4 +101,31 @@ function compactRecord(record) {
100
101
  }
101
102
  return result;
102
103
  }
104
+ /**
105
+ * This is a version of a deep clone that preserves unclonable values (like functions, symbols, ...) by keeping the same reference to them.
106
+ */
107
+ function deepClonePreserveUnclonable(obj) {
108
+ if (typeof obj !== 'object' || obj === null) {
109
+ return obj;
110
+ }
111
+ else if (Array.isArray(obj)) {
112
+ return obj.map(deepClonePreserveUnclonable);
113
+ }
114
+ else if (obj instanceof Date) {
115
+ return new Date(obj.getTime());
116
+ }
117
+ else if (obj instanceof Map) {
118
+ return new Map(obj.entries().map(([k, v]) => [deepClonePreserveUnclonable(k), deepClonePreserveUnclonable(v)]));
119
+ }
120
+ else if (obj instanceof Set) {
121
+ return new Set(obj.values().map(deepClonePreserveUnclonable));
122
+ }
123
+ else {
124
+ const result = {};
125
+ for (const key of Object.keys(obj)) {
126
+ result[key] = deepClonePreserveUnclonable(obj[key]);
127
+ }
128
+ return result;
129
+ }
130
+ }
103
131
  //# sourceMappingURL=objects.js.map
package/util/range.d.ts CHANGED
@@ -31,6 +31,14 @@ export declare const SourcePosition: {
31
31
  * returns an invalid source position
32
32
  */
33
33
  readonly invalid: (this: void) => SourcePosition;
34
+ /**
35
+ * Returns the line of a source position
36
+ */
37
+ readonly getLine: (this: void, pos: SourcePosition) => number;
38
+ /**
39
+ * Returns the column of a source position
40
+ */
41
+ readonly getColumn: (this: void, pos: SourcePosition) => number;
34
42
  };
35
43
  /**
36
44
  * **Please note** that for multi-file projects we also have a {@link SourceLocation|source location} type that includes the file name.
package/util/range.js CHANGED
@@ -31,7 +31,19 @@ exports.SourcePosition = {
31
31
  */
32
32
  invalid() {
33
33
  return [-1, -1];
34
- }
34
+ },
35
+ /**
36
+ * Returns the line of a source position
37
+ */
38
+ getLine(pos) {
39
+ return pos[0];
40
+ },
41
+ /**
42
+ * Returns the column of a source position
43
+ */
44
+ getColumn(pos) {
45
+ return pos[1];
46
+ },
35
47
  };
36
48
  /**
37
49
  * Utility functions for {@link SourceRange|source ranges}.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The direction to slice a program.
3
+ */
4
+ export declare enum SliceDirection {
5
+ Backward = "backward",
6
+ Forward = "forward"
7
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SliceDirection = void 0;
4
+ /**
5
+ * The direction to slice a program.
6
+ */
7
+ var SliceDirection;
8
+ (function (SliceDirection) {
9
+ SliceDirection["Backward"] = "backward";
10
+ SliceDirection["Forward"] = "forward";
11
+ })(SliceDirection || (exports.SliceDirection = SliceDirection = {}));
12
+ //# sourceMappingURL=slice-direction.js.map
@@ -34,7 +34,7 @@ function summarizeMeasurement(data, totalNumberOfDataPoints) {
34
34
  // just to avoid in-place modification
35
35
  const sorted = [...data].sort((a, b) => a - b);
36
36
  const min = sorted[0];
37
- const max = sorted[sorted.length - 1];
37
+ const max = sorted.at(-1);
38
38
  const median = sorted[Math.floor(sorted.length / 2)];
39
39
  const total = (0, arrays_1.arraySum)(sorted);
40
40
  const length = totalNumberOfDataPoints ?? sorted.length;
package/util/version.js CHANGED
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
6
6
  const semver_1 = require("semver");
7
7
  const assert_1 = require("./assert");
8
8
  // this is automatically replaced with the current version by release-it
9
- const version = '2.9.12';
9
+ const version = '2.9.14';
10
10
  /**
11
11
  * Retrieves the current flowR version as a new {@link SemVer} object.
12
12
  */
@@ -1,6 +0,0 @@
1
- import { DataflowGraph } from './graph';
2
- import type { REnvironmentInformation } from '../environments/environment';
3
- /**
4
- * Inverts the given dataflow graph by reversing all edges.
5
- */
6
- export declare function invertDfg(graph: DataflowGraph, cleanEnv: REnvironmentInformation): DataflowGraph;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invertDfg = invertDfg;
4
- const graph_1 = require("./graph");
5
- /**
6
- * Inverts the given dataflow graph by reversing all edges.
7
- */
8
- function invertDfg(graph, cleanEnv) {
9
- const invertedGraph = new graph_1.DataflowGraph(graph.idMap);
10
- for (const [, v] of graph.vertices(true)) {
11
- invertedGraph.addVertex(v, cleanEnv);
12
- }
13
- for (const [from, targets] of graph.edges()) {
14
- for (const [to, { types }] of targets) {
15
- invertedGraph.addEdge(to, from, types);
16
- }
17
- }
18
- return invertedGraph;
19
- }
20
- //# sourceMappingURL=invert-dfg.js.map
@@ -1,8 +0,0 @@
1
- import { DataflowGraph } from './graph';
2
- import { type AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
- import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
4
- /**
5
- * Resolves the dataflow graph ids from slicing criterion form to ids.
6
- * This returns a **new** graph with the resolved ids.
7
- */
8
- export declare function resolveDataflowGraph(graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext, idMap?: AstIdMap): DataflowGraph;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveDataflowGraph = resolveDataflowGraph;
4
- const graph_1 = require("./graph");
5
- const assert_1 = require("../../util/assert");
6
- const parse_1 = require("../../slicing/criterion/parse");
7
- const edge_1 = require("./edge");
8
- /**
9
- * Resolves the dataflow graph ids from slicing criterion form to ids.
10
- * This returns a **new** graph with the resolved ids.
11
- */
12
- function resolveDataflowGraph(graph, ctx, idMap) {
13
- const resolveMap = idMap ?? graph.idMap;
14
- (0, assert_1.guard)(resolveMap !== undefined, 'idMap must be provided to resolve the graph');
15
- const cache = new Map();
16
- const resolve = (id) => {
17
- const cached = cache.get(id);
18
- if (cached !== undefined) {
19
- return cached;
20
- }
21
- let resolved;
22
- try {
23
- resolved = (0, parse_1.slicingCriterionToId)(id, resolveMap);
24
- }
25
- catch {
26
- /* just keep it :D */
27
- resolved = id;
28
- }
29
- cache.set(id, resolved);
30
- return resolved;
31
- };
32
- const resultGraph = new graph_1.DataflowGraph(resolveMap);
33
- const roots = graph.rootIds();
34
- /* recreate vertices */
35
- for (const [id, vertex] of graph.vertices(true)) {
36
- resultGraph.addVertex({
37
- ...vertex,
38
- id: resolve(id)
39
- }, ctx.env.makeCleanEnv(), roots.has(id));
40
- }
41
- /* recreate edges */
42
- for (const [from, targets] of graph.edges()) {
43
- for (const [to, info] of targets) {
44
- for (const type of edge_1.DfEdge.splitTypes(info)) {
45
- resultGraph.addEdge(resolve(from), resolve(to), type);
46
- }
47
- }
48
- }
49
- for (const unknown of graph.unknownSideEffects) {
50
- if (typeof unknown === 'object') {
51
- resultGraph.markIdForUnknownSideEffects(resolve(unknown.id), unknown.linkTo);
52
- }
53
- else {
54
- resultGraph.markIdForUnknownSideEffects(resolve(unknown));
55
- }
56
- }
57
- return resultGraph;
58
- }
59
- //# sourceMappingURL=resolve-graph.js.map