@eagleoutice/flowr 2.13.8 → 2.13.10

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 (152) hide show
  1. package/config.d.ts +50 -2
  2. package/config.js +37 -6
  3. package/dataflow/cluster.js +48 -24
  4. package/dataflow/environments/apply-kill.js +4 -4
  5. package/dataflow/environments/built-in-props.d.ts +28 -4
  6. package/dataflow/environments/built-in-props.js +31 -8
  7. package/dataflow/environments/built-in.d.ts +7 -2
  8. package/dataflow/environments/built-in.js +10 -12
  9. package/dataflow/environments/default-builtin-config.d.ts +76 -6
  10. package/dataflow/environments/default-builtin-config.js +39 -16
  11. package/dataflow/environments/environment.d.ts +16 -0
  12. package/dataflow/environments/environment.js +70 -18
  13. package/dataflow/environments/identifier.d.ts +6 -0
  14. package/dataflow/environments/identifier.js +18 -5
  15. package/dataflow/environments/query-fn-props.js +34 -2
  16. package/dataflow/environments/reference-to-maybe.js +1 -1
  17. package/dataflow/eval/resolve/alias-tracking.js +45 -1
  18. package/dataflow/eval/resolve/resolve-argument.js +25 -17
  19. package/dataflow/eval/resolve/resolve-strings.d.ts +17 -0
  20. package/dataflow/eval/resolve/resolve-strings.js +16 -9
  21. package/dataflow/eval/resolve/resolve.js +3 -1
  22. package/dataflow/graph/call-graph.d.ts +7 -0
  23. package/dataflow/graph/call-graph.js +103 -0
  24. package/dataflow/graph/df-helper.d.ts +2 -0
  25. package/dataflow/graph/graph.d.ts +6 -8
  26. package/dataflow/graph/graph.js +21 -6
  27. package/dataflow/internal/linker.d.ts +5 -5
  28. package/dataflow/internal/linker.js +31 -92
  29. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  30. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +3 -9
  31. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +4 -30
  32. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
  33. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
  34. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -1
  35. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
  36. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
  37. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +5 -1
  38. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +2 -2
  39. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -6
  40. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +32 -14
  41. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +16 -4
  42. package/dataflow/internal/process/functions/call/known-call-handling.js +29 -8
  43. package/documentation/doc-util/doc-sigdb.d.ts +9 -0
  44. package/documentation/doc-util/doc-sigdb.js +32 -0
  45. package/documentation/wiki-interface.js +13 -2
  46. package/documentation/wiki-query.js +3 -0
  47. package/documentation/wiki-signature-database.js +2 -5
  48. package/gas.d.ts +6 -0
  49. package/gas.js +7 -1
  50. package/package.json +2 -2
  51. package/project/attached-packages.d.ts +13 -0
  52. package/project/attached-packages.js +30 -0
  53. package/project/context/flowr-analyzer-context.d.ts +15 -0
  54. package/project/context/flowr-analyzer-context.js +14 -3
  55. package/project/context/flowr-analyzer-files-context.d.ts +11 -0
  56. package/project/context/flowr-analyzer-files-context.js +3 -0
  57. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -0
  58. package/project/context/flowr-analyzer-incremental-analysis-context.js +69 -0
  59. package/project/dependency-version-space.d.ts +45 -8
  60. package/project/dependency-version-space.js +86 -26
  61. package/project/plugins/file-plugins/files/flowr-namespace-file.js +52 -24
  62. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.d.ts +22 -0
  63. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +101 -0
  64. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +30 -11
  65. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +79 -37
  66. package/project/plugins/package-version-plugins/package.d.ts +2 -0
  67. package/project/plugins/package-version-plugins/package.js +4 -0
  68. package/project/plugins/plugin-registry.d.ts +2 -1
  69. package/project/plugins/plugin-registry.js +2 -0
  70. package/project/sigdb/manifest.js +9 -5
  71. package/project/sigdb/signature-match.d.ts +5 -18
  72. package/project/sigdb/signature-match.js +5 -18
  73. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +4 -2
  74. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +25 -0
  75. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  76. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +4 -0
  77. package/queries/catalog/call-graph-query/call-graph-query-format.js +4 -0
  78. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +11 -1
  79. package/queries/catalog/dependencies-query/dependencies-query-executor.js +13 -5
  80. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +27 -1
  81. package/queries/catalog/dependencies-query/dependencies-query-format.js +69 -7
  82. package/queries/catalog/dependencies-query/function-info/library-functions.js +9 -2
  83. package/queries/catalog/dependencies-query/function-info/read-functions.js +31 -5
  84. package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +18 -0
  85. package/queries/catalog/dependencies-query/function-info/remote-functions.js +46 -0
  86. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  87. package/queries/catalog/dependencies-query/function-info/test-functions.js +33 -31
  88. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +52 -2
  89. package/queries/catalog/dependencies-query/function-info/write-functions.js +28 -5
  90. package/queries/catalog/dependencies-query/link-devices.d.ts +12 -0
  91. package/queries/catalog/dependencies-query/link-devices.js +58 -0
  92. package/queries/catalog/dice-query/dice-query-format.d.ts +2 -0
  93. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +25 -6
  94. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +38 -7
  95. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +18 -5
  96. package/queries/catalog/happens-before-query/happens-before-query-format.js +3 -2
  97. package/queries/catalog/input-sources-query/input-sources-query-format.js +4 -0
  98. package/queries/catalog/input-sources-query/input-types.d.ts +10 -0
  99. package/queries/catalog/input-sources-query/input-types.js +10 -0
  100. package/queries/catalog/location-map-query/location-map-query-executor.js +16 -6
  101. package/queries/catalog/location-map-query/location-map-query-format.d.ts +15 -1
  102. package/queries/catalog/location-map-query/location-map-query-format.js +22 -5
  103. package/queries/catalog/signature-query/signature-query-executor.js +3 -0
  104. package/queries/catalog/signature-query/signature-query-format.d.ts +5 -0
  105. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  106. package/queries/query.d.ts +1 -1
  107. package/r-bridge/data/data.d.ts +1 -1
  108. package/r-bridge/data/data.js +1 -1
  109. package/r-bridge/lang-4.x/ast/model/model.d.ts +14 -2
  110. package/r-bridge/lang-4.x/ast/model/model.js +32 -0
  111. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
  112. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -0
  113. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
  114. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
  115. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
  116. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
  117. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
  118. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +7 -8
  119. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +9 -46
  120. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
  121. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
  122. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
  123. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
  124. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
  125. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
  126. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
  127. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
  128. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
  129. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +2 -0
  130. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
  131. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
  132. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
  133. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +0 -5
  134. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +6 -3
  135. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
  136. package/search/flowr-search-filters.d.ts +17 -1
  137. package/search/flowr-search-filters.js +23 -0
  138. package/slicing/criterion/parse.d.ts +6 -25
  139. package/slicing/criterion/parse.js +50 -19
  140. package/slicing/static/fingerprint.d.ts +1 -1
  141. package/slicing/static/fingerprint.js +52 -8
  142. package/slicing/static/slicer-types.d.ts +10 -0
  143. package/slicing/static/static-slicer.d.ts +1 -1
  144. package/slicing/static/static-slicer.js +29 -6
  145. package/slicing/static/visiting-queue.d.ts +15 -3
  146. package/slicing/static/visiting-queue.js +37 -3
  147. package/util/arg-matching.d.ts +18 -0
  148. package/util/arg-matching.js +70 -0
  149. package/util/r-regex.js +19 -1
  150. package/util/range.d.ts +7 -8
  151. package/util/range.js +10 -11
  152. package/util/version.js +1 -1
@@ -9,6 +9,7 @@ exports.setCallable = setCallable;
9
9
  const flowr_file_1 = require("../../../context/flowr-file");
10
10
  const resolve_args_1 = require("../../../../abstract-interpretation/data-frame/resolve-args");
11
11
  const retriever_1 = require("../../../../r-bridge/retriever");
12
+ const strings_1 = require("../../../../util/text/strings");
12
13
  const fold_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/fold");
13
14
  const identifier_1 = require("../../../../dataflow/environments/identifier");
14
15
  const assert_1 = require("../../../../util/assert");
@@ -244,8 +245,12 @@ function wrapRNodeInNotCall(node, idMap) {
244
245
  arguments: [(0, make_argument_1.toUnnamedArgument)(node, idMap)]
245
246
  };
246
247
  }
248
+ /** the name a NAMESPACE directive lists, without the quotes or backticks R allows around it */
249
+ function unquoteName(name) {
250
+ return (0, strings_1.startAndEndsWith)(name, '`') ? name.slice(1, -1) : (0, retriever_1.removeRQuotes)(name);
251
+ }
247
252
  function handleExportCall(g, args) {
248
- g.current.exportedSymbols.push(...args.filter(a => a !== r_function_call_1.EmptyArgument).map(a => a.lexeme ? (0, retriever_1.removeRQuotes)(a.lexeme) : undefined).filter(assert_1.isNotUndefined));
253
+ g.current.exportedSymbols.push(...args.filter(a => a !== r_function_call_1.EmptyArgument).map(a => a.lexeme ? unquoteName(a.lexeme) : undefined).filter(assert_1.isNotUndefined));
249
254
  return g;
250
255
  }
251
256
  function handleExportPatternCall(g, args) {
@@ -253,7 +258,8 @@ function handleExportPatternCall(g, args) {
253
258
  return g;
254
259
  }
255
260
  function handleS3MethodCall(g, args) {
256
- if (args.length !== 2) {
261
+ /* `S3method(generic, class)` and `S3method(generic, class, method)` both register the class */
262
+ if (args.length !== 2 && args.length !== 3) {
257
263
  return g;
258
264
  }
259
265
  const pkgArg = args[0];
@@ -261,8 +267,8 @@ function handleS3MethodCall(g, args) {
261
267
  if (pkgArg === r_function_call_1.EmptyArgument || funcArg === r_function_call_1.EmptyArgument || !pkgArg.lexeme || !funcArg.lexeme) {
262
268
  return g;
263
269
  }
264
- const pkg = (0, retriever_1.removeRQuotes)(pkgArg.lexeme);
265
- const func = (0, retriever_1.removeRQuotes)(funcArg.lexeme);
270
+ const pkg = unquoteName(pkgArg.lexeme);
271
+ const func = unquoteName(funcArg.lexeme);
266
272
  let arr = g.current.exportS3Generics.get(pkg);
267
273
  if (!arr) {
268
274
  arr = [];
@@ -272,15 +278,12 @@ function handleS3MethodCall(g, args) {
272
278
  return g;
273
279
  }
274
280
  function handleImportCall(g, args) {
275
- if (args.length !== 1) {
276
- return g;
277
- }
278
- const pkgArg = args[0];
279
- if (pkgArg === r_function_call_1.EmptyArgument || !pkgArg.lexeme) {
280
- return g;
281
+ /* `import(a, b)` imports both; a named argument like `except =` names no package */
282
+ for (const arg of args) {
283
+ if (arg !== r_function_call_1.EmptyArgument && arg.name === undefined && arg.lexeme) {
284
+ g.current.importedPackages?.set(unquoteName(arg.lexeme), 'all');
285
+ }
281
286
  }
282
- const pkg = (0, retriever_1.removeRQuotes)(pkgArg.lexeme);
283
- g.current.importedPackages?.set(pkg, 'all');
284
287
  return g;
285
288
  }
286
289
  function handleImportFromCall(g, args) {
@@ -291,7 +294,7 @@ function handleImportFromCall(g, args) {
291
294
  if (pkgArg === r_function_call_1.EmptyArgument || !pkgArg.lexeme) {
292
295
  return g;
293
296
  }
294
- const pkg = (0, retriever_1.removeRQuotes)(pkgArg.lexeme);
297
+ const pkg = unquoteName(pkgArg.lexeme);
295
298
  let arr = g.current.importedPackages?.get(pkg);
296
299
  if (!arr || arr === 'all') {
297
300
  arr = [];
@@ -302,7 +305,7 @@ function handleImportFromCall(g, args) {
302
305
  if (symArg === r_function_call_1.EmptyArgument || !symArg.lexeme) {
303
306
  continue;
304
307
  }
305
- const sym = (0, retriever_1.removeRQuotes)(symArg.lexeme);
308
+ const sym = unquoteName(symArg.lexeme);
306
309
  arr.push(sym);
307
310
  }
308
311
  return g;
@@ -315,7 +318,7 @@ function handleUseDynLibCall(g, args) {
315
318
  if (pkgArg === r_function_call_1.EmptyArgument || !pkgArg.lexeme) {
316
319
  return g;
317
320
  }
318
- const pkg = (0, retriever_1.removeRQuotes)(pkgArg.lexeme);
321
+ const pkg = unquoteName(pkgArg.lexeme);
319
322
  if (!g[pkg]) {
320
323
  g[pkg] = {
321
324
  exportedSymbols: [],
@@ -334,7 +337,7 @@ function handleExportClassesCall(g, args) {
334
337
  if (args.length !== 1) {
335
338
  return g;
336
339
  }
337
- const classArgs = args.filter(a => a !== r_function_call_1.EmptyArgument).map(a => a.lexeme ? (0, retriever_1.removeRQuotes)(a.lexeme) : undefined).filter(assert_1.isNotUndefined);
340
+ const classArgs = args.filter(a => a !== r_function_call_1.EmptyArgument).map(a => a.lexeme ? unquoteName(a.lexeme) : undefined).filter(assert_1.isNotUndefined);
338
341
  g.current.exportedFunctions.push(...classArgs);
339
342
  return g;
340
343
  }
@@ -421,9 +424,33 @@ function mergeNamespaceInfo(target, source) {
421
424
  conditional: mergedConditional.size > 0 ? mergedConditional : undefined,
422
425
  };
423
426
  }
424
- /** Split a NAMESPACE directive's argument list (`a, "b", c`) into individual, quote-stripped names. */
427
+ /** an argument given by name (`except = c(x)`), which names no symbol of its own */
428
+ const namedArgument = /^[\w.]+\s*=[^=]/;
429
+ /**
430
+ * Split a NAMESPACE directive's argument list (`a, "b", except = c(x)`) into its positional, quote-stripped
431
+ * names. Only top-level commas separate, so an argument that is itself a call stays in one piece.
432
+ */
425
433
  function splitNamespaceArgs(args) {
426
- return args.split(',').map(s => (0, retriever_1.removeRQuotes)(s.trim())).filter(s => s.length > 0);
434
+ const names = [];
435
+ let depth = 0;
436
+ let start = 0;
437
+ for (let i = 0; i <= args.length; i++) {
438
+ const c = args[i];
439
+ if (c === '(' || c === '[') {
440
+ depth++;
441
+ }
442
+ else if (c === ')' || c === ']') {
443
+ depth--;
444
+ }
445
+ else if (i === args.length || (c === ',' && depth === 0)) {
446
+ const part = args.slice(start, i).trim();
447
+ start = i + 1;
448
+ if (part.length > 0 && !namedArgument.test(part)) {
449
+ names.push(unquoteName(part));
450
+ }
451
+ }
452
+ }
453
+ return names;
427
454
  }
428
455
  /**
429
456
  * Parses the given NAMESPACE file
@@ -433,7 +460,7 @@ function parseNamespaceSimple(file) {
433
460
  const fileContent = file.content().toString().replaceAll(cleanLineCommentRegex, '').trim()
434
461
  .split(/\r?\n/).filter(Boolean);
435
462
  for (const line of fileContent) {
436
- const match = line.trim().match(/^(\w+)\(([^)]*)\)$/);
463
+ const match = line.trim().match(/^(\w+)\((.*)\)$/);
437
464
  if (!match) {
438
465
  continue;
439
466
  }
@@ -446,8 +473,8 @@ function parseNamespaceSimple(file) {
446
473
  break;
447
474
  case 'S3method':
448
475
  {
449
- const parts = args.split(',').map(s => (0, retriever_1.removeRQuotes)(s.trim()));
450
- if (parts.length !== 2) {
476
+ const parts = splitNamespaceArgs(args);
477
+ if (parts.length !== 2 && parts.length !== 3) {
451
478
  continue;
452
479
  }
453
480
  const [pkg, func] = parts;
@@ -485,14 +512,15 @@ function parseNamespaceSimple(file) {
485
512
  break;
486
513
  }
487
514
  case 'import': {
488
- const pkg = args.trim();
489
- result.current.importedPackages?.set(pkg, 'all');
515
+ for (const pkg of splitNamespaceArgs(args)) {
516
+ result.current.importedPackages?.set(pkg, 'all');
517
+ }
490
518
  break;
491
519
  }
492
520
  case 'importFrom':
493
521
  case 'importClassesFrom':
494
522
  case 'importMethodsFrom': {
495
- const parts = args.split(',').map(s => s.trim());
523
+ const parts = splitNamespaceArgs(args);
496
524
  if (parts.length < 2) {
497
525
  continue;
498
526
  }
@@ -0,0 +1,22 @@
1
+ import { FlowrAnalyzerPackageVersionsPlugin } from './flowr-analyzer-package-versions-plugin';
2
+ import { SemVer } from 'semver';
3
+ import type { FlowrAnalyzerContext } from '../../context/flowr-analyzer-context';
4
+ import type { FlowrConfig } from '../../../config';
5
+ export declare const libraryLog: import("tslog").Logger<import("tslog").ILogObj>;
6
+ /** How the fallback searches for an installed package, see `solver.sigdb.installedLibrary`. */
7
+ export type InstalledLibraryOptions = NonNullable<FlowrConfig['solver']['sigdb']['installedLibrary']>;
8
+ /**
9
+ * Fills in packages no signature database knows from the copy installed on this machine: a package that CRAN
10
+ * archived (`maptools`, `rgdal`, ...) is in no database, but if it is installed, its `NAMESPACE` states its
11
+ * exports just as well. Off unless `solver.sigdb.installedLibrary.enabled` says otherwise, and consulted only
12
+ * for a package nothing else could resolve, so it never overrides a database entry.
13
+ */
14
+ export declare class FlowrAnalyzerPackageVersionsLibraryPlugin extends FlowrAnalyzerPackageVersionsPlugin {
15
+ readonly name = "flowr-analyzer-package-version-library-plugin";
16
+ readonly description = "Recovers the exports of packages no database knows from their installed copy.";
17
+ readonly version: SemVer;
18
+ private readonly overrides?;
19
+ /** @param overrides - options replacing what `solver.sigdb.installedLibrary` states, `enabled` included */
20
+ constructor(overrides?: Partial<InstalledLibraryOptions>);
21
+ process(ctx: FlowrAnalyzerContext): void;
22
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FlowrAnalyzerPackageVersionsLibraryPlugin = exports.libraryLog = void 0;
7
+ const flowr_analyzer_package_versions_plugin_1 = require("./flowr-analyzer-package-versions-plugin");
8
+ const semver_1 = require("semver");
9
+ const package_1 = require("./package");
10
+ const flowr_file_1 = require("../../context/flowr-file");
11
+ const flowr_description_file_1 = require("../file-plugins/files/flowr-description-file");
12
+ const flowr_namespace_file_1 = require("../file-plugins/files/flowr-namespace-file");
13
+ const log_1 = require("../../../util/log");
14
+ const fs_1 = __importDefault(require("fs"));
15
+ const path_1 = __importDefault(require("path"));
16
+ exports.libraryLog = log_1.log.getSubLogger({ name: 'flowr-analyzer-package-versions-library-plugin' });
17
+ /** the directories below `root` that may hold a library, stopping at an installed package (it holds none) */
18
+ function libraryDirs(root, depth) {
19
+ if (depth <= 0 || !fs_1.default.existsSync(root)) {
20
+ return [];
21
+ }
22
+ return fs_1.default.readdirSync(root, { withFileTypes: true }).filter(e => e.isDirectory()).flatMap(e => {
23
+ const dir = path_1.default.join(root, e.name);
24
+ return fs_1.default.existsSync(path_1.default.join(dir, 'DESCRIPTION')) ? [] : [dir, ...libraryDirs(dir, depth - 1)];
25
+ });
26
+ }
27
+ /**
28
+ * The library directories to search: the ones configured, or else the ones R's environment names (which
29
+ * already are libraries) and a project-local `renv`/`packrat` one (which nests its library below a platform
30
+ * and an R version).
31
+ */
32
+ function libraryRoots(opts, projectRoot) {
33
+ if (opts.paths?.length) {
34
+ return opts.paths;
35
+ }
36
+ const fromEnv = opts.useEnvironment === false ? [] :
37
+ [process.env.R_LIBS_USER, process.env.R_LIBS, process.env.R_LIBS_SITE].flatMap(v => v?.split(path_1.default.delimiter) ?? []);
38
+ const local = opts.useProjectLibrary === false || projectRoot === undefined ? [] :
39
+ ['renv/library', 'renv/staging', 'packrat/lib'].map(d => path_1.default.join(projectRoot, d))
40
+ .flatMap(d => [d, ...libraryDirs(d, opts.maxDepth ?? 3)]);
41
+ return [...new Set([...fromEnv, ...local])].filter(d => d.length > 0);
42
+ }
43
+ /**
44
+ * The package installed under `name` in one of `roots`, read from its own `DESCRIPTION` and `NAMESPACE`.
45
+ * An installed package keeps both, so its exports are recoverable even when no signature database knows it.
46
+ */
47
+ function installedPackage(name, roots) {
48
+ for (const root of roots) {
49
+ const dir = path_1.default.join(root, name);
50
+ const description = path_1.default.join(dir, 'DESCRIPTION');
51
+ const namespace = path_1.default.join(dir, 'NAMESPACE');
52
+ if (!fs_1.default.existsSync(description) || !fs_1.default.existsSync(namespace)) {
53
+ continue;
54
+ }
55
+ try {
56
+ const version = new flowr_description_file_1.FlowrDescriptionFile(new flowr_file_1.FlowrTextFile(description)).version();
57
+ const namespaceInfo = flowr_namespace_file_1.FlowrNamespaceFile.from(new flowr_file_1.FlowrTextFile(namespace)).content().current;
58
+ exports.libraryLog.debug(`Recovered ${name}${version ? ` ${version.str}` : ''} from ${dir}`);
59
+ return new package_1.Package({ name, resolvedVersion: version?.str, namespaceInfo });
60
+ }
61
+ catch (e) {
62
+ exports.libraryLog.warn(`Could not read the installed ${name} in ${dir}`, e);
63
+ }
64
+ }
65
+ return undefined;
66
+ }
67
+ /**
68
+ * Fills in packages no signature database knows from the copy installed on this machine: a package that CRAN
69
+ * archived (`maptools`, `rgdal`, ...) is in no database, but if it is installed, its `NAMESPACE` states its
70
+ * exports just as well. Off unless `solver.sigdb.installedLibrary.enabled` says otherwise, and consulted only
71
+ * for a package nothing else could resolve, so it never overrides a database entry.
72
+ */
73
+ class FlowrAnalyzerPackageVersionsLibraryPlugin extends flowr_analyzer_package_versions_plugin_1.FlowrAnalyzerPackageVersionsPlugin {
74
+ name = 'flowr-analyzer-package-version-library-plugin';
75
+ description = 'Recovers the exports of packages no database knows from their installed copy.';
76
+ version = new semver_1.SemVer('0.1.0');
77
+ overrides;
78
+ /** @param overrides - options replacing what `solver.sigdb.installedLibrary` states, `enabled` included */
79
+ constructor(overrides) {
80
+ super();
81
+ this.overrides = overrides;
82
+ }
83
+ process(ctx) {
84
+ const opts = { ...ctx.config.solver.sigdb.installedLibrary, ...this.overrides };
85
+ if (!opts.enabled) {
86
+ return;
87
+ }
88
+ const only = opts.packages?.map(p => new RegExp(p)) ?? [];
89
+ /* walking the library directories is only worth it once something actually goes unresolved */
90
+ let roots;
91
+ ctx.deps.addLazyResolver((name, existing) => {
92
+ if (existing?.namespaceInfo !== undefined || (only.length > 0 && !only.some(p => p.test(name)))) {
93
+ return undefined;
94
+ }
95
+ roots ??= libraryRoots(opts, ctx.files.root());
96
+ return installedPackage(name, roots);
97
+ });
98
+ }
99
+ }
100
+ exports.FlowrAnalyzerPackageVersionsLibraryPlugin = FlowrAnalyzerPackageVersionsLibraryPlugin;
101
+ //# sourceMappingURL=flowr-analyzer-package-versions-library-plugin.js.map
@@ -13,6 +13,30 @@ export type SigDbSource = PackageSignatureSource | string;
13
13
  * dispatch: an export `generic.class` is a method when the `generic` is itself exported (e.g. `print.foo`).
14
14
  */
15
15
  export declare function reconstructS3Generics(exported: readonly string[]): Map<string, string[]>;
16
+ /**
17
+ * The packages exporting one name: the sole exporter bare, the rivals as an array. Roughly 95% of the names in a
18
+ * bundle are exported by exactly one package, so giving those an array of their own would cost more than the
19
+ * index itself.
20
+ */
21
+ export type ExportIndexEntry = string | string[];
22
+ /**
23
+ * The reverse `export name -> packages exporting it` view of a signature source, each entry ordered by download
24
+ * count (descending, ties by name) so whoever has to pick one exporter starts with the package a script most
25
+ * likely means.
26
+ *
27
+ * Building the view reads every package blob of a bundle, which is why {@link of} memoizes it on the source
28
+ * object rather than on the caller: signature sources are opened once per process (see {@link getSharedSigSource})
29
+ * and are immutable, so every analyzer mounting the same bundle shares one index instead of re-scanning the
30
+ * database per analysis. It is deliberately analyzer-independent -- self-package exclusion belongs to the caller
31
+ * (see {@link FlowrAnalyzerPackageVersionsSigDbPlugin.packagesExporting}), not to the index.
32
+ */
33
+ export declare const ExportIndex: {
34
+ readonly name: "ExportIndex";
35
+ /** The index of `src`, built on first use and shared by every later caller; see {@link ExportIndex}. */
36
+ readonly of: (this: void, src: PackageSignatureSource) => ReadonlyMap<string, ExportIndexEntry>;
37
+ /** The packages an {@link ExportIndexEntry} names, as a list; empty when no package exports the name. */
38
+ readonly owners: (this: void, entry: ExportIndexEntry | undefined) => readonly string[];
39
+ };
16
40
  /**
17
41
  * Resolves `library(pkg)` / `use(pkg, fn)` from precomputed `flowr-sigdb` databases via the
18
42
  * {@link PackageSignatureSource} contract. For an R-core package it picks the version shipped with the assumed
@@ -28,8 +52,8 @@ export declare class FlowrAnalyzerPackageVersionsSigDbPlugin extends FlowrAnalyz
28
52
  /** the `additionalPaths` the current {@link sources} were assembled with, so a later config resolves a rebuild */
29
53
  private sourcesKey;
30
54
  private analyzerCtx;
31
- /** cached reverse index `export name -> packages exporting it`, built once per source set (see {@link packagesExporting}) */
32
- private exportIndex;
55
+ /** `packagesExporting` answers, merged across the source set and self-filtered; the scan itself is {@link ExportIndex} */
56
+ private exportsByName;
33
57
  /** `pkg@assumedR` keys already reported via {@link baseVersionFor}'s fallback, so the info is logged once */
34
58
  private readonly baseFallbacksLogged;
35
59
  /** installed package versions for `versionSelection: 'system'`, read once from R (see {@link warmInstalledVersions}) */
@@ -73,17 +97,12 @@ export declare class FlowrAnalyzerPackageVersionsSigDbPlugin extends FlowrAnalyz
73
97
  /**
74
98
  * Packages in the loaded sources (respecting `self`-package exclusion) that export `name`, **most downloaded
75
99
  * first**, so whoever has to pick one (or show only a few) starts with the package a script most likely means.
76
- * Backed by a reverse index built once per source set, so repeated hint lookups (e.g. from the
77
- * `undefined-symbol` linter) do not re-scan every package. The first call still pays one full pass over the
78
- * sources.
100
+ * Backed by {@link ExportIndex}, a reverse index built once per *source* (and hence shared by every analyzer
101
+ * mounting the same bundle), so repeated hint lookups (e.g. from the `undefined-symbol` linter) do not re-scan
102
+ * every package. Self-package exclusion is applied here rather than baked into the index, which keeps the
103
+ * index analyzer-independent.
79
104
  */
80
105
  packagesExporting(name: string): readonly string[];
81
- /**
82
- * One pass over every loaded source building `export name -> packages`, honoring self-package exclusion.
83
- * Each list ends up sorted by download count (descending, ties by name), which the sort at the end does
84
- * once per name rather than at every lookup.
85
- */
86
- private buildExportIndex;
87
106
  /**
88
107
  * The raw sources in priority order: explicit constructor sources, `$FLOWR_SIGDB`, then **every** bundled
89
108
  * database discovered in the data dirs (see {@link defaultSigDbPaths}), so an extra bundle dropped next to
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.FlowrAnalyzerPackageVersionsSigDbPlugin = exports.sigDbLog = exports.SigDbPluginName = void 0;
39
+ exports.FlowrAnalyzerPackageVersionsSigDbPlugin = exports.ExportIndex = exports.sigDbLog = exports.SigDbPluginName = void 0;
40
40
  exports.reconstructS3Generics = reconstructS3Generics;
41
41
  const flowr_analyzer_package_versions_plugin_1 = require("./flowr-analyzer-package-versions-plugin");
42
42
  const semver_1 = require("semver");
@@ -110,6 +110,58 @@ function reconstructS3Generics(exported) {
110
110
  }
111
111
  return generics;
112
112
  }
113
+ /** the built {@link ExportIndex} of each source, see {@link ExportIndex.of} for why it is keyed by the source */
114
+ const exportIndices = new WeakMap();
115
+ /**
116
+ * The reverse `export name -> packages exporting it` view of a signature source, each entry ordered by download
117
+ * count (descending, ties by name) so whoever has to pick one exporter starts with the package a script most
118
+ * likely means.
119
+ *
120
+ * Building the view reads every package blob of a bundle, which is why {@link of} memoizes it on the source
121
+ * object rather than on the caller: signature sources are opened once per process (see {@link getSharedSigSource})
122
+ * and are immutable, so every analyzer mounting the same bundle shares one index instead of re-scanning the
123
+ * database per analysis. It is deliberately analyzer-independent -- self-package exclusion belongs to the caller
124
+ * (see {@link FlowrAnalyzerPackageVersionsSigDbPlugin.packagesExporting}), not to the index.
125
+ */
126
+ exports.ExportIndex = {
127
+ name: 'ExportIndex',
128
+ /** The index of `src`, built on first use and shared by every later caller; see {@link ExportIndex}. */
129
+ of(src) {
130
+ const cached = exportIndices.get(src);
131
+ if (cached !== undefined) {
132
+ return cached;
133
+ }
134
+ const index = new Map();
135
+ for (const pkg of src.packageNames()) {
136
+ for (const exp of src.lookup(pkg)?.exported ?? []) {
137
+ const owners = index.get(exp);
138
+ if (owners === undefined) {
139
+ index.set(exp, pkg);
140
+ }
141
+ else if (typeof owners === 'string') {
142
+ if (owners !== pkg) {
143
+ index.set(exp, [owners, pkg]);
144
+ }
145
+ }
146
+ else if (owners[owners.length - 1] !== pkg) {
147
+ owners.push(pkg);
148
+ }
149
+ }
150
+ }
151
+ // sorting once per name here beats sorting at every lookup
152
+ for (const owners of index.values()) {
153
+ if (typeof owners !== 'string') {
154
+ owners.sort((a, b) => src.downloads(b) - src.downloads(a) || a.localeCompare(b));
155
+ }
156
+ }
157
+ exportIndices.set(src, index);
158
+ return index;
159
+ },
160
+ /** The packages an {@link ExportIndexEntry} names, as a list; empty when no package exports the name. */
161
+ owners(entry) {
162
+ return entry === undefined ? [] : typeof entry === 'string' ? [entry] : entry;
163
+ }
164
+ };
113
165
  /**
114
166
  * Resolves `library(pkg)` / `use(pkg, fn)` from precomputed `flowr-sigdb` databases via the
115
167
  * {@link PackageSignatureSource} contract. For an R-core package it picks the version shipped with the assumed
@@ -125,8 +177,8 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
125
177
  /** the `additionalPaths` the current {@link sources} were assembled with, so a later config resolves a rebuild */
126
178
  sourcesKey;
127
179
  analyzerCtx;
128
- /** cached reverse index `export name -> packages exporting it`, built once per source set (see {@link packagesExporting}) */
129
- exportIndex;
180
+ /** `packagesExporting` answers, merged across the source set and self-filtered; the scan itself is {@link ExportIndex} */
181
+ exportsByName = new Map();
130
182
  /** `pkg@assumedR` keys already reported via {@link baseVersionFor}'s fallback, so the info is logged once */
131
183
  baseFallbacksLogged = new Set();
132
184
  /** installed package versions for `versionSelection: 'system'`, read once from R (see {@link warmInstalledVersions}) */
@@ -137,7 +189,7 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
137
189
  resetAssembled() {
138
190
  this.sources = undefined;
139
191
  this.sourcesKey = undefined;
140
- this.exportIndex = undefined;
192
+ this.exportsByName = new Map();
141
193
  }
142
194
  constructor(...sources) {
143
195
  super();
@@ -254,48 +306,38 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
254
306
  /**
255
307
  * Packages in the loaded sources (respecting `self`-package exclusion) that export `name`, **most downloaded
256
308
  * first**, so whoever has to pick one (or show only a few) starts with the package a script most likely means.
257
- * Backed by a reverse index built once per source set, so repeated hint lookups (e.g. from the
258
- * `undefined-symbol` linter) do not re-scan every package. The first call still pays one full pass over the
259
- * sources.
309
+ * Backed by {@link ExportIndex}, a reverse index built once per *source* (and hence shared by every analyzer
310
+ * mounting the same bundle), so repeated hint lookups (e.g. from the `undefined-symbol` linter) do not re-scan
311
+ * every package. Self-package exclusion is applied here rather than baked into the index, which keeps the
312
+ * index analyzer-independent.
260
313
  */
261
314
  packagesExporting(name) {
262
315
  if (!(0, config_1.isSigDbEnabled)(this.analyzerCtx?.config)) {
263
316
  return [];
264
317
  }
265
- this.exportIndex ??= this.buildExportIndex();
266
- return this.exportIndex.get(name) ?? [];
267
- }
268
- /**
269
- * One pass over every loaded source building `export name -> packages`, honoring self-package exclusion.
270
- * Each list ends up sorted by download count (descending, ties by name), which the sort at the end does
271
- * once per name rather than at every lookup.
272
- */
273
- buildExportIndex() {
274
- const index = new Map();
275
- const downloads = new Map();
276
- for (const src of this.loadSources()) {
277
- for (const pkg of src.packageNames()) {
278
- if (this.isSelfPackage(pkg)) {
279
- continue;
280
- }
281
- downloads.set(pkg, Math.max(downloads.get(pkg) ?? 0, src.downloads(pkg)));
282
- for (const exp of src.lookup(pkg)?.exported ?? []) {
283
- const owners = index.get(exp);
284
- if (owners === undefined) {
285
- index.set(exp, [pkg]);
286
- }
287
- else if (!owners.includes(pkg)) {
288
- owners.push(pkg);
289
- }
318
+ const cached = this.exportsByName.get(name);
319
+ if (cached !== undefined) {
320
+ return cached;
321
+ }
322
+ const sources = this.loadSources();
323
+ const seen = new Set();
324
+ const owners = [];
325
+ for (const src of sources) {
326
+ for (const pkg of exports.ExportIndex.owners(exports.ExportIndex.of(src).get(name))) {
327
+ if (!seen.has(pkg) && !this.isSelfPackage(pkg)) {
328
+ seen.add(pkg);
329
+ owners.push(pkg);
290
330
  }
291
331
  }
292
332
  }
293
- for (const owners of index.values()) {
294
- if (owners.length > 1) {
295
- owners.sort((a, b) => (downloads.get(b) ?? 0) - (downloads.get(a) ?? 0) || a.localeCompare(b));
296
- }
333
+ // each source's list is already sorted; a merge of several needs one more pass to be globally ordered
334
+ if (owners.length > 1 && sources.length > 1) {
335
+ /* the comparator runs O(n log n) times, so each package is counted once up front */
336
+ const downloads = new Map(owners.map(pkg => [pkg, sources.reduce((m, s) => Math.max(m, s.has(pkg) ? s.downloads(pkg) : 0), 0)]));
337
+ owners.sort((a, b) => downloads.get(b) - downloads.get(a) || a.localeCompare(b));
297
338
  }
298
- return index;
339
+ this.exportsByName.set(name, owners);
340
+ return owners;
299
341
  }
300
342
  /**
301
343
  * The raw sources in priority order: explicit constructor sources, `$FLOWR_SIGDB`, then **every** bundled
@@ -35,6 +35,8 @@ export declare class Package {
35
35
  get resolvedVersion(): string | undefined;
36
36
  get versionConstraints(): readonly Range[];
37
37
  get derivedRange(): Range | undefined;
38
+ /** {@link derivedRange} if a source declared one, else the {@link resolvedVersion} the exports were read from. */
39
+ get effectiveRange(): Range | undefined;
38
40
  constructor(info: {
39
41
  name: string;
40
42
  } & PackageOptions);
@@ -44,6 +44,10 @@ class Package {
44
44
  this._derivedRange ??= this.deriveRange();
45
45
  return this._derivedRange;
46
46
  }
47
+ /** {@link derivedRange} if a source declared one, else the {@link resolvedVersion} the exports were read from. */
48
+ get effectiveRange() {
49
+ return this.derivedRange ?? (this._resolvedVersion !== undefined ? r_version_1.RRange.parse('=' + this._resolvedVersion) : undefined);
50
+ }
47
51
  constructor(info) {
48
52
  this.name = info.name;
49
53
  this.addInfo(info);
@@ -26,11 +26,12 @@ import { FlowrAnalyzerGitignoreProjectDiscoveryPlugin, FlowrAnalyzerIgnoreFilePr
26
26
  import { FlowrAnalyzerDefaultProjectDiscoveryPlugin, FlowrAnalyzerFullProjectDiscoveryPlugin } from './project-discovery/flowr-analyzer-project-discovery-plugin';
27
27
  import { FlowrAnalyzerRprofileFilePlugin } from './file-plugins/flowr-analyzer-rprofile-file-plugin';
28
28
  import { FlowrAnalyzerLoadingOrderRprofilePlugin } from './loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin';
29
+ import { FlowrAnalyzerPackageVersionsLibraryPlugin } from './package-version-plugins/flowr-analyzer-package-versions-library-plugin';
29
30
  import { FlowrAnalyzerLoadingOrderIncludedFilesPlugin } from './loading-order-plugins/flowr-analyzer-loading-order-included-files-plugin';
30
31
  /**
31
32
  * The built-in Flowr Analyzer plugins that are always available.
32
33
  */
33
- export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["versions:sigdb", typeof FlowrAnalyzerPackageVersionsSigDbPlugin], ["versions:renv", typeof FlowrAnalyzerPackageVersionsRenvPlugin], ["versions:rv", typeof FlowrAnalyzerPackageVersionsRvPlugin], ["versions:uvr", typeof FlowrAnalyzerPackageVersionsUvrPlugin], ["versions:packrat", typeof FlowrAnalyzerPackageVersionsPackratPlugin], ["versions:session-info", typeof FlowrAnalyzerPackageVersionsSessionInfoPlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["loading-order:implicit-sources", typeof FlowrAnalyzerLoadingOrderImplicitSourcesPlugin], ["loading-order:rprofile", typeof FlowrAnalyzerLoadingOrderRprofilePlugin], ["loading-order:included-files", typeof FlowrAnalyzerLoadingOrderIncludedFilesPlugin], ["meta:description", typeof FlowrAnalyzerMetaDescriptionFilePlugin], ["meta:rproject", typeof FlowrAnalyzerMetaRProjectFilePlugin], ["meta:uvr", typeof FlowrAnalyzerMetaUvrManifestFilePlugin], ["file-roles:vignette", typeof FlowrAnalyzerMetaVignetteFilesPlugin], ["file-roles:test", typeof FlowrAnalyzerMetaTestFilesPlugin], ["file-roles:inst", typeof FlowrAnalyzerMetaInstFilesPlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:rnw", typeof FlowrAnalyzerSweaveFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilesPlugin], ["versions:namespace", typeof FlowrAnalyzerPackageVersionsNamespaceFilePlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin], ["file:rda", typeof FlowrAnalyzerRdaFilePlugin], ["file:license", typeof FlowrAnalyzerLicenseFilePlugin], ["file:virtualenv", typeof FlowrAnalyzerVirtualEnvFilePlugin], ["file:rproject", typeof FlowrAnalyzerRProjectFilePlugin], ["file:uvr", typeof FlowrAnalyzerUvrManifestFilePlugin], ["file:rprofile", typeof FlowrAnalyzerRprofileFilePlugin], ["project-discovery:gitignore", typeof FlowrAnalyzerGitignoreProjectDiscoveryPlugin], ["project-discovery:rbuildignore", typeof FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin], ["project-discovery:ignore-files", typeof FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin], ["project-discovery:default", typeof FlowrAnalyzerDefaultProjectDiscoveryPlugin], ["project-discovery:full", typeof FlowrAnalyzerFullProjectDiscoveryPlugin]];
34
+ export declare const BuiltInPlugins: [["file:description", typeof FlowrAnalyzerDescriptionFilePlugin], ["versions:description", typeof FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ["versions:sigdb", typeof FlowrAnalyzerPackageVersionsSigDbPlugin], ["versions:library", typeof FlowrAnalyzerPackageVersionsLibraryPlugin], ["versions:renv", typeof FlowrAnalyzerPackageVersionsRenvPlugin], ["versions:rv", typeof FlowrAnalyzerPackageVersionsRvPlugin], ["versions:uvr", typeof FlowrAnalyzerPackageVersionsUvrPlugin], ["versions:packrat", typeof FlowrAnalyzerPackageVersionsPackratPlugin], ["versions:session-info", typeof FlowrAnalyzerPackageVersionsSessionInfoPlugin], ["loading-order:description", typeof FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ["loading-order:implicit-sources", typeof FlowrAnalyzerLoadingOrderImplicitSourcesPlugin], ["loading-order:rprofile", typeof FlowrAnalyzerLoadingOrderRprofilePlugin], ["loading-order:included-files", typeof FlowrAnalyzerLoadingOrderIncludedFilesPlugin], ["meta:description", typeof FlowrAnalyzerMetaDescriptionFilePlugin], ["meta:rproject", typeof FlowrAnalyzerMetaRProjectFilePlugin], ["meta:uvr", typeof FlowrAnalyzerMetaUvrManifestFilePlugin], ["file-roles:vignette", typeof FlowrAnalyzerMetaVignetteFilesPlugin], ["file-roles:test", typeof FlowrAnalyzerMetaTestFilesPlugin], ["file-roles:inst", typeof FlowrAnalyzerMetaInstFilesPlugin], ["file:rmd", typeof FlowrAnalyzerRmdFilePlugin], ["file:qmd", typeof FlowrAnalyzerQmdFilePlugin], ["file:rnw", typeof FlowrAnalyzerSweaveFilePlugin], ["file:ipynb", typeof FlowrAnalyzerJupyterFilePlugin], ["file:namespace", typeof FlowrAnalyzerNamespaceFilesPlugin], ["versions:namespace", typeof FlowrAnalyzerPackageVersionsNamespaceFilePlugin], ["file:news", typeof FlowrAnalyzerNewsFilePlugin], ["file:rda", typeof FlowrAnalyzerRdaFilePlugin], ["file:license", typeof FlowrAnalyzerLicenseFilePlugin], ["file:virtualenv", typeof FlowrAnalyzerVirtualEnvFilePlugin], ["file:rproject", typeof FlowrAnalyzerRProjectFilePlugin], ["file:uvr", typeof FlowrAnalyzerUvrManifestFilePlugin], ["file:rprofile", typeof FlowrAnalyzerRprofileFilePlugin], ["project-discovery:gitignore", typeof FlowrAnalyzerGitignoreProjectDiscoveryPlugin], ["project-discovery:rbuildignore", typeof FlowrAnalyzerRbuildignoreProjectDiscoveryPlugin], ["project-discovery:ignore-files", typeof FlowrAnalyzerIgnoreFileProjectDiscoveryPlugin], ["project-discovery:default", typeof FlowrAnalyzerDefaultProjectDiscoveryPlugin], ["project-discovery:full", typeof FlowrAnalyzerFullProjectDiscoveryPlugin]];
34
35
  export type BuiltInFlowrPluginName = typeof BuiltInPlugins[number][0];
35
36
  export type BuiltInFlowrPluginArgs<N extends BuiltInFlowrPluginName> = N extends typeof BuiltInPlugins[number][0] ? ConstructorParameters<Extract<typeof BuiltInPlugins[number], [N, PluginProducer]>[1]> : never;
36
37
  type PluginProducer = new (...args: never[]) => FlowrAnalyzerPlugin;
@@ -32,6 +32,7 @@ const flowr_analyzer_ignore_file_project_discovery_plugin_1 = require("./project
32
32
  const flowr_analyzer_project_discovery_plugin_1 = require("./project-discovery/flowr-analyzer-project-discovery-plugin");
33
33
  const flowr_analyzer_rprofile_file_plugin_1 = require("./file-plugins/flowr-analyzer-rprofile-file-plugin");
34
34
  const flowr_analyzer_loading_order_rprofile_plugin_1 = require("./loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin");
35
+ const flowr_analyzer_package_versions_library_plugin_1 = require("./package-version-plugins/flowr-analyzer-package-versions-library-plugin");
35
36
  const flowr_analyzer_loading_order_included_files_plugin_1 = require("./loading-order-plugins/flowr-analyzer-loading-order-included-files-plugin");
36
37
  /**
37
38
  * The built-in Flowr Analyzer plugins that are always available.
@@ -40,6 +41,7 @@ exports.BuiltInPlugins = [
40
41
  ['file:description', flowr_analyzer_description_file_plugin_1.FlowrAnalyzerDescriptionFilePlugin],
41
42
  ['versions:description', flowr_analyzer_package_versions_description_file_plugin_1.FlowrAnalyzerPackageVersionsDescriptionFilePlugin],
42
43
  ['versions:sigdb', flowr_analyzer_package_versions_sigdb_plugin_1.FlowrAnalyzerPackageVersionsSigDbPlugin],
44
+ ['versions:library', flowr_analyzer_package_versions_library_plugin_1.FlowrAnalyzerPackageVersionsLibraryPlugin],
43
45
  ['versions:renv', flowr_analyzer_package_versions_lockfile_plugin_1.FlowrAnalyzerPackageVersionsRenvPlugin],
44
46
  ['versions:rv', flowr_analyzer_package_versions_lockfile_plugin_1.FlowrAnalyzerPackageVersionsRvPlugin],
45
47
  ['versions:uvr', flowr_analyzer_package_versions_lockfile_plugin_1.FlowrAnalyzerPackageVersionsUvrPlugin],
@@ -60,6 +60,10 @@ function readManifestDate(manifestFile) {
60
60
  const SigDbScopeOrder = ['full', 'current', 'base'];
61
61
  /** layouts a bundled sigdb may sit in, relative to a search root -- the root itself (e.g. a `$FLOWR_SIGDB_DIR` data mount), then the dev `src`, build `dist` and data-dir layouts */
62
62
  const SigDbSubDirs = ['', 'data/sigdb', 'src/data/sigdb', 'dist/src/data/sigdb'];
63
+ /** a `<scope>.manifest.json`, in any of the codecs we can read */
64
+ const ManifestFilePattern = new RegExp(`\\.manifest\\.json${codec_1.CompressedExtPattern}$`);
65
+ /** a `<name>.sigs.ndjson` bundle, in any of the codecs we can read */
66
+ const BundleFilePattern = new RegExp(`${schema_1.SigDbExt.replace(/\./g, '\\.')}${codec_1.CompressedExtPattern}$`);
63
67
  function sigDbBundleDirs() {
64
68
  if (typeof node_fs_1.default?.readdirSync !== 'function') {
65
69
  return [];
@@ -169,13 +173,13 @@ function defaultSigDbPaths(searchRoots) {
169
173
  catch {
170
174
  continue; // directory does not exist on this root
171
175
  }
176
+ const dir = node_path_1.default.join(base, sub);
172
177
  for (const file of entries) {
173
- const full = node_path_1.default.join(base, sub, file);
174
- if (new RegExp(`\\.manifest\\.json${codec_1.CompressedExtPattern}$`).test(file)) {
175
- keep(manifests, (0, codec_1.stripCompressedExt)(file), full, node_path_1.default.join(base, sub));
178
+ if (ManifestFilePattern.test(file)) {
179
+ keep(manifests, (0, codec_1.stripCompressedExt)(file), node_path_1.default.join(dir, file), dir);
176
180
  }
177
- else if (new RegExp(`${schema_1.SigDbExt.replace(/\./g, '\\.')}${codec_1.CompressedExtPattern}$`).test(file) && !file.includes('.dict' + schema_1.SigDbExt)) {
178
- keep(standalones, (0, codec_1.stripCompressedExt)(file), full, node_path_1.default.join(base, sub));
181
+ else if (BundleFilePattern.test(file) && !file.includes('.dict' + schema_1.SigDbExt)) {
182
+ keep(standalones, (0, codec_1.stripCompressedExt)(file), node_path_1.default.join(dir, file), dir);
179
183
  }
180
184
  }
181
185
  }