@eagleoutice/flowr 2.9.12 → 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.
- package/README.md +27 -27
- package/benchmark/slicer.d.ts +4 -2
- package/benchmark/slicer.js +20 -6
- package/benchmark/stats/print.js +12 -0
- package/benchmark/stats/stats.d.ts +3 -2
- package/benchmark/stats/stats.js +1 -1
- package/benchmark/summarizer/data.d.ts +1 -0
- package/benchmark/summarizer/second-phase/process.js +5 -0
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +1 -0
- package/cli/benchmark-helper-app.d.ts +2 -1
- package/cli/benchmark-helper-app.js +6 -3
- package/cli/common/options.d.ts +8 -0
- package/cli/common/options.js +3 -1
- package/cli/common/scripts-info.d.ts +8 -0
- package/cli/export-quads-app.js +1 -1
- package/cli/flowr.js +3 -3
- package/cli/repl/core.d.ts +3 -3
- package/cli/repl/server/connection.d.ts +2 -2
- package/cli/repl/server/server.d.ts +2 -2
- package/cli/script-core/statistics-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.js +1 -1
- package/cli/slicer-app.js +2 -2
- package/cli/statistics-app.js +1 -1
- package/cli/statistics-helper-app.js +1 -1
- package/cli/wiki.js +2 -2
- package/config.d.ts +65 -24
- package/config.js +197 -161
- package/control-flow/extract-cfg.js +5 -8
- package/core/steps/pipeline-step.d.ts +2 -2
- package/dataflow/eval/resolve/alias-tracking.js +12 -15
- package/dataflow/graph/graph.js +8 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +20 -9
- package/documentation/doc-readme.js +2 -2
- package/documentation/wiki-analyzer.js +7 -5
- package/documentation/wiki-core.js +1 -3
- package/documentation/wiki-dataflow-graph.js +1 -1
- package/documentation/wiki-interface.js +5 -3
- package/documentation/wiki-linter.js +5 -5
- package/documentation/wiki-mk/doc-context.js +3 -4
- package/engines.d.ts +2 -2
- package/engines.js +4 -4
- package/linter/rules/dataframe-access-validation.js +5 -5
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +7 -3
- package/package.json +3 -1
- package/project/context/flowr-analyzer-context.d.ts +6 -6
- package/project/context/flowr-analyzer-context.js +2 -2
- package/project/context/flowr-analyzer-files-context.d.ts +2 -2
- package/project/context/flowr-analyzer-files-context.js +28 -8
- package/project/flowr-analyzer-builder.d.ts +10 -6
- package/project/flowr-analyzer-builder.js +12 -3
- package/project/flowr-analyzer.d.ts +3 -3
- package/queries/catalog/config-query/config-query-format.d.ts +5 -5
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
- package/queries/catalog/files-query/files-query-format.d.ts +3 -3
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +3 -3
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +3 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
- package/queries/query.d.ts +18 -18
- package/r-bridge/lang-4.x/ast/model/model.d.ts +7 -2
- package/r-bridge/lang-4.x/ast/model/model.js +13 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -2
- package/statistics/statistics.d.ts +2 -2
- package/util/objects.d.ts +12 -0
- package/util/objects.js +28 -0
- package/util/summarizer.js +1 -1
- package/util/version.js +1 -1
|
@@ -200,6 +200,7 @@ exports.RNode = {
|
|
|
200
200
|
* Returns the direct parent of a node.
|
|
201
201
|
* Usually, only root nodes do not have a parent, and you can assume that there is a
|
|
202
202
|
* linear chain of parents leading to the root node.
|
|
203
|
+
* @see {@link iterateParents} - to get all parents of a node
|
|
203
204
|
*/
|
|
204
205
|
directParent(node, idMap) {
|
|
205
206
|
const parentId = node.info.parent;
|
|
@@ -208,6 +209,18 @@ exports.RNode = {
|
|
|
208
209
|
}
|
|
209
210
|
return idMap.get(parentId);
|
|
210
211
|
},
|
|
212
|
+
/**
|
|
213
|
+
* Returns an iterable of all parents of a node, starting with the direct parent and ending with the root node.
|
|
214
|
+
*/
|
|
215
|
+
*iterateParents(node, idMap) {
|
|
216
|
+
let currentNode = node;
|
|
217
|
+
while (currentNode) {
|
|
218
|
+
currentNode = exports.RNode.directParent(currentNode, idMap);
|
|
219
|
+
if (currentNode) {
|
|
220
|
+
yield currentNode;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
},
|
|
211
224
|
/**
|
|
212
225
|
* In contrast to the nesting stored in the {@link RNode} structure,
|
|
213
226
|
* this function calculates the depth of a node by counting the number of parents until the root node is reached.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type IdGenerator, type NormalizedAst } from '../../model/processing/decorate';
|
|
2
2
|
import type { NoInfo } from '../../model/model';
|
|
3
3
|
import type { ParseStepOutput, ParseStepOutputSingleFile } from '../../../../parser';
|
|
4
|
-
import {
|
|
4
|
+
import { FlowrConfig } from '../../../../../config';
|
|
5
5
|
import type { Tree } from 'web-tree-sitter';
|
|
6
6
|
import { RProject } from '../../model/nodes/r-project';
|
|
7
7
|
export declare const parseLog: import("tslog").Logger<import("tslog").ILogObj>;
|
|
@@ -19,4 +19,4 @@ export declare function normalizeButNotDecorated({ parsed, filePath }: ParseStep
|
|
|
19
19
|
/**
|
|
20
20
|
* Tree-Sitter pendant to {@link normalize}.
|
|
21
21
|
*/
|
|
22
|
-
export declare function normalizeTreeSitter(parsed: ParseStepOutput<Tree>, getId
|
|
22
|
+
export declare function normalizeTreeSitter(parsed: ParseStepOutput<Tree>, getId?: IdGenerator<NoInfo>, config?: FlowrConfig): NormalizedAst;
|
|
@@ -32,8 +32,8 @@ function normalizeButNotDecorated({ parsed, filePath }) {
|
|
|
32
32
|
/**
|
|
33
33
|
* Tree-Sitter pendant to {@link normalize}.
|
|
34
34
|
*/
|
|
35
|
-
function normalizeTreeSitter(parsed, getId = (0, decorate_1.deterministicCountingIdGenerator)(0), config) {
|
|
36
|
-
const lax =
|
|
35
|
+
function normalizeTreeSitter(parsed, getId = (0, decorate_1.deterministicCountingIdGenerator)(0), config = config_1.FlowrConfig.default()) {
|
|
36
|
+
const lax = config_1.FlowrConfig.getForEngine(config, 'tree-sitter')?.lax;
|
|
37
37
|
const result = (0, decorate_1.decorateAst)((0, tree_sitter_normalize_1.normalizeTreeSitterTreeToAst)(parsed.files, lax), { getId });
|
|
38
38
|
result.hasError = parsed.files.some(p => p.parsed.rootNode.hasError);
|
|
39
39
|
return result;
|
|
@@ -224,14 +224,18 @@ function convertTreeNode(node) {
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
case tree_sitter_types_1.TreeSitterType.UnaryOperator: {
|
|
227
|
-
const [
|
|
227
|
+
const [comments, children] = splitComments(nonErrorChildren(node));
|
|
228
|
+
const [op, operand] = children;
|
|
228
229
|
return {
|
|
229
230
|
type: type_1.RType.UnaryOp,
|
|
230
231
|
operand: convertTreeNode(operand),
|
|
231
232
|
location: makeSourceRange(op),
|
|
232
233
|
operator: op.text,
|
|
233
234
|
lexeme: op.text,
|
|
234
|
-
|
|
235
|
+
info: {
|
|
236
|
+
...defaultInfo.info,
|
|
237
|
+
adToks: comments.map(c => c[1]),
|
|
238
|
+
}
|
|
235
239
|
};
|
|
236
240
|
}
|
|
237
241
|
case tree_sitter_types_1.TreeSitterType.NamespaceOperator: {
|
|
@@ -4,7 +4,7 @@ import type { PipelineOutput } from '../core/steps/pipeline/pipeline';
|
|
|
4
4
|
import { DEFAULT_DATAFLOW_PIPELINE } from '../core/steps/pipeline/default-pipelines';
|
|
5
5
|
import type { RShell } from '../r-bridge/shell';
|
|
6
6
|
import { type FeatureSelection, type FeatureStatistics } from './features/feature';
|
|
7
|
-
import type {
|
|
7
|
+
import type { FlowrConfig } from '../config';
|
|
8
8
|
/**
|
|
9
9
|
* By default, {@link extractUsageStatistics} requires a generator, but sometimes you already know all the files
|
|
10
10
|
* that you want to process. This function simply reps your requests as a generator.
|
|
@@ -21,7 +21,7 @@ type DataflowResult = PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>;
|
|
|
21
21
|
* If your request is statically known, you can use {@link staticRequests} to create this generator.
|
|
22
22
|
* @param rootPath - The root path to the project, this is used to relativize the file paths in the statistics.
|
|
23
23
|
*/
|
|
24
|
-
export declare function extractUsageStatistics<T extends RParseRequestFromText | RParseRequestFromFile>(shell: RShell, config:
|
|
24
|
+
export declare function extractUsageStatistics<T extends RParseRequestFromText | RParseRequestFromFile>(shell: RShell, config: FlowrConfig, onRequest: (request: T) => void, features: FeatureSelection, requests: AsyncGenerator<T>, rootPath?: string): Promise<{
|
|
25
25
|
features: FeatureStatistics;
|
|
26
26
|
meta: MetaStatistics;
|
|
27
27
|
outputs: Map<T, DataflowResult>;
|
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/summarizer.js
CHANGED
|
@@ -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
|
|
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.
|
|
9
|
+
const version = '2.9.13';
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
12
12
|
*/
|