@eagleoutice/flowr 2.13.9 → 2.13.11
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 +40 -40
- package/config.d.ts +50 -2
- package/config.js +37 -6
- package/dataflow/environments/apply-kill.js +4 -4
- package/dataflow/environments/built-in-props.d.ts +28 -4
- package/dataflow/environments/built-in-props.js +31 -8
- package/dataflow/environments/built-in.d.ts +7 -2
- package/dataflow/environments/built-in.js +10 -12
- package/dataflow/environments/default-builtin-config.d.ts +46 -6
- package/dataflow/environments/default-builtin-config.js +30 -16
- package/dataflow/environments/environment.d.ts +16 -0
- package/dataflow/environments/environment.js +114 -26
- package/dataflow/environments/identifier.d.ts +6 -0
- package/dataflow/environments/identifier.js +18 -5
- package/dataflow/environments/query-fn-props.js +34 -2
- package/dataflow/environments/reference-to-maybe.js +1 -1
- package/dataflow/environments/resolve-by-name.js +16 -6
- package/dataflow/environments/resolve-helper.d.ts +43 -0
- package/dataflow/environments/resolve-helper.js +47 -0
- package/dataflow/eval/resolve/alias-tracking.js +45 -1
- package/dataflow/eval/resolve/resolve-argument.js +25 -17
- package/dataflow/eval/resolve/resolve-strings.d.ts +17 -0
- package/dataflow/eval/resolve/resolve-strings.js +16 -9
- package/dataflow/eval/resolve/resolve.js +3 -1
- package/dataflow/graph/call-graph.d.ts +7 -0
- package/dataflow/graph/call-graph.js +103 -0
- package/dataflow/graph/df-helper.d.ts +50 -1
- package/dataflow/graph/df-helper.js +63 -0
- package/dataflow/graph/graph.d.ts +5 -8
- package/dataflow/graph/graph.js +24 -13
- package/dataflow/internal/linker.d.ts +5 -5
- package/dataflow/internal/linker.js +31 -92
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +3 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +4 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +32 -14
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +16 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +29 -8
- package/documentation/data/faq/faqs.js +1 -1
- package/documentation/data/faq/wiki-faq-store.js +3 -2
- package/documentation/data/server/doc-data-server-messages.js +1 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-files.d.ts +5 -0
- package/documentation/doc-util/doc-files.js +13 -3
- package/documentation/doc-util/doc-sigdb.d.ts +9 -0
- package/documentation/doc-util/doc-sigdb.js +32 -0
- package/documentation/wiki-analyzer.js +10 -10
- package/documentation/wiki-core.js +1 -1
- package/documentation/wiki-dataflow-graph.js +3 -3
- package/documentation/wiki-interface.js +13 -2
- package/documentation/wiki-linting-and-testing.js +13 -13
- package/documentation/wiki-mk/doc-context.d.ts +1 -1
- package/documentation/wiki-mk/doc-context.js +9 -5
- package/documentation/wiki-normalized-ast.js +1 -1
- package/documentation/wiki-overview.js +2 -2
- package/documentation/wiki-query.js +4 -1
- package/documentation/wiki-setup.js +3 -3
- package/documentation/wiki-signature-database.js +2 -5
- package/gas.d.ts +6 -0
- package/gas.js +7 -1
- package/linter/linter-rules.d.ts +1 -1
- package/linter/rules/syntactically-valid.d.ts +12 -1
- package/linter/rules/syntactically-valid.js +88 -17
- package/package.json +7 -8
- package/project/attached-packages.d.ts +13 -0
- package/project/attached-packages.js +30 -0
- package/project/context/flowr-analyzer-context.d.ts +15 -0
- package/project/context/flowr-analyzer-context.js +14 -3
- package/project/context/flowr-analyzer-files-context.d.ts +11 -0
- package/project/context/flowr-analyzer-files-context.js +3 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.js +69 -0
- package/project/context/flowr-analyzer-loading-order-context.d.ts +8 -0
- package/project/context/flowr-analyzer-loading-order-context.js +23 -2
- package/project/dependency-version-space.d.ts +33 -11
- package/project/dependency-version-space.js +58 -32
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +52 -24
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.d.ts +22 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +101 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +30 -11
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +79 -37
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/project/sigdb/manifest.js +9 -5
- package/project/sigdb/reader.d.ts +20 -0
- package/project/sigdb/reader.js +93 -10
- package/project/sigdb/signature-match.d.ts +5 -18
- package/project/sigdb/signature-match.js +5 -18
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +4 -0
- package/queries/catalog/call-graph-query/call-graph-query-format.js +4 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +11 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +25 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -2
- package/queries/catalog/dependencies-query/function-info/library-functions.js +7 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -5
- package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +18 -0
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +46 -0
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +52 -2
- package/queries/catalog/dependencies-query/function-info/write-functions.js +8 -4
- package/queries/catalog/dependencies-query/link-devices.d.ts +16 -0
- package/queries/catalog/dependencies-query/link-devices.js +104 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +2 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +25 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +37 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +17 -4
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +14 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +18 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.js +4 -0
- package/queries/catalog/input-sources-query/input-types.d.ts +10 -0
- package/queries/catalog/input-sources-query/input-types.js +10 -0
- package/queries/catalog/location-map-query/location-map-query-executor.js +16 -6
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +15 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +22 -5
- package/queries/catalog/signature-query/signature-query-executor.js +3 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +5 -0
- package/queries/catalog/slice-query-options.d.ts +11 -1
- package/queries/catalog/slice-query-options.js +8 -4
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +5 -1
- package/queries/query.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +23 -2
- package/r-bridge/lang-4.x/ast/model/model.js +44 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +8 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +9 -46
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +6 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
- package/reconstruct/reconstruct.d.ts +9 -0
- package/reconstruct/reconstruct.js +1 -0
- package/search/flowr-search-filters.d.ts +25 -1
- package/search/flowr-search-filters.js +42 -7
- package/search/search-executor/search-generators.js +7 -2
- package/search/search-executor/search-transformer.js +4 -1
- package/slicing/criterion/parse.d.ts +5 -25
- package/slicing/criterion/parse.js +15 -20
- package/slicing/static/fingerprint.js +18 -6
- package/slicing/static/slice-call.js +2 -2
- package/slicing/static/slicer-types.d.ts +10 -0
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +29 -6
- package/slicing/static/visiting-queue.d.ts +12 -2
- package/slicing/static/visiting-queue.js +28 -3
- package/util/arg-matching.d.ts +18 -0
- package/util/arg-matching.js +70 -0
- package/util/collections/bimap.d.ts +21 -1
- package/util/collections/bimap.js +43 -7
- package/util/r-regex.js +19 -1
- package/util/range.d.ts +7 -8
- package/util/range.js +10 -11
- package/util/version.js +1 -1
|
@@ -15,6 +15,7 @@ const assert_1 = require("../../../util/assert");
|
|
|
15
15
|
const log_1 = require("../../../util/log");
|
|
16
16
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
17
17
|
const graph_1 = require("../../../dataflow/graph/graph");
|
|
18
|
+
const link_devices_1 = require("./link-devices");
|
|
18
19
|
/**
|
|
19
20
|
* Executes a dependencies query.
|
|
20
21
|
*/
|
|
@@ -64,6 +65,10 @@ async function executeDependenciesQuery({ analyzer, }, queries) {
|
|
|
64
65
|
}
|
|
65
66
|
return [c, results];
|
|
66
67
|
})));
|
|
68
|
+
/* also without a device: a plot on screen has no file, but still has the addons drawn onto it */
|
|
69
|
+
if (results.visualize?.length) {
|
|
70
|
+
(0, link_devices_1.linkPlotsToDevices)(results.write ?? [], results.visualize, dataflow, normalize);
|
|
71
|
+
}
|
|
67
72
|
return {
|
|
68
73
|
'.meta': {
|
|
69
74
|
timing: Date.now() - now
|
|
@@ -191,10 +196,13 @@ function getResults(queries, { dataflow, config, normalize }, results, kind, fun
|
|
|
191
196
|
resolvedValue = info.stringReplacements[resolvedValue];
|
|
192
197
|
}
|
|
193
198
|
const dep = resolvedValue ? d.getDependency(resolvedValue) ?? undefined : undefined;
|
|
199
|
+
const lexeme = getLexeme(value, arg);
|
|
194
200
|
finalResults.push((0, objects_1.compactRecord)({
|
|
195
201
|
nodeId: id,
|
|
196
202
|
functionName,
|
|
197
|
-
|
|
203
|
+
/* only a value we could not make sense of is worth asking about further */
|
|
204
|
+
argumentId: lexeme === undefined ? undefined : arg,
|
|
205
|
+
lexemeOfArgument: lexeme,
|
|
198
206
|
linkedIds: linked?.length ? linked : undefined,
|
|
199
207
|
value: resolvedValue ?? info.defaultValue ?? defaultValue,
|
|
200
208
|
versionConstraints: dep?.versionConstraints,
|
|
@@ -207,7 +215,7 @@ function getResults(queries, { dataflow, config, normalize }, results, kind, fun
|
|
|
207
215
|
}
|
|
208
216
|
return finalResults;
|
|
209
217
|
function getLexeme(argument, id) {
|
|
210
|
-
if ((argument && argument !== dependencies_query_format_1.Unknown) || !id) {
|
|
218
|
+
if ((argument && argument !== dependencies_query_format_1.Unknown && argument !== dependencies_query_format_1.Constant) || !id) {
|
|
211
219
|
return undefined;
|
|
212
220
|
}
|
|
213
221
|
let get = normalize.idMap.get(id);
|
|
@@ -221,7 +229,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
|
|
|
221
229
|
if (!linkedIds || linkedIds.length === 0) {
|
|
222
230
|
return undefined;
|
|
223
231
|
}
|
|
224
|
-
const hasAtLeastAValue = args !== undefined && args.values().flatMap(x => Array.from(x)).toArray().some(v => v !== dependencies_query_format_1.Unknown && v !== undefined);
|
|
232
|
+
const hasAtLeastAValue = args !== undefined && args.values().flatMap(x => Array.from(x)).toArray().some(v => v !== dependencies_query_format_1.Unknown && v !== dependencies_query_format_1.Constant && v !== undefined);
|
|
225
233
|
const map = new Map();
|
|
226
234
|
for (const linkedId of linkedIds) {
|
|
227
235
|
if (typeof linkedId !== 'object' || !linkedId.info) {
|
|
@@ -9,7 +9,10 @@ import type { Range } from 'semver';
|
|
|
9
9
|
import type { AsyncOrSync, MarkOptional } from 'ts-essentials';
|
|
10
10
|
import type { NamespaceInfo } from '../../../project/plugins/file-plugins/files/flowr-namespace-file';
|
|
11
11
|
import { Identifier } from '../../../dataflow/environments/identifier';
|
|
12
|
+
/** The value could not be resolved, e.g. a path assembled at runtime. Such a dependency may be missing or fetchable. */
|
|
12
13
|
export declare const Unknown = "unknown";
|
|
14
|
+
/** The value resolved, but to data given inline rather than to a path (`matrix(0, 2, 2)`, `data.frame(a = 1)`). */
|
|
15
|
+
export declare const Constant = "constant";
|
|
13
16
|
export interface DependencyCategorySettings {
|
|
14
17
|
queryDisplayName?: string;
|
|
15
18
|
functions: FunctionInfo[];
|
|
@@ -33,6 +36,12 @@ export declare const DefaultDependencyCategories: {
|
|
|
33
36
|
readonly defaultValue: "unknown";
|
|
34
37
|
readonly additionalAnalysis: (data: BasicQueryData, ignoreDefault: boolean, _functions: FunctionInfo[], _queryResults: CallContextQueryResult, result: DependencyInfo[]) => Promise<void>;
|
|
35
38
|
};
|
|
39
|
+
readonly remote: {
|
|
40
|
+
readonly queryDisplayName: "Remote Installs";
|
|
41
|
+
readonly functions: FunctionInfo[];
|
|
42
|
+
readonly defaultValue: "unknown";
|
|
43
|
+
readonly additionalAnalysis: (_data: BasicQueryData, _ignoreDefault: boolean, _functions: FunctionInfo[], _queryResults: CallContextQueryResult, result: DependencyInfo[]) => void;
|
|
44
|
+
};
|
|
36
45
|
readonly source: {
|
|
37
46
|
readonly queryDisplayName: "Sourced Files";
|
|
38
47
|
readonly functions: FunctionInfo[];
|
|
@@ -82,13 +91,28 @@ export interface DependencyInfo extends Record<string, unknown> {
|
|
|
82
91
|
/** the called name; an {@link Identifier}, so a namespaced call like `maps::map` keeps its package */
|
|
83
92
|
functionName: Identifier;
|
|
84
93
|
linkedIds?: readonly NodeId[];
|
|
85
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* The other statements that build this output: for a plot, the addons drawn onto it and, when it lands in a
|
|
96
|
+
* file, the device opener and closer around it. Answers *which statements produce this output* without
|
|
97
|
+
* rebuilding it from {@link linkedIds}.
|
|
98
|
+
*/
|
|
99
|
+
parts?: readonly NodeId[];
|
|
100
|
+
/**
|
|
101
|
+
* the argument the value was read from, under the id the {@link InputSourcesQuery} reports it with: ask that
|
|
102
|
+
* query about {@link nodeId} and this entry of its answer says whether the value is a glob, a prompt, ...
|
|
103
|
+
*/
|
|
104
|
+
argumentId?: NodeId;
|
|
105
|
+
/** the lexeme is presented whenever the specific info is {@link Unknown} or {@link Constant} */
|
|
86
106
|
lexemeOfArgument?: string;
|
|
87
107
|
/** The library name, file, source, destination etc. being sourced, read from, or written to. */
|
|
88
108
|
value?: string;
|
|
89
109
|
versionConstraints?: readonly Range[];
|
|
90
110
|
derivedRange?: Range;
|
|
91
111
|
namespaceInfo?: NamespaceInfo;
|
|
112
|
+
/** the package the dependency provides, when the {@link value} names it only implicitly (a `user/repo` slug, a clone url) */
|
|
113
|
+
packageName?: string;
|
|
114
|
+
/** the revision such a reference pins, the `v1.2` of `user/repo@v1.2` */
|
|
115
|
+
revision?: string;
|
|
92
116
|
}
|
|
93
117
|
/**
|
|
94
118
|
* Gets all dependency categories, including user-defined additional categories.
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DependenciesQueryDefinition = exports.DefaultDependencyCategories = exports.Unknown = void 0;
|
|
6
|
+
exports.DependenciesQueryDefinition = exports.DefaultDependencyCategories = exports.Constant = exports.Unknown = void 0;
|
|
7
7
|
exports.getAllCategories = getAllCategories;
|
|
8
8
|
const ansi_1 = require("../../../util/text/ansi");
|
|
9
9
|
const time_1 = require("../../../util/text/time");
|
|
@@ -11,6 +11,7 @@ const joi_1 = __importDefault(require("joi"));
|
|
|
11
11
|
const dependencies_query_executor_1 = require("./dependencies-query-executor");
|
|
12
12
|
const library_functions_1 = require("./function-info/library-functions");
|
|
13
13
|
const source_functions_1 = require("./function-info/source-functions");
|
|
14
|
+
const remote_functions_1 = require("./function-info/remote-functions");
|
|
14
15
|
const read_functions_1 = require("./function-info/read-functions");
|
|
15
16
|
const write_functions_1 = require("./function-info/write-functions");
|
|
16
17
|
const visualize_functions_1 = require("./function-info/visualize-functions");
|
|
@@ -24,7 +25,10 @@ const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props"
|
|
|
24
25
|
const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
|
|
25
26
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
26
27
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
28
|
+
/** The value could not be resolved, e.g. a path assembled at runtime. Such a dependency may be missing or fetchable. */
|
|
27
29
|
exports.Unknown = 'unknown';
|
|
30
|
+
/** The value resolved, but to data given inline rather than to a path (`matrix(0, 2, 2)`, `data.frame(a = 1)`). */
|
|
31
|
+
exports.Constant = 'constant';
|
|
28
32
|
exports.DefaultDependencyCategories = {
|
|
29
33
|
'library': {
|
|
30
34
|
queryDisplayName: 'Libraries',
|
|
@@ -51,6 +55,20 @@ exports.DefaultDependencyCategories = {
|
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
},
|
|
58
|
+
'remote': {
|
|
59
|
+
queryDisplayName: 'Remote Installs',
|
|
60
|
+
functions: remote_functions_1.RemoteFunctions,
|
|
61
|
+
defaultValue: exports.Unknown,
|
|
62
|
+
/* the value is the reference as written, which names the package only implicitly */
|
|
63
|
+
additionalAnalysis: (_data, _ignoreDefault, _functions, _queryResults, result) => {
|
|
64
|
+
for (const [at, info] of result.entries()) {
|
|
65
|
+
const target = (0, remote_functions_1.remoteTarget)(info.value);
|
|
66
|
+
if (target !== undefined) {
|
|
67
|
+
result[at] = { ...info, ...target };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
54
72
|
'source': {
|
|
55
73
|
queryDisplayName: 'Sourced Files',
|
|
56
74
|
functions: source_functions_1.SourceFunctions,
|
|
@@ -114,7 +132,9 @@ function printResultSection(title, infos, result, formatter) {
|
|
|
114
132
|
// one line per dependency: the value (package/file) up front, its function + node as a faint provenance suffix
|
|
115
133
|
for (const i of infos) {
|
|
116
134
|
const fn = identifier_1.Identifier.getName(i.functionName);
|
|
117
|
-
|
|
135
|
+
/* neither names a resource: inline data is resolved but no path, `unknown` is a path we could not resolve */
|
|
136
|
+
const stands = i.value === exports.Constant ? '<inline data>' : i.value === exports.Unknown || i.value === undefined ? '<unresolved>' : undefined;
|
|
137
|
+
const value = stands !== undefined ? (0, ansi_1.faint)(stands, formatter) : (0, ansi_1.bold)(i.value, formatter);
|
|
118
138
|
const version = i.derivedRange !== undefined ? ` ${(0, ansi_1.faint)(i.derivedRange.format(), formatter)}` : '';
|
|
119
139
|
const linked = i.linkedIds ? `, linked ${i.linkedIds.join(', ')}` : '';
|
|
120
140
|
result.push(` ${value}${version} ${(0, ansi_1.faint)(`via ${fn} (node ${i.nodeId}${linked})`, formatter)}`);
|
|
@@ -5,17 +5,23 @@ exports.LibraryFunctions = [
|
|
|
5
5
|
{ package: 'base', name: 'library', argIdx: 0, argName: 'package', resolveValue: 'library' },
|
|
6
6
|
{ package: 'base', name: 'require', argIdx: 0, argName: 'package', resolveValue: 'library' },
|
|
7
7
|
{ package: 'base', name: 'loadNamespace', argIdx: 0, argName: 'package', resolveValue: true },
|
|
8
|
+
{ package: 'base', name: 'requireNamespace', argIdx: 0, argName: 'package', resolveValue: true },
|
|
8
9
|
{ package: 'base', name: 'attachNamespace', argIdx: 0, argName: 'ns', resolveValue: true },
|
|
9
10
|
{ package: 'base', name: 'attach', argIdx: 0, argName: 'what', resolveValue: true },
|
|
10
11
|
{ package: 'base', name: 'use', argIdx: 0, argName: 'package', resolveValue: 'library' },
|
|
11
12
|
{ package: 'groundhog', name: 'groundhog.library', argIdx: 0, argName: 'pkg', resolveValue: true },
|
|
12
13
|
{ package: 'pacman', name: 'p_load', argIdx: 'unnamed', resolveValue: 'library' },
|
|
13
14
|
{ package: 'pacman', name: 'p_load_gh', argIdx: 'unnamed', resolveValue: 'library' },
|
|
15
|
+
{ package: 'pacman', name: 'p_load_current_gh', argIdx: 'unnamed', resolveValue: 'library' },
|
|
16
|
+
{ package: 'xfun', name: 'pkg_attach', argIdx: 'unnamed', resolveValue: true },
|
|
17
|
+
{ package: 'xfun', name: 'pkg_attach2', argIdx: 'unnamed', resolveValue: true },
|
|
18
|
+
{ package: 'needs', name: 'needs', argIdx: 'unnamed', resolveValue: 'library' },
|
|
19
|
+
{ package: 'modules', name: 'import', argIdx: 0, argName: 'from', resolveValue: 'library' },
|
|
14
20
|
{ package: 'easypackages', name: 'from_import', argIdx: 0, argName: 'package', resolveValue: true },
|
|
15
21
|
{ package: 'easypackages', name: 'libraries', argIdx: 'unnamed', resolveValue: true },
|
|
16
22
|
{ package: 'librarian', name: 'shelf', argIdx: 'unnamed', resolveValue: true },
|
|
17
23
|
{ package: 'devtools', name: 'load_all', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
|
|
18
|
-
{ package: '
|
|
24
|
+
{ package: 'pkgload', name: 'load_code', argIdx: 0, argName: 'path', resolveValue: true, defaultValue: '.' },
|
|
19
25
|
{ package: 'import', name: 'from', argIdx: 0, argName: 'package', resolveValue: true },
|
|
20
26
|
{ package: 'rlang', name: 'on_package_load', argIdx: 0, argName: 'pkg', resolveValue: true }
|
|
21
27
|
];
|
|
@@ -6,7 +6,7 @@ const derived_functions_1 = require("./derived-functions");
|
|
|
6
6
|
const other_path_functions_1 = require("./other-path-functions");
|
|
7
7
|
const ReadFunctionsWithMore = [
|
|
8
8
|
{ package: 'base', name: 'parse', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
9
|
-
{ package: '
|
|
9
|
+
{ package: 'utils', name: 'read.table', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
|
|
10
10
|
{ package: 'utils', name: 'read.csv', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
|
|
11
11
|
{ package: 'utils', name: 'read.csv2', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
|
|
12
12
|
{ package: 'utils', name: 'read.delim', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
|
|
@@ -22,12 +22,13 @@ const ReadFunctionsWithMore = [
|
|
|
22
22
|
{ package: 'base', name: 'fifo', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
|
|
23
23
|
{ package: 'base', name: 'unz', argIdx: 0, argName: 'description', resolveValue: true, ignoreIf: 'mode-only-write', additionalArgs: { mode: { argIdx: 1, argName: 'open', resolveValue: true } } },
|
|
24
24
|
{ package: 'base', name: 'matrix', argIdx: 0, argName: 'data', resolveValue: true },
|
|
25
|
+
/* `data(mtcars)` names the dataset as a symbol (or as a string with `character.only`), just like `library` */
|
|
26
|
+
{ package: 'utils', name: 'data', argIdx: 0, resolveValue: 'library', ignoreIf: 'arg-missing' },
|
|
25
27
|
{ package: 'base', name: 'readRenviron', argIdx: 0, argName: 'path', resolveValue: true },
|
|
26
28
|
{ package: 'readr', name: 'read_csv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
27
29
|
{ package: 'readr', name: 'read_csv2', argIdx: 0, argName: 'file', resolveValue: true },
|
|
28
30
|
{ package: 'readr', name: 'read_lines', argIdx: 0, argName: 'file', resolveValue: true },
|
|
29
31
|
{ package: 'readr', name: 'read_delim', argIdx: 0, argName: 'file', resolveValue: true },
|
|
30
|
-
{ package: 'readr', name: 'read_dsv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
31
32
|
{ package: 'readr', name: 'read_fwf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
32
33
|
{ package: 'readr', name: 'read_tsv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
33
34
|
{ package: 'readr', name: 'read_table', argIdx: 0, argName: 'file', resolveValue: true },
|
|
@@ -68,7 +69,6 @@ const ReadFunctionsWithMore = [
|
|
|
68
69
|
{ package: 'sourcetools', name: 'tokenize', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
69
70
|
{ package: 'sourcetools', name: 'tokenize_file', argIdx: 0, argName: 'path', resolveValue: true },
|
|
70
71
|
{ package: 'expss', name: 'read_spss', argIdx: 0, argName: 'file', resolveValue: true },
|
|
71
|
-
{ package: 'expss', name: 'read_spss_to_list', argIdx: 0, argName: 'file', resolveValue: true },
|
|
72
72
|
{ package: 'SimPhe', name: 'read.geno', argIdx: 0, argName: 'fname', resolveValue: true },
|
|
73
73
|
{ package: 'ape', name: 'read.tree', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
74
74
|
{ package: 'geomorph', name: 'readland.tps', argIdx: 0, argName: 'file', resolveValue: true },
|
|
@@ -92,7 +92,7 @@ const ReadFunctionsWithMore = [
|
|
|
92
92
|
{ package: 'DiagrammeR', name: 'import_graph', argIdx: 0, argName: 'graph_file', resolveValue: true },
|
|
93
93
|
{ package: 'DiagrammeR', name: 'open_graph', argIdx: 0, argName: 'file', resolveValue: true },
|
|
94
94
|
{ package: 'highcharter', name: 'download_map_data', argIdx: 0, argName: 'url', resolveValue: true, defaultValue: 'custom/world.js' },
|
|
95
|
-
{
|
|
95
|
+
{ name: 'read_html', argIdx: 0, argName: 'x', resolveValue: true },
|
|
96
96
|
{ package: 'rvest', name: 'read_html_live', argIdx: 0, argName: 'url', resolveValue: true },
|
|
97
97
|
{ package: 'stats', name: 'read.ftable', argIdx: 0, argName: 'file', resolveValue: true },
|
|
98
98
|
{ package: 'DBI', name: 'dbReadTable', argIdx: 1, argName: 'name', resolveValue: true },
|
|
@@ -108,7 +108,7 @@ const ReadFunctionsWithMore = [
|
|
|
108
108
|
{ package: 'rpolars', name: 'pl_scan_parquet', argIdx: 0, argName: 'source', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
109
109
|
{ package: 'rio', name: 'import', argIdx: 0, argName: 'file', resolveValue: true },
|
|
110
110
|
{ package: 'rio', name: 'import_list', argIdx: 0, argName: 'file', resolveValue: true },
|
|
111
|
-
{ package: 'openxlsx', name: 'read.xlsx', argIdx: 0, argName: '
|
|
111
|
+
{ package: 'openxlsx', name: 'read.xlsx', argIdx: 0, argName: 'xlsxFile', resolveValue: true },
|
|
112
112
|
{ package: 'openxlsx', name: 'loadWorkbook', argIdx: 0, argName: 'file', resolveValue: true },
|
|
113
113
|
{ package: 'readODS', name: 'read_ods', argIdx: 0, argName: 'path', resolveValue: true },
|
|
114
114
|
{ package: 'vroom', name: 'vroom', argIdx: 0, argName: 'file', resolveValue: true },
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FunctionInfo } from './function-info';
|
|
2
|
+
/**
|
|
3
|
+
* The installers that fetch a package from somewhere other than a configured CRAN-like repository, with the
|
|
4
|
+
* argument naming what they fetch: a `user/repo` slug for the forge installers, a url or path for the rest.
|
|
5
|
+
* `remotes` implements them and `devtools` re-exports the whole API, so the entries state no package and match
|
|
6
|
+
* either spelling as well as the bare name.
|
|
7
|
+
*/
|
|
8
|
+
export declare const RemoteFunctions: FunctionInfo[];
|
|
9
|
+
/**
|
|
10
|
+
* What a remote reference installs, as the installers spell it: `user/repo` (the package is `repo`),
|
|
11
|
+
* `user/repo/subdir` (the package sits in `subdir`), `user/repo@v1.2` or `user/repo#42` (pinned to a revision),
|
|
12
|
+
* `github::user/repo` (a `pak` source prefix), and a clone url whose last segment names the package.
|
|
13
|
+
* `undefined` for a value that never resolved, which names nothing.
|
|
14
|
+
*/
|
|
15
|
+
export declare function remoteTarget(value: string | undefined): {
|
|
16
|
+
packageName: string;
|
|
17
|
+
revision?: string;
|
|
18
|
+
} | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoteFunctions = void 0;
|
|
4
|
+
exports.remoteTarget = remoteTarget;
|
|
5
|
+
const dependencies_query_format_1 = require("../dependencies-query-format");
|
|
6
|
+
/**
|
|
7
|
+
* The installers that fetch a package from somewhere other than a configured CRAN-like repository, with the
|
|
8
|
+
* argument naming what they fetch: a `user/repo` slug for the forge installers, a url or path for the rest.
|
|
9
|
+
* `remotes` implements them and `devtools` re-exports the whole API, so the entries state no package and match
|
|
10
|
+
* either spelling as well as the bare name.
|
|
11
|
+
*/
|
|
12
|
+
exports.RemoteFunctions = [
|
|
13
|
+
{ name: 'install_github', argIdx: 0, argName: 'repo', resolveValue: true },
|
|
14
|
+
{ name: 'install_gitlab', argIdx: 0, argName: 'repo', resolveValue: true },
|
|
15
|
+
{ name: 'install_bitbucket', argIdx: 0, argName: 'repo', resolveValue: true },
|
|
16
|
+
{ name: 'install_git', argIdx: 0, argName: 'url', resolveValue: true },
|
|
17
|
+
{ name: 'install_svn', argIdx: 0, argName: 'url', resolveValue: true },
|
|
18
|
+
{ name: 'install_url', argIdx: 0, argName: 'url', resolveValue: true },
|
|
19
|
+
{ name: 'install_bioc', argIdx: 0, argName: 'repo', resolveValue: true },
|
|
20
|
+
{ package: 'pak', name: 'pkg_install', argIdx: 0, argName: 'pkg', resolveValue: true },
|
|
21
|
+
{ package: 'pak', name: 'pak', argIdx: 0, argName: 'pkg', resolveValue: true },
|
|
22
|
+
{ package: 'renv', name: 'install', argIdx: 0, argName: 'packages', resolveValue: true }
|
|
23
|
+
];
|
|
24
|
+
/** `github::`, `bioc::`, ... prefixes of a `pak` reference, and the `.git` a clone url ends in */
|
|
25
|
+
const RemotePrefix = /^[a-z]+::/;
|
|
26
|
+
const RemoteRevision = /[@#](?<revision>[^/]+)$/;
|
|
27
|
+
/**
|
|
28
|
+
* What a remote reference installs, as the installers spell it: `user/repo` (the package is `repo`),
|
|
29
|
+
* `user/repo/subdir` (the package sits in `subdir`), `user/repo@v1.2` or `user/repo#42` (pinned to a revision),
|
|
30
|
+
* `github::user/repo` (a `pak` source prefix), and a clone url whose last segment names the package.
|
|
31
|
+
* `undefined` for a value that never resolved, which names nothing.
|
|
32
|
+
*/
|
|
33
|
+
function remoteTarget(value) {
|
|
34
|
+
if (value === undefined || value === dependencies_query_format_1.Unknown || value === dependencies_query_format_1.Constant || value.length === 0) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const revision = RemoteRevision.exec(value)?.groups?.revision;
|
|
38
|
+
const path = value.replace(RemoteRevision, '').replace(RemotePrefix, '').replace(/\/+$/, '');
|
|
39
|
+
/* a url carries a host we have to drop first, everything else is already the path of the reference */
|
|
40
|
+
const segments = (path.includes('://') ? path.slice(path.indexOf('://') + 3).split('/').slice(1) : path.split('/'))
|
|
41
|
+
.filter(s => s.length > 0);
|
|
42
|
+
/* a clone url ends in `.git`, an archive in its extension and often a version (`pkg_1.0.tar.gz`) */
|
|
43
|
+
const packageName = segments.at(-1)?.replace(/\.git$|\.(tar\.(gz|bz2|xz)|tgz|zip)$/, '').replace(/_[\d.-]+$/, '');
|
|
44
|
+
return packageName ? { packageName, ...(revision ? { revision } : {}) } : undefined;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=remote-functions.js.map
|
|
@@ -5,13 +5,63 @@ const default_builtin_config_1 = require("../../../../dataflow/environments/defa
|
|
|
5
5
|
const LinkToPlotCreation = [
|
|
6
6
|
{ type: 'link-to-last-call', callName: default_builtin_config_1.PlotCreate }
|
|
7
7
|
];
|
|
8
|
+
/**
|
|
9
|
+
* The package that actually exports a plotting call that flowR groups with ggplot2's: a namespaced call is only
|
|
10
|
+
* counted when it names the package the function belongs to, so `ggthemes::theme_wsj()` would otherwise be dropped.
|
|
11
|
+
* A name several packages define (`theme_map` in both cowplot and ggthemes) is left out and matches either way.
|
|
12
|
+
*/
|
|
13
|
+
const PlotFunctionsByPackage = {
|
|
14
|
+
factoextra: ['fviz_cluster', 'fviz_dend', 'fviz_mca', 'fviz_mca_biplot', 'fviz_mca_ind', 'fviz_mca_var', 'fviz_pca',
|
|
15
|
+
'fviz_pca_biplot', 'fviz_pca_ind', 'fviz_pca_var', 'fviz_screeplot'],
|
|
16
|
+
ggExtra: ['ggMarginal', 'removeGrid', 'removeGridX', 'removeGridY', 'rotateTextX'],
|
|
17
|
+
survminer: ['ggsurvplot', 'ggsurvplot_add_all', 'theme_survminer'],
|
|
18
|
+
cowplot: ['ggdraw'],
|
|
19
|
+
forecast: ['ggseasonplot'],
|
|
20
|
+
ggcorrplot: ['ggcorrplot'],
|
|
21
|
+
ggdendro: ['ggdendrogram'],
|
|
22
|
+
plotly: ['ggplotly'],
|
|
23
|
+
gridExtra: ['grid.arrange'],
|
|
24
|
+
ggmap: ['qmap'],
|
|
25
|
+
ggpubr: ['gradient_color'],
|
|
26
|
+
ggalt: ['geom_dumbbell', 'geom_encircle'],
|
|
27
|
+
ggthemes: [
|
|
28
|
+
'scale_color_calc', 'scale_color_canva', 'scale_color_colorblind', 'scale_color_continuous_tableau',
|
|
29
|
+
'scale_color_economist', 'scale_color_excel', 'scale_color_excel_new', 'scale_color_few',
|
|
30
|
+
'scale_color_fivethirtyeight', 'scale_color_gdocs', 'scale_color_gradient2_tableau',
|
|
31
|
+
'scale_color_gradient_tableau', 'scale_color_hc', 'scale_color_pander', 'scale_color_ptol',
|
|
32
|
+
'scale_color_solarized', 'scale_color_stata', 'scale_color_tableau', 'scale_color_wsj', 'scale_colour_calc',
|
|
33
|
+
'scale_colour_canva', 'scale_colour_colorblind', 'scale_colour_economist', 'scale_colour_excel',
|
|
34
|
+
'scale_colour_excel_new', 'scale_colour_few', 'scale_colour_fivethirtyeight', 'scale_colour_gdocs',
|
|
35
|
+
'scale_colour_gradient2_tableau', 'scale_colour_gradient_tableau', 'scale_colour_hc', 'scale_colour_pander',
|
|
36
|
+
'scale_colour_ptol', 'scale_colour_solarized', 'scale_colour_stata', 'scale_colour_tableau', 'scale_colour_wsj',
|
|
37
|
+
'scale_fill_calc', 'scale_fill_canva', 'scale_fill_colorblind', 'scale_fill_continuous_tableau',
|
|
38
|
+
'scale_fill_economist', 'scale_fill_excel', 'scale_fill_excel_new', 'scale_fill_few',
|
|
39
|
+
'scale_fill_fivethirtyeight', 'scale_fill_gdocs', 'scale_fill_gradient2_tableau', 'scale_fill_gradient_tableau',
|
|
40
|
+
'scale_fill_hc', 'scale_fill_pander', 'scale_fill_ptol', 'scale_fill_solarized', 'scale_fill_stata',
|
|
41
|
+
'scale_fill_tableau', 'scale_fill_wsj', 'scale_linetype_stata', 'scale_shape_calc', 'scale_shape_circlefill',
|
|
42
|
+
'scale_shape_cleveland', 'scale_shape_few', 'scale_shape_stata', 'scale_shape_tableau', 'scale_shape_tremmel',
|
|
43
|
+
'theme_base', 'theme_calc', 'theme_clean', 'theme_economist', 'theme_economist_white', 'theme_excel',
|
|
44
|
+
'theme_excel_new', 'theme_few', 'theme_fivethirtyeight', 'theme_foundation', 'theme_gdocs', 'theme_hc',
|
|
45
|
+
'theme_igray', 'theme_pander', 'theme_par', 'theme_solarized', 'theme_solarized_2', 'theme_solid',
|
|
46
|
+
'theme_stata', 'theme_tufte', 'theme_wsj'
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
/** {@link PlotFunctionsByPackage} inverted: the owning package of a name, `ggplot2` unless another package claims it */
|
|
50
|
+
const PlotFunctionOwner = new Map(Object.entries(PlotFunctionsByPackage).flatMap(([pkg, names]) => names.map(name => [name, pkg])));
|
|
51
|
+
/** Names that several packages define, so pinning any of them would drop the calls to the others. */
|
|
52
|
+
const AmbiguousPlotFunctions = new Set(['theme_map', 'wrap_by']);
|
|
53
|
+
/** the {@link FunctionInfo} for a ggplot-style call, qualified with the package that really exports it */
|
|
54
|
+
function ggStyle(name, linkTo) {
|
|
55
|
+
const owner = AmbiguousPlotFunctions.has(name) ? undefined : PlotFunctionOwner.get(name) ?? 'ggplot2';
|
|
56
|
+
return { ...(owner ? { package: owner } : {}), name, ...(linkTo ? { linkTo } : {}) };
|
|
57
|
+
}
|
|
8
58
|
exports.VisualizeFunctions =
|
|
9
59
|
// plot creation
|
|
10
|
-
default_builtin_config_1.GgPlotCreate.map(f => (
|
|
60
|
+
(default_builtin_config_1.GgPlotCreate.map(f => ggStyle(f))).concat(default_builtin_config_1.TinyPlotCrate.map(f => ({ package: 'tinyplot', name: f })),
|
|
11
61
|
// `map` is the maps-package plot; qualify it so it does not swallow purrr::map/dplyr::map etc.
|
|
12
62
|
default_builtin_config_1.GraphicsPlotCreate.map(f => f === 'map' ? { name: f, package: 'maps' } : { name: f }),
|
|
13
63
|
// plot modification
|
|
14
|
-
default_builtin_config_1.GgPlotImplicitAddons.concat(default_builtin_config_1.GgPlotAddons).map(f => (
|
|
64
|
+
default_builtin_config_1.GgPlotImplicitAddons.concat(default_builtin_config_1.GgPlotAddons).map(f => ggStyle(f, LinkToPlotCreation)), default_builtin_config_1.TinyPlotAddons.map(f => ({ package: 'tinyplot', name: f, linkTo: LinkToPlotCreation })), default_builtin_config_1.GraphicsPlotAddons.map(f => ({ name: f, linkTo: LinkToPlotCreation }))).map(f => {
|
|
15
65
|
if (f.name !== 'hist') {
|
|
16
66
|
return f;
|
|
17
67
|
}
|
|
@@ -40,11 +40,10 @@ const WriteFunctionsWithMore = [
|
|
|
40
40
|
{ package: 'readr', name: 'write_csv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
41
41
|
{ package: 'readr', name: 'write_csv2', argIdx: 1, argName: 'file', resolveValue: true },
|
|
42
42
|
{ package: 'readr', name: 'write_delim', argIdx: 1, argName: 'file', resolveValue: true },
|
|
43
|
-
{ package: 'readr', name: '
|
|
44
|
-
{ package: 'readr', name: '
|
|
43
|
+
{ package: 'readr', name: 'write_excel_csv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
44
|
+
{ package: 'readr', name: 'write_excel_csv2', argIdx: 1, argName: 'file', resolveValue: true },
|
|
45
|
+
{ package: 'readr', name: 'write_file', argIdx: 1, argName: 'file', resolveValue: true },
|
|
45
46
|
{ package: 'readr', name: 'write_tsv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
46
|
-
{ package: 'readr', name: 'write_table', argIdx: 1, argName: 'file', resolveValue: true },
|
|
47
|
-
{ package: 'readr', name: 'write_log', argIdx: 1, argName: 'file', resolveValue: true },
|
|
48
47
|
{ package: 'readr', name: 'write_lines', argIdx: 1, argName: 'file', resolveValue: true },
|
|
49
48
|
{ package: 'readr', name: 'write_rds', argIdx: 1, argName: 'file', resolveValue: true },
|
|
50
49
|
{ package: 'haven', name: 'write_sas', argIdx: 1, argName: 'file', resolveValue: true },
|
|
@@ -67,6 +66,11 @@ const WriteFunctionsWithMore = [
|
|
|
67
66
|
{ package: 'grDevices', name: 'tiff', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
68
67
|
{ package: 'grDevices', name: 'X11', argIdx: 0, argName: 'file', resolveValue: true },
|
|
69
68
|
{ package: 'grDevices', name: 'quartz', argIdx: 0, argName: 'file', resolveValue: true },
|
|
69
|
+
{ package: 'ragg', name: 'agg_png', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
70
|
+
{ package: 'ragg', name: 'agg_jpeg', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
71
|
+
{ package: 'ragg', name: 'agg_tiff', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
72
|
+
{ package: 'ragg', name: 'agg_ppm', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
73
|
+
{ package: 'ragg', name: 'agg_webp', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
70
74
|
{ package: 'car', name: 'Export', argIdx: 0, argName: 'file', resolveValue: true },
|
|
71
75
|
{ package: 'LIM', name: 'PrintMat', linkTo: OutputRedirects, resolveValue: true },
|
|
72
76
|
// write_spss/write_stata moved sjmisc -> sjlabelled, so do not pin a namespace (match either); write_sas also lives in haven
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DependencyInfo } from './dependencies-query-format';
|
|
2
|
+
import type { NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
|
+
import type { DataflowInformation } from '../../../dataflow/info';
|
|
4
|
+
/**
|
|
5
|
+
* Names the file each visualization lands in, and the statements that build it.
|
|
6
|
+
*
|
|
7
|
+
* A device opener (`pdf("a.pdf")`) takes every plot until the device is closed (`dev.off()`), so those plots
|
|
8
|
+
* end up in its file instead of on screen; a plot outside any open device keeps the value it had. Every plot
|
|
9
|
+
* that lands in a file also reports the statements it takes to produce that file in
|
|
10
|
+
* {@link DependencyInfo#parts}: the addons drawn onto it, plus the device opener and closer around it.
|
|
11
|
+
* Closing a device ends the plot, so an addon after it builds whatever device is open then, not this file.
|
|
12
|
+
*
|
|
13
|
+
* Openers are the `write` entries that draw ({@link CallProp.Graphics}), closers the calls that end a device
|
|
14
|
+
* ({@link CallProp.Closes}), and the order is the one the source states.
|
|
15
|
+
*/
|
|
16
|
+
export declare function linkPlotsToDevices(written: readonly DependencyInfo[], plots: DependencyInfo[], dataflow: DataflowInformation, ast: NormalizedAst): void;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linkPlotsToDevices = linkPlotsToDevices;
|
|
4
|
+
const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
|
|
5
|
+
const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
|
|
6
|
+
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
7
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
8
|
+
const range_1 = require("../../../util/range");
|
|
9
|
+
/** the {@link CallProp} bits of the call `id` makes */
|
|
10
|
+
function propsOf(id, { graph, environment }) {
|
|
11
|
+
const vertex = graph.getVertex(id);
|
|
12
|
+
if (vertex?.tag !== vertex_1.VertexType.FunctionCall) {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
const name = df_helper_1.Dataflow.qualify(id, graph, false) ?? vertex.name;
|
|
16
|
+
return (0, query_fn_props_1.queryFnProps)(name, { environment: vertex.environment ?? environment })?.props ?? 0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Names the file each visualization lands in, and the statements that build it.
|
|
20
|
+
*
|
|
21
|
+
* A device opener (`pdf("a.pdf")`) takes every plot until the device is closed (`dev.off()`), so those plots
|
|
22
|
+
* end up in its file instead of on screen; a plot outside any open device keeps the value it had. Every plot
|
|
23
|
+
* that lands in a file also reports the statements it takes to produce that file in
|
|
24
|
+
* {@link DependencyInfo#parts}: the addons drawn onto it, plus the device opener and closer around it.
|
|
25
|
+
* Closing a device ends the plot, so an addon after it builds whatever device is open then, not this file.
|
|
26
|
+
*
|
|
27
|
+
* Openers are the `write` entries that draw ({@link CallProp.Graphics}), closers the calls that end a device
|
|
28
|
+
* ({@link CallProp.Closes}), and the order is the one the source states.
|
|
29
|
+
*/
|
|
30
|
+
function linkPlotsToDevices(written, plots, dataflow, ast) {
|
|
31
|
+
const opened = new Map(written
|
|
32
|
+
.filter(w => w.value !== undefined && (propsOf(w.nodeId, dataflow) & built_in_props_1.CallProp.Graphics) !== 0)
|
|
33
|
+
.map(w => [w.nodeId, w.value]));
|
|
34
|
+
const closed = new Set(dataflow.graph.vertices(true)
|
|
35
|
+
.filter(([id, v]) => v.tag === vertex_1.VertexType.FunctionCall && (propsOf(id, dataflow) & built_in_props_1.CallProp.Closes) !== 0)
|
|
36
|
+
.map(([id]) => id));
|
|
37
|
+
const plotAt = new Map(plots.map((p, index) => [p.nodeId, index]));
|
|
38
|
+
const located = [...opened.keys(), ...closed, ...plotAt.keys()]
|
|
39
|
+
.flatMap(id => {
|
|
40
|
+
const at = ast.idMap.get(id)?.location;
|
|
41
|
+
return at ? [[id, at]] : [];
|
|
42
|
+
})
|
|
43
|
+
.sort(([, a], [, b]) => range_1.SourceRange.compare(a, b));
|
|
44
|
+
/* an addon points at the creation it belongs to, a creation points at nothing */
|
|
45
|
+
const linkOf = new Map(plots.filter(p => p.linkedIds?.length).map(p => [p.nodeId, p.linkedIds]));
|
|
46
|
+
const devices = [];
|
|
47
|
+
/* the opener/closer pair enclosing a plot, so it can report what it takes to produce its file */
|
|
48
|
+
const around = new Map();
|
|
49
|
+
/* what each addon draws onto, and the creation each device window is currently showing */
|
|
50
|
+
const builds = new Map();
|
|
51
|
+
const showing = new Map();
|
|
52
|
+
for (const [id] of located) {
|
|
53
|
+
const file = opened.get(id);
|
|
54
|
+
const plot = plotAt.get(id);
|
|
55
|
+
if (file !== undefined) {
|
|
56
|
+
devices.push({ file, opener: id, plots: [] });
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
else if (closed.has(id)) {
|
|
60
|
+
const device = devices.pop();
|
|
61
|
+
for (const on of device?.plots ?? []) {
|
|
62
|
+
around.set(on, [device?.opener, id]);
|
|
63
|
+
}
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
else if (plot === undefined) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const device = devices[devices.length - 1];
|
|
70
|
+
if (device !== undefined) {
|
|
71
|
+
device.plots.push(id);
|
|
72
|
+
around.set(id, [device.opener]);
|
|
73
|
+
plots[plot] = { ...plots[plot], value: device.file };
|
|
74
|
+
}
|
|
75
|
+
const window = device?.opener;
|
|
76
|
+
const linked = linkOf.get(id);
|
|
77
|
+
if (linked === undefined) {
|
|
78
|
+
/* a creation: whatever is drawn on this device from here on adds to it, as R keeps it current */
|
|
79
|
+
showing.set(window, id);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
/*
|
|
83
|
+
* Prefer what the dataflow linked the addon to, which knows about `p <- ggplot(); p + geom_point()`.
|
|
84
|
+
* It only tracks position, though, so an addon after a nested device closed still points into that
|
|
85
|
+
* device; R hands the drawing back to the plot the restored device is showing, so take that instead.
|
|
86
|
+
*/
|
|
87
|
+
const inWindow = linked.find(to => (around.get(to)?.[0]) === window);
|
|
88
|
+
const target = inWindow ?? showing.get(window);
|
|
89
|
+
if (target !== undefined) {
|
|
90
|
+
builds.set(id, target);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const addonsOf = new Map();
|
|
94
|
+
for (const [addon, creation] of builds) {
|
|
95
|
+
addonsOf.set(creation, [...addonsOf.get(creation) ?? [], addon]);
|
|
96
|
+
}
|
|
97
|
+
for (const [id, index] of plotAt) {
|
|
98
|
+
const parts = [...addonsOf.get(id) ?? [], ...around.get(id) ?? []];
|
|
99
|
+
if (parts.length > 0) {
|
|
100
|
+
plots[index] = { ...plots[index], parts };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=link-devices.js.map
|
|
@@ -25,6 +25,8 @@ export interface DiceQueryResult extends BaseQueryResult {
|
|
|
25
25
|
timesHitThreshold: number;
|
|
26
26
|
result: ReadonlySet<NodeId>;
|
|
27
27
|
slicedFor: readonly NodeId[];
|
|
28
|
+
/** see {@link SliceResult.stoppedEarly} */
|
|
29
|
+
stoppedEarly?: boolean;
|
|
28
30
|
'.meta': {
|
|
29
31
|
timing: number;
|
|
30
32
|
};
|