@eagleoutice/flowr 2.0.25 → 2.1.0
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/benchmark/slicer.js +2 -1
- package/benchmark/stats/print.js +3 -4
- package/benchmark/stats/size-of.js +9 -7
- package/benchmark/summarizer/first-phase/input.d.ts +0 -1
- package/benchmark/summarizer/first-phase/input.js +2 -3
- package/benchmark/summarizer/first-phase/process.js +7 -7
- package/benchmark/summarizer/second-phase/graph.js +1 -2
- package/benchmark/summarizer/second-phase/process.d.ts +0 -1
- package/benchmark/summarizer/second-phase/process.js +4 -5
- package/benchmark/summarizer/summarizer.js +7 -1
- package/cli/benchmark-app.js +6 -1
- package/cli/common/features.js +2 -3
- package/cli/common/script.js +2 -3
- package/cli/common/scripts-info.d.ts +69 -1
- package/cli/common/scripts-info.js +6 -6
- package/cli/flowr-main-options.d.ts +4 -0
- package/cli/flowr-main-options.js +88 -0
- package/cli/flowr.d.ts +3 -3
- package/cli/flowr.js +22 -31
- package/cli/repl/commands/{cfg.d.ts → repl-cfg.d.ts} +1 -1
- package/cli/repl/commands/{cfg.js → repl-cfg.js} +3 -3
- package/cli/repl/commands/{commands.d.ts → repl-commands.d.ts} +3 -1
- package/cli/repl/commands/{commands.js → repl-commands.js} +56 -35
- package/cli/repl/commands/{dataflow.d.ts → repl-dataflow.d.ts} +1 -1
- package/cli/repl/commands/{dataflow.js → repl-dataflow.js} +2 -2
- package/cli/repl/commands/{execute.d.ts → repl-execute.d.ts} +1 -1
- package/cli/repl/commands/{execute.js → repl-execute.js} +3 -3
- package/cli/repl/commands/repl-lineage.d.ts +15 -0
- package/cli/repl/commands/{lineage.js → repl-lineage.js} +14 -12
- package/cli/repl/commands/{main.js → repl-main.js} +1 -1
- package/cli/repl/commands/{normalize.d.ts → repl-normalize.d.ts} +1 -1
- package/cli/repl/commands/{normalize.js → repl-normalize.js} +3 -3
- package/cli/repl/commands/{parse.d.ts → repl-parse.d.ts} +1 -1
- package/cli/repl/commands/{parse.js → repl-parse.js} +3 -2
- package/cli/repl/commands/repl-query.d.ts +8 -0
- package/cli/repl/commands/repl-query.js +155 -0
- package/cli/repl/commands/repl-quit.d.ts +2 -0
- package/cli/repl/commands/{quit.js → repl-quit.js} +1 -1
- package/cli/repl/commands/{version.d.ts → repl-version.d.ts} +1 -1
- package/cli/repl/commands/{version.js → repl-version.js} +4 -4
- package/cli/repl/core.d.ts +1 -2
- package/cli/repl/core.js +13 -13
- package/cli/repl/execute.d.ts +1 -2
- package/cli/repl/execute.js +2 -3
- package/cli/repl/print-version.js +3 -4
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +45 -12
- package/cli/repl/server/messages/{messages.d.ts → all-messages.d.ts} +8 -7
- package/cli/repl/server/messages/{messages.js → all-messages.js} +1 -1
- package/cli/repl/server/messages/{analysis.d.ts → message-analysis.d.ts} +2 -1
- package/cli/repl/server/messages/message-analysis.js +39 -0
- package/cli/repl/server/messages/{error.d.ts → message-error.d.ts} +1 -1
- package/cli/repl/server/messages/{error.js → message-error.js} +1 -1
- package/cli/repl/server/messages/{hello.d.ts → message-hello.d.ts} +4 -3
- package/cli/repl/server/messages/message-hello.js +20 -0
- package/cli/repl/server/messages/{lineage.d.ts → message-lineage.d.ts} +2 -1
- package/cli/repl/server/messages/message-lineage.js +25 -0
- package/cli/repl/server/messages/message-query.d.ts +16 -0
- package/cli/repl/server/messages/message-query.js +26 -0
- package/cli/repl/server/messages/{repl.d.ts → message-repl.d.ts} +3 -1
- package/cli/repl/server/messages/message-repl.js +53 -0
- package/cli/repl/server/messages/{slice.d.ts → message-slice.d.ts} +2 -1
- package/cli/repl/server/messages/{slice.js → message-slice.js} +14 -6
- package/cli/repl/server/net.d.ts +0 -1
- package/cli/repl/server/send.d.ts +1 -1
- package/cli/repl/server/send.js +2 -3
- package/cli/repl/server/server.js +2 -2
- package/cli/repl/server/validate.d.ts +1 -1
- package/cli/repl/server/validate.js +5 -6
- package/cli/run-script.d.ts +8 -0
- package/cli/run-script.js +18 -0
- package/cli/script-core/statistics-core.d.ts +2 -0
- package/cli/script-core/statistics-core.js +100 -0
- package/cli/script-core/statistics-helper-core.d.ts +2 -0
- package/cli/script-core/statistics-helper-core.js +81 -0
- package/cli/script-core/summarizer-core.d.ts +2 -0
- package/cli/script-core/summarizer-core.js +51 -0
- package/cli/statistics-app.js +3 -87
- package/cli/statistics-helper-app.js +3 -77
- package/cli/summarizer-app.js +2 -48
- package/config.d.ts +20 -4
- package/config.js +62 -36
- package/core/pipeline-executor.js +11 -1
- package/core/print/dataflow-printer.js +4 -5
- package/core/print/normalize-printer.js +4 -5
- package/core/print/parse-printer.js +1 -2
- package/core/print/print.js +2 -3
- package/core/print/slice-diff-ansi.js +1 -2
- package/core/steps/pipeline/create-pipeline.js +1 -2
- package/core/steps/pipeline/default-pipelines.d.ts +18 -18
- package/core/steps/pipeline/pipeline.js +1 -2
- package/dataflow/environments/append.js +1 -2
- package/dataflow/environments/built-in-config.d.ts +47 -0
- package/dataflow/environments/built-in-config.js +83 -0
- package/dataflow/environments/built-in.d.ts +49 -6
- package/dataflow/environments/built-in.js +29 -97
- package/dataflow/environments/clone.js +2 -2
- package/dataflow/environments/default-builtin-config.d.ts +5 -0
- package/dataflow/environments/default-builtin-config.js +83 -0
- package/dataflow/environments/define.js +1 -2
- package/dataflow/environments/diff.js +5 -6
- package/dataflow/environments/environment.js +8 -7
- package/dataflow/environments/identifier.d.ts +39 -8
- package/dataflow/environments/identifier.js +33 -0
- package/dataflow/environments/overwrite.d.ts +6 -5
- package/dataflow/environments/overwrite.js +16 -9
- package/dataflow/environments/resolve-by-name.d.ts +3 -1
- package/dataflow/environments/resolve-by-name.js +40 -8
- package/dataflow/environments/scoping.js +2 -3
- package/dataflow/extractor.js +25 -24
- package/dataflow/graph/dataflowgraph-builder.d.ts +139 -0
- package/dataflow/graph/dataflowgraph-builder.js +247 -0
- package/dataflow/graph/diff.js +12 -11
- package/dataflow/graph/edge.d.ts +2 -2
- package/dataflow/graph/edge.js +46 -20
- package/dataflow/graph/graph.d.ts +14 -6
- package/dataflow/graph/graph.js +25 -21
- package/dataflow/graph/quads.js +1 -2
- package/dataflow/graph/resolve-graph.d.ts +7 -0
- package/dataflow/graph/resolve-graph.js +51 -0
- package/dataflow/graph/vertex.d.ts +12 -4
- package/dataflow/graph/vertex.js +19 -11
- package/dataflow/info.d.ts +3 -7
- package/dataflow/info.js +7 -8
- package/dataflow/internal/linker.d.ts +3 -1
- package/dataflow/internal/linker.js +77 -32
- package/dataflow/internal/process/functions/call/argument/make-argument.js +5 -5
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +10 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +27 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +40 -26
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +30 -20
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +10 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +12 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +10 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +6 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +6 -5
- package/dataflow/internal/process/functions/call/common.js +30 -19
- package/dataflow/internal/process/functions/call/default-call-handling.js +1 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +8 -6
- package/dataflow/internal/process/functions/call/named-call-handling.js +7 -6
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +11 -7
- package/dataflow/internal/process/functions/process-argument.js +10 -8
- package/dataflow/internal/process/functions/process-parameter.js +8 -6
- package/dataflow/internal/process/process-named-call.js +3 -3
- package/dataflow/internal/process/process-symbol.js +5 -4
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -2
- package/dataflow/internal/process/process-value.js +5 -4
- package/dataflow/processor.js +1 -2
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +20 -0
- package/documentation/data/dfg/doc-data-dfg-util.js +13 -0
- package/documentation/data/query/example-query-code.d.ts +1 -0
- package/documentation/data/query/example-query-code.js +25 -0
- package/documentation/data/server/doc-data-server-messages.d.ts +1 -0
- package/documentation/data/server/doc-data-server-messages.js +508 -0
- package/documentation/doc-util/doc-auto-gen.d.ts +7 -0
- package/documentation/doc-util/doc-auto-gen.js +9 -0
- package/documentation/doc-util/doc-cfg.d.ts +7 -0
- package/documentation/doc-util/doc-cfg.js +18 -0
- package/documentation/doc-util/doc-cli-option.d.ts +8 -0
- package/documentation/doc-util/doc-cli-option.js +36 -0
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +7 -0
- package/documentation/doc-util/doc-dfg.d.ts +21 -0
- package/documentation/doc-util/doc-dfg.js +93 -0
- package/documentation/doc-util/doc-docker.d.ts +1 -0
- package/documentation/doc-util/doc-docker.js +5 -0
- package/documentation/doc-util/doc-env.d.ts +2 -0
- package/documentation/doc-util/doc-env.js +20 -0
- package/documentation/doc-util/doc-files.d.ts +6 -0
- package/documentation/doc-util/doc-files.js +25 -0
- package/documentation/doc-util/doc-general.d.ts +2 -0
- package/documentation/doc-util/doc-general.js +16 -0
- package/documentation/doc-util/doc-hover-over.d.ts +1 -0
- package/documentation/doc-util/doc-hover-over.js +7 -0
- package/documentation/doc-util/doc-issue.d.ts +1 -0
- package/documentation/doc-util/doc-issue.js +6 -0
- package/documentation/doc-util/doc-ms.d.ts +1 -0
- package/documentation/doc-util/doc-ms.js +8 -0
- package/documentation/doc-util/doc-normalized-ast.d.ts +11 -0
- package/documentation/doc-util/doc-normalized-ast.js +71 -0
- package/documentation/doc-util/doc-query.d.ts +24 -0
- package/documentation/doc-util/doc-query.js +113 -0
- package/documentation/doc-util/doc-repl.d.ts +13 -0
- package/documentation/doc-util/doc-repl.js +79 -0
- package/documentation/doc-util/doc-server-message.d.ts +37 -0
- package/documentation/doc-util/doc-server-message.js +153 -0
- package/documentation/doc-util/doc-structure.d.ts +12 -0
- package/documentation/doc-util/doc-structure.js +21 -0
- package/documentation/doc-util/doc-types.d.ts +38 -0
- package/documentation/doc-util/doc-types.js +276 -0
- package/{r-bridge/data/print.js → documentation/print-capabilities-markdown.js} +8 -4
- package/documentation/print-dataflow-graph-wiki.d.ts +1 -0
- package/documentation/print-dataflow-graph-wiki.js +849 -0
- package/documentation/print-interface-wiki.d.ts +1 -0
- package/documentation/print-interface-wiki.js +401 -0
- package/documentation/print-normalized-ast-wiki.d.ts +1 -0
- package/documentation/print-normalized-ast-wiki.js +98 -0
- package/documentation/print-query-wiki.d.ts +1 -0
- package/documentation/print-query-wiki.js +215 -0
- package/package.json +29 -33
- package/queries/base-query-format.d.ts +11 -0
- package/{cli/repl/server/messages/hello.js → queries/base-query-format.js} +1 -1
- package/queries/call-context-query/call-context-query-executor.d.ts +11 -0
- package/queries/call-context-query/call-context-query-executor.js +255 -0
- package/queries/call-context-query/call-context-query-format.d.ts +72 -0
- package/queries/call-context-query/call-context-query-format.js +17 -0
- package/queries/query-schema.d.ts +7 -0
- package/queries/query-schema.js +31 -0
- package/queries/query.d.ts +35 -0
- package/queries/query.js +57 -0
- package/queries/two-layer-collector.d.ts +8 -0
- package/queries/two-layer-collector.js +31 -0
- package/queries/virtual-query/compound-query.d.ts +24 -0
- package/queries/virtual-query/compound-query.js +18 -0
- package/queries/virtual-query/virtual-queries.d.ts +15 -0
- package/queries/virtual-query/virtual-queries.js +8 -0
- package/r-bridge/data/data.d.ts +5 -0
- package/r-bridge/data/data.js +6 -0
- package/r-bridge/data/get.js +2 -3
- package/r-bridge/init.js +2 -2
- package/r-bridge/lang-4.x/ast/model/collect.js +1 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +10 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/operators.js +27 -26
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +9 -9
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +26 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +23 -23
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +23 -23
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/type.js +221 -12
- package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +6 -5
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/normalize-expression.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-argument.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-call.js +18 -18
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-definition.js +8 -8
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-parameter.js +9 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-break.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-for.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-next.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-repeat.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/normalize-access.js +12 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-binary.js +14 -14
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-unary.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-comment.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-line-directive.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.js +13 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-root.js +6 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-single-node.js +19 -19
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-number.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-string.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-symbol.js +2 -3
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +12 -12
- package/r-bridge/lang-4.x/convert-values.js +7 -7
- package/r-bridge/retriever.js +12 -11
- package/r-bridge/shell.d.ts +0 -1
- package/r-bridge/shell.js +6 -1
- package/reconstruct/auto-select/auto-select-defaults.js +1 -2
- package/reconstruct/auto-select/magic-comments.js +3 -3
- package/reconstruct/reconstruct.js +4 -3
- package/slicing/criterion/collect-all.js +1 -2
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/criterion/parse.js +6 -5
- package/slicing/static/fingerprint.js +2 -3
- package/slicing/static/slice-call.js +9 -9
- package/slicing/static/static-slicer.js +5 -4
- package/statistics/features/common-syntax-probability.js +13 -13
- package/statistics/features/feature.d.ts +5 -9
- package/statistics/features/feature.js +2 -2
- package/statistics/features/post-processing.js +2 -3
- package/statistics/features/supported/assignments/assignments.js +3 -2
- package/statistics/features/supported/assignments/post-process.js +1 -2
- package/statistics/features/supported/comments/post-process.js +1 -2
- package/statistics/features/supported/control-flow/control-flow.js +4 -3
- package/statistics/features/supported/control-flow/post-process.js +1 -2
- package/statistics/features/supported/data-access/data-access.d.ts +2 -2
- package/statistics/features/supported/data-access/data-access.js +3 -2
- package/statistics/features/supported/data-access/post-process.js +1 -2
- package/statistics/features/supported/defined-functions/defined-functions.js +9 -7
- package/statistics/features/supported/defined-functions/post-process.d.ts +1 -1
- package/statistics/features/supported/defined-functions/post-process.js +2 -3
- package/statistics/features/supported/expression-list/post-process.js +1 -2
- package/statistics/features/supported/expression-list/{expression-list.js → statistics-expression-list.js} +4 -3
- package/statistics/features/supported/loops/loops.js +8 -7
- package/statistics/features/supported/loops/post-process.js +1 -2
- package/statistics/features/supported/used-functions/post-process.js +2 -3
- package/statistics/features/supported/used-functions/used-functions.d.ts +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +4 -3
- package/statistics/features/supported/used-packages/post-process.js +1 -2
- package/statistics/features/supported/values/post-process.js +1 -2
- package/statistics/features/supported/variables/post-process.js +2 -3
- package/statistics/features/supported/variables/variables.js +2 -1
- package/statistics/meta-statistics.js +1 -2
- package/statistics/output/print-stats.js +4 -5
- package/statistics/output/statistics-file.js +5 -5
- package/statistics/statistics.js +2 -3
- package/statistics/summarizer/auto-detect.js +1 -2
- package/statistics/summarizer/post-process/clusterer.js +1 -2
- package/statistics/summarizer/post-process/file-based-count.js +2 -3
- package/statistics/summarizer/post-process/histogram.js +3 -4
- package/statistics/summarizer/post-process/post-process-output.js +2 -3
- package/statistics/summarizer/second-phase/process.d.ts +2 -0
- package/statistics/summarizer/second-phase/process.js +2 -2
- package/statistics/summarizer/summarizer.js +8 -1
- package/util/ansi.d.ts +1 -0
- package/util/ansi.js +27 -4
- package/util/args.js +2 -3
- package/util/arrays.js +8 -9
- package/util/assert.js +5 -6
- package/util/bimap.d.ts +4 -4
- package/util/cfg/cfg.d.ts +1 -0
- package/util/cfg/cfg.js +8 -5
- package/util/cfg/visitor.d.ts +8 -13
- package/util/cfg/visitor.js +22 -56
- package/util/diff.js +1 -2
- package/util/files.d.ts +0 -1
- package/util/files.js +11 -8
- package/util/json.js +2 -3
- package/util/mermaid/ast.js +7 -7
- package/util/mermaid/cfg.js +2 -3
- package/util/mermaid/dfg.d.ts +12 -4
- package/util/mermaid/dfg.js +28 -16
- package/util/mermaid/mermaid.js +5 -4
- package/util/numbers.js +1 -2
- package/util/objects.d.ts +7 -0
- package/util/objects.js +13 -3
- package/util/os.js +1 -2
- package/util/quads.js +5 -5
- package/util/random.js +2 -2
- package/util/range.js +8 -9
- package/util/schema.d.ts +11 -0
- package/util/schema.js +75 -0
- package/util/set.js +2 -3
- package/util/strings.js +3 -4
- package/util/summarizer.js +4 -4
- package/util/text.d.ts +1 -0
- package/util/text.js +20 -0
- package/util/time.js +1 -2
- package/util/version.js +2 -3
- package/cli/repl/commands/lineage.d.ts +0 -15
- package/cli/repl/commands/quit.d.ts +0 -2
- package/cli/repl/server/messages/analysis.js +0 -21
- package/cli/repl/server/messages/lineage.js +0 -17
- package/cli/repl/server/messages/repl.js +0 -37
- /package/cli/repl/commands/{main.d.ts → repl-main.d.ts} +0 -0
- /package/{r-bridge/data/print.d.ts → documentation/print-capabilities-markdown.d.ts} +0 -0
- /package/statistics/features/supported/expression-list/{expression-list.d.ts → statistics-expression-list.d.ts} +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.documentServerMessage = documentServerMessage;
|
|
4
|
+
exports.printServerMessages = printServerMessages;
|
|
5
|
+
exports.inServerContext = inServerContext;
|
|
6
|
+
exports.documentServerMessageResponse = documentServerMessageResponse;
|
|
7
|
+
const doc_files_1 = require("./doc-files");
|
|
8
|
+
const schema_1 = require("../../util/schema");
|
|
9
|
+
const ansi_1 = require("../../util/ansi");
|
|
10
|
+
const net_1 = require("../../../test/functionality/_helper/net");
|
|
11
|
+
const doc_code_1 = require("./doc-code");
|
|
12
|
+
const doc_ms_1 = require("./doc-ms");
|
|
13
|
+
const assert_1 = require("../../util/assert");
|
|
14
|
+
const messages = [];
|
|
15
|
+
function documentServerMessage(description) {
|
|
16
|
+
messages.push(description);
|
|
17
|
+
}
|
|
18
|
+
async function printServerMessages(shell) {
|
|
19
|
+
let text = '<ul>';
|
|
20
|
+
for (const message of messages) {
|
|
21
|
+
text += '<li>' + await printServerMessage(message, shell) + '</li>\n\n';
|
|
22
|
+
}
|
|
23
|
+
return text + '</ul>';
|
|
24
|
+
}
|
|
25
|
+
async function inServerContext(shell, fn) {
|
|
26
|
+
return (0, net_1.withSocket)(shell, async (socket, server) => {
|
|
27
|
+
return fn(socket, server);
|
|
28
|
+
})();
|
|
29
|
+
}
|
|
30
|
+
function explainMsg(msg, type, desc = '', open = false) {
|
|
31
|
+
const bold = open ? s => `<b>${s}</b>` : s => s;
|
|
32
|
+
const msgPrettyPrint = JSON.stringify(msg, null, 2);
|
|
33
|
+
return `
|
|
34
|
+
<li> ${bold('<code>' + msg.type + `</code> (${type})`)}
|
|
35
|
+
<details${open ? ' open' : ''}>
|
|
36
|
+
|
|
37
|
+
<summary> Show Details </summary>
|
|
38
|
+
|
|
39
|
+
${desc}
|
|
40
|
+
|
|
41
|
+
${msgPrettyPrint.length > 5_000 ? '_As the message is pretty long, we inhibit pretty printing and syntax highlighting:_' : ''}
|
|
42
|
+
${(0, doc_code_1.codeBlock)(msgPrettyPrint.length > 5_000 ? 'text' : 'json', msgPrettyPrint.length > 5_000 ? JSON.stringify(msg) : msgPrettyPrint)}
|
|
43
|
+
|
|
44
|
+
</details>
|
|
45
|
+
</li>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
function getDescriptionForMessage(msg, description) {
|
|
49
|
+
if (description === undefined) {
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
else if (typeof description === 'function') {
|
|
53
|
+
return description(msg);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return description ?? '';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function explainPingPong(description, received) {
|
|
60
|
+
let result = `<ol>${explainMsg(received[0], 'response', 'The first message is always a hello message.')}`;
|
|
61
|
+
let readReceived = 1;
|
|
62
|
+
/* we received one more than we sent (`hello` :D) */
|
|
63
|
+
for (const msg of description) {
|
|
64
|
+
if (msg.type === 'request') {
|
|
65
|
+
result += explainMsg(msg.message, 'request', getDescriptionForMessage(msg.message, msg.description), msg.mark);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const response = received[readReceived++];
|
|
69
|
+
result += explainMsg(response, 'response', getDescriptionForMessage(response, msg.description), msg.mark);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return result + '</ol>';
|
|
73
|
+
}
|
|
74
|
+
async function documentServerMessageResponse({ shell, title, messageType, messages }) {
|
|
75
|
+
const start = performance.now();
|
|
76
|
+
const response = await inServerContext(shell, async (socket) => {
|
|
77
|
+
for (const metaMessage of messages) {
|
|
78
|
+
if (metaMessage.type === 'request') {
|
|
79
|
+
socket.send(JSON.stringify(metaMessage.message) + '\n');
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
try {
|
|
83
|
+
await socket.waitForMessage(metaMessage.expectedType, 20);
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
console.error('Failed to receive message', metaMessage.expectedType, 'has', socket.getMessages());
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return socket.getMessages();
|
|
91
|
+
});
|
|
92
|
+
const end = performance.now();
|
|
93
|
+
(0, assert_1.guard)(title !== undefined || messageType !== undefined, 'Either a title or a message type must be given');
|
|
94
|
+
title ??= `Example of the <code>${messageType}</code> Message`;
|
|
95
|
+
return `
|
|
96
|
+
<details>
|
|
97
|
+
<summary>${title}</summary>
|
|
98
|
+
|
|
99
|
+
_Note:_ even though we pretty-print these messages, they are sent as a single line, ending with a newline.
|
|
100
|
+
|
|
101
|
+
The following lists all messages that were sent and received in case you want to reproduce the scenario:
|
|
102
|
+
|
|
103
|
+
${explainPingPong(messages, response)}
|
|
104
|
+
|
|
105
|
+
The complete round-trip took ${(0, doc_ms_1.printAsMs)(end - start)} (including time required to validate the messages, start, and stop the internal mock server).
|
|
106
|
+
|
|
107
|
+
</details>
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
function getSchema(definitionPath, def) {
|
|
111
|
+
return def ? `<details>
|
|
112
|
+
<summary style="color:gray">Message schema (<code>${def.type}</code>)</summary>
|
|
113
|
+
|
|
114
|
+
For the definition of the hello message, please see it's implementation at ${(0, doc_files_1.getFilePathMd)(definitionPath)}.
|
|
115
|
+
|
|
116
|
+
${(0, schema_1.describeSchema)(def.schema, ansi_1.markdownFormatter)}
|
|
117
|
+
|
|
118
|
+
</details>
|
|
119
|
+
` : '';
|
|
120
|
+
}
|
|
121
|
+
async function printServerMessage({ mermaidSequenceDiagram, text, title, shortDescription, definitionPath, defRequest, defResponse, additionalDefs }, shell) {
|
|
122
|
+
const base = defRequest ?? defResponse;
|
|
123
|
+
(0, assert_1.guard)(base !== undefined, 'At least one of the definitions must be given');
|
|
124
|
+
return `
|
|
125
|
+
<a id="message-${base.type}"></a>
|
|
126
|
+
<b>${title}</b> Message (<code>${base.type}</code>)
|
|
127
|
+
<details>
|
|
128
|
+
|
|
129
|
+
<summary style="color:gray"> View Details. <i>${shortDescription}</i> </summary>
|
|
130
|
+
|
|
131
|
+
\`\`\`mermaid
|
|
132
|
+
sequenceDiagram
|
|
133
|
+
autonumber
|
|
134
|
+
participant Client
|
|
135
|
+
participant Server
|
|
136
|
+
|
|
137
|
+
${mermaidSequenceDiagram}
|
|
138
|
+
\`\`\`
|
|
139
|
+
|
|
140
|
+
${await text(shell)}
|
|
141
|
+
|
|
142
|
+
<hr>
|
|
143
|
+
|
|
144
|
+
${getSchema(definitionPath, defRequest)}
|
|
145
|
+
${getSchema(definitionPath, defResponse)}
|
|
146
|
+
${additionalDefs?.map(def => getSchema(definitionPath, def)).join('\n') ?? ''}
|
|
147
|
+
|
|
148
|
+
<hr>
|
|
149
|
+
|
|
150
|
+
</details>
|
|
151
|
+
`;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=doc-server-message.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface DetailsOptions {
|
|
2
|
+
readonly color?: string;
|
|
3
|
+
readonly open?: boolean;
|
|
4
|
+
readonly hideIfEmpty?: boolean;
|
|
5
|
+
readonly prefixInit?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function details(title: string, content: string, { color, open, hideIfEmpty, prefixInit }?: DetailsOptions): string;
|
|
8
|
+
export interface BlockOptions {
|
|
9
|
+
readonly type: 'NOTE' | 'WARNING' | 'INFO' | 'TIP';
|
|
10
|
+
readonly content: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function block({ type, content }: BlockOptions): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.details = details;
|
|
4
|
+
exports.block = block;
|
|
5
|
+
const doc_general_1 = require("./doc-general");
|
|
6
|
+
function details(title, content, { color = 'black', open = false, hideIfEmpty = true, prefixInit = '' } = {}) {
|
|
7
|
+
return hideIfEmpty && content.trim().length === 0 ? '' : `
|
|
8
|
+
${prefixInit}<details${open ? ' open' : ''}><summary style="color:${color}">${title}</summary>
|
|
9
|
+
|
|
10
|
+
${content}
|
|
11
|
+
|
|
12
|
+
</details>
|
|
13
|
+
`;
|
|
14
|
+
}
|
|
15
|
+
function block({ type, content }) {
|
|
16
|
+
return `
|
|
17
|
+
> [!${type}]
|
|
18
|
+
${(0, doc_general_1.prefixLines)(content, '> ')}
|
|
19
|
+
`;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=doc-structure.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
export interface TypeElementInSource {
|
|
3
|
+
name: string;
|
|
4
|
+
node: ts.Node;
|
|
5
|
+
kind: 'interface' | 'type' | 'enum';
|
|
6
|
+
extends: string[];
|
|
7
|
+
generics: string[];
|
|
8
|
+
filePath: string;
|
|
9
|
+
lineNumber: number;
|
|
10
|
+
comments?: string[];
|
|
11
|
+
readonly properties?: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function getType(node: ts.Node, typeChecker: ts.TypeChecker): string;
|
|
14
|
+
export declare function followTypeReference(type: ts.TypeReferenceNode, sourceFile: ts.SourceFile): string[];
|
|
15
|
+
export declare function getTypePathLink({ filePath, lineNumber }: TypeElementInSource, prefix?: string): string;
|
|
16
|
+
export interface GetTypesAsMermaidOption {
|
|
17
|
+
readonly rootFolder?: string;
|
|
18
|
+
readonly files?: readonly string[];
|
|
19
|
+
readonly typeName: string;
|
|
20
|
+
readonly inlineTypes?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
export interface MermaidTypeReport {
|
|
23
|
+
text: string;
|
|
24
|
+
info: TypeElementInSource[];
|
|
25
|
+
program: ts.Program;
|
|
26
|
+
}
|
|
27
|
+
export declare function getTypesFromFolderAsMermaid(options: GetTypesAsMermaidOption): MermaidTypeReport;
|
|
28
|
+
export declare function implSnippet(node: TypeElementInSource | undefined, program: ts.Program, nesting?: number): string;
|
|
29
|
+
export interface PrintHierarchyArguments {
|
|
30
|
+
readonly program: ts.Program;
|
|
31
|
+
readonly hierarchy: TypeElementInSource[];
|
|
32
|
+
readonly root: string;
|
|
33
|
+
readonly collapseFromNesting?: number;
|
|
34
|
+
readonly initialNesting?: number;
|
|
35
|
+
readonly maxDepth?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare const mermaidHide: string[];
|
|
38
|
+
export declare function printHierarchy({ program, hierarchy, root, collapseFromNesting, initialNesting, maxDepth }: PrintHierarchyArguments): string;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mermaidHide = void 0;
|
|
7
|
+
exports.getType = getType;
|
|
8
|
+
exports.followTypeReference = followTypeReference;
|
|
9
|
+
exports.getTypePathLink = getTypePathLink;
|
|
10
|
+
exports.getTypesFromFolderAsMermaid = getTypesFromFolderAsMermaid;
|
|
11
|
+
exports.implSnippet = implSnippet;
|
|
12
|
+
exports.printHierarchy = printHierarchy;
|
|
13
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
14
|
+
const assert_1 = require("../../util/assert");
|
|
15
|
+
const doc_files_1 = require("./doc-files");
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const mermaid_1 = require("../../util/mermaid/mermaid");
|
|
19
|
+
const doc_code_1 = require("./doc-code");
|
|
20
|
+
const doc_structure_1 = require("./doc-structure");
|
|
21
|
+
function getSourceFiles(fileNames) {
|
|
22
|
+
try {
|
|
23
|
+
const program = typescript_1.default.createProgram(fileNames, { target: typescript_1.default.ScriptTarget.ESNext });
|
|
24
|
+
return { program, files: fileNames.map(fileName => program.getSourceFile(fileName)).filter(file => !!file) };
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
console.error('Failed to get source files', err);
|
|
28
|
+
return { files: [], program: undefined };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function dropGenericsFromType(type) {
|
|
32
|
+
let previous;
|
|
33
|
+
do {
|
|
34
|
+
previous = type;
|
|
35
|
+
type = type.replace(/<.*>/g, '');
|
|
36
|
+
} while (type !== previous);
|
|
37
|
+
return type;
|
|
38
|
+
}
|
|
39
|
+
function removeCommentSymbols(comment) {
|
|
40
|
+
return comment.replace(/^\/\*\*?/, '').replace(/\*\/$/, '').replace(/^\s*\*/, '').trim();
|
|
41
|
+
}
|
|
42
|
+
function getTextualComments(node) {
|
|
43
|
+
const comments = typescript_1.default.getJSDocCommentsAndTags(node);
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const { comment } of comments) {
|
|
46
|
+
if (typeof comment === 'string') {
|
|
47
|
+
out.push(comment);
|
|
48
|
+
}
|
|
49
|
+
else if (comment !== undefined) {
|
|
50
|
+
for (const c of comment) {
|
|
51
|
+
out.push(removeCommentSymbols(c.getText(c.getSourceFile())));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
function getStartLine(node, sourceFile) {
|
|
58
|
+
const lineStart = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line;
|
|
59
|
+
return lineStart + 1;
|
|
60
|
+
}
|
|
61
|
+
function getType(node, typeChecker) {
|
|
62
|
+
const tryDirect = typeChecker.getTypeAtLocation(node);
|
|
63
|
+
return tryDirect ? typeChecker.typeToString(tryDirect) : 'unknown';
|
|
64
|
+
}
|
|
65
|
+
function followTypeReference(type, sourceFile) {
|
|
66
|
+
const node = type.typeName;
|
|
67
|
+
if (typescript_1.default.isQualifiedName(node)) {
|
|
68
|
+
return [node.right.getText(sourceFile) ?? ''];
|
|
69
|
+
}
|
|
70
|
+
const args = type.typeArguments?.map(arg => arg.getText(sourceFile)) ?? [];
|
|
71
|
+
const nodeLexeme = node.getText(sourceFile) ?? '';
|
|
72
|
+
if (['Pick', 'Partial', 'Required', 'Readonly', 'Omit'].map(s => nodeLexeme.startsWith(s))) {
|
|
73
|
+
return args;
|
|
74
|
+
}
|
|
75
|
+
return [nodeLexeme, ...args];
|
|
76
|
+
}
|
|
77
|
+
function collectHierarchyInformation(sourceFiles, options) {
|
|
78
|
+
const hierarchyList = [];
|
|
79
|
+
const typeChecker = options.program.getTypeChecker();
|
|
80
|
+
const visit = (node, sourceFile) => {
|
|
81
|
+
if (!node) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (typescript_1.default.isInterfaceDeclaration(node)) {
|
|
85
|
+
const interfaceName = node.name?.getText(sourceFile) ?? '';
|
|
86
|
+
const baseTypes = node.heritageClauses?.flatMap(clause => clause.types
|
|
87
|
+
.map(type => type.getText(sourceFile) ?? '')
|
|
88
|
+
.map(dropGenericsFromType)) ?? [];
|
|
89
|
+
const generics = node.typeParameters?.map(param => param.getText(sourceFile) ?? '') || [];
|
|
90
|
+
hierarchyList.push({
|
|
91
|
+
name: dropGenericsFromType(interfaceName),
|
|
92
|
+
node,
|
|
93
|
+
kind: 'interface',
|
|
94
|
+
extends: baseTypes,
|
|
95
|
+
generics,
|
|
96
|
+
comments: getTextualComments(node),
|
|
97
|
+
filePath: sourceFile.fileName,
|
|
98
|
+
lineNumber: getStartLine(node, sourceFile),
|
|
99
|
+
properties: node.members.map(member => {
|
|
100
|
+
const name = member.name?.getText(sourceFile) ?? '';
|
|
101
|
+
return `${name}${(0, mermaid_1.escapeMarkdown)(': ' + getType(member, typeChecker))}`;
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else if (typescript_1.default.isTypeAliasDeclaration(node)) {
|
|
106
|
+
const typeName = node.name?.getText(sourceFile) ?? '';
|
|
107
|
+
let baseTypes = [];
|
|
108
|
+
if (typescript_1.default.isIntersectionTypeNode(node.type) || typescript_1.default.isUnionTypeNode(node.type)) {
|
|
109
|
+
baseTypes = node.type.types
|
|
110
|
+
.filter(typeNode => typescript_1.default.isTypeReferenceNode(typeNode))
|
|
111
|
+
.flatMap(typeName => followTypeReference(typeName, sourceFile))
|
|
112
|
+
.map(dropGenericsFromType);
|
|
113
|
+
}
|
|
114
|
+
else if (typescript_1.default.isTypeReferenceNode(node.type)) {
|
|
115
|
+
baseTypes = [...followTypeReference(node.type, sourceFile)];
|
|
116
|
+
}
|
|
117
|
+
const generics = node.typeParameters?.map(param => param.getText(sourceFile) ?? '') ?? [];
|
|
118
|
+
hierarchyList.push({
|
|
119
|
+
name: dropGenericsFromType(typeName),
|
|
120
|
+
node,
|
|
121
|
+
kind: 'type',
|
|
122
|
+
extends: baseTypes,
|
|
123
|
+
comments: getTextualComments(node),
|
|
124
|
+
generics,
|
|
125
|
+
filePath: sourceFile.fileName,
|
|
126
|
+
lineNumber: getStartLine(node, sourceFile),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else if (typescript_1.default.isEnumDeclaration(node)) {
|
|
130
|
+
const enumName = node.name?.getText(sourceFile) ?? '';
|
|
131
|
+
hierarchyList.push({
|
|
132
|
+
name: enumName,
|
|
133
|
+
node,
|
|
134
|
+
kind: 'enum',
|
|
135
|
+
extends: [],
|
|
136
|
+
comments: getTextualComments(node),
|
|
137
|
+
generics: [],
|
|
138
|
+
filePath: sourceFile.fileName,
|
|
139
|
+
lineNumber: getStartLine(node, sourceFile),
|
|
140
|
+
properties: node.members.map(member => {
|
|
141
|
+
const name = member.name?.getText(sourceFile) ?? '';
|
|
142
|
+
return `${name}${(0, mermaid_1.escapeMarkdown)(': ' + getType(member, typeChecker))}`;
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
typescript_1.default.forEachChild(node, child => visit(child, sourceFile));
|
|
147
|
+
};
|
|
148
|
+
sourceFiles.forEach(sourceFile => {
|
|
149
|
+
visit(sourceFile, sourceFile);
|
|
150
|
+
});
|
|
151
|
+
return hierarchyList;
|
|
152
|
+
}
|
|
153
|
+
function getTypePathLink({ filePath, lineNumber }, prefix = doc_files_1.RemoteFlowrFilePathBaseRef) {
|
|
154
|
+
const fromSource = filePath.replace(/^.*\/src\//, 'src/');
|
|
155
|
+
return `${prefix}/${fromSource}#L${lineNumber}`;
|
|
156
|
+
}
|
|
157
|
+
function generateMermaidClassDiagram(hierarchyList, rootName, options, visited = new Set()) {
|
|
158
|
+
const collect = { nodeLines: [], edgeLines: [] };
|
|
159
|
+
if (visited.has(rootName)) {
|
|
160
|
+
return collect;
|
|
161
|
+
} // Prevent circular references
|
|
162
|
+
visited.add(rootName);
|
|
163
|
+
const node = hierarchyList.find(h => h.name === rootName);
|
|
164
|
+
if (!node) {
|
|
165
|
+
return collect;
|
|
166
|
+
}
|
|
167
|
+
const genericPart = node.generics.length > 0 ? `~${node.generics.join(', ')}~` : '';
|
|
168
|
+
collect.nodeLines.push(`class ${node.name}${genericPart}`);
|
|
169
|
+
collect.nodeLines.push(` <<${node.kind}>> ${node.name}`);
|
|
170
|
+
if (node.kind === 'type') {
|
|
171
|
+
collect.nodeLines.push(`style ${node.name} opacity:.35,fill:#FAFAFA`);
|
|
172
|
+
}
|
|
173
|
+
const writtenProperties = new Set();
|
|
174
|
+
if (node.properties) {
|
|
175
|
+
for (const property of node.properties) {
|
|
176
|
+
collect.nodeLines.push(` ${node.name} : ${property}`);
|
|
177
|
+
writtenProperties.add(property);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
collect.nodeLines.push(`click ${node.name} href "${getTypePathLink(node)}" "${(0, mermaid_1.escapeMarkdown)(node.comments?.join('; ').replace(/\n/g, ' ') ?? '')}"`);
|
|
181
|
+
if (node.extends.length > 0) {
|
|
182
|
+
for (const baseType of node.extends) {
|
|
183
|
+
if (options.inlineTypes?.includes(baseType)) {
|
|
184
|
+
const info = hierarchyList.find(h => h.name === baseType);
|
|
185
|
+
for (const property of info?.properties ?? []) {
|
|
186
|
+
if (!writtenProperties.has(property)) {
|
|
187
|
+
collect.nodeLines.push(` ${node.name} : ${property} [from ${baseType}]`);
|
|
188
|
+
writtenProperties.add(property);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
if (node.kind === 'type' || hierarchyList.find(h => h.name === baseType)?.kind === 'type') {
|
|
194
|
+
collect.edgeLines.push(`${baseType} .. ${node.name}`);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
collect.edgeLines.push(`${baseType} <|-- ${node.name}`);
|
|
198
|
+
}
|
|
199
|
+
const { nodeLines, edgeLines } = generateMermaidClassDiagram(hierarchyList, baseType, options, visited);
|
|
200
|
+
collect.nodeLines.push(...nodeLines);
|
|
201
|
+
collect.edgeLines.push(...edgeLines);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return collect;
|
|
206
|
+
}
|
|
207
|
+
function visualizeMermaidClassDiagram(hierarchyList, options) {
|
|
208
|
+
const { nodeLines, edgeLines } = generateMermaidClassDiagram(hierarchyList, options.typeName, options);
|
|
209
|
+
return nodeLines.length === 0 && edgeLines.length === 0 ? '' : `
|
|
210
|
+
classDiagram
|
|
211
|
+
direction RL
|
|
212
|
+
${nodeLines.join('\n')}
|
|
213
|
+
${edgeLines.join('\n')}
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
function getTypesFromFileAsMermaid(fileNames, options) {
|
|
217
|
+
const { files, program } = getSourceFiles(fileNames);
|
|
218
|
+
(0, assert_1.guard)(files.length > 0, () => `No source files found for ${JSON.stringify(fileNames)}`);
|
|
219
|
+
const withProgram = { ...options, program };
|
|
220
|
+
const hierarchyList = collectHierarchyInformation(files, withProgram);
|
|
221
|
+
return {
|
|
222
|
+
text: visualizeMermaidClassDiagram(hierarchyList, withProgram),
|
|
223
|
+
info: hierarchyList,
|
|
224
|
+
program
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function getTypesFromFolderAsMermaid(options) {
|
|
228
|
+
(0, assert_1.guard)(options.rootFolder !== undefined || options.files !== undefined, 'Either rootFolder or files must be provided');
|
|
229
|
+
const files = [...options.files ?? []];
|
|
230
|
+
if (options.rootFolder) {
|
|
231
|
+
for (const fileBuff of fs_1.default.readdirSync(options.rootFolder, { recursive: true })) {
|
|
232
|
+
const file = fileBuff.toString();
|
|
233
|
+
if (file.endsWith('.ts')) {
|
|
234
|
+
files.push(path_1.default.join(options.rootFolder, file));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return getTypesFromFileAsMermaid(files, options);
|
|
239
|
+
}
|
|
240
|
+
function implSnippet(node, program, nesting = 0) {
|
|
241
|
+
(0, assert_1.guard)(node !== undefined, 'Node must be defined => invalid change of type name?');
|
|
242
|
+
const indent = ' '.repeat(nesting * 2);
|
|
243
|
+
const bold = node.kind === 'interface' || node.kind === 'enum' ? '**' : '';
|
|
244
|
+
const sep = node.comments ? ' \n' : '\n';
|
|
245
|
+
let text = node.comments?.join('\n') ?? '';
|
|
246
|
+
const code = node.node.getText(program.getSourceFile(node.node.getSourceFile().fileName));
|
|
247
|
+
text += `\n<details><summary style="color:gray">Defined at <a href="${getTypePathLink(node)}">${getTypePathLink(node, '.')}</a></summary>\n\n${(0, doc_code_1.codeBlock)('ts', code)}\n\n</details>\n`;
|
|
248
|
+
return `${indent} * ${bold}[${node.name}](${getTypePathLink(node)})${bold} ${sep}${indent} ${text.replaceAll('\t', ' ').split(/\n/g).join(`\n${indent} `)}`;
|
|
249
|
+
}
|
|
250
|
+
exports.mermaidHide = ['Leaf', 'Location', 'Namespace', 'Base', 'WithChildren', 'Partial', 'RAccessBase'];
|
|
251
|
+
function printHierarchy({ program, hierarchy, root, collapseFromNesting = 1, initialNesting = 0, maxDepth = 20 }) {
|
|
252
|
+
if (initialNesting > maxDepth) {
|
|
253
|
+
return '';
|
|
254
|
+
}
|
|
255
|
+
const node = hierarchy.find(e => e.name === root);
|
|
256
|
+
if (!node) {
|
|
257
|
+
return '';
|
|
258
|
+
}
|
|
259
|
+
const thisLine = implSnippet(node, program, initialNesting);
|
|
260
|
+
const result = [];
|
|
261
|
+
for (const baseType of node.extends) {
|
|
262
|
+
if (exports.mermaidHide.includes(baseType)) {
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
const res = printHierarchy({ program, hierarchy, root: baseType, collapseFromNesting, initialNesting: initialNesting + 1, maxDepth });
|
|
266
|
+
result.push(res);
|
|
267
|
+
}
|
|
268
|
+
const out = result.join('\n');
|
|
269
|
+
if (initialNesting === collapseFromNesting - 1) {
|
|
270
|
+
return thisLine + (out ? (0, doc_structure_1.details)(`View more (${node.extends.join(', ')})`, out, { prefixInit: ' '.repeat(2 * (collapseFromNesting + 1)) }) : '');
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
return thisLine + (out ? '\n' + out : '');
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=doc-types.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const data_1 = require("
|
|
3
|
+
const data_1 = require("../r-bridge/data/data");
|
|
4
|
+
const version_1 = require("../util/version");
|
|
5
|
+
const log_1 = require("../../test/functionality/_helper/log");
|
|
4
6
|
const supportedSymbolMap = new Map([
|
|
5
7
|
['not', ':red_circle:'],
|
|
6
8
|
['partially', ':large_orange_diamond:'],
|
|
@@ -36,7 +38,8 @@ function printAsMarkdown(capabilities, depth = 0, lines = []) {
|
|
|
36
38
|
}
|
|
37
39
|
function getPreamble() {
|
|
38
40
|
const currentDateAndTime = new Date().toISOString().replace('T', ', ').replace(/\.\d+Z$/, ' UTC');
|
|
39
|
-
|
|
41
|
+
const shortenFilename = module.filename.replace(/^.*src\//, 'src/');
|
|
42
|
+
return `_This document was generated from '${shortenFilename}' on ${currentDateAndTime} summarizig flowR's current capabilities (v${(0, version_1.flowrVersion)().format()})._
|
|
40
43
|
|
|
41
44
|
The code-font behind each capability name is a link to the capability's id. This id can be used to reference the capability in a labeled test within flowR.
|
|
42
45
|
Besides, we use colored bullets like this:
|
|
@@ -51,8 +54,9 @@ Besides, we use colored bullets like this:
|
|
|
51
54
|
|
|
52
55
|
`;
|
|
53
56
|
}
|
|
54
|
-
/** if we run this script, we want a
|
|
57
|
+
/** if we run this script, we want a Markdown representation of the capabilities */
|
|
55
58
|
if (require.main === module) {
|
|
59
|
+
(0, log_1.setMinLevelOfAllLogs)(6 /* LogLevel.Fatal */);
|
|
56
60
|
console.log(getPreamble() + printAsMarkdown(data_1.flowrCapabilities.capabilities));
|
|
57
61
|
}
|
|
58
|
-
//# sourceMappingURL=print.js.map
|
|
62
|
+
//# sourceMappingURL=print-capabilities-markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|