@eagleoutice/flowr 2.9.11 → 2.9.13

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 (95) hide show
  1. package/README.md +31 -31
  2. package/benchmark/slicer.d.ts +4 -2
  3. package/benchmark/slicer.js +20 -6
  4. package/benchmark/stats/print.js +12 -0
  5. package/benchmark/stats/stats.d.ts +3 -2
  6. package/benchmark/stats/stats.js +1 -1
  7. package/benchmark/summarizer/data.d.ts +1 -0
  8. package/benchmark/summarizer/second-phase/process.js +5 -0
  9. package/cli/benchmark-app.d.ts +1 -0
  10. package/cli/benchmark-app.js +1 -0
  11. package/cli/benchmark-helper-app.d.ts +2 -1
  12. package/cli/benchmark-helper-app.js +6 -3
  13. package/cli/common/options.d.ts +8 -0
  14. package/cli/common/options.js +3 -1
  15. package/cli/common/scripts-info.d.ts +8 -0
  16. package/cli/export-quads-app.js +1 -1
  17. package/cli/flowr.js +3 -3
  18. package/cli/repl/core.d.ts +3 -3
  19. package/cli/repl/server/connection.d.ts +2 -2
  20. package/cli/repl/server/server.d.ts +2 -2
  21. package/cli/script-core/statistics-core.d.ts +2 -2
  22. package/cli/script-core/statistics-helper-core.d.ts +2 -2
  23. package/cli/script-core/statistics-helper-core.js +1 -1
  24. package/cli/slicer-app.js +2 -2
  25. package/cli/statistics-app.js +1 -1
  26. package/cli/statistics-helper-app.js +1 -1
  27. package/cli/wiki.js +2 -2
  28. package/config.d.ts +65 -24
  29. package/config.js +197 -161
  30. package/control-flow/extract-cfg.js +5 -8
  31. package/core/steps/pipeline-step.d.ts +2 -2
  32. package/dataflow/cluster.js +12 -8
  33. package/dataflow/eval/resolve/alias-tracking.js +12 -15
  34. package/dataflow/graph/graph.js +8 -8
  35. package/dataflow/graph/quads.js +4 -7
  36. package/dataflow/internal/linker.js +5 -5
  37. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -2
  38. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  39. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +20 -9
  40. package/documentation/doc-readme.js +2 -2
  41. package/documentation/wiki-analyzer.js +7 -5
  42. package/documentation/wiki-core.js +1 -3
  43. package/documentation/wiki-dataflow-graph.js +87 -32
  44. package/documentation/wiki-engine.js +18 -0
  45. package/documentation/wiki-interface.js +5 -3
  46. package/documentation/wiki-linter.js +5 -5
  47. package/documentation/wiki-mk/doc-context.d.ts +44 -11
  48. package/documentation/wiki-mk/doc-context.js +19 -17
  49. package/engines.d.ts +2 -2
  50. package/engines.js +4 -4
  51. package/linter/rules/dataframe-access-validation.js +5 -5
  52. package/linter/rules/naming-convention.d.ts +1 -1
  53. package/linter/rules/naming-convention.js +7 -3
  54. package/package.json +3 -1
  55. package/project/context/flowr-analyzer-context.d.ts +6 -6
  56. package/project/context/flowr-analyzer-context.js +2 -2
  57. package/project/context/flowr-analyzer-files-context.d.ts +2 -2
  58. package/project/context/flowr-analyzer-files-context.js +28 -8
  59. package/project/flowr-analyzer-builder.d.ts +10 -6
  60. package/project/flowr-analyzer-builder.js +12 -3
  61. package/project/flowr-analyzer.d.ts +3 -3
  62. package/queries/catalog/config-query/config-query-format.d.ts +5 -5
  63. package/queries/catalog/dependencies-query/function-info/library-functions.js +2 -1
  64. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  65. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +9 -1
  66. package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -0
  67. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
  68. package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
  69. package/queries/catalog/files-query/files-query-format.d.ts +3 -3
  70. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
  71. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
  72. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
  73. package/queries/catalog/linter-query/linter-query-format.d.ts +3 -3
  74. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
  75. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
  76. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +3 -3
  77. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -2
  78. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -0
  79. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
  80. package/queries/query.d.ts +18 -18
  81. package/r-bridge/lang-4.x/ast/model/model.d.ts +7 -2
  82. package/r-bridge/lang-4.x/ast/model/model.js +13 -0
  83. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -2
  84. package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -2
  85. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -2
  86. package/statistics/statistics.d.ts +2 -2
  87. package/util/mermaid/dfg.d.ts +8 -0
  88. package/util/mermaid/dfg.js +4 -0
  89. package/util/objects.d.ts +12 -0
  90. package/util/objects.js +28 -0
  91. package/util/quads.js +14 -6
  92. package/util/range.d.ts +3 -0
  93. package/util/range.js +3 -0
  94. package/util/summarizer.js +1 -1
  95. package/util/version.js +1 -1
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mermaidNodeBrackets = mermaidNodeBrackets;
3
4
  exports.printIdentifier = printIdentifier;
4
5
  exports.graphToMermaid = graphToMermaid;
5
6
  exports.graphToMermaidUrl = graphToMermaidUrl;
@@ -89,6 +90,9 @@ function displayFunctionArgMapping(argMapping) {
89
90
  function encodeEdge(from, to, types) {
90
91
  return `${from}->${to}["${Array.from(types).join(':')}"]`;
91
92
  }
93
+ /**
94
+ * Translates a vertex tag to the corresponding mermaid node brackets.
95
+ */
92
96
  function mermaidNodeBrackets(tag) {
93
97
  let open;
94
98
  let close;
package/util/objects.d.ts CHANGED
@@ -32,4 +32,16 @@ type DefinedRecord<T> = {
32
32
  export declare function compactRecord<T extends Record<string, unknown>>(record: T): DefinedRecord<T>;
33
33
  export declare function compactRecord(record: undefined): undefined;
34
34
  export declare function compactRecord<T extends Record<string, unknown>>(record: T | undefined): DefinedRecord<T> | undefined;
35
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | Function;
36
+ /**
37
+ * Given an object type `T`, produces a union of string literal types representing all possible paths to primitive values within that object.
38
+ * Sadly, right now, the ts-essential paths property breaks when it comes to deeper nested objects
39
+ */
40
+ export type AutocompletablePaths<T, Prefix extends string = ''> = T extends Primitive | readonly unknown[] ? never : {
41
+ [K in keyof T & string]: `${Prefix}${K}` | (T[K] extends Primitive | readonly unknown[] ? never : AutocompletablePaths<T[K], `${Prefix}${K}.`>);
42
+ }[keyof T & string];
43
+ /**
44
+ * This is a version of a deep clone that preserves unclonable values (like functions, symbols, ...) by keeping the same reference to them.
45
+ */
46
+ export declare function deepClonePreserveUnclonable<T>(obj: T): T;
35
47
  export {};
package/util/objects.js CHANGED
@@ -4,6 +4,7 @@ exports.isObjectOrArray = isObjectOrArray;
4
4
  exports.deepMergeObject = deepMergeObject;
5
5
  exports.deepMergeObjectInPlace = deepMergeObjectInPlace;
6
6
  exports.compactRecord = compactRecord;
7
+ exports.deepClonePreserveUnclonable = deepClonePreserveUnclonable;
7
8
  const json_1 = require("./json");
8
9
  /**
9
10
  * checks if `item` is an object (it may be an array, ...)
@@ -100,4 +101,31 @@ function compactRecord(record) {
100
101
  }
101
102
  return result;
102
103
  }
104
+ /**
105
+ * This is a version of a deep clone that preserves unclonable values (like functions, symbols, ...) by keeping the same reference to them.
106
+ */
107
+ function deepClonePreserveUnclonable(obj) {
108
+ if (typeof obj !== 'object' || obj === null) {
109
+ return obj;
110
+ }
111
+ else if (Array.isArray(obj)) {
112
+ return obj.map(deepClonePreserveUnclonable);
113
+ }
114
+ else if (obj instanceof Date) {
115
+ return new Date(obj.getTime());
116
+ }
117
+ else if (obj instanceof Map) {
118
+ return new Map(obj.entries().map(([k, v]) => [deepClonePreserveUnclonable(k), deepClonePreserveUnclonable(v)]));
119
+ }
120
+ else if (obj instanceof Set) {
121
+ return new Set(obj.values().map(deepClonePreserveUnclonable));
122
+ }
123
+ else {
124
+ const result = {};
125
+ for (const key of Object.keys(obj)) {
126
+ result[key] = deepClonePreserveUnclonable(obj[key]);
127
+ }
128
+ return result;
129
+ }
130
+ }
103
131
  //# sourceMappingURL=objects.js.map
package/util/quads.js CHANGED
@@ -130,16 +130,24 @@ function processLiteralEntry(value, key, obj, quads, config, index) {
130
130
  }
131
131
  }
132
132
  function processObjectEntry(key, value, obj, quads, config) {
133
- if (config.ignore(key, value)) {
134
- return;
135
- }
136
- if (guardCycle(value)) {
133
+ if (config.ignore(key, value) || guardCycle(value)) {
137
134
  return;
138
135
  }
139
136
  if ((0, objects_1.isObjectOrArray)(value)) {
140
137
  if (Array.isArray(value)) {
141
138
  processArrayEntries(key, value, obj, quads, config);
142
139
  }
140
+ else if (value instanceof Map) {
141
+ for (const [mapKey, mapValue] of value.entries()) {
142
+ processObjectEntry('key-' + String(mapKey), mapValue, obj, quads, config);
143
+ }
144
+ }
145
+ else if (value instanceof Set) {
146
+ let i = 0;
147
+ for (const setValue of value.values()) {
148
+ processObjectEntry('idx-' + String(i++), setValue, obj, quads, config);
149
+ }
150
+ }
143
151
  else {
144
152
  processObjectEntries(key, value, obj, quads, config);
145
153
  }
@@ -152,10 +160,10 @@ let store = new Set();
152
160
  function guardCycle(obj) {
153
161
  // @ts-expect-error we do not care about the type here
154
162
  if ((0, objects_1.isObjectOrArray)(obj) && 'id' in obj) {
155
- if (store.has(obj.id)) {
163
+ if (store.has(obj)) {
156
164
  return true;
157
165
  }
158
- store.add(obj.id);
166
+ store.add(obj);
159
167
  }
160
168
  return false;
161
169
  }
package/util/range.d.ts CHANGED
@@ -16,6 +16,7 @@ export type SourcePosition = [
16
16
  * Utility functions for {@link SourcePosition|source positions}.
17
17
  */
18
18
  export declare const SourcePosition: {
19
+ readonly name: "SourcePosition";
19
20
  /**
20
21
  * Formats a {@link SourcePosition|source position} as a human-readable string.
21
22
  */
@@ -48,6 +49,7 @@ export type SourceRange = [
48
49
  * Utility functions for {@link SourceRange|source ranges}.
49
50
  */
50
51
  export declare const SourceRange: {
52
+ readonly name: "SourceRange";
51
53
  /**
52
54
  * Prints a {@link SourceRange|range} as a human-readable string.
53
55
  */
@@ -123,6 +125,7 @@ export type SourceLocation = [...r: SourceRange, f?: string];
123
125
  * Utility functions for {@link SourceLocation|source locations}.
124
126
  */
125
127
  export declare const SourceLocation: {
128
+ readonly name: "SourceLocation";
126
129
  /**
127
130
  * Formats a {@link SourceLocation|source location} as a human-readable string.
128
131
  */
package/util/range.js CHANGED
@@ -6,6 +6,7 @@ const assert_1 = require("./assert");
6
6
  * Utility functions for {@link SourcePosition|source positions}.
7
7
  */
8
8
  exports.SourcePosition = {
9
+ name: 'SourcePosition',
9
10
  /**
10
11
  * Formats a {@link SourcePosition|source position} as a human-readable string.
11
12
  */
@@ -36,6 +37,7 @@ exports.SourcePosition = {
36
37
  * Utility functions for {@link SourceRange|source ranges}.
37
38
  */
38
39
  exports.SourceRange = {
40
+ name: 'SourceRange',
39
41
  /**
40
42
  * Prints a {@link SourceRange|range} as a human-readable string.
41
43
  */
@@ -157,6 +159,7 @@ exports.SourceRange = {
157
159
  * Utility functions for {@link SourceLocation|source locations}.
158
160
  */
159
161
  exports.SourceLocation = {
162
+ name: 'SourceLocation',
160
163
  /**
161
164
  * Formats a {@link SourceLocation|source location} as a human-readable string.
162
165
  */
@@ -34,7 +34,7 @@ function summarizeMeasurement(data, totalNumberOfDataPoints) {
34
34
  // just to avoid in-place modification
35
35
  const sorted = [...data].sort((a, b) => a - b);
36
36
  const min = sorted[0];
37
- const max = sorted[sorted.length - 1];
37
+ const max = sorted.at(-1);
38
38
  const median = sorted[Math.floor(sorted.length / 2)];
39
39
  const total = (0, arrays_1.arraySum)(sorted);
40
40
  const length = totalNumberOfDataPoints ?? sorted.length;
package/util/version.js CHANGED
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
6
6
  const semver_1 = require("semver");
7
7
  const assert_1 = require("./assert");
8
8
  // this is automatically replaced with the current version by release-it
9
- const version = '2.9.11';
9
+ const version = '2.9.13';
10
10
  /**
11
11
  * Retrieves the current flowR version as a new {@link SemVer} object.
12
12
  */