@eagleoutice/flowr 2.17.3 → 2.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +9 -9
  2. package/cli/repl/commands/repl-signature.d.ts +1 -1
  3. package/cli/repl/completion.d.ts +23 -0
  4. package/cli/repl/completion.js +9 -0
  5. package/cli/repl/core.d.ts +0 -23
  6. package/cli/repl/core.js +0 -5
  7. package/cli/repl/parser/slice-query-parser.d.ts +1 -1
  8. package/cli/repl/parser/slice-query-parser.js +3 -3
  9. package/dataflow/environments/built-in-props.d.ts +8 -1
  10. package/dataflow/environments/built-in-props.js +9 -1
  11. package/dataflow/environments/built-in.d.ts +5 -3
  12. package/dataflow/environments/built-in.js +5 -4
  13. package/dataflow/environments/default-builtin-config.d.ts +21 -3
  14. package/dataflow/environments/default-builtin-config.js +49 -47
  15. package/dataflow/eval/resolve/resolve-argument.js +11 -6
  16. package/dataflow/eval/resolve/resolve-numbers.d.ts +1 -178
  17. package/dataflow/eval/resolve/resolve-numbers.js +2 -13
  18. package/dataflow/eval/resolve/resolve-strings.d.ts +1 -93
  19. package/dataflow/eval/resolve/resolve-strings.js +2 -17
  20. package/dataflow/eval/resolve/resolve-working-directory.js +3 -4
  21. package/dataflow/extractor.js +44 -26
  22. package/dataflow/graph/df-helper.d.ts +2 -1
  23. package/dataflow/graph/df-helper.js +2 -1
  24. package/dataflow/internal/linker.js +2 -1
  25. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +8 -0
  26. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +44 -7
  27. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +3 -2
  28. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +2 -1
  29. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +0 -9
  30. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +11 -21
  31. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +3 -3
  32. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +2 -1
  33. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +13 -3
  34. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -5
  35. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +1 -24
  36. package/dataflow/internal/process/functions/call/known-call-handling.js +8 -34
  37. package/dataflow/internal/process/functions/call/nse-kind.d.ts +24 -0
  38. package/dataflow/internal/process/functions/call/nse-kind.js +30 -0
  39. package/documentation/wiki-query.js +3 -2
  40. package/linter/rules/absolute-path.js +5 -5
  41. package/linter/rules/cmd-check/dependency-declaration.js +2 -2
  42. package/linter/rules/cmd-check/package-runtime.js +2 -2
  43. package/linter/rules/deprecated-functions.js +2 -2
  44. package/linter/rules/file-path-validity.js +5 -5
  45. package/linter/rules/function-finder-util.js +2 -2
  46. package/linter/rules/overwritten-file.js +2 -4
  47. package/linter/rules/secret-exfiltration.d.ts +3 -2
  48. package/linter/rules/secret-exfiltration.js +8 -3
  49. package/linter/rules/unused-import.js +20 -6
  50. package/package.json +1 -1
  51. package/project/cache/flowr-analyzer-controlflow-cache.d.ts +0 -6
  52. package/project/cache/flowr-analyzer-controlflow-cache.js +7 -27
  53. package/project/context/flowr-analyzer-context.d.ts +2 -2
  54. package/project/context/flowr-analyzer-context.js +2 -2
  55. package/project/context/flowr-analyzer-files-context.d.ts +8 -0
  56. package/project/context/flowr-analyzer-files-context.js +51 -6
  57. package/project/flowr-analyzer.d.ts +0 -9
  58. package/project/flowr-analyzer.js +7 -28
  59. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +0 -3
  60. package/project/plugins/file-plugins/files/flowr-namespace-file.js +57 -163
  61. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -3
  62. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +2 -3
  63. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -3
  64. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
  65. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -2
  66. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +0 -1
  67. package/project/plugins/package-version-plugins/package.js +1 -1
  68. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -3
  69. package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
  70. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  71. package/queries/catalog/config-query/config-query-format.js +4 -4
  72. package/queries/catalog/dependencies-query/dependencies-query-executor.js +6 -5
  73. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -4
  74. package/queries/catalog/dependencies-query/dependencies-query-format.js +11 -11
  75. package/queries/catalog/dependencies-query/dependency-values.d.ts +9 -0
  76. package/queries/catalog/dependencies-query/dependency-values.js +13 -0
  77. package/queries/catalog/dependencies-query/function-info/remote-functions.js +2 -2
  78. package/queries/catalog/dependencies-query/function-info/write-functions.js +8 -7
  79. package/queries/catalog/dependencies-query/implicit-echo.js +2 -1
  80. package/queries/catalog/dependencies-query/plot-description.d.ts +1 -1
  81. package/queries/catalog/dependencies-query/plot-description.js +2 -2
  82. package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
  83. package/queries/catalog/files-query/files-query-format.d.ts +1 -1
  84. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -2
  85. package/queries/catalog/linter-query/linter-query-format.js +13 -9
  86. package/queries/catalog/signature-query/signature-query-executor.d.ts +1 -1
  87. package/queries/catalog/taint-query/taint-query-format.d.ts +1 -1
  88. package/queries/query-function-filter.d.ts +1 -1
  89. package/queries/query.d.ts +2 -2
  90. package/r-bridge/init.js +1 -1
  91. package/search/flowr-search-filters.js +2 -2
  92. package/search/search-executor/search-generators.d.ts +0 -1
  93. package/search/search-executor/search-generators.js +5 -6
  94. package/search/search-logger.d.ts +1 -0
  95. package/search/search-logger.js +6 -0
  96. package/util/flowr-version.d.ts +1 -1
  97. package/util/flowr-version.js +2 -2
@@ -5,14 +5,11 @@ import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-conte
5
5
  import type { ParentInformation } from '../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
6
6
  export interface NamespaceInfo {
7
7
  exportedSymbols: string[];
8
- exportedFunctions: string[];
9
8
  /**
10
9
  * Names listed by `exportMethods()`: S4 methods the package registered for one of its classes, which is a
11
10
  * different claim than an ordinary export (the package answers a generic, it does not define the function).
12
11
  * As R's `loadNamespace`, this keeps only the non-primitive generics: a method on a primitive such as `+` or `[`
13
12
  * binds nothing in the namespace, so `pkg::"+"` does not exist and the call stays with base.
14
- * Only the context-parsed path ({@link parseNamespaceComplex}) tells these apart; the regex fallback folds
15
- * them into {@link exportedFunctions}.
16
13
  */
17
14
  exportedS4Methods: string[];
18
15
  /** Classes listed by `exportClasses()`: the S4 classes the package owns. Separated like {@link exportedS4Methods}. */
@@ -13,7 +13,6 @@ const flowr_file_1 = require("../../../context/flowr-file");
13
13
  const resolve_args_1 = require("../../../../abstract-interpretation/data-frame/resolve-args");
14
14
  const fold_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/fold");
15
15
  const identifier_1 = require("../../../../dataflow/environments/identifier");
16
- const assert_1 = require("../../../../util/assert");
17
16
  const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
18
17
  const r_primitives_generated_1 = require("../../../../data/r-primitives.generated");
19
18
  const make_argument_1 = require("../../../../dataflow/internal/process/functions/call/argument/make-argument");
@@ -21,7 +20,6 @@ const range_1 = require("../../../../util/range");
21
20
  const r_regex_1 = require("../../../../util/r-regex");
22
21
  const r_argument_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
23
22
  const arrays_1 = require("../../../../util/collections/arrays");
24
- const r_function_call_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
25
23
  /**
26
24
  * Decorates a text file to expose its content as a {@link NamespaceFormat}.
27
25
  * Simple parsing is quicker but does not support `if`/other R constructs.
@@ -96,8 +94,7 @@ function importOrigin(name, nsInfo) {
96
94
  }
97
95
  /** As {@link isExportedInNamespaceFormat}, but for one already picked {@link NamespaceInfo}. */
98
96
  function isExportedInInfo(name, nsInfo) {
99
- if (nsInfo.exportedSymbols.includes(name) || nsInfo.exportedFunctions.includes(name)
100
- || nsInfo.exportedS4Methods.includes(name) || nsInfo.exportedS4Classes.includes(name)) {
97
+ if (nsInfo.exportedSymbols.includes(name) || nsInfo.exportedS4Methods.includes(name) || nsInfo.exportedS4Classes.includes(name)) {
101
98
  return true;
102
99
  }
103
100
  if (name.includes('.')) {
@@ -180,27 +177,10 @@ function parseNamespaceComplex(file, ctx) {
180
177
  }
181
178
  const name = identifier_1.Identifier.getName(call.functionName.content);
182
179
  const g = expr ?? getEmptyNamespaceFormat();
183
- switch (name) {
184
- case 'export':
185
- return handleExportCall(g, call.arguments);
186
- case 'exportPattern':
187
- return handleExportPatternCall(g, call.arguments);
188
- case 'S3method':
189
- return handleS3MethodCall(g, call.arguments);
190
- case 'import':
191
- return handleImportCall(g, call.arguments);
192
- case 'importFrom':
193
- case 'importClassesFrom':
194
- case 'importMethodsFrom':
195
- return handleImportFromCall(g, call.arguments);
196
- case 'useDynLib':
197
- return handleUseDynLibCall(g, call.arguments);
198
- case 'exportClasses':
199
- return handleS4ExportCall(g, call.arguments, 'exportedS4Classes');
200
- case 'exportMethods':
201
- return handleS4ExportCall(g, call.arguments, 'exportedS4Methods');
202
- }
203
- return g;
180
+ return applyDirective(g, name, call.arguments.flatMap(a => {
181
+ const value = r_argument_1.RArgument.isEmpty(a) ? undefined : a.name === undefined ? a.lexeme : a.value?.lexeme;
182
+ return value === undefined || r_argument_1.RArgument.isEmpty(a) ? [] : [{ name: a.name === undefined ? undefined : identifier_1.Identifier.getName(a.name.content), value }];
183
+ }));
204
184
  }
205
185
  }
206
186
  });
@@ -213,7 +193,7 @@ function getExportedNames(info) {
213
193
  s3.push(`${g}.${m}`);
214
194
  }
215
195
  }
216
- return (0, arrays_1.uniqueArray)([...info.exportedSymbols, ...info.exportedFunctions, ...info.exportedS4Methods,
196
+ return (0, arrays_1.uniqueArray)([...info.exportedSymbols, ...info.exportedS4Methods,
217
197
  ...info.exportedS4Classes, ...info.exportedPatterns, ...s3]);
218
198
  }
219
199
  /** The names a package makes callable: the explicitly configured {@link NamespaceInfo#callable} subset, or all exports (see {@link getExportedNames}) by default. */
@@ -257,10 +237,6 @@ function wrapRNodeInNotCall(node, idMap) {
257
237
  arguments: [(0, make_argument_1.toUnnamedArgument)(node, idMap)]
258
238
  };
259
239
  }
260
- /** Unquotes every lexeme of `args` (dropping empty/nameless arguments) and pushes the result onto `target`. */
261
- function pushUnquotedLexemes(target, args, unquote) {
262
- target.push(...args.filter(a => a !== r_function_call_1.EmptyArgument).map(a => a.lexeme ? unquote(a.lexeme) : undefined).filter(assert_1.isNotUndefined));
263
- }
264
240
  /** The array stored for `key` in a `string[]`-valued map, creating and registering an empty one if there is none yet. */
265
241
  function arrayAt(map, key) {
266
242
  const arr = map.get(key) ?? [];
@@ -281,88 +257,59 @@ function importArrayAt(map, key) {
281
257
  function markSideEffectLoader(fmt, pkg) {
282
258
  (fmt[pkg] ??= emptyNamespaceInfo()).loadsWithSideEffects = true;
283
259
  }
284
- function handleExportCall(g, args) {
285
- pushUnquotedLexemes(g.current.exportedSymbols, args, r_string_1.RString.unquote);
286
- return g;
287
- }
288
- function handleExportPatternCall(g, args) {
289
- pushUnquotedLexemes(g.current.exportedPatterns, args, resolve_args_1.unquoteArgument);
290
- return g;
291
- }
292
- function handleS3MethodCall(g, args) {
293
- /* `S3method(generic, class)` and `S3method(generic, class, method)` both register the class */
294
- if (args.length !== 2 && args.length !== 3) {
295
- return g;
296
- }
297
- const pkgArg = args[0];
298
- const funcArg = args[1];
299
- if (r_argument_1.RArgument.isEmpty(pkgArg) || r_argument_1.RArgument.isEmpty(funcArg) || !pkgArg.lexeme || !funcArg.lexeme) {
300
- return g;
301
- }
302
- const generic = r_string_1.RString.unquote(pkgArg.lexeme);
303
- const cls = r_string_1.RString.unquote(funcArg.lexeme);
304
- arrayAt(g.current.exportS3Generics, generic).push(cls);
305
- const fun = args[2];
306
- if (fun !== undefined && !r_argument_1.RArgument.isEmpty(fun) && fun.lexeme) {
307
- (g.current.s3MethodFunctions ??= new Map()).set(`${generic}.${cls}`, r_string_1.RString.unquote(fun.lexeme));
260
+ function importFrom(g, [pkg, ...symbols]) {
261
+ if (pkg !== undefined && symbols.length > 0) {
262
+ importArrayAt(g.current.importedPackages, r_string_1.RString.unquote(pkg)).push(...symbols.map(r_string_1.RString.unquote));
308
263
  }
309
- return g;
310
264
  }
311
- function handleImportCall(g, args) {
312
- /* `import(a, b)` imports both; a named argument like `except =` names no package */
313
- for (const arg of args) {
314
- if (arg !== r_function_call_1.EmptyArgument && arg.name === undefined && arg.lexeme) {
315
- g.current.importedPackages?.set(r_string_1.RString.unquote(arg.lexeme), 'all');
265
+ /** What each NAMESPACE directive adds, shared by the AST-based and the plain-text parser so that both read a NAMESPACE alike. */
266
+ const NamespaceDirectives = new Map(Object.entries({
267
+ export: (g, args) => g.current.exportedSymbols.push(...args.map(r_string_1.RString.unquote)),
268
+ exportPattern: (g, args) => g.current.exportedPatterns.push(...args.map(a => (0, resolve_args_1.unquoteArgument)(a))),
269
+ exportClasses: (g, args) => g.current.exportedS4Classes.push(...args.map(r_string_1.RString.unquote)),
270
+ /* as for R, a method on a primitive generic binds nothing in the namespace */
271
+ exportMethods: (g, args) => g.current.exportedS4Methods.push(...args.map(r_string_1.RString.unquote).filter(n => !r_primitives_generated_1.RPrimitives.has(n))),
272
+ /* `S3method(generic, class)` and `S3method(generic, class, method)` both register the class */
273
+ S3method: (g, args) => {
274
+ if (args.length !== 2 && args.length !== 3) {
275
+ return;
316
276
  }
317
- }
318
- return g;
319
- }
320
- function handleImportFromCall(g, args) {
321
- if (args.length < 2) {
322
- return g;
323
- }
324
- const pkgArg = args[0];
325
- if (r_argument_1.RArgument.isEmpty(pkgArg) || !pkgArg.lexeme) {
326
- return g;
327
- }
328
- const arr = importArrayAt(g.current.importedPackages, r_string_1.RString.unquote(pkgArg.lexeme));
329
- for (let i = 1; i < args.length; i++) {
330
- const symArg = args[i];
331
- if (r_argument_1.RArgument.isEmpty(symArg) || !symArg.lexeme) {
332
- continue;
277
+ const [generic, cls, fun] = args.map(r_string_1.RString.unquote);
278
+ arrayAt(g.current.exportS3Generics, generic).push(cls);
279
+ if (fun !== undefined) {
280
+ (g.current.s3MethodFunctions ??= new Map()).set(`${generic}.${cls}`, fun);
281
+ }
282
+ },
283
+ import: (g, args) => {
284
+ for (const pkg of args) {
285
+ g.current.importedPackages.set(r_string_1.RString.unquote(pkg), 'all');
286
+ }
287
+ },
288
+ importFrom,
289
+ importClassesFrom: importFrom,
290
+ importMethodsFrom: importFrom,
291
+ useDynLib: (g, [pkg]) => {
292
+ if (pkg !== undefined) {
293
+ markSideEffectLoader(g, r_string_1.RString.unquote(pkg));
333
294
  }
334
- arr.push(r_string_1.RString.unquote(symArg.lexeme));
335
- }
336
- return g;
337
- }
338
- function handleUseDynLibCall(g, args) {
339
- if (args.length < 1) {
340
- return g;
341
- }
342
- const pkgArg = args[0];
343
- if (r_argument_1.RArgument.isEmpty(pkgArg) || !pkgArg.lexeme) {
344
- return g;
345
295
  }
346
- markSideEffectLoader(g, r_string_1.RString.unquote(pkgArg.lexeme));
296
+ }));
297
+ /** As R's `parseNamespaceFile`, these options are read by name, every other argument by its position. */
298
+ const DirectiveOptions = new Map([
299
+ ['import', new Set(['except'])],
300
+ ['useDynLib', new Set(['.registration', '.fixes'])]
301
+ ]);
302
+ /** Applies the directive `name` (if it is one) with its `args` to `g`. */
303
+ function applyDirective(g, name, args) {
304
+ const options = DirectiveOptions.get(name);
305
+ NamespaceDirectives.get(name)?.(g, args.filter(a => a.name === undefined || !options?.has(a.name)).map(a => a.value));
347
306
  return g;
348
307
  }
349
- /** `exportClasses(A, B)` / `exportMethods(show, summary)`: a directive may list several names, and each goes to `into`. */
350
- function handleS4ExportCall(g, args, into) {
351
- const names = [];
352
- pushUnquotedLexemes(names, args, r_string_1.RString.unquote);
353
- g.current[into].push(...(into === 'exportedS4Methods' ? exportedGenerics(names) : names));
354
- return g;
355
- }
356
- /** The `exportMethods()` names R exports: methods on a primitive generic bind nothing in the namespace. */
357
- function exportedGenerics(names) {
358
- return names.filter(n => !r_primitives_generated_1.RPrimitives.has(n));
359
- }
360
308
  const cleanLineCommentRegex = /^#.*$/gm;
361
309
  /** A namespace that neither exports nor imports anything yet. */
362
310
  function emptyNamespaceInfo() {
363
311
  return {
364
312
  exportedSymbols: [],
365
- exportedFunctions: [],
366
313
  exportedS4Methods: [],
367
314
  exportedS4Classes: [],
368
315
  exportS3Generics: new Map(),
@@ -437,23 +384,22 @@ function mergeNamespaceInfo(target, source) {
437
384
  ? new Map([...target.s3MethodFunctions ?? [], ...source.s3MethodFunctions ?? []]) : undefined;
438
385
  return {
439
386
  ...(s3MethodFunctions ? { s3MethodFunctions } : {}),
387
+ ...(mergedConditional.size > 0 ? { conditional: mergedConditional } : {}),
440
388
  callable: [...target.callable, ...source.callable],
441
389
  exportedSymbols: [...target.exportedSymbols, ...source.exportedSymbols],
442
- exportedFunctions: [...target.exportedFunctions, ...source.exportedFunctions],
443
390
  exportedS4Methods: [...target.exportedS4Methods, ...source.exportedS4Methods],
444
391
  exportedS4Classes: [...target.exportedS4Classes, ...source.exportedS4Classes],
445
392
  exportS3Generics: mergedS3Generics,
446
393
  exportedPatterns: [...target.exportedPatterns, ...source.exportedPatterns],
447
394
  importedPackages: mergedImportedPackages,
448
- loadsWithSideEffects: target.loadsWithSideEffects || source.loadsWithSideEffects,
449
- conditional: mergedConditional.size > 0 ? mergedConditional : undefined,
395
+ loadsWithSideEffects: target.loadsWithSideEffects || source.loadsWithSideEffects
450
396
  };
451
397
  }
452
- /** an argument given by name (`except = c(x)`), which names no symbol of its own */
453
- const namedArgument = /^[\w.]+\s*=[^=]/;
398
+ /** an argument given by name (`except = c(x)`) */
399
+ const namedArgument = /^([\w.]+)\s*=(?!=)\s*(.*)$/s;
454
400
  /**
455
- * Split a NAMESPACE directive's argument list (`a, "b", except = c(x)`) into its positional, quote-stripped
456
- * names. Only top-level commas separate, so an argument that is itself a call stays in one piece.
401
+ * Split a NAMESPACE directive's argument list (`a, "b", except = c(x)`) into its
402
+ * arguments as written. Only top-level commas separate, so an argument that is itself a call stays in one piece.
457
403
  */
458
404
  function splitNamespaceArgs(args) {
459
405
  const names = [];
@@ -482,8 +428,9 @@ function splitNamespaceArgs(args) {
482
428
  else if (i === args.length || (c === ',' && depth === 0)) {
483
429
  const part = args.slice(start, i).trim();
484
430
  start = i + 1;
485
- if (part.length > 0 && !namedArgument.test(part)) {
486
- names.push(r_string_1.RString.unquote(part));
431
+ const named = namedArgument.exec(part);
432
+ if (part.length > 0) {
433
+ names.push(named === null ? { value: part } : { name: named[1], value: named[2] });
487
434
  }
488
435
  }
489
436
  }
@@ -502,60 +449,7 @@ function parseNamespaceSimple(file) {
502
449
  continue;
503
450
  }
504
451
  const [, type, args] = match;
505
- switch (type) {
506
- case 'exportClasses':
507
- case 'exportMethods':
508
- // a single directive may list several symbols, e.g. `exportMethods(show, summary)`
509
- result.current.exportedFunctions.push(...exportedGenerics(splitNamespaceArgs(args)));
510
- break;
511
- case 'S3method':
512
- {
513
- const parts = splitNamespaceArgs(args);
514
- if (parts.length !== 2 && parts.length !== 3) {
515
- continue;
516
- }
517
- const [pkg, func, fun] = parts;
518
- arrayAt(result.current.exportS3Generics, pkg).push(func);
519
- if (fun !== undefined) {
520
- (result.current.s3MethodFunctions ??= new Map()).set(`${pkg}.${func}`, fun);
521
- }
522
- break;
523
- }
524
- case 'export':
525
- // `export(a, b)` exports both `a` and `b`, so split rather than storing the literal `"a, b"`
526
- result.current.exportedSymbols.push(...splitNamespaceArgs(args));
527
- break;
528
- case 'useDynLib':
529
- {
530
- const parts = args.split(',').map(s => s.trim());
531
- if (parts.length !== 2) {
532
- continue;
533
- }
534
- markSideEffectLoader(result, parts[0]);
535
- break;
536
- }
537
- case 'import': {
538
- for (const pkg of splitNamespaceArgs(args)) {
539
- result.current.importedPackages?.set(pkg, 'all');
540
- }
541
- break;
542
- }
543
- case 'importFrom':
544
- case 'importClassesFrom':
545
- case 'importMethodsFrom': {
546
- const parts = splitNamespaceArgs(args);
547
- if (parts.length < 2) {
548
- continue;
549
- }
550
- const [pkg, ...symbols] = parts;
551
- importArrayAt(result.current.importedPackages, pkg).push(...symbols);
552
- break;
553
- }
554
- case 'exportPattern': {
555
- result.current.exportedPatterns?.push((0, resolve_args_1.unquoteArgument)(args.trim()));
556
- break;
557
- }
558
- }
452
+ applyDirective(result, type, splitNamespaceArgs(args));
559
453
  }
560
454
  return result;
561
455
  }
@@ -3,7 +3,6 @@ import type { PathLike } from 'fs';
3
3
  import type { FlowrFileProvider } from '../../context/flowr-file';
4
4
  import { FileRole } from '../../context/flowr-file';
5
5
  import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
6
- import { platformBasename, platformDirname } from '../../../dataflow/internal/process/functions/call/built-in/built-in-source';
7
6
  /**
8
7
  * This is the base class for all plugins that load and possibly transform files when they are loaded.
9
8
  * Different from other plugins, these plugins trigger for each file that is loaded (if they {@link applies} to the file).
@@ -28,9 +27,9 @@ export declare abstract class FlowrAnalyzerFilePlugin extends FlowrAnalyzerPlugi
28
27
  /** Which part of a path a {@link FlowrAnalyzerPatternFilePlugin} matches its pattern against. */
29
28
  export declare const PathPart: {
30
29
  /** The file name including its extension. */
31
- readonly Basename: typeof platformBasename;
30
+ readonly Basename: (this: void, p: string) => string;
32
31
  /** The directory portion of the path. */
33
- readonly Dirname: typeof platformDirname;
32
+ readonly Dirname: (this: void, p: string) => string;
34
33
  /** The whole path, for patterns that need both the folder and the file name. */
35
34
  readonly Full: (p: string) => string;
36
35
  };
@@ -5,7 +5,6 @@ const flowr_analyzer_plugin_1 = require("../flowr-analyzer-plugin");
5
5
  const flowr_file_1 = require("../../context/flowr-file");
6
6
  const semver_1 = require("semver");
7
7
  const files_1 = require("../../../util/files");
8
- const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
9
8
  /**
10
9
  * This is the base class for all plugins that load and possibly transform files when they are loaded.
11
10
  * Different from other plugins, these plugins trigger for each file that is loaded (if they {@link applies} to the file).
@@ -45,9 +44,9 @@ class DefaultFlowrAnalyzerFilePlugin extends FlowrAnalyzerFilePlugin {
45
44
  /** Which part of a path a {@link FlowrAnalyzerPatternFilePlugin} matches its pattern against. */
46
45
  exports.PathPart = {
47
46
  /** The file name including its extension. */
48
- Basename: built_in_source_1.platformBasename,
47
+ Basename: files_1.RPath.basename,
49
48
  /** The directory portion of the path. */
50
- Dirname: built_in_source_1.platformDirname,
49
+ Dirname: files_1.RPath.dirname,
51
50
  /** The whole path, for patterns that need both the folder and the file name. */
52
51
  Full: (p) => p
53
52
  };
@@ -4,7 +4,7 @@ exports.FlowrAnalyzerRprofileFilePlugin = exports.RenvironFilePattern = exports.
4
4
  const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
5
5
  const semver_1 = require("semver");
6
6
  const flowr_file_1 = require("../../context/flowr-file");
7
- const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
7
+ const files_1 = require("../../../util/files");
8
8
  /** `Rprofile.site` is the site-wide, `.Rprofile` the user/project profile. */
9
9
  exports.RprofileFilePattern = /^(\.Rprofile|Rprofile\.site)$/i;
10
10
  /** `.Renviron` is the user/project environment file, `Renviron.site` the site-wide one. */
@@ -25,10 +25,10 @@ class FlowrAnalyzerRprofileFilePlugin extends flowr_analyzer_file_plugin_1.Flowr
25
25
  this.environPattern = environPattern;
26
26
  }
27
27
  applies(file) {
28
- return super.applies(file) || this.environPattern.test((0, built_in_source_1.platformBasename)(file.toString()));
28
+ return super.applies(file) || this.environPattern.test(files_1.RPath.basename(file.toString()));
29
29
  }
30
30
  process(_ctx, file) {
31
- if (this.environPattern.test((0, built_in_source_1.platformBasename)(file.path()))) {
31
+ if (this.environPattern.test(files_1.RPath.basename(file.path()))) {
32
32
  file.assignRole(flowr_file_1.FileRole.Environment);
33
33
  }
34
34
  else {
@@ -6,7 +6,7 @@ const flowr_analyzer_package_versions_plugin_1 = require("./flowr-analyzer-packa
6
6
  const semver_1 = require("semver");
7
7
  const package_1 = require("./package");
8
8
  const flowr_file_1 = require("../../context/flowr-file");
9
- const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
9
+ const files_1 = require("../../../util/files");
10
10
  const log_1 = require("../../../util/log");
11
11
  const smol_toml_1 = require("smol-toml");
12
12
  const flowr_analyzer_meta_context_1 = require("../../context/flowr-analyzer-meta-context");
@@ -15,7 +15,7 @@ exports.lockfileLog = log_1.log.getSubLogger({ name: 'flowr-analyzer-package-ver
15
15
  /** The {@link FileRole.VirtualEnv} lockfiles named `name` (e.g. `renv.lock`), matched case-insensitively like the role is assigned. */
16
16
  function virtualEnvFiles(ctx, name) {
17
17
  return ctx.files.getFilesByRole(flowr_file_1.FileRole.VirtualEnv).filter(f => {
18
- const base = (0, built_in_source_1.platformBasename)(f.path());
18
+ const base = files_1.RPath.basename(f.path());
19
19
  return typeof name === 'string' ? base.toLowerCase() === name : name.test(base);
20
20
  });
21
21
  }
@@ -28,10 +28,9 @@ class FlowrAnalyzerPackageVersionsNamespaceFilePlugin extends flowr_analyzer_pac
28
28
  name: pkg,
29
29
  namespaceInfo: info
30
30
  }));
31
- /* the S4 lists are exports as much as the other two, they just say *why* the name is exported */
31
+ /* the S4 lists are exports as much as the plain one, they just say *why* the name is exported */
32
32
  const exportKinds = [
33
33
  [info.exportedSymbols, {}],
34
- [info.exportedFunctions, {}],
35
34
  [info.exportedS4Methods, { isS4Method: true }],
36
35
  [info.exportedS4Classes, { isS4Class: true }]
37
36
  ];
@@ -499,7 +499,6 @@ function packageFromExports(name, info, stated) {
499
499
  const exported = (0, arrays_1.uniqueArray)([...info.exported, ...reexports?.keys() ?? [], ...[...stated ?? []].map(String)]);
500
500
  const namespaceInfo = {
501
501
  exportedSymbols: exported,
502
- exportedFunctions: [],
503
502
  exportedS4Methods: [],
504
503
  /* the database derives these from the very `exportClasses()` directives the field stands for */
505
504
  exportedS4Classes: info.s4Classes.slice(),
@@ -70,7 +70,7 @@ class Package {
70
70
  }
71
71
  // a directly exported symbol/function - this also covers dotted plain exports such as
72
72
  // `solve.QP`, `as.Date` or `read.csv` that are not S3 methods
73
- if (this.namespaceInfo.exportedFunctions.includes(name) || this.namespaceInfo.exportedSymbols.includes(name)
73
+ if (this.namespaceInfo.exportedSymbols.includes(name)
74
74
  || this.namespaceInfo.exportedS4Methods.includes(name) || this.namespaceInfo.exportedS4Classes.includes(name)) {
75
75
  return true;
76
76
  }
@@ -9,7 +9,6 @@ const flowr_analyzer_plugin_1 = require("../flowr-analyzer-plugin");
9
9
  const semver_1 = require("semver");
10
10
  const flowr_file_1 = require("../../context/flowr-file");
11
11
  const files_1 = require("../../../util/files");
12
- const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
13
12
  const fs_1 = __importDefault(require("fs"));
14
13
  const path_1 = __importDefault(require("path"));
15
14
  const classify_project_kind_1 = require("../../context/classify-project-kind");
@@ -47,9 +46,9 @@ function collectRequests(files, root, opts = {}) {
47
46
  const requests = [];
48
47
  for (const file of files) {
49
48
  const relativePath = path_1.default.relative(root, file);
50
- if (supportedExtensions.test(relativePath) && (!onlyTraversePaths || onlyTraversePaths.test(relativePath)) && !excludePathsRegex.test((0, built_in_source_1.platformDirname)(relativePath))) {
49
+ if (supportedExtensions.test(relativePath) && (!onlyTraversePaths || onlyTraversePaths.test(relativePath)) && !excludePathsRegex.test(files_1.RPath.dirname(relativePath))) {
51
50
  requests.push({ content: file, request: 'file' });
52
- if (flowr_analyzer_rprofile_file_plugin_1.RprofileFilePattern.test((0, built_in_source_1.platformBasename)(relativePath))) {
51
+ if (flowr_analyzer_rprofile_file_plugin_1.RprofileFilePattern.test(files_1.RPath.basename(relativePath))) {
53
52
  // parse requests skip the file plugins, so emit a file too to have the profile tagged
54
53
  requests.push(new flowr_file_1.FlowrTextFile(file));
55
54
  }
@@ -4,7 +4,7 @@ import { DataFrameShapeAnalysis } from '../../../abstract-interpretation/data-fr
4
4
  import type { MultiValueDomain, MultiValueStateDomain } from '../../../abstract-interpretation/domains/multi-value-state-domain';
5
5
  import type { StateDomain } from '../../../abstract-interpretation/domains/state-domain';
6
6
  import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
7
- import type { CommandCompletions } from '../../../cli/repl/core';
7
+ import type { CommandCompletions } from '../../../cli/repl/completion';
8
8
  import type { FlowrConfig } from '../../../config';
9
9
  import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
10
10
  import { SlicingCriterion, type SlicingCriteria } from '../../../slicing/criterion/parse';
@@ -6,7 +6,7 @@ import { FlowrConfig } from '../../../config';
6
6
  import type { DeepPartial } from 'ts-essentials';
7
7
  import type { ParsedQueryLine, Query } from '../../query';
8
8
  import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
9
- import { type CommandCompletions } from '../../../cli/repl/core';
9
+ import { type CommandCompletions } from '../../../cli/repl/completion';
10
10
  import type { ProjectKind } from '../../../project/context/project-kind';
11
11
  export interface ConfigQuery extends BaseQueryFormat {
12
12
  readonly type: 'config';
@@ -11,7 +11,7 @@ const ansi_1 = require("../../../util/text/ansi");
11
11
  const joi_1 = __importDefault(require("joi"));
12
12
  const config_1 = require("../../../config");
13
13
  const json_1 = require("../../../util/json");
14
- const core_1 = require("../../../cli/repl/core");
14
+ const completion_1 = require("../../../cli/repl/completion");
15
15
  const schema_1 = require("../../../util/schema");
16
16
  const strings_1 = require("../../../util/text/strings");
17
17
  function configReplCompleter(partialLine, startingNewArg, _config) {
@@ -25,7 +25,7 @@ function configReplCompleter(partialLine, startingNewArg, _config) {
25
25
  const sigil = update ? '+' : '';
26
26
  // on the empty token also offer `+` (writes a value) before the inspectable keys (which read); label it like the keys
27
27
  const lead = token.length === 0 ? ['+'] : [];
28
- const leadLabels = token.length === 0 ? [['+', (0, core_1.describeCompletion)('+', 'change config values')]] : [];
28
+ const leadLabels = token.length === 0 ? [['+', (0, completion_1.describeCompletion)('+', 'change config values')]] : [];
29
29
  // once `+key=` is typed, complete the value (its type), not more keys
30
30
  if (update && raw.includes('=')) {
31
31
  const eq = raw.indexOf('=');
@@ -44,7 +44,7 @@ function configReplCompleter(partialLine, startingNewArg, _config) {
44
44
  if (!update && raw.includes('*')) {
45
45
  const matches = configGlobMatcher(raw.endsWith('*') ? raw : `${raw}*`);
46
46
  const found = sortConfigPaths(configPaths().filter(matches)).map(p => p.join('.'));
47
- return { completions: found, labels: new Map(found.map(p => [p, (0, core_1.describeCompletion)(p, configSchemaInfo(p.split('.')).type ?? '')])), preFiltered: true };
47
+ return { completions: found, labels: new Map(found.map(p => [p, (0, completion_1.describeCompletion)(p, configSchemaInfo(p.split('.')).type ?? '')])), preFiltered: true };
48
48
  }
49
49
  const path = raw.split('.').filter(p => p.length > 0);
50
50
  const fullPath = path.slice();
@@ -57,7 +57,7 @@ function configReplCompleter(partialLine, startingNewArg, _config) {
57
57
  const have = offered.map(k => `${sigil}${[...path, k].join('.')}`);
58
58
  if (have.length > 0) {
59
59
  // label starts with the full completion (incl. sigil) so readline keeps the sigil on common-prefix insertion
60
- return { completions: [...lead, ...have], labels: new Map([...leadLabels, ...have.map((c, i) => [c, offered[i] === 'reset' && path.length === 0 ? (0, core_1.describeCompletion)(c, 'discard runtime config updates') : (0, core_1.describeCompletion)(c, configSchemaInfo([...path, offered[i]]).type ?? '')])]) };
60
+ return { completions: [...lead, ...have], labels: new Map([...leadLabels, ...have.map((c, i) => [c, offered[i] === 'reset' && path.length === 0 ? (0, completion_1.describeCompletion)(c, 'discard runtime config updates') : (0, completion_1.describeCompletion)(c, configSchemaInfo([...path, offered[i]]).type ?? '')])]) };
61
61
  }
62
62
  else if (lastPath.length > 0 && configSchemaKeys(fullPath).length > 0) {
63
63
  return { completions: [`${sigil}${fullPath.join('.')}.`] };
@@ -5,6 +5,7 @@ const query_1 = require("../../query");
5
5
  const slice_direction_1 = require("../../../util/slice-direction");
6
6
  const parse_1 = require("../../../slicing/criterion/parse");
7
7
  const dependencies_query_format_1 = require("./dependencies-query-format");
8
+ const dependency_values_1 = require("./dependency-values");
8
9
  const vertex_1 = require("../../../dataflow/graph/vertex");
9
10
  const identifier_1 = require("../../../dataflow/environments/identifier");
10
11
  const df_helper_1 = require("../../../dataflow/graph/df-helper");
@@ -94,7 +95,7 @@ async function executeDependenciesQuery({ analyzer, }, queries) {
94
95
  }
95
96
  }
96
97
  if (query.assumedPackages && (enabled === undefined || enabled.includes('library'))) {
97
- const explicit = new Set((results.library ?? []).map(r => r.value).filter((v) => v !== undefined && v !== dependencies_query_format_1.Unknown && v !== dependencies_query_format_1.Constant));
98
+ const explicit = new Set((results.library ?? []).map(r => r.value).filter((v) => v !== undefined && v !== dependency_values_1.Unknown && v !== dependency_values_1.Constant));
98
99
  const assumed = assumedBasePackageEntries(dataflow.graph, ctx.resolvedRVersion, explicit);
99
100
  if (assumed.length > 0) {
100
101
  results.library = [...(results.library ?? []), ...assumed];
@@ -124,7 +125,7 @@ const NotPassedOnByCalls = new Set(['library', 'source', 'remote']);
124
125
  */
125
126
  function callSitesOf(found, graph, ast, revalue) {
126
127
  /* a call already found doing this needs no entry for it, but two writes of one file in one body both pass on to the call */
127
- const named = (value) => value !== undefined && value !== dependencies_query_format_1.Unknown && value !== dependencies_query_format_1.Constant && value !== 'stdout' && value !== 'stderr';
128
+ const named = (value) => value !== undefined && value !== dependency_values_1.Unknown && value !== dependency_values_1.Constant && !dependency_values_1.ConsoleStreams.has(value);
128
129
  const key = (id, value, root) => `${String(id)}\0${value ?? ''}\0${named(value) ? String(root) : ''}`;
129
130
  const known = new Set(found.map(f => key(f.nodeId, f.value)));
130
131
  const byNode = Map.groupBy(found.filter(f => f.nodeId !== undefined), f => f.nodeId);
@@ -337,7 +338,7 @@ function getResults(categories, run, results, kind, functions, data, attaching =
337
338
  lexemeOfArgument: undefined,
338
339
  linkedIds: linked?.length ? linked : undefined,
339
340
  ...flow,
340
- value: passesInline ? dependencies_query_format_1.Constant : info.defaultValue ?? defaultValue
341
+ value: passesInline ? dependency_values_1.Constant : info.defaultValue ?? defaultValue
341
342
  }));
342
343
  }
343
344
  continue;
@@ -386,7 +387,7 @@ function getResults(categories, run, results, kind, functions, data, attaching =
386
387
  }
387
388
  return finalResults;
388
389
  function unresolvedArgumentCode(argument, id) {
389
- if ((argument && argument !== dependencies_query_format_1.Unknown && argument !== dependencies_query_format_1.Constant) || !id) {
390
+ if ((argument && argument !== dependency_values_1.Unknown && argument !== dependency_values_1.Constant) || !id) {
390
391
  return undefined;
391
392
  }
392
393
  return model_1.RNode.lexeme(r_argument_1.RArgument.valueOf(normalize.idMap.get(id)));
@@ -396,7 +397,7 @@ function collectValuesFromLinks(args, data, linkedIds, callContext) {
396
397
  if (!linkedIds || linkedIds.length === 0) {
397
398
  return undefined;
398
399
  }
399
- 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);
400
+ const hasAtLeastAValue = args !== undefined && args.values().flatMap(x => Array.from(x)).toArray().some(v => v !== dependency_values_1.Unknown && v !== dependency_values_1.Constant && v !== undefined);
400
401
  const map = new Map();
401
402
  for (const linkedId of linkedIds) {
402
403
  if (typeof linkedId !== 'object' || !linkedId.info) {
@@ -12,10 +12,7 @@ import type { AsyncOrSync, MarkOptional } from 'ts-essentials';
12
12
  import type { NamespaceInfo } from '../../../project/plugins/file-plugins/files/flowr-namespace-file';
13
13
  import { Identifier } from '../../../dataflow/environments/identifier';
14
14
  import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
15
- /** The value could not be resolved, e.g. a path assembled at runtime. Such a dependency may be missing or fetchable. */
16
- export declare const Unknown = "unknown";
17
- /** The value resolved, but to data given inline rather than to a path (`matrix(0, 2, 2)`, `data.frame(a = 1)`). */
18
- export declare const Constant = "constant";
15
+ export { Constant, Unknown } from './dependency-values';
19
16
  /** {@link DependencyInfo#functionName} for an assumed base package: nothing in the code names it, so there is no call to report as `functionName`. */
20
17
  export declare const Attached = "<attached>";
21
18
  export interface DependencyCategorySettings {