@eagleoutice/flowr 2.2.2 → 2.2.4
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 +412 -39
- package/benchmark/slicer.js +0 -1
- package/benchmark/summarizer/first-phase/process.js +18 -8
- package/benchmark/summarizer/summarizer.d.ts +1 -1
- package/benchmark/summarizer/summarizer.js +1 -1
- package/cli/benchmark-app.js +1 -1
- package/cli/common/script.js +0 -1
- package/cli/repl/commands/repl-cfg.js +38 -8
- package/cli/repl/commands/repl-commands.js +1 -1
- package/cli/repl/commands/repl-dataflow.js +45 -12
- package/cli/repl/commands/repl-normalize.js +38 -8
- package/cli/repl/commands/repl-parse.js +43 -2
- package/cli/repl/commands/repl-query.js +2 -2
- package/cli/repl/core.js +17 -8
- package/cli/repl/print-version.d.ts +1 -0
- package/cli/repl/print-version.js +8 -2
- package/cli/repl/server/connection.js +27 -15
- package/cli/repl/server/messages/all-messages.js +17 -7
- package/cli/repl/server/messages/message-repl.js +17 -7
- package/cli/repl/server/messages/message-slice.js +17 -7
- package/cli/script-core/statistics-helper-core.js +0 -1
- package/core/pipeline-executor.d.ts +6 -0
- package/core/pipeline-executor.js +8 -0
- package/core/print/dataflow-printer.js +3 -0
- package/core/print/normalize-printer.js +0 -1
- package/core/steps/all/core/01-parse-tree-sitter.d.ts +7 -0
- package/core/steps/pipeline/default-pipelines.d.ts +57 -47
- package/core/steps/pipeline/default-pipelines.js +23 -2
- package/core/steps/pipeline/pipeline.d.ts +1 -1
- package/core/steps/pipeline/pipeline.js +1 -1
- package/core/steps/pipeline-step.d.ts +1 -3
- package/dataflow/environments/resolve-by-name.d.ts +5 -2
- package/dataflow/environments/resolve-by-name.js +6 -4
- package/dataflow/extractor.d.ts +10 -0
- package/dataflow/extractor.js +10 -0
- package/dataflow/graph/resolve-graph.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +20 -4
- package/documentation/data/server/doc-data-server-messages.js +1 -2
- package/documentation/doc-util/doc-auto-gen.d.ts +1 -0
- package/documentation/doc-util/doc-auto-gen.js +5 -1
- package/documentation/doc-util/doc-benchmarks.d.ts +23 -0
- package/documentation/doc-util/doc-benchmarks.js +76 -0
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +4 -0
- package/documentation/doc-util/doc-dfg.d.ts +5 -3
- package/documentation/doc-util/doc-dfg.js +10 -8
- package/documentation/doc-util/doc-files.d.ts +2 -1
- package/documentation/doc-util/doc-files.js +3 -2
- package/documentation/doc-util/doc-normalized-ast.d.ts +2 -1
- package/documentation/doc-util/doc-normalized-ast.js +4 -5
- package/documentation/doc-util/doc-repl.d.ts +6 -2
- package/documentation/doc-util/doc-repl.js +10 -6
- package/documentation/doc-util/doc-server-message.js +1 -1
- package/documentation/doc-util/doc-structure.d.ts +1 -1
- package/documentation/doc-util/doc-structure.js +2 -2
- package/documentation/doc-util/doc-types.d.ts +8 -5
- package/documentation/doc-util/doc-types.js +31 -18
- package/documentation/index.d.ts +9 -0
- package/documentation/index.js +26 -0
- package/documentation/print-capabilities-markdown.js +105 -19
- package/documentation/print-core-wiki.d.ts +1 -0
- package/documentation/print-core-wiki.js +413 -0
- package/documentation/print-dataflow-graph-wiki.js +27 -27
- package/documentation/print-interface-wiki.js +22 -16
- package/documentation/print-linting-and-testing-wiki.js +29 -9
- package/documentation/print-normalized-ast-wiki.js +22 -17
- package/documentation/print-query-wiki.js +7 -7
- package/documentation/print-readme.d.ts +1 -0
- package/documentation/print-readme.js +160 -0
- package/documentation/print-search-wiki.js +2 -1
- package/package.json +30 -41
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +77 -45
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -0
- package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/r-bridge/data/data.d.ts +48 -7
- package/r-bridge/data/data.js +62 -8
- package/r-bridge/data/types.d.ts +7 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +2 -3
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +2 -5
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +6 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +13 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +19 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +1 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +3 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -1
- package/r-bridge/parser.d.ts +10 -0
- package/r-bridge/parser.js +26 -2
- package/r-bridge/shell.js +18 -8
- package/search/flowr-search-builder.d.ts +1 -2
- package/search/flowr-search-builder.js +1 -3
- package/statistics/features/supported/comments/comments.js +17 -7
- package/statistics/features/supported/used-functions/post-process.js +0 -1
- package/statistics/features/supported/used-packages/used-packages.js +17 -7
- package/statistics/features/supported/values/values.js +17 -7
- package/statistics/summarizer/summarizer.js +1 -2
- package/util/files.js +17 -7
- package/util/json.js +0 -2
- package/util/mermaid/dfg.d.ts +3 -0
- package/util/mermaid/dfg.js +24 -8
- package/util/numbers.d.ts +1 -0
- package/util/numbers.js +5 -0
- package/util/parallel.js +17 -7
- package/util/quads.js +3 -3
- package/util/strings.d.ts +9 -0
- package/util/strings.js +14 -0
- package/util/version.js +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contains the default pipeline for working with
|
|
2
|
+
* Contains the default pipeline for working with flowR
|
|
3
3
|
*/
|
|
4
4
|
import type { PipelineInput } from './pipeline';
|
|
5
5
|
import type { KnownParser, Parser } from '../../../r-bridge/parser';
|
|
6
6
|
import { PipelineExecutor } from '../../pipeline-executor';
|
|
7
|
+
import type { RShell } from '../../../r-bridge/shell';
|
|
8
|
+
import type { TreeSitterExecutor } from '../../../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor';
|
|
7
9
|
export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
|
|
8
10
|
readonly name: "parse";
|
|
9
11
|
readonly humanReadableName: "parse with R shell";
|
|
@@ -256,21 +258,6 @@ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline
|
|
|
256
258
|
readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
|
|
257
259
|
};
|
|
258
260
|
readonly dependencies: readonly ["normalize"];
|
|
259
|
-
} | {
|
|
260
|
-
readonly name: "parse";
|
|
261
|
-
readonly humanReadableName: "parse with tree-sitter";
|
|
262
|
-
readonly description: "Parse the given R code into an AST using tree-sitter";
|
|
263
|
-
readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<import("web-tree-sitter").Tree>>;
|
|
264
|
-
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
|
|
265
|
-
readonly printer: {
|
|
266
|
-
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
267
|
-
readonly 2: {
|
|
268
|
-
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
269
|
-
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
270
|
-
};
|
|
271
|
-
};
|
|
272
|
-
readonly dependencies: readonly [];
|
|
273
|
-
readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
|
|
274
261
|
} | {
|
|
275
262
|
readonly name: "slice";
|
|
276
263
|
readonly humanReadableName: "static slice";
|
|
@@ -299,6 +286,21 @@ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline
|
|
|
299
286
|
};
|
|
300
287
|
readonly dependencies: readonly ["slice"];
|
|
301
288
|
readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
|
|
289
|
+
} | {
|
|
290
|
+
readonly name: "parse";
|
|
291
|
+
readonly humanReadableName: "parse with tree-sitter";
|
|
292
|
+
readonly description: "Parse the given R code into an AST using tree-sitter";
|
|
293
|
+
readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<import("web-tree-sitter").Tree>>;
|
|
294
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
|
|
295
|
+
readonly printer: {
|
|
296
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
297
|
+
readonly 2: {
|
|
298
|
+
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
299
|
+
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
readonly dependencies: readonly [];
|
|
303
|
+
readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
|
|
302
304
|
} | {
|
|
303
305
|
readonly name: "normalize";
|
|
304
306
|
readonly humanReadableName: "normalize tree-sitter tree";
|
|
@@ -337,21 +339,6 @@ export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipel
|
|
|
337
339
|
readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
|
|
338
340
|
};
|
|
339
341
|
readonly dependencies: readonly ["normalize"];
|
|
340
|
-
} | {
|
|
341
|
-
readonly name: "parse";
|
|
342
|
-
readonly humanReadableName: "parse with tree-sitter";
|
|
343
|
-
readonly description: "Parse the given R code into an AST using tree-sitter";
|
|
344
|
-
readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<import("web-tree-sitter").Tree>>;
|
|
345
|
-
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
|
|
346
|
-
readonly printer: {
|
|
347
|
-
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
348
|
-
readonly 2: {
|
|
349
|
-
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
350
|
-
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
351
|
-
};
|
|
352
|
-
};
|
|
353
|
-
readonly dependencies: readonly [];
|
|
354
|
-
readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
|
|
355
342
|
} | {
|
|
356
343
|
readonly name: "slice";
|
|
357
344
|
readonly humanReadableName: "static slice";
|
|
@@ -380,6 +367,21 @@ export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipel
|
|
|
380
367
|
};
|
|
381
368
|
readonly dependencies: readonly ["slice"];
|
|
382
369
|
readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
|
|
370
|
+
} | {
|
|
371
|
+
readonly name: "parse";
|
|
372
|
+
readonly humanReadableName: "parse with tree-sitter";
|
|
373
|
+
readonly description: "Parse the given R code into an AST using tree-sitter";
|
|
374
|
+
readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<import("web-tree-sitter").Tree>>;
|
|
375
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
|
|
376
|
+
readonly printer: {
|
|
377
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
378
|
+
readonly 2: {
|
|
379
|
+
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
380
|
+
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
readonly dependencies: readonly [];
|
|
384
|
+
readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
|
|
383
385
|
} | {
|
|
384
386
|
readonly name: "normalize";
|
|
385
387
|
readonly humanReadableName: "normalize tree-sitter tree";
|
|
@@ -418,6 +420,20 @@ export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./p
|
|
|
418
420
|
readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
|
|
419
421
|
};
|
|
420
422
|
readonly dependencies: readonly ["normalize"];
|
|
423
|
+
} | {
|
|
424
|
+
readonly name: "slice";
|
|
425
|
+
readonly humanReadableName: "static slice";
|
|
426
|
+
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
427
|
+
readonly processor: (results: {
|
|
428
|
+
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
429
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
430
|
+
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
431
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
432
|
+
readonly printer: {
|
|
433
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
434
|
+
};
|
|
435
|
+
readonly dependencies: readonly ["dataflow"];
|
|
436
|
+
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
421
437
|
} | {
|
|
422
438
|
readonly name: "parse";
|
|
423
439
|
readonly humanReadableName: "parse with tree-sitter";
|
|
@@ -433,20 +449,6 @@ export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./p
|
|
|
433
449
|
};
|
|
434
450
|
readonly dependencies: readonly [];
|
|
435
451
|
readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
|
|
436
|
-
} | {
|
|
437
|
-
readonly name: "slice";
|
|
438
|
-
readonly humanReadableName: "static slice";
|
|
439
|
-
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
440
|
-
readonly processor: (results: {
|
|
441
|
-
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
442
|
-
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
443
|
-
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
444
|
-
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
445
|
-
readonly printer: {
|
|
446
|
-
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
447
|
-
};
|
|
448
|
-
readonly dependencies: readonly ["dataflow"];
|
|
449
|
-
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
450
452
|
} | {
|
|
451
453
|
readonly name: "normalize";
|
|
452
454
|
readonly humanReadableName: "normalize tree-sitter tree";
|
|
@@ -466,8 +468,8 @@ export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./p
|
|
|
466
468
|
readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
|
|
467
469
|
}>;
|
|
468
470
|
/**
|
|
469
|
-
* The default pipeline for working with
|
|
470
|
-
*
|
|
471
|
+
* The default pipeline for working with flowR, including the dataflow step.
|
|
472
|
+
* See the {@link DEFAULT_NORMALIZE_PIPELINE} for the pipeline without the dataflow step
|
|
471
473
|
* and the {@link DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE} for the pipeline with slicing and reconstructing steps
|
|
472
474
|
*/
|
|
473
475
|
export declare const DEFAULT_DATAFLOW_PIPELINE: import("./pipeline").Pipeline<{
|
|
@@ -678,7 +680,15 @@ export declare const TREE_SITTER_PARSE_PIPELINE: import("./pipeline").Pipeline<{
|
|
|
678
680
|
readonly dependencies: readonly [];
|
|
679
681
|
readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
|
|
680
682
|
}>;
|
|
683
|
+
export declare function createParsePipeline(parser: TreeSitterExecutor, inputs: Omit<PipelineInput<typeof DEFAULT_PARSE_PIPELINE>, 'parser'>): PipelineExecutor<typeof TREE_SITTER_PARSE_PIPELINE>;
|
|
684
|
+
export declare function createParsePipeline(parser: RShell, inputs: Omit<PipelineInput<typeof DEFAULT_PARSE_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_PARSE_PIPELINE>;
|
|
681
685
|
export declare function createParsePipeline(parser: KnownParser, inputs: Omit<PipelineInput<typeof DEFAULT_PARSE_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_PARSE_PIPELINE> | PipelineExecutor<typeof TREE_SITTER_PARSE_PIPELINE>;
|
|
686
|
+
export declare function createSlicePipeline(parser: TreeSitterExecutor, inputs: Omit<PipelineInput<typeof DEFAULT_SLICING_PIPELINE>, 'parser'>): PipelineExecutor<typeof TREE_SITTER_SLICING_PIPELINE>;
|
|
687
|
+
export declare function createSlicePipeline(parser: RShell, inputs: Omit<PipelineInput<typeof DEFAULT_SLICING_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_SLICING_PIPELINE>;
|
|
682
688
|
export declare function createSlicePipeline(parser: KnownParser, inputs: Omit<PipelineInput<typeof DEFAULT_SLICING_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_SLICING_PIPELINE> | PipelineExecutor<typeof TREE_SITTER_SLICING_PIPELINE>;
|
|
689
|
+
export declare function createNormalizePipeline(parser: TreeSitterExecutor, inputs: Omit<PipelineInput<typeof DEFAULT_NORMALIZE_PIPELINE>, 'parser'>): PipelineExecutor<typeof TREE_SITTER_NORMALIZE_PIPELINE>;
|
|
690
|
+
export declare function createNormalizePipeline(parser: RShell, inputs: Omit<PipelineInput<typeof DEFAULT_NORMALIZE_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_NORMALIZE_PIPELINE>;
|
|
683
691
|
export declare function createNormalizePipeline(parser: KnownParser, inputs: Omit<PipelineInput<typeof DEFAULT_NORMALIZE_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_NORMALIZE_PIPELINE> | PipelineExecutor<typeof TREE_SITTER_NORMALIZE_PIPELINE>;
|
|
692
|
+
export declare function createDataflowPipeline(parser: TreeSitterExecutor, inputs: Omit<PipelineInput<typeof DEFAULT_DATAFLOW_PIPELINE>, 'parser'>): PipelineExecutor<typeof TREE_SITTER_DATAFLOW_PIPELINE>;
|
|
693
|
+
export declare function createDataflowPipeline(parser: RShell, inputs: Omit<PipelineInput<typeof DEFAULT_DATAFLOW_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_DATAFLOW_PIPELINE>;
|
|
684
694
|
export declare function createDataflowPipeline(parser: KnownParser, inputs: Omit<PipelineInput<typeof DEFAULT_DATAFLOW_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_DATAFLOW_PIPELINE> | PipelineExecutor<typeof TREE_SITTER_DATAFLOW_PIPELINE>;
|
|
@@ -21,8 +21,8 @@ exports.TREE_SITTER_SLICING_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_
|
|
|
21
21
|
exports.TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE = exports.TREE_SITTER_SLICING_PIPELINE;
|
|
22
22
|
exports.TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_tree_sitter_1.PARSE_WITH_TREE_SITTER_STEP, _11_normalize_tree_sitter_1.NORMALIZE_TREE_SITTER, _20_dataflow_1.STATIC_DATAFLOW, _00_slice_1.STATIC_SLICE);
|
|
23
23
|
/**
|
|
24
|
-
* The default pipeline for working with
|
|
25
|
-
*
|
|
24
|
+
* The default pipeline for working with flowR, including the dataflow step.
|
|
25
|
+
* See the {@link DEFAULT_NORMALIZE_PIPELINE} for the pipeline without the dataflow step
|
|
26
26
|
* and the {@link DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE} for the pipeline with slicing and reconstructing steps
|
|
27
27
|
*/
|
|
28
28
|
exports.DEFAULT_DATAFLOW_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, _10_normalize_1.NORMALIZE, _20_dataflow_1.STATIC_DATAFLOW);
|
|
@@ -32,6 +32,11 @@ exports.DEFAULT_NORMALIZE_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.
|
|
|
32
32
|
exports.TREE_SITTER_NORMALIZE_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_tree_sitter_1.PARSE_WITH_TREE_SITTER_STEP, _11_normalize_tree_sitter_1.NORMALIZE_TREE_SITTER);
|
|
33
33
|
exports.DEFAULT_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP);
|
|
34
34
|
exports.TREE_SITTER_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_tree_sitter_1.PARSE_WITH_TREE_SITTER_STEP);
|
|
35
|
+
/**
|
|
36
|
+
* Returns either a {@link DEFAULT_PARSE_PIPELINE} or a {@link TREE_SITTER_PARSE_PIPELINE} depending on the parser used.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link createNormalizePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
|
|
39
|
+
*/
|
|
35
40
|
function createParsePipeline(parser, inputs) {
|
|
36
41
|
const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_PARSE_PIPELINE : exports.DEFAULT_PARSE_PIPELINE;
|
|
37
42
|
return new pipeline_executor_1.PipelineExecutor(base, {
|
|
@@ -39,6 +44,11 @@ function createParsePipeline(parser, inputs) {
|
|
|
39
44
|
...inputs
|
|
40
45
|
});
|
|
41
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns either a {@link DEFAULT_SLICING_PIPELINE} or a {@link TREE_SITTER_SLICING_PIPELINE} depending on the parser used.
|
|
49
|
+
*
|
|
50
|
+
* @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createDataflowPipeline}
|
|
51
|
+
*/
|
|
42
52
|
function createSlicePipeline(parser, inputs) {
|
|
43
53
|
const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_SLICING_PIPELINE : exports.DEFAULT_SLICING_PIPELINE;
|
|
44
54
|
return new pipeline_executor_1.PipelineExecutor(base, {
|
|
@@ -46,6 +56,11 @@ function createSlicePipeline(parser, inputs) {
|
|
|
46
56
|
...inputs
|
|
47
57
|
});
|
|
48
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns either a {@link DEFAULT_NORMALIZE_PIPELINE} or a {@link TREE_SITTER_NORMALIZE_PIPELINE} depending on the parser used.
|
|
61
|
+
*
|
|
62
|
+
* @see {@link createParsePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
|
|
63
|
+
*/
|
|
49
64
|
function createNormalizePipeline(parser, inputs) {
|
|
50
65
|
const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_NORMALIZE_PIPELINE : exports.DEFAULT_NORMALIZE_PIPELINE;
|
|
51
66
|
return new pipeline_executor_1.PipelineExecutor(base, {
|
|
@@ -53,6 +68,12 @@ function createNormalizePipeline(parser, inputs) {
|
|
|
53
68
|
...inputs
|
|
54
69
|
});
|
|
55
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Returns either a {@link DEFAULT_DATAFLOW_PIPELINE} or a {@link TREE_SITTER_DATAFLOW_PIPELINE} depending on the parser used.
|
|
73
|
+
*
|
|
74
|
+
* @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createSlicePipeline}
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
56
77
|
function createDataflowPipeline(parser, inputs) {
|
|
57
78
|
const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_DATAFLOW_PIPELINE : exports.DEFAULT_DATAFLOW_PIPELINE;
|
|
58
79
|
return new pipeline_executor_1.PipelineExecutor(base, {
|
|
@@ -120,7 +120,7 @@ export type PipelineOutput<P extends Pipeline> = {
|
|
|
120
120
|
*
|
|
121
121
|
* 0) the collection of {@link IPipelineStep|steps} is not empty
|
|
122
122
|
* 1) all {@link IPipelineStepOrder#name|names} of {@link IPipelineStep|steps} are unique for the given pipeline
|
|
123
|
-
* 2) all {@link IPipelineStepOrder#dependencies|dependencies} of all {@link IPipelineStep|steps}
|
|
123
|
+
* 2) all {@link IPipelineStepOrder#dependencies|dependencies} of all {@link IPipelineStep|steps} exist
|
|
124
124
|
* 3) there are no cycles in the dependency graph
|
|
125
125
|
* 4) the target of a {@link IPipelineStepOrder#decorates|step's decoration} exists
|
|
126
126
|
* 5) if a {@link IPipelineStepOrder#decorates|decoration} applies, all of its {@link IPipelineStepOrder#dependencies|dependencies} are already in the pipeline
|
|
@@ -9,7 +9,7 @@ const create_pipeline_1 = require("./create-pipeline");
|
|
|
9
9
|
*
|
|
10
10
|
* 0) the collection of {@link IPipelineStep|steps} is not empty
|
|
11
11
|
* 1) all {@link IPipelineStepOrder#name|names} of {@link IPipelineStep|steps} are unique for the given pipeline
|
|
12
|
-
* 2) all {@link IPipelineStepOrder#dependencies|dependencies} of all {@link IPipelineStep|steps}
|
|
12
|
+
* 2) all {@link IPipelineStepOrder#dependencies|dependencies} of all {@link IPipelineStep|steps} exist
|
|
13
13
|
* 3) there are no cycles in the dependency graph
|
|
14
14
|
* 4) the target of a {@link IPipelineStepOrder#decorates|step's decoration} exists
|
|
15
15
|
* 5) if a {@link IPipelineStepOrder#decorates|decoration} applies, all of its {@link IPipelineStepOrder#dependencies|dependencies} are already in the pipeline
|
|
@@ -67,9 +67,7 @@ export interface IPipelineStep<Name extends PipelineStepName = PipelineStepName,
|
|
|
67
67
|
readonly description: string;
|
|
68
68
|
/** The main processor that essentially performs the logic of this step */
|
|
69
69
|
readonly processor: (...input: Parameters<Fn>) => ReturnType<Fn>;
|
|
70
|
-
/**
|
|
71
|
-
* How to visualize the results of the respective step to the user?
|
|
72
|
-
*/
|
|
70
|
+
/** How to visualize the results of the respective step to the user? */
|
|
73
71
|
readonly printer: {
|
|
74
72
|
[K in StepOutputFormat]?: IPipelineStepPrinter<Fn, K, never[]>;
|
|
75
73
|
} & {
|
|
@@ -4,6 +4,7 @@ import type { Identifier, IdentifierDefinition } from './identifier';
|
|
|
4
4
|
import { ReferenceType } from './identifier';
|
|
5
5
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
6
|
import type { DataflowGraph } from '../graph/graph';
|
|
7
|
+
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
8
|
/**
|
|
8
9
|
* Resolves a given identifier name to a list of its possible definition location using R scoping and resolving rules.
|
|
9
10
|
*
|
|
@@ -16,11 +17,13 @@ import type { DataflowGraph } from '../graph/graph';
|
|
|
16
17
|
*/
|
|
17
18
|
export declare function resolveByName(name: Identifier, environment: REnvironmentInformation, target?: ReferenceType): IdentifierDefinition[] | undefined;
|
|
18
19
|
export declare function resolvesToBuiltInConstant(name: Identifier | undefined, environment: REnvironmentInformation, wantedValue: unknown): Ternary;
|
|
20
|
+
/** Please use {@link resolveValueOfVariable} */
|
|
19
21
|
export declare function resolveToConstants(name: Identifier | undefined, environment: REnvironmentInformation): unknown[] | undefined;
|
|
20
22
|
export declare function getAliases(sourceIds: readonly NodeId[], dataflow: DataflowGraph, environment: REnvironmentInformation): NodeId[] | undefined;
|
|
21
|
-
|
|
23
|
+
/** Please use {@link resolveValueOfVariable} */
|
|
24
|
+
export declare function resolveToValues(identifier: Identifier | undefined, environment: REnvironmentInformation, idMap?: AstIdMap): unknown[] | undefined;
|
|
22
25
|
/**
|
|
23
26
|
* Convenience function using the variable resolver as specified within the configuration file
|
|
24
27
|
* In the future we may want to have this set once at the start of the analysis
|
|
25
28
|
*/
|
|
26
|
-
export declare function resolveValueOfVariable(identifier: Identifier | undefined, environment: REnvironmentInformation,
|
|
29
|
+
export declare function resolveValueOfVariable(identifier: Identifier | undefined, environment: REnvironmentInformation, idMap?: AstIdMap): unknown[] | undefined;
|
|
@@ -90,6 +90,7 @@ function resolvesToBuiltInConstant(name, environment, wantedValue) {
|
|
|
90
90
|
return some ? logic_1.Ternary.Maybe : logic_1.Ternary.Never;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
+
/** Please use {@link resolveValueOfVariable} */
|
|
93
94
|
function resolveToConstants(name, environment) {
|
|
94
95
|
if (name === undefined) {
|
|
95
96
|
return undefined;
|
|
@@ -147,7 +148,8 @@ function getAliases(sourceIds, dataflow, environment) {
|
|
|
147
148
|
}
|
|
148
149
|
return [...definitions];
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
+
/** Please use {@link resolveValueOfVariable} */
|
|
152
|
+
function resolveToValues(identifier, environment, idMap) {
|
|
151
153
|
if (identifier === undefined) {
|
|
152
154
|
return undefined;
|
|
153
155
|
}
|
|
@@ -169,7 +171,7 @@ function resolveToValues(identifier, environment, graph) {
|
|
|
169
171
|
return undefined;
|
|
170
172
|
}
|
|
171
173
|
for (const id of def.value) {
|
|
172
|
-
const value =
|
|
174
|
+
const value = idMap?.get(id)?.content;
|
|
173
175
|
if (value !== undefined) {
|
|
174
176
|
values.push(value);
|
|
175
177
|
}
|
|
@@ -185,10 +187,10 @@ function resolveToValues(identifier, environment, graph) {
|
|
|
185
187
|
* Convenience function using the variable resolver as specified within the configuration file
|
|
186
188
|
* In the future we may want to have this set once at the start of the analysis
|
|
187
189
|
*/
|
|
188
|
-
function resolveValueOfVariable(identifier, environment,
|
|
190
|
+
function resolveValueOfVariable(identifier, environment, idMap) {
|
|
189
191
|
const resolve = (0, config_1.getConfig)().solver.variables;
|
|
190
192
|
switch (resolve) {
|
|
191
|
-
case config_1.VariableResolve.Alias: return resolveToValues(identifier, environment,
|
|
193
|
+
case config_1.VariableResolve.Alias: return resolveToValues(identifier, environment, idMap);
|
|
192
194
|
case config_1.VariableResolve.Builtin: return resolveToConstants(identifier, environment);
|
|
193
195
|
case config_1.VariableResolve.Disabled: return [];
|
|
194
196
|
default: (0, assert_1.assertUnreachable)(resolve);
|
package/dataflow/extractor.d.ts
CHANGED
|
@@ -3,5 +3,15 @@ import type { DataflowProcessors } from './processor';
|
|
|
3
3
|
import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { RParseRequests } from '../r-bridge/retriever';
|
|
5
5
|
import type { KnownParserType, Parser } from '../r-bridge/parser';
|
|
6
|
+
/**
|
|
7
|
+
* The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
|
|
8
|
+
* Maps every {@link RType} in the normalized AST to a processor.
|
|
9
|
+
*/
|
|
6
10
|
export declare const processors: DataflowProcessors<ParentInformation>;
|
|
11
|
+
/**
|
|
12
|
+
* This is the main function to produce the dataflow graph from a given request and normalized AST.
|
|
13
|
+
* Note, that this requires knowledge of the active parser in case the dataflow analysis uncovers other files that have to be parsed and integrated into the analysis
|
|
14
|
+
* (e.g., in the event of a `source` call).
|
|
15
|
+
* For the actual, canonical fold entry point, see {@link processDataflowFor}.
|
|
16
|
+
*/
|
|
7
17
|
export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, request: RParseRequests, ast: NormalizedAst<OtherInfo & ParentInformation>): DataflowInformation;
|
package/dataflow/extractor.js
CHANGED
|
@@ -21,6 +21,10 @@ const cfg_1 = require("../util/cfg/cfg");
|
|
|
21
21
|
const edge_1 = require("./graph/edge");
|
|
22
22
|
const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
23
23
|
const built_in_function_definition_1 = require("./internal/process/functions/call/built-in/built-in-function-definition");
|
|
24
|
+
/**
|
|
25
|
+
* The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
|
|
26
|
+
* Maps every {@link RType} in the normalized AST to a processor.
|
|
27
|
+
*/
|
|
24
28
|
exports.processors = {
|
|
25
29
|
[type_1.RType.Number]: process_value_1.processValue,
|
|
26
30
|
[type_1.RType.String]: process_value_1.processValue,
|
|
@@ -68,6 +72,12 @@ function resolveLinkToSideEffects(ast, graph) {
|
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* This is the main function to produce the dataflow graph from a given request and normalized AST.
|
|
77
|
+
* Note, that this requires knowledge of the active parser in case the dataflow analysis uncovers other files that have to be parsed and integrated into the analysis
|
|
78
|
+
* (e.g., in the event of a `source` call).
|
|
79
|
+
* For the actual, canonical fold entry point, see {@link processDataflowFor}.
|
|
80
|
+
*/
|
|
71
81
|
function produceDataFlowGraph(parser, request, ast) {
|
|
72
82
|
const multifile = Array.isArray(request);
|
|
73
83
|
let firstRequest;
|
|
@@ -47,4 +47,4 @@ export interface AssignmentToSymbolParameters<OtherInfo> extends AssignmentConfi
|
|
|
47
47
|
export declare function markAsAssignment(information: {
|
|
48
48
|
environment: REnvironmentInformation;
|
|
49
49
|
graph: DataflowGraph;
|
|
50
|
-
}, nodeToDefine: InGraphIdentifierDefinition, sourceIds: readonly NodeId[], rootIdOfAssignment: NodeId, config?: AssignmentConfiguration
|
|
50
|
+
}, nodeToDefine: InGraphIdentifierDefinition, sourceIds: readonly NodeId[], rootIdOfAssignment: NodeId, config?: AssignmentConfiguration): void;
|
|
@@ -33,7 +33,7 @@ function processIfThenElse(name, args, rootId, data) {
|
|
|
33
33
|
let then;
|
|
34
34
|
let makeThenMaybe = false;
|
|
35
35
|
// we should defer this to the abstract interpretation
|
|
36
|
-
const values = (0, resolve_by_name_1.resolveValueOfVariable)(condArg?.lexeme, data.environment,
|
|
36
|
+
const values = (0, resolve_by_name_1.resolveValueOfVariable)(condArg?.lexeme, data.environment, data.completeAst.idMap);
|
|
37
37
|
const conditionIsAlwaysFalse = values?.every(d => d === false) ?? false;
|
|
38
38
|
const conditionIsAlwaysTrue = values?.every(d => d === true) ?? false;
|
|
39
39
|
if (!conditionIsAlwaysFalse) {
|
|
@@ -21,6 +21,8 @@ const log_1 = require("../../../../../../util/log");
|
|
|
21
21
|
const fs_1 = __importDefault(require("fs"));
|
|
22
22
|
const parser_1 = require("../../../../../../r-bridge/lang-4.x/ast/parser/json/parser");
|
|
23
23
|
const shell_executor_1 = require("../../../../../../r-bridge/shell-executor");
|
|
24
|
+
const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
|
|
25
|
+
const assert_1 = require("../../../../../../util/assert");
|
|
24
26
|
let sourceProvider = (0, retriever_1.requestProviderFromFile)();
|
|
25
27
|
function setSourceProvider(provider) {
|
|
26
28
|
sourceProvider = provider;
|
|
@@ -29,14 +31,28 @@ function processSourceCall(name, args, rootId, data, config) {
|
|
|
29
31
|
const information = config.includeFunctionCall ?
|
|
30
32
|
(0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data }).information
|
|
31
33
|
: (0, info_1.initializeCleanDataflowInformation)(rootId, data);
|
|
32
|
-
const
|
|
34
|
+
const sourceFileArgument = args[0];
|
|
33
35
|
if (!config.forceFollow && (0, config_1.getConfig)().ignoreSourceCalls) {
|
|
34
|
-
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Skipping source call ${JSON.stringify(
|
|
36
|
+
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Skipping source call ${JSON.stringify(sourceFileArgument)} (disabled in config file)`);
|
|
35
37
|
information.graph.markIdForUnknownSideEffects(rootId);
|
|
36
38
|
return information;
|
|
37
39
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
let sourceFile;
|
|
41
|
+
if (sourceFileArgument !== r_function_call_1.EmptyArgument && sourceFileArgument?.value?.type === type_1.RType.String) {
|
|
42
|
+
sourceFile = [(0, retriever_1.removeRQuotes)(sourceFileArgument.lexeme)];
|
|
43
|
+
}
|
|
44
|
+
else if (sourceFileArgument !== r_function_call_1.EmptyArgument) {
|
|
45
|
+
sourceFile = (0, resolve_by_name_1.resolveValueOfVariable)(sourceFileArgument.value?.lexeme, data.environment, data.completeAst.idMap)?.map(x => {
|
|
46
|
+
if (typeof x === 'object' && x && 'str' in x) {
|
|
47
|
+
return x.str;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
}).filter(assert_1.isNotUndefined);
|
|
53
|
+
}
|
|
54
|
+
if (sourceFile && sourceFile.length === 1) {
|
|
55
|
+
const path = (0, retriever_1.removeRQuotes)(sourceFile[0]);
|
|
40
56
|
const request = sourceProvider.createRequest(path);
|
|
41
57
|
// check if the sourced file has already been dataflow analyzed, and if so, skip it
|
|
42
58
|
if (data.referenceChain.includes((0, retriever_1.requestFingerprint)(request))) {
|
|
@@ -69,7 +69,7 @@ Requests for the [REPL](#message-request-repl) are independent of that.
|
|
|
69
69
|
The request allows the server to analyze a file and prepare it for slicing.
|
|
70
70
|
The message can contain a \`filetoken\`, which is used to identify the file in later slice or lineage requests (if you do not add one, the request will not be stored and therefore, it is not available for subsequent requests).
|
|
71
71
|
|
|
72
|
-
>
|
|
72
|
+
> **Please note!**\\
|
|
73
73
|
> If you want to send and process a lot of analysis requests, but do not want to slice them, please do not pass the \`filetoken\` field. This will save the server a lot of memory allocation.
|
|
74
74
|
|
|
75
75
|
Furthermore, the request must contain either a \`content\` field to directly pass the file's content or a \`filepath\` field which contains the path to the file (this path must be accessible for the server to be useful).
|
|
@@ -420,7 +420,6 @@ See [above](#message-request-file-analysis) for the general structure of the res
|
|
|
420
420
|
{
|
|
421
421
|
type: 'compound',
|
|
422
422
|
query: 'call-context',
|
|
423
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- otherwise we would have to carry generic typing information through the test infrastrcuture
|
|
424
423
|
commonArguments: {
|
|
425
424
|
kind: 'visualize',
|
|
426
425
|
subkind: 'text',
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.autoGenHeader = autoGenHeader;
|
|
4
|
+
exports.fileNameForGenHeader = fileNameForGenHeader;
|
|
4
5
|
const version_1 = require("../../util/version");
|
|
5
6
|
const doc_files_1 = require("./doc-files");
|
|
6
7
|
function autoGenHeader({ rVersion, filename, purpose, currentDateAndTime = new Date().toISOString().replace('T', ', ').replace(/\.\d+Z$/, ' UTC') }) {
|
|
8
|
+
return `_This document was generated from '${fileNameForGenHeader(filename)}' on ${currentDateAndTime} presenting an overview of flowR's ${purpose} (v${(0, version_1.flowrVersion)().format()}${rVersion ? ', using R v' + rVersion : ''}). Please do not edit this file/wiki page directly._`;
|
|
9
|
+
}
|
|
10
|
+
function fileNameForGenHeader(filename) {
|
|
7
11
|
const shortenFilename = filename.replace(/^.*src\//, 'src/');
|
|
8
|
-
return
|
|
12
|
+
return (0, doc_files_1.linkFlowRSourceFile)(shortenFilename);
|
|
9
13
|
}
|
|
10
14
|
//# sourceMappingURL=doc-auto-gen.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface BenchmarkData {
|
|
2
|
+
readonly lastUpdate: number;
|
|
3
|
+
readonly repoUrl: string;
|
|
4
|
+
readonly entries: Record<string, [BenchmarkElement]>;
|
|
5
|
+
}
|
|
6
|
+
interface BenchmarkElement {
|
|
7
|
+
readonly commit: Record<string, unknown>;
|
|
8
|
+
readonly date: number;
|
|
9
|
+
readonly tool: string;
|
|
10
|
+
readonly benches: BenchmarkElementBench[];
|
|
11
|
+
}
|
|
12
|
+
interface BenchmarkElementBench {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly value: number;
|
|
15
|
+
readonly unit: string;
|
|
16
|
+
readonly range: number;
|
|
17
|
+
readonly extra: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function loadBenchmarkData(): Promise<BenchmarkData>;
|
|
20
|
+
export declare function getLatestBenchmark(suite: string): Promise<BenchmarkElement>;
|
|
21
|
+
export declare function getLastBenchmarkUpdate(): Promise<number>;
|
|
22
|
+
export declare function getLatestDfAnalysisTime(suite: string): Promise<number>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.loadBenchmarkData = loadBenchmarkData;
|
|
40
|
+
exports.getLatestBenchmark = getLatestBenchmark;
|
|
41
|
+
exports.getLastBenchmarkUpdate = getLastBenchmarkUpdate;
|
|
42
|
+
exports.getLatestDfAnalysisTime = getLatestDfAnalysisTime;
|
|
43
|
+
const path_1 = __importDefault(require("path"));
|
|
44
|
+
const assert_1 = require("../../util/assert");
|
|
45
|
+
const BenchmarkDataPath = path_1.default.resolve(__dirname, '..', '..', '..', 'wiki', 'stats', 'benchmark', 'data.js');
|
|
46
|
+
let benchmarkData = null;
|
|
47
|
+
async function loadBenchmarkData() {
|
|
48
|
+
if (benchmarkData === null) {
|
|
49
|
+
// provide a window object to attach to in the import
|
|
50
|
+
globalThis['window'] = {};
|
|
51
|
+
await Promise.resolve(`${BenchmarkDataPath}`).then(s => __importStar(require(s)));
|
|
52
|
+
// @ts-expect-error -- we know that the data is there
|
|
53
|
+
benchmarkData = window['BENCHMARK_DATA'];
|
|
54
|
+
}
|
|
55
|
+
return benchmarkData;
|
|
56
|
+
}
|
|
57
|
+
async function getLatestBenchmark(suite) {
|
|
58
|
+
// provide a window object to attach to in the import
|
|
59
|
+
const suiteData = (await loadBenchmarkData()).entries[suite];
|
|
60
|
+
(0, assert_1.guard)(suiteData, `No benchmark data for suite '${suite}' found!`);
|
|
61
|
+
return suiteData.sort((a, b) => b.date - a.date)[0];
|
|
62
|
+
}
|
|
63
|
+
async function getLastBenchmarkUpdate() {
|
|
64
|
+
return (await loadBenchmarkData()).lastUpdate;
|
|
65
|
+
}
|
|
66
|
+
function getBenchmarkElement(bench, name) {
|
|
67
|
+
const element = bench.benches.find(b => b.name === name);
|
|
68
|
+
(0, assert_1.guard)(element, `No benchmark data for '${name}' found!`);
|
|
69
|
+
return element;
|
|
70
|
+
}
|
|
71
|
+
async function getLatestDfAnalysisTime(suite) {
|
|
72
|
+
const elem = await getLatestBenchmark(suite);
|
|
73
|
+
const [parse, normalize, analyze] = ['Retrieve AST from R code', 'Normalize R AST', 'Produce dataflow information'].map(name => getBenchmarkElement(elem, name));
|
|
74
|
+
return parse.value + normalize.value + analyze.value;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=doc-benchmarks.js.map
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.codeBlock = codeBlock;
|
|
4
|
+
exports.codeInline = codeInline;
|
|
4
5
|
exports.jsonWithLimit = jsonWithLimit;
|
|
5
6
|
const json_1 = require("../../util/json");
|
|
6
7
|
function codeBlock(language, code) {
|
|
7
8
|
return `\n\`\`\`${language}\n${code?.trim() ?? ''}\n\`\`\`\n`;
|
|
8
9
|
}
|
|
10
|
+
function codeInline(code) {
|
|
11
|
+
return `<code>${code}</code>`;
|
|
12
|
+
}
|
|
9
13
|
function jsonWithLimit(object, maxLength = 5_000, tooLongText = '_As the code is pretty long, we inhibit pretty printing and syntax highlighting (JSON):_') {
|
|
10
14
|
const prettyPrinted = JSON.stringify(object, json_1.jsonReplacer, 2);
|
|
11
15
|
return `
|
|
@@ -3,19 +3,21 @@ import type { RShell } from '../../r-bridge/shell';
|
|
|
3
3
|
import type { MermaidMarkdownMark } from '../../util/mermaid/dfg';
|
|
4
4
|
import { DEFAULT_DATAFLOW_PIPELINE } from '../../core/steps/pipeline/default-pipelines';
|
|
5
5
|
import type { PipelineOutput } from '../../core/steps/pipeline/pipeline';
|
|
6
|
-
|
|
6
|
+
import type { KnownParser } from '../../r-bridge/parser';
|
|
7
|
+
export declare function printDfGraph(graph: DataflowGraph, mark?: ReadonlySet<MermaidMarkdownMark>, simplified?: boolean): string;
|
|
7
8
|
export interface PrintDataflowGraphOptions {
|
|
8
9
|
readonly mark?: ReadonlySet<MermaidMarkdownMark>;
|
|
9
10
|
readonly showCode?: boolean;
|
|
10
11
|
readonly codeOpen?: boolean;
|
|
11
12
|
readonly exposeResult?: boolean;
|
|
12
13
|
readonly switchCodeAndGraph?: boolean;
|
|
14
|
+
readonly simplified?: boolean;
|
|
13
15
|
}
|
|
14
16
|
export declare function formatSideEffect(ef: UnknownSidEffect): string;
|
|
15
|
-
export declare function printDfGraphForCode(
|
|
17
|
+
export declare function printDfGraphForCode(parser: KnownParser, code: string, options: PrintDataflowGraphOptions & {
|
|
16
18
|
exposeResult: true;
|
|
17
19
|
}): Promise<[string, PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>]>;
|
|
18
|
-
export declare function printDfGraphForCode(
|
|
20
|
+
export declare function printDfGraphForCode(parser: KnownParser, code: string, options?: PrintDataflowGraphOptions & {
|
|
19
21
|
exposeResult?: false | undefined;
|
|
20
22
|
}): Promise<string>;
|
|
21
23
|
/** returns resolved expected df graph */
|