@eagleoutice/flowr 2.2.4 → 2.2.5

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.
package/README.md CHANGED
@@ -41,14 +41,14 @@ It offers a wide variety of features, for example:
41
41
  ```
42
42
 
43
43
 
44
- Let's suppose we are interested only in the sum which is printed in line 11.
44
+ Let's suppose we are interested only in the `sum` which is printed in line 11.
45
45
  To get a slice for this, you can use the following command:
46
46
 
47
47
 
48
48
 
49
49
  ```shell
50
50
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
51
- flowR repl using flowR v2.2.3, R v4.4.0 (r-shell engine)
51
+ flowR repl using flowR v2.2.4, R v4.4.0 (r-shell engine)
52
52
  R> :slicer test/testfiles/example.R --criterion "11@sum"
53
53
  ```
54
54
 
@@ -95,7 +95,7 @@ It offers a wide variety of features, for example:
95
95
 
96
96
 
97
97
  * 🚀 **fast data and control-flow graphs**\
98
- Within just <i><span title="This measurement is automatically fetched from the latest benchmarks!">120.6 ms</i></span> (as of Feb 12, 2025),
98
+ Within just <i><span title="This measurement is automatically fetched from the latest benchmarks!">119.8 ms</i></span> (as of Feb 16, 2025),
99
99
  _flowR_ can analyze the data- and control-flow of the average real-world R script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
100
100
  and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the dataflow graph.
101
101
 
@@ -131,7 +131,7 @@ It offers a wide variety of features, for example:
131
131
 
132
132
  ```shell
133
133
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
134
- flowR repl using flowR v2.2.3, R v4.4.0 (r-shell engine)
134
+ flowR repl using flowR v2.2.4, R v4.4.0 (r-shell engine)
135
135
  R> :dataflow* test/testfiles/example.R
136
136
  ```
137
137
 
@@ -375,7 +375,7 @@ It offers a wide variety of features, for example:
375
375
  52 -->|"argument"| 50
376
376
  ```
377
377
 
378
- (The analysis required _22.53 ms_ (including parse and normalize, using the [r-shell](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment.)
378
+ (The analysis required _22.93 ms_ (including parse and normalize, using the [r-shell](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment.)
379
379
 
380
380
 
381
381
 
@@ -6,7 +6,7 @@ import type { KnownParser } from '../../r-bridge/parser';
6
6
  * Used by the repl to provide automatic completions for a given (partial) input line
7
7
  */
8
8
  export declare function replCompleter(line: string): [string[], string];
9
- export declare const DEFAULT_REPL_READLINE_CONFIGURATION: readline.ReadLineOptions;
9
+ export declare function makeDefaultReplReadline(): readline.ReadLineOptions;
10
10
  /**
11
11
  * This function interprets the given `expr` as a REPL command (see {@link repl} for more on the semantics).
12
12
  *
package/cli/repl/core.js CHANGED
@@ -36,8 +36,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.DEFAULT_REPL_READLINE_CONFIGURATION = void 0;
40
39
  exports.replCompleter = replCompleter;
40
+ exports.makeDefaultReplReadline = makeDefaultReplReadline;
41
41
  exports.replProcessAnswer = replProcessAnswer;
42
42
  exports.repl = repl;
43
43
  exports.loadReplHistory = loadReplHistory;
@@ -98,15 +98,18 @@ function replCompleter(line) {
98
98
  // if no command is already typed, just return all commands that match
99
99
  return [replCompleterKeywords().filter(k => k.startsWith(line)).map(k => `${k} `), line];
100
100
  }
101
- exports.DEFAULT_REPL_READLINE_CONFIGURATION = {
102
- input: process.stdin,
103
- output: process.stdout,
104
- tabSize: 4,
105
- terminal: true,
106
- history: loadReplHistory(defaultHistoryFile),
107
- removeHistoryDuplicates: true,
108
- completer: replCompleter
109
- };
101
+ function makeDefaultReplReadline() {
102
+ return {
103
+ input: process.stdin,
104
+ output: process.stdout,
105
+ tabSize: 4,
106
+ terminal: true,
107
+ history: loadReplHistory(defaultHistoryFile),
108
+ removeHistoryDuplicates: true,
109
+ completer: replCompleter
110
+ };
111
+ }
112
+ ;
110
113
  async function replProcessStatement(output, statement, parser, allowRSessionAccess) {
111
114
  if (statement.startsWith(':')) {
112
115
  const command = statement.slice(1).split(' ')[0].toLowerCase();
@@ -157,7 +160,7 @@ async function replProcessAnswer(output, expr, parser, allowRSessionAccess) {
157
160
  * For the execution, this function makes use of {@link replProcessAnswer}.
158
161
  *
159
162
  */
160
- async function repl({ parser = new shell_1.RShell({ revive: 2 /* RShellReviveOptions.Always */ }), rl = readline.createInterface(exports.DEFAULT_REPL_READLINE_CONFIGURATION), output = repl_main_1.standardReplOutput, historyFile = defaultHistoryFile, allowRSessionAccess = false }) {
163
+ async function repl({ parser = new shell_1.RShell({ revive: 2 /* RShellReviveOptions.Always */ }), rl = readline.createInterface(makeDefaultReplReadline()), output = repl_main_1.standardReplOutput, historyFile = defaultHistoryFile, allowRSessionAccess = false }) {
161
164
  if (historyFile) {
162
165
  rl.on('history', h => fs_1.default.writeFileSync(historyFile, h.join('\n'), { encoding: 'utf-8' }));
163
166
  }
@@ -175,9 +178,16 @@ async function repl({ parser = new shell_1.RShell({ revive: 2 /* RShellReviveOpt
175
178
  }
176
179
  }
177
180
  function loadReplHistory(historyFile) {
178
- if (!fs_1.default.existsSync(historyFile)) {
181
+ try {
182
+ if (!fs_1.default.existsSync(historyFile)) {
183
+ return undefined;
184
+ }
185
+ return fs_1.default.readFileSync(historyFile, { encoding: 'utf-8' }).split('\n');
186
+ }
187
+ catch (e) {
188
+ log_1.log.error(`Failed to load repl history from ${historyFile}: ${e?.message}`);
189
+ log_1.log.error(e?.stack);
179
190
  return undefined;
180
191
  }
181
- return fs_1.default.readFileSync(historyFile, { encoding: 'utf-8' }).split('\n');
182
192
  }
183
193
  //# sourceMappingURL=core.js.map
package/config.d.ts CHANGED
@@ -29,7 +29,7 @@ export interface FlowrConfigOptions extends MergeableRecord {
29
29
  };
30
30
  };
31
31
  /**
32
- * The engines to use for interacting with R code. Currently supports {@link TreeSitterEngineConfig} and {@link RShellEngineConfig}.
32
+ * The engines to use for interacting with R code. Currently, supports {@link TreeSitterEngineConfig} and {@link RShellEngineConfig}.
33
33
  * An empty array means all available engines will be used.
34
34
  */
35
35
  readonly engines: readonly EngineConfig[];
@@ -37,7 +37,7 @@ export interface FlowrConfigOptions extends MergeableRecord {
37
37
  * The default engine to use for interacting with R code. If this is undefined, an arbitrary engine from {@link engines} will be used.
38
38
  */
39
39
  readonly defaultEngine?: EngineConfig['type'];
40
- /** How to resolve constants, constraints, cells, ... */
40
+ /** How to resolve constants, constraints, cells, … */
41
41
  readonly solver: {
42
42
  /**
43
43
  * How to resolve variables and their values
package/config.js CHANGED
@@ -110,7 +110,13 @@ function amendConfig(amendment) {
110
110
  function getConfig() {
111
111
  // lazy-load the config based on the current settings
112
112
  if (currentConfig === undefined) {
113
- setConfig(loadConfigFromFile(configFile, configWorkingDirectory));
113
+ try {
114
+ setConfig(loadConfigFromFile(configFile, configWorkingDirectory));
115
+ }
116
+ catch (e) {
117
+ log_1.log.error(`Failed to load config: ${e.message}`);
118
+ setConfig(exports.defaultConfigOptions);
119
+ }
114
120
  }
115
121
  return currentConfig;
116
122
  }
@@ -42,7 +42,7 @@ For this, let's have a look at the example file, located at ${(0, doc_files_1.li
42
42
 
43
43
  ${(0, doc_code_1.codeBlock)('r', (0, doc_files_1.getFileContentFromRoot)('test/testfiles/example.R'))}
44
44
 
45
- Let's suppose we are interested only in the sum which is printed in line 11.
45
+ Let's suppose we are interested only in the \`sum\` which is printed in line 11.
46
46
  To get a slice for this, you can use the following command:
47
47
 
48
48
  ${await (0, doc_repl_1.documentReplSession)(shell, [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "repository": {
package/util/version.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flowrVersion = flowrVersion;
4
4
  const semver_1 = require("semver");
5
5
  // this is automatically replaced with the current version by release-it
6
- const version = '2.2.4';
6
+ const version = '2.2.5';
7
7
  function flowrVersion() {
8
8
  return new semver_1.SemVer(version);
9
9
  }