@eagleoutice/flowr 2.13.1 → 2.13.2
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/cli/flowr.js +21 -5
- package/cli/repl/commands/repl-commands.js +11 -9
- package/cli/repl/commands/repl-query.js +1 -1
- package/cli/repl/commands/repl-signature.js +8 -1
- package/cli/repl/core.js +13 -10
- package/cli/repl/print-version.js +1 -1
- package/cli/repl/server/connection.d.ts +1 -1
- package/cli/repl/server/net.js +15 -0
- package/config.d.ts +29 -0
- package/config.js +54 -2
- package/data/sigdb/sigdb.remote.json +1 -1
- package/dataflow/environments/identifier.d.ts +9 -8
- package/dataflow/environments/identifier.js +21 -13
- package/dataflow/eval/resolve/resolve-working-directory.d.ts +29 -0
- package/dataflow/eval/resolve/resolve-working-directory.js +168 -0
- package/dataflow/extractor.js +2 -1
- package/dataflow/graph/df-helper.d.ts +3 -2
- package/dataflow/graph/df-helper.js +11 -15
- package/dataflow/graph/diff-dataflow-graph.js +1 -1
- package/dataflow/graph/graph-helper.js +2 -6
- package/dataflow/graph/graph.d.ts +24 -0
- package/dataflow/graph/graph.js +25 -1
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-mk/doc-context.d.ts +10 -0
- package/documentation/wiki-mk/doc-context.js +3 -0
- package/documentation/wiki-signature-database.js +16 -6
- package/linter/linter-rules.d.ts +24 -2
- package/linter/linter-rules.js +3 -1
- package/linter/rules/absolute-path.d.ts +4 -4
- package/linter/rules/absolute-path.js +7 -5
- package/linter/rules/file-path-validity.d.ts +1 -1
- package/linter/rules/file-path-validity.js +48 -8
- package/linter/rules/function-finder-util.d.ts +2 -1
- package/linter/rules/syntactically-valid.d.ts +58 -0
- package/linter/rules/syntactically-valid.js +203 -0
- package/linter/rules/undefined-symbol.js +3 -2
- package/package.json +5 -4
- package/project/context/classify-project-kind.d.ts +40 -0
- package/project/context/classify-project-kind.js +76 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +23 -4
- package/project/context/flowr-analyzer-dependencies-context.js +23 -1
- package/project/context/flowr-analyzer-files-context.d.ts +10 -8
- package/project/context/flowr-analyzer-files-context.js +26 -67
- package/project/context/flowr-file.d.ts +5 -0
- package/project/context/flowr-file.js +5 -0
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +12 -4
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +25 -10
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +4 -1
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +57 -2
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +150 -28
- package/project/sigdb/decompress.d.ts +1 -1
- package/project/sigdb/decompress.js +4 -1
- package/project/sigdb/manifest.js +60 -26
- package/project/sigdb/sigdb-download.d.ts +6 -7
- package/project/sigdb/sigdb-download.js +30 -9
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +0 -10
- package/queries/catalog/dependencies-query/dependencies-query-format.js +0 -106
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -1
- package/queries/catalog/linter-query/linter-query-format.js +9 -2
- package/queries/catalog/signature-query/signature-query-executor.js +3 -0
- package/queries/catalog/signature-query/signature-query-render.js +4 -4
- package/queries/query.js +9 -2
- package/r-bridge/data/data.d.ts +5 -0
- package/r-bridge/data/data.js +6 -0
- package/r-bridge/retriever.js +6 -1
- package/r-bridge/shell.js +5 -0
- package/search/flowr-search-filters.d.ts +2 -1
- package/util/files.d.ts +6 -4
- package/util/files.js +30 -8
- package/util/mermaid/dfg.js +1 -1
- package/util/text/ansi.d.ts +7 -3
- package/util/text/ansi.js +8 -5
- package/util/version.js +4 -4
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type LintingResult, LintingRuleCertainty, type LintQuickFix } from '../linter-format';
|
|
2
|
+
import type { MergeableRecord } from '../../util/objects';
|
|
3
|
+
import { LintingRuleTag } from '../linter-tags';
|
|
4
|
+
import type { SyntaxNode } from 'web-tree-sitter';
|
|
5
|
+
/** The direction a fix takes to repair an error: add text, remove text, or comment the region out. */
|
|
6
|
+
export type FixDirection = 'add' | 'remove' | 'comment';
|
|
7
|
+
export interface SyntacticallyValidResult extends LintingResult {
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly kind: 'missing' | 'error';
|
|
10
|
+
}
|
|
11
|
+
export interface SyntacticallyValidConfig extends MergeableRecord {
|
|
12
|
+
/** Names of {@link SyntaxErrorFixPatterns|auto-fix patterns} to disable (default none). */
|
|
13
|
+
readonly disabledFixes: readonly string[];
|
|
14
|
+
/** Preferred {@link FixDirection}; each error gets a single fix, favouring a candidate of this direction. */
|
|
15
|
+
readonly preferFix: FixDirection;
|
|
16
|
+
}
|
|
17
|
+
export interface SyntacticallyValidMetadata extends MergeableRecord {
|
|
18
|
+
readonly errors: number;
|
|
19
|
+
readonly fixable: number;
|
|
20
|
+
readonly parser: string;
|
|
21
|
+
}
|
|
22
|
+
/** A `missing` (parser-inserted, zero-width) or `error` (un-parseable) tree-sitter node. */
|
|
23
|
+
export interface SyntaxErrorFinding {
|
|
24
|
+
readonly kind: 'missing' | 'error';
|
|
25
|
+
readonly node: SyntaxNode;
|
|
26
|
+
}
|
|
27
|
+
/** An extensible auto-fix pattern; append to {@link SyntaxErrorFixPatterns} to teach the rule new repairs. */
|
|
28
|
+
export interface SyntaxErrorFixPattern {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly description: string;
|
|
31
|
+
readonly direction: FixDirection;
|
|
32
|
+
readonly appliesTo: (finding: SyntaxErrorFinding) => boolean;
|
|
33
|
+
readonly quickFix: (finding: SyntaxErrorFinding, file: string | undefined) => LintQuickFix;
|
|
34
|
+
}
|
|
35
|
+
/** The built-in auto-fix patterns; append a {@link SyntaxErrorFixPattern} to add repairs. */
|
|
36
|
+
export declare const SyntaxErrorFixPatterns: SyntaxErrorFixPattern[];
|
|
37
|
+
export declare const SYNTACTICALLY_VALID: {
|
|
38
|
+
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", [], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
|
|
39
|
+
readonly processSearchResult: (_elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: SyntacticallyValidConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
|
|
40
|
+
results: SyntacticallyValidResult[];
|
|
41
|
+
".meta": SyntacticallyValidMetadata;
|
|
42
|
+
}>;
|
|
43
|
+
readonly prettyPrint: {
|
|
44
|
+
readonly query: (result: SyntacticallyValidResult) => string;
|
|
45
|
+
readonly full: (result: SyntacticallyValidResult) => string;
|
|
46
|
+
};
|
|
47
|
+
readonly info: {
|
|
48
|
+
readonly name: "Syntactically Valid";
|
|
49
|
+
readonly description: "Checks whether the code is free of syntax errors, using the configured (error-tolerant) parser, and offers extensible quick-fixes to repair them.";
|
|
50
|
+
readonly tags: readonly [LintingRuleTag.Bug, LintingRuleTag.Robustness, LintingRuleTag.QuickFix];
|
|
51
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
52
|
+
readonly activeByDefault: false;
|
|
53
|
+
readonly defaultConfig: {
|
|
54
|
+
readonly disabledFixes: readonly [];
|
|
55
|
+
readonly preferFix: "remove";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SYNTACTICALLY_VALID = exports.SyntaxErrorFixPatterns = void 0;
|
|
4
|
+
const linter_format_1 = require("../linter-format");
|
|
5
|
+
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
6
|
+
const range_1 = require("../../util/range");
|
|
7
|
+
const linter_tags_1 = require("../linter-tags");
|
|
8
|
+
const DelimiterInsert = new Map([[')', ')'], ['}', '}'], [']', ']'], [']]', ']]'], ['"', '"'], ['\'', '\''], ['`', '`'], [',', ','], [';', ';']]);
|
|
9
|
+
const KeywordInsert = new Map([['in', ' in '], ['else', ' else ']]);
|
|
10
|
+
const OperatorToken = /^([-+*/^:~!<>=&|@$]+|<-|<<-|->|->>|\|>|%[^%]*%)$/;
|
|
11
|
+
const KnownOperators = ['%%', '%/%', '%*%', '%o%', '%x%', '%in%', '%>%', '%<>%', '%+%', '%||%'];
|
|
12
|
+
// tree-sitter is 0-based with an exclusive end column (matching flowR), so only the 1-based start shifts
|
|
13
|
+
const point = (p) => [p.row + 1, p.column + 1, p.row + 1, p.column];
|
|
14
|
+
const span = (n) => [n.startPosition.row + 1, n.startPosition.column + 1, n.endPosition.row + 1, n.endPosition.column];
|
|
15
|
+
const isDanglingOperator = (n) => !!n && !n.isNamed && OperatorToken.test(n.type);
|
|
16
|
+
/** The closing delimiters an unbalanced error region is missing, innermost first (skips strings/comments; `({` needs `})`). */
|
|
17
|
+
function bracketDeficit(text) {
|
|
18
|
+
const stack = [];
|
|
19
|
+
let quote;
|
|
20
|
+
for (let i = 0; i < text.length; i++) {
|
|
21
|
+
const c = text[i];
|
|
22
|
+
if (quote) {
|
|
23
|
+
if (c === '\\') {
|
|
24
|
+
i++;
|
|
25
|
+
}
|
|
26
|
+
else if (c === quote) {
|
|
27
|
+
quote = undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (c === '"' || c === '\'' || c === '`') {
|
|
31
|
+
quote = c;
|
|
32
|
+
}
|
|
33
|
+
else if (c === '#') {
|
|
34
|
+
while (i < text.length && text[i] !== '\n') {
|
|
35
|
+
i++;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (c === '(') {
|
|
39
|
+
stack.push(')');
|
|
40
|
+
}
|
|
41
|
+
else if (c === '[') {
|
|
42
|
+
stack.push(text[i + 1] === '[' ? (i++, ']]') : ']');
|
|
43
|
+
}
|
|
44
|
+
else if (c === '{') {
|
|
45
|
+
stack.push('}');
|
|
46
|
+
}
|
|
47
|
+
else if ((c === ')' || c === '}') && stack[stack.length - 1] === c) {
|
|
48
|
+
stack.pop();
|
|
49
|
+
}
|
|
50
|
+
else if (c === ']') {
|
|
51
|
+
if (stack[stack.length - 1] === ']') {
|
|
52
|
+
stack.pop();
|
|
53
|
+
}
|
|
54
|
+
else if (stack[stack.length - 1] === ']]') {
|
|
55
|
+
stack[stack.length - 1] = ']';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return stack.reverse();
|
|
60
|
+
}
|
|
61
|
+
/** Fuzzy-complete the unfinished `%...` operator in an error region to the nearest known operator (else just close it). */
|
|
62
|
+
function operatorCompletion(node) {
|
|
63
|
+
const at = node.text.lastIndexOf('%');
|
|
64
|
+
const fragment = /^%[A-Za-z0-9]*/.exec(node.text.slice(at))?.[0] ?? '%';
|
|
65
|
+
const full = KnownOperators.find(op => op !== fragment && op.startsWith(fragment)) ?? fragment + '%';
|
|
66
|
+
const column = node.startPosition.column + at;
|
|
67
|
+
return { range: [node.startPosition.row + 1, column + 1, node.startPosition.row + 1, column + fragment.length], full };
|
|
68
|
+
}
|
|
69
|
+
const isMissingExpression = (f) => f.kind === 'missing' && !DelimiterInsert.has(f.node.type) && !KeywordInsert.has(f.node.type);
|
|
70
|
+
/** The built-in auto-fix patterns; append a {@link SyntaxErrorFixPattern} to add repairs. */
|
|
71
|
+
exports.SyntaxErrorFixPatterns = [
|
|
72
|
+
{
|
|
73
|
+
name: 'insert-missing-token',
|
|
74
|
+
description: 'Insert a delimiter, quote, or keyword the parser expected but did not find.',
|
|
75
|
+
direction: 'add',
|
|
76
|
+
appliesTo: f => f.kind === 'missing' && (DelimiterInsert.has(f.node.type) || KeywordInsert.has(f.node.type)),
|
|
77
|
+
quickFix: (f, file) => ({
|
|
78
|
+
type: 'replace',
|
|
79
|
+
loc: range_1.SourceLocation.from(point(f.node.startPosition), file),
|
|
80
|
+
description: `Insert missing \`${f.node.type}\``,
|
|
81
|
+
replacement: DelimiterInsert.get(f.node.type) ?? KeywordInsert.get(f.node.type)
|
|
82
|
+
})
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'remove-dangling-operator',
|
|
86
|
+
description: 'Drop a dangling operator whose operand the parser found missing.',
|
|
87
|
+
direction: 'remove',
|
|
88
|
+
appliesTo: f => isMissingExpression(f) && isDanglingOperator(f.node.previousSibling),
|
|
89
|
+
quickFix: (f, file) => ({ type: 'remove', loc: range_1.SourceLocation.from(span(f.node.previousSibling), file), description: `Remove the dangling \`${f.node.previousSibling.type}\`` })
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'insert-operand-placeholder',
|
|
93
|
+
description: 'Insert a `NULL` placeholder for a missing operand or body.',
|
|
94
|
+
direction: 'add',
|
|
95
|
+
appliesTo: isMissingExpression,
|
|
96
|
+
quickFix: (f, file) => ({ type: 'replace', loc: range_1.SourceLocation.from(point(f.node.startPosition), file), description: 'Insert placeholder `NULL`', replacement: ' NULL' })
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'balance-brackets',
|
|
100
|
+
description: 'Close an unbalanced region by appending the brackets that were left open.',
|
|
101
|
+
direction: 'add',
|
|
102
|
+
appliesTo: f => f.kind === 'error' && bracketDeficit(f.node.text).length > 0,
|
|
103
|
+
quickFix: (f, file) => {
|
|
104
|
+
const closers = bracketDeficit(f.node.text).join('');
|
|
105
|
+
return { type: 'replace', loc: range_1.SourceLocation.from(point(f.node.endPosition), file), description: `Add missing closing \`${closers}\``, replacement: closers };
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'complete-operator',
|
|
110
|
+
description: 'Complete an unfinished `%...%` operator to the nearest known one.',
|
|
111
|
+
direction: 'add',
|
|
112
|
+
appliesTo: f => f.kind === 'error' && !f.node.text.includes('\n') && (f.node.text.match(/%/g)?.length ?? 0) % 2 === 1,
|
|
113
|
+
quickFix: (f, file) => {
|
|
114
|
+
const { range, full } = operatorCompletion(f.node);
|
|
115
|
+
return { type: 'replace', loc: range_1.SourceLocation.from(range, file), description: `Complete operator to \`${full}\``, replacement: full };
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'comment-out',
|
|
120
|
+
description: 'Comment out an un-parseable region so the rest of the file still parses.',
|
|
121
|
+
direction: 'comment',
|
|
122
|
+
appliesTo: f => f.kind === 'error' && !f.node.text.includes('\n'),
|
|
123
|
+
quickFix: (f, file) => ({ type: 'replace', loc: range_1.SourceLocation.from(span(f.node), file), description: 'Comment out the offending code', replacement: '# ' + f.node.text })
|
|
124
|
+
}
|
|
125
|
+
];
|
|
126
|
+
/** Collect the outermost `missing`/`error` nodes, pruning subtrees the parser reports as clean. */
|
|
127
|
+
function collectFindings(node, out = []) {
|
|
128
|
+
if (node.isMissing) {
|
|
129
|
+
out.push({ kind: 'missing', node });
|
|
130
|
+
}
|
|
131
|
+
else if (node.isError) {
|
|
132
|
+
out.push({ kind: 'error', node });
|
|
133
|
+
}
|
|
134
|
+
else if (node.hasError) {
|
|
135
|
+
for (const child of node.children) {
|
|
136
|
+
collectFindings(child, out);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
function describe(finding) {
|
|
142
|
+
if (finding.kind === 'missing') {
|
|
143
|
+
return `Missing \`${finding.node.type}\``;
|
|
144
|
+
}
|
|
145
|
+
const text = finding.node.text.replace(/\s+/g, ' ').trim();
|
|
146
|
+
return `Unexpected \`${text.length > 30 ? text.slice(0, 27) + '...' : text}\``;
|
|
147
|
+
}
|
|
148
|
+
exports.SYNTACTICALLY_VALID = {
|
|
149
|
+
createSearch: () => flowr_search_builder_1.Q.all(),
|
|
150
|
+
processSearchResult: async (_elements, config, data) => {
|
|
151
|
+
const parser = data.parserInformation().name;
|
|
152
|
+
const results = [];
|
|
153
|
+
// only tree-sitter recovers from syntax errors; a hard parser aborts before the linter ever runs
|
|
154
|
+
if (parser === 'tree-sitter') {
|
|
155
|
+
const patterns = exports.SyntaxErrorFixPatterns.filter(p => !config.disabledFixes.includes(p.name));
|
|
156
|
+
for (const file of (await data.parse()).files) {
|
|
157
|
+
const root = file.parsed.rootNode;
|
|
158
|
+
if (!root.hasError) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
for (const finding of collectFindings(root)) {
|
|
162
|
+
// a single fix per error, favouring the preferred direction (alternatives are never emitted together)
|
|
163
|
+
let fix;
|
|
164
|
+
let best = 2;
|
|
165
|
+
for (const p of patterns) {
|
|
166
|
+
const rank = p.direction === config.preferFix ? 0 : 1;
|
|
167
|
+
if (rank < best && p.appliesTo(finding)) {
|
|
168
|
+
fix = p.quickFix(finding, file.filePath);
|
|
169
|
+
best = rank;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
results.push({
|
|
173
|
+
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
174
|
+
kind: finding.kind,
|
|
175
|
+
involvedId: undefined,
|
|
176
|
+
loc: range_1.SourceLocation.from(span(finding.node), file.filePath),
|
|
177
|
+
message: describe(finding),
|
|
178
|
+
quickFix: fix ? [fix] : undefined
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return { results, '.meta': { parser, errors: results.length, fixable: results.filter(r => r.quickFix !== undefined).length } };
|
|
184
|
+
},
|
|
185
|
+
prettyPrint: {
|
|
186
|
+
[linter_format_1.LintingPrettyPrintContext.Query]: (result) => `${result.message} at ${range_1.SourceLocation.format(result.loc)}`,
|
|
187
|
+
[linter_format_1.LintingPrettyPrintContext.Full]: (result) => `Syntax error (${result.kind}): ${result.message} at ${range_1.SourceLocation.format(result.loc)}`
|
|
188
|
+
},
|
|
189
|
+
info: {
|
|
190
|
+
name: 'Syntactically Valid',
|
|
191
|
+
description: 'Checks whether the code is free of syntax errors, using the configured (error-tolerant) parser, and offers extensible quick-fixes to repair them.',
|
|
192
|
+
tags: [linter_tags_1.LintingRuleTag.Bug, linter_tags_1.LintingRuleTag.Robustness, linter_tags_1.LintingRuleTag.QuickFix],
|
|
193
|
+
// tree-sitter reports real syntax errors precisely, but a strict parse may collapse a region into fewer findings
|
|
194
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
195
|
+
// only meaningful under tree-sitter, so opt-in rather than part of the default set
|
|
196
|
+
activeByDefault: false,
|
|
197
|
+
defaultConfig: {
|
|
198
|
+
disabledFixes: [],
|
|
199
|
+
preferFix: 'remove'
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
//# sourceMappingURL=syntactically-valid.js.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UNDEFINED_SYMBOL = void 0;
|
|
4
4
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
5
|
+
const graph_1 = require("../../dataflow/graph/graph");
|
|
5
6
|
const dfg_get_origin_1 = require("../../dataflow/origin/dfg-get-origin");
|
|
6
7
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
7
8
|
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
@@ -56,12 +57,12 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
56
57
|
// findings as low-confidence (`mayBeProvidedByUnresolvedLibrary`) so the severity can be lowered
|
|
57
58
|
const unknownIds = new Set();
|
|
58
59
|
for (const e of graph.unknownSideEffects) {
|
|
59
|
-
unknownIds.add(
|
|
60
|
+
unknownIds.add(graph_1.UnknownSideEffect.id(e));
|
|
60
61
|
}
|
|
61
62
|
let unresolvedLibraryInScope = false;
|
|
62
63
|
if (unknownIds.size > 0) {
|
|
63
64
|
for (const [id, v] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
64
|
-
if (LibraryLoadFunctions.has(identifier_1.Identifier.getName(v.name)) && unknownIds.has(
|
|
65
|
+
if (LibraryLoadFunctions.has(identifier_1.Identifier.getName(v.name)) && unknownIds.has(id)) {
|
|
65
66
|
unresolvedLibraryInScope = true;
|
|
66
67
|
break;
|
|
67
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagleoutice/flowr",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.2",
|
|
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": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"setup:dev": "git lfs fetch && npm ci && git config --local core.hooksPath .githooks/ && git push --dry-run",
|
|
16
16
|
"main": "npm run build:bundle-flowr && node dist/src/cli/flowr.min.js",
|
|
17
17
|
"flowr": "npm run main --",
|
|
18
|
-
"flowr:dev": "npm run gen:base-packages && npm run main-dev --",
|
|
18
|
+
"flowr:dev": "npm run sync:sigdb && npm run gen:base-packages && npm run main-dev --",
|
|
19
19
|
"main-dev": "node -r ts-node/register --watch src/cli/flowr.ts",
|
|
20
20
|
"publish-library": "cp .npmignore package.json README.md LICENSE dist/src/ && cd dist/src && npm publish --access public",
|
|
21
21
|
"release": "npx release-it --ci",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"wiki:watch": "node -r ts-node/register --watch src/cli/wiki.ts --keep-alive",
|
|
30
30
|
"build": "npm run gen:base-packages && tsc --project . && npm run build:copy-data",
|
|
31
31
|
"gen:base-packages": "ts-node --transpile-only scripts/gen-base-packages.ts",
|
|
32
|
-
"sync:sigdb": "ts-node --transpile-only scripts/sigdb-
|
|
32
|
+
"sync:sigdb": "ts-node --transpile-only scripts/sigdb-sync.ts",
|
|
33
|
+
"gen:sigdb-remote": "ts-node --transpile-only scripts/sigdb-remote.ts",
|
|
33
34
|
"publish:sigdb": "ts-node scripts/publish-sigdb.ts",
|
|
34
35
|
"build:copy-data": "ts-node --transpile-only scripts/sigdb-copy.ts",
|
|
35
36
|
"build-dev": "npm run build && npm run build:copy-wasm",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"test-full": "npm run test:coverage -- --no-watch -- --make-summary --test-installation",
|
|
49
50
|
"performance-test": "func() { cd test/performance/ && bash run-all-suites.sh $1 $2 $3 $4; cd ../../; }; func",
|
|
50
51
|
"test:performance": "npm run performance-test --",
|
|
51
|
-
"test:docker": "func() { for df in scripts/Dockerfile scripts/Dockerfile-NoR; do echo \"=== building $df ===\";
|
|
52
|
+
"test:docker": "func() { b() { docker build ${1:+--network=$1} -t flowr-docker-test -f \"$2\" .; }; r() { docker run --rm ${1:+--network=$1} flowr-docker-test --version; }; for df in scripts/Dockerfile scripts/Dockerfile-NoR; do echo \"=== building $df ===\"; b '' \"$df\" || { echo '(retrying with --network=host: bridge networking unavailable)'; b host \"$df\"; } || return 1; echo \"=== smoke-testing $df ===\"; r '' || r host || return 1; done; }; func",
|
|
52
53
|
"detect-circular-deps": "npx madge --extensions ts,tsx --circular src/",
|
|
53
54
|
"checkup": "ts-node scripts/checkup-parallel.ts"
|
|
54
55
|
},
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ProjectKind } from './project-kind';
|
|
2
|
+
/** Lazily read a shiny-entry file's content; returns `undefined` when it cannot be read. */
|
|
3
|
+
export type ContentReader = () => string | undefined;
|
|
4
|
+
/** The evidence {@link classifyProjectKind} works from. */
|
|
5
|
+
export interface ProjectKindSignals {
|
|
6
|
+
/** lower-cased basenames of every file known so far */
|
|
7
|
+
readonly names: ReadonlySet<string>;
|
|
8
|
+
/** shiny-entry basename to a reader for its content */
|
|
9
|
+
readonly entries: ReadonlyMap<string, ContentReader>;
|
|
10
|
+
/** the lower-cased `Type:` of each known `DESCRIPTION` (`''` when absent) */
|
|
11
|
+
readonly descriptionTypes: readonly string[];
|
|
12
|
+
/** how many `DESCRIPTION` files are known */
|
|
13
|
+
readonly descriptionCount: number;
|
|
14
|
+
}
|
|
15
|
+
/** The configurable classification inputs, from `project.classification`. */
|
|
16
|
+
export interface ClassificationConfig {
|
|
17
|
+
readonly shinyDescriptionTypes?: readonly string[];
|
|
18
|
+
readonly shinyEntryFiles?: readonly string[];
|
|
19
|
+
readonly shinyUsagePattern?: string;
|
|
20
|
+
readonly notebookExtensions?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/** {@link ClassificationConfig} resolved to matchers, falling back to the built-in defaults. */
|
|
23
|
+
export interface ResolvedClassifyOptions {
|
|
24
|
+
readonly shinyDescriptionTypes: ReadonlySet<string>;
|
|
25
|
+
readonly shinyEntryFiles: ReadonlySet<string>;
|
|
26
|
+
readonly shinyUsage: RegExp;
|
|
27
|
+
readonly notebookExtension: RegExp;
|
|
28
|
+
}
|
|
29
|
+
/** Resolve {@link ClassificationConfig} into {@link ResolvedClassifyOptions}, using the built-in defaults for unset fields. */
|
|
30
|
+
export declare function resolveClassifyOptions(cfg?: ClassificationConfig): ResolvedClassifyOptions;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the project is a shiny app: it has the canonical entry files (a single `app.R`, or the `ui.R`+`server.R`
|
|
33
|
+
* pair) and one of them uses the shiny stack. When no entry file can be read we trust the file names alone.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isShinyAppSignals(names: ReadonlySet<string>, entries: ReadonlyMap<string, ContentReader>, shinyUsagePattern?: RegExp): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Classify the {@link ProjectKind} from the given {@link ProjectKindSignals}. Shiny apps are detected first (they
|
|
38
|
+
* often ship a `DESCRIPTION` too), then packages, then notebooks; the rest is a single-file `Script` or a `Project`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function classifyProjectKind(signals: ProjectKindSignals, opts?: ResolvedClassifyOptions): ProjectKind;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveClassifyOptions = resolveClassifyOptions;
|
|
4
|
+
exports.isShinyAppSignals = isShinyAppSignals;
|
|
5
|
+
exports.classifyProjectKind = classifyProjectKind;
|
|
6
|
+
const project_kind_1 = require("./project-kind");
|
|
7
|
+
/** default DESCRIPTION `Type:` values marking a shiny app */
|
|
8
|
+
const shinyDescriptionTypes = new Set(['shiny', 'shiny-app', 'shinyapp']);
|
|
9
|
+
/** default (lower-cased) file names a shiny app is assembled from */
|
|
10
|
+
const shinyEntryFiles = new Set(['app.r', 'ui.r', 'server.r', 'global.r']);
|
|
11
|
+
/** default evidence that a file is part of a shiny app (a load of the shiny stack or a call to one of its entry points) */
|
|
12
|
+
const shinyUsage = /(?:library|require|requireNamespace|loadNamespace)\s*\(\s*['"]?(?:shiny|bslib|shinydashboard|shinyMobile|golem|flexdashboard)\b|\b(?:shinyApp|shinyServer|shinyUI|runApp|fluidPage|fluidRow|navbarPage|bootstrapPage|fillPage|dashboardPage|page_fluid|page_sidebar|page_navbar|pageWithSidebar)\s*\(/;
|
|
13
|
+
/** default extensions marking a notebook / literate document */
|
|
14
|
+
const notebookExtension = /\.(ipynb|rmd|qmd|rnw)$/;
|
|
15
|
+
/** Resolve {@link ClassificationConfig} into {@link ResolvedClassifyOptions}, using the built-in defaults for unset fields. */
|
|
16
|
+
function resolveClassifyOptions(cfg) {
|
|
17
|
+
return {
|
|
18
|
+
shinyDescriptionTypes: cfg?.shinyDescriptionTypes ? new Set(cfg.shinyDescriptionTypes.map(s => s.toLowerCase())) : shinyDescriptionTypes,
|
|
19
|
+
shinyEntryFiles: cfg?.shinyEntryFiles ? new Set(cfg.shinyEntryFiles.map(s => s.toLowerCase())) : shinyEntryFiles,
|
|
20
|
+
shinyUsage: cfg?.shinyUsagePattern ? new RegExp(cfg.shinyUsagePattern) : shinyUsage,
|
|
21
|
+
notebookExtension: cfg?.notebookExtensions ? new RegExp(`\\.(${cfg.notebookExtensions.join('|')})$`, 'i') : notebookExtension
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const defaultClassifyOptions = resolveClassifyOptions();
|
|
25
|
+
/**
|
|
26
|
+
* Whether the project is a shiny app: it has the canonical entry files (a single `app.R`, or the `ui.R`+`server.R`
|
|
27
|
+
* pair) and one of them uses the shiny stack. When no entry file can be read we trust the file names alone.
|
|
28
|
+
*/
|
|
29
|
+
function isShinyAppSignals(names, entries, shinyUsagePattern = shinyUsage) {
|
|
30
|
+
if (!names.has('app.r') && !(names.has('ui.r') && names.has('server.r'))) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
let couldRead = false;
|
|
34
|
+
for (const read of entries.values()) {
|
|
35
|
+
const content = read();
|
|
36
|
+
if (content === undefined) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
couldRead = true;
|
|
40
|
+
if (shinyUsagePattern.test(content)) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return !couldRead;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Classify the {@link ProjectKind} from the given {@link ProjectKindSignals}. Shiny apps are detected first (they
|
|
48
|
+
* often ship a `DESCRIPTION` too), then packages, then notebooks; the rest is a single-file `Script` or a `Project`.
|
|
49
|
+
*/
|
|
50
|
+
function classifyProjectKind(signals, opts = defaultClassifyOptions) {
|
|
51
|
+
if (signals.descriptionTypes.some(t => opts.shinyDescriptionTypes.has(t))) {
|
|
52
|
+
return project_kind_1.ProjectKind.ShinyApp;
|
|
53
|
+
}
|
|
54
|
+
if (isShinyAppSignals(signals.names, signals.entries, opts.shinyUsage)) {
|
|
55
|
+
return project_kind_1.ProjectKind.ShinyApp;
|
|
56
|
+
}
|
|
57
|
+
if (signals.descriptionCount > 0) {
|
|
58
|
+
return project_kind_1.ProjectKind.Package;
|
|
59
|
+
}
|
|
60
|
+
if (signals.names.size === 0) {
|
|
61
|
+
return project_kind_1.ProjectKind.Unknown;
|
|
62
|
+
}
|
|
63
|
+
for (const name of signals.names) {
|
|
64
|
+
if (opts.notebookExtension.test(name)) {
|
|
65
|
+
return project_kind_1.ProjectKind.Notebook;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let rSources = 0;
|
|
69
|
+
for (const name of signals.names) {
|
|
70
|
+
if (name.endsWith('.r')) {
|
|
71
|
+
rSources++;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return rSources <= 1 ? project_kind_1.ProjectKind.Script : project_kind_1.ProjectKind.Project;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=classify-project-kind.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractFlowrAnalyzerContext } from './abstract-flowr-analyzer-context';
|
|
2
2
|
import { FlowrAnalyzerPackageVersionsPlugin, type SigDbLoadedInfo } from '../plugins/package-version-plugins/flowr-analyzer-package-versions-plugin';
|
|
3
|
-
import
|
|
3
|
+
import { Package } from '../plugins/package-version-plugins/package';
|
|
4
4
|
import type { PackageSignatureSource } from '../sigdb/reader';
|
|
5
5
|
import { Identifier } from '../../dataflow/environments/identifier';
|
|
6
6
|
import type { DecodedFunction } from '../sigdb/decode';
|
|
@@ -22,10 +22,14 @@ export interface ReadOnlyFlowrAnalyzerDependenciesContext {
|
|
|
22
22
|
* Get the dependency with the given name, if it exists.
|
|
23
23
|
*
|
|
24
24
|
* If the static dependencies have not yet been loaded, this may trigger a resolution step.
|
|
25
|
-
*
|
|
25
|
+
* Pass `version` to pin the resolution to a constraint (an exact version string, or a {@link Range}; uncached;
|
|
26
|
+
* `versionOverrides` config still wins, base-R stays tied to the assumed R version); otherwise the version
|
|
27
|
+
* comes from the declared constraints.
|
|
28
|
+
* @param name - The name of the dependency to get.
|
|
29
|
+
* @param version - Optional version constraint to pin the resolution to (exact version string or a {@link Range}).
|
|
26
30
|
* @returns The dependency with the given name, or undefined if it does not exist.
|
|
27
31
|
*/
|
|
28
|
-
getDependency(name: string): Readonly<Package> | undefined;
|
|
32
|
+
getDependency(name: string, version?: string | Range): Readonly<Package> | undefined;
|
|
29
33
|
/**
|
|
30
34
|
* The versions a dependency can possibly have, combining everything declared for it (a `DESCRIPTION` range,
|
|
31
35
|
* an `rproject.toml` entry, a lockfile pin, ...). `undefined` if the dependency is unknown, if nothing
|
|
@@ -44,6 +48,17 @@ export interface ReadOnlyFlowrAnalyzerDependenciesContext {
|
|
|
44
48
|
* Metadata of the signature databases the version plugins currently have loaded.
|
|
45
49
|
*/
|
|
46
50
|
loadedSignatureDatabases(): SigDbLoadedInfo[];
|
|
51
|
+
/**
|
|
52
|
+
* The identifying names (scopes, e.g. `base`/`current`/`history`) of the signature databases currently
|
|
53
|
+
* available, deduplicated. A simple view over {@link loadedSignatureDatabases} for checking what a project
|
|
54
|
+
* can resolve against; empty when the signature database is disabled or none is loaded.
|
|
55
|
+
*/
|
|
56
|
+
availableSignatureDatabases(): readonly string[];
|
|
57
|
+
/**
|
|
58
|
+
* Whether at least one signature database is available (i.e., {@link availableSignatureDatabases} is non-empty).
|
|
59
|
+
* Cheaper than materializing the list when only the presence matters.
|
|
60
|
+
*/
|
|
61
|
+
hasSignatureDatabase(): boolean;
|
|
47
62
|
/**
|
|
48
63
|
* The names of known packages that export `name` (from the version plugins' signature databases). Used to
|
|
49
64
|
* hint which `library()`/`::` might be missing for an otherwise-undefined symbol. Empty if no database is
|
|
@@ -76,6 +91,8 @@ export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnaly
|
|
|
76
91
|
/** Register a resolver consulted by {@link getDependency} to fill in a package's exports lazily. */
|
|
77
92
|
addLazyResolver(resolver: (name: string, existing?: Package) => Package | undefined): void;
|
|
78
93
|
loadedSignatureDatabases(): SigDbLoadedInfo[];
|
|
94
|
+
availableSignatureDatabases(): readonly string[];
|
|
95
|
+
hasSignatureDatabase(): boolean;
|
|
79
96
|
packagesExporting(name: string): readonly string[];
|
|
80
97
|
signatureSources(): readonly PackageSignatureSource[];
|
|
81
98
|
signatureOf(id: Identifier, version?: string): DecodedFunction | undefined;
|
|
@@ -99,7 +116,9 @@ export declare class FlowrAnalyzerDependenciesContext extends AbstractFlowrAnaly
|
|
|
99
116
|
*/
|
|
100
117
|
addDeclaredDependency(pkg: Package): this;
|
|
101
118
|
addDependency(pkg: Package): this;
|
|
102
|
-
getDependency(name: string): Package | undefined;
|
|
119
|
+
getDependency(name: string, version?: string | Range): Package | undefined;
|
|
120
|
+
/** Resolve `name` constrained to `range` via the plugins (uncached); falls back to the cached dependency. */
|
|
121
|
+
private resolvePinnedDependency;
|
|
103
122
|
inferredVersion(name: string): Range | undefined;
|
|
104
123
|
getDependencies(): Package[];
|
|
105
124
|
}
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FlowrAnalyzerDependenciesContext = void 0;
|
|
4
4
|
const abstract_flowr_analyzer_context_1 = require("./abstract-flowr-analyzer-context");
|
|
5
5
|
const flowr_analyzer_package_versions_plugin_1 = require("../plugins/package-version-plugins/flowr-analyzer-package-versions-plugin");
|
|
6
|
+
const package_1 = require("../plugins/package-version-plugins/package");
|
|
6
7
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
7
8
|
const config_1 = require("../../config");
|
|
9
|
+
const r_version_1 = require("../../util/r-version");
|
|
8
10
|
/**
|
|
9
11
|
* Manages the project's dependencies, their versions, and their interplay with {@link FlowrAnalyzerPackageVersionsPlugin}s.
|
|
10
12
|
*/
|
|
@@ -32,6 +34,12 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
32
34
|
}
|
|
33
35
|
return this.plugins.flatMap(p => p.loadedDatabases());
|
|
34
36
|
}
|
|
37
|
+
availableSignatureDatabases() {
|
|
38
|
+
return [...new Set(this.loadedSignatureDatabases().map(d => d.scope))];
|
|
39
|
+
}
|
|
40
|
+
hasSignatureDatabase() {
|
|
41
|
+
return (0, config_1.isSigDbEnabled)(this.ctx.config) && this.plugins.some(p => p.loadedDatabases().length > 0);
|
|
42
|
+
}
|
|
35
43
|
packagesExporting(name) {
|
|
36
44
|
if (!(0, config_1.isSigDbEnabled)(this.ctx.config)) {
|
|
37
45
|
return [];
|
|
@@ -129,10 +137,13 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
129
137
|
}
|
|
130
138
|
return this;
|
|
131
139
|
}
|
|
132
|
-
getDependency(name) {
|
|
140
|
+
getDependency(name, version) {
|
|
133
141
|
if (!this.staticsLoaded) {
|
|
134
142
|
this.resolveStaticDependencies();
|
|
135
143
|
}
|
|
144
|
+
if (version !== undefined) {
|
|
145
|
+
return this.resolvePinnedDependency(name, typeof version === 'string' ? r_version_1.RRange.parse('=' + version) : version);
|
|
146
|
+
}
|
|
136
147
|
const existing = this.dependencies.get(name);
|
|
137
148
|
// a package already carrying exports is complete; a version-only one is still enriched below
|
|
138
149
|
if (existing?.namespaceInfo || (!existing && this.resolvedMisses.has(name))) {
|
|
@@ -150,6 +161,17 @@ class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1
|
|
|
150
161
|
}
|
|
151
162
|
return existing;
|
|
152
163
|
}
|
|
164
|
+
/** Resolve `name` constrained to `range` via the plugins (uncached); falls back to the cached dependency. */
|
|
165
|
+
resolvePinnedDependency(name, range) {
|
|
166
|
+
const pin = new package_1.Package({ name, derivedVersion: range });
|
|
167
|
+
for (const resolve of this.lazyResolvers) {
|
|
168
|
+
const resolved = resolve(name, pin);
|
|
169
|
+
if (resolved) {
|
|
170
|
+
return resolved;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return this.getDependency(name);
|
|
174
|
+
}
|
|
153
175
|
inferredVersion(name) {
|
|
154
176
|
const pkg = this.getDependency(name);
|
|
155
177
|
return pkg?.hasSatisfiableVersion() ? pkg.derivedVersion : undefined;
|
|
@@ -8,7 +8,7 @@ import type { FlowrDescriptionFile } from '../plugins/file-plugins/files/flowr-d
|
|
|
8
8
|
import type { FlowrNewsFile } from '../plugins/file-plugins/files/flowr-news-file';
|
|
9
9
|
import type { FlowrNamespaceFile } from '../plugins/file-plugins/files/flowr-namespace-file';
|
|
10
10
|
import type { FlowrRProjectFile } from '../plugins/file-plugins/files/flowr-rproject-file';
|
|
11
|
-
import { ProjectKind } from './project-kind';
|
|
11
|
+
import type { ProjectKind } from './project-kind';
|
|
12
12
|
/**
|
|
13
13
|
* This is a request to process a folder as a project, which will be expanded by the registered {@link FlowrAnalyzerProjectDiscoveryPlugin}s.
|
|
14
14
|
*/
|
|
@@ -31,6 +31,7 @@ export type RoleBasedFiles = {
|
|
|
31
31
|
[FileRole.License]: FlowrFileProvider[];
|
|
32
32
|
[FileRole.VirtualEnv]: FlowrFileProvider[];
|
|
33
33
|
[FileRole.Startup]: FlowrFileProvider[];
|
|
34
|
+
[FileRole.Environment]: FlowrFileProvider[];
|
|
34
35
|
[FileRole.Source]: FlowrFileProvider[];
|
|
35
36
|
[FileRole.Data]: FlowrFileProvider[];
|
|
36
37
|
[FileRole.Other]: FlowrFileProvider[];
|
|
@@ -93,6 +94,8 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
|
|
|
93
94
|
* @returns The actual path of the file if it exists, otherwise `undefined`.
|
|
94
95
|
*/
|
|
95
96
|
exists(path: string, ignoreCase: boolean): string | undefined;
|
|
97
|
+
/** The project root folder (common directory of the requested roots), or `undefined` if none was requested. */
|
|
98
|
+
root(): string | undefined;
|
|
96
99
|
/**
|
|
97
100
|
* Until parsers support multiple request types from the virtual context system,
|
|
98
101
|
* we resolve their contents.
|
|
@@ -112,6 +115,11 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
|
|
|
112
115
|
* {@link ProjectKind.Unknown}. The result is cached and invalidated whenever the files change.
|
|
113
116
|
*/
|
|
114
117
|
projectKind(): ProjectKind;
|
|
118
|
+
/**
|
|
119
|
+
* The root paths that were requested for analysis: the folder for a project request, or the containing
|
|
120
|
+
* folder for a single-file request. Useful to report back which inputs did not resolve to anything.
|
|
121
|
+
*/
|
|
122
|
+
getRequestedRoots(): readonly string[];
|
|
115
123
|
}
|
|
116
124
|
/**
|
|
117
125
|
* This is the analyzer file context to be modified by all plugins that affect the files.
|
|
@@ -152,14 +160,8 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
|
|
|
152
160
|
*/
|
|
153
161
|
consideredFilesList(): readonly string[];
|
|
154
162
|
projectKind(): ProjectKind;
|
|
163
|
+
getRequestedRoots(): readonly string[];
|
|
155
164
|
private classifyProject;
|
|
156
|
-
/**
|
|
157
|
-
* Whether the project is a shiny app: it has the canonical entry files (a single `app.R`, or the `ui.R`+`server.R`
|
|
158
|
-
* pair -- a lone `server.R` is not enough) and one of them actually loads or calls the shiny stack. The usage
|
|
159
|
-
* check keeps a coincidental `ui.R`/`server.R` pair from being mistaken for an app; only when none of the entry
|
|
160
|
-
* files can be read do we fall back to trusting the file names alone.
|
|
161
|
-
*/
|
|
162
|
-
private isShinyApp;
|
|
163
165
|
/**
|
|
164
166
|
* Add multiple requests to the context. This is just a convenience method that calls {@link addRequest} for each request.
|
|
165
167
|
*/
|