@eagleoutice/flowr 2.13.16 → 2.14.1

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 (253) hide show
  1. package/README.md +36 -25
  2. package/abstract-interpretation/absint-visitor.js +1 -1
  3. package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
  4. package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
  5. package/abstract-interpretation/data-frame/mappers/function-mapper.js +18 -17
  6. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +6 -6
  7. package/abstract-interpretation/data-frame/resolve-args.d.ts +9 -4
  8. package/abstract-interpretation/data-frame/resolve-args.js +10 -5
  9. package/benchmark/calibration.d.ts +16 -7
  10. package/benchmark/calibration.js +44 -17
  11. package/benchmark/slicer.d.ts +3 -2
  12. package/benchmark/slicer.js +9 -5
  13. package/benchmark/stats/size-of.js +1 -1
  14. package/benchmark/summarizer/first-phase/process.d.ts +2 -0
  15. package/benchmark/summarizer/first-phase/process.js +2 -0
  16. package/cli/benchmark-app.js +4 -1
  17. package/cli/benchmark-helper-app.d.ts +1 -0
  18. package/cli/benchmark-helper-app.js +2 -2
  19. package/cli/common/options.d.ts +5 -31
  20. package/cli/common/options.js +2 -8
  21. package/cli/common/scripts-info.d.ts +5 -38
  22. package/cli/common/scripts-info.js +0 -8
  23. package/cli/repl/core.js +1 -1
  24. package/cli/repl/execute.d.ts +2 -2
  25. package/cli/repl/execute.js +2 -2
  26. package/cli/repl/parser/slice-query-parser.js +1 -1
  27. package/cli/repl/print-version.js +2 -2
  28. package/config.d.ts +16 -0
  29. package/config.js +83 -5
  30. package/control-flow/extract-cfg.js +1 -1
  31. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  32. package/control-flow/semantic-cfg-guided-visitor.js +1 -1
  33. package/control-flow/useless-loop.js +1 -1
  34. package/core/print/slice-diff-ansi.js +1 -1
  35. package/core/steps/pipeline/create-pipeline.js +1 -1
  36. package/dataflow/cluster.js +2 -2
  37. package/dataflow/environments/apply-kill.js +1 -1
  38. package/dataflow/environments/built-in-props.d.ts +13 -2
  39. package/dataflow/environments/built-in-props.js +23 -1
  40. package/dataflow/environments/built-in.d.ts +7 -1
  41. package/dataflow/environments/built-in.js +42 -3
  42. package/dataflow/environments/default-builtin-config.d.ts +518 -11
  43. package/dataflow/environments/default-builtin-config.js +218 -23
  44. package/dataflow/environments/environment.d.ts +10 -2
  45. package/dataflow/environments/environment.js +25 -7
  46. package/dataflow/environments/identifier.d.ts +8 -2
  47. package/dataflow/environments/identifier.js +6 -1
  48. package/dataflow/environments/query-fn-props.d.ts +6 -0
  49. package/dataflow/environments/query-fn-props.js +22 -2
  50. package/dataflow/environments/reference-to-maybe.js +5 -5
  51. package/dataflow/environments/resolve-by-name.d.ts +3 -0
  52. package/dataflow/environments/resolve-by-name.js +44 -7
  53. package/dataflow/environments/resolve-helper.d.ts +6 -0
  54. package/dataflow/environments/resolve-helper.js +6 -0
  55. package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
  56. package/dataflow/eval/resolve/alias-tracking.js +21 -14
  57. package/dataflow/eval/resolve/node-value.d.ts +6 -0
  58. package/dataflow/eval/resolve/node-value.js +15 -9
  59. package/dataflow/eval/resolve/resolve-argument.js +2 -2
  60. package/dataflow/eval/resolve/resolve-numbers.js +2 -2
  61. package/dataflow/eval/resolve/resolve-operators.js +5 -4
  62. package/dataflow/eval/resolve/resolve-strings.js +3 -3
  63. package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
  64. package/dataflow/eval/resolve/resolve-working-directory.js +3 -3
  65. package/dataflow/eval/resolve/resolve.d.ts +5 -5
  66. package/dataflow/eval/resolve/resolve.js +10 -11
  67. package/dataflow/eval/values/general.d.ts +4 -1
  68. package/dataflow/eval/values/general.js +1 -1
  69. package/dataflow/extractor.js +2 -1
  70. package/dataflow/fn/exceptions-of-function.d.ts +3 -1
  71. package/dataflow/fn/exceptions-of-function.js +87 -39
  72. package/dataflow/fn/higher-order-function.js +5 -4
  73. package/dataflow/fn/strict-function.d.ts +40 -0
  74. package/dataflow/fn/strict-function.js +337 -0
  75. package/dataflow/graph/call-graph.js +14 -14
  76. package/dataflow/graph/df-helper.d.ts +24 -1
  77. package/dataflow/graph/df-helper.js +29 -7
  78. package/dataflow/graph/diff-dataflow-graph.js +6 -6
  79. package/dataflow/graph/edge.d.ts +27 -0
  80. package/dataflow/graph/edge.js +33 -0
  81. package/dataflow/graph/graph-helper.d.ts +3 -4
  82. package/dataflow/graph/graph-helper.js +4 -5
  83. package/dataflow/graph/graph.d.ts +39 -3
  84. package/dataflow/graph/graph.js +75 -7
  85. package/dataflow/graph/vertex.d.ts +42 -6
  86. package/dataflow/graph/vertex.js +42 -6
  87. package/dataflow/info.d.ts +26 -0
  88. package/dataflow/info.js +28 -1
  89. package/dataflow/internal/linker.d.ts +1 -0
  90. package/dataflow/internal/linker.js +11 -9
  91. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  92. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  93. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
  94. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
  95. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
  96. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
  97. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
  98. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
  99. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
  100. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  101. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
  102. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  103. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
  104. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
  106. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
  107. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -0
  108. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +29 -3
  109. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  110. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
  111. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
  112. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
  113. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +44 -20
  114. package/dataflow/internal/process/functions/call/common.d.ts +9 -1
  115. package/dataflow/internal/process/functions/call/common.js +17 -6
  116. package/dataflow/internal/process/functions/call/deferred.js +2 -1
  117. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
  118. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
  119. package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
  120. package/dataflow/internal/process/functions/call/nse.d.ts +33 -5
  121. package/dataflow/internal/process/functions/call/nse.js +113 -6
  122. package/dataflow/internal/process/functions/call/quoted.d.ts +5 -0
  123. package/dataflow/internal/process/functions/call/quoted.js +21 -9
  124. package/dataflow/origin/dfg-get-origin.d.ts +1 -0
  125. package/dataflow/origin/dfg-get-origin.js +9 -6
  126. package/documentation/data/faq/faqs.js +88 -88
  127. package/documentation/data/faq/recommended-configs.js +1 -1
  128. package/documentation/data/faq/wiki-faq-store.js +1 -1
  129. package/documentation/doc-capabilities.js +1 -1
  130. package/documentation/doc-readme.js +1 -1
  131. package/documentation/doc-util/doc-auto-gen.js +6 -2
  132. package/documentation/doc-util/doc-functions.js +1 -1
  133. package/documentation/wiki-cfg.js +2 -2
  134. package/documentation/wiki-core.js +1 -1
  135. package/documentation/wiki-create-linting-rules.js +45 -45
  136. package/documentation/wiki-dataflow-graph.js +18 -18
  137. package/documentation/wiki-linter.js +1 -0
  138. package/documentation/wiki-linting-and-testing.js +93 -5
  139. package/documentation/wiki-mk/doc-maker.js +1 -1
  140. package/documentation/wiki-overview.js +12 -1
  141. package/documentation/wiki-query.js +53 -0
  142. package/documentation/wiki-signature-database.js +3 -0
  143. package/linter/linter-output.js +1 -1
  144. package/linter/linter-rules.d.ts +24 -0
  145. package/linter/linter-rules.js +3 -1
  146. package/linter/rules/file-path-validity.js +1 -1
  147. package/linter/rules/function-finder-util.js +1 -1
  148. package/linter/rules/naming-convention.js +1 -1
  149. package/linter/rules/network-functions.d.ts +1 -1
  150. package/linter/rules/no-leaked-credentials.js +2 -1
  151. package/linter/rules/stop-with-call-arg.js +4 -4
  152. package/linter/rules/unclosed-connection.d.ts +44 -0
  153. package/linter/rules/unclosed-connection.js +200 -0
  154. package/linter/rules/undefined-symbol-util.d.ts +1 -1
  155. package/linter/rules/undefined-symbol-util.js +5 -4
  156. package/linter/rules/undefined-symbol.js +3 -3
  157. package/linter/rules/unused-definition.js +2 -1
  158. package/package.json +38 -51
  159. package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
  160. package/project/context/flowr-analyzer-environment-context.js +25 -0
  161. package/project/dependency-version-space.d.ts +3 -3
  162. package/project/dependency-version-space.js +3 -4
  163. package/project/flowr-analyzer.js +1 -1
  164. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
  165. package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
  166. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
  167. package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
  168. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
  169. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
  170. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +1 -1
  171. package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -4
  172. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +36 -7
  175. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
  176. package/project/sigdb/build.js +16 -16
  177. package/project/sigdb/codec.d.ts +1 -1
  178. package/project/sigdb/codec.js +13 -13
  179. package/project/sigdb/decompress.d.ts +1 -1
  180. package/project/sigdb/decompress.js +33 -33
  181. package/project/sigdb/index-format.js +2 -2
  182. package/project/sigdb/manifest.d.ts +3 -1
  183. package/project/sigdb/manifest.js +68 -27
  184. package/project/sigdb/memory-source.d.ts +64 -0
  185. package/project/sigdb/memory-source.js +133 -0
  186. package/project/sigdb/reader.js +14 -14
  187. package/project/sigdb/schema.d.ts +2 -2
  188. package/project/sigdb/schema.js +2 -2
  189. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  190. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
  191. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  192. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  193. package/queries/catalog/dependencies-query/link-devices.js +3 -9
  194. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
  195. package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
  196. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -1
  197. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
  198. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
  199. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
  200. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
  201. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
  202. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  203. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  204. package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
  205. package/queries/catalog/signature-query/signature-query-executor.js +3 -2
  206. package/queries/catalog/slice-query-options.d.ts +1 -1
  207. package/queries/catalog/slice-query-options.js +1 -1
  208. package/queries/query-function-filter.d.ts +8 -2
  209. package/queries/query-function-filter.js +11 -1
  210. package/queries/query.d.ts +11 -1
  211. package/queries/query.js +2 -0
  212. package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
  213. package/r-bridge/lang-4.x/ast/model/model.js +4 -4
  214. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
  215. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  216. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  217. package/r-bridge/retriever.d.ts +2 -1
  218. package/r-bridge/retriever.js +3 -2
  219. package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
  220. package/r-bridge/roxygen2/documentation-provider.js +1 -0
  221. package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
  222. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  223. package/search/flowr-search-filters.d.ts +1 -1
  224. package/search/flowr-search-filters.js +2 -14
  225. package/search/search-executor/search-enrichers.js +4 -4
  226. package/search/search-executor/search-generators.js +1 -1
  227. package/slicing/criterion/parse.d.ts +2 -2
  228. package/slicing/criterion/parse.js +5 -5
  229. package/slicing/static/fingerprint.js +1 -1
  230. package/slicing/static/slice-call.d.ts +1 -1
  231. package/slicing/static/slice-call.js +2 -2
  232. package/slicing/static/static-slicer.js +4 -3
  233. package/util/assert.js +1 -1
  234. package/util/log.d.ts +4 -1
  235. package/util/log.js +15 -2
  236. package/util/logic.js +2 -2
  237. package/util/mermaid/cfg.js +1 -1
  238. package/util/mermaid/dfg.js +6 -6
  239. package/util/mermaid/mermaid.js +3 -1
  240. package/util/objects.d.ts +12 -0
  241. package/util/objects.js +48 -0
  242. package/util/quads.js +19 -6
  243. package/util/schema.js +2 -2
  244. package/util/simple-df/dfg-ascii.js +14 -3
  245. package/util/text/ansi.d.ts +2 -0
  246. package/util/text/ansi.js +8 -0
  247. package/util/text/name-rank.d.ts +29 -0
  248. package/util/text/name-rank.js +39 -0
  249. package/util/text/url-encoding.d.ts +15 -0
  250. package/util/text/url-encoding.js +59 -0
  251. package/util/version.js +1 -1
  252. package/cli/export-quads-app.d.ts +0 -7
  253. package/cli/export-quads-app.js +0 -44
@@ -57,12 +57,14 @@ export declare function readManifestDate(manifestFile: string): string | undefin
57
57
  export type SigDbScope = 'base' | 'current' | 'full';
58
58
  /**
59
59
  * Location of a bundled sigdb **manifest**, found by walking up from several roots (this module,
60
- * `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`) and data-mount
60
+ * `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`), and data-mount
61
61
  * layouts. With no `scope` it returns the richest available (`full` > `current` > `base`), so a
62
62
  * container that ships the full set uses it automatically while a plain npm install falls back to the
63
63
  * bundled `base`. Node only (needs `fs`); pass `searchRoots` to override where it looks.
64
64
  */
65
65
  export declare function defaultSigDbPath(scope?: SigDbScope, searchRoots?: readonly string[]): string | undefined;
66
+ /** Forget what {@link defaultSigDbPaths} discovered, so the next call scans the filesystem again. */
67
+ export declare function clearDefaultSigDbPathsMemo(): void;
66
68
  /**
67
69
  * Every distinct sigdb bundle discoverable in the search dirs (see {@link defaultSigDbPath}) -- not just the
68
70
  * richest scope. So dropping an extra bundle next to the shipped default (a downloaded full-history
@@ -8,14 +8,15 @@ exports.writeManifest = writeManifest;
8
8
  exports.readManifestFile = readManifestFile;
9
9
  exports.readManifestDate = readManifestDate;
10
10
  exports.defaultSigDbPath = defaultSigDbPath;
11
+ exports.clearDefaultSigDbPathsMemo = clearDefaultSigDbPathsMemo;
11
12
  exports.defaultSigDbPaths = defaultSigDbPaths;
12
13
  /**
13
14
  * The sharded-database manifest format (shard/dictionary descriptors that route a set of shard files as one
14
15
  * database), reading/writing it, and discovering the bundled manifests/bundles on flowR's search path. Split
15
16
  * out of `../sigdb` as pure format + filesystem discovery, with no dependency on the reader/writer classes.
16
17
  */
17
- const node_fs_1 = __importDefault(require("node:fs"));
18
- const node_path_1 = __importDefault(require("node:path"));
18
+ const fs_1 = __importDefault(require("fs"));
19
+ const path_1 = __importDefault(require("path"));
19
20
  const schema_1 = require("./schema");
20
21
  const codec_1 = require("./codec");
21
22
  const decompress_1 = require("./decompress");
@@ -23,11 +24,11 @@ exports.SigDbManifestMagic = 'flowr-sigdb-manifest';
23
24
  exports.SigDbManifestSchema = 2;
24
25
  /** write a {@link SigDbManifest} (compact JSON) plus a compressed copy per available codec (`.br` always, `.zst` when supported) beside it */
25
26
  function writeManifest(file, manifest) {
26
- node_fs_1.default.mkdirSync(node_path_1.default.dirname(node_path_1.default.resolve(file)), { recursive: true });
27
+ fs_1.default.mkdirSync(path_1.default.dirname(path_1.default.resolve(file)), { recursive: true });
27
28
  const json = JSON.stringify(manifest);
28
- node_fs_1.default.writeFileSync(file, json);
29
+ fs_1.default.writeFileSync(file, json);
29
30
  for (const spec of (0, codec_1.writeCodecs)()) {
30
- node_fs_1.default.writeFileSync(`${file}${spec.ext}`, spec.compressSync(json, { level: 11, sizeHint: json.length }));
31
+ fs_1.default.writeFileSync(`${file}${spec.ext}`, spec.compressSync(json, { level: 11, sizeHint: json.length }));
31
32
  }
32
33
  }
33
34
  /** how cheap a file is to read (lower is better); one we cannot decompress here sorts last */
@@ -44,7 +45,7 @@ function readManifestFile(manifestFile) {
44
45
  return JSON.parse(readManifestText(manifestFile));
45
46
  }
46
47
  function readManifestText(manifestFile) {
47
- const raw = node_fs_1.default.readFileSync(manifestFile);
48
+ const raw = fs_1.default.readFileSync(manifestFile);
48
49
  return (0, codec_1.compressedExtOf)(manifestFile) ? (0, codec_1.decompressSyncFor)(manifestFile, raw).toString('utf8') : raw.toString('utf8');
49
50
  }
50
51
  /**
@@ -58,21 +59,24 @@ function readManifestDate(manifestFile) {
58
59
  }
59
60
  /** richest first: a container shipping the full set uses it, else the slim `current`, else the `base` floor */
60
61
  const SigDbScopeOrder = ['full', 'current', 'base'];
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
+ /** 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
63
  const SigDbSubDirs = ['', 'data/sigdb', 'src/data/sigdb', 'dist/src/data/sigdb'];
63
64
  /** a `<scope>.manifest.json`, in any of the codecs we can read */
64
65
  const ManifestFilePattern = new RegExp(`\\.manifest\\.json${codec_1.CompressedExtPattern}$`);
65
66
  /** a `<name>.sigs.ndjson` bundle, in any of the codecs we can read */
66
67
  const BundleFilePattern = new RegExp(`${schema_1.SigDbExt.replace(/\./g, '\\.')}${codec_1.CompressedExtPattern}$`);
67
- function sigDbBundleDirs() {
68
- if (typeof node_fs_1.default?.readdirSync !== 'function') {
68
+ function sigDbBundleDirs(watched) {
69
+ if (typeof fs_1.default?.readdirSync !== 'function') {
69
70
  return [];
70
71
  }
71
72
  try {
72
- const bundles = node_path_1.default.join((0, decompress_1.sigDbCacheDir)(undefined, false), 'bundles');
73
- return node_fs_1.default.readdirSync(bundles, { withFileTypes: true })
73
+ const bundles = path_1.default.join((0, decompress_1.sigDbCacheDir)(undefined, false), 'bundles');
74
+ const mtimeMs = fs_1.default.statSync(bundles).mtimeMs;
75
+ const dirs = fs_1.default.readdirSync(bundles, { withFileTypes: true })
74
76
  .filter(e => e.isDirectory())
75
- .map(e => node_path_1.default.join(bundles, e.name));
77
+ .map(e => path_1.default.join(bundles, e.name));
78
+ watched?.push([bundles, mtimeMs]); // a bundle directory appearing here has to be picked up too
79
+ return dirs;
76
80
  }
77
81
  catch {
78
82
  return [];
@@ -83,7 +87,7 @@ function sigDbSearchRoots(extra) {
83
87
  const roots = [...(extra ?? [])];
84
88
  const env = typeof process !== 'undefined' ? process.env?.FLOWR_SIGDB_DIR : undefined;
85
89
  if (env) {
86
- roots.push(...env.split(node_path_1.default.delimiter).filter(Boolean));
90
+ roots.push(...env.split(path_1.default.delimiter).filter(Boolean));
87
91
  }
88
92
  if (typeof __dirname !== 'undefined') {
89
93
  roots.push(__dirname);
@@ -95,13 +99,13 @@ function sigDbSearchRoots(extra) {
95
99
  }
96
100
  /**
97
101
  * Location of a bundled sigdb **manifest**, found by walking up from several roots (this module,
98
- * `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`) and data-mount
102
+ * `$FLOWR_SIGDB_DIR`, the working directory) across the dev (`src`), build (`dist`), and data-mount
99
103
  * layouts. With no `scope` it returns the richest available (`full` &gt; `current` &gt; `base`), so a
100
104
  * container that ships the full set uses it automatically while a plain npm install falls back to the
101
105
  * bundled `base`. Node only (needs `fs`); pass `searchRoots` to override where it looks.
102
106
  */
103
107
  function defaultSigDbPath(scope, searchRoots) {
104
- if (typeof node_fs_1.default?.existsSync !== 'function') {
108
+ if (typeof fs_1.default?.existsSync !== 'function') {
105
109
  return undefined;
106
110
  }
107
111
  const scopes = scope ? [scope] : SigDbScopeOrder;
@@ -109,8 +113,8 @@ function defaultSigDbPath(scope, searchRoots) {
109
113
  for (const sub of SigDbSubDirs) {
110
114
  for (const s of scopes) {
111
115
  for (const suffix of ['', ...(0, codec_1.readableExtsPreferred)()]) {
112
- const candidate = node_path_1.default.join(dir, sub, `${s}.manifest.json${suffix}`);
113
- if (node_fs_1.default.existsSync(candidate)) {
116
+ const candidate = path_1.default.join(dir, sub, `${s}.manifest.json${suffix}`);
117
+ if (fs_1.default.existsSync(candidate)) {
114
118
  return candidate;
115
119
  }
116
120
  }
@@ -124,7 +128,7 @@ function defaultSigDbPath(scope, searchRoots) {
124
128
  if (hit !== undefined) {
125
129
  return hit;
126
130
  }
127
- const parent = node_path_1.default.dirname(dir);
131
+ const parent = path_1.default.dirname(dir);
128
132
  if (parent === dir) {
129
133
  break;
130
134
  }
@@ -139,6 +143,31 @@ function defaultSigDbPath(scope, searchRoots) {
139
143
  }
140
144
  return undefined;
141
145
  }
146
+ /**
147
+ * Memo for {@link defaultSigDbPaths}, keyed by the resolved search roots. The scan costs ~70 `readdirSync` calls
148
+ * to answer with a handful of paths and an analyzer asks for it once on construction, so a per-analyzer run
149
+ * repeats it for nothing. Kept honest by remembering the modification time of every directory the scan read: a
150
+ * bundle dropped next to the shipped ones bumps that directory and the next call rescans.
151
+ */
152
+ const defaultSigDbPathsMemo = new Map();
153
+ /** Forget what {@link defaultSigDbPaths} discovered, so the next call scans the filesystem again. */
154
+ function clearDefaultSigDbPathsMemo() {
155
+ defaultSigDbPathsMemo.clear();
156
+ }
157
+ /** Whether every directory the memoized scan read still carries the modification time it had back then */
158
+ function memoizedScanStillCurrent(watched) {
159
+ for (const [dir, mtimeMs] of watched) {
160
+ try {
161
+ if (fs_1.default.statSync(dir).mtimeMs !== mtimeMs) {
162
+ return false;
163
+ }
164
+ }
165
+ catch {
166
+ return false; // the directory went away
167
+ }
168
+ }
169
+ return true;
170
+ }
142
171
  /**
143
172
  * Every distinct sigdb bundle discoverable in the search dirs (see {@link defaultSigDbPath}) -- not just the
144
173
  * richest scope. So dropping an extra bundle next to the shipped default (a downloaded full-history
@@ -147,9 +176,17 @@ function defaultSigDbPath(scope, searchRoots) {
147
176
  * shard and dictionary files a manifest already owns are skipped. Deduped by filename, first search location wins.
148
177
  */
149
178
  function defaultSigDbPaths(searchRoots) {
150
- if (typeof node_fs_1.default?.readdirSync !== 'function') {
179
+ if (typeof fs_1.default?.readdirSync !== 'function') {
151
180
  return [];
152
181
  }
182
+ const roots = sigDbSearchRoots(searchRoots);
183
+ const memoKey = roots.join('\0');
184
+ const memoized = defaultSigDbPathsMemo.get(memoKey);
185
+ if (memoized !== undefined && memoizedScanStillCurrent(memoized.watched)) {
186
+ return [...memoized.paths];
187
+ }
188
+ /** every directory the scan below read, with its modification time taken _before_ the read so a concurrent write invalidates rather than sticks */
189
+ const watched = [];
153
190
  const manifests = new Map(); // `<name>.manifest.json` (ignoring compression ext) -> first-found path
154
191
  const standalones = new Map(); // `<name>.sigs.ndjson` (ignoring compression ext) -> first-found path
155
192
  const foundIn = new Map(); // where a key was first found, to only compare codecs within one directory
@@ -166,35 +203,37 @@ function defaultSigDbPaths(searchRoots) {
166
203
  };
167
204
  const scanDir = (base) => {
168
205
  for (const sub of SigDbSubDirs) {
206
+ const dir = path_1.default.join(base, sub);
169
207
  let entries;
170
208
  try {
171
- entries = node_fs_1.default.readdirSync(node_path_1.default.join(base, sub));
209
+ const mtimeMs = fs_1.default.statSync(dir).mtimeMs;
210
+ entries = fs_1.default.readdirSync(dir);
211
+ watched.push([dir, mtimeMs]);
172
212
  }
173
213
  catch {
174
214
  continue; // directory does not exist on this root
175
215
  }
176
- const dir = node_path_1.default.join(base, sub);
177
216
  for (const file of entries) {
178
217
  if (ManifestFilePattern.test(file)) {
179
- keep(manifests, (0, codec_1.stripCompressedExt)(file), node_path_1.default.join(dir, file), dir);
218
+ keep(manifests, (0, codec_1.stripCompressedExt)(file), path_1.default.join(dir, file), dir);
180
219
  }
181
220
  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);
221
+ keep(standalones, (0, codec_1.stripCompressedExt)(file), path_1.default.join(dir, file), dir);
183
222
  }
184
223
  }
185
224
  }
186
225
  };
187
- for (const root of sigDbSearchRoots(searchRoots)) {
226
+ for (const root of roots) {
188
227
  for (let dir = root, i = 0; i < 10; i++) {
189
228
  scanDir(dir);
190
- const parent = node_path_1.default.dirname(dir);
229
+ const parent = path_1.default.dirname(dir);
191
230
  if (parent === dir) {
192
231
  break;
193
232
  }
194
233
  dir = parent;
195
234
  }
196
235
  }
197
- for (const bundle of sigDbBundleDirs()) {
236
+ for (const bundle of sigDbBundleDirs(watched)) {
198
237
  scanDir(bundle);
199
238
  }
200
239
  // a standalone bundle is a `.sigs.ndjson` that is not a shard of a discovered manifest (`<manifest>.<shard>...`)
@@ -210,6 +249,8 @@ function defaultSigDbPaths(searchRoots) {
210
249
  const orderedManifests = [...manifests.entries()]
211
250
  .sort((a, b) => scopeRank(a[0]) - scopeRank(b[0]) || a[0].localeCompare(b[0])).map(([, p]) => p);
212
251
  const bundles = standalones.entries().filter(([name]) => !isShard(name)).map(([, p]) => p);
213
- return [...orderedManifests, ...bundles];
252
+ const paths = [...orderedManifests, ...bundles];
253
+ defaultSigDbPathsMemo.set(memoKey, { paths, watched });
254
+ return [...paths];
214
255
  }
215
256
  //# sourceMappingURL=manifest.js.map
@@ -0,0 +1,64 @@
1
+ import type { PackageSignatureSource } from './reader';
2
+ import type { VersionRelease } from './sigdb-version';
3
+ import type { LibraryExports } from './schema';
4
+ import type { ResolvedDependency } from './decode';
5
+ import { RVersion } from '../../util/r-version';
6
+ /**
7
+ * One package as {@link MemorySignatureSource} carries it: the exports are what attaching it brings, the rest
8
+ * is what the answers below need to stay honest. Everything but the name and the exports is optional, so a
9
+ * caller may ship no more than it has.
10
+ */
11
+ export interface MemoryPackage {
12
+ readonly version?: string;
13
+ readonly exported: readonly string[];
14
+ readonly deprecated?: readonly string[];
15
+ readonly s3Classes?: readonly string[];
16
+ readonly s4Classes?: readonly string[];
17
+ readonly downloads?: number;
18
+ readonly deps?: readonly ResolvedDependency[];
19
+ /** when that version was released, which is what makes it a release rather than a label */
20
+ readonly released?: Date;
21
+ }
22
+ /**
23
+ * A signature source held entirely in memory, for the places that cannot open a database file: a browser
24
+ * (the playground bundles its packages rather than reading them) and a test that wants to state a package's
25
+ * exports outright. It answers what a package brings into scope; the per-function view a real database
26
+ * decodes from its blobs is not part of what it can say, so those answers stay empty.
27
+ * @see {@link SigDatabase} - the file-backed source
28
+ */
29
+ export declare class MemorySignatureSource implements PackageSignatureSource {
30
+ private readonly packages;
31
+ /** reverse index `class -> owning package`, built on first use (see {@link classOwner}) */
32
+ private classIndex;
33
+ constructor(packages: Readonly<Record<string, MemoryPackage>> | ReadonlyMap<string, MemoryPackage>);
34
+ has(pkg: string): boolean;
35
+ hasVersion(pkg: string, version: string): boolean;
36
+ isCranVersion(pkg: string, version: string): boolean;
37
+ lookup(pkg: string, version?: string): LibraryExports | undefined;
38
+ packagesExporting(name: string): readonly string[];
39
+ classOwner(className: string, version?: string): string | undefined;
40
+ /** no blobs to decode, so the rich per-function view has nothing to give */
41
+ functions(): undefined;
42
+ functionByName(): undefined;
43
+ transitiveCallees(): undefined;
44
+ dependencies(pkg: string, version?: string): ResolvedDependency[] | undefined;
45
+ packageNames(): string[];
46
+ isBaseR(pkg: string): boolean;
47
+ downloads(pkg: string): number;
48
+ /** the R releases a base package shipped with are a property of the database, which this source has none of */
49
+ coreVersions(): undefined;
50
+ releaseDate(pkg: string): Date | undefined;
51
+ releaseDates(pkg: string): VersionRelease[];
52
+ latestVersion(pkg: string): RVersion | undefined;
53
+ /** nothing is held open */
54
+ close(): void;
55
+ /** whether the package answers a lookup for `version`, which an unversioned one always does */
56
+ private answersFor;
57
+ private versionOf;
58
+ }
59
+ /**
60
+ * A {@link MemorySignatureSource} from what a page can carry: `package -> [version, release date, ...exports]`.
61
+ * The version is what the exports were read from, so recording it is what keeps a consumer from being told
62
+ * the package is unknown when only its history is.
63
+ */
64
+ export declare function memorySourceOfPackages(packages: Readonly<Record<string, readonly string[]>>): MemorySignatureSource;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MemorySignatureSource = void 0;
4
+ exports.memorySourceOfPackages = memorySourceOfPackages;
5
+ const r_version_1 = require("../../util/r-version");
6
+ const reader_1 = require("./reader");
7
+ const r_base_packages_1 = require("../../util/r-base-packages");
8
+ /** what {@link LibraryExports.version} says when the source was given no version to claim */
9
+ const UnknownVersion = '';
10
+ /**
11
+ * A signature source held entirely in memory, for the places that cannot open a database file: a browser
12
+ * (the playground bundles its packages rather than reading them) and a test that wants to state a package's
13
+ * exports outright. It answers what a package brings into scope; the per-function view a real database
14
+ * decodes from its blobs is not part of what it can say, so those answers stay empty.
15
+ * @see {@link SigDatabase} - the file-backed source
16
+ */
17
+ class MemorySignatureSource {
18
+ packages;
19
+ /** reverse index `class -> owning package`, built on first use (see {@link classOwner}) */
20
+ classIndex;
21
+ constructor(packages) {
22
+ this.packages = packages instanceof Map ? packages : new Map(Object.entries(packages));
23
+ }
24
+ has(pkg) {
25
+ return this.packages.has(pkg);
26
+ }
27
+ hasVersion(pkg, version) {
28
+ const known = this.versionOf(pkg);
29
+ return known !== UnknownVersion && known === version;
30
+ }
31
+ isCranVersion(pkg, version) {
32
+ return this.hasVersion(pkg, version);
33
+ }
34
+ lookup(pkg, version) {
35
+ const found = this.packages.get(pkg);
36
+ /* a source given no version has one answer and gives it whatever is asked for: it cannot say no */
37
+ if (found === undefined || !this.answersFor(pkg, version)) {
38
+ return undefined;
39
+ }
40
+ return {
41
+ version: this.versionOf(pkg),
42
+ exported: found.exported,
43
+ internal: [],
44
+ deprecated: found.deprecated ?? [],
45
+ s3Classes: found.s3Classes ?? [],
46
+ s4Classes: found.s4Classes ?? [],
47
+ cran: true
48
+ };
49
+ }
50
+ packagesExporting(name) {
51
+ return [...this.packages]
52
+ .filter(([, p]) => p.exported.includes(name))
53
+ .sort(([an, a], [bn, b]) => (b.downloads ?? 0) - (a.downloads ?? 0) || an.localeCompare(bn))
54
+ .map(([pkg]) => pkg);
55
+ }
56
+ classOwner(className, version) {
57
+ if (version !== undefined) {
58
+ return this.packageNames().find(pkg => {
59
+ const lib = this.lookup(pkg, version);
60
+ return (lib?.s3Classes.includes(className) ?? false) || (lib?.s4Classes.includes(className) ?? false);
61
+ });
62
+ }
63
+ this.classIndex ??= (0, reader_1.classOwnerIndexFor)(this, this.packageNames());
64
+ return this.classIndex.get(className);
65
+ }
66
+ /** no blobs to decode, so the rich per-function view has nothing to give */
67
+ functions() {
68
+ return undefined;
69
+ }
70
+ functionByName() {
71
+ return undefined;
72
+ }
73
+ transitiveCallees() {
74
+ return undefined;
75
+ }
76
+ dependencies(pkg, version) {
77
+ const found = this.packages.get(pkg);
78
+ if (found === undefined || !this.answersFor(pkg, version)) {
79
+ return undefined;
80
+ }
81
+ return [...found.deps ?? []];
82
+ }
83
+ packageNames() {
84
+ return [...this.packages.keys()];
85
+ }
86
+ isBaseR(pkg) {
87
+ return (0, r_base_packages_1.baseRPackages)().includes(pkg);
88
+ }
89
+ downloads(pkg) {
90
+ return this.packages.get(pkg)?.downloads ?? 0;
91
+ }
92
+ /** the R releases a base package shipped with are a property of the database, which this source has none of */
93
+ coreVersions() {
94
+ return undefined;
95
+ }
96
+ releaseDate(pkg) {
97
+ return this.packages.get(pkg)?.released;
98
+ }
99
+ releaseDates(pkg) {
100
+ const version = this.latestVersion(pkg);
101
+ const date = this.releaseDate(pkg);
102
+ return version === undefined || date === undefined ? [] : [{ version, date }];
103
+ }
104
+ latestVersion(pkg) {
105
+ const known = this.versionOf(pkg);
106
+ return known === UnknownVersion ? undefined : r_version_1.RVersion.parse(known);
107
+ }
108
+ /** nothing is held open */
109
+ close() {
110
+ /* nothing to release */
111
+ }
112
+ /** whether the package answers a lookup for `version`, which an unversioned one always does */
113
+ answersFor(pkg, version) {
114
+ return version === undefined || this.versionOf(pkg) === UnknownVersion || this.versionOf(pkg) === version;
115
+ }
116
+ versionOf(pkg) {
117
+ return this.packages.get(pkg)?.version ?? UnknownVersion;
118
+ }
119
+ }
120
+ exports.MemorySignatureSource = MemorySignatureSource;
121
+ /**
122
+ * A {@link MemorySignatureSource} from what a page can carry: `package -> [version, release date, ...exports]`.
123
+ * The version is what the exports were read from, so recording it is what keeps a consumer from being told
124
+ * the package is unknown when only its history is.
125
+ */
126
+ function memorySourceOfPackages(packages) {
127
+ return new MemorySignatureSource(Object.fromEntries(Object.entries(packages).map(([pkg, [version = '', released = '', ...exported]]) => [pkg, {
128
+ exported,
129
+ version: version.length > 0 ? version : undefined,
130
+ released: released.length > 0 ? new Date(released) : undefined
131
+ }])));
132
+ }
133
+ //# sourceMappingURL=memory-source.js.map
@@ -17,9 +17,9 @@ exports.verifyShardedDatabase = verifyShardedDatabase;
17
17
  * whole-bundle reading, and the post-write verification gate. This is the surface the package-version plugin
18
18
  * uses; the format/codec/writer building blocks live in the sibling `sigdb/*` modules (imported directly).
19
19
  */
20
- const node_fs_1 = __importDefault(require("node:fs"));
21
- const node_path_1 = __importDefault(require("node:path"));
22
- const node_readline_1 = __importDefault(require("node:readline"));
20
+ const fs_1 = __importDefault(require("fs"));
21
+ const path_1 = __importDefault(require("path"));
22
+ const readline_1 = __importDefault(require("readline"));
23
23
  const r_version_1 = require("../../util/r-version");
24
24
  const schema_1 = require("./schema");
25
25
  const sigdb_version_1 = require("./sigdb-version");
@@ -52,7 +52,7 @@ function readDictSection(buf, strings) {
52
52
  }
53
53
  /** stream-read a whole bundle into a {@link SigDb} (any size; never one string). Prefer {@link SigDatabase} for partial access. */
54
54
  async function readSignatureDb(file) {
55
- const rl = node_readline_1.default.createInterface({ input: (0, decompress_1.sigDbStream)(file), crlfDelay: Infinity });
55
+ const rl = readline_1.default.createInterface({ input: (0, decompress_1.sigDbStream)(file), crlfDelay: Infinity });
56
56
  let header;
57
57
  const strings = [];
58
58
  const blobs = [];
@@ -316,9 +316,9 @@ class SigDatabase {
316
316
  throw new Error('SigDatabase.openSync needs the plain .sigs.ndjson; use open() for .br/.zst/.gz');
317
317
  }
318
318
  const index = opts.index ?? (0, index_format_1.readSigDbIndex)(plainFile);
319
- const fd = node_fs_1.default.openSync(plainFile, 'r');
319
+ const fd = fs_1.default.openSync(plainFile, 'r');
320
320
  const head = Buffer.allocUnsafe(Math.min(65536, index.byteCount));
321
- node_fs_1.default.readSync(fd, head, 0, head.length, 0);
321
+ fs_1.default.readSync(fd, head, 0, head.length, 0);
322
322
  const header = (0, decompress_1.parseHeader)(head.toString('utf8'));
323
323
  let strings = opts.strings;
324
324
  if (!strings) {
@@ -326,7 +326,7 @@ class SigDatabase {
326
326
  const [dictStart, dictBytes] = index.dict;
327
327
  if (dictBytes > 0) {
328
328
  const buf = Buffer.allocUnsafe(dictBytes);
329
- node_fs_1.default.readSync(fd, buf, 0, dictBytes, dictStart);
329
+ fs_1.default.readSync(fd, buf, 0, dictBytes, dictStart);
330
330
  readDictSection(buf, strings);
331
331
  }
332
332
  }
@@ -427,7 +427,7 @@ class SigDatabase {
427
427
  /** seek to a byte range, read + decode the package blob there (no caching) */
428
428
  readBlobAt([start, bytes]) {
429
429
  const buf = Buffer.allocUnsafe(bytes);
430
- node_fs_1.default.readSync(this.fd, buf, 0, bytes, start);
430
+ fs_1.default.readSync(this.fd, buf, 0, bytes, start);
431
431
  const [, , tuple] = JSON.parse(buf.toString('utf8'));
432
432
  return (0, decode_1.tupleToBlob)(tuple);
433
433
  }
@@ -469,7 +469,7 @@ class SigDatabase {
469
469
  return [];
470
470
  }
471
471
  const found = [];
472
- for (const pkg of this.packageNames()) {
472
+ for (const pkg in this.index.pkgs) {
473
473
  if (this.mayOffer(pkg, name) && this.lookup(pkg)?.exported.includes(name)) {
474
474
  found.push(pkg);
475
475
  }
@@ -592,7 +592,7 @@ class SigDatabase {
592
592
  this.blobCache.clear();
593
593
  this.classIndex = undefined;
594
594
  if (this.fd !== NoFile) {
595
- node_fs_1.default.closeSync(this.fd);
595
+ fs_1.default.closeSync(this.fd);
596
596
  }
597
597
  }
598
598
  }
@@ -636,7 +636,7 @@ class SigDatabaseSet {
636
636
  }
637
637
  /** read + validate a manifest and apply the include/exclude shard filter */
638
638
  static prepManifest(manifestFile, opts) {
639
- const baseDir = node_path_1.default.dirname(manifestFile);
639
+ const baseDir = path_1.default.dirname(manifestFile);
640
640
  const full = (0, manifest_1.readManifestFile)(manifestFile);
641
641
  if (full.format !== manifest_1.SigDbManifestMagic) {
642
642
  throw new Error(`not a ${manifest_1.SigDbManifestMagic} (got ${String(full.format)})`);
@@ -698,15 +698,15 @@ class SigDatabaseSet {
698
698
  }
699
699
  const plain = (0, decompress_1.ensurePlainSync)((0, decompress_1.resolveSource)(this.baseDir, ref.path), { cacheDir: this.cacheDir, hash: ref.hash, indexless: true });
700
700
  const strings = [];
701
- const fd = node_fs_1.default.openSync(plain, 'r');
701
+ const fd = fs_1.default.openSync(plain, 'r');
702
702
  try {
703
703
  const [start, bytes] = ref.range;
704
704
  const buf = Buffer.allocUnsafe(bytes);
705
- node_fs_1.default.readSync(fd, buf, 0, bytes, start);
705
+ fs_1.default.readSync(fd, buf, 0, bytes, start);
706
706
  readDictSection(buf, strings);
707
707
  }
708
708
  finally {
709
- node_fs_1.default.closeSync(fd);
709
+ fs_1.default.closeSync(fd);
710
710
  }
711
711
  this.dictCache.set(dictId, strings);
712
712
  return strings;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms and
3
- * data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
2
+ * On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms,
3
+ * and data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
4
4
  * operates on these lives in `./sigdb` (which re-exports this module, so `./sigdb` stays the single entry point).
5
5
  */
6
6
  /** The definition location of the binding, with a file path usually relative to the package project root. */
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
- * On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms and
4
- * data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
3
+ * On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms,
4
+ * and data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
5
5
  * operates on these lives in `./sigdb` (which re-exports this module, so `./sigdb` stays the single entry point).
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -132,7 +132,7 @@ function retrieveAllCallAliases(nodeId, graph) {
132
132
  continue;
133
133
  }
134
134
  const [info, outgoing] = vertex;
135
- if (info.tag !== vertex_1.VertexType.FunctionCall) {
135
+ if (!vertex_1.FunctionCallVertex.is(info)) {
136
136
  const wantedTypes = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall;
137
137
  const x = outgoing.entries()
138
138
  .filter(([, e]) => edge_1.DfEdge.includesType(e, wantedTypes))
@@ -10,12 +10,12 @@ const graph_1 = require("../../../dataflow/graph/graph");
10
10
  const simple_visitor_1 = require("../../../control-flow/simple-visitor");
11
11
  const vertex_1 = require("../../../dataflow/graph/vertex");
12
12
  const edge_1 = require("../../../dataflow/graph/edge");
13
- const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
14
13
  const identifier_1 = require("../../../dataflow/environments/identifier");
15
14
  const assert_1 = require("../../../util/assert");
16
15
  const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
17
16
  const cascade_action_1 = require("./cascade-action");
18
17
  const cfg_kind_1 = require("../../../project/cfg-kind");
18
+ const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
19
19
  var CallTargets;
20
20
  (function (CallTargets) {
21
21
  /** call targets a function that is not defined locally in the script (e.g., the call targets a library function) */
@@ -55,7 +55,7 @@ function satisfiesCallTargets(info, graph, callTarget) {
55
55
  * for performance and scoping reasons, flowR will not identify the global linkage,
56
56
  * including any potential built-in mapping.
57
57
  */
58
- const reResolved = (0, resolve_by_name_1.resolveByNameAnyType)(info.name, info.environment);
58
+ const reResolved = resolve_helper_1.Resolve.byName(info.name, info.environment);
59
59
  if (reResolved?.some(t => node_id_1.NodeId.isBuiltIn(t.definedAt))) {
60
60
  builtIn = true;
61
61
  }
@@ -242,7 +242,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
242
242
  }
243
243
  // collect this one!
244
244
  const vertex = data.dataflow.graph.getVertex(linkedId.id);
245
- if (vertex?.tag !== vertex_1.VertexType.FunctionCall) {
245
+ if (!vertex_1.FunctionCallVertex.is(vertex)) {
246
246
  continue;
247
247
  }
248
248
  const args = (0, resolve_argument_1.getArgumentStringValue)(data.config.solver.variables, data.dataflow.graph, vertex, info.argIdx, info.argName, info.resolveValue, data.ctx);
@@ -261,7 +261,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
261
261
  }
262
262
  function getFunctionsToCheck(customFunctions, functionFlag, enabled, ignoreDefaultFunctions, defaultFunctions) {
263
263
  // "If unset or empty, all function types are searched for."
264
- if (enabled !== undefined && (enabled?.length === 0 || enabled.indexOf(functionFlag) < 0)) {
264
+ if (enabled !== undefined && (enabled?.length === 0 || !enabled.includes(functionFlag))) {
265
265
  return [];
266
266
  }
267
267
  let functions = ignoreDefaultFunctions ? [] : defaultFunctions.slice();
@@ -101,7 +101,7 @@ exports.DefaultDependencyCategories = {
101
101
  continue;
102
102
  }
103
103
  const vertex = dataflow.graph.getVertex(statement.info.id);
104
- const functionName = vertex?.tag === vertex_1.VertexType.FunctionCall
104
+ const functionName = vertex_1.FunctionCallVertex.is(vertex)
105
105
  ? df_helper_1.Dataflow.qualify(statement.info.id, dataflow.graph, false) ?? vertex.name : undefined;
106
106
  if (functionName === undefined) {
107
107
  continue;
@@ -4,16 +4,10 @@ exports.linkPlotsToDevices = linkPlotsToDevices;
4
4
  const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
5
5
  const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
6
6
  const vertex_1 = require("../../../dataflow/graph/vertex");
7
- const df_helper_1 = require("../../../dataflow/graph/df-helper");
8
7
  const range_1 = require("../../../util/range");
9
8
  /** the {@link CallProp} bits of the call `id` makes */
10
- function propsOf(id, { graph, environment }) {
11
- const vertex = graph.getVertex(id);
12
- if (vertex?.tag !== vertex_1.VertexType.FunctionCall) {
13
- return 0;
14
- }
15
- const name = df_helper_1.Dataflow.qualify(id, graph, false) ?? vertex.name;
16
- return (0, query_fn_props_1.queryFnProps)(name, { environment: vertex.environment ?? environment })?.props ?? 0;
9
+ function propsOf(id, dataflow) {
10
+ return (0, query_fn_props_1.callFnProps)(id, dataflow)?.props ?? 0;
17
11
  }
18
12
  /**
19
13
  * Names the file each visualization lands in, and the statements that build it.
@@ -32,7 +26,7 @@ function linkPlotsToDevices(written, plots, dataflow, ast) {
32
26
  .filter(w => w.value !== undefined && (propsOf(w.nodeId, dataflow) & built_in_props_1.CallProp.Graphics) !== 0)
33
27
  .map(w => [w.nodeId, w.value]));
34
28
  const closed = new Set(dataflow.graph.vertices(true)
35
- .filter(([id, v]) => v.tag === vertex_1.VertexType.FunctionCall && (propsOf(id, dataflow) & built_in_props_1.CallProp.Closes) !== 0)
29
+ .filter(([id, v]) => vertex_1.FunctionCallVertex.is(v) && (propsOf(id, dataflow) & built_in_props_1.CallProp.Closes) !== 0)
36
30
  .map(([id]) => id));
37
31
  const plotAt = new Map(plots.map((p, index) => [p.nodeId, index]));
38
32
  const located = [...opened.keys(), ...closed, ...plotAt.keys()]