@eagleoutice/flowr 2.13.2 → 2.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -43
- package/abstract-interpretation/absint-visitor.js +2 -2
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +1 -0
- package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +3 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +1 -1
- package/abstract-interpretation/domains/state-domain-like.d.ts +1 -1
- package/abstract-interpretation/unsupported-functions.js +1 -1
- package/config.d.ts +8 -0
- package/config.js +9 -1
- package/control-flow/cfg-dead-code.js +72 -11
- package/control-flow/control-flow-graph.js +2 -1
- package/control-flow/extract-cfg.js +85 -8
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +1 -1
- package/dataflow/environments/append.d.ts +1 -1
- 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 +5 -1
- package/dataflow/environments/built-in.js +5 -1
- package/dataflow/environments/clone.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.d.ts +59 -4
- package/dataflow/environments/default-builtin-config.js +23 -11
- package/dataflow/environments/environment.d.ts +28 -4
- package/dataflow/environments/environment.js +66 -11
- package/dataflow/environments/identifier.d.ts +1 -0
- package/dataflow/environments/overwrite.d.ts +1 -1
- package/dataflow/eval/resolve/alias-tracking.d.ts +3 -1
- package/dataflow/eval/resolve/alias-tracking.js +8 -1
- package/dataflow/eval/resolve/resolve.d.ts +14 -0
- package/dataflow/eval/resolve/resolve.js +47 -0
- package/dataflow/fn/higher-order-function.js +3 -3
- package/dataflow/fn/recursive-function.js +1 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/df-helper.js +1 -1
- package/dataflow/graph/vertex.d.ts +32 -25
- package/dataflow/graph/vertex.js +40 -36
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +14 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +28 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +41 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +14 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +45 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +14 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +80 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +63 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +63 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +29 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +15 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +35 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +55 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +5 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +24 -0
- package/dataflow/internal/process/functions/process-parameter.js +2 -1
- package/documentation/doc-readme.js +14 -12
- package/documentation/doc-util/doc-normalized-ast.d.ts +1 -1
- package/documentation/wiki-dataflow-graph.js +4 -24
- package/documentation/wiki-query.js +47 -0
- package/documentation/wiki-signature-database.js +3 -2
- package/linter/rules/absolute-path.js +1 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/function-finder-util.js +1 -1
- package/linter/rules/no-leaked-credentials.js +1 -1
- package/linter/rules/undefined-symbol-util.js +3 -1
- package/linter/rules/undefined-symbol.js +4 -5
- package/linter/rules/unused-definition.js +15 -10
- package/linter/rules/useless-loop.js +1 -1
- package/package.json +21 -9
- package/project/context/flowr-analyzer-context.d.ts +4 -4
- package/project/context/flowr-analyzer-context.js +3 -3
- package/project/context/flowr-analyzer-dependencies-context.d.ts +11 -5
- package/project/context/flowr-analyzer-dependencies-context.js +8 -3
- package/project/context/flowr-analyzer-meta-context.d.ts +1 -0
- package/project/dependency-version-space.d.ts +118 -26
- package/project/dependency-version-space.js +343 -87
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +8 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +27 -25
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +4 -4
- package/project/plugins/package-version-plugins/package.d.ts +27 -10
- package/project/plugins/package-version-plugins/package.js +50 -25
- package/project/sigdb/reader.d.ts +26 -16
- package/project/sigdb/reader.js +52 -21
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -2
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/write-functions.js +23 -24
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +39 -77
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +12 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +53 -23
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +14 -0
- package/queries/catalog/input-sources-query/input-source-functions.js +109 -20
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +45 -4
- package/queries/catalog/input-sources-query/input-sources-query-format.js +22 -3
- package/queries/catalog/input-sources-query/input-types.d.ts +58 -0
- package/queries/catalog/input-sources-query/input-types.js +64 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +76 -53
- package/queries/catalog/input-sources-query/simple-input-classifier.js +358 -101
- package/queries/catalog/project-query/project-query-executor.js +1 -1
- package/queries/catalog/signature-query/signature-query-executor.d.ts +7 -1
- package/queries/catalog/signature-query/signature-query-executor.js +112 -39
- package/queries/catalog/signature-query/signature-query-format.d.ts +5 -1
- package/queries/catalog/signature-query/signature-query-format.js +1 -1
- package/queries/catalog/signature-query/signature-query-render.js +8 -3
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
- package/r-bridge/retriever.d.ts +1 -1
- package/reconstruct/inline/source-inline-map.js +1 -1
- package/search/flowr-search-printer.js +10 -8
- package/slicing/static/static-slicer.d.ts +2 -2
- package/util/mermaid/dfg.js +1 -1
- package/util/objects.js +6 -4
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +3 -0
- package/util/r-license.js +1 -4
- package/util/r-version.d.ts +12 -0
- package/util/r-version.js +16 -0
- package/util/range.d.ts +6 -2
- package/util/range.js +33 -15
- package/util/version.js +1 -1
|
@@ -19,7 +19,8 @@ function processFunctionParameter(parameter, data) {
|
|
|
19
19
|
type: identifier_1.ReferenceType.Parameter,
|
|
20
20
|
definedAt: parameter.info.id
|
|
21
21
|
}));
|
|
22
|
-
|
|
22
|
+
// keep the default's environment so its escaping (`<<-`) writes are carried on
|
|
23
|
+
let environment = defaultValue?.environment ?? name.environment;
|
|
23
24
|
for (const writtenNode of writtenNodes) {
|
|
24
25
|
const wid = writtenNode.nodeId;
|
|
25
26
|
(0, log_1.expensiveTrace)(log_1.log, () => `parameter ${writtenNode.name} (${wid}) is defined at id ${writtenNode.definedAt} with ${defaultValue === undefined ? 'no default value' : ' a default value'}`);
|
|
@@ -147,6 +147,20 @@ available for ${ctx.linkPage('flowr:vscode', 'VSCode')}, ${ctx.linkPage('flowr:p
|
|
|
147
147
|
and ${ctx.linkPage('flowr:docker', 'Docker')}.
|
|
148
148
|
It offers a wide variety of features, for example:
|
|
149
149
|
|
|
150
|
+
* 📚 **dependency analysis**\\
|
|
151
|
+
Given your analysis project, flowR offers a plethora of so-called ${ctx.linkPage('wiki/Query API', 'queries')} to get more information about your code.
|
|
152
|
+
An important query is the ${(0, doc_query_1.linkToQueryOfName)('dependencies', 'dependencies query')}, which shows you the library your project needs,
|
|
153
|
+
the data files it reads, the scripts it sources, and the data it outputs.
|
|
154
|
+
Building on it, the ${(0, doc_query_1.linkToQueryOfName)('guess-dep-versions', 'guess dependency versions query')} narrows down the version range each
|
|
155
|
+
of these libraries has to have, by combining the constraints your project declares with the functions your code actually calls.
|
|
156
|
+
|
|
157
|
+
${(0, doc_general_1.prefixLines)((0, doc_structure_1.details)('Example: Dependency Analysis with flowR', `
|
|
158
|
+
The following showcases the dependency view of the ${ctx.linkPage('flowr:vscode', 'Visual Studio Code extension')}:
|
|
159
|
+
|
|
160
|
+

|
|
161
|
+
|
|
162
|
+
`), ' ')}
|
|
163
|
+
|
|
150
164
|
* 🐞 **code linting**\\
|
|
151
165
|
Analyze your R scripts for common issues and potential bugs (see the ${ctx.linkPage('wiki/Linter', 'wiki page')} for more information on the currently supported linters).
|
|
152
166
|
|
|
@@ -193,18 +207,6 @@ ${await (0, doc_repl_1.documentReplSession)(treeSitter, [{
|
|
|
193
207
|
|
|
194
208
|
`), ' ')}
|
|
195
209
|
|
|
196
|
-
* 📚 **dependency analysis**\\
|
|
197
|
-
Given your analysis project, flowR offers a plethora of so-called ${ctx.linkPage('wiki/Query API', 'queries')} to get more information about your code.
|
|
198
|
-
An important query is the ${(0, doc_query_1.linkToQueryOfName)('dependencies', 'dependencies query')}, which shows you the library your project needs,
|
|
199
|
-
the data files it reads, the scripts it sources, and the data it outputs.
|
|
200
|
-
|
|
201
|
-
${(0, doc_general_1.prefixLines)((0, doc_structure_1.details)('Example: Dependency Analysis with flowR', `
|
|
202
|
-
The following showcases the dependency view of the ${ctx.linkPage('flowr:vscode', 'Visual Studio Code extension')}:
|
|
203
|
-
|
|
204
|
-

|
|
205
|
-
|
|
206
|
-
`), ' ')}
|
|
207
|
-
|
|
208
210
|
* 🚀 **fast call-graph, data-, and control-flow graphs**\\
|
|
209
211
|
Within just [${'<i>' + (0, html_hover_over_1.textWithTooltip)((0, numbers_1.roundToDecimals)(await (0, doc_benchmarks_1.getLatestDfAnalysisTime)('"social-science" Benchmark Suite (tree-sitter)'), 1) + ' ms', 'This measurement is automatically fetched from the latest benchmark!') + '</i>'} (as of ${new Date(await (0, doc_benchmarks_1.getLastBenchmarkUpdate)()).toLocaleDateString('en-US', dateOptions)})](${doc_files_1.FlowrSiteBaseRef}/wiki/stats/benchmark),
|
|
210
212
|
_flowR_ can analyze the data- and control-flow of the average real-world R script. See the ${ctx.linkPage('flowr:benchmarks', 'benchmarks')} for more information,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ParentInformation, RNodeWithParent } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
2
|
import type { KnownParser } from '../../r-bridge/parser';
|
|
3
3
|
import type { GeneralDocContext } from '../wiki-mk/doc-context';
|
|
4
4
|
import type { RProject } from '../../r-bridge/lang-4.x/ast/model/nodes/r-project';
|
|
@@ -1000,30 +1000,10 @@ Additionally, we get the information that the node with the id 2 was responsible
|
|
|
1000
1000
|
Calling \`library(pkg)\` (or \`require\`) attaches a package to the search path.
|
|
1001
1001
|
Mirroring R's \`search()\`, _flowR_ inserts the package's namespace and imports environments *below* the global environment (\`.GlobalEnv\`), so resolution walks **current scope -> enclosing scopes -> global -> attached packages -> built-ins**.
|
|
1002
1002
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
library(stats) # stats also exports filter()
|
|
1008
|
-
filter(1) # -> resolves to YOUR filter, not stats::filter
|
|
1009
|
-
\`\`\`
|
|
1010
|
-
|
|
1011
|
-
**Most recently attached is nearest, and re-attaching is a no-op:**
|
|
1012
|
-
|
|
1013
|
-
\`\`\`r
|
|
1014
|
-
library(A) # search path (top-down): A
|
|
1015
|
-
library(B) # B, A
|
|
1016
|
-
library(A) # no-op B, A (A is not moved or duplicated)
|
|
1017
|
-
\`\`\`
|
|
1018
|
-
|
|
1019
|
-
**Attaching inside a function propagates to the caller** (R attaches globally), and across branches every possibly-attached package is kept (a sound over-approximation of R's single runtime path):
|
|
1020
|
-
|
|
1021
|
-
\`\`\`r
|
|
1022
|
-
f <- function() library(A) # attaches A when called
|
|
1023
|
-
f()
|
|
1024
|
-
someExportOfA() # -> resolves against A
|
|
1025
|
-
if (cond) library(B) # B is kept (may be attached)
|
|
1026
|
-
\`\`\`
|
|
1003
|
+
A global binding shadows a package export of the same name, exactly as in R.
|
|
1004
|
+
The most recently attached package is the nearest one, and re-attaching neither moves nor duplicates it.
|
|
1005
|
+
The \`pos\` argument attaches further down the search path instead, given either as a position or as the name of an existing entry (an unknown position or name falls back to the default of 2, directly below the global environment).
|
|
1006
|
+
Attaching inside a function propagates to the caller (R attaches globally), and across branches every possibly-attached package is kept (a sound over-approximation of R's single runtime path).
|
|
1027
1007
|
|
|
1028
1008
|
Last but not least, the information contains the single **entry point** (${JSON.stringify(result.entryPoint)}) and a set of **exit points** (${JSON.stringify(result.exitPoints.map(e => e.nodeId))}).
|
|
1029
1009
|
Besides marking potential exits, the exit points also provide information about why the exit occurs and which control dependencies affect the exit.
|
|
@@ -640,6 +640,11 @@ f <- function(x) {
|
|
|
640
640
|
print(x)
|
|
641
641
|
}`.trim();
|
|
642
642
|
const criterion = '3@print';
|
|
643
|
+
const shinyCode = `
|
|
644
|
+
server <- function(input, output, session) {
|
|
645
|
+
system(paste("convert", input$file))
|
|
646
|
+
}`.trim();
|
|
647
|
+
const shinyCriterion = '2@system';
|
|
643
648
|
return `
|
|
644
649
|
Given a [slicing criterion](${doc_files_1.FlowrWikiBaseRef}/Terminology#slicing-criterion) to
|
|
645
650
|
something like a function call, flowR classifies the types of all input sources (e.g., arguments).
|
|
@@ -652,6 +657,37 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
|
652
657
|
type: 'input-sources',
|
|
653
658
|
criterion
|
|
654
659
|
}], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
|
|
660
|
+
|
|
661
|
+
Some objects are handed to the code by a framework rather than defined in it, like the \`input\` of a shiny
|
|
662
|
+
server function. The ${ctx.link('InputClassifierConfig::linkedObjects')} configuration lists them, so that reads
|
|
663
|
+
of such an object (and of its fields) classify as user input instead of stopping at a ${ctx.link('InputType::Parameter')}:
|
|
664
|
+
${(0, doc_code_1.codeBlock)('r', shinyCode)}
|
|
665
|
+
|
|
666
|
+
${await (0, doc_query_1.showQuery)(shell, shinyCode, [{
|
|
667
|
+
type: 'input-sources',
|
|
668
|
+
criterion: shinyCriterion
|
|
669
|
+
}], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([shinyCriterion], (0, doc_escape_1.escapeNewline)(shinyCode)), ctx })}
|
|
670
|
+
|
|
671
|
+
Every ${ctx.link('LinkedInputObject')} names the object, the ${ctx.link('InputType')} to use for it, and optionally
|
|
672
|
+
the parameters the binding function has to declare as well (${ctx.link('LinkedInputObject::withParams')}) - shiny's
|
|
673
|
+
\`input\` only counts as such if the function also takes an \`output\`, so that an ordinary function with a
|
|
674
|
+
parameter named \`input\` is left alone. Where the framework is handed the function instead of the code naming it,
|
|
675
|
+
a ${ctx.link('LinkedInputEntryPoint')} is exact: it says which object goes to which parameter *by position*, just
|
|
676
|
+
like R does, so \`shinyApp(ui, function(i, o, s))\` works no matter what those parameters are called.
|
|
677
|
+
With ${ctx.link('LinkedInputObject::declaredBy')} a read even links back to its definition - the \`textInput("n", …)\`
|
|
678
|
+
behind an \`input$n\` shows up as ${ctx.link('InputSource::declaredAt')}.
|
|
679
|
+
|
|
680
|
+
You do not have to pass any of this per query: the ${ctx.linkConfig('inputSources', true)} section of flowR's
|
|
681
|
+
${ctx.linkPage('wiki/Interface', 'configuration file')} carries the same shape and is *added* to what flowR already
|
|
682
|
+
knows, so your framework joins shiny instead of replacing it (and \`specializeConfig\` can scope it to one
|
|
683
|
+
${ctx.link('ProjectKind')}). Functions may be written as plain \`fn\` or namespaced \`pkg::fn\` strings; a bare call
|
|
684
|
+
only counts as the namespaced one while that package is attached, exactly as R would resolve it.
|
|
685
|
+
|
|
686
|
+
${(0, doc_code_1.codeBlock)('json', JSON.stringify({ inputSources: {
|
|
687
|
+
user: ['myframework::read_form'],
|
|
688
|
+
linkedObjects: [{ name: 'ctx', type: 'user', declaredBy: { calls: ['myframework::field'], argName: 'id', argIdx: 0 } }],
|
|
689
|
+
linkedEntryPoints: [{ call: 'myframework::serve', argName: 'handler', argIdx: 0, params: ['ctx', null] }]
|
|
690
|
+
} }, undefined, 2))}
|
|
655
691
|
`;
|
|
656
692
|
}
|
|
657
693
|
});
|
|
@@ -981,6 +1017,17 @@ The guess can be narrowed further:
|
|
|
981
1017
|
Packages can also be tied to one shared version (the base/R packages always are), and ${ctx.linkConfig('solver.versionManagement.linkedVersionGroups', true)}
|
|
982
1018
|
declares further groups. Such a package reports its partners in \`linkedWith\`, because its range is then no longer independent of theirs.
|
|
983
1019
|
|
|
1020
|
+
What one dependency requires of another (\`transitive\` evidence) is read from *every* version of it still in play:
|
|
1021
|
+
|
|
1022
|
+
* all of them require it: the guess is narrowed, by the weakest of their bounds,
|
|
1023
|
+
* only some do: the evidence carries \`partial: true\` and never narrows, as another version avoids it.
|
|
1024
|
+
|
|
1025
|
+
A partial requirement still ties the two together. \`A 0.2.5\` needing \`B 0.2.1\` and \`A 0.3.0\` needing \`B 0.3.2\`
|
|
1026
|
+
shrinks neither range, yet the versions are not free. Each package lists its \`coupledWith\` partners, and
|
|
1027
|
+
\`runnableCombinations\` counts the tuples those couplings admit, against the plain product \`possibleCombinations\`
|
|
1028
|
+
and, where the project declares constraints, against \`declaredCombinations\` (what those alone leave, so the share
|
|
1029
|
+
says how much the guess added).
|
|
1030
|
+
|
|
984
1031
|
${(0, doc_structure_1.block)({
|
|
985
1032
|
type: 'NOTE',
|
|
986
1033
|
content: `This query needs the ${ctx.linkPage('wiki/Signature Database', 'signature database')}, and specifically a database carrying the _history_ of a package,
|
|
@@ -139,7 +139,7 @@ function measureLoad(file) {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
|
-
* A table of the databases the default bundle actually ships, read
|
|
142
|
+
* A table of the databases the default bundle actually ships, read at generation time, never hardcoded,
|
|
143
143
|
* from the manifests. Each shard becomes a row (contents, retained history, package and version counts, its
|
|
144
144
|
* on-disk size, and the measured cost of decompressing it on first touch). Every bundled manifest is unioned
|
|
145
145
|
* (deduped by shard/dictionary id), so the separate `history` manifest's shards show up alongside `current`,
|
|
@@ -234,10 +234,11 @@ Every function is a ${ctx.link('DecodedFunction')}:
|
|
|
234
234
|
|
|
235
235
|
Per version the source also answers declared dependencies (${ctx.link('ResolvedDependency')}), release dates, the plain export view (${ctx.link('LibraryExports')}), and the versions it carries (${ctx.link('AvailableVersion')}).
|
|
236
236
|
|
|
237
|
-
Beyond the flags above, ${ctx.link('DecodedFunction::props')} also carry ${ctx.linkE('FnProp', 'NoDoc')} (a documented package has no help page for this name), ${ctx.linkE('FnProp', 'S3Method')} (a registered S3 method, from the package NAMESPACE or base R's method table), and ${ctx.linkE('FnProp', 'S3Owner')} (an exported constructor for an S3 class this package OWNS: it also registers at least one S3 method for that class). The owned classes of a version are ${ctx.link('LibraryExports::s3Classes')}, and ${ctx.linkM(reader_1.SigDatabase, 'classOwner')} answers, for a class name, which package owns it (backed by a reverse index built once). This lets ${ctx.linkPage('wiki/Query API', 'version guessing')} mark a package used when the analyzed project's own NAMESPACE registers an S3 method for a class it owns, even with no direct call
|
|
237
|
+
Beyond the flags above, ${ctx.link('DecodedFunction::props')} also carry ${ctx.linkE('FnProp', 'NoDoc')} (a documented package has no help page for this name), ${ctx.linkE('FnProp', 'S3Method')} (a registered S3 method, from the package NAMESPACE or base R's method table), and ${ctx.linkE('FnProp', 'S3Owner')} (an exported constructor for an S3 class this package OWNS: it also registers at least one S3 method for that class). The owned classes of a version are ${ctx.link('LibraryExports::s3Classes')}, and ${ctx.linkM(reader_1.SigDatabase, 'classOwner')} answers, for a class name, which package owns it (backed by a reverse index built once). This lets ${ctx.linkPage('wiki/Query API', 'version guessing')} mark a package used when the analyzed project's own NAMESPACE registers an S3 method for a class it owns, even with no direct call, e.g. tseries's \`S3method("as.irts","zoo")\` marks \`zoo\` used.
|
|
238
238
|
|
|
239
239
|
These are derived on demand by the ${ctx.linkPage('wiki/Query API', 'signature query')}, not stored:
|
|
240
240
|
- the rdrr.io documentation link ${ctx.link('SignatureFunctionView::docUrl')} (base R \`/r/<pkg>/<topic>\`, CRAN \`/cran/<pkg>/man/<topic>\`), omitted for a ${ctx.linkE('FnProp', 'NoDoc')} function
|
|
241
|
+
- ${ctx.link('SignatureFunctionView::sourceUrl')} and ${ctx.link('SignatureFunctionView::manUrl')}: the definition and its \`.Rd\` help page at the queried version, on \`github.com/cran/<pkg>\` (CRAN) or \`github.com/wch/r-source\` (base R)
|
|
241
242
|
- the S3 method to generic backlink ${ctx.link('SignatureFunctionView::s3method')}, for a ${ctx.linkE('FnProp', 'S3Method')} function, resolving its generic
|
|
242
243
|
- the transitive call graph ${ctx.linkM(reader_1.SigDatabase, 'transitiveCallees')}, expanding the stored local callees inside one version
|
|
243
244
|
|
|
@@ -162,7 +162,7 @@ exports.ABSOLUTE_PATH = {
|
|
|
162
162
|
}
|
|
163
163
|
else {
|
|
164
164
|
const dfNode = dataflow.graph.getVertex(node.info.id);
|
|
165
|
-
if (
|
|
165
|
+
if (vertex_1.FunctionCallVertex.is(dfNode)) {
|
|
166
166
|
const handler = dfNode.name ? PathFunctions.get(dfNode.name) : undefined;
|
|
167
167
|
const strings = handler ? handler(dataflow.graph, dfNode, data.inspectContext()) : [];
|
|
168
168
|
if (strings) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
2
|
import type { FlowrSearchElements } from '../../search/flowr-search';
|
|
3
|
-
import {
|
|
3
|
+
import type { MergeableRecord } from '../../util/objects';
|
|
4
4
|
import { LintingRuleCertainty, type LintingResult } from '../linter-format';
|
|
5
5
|
import { LintingRuleTag } from '../linter-tags';
|
|
6
6
|
export interface DataFrameAccessValidationResult extends LintingResult {
|
|
@@ -70,7 +70,7 @@ exports.functionFinderUtil = {
|
|
|
70
70
|
}
|
|
71
71
|
const dataflow = await analyzer.dataflow();
|
|
72
72
|
const vert = dataflow.graph.getVertex(element.node.info.id);
|
|
73
|
-
if (
|
|
73
|
+
if (vertex_1.FunctionCallVertex.is(vert)) {
|
|
74
74
|
const args = (0, resolve_argument_1.getArgumentStringValue)(analyzer.flowrConfig.solver.variables, dataflow.graph, vert, info.argIdx, info.argName, info.resolveValue, analyzer.inspectContext());
|
|
75
75
|
// we obtain all values, at least one of them has to trigger for the request
|
|
76
76
|
const argValues = args ? args.values().flatMap(s => Array.from(s)).filter(assert_1.isNotUndefined).toArray() : [];
|
|
@@ -34,7 +34,7 @@ exports.NO_LEAKED_CREDENTIALS = {
|
|
|
34
34
|
totalChecked++;
|
|
35
35
|
const name = element.node.lexeme ?? '';
|
|
36
36
|
const vertex = dfg.getVertex(element.node.info.id);
|
|
37
|
-
if (!
|
|
37
|
+
if (!vertex_1.VariableDefinitionVertex.is(vertex)) {
|
|
38
38
|
return [];
|
|
39
39
|
}
|
|
40
40
|
const nameMatches = namePattern.test(name);
|
|
@@ -117,7 +117,9 @@ function collectScopeDefinedNames(graph) {
|
|
|
117
117
|
if (!unconditional) {
|
|
118
118
|
continue;
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
const names = byScope.get(scope) ?? new Set();
|
|
121
|
+
names.add(name);
|
|
122
|
+
byScope.set(scope, names);
|
|
121
123
|
}
|
|
122
124
|
return byScope;
|
|
123
125
|
}
|
|
@@ -18,13 +18,12 @@ const undefined_symbol_util_1 = require("./undefined-symbol-util");
|
|
|
18
18
|
/** calls that load a package; an unresolved one means we cannot enumerate all exports in scope */
|
|
19
19
|
const LibraryLoadFunctions = new Set(['library', 'require', 'requireNamespace', 'loadNamespace', 'attachNamespace', 'load_all', 'use', 'p_load']);
|
|
20
20
|
// standard packages attached by default; exports are in scope without library()
|
|
21
|
-
const AttachedBasePackages = ['base', 'stats', 'graphics', 'grDevices', 'utils', 'datasets', 'methods'];
|
|
22
21
|
/** test frameworks whose namespace a test file runs under implicitly (e.g. `tests/testthat/test-*.R` sees testthat's exports without a `library()`) */
|
|
23
22
|
const ImplicitTestFrameworks = new Set(['testthat', 'tinytest', 'RUnit']);
|
|
24
23
|
/** whether name is an export of a default-attached base package (needs no library()) */
|
|
25
24
|
function isAttachedBaseName(name) {
|
|
26
25
|
const owner = (0, r_base_packages_1.baseRExportOwner)(name);
|
|
27
|
-
return owner !== undefined && AttachedBasePackages.includes(owner);
|
|
26
|
+
return owner !== undefined && r_base_packages_1.AttachedBasePackages.includes(owner);
|
|
28
27
|
}
|
|
29
28
|
/** upper bound on the number of packages named in a "did you forget to load it" hint */
|
|
30
29
|
const MaxHintPackages = 5;
|
|
@@ -74,10 +73,10 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
74
73
|
// packages, each resolved (exports enriched) from the package database via getDependency
|
|
75
74
|
const loadedPackages = [
|
|
76
75
|
...deps.getDependencies().map(p => deps.getDependency(p.name) ?? p),
|
|
77
|
-
...AttachedBasePackages.map(n => deps.getDependency(n)).filter(assert_1.isNotUndefined)
|
|
76
|
+
...r_base_packages_1.AttachedBasePackages.map(n => deps.getDependency(n)).filter(assert_1.isNotUndefined)
|
|
78
77
|
];
|
|
79
78
|
// hint an unloaded package that exports `name` (e.g. `ggplot` -> `ggplot2`), from the package database
|
|
80
|
-
const attached = new Set(AttachedBasePackages);
|
|
79
|
+
const attached = new Set(r_base_packages_1.AttachedBasePackages);
|
|
81
80
|
const hintPackagesFor = (name) => deps.packagesExporting(name).filter(p => !attached.has(p)).slice(0, MaxHintPackages);
|
|
82
81
|
const results = elements.getElements().map(element => {
|
|
83
82
|
const id = element.node.info.id;
|
|
@@ -86,7 +85,7 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
86
85
|
return undefined;
|
|
87
86
|
}
|
|
88
87
|
const inInstalledFile = isInstalledFile(element.node.info.file);
|
|
89
|
-
if (
|
|
88
|
+
if (vertex_1.FunctionCallVertex.is(vtx)) {
|
|
90
89
|
if (vtx.origin === 'unnamed' || !config.checkFunctions) {
|
|
91
90
|
return undefined;
|
|
92
91
|
}
|
|
@@ -64,29 +64,30 @@ function collectCalledNames(dfg) {
|
|
|
64
64
|
}
|
|
65
65
|
return names;
|
|
66
66
|
}
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
/** S3 (`UseMethod`) and S4/S7 (`standardGeneric`) generic dispatchers, invoked indirectly by R's dispatch. */
|
|
68
|
+
const GenericDispatchers = new Set(['UseMethod', 'standardGeneric']);
|
|
69
|
+
/** Whether a function body is a single call to a generic dispatcher. */
|
|
70
|
+
function isGenericDispatcherOnlyBody(node) {
|
|
71
|
+
if (r_function_call_1.RFunctionCall.isNamed(node) && GenericDispatchers.has(identifier_1.Identifier.getName(node.functionName.content))) {
|
|
71
72
|
return true;
|
|
72
73
|
}
|
|
73
74
|
const nodeWithChildren = node;
|
|
74
75
|
if (Array.isArray(nodeWithChildren.children) && nodeWithChildren.children.length === 1) {
|
|
75
76
|
const child = nodeWithChildren.children[0];
|
|
76
|
-
if (child && r_function_call_1.RFunctionCall.isNamed(child) && identifier_1.Identifier.getName(child.functionName.content)
|
|
77
|
+
if (child && r_function_call_1.RFunctionCall.isNamed(child) && GenericDispatchers.has(identifier_1.Identifier.getName(child.functionName.content))) {
|
|
77
78
|
return true;
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
return false;
|
|
81
82
|
}
|
|
82
|
-
/** Collects the parameter IDs of
|
|
83
|
+
/** Collects the parameter IDs of generic dispatcher functions. */
|
|
83
84
|
function collectS3GenericParameterIds(ast) {
|
|
84
85
|
const paramIds = new Set();
|
|
85
86
|
for (const [, node] of ast.idMap) {
|
|
86
87
|
if (!r_function_definition_1.RFunctionDefinition.is(node)) {
|
|
87
88
|
continue;
|
|
88
89
|
}
|
|
89
|
-
if (
|
|
90
|
+
if (isGenericDispatcherOnlyBody(node.body)) {
|
|
90
91
|
for (const param of node.parameters) {
|
|
91
92
|
paramIds.add(param.name.info.id);
|
|
92
93
|
}
|
|
@@ -211,18 +212,22 @@ exports.UNUSED_DEFINITION = {
|
|
|
211
212
|
return [];
|
|
212
213
|
}
|
|
213
214
|
const dfgVertex = dataflow.graph.getVertex(element.node.info.id);
|
|
214
|
-
if (!dfgVertex || (!
|
|
215
|
-
&&
|
|
215
|
+
if (!dfgVertex || (!vertex_1.VariableDefinitionVertex.is(dfgVertex)
|
|
216
|
+
&& vertex_1.FunctionDefinitionVertex.is(dfgVertex) && !config.includeFunctionDefinitions)) {
|
|
216
217
|
return undefined;
|
|
217
218
|
}
|
|
218
219
|
if (s3GenericParams.has(element.node.info.id)) {
|
|
219
220
|
return undefined;
|
|
220
221
|
}
|
|
222
|
+
// an anonymous dispatcher passed to setGeneric()/new_generic() runs on every dispatch, so it is used
|
|
223
|
+
if (vertex_1.FunctionDefinitionVertex.is(dfgVertex) && r_function_definition_1.RFunctionDefinition.is(element.node) && isGenericDispatcherOnlyBody(element.node.body)) {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
221
226
|
if (isConsideredUsed(element.node.lexeme, config, packageInfo, calledNames)) {
|
|
222
227
|
return undefined;
|
|
223
228
|
}
|
|
224
229
|
const ingoingEdges = dataflow.graph.ingoingEdges(dfgVertex.id);
|
|
225
|
-
const interestedIn =
|
|
230
|
+
const interestedIn = vertex_1.VariableDefinitionVertex.is(dfgVertex) ? InterestingEdgesVariable : InterestingEdgesFunction;
|
|
226
231
|
const ingoingInteresting = ingoingEdges?.values().some(e => edge_1.DfEdge.includesType(e, interestedIn));
|
|
227
232
|
if (ingoingInteresting) {
|
|
228
233
|
return undefined;
|
|
@@ -16,7 +16,7 @@ exports.USELESS_LOOP = {
|
|
|
16
16
|
const results = elements.getElements().filter(e => {
|
|
17
17
|
const vertex = dataflow.graph.getVertex(e.node.info.id);
|
|
18
18
|
return vertex
|
|
19
|
-
&&
|
|
19
|
+
&& vertex_1.FunctionCallVertex.is(vertex)
|
|
20
20
|
&& vertex.origin !== 'unnamed'
|
|
21
21
|
&& useLessLoopConfig.loopyFunctions.has(vertex.origin[0]);
|
|
22
22
|
}).filter(loop => (0, useless_loop_1.onlyLoopsOnce)(loop.node.info.id, dataflow.graph, cfg, normalize, data.inspectContext())).map(res => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagleoutice/flowr",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.4",
|
|
4
4
|
"description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
"build-dev": "npm run build && npm run build:copy-wasm",
|
|
37
37
|
"build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --tree-shaking=true --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm",
|
|
38
38
|
"build:copy-wasm": "mkdir -p dist/node_modules/@davisvaughan/tree-sitter-r/ && mkdir -p dist/node_modules/web-tree-sitter && cp node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm dist/node_modules/@davisvaughan/tree-sitter-r/ && cp node_modules/web-tree-sitter/tree-sitter.wasm dist/node_modules/web-tree-sitter/",
|
|
39
|
-
"
|
|
40
|
-
"lint": "npm run
|
|
39
|
+
"typecheck": "tsc --noEmit --project .",
|
|
40
|
+
"lint-local": "npm run typecheck && npx eslint --version && npx eslint src/ test/ scripts/ --concurrency=auto --cache --cache-location node_modules/.cache/eslint-local --rule \"no-warning-comments: off\"",
|
|
41
|
+
"lint": "npm run license-compat -- --summary && npm run typecheck && npx eslint --version && npx eslint src/ test/ scripts/ --concurrency=auto --cache --cache-location node_modules/.cache/eslint",
|
|
41
42
|
"license-compat": "license-checker-rseidelsohn --onlyAllow 'MIT;MPL-2.0;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD' --clarificationsFile license-clarifications.json",
|
|
42
43
|
"doc": "typedoc",
|
|
43
44
|
"test": "vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
|
|
@@ -181,10 +182,9 @@
|
|
|
181
182
|
"devDependencies": {
|
|
182
183
|
"@commitlint/cli": "^20.5.0",
|
|
183
184
|
"@commitlint/config-angular": "^20.5.0",
|
|
184
|
-
"@eagleoutice/eslint-config-flowr": "^
|
|
185
|
-
"@eslint/eslintrc": "^3.3.3",
|
|
186
|
-
"@eslint/js": "^9.39.2",
|
|
185
|
+
"@eagleoutice/eslint-config-flowr": "^2.0.1",
|
|
187
186
|
"@j-ulrich/release-it-regex-bumper": "^5.4.0",
|
|
187
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
188
188
|
"@types/command-line-args": "^5.2.3",
|
|
189
189
|
"@types/command-line-usage": "^5.0.4",
|
|
190
190
|
"@types/commonmark": "^0.27.10",
|
|
@@ -198,11 +198,16 @@
|
|
|
198
198
|
"@types/tmp": "^0.2.6",
|
|
199
199
|
"@types/ws": "^8.18.1",
|
|
200
200
|
"@typescript-eslint/eslint-plugin": "^8.40.0",
|
|
201
|
+
"@typescript-eslint/parser": "^8.65.0",
|
|
201
202
|
"@vitest/coverage-v8": "^4.1.8",
|
|
202
203
|
"esbuild": "^0.28.1",
|
|
203
|
-
"eslint": "^
|
|
204
|
-
"
|
|
205
|
-
"
|
|
204
|
+
"eslint": "^10.8.0",
|
|
205
|
+
"eslint-plugin-check-file": "^3.3.2",
|
|
206
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
207
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
208
|
+
"eslint-plugin-tsdoc": "^0.5.2",
|
|
209
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
210
|
+
"license-checker-rseidelsohn": "^5.0.1",
|
|
206
211
|
"release-it": "^20.0.0",
|
|
207
212
|
"ts-node": "^10.9.2",
|
|
208
213
|
"typedoc": "^0.28.17",
|
|
@@ -242,5 +247,12 @@
|
|
|
242
247
|
"web-tree-sitter": "^0.24.7",
|
|
243
248
|
"ws": "^8.18.0",
|
|
244
249
|
"xpath-ts2": "^1.4.2"
|
|
250
|
+
},
|
|
251
|
+
"allowScripts": {
|
|
252
|
+
"@davisvaughan/tree-sitter-r@1.2.0": true,
|
|
253
|
+
"core-js-pure@3.40.0": true,
|
|
254
|
+
"esbuild@0.28.1": true,
|
|
255
|
+
"plantuml-pipe@1.6.0": true,
|
|
256
|
+
"unrs-resolver@1.12.2": true
|
|
245
257
|
}
|
|
246
258
|
}
|
|
@@ -42,8 +42,8 @@ export interface ReadOnlyFlowrAnalyzerContext {
|
|
|
42
42
|
readonly rVersionKnown: boolean;
|
|
43
43
|
/** Classify the {@link ProjectKind} of the project, see {@link ReadOnlyFlowrAnalyzerFilesContext#projectKind}. */
|
|
44
44
|
projectKind(): ProjectKind;
|
|
45
|
-
/** The versions a dependency can possibly have, see {@link ReadOnlyFlowrAnalyzerDependenciesContext#
|
|
46
|
-
|
|
45
|
+
/** The versions a dependency can possibly have, see {@link ReadOnlyFlowrAnalyzerDependenciesContext#inferredRange}. */
|
|
46
|
+
inferredRange(name: string): Range | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* Resource-usage guard (gas).
|
|
49
49
|
* Call `ctx.gas.checkGas(key)` at expensive analysis sites to obtain the current pressure level.
|
|
@@ -127,8 +127,8 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
|
|
|
127
127
|
get rVersionKnown(): boolean;
|
|
128
128
|
/** Classify the {@link ProjectKind} of the project (delegates to the cached {@link FlowrAnalyzerFilesContext#projectKind}). */
|
|
129
129
|
projectKind(): ProjectKind;
|
|
130
|
-
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#
|
|
131
|
-
|
|
130
|
+
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#inferredRange}). */
|
|
131
|
+
inferredRange(name: string): Range | undefined;
|
|
132
132
|
/** delegate request addition */
|
|
133
133
|
addRequests(requests: readonly RAnalysisRequest[]): void;
|
|
134
134
|
addFile(f: string | FlowrFileProvider | RParseRequestFromFile): void;
|
|
@@ -181,9 +181,9 @@ class FlowrAnalyzerContext {
|
|
|
181
181
|
projectKind() {
|
|
182
182
|
return this.files.projectKind();
|
|
183
183
|
}
|
|
184
|
-
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#
|
|
185
|
-
|
|
186
|
-
return this.deps.
|
|
184
|
+
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#inferredRange}). */
|
|
185
|
+
inferredRange(name) {
|
|
186
|
+
return this.deps.inferredRange(name);
|
|
187
187
|
}
|
|
188
188
|
/** delegate request addition */
|
|
189
189
|
addRequests(requests) {
|
|
@@ -31,19 +31,24 @@ export interface ReadOnlyFlowrAnalyzerDependenciesContext {
|
|
|
31
31
|
*/
|
|
32
32
|
getDependency(name: string, version?: string | Range): Readonly<Package> | undefined;
|
|
33
33
|
/**
|
|
34
|
-
* The versions a dependency can possibly have
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* The versions a dependency can possibly have: its {@link Package.derivedRange|derived range}, but only once
|
|
35
|
+
* some version can satisfy it. `undefined` if the dependency is unknown, if nothing constrains it, or if the
|
|
36
|
+
* sources contradict each other, since then no version is possible at all.
|
|
37
37
|
*
|
|
38
38
|
* For *why* it is what it is (the individual constraints, or the version the database resolved to), take the
|
|
39
39
|
* {@link Package} from {@link getDependency}.
|
|
40
40
|
* @param name - The name of the dependency.
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
inferredRange(name: string): Range | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* Get all dependencies known to this context.
|
|
45
45
|
*/
|
|
46
46
|
getDependencies(): readonly Readonly<Package>[];
|
|
47
|
+
/**
|
|
48
|
+
* Every package name the project *declares* (`Depends`/`Imports`/`Suggests`/`LinkingTo`/`Enhances`), whether or
|
|
49
|
+
* not it became a loadable dependency here. `Suggests` do not, yet they still name packages the project may install.
|
|
50
|
+
*/
|
|
51
|
+
declaredPackageNames(): readonly string[];
|
|
47
52
|
/**
|
|
48
53
|
* Metadata of the signature databases the version plugins currently have loaded.
|
|
49
54
|
*/
|
|
@@ -119,6 +124,7 @@ export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnaly
|
|
|
119
124
|
getDependency(name: string, version?: string | Range): Package | undefined;
|
|
120
125
|
/** Resolve `name` constrained to `range` via the plugins (uncached); falls back to the cached dependency. */
|
|
121
126
|
private resolvePinnedDependency;
|
|
122
|
-
|
|
127
|
+
inferredRange(name: string): Range | undefined;
|
|
123
128
|
getDependencies(): Package[];
|
|
129
|
+
declaredPackageNames(): string[];
|
|
124
130
|
}
|
|
@@ -163,7 +163,7 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
163
163
|
}
|
|
164
164
|
/** Resolve `name` constrained to `range` via the plugins (uncached); falls back to the cached dependency. */
|
|
165
165
|
resolvePinnedDependency(name, range) {
|
|
166
|
-
const pin = new package_1.Package({ name,
|
|
166
|
+
const pin = new package_1.Package({ name, versionConstraints: range ? [range] : [] });
|
|
167
167
|
for (const resolve of this.lazyResolvers) {
|
|
168
168
|
const resolved = resolve(name, pin);
|
|
169
169
|
if (resolved) {
|
|
@@ -172,9 +172,9 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
172
172
|
}
|
|
173
173
|
return this.getDependency(name);
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
inferredRange(name) {
|
|
176
176
|
const pkg = this.getDependency(name);
|
|
177
|
-
return pkg?.hasSatisfiableVersion() ? pkg.
|
|
177
|
+
return pkg?.hasSatisfiableVersion() ? pkg.derivedRange : undefined;
|
|
178
178
|
}
|
|
179
179
|
getDependencies() {
|
|
180
180
|
if (!this.staticsLoaded) {
|
|
@@ -182,6 +182,11 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
182
182
|
}
|
|
183
183
|
return Array.from(this.dependencies.values());
|
|
184
184
|
}
|
|
185
|
+
declaredPackageNames() {
|
|
186
|
+
this.ensureStaticsLoaded();
|
|
187
|
+
const declared = Object.values(this.ctx.meta.getDeclaredPackages());
|
|
188
|
+
return [...new Set(declared.flatMap(group => group?.map(p => p.name) ?? []))];
|
|
189
|
+
}
|
|
185
190
|
}
|
|
186
191
|
exports.FlowrAnalyzerDependenciesContext = FlowrAnalyzerDependenciesContext;
|
|
187
192
|
//# sourceMappingURL=flowr-analyzer-dependencies-context.js.map
|
|
@@ -23,6 +23,7 @@ export interface DeclaredPackages {
|
|
|
23
23
|
depends?: readonly Package[];
|
|
24
24
|
suggests?: readonly Package[];
|
|
25
25
|
linkingTo?: readonly Package[];
|
|
26
|
+
enhances?: readonly Package[];
|
|
26
27
|
}
|
|
27
28
|
/** The project metadata a plugin may contribute, see {@link FlowrAnalyzerMetaContext#contribute}. */
|
|
28
29
|
export interface ProjectMetaFields {
|