@eagleoutice/flowr 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/README.md +3 -3
  2. package/abstract-interpretation/processor.js +9 -3
  3. package/config.d.ts +16 -0
  4. package/config.js +75 -0
  5. package/core/input.d.ts +1 -1
  6. package/core/output.d.ts +1 -2
  7. package/core/print/parse-printer.d.ts +1 -2
  8. package/core/print/parse-printer.js +6 -4
  9. package/core/print/slice-diff-ansi.js +7 -7
  10. package/core/slicer.js +4 -8
  11. package/core/steps.d.ts +355 -31
  12. package/core/steps.js +7 -14
  13. package/dataflow/environments/environment.js +8 -0
  14. package/dataflow/environments/register.js +1 -0
  15. package/dataflow/extractor.d.ts +2 -2
  16. package/dataflow/extractor.js +10 -2
  17. package/dataflow/internal/process/functions/function-call.js +7 -1
  18. package/dataflow/internal/process/functions/source.d.ts +8 -0
  19. package/dataflow/internal/process/functions/source.js +81 -0
  20. package/dataflow/processor.d.ts +10 -1
  21. package/index.d.ts +0 -2
  22. package/index.js +0 -2
  23. package/package.json +75 -202
  24. package/r-bridge/lang-4.x/ast/index.d.ts +1 -0
  25. package/r-bridge/lang-4.x/ast/index.js +3 -0
  26. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -0
  27. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +6 -1
  28. package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +14 -0
  29. package/r-bridge/lang-4.x/ast/parser/json/format.js +26 -0
  30. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +7 -0
  31. package/r-bridge/lang-4.x/ast/parser/json/parser.js +57 -0
  32. package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +0 -3
  33. package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -2
  34. package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -2
  35. package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +5 -1
  36. package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +7 -10
  37. package/r-bridge/lang-4.x/ast/parser/xml/internal/access.js +2 -2
  38. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.js +1 -1
  39. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.js +2 -2
  40. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +4 -4
  41. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.js +2 -2
  42. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.js +4 -4
  43. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.js +2 -2
  44. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.js +2 -2
  45. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -1
  46. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -1
  47. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.js +2 -2
  48. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.js +3 -6
  49. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.js +2 -2
  50. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.js +2 -2
  51. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.js +2 -2
  52. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +6 -11
  53. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.js +15 -23
  54. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.js +6 -6
  55. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +3 -3
  56. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.js +2 -2
  57. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.js +2 -2
  58. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +3 -3
  59. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +3 -4
  60. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +2 -2
  61. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.js +2 -2
  62. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.js +2 -2
  63. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.js +4 -4
  64. package/r-bridge/lang-4.x/values.d.ts +0 -1
  65. package/r-bridge/lang-4.x/values.js +14 -6
  66. package/r-bridge/retriever.d.ts +25 -21
  67. package/r-bridge/retriever.js +73 -23
  68. package/r-bridge/shell-executor.d.ts +3 -17
  69. package/r-bridge/shell-executor.js +9 -78
  70. package/r-bridge/shell.d.ts +5 -27
  71. package/r-bridge/shell.js +31 -92
  72. package/{statistics/output → util}/ansi.js +1 -1
  73. package/util/args.d.ts +8 -4
  74. package/util/args.js +11 -4
  75. package/util/cfg/visitor.js +1 -1
  76. package/util/files.d.ts +6 -0
  77. package/util/files.js +11 -1
  78. package/util/log.js +3 -0
  79. package/util/{summarizer/summarizer.d.ts → summarizer.d.ts} +15 -1
  80. package/util/summarizer.js +37 -0
  81. package/util/version.d.ts +2 -0
  82. package/util/version.js +10 -0
  83. package/benchmark/index.d.ts +0 -3
  84. package/benchmark/index.js +0 -20
  85. package/benchmark/slicer.d.ts +0 -101
  86. package/benchmark/slicer.js +0 -225
  87. package/benchmark/stats/index.d.ts +0 -10
  88. package/benchmark/stats/index.js +0 -27
  89. package/benchmark/stats/print.d.ts +0 -7
  90. package/benchmark/stats/print.js +0 -157
  91. package/benchmark/stats/stats.d.ts +0 -41
  92. package/benchmark/stats/stats.js +0 -6
  93. package/benchmark/stopwatch.d.ts +0 -35
  94. package/benchmark/stopwatch.js +0 -79
  95. package/cli/benchmark-app.d.ts +0 -9
  96. package/cli/benchmark-app.js +0 -52
  97. package/cli/benchmark-helper-app.d.ts +0 -7
  98. package/cli/benchmark-helper-app.js +0 -60
  99. package/cli/common/features.d.ts +0 -3
  100. package/cli/common/features.js +0 -30
  101. package/cli/common/index.d.ts +0 -2
  102. package/cli/common/index.js +0 -19
  103. package/cli/common/options.d.ts +0 -20
  104. package/cli/common/options.js +0 -82
  105. package/cli/common/script.d.ts +0 -21
  106. package/cli/common/script.js +0 -61
  107. package/cli/common/scripts-info.d.ts +0 -24
  108. package/cli/common/scripts-info.js +0 -69
  109. package/cli/export-quads-app.d.ts +0 -7
  110. package/cli/export-quads-app.js +0 -46
  111. package/cli/repl/commands/cfg.d.ts +0 -3
  112. package/cli/repl/commands/cfg.js +0 -37
  113. package/cli/repl/commands/commands.d.ts +0 -11
  114. package/cli/repl/commands/commands.js +0 -103
  115. package/cli/repl/commands/dataflow.d.ts +0 -3
  116. package/cli/repl/commands/dataflow.js +0 -34
  117. package/cli/repl/commands/execute.d.ts +0 -4
  118. package/cli/repl/commands/execute.js +0 -27
  119. package/cli/repl/commands/index.d.ts +0 -2
  120. package/cli/repl/commands/index.js +0 -19
  121. package/cli/repl/commands/main.d.ts +0 -39
  122. package/cli/repl/commands/main.js +0 -14
  123. package/cli/repl/commands/normalize.d.ts +0 -3
  124. package/cli/repl/commands/normalize.js +0 -34
  125. package/cli/repl/commands/parse.d.ts +0 -2
  126. package/cli/repl/commands/parse.js +0 -109
  127. package/cli/repl/commands/quit.d.ts +0 -2
  128. package/cli/repl/commands/quit.js +0 -12
  129. package/cli/repl/commands/version.d.ts +0 -16
  130. package/cli/repl/commands/version.js +0 -33
  131. package/cli/repl/core.d.ts +0 -39
  132. package/cli/repl/core.js +0 -116
  133. package/cli/repl/execute.d.ts +0 -28
  134. package/cli/repl/execute.js +0 -79
  135. package/cli/repl/index.d.ts +0 -5
  136. package/cli/repl/index.js +0 -22
  137. package/cli/repl/prompt.d.ts +0 -2
  138. package/cli/repl/prompt.js +0 -9
  139. package/cli/repl/server/connection.d.ts +0 -21
  140. package/cli/repl/server/connection.js +0 -218
  141. package/cli/repl/server/messages/analysis.d.ts +0 -71
  142. package/cli/repl/server/messages/analysis.js +0 -21
  143. package/cli/repl/server/messages/error.d.ts +0 -11
  144. package/cli/repl/server/messages/error.js +0 -3
  145. package/cli/repl/server/messages/hello.d.ts +0 -20
  146. package/cli/repl/server/messages/hello.js +0 -3
  147. package/cli/repl/server/messages/index.d.ts +0 -1
  148. package/cli/repl/server/messages/index.js +0 -3
  149. package/cli/repl/server/messages/messages.d.ts +0 -35
  150. package/cli/repl/server/messages/messages.js +0 -40
  151. package/cli/repl/server/messages/repl.d.ts +0 -33
  152. package/cli/repl/server/messages/repl.js +0 -37
  153. package/cli/repl/server/messages/slice.d.ts +0 -25
  154. package/cli/repl/server/messages/slice.js +0 -37
  155. package/cli/repl/server/net.d.ts +0 -49
  156. package/cli/repl/server/net.js +0 -63
  157. package/cli/repl/server/send.d.ts +0 -4
  158. package/cli/repl/server/send.js +0 -18
  159. package/cli/repl/server/server.d.ts +0 -20
  160. package/cli/repl/server/server.js +0 -66
  161. package/cli/repl/server/validate.d.ts +0 -15
  162. package/cli/repl/server/validate.js +0 -34
  163. package/cli/slicer-app.d.ts +0 -11
  164. package/cli/slicer-app.js +0 -81
  165. package/cli/statistics-app.d.ts +0 -11
  166. package/cli/statistics-app.js +0 -98
  167. package/cli/statistics-helper-app.d.ts +0 -11
  168. package/cli/statistics-helper-app.js +0 -83
  169. package/cli/summarizer-app.d.ts +0 -18
  170. package/cli/summarizer-app.js +0 -67
  171. package/flowr.d.ts +0 -27
  172. package/flowr.js +0 -137
  173. package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +0 -25
  174. package/r-bridge/lang-4.x/ast/parser/xml/config.js +0 -16
  175. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +0 -9
  176. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.js +0 -51
  177. package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +0 -17
  178. package/r-bridge/lang-4.x/ast/parser/xml/parser.js +0 -30
  179. package/statistics/features/common-syntax-probability.d.ts +0 -31
  180. package/statistics/features/common-syntax-probability.js +0 -156
  181. package/statistics/features/feature.d.ts +0 -175
  182. package/statistics/features/feature.js +0 -30
  183. package/statistics/features/index.d.ts +0 -1
  184. package/statistics/features/index.js +0 -18
  185. package/statistics/features/post-processing.d.ts +0 -12
  186. package/statistics/features/post-processing.js +0 -21
  187. package/statistics/features/supported/assignments/assignments.d.ts +0 -11
  188. package/statistics/features/supported/assignments/assignments.js +0 -53
  189. package/statistics/features/supported/assignments/index.d.ts +0 -1
  190. package/statistics/features/supported/assignments/index.js +0 -6
  191. package/statistics/features/supported/assignments/post-process.d.ts +0 -3
  192. package/statistics/features/supported/assignments/post-process.js +0 -125
  193. package/statistics/features/supported/comments/comments.d.ts +0 -18
  194. package/statistics/features/supported/comments/comments.js +0 -133
  195. package/statistics/features/supported/comments/index.d.ts +0 -1
  196. package/statistics/features/supported/comments/index.js +0 -6
  197. package/statistics/features/supported/comments/post-process.d.ts +0 -3
  198. package/statistics/features/supported/comments/post-process.js +0 -50
  199. package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
  200. package/statistics/features/supported/control-flow/control-flow.js +0 -67
  201. package/statistics/features/supported/control-flow/index.d.ts +0 -1
  202. package/statistics/features/supported/control-flow/index.js +0 -6
  203. package/statistics/features/supported/control-flow/post-process.d.ts +0 -3
  204. package/statistics/features/supported/control-flow/post-process.js +0 -65
  205. package/statistics/features/supported/data-access/data-access.d.ts +0 -15
  206. package/statistics/features/supported/data-access/data-access.js +0 -118
  207. package/statistics/features/supported/data-access/index.d.ts +0 -1
  208. package/statistics/features/supported/data-access/index.js +0 -6
  209. package/statistics/features/supported/data-access/post-process.d.ts +0 -3
  210. package/statistics/features/supported/data-access/post-process.js +0 -107
  211. package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -35
  212. package/statistics/features/supported/defined-functions/defined-functions.js +0 -139
  213. package/statistics/features/supported/defined-functions/index.d.ts +0 -1
  214. package/statistics/features/supported/defined-functions/index.js +0 -6
  215. package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
  216. package/statistics/features/supported/defined-functions/post-process.js +0 -177
  217. package/statistics/features/supported/expression-list/expression-list.d.ts +0 -9
  218. package/statistics/features/supported/expression-list/expression-list.js +0 -36
  219. package/statistics/features/supported/expression-list/index.d.ts +0 -1
  220. package/statistics/features/supported/expression-list/index.js +0 -6
  221. package/statistics/features/supported/expression-list/post-process.d.ts +0 -3
  222. package/statistics/features/supported/expression-list/post-process.js +0 -44
  223. package/statistics/features/supported/index.d.ts +0 -10
  224. package/statistics/features/supported/index.js +0 -27
  225. package/statistics/features/supported/loops/index.d.ts +0 -1
  226. package/statistics/features/supported/loops/index.js +0 -6
  227. package/statistics/features/supported/loops/loops.d.ts +0 -20
  228. package/statistics/features/supported/loops/loops.js +0 -79
  229. package/statistics/features/supported/loops/post-process.d.ts +0 -3
  230. package/statistics/features/supported/loops/post-process.js +0 -72
  231. package/statistics/features/supported/used-functions/index.d.ts +0 -1
  232. package/statistics/features/supported/used-functions/index.js +0 -6
  233. package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
  234. package/statistics/features/supported/used-functions/post-process.js +0 -179
  235. package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
  236. package/statistics/features/supported/used-functions/used-functions.js +0 -95
  237. package/statistics/features/supported/used-packages/index.d.ts +0 -1
  238. package/statistics/features/supported/used-packages/index.js +0 -6
  239. package/statistics/features/supported/used-packages/post-process.d.ts +0 -3
  240. package/statistics/features/supported/used-packages/post-process.js +0 -121
  241. package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
  242. package/statistics/features/supported/used-packages/used-packages.js +0 -130
  243. package/statistics/features/supported/values/index.d.ts +0 -1
  244. package/statistics/features/supported/values/index.js +0 -6
  245. package/statistics/features/supported/values/post-process.d.ts +0 -3
  246. package/statistics/features/supported/values/post-process.js +0 -72
  247. package/statistics/features/supported/values/values.d.ts +0 -14
  248. package/statistics/features/supported/values/values.js +0 -101
  249. package/statistics/features/supported/variables/index.d.ts +0 -1
  250. package/statistics/features/supported/variables/index.js +0 -6
  251. package/statistics/features/supported/variables/post-process.d.ts +0 -9
  252. package/statistics/features/supported/variables/post-process.js +0 -122
  253. package/statistics/features/supported/variables/variables.d.ts +0 -15
  254. package/statistics/features/supported/variables/variables.js +0 -70
  255. package/statistics/index.d.ts +0 -6
  256. package/statistics/index.js +0 -24
  257. package/statistics/meta-statistics.d.ts +0 -33
  258. package/statistics/meta-statistics.js +0 -17
  259. package/statistics/output/file-provider.d.ts +0 -37
  260. package/statistics/output/file-provider.js +0 -97
  261. package/statistics/output/index.d.ts +0 -4
  262. package/statistics/output/index.js +0 -21
  263. package/statistics/output/print-stats.d.ts +0 -17
  264. package/statistics/output/print-stats.js +0 -69
  265. package/statistics/output/statistics-file.d.ts +0 -37
  266. package/statistics/output/statistics-file.js +0 -69
  267. package/statistics/statistics.d.ts +0 -24
  268. package/statistics/statistics.js +0 -109
  269. package/util/summarizer/auto-detect.d.ts +0 -2
  270. package/util/summarizer/auto-detect.js +0 -32
  271. package/util/summarizer/benchmark/data.d.ts +0 -66
  272. package/util/summarizer/benchmark/data.js +0 -13
  273. package/util/summarizer/benchmark/first-phase/input.d.ts +0 -2
  274. package/util/summarizer/benchmark/first-phase/input.js +0 -59
  275. package/util/summarizer/benchmark/first-phase/process.d.ts +0 -10
  276. package/util/summarizer/benchmark/first-phase/process.js +0 -208
  277. package/util/summarizer/benchmark/second-phase/graph.d.ts +0 -2
  278. package/util/summarizer/benchmark/second-phase/graph.js +0 -54
  279. package/util/summarizer/benchmark/second-phase/process.d.ts +0 -4
  280. package/util/summarizer/benchmark/second-phase/process.js +0 -89
  281. package/util/summarizer/benchmark/summarizer.d.ts +0 -35
  282. package/util/summarizer/benchmark/summarizer.js +0 -49
  283. package/util/summarizer/statistics/first-phase/process.d.ts +0 -6
  284. package/util/summarizer/statistics/first-phase/process.js +0 -81
  285. package/util/summarizer/statistics/post-process/clusterer.d.ts +0 -26
  286. package/util/summarizer/statistics/post-process/clusterer.js +0 -43
  287. package/util/summarizer/statistics/post-process/file-based-count.d.ts +0 -17
  288. package/util/summarizer/statistics/post-process/file-based-count.js +0 -49
  289. package/util/summarizer/statistics/post-process/histogram.d.ts +0 -59
  290. package/util/summarizer/statistics/post-process/histogram.js +0 -128
  291. package/util/summarizer/statistics/post-process/index.d.ts +0 -4
  292. package/util/summarizer/statistics/post-process/index.js +0 -21
  293. package/util/summarizer/statistics/post-process/post-process-output.d.ts +0 -16
  294. package/util/summarizer/statistics/post-process/post-process-output.js +0 -104
  295. package/util/summarizer/statistics/second-phase/process.d.ts +0 -11
  296. package/util/summarizer/statistics/second-phase/process.js +0 -117
  297. package/util/summarizer/statistics/summarizer.d.ts +0 -35
  298. package/util/summarizer/statistics/summarizer.js +0 -135
  299. package/util/summarizer/summarizer.js +0 -13
  300. /package/{statistics/output → util}/ansi.d.ts +0 -0
@@ -1,35 +0,0 @@
1
- /**
2
- * Provides the capability of connecting to the repl of flowr via messages.
3
- *
4
- * @module
5
- */
6
- import * as Joi from 'joi';
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
- /**
13
- * If you send a message it must *not* contain a newline but the message must be terminated by a newline.
14
- */
15
- export interface IdMessageBase {
16
- /**
17
- * The at this time unknown type
18
- */
19
- type: string;
20
- /**
21
- * The id that links a request with its responses, it is up to the calling client to make sure it is unique.
22
- * However, the client does not have to pass the id if it does not need to link the request with its response.
23
- * The id is always undefined if the message is unprompted (e.g., with hello) or the id unknown.
24
- */
25
- id: string | undefined;
26
- }
27
- export interface MessageDefinition<T extends FlowrMessage | IdMessageBase> {
28
- type: T['type'] | undefined;
29
- schema: Joi.Schema;
30
- }
31
- export declare const baseMessage: MessageDefinition<IdMessageBase>;
32
- /**
33
- * This is the main message type that should be used to represent a message in *flowR*
34
- */
35
- export type FlowrMessage = FlowrHelloResponseMessage | FileAnalysisRequestMessage | FileAnalysisResponseMessageJson | ExecuteRequestMessage | ExecuteIntermediateResponseMessage | ExecuteEndMessage | SliceRequestMessage | SliceResponseMessage | FlowrErrorMessage;
@@ -1,40 +0,0 @@
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;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.baseMessage = void 0;
27
- /**
28
- * Provides the capability of connecting to the repl of flowr via messages.
29
- *
30
- * @module
31
- */
32
- const Joi = __importStar(require("joi"));
33
- exports.baseMessage = {
34
- type: '**base**',
35
- schema: Joi.object({
36
- type: Joi.string().required(),
37
- id: Joi.string().optional()
38
- }).unknown(true)
39
- };
40
- //# sourceMappingURL=messages.js.map
@@ -1,33 +0,0 @@
1
- import type { IdMessageBase, MessageDefinition } from './messages';
2
- /**
3
- * Request the execution of the given expression as a REPL statement.
4
- * We strongly recommend that you make use of a unique {@link IdMessageBase#id}
5
- * in case the message responses happen in parallel.
6
- *
7
- * @see ExecuteIntermediateResponseMessage
8
- * @see ExecuteEndMessage
9
- */
10
- export interface ExecuteRequestMessage extends IdMessageBase {
11
- type: 'request-repl-execution';
12
- /** Should ansi formatting be enabled for the response? Is `false` by default. */
13
- ansi?: boolean;
14
- /** The expression to execute */
15
- expression: string;
16
- }
17
- export declare const requestExecuteReplExpressionMessage: MessageDefinition<ExecuteRequestMessage>;
18
- /**
19
- * This message may be sent multiple times, triggered for every "output" performed by the execution.
20
- * {@link ExecuteEndMessage} marks the end of these messages.
21
- */
22
- export interface ExecuteIntermediateResponseMessage extends IdMessageBase {
23
- type: 'response-repl-execution';
24
- stream: 'stdout' | 'stderr';
25
- result: string;
26
- }
27
- /**
28
- * Marks the end of the execution of the respective {@link ExecuteRequestMessage}.
29
- * The underlying TCP connection should ensure the ordering so that this message is the last.
30
- */
31
- export interface ExecuteEndMessage extends IdMessageBase {
32
- type: 'end-repl-execution';
33
- }
@@ -1,37 +0,0 @@
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;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.requestExecuteReplExpressionMessage = void 0;
27
- const Joi = __importStar(require("joi"));
28
- exports.requestExecuteReplExpressionMessage = {
29
- type: 'request-repl-execution',
30
- schema: Joi.object({
31
- type: Joi.string().valid('request-repl-execution').required(),
32
- id: Joi.string().optional(),
33
- ansi: Joi.boolean().optional(),
34
- expression: Joi.string().required(),
35
- })
36
- };
37
- //# sourceMappingURL=repl.js.map
@@ -1,25 +0,0 @@
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
- /**
5
- * Can only be sent after you have sent the {@link FileAnalysisRequestMessage}.
6
- * Using the same `filetoken` as in the {@link FileAnalysisRequestMessage} you
7
- * can slice the respective file given the respective criteria.
8
- */
9
- export interface SliceRequestMessage extends IdMessageBase {
10
- type: 'request-slice';
11
- /** The {@link FileAnalysisRequestMessage#filetoken} of the file/data to slice */
12
- filetoken: string;
13
- /** The slicing criteria to use */
14
- criterion: SlicingCriteria;
15
- }
16
- export declare const requestSliceMessage: MessageDefinition<SliceRequestMessage>;
17
- /**
18
- * Similar to {@link FileAnalysisResponseMessage} this only contains the results of
19
- * the slice steps.
20
- */
21
- export interface SliceResponseMessage extends IdMessageBase {
22
- type: 'response-slice';
23
- /** only contains the results of the slice steps to not repeat ourselves */
24
- results: Omit<StepResults<typeof LAST_STEP>, keyof StepResults<typeof LAST_PER_FILE_STEP>>;
25
- }
@@ -1,37 +0,0 @@
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;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.requestSliceMessage = void 0;
27
- const Joi = __importStar(require("joi"));
28
- exports.requestSliceMessage = {
29
- type: 'request-slice',
30
- schema: Joi.object({
31
- type: Joi.string().valid('request-slice').required(),
32
- id: Joi.string().optional(),
33
- filetoken: Joi.string().required(),
34
- criterion: Joi.array().items(Joi.string().regex(/\d+:\d+|\d+@.*|\$\d+/)).min(0).required()
35
- })
36
- };
37
- //# sourceMappingURL=slice.js.map
@@ -1,49 +0,0 @@
1
- /// <reference types="node" />
2
- import type WebSocket from 'ws';
3
- /** Function handler that should be triggered when the respective socket connects */
4
- export type OnConnect = (c: Socket) => void;
5
- /**
6
- * A generic server interface that allows us to mock the server's behavior in tests.
7
- */
8
- export interface Server {
9
- /**
10
- * Register a function to be called when a new socket connects.
11
- * This should be only called once per server.
12
- */
13
- onConnect(handler: OnConnect): void;
14
- start(port: number): void;
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
- }
22
- /**
23
- * The socket abstraction of *flowR*.
24
- * Essentially a subset of what the default `net.Socket` of `node` provides.
25
- */
26
- export interface Socket {
27
- remoteAddress?: string;
28
- remotePort?: number;
29
- on(event: 'error', listener: (e: unknown) => void): void;
30
- on(event: 'close', listener: () => void): void;
31
- on(event: 'data', listener: (data: Buffer) => void): void;
32
- write(data: string): void;
33
- end(): void;
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
- }
44
- export declare class NetServer implements Server {
45
- private readonly server;
46
- constructor();
47
- onConnect(handler: OnConnect): void;
48
- start(port: number): void;
49
- }
@@ -1,63 +0,0 @@
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.NetServer = exports.WebSocketWrapper = exports.WebSocketServerWrapper = void 0;
7
- /**
8
- * This is just a simple layer to allow me to mock the server's behavior in tests.
9
- */
10
- const node_net_1 = __importDefault(require("node: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;
50
- class NetServer {
51
- server;
52
- constructor() {
53
- this.server = node_net_1.default.createServer();
54
- }
55
- onConnect(handler) {
56
- this.server.on('connection', handler);
57
- }
58
- start(port) {
59
- this.server.listen(port);
60
- }
61
- }
62
- exports.NetServer = NetServer;
63
- //# sourceMappingURL=net.js.map
@@ -1,4 +0,0 @@
1
- import type { IdMessageBase } from './messages/messages';
2
- import type { Socket } from './net';
3
- export declare function getUnnamedSocketName(c: Socket): string;
4
- export declare function sendMessage<T extends IdMessageBase>(c: Socket, message: T): void;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendMessage = exports.getUnnamedSocketName = void 0;
4
- const json_1 = require("../../../util/json");
5
- const server_1 = require("./server");
6
- function getUnnamedSocketName(c) {
7
- return `${c.remoteAddress ?? '?'}@${c.remotePort ?? '?'}`;
8
- }
9
- exports.getUnnamedSocketName = getUnnamedSocketName;
10
- function sendMessage(c, message) {
11
- const msg = JSON.stringify(message, json_1.jsonReplacer);
12
- if (server_1.serverLog.settings.minLevel >= 2 /* LogLevel.Debug */) {
13
- server_1.serverLog.debug(`[${getUnnamedSocketName(c)}] sending message: ${msg}`);
14
- }
15
- c.write(`${msg}\n`);
16
- }
17
- exports.sendMessage = sendMessage;
18
- //# sourceMappingURL=send.js.map
@@ -1,20 +0,0 @@
1
- import type { RShell } from '../../../r-bridge';
2
- import type { Server } from './net';
3
- import { FlowrLogger } from '../../../util/log';
4
- export declare const serverLog: FlowrLogger;
5
- /**
6
- * This class controls the TCP server, which can be started by calling {@link start}.
7
- * Afterward, each incoming connection will be greeted with {@link helloClient} and from
8
- * thereon be handled by a {@link FlowRServerConnection}.
9
- */
10
- export declare class FlowRServer {
11
- private readonly server;
12
- private readonly shell;
13
- private versionInformation;
14
- /** maps names to the respective connection */
15
- private connections;
16
- private nameCounter;
17
- constructor(shell: RShell, server?: Server);
18
- start(port: number): Promise<void>;
19
- private onConnect;
20
- }
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowRServer = exports.serverLog = void 0;
4
- const version_1 = require("../commands/version");
5
- const connection_1 = require("./connection");
6
- const send_1 = require("./send");
7
- const net_1 = require("./net");
8
- const log_1 = require("../../../util/log");
9
- // we detach from the main logger so that it can have its own switch
10
- exports.serverLog = new log_1.FlowrLogger({ name: 'server' });
11
- /**
12
- * This class controls the TCP server, which can be started by calling {@link start}.
13
- * Afterward, each incoming connection will be greeted with {@link helloClient} and from
14
- * thereon be handled by a {@link FlowRServerConnection}.
15
- */
16
- class FlowRServer {
17
- server;
18
- shell;
19
- versionInformation;
20
- /** maps names to the respective connection */
21
- connections = new Map();
22
- nameCounter = 0;
23
- constructor(shell, server = new net_1.NetServer()) {
24
- this.server = server;
25
- this.server.onConnect(c => this.onConnect(c));
26
- this.shell = shell;
27
- }
28
- async start(port) {
29
- this.versionInformation = await (0, version_1.retrieveVersionInformation)(this.shell);
30
- this.server.start(port);
31
- exports.serverLog.info(`Server listening on port ${port}`);
32
- }
33
- onConnect(c) {
34
- if (!this.versionInformation) {
35
- notYetInitialized(c, undefined);
36
- return;
37
- }
38
- const name = `client-${this.nameCounter++}`;
39
- exports.serverLog.info(`Client connected: ${(0, send_1.getUnnamedSocketName)(c)} as "${name}"`);
40
- this.connections.set(name, new connection_1.FlowRServerConnection(c, name, this.shell));
41
- helloClient(c, name, this.versionInformation);
42
- c.on('close', () => {
43
- this.connections.delete(name);
44
- exports.serverLog.info(`Client "${name}" disconnected (${(0, send_1.getUnnamedSocketName)(c)})`);
45
- });
46
- }
47
- }
48
- exports.FlowRServer = FlowRServer;
49
- function notYetInitialized(c, id) {
50
- (0, send_1.sendMessage)(c, {
51
- id,
52
- type: 'error',
53
- fatal: true,
54
- reason: 'Server not initialized yet (or failed to), please try again later.'
55
- });
56
- c.end();
57
- }
58
- function helloClient(c, name, versionInformation) {
59
- (0, send_1.sendMessage)(c, {
60
- id: undefined,
61
- type: 'hello',
62
- clientName: name,
63
- versions: versionInformation
64
- });
65
- }
66
- //# sourceMappingURL=server.js.map
@@ -1,15 +0,0 @@
1
- import type * as Joi from 'joi';
2
- import type { FlowrMessage, IdMessageBase, MessageDefinition } from './messages/messages';
3
- import type { Socket } from './net';
4
- export interface ValidationErrorResult {
5
- type: 'error';
6
- reason: Joi.ValidationError | Error;
7
- }
8
- export interface SuccessValidationResult<T extends IdMessageBase> {
9
- type: 'success';
10
- message: T;
11
- }
12
- export type ValidationResult<T extends IdMessageBase> = SuccessValidationResult<T> | ValidationErrorResult;
13
- export declare function validateBaseMessageFormat(input: string): ValidationResult<IdMessageBase>;
14
- export declare function validateMessage<T extends FlowrMessage | IdMessageBase>(input: IdMessageBase, def: MessageDefinition<T>): ValidationResult<T>;
15
- export declare function answerForValidationError(client: Socket, result: ValidationErrorResult, id?: string): void;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.answerForValidationError = exports.validateMessage = exports.validateBaseMessageFormat = void 0;
4
- const send_1 = require("./send");
5
- const messages_1 = require("./messages/messages");
6
- function validateBaseMessageFormat(input) {
7
- try {
8
- return validateMessage(JSON.parse(input), messages_1.baseMessage);
9
- }
10
- catch (e) {
11
- return { type: 'error', reason: e };
12
- }
13
- }
14
- exports.validateBaseMessageFormat = validateBaseMessageFormat;
15
- function validateMessage(input, def) {
16
- try {
17
- const result = def.schema.validate(input);
18
- return result.error ? { type: 'error', reason: result.error } : { type: 'success', message: input };
19
- }
20
- catch (e) {
21
- return { type: 'error', reason: e };
22
- }
23
- }
24
- exports.validateMessage = validateMessage;
25
- function answerForValidationError(client, result, id) {
26
- (0, send_1.sendMessage)(client, {
27
- type: 'error',
28
- fatal: false,
29
- id: id,
30
- reason: `Invalid message format: ${result.reason.message}`
31
- });
32
- }
33
- exports.answerForValidationError = answerForValidationError;
34
- //# sourceMappingURL=validate.js.map
@@ -1,11 +0,0 @@
1
- export interface SlicerCliOptions {
2
- verbose: boolean;
3
- help: boolean;
4
- input: string | undefined;
5
- criterion: string | undefined;
6
- output: string | undefined;
7
- diff: boolean;
8
- 'input-is-text': boolean;
9
- stats: boolean;
10
- api: boolean;
11
- }
package/cli/slicer-app.js DELETED
@@ -1,81 +0,0 @@
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
- const log_1 = require("../util/log");
7
- const fs_1 = __importDefault(require("fs"));
8
- const assert_1 = require("../util/assert");
9
- const benchmark_1 = require("../benchmark");
10
- const common_1 = require("./common");
11
- const json_1 = require("../util/json");
12
- const slice_diff_ansi_1 = require("../core/print/slice-diff-ansi");
13
- const options = (0, common_1.processCommandLineArgs)('slicer', ['input', 'criterion'], {
14
- subtitle: 'Slice R code based on a given slicing criterion',
15
- examples: [
16
- '{bold -c} {italic "12@product"} {italic test/testfiles/example.R}',
17
- // why double escaped :C
18
- '{bold -c} {italic "3@a"} {bold -r} {italic "a <- 3\\\\nb <- 4\\\\nprint(a)"} {bold --diff}',
19
- '{bold -i} {italic example.R} {bold --stats} {bold --criterion} {italic "8:3;3:1;12@product"}',
20
- '{bold --help}'
21
- ]
22
- });
23
- async function getSlice() {
24
- const slicer = new benchmark_1.BenchmarkSlicer();
25
- (0, assert_1.guard)(options.input !== undefined, 'input must be given');
26
- (0, assert_1.guard)(options.criterion !== undefined, 'a slicing criterion must be given');
27
- await slicer.init(options['input-is-text'] ? { request: 'text', content: options.input } : { request: 'file', content: options.input });
28
- let mappedSlices = [];
29
- let reconstruct = undefined;
30
- const doSlicing = options.criterion.trim() !== '';
31
- let slice = undefined;
32
- if (doSlicing) {
33
- const slices = options.criterion.split(';').map(c => c.trim());
34
- try {
35
- const { stats: { reconstructedCode, slicingCriteria }, slice: sliced } = await slicer.slice(...slices);
36
- slice = sliced;
37
- mappedSlices = slicingCriteria;
38
- reconstruct = reconstructedCode;
39
- if (options.output) {
40
- console.log('Written reconstructed code to', options.output);
41
- console.log(`Automatically selected ${reconstructedCode.autoSelected} statements`);
42
- fs_1.default.writeFileSync(options.output, reconstructedCode.code);
43
- }
44
- else if (!options.api && !options.diff) {
45
- console.log(reconstructedCode.code);
46
- }
47
- }
48
- catch (e) {
49
- log_1.log.error(`[Skipped] Error while processing ${options.input}: ${e.message} (${e.stack ?? ''})`);
50
- }
51
- }
52
- const { stats, normalize, parse, tokenMap, dataflow } = slicer.finish();
53
- const mappedCriteria = mappedSlices.map(c => ` ${c.criterion} => ${c.id} (${JSON.stringify(normalize.idMap.get(c.id)?.location)})`).join('\n');
54
- log_1.log.info(`Mapped criteria:\n${mappedCriteria}`);
55
- const sliceStatsAsString = (0, benchmark_1.stats2string)(await (0, benchmark_1.summarizeSlicerStats)(stats));
56
- if (options.api) {
57
- const output = {
58
- tokenMap,
59
- parse,
60
- normalize,
61
- dataflow,
62
- ...(options.stats ? { stats } : {}),
63
- ...(doSlicing ? { slice: mappedSlices, reconstruct } : {})
64
- };
65
- console.log(JSON.stringify(output, json_1.jsonReplacer));
66
- }
67
- else {
68
- if (doSlicing && options.diff) {
69
- const originalCode = options['input-is-text'] ? options.input : fs_1.default.readFileSync(options.input).toString();
70
- console.log((0, slice_diff_ansi_1.sliceDiffAnsi)(slice.result, normalize, new Set(mappedSlices.map(({ id }) => id)), originalCode));
71
- }
72
- if (options.stats) {
73
- console.log(sliceStatsAsString);
74
- const filename = `${options.input}.stats`;
75
- console.log(`Writing stats for ${options.input} to "${filename}"`);
76
- fs_1.default.writeFileSync(filename, sliceStatsAsString);
77
- }
78
- }
79
- }
80
- void getSlice();
81
- //# sourceMappingURL=slicer-app.js.map
@@ -1,11 +0,0 @@
1
- export interface StatsCliOptions {
2
- readonly verbose: boolean;
3
- readonly help: boolean;
4
- readonly limit: number | undefined;
5
- readonly input: string[];
6
- readonly 'dump-json': boolean;
7
- readonly 'output-dir': string;
8
- readonly 'no-ansi': boolean;
9
- readonly parallel: number;
10
- readonly features: string[];
11
- }