@eagleoutice/flowr 2.2.10 → 2.2.12
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 +4 -4
- package/benchmark/slicer.d.ts +49 -22
- package/benchmark/slicer.js +88 -28
- package/benchmark/stats/print.js +16 -10
- package/benchmark/stats/size-of.js +18 -1
- package/benchmark/stats/stats.d.ts +3 -0
- package/benchmark/summarizer/second-phase/process.js +8 -2
- package/cli/benchmark-app.d.ts +5 -0
- package/cli/benchmark-app.js +49 -6
- package/cli/benchmark-helper-app.d.ts +4 -0
- package/cli/benchmark-helper-app.js +20 -4
- package/cli/common/options.js +13 -4
- package/cli/repl/commands/repl-commands.js +2 -0
- package/cli/repl/commands/repl-dataflow.d.ts +2 -0
- package/cli/repl/commands/repl-dataflow.js +35 -1
- package/cli/repl/server/compact.d.ts +2 -2
- package/cli/repl/server/compact.js +3 -3
- package/cli/repl/server/messages/message-analysis.d.ts +2 -2
- package/cli/repl/server/messages/message-analysis.js +2 -2
- package/config.d.ts +27 -2
- package/config.js +30 -4
- package/dataflow/environments/built-in-config.d.ts +5 -2
- package/dataflow/environments/built-in-config.js +8 -2
- package/dataflow/environments/built-in.d.ts +8 -1
- package/dataflow/environments/built-in.js +8 -1
- package/dataflow/environments/clone.d.ts +5 -0
- package/dataflow/environments/clone.js +5 -0
- package/dataflow/environments/default-builtin-config.js +96 -10
- package/dataflow/environments/define.d.ts +5 -1
- package/dataflow/environments/define.js +36 -10
- package/dataflow/environments/environment.js +4 -2
- package/dataflow/environments/overwrite.js +4 -0
- package/dataflow/environments/remove.d.ts +6 -0
- package/dataflow/environments/remove.js +24 -0
- package/dataflow/environments/resolve-by-name.js +1 -1
- package/dataflow/extractor.d.ts +1 -1
- package/dataflow/extractor.js +8 -6
- package/dataflow/graph/dataflowgraph-builder.d.ts +76 -6
- package/dataflow/graph/dataflowgraph-builder.js +102 -6
- package/dataflow/graph/edge.js +4 -1
- package/dataflow/graph/graph.d.ts +12 -1
- package/dataflow/graph/graph.js +37 -0
- package/dataflow/graph/vertex.d.ts +42 -2
- package/dataflow/graph/vertex.js +32 -0
- package/dataflow/internal/linker.js +3 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +3 -0
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +4 -10
- 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 +55 -45
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +27 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +37 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +10 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +140 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +51 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +21 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +3 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +83 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +20 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +15 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +75 -0
- package/dataflow/internal/process/functions/call/common.d.ts +1 -1
- package/dataflow/internal/process/functions/call/common.js +4 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +9 -5
- package/dataflow/internal/process/process-named-call.d.ts +3 -0
- package/dataflow/internal/process/process-named-call.js +3 -0
- package/dataflow/processor.d.ts +7 -7
- package/documentation/data/server/doc-data-server-messages.js +2 -2
- package/documentation/doc-util/doc-cfg.d.ts +11 -2
- package/documentation/doc-util/doc-cfg.js +35 -6
- package/documentation/doc-util/doc-code.js +10 -2
- package/documentation/print-capabilities-markdown.js +1 -1
- package/documentation/print-cfg-wiki.d.ts +1 -0
- package/documentation/print-cfg-wiki.js +84 -0
- package/documentation/print-core-wiki.js +2 -2
- package/documentation/print-interface-wiki.js +4 -0
- package/documentation/print-query-wiki.js +22 -3
- package/package.json +4 -3
- package/queries/catalog/call-context-query/call-context-query-executor.js +13 -0
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -0
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +13 -5
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -25
- package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -145
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +24 -0
- package/queries/catalog/dependencies-query/function-info/function-info.js +10 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.js +18 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +101 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.js +11 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +87 -0
- package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.js +38 -3
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +10 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +5 -1
- package/queries/catalog/project-query/project-query-executor.d.ts +3 -0
- package/queries/catalog/project-query/project-query-executor.js +17 -0
- package/queries/catalog/project-query/project-query-format.d.ts +67 -0
- package/queries/catalog/project-query/project-query-format.js +26 -0
- package/queries/query.d.ts +60 -1
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/slicing/static/fingerprint.js +8 -1
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +5 -16
- package/slicing/static/slicer-types.d.ts +2 -0
- package/slicing/static/static-slicer.d.ts +4 -2
- package/slicing/static/static-slicer.js +24 -18
- package/slicing/static/visiting-queue.d.ts +7 -1
- package/slicing/static/visiting-queue.js +20 -6
- package/util/arrays.d.ts +23 -0
- package/util/arrays.js +41 -0
- package/util/cfg/visitor.d.ts +1 -1
- package/util/cfg/visitor.js +2 -2
- package/util/{list-access.d.ts → containers.d.ts} +24 -4
- package/util/{list-access.js → containers.js} +42 -12
- package/util/mermaid/ast.js +12 -1
- package/util/mermaid/cfg.js +2 -2
- package/util/parallel.d.ts +2 -1
- package/util/parallel.js +11 -2
- package/util/prefix.d.ts +13 -0
- package/util/prefix.js +34 -0
- package/util/version.js +1 -1
|
@@ -12,6 +12,11 @@ const visitor_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/visit
|
|
|
12
12
|
const assert_1 = require("../../../util/assert");
|
|
13
13
|
const objects_1 = require("../../../util/objects");
|
|
14
14
|
const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
|
|
15
|
+
const library_functions_1 = require("./function-info/library-functions");
|
|
16
|
+
const source_functions_1 = require("./function-info/source-functions");
|
|
17
|
+
const read_functions_1 = require("./function-info/read-functions");
|
|
18
|
+
const write_functions_1 = require("./function-info/write-functions");
|
|
19
|
+
const function_info_1 = require("./function-info/function-info");
|
|
15
20
|
function collectNamespaceAccesses(data, libraries) {
|
|
16
21
|
/* for libraries, we have to additionally track all uses of `::` and `:::`, for this we currently simply traverse all uses */
|
|
17
22
|
(0, visitor_1.visitAst)(data.ast.ast, n => {
|
|
@@ -32,10 +37,10 @@ function executeDependenciesQuery(data, queries) {
|
|
|
32
37
|
const now = Date.now();
|
|
33
38
|
const [query] = queries;
|
|
34
39
|
const ignoreDefault = query.ignoreDefaultFunctions ?? false;
|
|
35
|
-
const libraryFunctions = getFunctionsToCheck(query.libraryFunctions, ignoreDefault,
|
|
36
|
-
const sourceFunctions = getFunctionsToCheck(query.sourceFunctions, ignoreDefault,
|
|
37
|
-
const readFunctions = getFunctionsToCheck(query.readFunctions, ignoreDefault,
|
|
38
|
-
const writeFunctions = getFunctionsToCheck(query.writeFunctions, ignoreDefault,
|
|
40
|
+
const libraryFunctions = getFunctionsToCheck(query.libraryFunctions, ignoreDefault, library_functions_1.LibraryFunctions);
|
|
41
|
+
const sourceFunctions = getFunctionsToCheck(query.sourceFunctions, ignoreDefault, source_functions_1.SourceFunctions);
|
|
42
|
+
const readFunctions = getFunctionsToCheck(query.readFunctions, ignoreDefault, read_functions_1.ReadFunctions);
|
|
43
|
+
const writeFunctions = getFunctionsToCheck(query.writeFunctions, ignoreDefault, write_functions_1.WriteFunctions);
|
|
39
44
|
const numberOfFunctions = libraryFunctions.length + sourceFunctions.length + readFunctions.length + writeFunctions.length;
|
|
40
45
|
const results = numberOfFunctions === 0 ? { kinds: {}, '.meta': { timing: 0 } } : (0, query_1.executeQueriesOfSameType)(data, ...makeCallContextQuery(libraryFunctions, 'library'), ...makeCallContextQuery(sourceFunctions, 'source'), ...makeCallContextQuery(readFunctions, 'read'), ...makeCallContextQuery(writeFunctions, 'write'));
|
|
41
46
|
function getLexeme(argument, id) {
|
|
@@ -113,6 +118,9 @@ function getResults(data, results, kind, functions, makeInfo) {
|
|
|
113
118
|
const linkedArgs = collectValuesFromLinks(args, data, linkedIds);
|
|
114
119
|
const foundValues = linkedArgs ?? args;
|
|
115
120
|
if (!foundValues) {
|
|
121
|
+
if (info.ignoreIf === 'arg-missing') {
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
116
124
|
const record = (0, objects_1.compactRecord)(makeInfo(id, vertex, undefined, undefined, dropInfoOnLinkedIds(linkedIds)));
|
|
117
125
|
return record ? [record] : [];
|
|
118
126
|
}
|
|
@@ -140,7 +148,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
|
|
|
140
148
|
}
|
|
141
149
|
const info = linkedId.info;
|
|
142
150
|
// do not collect this one
|
|
143
|
-
if (hasAtLeastAValue && info.when !==
|
|
151
|
+
if (hasAtLeastAValue && info.when !== function_info_1.DependencyInfoLinkConstraint.Always) {
|
|
144
152
|
continue;
|
|
145
153
|
}
|
|
146
154
|
// collect this one!
|
|
@@ -2,32 +2,8 @@ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
|
2
2
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
3
|
import Joi from 'joi';
|
|
4
4
|
import { executeDependenciesQuery } from './dependencies-query-executor';
|
|
5
|
-
import type {
|
|
5
|
+
import type { FunctionInfo } from './function-info/function-info';
|
|
6
6
|
export declare const Unknown = "unknown";
|
|
7
|
-
/** when to read the argument value from a linked function */
|
|
8
|
-
export declare enum DependencyInfoLinkConstraint {
|
|
9
|
-
Always = "always",
|
|
10
|
-
IfUnknown = "if-unknown"
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A dependency link may have attached information. If you pass it, we try to resolve the argument value from the linked function
|
|
14
|
-
* if the `when` constraint is met.
|
|
15
|
-
*/
|
|
16
|
-
export type DependencyInfoLink = LinkTo<RegExp | string, Omit<FunctionInfo, 'name' | 'linkTo'> & {
|
|
17
|
-
when: DependencyInfoLinkConstraint;
|
|
18
|
-
} | undefined>;
|
|
19
|
-
export type DependencyInfoLinkAttachedInfo = DependencyInfoLink['attachLinkInfo'];
|
|
20
|
-
export declare const LibraryFunctions: FunctionInfo[];
|
|
21
|
-
export declare const SourceFunctions: FunctionInfo[];
|
|
22
|
-
export declare const ReadFunctions: FunctionInfo[];
|
|
23
|
-
export declare const WriteFunctions: FunctionInfo[];
|
|
24
|
-
export interface FunctionInfo {
|
|
25
|
-
name: string;
|
|
26
|
-
argIdx?: number | 'unnamed';
|
|
27
|
-
argName?: string;
|
|
28
|
-
linkTo?: DependencyInfoLink[];
|
|
29
|
-
resolveValue?: boolean | 'library';
|
|
30
|
-
}
|
|
31
7
|
export interface DependenciesQuery extends BaseQueryFormat {
|
|
32
8
|
readonly type: 'dependencies';
|
|
33
9
|
readonly ignoreDefaultFunctions?: boolean;
|
|
@@ -3,156 +3,12 @@ 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.
|
|
6
|
+
exports.DependenciesQueryDefinition = exports.Unknown = void 0;
|
|
7
7
|
const ansi_1 = require("../../../util/ansi");
|
|
8
8
|
const time_1 = require("../../../util/time");
|
|
9
9
|
const joi_1 = __importDefault(require("joi"));
|
|
10
10
|
const dependencies_query_executor_1 = require("./dependencies-query-executor");
|
|
11
11
|
exports.Unknown = 'unknown';
|
|
12
|
-
/** when to read the argument value from a linked function */
|
|
13
|
-
var DependencyInfoLinkConstraint;
|
|
14
|
-
(function (DependencyInfoLinkConstraint) {
|
|
15
|
-
DependencyInfoLinkConstraint["Always"] = "always";
|
|
16
|
-
DependencyInfoLinkConstraint["IfUnknown"] = "if-unknown";
|
|
17
|
-
})(DependencyInfoLinkConstraint || (exports.DependencyInfoLinkConstraint = DependencyInfoLinkConstraint = {}));
|
|
18
|
-
// these lists are originally based on https://github.com/duncantl/CodeDepends/blob/7fd96dfee16b252e5f642c77a7ababf48e9326f8/R/codeTypes.R
|
|
19
|
-
exports.LibraryFunctions = [
|
|
20
|
-
{ name: 'library', argIdx: 0, argName: 'package', resolveValue: 'library' },
|
|
21
|
-
{ name: 'require', argIdx: 0, argName: 'package', resolveValue: 'library' },
|
|
22
|
-
{ name: 'loadNamespace', argIdx: 0, argName: 'package', resolveValue: true },
|
|
23
|
-
{ name: 'attachNamespace', argIdx: 0, argName: 'ns', resolveValue: true },
|
|
24
|
-
{ name: 'attach', argIdx: 0, argName: 'what', resolveValue: true },
|
|
25
|
-
{ name: 'groundhog.library', argIdx: 0, argName: 'pkg', resolveValue: true },
|
|
26
|
-
{ name: 'p_load', argIdx: 'unnamed', resolveValue: 'library' }, // pacman
|
|
27
|
-
{ name: 'p_load_gh', argIdx: 'unnamed', resolveValue: 'library' }, // pacman
|
|
28
|
-
{ name: 'from_import', argIdx: 0, argName: 'package', resolveValue: true }, // easypackages
|
|
29
|
-
{ name: 'libraries', argIdx: 'unnamed', resolveValue: true }, // easypackages
|
|
30
|
-
{ name: 'shelf', argIdx: 'unnamed', resolveValue: true } // librarian
|
|
31
|
-
];
|
|
32
|
-
exports.SourceFunctions = [
|
|
33
|
-
{ name: 'source', argIdx: 0, argName: 'file', resolveValue: true },
|
|
34
|
-
{ name: 'sys.source', argIdx: 0, argName: 'file', resolveValue: true }
|
|
35
|
-
];
|
|
36
|
-
exports.ReadFunctions = [
|
|
37
|
-
{ name: 'read.table', argIdx: 0, argName: 'file', resolveValue: true },
|
|
38
|
-
{ name: 'read.csv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
39
|
-
{ name: 'read.csv2', argIdx: 0, argName: 'file', resolveValue: true },
|
|
40
|
-
{ name: 'read.delim', argIdx: 0, argName: 'file', resolveValue: true },
|
|
41
|
-
{ name: 'read.dcf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
42
|
-
{ name: 'scan', argIdx: 0, argName: 'file', resolveValue: true },
|
|
43
|
-
{ name: 'read.fwf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
44
|
-
{ name: 'file', argIdx: 1, argName: 'open', resolveValue: true },
|
|
45
|
-
{ name: 'url', argIdx: 1, argName: 'open', resolveValue: true },
|
|
46
|
-
{ name: 'load', argIdx: 0, argName: 'file', resolveValue: true },
|
|
47
|
-
{ name: 'gzfile', argIdx: 1, argName: 'open', resolveValue: true },
|
|
48
|
-
{ name: 'bzfile', argIdx: 1, argName: 'open', resolveValue: true },
|
|
49
|
-
{ name: 'download.file', argIdx: 0, argName: 'url', resolveValue: true },
|
|
50
|
-
{ name: 'pipe', argIdx: 1, argName: 'open', resolveValue: true },
|
|
51
|
-
{ name: 'fifo', argIdx: 1, argName: 'open', resolveValue: true },
|
|
52
|
-
{ name: 'unz', argIdx: 1, argName: 'open', resolveValue: true },
|
|
53
|
-
{ name: 'matrix', argIdx: 0, argName: 'data', resolveValue: true },
|
|
54
|
-
{ name: 'readRDS', argIdx: 0, argName: 'file', resolveValue: true },
|
|
55
|
-
{ name: 'readLines', argIdx: 0, argName: 'con', resolveValue: true },
|
|
56
|
-
{ name: 'readRenviron', argIdx: 0, argName: 'path', resolveValue: true },
|
|
57
|
-
// readr
|
|
58
|
-
{ name: 'read_csv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
59
|
-
{ name: 'read_csv2', argIdx: 0, argName: 'file', resolveValue: true },
|
|
60
|
-
{ name: 'read_lines', argIdx: 0, argName: 'file', resolveValue: true },
|
|
61
|
-
{ name: 'read_delim', argIdx: 0, argName: 'file', resolveValue: true },
|
|
62
|
-
{ name: 'read_dsv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
63
|
-
{ name: 'read_fwf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
64
|
-
{ name: 'read_tsv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
65
|
-
{ name: 'read_table', argIdx: 0, argName: 'file', resolveValue: true },
|
|
66
|
-
{ name: 'read_log', argIdx: 0, argName: 'file', resolveValue: true },
|
|
67
|
-
{ name: 'read_lines', argIdx: 0, argName: 'file', resolveValue: true },
|
|
68
|
-
{ name: 'read_lines_chunked', argIdx: 0, argName: 'file', resolveValue: true },
|
|
69
|
-
// xlsx
|
|
70
|
-
{ name: 'read.xlsx', argIdx: 0, argName: 'file', resolveValue: true },
|
|
71
|
-
{ name: 'read.xlsx2', argIdx: 0, argName: 'file', resolveValue: true },
|
|
72
|
-
// data.table
|
|
73
|
-
{ name: 'fread', argIdx: 0, argName: 'file', resolveValue: true },
|
|
74
|
-
// haven
|
|
75
|
-
{ name: 'read_sas', argIdx: 0, argName: 'file', resolveValue: true },
|
|
76
|
-
{ name: 'read_sav', argIdx: 0, argName: 'file', resolveValue: true },
|
|
77
|
-
{ name: 'read_por', argIdx: 0, argName: 'file', resolveValue: true },
|
|
78
|
-
{ name: 'read_dta', argIdx: 0, argName: 'file', resolveValue: true },
|
|
79
|
-
{ name: 'read_xpt', argIdx: 0, argName: 'file', resolveValue: true },
|
|
80
|
-
// feather
|
|
81
|
-
{ name: 'read_feather', argIdx: 0, argName: 'file', resolveValue: true },
|
|
82
|
-
// foreign
|
|
83
|
-
{ name: 'read.arff', argIdx: 0, argName: 'file', resolveValue: true },
|
|
84
|
-
{ name: 'read.dbf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
85
|
-
{ name: 'read.dta', argIdx: 0, argName: 'file', resolveValue: true },
|
|
86
|
-
{ name: 'read.epiinfo', argIdx: 0, argName: 'file', resolveValue: true },
|
|
87
|
-
{ name: 'read.mtp', argIdx: 0, argName: 'file', resolveValue: true },
|
|
88
|
-
{ name: 'read.octave', argIdx: 0, argName: 'file', resolveValue: true },
|
|
89
|
-
{ name: 'read.spss', argIdx: 0, argName: 'file', resolveValue: true },
|
|
90
|
-
{ name: 'read.ssd', argIdx: 0, argName: 'file', resolveValue: true },
|
|
91
|
-
{ name: 'read.systat', argIdx: 0, argName: 'file', resolveValue: true },
|
|
92
|
-
{ name: 'read.xport', argIdx: 0, argName: 'file', resolveValue: true },
|
|
93
|
-
// car
|
|
94
|
-
{ name: 'Import', argIdx: 0, argName: 'file', resolveValue: true },
|
|
95
|
-
];
|
|
96
|
-
const OutputRedirects = [
|
|
97
|
-
{ type: 'link-to-last-call', callName: 'sink', attachLinkInfo: { argIdx: 0, argName: 'file', when: DependencyInfoLinkConstraint.IfUnknown, resolveValue: true } }
|
|
98
|
-
];
|
|
99
|
-
exports.WriteFunctions = [
|
|
100
|
-
{ name: 'save', argName: 'file', resolveValue: true },
|
|
101
|
-
{ name: 'save.image', argIdx: 1, argName: 'file', resolveValue: true },
|
|
102
|
-
{ name: 'write', argIdx: 1, argName: 'file', resolveValue: true },
|
|
103
|
-
{ name: 'dput', argIdx: 1, argName: 'file', resolveValue: true },
|
|
104
|
-
{ name: 'dump', argIdx: 1, argName: 'file', resolveValue: true },
|
|
105
|
-
{ name: 'write.table', argIdx: 1, argName: 'file', resolveValue: true },
|
|
106
|
-
{ name: 'write.csv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
107
|
-
{ name: 'saveRDS', argIdx: 1, argName: 'file', resolveValue: true },
|
|
108
|
-
// write functions that don't have argIndex are assumed to write to stdout
|
|
109
|
-
{ name: 'print', linkTo: OutputRedirects, resolveValue: true },
|
|
110
|
-
{ name: 'cat', linkTo: OutputRedirects, argName: 'file', resolveValue: true },
|
|
111
|
-
{ name: 'message', linkTo: OutputRedirects, resolveValue: true },
|
|
112
|
-
{ name: 'warning', linkTo: OutputRedirects, resolveValue: true },
|
|
113
|
-
// readr
|
|
114
|
-
{ name: 'write_csv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
115
|
-
{ name: 'write_csv2', argIdx: 1, argName: 'file', resolveValue: true },
|
|
116
|
-
{ name: 'write_delim', argIdx: 1, argName: 'file', resolveValue: true },
|
|
117
|
-
{ name: 'write_dsv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
118
|
-
{ name: 'write_fwf', argIdx: 1, argName: 'file', resolveValue: true },
|
|
119
|
-
{ name: 'write_tsv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
120
|
-
{ name: 'write_table', argIdx: 1, argName: 'file', resolveValue: true },
|
|
121
|
-
{ name: 'write_log', argIdx: 1, argName: 'file', resolveValue: true },
|
|
122
|
-
// heaven
|
|
123
|
-
{ name: 'write_sas', argIdx: 1, argName: 'file', resolveValue: true },
|
|
124
|
-
{ name: 'write_sav', argIdx: 1, argName: 'file', resolveValue: true },
|
|
125
|
-
{ name: 'write_por', argIdx: 1, argName: 'file', resolveValue: true },
|
|
126
|
-
{ name: 'write_dta', argIdx: 1, argName: 'file', resolveValue: true },
|
|
127
|
-
{ name: 'write_xpt', argIdx: 1, argName: 'file', resolveValue: true },
|
|
128
|
-
// feather
|
|
129
|
-
{ name: 'write_feather', argIdx: 1, argName: 'file', resolveValue: true },
|
|
130
|
-
// foreign
|
|
131
|
-
{ name: 'write.arff', argIdx: 1, argName: 'file', resolveValue: true },
|
|
132
|
-
{ name: 'write.dbf', argIdx: 1, argName: 'file', resolveValue: true },
|
|
133
|
-
{ name: 'write.dta', argIdx: 1, argName: 'file', resolveValue: true },
|
|
134
|
-
{ name: 'write.foreign', argIdx: 1, argName: 'file', resolveValue: true },
|
|
135
|
-
// xlsx
|
|
136
|
-
{ name: 'write.xlsx', argIdx: 1, argName: 'file', resolveValue: true },
|
|
137
|
-
{ name: 'write.xlsx2', argIdx: 1, argName: 'file', resolveValue: true },
|
|
138
|
-
// graphics
|
|
139
|
-
{ name: 'pdf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
140
|
-
{ name: 'jpeg', argIdx: 0, argName: 'file', resolveValue: true },
|
|
141
|
-
{ name: 'png', argIdx: 0, argName: 'file', resolveValue: true },
|
|
142
|
-
{ name: 'windows', argIdx: 0, argName: 'file', resolveValue: true },
|
|
143
|
-
{ name: 'postscript', argIdx: 0, argName: 'file', resolveValue: true },
|
|
144
|
-
{ name: 'xfix', argIdx: 0, argName: 'file', resolveValue: true },
|
|
145
|
-
{ name: 'bitmap', argIdx: 0, argName: 'file', resolveValue: true },
|
|
146
|
-
{ name: 'pictex', argIdx: 0, argName: 'file', resolveValue: true },
|
|
147
|
-
{ name: 'cairo_pdf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
148
|
-
{ name: 'svg', argIdx: 0, argName: 'file', resolveValue: true },
|
|
149
|
-
{ name: 'bmp', argIdx: 0, argName: 'file', resolveValue: true },
|
|
150
|
-
{ name: 'tiff', argIdx: 0, argName: 'file', resolveValue: true },
|
|
151
|
-
{ name: 'X11', argIdx: 0, argName: 'file', resolveValue: true },
|
|
152
|
-
{ name: 'quartz', argIdx: 0, argName: 'file', resolveValue: true },
|
|
153
|
-
// car
|
|
154
|
-
{ name: 'Export', argIdx: 0, argName: 'file', resolveValue: true },
|
|
155
|
-
];
|
|
156
12
|
function printResultSection(title, infos, result, sectionSpecifics) {
|
|
157
13
|
if (infos.length <= 0) {
|
|
158
14
|
return;
|
|
@@ -175,6 +31,7 @@ function printResultSection(title, infos, result, sectionSpecifics) {
|
|
|
175
31
|
}
|
|
176
32
|
const functionInfoSchema = joi_1.default.array().items(joi_1.default.object({
|
|
177
33
|
name: joi_1.default.string().required().description('The name of the library function.'),
|
|
34
|
+
package: joi_1.default.string().optional().description('The package name of the library function'),
|
|
178
35
|
argIdx: joi_1.default.number().optional().description('The index of the argument that contains the library name.'),
|
|
179
36
|
argName: joi_1.default.string().optional().description('The name of the argument that contains the library name.'),
|
|
180
37
|
})).optional();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LinkTo } from '../../call-context-query/call-context-query-format';
|
|
2
|
+
/** when to read the argument value from a linked function */
|
|
3
|
+
export declare enum DependencyInfoLinkConstraint {
|
|
4
|
+
Always = "always",
|
|
5
|
+
IfUnknown = "if-unknown"
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A dependency link may have attached information. If you pass it, we try to resolve the argument value from the linked function
|
|
9
|
+
* if the `when` constraint is met.
|
|
10
|
+
*/
|
|
11
|
+
export type DependencyInfoLink = LinkTo<RegExp | string, Omit<FunctionInfo, 'name' | 'linkTo' | 'package'> & {
|
|
12
|
+
when: DependencyInfoLinkConstraint;
|
|
13
|
+
} | undefined>;
|
|
14
|
+
export type DependencyInfoLinkAttachedInfo = DependencyInfoLink['attachLinkInfo'];
|
|
15
|
+
export interface FunctionInfo {
|
|
16
|
+
package?: string;
|
|
17
|
+
name: string;
|
|
18
|
+
/** the index if the argument can be positional, unnamed in case of something like `...`, if the argument must be given with the name, please leave undefined */
|
|
19
|
+
argIdx?: number | 'unnamed';
|
|
20
|
+
argName?: string;
|
|
21
|
+
linkTo?: DependencyInfoLink[];
|
|
22
|
+
resolveValue?: boolean | 'library';
|
|
23
|
+
ignoreIf?: 'arg-missing';
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DependencyInfoLinkConstraint = void 0;
|
|
4
|
+
/** when to read the argument value from a linked function */
|
|
5
|
+
var DependencyInfoLinkConstraint;
|
|
6
|
+
(function (DependencyInfoLinkConstraint) {
|
|
7
|
+
DependencyInfoLinkConstraint["Always"] = "always";
|
|
8
|
+
DependencyInfoLinkConstraint["IfUnknown"] = "if-unknown";
|
|
9
|
+
})(DependencyInfoLinkConstraint || (exports.DependencyInfoLinkConstraint = DependencyInfoLinkConstraint = {}));
|
|
10
|
+
//# sourceMappingURL=function-info.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LibraryFunctions = void 0;
|
|
4
|
+
exports.LibraryFunctions = [
|
|
5
|
+
{ package: 'base', name: 'library', argIdx: 0, argName: 'package', resolveValue: 'library' },
|
|
6
|
+
{ package: 'base', name: 'require', argIdx: 0, argName: 'package', resolveValue: 'library' },
|
|
7
|
+
{ package: 'base', name: 'loadNamespace', argIdx: 0, argName: 'package', resolveValue: true },
|
|
8
|
+
{ package: 'base', name: 'attachNamespace', argIdx: 0, argName: 'ns', resolveValue: true },
|
|
9
|
+
{ package: 'base', name: 'attach', argIdx: 0, argName: 'what', resolveValue: true },
|
|
10
|
+
{ package: 'groundhog', name: 'groundhog.library', argIdx: 0, argName: 'pkg', resolveValue: true },
|
|
11
|
+
{ package: 'pacman', name: 'p_load', argIdx: 'unnamed', resolveValue: 'library' },
|
|
12
|
+
{ package: 'pacman', name: 'p_load_gh', argIdx: 'unnamed', resolveValue: 'library' },
|
|
13
|
+
{ package: 'easypackages', name: 'from_import', argIdx: 0, argName: 'package', resolveValue: true },
|
|
14
|
+
{ package: 'easypackages', name: 'libraries', argIdx: 'unnamed', resolveValue: true },
|
|
15
|
+
{ package: 'librarian', name: 'shelf', argIdx: 'unnamed', resolveValue: true },
|
|
16
|
+
{ package: 'devtools', name: 'load_all', argIdx: 0, argName: 'path', resolveValue: true }
|
|
17
|
+
];
|
|
18
|
+
//# sourceMappingURL=library-functions.js.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReadFunctions = void 0;
|
|
4
|
+
exports.ReadFunctions = [
|
|
5
|
+
{ package: 'base', name: 'parse', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
6
|
+
{ package: 'base', name: 'read.table', argIdx: 0, argName: 'file', resolveValue: true },
|
|
7
|
+
{ package: 'utils', name: 'read.csv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
8
|
+
{ package: 'utils', name: 'read.csv2', argIdx: 0, argName: 'file', resolveValue: true },
|
|
9
|
+
{ package: 'utils', name: 'read.delim', argIdx: 0, argName: 'file', resolveValue: true },
|
|
10
|
+
{ package: 'base', name: 'read.dcf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
11
|
+
{ package: 'base', name: 'scan', argIdx: 0, argName: 'file', resolveValue: true },
|
|
12
|
+
{ package: 'utils', name: 'read.fwf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
13
|
+
{ package: 'base', name: 'file', argIdx: 1, argName: 'open', resolveValue: true },
|
|
14
|
+
{ package: 'base', name: 'url', argIdx: 1, argName: 'open', resolveValue: true },
|
|
15
|
+
{ package: 'base', name: 'load', argIdx: 0, argName: 'file', resolveValue: true },
|
|
16
|
+
{ package: 'base', name: 'gzfile', argIdx: 1, argName: 'open', resolveValue: true },
|
|
17
|
+
{ package: 'base', name: 'bzfile', argIdx: 1, argName: 'open', resolveValue: true },
|
|
18
|
+
{ package: 'utils', name: 'download.file', argIdx: 0, argName: 'url', resolveValue: true },
|
|
19
|
+
{ package: 'base', name: 'pipe', argIdx: 1, argName: 'open', resolveValue: true },
|
|
20
|
+
{ package: 'base', name: 'fifo', argIdx: 1, argName: 'open', resolveValue: true },
|
|
21
|
+
{ package: 'base', name: 'unz', argIdx: 1, argName: 'open', resolveValue: true },
|
|
22
|
+
{ package: 'base', name: 'matrix', argIdx: 0, argName: 'data', resolveValue: true },
|
|
23
|
+
{ package: 'base', name: 'readRDS', argIdx: 0, argName: 'file', resolveValue: true },
|
|
24
|
+
{ package: 'base', name: 'readLines', argIdx: 0, argName: 'con', resolveValue: true },
|
|
25
|
+
{ package: 'base', name: 'readRenviron', argIdx: 0, argName: 'path', resolveValue: true },
|
|
26
|
+
{ package: 'readr', name: 'read_csv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
27
|
+
{ package: 'readr', name: 'read_csv2', argIdx: 0, argName: 'file', resolveValue: true },
|
|
28
|
+
{ package: 'readr', name: 'read_lines', argIdx: 0, argName: 'file', resolveValue: true },
|
|
29
|
+
{ package: 'readr', name: 'read_delim', argIdx: 0, argName: 'file', resolveValue: true },
|
|
30
|
+
{ package: 'readr', name: 'read_dsv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
31
|
+
{ package: 'readr', name: 'read_fwf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
32
|
+
{ package: 'readr', name: 'read_tsv', argIdx: 0, argName: 'file', resolveValue: true },
|
|
33
|
+
{ package: 'readr', name: 'read_table', argIdx: 0, argName: 'file', resolveValue: true },
|
|
34
|
+
{ package: 'readr', name: 'read_log', argIdx: 0, argName: 'file', resolveValue: true },
|
|
35
|
+
{ package: 'readr', name: 'read_lines_raw', argIdx: 0, argName: 'file', resolveValue: true },
|
|
36
|
+
{ package: 'readr', name: 'read_lines_chunked', argIdx: 0, argName: 'file', resolveValue: true },
|
|
37
|
+
{ package: 'readr', name: 'read_rds', argIdx: 0, argName: 'file', resolveValue: true },
|
|
38
|
+
{ package: 'readr', name: 'clipboard' },
|
|
39
|
+
{ package: 'xlsx', name: 'read.xlsx', argIdx: 0, argName: 'file', resolveValue: true },
|
|
40
|
+
{ package: 'xlsx', name: 'read.xlsx2', argIdx: 0, argName: 'file', resolveValue: true },
|
|
41
|
+
{ package: 'data.table', name: 'fread', argIdx: 0, argName: 'file', resolveValue: true },
|
|
42
|
+
{ package: 'haven', name: 'read_sas', argIdx: 0, argName: 'file', resolveValue: true },
|
|
43
|
+
{ package: 'haven', name: 'read_sav', argIdx: 0, argName: 'file', resolveValue: true },
|
|
44
|
+
{ package: 'haven', name: 'read_por', argIdx: 0, argName: 'file', resolveValue: true },
|
|
45
|
+
{ package: 'haven', name: 'read_dta', argIdx: 0, argName: 'file', resolveValue: true },
|
|
46
|
+
{ package: 'haven', name: 'read_xpt', argIdx: 0, argName: 'file', resolveValue: true },
|
|
47
|
+
{ package: 'feather', name: 'read_feather', argIdx: 0, argName: 'file', resolveValue: true },
|
|
48
|
+
{ package: 'foreign', name: 'read.arff', argIdx: 0, argName: 'file', resolveValue: true },
|
|
49
|
+
{ package: 'foreign', name: 'read.dbf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
50
|
+
{ package: 'foreign', name: 'read.dta', argIdx: 0, argName: 'file', resolveValue: true },
|
|
51
|
+
{ package: 'foreign', name: 'read.epiinfo', argIdx: 0, argName: 'file', resolveValue: true },
|
|
52
|
+
{ package: 'foreign', name: 'read.mtp', argIdx: 0, argName: 'file', resolveValue: true },
|
|
53
|
+
{ package: 'foreign', name: 'read.octave', argIdx: 0, argName: 'file', resolveValue: true },
|
|
54
|
+
{ package: 'foreign', name: 'read.spss', argIdx: 0, argName: 'file', resolveValue: true },
|
|
55
|
+
{ package: 'foreign', name: 'read.ssd', argIdx: 0, argName: 'file', resolveValue: true },
|
|
56
|
+
{ package: 'foreign', name: 'read.systat', argIdx: 0, argName: 'file', resolveValue: true },
|
|
57
|
+
{ package: 'foreign', name: 'read.xport', argIdx: 0, argName: 'file', resolveValue: true },
|
|
58
|
+
{ package: 'car', name: 'Import', argIdx: 0, argName: 'file', resolveValue: true },
|
|
59
|
+
{ package: 'magick', name: 'image_read', argIdx: 0, argName: 'path', resolveValue: true },
|
|
60
|
+
{ package: 'magick', name: 'image_read_svg', argIdx: 0, argName: 'path', resolveValue: true },
|
|
61
|
+
{ package: 'magick', name: 'image_read_pdf', argIdx: 0, argName: 'path', resolveValue: true },
|
|
62
|
+
{ package: 'magick', name: 'image_read_video', argIdx: 0, argName: 'path', resolveValue: true },
|
|
63
|
+
{ package: 'LIM', name: 'Read', argIdx: 0, argName: 'file', resolveValue: true },
|
|
64
|
+
{ package: 'sourcetools', name: 'read', argIdx: 0, argName: 'path', resolveValue: true },
|
|
65
|
+
{ package: 'sourcetools', name: 'read_lines', argIdx: 0, argName: 'path', resolveValue: true },
|
|
66
|
+
{ package: 'sourcetools', name: 'read_bytes', argIdx: 0, argName: 'path', resolveValue: true },
|
|
67
|
+
{ package: 'sourcetools', name: 'read_lines_bytes', argIdx: 0, argName: 'path', resolveValue: true },
|
|
68
|
+
{ package: 'sourcetools', name: 'tokenize', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
69
|
+
{ package: 'sourcetools', name: 'tokenize_file', argIdx: 0, argName: 'path', resolveValue: true },
|
|
70
|
+
{ 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
|
+
{ package: 'SimPhe', name: 'read.geno', argIdx: 0, argName: 'fname', resolveValue: true },
|
|
73
|
+
{ package: 'ape', name: 'read.tree', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
74
|
+
{ package: 'geomorph', name: 'readland.tps', argIdx: 0, argName: 'file', resolveValue: true },
|
|
75
|
+
{ package: 'readxl', name: 'read_excel', argIdx: 0, argName: 'path', resolveValue: true },
|
|
76
|
+
{ package: 'readxl', name: 'read_xls', argIdx: 0, argName: 'path', resolveValue: true },
|
|
77
|
+
{ package: 'readxl', name: 'read_xlsx', argIdx: 0, argName: 'path', resolveValue: true },
|
|
78
|
+
{ package: 'sf', name: 'read.sf', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
79
|
+
{ package: 'sf', name: 'st_read', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
80
|
+
{ package: 'rgdal', name: 'readOGR', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
81
|
+
{ package: 'rgdal', name: 'ogrInfo', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
82
|
+
{ package: 'rgdal', name: 'ogrFIDs', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
83
|
+
{ package: 'rgdal', name: 'OGRSpatialRef', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
84
|
+
{ package: 'rgdal', name: 'ogrListLayers', argIdx: 0, argName: 'dsn', resolveValue: true },
|
|
85
|
+
{ package: 'rgdal', name: 'readGDAL', argIdx: 0, argName: 'fname', resolveValue: true },
|
|
86
|
+
{ package: 'readstata13', name: 'read.dta13', argIdx: 0, argName: 'file', resolveValue: true },
|
|
87
|
+
{ package: 'arrow', name: 'read_parquet', argIdx: 0, argName: 'file', resolveValue: true },
|
|
88
|
+
{ package: 'maptools', name: 'readShapePoly', argIdx: 0, argName: 'fn', resolveValue: true },
|
|
89
|
+
{ package: 'XLConnect', name: 'readWorksheetFromFile', argIdx: 0, argName: 'file', resolveValue: true },
|
|
90
|
+
{ package: 'XLConnect', name: 'readNamedRegionFromFile', argIdx: 0, argName: 'file', resolveValue: true },
|
|
91
|
+
{ package: 'XLConnect', name: 'loadWorkbook', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
92
|
+
{ package: 'DiagrammeR', name: 'import_graph', argIdx: 0, argName: 'graph_file', resolveValue: true },
|
|
93
|
+
{ package: 'DiagrammeR', name: 'open_graph', argIdx: 0, argName: 'file', resolveValue: true },
|
|
94
|
+
{ package: 'highcharter', name: 'download_map_data', argIdx: 0, argName: 'url', resolveValue: true },
|
|
95
|
+
{ package: 'rvest', name: 'read_html', argIdx: 0, argName: 'x', resolveValue: true },
|
|
96
|
+
{ package: 'rvest', name: 'read_html_live', argIdx: 0, argName: 'url', resolveValue: true },
|
|
97
|
+
{ package: 'stats', name: 'read.ftable', argIdx: 0, argName: 'file', resolveValue: true },
|
|
98
|
+
{ package: 'DBI', name: 'dbReadTable', argIdx: 1, argName: 'name', resolveValue: true },
|
|
99
|
+
{ package: 'DBI', name: 'dbReadTableArrow', argIdx: 1, argName: 'name', resolveValue: true },
|
|
100
|
+
];
|
|
101
|
+
//# sourceMappingURL=read-functions.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SourceFunctions = void 0;
|
|
4
|
+
// these lists are originally based on https://github.com/duncantl/CodeDepends/blob/7fd96dfee16b252e5f642c77a7ababf48e9326f8/R/codeTypes.R
|
|
5
|
+
exports.SourceFunctions = [
|
|
6
|
+
{ package: 'base', name: 'source', argIdx: 0, argName: 'file', resolveValue: true },
|
|
7
|
+
{ package: 'base', name: 'sys.source', argIdx: 0, argName: 'file', resolveValue: true },
|
|
8
|
+
{ package: 'devtools', name: 'source_url', argIdx: 0, argName: 'url', resolveValue: true },
|
|
9
|
+
{ package: 'devtools', name: 'source_gist', argIdx: 0, argName: 'id', resolveValue: true }
|
|
10
|
+
];
|
|
11
|
+
//# sourceMappingURL=source-functions.js.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WriteFunctions = void 0;
|
|
4
|
+
const function_info_1 = require("./function-info");
|
|
5
|
+
const OutputRedirects = [
|
|
6
|
+
{ type: 'link-to-last-call', callName: 'sink', attachLinkInfo: { argIdx: 0, argName: 'file', when: function_info_1.DependencyInfoLinkConstraint.IfUnknown, resolveValue: true } }
|
|
7
|
+
];
|
|
8
|
+
exports.WriteFunctions = [
|
|
9
|
+
{ package: 'base', name: 'save', argName: 'file', resolveValue: true },
|
|
10
|
+
{ package: 'base', name: 'save.image', argIdx: 1, argName: 'file', resolveValue: true },
|
|
11
|
+
{ package: 'base', name: 'write', argIdx: 1, argName: 'file', resolveValue: true },
|
|
12
|
+
{ package: 'base', name: 'dput', argIdx: 1, argName: 'file', resolveValue: true },
|
|
13
|
+
{ package: 'base', name: 'dump', argIdx: 1, argName: 'file', resolveValue: true },
|
|
14
|
+
{ package: 'utils', name: 'write.table', argIdx: 1, argName: 'file', resolveValue: true },
|
|
15
|
+
{ package: 'utils', name: 'write.csv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
16
|
+
{ package: 'base', name: 'saveRDS', argIdx: 1, argName: 'file', resolveValue: true },
|
|
17
|
+
// write functions that don't have argIndex are assumed to write to stdout
|
|
18
|
+
{ package: 'base', name: 'print', linkTo: OutputRedirects, resolveValue: true },
|
|
19
|
+
{ package: 'base', name: 'cat', linkTo: OutputRedirects, argName: 'file', resolveValue: true },
|
|
20
|
+
{ package: 'base', name: 'message', linkTo: OutputRedirects, resolveValue: true },
|
|
21
|
+
{ package: 'base', name: 'warning', linkTo: OutputRedirects, resolveValue: true },
|
|
22
|
+
{ package: 'readr', name: 'write_csv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
23
|
+
{ package: 'readr', name: 'write_csv2', argIdx: 1, argName: 'file', resolveValue: true },
|
|
24
|
+
{ package: 'readr', name: 'write_delim', argIdx: 1, argName: 'file', resolveValue: true },
|
|
25
|
+
{ package: 'readr', name: 'write_dsv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
26
|
+
{ package: 'readr', name: 'write_fwf', argIdx: 1, argName: 'file', resolveValue: true },
|
|
27
|
+
{ package: 'readr', name: 'write_tsv', argIdx: 1, argName: 'file', resolveValue: true },
|
|
28
|
+
{ package: 'readr', name: 'write_table', argIdx: 1, argName: 'file', resolveValue: true },
|
|
29
|
+
{ package: 'readr', name: 'write_log', argIdx: 1, argName: 'file', resolveValue: true },
|
|
30
|
+
{ package: 'readr', name: 'write_lines', argIdx: 1, argName: 'file', resolveValue: true },
|
|
31
|
+
{ package: 'readr', name: 'write_rds', argIdx: 1, argName: 'file', resolveValue: true },
|
|
32
|
+
{ package: 'heaven', name: 'write_sas', argIdx: 1, argName: 'file', resolveValue: true },
|
|
33
|
+
{ package: 'heaven', name: 'write_sav', argIdx: 1, argName: 'file', resolveValue: true },
|
|
34
|
+
{ package: 'heaven', name: 'write_por', argIdx: 1, argName: 'file', resolveValue: true },
|
|
35
|
+
{ package: 'heaven', name: 'write_dta', argIdx: 1, argName: 'file', resolveValue: true },
|
|
36
|
+
{ package: 'heaven', name: 'write_xpt', argIdx: 1, argName: 'file', resolveValue: true },
|
|
37
|
+
{ package: 'feather', name: 'write_feather', argIdx: 1, argName: 'file', resolveValue: true },
|
|
38
|
+
{ package: 'foreign', name: 'write.arff', argIdx: 1, argName: 'file', resolveValue: true },
|
|
39
|
+
{ package: 'foreign', name: 'write.dbf', argIdx: 1, argName: 'file', resolveValue: true },
|
|
40
|
+
{ package: 'foreign', name: 'write.dta', argIdx: 1, argName: 'file', resolveValue: true },
|
|
41
|
+
{ package: 'foreign', name: 'write.foreign', argIdx: 1, argName: 'file', resolveValue: true },
|
|
42
|
+
{ package: 'xlsx', name: 'write.xlsx', argIdx: 1, argName: 'file', resolveValue: true },
|
|
43
|
+
{ package: 'xlsx', name: 'write.xlsx2', argIdx: 1, argName: 'file', resolveValue: true },
|
|
44
|
+
{ package: 'graphics', name: 'pdf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
45
|
+
{ package: 'graphics', name: 'jpeg', argIdx: 0, argName: 'file', resolveValue: true },
|
|
46
|
+
{ package: 'graphics', name: 'png', argIdx: 0, argName: 'file', resolveValue: true },
|
|
47
|
+
{ package: 'graphics', name: 'windows', argIdx: 0, argName: 'file', resolveValue: true },
|
|
48
|
+
{ package: 'graphics', name: 'postscript', argIdx: 0, argName: 'file', resolveValue: true },
|
|
49
|
+
{ package: 'graphics', name: 'xfix', argIdx: 0, argName: 'file', resolveValue: true },
|
|
50
|
+
{ package: 'graphics', name: 'bitmap', argIdx: 0, argName: 'file', resolveValue: true },
|
|
51
|
+
{ package: 'graphics', name: 'pictex', argIdx: 0, argName: 'file', resolveValue: true },
|
|
52
|
+
{ package: 'graphics', name: 'cairo_pdf', argIdx: 0, argName: 'file', resolveValue: true },
|
|
53
|
+
{ package: 'graphics', name: 'svg', argIdx: 0, argName: 'file', resolveValue: true },
|
|
54
|
+
{ package: 'graphics', name: 'bmp', argIdx: 0, argName: 'file', resolveValue: true },
|
|
55
|
+
{ package: 'graphics', name: 'tiff', argIdx: 0, argName: 'file', resolveValue: true },
|
|
56
|
+
{ package: 'graphics', name: 'X11', argIdx: 0, argName: 'file', resolveValue: true },
|
|
57
|
+
{ package: 'graphics', name: 'quartz', argIdx: 0, argName: 'file', resolveValue: true },
|
|
58
|
+
{ package: 'car', name: 'Export', argIdx: 0, argName: 'file', resolveValue: true },
|
|
59
|
+
{ package: 'LIM', name: 'PrintMat', linkTo: OutputRedirects, resolveValue: true },
|
|
60
|
+
{ package: 'sjmisc', name: 'write_spss', argIdx: 1, argName: 'path', resolveValue: true },
|
|
61
|
+
{ package: 'sjmisc', name: 'write_stata', argIdx: 1, argName: 'path', resolveValue: true },
|
|
62
|
+
{ package: 'sjmisc', name: 'write_sas', argIdx: 1, argName: 'path', resolveValue: true },
|
|
63
|
+
{ package: 'ape', name: 'write.tree', argIdx: 1, argName: 'file', resolveValue: true },
|
|
64
|
+
{ package: 'ape', name: 'write.nexus', argIdx: 1, argName: 'file', resolveValue: true },
|
|
65
|
+
{ package: 'ape', name: 'write.phyloXML', argIdx: 1, argName: 'file', resolveValue: true },
|
|
66
|
+
{ package: 'Claddis', name: 'write_nexus_matrix', argIdx: 1, argName: 'file_name', resolveValue: true },
|
|
67
|
+
{ package: 'Claddis', name: 'write_tnt_matrix', argIdx: 1, argName: 'file_name', resolveValue: true },
|
|
68
|
+
{ package: 'rgdal', name: 'writeOGR', argIdx: 1, argName: 'dsn', resolveValue: true },
|
|
69
|
+
{ package: 'rgdal', name: 'writeGDAL', argIdx: 1, argName: 'fname', resolveValue: true },
|
|
70
|
+
{ package: 'arrow', name: 'write_parquet', argIdx: 1, argName: 'sink', resolveValue: true },
|
|
71
|
+
{ package: 'sf', name: 'st_write', argIdx: 1, argName: 'dsn', resolveValue: true },
|
|
72
|
+
{ package: 'sf', name: 'write_sf', argIdx: 1, argName: 'dsn', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
73
|
+
{ package: 'maptools', name: 'writePolyShape', argIdx: 1, argName: 'fn', resolveValue: true },
|
|
74
|
+
{ package: 'XLConnect', name: 'writeNamedRegionToFile', argIdx: 0, argName: 'file', resolveValue: true },
|
|
75
|
+
{ package: 'XLConnect', name: 'writeWorksheetToFile', argIdx: 0, argName: 'file', resolveValue: true },
|
|
76
|
+
{ package: 'visNetwork', name: 'visSave', argIdx: 1, argName: 'file', resolveValue: true },
|
|
77
|
+
{ package: 'DiagrammeR', name: 'save_graph', argIdx: 1, argName: 'file', resolveValue: true },
|
|
78
|
+
{ package: 'DiagrammeR', name: 'export_graph', argName: 'file_name', resolveValue: true },
|
|
79
|
+
{ package: 'ggplot', name: 'ggsave', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
80
|
+
{ package: 'cowplot', name: 'ggsave2', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
81
|
+
{ package: 'tinyplot', name: 'tinyplot', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
82
|
+
{ package: 'tinyplot', name: 'plt', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
|
|
83
|
+
{ package: 'rasterpdf', name: 'raster_pdf', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
84
|
+
{ package: 'rasterpdf', name: 'agg_pdf', argIdx: 0, argName: 'filename', resolveValue: true },
|
|
85
|
+
{ package: 'highcharter', name: 'hc_exporting', argName: 'filename', resolveValue: true },
|
|
86
|
+
];
|
|
87
|
+
//# sourceMappingURL=write-functions.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LocationMapQuery, LocationMapQueryResult } from './location-map-query-format';
|
|
2
2
|
import type { BasicQueryData } from '../../base-query-format';
|
|
3
|
-
export declare function executeLocationMapQuery({ ast }: BasicQueryData, queries: readonly LocationMapQuery[]): LocationMapQueryResult;
|
|
3
|
+
export declare function executeLocationMapQuery({ ast, dataflow: { graph } }: BasicQueryData, queries: readonly LocationMapQuery[]): LocationMapQueryResult;
|
|
@@ -2,14 +2,49 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeLocationMapQuery = executeLocationMapQuery;
|
|
4
4
|
const log_1 = require("../../../util/log");
|
|
5
|
-
|
|
5
|
+
const fileIdRegex = /^(?<file>.*(\.[rR]))-/;
|
|
6
|
+
function fuzzyFindFile(node, idMap) {
|
|
7
|
+
if (node?.info.file) {
|
|
8
|
+
return node.info.file;
|
|
9
|
+
}
|
|
10
|
+
else if (node?.info.id) {
|
|
11
|
+
const file = fileIdRegex.exec(String(node.info.id));
|
|
12
|
+
if (file && file.groups?.file.trim()) {
|
|
13
|
+
return file.groups?.file.trim();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
else if (node?.info.parent) {
|
|
17
|
+
const parent = idMap.get(node.info.parent);
|
|
18
|
+
if (parent) {
|
|
19
|
+
return fuzzyFindFile(parent, idMap);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return '<inline>';
|
|
23
|
+
}
|
|
24
|
+
function executeLocationMapQuery({ ast, dataflow: { graph } }, queries) {
|
|
6
25
|
if (queries.length !== 1) {
|
|
7
26
|
log_1.log.warn('Id-Map query expects only up to one query, but got', queries.length);
|
|
8
27
|
}
|
|
9
28
|
const start = Date.now();
|
|
10
|
-
const locationMap = {
|
|
29
|
+
const locationMap = {
|
|
30
|
+
files: {},
|
|
31
|
+
ids: {}
|
|
32
|
+
};
|
|
33
|
+
let count = 0;
|
|
34
|
+
const inverseMap = new Map();
|
|
35
|
+
for (const file of graph.sourced) {
|
|
36
|
+
locationMap.files[count] = file;
|
|
37
|
+
inverseMap.set(file, count);
|
|
38
|
+
count++;
|
|
39
|
+
}
|
|
11
40
|
for (const [id, node] of ast.idMap.entries()) {
|
|
12
|
-
|
|
41
|
+
if (node.location) {
|
|
42
|
+
const file = fuzzyFindFile(node, ast.idMap);
|
|
43
|
+
locationMap.ids[id] = [
|
|
44
|
+
inverseMap.get(file) ?? -1,
|
|
45
|
+
node.location
|
|
46
|
+
];
|
|
47
|
+
}
|
|
13
48
|
}
|
|
14
49
|
return {
|
|
15
50
|
'.meta': {
|
|
@@ -7,8 +7,17 @@ import type { SourceRange } from '../../../util/range';
|
|
|
7
7
|
export interface LocationMapQuery extends BaseQueryFormat {
|
|
8
8
|
readonly type: 'location-map';
|
|
9
9
|
}
|
|
10
|
+
export type FileId = number & {
|
|
11
|
+
readonly __fileId?: unique symbol;
|
|
12
|
+
};
|
|
13
|
+
export type FilePath = string & {
|
|
14
|
+
readonly __filePath?: unique symbol;
|
|
15
|
+
};
|
|
10
16
|
export interface LocationMapQueryResult extends BaseQueryResult {
|
|
11
|
-
readonly map:
|
|
17
|
+
readonly map: {
|
|
18
|
+
files: Record<FileId, FilePath>;
|
|
19
|
+
ids: Record<NodeId, [FileId, SourceRange]>;
|
|
20
|
+
};
|
|
12
21
|
}
|
|
13
22
|
export declare const LocationMapQueryDefinition: {
|
|
14
23
|
readonly executor: typeof executeLocationMapQuery;
|