@eagleoutice/flowr 2.13.2 → 2.13.3
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 +46 -44
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +1 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +3 -0
- package/abstract-interpretation/domains/state-domain-like.d.ts +1 -1
- package/config.d.ts +8 -0
- package/config.js +9 -1
- package/control-flow/control-flow-graph.js +2 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +1 -1
- package/dataflow/environments/append.d.ts +1 -1
- package/dataflow/environments/clone.d.ts +1 -1
- package/dataflow/environments/environment.d.ts +28 -4
- package/dataflow/environments/environment.js +66 -11
- package/dataflow/environments/overwrite.d.ts +1 -1
- package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +51 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +15 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +9 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +1 -1
- package/documentation/doc-readme.js +14 -12
- package/documentation/doc-util/doc-normalized-ast.d.ts +1 -1
- package/documentation/wiki-dataflow-graph.js +4 -24
- package/documentation/wiki-query.js +47 -0
- package/documentation/wiki-signature-database.js +3 -2
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/undefined-symbol-util.js +3 -1
- package/linter/rules/undefined-symbol.js +3 -4
- package/package.json +21 -9
- package/project/context/flowr-analyzer-context.d.ts +4 -4
- package/project/context/flowr-analyzer-context.js +3 -3
- package/project/context/flowr-analyzer-dependencies-context.d.ts +11 -5
- package/project/context/flowr-analyzer-dependencies-context.js +8 -3
- package/project/context/flowr-analyzer-meta-context.d.ts +1 -0
- package/project/dependency-version-space.d.ts +118 -26
- package/project/dependency-version-space.js +343 -87
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +8 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +27 -25
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +4 -4
- package/project/plugins/package-version-plugins/package.d.ts +27 -10
- package/project/plugins/package-version-plugins/package.js +50 -25
- package/project/sigdb/reader.d.ts +26 -16
- package/project/sigdb/reader.js +52 -21
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +39 -77
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +12 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +53 -23
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +13 -0
- package/queries/catalog/input-sources-query/input-source-functions.js +96 -1
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +40 -4
- package/queries/catalog/input-sources-query/input-sources-query-format.js +21 -3
- package/queries/catalog/input-sources-query/input-types.d.ts +58 -0
- package/queries/catalog/input-sources-query/input-types.js +64 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +62 -52
- package/queries/catalog/input-sources-query/simple-input-classifier.js +334 -101
- package/queries/catalog/project-query/project-query-executor.js +1 -1
- package/queries/catalog/signature-query/signature-query-executor.d.ts +7 -1
- package/queries/catalog/signature-query/signature-query-executor.js +112 -39
- package/queries/catalog/signature-query/signature-query-format.d.ts +5 -1
- package/queries/catalog/signature-query/signature-query-format.js +1 -1
- package/queries/catalog/signature-query/signature-query-render.js +8 -3
- package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
- package/r-bridge/retriever.d.ts +1 -1
- package/search/flowr-search-printer.js +10 -8
- package/slicing/static/static-slicer.d.ts +2 -2
- package/util/objects.js +6 -4
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +3 -0
- package/util/r-license.js +1 -4
- package/util/r-version.d.ts +12 -0
- package/util/r-version.js +16 -0
- package/util/range.d.ts +6 -2
- package/util/range.js +33 -15
- package/util/version.js +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cranPageUrl = cranPageUrl;
|
|
4
4
|
exports.cranMirrorSourceUrl = cranMirrorSourceUrl;
|
|
5
|
+
exports.rSourceRef = rSourceRef;
|
|
5
6
|
exports.rdrrDocUrl = rdrrDocUrl;
|
|
6
7
|
exports.signatureFunctionInfo = signatureFunctionInfo;
|
|
7
8
|
exports.signaturePackageInfo = signaturePackageInfo;
|
|
@@ -99,7 +100,23 @@ function cranMirrorSourceUrl(pkg, version, file, line) {
|
|
|
99
100
|
const anchor = line !== undefined && line >= 0 ? `#L${line}` : '';
|
|
100
101
|
return `${cranMirrorRepoUrl(pkg)}/blob/${ref}/${file}${anchor}`;
|
|
101
102
|
}
|
|
102
|
-
/**
|
|
103
|
+
/** read-only GitHub mirror of R's own SVN; base packages live under `src/library/<pkg>` */
|
|
104
|
+
const RSourceMirror = 'https://github.com/wch/r-source';
|
|
105
|
+
/**
|
|
106
|
+
* The mirror ref holding an R version. The mirror carries no tags, only a `R-<major>-<minor>-branch` per release
|
|
107
|
+
* series, so a link is exact to the minor release and points at its latest patch; `trunk` stands in when the version
|
|
108
|
+
* is unknown.
|
|
109
|
+
*/
|
|
110
|
+
function rSourceRef(version) {
|
|
111
|
+
const series = /^(\d+)\.(\d+)/.exec(version ?? '');
|
|
112
|
+
return series ? `R-${series[1]}-${series[2]}-branch` : 'trunk';
|
|
113
|
+
}
|
|
114
|
+
/** deep-link a base-R definition into the R sources mirror at the release series of `version` */
|
|
115
|
+
function rSourceUrl(pkg, version, file, line) {
|
|
116
|
+
const anchor = line !== undefined && line >= 0 ? `#L${line}` : '';
|
|
117
|
+
return `${RSourceMirror}/blob/${rSourceRef(version)}/src/library/${encodeURIComponent(pkg)}/${file}${anchor}`;
|
|
118
|
+
}
|
|
119
|
+
/** function/topic names that map cleanly to a man page (skip operators like `+.gg`, `[.data.frame`; Rd topics allow hyphens, e.g. `dplyr-package`) */
|
|
103
120
|
const RdrrTopicName = /^[A-Za-z.][A-Za-z0-9._-]*$/;
|
|
104
121
|
/** best-effort rdrr.io documentation link: `/r/<pkg>/<fn>` for base R, `/cran/<pkg>/man/<fn>` for CRAN */
|
|
105
122
|
function rdrrDocUrl(pkg, fn, opts) {
|
|
@@ -114,18 +131,48 @@ function rdrrDocUrl(pkg, fn, opts) {
|
|
|
114
131
|
}
|
|
115
132
|
return undefined;
|
|
116
133
|
}
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
|
|
134
|
+
/**
|
|
135
|
+
* The `.Rd` help source of a topic *at the queried version*, on the same mirrors the source links use. rdrr.io only
|
|
136
|
+
* serves a package's current release, so {@link rdrrDocUrl} silently answers for the wrong version whenever an older
|
|
137
|
+
* one was asked for; this link cannot drift.
|
|
138
|
+
*/
|
|
139
|
+
function manPageUrl(pkg, topic, version, opts) {
|
|
140
|
+
if (!RdrrTopicName.test(topic)) {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
if (opts.base) {
|
|
144
|
+
return rSourceUrl(pkg, version, `man/${topic}.Rd`);
|
|
145
|
+
}
|
|
146
|
+
return opts.cran ? cranMirrorSourceUrl(pkg, version, `man/${topic}.Rd`) : undefined;
|
|
147
|
+
}
|
|
148
|
+
/** the doc links for a function: its help topic (else its name), or none when it is proven undocumented (`no-doc`) */
|
|
149
|
+
function docUrlsFor(pkg, fn, version, base, cran) {
|
|
150
|
+
if (fn.props.includes('no-doc')) {
|
|
151
|
+
return {};
|
|
152
|
+
}
|
|
153
|
+
const topic = fn.topic ?? fn.name;
|
|
154
|
+
const doc = rdrrDocUrl(pkg, topic, { base, cran });
|
|
155
|
+
const man = manPageUrl(pkg, topic, version, { base, cran });
|
|
156
|
+
return { ...(doc ? { docUrl: doc } : {}), ...(man ? { manUrl: man } : {}) };
|
|
157
|
+
}
|
|
158
|
+
/** the source link of a definition: the CRAN mirror at its version tag, or the R sources mirror for a base package */
|
|
159
|
+
function sourceUrlFor(pkg, fn, version, base, cran) {
|
|
160
|
+
if (!fn.file) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
if (base) {
|
|
164
|
+
return rSourceUrl(pkg, version, fn.file, fn.line);
|
|
165
|
+
}
|
|
166
|
+
return cran ? cranMirrorSourceUrl(pkg, version, fn.file, fn.line) : undefined;
|
|
120
167
|
}
|
|
121
|
-
/** the trailing fields shared by every function view: definition location,
|
|
168
|
+
/** the trailing fields shared by every function view: definition location, source link, and documentation links */
|
|
122
169
|
function locationFields(pkg, fn, version, base, cran) {
|
|
123
|
-
const
|
|
170
|
+
const source = sourceUrlFor(pkg, fn, version, base, cran);
|
|
124
171
|
return {
|
|
125
172
|
...(fn.file ? { file: fn.file } : {}),
|
|
126
173
|
...(fn.line >= 0 ? { line: fn.line } : {}),
|
|
127
|
-
...(
|
|
128
|
-
...(
|
|
174
|
+
...(source ? { sourceUrl: source } : {}),
|
|
175
|
+
...docUrlsFor(pkg, fn, version, base, cran)
|
|
129
176
|
};
|
|
130
177
|
}
|
|
131
178
|
/** the decoded view of one function, adding the CRAN-mirror source link */
|
|
@@ -148,7 +195,7 @@ function decodedToView(pkg, fn, version, opts) {
|
|
|
148
195
|
}
|
|
149
196
|
/**
|
|
150
197
|
* The detailed view of a single function within a package: its signature (parameters, forced/optional,
|
|
151
|
-
* defaults), properties, definition location, call graph, and
|
|
198
|
+
* defaults), properties, definition location, call graph, and for a CRAN package a deep link into the
|
|
152
199
|
* read-only CRAN GitHub mirror. `version` defaults to the source's latest; `undefined` when the source does
|
|
153
200
|
* not carry that function.
|
|
154
201
|
*/
|
|
@@ -160,40 +207,70 @@ function signatureFunctionInfo(src, pkg, fnName, version) {
|
|
|
160
207
|
}
|
|
161
208
|
const exports = src.lookup(pkg, version) ?? src.lookup(pkg);
|
|
162
209
|
const view = decodedToView(pkg, fn, exports?.version, { cran: exports?.cran ?? false, base: src.isBaseR(pkg) });
|
|
163
|
-
// an S3 generic's methods are the
|
|
164
|
-
//
|
|
210
|
+
// an S3 generic's methods are the `<generic>.<class>` functions that resolve back to it (see s3MethodParts);
|
|
211
|
+
// the reverse links a method to the generic it dispatches for
|
|
165
212
|
const methods = (fns ?? [])
|
|
166
|
-
.filter(f => f.name !== fn.name && f.name.startsWith(fn.name + '.') &&
|
|
213
|
+
.filter(f => f.name !== fn.name && f.name.startsWith(fn.name + '.') && s3MethodParts(src, pkg, fns, f)?.generic === fn.name)
|
|
167
214
|
.map(f => f.name)
|
|
168
215
|
.sort();
|
|
169
|
-
const s3method =
|
|
216
|
+
const s3method = s3MethodParts(src, pkg, fns, fn);
|
|
170
217
|
return {
|
|
171
218
|
...view,
|
|
172
219
|
...(methods.length > 0 ? { s3generic: true, s3methods: methods } : {}),
|
|
173
220
|
...(s3method ? { s3method } : {})
|
|
174
221
|
};
|
|
175
222
|
}
|
|
176
|
-
/** whether
|
|
177
|
-
function
|
|
178
|
-
return fn.
|
|
223
|
+
/** whether `fn` is an S3 generic: its body dispatches via `UseMethod`, so `<name>.<class>` functions can be its methods */
|
|
224
|
+
function dispatchesGeneric(fn) {
|
|
225
|
+
return fn.callees.includes('UseMethod');
|
|
226
|
+
}
|
|
227
|
+
/** the function named `generic`, resolved in `pkg` first, then base R, with the package it was found in */
|
|
228
|
+
function resolveGeneric(src, pkg, fns, generic) {
|
|
229
|
+
const local = fns?.find(f => f.name === generic);
|
|
230
|
+
if (local) {
|
|
231
|
+
return { fn: local, package: pkg };
|
|
232
|
+
}
|
|
233
|
+
for (const base of (0, r_base_packages_1.baseRPackages)()) {
|
|
234
|
+
if (base !== pkg) {
|
|
235
|
+
const fn = src.functionByName(base, generic);
|
|
236
|
+
if (fn) {
|
|
237
|
+
return { fn, package: base };
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
/** whether `cls` is a class a loaded package registers S3 methods for (the method's own package, or base R) */
|
|
244
|
+
function isKnownS3Class(src, pkg, cls) {
|
|
245
|
+
if (src.lookup(pkg)?.s3Classes.includes(cls)) {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
for (const base of (0, r_base_packages_1.baseRPackages)()) {
|
|
249
|
+
if (base !== pkg && src.lookup(base)?.s3Classes.includes(cls)) {
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
/** the `generic.class` readings of a dotted name, longest generic first (`as.data.frame.matrix` before `as.data`) */
|
|
256
|
+
function* dottedSplits(name) {
|
|
257
|
+
for (let dot = name.lastIndexOf('.'); dot > 0; dot = name.lastIndexOf('.', dot - 1)) {
|
|
258
|
+
yield [name.slice(0, dot), name.slice(dot + 1)];
|
|
259
|
+
}
|
|
179
260
|
}
|
|
180
261
|
/**
|
|
181
|
-
* The generic and dispatch class of
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
262
|
+
* The generic and dispatch class of an S3 method named `generic.class`, or `undefined` when `fn` is not one.
|
|
263
|
+
*
|
|
264
|
+
* The crawled `s3-method` property settles it when present. It is missing for a base method whose generic lives in
|
|
265
|
+
* another package (`stats` never flags `print.acf`, since `print` is in `base`), so then the prefix must name a
|
|
266
|
+
* dispatching generic and the suffix a registered class. Dropping either check would split `data.frame` or `t.test`.
|
|
185
267
|
*/
|
|
186
|
-
function s3MethodParts(src, pkg, fns,
|
|
187
|
-
const
|
|
188
|
-
for (
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
return { generic, class:
|
|
192
|
-
}
|
|
193
|
-
for (const base of bases) {
|
|
194
|
-
if (base !== pkg && src.functionByName(base, generic) !== undefined) {
|
|
195
|
-
return { generic, class: name.slice(dot + 1), package: base };
|
|
196
|
-
}
|
|
268
|
+
function s3MethodParts(src, pkg, fns, fn) {
|
|
269
|
+
const flagged = fn.props.includes('s3-method');
|
|
270
|
+
for (const [generic, cls] of dottedSplits(fn.name)) {
|
|
271
|
+
const g = resolveGeneric(src, pkg, fns, generic);
|
|
272
|
+
if (g && (flagged || (dispatchesGeneric(g.fn) && isKnownS3Class(src, pkg, cls)))) {
|
|
273
|
+
return { generic, class: cls, package: g.package };
|
|
197
274
|
}
|
|
198
275
|
}
|
|
199
276
|
return undefined;
|
|
@@ -260,7 +337,7 @@ function signatureCallGraphUrl(src, pkg, version, root) {
|
|
|
260
337
|
for (const callee of src.functionByName(cur.owner, cur.name, cur.ver)?.callees ?? []) {
|
|
261
338
|
const r = resolve(cur.owner, cur.ver, callee);
|
|
262
339
|
edges.push(` ${cur.id} --> ${node(r?.owner, r ? r.name : callee)}`);
|
|
263
|
-
// expand into a resolved same/other CRAN package (not base R
|
|
340
|
+
// expand into a resolved same/other CRAN package (not base R, whose internals explode the graph), avoiding cycles
|
|
264
341
|
if (r && !bases.has(r.owner) && !seen.has(`${r.owner}::${r.name}`) && nodes.size < CallGraphMaxNodes) {
|
|
265
342
|
queue.push({ owner: r.owner, ver: r.owner === cur.owner ? cur.ver : src.latestVersion(r.owner)?.str, name: r.name, id: node(r.owner, r.name) });
|
|
266
343
|
}
|
|
@@ -364,16 +441,12 @@ function matchedParamPreview(fn, q) {
|
|
|
364
441
|
}
|
|
365
442
|
/** a compact view for a wildcard search hit (signature/call-graph omitted; the JSON dump carries those per name) */
|
|
366
443
|
function compactMatch(pkg, fn, version, base, cran, params) {
|
|
367
|
-
const doc = docUrlFor(pkg, fn, base, cran);
|
|
368
444
|
return {
|
|
369
445
|
package: pkg,
|
|
370
446
|
name: fn.name,
|
|
371
447
|
exported: fn.exported,
|
|
372
448
|
...(version !== undefined ? { version } : {}),
|
|
373
|
-
...(
|
|
374
|
-
...(fn.line >= 0 ? { line: fn.line } : {}),
|
|
375
|
-
...(cran && !base && fn.file ? { sourceUrl: cranMirrorSourceUrl(pkg, version, fn.file, fn.line) } : {}),
|
|
376
|
-
...(doc ? { docUrl: doc } : {}),
|
|
449
|
+
...locationFields(pkg, fn, version, base, cran),
|
|
377
450
|
...(params && params.preview.length > 0 ? { parameters: params.preview } : {}),
|
|
378
451
|
...(params && params.matched.length > 0 ? { matchedParameters: params.matched } : {})
|
|
379
452
|
};
|
|
@@ -391,7 +464,7 @@ function allAvailableVersions(sources, pkg) {
|
|
|
391
464
|
return [...set].sort((a, b) => r_version_1.RVersion.compare(a, b));
|
|
392
465
|
}
|
|
393
466
|
/**
|
|
394
|
-
* The owning source that actually carries `version
|
|
467
|
+
* The owning source that actually carries `version`: `current` is checked before `history`, so a
|
|
395
468
|
* latest-version query never decompresses the (large) history shard. Returns the first owner when no version
|
|
396
469
|
* was asked, or `undefined` when an explicit version is carried by none of them.
|
|
397
470
|
*/
|
|
@@ -449,7 +522,7 @@ function searchSources(sources, allNames, q) {
|
|
|
449
522
|
}
|
|
450
523
|
const fnMatch = q.function ? nameMatcher(q.function) : () => true;
|
|
451
524
|
// an exact function name lets us seek that one record (decoding only it) instead of decoding every function of
|
|
452
|
-
// every package
|
|
525
|
+
// every package, the difference between a fast `* ggplot` and one that decodes the whole database
|
|
453
526
|
const exactName = q.function !== undefined && !hasGlob(q.function);
|
|
454
527
|
const matches = [];
|
|
455
528
|
let searched = 0;
|
|
@@ -49,10 +49,12 @@ export interface SignatureFunctionView {
|
|
|
49
49
|
readonly callees: readonly string[];
|
|
50
50
|
readonly file?: string;
|
|
51
51
|
readonly line?: number;
|
|
52
|
-
/** deep link
|
|
52
|
+
/** deep link to the definition on the read-only GitHub mirror of the sources (CRAN, or R's own for a base package) */
|
|
53
53
|
readonly sourceUrl?: string;
|
|
54
54
|
/** best-effort rdrr.io documentation link, when the function name maps to a documentable topic */
|
|
55
55
|
readonly docUrl?: string;
|
|
56
|
+
/** link to the `.Rd` help source *at the queried version*, which {@link docUrl} cannot offer (rdrr.io only serves the current release) */
|
|
57
|
+
readonly manUrl?: string;
|
|
56
58
|
/** whether the function looks like an S3 generic (has `<generic>.<class>` dispatch targets in the same package) */
|
|
57
59
|
readonly s3generic?: boolean;
|
|
58
60
|
/** the `<generic>.<class>` dispatch targets found in the same package */
|
|
@@ -108,6 +110,8 @@ export interface SignatureMatchView {
|
|
|
108
110
|
readonly sourceUrl?: string;
|
|
109
111
|
/** best-effort rdrr.io documentation link, when the function name maps to a documentable topic */
|
|
110
112
|
readonly docUrl?: string;
|
|
113
|
+
/** link to the `.Rd` help source at the queried version, see {@link SignatureFunctionView.manUrl} */
|
|
114
|
+
readonly manUrl?: string;
|
|
111
115
|
/** a preview of the function's parameters (the ones a parameter/required filter matched first), when such a filter is active */
|
|
112
116
|
readonly parameters?: readonly string[];
|
|
113
117
|
/** the subset of {@link parameters} that the `--param` filter actually matched, so the renderer can highlight them */
|
|
@@ -34,7 +34,7 @@ function signatureQueryLineParser(output, line, _config) {
|
|
|
34
34
|
positional.push(tok);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
// help only when it is the leading word or an explicit flag
|
|
37
|
+
// help only when it is the leading word or an explicit flag, never for a package/function literally named `help`
|
|
38
38
|
if (positional[0] === 'help' || line.includes('--help') || line.includes('-h')) {
|
|
39
39
|
(0, signature_query_render_1.printSignatureHelp)(output);
|
|
40
40
|
return { query: [] };
|
|
@@ -70,8 +70,12 @@ function pushFunction(result, f, fn) {
|
|
|
70
70
|
const loc = `${fn.file}${fn.line !== undefined ? `:${fn.line}` : ''}`;
|
|
71
71
|
result.push(` ╰ ${(0, ansi_1.italic)('source', f)} ${fn.sourceUrl ? `${loc} ${f.hyperlink(fn.sourceUrl, fn.sourceUrl)}` : loc}`);
|
|
72
72
|
}
|
|
73
|
-
if (fn.docUrl) {
|
|
74
|
-
|
|
73
|
+
if (fn.docUrl || fn.manUrl) {
|
|
74
|
+
const links = [
|
|
75
|
+
...(fn.docUrl ? [f.hyperlink('rdrr.io', fn.docUrl)] : []),
|
|
76
|
+
...(fn.manUrl ? [f.hyperlink(fn.version ? `man v${fn.version}` : 'man', fn.manUrl)] : [])
|
|
77
|
+
];
|
|
78
|
+
result.push(` ╰ ${(0, ansi_1.italic)('docs', f)} ${links.join(' ')}`);
|
|
75
79
|
}
|
|
76
80
|
if (fn.s3method) {
|
|
77
81
|
result.push(` ╰ ${(0, ansi_1.italic)('S3 method of', f)} ${(0, ansi_1.color)(`${fn.s3method.package}::${fn.s3method.generic}`, 5 /* Colors.Magenta */, f)} ${(0, ansi_1.italic)(`(class ${fn.s3method.class})`, f)}`);
|
|
@@ -154,7 +158,8 @@ function pushMatches(result, f, out) {
|
|
|
154
158
|
? `${(0, ansi_1.italic)('(', f)}${m.parameters.map(p => matched.has(p) ? (0, ansi_1.color)(p, 3 /* Colors.Yellow */, f, { style: 1 /* FontStyles.Bold */ }) : (0, ansi_1.italic)(p, f)).join((0, ansi_1.italic)(', ', f))}${(0, ansi_1.italic)(')', f)}`
|
|
155
159
|
: '';
|
|
156
160
|
const loc = m.file ? ` ${linkLocation(m.file, m.line, m.sourceUrl, f)}` : '';
|
|
157
|
-
|
|
161
|
+
// one link on a search hit: the version-exact help page when there is one, else the rdrr.io page
|
|
162
|
+
const doc = m.manUrl ? ` ${f.hyperlink('man', m.manUrl)}` : (m.docUrl ? ` ${f.hyperlink('docs', m.docUrl)}` : '');
|
|
158
163
|
result.push(` ╰ ${(0, ansi_1.color)(m.package, 6 /* Colors.Cyan */, f)}::${(0, ansi_1.bold)(m.name, f)}${params}${m.version ? (0, ansi_1.italic)(` v${m.version}`, f) : ''}${loc}${doc}`);
|
|
159
164
|
}
|
|
160
165
|
}
|
|
@@ -102,7 +102,7 @@ function prepareParsedData(data) {
|
|
|
102
102
|
json = JSON.parse(`[${jsonSafeRParseData(data.trim())}]`);
|
|
103
103
|
}
|
|
104
104
|
catch (e) {
|
|
105
|
-
throw new Error(`Failed to parse data [${data}]: ${e?.message}
|
|
105
|
+
throw new Error(`Failed to parse data [${data}]: ${e?.message}`, { cause: e });
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
(0, assert_1.guard)(Array.isArray(json), () => `Expected ${data} to be an array but was not`);
|
package/r-bridge/retriever.d.ts
CHANGED
|
@@ -59,14 +59,16 @@ function flowrSearchToCode(search) {
|
|
|
59
59
|
function flowrTransformerToCode(node) {
|
|
60
60
|
if (node.name === 'filter') {
|
|
61
61
|
const a = node.args.filter;
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
if (typeof a === 'string') {
|
|
63
|
+
if (vertex_1.ValidVertexTypes.has(a)) {
|
|
64
|
+
return `${node.name}(VertexType.${vertex_1.ValidVertexTypeReverse[a]})`;
|
|
65
|
+
}
|
|
66
|
+
else if (type_1.ValidRTypes.has(a)) {
|
|
67
|
+
return `${node.name}(RType.${type_1.ValidRTypesReverse[a]})`;
|
|
68
|
+
}
|
|
69
|
+
else if (flowr_search_filters_1.ValidFlowrFilters.has(a)) {
|
|
70
|
+
return `${node.name}(FlowrFilter.${flowr_search_filters_1.ValidFlowrFiltersReverse[a]})`;
|
|
71
|
+
}
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
74
|
return `${node.name}(${argsToCodeString(node.args)})`;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SliceResult } from './slicer-types';
|
|
2
|
-
import {
|
|
2
|
+
import type { Fingerprint } from './fingerprint';
|
|
3
3
|
import { VisitingQueue } from './visiting-queue';
|
|
4
4
|
import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
|
-
import {
|
|
5
|
+
import type { REnvironmentInformation } from '../../dataflow/environments/environment';
|
|
6
6
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import type { DataflowInformation } from '../../dataflow/info';
|
|
8
8
|
import type { DataflowGraph } from '../../dataflow/graph/graph';
|
package/util/objects.js
CHANGED
|
@@ -87,7 +87,7 @@ function deepMergeObjectInPlace(base, addon) {
|
|
|
87
87
|
}
|
|
88
88
|
else if (baseIsArray && addonIsArray) {
|
|
89
89
|
for (const item of addon) {
|
|
90
|
-
base.push(item);
|
|
90
|
+
(base).push(item);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
@@ -175,9 +175,11 @@ function looselyCompareObjects(obj, expected, arrayMatch, logger) {
|
|
|
175
175
|
return false;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
else if (expectedValue instanceof RegExp) {
|
|
179
|
+
// for anything else, we match with our regular expression or string
|
|
180
|
+
// (arrays and objects are handled above, so only primitives reach this point)
|
|
181
|
+
const realPrimitive = realValue;
|
|
182
|
+
if (!expectedValue.test(typeof realPrimitive === 'string' ? realPrimitive : String(realPrimitive))) {
|
|
181
183
|
(0, log_1.expensiveTrace)(logger, () => `Value ${JSON.stringify(realValue)} does not match expected regular expression ${expectedValue}`);
|
|
182
184
|
return false;
|
|
183
185
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** the base packages R attaches to the search path on startup, so their exports are usable without a `library` call */
|
|
2
|
+
export declare const AttachedBasePackages: readonly string[];
|
|
1
3
|
/**
|
|
2
4
|
* The base packages available at the assumed R version (all of them if omitted). A package counts as
|
|
3
5
|
* available when that R release lies within the range it was part of core; e.g. `parallel` (added in R
|
package/util/r-base-packages.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttachedBasePackages = void 0;
|
|
3
4
|
exports.baseRPackages = baseRPackages;
|
|
4
5
|
exports.baseRExportOwner = baseRExportOwner;
|
|
5
6
|
exports.isBaseRPackage = isBaseRPackage;
|
|
6
7
|
const r_base_packages_generated_1 = require("../data/r-base-packages.generated");
|
|
7
8
|
const r_base_primitives_generated_1 = require("../data/r-base-primitives.generated");
|
|
8
9
|
const r_version_1 = require("./r-version");
|
|
10
|
+
/** the base packages R attaches to the search path on startup, so their exports are usable without a `library` call */
|
|
11
|
+
exports.AttachedBasePackages = ['base', 'stats', 'graphics', 'grDevices', 'utils', 'datasets', 'methods'];
|
|
9
12
|
/** clamp `rVersion` to the newest R release the store knows about (so a future R version stays answerable) */
|
|
10
13
|
function effective(rVersion) {
|
|
11
14
|
return r_version_1.RVersion.compare(rVersion, r_base_packages_generated_1.RBasePackageStore.newestRVersion) > 0 ? r_base_packages_generated_1.RBasePackageStore.newestRVersion : rVersion;
|
package/util/r-license.js
CHANGED
|
@@ -66,15 +66,12 @@ function skipWhitespace({ remInput, position }) {
|
|
|
66
66
|
function consumeLicenseName(info) {
|
|
67
67
|
info = skipWhitespace(info);
|
|
68
68
|
let licenseName = '';
|
|
69
|
-
let isAtWhitespace = false;
|
|
70
69
|
for (let i = 0; i < info.remInput.length; i++) {
|
|
71
70
|
const char = info.remInput[i];
|
|
72
71
|
if (/[()<>~!=,&|+]/.test(char)) {
|
|
73
72
|
break;
|
|
74
73
|
}
|
|
75
|
-
|
|
76
|
-
isAtWhitespace = /\s/.test(char);
|
|
77
|
-
}
|
|
74
|
+
const isAtWhitespace = /\s/.test(char);
|
|
78
75
|
if (isAtWhitespace) {
|
|
79
76
|
if (/^\s*(with|and|or)\s+/i.test(info.remInput.slice(i))) {
|
|
80
77
|
break;
|
package/util/r-version.d.ts
CHANGED
|
@@ -54,4 +54,16 @@ export declare const RRange: {
|
|
|
54
54
|
* (never throws), so a malformed version/constraint simply does not match.
|
|
55
55
|
*/
|
|
56
56
|
readonly satisfies: (this: void, version: string, range: Range | string) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The range every one of `ranges` allows (semver reads a space-separated list as a conjunction). `undefined` if
|
|
59
|
+
* none were given or the combination is unparseable; it may still be a range no version satisfies, which
|
|
60
|
+
* {@link RVersion.parse|minVersion} reports.
|
|
61
|
+
*/
|
|
62
|
+
readonly intersect: (this: void, ranges: readonly Range[]) => (Range & {
|
|
63
|
+
str: string;
|
|
64
|
+
}) | undefined;
|
|
65
|
+
/** how a set of alternative requirements reads, in semver's `a || b` form (for reporting, not for parsing back) */
|
|
66
|
+
readonly formatAlternatives: (this: void, ranges: readonly Range[]) => string;
|
|
67
|
+
/** whether `version` satisfies at least one of `ranges` (an empty list constrains nothing, so it does) */
|
|
68
|
+
readonly satisfiesAny: (this: void, version: string, ranges: readonly Range[]) => boolean;
|
|
57
69
|
};
|
package/util/r-version.js
CHANGED
|
@@ -190,6 +190,22 @@ exports.RRange = {
|
|
|
190
190
|
}
|
|
191
191
|
const r = typeof range === 'string' ? exports.RRange.parse(range) : range;
|
|
192
192
|
return r !== undefined && (0, semver_1.satisfies)(v, r, { loose: true, includePrerelease: true });
|
|
193
|
+
},
|
|
194
|
+
/**
|
|
195
|
+
* The range every one of `ranges` allows (semver reads a space-separated list as a conjunction). `undefined` if
|
|
196
|
+
* none were given or the combination is unparseable; it may still be a range no version satisfies, which
|
|
197
|
+
* {@link RVersion.parse|minVersion} reports.
|
|
198
|
+
*/
|
|
199
|
+
intersect(ranges) {
|
|
200
|
+
return ranges.length > 0 ? exports.RRange.parse(ranges.map(r => r.raw).join(' ')) : undefined;
|
|
201
|
+
},
|
|
202
|
+
/** how a set of alternative requirements reads, in semver's `a || b` form (for reporting, not for parsing back) */
|
|
203
|
+
formatAlternatives(ranges) {
|
|
204
|
+
return ranges.map(r => r.raw).join(' || ');
|
|
205
|
+
},
|
|
206
|
+
/** whether `version` satisfies at least one of `ranges` (an empty list constrains nothing, so it does) */
|
|
207
|
+
satisfiesAny(version, ranges) {
|
|
208
|
+
return ranges.length === 0 || ranges.some(r => exports.RRange.satisfies(version, r));
|
|
193
209
|
}
|
|
194
210
|
};
|
|
195
211
|
//# sourceMappingURL=r-version.js.map
|
package/util/range.d.ts
CHANGED
|
@@ -93,7 +93,7 @@ export declare const SourceRange: {
|
|
|
93
93
|
readonly invalid: (this: void) => SourceRange;
|
|
94
94
|
/**
|
|
95
95
|
* Merges multiple source ranges into a single source range that spans from the earliest start to the latest end.
|
|
96
|
-
* If you are interested in
|
|
96
|
+
* If you are interested in reducing a set of ranges to those none of the others contains, see {@link combineRanges}.
|
|
97
97
|
* @throws if no ranges are provided
|
|
98
98
|
*/
|
|
99
99
|
readonly merge: (this: void, rs: (SourceRange | undefined)[]) => SourceRange;
|
|
@@ -131,7 +131,8 @@ export declare const SourceRange: {
|
|
|
131
131
|
*/
|
|
132
132
|
readonly isStrictSubsetOf: (this: void, r1: SourceRange, r2: SourceRange) => boolean;
|
|
133
133
|
/**
|
|
134
|
-
*
|
|
134
|
+
* Reduces the ranges to those no other one contains, keeping the first of any duplicates. Ranges that merely
|
|
135
|
+
* overlap are both kept, as neither contains the other. A non-empty input always yields a non-empty result.
|
|
135
136
|
* @see {@link SourceRange.merge} for merging multiple ranges into a single range.
|
|
136
137
|
*/
|
|
137
138
|
readonly combineRanges: (this: void, ...ranges: SourceRange[]) => SourceRange[];
|
|
@@ -147,6 +148,9 @@ export declare const SourceRange: {
|
|
|
147
148
|
* Nodes may share a range (a function call and the symbol naming it do), so `treatChildAsInner` decides that
|
|
148
149
|
* tie: with it, a node sharing its parent's range counts as the inner one and the parent drops out; without
|
|
149
150
|
* it, both are kept and the caller may pick between them (e.g. by node type).
|
|
151
|
+
*
|
|
152
|
+
* A non-empty input always yields a non-empty result: enclosure is a strict order so some node is always minimal,
|
|
153
|
+
* and a node carrying no range at all is kept rather than dropped.
|
|
150
154
|
* @see {@link SourceRange.nodesContaining} which this usually narrows down
|
|
151
155
|
*/
|
|
152
156
|
readonly innermostNodes: <OtherInfo>(this: void, nodes: readonly RNodeWithParent<OtherInfo>[], treatChildAsInner?: boolean) => RNodeWithParent<OtherInfo>[];
|
package/util/range.js
CHANGED
|
@@ -109,7 +109,7 @@ exports.SourceRange = {
|
|
|
109
109
|
},
|
|
110
110
|
/**
|
|
111
111
|
* Merges multiple source ranges into a single source range that spans from the earliest start to the latest end.
|
|
112
|
-
* If you are interested in
|
|
112
|
+
* If you are interested in reducing a set of ranges to those none of the others contains, see {@link combineRanges}.
|
|
113
113
|
* @throws if no ranges are provided
|
|
114
114
|
*/
|
|
115
115
|
merge(rs) {
|
|
@@ -187,11 +187,13 @@ exports.SourceRange = {
|
|
|
187
187
|
return exports.SourceRange.isSubsetOf(r1, r2) && !exports.SourceRange.equals(r1, r2);
|
|
188
188
|
},
|
|
189
189
|
/**
|
|
190
|
-
*
|
|
190
|
+
* Reduces the ranges to those no other one contains, keeping the first of any duplicates. Ranges that merely
|
|
191
|
+
* overlap are both kept, as neither contains the other. A non-empty input always yields a non-empty result.
|
|
191
192
|
* @see {@link SourceRange.merge} for merging multiple ranges into a single range.
|
|
192
193
|
*/
|
|
193
194
|
combineRanges(...ranges) {
|
|
194
|
-
return ranges.filter(range => !ranges.some(other =>
|
|
195
|
+
return ranges.filter((range, i) => !ranges.some((other, j) => i !== j
|
|
196
|
+
&& (exports.SourceRange.isStrictSubsetOf(range, other) || (j < i && exports.SourceRange.equals(range, other)))));
|
|
195
197
|
},
|
|
196
198
|
fromNode(node) {
|
|
197
199
|
return node?.info.fullRange ?? node?.location;
|
|
@@ -215,25 +217,41 @@ exports.SourceRange = {
|
|
|
215
217
|
* Nodes may share a range (a function call and the symbol naming it do), so `treatChildAsInner` decides that
|
|
216
218
|
* tie: with it, a node sharing its parent's range counts as the inner one and the parent drops out; without
|
|
217
219
|
* it, both are kept and the caller may pick between them (e.g. by node type).
|
|
220
|
+
*
|
|
221
|
+
* A non-empty input always yields a non-empty result: enclosure is a strict order so some node is always minimal,
|
|
222
|
+
* and a node carrying no range at all is kept rather than dropped.
|
|
218
223
|
* @see {@link SourceRange.nodesContaining} which this usually narrows down
|
|
219
224
|
*/
|
|
220
225
|
innermostNodes(nodes, treatChildAsInner = true) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
return nodes.filter(node => {
|
|
226
|
+
const result = [];
|
|
227
|
+
for (const node of nodes) {
|
|
225
228
|
const range = exports.SourceRange.fromNode(node);
|
|
226
|
-
|
|
229
|
+
if (!range) {
|
|
230
|
+
result.push(node);
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
let inner = false;
|
|
234
|
+
for (const other of nodes) {
|
|
227
235
|
if (other === node) {
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
else if (treatChildAsInner && other.info.parent === node.info.id) {
|
|
231
|
-
return true;
|
|
236
|
+
continue;
|
|
232
237
|
}
|
|
233
238
|
const otherRange = exports.SourceRange.fromNode(other);
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
239
|
+
if (!otherRange) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if (exports.SourceRange.isStrictSubsetOf(otherRange, range) ||
|
|
243
|
+
(treatChildAsInner &&
|
|
244
|
+
other.info.parent === node.info.id &&
|
|
245
|
+
exports.SourceRange.equals(otherRange, range))) {
|
|
246
|
+
inner = true;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (!inner) {
|
|
251
|
+
result.push(node);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return result.length > 0 ? result : nodes.slice();
|
|
237
255
|
}
|
|
238
256
|
};
|
|
239
257
|
/**
|
package/util/version.js
CHANGED
|
@@ -42,7 +42,7 @@ const assert_1 = require("./assert");
|
|
|
42
42
|
const sigdb_download_1 = require("../project/sigdb/sigdb-download");
|
|
43
43
|
const doc_files_1 = require("../documentation/doc-util/doc-files");
|
|
44
44
|
// this is automatically replaced with the current version by release-it
|
|
45
|
-
const version = '2.13.
|
|
45
|
+
const version = '2.13.3';
|
|
46
46
|
// this is automatically replaced with the release date by release-it (regex-bumper, see package.json)
|
|
47
47
|
const versionDate = '2026-07-15T07:13:44Z';
|
|
48
48
|
/**
|