@eagleoutice/flowr 1.3.14 → 1.4.2

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 (309) hide show
  1. package/README.md +3 -3
  2. package/abstract-interpretation/domain.d.ts +27 -0
  3. package/abstract-interpretation/domain.js +146 -0
  4. package/abstract-interpretation/handler/binop/binop.d.ts +16 -0
  5. package/abstract-interpretation/handler/binop/binop.js +40 -0
  6. package/abstract-interpretation/handler/binop/operators.d.ts +2 -0
  7. package/abstract-interpretation/handler/binop/operators.js +42 -0
  8. package/abstract-interpretation/handler/handler.d.ts +6 -0
  9. package/abstract-interpretation/handler/handler.js +3 -0
  10. package/abstract-interpretation/processor.d.ts +10 -0
  11. package/abstract-interpretation/processor.js +84 -0
  12. package/benchmark/slicer.d.ts +6 -8
  13. package/benchmark/slicer.js +5 -15
  14. package/benchmark/stats/print.d.ts +1 -1
  15. package/benchmark/stats/print.js +0 -2
  16. package/benchmark/stats/stats.d.ts +3 -4
  17. package/benchmark/stats/stats.js +1 -1
  18. package/cli/benchmark-app.d.ts +1 -0
  19. package/cli/benchmark-app.js +21 -6
  20. package/cli/benchmark-helper-app.d.ts +2 -0
  21. package/cli/benchmark-helper-app.js +15 -6
  22. package/cli/common/features.d.ts +1 -1
  23. package/cli/common/options.d.ts +1 -1
  24. package/cli/common/options.js +4 -1
  25. package/cli/common/script.d.ts +1 -1
  26. package/cli/common/scripts-info.d.ts +3 -2
  27. package/cli/common/scripts-info.js +15 -1
  28. package/cli/export-quads-app.js +1 -5
  29. package/cli/repl/commands/cfg.d.ts +1 -1
  30. package/cli/repl/commands/cfg.js +3 -3
  31. package/cli/repl/commands/commands.d.ts +4 -2
  32. package/cli/repl/commands/commands.js +67 -28
  33. package/cli/repl/commands/dataflow.d.ts +1 -1
  34. package/cli/repl/commands/dataflow.js +2 -2
  35. package/cli/repl/commands/execute.d.ts +2 -2
  36. package/cli/repl/commands/main.d.ts +2 -2
  37. package/cli/repl/commands/normalize.d.ts +1 -1
  38. package/cli/repl/commands/normalize.js +2 -2
  39. package/cli/repl/commands/parse.d.ts +1 -1
  40. package/cli/repl/commands/parse.js +12 -12
  41. package/cli/repl/commands/quit.d.ts +1 -1
  42. package/cli/repl/commands/quit.js +4 -1
  43. package/cli/repl/commands/version.d.ts +1 -1
  44. package/cli/repl/core.d.ts +5 -3
  45. package/cli/repl/core.js +63 -7
  46. package/cli/repl/execute.d.ts +1 -1
  47. package/cli/repl/execute.js +3 -3
  48. package/cli/repl/server/connection.d.ts +2 -2
  49. package/cli/repl/server/connection.js +4 -8
  50. package/cli/repl/server/messages/analysis.d.ts +3 -3
  51. package/cli/repl/server/messages/analysis.js +12 -32
  52. package/cli/repl/server/messages/error.d.ts +1 -1
  53. package/cli/repl/server/messages/hello.d.ts +2 -2
  54. package/cli/repl/server/messages/messages.d.ts +5 -5
  55. package/cli/repl/server/messages/repl.d.ts +1 -1
  56. package/cli/repl/server/messages/slice.d.ts +3 -3
  57. package/cli/repl/server/net.d.ts +16 -0
  58. package/cli/repl/server/net.js +42 -3
  59. package/cli/repl/server/send.d.ts +2 -2
  60. package/cli/repl/server/server.d.ts +2 -2
  61. package/cli/repl/server/validate.d.ts +3 -3
  62. package/cli/statistics-helper-app.js +2 -3
  63. package/cli/summarizer-app.js +1 -2
  64. package/config.d.ts +16 -0
  65. package/config.js +75 -0
  66. package/core/input.d.ts +5 -5
  67. package/core/output.d.ts +1 -1
  68. package/core/print/dataflow-printer.d.ts +3 -3
  69. package/core/print/normalize-printer.d.ts +2 -2
  70. package/core/print/parse-printer.d.ts +2 -3
  71. package/core/print/parse-printer.js +6 -4
  72. package/core/print/print.d.ts +1 -1
  73. package/core/print/slice-diff-ansi.d.ts +1 -1
  74. package/core/slicer.d.ts +5 -4
  75. package/core/slicer.js +2 -2
  76. package/core/steps.d.ts +10 -9
  77. package/core/steps.js +5 -4
  78. package/dataflow/environments/append.d.ts +1 -1
  79. package/dataflow/environments/environment.d.ts +4 -4
  80. package/dataflow/environments/environment.js +8 -0
  81. package/dataflow/environments/overwrite.d.ts +1 -1
  82. package/dataflow/environments/register.d.ts +2 -2
  83. package/dataflow/environments/register.js +1 -0
  84. package/dataflow/environments/resolve-by-name.d.ts +2 -2
  85. package/dataflow/environments/scoping.d.ts +1 -1
  86. package/dataflow/extractor.d.ts +5 -5
  87. package/dataflow/extractor.js +10 -2
  88. package/dataflow/graph/diff.d.ts +3 -3
  89. package/dataflow/graph/graph.d.ts +8 -7
  90. package/dataflow/graph/quads.d.ts +2 -2
  91. package/dataflow/graph/vertex.d.ts +5 -5
  92. package/dataflow/internal/info.d.ts +2 -2
  93. package/dataflow/internal/linker.d.ts +3 -3
  94. package/dataflow/internal/process/access.d.ts +3 -3
  95. package/dataflow/internal/process/expression-list.d.ts +3 -3
  96. package/dataflow/internal/process/expression-list.js +0 -4
  97. package/dataflow/internal/process/functions/argument.d.ts +4 -4
  98. package/dataflow/internal/process/functions/exit-points.d.ts +1 -1
  99. package/dataflow/internal/process/functions/function-call.d.ts +3 -3
  100. package/dataflow/internal/process/functions/function-call.js +7 -1
  101. package/dataflow/internal/process/functions/function-definition.d.ts +3 -3
  102. package/dataflow/internal/process/functions/parameter.d.ts +3 -3
  103. package/dataflow/internal/process/functions/source.d.ts +8 -0
  104. package/dataflow/internal/process/functions/source.js +81 -0
  105. package/dataflow/internal/process/if-then-else.d.ts +3 -3
  106. package/dataflow/internal/process/loops/for-loop.d.ts +3 -3
  107. package/dataflow/internal/process/loops/repeat-loop.d.ts +3 -3
  108. package/dataflow/internal/process/loops/while-loop.d.ts +3 -3
  109. package/dataflow/internal/process/operators/assignment.d.ts +3 -3
  110. package/dataflow/internal/process/operators/non-assignment-binary-op.d.ts +3 -3
  111. package/dataflow/internal/process/operators/pipe.d.ts +3 -3
  112. package/dataflow/internal/process/operators/unary-op.d.ts +3 -3
  113. package/dataflow/internal/process/symbol.d.ts +3 -3
  114. package/dataflow/internal/process/uninteresting-leaf.d.ts +2 -2
  115. package/dataflow/processor.d.ts +12 -3
  116. package/flowr.d.ts +5 -2
  117. package/flowr.js +19 -12
  118. package/package.json +50 -18
  119. package/r-bridge/lang-4.x/ast/index.d.ts +1 -0
  120. package/r-bridge/lang-4.x/ast/index.js +3 -0
  121. package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -2
  122. package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -6
  123. package/r-bridge/lang-4.x/ast/model/nodes/info/index.d.ts +2 -2
  124. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +3 -3
  125. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -3
  126. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -3
  127. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -3
  128. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -2
  129. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -2
  130. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
  131. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +4 -4
  132. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -4
  133. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +4 -4
  134. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -3
  135. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -2
  136. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -2
  137. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -2
  138. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -3
  139. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -3
  140. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
  141. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -3
  142. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -3
  143. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -2
  144. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -3
  145. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -3
  146. package/r-bridge/lang-4.x/ast/model/operators.d.ts +1 -1
  147. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +4 -2
  148. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +6 -1
  149. package/r-bridge/lang-4.x/ast/model/processing/fold.d.ts +3 -3
  150. package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +1 -1
  151. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +3 -3
  152. package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
  153. package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +14 -0
  154. package/r-bridge/lang-4.x/ast/parser/json/format.js +26 -0
  155. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +7 -0
  156. package/r-bridge/lang-4.x/ast/parser/json/parser.js +57 -0
  157. package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +4 -7
  158. package/r-bridge/lang-4.x/ast/parser/xml/hooks.d.ts +5 -5
  159. package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -2
  160. package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -2
  161. package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +6 -2
  162. package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +7 -10
  163. package/r-bridge/lang-4.x/ast/parser/xml/internal/access.d.ts +3 -3
  164. package/r-bridge/lang-4.x/ast/parser/xml/internal/access.js +2 -2
  165. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.d.ts +3 -3
  166. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.js +1 -1
  167. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.d.ts +3 -3
  168. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.js +2 -2
  169. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.d.ts +3 -3
  170. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +4 -4
  171. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.d.ts +3 -3
  172. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.js +2 -2
  173. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.d.ts +3 -3
  174. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.js +4 -4
  175. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.d.ts +3 -3
  176. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.js +2 -2
  177. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.d.ts +3 -3
  178. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.js +2 -2
  179. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -1
  180. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -1
  181. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.d.ts +3 -3
  182. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.js +2 -2
  183. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.d.ts +3 -3
  184. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.js +3 -6
  185. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.d.ts +3 -3
  186. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.js +2 -2
  187. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.d.ts +3 -3
  188. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.js +2 -2
  189. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.d.ts +3 -3
  190. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.js +2 -2
  191. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +9 -14
  192. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.js +15 -23
  193. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.d.ts +3 -3
  194. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.js +6 -6
  195. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.d.ts +1 -1
  196. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.d.ts +3 -3
  197. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +3 -3
  198. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.d.ts +3 -3
  199. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.js +2 -2
  200. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.d.ts +3 -3
  201. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.js +2 -2
  202. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.d.ts +4 -4
  203. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +3 -3
  204. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.d.ts +3 -3
  205. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +3 -4
  206. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.d.ts +4 -4
  207. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +2 -2
  208. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.d.ts +4 -4
  209. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.js +2 -2
  210. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.d.ts +3 -3
  211. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.js +2 -2
  212. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.d.ts +3 -3
  213. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.js +4 -4
  214. package/r-bridge/lang-4.x/values.d.ts +0 -1
  215. package/r-bridge/lang-4.x/values.js +14 -6
  216. package/r-bridge/retriever.d.ts +26 -22
  217. package/r-bridge/retriever.js +73 -23
  218. package/r-bridge/shell-executor.d.ts +11 -0
  219. package/r-bridge/shell-executor.js +50 -0
  220. package/r-bridge/shell.d.ts +12 -31
  221. package/r-bridge/shell.js +36 -94
  222. package/reconstruct/reconstruct.d.ts +1 -1
  223. package/slicing/criterion/collect-all.d.ts +3 -3
  224. package/slicing/criterion/filters/all-variables.d.ts +1 -1
  225. package/slicing/criterion/parse.d.ts +1 -1
  226. package/slicing/static/static-slicer.d.ts +3 -3
  227. package/statistics/features/common-syntax-probability.d.ts +3 -2
  228. package/statistics/features/common-syntax-probability.js +0 -3
  229. package/statistics/features/feature.d.ts +6 -6
  230. package/statistics/features/post-processing.d.ts +2 -2
  231. package/statistics/features/supported/assignments/assignments.d.ts +2 -2
  232. package/statistics/features/supported/assignments/post-process.d.ts +2 -2
  233. package/statistics/features/supported/assignments/post-process.js +6 -6
  234. package/statistics/features/supported/comments/comments.d.ts +2 -2
  235. package/statistics/features/supported/comments/post-process.d.ts +2 -2
  236. package/statistics/features/supported/comments/post-process.js +2 -2
  237. package/statistics/features/supported/control-flow/control-flow.d.ts +2 -2
  238. package/statistics/features/supported/control-flow/post-process.d.ts +2 -2
  239. package/statistics/features/supported/data-access/data-access.d.ts +3 -3
  240. package/statistics/features/supported/data-access/post-process.d.ts +2 -2
  241. package/statistics/features/supported/data-access/post-process.js +4 -4
  242. package/statistics/features/supported/defined-functions/defined-functions.d.ts +4 -4
  243. package/statistics/features/supported/defined-functions/post-process.d.ts +2 -2
  244. package/statistics/features/supported/defined-functions/post-process.js +4 -4
  245. package/statistics/features/supported/expression-list/expression-list.d.ts +2 -2
  246. package/statistics/features/supported/expression-list/post-process.d.ts +2 -2
  247. package/statistics/features/supported/expression-list/post-process.js +3 -3
  248. package/statistics/features/supported/loops/loops.d.ts +2 -2
  249. package/statistics/features/supported/loops/post-process.d.ts +2 -2
  250. package/statistics/features/supported/loops/post-process.js +3 -3
  251. package/statistics/features/supported/used-functions/post-process.d.ts +2 -2
  252. package/statistics/features/supported/used-functions/post-process.js +5 -5
  253. package/statistics/features/supported/used-functions/used-functions.d.ts +3 -3
  254. package/statistics/features/supported/used-packages/post-process.d.ts +2 -2
  255. package/statistics/features/supported/used-packages/post-process.js +5 -5
  256. package/statistics/features/supported/used-packages/used-packages.d.ts +2 -2
  257. package/statistics/features/supported/values/post-process.d.ts +2 -2
  258. package/statistics/features/supported/values/post-process.js +3 -3
  259. package/statistics/features/supported/values/values.d.ts +2 -2
  260. package/statistics/features/supported/variables/post-process.d.ts +3 -3
  261. package/statistics/features/supported/variables/post-process.js +3 -3
  262. package/statistics/features/supported/variables/variables.d.ts +2 -2
  263. package/statistics/meta-statistics.d.ts +1 -1
  264. package/statistics/output/ansi.js +1 -1
  265. package/statistics/output/print-stats.d.ts +2 -2
  266. package/statistics/output/statistics-file.d.ts +1 -1
  267. package/statistics/statistics.d.ts +4 -4
  268. package/statistics/statistics.js +7 -8
  269. package/util/args.d.ts +8 -4
  270. package/util/args.js +11 -4
  271. package/util/{cfg.d.ts → cfg/cfg.d.ts} +18 -6
  272. package/util/{cfg.js → cfg/cfg.js} +42 -37
  273. package/util/cfg/visitor.d.ts +14 -0
  274. package/util/cfg/visitor.js +64 -0
  275. package/util/diff.d.ts +1 -1
  276. package/util/files.d.ts +7 -1
  277. package/util/files.js +11 -1
  278. package/util/log.js +3 -0
  279. package/util/mermaid/ast.d.ts +1 -1
  280. package/util/mermaid/cfg.d.ts +2 -2
  281. package/util/mermaid/dfg.d.ts +3 -3
  282. package/util/objects.d.ts +1 -1
  283. package/util/quads.d.ts +2 -2
  284. package/util/summarizer/benchmark/data.d.ts +1 -1
  285. package/util/summarizer/benchmark/first-phase/input.d.ts +2 -1
  286. package/util/summarizer/benchmark/first-phase/input.js +20 -4
  287. package/util/summarizer/benchmark/first-phase/process.d.ts +4 -3
  288. package/util/summarizer/benchmark/first-phase/process.js +14 -5
  289. package/util/summarizer/benchmark/second-phase/graph.d.ts +1 -1
  290. package/util/summarizer/benchmark/second-phase/graph.js +1 -1
  291. package/util/summarizer/benchmark/second-phase/process.d.ts +3 -1
  292. package/util/summarizer/benchmark/second-phase/process.js +48 -11
  293. package/util/summarizer/benchmark/summarizer.d.ts +3 -6
  294. package/util/summarizer/benchmark/summarizer.js +16 -11
  295. package/util/summarizer/statistics/first-phase/process.js +8 -8
  296. package/util/summarizer/statistics/post-process/clusterer.d.ts +2 -2
  297. package/util/summarizer/statistics/post-process/file-based-count.d.ts +1 -1
  298. package/util/summarizer/statistics/post-process/histogram.d.ts +2 -2
  299. package/util/summarizer/statistics/post-process/post-process-output.d.ts +2 -2
  300. package/util/summarizer/statistics/post-process/post-process-output.js +4 -5
  301. package/util/summarizer/statistics/second-phase/process.d.ts +2 -2
  302. package/util/summarizer/statistics/summarizer.d.ts +3 -2
  303. package/util/summarizer/summarizer.d.ts +1 -1
  304. package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +0 -25
  305. package/r-bridge/lang-4.x/ast/parser/xml/config.js +0 -16
  306. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +0 -9
  307. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.js +0 -51
  308. package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +0 -17
  309. package/r-bridge/lang-4.x/ast/parser/xml/parser.js +0 -30
package/cli/repl/core.js CHANGED
@@ -22,8 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.repl = exports.replProcessAnswer = exports.DEFAULT_REPL_READLINE_CONFIGURATION = exports.replCompleter = void 0;
29
+ exports.loadReplHistory = exports.repl = exports.replProcessAnswer = exports.DEFAULT_REPL_READLINE_CONFIGURATION = exports.replCompleter = void 0;
27
30
  /**
28
31
  * Basically a helper file to allow the main 'flowr' script (located in the source root) to provide its repl
29
32
  *
@@ -33,15 +36,51 @@ const r_bridge_1 = require("../../r-bridge");
33
36
  const statistics_1 = require("../../statistics");
34
37
  const prompt_1 = require("./prompt");
35
38
  const commands_1 = require("./commands");
36
- const readline = __importStar(require("node:readline"));
39
+ const readline = __importStar(require("readline"));
37
40
  const args_1 = require("../../util/args");
38
41
  const execute_1 = require("./commands/execute");
39
- const replCompleterKeywords = Array.from(commands_1.commandNames, s => `:${s}`);
42
+ const os_1 = __importDefault(require("os"));
43
+ const path_1 = __importDefault(require("path"));
44
+ const fs_1 = __importDefault(require("fs"));
45
+ const common_1 = require("../common");
46
+ let _replCompleterKeywords = undefined;
47
+ function replCompleterKeywords() {
48
+ if (_replCompleterKeywords === undefined) {
49
+ _replCompleterKeywords = Array.from((0, commands_1.getCommandNames)(), s => `:${s}`);
50
+ }
51
+ return _replCompleterKeywords;
52
+ }
53
+ const defaultHistoryFile = path_1.default.join(os_1.default.tmpdir(), '.flowrhistory');
40
54
  /**
41
55
  * Used by the repl to provide automatic completions for a given (partial) input line
42
56
  */
43
57
  function replCompleter(line) {
44
- return [replCompleterKeywords.filter(k => k.startsWith(line)), line];
58
+ const splitLine = (0, args_1.splitAtEscapeSensitive)(line);
59
+ // did we just type a space (and are starting a new arg right now)?
60
+ const startingNewArg = line.endsWith(' ');
61
+ // if we typed a command fully already, autocomplete the arguments
62
+ if (splitLine.length > 1 || startingNewArg) {
63
+ const commandNameColon = replCompleterKeywords().find(k => splitLine[0] === k);
64
+ if (commandNameColon) {
65
+ const completions = [];
66
+ const commandName = commandNameColon.slice(1);
67
+ if ((0, commands_1.getCommand)(commandName)?.script === true) {
68
+ // autocomplete script arguments
69
+ const options = common_1.scripts[commandName].options;
70
+ completions.push(...(0, common_1.getValidOptionsForCompletion)(options, splitLine).map(o => `${o} `));
71
+ }
72
+ else {
73
+ // autocomplete command arguments (specifically, autocomplete the file:// protocol)
74
+ completions.push(r_bridge_1.fileProtocol);
75
+ }
76
+ // add an empty option so that it doesn't autocomplete the only defined option immediately
77
+ completions.push(' ');
78
+ const currentArg = startingNewArg ? '' : splitLine[splitLine.length - 1];
79
+ return [completions.filter(a => a.startsWith(currentArg)), currentArg];
80
+ }
81
+ }
82
+ // if no command is already typed, just return all commands that match
83
+ return [replCompleterKeywords().filter(k => k.startsWith(line)).map(k => `${k} `), line];
45
84
  }
46
85
  exports.replCompleter = replCompleter;
47
86
  exports.DEFAULT_REPL_READLINE_CONFIGURATION = {
@@ -49,6 +88,7 @@ exports.DEFAULT_REPL_READLINE_CONFIGURATION = {
49
88
  output: process.stdout,
50
89
  tabSize: 4,
51
90
  terminal: true,
91
+ history: loadReplHistory(defaultHistoryFile),
52
92
  removeHistoryDuplicates: true,
53
93
  completer: replCompleter
54
94
  };
@@ -57,7 +97,12 @@ async function replProcessStatement(output, statement, shell) {
57
97
  const command = statement.slice(1).split(' ')[0].toLowerCase();
58
98
  const processor = (0, commands_1.getCommand)(command);
59
99
  if (processor) {
60
- await processor.fn(output, shell, statement.slice(command.length + 2).trim());
100
+ try {
101
+ await processor.fn(output, shell, statement.slice(command.length + 2).trim());
102
+ }
103
+ catch (e) {
104
+ console.log(`${(0, statistics_1.bold)(`Failed to execute command ${command}`)}: ${e?.message}. Using the ${(0, statistics_1.bold)('--verbose')} flag on startup may provide additional information.`);
105
+ }
61
106
  }
62
107
  else {
63
108
  console.log(`the command '${command}' is unknown, try ${(0, statistics_1.bold)(':help')} for more information`);
@@ -75,7 +120,7 @@ async function replProcessStatement(output, statement, shell) {
75
120
  * @param shell - The {@link RShell} to use (see {@link repl}).
76
121
  */
77
122
  async function replProcessAnswer(output, expr, shell) {
78
- const statements = (0, args_1.splitAtEscapeSensitive)(expr, ';');
123
+ const statements = (0, args_1.splitAtEscapeSensitive)(expr, false, ';');
79
124
  for (const statement of statements) {
80
125
  await replProcessStatement(output, statement, shell);
81
126
  }
@@ -93,11 +138,15 @@ exports.replProcessAnswer = replProcessAnswer;
93
138
  * If you want to provide a custom one but use the same `completer`, refer to {@link replCompleter}.
94
139
  * For the default arguments, see {@link DEFAULT_REPL_READLINE_CONFIGURATION}.
95
140
  * @param output - Defines two methods that every function in the repl uses to output its data.
141
+ * @param historyFile - The file to use for persisting the repl's history. Passing undefined causes history not to be saved.
96
142
  *
97
143
  * For the execution, this function makes use of {@link replProcessAnswer}
98
144
  *
99
145
  */
100
- async function repl(shell = new r_bridge_1.RShell({ revive: 'always' }), rl = readline.createInterface(exports.DEFAULT_REPL_READLINE_CONFIGURATION), output = commands_1.standardReplOutput) {
146
+ async function repl(shell = new r_bridge_1.RShell({ revive: 'always' }), rl = readline.createInterface(exports.DEFAULT_REPL_READLINE_CONFIGURATION), output = commands_1.standardReplOutput, historyFile = defaultHistoryFile) {
147
+ if (historyFile) {
148
+ rl.on('history', h => fs_1.default.writeFileSync(historyFile, h.join('\n'), { encoding: 'utf-8' }));
149
+ }
101
150
  // the incredible repl :D, we kill it with ':quit'
102
151
  // eslint-disable-next-line no-constant-condition,@typescript-eslint/no-unnecessary-condition
103
152
  while (true) {
@@ -113,4 +162,11 @@ async function repl(shell = new r_bridge_1.RShell({ revive: 'always' }), rl = re
113
162
  }
114
163
  }
115
164
  exports.repl = repl;
165
+ function loadReplHistory(historyFile) {
166
+ if (!fs_1.default.existsSync(historyFile)) {
167
+ return undefined;
168
+ }
169
+ return fs_1.default.readFileSync(historyFile, { encoding: 'utf-8' }).split('\n');
170
+ }
171
+ exports.loadReplHistory = loadReplHistory;
116
172
  //# sourceMappingURL=core.js.map
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Readable, Writable } from 'node:stream';
2
+ import type { Readable, Writable } from 'stream';
3
3
  type Stdio = [stdin: Writable | null, stdout: Readable | null, stderr: Readable | null, extra: Writable | Readable | null | undefined, extra: Writable | Readable | null | undefined];
4
4
  export type StdioProcessor = (stdio: Stdio) => void;
5
5
  /**
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.waitOnScript = exports.stdioCaptureProcessor = void 0;
7
7
  const log_1 = require("../../util/log");
8
8
  const child_process_1 = __importDefault(require("child_process"));
9
- const node_readline_1 = __importDefault(require("node:readline"));
9
+ const readline_1 = __importDefault(require("readline"));
10
10
  const assert_1 = require("../../util/assert");
11
11
  /**
12
12
  * Simply captures the output of the script executed by {@link waitOnScript}.
@@ -17,12 +17,12 @@ const assert_1 = require("../../util/assert");
17
17
  */
18
18
  function stdioCaptureProcessor(stdio, onStdOutLine, onStdErrLine) {
19
19
  (0, assert_1.guard)(stdio[1] !== null, 'no stdout given in stdio!');
20
- const outRl = node_readline_1.default.createInterface({
20
+ const outRl = readline_1.default.createInterface({
21
21
  input: stdio[1],
22
22
  terminal: false
23
23
  });
24
24
  (0, assert_1.guard)(stdio[2] !== null, 'no stderr given in stdio!');
25
- const errRl = node_readline_1.default.createInterface({
25
+ const errRl = readline_1.default.createInterface({
26
26
  input: stdio[2],
27
27
  terminal: false
28
28
  });
@@ -1,5 +1,5 @@
1
- import { RShell } from '../../../r-bridge';
2
- import { Socket } from './net';
1
+ import type { RShell } from '../../../r-bridge';
2
+ import type { Socket } from './net';
3
3
  /**
4
4
  * Each connection handles a single client, answering to its requests.
5
5
  * There is no need to construct this class manually, {@link FlowRServer} will do it for you.
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlowRServerConnection = void 0;
4
4
  const core_1 = require("../../../core");
5
- const r_bridge_1 = require("../../../r-bridge");
6
5
  const send_1 = require("./send");
7
6
  const validate_1 = require("./validate");
8
7
  const analysis_1 = require("./messages/analysis");
@@ -11,9 +10,8 @@ const server_1 = require("./server");
11
10
  const repl_1 = require("./messages/repl");
12
11
  const core_2 = require("../core");
13
12
  const statistics_1 = require("../../../statistics");
14
- const cfg_1 = require("../../../util/cfg");
13
+ const cfg_1 = require("../../../util/cfg/cfg");
15
14
  const quads_1 = require("../../../util/quads");
16
- const objects_1 = require("../../../util/objects");
17
15
  /**
18
16
  * Each connection handles a single client, answering to its requests.
19
17
  * There is no need to construct this class manually, {@link FlowRServer} will do it for you.
@@ -100,7 +98,6 @@ class FlowRServerConnection {
100
98
  cfg = (0, cfg_1.extractCFG)(results.normalize);
101
99
  }
102
100
  const config = () => ({ context: message.filename ?? 'unknown', getId: (0, quads_1.defaultQuadIdGenerator)() });
103
- const parseConfig = (0, objects_1.deepMergeObject)(r_bridge_1.DEFAULT_XML_PARSER_CONFIG, { tokenMap: await this.shell.tokenMap() });
104
101
  if (message.format === 'n-quads') {
105
102
  (0, send_1.sendMessage)(this.socket, {
106
103
  type: 'response-file-analysis',
@@ -108,9 +105,9 @@ class FlowRServerConnection {
108
105
  id: message.id,
109
106
  cfg: cfg ? (0, cfg_1.cfg2quads)(cfg, config()) : undefined,
110
107
  results: {
111
- parse: await (0, core_1.printStepResult)('parse', results.parse, 5 /* StepOutputFormat.RdfQuads */, config(), parseConfig),
108
+ parse: await (0, core_1.printStepResult)('parse', results.parse, 5 /* StepOutputFormat.RdfQuads */, config()),
112
109
  normalize: await (0, core_1.printStepResult)('normalize', results.normalize, 5 /* StepOutputFormat.RdfQuads */, config()),
113
- dataflow: await (0, core_1.printStepResult)('dataflow', results.dataflow, 5 /* StepOutputFormat.RdfQuads */, config()),
110
+ dataflow: await (0, core_1.printStepResult)('dataflow', results.dataflow, 5 /* StepOutputFormat.RdfQuads */, config())
114
111
  }
115
112
  });
116
113
  }
@@ -137,8 +134,7 @@ class FlowRServerConnection {
137
134
  // we have to make sure, that the content is not interpreted as a file path if it starts with 'file://' therefore, we do it manually
138
135
  request: {
139
136
  request: message.content === undefined ? 'file' : 'text',
140
- content: message.content ?? message.filepath,
141
- ensurePackageInstalled: false
137
+ content: message.content ?? message.filepath
142
138
  },
143
139
  criterion: [] // currently unknown
144
140
  });
@@ -1,6 +1,6 @@
1
- import { IdMessageBase, MessageDefinition } from './messages';
2
- import { LAST_PER_FILE_STEP, StepResults } from '../../../../core';
3
- import { ControlFlowInformation } from '../../../../util/cfg';
1
+ import type { IdMessageBase, MessageDefinition } from './messages';
2
+ import type { LAST_PER_FILE_STEP, StepResults } from '../../../../core';
3
+ import type { ControlFlowInformation } from '../../../../util/cfg/cfg';
4
4
  /**
5
5
  * Send by the client to request an analysis of a given file.
6
6
  * Answered by either an {@link FlowrErrorMessage} or a {@link FileAnalysisResponseMessageJson}.
@@ -1,41 +1,21 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
6
  exports.requestAnalysisMessage = void 0;
27
- const Joi = __importStar(require("joi"));
7
+ const joi_1 = __importDefault(require("joi"));
28
8
  exports.requestAnalysisMessage = {
29
9
  type: 'request-file-analysis',
30
- schema: Joi.object({
31
- type: Joi.string().valid('request-file-analysis').required(),
32
- id: Joi.string().optional(),
33
- filetoken: Joi.string().optional(),
34
- filename: Joi.string().optional(),
35
- content: Joi.string().optional(),
36
- filepath: Joi.string().optional(),
37
- cfg: Joi.boolean().optional(),
38
- format: Joi.string().valid('json', 'n-quads').optional()
10
+ schema: joi_1.default.object({
11
+ type: joi_1.default.string().valid('request-file-analysis').required(),
12
+ id: joi_1.default.string().optional(),
13
+ filetoken: joi_1.default.string().optional(),
14
+ filename: joi_1.default.string().optional(),
15
+ content: joi_1.default.string().optional(),
16
+ filepath: joi_1.default.string().optional(),
17
+ cfg: joi_1.default.boolean().optional(),
18
+ format: joi_1.default.string().valid('json', 'n-quads').optional()
39
19
  }).xor('content', 'filepath')
40
20
  };
41
21
  //# sourceMappingURL=analysis.js.map
@@ -1,4 +1,4 @@
1
- import { IdMessageBase } from './messages';
1
+ import type { IdMessageBase } from './messages';
2
2
  /**
3
3
  * Sent in case of any error (e.g., if the analysis fails, or the message contains syntax errors).
4
4
  */
@@ -1,5 +1,5 @@
1
- import { VersionInformation } from '../../commands/version';
2
- import { IdMessageBase } from './messages';
1
+ import type { VersionInformation } from '../../commands/version';
2
+ import type { IdMessageBase } from './messages';
3
3
  /**
4
4
  * The hello message is automatically send by the sever upon connection.
5
5
  */
@@ -4,11 +4,11 @@
4
4
  * @module
5
5
  */
6
6
  import * as Joi from 'joi';
7
- import { FlowrHelloResponseMessage } from './hello';
8
- import { FileAnalysisRequestMessage, FileAnalysisResponseMessageJson } from './analysis';
9
- import { ExecuteEndMessage, ExecuteIntermediateResponseMessage, ExecuteRequestMessage } from './repl';
10
- import { SliceRequestMessage, SliceResponseMessage } from './slice';
11
- import { FlowrErrorMessage } from './error';
7
+ import type { FlowrHelloResponseMessage } from './hello';
8
+ import type { FileAnalysisRequestMessage, FileAnalysisResponseMessageJson } from './analysis';
9
+ import type { ExecuteEndMessage, ExecuteIntermediateResponseMessage, ExecuteRequestMessage } from './repl';
10
+ import type { SliceRequestMessage, SliceResponseMessage } from './slice';
11
+ import type { FlowrErrorMessage } from './error';
12
12
  /**
13
13
  * If you send a message it must *not* contain a newline but the message must be terminated by a newline.
14
14
  */
@@ -1,4 +1,4 @@
1
- import { IdMessageBase, MessageDefinition } from './messages';
1
+ import type { IdMessageBase, MessageDefinition } from './messages';
2
2
  /**
3
3
  * Request the execution of the given expression as a REPL statement.
4
4
  * We strongly recommend that you make use of a unique {@link IdMessageBase#id}
@@ -1,6 +1,6 @@
1
- import { SlicingCriteria } from '../../../../slicing';
2
- import { LAST_PER_FILE_STEP, LAST_STEP, StepResults } from '../../../../core';
3
- import { IdMessageBase, MessageDefinition } from './messages';
1
+ import type { SlicingCriteria } from '../../../../slicing';
2
+ import type { LAST_PER_FILE_STEP, LAST_STEP, StepResults } from '../../../../core';
3
+ import type { IdMessageBase, MessageDefinition } from './messages';
4
4
  /**
5
5
  * Can only be sent after you have sent the {@link FileAnalysisRequestMessage}.
6
6
  * Using the same `filetoken` as in the {@link FileAnalysisRequestMessage} you
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ import type WebSocket from 'ws';
2
3
  /** Function handler that should be triggered when the respective socket connects */
3
4
  export type OnConnect = (c: Socket) => void;
4
5
  /**
@@ -12,6 +13,12 @@ export interface Server {
12
13
  onConnect(handler: OnConnect): void;
13
14
  start(port: number): void;
14
15
  }
16
+ export declare class WebSocketServerWrapper implements Server {
17
+ private server;
18
+ private connectHandler;
19
+ onConnect(handler: OnConnect): void;
20
+ start(port: number): void;
21
+ }
15
22
  /**
16
23
  * The socket abstraction of *flowR*.
17
24
  * Essentially a subset of what the default `net.Socket` of `node` provides.
@@ -25,6 +32,15 @@ export interface Socket {
25
32
  write(data: string): void;
26
33
  end(): void;
27
34
  }
35
+ export declare class WebSocketWrapper implements Socket {
36
+ private readonly socket;
37
+ remoteAddress?: string;
38
+ remotePort?: number;
39
+ constructor(socket: WebSocket);
40
+ write(data: string): void;
41
+ end(): void;
42
+ on(event: 'data' | 'close' | 'error', listener: (data: Buffer) => void): void;
43
+ }
28
44
  export declare class NetServer implements Server {
29
45
  private readonly server;
30
46
  constructor();
@@ -3,15 +3,54 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NetServer = void 0;
6
+ exports.NetServer = exports.WebSocketWrapper = exports.WebSocketServerWrapper = void 0;
7
7
  /**
8
8
  * This is just a simple layer to allow me to mock the server's behavior in tests.
9
9
  */
10
- const node_net_1 = __importDefault(require("node:net"));
10
+ const net_1 = __importDefault(require("net"));
11
+ const ws_1 = require("ws");
12
+ const server_1 = require("./server");
13
+ class WebSocketServerWrapper {
14
+ server;
15
+ connectHandler;
16
+ onConnect(handler) {
17
+ this.connectHandler = handler;
18
+ }
19
+ start(port) {
20
+ this.server = new ws_1.WebSocketServer({ port });
21
+ server_1.serverLog.info('WebSocket-Server wrapper is active!');
22
+ this.server.on('connection', c => this.connectHandler?.(new WebSocketWrapper(c)));
23
+ }
24
+ }
25
+ exports.WebSocketServerWrapper = WebSocketServerWrapper;
26
+ class WebSocketWrapper {
27
+ socket;
28
+ remoteAddress;
29
+ remotePort;
30
+ constructor(socket) {
31
+ this.socket = socket;
32
+ this.remoteAddress = socket.url;
33
+ }
34
+ write(data) {
35
+ this.socket.send(data);
36
+ }
37
+ end() {
38
+ this.socket.close();
39
+ }
40
+ on(event, listener) {
41
+ if (event === 'data') {
42
+ this.socket.on('message', listener);
43
+ }
44
+ else {
45
+ this.socket.on(event, listener);
46
+ }
47
+ }
48
+ }
49
+ exports.WebSocketWrapper = WebSocketWrapper;
11
50
  class NetServer {
12
51
  server;
13
52
  constructor() {
14
- this.server = node_net_1.default.createServer();
53
+ this.server = net_1.default.createServer();
15
54
  }
16
55
  onConnect(handler) {
17
56
  this.server.on('connection', handler);
@@ -1,4 +1,4 @@
1
- import { IdMessageBase } from './messages/messages';
2
- import { Socket } from './net';
1
+ import type { IdMessageBase } from './messages/messages';
2
+ import type { Socket } from './net';
3
3
  export declare function getUnnamedSocketName(c: Socket): string;
4
4
  export declare function sendMessage<T extends IdMessageBase>(c: Socket, message: T): void;
@@ -1,5 +1,5 @@
1
- import { RShell } from '../../../r-bridge';
2
- import { Server } from './net';
1
+ import type { RShell } from '../../../r-bridge';
2
+ import type { Server } from './net';
3
3
  import { FlowrLogger } from '../../../util/log';
4
4
  export declare const serverLog: FlowrLogger;
5
5
  /**
@@ -1,6 +1,6 @@
1
- import * as Joi from 'joi';
2
- import { FlowrMessage, IdMessageBase, MessageDefinition } from './messages/messages';
3
- import { Socket } from './net';
1
+ import type * as Joi from 'joi';
2
+ import type { FlowrMessage, IdMessageBase, MessageDefinition } from './messages/messages';
3
+ import type { Socket } from './net';
4
4
  export interface ValidationErrorResult {
5
5
  type: 'error';
6
6
  reason: Joi.ValidationError | Error;
@@ -8,13 +8,13 @@ const statistics_1 = require("../statistics");
8
8
  const log_1 = require("../util/log");
9
9
  const common_1 = require("./common");
10
10
  const json_1 = require("../util/json");
11
- const cfg_1 = require("../util/cfg");
12
- const tar_1 = require("tar");
13
11
  const fs_1 = __importDefault(require("fs"));
14
12
  const assert_1 = require("../util/assert");
15
13
  const features_1 = require("./common/features");
16
14
  const core_1 = require("../core");
17
15
  const time_1 = require("../util/time");
16
+ const tar_1 = require("tar");
17
+ const cfg_1 = require("../util/cfg/cfg");
18
18
  const options = (0, common_1.processCommandLineArgs)('stats-helper', [], {
19
19
  subtitle: 'Given a single input file, this will collect usage statistics for the given features and write them to a file',
20
20
  examples: [
@@ -37,7 +37,6 @@ if (options.compress) {
37
37
  // assume correct
38
38
  const processedFeatures = new Set(options.features);
39
39
  const shell = new r_bridge_1.RShell();
40
- shell.tryToInjectHomeLibPath();
41
40
  (0, statistics_1.initFileProvider)(options['output-dir']);
42
41
  function compressFolder(folder, target) {
43
42
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
@@ -25,9 +25,8 @@ function getBenchmarkSummarizer() {
25
25
  return new summarizer_1.BenchmarkSummarizer({
26
26
  graphOutputPath: options.graph ? `${outputBase}-graph.json` : undefined,
27
27
  inputPath: options.input,
28
- intermediateOutputPath: `${outputBase}.json`,
28
+ intermediateOutputPath: outputBase,
29
29
  outputPath: `${outputBase}-ultimate.json`,
30
- outputLogPath: `${outputBase}.log`,
31
30
  logger: console.log
32
31
  });
33
32
  }
package/config.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { MergeableRecord } from './util/objects';
2
+ export interface FlowrConfigOptions extends MergeableRecord {
3
+ /**
4
+ * Whether source calls should be ignored, causing {@link processSourceCall}'s behavior to be skipped
5
+ */
6
+ ignoreSourceCalls: boolean;
7
+ /**
8
+ * The path to the R executable to use. If this is undefined, {@link DEFAULT_R_PATH} will be used.
9
+ */
10
+ rPath: string | undefined;
11
+ }
12
+ export declare const defaultConfigOptions: FlowrConfigOptions;
13
+ export declare const defaultConfigFile = "flowr.json";
14
+ export declare function setConfigFile(workingDirectory?: string, file?: string, forceLoad?: boolean): void;
15
+ export declare function setConfig(config: FlowrConfigOptions): void;
16
+ export declare function getConfig(): FlowrConfigOptions;
package/config.js ADDED
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getConfig = exports.setConfig = exports.setConfigFile = exports.defaultConfigFile = exports.defaultConfigOptions = void 0;
7
+ const objects_1 = require("./util/objects");
8
+ const path_1 = __importDefault(require("path"));
9
+ const fs_1 = __importDefault(require("fs"));
10
+ const log_1 = require("./util/log");
11
+ const files_1 = require("./util/files");
12
+ const joi_1 = __importDefault(require("joi"));
13
+ exports.defaultConfigOptions = {
14
+ ignoreSourceCalls: false,
15
+ rPath: undefined
16
+ };
17
+ exports.defaultConfigFile = 'flowr.json';
18
+ const schema = joi_1.default.object({
19
+ ignoreSourceCalls: joi_1.default.boolean().optional()
20
+ });
21
+ let configWorkingDirectory = process.cwd();
22
+ let configFile = exports.defaultConfigFile;
23
+ let currentConfig;
24
+ function setConfigFile(workingDirectory = process.cwd(), file = exports.defaultConfigFile, forceLoad = false) {
25
+ configWorkingDirectory = workingDirectory;
26
+ configFile = file;
27
+ // reset the config so it gets reloaded
28
+ currentConfig = undefined;
29
+ if (forceLoad) {
30
+ getConfig();
31
+ }
32
+ }
33
+ exports.setConfigFile = setConfigFile;
34
+ function setConfig(config) {
35
+ currentConfig = config;
36
+ }
37
+ exports.setConfig = setConfig;
38
+ function getConfig() {
39
+ // lazy-load the config based on the current settings
40
+ if (currentConfig === undefined) {
41
+ setConfig(parseConfigOptions(configWorkingDirectory, configFile));
42
+ }
43
+ return currentConfig;
44
+ }
45
+ exports.getConfig = getConfig;
46
+ function parseConfigOptions(workingDirectory, configFile) {
47
+ let searchPath = path_1.default.resolve(workingDirectory);
48
+ do {
49
+ const configPath = path_1.default.join(searchPath, configFile);
50
+ if (fs_1.default.existsSync(configPath)) {
51
+ try {
52
+ const text = fs_1.default.readFileSync(configPath, { encoding: 'utf-8' });
53
+ const parsed = JSON.parse(text);
54
+ const validate = schema.validate(parsed);
55
+ if (!validate.error) {
56
+ // assign default values to all config options except for the specified ones
57
+ const ret = (0, objects_1.deepMergeObject)(exports.defaultConfigOptions, parsed);
58
+ log_1.log.info(`Using config ${JSON.stringify(ret)} from ${configPath}`);
59
+ return ret;
60
+ }
61
+ else {
62
+ log_1.log.error(`Failed to validate config file at ${configPath}: ${validate.error.message}`);
63
+ }
64
+ }
65
+ catch (e) {
66
+ log_1.log.error(`Failed to parse config file at ${configPath}: ${e.message}`);
67
+ }
68
+ }
69
+ // move up to parent directory
70
+ searchPath = (0, files_1.getParentDirectory)(searchPath);
71
+ } while (fs_1.default.existsSync(searchPath));
72
+ log_1.log.info(`Using default config ${JSON.stringify(exports.defaultConfigOptions)}`);
73
+ return exports.defaultConfigOptions;
74
+ }
75
+ //# sourceMappingURL=config.js.map
package/core/input.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { MergeableRecord } from '../util/objects';
2
- import { IdGenerator, NoInfo, RParseRequest, RShell, XmlParserHooks } from '../r-bridge';
3
- import { DeepPartial } from 'ts-essentials';
4
- import { AutoSelectPredicate, SlicingCriteria } from '../slicing';
5
- import { STEPS_PER_SLICE, StepName, STEPS_PER_FILE } from './steps';
1
+ import type { MergeableRecord } from '../util/objects';
2
+ import type { IdGenerator, NoInfo, RParseRequest, RShell, XmlParserHooks } from '../r-bridge';
3
+ import type { DeepPartial } from 'ts-essentials';
4
+ import type { AutoSelectPredicate, SlicingCriteria } from '../slicing';
5
+ import type { STEPS_PER_SLICE, StepName, STEPS_PER_FILE } from './steps';
6
6
  /**
7
7
  * We split the types, as if you are only interested in what can be done per-file, you do not need a slicing criterion.
8
8
  * Furthermore, if you are only interested in the parse result, you do not require the token map and you can not pass hooks
package/core/output.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LAST_STEP, StepName, StepResult } from './steps';
1
+ import type { LAST_STEP, StepName, StepResult } from './steps';
2
2
  /** Represents the return value of the processor linked to the step with the name 'K' */
3
3
  type Out<K extends StepName> = Record<K, StepResult<K>>;
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { DataflowInformation } from '../../dataflow/internal/info';
2
- import { QuadSerializationConfiguration } from '../../util/quads';
3
- import { DataflowMap } from '../../dataflow';
1
+ import type { DataflowInformation } from '../../dataflow/internal/info';
2
+ import type { QuadSerializationConfiguration } from '../../util/quads';
3
+ import type { DataflowMap } from '../../dataflow';
4
4
  /** Should work with larger things as well */
5
5
  export declare function dataflowGraphToJson(df: DataflowInformation): string;
6
6
  export declare function dataflowGraphToMermaid(df: DataflowInformation, idMap: DataflowMap): string;
@@ -1,5 +1,5 @@
1
- import { NormalizedAst } from '../../r-bridge';
2
- import { QuadSerializationConfiguration } from '../../util/quads';
1
+ import type { NormalizedAst } from '../../r-bridge';
2
+ import type { QuadSerializationConfiguration } from '../../util/quads';
3
3
  /** Should work with larger things as well */
4
4
  export declare function normalizedAstToJson(ast: NormalizedAst): string;
5
5
  export declare function normalizedAstToQuads(ast: NormalizedAst, config: QuadSerializationConfiguration): string;
@@ -1,3 +1,2 @@
1
- import { QuadSerializationConfiguration } from '../../util/quads';
2
- import { XmlParserConfig } from '../../r-bridge';
3
- export declare function parseToQuads(code: string, config: QuadSerializationConfiguration, parseConfig: XmlParserConfig): Promise<string>;
1
+ import type { QuadSerializationConfiguration } from '../../util/quads';
2
+ export declare function parseToQuads(code: string, config: QuadSerializationConfiguration): string;