@eagleoutice/flowr 2.10.9 → 2.11.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 (417) hide show
  1. package/README.md +116 -38
  2. package/abstract-interpretation/absint-visitor.js +6 -3
  3. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
  4. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
  5. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  6. package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
  7. package/abstract-interpretation/domains/interval-domain.js +1 -1
  8. package/abstract-interpretation/domains/lattice.d.ts +1 -1
  9. package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
  10. package/abstract-interpretation/domains/partial-product-domain.js +2 -2
  11. package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
  12. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  13. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
  14. package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
  15. package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
  16. package/abstract-interpretation/domains/singleton-domain.js +1 -1
  17. package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
  19. package/abstract-interpretation/unsupported-functions.d.ts +3 -2
  20. package/abstract-interpretation/unsupported-functions.js +38 -28
  21. package/cli/benchmark-app.js +2 -1
  22. package/cli/common/options.d.ts +2 -108
  23. package/cli/common/options.js +3 -27
  24. package/cli/common/script.js +3 -2
  25. package/cli/common/scripts-info.d.ts +2 -123
  26. package/cli/common/scripts-info.js +0 -17
  27. package/cli/flowr-main-options.d.ts +5 -0
  28. package/cli/flowr-main-options.js +10 -0
  29. package/cli/flowr.js +48 -11
  30. package/cli/repl/commands/repl-cfg.js +9 -9
  31. package/cli/repl/commands/repl-commands.js +5 -0
  32. package/cli/repl/commands/repl-dataflow.js +31 -24
  33. package/cli/repl/commands/repl-main.d.ts +6 -0
  34. package/cli/repl/commands/repl-normalize.js +15 -12
  35. package/cli/repl/commands/repl-parse.js +1 -1
  36. package/cli/repl/commands/repl-query.js +4 -5
  37. package/cli/repl/commands/repl-quit.js +2 -1
  38. package/cli/repl/core.d.ts +11 -0
  39. package/cli/repl/core.js +101 -3
  40. package/cli/repl/execute.js +3 -2
  41. package/cli/repl/parser/slice-query-parser.d.ts +16 -0
  42. package/cli/repl/parser/slice-query-parser.js +52 -0
  43. package/cli/repl/print-version.d.ts +3 -1
  44. package/cli/repl/print-version.js +21 -2
  45. package/cli/repl/server/connection.d.ts +3 -0
  46. package/cli/repl/server/connection.js +65 -31
  47. package/cli/repl/server/messages/message-analysis.d.ts +10 -0
  48. package/cli/repl/server/messages/message-analysis.js +6 -2
  49. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  50. package/cli/script-core/summarizer-core.js +13 -32
  51. package/cli/wiki.d.ts +3 -1
  52. package/cli/wiki.js +6 -1
  53. package/config.d.ts +22 -10
  54. package/config.js +33 -7
  55. package/control-flow/diff-cfg.d.ts +1 -1
  56. package/control-flow/diff-cfg.js +1 -1
  57. package/control-flow/semantic-cfg-guided-visitor.js +2 -0
  58. package/control-flow/simple-visitor.js +6 -5
  59. package/control-flow/useless-loop.js +2 -2
  60. package/core/print/dataflow-printer.d.ts +2 -2
  61. package/core/print/dataflow-printer.js +2 -2
  62. package/core/steps/all/static-slicing/00-slice.js +1 -1
  63. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  64. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  65. package/dataflow/environments/append.d.ts +2 -2
  66. package/dataflow/environments/append.js +4 -10
  67. package/dataflow/environments/apply-kill.d.ts +21 -0
  68. package/dataflow/environments/apply-kill.js +155 -0
  69. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  70. package/dataflow/environments/built-in-proc-name.js +4 -0
  71. package/dataflow/environments/built-in.d.ts +4 -0
  72. package/dataflow/environments/built-in.js +4 -0
  73. package/dataflow/environments/default-builtin-config.d.ts +183 -67
  74. package/dataflow/environments/default-builtin-config.js +358 -147
  75. package/dataflow/environments/environment.d.ts +49 -31
  76. package/dataflow/environments/environment.js +144 -25
  77. package/dataflow/environments/identifier.d.ts +65 -2
  78. package/dataflow/environments/identifier.js +37 -2
  79. package/dataflow/environments/overwrite.js +2 -10
  80. package/dataflow/environments/reference-to-maybe.d.ts +2 -0
  81. package/dataflow/environments/reference-to-maybe.js +56 -11
  82. package/dataflow/environments/resolve-by-name.d.ts +1 -1
  83. package/dataflow/environments/resolve-by-name.js +23 -9
  84. package/dataflow/environments/scoping.d.ts +9 -2
  85. package/dataflow/environments/scoping.js +15 -2
  86. package/dataflow/eval/values/general.js +4 -0
  87. package/dataflow/extractor.js +35 -4
  88. package/dataflow/graph/df-helper.d.ts +14 -0
  89. package/dataflow/graph/df-helper.js +41 -0
  90. package/dataflow/graph/graph.d.ts +4 -1
  91. package/dataflow/graph/graph.js +6 -2
  92. package/dataflow/info.d.ts +27 -1
  93. package/dataflow/internal/linker.d.ts +5 -1
  94. package/dataflow/internal/linker.js +34 -9
  95. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
  96. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
  97. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
  98. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
  99. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
  100. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
  101. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
  102. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +7 -2
  103. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
  104. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +61 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
  106. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
  107. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
  108. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
  109. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
  110. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  111. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +3 -2
  112. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +132 -25
  113. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
  114. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
  115. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
  116. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +11 -4
  117. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
  118. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
  119. package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
  120. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  121. package/dataflow/internal/process/functions/call/named-call-handling.js +23 -0
  122. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  123. package/dataflow/origin/dfg-get-origin.js +1 -1
  124. package/dataflow/processor.d.ts +6 -0
  125. package/documentation/data/faq/faqs.d.ts +2 -1
  126. package/documentation/data/faq/faqs.js +78 -57
  127. package/documentation/data/interface/doc-writing-code.js +4 -80
  128. package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
  129. package/documentation/data/server/doc-data-server-messages.js +15 -7
  130. package/documentation/doc-readme.js +15 -15
  131. package/documentation/doc-util/doc-cfg.d.ts +3 -1
  132. package/documentation/doc-util/doc-cfg.js +3 -3
  133. package/documentation/doc-util/doc-dfg.d.ts +3 -1
  134. package/documentation/doc-util/doc-dfg.js +3 -3
  135. package/documentation/doc-util/doc-files.d.ts +3 -1
  136. package/documentation/doc-util/doc-files.js +9 -6
  137. package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
  138. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  139. package/documentation/doc-util/doc-query.d.ts +2 -1
  140. package/documentation/doc-util/doc-query.js +2 -2
  141. package/documentation/doc-util/doc-repl.js +1 -0
  142. package/documentation/doc-util/doc-structure.js +1 -2
  143. package/documentation/doc-util/doc-types.d.ts +6 -6
  144. package/documentation/doc-util/doc-types.js +11 -9
  145. package/documentation/issue-linting-rule.js +1 -2
  146. package/documentation/wiki-analyzer.js +9 -9
  147. package/documentation/wiki-cfg.js +40 -41
  148. package/documentation/wiki-core.js +121 -32
  149. package/documentation/wiki-create-linting-rules.d.ts +6 -0
  150. package/documentation/wiki-create-linting-rules.js +95 -0
  151. package/documentation/wiki-dataflow-graph.js +112 -77
  152. package/documentation/wiki-engine.js +1 -2
  153. package/documentation/wiki-faq.d.ts +2 -1
  154. package/documentation/wiki-faq.js +4 -4
  155. package/documentation/wiki-interface.js +22 -8
  156. package/documentation/wiki-linter.d.ts +1 -1
  157. package/documentation/wiki-linter.js +16 -6
  158. package/documentation/wiki-linting-and-testing.js +2 -2
  159. package/documentation/wiki-mk/doc-context.d.ts +3 -3
  160. package/documentation/wiki-mk/doc-maker.d.ts +2 -0
  161. package/documentation/wiki-mk/doc-maker.js +7 -1
  162. package/documentation/wiki-normalized-ast.js +5 -5
  163. package/documentation/wiki-onboarding.d.ts +2 -1
  164. package/documentation/wiki-onboarding.js +5 -5
  165. package/documentation/wiki-overview.js +4 -17
  166. package/documentation/wiki-package-database.d.ts +9 -0
  167. package/documentation/wiki-package-database.js +63 -0
  168. package/documentation/wiki-query.js +86 -84
  169. package/documentation/wiki-search.js +4 -5
  170. package/documentation/wiki-setup.js +6 -7
  171. package/gas.d.ts +74 -0
  172. package/gas.js +18 -0
  173. package/linter/linter-executor.js +2 -8
  174. package/linter/linter-format.d.ts +4 -11
  175. package/linter/linter-rules.d.ts +111 -86
  176. package/linter/linter-rules.js +9 -1
  177. package/linter/rules/absolute-path.d.ts +2 -7
  178. package/linter/rules/absolute-path.js +8 -5
  179. package/linter/rules/dataframe-access-validation.d.ts +1 -6
  180. package/linter/rules/dataframe-access-validation.js +8 -6
  181. package/linter/rules/dead-code.d.ts +2 -11
  182. package/linter/rules/dead-code.js +16 -11
  183. package/linter/rules/deprecated-functions.d.ts +3 -3
  184. package/linter/rules/file-path-validity.d.ts +1 -6
  185. package/linter/rules/file-path-validity.js +5 -5
  186. package/linter/rules/function-finder-util.d.ts +7 -11
  187. package/linter/rules/function-finder-util.js +9 -6
  188. package/linter/rules/naming-convention.d.ts +2 -7
  189. package/linter/rules/naming-convention.js +3 -2
  190. package/linter/rules/network-functions.d.ts +2 -7
  191. package/linter/rules/network-functions.js +14 -12
  192. package/linter/rules/no-leaked-credentials.d.ts +36 -0
  193. package/linter/rules/no-leaked-credentials.js +75 -0
  194. package/linter/rules/problematic-inputs.d.ts +1 -8
  195. package/linter/rules/problematic-inputs.js +5 -4
  196. package/linter/rules/roxygen-arguments.d.ts +2 -7
  197. package/linter/rules/roxygen-arguments.js +13 -20
  198. package/linter/rules/seeded-randomness.d.ts +2 -7
  199. package/linter/rules/seeded-randomness.js +7 -4
  200. package/linter/rules/software-has-license.d.ts +31 -0
  201. package/linter/rules/software-has-license.js +46 -0
  202. package/linter/rules/software-has-tests.d.ts +38 -0
  203. package/linter/rules/software-has-tests.js +48 -0
  204. package/linter/rules/stop-with-call-arg.d.ts +2 -7
  205. package/linter/rules/stop-with-call-arg.js +3 -2
  206. package/linter/rules/undefined-symbol.d.ts +39 -0
  207. package/linter/rules/undefined-symbol.js +80 -0
  208. package/linter/rules/unused-definition.d.ts +3 -8
  209. package/linter/rules/unused-definition.js +7 -5
  210. package/linter/rules/useless-loop.d.ts +2 -7
  211. package/linter/rules/useless-loop.js +5 -2
  212. package/package.json +5 -5
  213. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  214. package/project/cache/flowr-analyzer-cache.js +9 -1
  215. package/project/context/flowr-analyzer-context.d.ts +13 -14
  216. package/project/context/flowr-analyzer-context.js +4 -0
  217. package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
  218. package/project/context/flowr-analyzer-dependencies-context.js +36 -4
  219. package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
  220. package/project/context/flowr-analyzer-environment-context.js +3 -4
  221. package/project/context/flowr-analyzer-files-context.d.ts +13 -0
  222. package/project/context/flowr-analyzer-files-context.js +12 -2
  223. package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
  224. package/project/context/flowr-analyzer-gas-context.js +101 -0
  225. package/project/context/flowr-file.d.ts +2 -0
  226. package/project/context/flowr-file.js +2 -0
  227. package/project/flowr-analyzer-builder.js +3 -0
  228. package/project/flowr-analyzer.d.ts +2 -1
  229. package/project/flowr-analyzer.js +3 -1
  230. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
  231. package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
  232. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
  233. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
  234. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
  235. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
  236. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  237. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
  238. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
  239. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
  240. package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
  241. package/project/plugins/flowr-analyzer-plugin.js +14 -7
  242. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
  243. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
  244. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
  245. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
  246. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
  247. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
  248. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  249. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
  250. package/project/plugins/package-version-plugins/package.d.ts +3 -0
  251. package/project/plugins/package-version-plugins/package.js +12 -0
  252. package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
  253. package/project/plugins/package-version-plugins/pkgdb.js +370 -0
  254. package/project/plugins/plugin-registry.d.ts +5 -1
  255. package/project/plugins/plugin-registry.js +10 -1
  256. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
  257. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
  258. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
  259. package/queries/catalog/call-context-query/call-context-query-executor.js +62 -8
  260. package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -2
  261. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  262. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
  263. package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
  264. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
  265. package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
  266. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
  267. package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
  268. package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
  269. package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
  270. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  271. package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
  272. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
  273. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  274. package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
  275. package/queries/catalog/dice-query/dice-query-executor.js +52 -0
  276. package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
  277. package/queries/catalog/dice-query/dice-query-format.js +102 -0
  278. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  279. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  280. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
  281. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  282. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
  283. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  284. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
  285. package/queries/catalog/linter-query/linter-query-executor.js +8 -0
  286. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  287. package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
  288. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  289. package/queries/catalog/origin-query/origin-query-format.js +1 -0
  290. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  291. package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
  292. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  293. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
  294. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  295. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
  296. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  297. package/queries/query.d.ts +18 -1
  298. package/queries/query.js +3 -1
  299. package/r-bridge/data/data.d.ts +7 -2
  300. package/r-bridge/data/data.js +8 -2
  301. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
  302. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
  303. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  304. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
  305. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
  306. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
  307. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
  308. package/r-bridge/parser.js +2 -9
  309. package/r-bridge/shell.d.ts +8 -1
  310. package/r-bridge/shell.js +26 -7
  311. package/search/flowr-search-builder.d.ts +2 -2
  312. package/search/flowr-search-builder.js +1 -1
  313. package/search/flowr-search-filters.d.ts +30 -9
  314. package/search/flowr-search-filters.js +26 -21
  315. package/search/search-executor/search-enrichers.d.ts +601 -1
  316. package/search/search-executor/search-enrichers.js +30 -6
  317. package/slicing/static/static-slicer.d.ts +39 -11
  318. package/slicing/static/static-slicer.js +44 -14
  319. package/util/collections/queue.d.ts +16 -0
  320. package/util/collections/queue.js +38 -0
  321. package/util/log.d.ts +1 -1
  322. package/util/log.js +1 -1
  323. package/util/mermaid/dfg.d.ts +2 -2
  324. package/util/mermaid/dfg.js +2 -2
  325. package/util/mermaid/mermaid.d.ts +4 -0
  326. package/util/mermaid/mermaid.js +8 -1
  327. package/util/objects.d.ts +9 -0
  328. package/util/objects.js +54 -0
  329. package/util/proc.d.ts +6 -0
  330. package/util/proc.js +20 -0
  331. package/util/version.js +10 -2
  332. package/cli/common/features.d.ts +0 -9
  333. package/cli/common/features.js +0 -35
  334. package/cli/script-core/statistics-core.d.ts +0 -6
  335. package/cli/script-core/statistics-core.js +0 -103
  336. package/cli/script-core/statistics-helper-core.d.ts +0 -6
  337. package/cli/script-core/statistics-helper-core.js +0 -85
  338. package/cli/statistics-app.d.ts +0 -11
  339. package/cli/statistics-app.js +0 -16
  340. package/cli/statistics-helper-app.d.ts +0 -11
  341. package/cli/statistics-helper-app.js +0 -14
  342. package/statistics/features/common-syntax-probability.d.ts +0 -38
  343. package/statistics/features/common-syntax-probability.js +0 -169
  344. package/statistics/features/feature.d.ts +0 -179
  345. package/statistics/features/feature.js +0 -38
  346. package/statistics/features/post-processing.d.ts +0 -18
  347. package/statistics/features/post-processing.js +0 -26
  348. package/statistics/features/supported/assignments/assignments.d.ts +0 -12
  349. package/statistics/features/supported/assignments/assignments.js +0 -56
  350. package/statistics/features/supported/assignments/post-process.d.ts +0 -6
  351. package/statistics/features/supported/assignments/post-process.js +0 -126
  352. package/statistics/features/supported/comments/comments.d.ts +0 -18
  353. package/statistics/features/supported/comments/comments.js +0 -143
  354. package/statistics/features/supported/comments/post-process.d.ts +0 -6
  355. package/statistics/features/supported/comments/post-process.js +0 -51
  356. package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
  357. package/statistics/features/supported/control-flow/control-flow.js +0 -69
  358. package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
  359. package/statistics/features/supported/control-flow/post-process.js +0 -66
  360. package/statistics/features/supported/data-access/data-access.d.ts +0 -15
  361. package/statistics/features/supported/data-access/data-access.js +0 -122
  362. package/statistics/features/supported/data-access/post-process.d.ts +0 -6
  363. package/statistics/features/supported/data-access/post-process.js +0 -108
  364. package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
  365. package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
  366. package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
  367. package/statistics/features/supported/defined-functions/post-process.js +0 -168
  368. package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
  369. package/statistics/features/supported/expression-list/post-process.js +0 -45
  370. package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
  371. package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
  372. package/statistics/features/supported/loops/loops.d.ts +0 -20
  373. package/statistics/features/supported/loops/loops.js +0 -81
  374. package/statistics/features/supported/loops/post-process.d.ts +0 -6
  375. package/statistics/features/supported/loops/post-process.js +0 -73
  376. package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
  377. package/statistics/features/supported/used-functions/post-process.js +0 -176
  378. package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
  379. package/statistics/features/supported/used-functions/used-functions.js +0 -99
  380. package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
  381. package/statistics/features/supported/used-packages/post-process.js +0 -122
  382. package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
  383. package/statistics/features/supported/used-packages/used-packages.js +0 -140
  384. package/statistics/features/supported/values/post-process.d.ts +0 -6
  385. package/statistics/features/supported/values/post-process.js +0 -73
  386. package/statistics/features/supported/values/values.d.ts +0 -14
  387. package/statistics/features/supported/values/values.js +0 -111
  388. package/statistics/features/supported/variables/post-process.d.ts +0 -15
  389. package/statistics/features/supported/variables/post-process.js +0 -126
  390. package/statistics/features/supported/variables/variables.d.ts +0 -15
  391. package/statistics/features/supported/variables/variables.js +0 -62
  392. package/statistics/meta-statistics.d.ts +0 -32
  393. package/statistics/meta-statistics.js +0 -16
  394. package/statistics/output/file-provider.d.ts +0 -36
  395. package/statistics/output/file-provider.js +0 -96
  396. package/statistics/output/print-stats.d.ts +0 -29
  397. package/statistics/output/print-stats.js +0 -81
  398. package/statistics/output/statistics-file.d.ts +0 -36
  399. package/statistics/output/statistics-file.js +0 -68
  400. package/statistics/statistics.d.ts +0 -29
  401. package/statistics/statistics.js +0 -108
  402. package/statistics/summarizer/auto-detect.d.ts +0 -5
  403. package/statistics/summarizer/auto-detect.js +0 -34
  404. package/statistics/summarizer/first-phase/process.d.ts +0 -6
  405. package/statistics/summarizer/first-phase/process.js +0 -81
  406. package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
  407. package/statistics/summarizer/post-process/clusterer.js +0 -40
  408. package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
  409. package/statistics/summarizer/post-process/file-based-count.js +0 -47
  410. package/statistics/summarizer/post-process/histogram.d.ts +0 -57
  411. package/statistics/summarizer/post-process/histogram.js +0 -126
  412. package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
  413. package/statistics/summarizer/post-process/post-process-output.js +0 -102
  414. package/statistics/summarizer/second-phase/process.d.ts +0 -15
  415. package/statistics/summarizer/second-phase/process.js +0 -118
  416. package/statistics/summarizer/summarizer.d.ts +0 -34
  417. package/statistics/summarizer/summarizer.js +0 -141
@@ -3,43 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UnsupportedFunctions = void 0;
4
4
  const identifier_1 = require("../dataflow/environments/identifier");
5
5
  const vertex_1 = require("../dataflow/graph/vertex");
6
+ const record_1 = require("../util/record");
7
+ function unsupportedFunctions(functions) {
8
+ return record_1.Record.entries(functions).map(([identifier, info]) => ({ identifier: identifier_1.Identifier.parse(identifier), ...info }));
9
+ }
6
10
  /**
7
11
  * List of known function calls that may change the environment unresolvable/implicitly.
8
12
  */
9
- const UnsupportedFunctionsList = {
10
- '.Primitive': { package: 'base' },
11
- '.Internal': { package: 'base' },
12
- '.External': { package: 'base' },
13
- '.Call': { package: 'base' },
14
- '.C': { package: 'base' },
15
- '.Fortran': { package: 'base' },
16
- '.dyn.load': { package: 'base' },
17
- 'eval': { package: 'base' },
18
- 'evalq': { package: 'base' },
19
- 'eval.parent': { package: 'base' },
20
- 'eval_tidy': { package: 'rlang' },
21
- 'eval_bare': { package: 'rlang' },
22
- 'body<-': { package: 'base' },
23
- 'formals<-': { package: 'base' },
24
- 'environment<-': { package: 'base' },
25
- 'load': { package: 'base' },
26
- 'attach': { package: 'base' },
27
- 'detach': { package: 'base' },
28
- 'rm': { package: 'base' },
29
- 'remove': { package: 'base' },
30
- 'list2env': { package: 'base' },
31
- 'assignInNamespace': { package: 'utils' },
32
- 'assignInMyNamespace': { package: 'utils' },
33
- };
13
+ const UnsupportedFunctionsList = unsupportedFunctions({
14
+ 'base::.Primitive': {},
15
+ 'base::.Internal': {},
16
+ 'base::.External': {},
17
+ 'base::.Call': {},
18
+ 'base::.C': {},
19
+ 'base::.Fortran': {},
20
+ 'base::.dyn.load': {},
21
+ 'base::eval': {},
22
+ 'base::evalq': {},
23
+ 'base::eval.parent': {},
24
+ 'rlang::eval_tidy': {},
25
+ 'rlang::eval_bare': {},
26
+ 'base::body<-': {},
27
+ 'base::formals<-': {},
28
+ 'base::environment<-': {},
29
+ 'base::load': {},
30
+ 'base::attach': {},
31
+ 'base::detach': {},
32
+ 'base::rm': {},
33
+ 'base::remove': {},
34
+ 'base::list2env': {},
35
+ 'base::assign': { condition: (vertex, dfg) => dfg.unknownSideEffects.has(vertex.id) },
36
+ 'base::delayedAssign': { condition: (vertex, dfg) => dfg.unknownSideEffects.has(vertex.id) },
37
+ 'utils::assignInNamespace': {},
38
+ 'utils::assignInMyNamespace': {},
39
+ });
34
40
  /**
35
41
  * Helper for unsupported functions that may change the environment.
36
42
  */
37
43
  exports.UnsupportedFunctions = {
38
44
  /**
39
- * Checks whether a data flow graph vertex represents a unsupported (environment-changing) function call (e.g. `eval`, `load`, `attach`, `rm`, ...)
45
+ * Checks whether a data flow graph vertex represents an unsupported (environment-changing) function call (e.g. `eval`, `load`, `attach`, `rm`, ...)
40
46
  */
41
- isUnsupportedCall(vertex) {
42
- return (0, vertex_1.isFunctionCallVertex)(vertex) && Object.hasOwn(UnsupportedFunctionsList, identifier_1.Identifier.getName(vertex.name));
47
+ isUnsupportedCall(vertex, dfg) {
48
+ if (!(0, vertex_1.isFunctionCallVertex)(vertex)) {
49
+ return false;
50
+ }
51
+ const entry = UnsupportedFunctionsList.find(entry => identifier_1.Identifier.matches(vertex.name, entry.identifier));
52
+ return entry !== undefined && (entry.condition?.(vertex, dfg) ?? true);
43
53
  }
44
54
  };
45
55
  //# sourceMappingURL=unsupported-functions.js.map
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = __importDefault(require("fs"));
7
+ const proc_1 = require("../util/proc");
7
8
  const path_1 = __importDefault(require("path"));
8
9
  const seedrandom_1 = __importDefault(require("seedrandom"));
9
10
  const assert_1 = require("../util/assert");
@@ -20,7 +21,7 @@ const options = (0, script_1.processCommandLineArgs)('benchmark', [], {
20
21
  });
21
22
  if (options.input.length === 0) {
22
23
  console.error('No input files given. Nothing to do. See \'--help\' if this is an error.');
23
- process.exit(0);
24
+ (0, proc_1.exitSafe)(0);
24
25
  }
25
26
  const numberRegex = /^\d+$/;
26
27
  (0, assert_1.guard)(options.slice === 'all' || options.slice === 'no' || numberRegex.test(options.slice), 'slice must be either all, no, or a number');
@@ -282,112 +282,6 @@ export declare const slicerOptions: [{
282
282
  readonly type: BooleanConstructor;
283
283
  readonly description: "Instead of human-readable output, dump a lot of json with the results of all intermediate steps.";
284
284
  }];
285
- export declare const statisticOptions: [{
286
- readonly name: "verbose";
287
- readonly alias: "v";
288
- readonly type: BooleanConstructor;
289
- readonly description: "Run with verbose logging";
290
- }, {
291
- readonly name: "help";
292
- readonly alias: "h";
293
- readonly type: BooleanConstructor;
294
- readonly description: "Print this usage guide";
295
- }, {
296
- readonly name: "limit";
297
- readonly alias: "l";
298
- readonly type: NumberConstructor;
299
- readonly description: "Limit the number of files to process";
300
- }, {
301
- readonly name: "input";
302
- readonly alias: "i";
303
- readonly type: StringConstructor;
304
- readonly description: "Pass a folder or file as src to read from";
305
- readonly multiple: true;
306
- readonly defaultOption: true;
307
- readonly defaultValue: readonly [];
308
- readonly typeLabel: "{underline files/folders}";
309
- }, {
310
- readonly name: "output-dir";
311
- readonly alias: "o";
312
- readonly type: StringConstructor;
313
- readonly description: "Folder to write the output to";
314
- readonly defaultValue: `${string}/statistics-out/${string}`;
315
- readonly typeLabel: "{underline folder}";
316
- }, {
317
- readonly name: "dump-json";
318
- readonly type: BooleanConstructor;
319
- readonly description: "Write JSON output during the extraction";
320
- readonly typeLabel: "{underline folder}";
321
- }, {
322
- readonly name: "no-ansi";
323
- readonly type: BooleanConstructor;
324
- readonly description: "Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.";
325
- }, {
326
- readonly name: "parallel";
327
- readonly alias: "p";
328
- readonly type: StringConstructor;
329
- readonly description: "Number of parallel executors (defaults to {italic max(cpu.count-1, 1)})";
330
- readonly defaultValue: number;
331
- readonly typeLabel: "{underline number}";
332
- }, {
333
- readonly name: "features";
334
- readonly type: StringConstructor;
335
- readonly description: `Features to track, supported are "all" or ${string}`;
336
- readonly multiple: true;
337
- readonly defaultValue: "all";
338
- readonly typeLabel: "{underline names}";
339
- }];
340
- export declare const statisticHelperOptions: [{
341
- readonly name: "verbose";
342
- readonly alias: "v";
343
- readonly type: BooleanConstructor;
344
- readonly description: "Run with verbose logging";
345
- }, {
346
- readonly name: "help";
347
- readonly alias: "h";
348
- readonly type: BooleanConstructor;
349
- readonly description: "Print this usage guide";
350
- }, {
351
- readonly name: "input";
352
- readonly alias: "i";
353
- readonly type: StringConstructor;
354
- readonly description: "Pass single file as src to read from";
355
- readonly multiple: false;
356
- readonly defaultOption: true;
357
- readonly typeLabel: "{underline file}";
358
- }, {
359
- readonly name: "output-dir";
360
- readonly alias: "o";
361
- readonly type: StringConstructor;
362
- readonly description: "Folder to write the output to";
363
- readonly typeLabel: "{underline folder}";
364
- }, {
365
- readonly name: "root-dir";
366
- readonly type: StringConstructor;
367
- readonly description: "Root dir for the statistics files";
368
- readonly defaultValue: "";
369
- }, {
370
- readonly name: "compress";
371
- readonly type: BooleanConstructor;
372
- readonly description: "Compress the output folder to a single file";
373
- readonly defaultValue: false;
374
- }, {
375
- readonly name: "dump-json";
376
- readonly type: BooleanConstructor;
377
- readonly description: "Write JSON output during the extraction";
378
- readonly typeLabel: "{underline folder}";
379
- }, {
380
- readonly name: "no-ansi";
381
- readonly type: BooleanConstructor;
382
- readonly description: "Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.";
383
- }, {
384
- readonly name: "features";
385
- readonly type: StringConstructor;
386
- readonly description: `Features to track, supported are "all" or ${string}`;
387
- readonly multiple: true;
388
- readonly defaultValue: "all";
389
- readonly typeLabel: "{underline names}";
390
- }];
391
285
  export declare const summarizerOptions: [{
392
286
  readonly name: "verbose";
393
287
  readonly alias: "v";
@@ -402,7 +296,7 @@ export declare const summarizerOptions: [{
402
296
  readonly name: "type";
403
297
  readonly alias: "t";
404
298
  readonly type: StringConstructor;
405
- readonly description: "Manually specify if you want to post-process benchmark results, statistics, or compressed statistics (defaults to auto).";
299
+ readonly description: "Manually specify if you want to post-process benchmark results (defaults to auto).";
406
300
  readonly defaultValue: "auto";
407
301
  }, {
408
302
  readonly name: "graph";
@@ -428,7 +322,7 @@ export declare const summarizerOptions: [{
428
322
  readonly name: "input";
429
323
  readonly alias: "i";
430
324
  readonly type: StringConstructor;
431
- readonly description: "The {italic output} produced by the benchmark, the statistics, ...";
325
+ readonly description: "The {italic output} produced by the benchmark";
432
326
  readonly defaultOption: true;
433
327
  readonly multiple: false;
434
328
  readonly typeLabel: "{underline file.json/output}";
@@ -3,10 +3,9 @@ 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.summarizerOptions = exports.statisticHelperOptions = exports.statisticOptions = exports.slicerOptions = exports.exportQuadsOptions = exports.benchmarkHelperOptions = exports.benchmarkOptions = void 0;
6
+ exports.summarizerOptions = exports.slicerOptions = exports.exportQuadsOptions = exports.benchmarkHelperOptions = exports.benchmarkOptions = void 0;
7
7
  const os_1 = __importDefault(require("os"));
8
8
  const time_1 = require("../../util/text/time");
9
- const feature_1 = require("../../statistics/features/feature");
10
9
  /**
11
10
  * This string contains a string representation of the time this module was loaded.
12
11
  */
@@ -66,38 +65,15 @@ exports.slicerOptions = [
66
65
  { name: 'no-magic-comments', alias: 'm', type: Boolean, description: 'Disable the effects of magic comments which force lines to be included.' },
67
66
  { name: 'api', type: Boolean, description: 'Instead of human-readable output, dump a lot of json with the results of all intermediate steps.' },
68
67
  ];
69
- const featureNameList = Array.from(feature_1.allFeatureNames).map(s => `"${s}"`).join(', ');
70
- exports.statisticOptions = [
71
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
72
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
73
- { name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process' },
74
- { name: 'input', alias: 'i', type: String, description: 'Pass a folder or file as src to read from', multiple: true, defaultOption: true, defaultValue: [], typeLabel: '{underline files/folders}' },
75
- { name: 'output-dir', alias: 'o', type: String, description: 'Folder to write the output to', defaultValue: `${process.cwd()}/statistics-out/${(0, time_1.date2string)(new Date())}`, typeLabel: '{underline folder}' },
76
- { name: 'dump-json', type: Boolean, description: 'Write JSON output during the extraction', typeLabel: '{underline folder}' },
77
- { name: 'no-ansi', type: Boolean, description: 'Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.' },
78
- { name: 'parallel', alias: 'p', type: String, description: 'Number of parallel executors (defaults to {italic max(cpu.count-1, 1)})', defaultValue: Math.max(os_1.default.cpus().length - 1, 1), typeLabel: '{underline number}' },
79
- { name: 'features', type: String, description: `Features to track, supported are "all" or ${featureNameList}`, multiple: true, defaultValue: 'all', typeLabel: '{underline names}' },
80
- ];
81
- exports.statisticHelperOptions = [
82
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
83
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
84
- { name: 'input', alias: 'i', type: String, description: 'Pass single file as src to read from', multiple: false, defaultOption: true, typeLabel: '{underline file}' },
85
- { name: 'output-dir', alias: 'o', type: String, description: 'Folder to write the output to', typeLabel: '{underline folder}' },
86
- { name: 'root-dir', type: String, description: 'Root dir for the statistics files', defaultValue: '' },
87
- { name: 'compress', type: Boolean, description: 'Compress the output folder to a single file', defaultValue: false },
88
- { name: 'dump-json', type: Boolean, description: 'Write JSON output during the extraction', typeLabel: '{underline folder}' },
89
- { name: 'no-ansi', type: Boolean, description: 'Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.' },
90
- { name: 'features', type: String, description: `Features to track, supported are "all" or ${featureNameList}`, multiple: true, defaultValue: 'all', typeLabel: '{underline names}' },
91
- ];
92
68
  exports.summarizerOptions = [
93
69
  { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
94
70
  { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
95
- { name: 'type', alias: 't', type: String, description: 'Manually specify if you want to post-process benchmark results, statistics, or compressed statistics (defaults to auto).', defaultValue: 'auto' },
71
+ { name: 'type', alias: 't', type: String, description: 'Manually specify if you want to post-process benchmark results (defaults to auto).', defaultValue: 'auto' },
96
72
  { name: 'graph', alias: 'g', type: Boolean, description: 'Produce data to be used for visualizing benchmarks over time' },
97
73
  { name: 'categorize', type: Boolean, description: 'Categorize the results (e.g., "test", "example", ...)', defaultValue: false },
98
74
  { name: 'project-skip', type: Number, description: 'Skip the first n folders to find the location of projects', defaultValue: 0 },
99
75
  { name: 'ultimate-only', alias: 'u', type: Boolean, description: 'Only perform the second summary-stage, with this, the input is used to find the summary-output.' },
100
- { name: 'input', alias: 'i', type: String, description: 'The {italic output} produced by the benchmark, the statistics, ...', defaultOption: true, multiple: false, typeLabel: '{underline file.json/output}' },
76
+ { name: 'input', alias: 'i', type: String, description: 'The {italic output} produced by the benchmark', defaultOption: true, multiple: false, typeLabel: '{underline file.json/output}' },
101
77
  { name: 'output', alias: 'o', type: String, description: 'Basename of the summaries (defaults to {italic <input>-summary})', typeLabel: '{underline file}' },
102
78
  ];
103
79
  //# sourceMappingURL=options.js.map
@@ -14,6 +14,7 @@ const command_line_usage_1 = __importDefault(require("command-line-usage"));
14
14
  const command_line_args_1 = __importDefault(require("command-line-args"));
15
15
  const ansi_1 = require("../../util/text/ansi");
16
16
  const log_1 = require("../../util/log");
17
+ const proc_1 = require("../../util/proc");
17
18
  /**
18
19
  * Automatically generates a uniform help from a given script (see {@link scripts}).
19
20
  * Additionally, you can pass usage examples that may make use of the formatting instructions `{italic x}` and `{bold x}`.
@@ -41,7 +42,7 @@ function processCommandLineArgs(script, requireAdditionally, help) {
41
42
  const options = (0, command_line_args_1.default)(scripts_info_1.scripts[script].options);
42
43
  if (options.help) {
43
44
  console.log(helpForOptions(script, help));
44
- process.exit(0);
45
+ (0, proc_1.exitSafe)(0);
45
46
  }
46
47
  else if (requireAdditionally.length > 0) {
47
48
  const keys = new Set(Object.keys(options));
@@ -49,7 +50,7 @@ function processCommandLineArgs(script, requireAdditionally, help) {
49
50
  if (missing.length > 0) {
50
51
  console.error((0, ansi_1.italic)(`Missing required arguments: ${missing.join(', ')}. Showing help.`));
51
52
  console.log(helpForOptions(script, help));
52
- process.exit(0);
53
+ (0, proc_1.exitSafe)(0);
53
54
  }
54
55
  }
55
56
  log_1.log.updateSettings(l => l.settings.minLevel = options.verbose ? 1 /* LogLevel.Trace */ : 5 /* LogLevel.Error */);
@@ -309,7 +309,7 @@ declare const _scripts: {
309
309
  readonly name: "type";
310
310
  readonly alias: "t";
311
311
  readonly type: StringConstructor;
312
- readonly description: "Manually specify if you want to post-process benchmark results, statistics, or compressed statistics (defaults to auto).";
312
+ readonly description: "Manually specify if you want to post-process benchmark results (defaults to auto).";
313
313
  readonly defaultValue: "auto";
314
314
  }, {
315
315
  readonly name: "graph";
@@ -335,7 +335,7 @@ declare const _scripts: {
335
335
  readonly name: "input";
336
336
  readonly alias: "i";
337
337
  readonly type: StringConstructor;
338
- readonly description: "The {italic output} produced by the benchmark, the statistics, ...";
338
+ readonly description: "The {italic output} produced by the benchmark";
339
339
  readonly defaultOption: true;
340
340
  readonly multiple: false;
341
341
  readonly typeLabel: "{underline file.json/output}";
@@ -387,127 +387,6 @@ declare const _scripts: {
387
387
  }];
388
388
  type: string;
389
389
  };
390
- stats: {
391
- toolName: string;
392
- target: string;
393
- description: string;
394
- options: [{
395
- readonly name: "verbose";
396
- readonly alias: "v";
397
- readonly type: BooleanConstructor;
398
- readonly description: "Run with verbose logging";
399
- }, {
400
- readonly name: "help";
401
- readonly alias: "h";
402
- readonly type: BooleanConstructor;
403
- readonly description: "Print this usage guide";
404
- }, {
405
- readonly name: "limit";
406
- readonly alias: "l";
407
- readonly type: NumberConstructor;
408
- readonly description: "Limit the number of files to process";
409
- }, {
410
- readonly name: "input";
411
- readonly alias: "i";
412
- readonly type: StringConstructor;
413
- readonly description: "Pass a folder or file as src to read from";
414
- readonly multiple: true;
415
- readonly defaultOption: true;
416
- readonly defaultValue: readonly [];
417
- readonly typeLabel: "{underline files/folders}";
418
- }, {
419
- readonly name: "output-dir";
420
- readonly alias: "o";
421
- readonly type: StringConstructor;
422
- readonly description: "Folder to write the output to";
423
- readonly defaultValue: `${string}/statistics-out/${string}`;
424
- readonly typeLabel: "{underline folder}";
425
- }, {
426
- readonly name: "dump-json";
427
- readonly type: BooleanConstructor;
428
- readonly description: "Write JSON output during the extraction";
429
- readonly typeLabel: "{underline folder}";
430
- }, {
431
- readonly name: "no-ansi";
432
- readonly type: BooleanConstructor;
433
- readonly description: "Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.";
434
- }, {
435
- readonly name: "parallel";
436
- readonly alias: "p";
437
- readonly type: StringConstructor;
438
- readonly description: "Number of parallel executors (defaults to {italic max(cpu.count-1, 1)})";
439
- readonly defaultValue: number;
440
- readonly typeLabel: "{underline number}";
441
- }, {
442
- readonly name: "features";
443
- readonly type: StringConstructor;
444
- readonly description: `Features to track, supported are "all" or ${string}`;
445
- readonly multiple: true;
446
- readonly defaultValue: "all";
447
- readonly typeLabel: "{underline names}";
448
- }];
449
- usageExample: string;
450
- type: string;
451
- };
452
- 'stats-helper': {
453
- toolName: string;
454
- target: string;
455
- description: string;
456
- options: [{
457
- readonly name: "verbose";
458
- readonly alias: "v";
459
- readonly type: BooleanConstructor;
460
- readonly description: "Run with verbose logging";
461
- }, {
462
- readonly name: "help";
463
- readonly alias: "h";
464
- readonly type: BooleanConstructor;
465
- readonly description: "Print this usage guide";
466
- }, {
467
- readonly name: "input";
468
- readonly alias: "i";
469
- readonly type: StringConstructor;
470
- readonly description: "Pass single file as src to read from";
471
- readonly multiple: false;
472
- readonly defaultOption: true;
473
- readonly typeLabel: "{underline file}";
474
- }, {
475
- readonly name: "output-dir";
476
- readonly alias: "o";
477
- readonly type: StringConstructor;
478
- readonly description: "Folder to write the output to";
479
- readonly typeLabel: "{underline folder}";
480
- }, {
481
- readonly name: "root-dir";
482
- readonly type: StringConstructor;
483
- readonly description: "Root dir for the statistics files";
484
- readonly defaultValue: "";
485
- }, {
486
- readonly name: "compress";
487
- readonly type: BooleanConstructor;
488
- readonly description: "Compress the output folder to a single file";
489
- readonly defaultValue: false;
490
- }, {
491
- readonly name: "dump-json";
492
- readonly type: BooleanConstructor;
493
- readonly description: "Write JSON output during the extraction";
494
- readonly typeLabel: "{underline folder}";
495
- }, {
496
- readonly name: "no-ansi";
497
- readonly type: BooleanConstructor;
498
- readonly description: "Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.";
499
- }, {
500
- readonly name: "features";
501
- readonly type: StringConstructor;
502
- readonly description: `Features to track, supported are "all" or ${string}`;
503
- readonly multiple: true;
504
- readonly defaultValue: "all";
505
- readonly typeLabel: "{underline names}";
506
- }];
507
- usageExample: string;
508
- type: string;
509
- masterScripts: string[];
510
- };
511
390
  };
512
391
  export declare const scripts: Record<keyof typeof _scripts, ScriptInformation>;
513
392
  /**
@@ -48,23 +48,6 @@ const _scripts = {
48
48
  usageExample: 'export-quads "example.R" --output "example.quads"',
49
49
  options: options_1.exportQuadsOptions,
50
50
  type: 'master script',
51
- },
52
- 'stats': {
53
- toolName: 'stats',
54
- target: 'statistics-app',
55
- description: 'Generate usage Statistics for R scripts',
56
- options: options_1.statisticOptions,
57
- usageExample: 'stats -i example.R --output-dir "output-folder/"',
58
- type: 'master script',
59
- },
60
- 'stats-helper': {
61
- toolName: 'stats-helper',
62
- target: 'statistics-helper-app',
63
- description: 'Generate usage Statistics for a single R script (parallel helper for stats)',
64
- options: options_1.statisticHelperOptions,
65
- usageExample: 'stats-helper -i example.R --output-dir "output-folder/"',
66
- type: 'helper script',
67
- masterScripts: ['stats']
68
51
  }
69
52
  };
70
53
  exports.scripts = _scripts;
@@ -105,3 +105,8 @@ export declare const flowrMainOptionDefinitions: [{
105
105
  readonly multiple: false;
106
106
  }];
107
107
  export declare const defaultConfigFile = "flowr.json";
108
+ /**
109
+ * Arguments to forward to a sub-script: everything the user passed except the script name token,
110
+ * which (being the default option) may appear before or after the main flowR options.
111
+ */
112
+ export declare function getScriptArguments(script: string, argv?: readonly string[]): string[];
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultConfigFile = exports.flowrMainOptionDefinitions = void 0;
4
4
  exports.getScriptsText = getScriptsText;
5
+ exports.getScriptArguments = getScriptArguments;
5
6
  const scripts_info_1 = require("./common/scripts-info");
6
7
  let _scriptsText;
7
8
  /**
@@ -128,4 +129,13 @@ exports.flowrMainOptionDefinitions = [
128
129
  }
129
130
  ];
130
131
  exports.defaultConfigFile = 'flowr.json';
132
+ /**
133
+ * Arguments to forward to a sub-script: everything the user passed except the script name token,
134
+ * which (being the default option) may appear before or after the main flowR options.
135
+ */
136
+ function getScriptArguments(script, argv = process.argv) {
137
+ const passedArgs = argv.slice(2);
138
+ const scriptIndex = passedArgs.indexOf(script);
139
+ return scriptIndex < 0 ? [...passedArgs] : [...passedArgs.slice(0, scriptIndex), ...passedArgs.slice(scriptIndex + 1)];
140
+ }
131
141
  //# sourceMappingURL=flowr-main-options.js.map
package/cli/flowr.js CHANGED
@@ -1,11 +1,42 @@
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.optionHelp = exports.toolName = void 0;
7
- const server_1 = require("./repl/server/server");
8
- const net_1 = require("./repl/server/net");
9
40
  const version_1 = require("../util/version");
10
41
  const command_line_usage_1 = __importDefault(require("command-line-usage"));
11
42
  const log_1 = require("../util/log");
@@ -17,6 +48,7 @@ const scripts_info_1 = require("./common/scripts-info");
17
48
  const execute_1 = require("./repl/execute");
18
49
  const repl_main_1 = require("./repl/commands/repl-main");
19
50
  const core_1 = require("./repl/core");
51
+ const proc_1 = require("../util/proc");
20
52
  const print_version_1 = require("./repl/print-version");
21
53
  const flowr_main_options_1 = require("./flowr-main-options");
22
54
  const fs_1 = __importDefault(require("fs"));
@@ -97,7 +129,7 @@ function hookSignalHandlers(engines) {
97
129
  console.log(`\n${(0, ansi_1.italic)('Exiting...')}`);
98
130
  }
99
131
  Object.values(engines.engines).forEach(e => e?.close());
100
- process.exit(0);
132
+ (0, proc_1.exitSafe)(0);
101
133
  };
102
134
  process.on('SIGINT', end);
103
135
  process.on('SIGTERM', end);
@@ -120,12 +152,12 @@ async function mainRepl() {
120
152
  (0, assert_1.guard)(target !== undefined, `Unknown script target "${options.script}", pick one of ${(0, flowr_main_options_1.getScriptsText)()}.`);
121
153
  console.log(`Running script '${ansi_1.formatter.format(options.script, { style: 1 /* FontStyles.Bold */ })}'`);
122
154
  log_1.log.debug(`Script maps to "${target}"`);
123
- await (0, execute_1.waitOnScript)(`${__dirname}/${target}`, process.argv.slice(3), undefined, true);
124
- process.exit(0);
155
+ await (0, execute_1.waitOnScript)(`${__dirname}/${target}`, (0, flowr_main_options_1.getScriptArguments)(options.script, process.argv), undefined, true);
156
+ return (0, proc_1.exitSafe)(0);
125
157
  }
126
158
  if (options.help) {
127
159
  console.log((0, command_line_usage_1.default)(exports.optionHelp));
128
- process.exit(0);
160
+ return (0, proc_1.exitSafe)(0);
129
161
  }
130
162
  const engines = await (0, engines_1.retrieveEngineInstances)(config);
131
163
  const defaultEngine = engines.engines[engines.default];
@@ -134,7 +166,7 @@ async function mainRepl() {
134
166
  await (0, version_1.printVersionInformation)(repl_main_1.standardReplOutput, engine);
135
167
  engine?.close();
136
168
  }
137
- process.exit(0);
169
+ return (0, proc_1.exitSafe)(0);
138
170
  }
139
171
  hookSignalHandlers(engines);
140
172
  const analyzer = new flowr_analyzer_builder_1.FlowrAnalyzerBuilder(false)
@@ -152,16 +184,21 @@ async function mainRepl() {
152
184
  console.log(w('use ') + ansi_1.ansiFormatter.format(':help', { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }) + w(' to get a list of available commands.'));
153
185
  await (0, core_1.repl)({ analyzer, allowRSessionAccess });
154
186
  }
155
- process.exit(0);
187
+ (0, proc_1.exitSafe)(0);
156
188
  }
157
- async function mainServer(backend = new net_1.NetServer()) {
189
+ async function mainServer(useWebSocket) {
158
190
  const config = createConfig();
159
191
  const engines = await (0, engines_1.retrieveEngineInstances)(config);
160
192
  hookSignalHandlers(engines);
161
- await new server_1.FlowRServer(engines.engines, engines.default, options['r-session-access'], config, backend).start(options.port);
193
+ // the server stack (incl. the `ws` websocket library) is only loaded when actually running a server,
194
+ // so the common one-shot analysis path does not pay for evaluating it
195
+ const { FlowRServer } = await Promise.resolve().then(() => __importStar(require('./repl/server/server')));
196
+ const { NetServer, WebSocketServerWrapper } = await Promise.resolve().then(() => __importStar(require('./repl/server/net')));
197
+ const backend = useWebSocket ? new WebSocketServerWrapper() : new NetServer();
198
+ await new FlowRServer(engines.engines, engines.default, options['r-session-access'], config, backend).start(options.port);
162
199
  }
163
200
  if (options.server) {
164
- void mainServer(options.ws ? new net_1.WebSocketServerWrapper() : new net_1.NetServer());
201
+ void mainServer(options.ws);
165
202
  }
166
203
  else {
167
204
  void mainRepl();