@eagleoutice/flowr 2.5.0 → 2.6.1
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 +46 -35
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +1 -1
- package/abstract-interpretation/data-frame/absint-visitor.js +1 -1
- package/cli/flowr.js +11 -33
- package/cli/repl/commands/repl-cfg.d.ts +5 -5
- package/cli/repl/commands/repl-cfg.js +21 -22
- package/cli/repl/commands/repl-commands.d.ts +3 -3
- package/cli/repl/commands/repl-commands.js +2 -0
- package/cli/repl/commands/repl-dataflow.d.ts +5 -5
- package/cli/repl/commands/repl-dataflow.js +27 -30
- package/cli/repl/commands/repl-execute.d.ts +1 -1
- package/cli/repl/commands/repl-execute.js +8 -7
- package/cli/repl/commands/repl-lineage.d.ts +2 -2
- package/cli/repl/commands/repl-lineage.js +11 -11
- package/cli/repl/commands/repl-main.d.ts +35 -7
- package/cli/repl/commands/repl-normalize.d.ts +3 -3
- package/cli/repl/commands/repl-normalize.js +15 -19
- package/cli/repl/commands/repl-parse.d.ts +2 -2
- package/cli/repl/commands/repl-parse.js +14 -8
- package/cli/repl/commands/repl-query.d.ts +3 -3
- package/cli/repl/commands/repl-query.js +29 -19
- package/cli/repl/commands/repl-quit.js +1 -0
- package/cli/repl/commands/repl-version.d.ts +1 -16
- package/cli/repl/commands/repl-version.js +2 -18
- package/cli/repl/core.d.ts +12 -9
- package/cli/repl/core.js +26 -12
- package/cli/repl/print-version.js +2 -2
- package/cli/repl/server/connection.d.ts +7 -3
- package/cli/repl/server/connection.js +46 -50
- package/cli/repl/server/messages/message-hello.d.ts +1 -1
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/repl/server/server.js +2 -2
- package/cli/slicer-app.js +1 -1
- package/config.d.ts +1 -1
- package/config.js +4 -1
- package/control-flow/extract-cfg.d.ts +1 -1
- package/control-flow/extract-cfg.js +1 -1
- package/core/pipeline-executor.d.ts +5 -0
- package/core/pipeline-executor.js +5 -0
- package/core/steps/all/core/20-dataflow.d.ts +3 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/core/steps/pipeline/default-pipelines.d.ts +24 -8
- package/core/steps/pipeline/default-pipelines.js +4 -1
- package/dataflow/environments/default-builtin-config.js +8 -0
- package/dataflow/eval/resolve/alias-tracking.js +2 -0
- package/dataflow/eval/resolve/resolve.js +3 -0
- package/dataflow/eval/values/r-value.d.ts +4 -1
- package/dataflow/eval/values/r-value.js +2 -0
- package/dataflow/extractor.d.ts +4 -1
- package/dataflow/extractor.js +7 -5
- package/dataflow/fn/higher-order-function.d.ts +9 -0
- package/dataflow/fn/higher-order-function.js +75 -0
- package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
- package/dataflow/graph/dataflowgraph-builder.js +6 -6
- package/documentation/doc-util/doc-query.d.ts +3 -6
- package/documentation/doc-util/doc-query.js +5 -17
- package/documentation/doc-util/doc-repl.js +5 -2
- package/documentation/doc-util/doc-search.js +7 -10
- package/documentation/doc-util/doc-structure.d.ts +4 -0
- package/documentation/doc-util/doc-structure.js +28 -0
- package/documentation/doc-util/doc-types.d.ts +5 -1
- package/documentation/doc-util/doc-types.js +29 -3
- package/documentation/print-analyzer-wiki.d.ts +1 -0
- package/documentation/print-analyzer-wiki.js +137 -0
- package/documentation/print-core-wiki.d.ts +2 -1
- package/documentation/print-core-wiki.js +58 -4
- package/documentation/print-dataflow-graph-wiki.js +16 -23
- package/documentation/print-interface-wiki.js +18 -1
- package/documentation/print-linter-wiki.js +5 -1
- package/documentation/print-normalized-ast-wiki.js +6 -8
- package/documentation/print-query-wiki.js +20 -0
- package/documentation/print-readme.js +1 -1
- package/engines.d.ts +9 -0
- package/engines.js +38 -0
- package/linter/linter-executor.d.ts +2 -8
- package/linter/linter-executor.js +9 -4
- package/linter/linter-format.d.ts +8 -9
- package/linter/linter-rules.d.ts +57 -15
- package/linter/linter-rules.js +2 -0
- package/linter/rules/absolute-path.d.ts +1 -0
- package/linter/rules/dataframe-access-validation.d.ts +4 -3
- package/linter/rules/dataframe-access-validation.js +7 -4
- package/linter/rules/dead-code.d.ts +2 -1
- package/linter/rules/deprecated-functions.d.ts +15 -28
- package/linter/rules/deprecated-functions.js +5 -43
- package/linter/rules/file-path-validity.d.ts +2 -1
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/function-finder-util.d.ts +51 -0
- package/linter/rules/function-finder-util.js +77 -0
- package/linter/rules/naming-convention.d.ts +2 -1
- package/linter/rules/network-functions.d.ts +40 -0
- package/linter/rules/network-functions.js +24 -0
- package/linter/rules/seeded-randomness.d.ts +2 -1
- package/linter/rules/unused-definition.d.ts +2 -1
- package/linter/rules/useless-loop.d.ts +3 -2
- package/linter/rules/useless-loop.js +4 -6
- package/package.json +2 -1
- package/project/cache/flowr-analyzer-cache.d.ts +94 -0
- package/project/cache/flowr-analyzer-cache.js +164 -0
- package/project/cache/flowr-cache.d.ts +28 -0
- package/project/cache/flowr-cache.js +49 -0
- package/project/cfg-kind.d.ts +17 -0
- package/project/cfg-kind.js +22 -0
- package/project/context/abstract-flowr-analyzer-context.d.ts +39 -0
- package/project/context/abstract-flowr-analyzer-context.js +46 -0
- package/project/context/flowr-analyzer-context.d.ts +54 -0
- package/project/context/flowr-analyzer-context.js +58 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +39 -0
- package/project/context/flowr-analyzer-dependencies-context.js +43 -0
- package/project/context/flowr-analyzer-files-context.d.ts +87 -0
- package/project/context/flowr-analyzer-files-context.js +134 -0
- package/project/context/flowr-analyzer-loading-order-context.d.ts +77 -0
- package/project/context/flowr-analyzer-loading-order-context.js +96 -0
- package/project/context/flowr-file.d.ts +89 -0
- package/project/context/flowr-file.js +78 -0
- package/project/flowr-analyzer-builder.d.ts +106 -0
- package/project/flowr-analyzer-builder.js +197 -0
- package/project/flowr-analyzer.d.ts +126 -0
- package/project/flowr-analyzer.js +88 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
- package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
- package/project/plugins/file-plugins/flowr-description-file.js +38 -0
- package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
- package/project/plugins/flowr-analyzer-plugin.js +82 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
- package/project/plugins/package-version-plugins/package.d.ts +15 -0
- package/project/plugins/package-version-plugins/package.js +56 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
- package/queries/base-query-format.d.ts +2 -8
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +21 -13
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
- package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
- package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
- package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.js +5 -5
- package/queries/catalog/config-query/config-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.js +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +3 -3
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
- package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
- package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
- package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
- package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
- package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +45 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +22 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +32 -0
- package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
- package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.js +2 -3
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
- package/queries/catalog/linter-query/linter-query-format.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
- package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
- package/queries/catalog/project-query/project-query-executor.js +2 -2
- package/queries/catalog/project-query/project-query-format.d.ts +1 -54
- package/queries/catalog/project-query/project-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
- package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
- package/queries/catalog/search-query/search-query-executor.js +3 -3
- package/queries/catalog/search-query/search-query-format.d.ts +1 -54
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
- package/queries/query-print.d.ts +4 -4
- package/queries/query-print.js +12 -12
- package/queries/query.d.ts +37 -885
- package/queries/query.js +3 -1
- package/r-bridge/parser.d.ts +7 -0
- package/r-bridge/retriever.d.ts +6 -5
- package/r-bridge/retriever.js +9 -5
- package/search/flowr-search-executor.d.ts +3 -5
- package/search/flowr-search-executor.js +6 -4
- package/search/flowr-search-filters.d.ts +12 -6
- package/search/flowr-search-filters.js +1 -1
- package/search/flowr-search.d.ts +5 -16
- package/search/flowr-search.js +14 -5
- package/search/search-executor/search-enrichers.d.ts +37 -36
- package/search/search-executor/search-enrichers.js +5 -4
- package/search/search-executor/search-generators.d.ts +12 -12
- package/search/search-executor/search-generators.js +27 -19
- package/search/search-executor/search-mappers.d.ts +5 -5
- package/search/search-executor/search-transformer.d.ts +17 -17
- package/search/search-executor/search-transformer.js +14 -7
- package/util/collections/arrays.d.ts +1 -0
- package/util/collections/arrays.js +15 -0
- package/util/collections/objectmap.d.ts +17 -0
- package/util/collections/objectmap.js +28 -0
- package/util/containers.d.ts +0 -1
- package/util/containers.js +0 -1
- package/util/files.d.ts +17 -0
- package/util/files.js +65 -0
- package/util/formats/adapter.d.ts +4 -2
- package/util/formats/adapter.js +11 -4
- package/util/r-value.d.ts +1 -1
- package/util/r-value.js +2 -0
- package/util/version.d.ts +17 -0
- package/util/version.js +28 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { FlowrSearchElement
|
|
1
|
+
import type { FlowrSearchElement } from '../flowr-search';
|
|
2
2
|
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
3
|
import type { Enrichment } from './search-enrichers';
|
|
4
4
|
import type { MergeableRecord } from '../../util/objects';
|
|
5
|
-
import type {
|
|
5
|
+
import type { FlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
6
6
|
export declare enum Mapper {
|
|
7
7
|
Enrichment = "enrichment"
|
|
8
8
|
}
|
|
9
9
|
export interface MapperData<Arguments extends string | MergeableRecord> {
|
|
10
|
-
mapper: (e: FlowrSearchElement<ParentInformation>, data:
|
|
10
|
+
mapper: (e: FlowrSearchElement<ParentInformation>, data: FlowrAnalysisProvider, args: Arguments) => FlowrSearchElement<ParentInformation>[];
|
|
11
11
|
}
|
|
12
12
|
export type MapperArguments<M extends Mapper> = typeof Mappers[M] extends MapperData<infer Arguments> ? Arguments : never;
|
|
13
13
|
declare const Mappers: {
|
|
14
14
|
readonly enrichment: {
|
|
15
|
-
mapper: (e: FlowrSearchElement<ParentInformation>, _data:
|
|
15
|
+
mapper: (e: FlowrSearchElement<ParentInformation>, _data: FlowrAnalysisProvider, enrichment: Enrichment) => FlowrSearchElement<ParentInformation>[];
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export declare function map<Element extends FlowrSearchElement<ParentInformation>, MapperType extends Mapper>(e: Element, data:
|
|
18
|
+
export declare function map<Element extends FlowrSearchElement<ParentInformation>, MapperType extends Mapper>(e: Element, data: FlowrAnalysisProvider, mapper: MapperType, args: MapperArguments<MapperType>): Element[];
|
|
19
19
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { FlowrSearchElement, FlowrSearchElements,
|
|
2
|
-
import type { Pipeline } from '../../core/steps/pipeline/pipeline';
|
|
1
|
+
import type { FlowrSearchElement, FlowrSearchElements, FlowrSearchTransformerNodeBase } from '../flowr-search';
|
|
3
2
|
import type { LastOfArray, Tail2TypesOrUndefined, TailOfArray } from '../../util/collections/arrays';
|
|
4
3
|
import type { FlowrFilterExpression } from '../flowr-search-filters';
|
|
5
4
|
import type { FlowrSearchGeneratorNode } from './search-generators';
|
|
6
5
|
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
6
|
import type { Enrichment, EnrichmentElementArguments } from './search-enrichers';
|
|
8
7
|
import type { Mapper, MapperArguments } from './search-mappers';
|
|
8
|
+
import type { FlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
9
9
|
/**
|
|
10
10
|
* This is a union of all possible transformer node types
|
|
11
11
|
*/
|
|
@@ -37,35 +37,35 @@ export declare const transformers: {
|
|
|
37
37
|
export declare function getTransformer<Name extends TransformerNames>(name: Name): typeof transformers[Name];
|
|
38
38
|
/** If we already have no more elements, cascade will not add any but keep the empty elements, otherwise it will now be NewElements */
|
|
39
39
|
type CascadeEmpty<Elements extends FlowrSearchElement<ParentInformation>[], NewElements extends FlowrSearchElement<ParentInformation>[]> = Elements extends [] ? FlowrSearchElements<ParentInformation, []> : FlowrSearchElements<ParentInformation, NewElements>;
|
|
40
|
-
declare function getFirst<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
41
|
-
declare function getLast<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
42
|
-
declare function getIndex<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
40
|
+
declare function getFirst<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE): CascadeEmpty<Elements, [Elements[0]]>;
|
|
41
|
+
declare function getLast<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE): CascadeEmpty<Elements, [LastOfArray<Elements>]>;
|
|
42
|
+
declare function getIndex<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { index }: {
|
|
43
43
|
index: number;
|
|
44
44
|
}): CascadeEmpty<Elements, [Elements[number]]>;
|
|
45
|
-
declare function getSelect<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
45
|
+
declare function getSelect<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { select }: {
|
|
46
46
|
select: number[];
|
|
47
47
|
}): CascadeEmpty<Elements, Elements>;
|
|
48
|
-
declare function getTail<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
49
|
-
declare function getTake<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
48
|
+
declare function getTail<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE): CascadeEmpty<Elements, TailOfArray<Elements>>;
|
|
49
|
+
declare function getTake<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { count }: {
|
|
50
50
|
count: number;
|
|
51
51
|
}): CascadeEmpty<Elements, TailOfArray<Elements>>;
|
|
52
|
-
declare function getSkip<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
52
|
+
declare function getSkip<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { count }: {
|
|
53
53
|
count: number;
|
|
54
54
|
}): CascadeEmpty<Elements, TailOfArray<Elements>>;
|
|
55
|
-
declare function getFilter<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
55
|
+
declare function getFilter<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { filter }: {
|
|
56
56
|
filter: FlowrFilterExpression;
|
|
57
|
-
}): CascadeEmpty<Elements, Elements | []
|
|
58
|
-
declare function getWith<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(
|
|
57
|
+
}): Promise<CascadeEmpty<Elements, Elements | []>>;
|
|
58
|
+
declare function getWith<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(input: FlowrAnalysisProvider, elements: FSE, { info, args }: {
|
|
59
59
|
info: Enrichment;
|
|
60
60
|
args?: EnrichmentElementArguments<Enrichment>;
|
|
61
|
-
}): FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]
|
|
62
|
-
declare function getMap<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
61
|
+
}): Promise<FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>>;
|
|
62
|
+
declare function getMap<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { mapper, args }: {
|
|
63
63
|
mapper: Mapper;
|
|
64
64
|
args: MapperArguments<Mapper>;
|
|
65
65
|
}): FlowrSearchElements<ParentInformation, Elements>;
|
|
66
|
-
declare function getMerge<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
66
|
+
declare function getMerge<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, other: {
|
|
67
67
|
search: unknown[];
|
|
68
68
|
generator: FlowrSearchGeneratorNode;
|
|
69
|
-
}): FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]
|
|
70
|
-
declare function getUnique<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data:
|
|
69
|
+
}): Promise<FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>>;
|
|
70
|
+
declare function getUnique<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE): CascadeEmpty<Elements, Elements>;
|
|
71
71
|
export {};
|
|
@@ -92,19 +92,26 @@ function getTake(data, elements, { count }) {
|
|
|
92
92
|
function getSkip(data, elements, { count }) {
|
|
93
93
|
return elements.mutate(e => sortFully(e).slice(count));
|
|
94
94
|
}
|
|
95
|
-
function getFilter(data, elements, { filter }) {
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
async function getFilter(data, elements, { filter }) {
|
|
96
|
+
const dataflow = await data.dataflow();
|
|
97
|
+
return elements.mutate(e => e.filter(e => (0, flowr_search_filters_1.evalFilter)(filter, { element: e, data: { dataflow } })));
|
|
98
|
+
}
|
|
99
|
+
async function getWith(input, elements, { info, args }) {
|
|
100
|
+
const data = {
|
|
101
|
+
normalize: await input.normalize(),
|
|
102
|
+
dataflow: await input.dataflow(),
|
|
103
|
+
cfg: await input.controlflow(),
|
|
104
|
+
config: input.flowrConfig
|
|
105
|
+
};
|
|
106
|
+
return (await elements.enrich(input, info, args)).mutate(async (s) => await Promise.all(s.map(e => (0, search_enrichers_1.enrichElement)(e, elements, data, info, args))));
|
|
100
107
|
}
|
|
101
108
|
function getMap(data, elements, { mapper, args }) {
|
|
102
109
|
return elements.mutate(elements => elements.flatMap(e => (0, search_mappers_1.map)(e, data, mapper, args)));
|
|
103
110
|
}
|
|
104
|
-
function getMerge(
|
|
111
|
+
async function getMerge(
|
|
105
112
|
/* search has to be unknown because it is a recursive type */
|
|
106
113
|
data, elements, other) {
|
|
107
|
-
const resultOther = (0, flowr_search_executor_1.runSearch)(other, data);
|
|
114
|
+
const resultOther = await (0, flowr_search_executor_1.runSearch)(other, data);
|
|
108
115
|
return elements.addAll([...resultOther.getElements()]);
|
|
109
116
|
}
|
|
110
117
|
function getUnique(data, elements) {
|
|
@@ -90,3 +90,4 @@ export declare function equidistantSampling<T>(list: readonly T[], sampleCount:
|
|
|
90
90
|
export declare function cartesianProduct<T>(...arrays: T[][]): T[][];
|
|
91
91
|
/** merge two arrays, removing duplicates */
|
|
92
92
|
export declare function uniqueArrayMerge<T>(left: readonly T[], right: readonly T[]): T[];
|
|
93
|
+
export declare function arraysGroupBy<T, K>(arr: readonly T[], keyFn: (elem: T) => K): Map<K, T[]>;
|
|
@@ -11,6 +11,7 @@ exports.arrayEqual = arrayEqual;
|
|
|
11
11
|
exports.equidistantSampling = equidistantSampling;
|
|
12
12
|
exports.cartesianProduct = cartesianProduct;
|
|
13
13
|
exports.uniqueArrayMerge = uniqueArrayMerge;
|
|
14
|
+
exports.arraysGroupBy = arraysGroupBy;
|
|
14
15
|
const assert_1 = require("../assert");
|
|
15
16
|
/**
|
|
16
17
|
* Splits the array every time the given predicate fires.
|
|
@@ -224,4 +225,18 @@ function uniqueArrayMerge(left, right) {
|
|
|
224
225
|
}
|
|
225
226
|
return Array.from(result);
|
|
226
227
|
}
|
|
228
|
+
function arraysGroupBy(arr, keyFn) {
|
|
229
|
+
const result = new Map();
|
|
230
|
+
for (const elem of arr) {
|
|
231
|
+
const key = keyFn(elem);
|
|
232
|
+
const group = result.get(key);
|
|
233
|
+
if (group) {
|
|
234
|
+
group.push(elem);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
result.set(key, [elem]);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
227
242
|
//# sourceMappingURL=arrays.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A map type that accepts an arbitrary object as key.
|
|
3
|
+
* {@link JSON.stringify} is used to create the actual key for the underlying map.
|
|
4
|
+
* This can be helpful if value equality is desired.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ObjectMap<K, V> {
|
|
7
|
+
private readonly internal;
|
|
8
|
+
private makeKey;
|
|
9
|
+
/**
|
|
10
|
+
* Sets a value for a given key.
|
|
11
|
+
*/
|
|
12
|
+
set(key: K, v: V): void;
|
|
13
|
+
/**
|
|
14
|
+
* Return the value for the key.
|
|
15
|
+
*/
|
|
16
|
+
get(key: K): V | undefined;
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectMap = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A map type that accepts an arbitrary object as key.
|
|
6
|
+
* {@link JSON.stringify} is used to create the actual key for the underlying map.
|
|
7
|
+
* This can be helpful if value equality is desired.
|
|
8
|
+
*/
|
|
9
|
+
class ObjectMap {
|
|
10
|
+
internal = new Map();
|
|
11
|
+
makeKey(key) {
|
|
12
|
+
return JSON.stringify(key);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Sets a value for a given key.
|
|
16
|
+
*/
|
|
17
|
+
set(key, v) {
|
|
18
|
+
this.internal.set(this.makeKey(key), v);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Return the value for the key.
|
|
22
|
+
*/
|
|
23
|
+
get(key) {
|
|
24
|
+
return this.internal.get(this.makeKey(key));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ObjectMap = ObjectMap;
|
|
28
|
+
//# sourceMappingURL=objectmap.js.map
|
package/util/containers.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export declare function getAccessOperands<OtherInfo>(args: readonly RFunctionArg
|
|
|
17
17
|
*
|
|
18
18
|
* @param name - Name to resolve
|
|
19
19
|
* @param environment - Environment in which name is resolved
|
|
20
|
-
* @param builtInEnvironment - Built-in environment
|
|
21
20
|
* @returns The indicesCollection of the resolved definitions
|
|
22
21
|
*/
|
|
23
22
|
export declare function resolveIndicesByName(name: Identifier, environment: REnvironmentInformation): ContainerIndices[] | undefined;
|
package/util/containers.js
CHANGED
|
@@ -24,7 +24,6 @@ function getAccessOperands(args) {
|
|
|
24
24
|
*
|
|
25
25
|
* @param name - Name to resolve
|
|
26
26
|
* @param environment - Environment in which name is resolved
|
|
27
|
-
* @param builtInEnvironment - Built-in environment
|
|
28
27
|
* @returns The indicesCollection of the resolved definitions
|
|
29
28
|
*/
|
|
30
29
|
function resolveIndicesByName(name, environment) {
|
package/util/files.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { PathLike } from 'fs';
|
|
1
2
|
import type { RParseRequestFromFile } from '../r-bridge/retriever';
|
|
3
|
+
import type { FlowrFileProvider } from '../project/context/flowr-file';
|
|
2
4
|
/**
|
|
3
5
|
* Represents a table, identified by a header and a list of rows.
|
|
4
6
|
*/
|
|
@@ -11,8 +13,16 @@ export interface Table {
|
|
|
11
13
|
* @param dir - Directory path to start the search from
|
|
12
14
|
* @param suffix - Suffix of the files to be retrieved
|
|
13
15
|
* Based on {@link https://stackoverflow.com/a/45130990}
|
|
16
|
+
*
|
|
17
|
+
* @see {@link getAllFilesSync} for a synchronous version.
|
|
14
18
|
*/
|
|
15
19
|
export declare function getAllFiles(dir: string, suffix?: RegExp): AsyncGenerator<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves all files in the given directory recursively (synchronously)
|
|
22
|
+
*
|
|
23
|
+
* @see {@link getAllFiles} - for an asynchronous version.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAllFilesSync(dir: string, suffix?: RegExp): Generator<string>;
|
|
16
26
|
/**
|
|
17
27
|
* Retrieves all R files in a given directory (asynchronously)
|
|
18
28
|
*
|
|
@@ -63,3 +73,10 @@ export declare function readLineByLineSync(filePath: string, onLine: (line: Buff
|
|
|
63
73
|
* @param directory - The directory whose parent to return
|
|
64
74
|
*/
|
|
65
75
|
export declare function getParentDirectory(directory: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Parses the given file in the 'Debian Control Format'.
|
|
78
|
+
* @param file - The file to parse
|
|
79
|
+
* @returns Map containing the keys and values of the provided file.
|
|
80
|
+
*/
|
|
81
|
+
export declare function parseDCF(file: FlowrFileProvider<string>): Map<string, string[]>;
|
|
82
|
+
export declare function isFilePath(p: PathLike): boolean;
|
package/util/files.js
CHANGED
|
@@ -37,12 +37,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getAllFiles = getAllFiles;
|
|
40
|
+
exports.getAllFilesSync = getAllFilesSync;
|
|
40
41
|
exports.allRFiles = allRFiles;
|
|
41
42
|
exports.allRFilesFrom = allRFilesFrom;
|
|
42
43
|
exports.writeTableAsCsv = writeTableAsCsv;
|
|
43
44
|
exports.readLineByLine = readLineByLine;
|
|
44
45
|
exports.readLineByLineSync = readLineByLineSync;
|
|
45
46
|
exports.getParentDirectory = getParentDirectory;
|
|
47
|
+
exports.parseDCF = parseDCF;
|
|
48
|
+
exports.isFilePath = isFilePath;
|
|
46
49
|
const fs_1 = __importStar(require("fs"));
|
|
47
50
|
const path_1 = __importDefault(require("path"));
|
|
48
51
|
const log_1 = require("./log");
|
|
@@ -52,6 +55,8 @@ const n_readlines_1 = __importDefault(require("n-readlines"));
|
|
|
52
55
|
* @param dir - Directory path to start the search from
|
|
53
56
|
* @param suffix - Suffix of the files to be retrieved
|
|
54
57
|
* Based on {@link https://stackoverflow.com/a/45130990}
|
|
58
|
+
*
|
|
59
|
+
* @see {@link getAllFilesSync} for a synchronous version.
|
|
55
60
|
*/
|
|
56
61
|
async function* getAllFiles(dir, suffix = /.*/) {
|
|
57
62
|
const entries = await fs_1.promises.readdir(dir, { withFileTypes: true, recursive: false });
|
|
@@ -65,6 +70,23 @@ async function* getAllFiles(dir, suffix = /.*/) {
|
|
|
65
70
|
}
|
|
66
71
|
}
|
|
67
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Retrieves all files in the given directory recursively (synchronously)
|
|
75
|
+
*
|
|
76
|
+
* @see {@link getAllFiles} - for an asynchronous version.
|
|
77
|
+
*/
|
|
78
|
+
function* getAllFilesSync(dir, suffix = /.*/) {
|
|
79
|
+
const entries = fs_1.default.readdirSync(dir, { withFileTypes: true, recursive: false });
|
|
80
|
+
for (const subEntries of entries) {
|
|
81
|
+
const res = path_1.default.resolve(dir, subEntries.name);
|
|
82
|
+
if (subEntries.isDirectory()) {
|
|
83
|
+
yield* getAllFilesSync(res, suffix);
|
|
84
|
+
}
|
|
85
|
+
else if (suffix.test(subEntries.name)) {
|
|
86
|
+
yield res;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
68
90
|
const rFileRegex = /\.[rR]$/;
|
|
69
91
|
/**
|
|
70
92
|
* Retrieves all R files in a given directory (asynchronously)
|
|
@@ -182,4 +204,47 @@ function getParentDirectory(directory) {
|
|
|
182
204
|
// apparently this is somehow the best way to do it in node, what
|
|
183
205
|
return directory.split(path_1.default.sep).slice(0, -1).join(path_1.default.sep);
|
|
184
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Parses the given file in the 'Debian Control Format'.
|
|
209
|
+
* @param file - The file to parse
|
|
210
|
+
* @returns Map containing the keys and values of the provided file.
|
|
211
|
+
*/
|
|
212
|
+
function parseDCF(file) {
|
|
213
|
+
const result = new Map();
|
|
214
|
+
let currentKey = '';
|
|
215
|
+
let currentValue = '';
|
|
216
|
+
const indentRegex = new RegExp(/^\s/);
|
|
217
|
+
const firstColonRegex = new RegExp(/:(.*)/s);
|
|
218
|
+
const fileContent = file.content().split(/\r?\n/);
|
|
219
|
+
for (const line of fileContent) {
|
|
220
|
+
if (indentRegex.test(line)) {
|
|
221
|
+
currentValue += '\n' + line.trim();
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
if (currentKey) {
|
|
225
|
+
const values = currentValue ? cleanValues(currentValue) : [];
|
|
226
|
+
result.set(currentKey, values);
|
|
227
|
+
}
|
|
228
|
+
const [key, rest] = line.split(firstColonRegex).map(s => s.trim());
|
|
229
|
+
currentKey = key.trim();
|
|
230
|
+
currentValue = rest.trim();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (currentKey) {
|
|
234
|
+
const values = currentValue ? cleanValues(currentValue) : [];
|
|
235
|
+
result.set(currentKey, values);
|
|
236
|
+
}
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
const cleanSplitRegex = /[\n,]+/;
|
|
240
|
+
const cleanQuotesRegex = /'/g;
|
|
241
|
+
function cleanValues(values) {
|
|
242
|
+
return values
|
|
243
|
+
.split(cleanSplitRegex)
|
|
244
|
+
.map(s => s.trim().replace(cleanQuotesRegex, ''))
|
|
245
|
+
.filter(s => s.length > 0);
|
|
246
|
+
}
|
|
247
|
+
function isFilePath(p) {
|
|
248
|
+
return fs_1.default.existsSync(p) && fs_1.default.statSync(p).isFile();
|
|
249
|
+
}
|
|
185
250
|
//# sourceMappingURL=files.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { RParseRequest } from '../../r-bridge/retriever';
|
|
1
|
+
import type { RParseRequest, RParseRequestFromText } from '../../r-bridge/retriever';
|
|
2
|
+
import type { SupportedFormats } from './adapter-format';
|
|
2
3
|
export declare const FileAdapters: {
|
|
3
4
|
readonly R: {
|
|
4
5
|
convertRequest: (request: RParseRequest) => RParseRequest;
|
|
5
6
|
};
|
|
6
7
|
readonly Rmd: {
|
|
7
|
-
convertRequest: (request: RParseRequest) =>
|
|
8
|
+
convertRequest: (request: RParseRequest) => RParseRequestFromText<import("./adapters/rmd-adapter").RmdInfo>;
|
|
8
9
|
};
|
|
9
10
|
};
|
|
10
11
|
export declare const DocumentTypeToFormat: {
|
|
@@ -13,4 +14,5 @@ export declare const DocumentTypeToFormat: {
|
|
|
13
14
|
};
|
|
14
15
|
export type AdapterReturnTypes = ReturnType<typeof FileAdapters[keyof typeof FileAdapters]['convertRequest']>;
|
|
15
16
|
export declare function requestFromFile(path: string): AdapterReturnTypes;
|
|
17
|
+
export declare function requestFromText(text: string, typeHint?: SupportedFormats): AdapterReturnTypes;
|
|
16
18
|
export declare function inferFileType(request: RParseRequest): keyof typeof FileAdapters;
|
package/util/formats/adapter.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DocumentTypeToFormat = exports.FileAdapters = void 0;
|
|
7
7
|
exports.requestFromFile = requestFromFile;
|
|
8
|
+
exports.requestFromText = requestFromText;
|
|
8
9
|
exports.inferFileType = inferFileType;
|
|
9
10
|
const r_adapter_1 = require("./adapters/r-adapter");
|
|
10
11
|
const path_1 = __importDefault(require("path"));
|
|
@@ -25,12 +26,18 @@ function requestFromFile(path) {
|
|
|
25
26
|
const type = inferFileType(baseRequest);
|
|
26
27
|
return exports.FileAdapters[type].convertRequest(baseRequest);
|
|
27
28
|
}
|
|
29
|
+
function requestFromText(text, typeHint) {
|
|
30
|
+
const baseRequest = {
|
|
31
|
+
request: 'text',
|
|
32
|
+
content: text,
|
|
33
|
+
info: typeHint ? { type: typeHint } : undefined
|
|
34
|
+
};
|
|
35
|
+
const type = inferFileType(baseRequest);
|
|
36
|
+
return exports.FileAdapters[type].convertRequest(baseRequest);
|
|
37
|
+
}
|
|
28
38
|
function inferFileType(request) {
|
|
29
39
|
if (request.request === 'text') {
|
|
30
|
-
|
|
31
|
-
// and have to assume it is normal R Code
|
|
32
|
-
// In the future we could add a heuristic to guess the type
|
|
33
|
-
return 'R';
|
|
40
|
+
return request.info ? request.info.type : 'R';
|
|
34
41
|
}
|
|
35
42
|
const type = path_1.default.extname(request.content).toLowerCase();
|
|
36
43
|
// Fallback to default if unknown
|
package/util/r-value.d.ts
CHANGED
|
@@ -20,4 +20,4 @@ export declare function unliftRValue(value: ValueString): RStringValue | undefin
|
|
|
20
20
|
export declare function unliftRValue(value: ValueNumber | ValueInterval): RNumberValue | undefined;
|
|
21
21
|
export declare function unliftRValue(value: ValueLogical): RLogicalValue | undefined;
|
|
22
22
|
export declare function unliftRValue(value: ValueVector): (RStringValue | RNumberValue | RLogicalValue)[] | undefined;
|
|
23
|
-
export declare function unliftRValue(value: Value): RStringValue | RNumberValue | boolean | (RStringValue | RNumberValue | RLogicalValue)[] | undefined;
|
|
23
|
+
export declare function unliftRValue(value: Value): RStringValue | RNumberValue | 'fn-def' | boolean | ('fn-def' | RStringValue | RNumberValue | RLogicalValue)[] | undefined;
|
package/util/r-value.js
CHANGED
package/util/version.d.ts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
import { SemVer } from 'semver';
|
|
2
|
+
import type { KnownParser } from '../r-bridge/parser';
|
|
3
|
+
import type { ReplOutput } from '../cli/repl/commands/repl-main';
|
|
4
|
+
import type { FlowrAnalysisProvider } from '../project/flowr-analyzer';
|
|
2
5
|
export declare function flowrVersion(): SemVer;
|
|
6
|
+
type Version = `${number}.${number}.${number}`;
|
|
7
|
+
/**
|
|
8
|
+
* Describes the version of flowR and the used R interpreter.
|
|
9
|
+
*/
|
|
10
|
+
export interface VersionInformation {
|
|
11
|
+
/** The version of flowR */
|
|
12
|
+
flowr: Version;
|
|
13
|
+
/** The version of R identified by the underlying {@link RShell} */
|
|
14
|
+
r: Version | 'unknown' | 'none';
|
|
15
|
+
engine: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function retrieveVersionInformation(input: KnownParser | FlowrAnalysisProvider): Promise<VersionInformation>;
|
|
18
|
+
export declare function printVersionInformation(output: ReplOutput, input: KnownParser | FlowrAnalysisProvider): Promise<void>;
|
|
19
|
+
export {};
|
package/util/version.js
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.flowrVersion = flowrVersion;
|
|
4
|
+
exports.retrieveVersionInformation = retrieveVersionInformation;
|
|
5
|
+
exports.printVersionInformation = printVersionInformation;
|
|
4
6
|
const semver_1 = require("semver");
|
|
7
|
+
const assert_1 = require("./assert");
|
|
5
8
|
// this is automatically replaced with the current version by release-it
|
|
6
|
-
const version = '2.
|
|
9
|
+
const version = '2.6.1';
|
|
7
10
|
function flowrVersion() {
|
|
8
11
|
return new semver_1.SemVer(version);
|
|
9
12
|
}
|
|
13
|
+
const versionRegex = /^\d+\.\d+\.\d+/m;
|
|
14
|
+
async function retrieveVersionInformation(input) {
|
|
15
|
+
const flowr = flowrVersion().toString();
|
|
16
|
+
let r;
|
|
17
|
+
let name;
|
|
18
|
+
if ('name' in input) {
|
|
19
|
+
r = await input.rVersion();
|
|
20
|
+
name = input.name;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const parserInformation = await input.parserInformation();
|
|
24
|
+
r = parserInformation.name === 'r-shell' ? parserInformation.rVersion : 'unknown';
|
|
25
|
+
name = parserInformation.name;
|
|
26
|
+
}
|
|
27
|
+
(0, assert_1.guard)(versionRegex.test(flowr), `flowR version ${flowr} does not match the expected format!`);
|
|
28
|
+
(0, assert_1.guard)(r === 'unknown' || r === 'none' || versionRegex.test(r), `R version ${r} does not match the expected format!`);
|
|
29
|
+
return { flowr: flowr, r: r, engine: name };
|
|
30
|
+
}
|
|
31
|
+
async function printVersionInformation(output, input) {
|
|
32
|
+
const { flowr, r, engine } = await retrieveVersionInformation(input);
|
|
33
|
+
output.stdout(`Engine: ${engine}`);
|
|
34
|
+
output.stdout(` flowR: ${flowr}`);
|
|
35
|
+
output.stdout(` R: ${r}`);
|
|
36
|
+
}
|
|
10
37
|
//# sourceMappingURL=version.js.map
|