@eagleoutice/flowr 2.10.9 → 2.11.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/README.md +116 -38
- package/abstract-interpretation/absint-visitor.js +6 -3
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
- package/abstract-interpretation/domains/interval-domain.js +1 -1
- package/abstract-interpretation/domains/lattice.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
- package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
- package/abstract-interpretation/domains/singleton-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
- package/abstract-interpretation/unsupported-functions.d.ts +3 -2
- package/abstract-interpretation/unsupported-functions.js +38 -28
- package/cli/benchmark-app.js +2 -1
- package/cli/common/options.d.ts +2 -108
- package/cli/common/options.js +3 -27
- package/cli/common/script.js +3 -2
- package/cli/common/scripts-info.d.ts +2 -123
- package/cli/common/scripts-info.js +0 -17
- package/cli/flowr-main-options.d.ts +5 -0
- package/cli/flowr-main-options.js +10 -0
- package/cli/flowr.js +48 -11
- package/cli/repl/commands/repl-cfg.js +9 -9
- package/cli/repl/commands/repl-commands.js +5 -0
- package/cli/repl/commands/repl-dataflow.js +31 -24
- package/cli/repl/commands/repl-main.d.ts +6 -0
- package/cli/repl/commands/repl-normalize.js +15 -12
- package/cli/repl/commands/repl-parse.js +1 -1
- package/cli/repl/commands/repl-query.js +4 -5
- package/cli/repl/commands/repl-quit.js +2 -1
- package/cli/repl/core.d.ts +11 -0
- package/cli/repl/core.js +101 -3
- package/cli/repl/execute.js +3 -2
- package/cli/repl/parser/slice-query-parser.d.ts +16 -0
- package/cli/repl/parser/slice-query-parser.js +52 -0
- package/cli/repl/print-version.d.ts +3 -1
- package/cli/repl/print-version.js +21 -2
- package/cli/repl/server/connection.d.ts +3 -0
- package/cli/repl/server/connection.js +65 -31
- package/cli/repl/server/messages/message-analysis.d.ts +10 -0
- package/cli/repl/server/messages/message-analysis.js +6 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/script-core/summarizer-core.js +13 -32
- package/cli/wiki.d.ts +3 -1
- package/cli/wiki.js +6 -1
- package/config.d.ts +22 -10
- package/config.js +33 -7
- package/control-flow/diff-cfg.d.ts +1 -1
- package/control-flow/diff-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/control-flow/simple-visitor.js +6 -5
- package/control-flow/useless-loop.js +2 -2
- package/core/print/dataflow-printer.d.ts +2 -2
- package/core/print/dataflow-printer.js +2 -2
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/dataflow/environments/append.d.ts +2 -2
- package/dataflow/environments/append.js +4 -10
- package/dataflow/environments/apply-kill.d.ts +21 -0
- package/dataflow/environments/apply-kill.js +155 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in.d.ts +4 -0
- package/dataflow/environments/built-in.js +4 -0
- package/dataflow/environments/default-builtin-config.d.ts +183 -67
- package/dataflow/environments/default-builtin-config.js +358 -147
- package/dataflow/environments/environment.d.ts +49 -31
- package/dataflow/environments/environment.js +144 -25
- package/dataflow/environments/identifier.d.ts +65 -2
- package/dataflow/environments/identifier.js +37 -2
- package/dataflow/environments/overwrite.js +2 -10
- package/dataflow/environments/reference-to-maybe.d.ts +2 -0
- package/dataflow/environments/reference-to-maybe.js +56 -11
- package/dataflow/environments/resolve-by-name.d.ts +1 -1
- package/dataflow/environments/resolve-by-name.js +23 -9
- package/dataflow/environments/scoping.d.ts +9 -2
- package/dataflow/environments/scoping.js +15 -2
- package/dataflow/eval/values/general.js +4 -0
- package/dataflow/extractor.js +35 -4
- package/dataflow/graph/df-helper.d.ts +14 -0
- package/dataflow/graph/df-helper.js +41 -0
- package/dataflow/graph/graph.d.ts +4 -1
- package/dataflow/graph/graph.js +6 -2
- package/dataflow/info.d.ts +27 -1
- package/dataflow/internal/linker.d.ts +5 -1
- package/dataflow/internal/linker.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +61 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +132 -25
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +11 -4
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +23 -0
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-origin.js +1 -1
- package/dataflow/processor.d.ts +6 -0
- package/documentation/data/faq/faqs.d.ts +2 -1
- package/documentation/data/faq/faqs.js +78 -57
- package/documentation/data/interface/doc-writing-code.js +4 -80
- package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
- package/documentation/data/server/doc-data-server-messages.js +15 -7
- package/documentation/doc-readme.js +15 -15
- package/documentation/doc-util/doc-cfg.d.ts +3 -1
- package/documentation/doc-util/doc-cfg.js +3 -3
- package/documentation/doc-util/doc-dfg.d.ts +3 -1
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-files.d.ts +3 -1
- package/documentation/doc-util/doc-files.js +9 -6
- package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +2 -1
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -0
- package/documentation/doc-util/doc-structure.js +1 -2
- package/documentation/doc-util/doc-types.d.ts +6 -6
- package/documentation/doc-util/doc-types.js +11 -9
- package/documentation/issue-linting-rule.js +1 -2
- package/documentation/wiki-analyzer.js +9 -9
- package/documentation/wiki-cfg.js +40 -41
- package/documentation/wiki-core.js +121 -32
- package/documentation/wiki-create-linting-rules.d.ts +6 -0
- package/documentation/wiki-create-linting-rules.js +95 -0
- package/documentation/wiki-dataflow-graph.js +112 -77
- package/documentation/wiki-engine.js +1 -2
- package/documentation/wiki-faq.d.ts +2 -1
- package/documentation/wiki-faq.js +4 -4
- package/documentation/wiki-interface.js +22 -8
- package/documentation/wiki-linter.d.ts +1 -1
- package/documentation/wiki-linter.js +16 -6
- package/documentation/wiki-linting-and-testing.js +2 -2
- package/documentation/wiki-mk/doc-context.d.ts +3 -3
- package/documentation/wiki-mk/doc-maker.d.ts +2 -0
- package/documentation/wiki-mk/doc-maker.js +7 -1
- package/documentation/wiki-normalized-ast.js +5 -5
- package/documentation/wiki-onboarding.d.ts +2 -1
- package/documentation/wiki-onboarding.js +5 -5
- package/documentation/wiki-overview.js +4 -17
- package/documentation/wiki-package-database.d.ts +9 -0
- package/documentation/wiki-package-database.js +63 -0
- package/documentation/wiki-query.js +86 -84
- package/documentation/wiki-search.js +4 -5
- package/documentation/wiki-setup.js +6 -7
- package/gas.d.ts +74 -0
- package/gas.js +18 -0
- package/linter/linter-executor.js +2 -8
- package/linter/linter-format.d.ts +4 -11
- package/linter/linter-rules.d.ts +111 -86
- package/linter/linter-rules.js +9 -1
- package/linter/rules/absolute-path.d.ts +2 -7
- package/linter/rules/absolute-path.js +8 -5
- package/linter/rules/dataframe-access-validation.d.ts +1 -6
- package/linter/rules/dataframe-access-validation.js +8 -6
- package/linter/rules/dead-code.d.ts +2 -11
- package/linter/rules/dead-code.js +16 -11
- package/linter/rules/deprecated-functions.d.ts +3 -3
- package/linter/rules/file-path-validity.d.ts +1 -6
- package/linter/rules/file-path-validity.js +5 -5
- package/linter/rules/function-finder-util.d.ts +7 -11
- package/linter/rules/function-finder-util.js +9 -6
- package/linter/rules/naming-convention.d.ts +2 -7
- package/linter/rules/naming-convention.js +3 -2
- package/linter/rules/network-functions.d.ts +2 -7
- package/linter/rules/network-functions.js +14 -12
- package/linter/rules/no-leaked-credentials.d.ts +36 -0
- package/linter/rules/no-leaked-credentials.js +75 -0
- package/linter/rules/problematic-inputs.d.ts +1 -8
- package/linter/rules/problematic-inputs.js +5 -4
- package/linter/rules/roxygen-arguments.d.ts +2 -7
- package/linter/rules/roxygen-arguments.js +13 -20
- package/linter/rules/seeded-randomness.d.ts +2 -7
- package/linter/rules/seeded-randomness.js +7 -4
- package/linter/rules/software-has-license.d.ts +31 -0
- package/linter/rules/software-has-license.js +46 -0
- package/linter/rules/software-has-tests.d.ts +38 -0
- package/linter/rules/software-has-tests.js +48 -0
- package/linter/rules/stop-with-call-arg.d.ts +2 -7
- package/linter/rules/stop-with-call-arg.js +3 -2
- package/linter/rules/undefined-symbol.d.ts +39 -0
- package/linter/rules/undefined-symbol.js +80 -0
- package/linter/rules/unused-definition.d.ts +3 -8
- package/linter/rules/unused-definition.js +7 -5
- package/linter/rules/useless-loop.d.ts +2 -7
- package/linter/rules/useless-loop.js +5 -2
- package/package.json +5 -5
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +9 -1
- package/project/context/flowr-analyzer-context.d.ts +13 -14
- package/project/context/flowr-analyzer-context.js +4 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
- package/project/context/flowr-analyzer-dependencies-context.js +36 -4
- package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
- package/project/context/flowr-analyzer-environment-context.js +3 -4
- package/project/context/flowr-analyzer-files-context.d.ts +13 -0
- package/project/context/flowr-analyzer-files-context.js +12 -2
- package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
- package/project/context/flowr-analyzer-gas-context.js +101 -0
- package/project/context/flowr-file.d.ts +2 -0
- package/project/context/flowr-file.js +2 -0
- package/project/flowr-analyzer-builder.js +3 -0
- package/project/flowr-analyzer.d.ts +2 -1
- package/project/flowr-analyzer.js +3 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
- package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
- package/project/plugins/flowr-analyzer-plugin.js +14 -7
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
- package/project/plugins/package-version-plugins/package.d.ts +3 -0
- package/project/plugins/package-version-plugins/package.js +12 -0
- package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
- package/project/plugins/package-version-plugins/pkgdb.js +370 -0
- package/project/plugins/plugin-registry.d.ts +5 -1
- package/project/plugins/plugin-registry.js +10 -1
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +62 -8
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -2
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
- package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
- package/queries/catalog/dice-query/dice-query-executor.js +52 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
- package/queries/catalog/dice-query/dice-query-format.js +102 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
- package/queries/catalog/linter-query/linter-query-executor.js +8 -0
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +1 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
- package/queries/query.d.ts +18 -1
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +7 -2
- package/r-bridge/data/data.js +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
- package/r-bridge/parser.js +2 -9
- package/r-bridge/shell.d.ts +8 -1
- package/r-bridge/shell.js +26 -7
- package/search/flowr-search-builder.d.ts +2 -2
- package/search/flowr-search-builder.js +1 -1
- package/search/flowr-search-filters.d.ts +30 -9
- package/search/flowr-search-filters.js +26 -21
- package/search/search-executor/search-enrichers.d.ts +601 -1
- package/search/search-executor/search-enrichers.js +30 -6
- package/slicing/static/static-slicer.d.ts +39 -11
- package/slicing/static/static-slicer.js +44 -14
- package/util/collections/queue.d.ts +16 -0
- package/util/collections/queue.js +38 -0
- package/util/log.d.ts +1 -1
- package/util/log.js +1 -1
- package/util/mermaid/dfg.d.ts +2 -2
- package/util/mermaid/dfg.js +2 -2
- package/util/mermaid/mermaid.d.ts +4 -0
- package/util/mermaid/mermaid.js +8 -1
- package/util/objects.d.ts +9 -0
- package/util/objects.js +54 -0
- package/util/proc.d.ts +6 -0
- package/util/proc.js +20 -0
- package/util/version.js +10 -2
- package/cli/common/features.d.ts +0 -9
- package/cli/common/features.js +0 -35
- package/cli/script-core/statistics-core.d.ts +0 -6
- package/cli/script-core/statistics-core.js +0 -103
- package/cli/script-core/statistics-helper-core.d.ts +0 -6
- package/cli/script-core/statistics-helper-core.js +0 -85
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -16
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -14
- package/statistics/features/common-syntax-probability.d.ts +0 -38
- package/statistics/features/common-syntax-probability.js +0 -169
- package/statistics/features/feature.d.ts +0 -179
- package/statistics/features/feature.js +0 -38
- package/statistics/features/post-processing.d.ts +0 -18
- package/statistics/features/post-processing.js +0 -26
- package/statistics/features/supported/assignments/assignments.d.ts +0 -12
- package/statistics/features/supported/assignments/assignments.js +0 -56
- package/statistics/features/supported/assignments/post-process.d.ts +0 -6
- package/statistics/features/supported/assignments/post-process.js +0 -126
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -143
- package/statistics/features/supported/comments/post-process.d.ts +0 -6
- package/statistics/features/supported/comments/post-process.js +0 -51
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -69
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
- package/statistics/features/supported/control-flow/post-process.js +0 -66
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -122
- package/statistics/features/supported/data-access/post-process.d.ts +0 -6
- package/statistics/features/supported/data-access/post-process.js +0 -108
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -168
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
- package/statistics/features/supported/expression-list/post-process.js +0 -45
- package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -81
- package/statistics/features/supported/loops/post-process.d.ts +0 -6
- package/statistics/features/supported/loops/post-process.js +0 -73
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -176
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -99
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
- package/statistics/features/supported/used-packages/post-process.js +0 -122
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -140
- package/statistics/features/supported/values/post-process.d.ts +0 -6
- package/statistics/features/supported/values/post-process.js +0 -73
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -111
- package/statistics/features/supported/variables/post-process.d.ts +0 -15
- package/statistics/features/supported/variables/post-process.js +0 -126
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -62
- package/statistics/meta-statistics.d.ts +0 -32
- package/statistics/meta-statistics.js +0 -16
- package/statistics/output/file-provider.d.ts +0 -36
- package/statistics/output/file-provider.js +0 -96
- package/statistics/output/print-stats.d.ts +0 -29
- package/statistics/output/print-stats.js +0 -81
- package/statistics/output/statistics-file.d.ts +0 -36
- package/statistics/output/statistics-file.js +0 -68
- package/statistics/statistics.d.ts +0 -29
- package/statistics/statistics.js +0 -108
- package/statistics/summarizer/auto-detect.d.ts +0 -5
- package/statistics/summarizer/auto-detect.js +0 -34
- package/statistics/summarizer/first-phase/process.d.ts +0 -6
- package/statistics/summarizer/first-phase/process.js +0 -81
- package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
- package/statistics/summarizer/post-process/clusterer.js +0 -40
- package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
- package/statistics/summarizer/post-process/file-based-count.js +0 -47
- package/statistics/summarizer/post-process/histogram.d.ts +0 -57
- package/statistics/summarizer/post-process/histogram.js +0 -126
- package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
- package/statistics/summarizer/post-process/post-process-output.js +0 -102
- package/statistics/summarizer/second-phase/process.d.ts +0 -15
- package/statistics/summarizer/second-phase/process.js +0 -118
- package/statistics/summarizer/summarizer.d.ts +0 -34
- package/statistics/summarizer/summarizer.js +0 -141
|
@@ -10,10 +10,8 @@ export interface NamespaceInfo {
|
|
|
10
10
|
exportedPatterns: string[];
|
|
11
11
|
importedPackages: Map<string, string[] | 'all'>;
|
|
12
12
|
loadsWithSideEffects: boolean;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* about which parts are only active with given conditions!
|
|
16
|
-
*/
|
|
13
|
+
callable: string[];
|
|
14
|
+
/** Present only in complex parsed NAMESPACE files. Maps conditions to the parts they gate. */
|
|
17
15
|
conditional?: Map<RNode<ParentInformation>, NamespaceInfo>;
|
|
18
16
|
}
|
|
19
17
|
export interface NamespaceFormat {
|
|
@@ -21,20 +19,15 @@ export interface NamespaceFormat {
|
|
|
21
19
|
[packageName: string]: NamespaceInfo;
|
|
22
20
|
}
|
|
23
21
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
22
|
+
* Decorates a text file to expose its content as a {@link NamespaceFormat}.
|
|
23
|
+
* Simple parsing is quicker but does not support `if`/other R constructs.
|
|
26
24
|
*/
|
|
27
25
|
export declare class FlowrNamespaceFile extends FlowrFile<NamespaceFormat> {
|
|
28
26
|
private readonly wrapped;
|
|
29
27
|
private readonly ctx;
|
|
30
|
-
/**
|
|
31
|
-
* Prefer the static {@link FlowrNamespaceFile.from} method to create instances of this class as it will not re-create if already a namespace file
|
|
32
|
-
* and handle role assignments.
|
|
33
|
-
*/
|
|
28
|
+
/** Prefer {@link FlowrNamespaceFile.from}, which avoids re-wrapping and handles roles. */
|
|
34
29
|
constructor(file: FlowrFileProvider, ctx?: FlowrAnalyzerContext);
|
|
35
|
-
/**
|
|
36
|
-
* Creates a {@link FlowrNamespaceFile} from a given {@link NamespaceFormat}, path and optional roles. This is useful if you already have the namespace content parsed and want to create a namespace file instance without re-parsing.
|
|
37
|
-
*/
|
|
30
|
+
/** Creates a {@link FlowrNamespaceFile} from an already-parsed {@link NamespaceFormat}. */
|
|
38
31
|
static fromNamespaceFormat(fmt: NamespaceFormat, path: string, roles?: FileRole[]): FlowrNamespaceFile;
|
|
39
32
|
/**
|
|
40
33
|
* Loads and parses the content of the wrapped file in the {@link NamespaceFormat}.
|
|
@@ -50,8 +43,7 @@ export declare class FlowrNamespaceFile extends FlowrFile<NamespaceFormat> {
|
|
|
50
43
|
*/
|
|
51
44
|
isExported(name: string, pkg?: string): boolean | RNode<ParentInformation>[];
|
|
52
45
|
/**
|
|
53
|
-
*
|
|
54
|
-
* and handles role assignments.
|
|
46
|
+
* Lifts a file to a {@link FlowrNamespaceFile}, reusing it if already one and assigning roles.
|
|
55
47
|
* @param file - The file to lift or return if already a namespace file
|
|
56
48
|
* @param ctx - An optional analyzer context to use for complex parsing
|
|
57
49
|
* @param role - An optional role to assign to the file
|
|
@@ -73,3 +65,9 @@ export declare function isExportedInNamespaceFormat(this: void, fmt: NamespaceFo
|
|
|
73
65
|
* @param nsInfo - The namespace info to check in
|
|
74
66
|
*/
|
|
75
67
|
export declare function isExportedInInfo(this: void, name: string, nsInfo: NamespaceInfo): boolean | RNode<ParentInformation>[];
|
|
68
|
+
/** All exported names of a namespace that can be referenced (functions, symbols, patterns and S3 methods as `generic.class`). */
|
|
69
|
+
export declare function getExportedNames(info: NamespaceInfo): string[];
|
|
70
|
+
/** The names a package makes callable: the explicitly configured {@link NamespaceInfo#callable} subset, or all exports (see {@link getExportedNames}) by default. */
|
|
71
|
+
export declare function getCallables(info: NamespaceInfo): string[];
|
|
72
|
+
/** Sets the given list of strings as callable functions */
|
|
73
|
+
export declare function setCallable(info: NamespaceInfo, func: string[]): NamespaceInfo;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FlowrNamespaceFile = void 0;
|
|
4
4
|
exports.isExportedInNamespaceFormat = isExportedInNamespaceFormat;
|
|
5
5
|
exports.isExportedInInfo = isExportedInInfo;
|
|
6
|
+
exports.getExportedNames = getExportedNames;
|
|
7
|
+
exports.getCallables = getCallables;
|
|
8
|
+
exports.setCallable = setCallable;
|
|
6
9
|
const flowr_file_1 = require("../../../context/flowr-file");
|
|
7
10
|
const resolve_args_1 = require("../../../../abstract-interpretation/data-frame/resolve-args");
|
|
8
11
|
const retriever_1 = require("../../../../r-bridge/retriever");
|
|
@@ -15,24 +18,19 @@ const make_argument_1 = require("../../../../dataflow/internal/process/functions
|
|
|
15
18
|
const range_1 = require("../../../../util/range");
|
|
16
19
|
const r_regex_1 = require("../../../../util/r-regex");
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
21
|
+
* Decorates a text file to expose its content as a {@link NamespaceFormat}.
|
|
22
|
+
* Simple parsing is quicker but does not support `if`/other R constructs.
|
|
20
23
|
*/
|
|
21
24
|
class FlowrNamespaceFile extends flowr_file_1.FlowrFile {
|
|
22
25
|
wrapped;
|
|
23
26
|
ctx;
|
|
24
|
-
/**
|
|
25
|
-
* Prefer the static {@link FlowrNamespaceFile.from} method to create instances of this class as it will not re-create if already a namespace file
|
|
26
|
-
* and handle role assignments.
|
|
27
|
-
*/
|
|
27
|
+
/** Prefer {@link FlowrNamespaceFile.from}, which avoids re-wrapping and handles roles. */
|
|
28
28
|
constructor(file, ctx) {
|
|
29
29
|
super(file.path(), file.roles);
|
|
30
30
|
this.wrapped = file;
|
|
31
31
|
this.ctx = ctx;
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates a {@link FlowrNamespaceFile} from a given {@link NamespaceFormat}, path and optional roles. This is useful if you already have the namespace content parsed and want to create a namespace file instance without re-parsing.
|
|
35
|
-
*/
|
|
33
|
+
/** Creates a {@link FlowrNamespaceFile} from an already-parsed {@link NamespaceFormat}. */
|
|
36
34
|
static fromNamespaceFormat(fmt, path, roles) {
|
|
37
35
|
const file = new FlowrNamespaceFile(new flowr_file_1.FlowrTextFile(path, roles));
|
|
38
36
|
file.setContent(fmt);
|
|
@@ -57,8 +55,7 @@ class FlowrNamespaceFile extends flowr_file_1.FlowrFile {
|
|
|
57
55
|
return isExportedInNamespaceFormat(fmt, name, pkg);
|
|
58
56
|
}
|
|
59
57
|
/**
|
|
60
|
-
*
|
|
61
|
-
* and handles role assignments.
|
|
58
|
+
* Lifts a file to a {@link FlowrNamespaceFile}, reusing it if already one and assigning roles.
|
|
62
59
|
* @param file - The file to lift or return if already a namespace file
|
|
63
60
|
* @param ctx - An optional analyzer context to use for complex parsing
|
|
64
61
|
* @param role - An optional role to assign to the file
|
|
@@ -99,7 +96,6 @@ function isExportedInInfo(name, nsInfo) {
|
|
|
99
96
|
}
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
|
-
// pattern
|
|
103
99
|
for (const pattern of nsInfo.exportedPatterns) {
|
|
104
100
|
const regex = (0, r_regex_1.parseRRegexPattern)(pattern);
|
|
105
101
|
if (regex.test(name)) {
|
|
@@ -107,7 +103,6 @@ function isExportedInInfo(name, nsInfo) {
|
|
|
107
103
|
}
|
|
108
104
|
}
|
|
109
105
|
if (nsInfo.conditional) {
|
|
110
|
-
// nested with recursion
|
|
111
106
|
for (const [cond, info] of nsInfo.conditional) {
|
|
112
107
|
const res = isExportedInInfo(name, info);
|
|
113
108
|
if (res === true) {
|
|
@@ -196,6 +191,30 @@ function parseNamespaceComplex(file, ctx) {
|
|
|
196
191
|
}
|
|
197
192
|
});
|
|
198
193
|
}
|
|
194
|
+
/** All exported names of a namespace that can be referenced (functions, symbols, patterns and S3 methods as `generic.class`). */
|
|
195
|
+
function getExportedNames(info) {
|
|
196
|
+
const s3 = [];
|
|
197
|
+
for (const [g, methods] of info.exportS3Generics) {
|
|
198
|
+
for (const m of methods) {
|
|
199
|
+
s3.push(`${g}.${m}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return [...new Set([...info.exportedSymbols, ...info.exportedFunctions, ...info.exportedPatterns, ...s3])];
|
|
203
|
+
}
|
|
204
|
+
/** The names a package makes callable: the explicitly configured {@link NamespaceInfo#callable} subset, or all exports (see {@link getExportedNames}) by default. */
|
|
205
|
+
function getCallables(info) {
|
|
206
|
+
return info.callable.length > 0 ? info.callable : getExportedNames(info);
|
|
207
|
+
}
|
|
208
|
+
/** Sets the given list of strings as callable functions */
|
|
209
|
+
function setCallable(info, func) {
|
|
210
|
+
const all = new Set(getExportedNames(info));
|
|
211
|
+
for (const f of func) {
|
|
212
|
+
if (all.has(f)) {
|
|
213
|
+
info.callable.push(f);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return info;
|
|
217
|
+
}
|
|
199
218
|
function handleConditionCall(idMap, cond, thenBranch, elseBranch) {
|
|
200
219
|
const g = getEmptyNamespaceFormat();
|
|
201
220
|
const condMap = g.current.conditional ?? new Map();
|
|
@@ -302,6 +321,7 @@ function handleUseDynLibCall(g, args) {
|
|
|
302
321
|
exportS3Generics: new Map(),
|
|
303
322
|
exportedPatterns: [],
|
|
304
323
|
importedPackages: new Map(),
|
|
324
|
+
callable: [],
|
|
305
325
|
loadsWithSideEffects: false,
|
|
306
326
|
};
|
|
307
327
|
}
|
|
@@ -325,6 +345,7 @@ function getEmptyNamespaceFormat() {
|
|
|
325
345
|
exportS3Generics: new Map(),
|
|
326
346
|
exportedPatterns: [],
|
|
327
347
|
importedPackages: new Map(),
|
|
348
|
+
callable: [],
|
|
328
349
|
loadsWithSideEffects: false,
|
|
329
350
|
},
|
|
330
351
|
};
|
|
@@ -388,6 +409,7 @@ function mergeNamespaceInfo(target, source) {
|
|
|
388
409
|
}
|
|
389
410
|
}
|
|
390
411
|
return {
|
|
412
|
+
callable: [...target.callable, ...source.callable],
|
|
391
413
|
exportedSymbols: [...target.exportedSymbols, ...source.exportedSymbols],
|
|
392
414
|
exportedFunctions: [...target.exportedFunctions, ...source.exportedFunctions],
|
|
393
415
|
exportS3Generics: mergedS3Generics,
|
|
@@ -447,6 +469,7 @@ function parseNamespaceSimple(file) {
|
|
|
447
469
|
exportS3Generics: new Map(),
|
|
448
470
|
exportedPatterns: [],
|
|
449
471
|
importedPackages: new Map(),
|
|
472
|
+
callable: [],
|
|
450
473
|
loadsWithSideEffects: false,
|
|
451
474
|
};
|
|
452
475
|
}
|
|
@@ -1,42 +1,48 @@
|
|
|
1
1
|
import type { FlowrFileProvider } from '../../../context/flowr-file';
|
|
2
2
|
import { FlowrFile } from '../../../context/flowr-file';
|
|
3
3
|
import { type Node } from 'commonmark';
|
|
4
|
+
import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-context';
|
|
4
5
|
/**
|
|
5
6
|
* This decorates a text file and parses its contents as a R Markdown file.
|
|
6
7
|
* Finally, it provides access to the single cells, and all cells fused together as one R file.
|
|
7
8
|
*/
|
|
8
9
|
export declare class FlowrRMarkdownFile extends FlowrFile<string> {
|
|
9
10
|
private data?;
|
|
11
|
+
private mergedCode?;
|
|
10
12
|
private readonly wrapped;
|
|
13
|
+
private readonly context;
|
|
11
14
|
/**
|
|
12
15
|
* Prefer the static {@link FlowrRMarkdownFile.from} method
|
|
13
16
|
* @param file - the file to load as R Markdown
|
|
14
17
|
*/
|
|
15
|
-
constructor(file: FlowrFileProvider<string
|
|
18
|
+
constructor(file: FlowrFileProvider<string>, ctx: FlowrAnalyzerContext);
|
|
16
19
|
/**
|
|
17
20
|
* Gets the parsed R Markdown information
|
|
18
21
|
*/
|
|
19
22
|
get rmd(): RmdInfo;
|
|
23
|
+
get executableCells(): CodeBlock[];
|
|
20
24
|
/**
|
|
21
25
|
* Loads and parses the content of the wrapped file.
|
|
22
26
|
* @returns RmdInfo
|
|
23
27
|
*/
|
|
24
28
|
protected loadContent(): string;
|
|
25
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Postprocess blocks with options like child='other.Rmd'
|
|
31
|
+
*/
|
|
32
|
+
private postProcessCodeBlocks;
|
|
33
|
+
static from(file: FlowrFileProvider<string> | FlowrRMarkdownFile, ctx: FlowrAnalyzerContext): FlowrRMarkdownFile;
|
|
26
34
|
}
|
|
27
35
|
export type CodeBlockOptions = Map<string, string>;
|
|
28
36
|
export interface CodeBlock {
|
|
29
37
|
options: CodeBlockOptions;
|
|
30
38
|
code: string;
|
|
31
|
-
|
|
32
|
-
export type CodeBlockEx = CodeBlock & {
|
|
39
|
+
header: string;
|
|
33
40
|
startpos: {
|
|
34
41
|
line: number;
|
|
35
42
|
col: number;
|
|
36
43
|
};
|
|
37
|
-
}
|
|
44
|
+
}
|
|
38
45
|
export interface RmdInfo {
|
|
39
|
-
content: string;
|
|
40
46
|
blocks: CodeBlock[];
|
|
41
47
|
options: object;
|
|
42
48
|
}
|
|
@@ -56,7 +62,7 @@ export declare function isRCodeBlock(node: Node): node is Node & {
|
|
|
56
62
|
/**
|
|
57
63
|
* Restores an Rmd file from code blocks, filling non-code lines with empty lines
|
|
58
64
|
*/
|
|
59
|
-
export declare function restoreBlocksWithoutMd(blocks:
|
|
65
|
+
export declare function restoreBlocksWithoutMd(blocks: readonly CodeBlock[], totalLines: number): string;
|
|
60
66
|
/**
|
|
61
67
|
* Parses the options of an R code block from its header and content
|
|
62
68
|
*/
|
|
@@ -13,20 +13,24 @@ const assert_1 = require("../../../../util/assert");
|
|
|
13
13
|
const commonmark_1 = require("commonmark");
|
|
14
14
|
const gray_matter_1 = __importDefault(require("gray-matter"));
|
|
15
15
|
const log_1 = require("../../../../util/log");
|
|
16
|
+
const built_in_source_1 = require("../../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
16
17
|
/**
|
|
17
18
|
* This decorates a text file and parses its contents as a R Markdown file.
|
|
18
19
|
* Finally, it provides access to the single cells, and all cells fused together as one R file.
|
|
19
20
|
*/
|
|
20
21
|
class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
|
|
21
22
|
data;
|
|
23
|
+
mergedCode;
|
|
22
24
|
wrapped;
|
|
25
|
+
context;
|
|
23
26
|
/**
|
|
24
27
|
* Prefer the static {@link FlowrRMarkdownFile.from} method
|
|
25
28
|
* @param file - the file to load as R Markdown
|
|
26
29
|
*/
|
|
27
|
-
constructor(file) {
|
|
30
|
+
constructor(file, ctx) {
|
|
28
31
|
super(file.path(), file.roles ? [...file.roles, flowr_file_1.FileRole.Source] : [flowr_file_1.FileRole.Source]);
|
|
29
32
|
this.wrapped = file;
|
|
33
|
+
this.context = ctx;
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
32
36
|
* Gets the parsed R Markdown information
|
|
@@ -35,19 +39,62 @@ class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
|
|
|
35
39
|
if (!this.data) {
|
|
36
40
|
this.loadContent();
|
|
37
41
|
}
|
|
38
|
-
(0, assert_1.guard)(this.data);
|
|
42
|
+
(0, assert_1.guard)(this.data !== undefined);
|
|
39
43
|
return this.data;
|
|
40
44
|
}
|
|
45
|
+
get executableCells() {
|
|
46
|
+
return this.rmd.blocks.filter(b => {
|
|
47
|
+
const opt = b.options.get('eval');
|
|
48
|
+
return opt !== 'F' && opt !== 'FALSE';
|
|
49
|
+
});
|
|
50
|
+
}
|
|
41
51
|
/**
|
|
42
52
|
* Loads and parses the content of the wrapped file.
|
|
43
53
|
* @returns RmdInfo
|
|
44
54
|
*/
|
|
45
55
|
loadContent() {
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
const raw = this.wrapped.content();
|
|
57
|
+
this.data = parseRMarkdownFile(raw);
|
|
58
|
+
this.postProcessCodeBlocks();
|
|
59
|
+
this.mergedCode = restoreBlocksWithoutMd(this.data.blocks, countNewlines(raw));
|
|
60
|
+
(0, assert_1.guard)(this.mergedCode !== undefined);
|
|
61
|
+
return this.mergedCode;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Postprocess blocks with options like child='other.Rmd'
|
|
65
|
+
*/
|
|
66
|
+
postProcessCodeBlocks() {
|
|
67
|
+
(0, assert_1.guard)(this.data !== undefined);
|
|
68
|
+
for (const block of this.data.blocks) {
|
|
69
|
+
const childOpt = block.options.get('child');
|
|
70
|
+
if (childOpt === undefined) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const childPath = (0, built_in_source_1.findSource)(this.context.config.solver.resolveSource, childOpt, {
|
|
74
|
+
ctx: this.context,
|
|
75
|
+
referenceChain: [this.path()]
|
|
76
|
+
});
|
|
77
|
+
if (childPath === undefined) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (childPath.length > 1) {
|
|
81
|
+
log_1.log.warn(`Found more than one path for child '${childOpt}' in rmd file '${this.path()}'. Only using the first path: '${childPath[0]}'`);
|
|
82
|
+
}
|
|
83
|
+
this.context.files.resolveRequest({
|
|
84
|
+
request: 'file',
|
|
85
|
+
content: childPath[0]
|
|
86
|
+
});
|
|
87
|
+
const rawChildFile = this.context.files.getFileByPath(childPath[0]);
|
|
88
|
+
if (rawChildFile !== undefined) {
|
|
89
|
+
block.code = FlowrRMarkdownFile.from(rawChildFile, this.context).content();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
log_1.log.warn(`Child file '${childPath[0]}' of '${this.path()}' did not load as RMD.`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
48
95
|
}
|
|
49
|
-
static from(file) {
|
|
50
|
-
return file instanceof FlowrRMarkdownFile ? file : new FlowrRMarkdownFile(file);
|
|
96
|
+
static from(file, ctx) {
|
|
97
|
+
return file instanceof FlowrRMarkdownFile ? file : new FlowrRMarkdownFile(file, ctx);
|
|
51
98
|
}
|
|
52
99
|
}
|
|
53
100
|
exports.FlowrRMarkdownFile = FlowrRMarkdownFile;
|
|
@@ -86,13 +133,12 @@ function parseRMarkdownFile(raw) {
|
|
|
86
133
|
blocks.push({
|
|
87
134
|
code: node.literal,
|
|
88
135
|
options: options,
|
|
136
|
+
header: node.info,
|
|
89
137
|
startpos: { line: node.sourcepos[0][0] + 1, col: 0 }
|
|
90
138
|
});
|
|
91
139
|
}
|
|
92
140
|
return {
|
|
93
|
-
|
|
94
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
95
|
-
blocks: blocks.map(({ startpos, ...block }) => block),
|
|
141
|
+
blocks: blocks,
|
|
96
142
|
options: frontmatter?.data ?? {}
|
|
97
143
|
};
|
|
98
144
|
}
|
|
@@ -115,8 +161,7 @@ function restoreBlocksWithoutMd(blocks, totalLines) {
|
|
|
115
161
|
let line = 1;
|
|
116
162
|
let output = '';
|
|
117
163
|
const goToLine = (n) => {
|
|
118
|
-
const diff = n - line;
|
|
119
|
-
(0, assert_1.guard)(diff >= 0);
|
|
164
|
+
const diff = Math.max(n - line, 0);
|
|
120
165
|
line += diff;
|
|
121
166
|
output += '\n'.repeat(diff);
|
|
122
167
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FlowrAnalyzerFilePlugin } from './flowr-analyzer-file-plugin';
|
|
2
|
+
import { SemVer } from 'semver';
|
|
3
|
+
import type { PathLike } from 'fs';
|
|
4
|
+
import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
|
|
5
|
+
import type { FlowrFileProvider } from '../../context/flowr-file';
|
|
6
|
+
/**
|
|
7
|
+
* Tags a project's virtual-environment lockfiles (e.g. `renv.lock`, `rv.lock`) with the
|
|
8
|
+
* {@link FileRole.VirtualEnv} role, so the version plugins that read them (renv/rv) can look them up
|
|
9
|
+
* by role instead of scanning every project file.
|
|
10
|
+
*/
|
|
11
|
+
export declare class FlowrAnalyzerVirtualEnvFilePlugin extends FlowrAnalyzerFilePlugin {
|
|
12
|
+
readonly name = "flowr-analyzer-virtualenv-files-plugin";
|
|
13
|
+
readonly description = "This plugin marks virtual-environment lockfiles (renv.lock, rv.lock).";
|
|
14
|
+
readonly version: SemVer;
|
|
15
|
+
private readonly pathPattern;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new instance of the virtual-environment file plugin.
|
|
18
|
+
* @param pathPattern - The pattern to identify lockfiles, see {@link VirtualEnvFilePattern} for the default.
|
|
19
|
+
*/
|
|
20
|
+
constructor(pathPattern?: RegExp);
|
|
21
|
+
applies(file: PathLike): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Processes the given file, assigning it the {@link FileRole.VirtualEnv} role. The file may still be
|
|
24
|
+
* relevant to other plugins, so this returns the `true` flag to keep the loader chain going.
|
|
25
|
+
*/
|
|
26
|
+
process(_ctx: FlowrAnalyzerContext, file: FlowrFileProvider): [FlowrFileProvider, true];
|
|
27
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowrAnalyzerVirtualEnvFilePlugin = void 0;
|
|
4
|
+
const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
const flowr_file_1 = require("../../context/flowr-file");
|
|
7
|
+
const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
8
|
+
/** Lockfiles pinning a project's package environment (`renv.lock`, `rv.lock`). */
|
|
9
|
+
const VirtualEnvFilePattern = /^(renv|rv)\.lock$/i;
|
|
10
|
+
/**
|
|
11
|
+
* Tags a project's virtual-environment lockfiles (e.g. `renv.lock`, `rv.lock`) with the
|
|
12
|
+
* {@link FileRole.VirtualEnv} role, so the version plugins that read them (renv/rv) can look them up
|
|
13
|
+
* by role instead of scanning every project file.
|
|
14
|
+
*/
|
|
15
|
+
class FlowrAnalyzerVirtualEnvFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
|
|
16
|
+
name = 'flowr-analyzer-virtualenv-files-plugin';
|
|
17
|
+
description = 'This plugin marks virtual-environment lockfiles (renv.lock, rv.lock).';
|
|
18
|
+
version = new semver_1.SemVer('0.1.0');
|
|
19
|
+
pathPattern;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new instance of the virtual-environment file plugin.
|
|
22
|
+
* @param pathPattern - The pattern to identify lockfiles, see {@link VirtualEnvFilePattern} for the default.
|
|
23
|
+
*/
|
|
24
|
+
constructor(pathPattern = VirtualEnvFilePattern) {
|
|
25
|
+
super();
|
|
26
|
+
this.pathPattern = pathPattern;
|
|
27
|
+
}
|
|
28
|
+
applies(file) {
|
|
29
|
+
return this.pathPattern.test((0, built_in_source_1.platformBasename)(file.toString()));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Processes the given file, assigning it the {@link FileRole.VirtualEnv} role. The file may still be
|
|
33
|
+
* relevant to other plugins, so this returns the `true` flag to keep the loader chain going.
|
|
34
|
+
*/
|
|
35
|
+
process(_ctx, file) {
|
|
36
|
+
file.assignRole(flowr_file_1.FileRole.VirtualEnv);
|
|
37
|
+
return [file, true];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.FlowrAnalyzerVirtualEnvFilePlugin = FlowrAnalyzerVirtualEnvFilePlugin;
|
|
41
|
+
//# sourceMappingURL=flowr-analyzer-virtualenv-file-plugin.js.map
|
|
@@ -18,5 +18,5 @@ export declare class FlowrAnalyzerQmdFilePlugin extends FlowrAnalyzerFilePlugin
|
|
|
18
18
|
*/
|
|
19
19
|
constructor(filePattern?: RegExp);
|
|
20
20
|
applies(file: PathLike): boolean;
|
|
21
|
-
protected process(
|
|
21
|
+
protected process(ctx: FlowrAnalyzerContext, arg: FlowrFileProvider<string>): FlowrRMarkdownFile;
|
|
22
22
|
}
|
|
@@ -25,8 +25,8 @@ class FlowrAnalyzerQmdFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnaly
|
|
|
25
25
|
applies(file) {
|
|
26
26
|
return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
|
|
27
27
|
}
|
|
28
|
-
process(
|
|
29
|
-
return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg);
|
|
28
|
+
process(ctx, arg) {
|
|
29
|
+
return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg, ctx);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.FlowrAnalyzerQmdFilePlugin = FlowrAnalyzerQmdFilePlugin;
|
|
@@ -4,6 +4,7 @@ import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-conte
|
|
|
4
4
|
import { type FlowrFileProvider } from '../../../context/flowr-file';
|
|
5
5
|
import { FlowrAnalyzerFilePlugin } from '../flowr-analyzer-file-plugin';
|
|
6
6
|
import { FlowrRMarkdownFile } from '../files/flowr-rmarkdown-file';
|
|
7
|
+
export declare const RmdPattern: RegExp;
|
|
7
8
|
/**
|
|
8
9
|
* The plugin provides support for R Markdown (`.rmd`) files
|
|
9
10
|
*/
|
|
@@ -18,5 +19,5 @@ export declare class FlowrAnalyzerRmdFilePlugin extends FlowrAnalyzerFilePlugin
|
|
|
18
19
|
*/
|
|
19
20
|
constructor(filePattern?: RegExp);
|
|
20
21
|
applies(file: PathLike): boolean;
|
|
21
|
-
protected process(
|
|
22
|
+
protected process(ctx: FlowrAnalyzerContext, arg: FlowrFileProvider<string>): FlowrRMarkdownFile;
|
|
22
23
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowrAnalyzerRmdFilePlugin = void 0;
|
|
3
|
+
exports.FlowrAnalyzerRmdFilePlugin = exports.RmdPattern = void 0;
|
|
4
4
|
const semver_1 = require("semver");
|
|
5
5
|
const flowr_analyzer_file_plugin_1 = require("../flowr-analyzer-file-plugin");
|
|
6
6
|
const flowr_rmarkdown_file_1 = require("../files/flowr-rmarkdown-file");
|
|
7
7
|
const built_in_source_1 = require("../../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
8
|
-
|
|
8
|
+
exports.RmdPattern = /\.rmd$/i;
|
|
9
9
|
/**
|
|
10
10
|
* The plugin provides support for R Markdown (`.rmd`) files
|
|
11
11
|
*/
|
|
@@ -18,15 +18,15 @@ class FlowrAnalyzerRmdFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnaly
|
|
|
18
18
|
* Creates a new instance of the R Markdown file plugin.
|
|
19
19
|
* @param filePattern - The pattern to identify R Markdown files, see {@link RmdPattern} for the default pattern.
|
|
20
20
|
*/
|
|
21
|
-
constructor(filePattern = RmdPattern) {
|
|
21
|
+
constructor(filePattern = exports.RmdPattern) {
|
|
22
22
|
super();
|
|
23
23
|
this.pattern = filePattern;
|
|
24
24
|
}
|
|
25
25
|
applies(file) {
|
|
26
26
|
return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
|
|
27
27
|
}
|
|
28
|
-
process(
|
|
29
|
-
return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg);
|
|
28
|
+
process(ctx, arg) {
|
|
29
|
+
return flowr_rmarkdown_file_1.FlowrRMarkdownFile.from(arg, ctx);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.FlowrAnalyzerRmdFilePlugin = FlowrAnalyzerRmdFilePlugin;
|
|
@@ -12,13 +12,14 @@ import type { FlowrAnalyzerContext } from '../context/flowr-analyzer-context';
|
|
|
12
12
|
* │ │ │ │ │ │ │ │ │ │
|
|
13
13
|
* │ *Builder* ├──▶│ Project Discovery ├──▶│ File Loader ├──▶│ Dependencies ├──▶│ *DFA* │
|
|
14
14
|
* │ │ │ (if necessary) │ │ │ │ (static) │ │ │
|
|
15
|
-
* └───────────┘ └───────────────────┘ └──────┬──────┘ └───────────────┘
|
|
16
|
-
* │
|
|
17
|
-
* │ ┌───────────────┐
|
|
18
|
-
* │ │ │
|
|
19
|
-
* └─────────▶│ Loading Order
|
|
20
|
-
* │ │
|
|
21
|
-
* └───────────────┘
|
|
15
|
+
* └───────────┘ └───────────────────┘ └──────┬──────┘ └───────────────┘ └────┬──┘
|
|
16
|
+
* │ ▲│
|
|
17
|
+
* │ ┌───────────────┐ ││
|
|
18
|
+
* │ │ │ ││ on-demand
|
|
19
|
+
* └─────────▶│ Loading Order ├───────┘│
|
|
20
|
+
* │ │ │ ┌───────────┐
|
|
21
|
+
* └───────────────┘ └─▶│ Gas │
|
|
22
|
+
* └───────────┘
|
|
22
23
|
*```
|
|
23
24
|
*
|
|
24
25
|
*/
|
|
@@ -42,7 +43,13 @@ export declare enum PluginType {
|
|
|
42
43
|
* Plugins that are applied to load and parse files.
|
|
43
44
|
* @see {@link FlowrAnalyzerFilePlugin} - for the base class to implement such a plugin.
|
|
44
45
|
*/
|
|
45
|
-
FileLoad = "file-load"
|
|
46
|
+
FileLoad = "file-load",
|
|
47
|
+
/**
|
|
48
|
+
* Plugins that are queried on-demand during analysis to report the current resource-usage pressure level.
|
|
49
|
+
* Multiple Gas plugins are combined by taking the maximum level returned.
|
|
50
|
+
* @see {@link FlowrAnalyzerGasPlugin} - for the base class to implement such a plugin.
|
|
51
|
+
*/
|
|
52
|
+
Gas = "gas"
|
|
46
53
|
}
|
|
47
54
|
/**
|
|
48
55
|
* This is the main interface that every plugin to be used with the {@link FlowrAnalyzer} must comply with.
|
|
@@ -13,13 +13,14 @@ const log_1 = require("../../util/log");
|
|
|
13
13
|
* │ │ │ │ │ │ │ │ │ │
|
|
14
14
|
* │ *Builder* ├──▶│ Project Discovery ├──▶│ File Loader ├──▶│ Dependencies ├──▶│ *DFA* │
|
|
15
15
|
* │ │ │ (if necessary) │ │ │ │ (static) │ │ │
|
|
16
|
-
* └───────────┘ └───────────────────┘ └──────┬──────┘ └───────────────┘
|
|
17
|
-
* │
|
|
18
|
-
* │ ┌───────────────┐
|
|
19
|
-
* │ │ │
|
|
20
|
-
* └─────────▶│ Loading Order
|
|
21
|
-
* │ │
|
|
22
|
-
* └───────────────┘
|
|
16
|
+
* └───────────┘ └───────────────────┘ └──────┬──────┘ └───────────────┘ └────┬──┘
|
|
17
|
+
* │ ▲│
|
|
18
|
+
* │ ┌───────────────┐ ││
|
|
19
|
+
* │ │ │ ││ on-demand
|
|
20
|
+
* └─────────▶│ Loading Order ├───────┘│
|
|
21
|
+
* │ │ │ ┌───────────┐
|
|
22
|
+
* └───────────────┘ └─▶│ Gas │
|
|
23
|
+
* └───────────┘
|
|
23
24
|
*```
|
|
24
25
|
*
|
|
25
26
|
*/
|
|
@@ -45,6 +46,12 @@ var PluginType;
|
|
|
45
46
|
* @see {@link FlowrAnalyzerFilePlugin} - for the base class to implement such a plugin.
|
|
46
47
|
*/
|
|
47
48
|
PluginType["FileLoad"] = "file-load";
|
|
49
|
+
/**
|
|
50
|
+
* Plugins that are queried on-demand during analysis to report the current resource-usage pressure level.
|
|
51
|
+
* Multiple Gas plugins are combined by taking the maximum level returned.
|
|
52
|
+
* @see {@link FlowrAnalyzerGasPlugin} - for the base class to implement such a plugin.
|
|
53
|
+
*/
|
|
54
|
+
PluginType["Gas"] = "gas";
|
|
48
55
|
})(PluginType || (exports.PluginType = PluginType = {}));
|
|
49
56
|
const generalPluginLog = log_1.log.getSubLogger({ name: 'plugins' });
|
|
50
57
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FlowrAnalyzerPlugin, PluginType } from '../flowr-analyzer-plugin';
|
|
2
|
+
import type { GasLevel } from '../../../gas';
|
|
3
|
+
/**
|
|
4
|
+
* Base class for gas plugins, queried on-demand by {@link FlowrAnalyzerGasContext.checkGas}.
|
|
5
|
+
*
|
|
6
|
+
* Override {@link process} to provide a custom resource-pressure assessment for a feature key.
|
|
7
|
+
* Return `undefined` to defer to the built-in memory and time checks.
|
|
8
|
+
* Multiple Gas plugins are combined by taking the maximum ({@link GasLevel}) returned by any plugin
|
|
9
|
+
* or by the built-in checks.
|
|
10
|
+
*
|
|
11
|
+
* A gas plugin is the right place to add domain-specific checks (e.g., CPU, I/O, quota limits)
|
|
12
|
+
* or to override default behavior for testing by returning a hardcoded level.
|
|
13
|
+
* @see {@link PluginType.Gas}
|
|
14
|
+
* @see {@link FlowrAnalyzerGasContext}
|
|
15
|
+
*/
|
|
16
|
+
export declare abstract class FlowrAnalyzerGasPlugin extends FlowrAnalyzerPlugin<string, GasLevel | undefined> {
|
|
17
|
+
readonly type = PluginType.Gas;
|
|
18
|
+
static defaultPlugin(): FlowrAnalyzerGasPlugin;
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowrAnalyzerGasPlugin = void 0;
|
|
4
|
+
const flowr_analyzer_plugin_1 = require("../flowr-analyzer-plugin");
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
/**
|
|
7
|
+
* Base class for gas plugins, queried on-demand by {@link FlowrAnalyzerGasContext.checkGas}.
|
|
8
|
+
*
|
|
9
|
+
* Override {@link process} to provide a custom resource-pressure assessment for a feature key.
|
|
10
|
+
* Return `undefined` to defer to the built-in memory and time checks.
|
|
11
|
+
* Multiple Gas plugins are combined by taking the maximum ({@link GasLevel}) returned by any plugin
|
|
12
|
+
* or by the built-in checks.
|
|
13
|
+
*
|
|
14
|
+
* A gas plugin is the right place to add domain-specific checks (e.g., CPU, I/O, quota limits)
|
|
15
|
+
* or to override default behavior for testing by returning a hardcoded level.
|
|
16
|
+
* @see {@link PluginType.Gas}
|
|
17
|
+
* @see {@link FlowrAnalyzerGasContext}
|
|
18
|
+
*/
|
|
19
|
+
class FlowrAnalyzerGasPlugin extends flowr_analyzer_plugin_1.FlowrAnalyzerPlugin {
|
|
20
|
+
type = flowr_analyzer_plugin_1.PluginType.Gas;
|
|
21
|
+
static defaultPlugin() {
|
|
22
|
+
return new DefaultFlowrAnalyzerGasPlugin();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.FlowrAnalyzerGasPlugin = FlowrAnalyzerGasPlugin;
|
|
26
|
+
/** Default no-op gas plugin that defers all checks to the built-in memory and time logic. */
|
|
27
|
+
class DefaultFlowrAnalyzerGasPlugin extends FlowrAnalyzerGasPlugin {
|
|
28
|
+
name = 'default-gas-plugin';
|
|
29
|
+
description = 'Defers to built-in memory and time checks.';
|
|
30
|
+
version = new semver_1.SemVer('0.0.0');
|
|
31
|
+
process(_ctx, _key) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=flowr-analyzer-gas-plugin.js.map
|