@eagleoutice/flowr 2.10.10 → 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 (220) hide show
  1. package/README.md +37 -29
  2. package/cli/common/options.d.ts +2 -108
  3. package/cli/common/options.js +3 -27
  4. package/cli/common/scripts-info.d.ts +2 -123
  5. package/cli/common/scripts-info.js +0 -17
  6. package/cli/flowr-main-options.d.ts +5 -0
  7. package/cli/flowr-main-options.js +10 -0
  8. package/cli/flowr.js +1 -1
  9. package/cli/repl/print-version.d.ts +3 -1
  10. package/cli/repl/print-version.js +21 -2
  11. package/cli/repl/server/connection.d.ts +2 -0
  12. package/cli/repl/server/connection.js +40 -31
  13. package/cli/script-core/summarizer-core.js +13 -32
  14. package/cli/wiki.d.ts +2 -1
  15. package/cli/wiki.js +2 -0
  16. package/config.d.ts +13 -0
  17. package/config.js +8 -0
  18. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  19. package/core/steps/pipeline/default-pipelines.d.ts +146 -146
  20. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  21. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  22. package/dataflow/environments/append.d.ts +1 -2
  23. package/dataflow/environments/append.js +3 -10
  24. package/dataflow/environments/apply-kill.d.ts +21 -0
  25. package/dataflow/environments/apply-kill.js +155 -0
  26. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  27. package/dataflow/environments/built-in-proc-name.js +2 -0
  28. package/dataflow/environments/built-in.d.ts +2 -0
  29. package/dataflow/environments/built-in.js +2 -0
  30. package/dataflow/environments/default-builtin-config.d.ts +63 -3
  31. package/dataflow/environments/default-builtin-config.js +40 -8
  32. package/dataflow/environments/environment.d.ts +49 -32
  33. package/dataflow/environments/environment.js +133 -18
  34. package/dataflow/environments/identifier.d.ts +10 -0
  35. package/dataflow/environments/identifier.js +23 -0
  36. package/dataflow/environments/overwrite.js +2 -10
  37. package/dataflow/environments/resolve-by-name.d.ts +1 -1
  38. package/dataflow/environments/resolve-by-name.js +10 -2
  39. package/dataflow/environments/scoping.d.ts +9 -2
  40. package/dataflow/environments/scoping.js +15 -2
  41. package/dataflow/extractor.js +23 -2
  42. package/dataflow/graph/df-helper.d.ts +8 -0
  43. package/dataflow/graph/df-helper.js +8 -0
  44. package/dataflow/graph/graph.d.ts +4 -1
  45. package/dataflow/graph/graph.js +5 -1
  46. package/dataflow/info.d.ts +26 -0
  47. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
  48. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
  49. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
  50. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
  51. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
  52. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
  53. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
  54. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -1
  55. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
  56. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +8 -1
  57. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
  58. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
  59. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
  60. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -1
  61. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +131 -48
  62. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
  63. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
  64. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +10 -3
  65. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
  66. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
  67. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  68. package/dataflow/internal/process/functions/call/named-call-handling.js +17 -0
  69. package/documentation/data/faq/faqs.js +3 -0
  70. package/documentation/data/interface/doc-writing-code.js +4 -80
  71. package/documentation/doc-util/doc-structure.js +1 -2
  72. package/documentation/wiki-core.js +2 -1
  73. package/documentation/wiki-dataflow-graph.js +35 -1
  74. package/documentation/wiki-interface.js +3 -2
  75. package/documentation/wiki-linter.js +2 -0
  76. package/documentation/wiki-overview.js +1 -14
  77. package/documentation/wiki-package-database.d.ts +9 -0
  78. package/documentation/wiki-package-database.js +63 -0
  79. package/documentation/wiki-query.js +1 -0
  80. package/linter/linter-rules.d.ts +23 -0
  81. package/linter/linter-rules.js +3 -1
  82. package/linter/rules/absolute-path.js +2 -1
  83. package/linter/rules/undefined-symbol.d.ts +39 -0
  84. package/linter/rules/undefined-symbol.js +80 -0
  85. package/package.json +3 -4
  86. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  87. package/project/cache/flowr-analyzer-cache.js +9 -1
  88. package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
  89. package/project/context/flowr-analyzer-dependencies-context.js +36 -4
  90. package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
  91. package/project/context/flowr-analyzer-environment-context.js +3 -4
  92. package/project/context/flowr-analyzer-files-context.d.ts +1 -0
  93. package/project/context/flowr-file.d.ts +2 -0
  94. package/project/context/flowr-file.js +2 -0
  95. package/project/flowr-analyzer-builder.js +3 -0
  96. package/project/flowr-analyzer.d.ts +2 -1
  97. package/project/flowr-analyzer.js +3 -1
  98. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
  99. package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
  100. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
  101. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
  102. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
  103. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
  104. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
  105. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
  106. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  107. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
  108. package/project/plugins/package-version-plugins/package.d.ts +3 -0
  109. package/project/plugins/package-version-plugins/package.js +12 -0
  110. package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
  111. package/project/plugins/package-version-plugins/pkgdb.js +370 -0
  112. package/project/plugins/plugin-registry.d.ts +4 -1
  113. package/project/plugins/plugin-registry.js +7 -0
  114. package/queries/catalog/call-context-query/call-context-query-executor.js +8 -0
  115. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -0
  116. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  117. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
  118. package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
  119. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
  120. package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
  121. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
  122. package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
  123. package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
  124. package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
  125. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
  126. package/queries/catalog/linter-query/linter-query-executor.js +1 -0
  127. package/r-bridge/data/data.d.ts +2 -2
  128. package/r-bridge/data/data.js +2 -2
  129. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
  130. package/search/search-executor/search-enrichers.d.ts +1 -1
  131. package/search/search-executor/search-enrichers.js +7 -4
  132. package/util/mermaid/mermaid.d.ts +4 -0
  133. package/util/mermaid/mermaid.js +8 -1
  134. package/util/version.js +10 -2
  135. package/cli/common/features.d.ts +0 -9
  136. package/cli/common/features.js +0 -35
  137. package/cli/script-core/statistics-core.d.ts +0 -6
  138. package/cli/script-core/statistics-core.js +0 -104
  139. package/cli/script-core/statistics-helper-core.d.ts +0 -6
  140. package/cli/script-core/statistics-helper-core.js +0 -86
  141. package/cli/statistics-app.d.ts +0 -11
  142. package/cli/statistics-app.js +0 -16
  143. package/cli/statistics-helper-app.d.ts +0 -11
  144. package/cli/statistics-helper-app.js +0 -14
  145. package/statistics/features/common-syntax-probability.d.ts +0 -38
  146. package/statistics/features/common-syntax-probability.js +0 -169
  147. package/statistics/features/feature.d.ts +0 -179
  148. package/statistics/features/feature.js +0 -38
  149. package/statistics/features/post-processing.d.ts +0 -18
  150. package/statistics/features/post-processing.js +0 -26
  151. package/statistics/features/supported/assignments/assignments.d.ts +0 -12
  152. package/statistics/features/supported/assignments/assignments.js +0 -56
  153. package/statistics/features/supported/assignments/post-process.d.ts +0 -6
  154. package/statistics/features/supported/assignments/post-process.js +0 -126
  155. package/statistics/features/supported/comments/comments.d.ts +0 -18
  156. package/statistics/features/supported/comments/comments.js +0 -143
  157. package/statistics/features/supported/comments/post-process.d.ts +0 -6
  158. package/statistics/features/supported/comments/post-process.js +0 -51
  159. package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
  160. package/statistics/features/supported/control-flow/control-flow.js +0 -69
  161. package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
  162. package/statistics/features/supported/control-flow/post-process.js +0 -66
  163. package/statistics/features/supported/data-access/data-access.d.ts +0 -15
  164. package/statistics/features/supported/data-access/data-access.js +0 -122
  165. package/statistics/features/supported/data-access/post-process.d.ts +0 -6
  166. package/statistics/features/supported/data-access/post-process.js +0 -108
  167. package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
  168. package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
  169. package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
  170. package/statistics/features/supported/defined-functions/post-process.js +0 -168
  171. package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
  172. package/statistics/features/supported/expression-list/post-process.js +0 -45
  173. package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
  174. package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
  175. package/statistics/features/supported/loops/loops.d.ts +0 -20
  176. package/statistics/features/supported/loops/loops.js +0 -81
  177. package/statistics/features/supported/loops/post-process.d.ts +0 -6
  178. package/statistics/features/supported/loops/post-process.js +0 -73
  179. package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
  180. package/statistics/features/supported/used-functions/post-process.js +0 -176
  181. package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
  182. package/statistics/features/supported/used-functions/used-functions.js +0 -99
  183. package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
  184. package/statistics/features/supported/used-packages/post-process.js +0 -122
  185. package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
  186. package/statistics/features/supported/used-packages/used-packages.js +0 -140
  187. package/statistics/features/supported/values/post-process.d.ts +0 -6
  188. package/statistics/features/supported/values/post-process.js +0 -73
  189. package/statistics/features/supported/values/values.d.ts +0 -14
  190. package/statistics/features/supported/values/values.js +0 -111
  191. package/statistics/features/supported/variables/post-process.d.ts +0 -15
  192. package/statistics/features/supported/variables/post-process.js +0 -126
  193. package/statistics/features/supported/variables/variables.d.ts +0 -15
  194. package/statistics/features/supported/variables/variables.js +0 -62
  195. package/statistics/meta-statistics.d.ts +0 -32
  196. package/statistics/meta-statistics.js +0 -16
  197. package/statistics/output/file-provider.d.ts +0 -36
  198. package/statistics/output/file-provider.js +0 -96
  199. package/statistics/output/print-stats.d.ts +0 -29
  200. package/statistics/output/print-stats.js +0 -81
  201. package/statistics/output/statistics-file.d.ts +0 -36
  202. package/statistics/output/statistics-file.js +0 -68
  203. package/statistics/statistics.d.ts +0 -29
  204. package/statistics/statistics.js +0 -108
  205. package/statistics/summarizer/auto-detect.d.ts +0 -5
  206. package/statistics/summarizer/auto-detect.js +0 -34
  207. package/statistics/summarizer/first-phase/process.d.ts +0 -6
  208. package/statistics/summarizer/first-phase/process.js +0 -81
  209. package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
  210. package/statistics/summarizer/post-process/clusterer.js +0 -40
  211. package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
  212. package/statistics/summarizer/post-process/file-based-count.js +0 -47
  213. package/statistics/summarizer/post-process/histogram.d.ts +0 -57
  214. package/statistics/summarizer/post-process/histogram.js +0 -126
  215. package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
  216. package/statistics/summarizer/post-process/post-process-output.js +0 -102
  217. package/statistics/summarizer/second-phase/process.d.ts +0 -15
  218. package/statistics/summarizer/second-phase/process.js +0 -118
  219. package/statistics/summarizer/summarizer.d.ts +0 -34
  220. package/statistics/summarizer/summarizer.js +0 -141
@@ -1,16 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pkgDbReplSuffix = pkgDbReplSuffix;
3
4
  exports.versionReplString = versionReplString;
4
5
  exports.printVersionRepl = printVersionRepl;
5
6
  const version_1 = require("../../util/version");
7
+ const pkgdb_1 = require("../../project/plugins/package-version-plugins/pkgdb");
8
+ /** a short `, package database: <scope> <date>` suffix for the bundled database, or empty if none */
9
+ function pkgDbReplSuffix() {
10
+ try {
11
+ if (typeof process !== 'undefined' && process.env?.FLOWR_DISABLE_DEFAULT_PKGDB) {
12
+ return '';
13
+ }
14
+ const path = (0, pkgdb_1.defaultPkgDbPath)();
15
+ if (path === undefined) {
16
+ return '';
17
+ }
18
+ const db = pkgdb_1.PkgDatabase.fromFileSync(path);
19
+ return `, pkg-db: ${db.scope}/${db.content.date}`;
20
+ }
21
+ catch {
22
+ return '';
23
+ }
24
+ }
6
25
  /**
7
- * Returns a version string for the REPL including flowR and R version.
26
+ * Returns a version string for the REPL including flowR, R, and the package database in use.
8
27
  */
9
28
  async function versionReplString(parser) {
10
29
  const version = await (0, version_1.retrieveVersionInformation)(parser);
11
30
  const rVersion = version.r === 'none' ? '' : version.r === 'unknown' ? ', R version unknown' : `, R v${version.r}`;
12
31
  const treeSitterVer = parser.name === 'tree-sitter' ? `, R grammar v${parser.treeSitterVersion()}` : '';
13
- return `flowR repl using flowR v${version.flowr}${rVersion}${treeSitterVer} (${version.engine} engine)`;
32
+ return `flowR repl v${version.flowr}${rVersion}${treeSitterVer} (${version.engine} engine${pkgDbReplSuffix()})`;
14
33
  }
15
34
  /**
16
35
  * Prints the version information for the REPL including flowR and R version.
@@ -21,7 +21,9 @@ export declare class FlowRServerConnection {
21
21
  private readonly fileMap;
22
22
  constructor(socket: Socket, name: string, parser: KnownParser, allowRSessionAccess: boolean, config: FlowrConfig);
23
23
  private currentMessageBuffer;
24
+ private requestQueue;
24
25
  private handleData;
26
+ private dispatch;
25
27
  private handleFileAnalysisRequest;
26
28
  private invalidateTokens;
27
29
  private sendFileAnalysisResponse;
@@ -88,6 +88,8 @@ class FlowRServerConnection {
88
88
  this.allowRSessionAccess = allowRSessionAccess;
89
89
  }
90
90
  currentMessageBuffer = '';
91
+ /* requests of a single client share one analyzer, so we handle them one after another to avoid racing on it */
92
+ requestQueue = Promise.resolve();
91
93
  handleData(message) {
92
94
  if (!message.endsWith('\n')) {
93
95
  this.currentMessageBuffer += message;
@@ -104,27 +106,31 @@ class FlowRServerConnection {
104
106
  (0, validate_1.answerForValidationError)(this.socket, request);
105
107
  return;
106
108
  }
107
- switch (request.message.type) {
109
+ this.requestQueue = this.requestQueue
110
+ .then(() => this.dispatch(request.message))
111
+ .catch(e => {
112
+ this.logger.error(`[${this.name}] Error while handling request: ${String(e)}`);
113
+ });
114
+ }
115
+ dispatch(message) {
116
+ switch (message.type) {
108
117
  case 'request-file-analysis':
109
- void this.handleFileAnalysisRequest(request.message);
110
- break;
118
+ return this.handleFileAnalysisRequest(message);
111
119
  case 'request-slice':
112
- this.handleSliceRequest(request.message);
113
- break;
120
+ return this.handleSliceRequest(message);
114
121
  case 'request-repl-execution':
115
- this.handleRepl(request.message);
116
- break;
122
+ return this.handleRepl(message);
117
123
  case 'request-query':
118
- this.handleQueryRequest(request.message);
119
- break;
124
+ return this.handleQueryRequest(message);
120
125
  default:
121
126
  (0, send_1.sendMessage)(this.socket, {
122
- id: request.message.id,
127
+ id: message.id,
123
128
  type: 'error',
124
129
  fatal: true,
125
- reason: `The message type ${JSON.stringify(request.message.type ?? 'undefined')} is not supported.`
130
+ reason: `The message type ${JSON.stringify(message.type ?? 'undefined')} is not supported.`
126
131
  });
127
132
  this.socket.end();
133
+ return Promise.resolve();
128
134
  }
129
135
  }
130
136
  async handleFileAnalysisRequest(base) {
@@ -253,7 +259,7 @@ class FlowRServerConnection {
253
259
  }
254
260
  return analyzer;
255
261
  }
256
- handleSliceRequest(base) {
262
+ async handleSliceRequest(base) {
257
263
  const requestResult = (0, validate_1.validateMessage)(base, message_slice_1.requestSliceMessage);
258
264
  if (requestResult.type === 'error') {
259
265
  (0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
@@ -271,19 +277,21 @@ class FlowRServerConnection {
271
277
  });
272
278
  return;
273
279
  }
274
- void fileInformation.analyzer.query([{
275
- type: 'static-slice',
276
- criteria: request.criterion,
277
- noMagicComments: request.noMagicComments,
278
- direction: request.direction
279
- }]).then(result => {
280
+ try {
281
+ const result = await fileInformation.analyzer.query([{
282
+ type: 'static-slice',
283
+ criteria: request.criterion,
284
+ noMagicComments: request.noMagicComments,
285
+ direction: request.direction
286
+ }]);
280
287
  (0, send_1.sendMessage)(this.socket, {
281
288
  type: 'response-slice',
282
289
  id: request.id,
283
290
  results: Object.fromEntries(Object.entries(result)
284
291
  .filter(([k]) => default_pipelines_1.DEFAULT_SLICING_PIPELINE.steps.get(k)?.executed === 1 /* PipelineStepStage.OncePerRequest */))
285
292
  });
286
- }).catch(e => {
293
+ }
294
+ catch (e) {
287
295
  this.logger.error(`[${this.name}] Error while analyzing file for token ${request.filetoken}: ${String(e)}`);
288
296
  (0, send_1.sendMessage)(this.socket, {
289
297
  id: request.id,
@@ -291,9 +299,9 @@ class FlowRServerConnection {
291
299
  fatal: false,
292
300
  reason: `Error while analyzing file for token ${request.filetoken}: ${String(e)}`
293
301
  });
294
- });
302
+ }
295
303
  }
296
- handleRepl(base) {
304
+ async handleRepl(base) {
297
305
  const requestResult = (0, validate_1.validateMessage)(base, message_repl_1.requestExecuteReplExpressionMessage);
298
306
  if (requestResult.type === 'error') {
299
307
  (0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
@@ -312,18 +320,17 @@ class FlowRServerConnection {
312
320
  .setConfig(this.config)
313
321
  .setParser(this.parser)
314
322
  .buildSync();
315
- void (0, core_1.replProcessAnswer)(analyzer, {
323
+ await (0, core_1.replProcessAnswer)(analyzer, {
316
324
  formatter: request.ansi ? ansi_1.ansiFormatter : ansi_1.voidFormatter,
317
325
  stdout: msg => out('stdout', msg),
318
326
  stderr: msg => out('stderr', msg)
319
- }, request.expression, this.allowRSessionAccess).then(() => {
320
- (0, send_1.sendMessage)(this.socket, {
321
- type: 'end-repl-execution',
322
- id: request.id
323
- });
327
+ }, request.expression, this.allowRSessionAccess);
328
+ (0, send_1.sendMessage)(this.socket, {
329
+ type: 'end-repl-execution',
330
+ id: request.id
324
331
  });
325
332
  }
326
- handleQueryRequest(base) {
333
+ async handleQueryRequest(base) {
327
334
  const requestResult = (0, validate_1.validateMessage)(base, message_query_1.requestQueryMessage);
328
335
  if (requestResult.type === 'error') {
329
336
  (0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
@@ -341,13 +348,15 @@ class FlowRServerConnection {
341
348
  });
342
349
  return;
343
350
  }
344
- void Promise.resolve(fileInformation.analyzer.query(request.query)).then(results => {
351
+ try {
352
+ const results = await fileInformation.analyzer.query(request.query);
345
353
  (0, send_1.sendMessage)(this.socket, {
346
354
  type: 'response-query',
347
355
  id: request.id,
348
356
  results
349
357
  });
350
- }).catch(e => {
358
+ }
359
+ catch (e) {
351
360
  this.logger.error(`[${this.name}] Error while executing query: ${String(e)}`);
352
361
  (0, send_1.sendMessage)(this.socket, {
353
362
  id: request.id,
@@ -355,7 +364,7 @@ class FlowRServerConnection {
355
364
  fatal: false,
356
365
  reason: `Error while executing query: ${String(e)}`
357
366
  });
358
- });
367
+ }
359
368
  }
360
369
  }
361
370
  exports.FlowRServerConnection = FlowRServerConnection;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flowrScriptSummarizer = flowrScriptSummarizer;
4
- const summarizer_1 = require("../../statistics/summarizer/summarizer");
5
- const summarizer_2 = require("../../benchmark/summarizer/summarizer");
6
- const auto_detect_1 = require("../../statistics/summarizer/auto-detect");
7
- const feature_1 = require("../../statistics/features/feature");
4
+ const summarizer_1 = require("../../benchmark/summarizer/summarizer");
8
5
  function getBenchmarkSummarizer(options, outputBase) {
9
- return new summarizer_2.BenchmarkSummarizer({
6
+ return new summarizer_1.BenchmarkSummarizer({
10
7
  graphOutputPath: options.graph ? `${outputBase}-graph.json` : undefined,
11
8
  inputPath: options.input,
12
9
  intermediateOutputPath: outputBase,
@@ -14,40 +11,24 @@ function getBenchmarkSummarizer(options, outputBase) {
14
11
  logger: console.log
15
12
  });
16
13
  }
17
- function getStatisticsSummarizer(options, outputBase) {
18
- return new summarizer_1.StatisticsSummarizer({
19
- inputPath: options.input,
20
- outputPath: `${outputBase}-final`,
21
- intermediateOutputPath: `${outputBase}-intermediate/`,
22
- projectSkip: options['project-skip'],
23
- featuresToUse: feature_1.allFeatureNames,
24
- logger: console.log
25
- });
26
- }
27
- async function retrieveSummarizer(options, outputBase) {
28
- const type = options.type === 'auto' ? await (0, auto_detect_1.detectSummarizationType)(options.input) : options.type;
29
- if (type === "benchmark" /* SummarizerType.Benchmark */) {
30
- console.log('Summarizing benchmark');
31
- return getBenchmarkSummarizer(options, outputBase);
32
- }
33
- else if (type === "statistics" /* SummarizerType.Statistics */) {
34
- console.log('Summarizing statistics');
35
- return getStatisticsSummarizer(options, outputBase);
36
- }
37
- else {
38
- console.error('Unknown type', type, 'either give "benchmark" or "statistics"');
39
- process.exit(1);
40
- }
41
- }
42
14
  /**
43
15
  * The core function for the 'flowr summarize' script.
44
16
  */
45
17
  async function flowrScriptSummarizer(options) {
18
+ if (options.type && options.type !== 'benchmark') {
19
+ console.error(`Warning: --type ${options.type} is no longer supported. The summarizer only produces benchmark summaries.`);
20
+ }
21
+ if (options.categorize) {
22
+ console.error('Warning: --categorize is no longer supported.');
23
+ }
24
+ if (options['project-skip'] && options['project-skip'] > 0) {
25
+ console.error(`Warning: --project-skip ${options['project-skip']} is no longer supported.`);
26
+ }
46
27
  const outputBase = (options.output ?? options.input).replace(/\.json$|\/$/, '-summary');
47
28
  console.log(`Writing outputs to base ${outputBase}`);
48
- const summarizer = await retrieveSummarizer(options, outputBase);
29
+ const summarizer = getBenchmarkSummarizer(options, outputBase);
49
30
  if (!options['ultimate-only']) {
50
- await summarizer.preparationPhase(options.categorize);
31
+ await summarizer.preparationPhase();
51
32
  }
52
33
  await summarizer.summarizePhase();
53
34
  }
package/cli/wiki.d.ts CHANGED
@@ -10,7 +10,8 @@ import { WikiSetup } from '../documentation/wiki-setup';
10
10
  import { WikiOverview } from '../documentation/wiki-overview';
11
11
  import { WikiAbsint } from '../documentation/wiki-absint';
12
12
  import { WikiCreateLintingRules } from '../documentation/wiki-create-linting-rules';
13
- export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, WikiCreateLintingRules, IssueLintingRule, DocReadme, DocCapabilities];
13
+ import { WikiPackageDatabase } from '../documentation/wiki-package-database';
14
+ export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, WikiCreateLintingRules, WikiPackageDatabase, IssueLintingRule, DocReadme, DocCapabilities];
14
15
  export type ValidWikiDocumentTargets = ReturnType<typeof AllWikiDocuments[number]['getTarget']>;
15
16
  export type ValidWikiDocumentTargetsNoSuffix = ValidWikiDocumentTargets extends `${infer Name}.${string}` ? Name : never;
16
17
  /**
package/cli/wiki.js CHANGED
@@ -28,6 +28,7 @@ const wiki_setup_1 = require("../documentation/wiki-setup");
28
28
  const wiki_overview_1 = require("../documentation/wiki-overview");
29
29
  const wiki_absint_1 = require("../documentation/wiki-absint");
30
30
  const wiki_create_linting_rules_1 = require("../documentation/wiki-create-linting-rules");
31
+ const wiki_package_database_1 = require("../documentation/wiki-package-database");
31
32
  exports.AllWikiDocuments = [
32
33
  new wiki_faq_1.WikiFaq(),
33
34
  new documentation_1.WikiSearch(),
@@ -46,6 +47,7 @@ exports.AllWikiDocuments = [
46
47
  new wiki_linter_1.WikiLinter(),
47
48
  new wiki_absint_1.WikiAbsint(),
48
49
  new wiki_create_linting_rules_1.WikiCreateLintingRules(),
50
+ new wiki_package_database_1.WikiPackageDatabase(),
49
51
  new issue_linting_rule_1.IssueLintingRule(),
50
52
  new doc_readme_1.DocReadme(),
51
53
  new documentation_1.DocCapabilities()
package/config.d.ts CHANGED
@@ -149,6 +149,19 @@ export interface FlowrConfig extends MergeableRecord {
149
149
  * When disabled all envir-style calls fall through to the conservative global treatment.
150
150
  */
151
151
  readonly trackEnvironments: boolean;
152
+ /**
153
+ * Materialize a built-in function-definition vertex for every export when a package is loaded
154
+ * (`library()`, `use()`, ...). By default (`false`) exports are only added to the environment
155
+ * and their vertices are created on demand, when a call actually resolves to one, keeping the
156
+ * dataflow graph small for large packages.
157
+ */
158
+ readonly eagerlyLoadPackages: boolean;
159
+ /**
160
+ * Mount the package database (e.g. the bundled `flowr-pkgdb`) up front instead of lazily on the
161
+ * first package load. By default (`false`) the database is parsed only when a `library()`/`use()`
162
+ * call first needs it, so scripts without package loads never pay for it.
163
+ */
164
+ readonly eagerlyLoadPackageDatabase: boolean;
152
165
  /** These keys are only intended for use within code, allowing to instrument the dataflow analyzer! */
153
166
  readonly instrument: {
154
167
  /**
package/config.js CHANGED
@@ -54,6 +54,9 @@ const defaultEngineConfigs = {
54
54
  exports.FlowrDefaultPlugins = [
55
55
  'file:description',
56
56
  'versions:description',
57
+ 'versions:pkgdb',
58
+ 'versions:renv',
59
+ 'versions:rv',
57
60
  'loading-order:description',
58
61
  'meta:description',
59
62
  'files:vignette',
@@ -65,6 +68,7 @@ exports.FlowrDefaultPlugins = [
65
68
  'file:namespace',
66
69
  'file:news',
67
70
  'file:license',
71
+ 'file:virtualenv',
68
72
  ];
69
73
  /**
70
74
  * Helper Object to work with {@link FlowrConfig}, provides the default config and the Joi schema for validation.
@@ -101,6 +105,8 @@ exports.FlowrConfig = {
101
105
  variables: VariableResolve.Alias,
102
106
  evalStrings: true,
103
107
  trackEnvironments: true,
108
+ eagerlyLoadPackages: false,
109
+ eagerlyLoadPackageDatabase: false,
104
110
  resolveSource: {
105
111
  dropPaths: DropPathsOption.No,
106
112
  ignoreCapitalization: true,
@@ -171,6 +177,8 @@ exports.FlowrConfig = {
171
177
  variables: joi_1.default.string().valid(...Object.values(VariableResolve)).description('How to resolve variables and their values.'),
172
178
  evalStrings: joi_1.default.boolean().description('Should we include eval(parse(text="...")) calls in the dataflow graph?'),
173
179
  trackEnvironments: joi_1.default.boolean().optional().description('Track user-created environments (new.env, assign/get/local with envir=, dollar-assign, attach). When false, all envir-style calls fall through conservatively.'),
180
+ eagerlyLoadPackages: joi_1.default.boolean().optional().description('Create a built-in vertex for every export when a package is loaded. When false (default), export vertices are created on demand as calls resolve to them, keeping the dataflow graph small.'),
181
+ eagerlyLoadPackageDatabase: joi_1.default.boolean().optional().description('Mount the package database up front instead of lazily on the first package load. When false (default), it is parsed only when a library()/use() call first needs it.'),
174
182
  instrument: joi_1.default.object({
175
183
  dataflowExtractors: joi_1.default.any().optional().description('These keys are only intended for use within code, allowing to instrument the dataflow analyzer!')
176
184
  }),
@@ -255,6 +255,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
255
255
  return this.onPurrFormulaCall({ call });
256
256
  case built_in_proc_name_1.BuiltInProcName.NamespaceAccess:
257
257
  case built_in_proc_name_1.BuiltInProcName.NewEnv:
258
+ case built_in_proc_name_1.BuiltInProcName.StackEnv:
258
259
  case built_in_proc_name_1.BuiltInProcName.With:
259
260
  case built_in_proc_name_1.BuiltInProcName.Attach:
260
261
  case built_in_proc_name_1.BuiltInProcName.Default: