@eagleoutice/flowr 2.14.0 → 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 (96) hide show
  1. package/README.md +39 -28
  2. package/benchmark/calibration.d.ts +13 -11
  3. package/benchmark/calibration.js +25 -26
  4. package/benchmark/slicer.d.ts +2 -1
  5. package/benchmark/slicer.js +6 -3
  6. package/cli/benchmark-app.js +4 -1
  7. package/cli/benchmark-helper-app.d.ts +1 -0
  8. package/cli/benchmark-helper-app.js +2 -2
  9. package/cli/common/options.d.ts +5 -0
  10. package/cli/common/options.js +1 -0
  11. package/cli/common/scripts-info.d.ts +5 -0
  12. package/cli/repl/execute.d.ts +2 -2
  13. package/cli/repl/execute.js +2 -2
  14. package/config.js +5 -6
  15. package/dataflow/environments/apply-kill.js +1 -1
  16. package/dataflow/environments/built-in-props.d.ts +6 -2
  17. package/dataflow/environments/built-in-props.js +5 -1
  18. package/dataflow/environments/default-builtin-config.d.ts +76 -1
  19. package/dataflow/environments/default-builtin-config.js +30 -5
  20. package/dataflow/environments/environment.d.ts +9 -1
  21. package/dataflow/environments/environment.js +25 -7
  22. package/dataflow/environments/identifier.d.ts +1 -0
  23. package/dataflow/environments/query-fn-props.d.ts +6 -0
  24. package/dataflow/environments/query-fn-props.js +20 -0
  25. package/dataflow/environments/resolve-by-name.js +14 -2
  26. package/dataflow/eval/resolve/resolve-operators.js +1 -1
  27. package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
  28. package/dataflow/eval/resolve/resolve-working-directory.js +1 -2
  29. package/dataflow/fn/exceptions-of-function.d.ts +3 -1
  30. package/dataflow/fn/exceptions-of-function.js +85 -38
  31. package/dataflow/fn/strict-function.d.ts +40 -0
  32. package/dataflow/fn/strict-function.js +337 -0
  33. package/dataflow/graph/df-helper.d.ts +9 -1
  34. package/dataflow/graph/df-helper.js +19 -3
  35. package/dataflow/graph/graph.d.ts +28 -2
  36. package/dataflow/graph/graph.js +59 -2
  37. package/dataflow/info.d.ts +26 -0
  38. package/dataflow/info.js +28 -1
  39. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -0
  40. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +27 -1
  41. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
  42. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -8
  43. package/documentation/wiki-core.js +1 -1
  44. package/documentation/wiki-dataflow-graph.js +1 -0
  45. package/documentation/wiki-linter.js +1 -0
  46. package/documentation/wiki-query.js +53 -0
  47. package/linter/linter-output.js +1 -1
  48. package/linter/linter-rules.d.ts +24 -0
  49. package/linter/linter-rules.js +3 -1
  50. package/linter/rules/network-functions.d.ts +1 -1
  51. package/linter/rules/unclosed-connection.d.ts +44 -0
  52. package/linter/rules/unclosed-connection.js +200 -0
  53. package/package.json +4 -7
  54. package/project/dependency-version-space.d.ts +3 -3
  55. package/project/dependency-version-space.js +2 -2
  56. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
  57. package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
  58. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
  59. package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
  60. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
  61. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
  62. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +1 -1
  63. package/project/plugins/file-plugins/files/flowr-rda-file.js +1 -1
  64. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
  65. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +33 -6
  66. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
  67. package/project/sigdb/manifest.d.ts +3 -1
  68. package/project/sigdb/manifest.js +50 -9
  69. package/project/sigdb/reader.js +1 -1
  70. package/project/sigdb/schema.d.ts +2 -2
  71. package/project/sigdb/schema.js +2 -2
  72. package/queries/catalog/dependencies-query/link-devices.js +2 -8
  73. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -1
  74. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
  75. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
  76. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
  77. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
  78. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
  79. package/queries/catalog/slice-query-options.d.ts +1 -1
  80. package/queries/catalog/slice-query-options.js +1 -1
  81. package/queries/query-function-filter.d.ts +8 -2
  82. package/queries/query-function-filter.js +11 -1
  83. package/queries/query.d.ts +11 -1
  84. package/queries/query.js +2 -0
  85. package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
  86. package/r-bridge/lang-4.x/ast/model/model.js +4 -4
  87. package/search/flowr-search-filters.js +1 -13
  88. package/slicing/criterion/parse.d.ts +2 -2
  89. package/slicing/criterion/parse.js +2 -2
  90. package/slicing/static/fingerprint.js +1 -1
  91. package/util/objects.d.ts +12 -0
  92. package/util/objects.js +48 -0
  93. package/util/simple-df/dfg-ascii.js +14 -3
  94. package/util/text/name-rank.d.ts +1 -1
  95. package/util/text/name-rank.js +1 -1
  96. package/util/version.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -187,7 +187,7 @@
187
187
  "@commitlint/cli": "^20.5.0",
188
188
  "@commitlint/config-angular": "^20.5.0",
189
189
  "@eagleoutice/eslint-config-flowr": "^2.1.1",
190
- "@j-ulrich/release-it-regex-bumper": "^5.4.0",
190
+ "@j-ulrich/release-it-regex-bumper": "^5.6.0",
191
191
  "@types/command-line-args": "^5.2.3",
192
192
  "@types/command-line-usage": "^5.0.4",
193
193
  "@types/commonmark": "^0.27.10",
@@ -195,7 +195,6 @@
195
195
  "@types/n-readlines": "^1.0.6",
196
196
  "@types/n3": "^1.26.0",
197
197
  "@types/object-hash": "^3.0.6",
198
- "@types/object-path": "^0.11.4",
199
198
  "@types/seedrandom": "^3.0.8",
200
199
  "@types/semver": "^7.7.0",
201
200
  "@types/tmp": "^0.2.6",
@@ -205,7 +204,7 @@
205
204
  "esbuild": "^0.28.1",
206
205
  "eslint": "^10.8.0",
207
206
  "license-checker-rseidelsohn": "^4.4.2",
208
- "release-it": "^20.0.0",
207
+ "release-it": "^21.0.2",
209
208
  "seedrandom": "^3.0.5",
210
209
  "ts-node": "^10.9.2",
211
210
  "typedoc": "^0.28.17",
@@ -217,19 +216,16 @@
217
216
  "dependencies": {
218
217
  "@davisvaughan/tree-sitter-r": "^1.2.0",
219
218
  "@jupyterlab/nbformat": "^4.5.4",
220
- "@xmldom/xmldom": "^0.9.7",
221
219
  "bzip2": "^0.1.1",
222
220
  "command-line-args": "^6.0.1",
223
221
  "command-line-usage": "^7.0.3",
224
222
  "commonmark": "^0.31.2",
225
- "dagre": "^0.8.5",
226
223
  "gray-matter": "^4.0.3",
227
224
  "ignore": "^5.3.2",
228
225
  "joi": "^18.0.1",
229
226
  "lz-string": "^1.5.0",
230
227
  "n-readlines": "^3.4.1",
231
228
  "object-hash": "^3.0.0",
232
- "object-path": "^0.11.8",
233
229
  "object-sizeof": "^2.6.5",
234
230
  "semver": "^7.7.4",
235
231
  "smol-toml": "^1.7.0",
@@ -248,6 +244,7 @@
248
244
  },
249
245
  "optionalDependencies": {
250
246
  "clipboardy": "^4.0.0",
247
+ "dagre": "^0.8.5",
251
248
  "n3": "^1.26.0",
252
249
  "rotating-file-stream": "^3.2.8"
253
250
  }
@@ -204,7 +204,7 @@ export interface VersionSpaceOptions {
204
204
  /** constraint sources to skip entirely: neither filtered on nor reported */
205
205
  readonly disabled?: ReadonlySet<ConstraintSource>;
206
206
  }
207
- /** a target's sigdb package key, merged source and memoized signature resolver */
207
+ /** a target's sigdb package key, merged source, and memoized signature resolver */
208
208
  interface PackageResolution {
209
209
  readonly key: string;
210
210
  readonly src: PackageSignatureSource | undefined;
@@ -219,7 +219,7 @@ interface PackageResolution {
219
219
  /**
220
220
  * The version space of one analysis: the surviving versions of each dependency and the transitive constraints
221
221
  * refined to a fixpoint. Holding the shared inputs here keeps the passes to a handful of arguments and lets each
222
- * package's sigdb key, source and decoded signatures be resolved once. The passes revisit the same versions
222
+ * package's sigdb key, source, and decoded signatures be resolved once. The passes revisit the same versions
223
223
  * repeatedly, so that memoization is what makes the fixpoint affordable.
224
224
  */
225
225
  export declare class VersionSpace {
@@ -231,7 +231,7 @@ export declare class VersionSpace {
231
231
  readonly disabled: ReadonlySet<ConstraintSource>;
232
232
  private readonly resolved;
233
233
  constructor({ deps, usage, cutoff, rVersion, disabled }: VersionSpaceOptions);
234
- /** the sigdb package, source and signature resolver of a target, resolved once */
234
+ /** the sigdb package, source, and signature resolver of a target, resolved once */
235
235
  resolve(name: string): PackageResolution;
236
236
  /** the versions of `name` surviving every constraint, see {@link survivingEntries} */
237
237
  survivors(name: string, transitive: readonly TransitiveConstraint[], observe?: ConstraintObserver): SurvivingEntries;
@@ -529,7 +529,7 @@ function makeSignatureFilter(src, pkg, getFn, timeline, usage) {
529
529
  /**
530
530
  * The version space of one analysis: the surviving versions of each dependency and the transitive constraints
531
531
  * refined to a fixpoint. Holding the shared inputs here keeps the passes to a handful of arguments and lets each
532
- * package's sigdb key, source and decoded signatures be resolved once. The passes revisit the same versions
532
+ * package's sigdb key, source, and decoded signatures be resolved once. The passes revisit the same versions
533
533
  * repeatedly, so that memoization is what makes the fixpoint affordable.
534
534
  */
535
535
  class VersionSpace {
@@ -548,7 +548,7 @@ class VersionSpace {
548
548
  this.rVersion = rVersion;
549
549
  this.disabled = disabled;
550
550
  }
551
- /** the sigdb package, source and signature resolver of a target, resolved once */
551
+ /** the sigdb package, source, and signature resolver of a target, resolved once */
552
552
  resolve(name) {
553
553
  let entry = this.resolved.get(name);
554
554
  if (entry === undefined) {
@@ -25,7 +25,7 @@ export declare class FlowrDescriptionFile extends FlowrFile<DeepReadonly<DCF>> {
25
25
  */
26
26
  protected loadContent(): DCF;
27
27
  /**
28
- * Creates a FlowrDescriptionFile from given DCF content, path and optional roles.
28
+ * Creates a FlowrDescriptionFile from given DCF content, path, and optional roles.
29
29
  * This is useful if you already have the DCF content parsed and want to create a description file instance without re-parsing.
30
30
  */
31
31
  static fromDCF(dcf: DCF, path: string, roles?: FileRole[]): FlowrDescriptionFile;
@@ -35,7 +35,7 @@ class FlowrDescriptionFile extends flowr_file_1.FlowrFile {
35
35
  return parseDCF(this.wrapped);
36
36
  }
37
37
  /**
38
- * Creates a FlowrDescriptionFile from given DCF content, path and optional roles.
38
+ * Creates a FlowrDescriptionFile from given DCF content, path, and optional roles.
39
39
  * This is useful if you already have the DCF content parsed and want to create a description file instance without re-parsing.
40
40
  */
41
41
  static fromDCF(dcf, path, roles) {
@@ -65,7 +65,7 @@ export declare function isExportedInNamespaceFormat(this: void, fmt: NamespaceFo
65
65
  * @param nsInfo - The namespace info to check in
66
66
  */
67
67
  export declare function isExportedInInfo(this: void, name: string, nsInfo: NamespaceInfo): boolean | RNode<ParentInformation>[];
68
- /** All exported names of a namespace that can be referenced (functions, symbols, patterns and S3 methods as `generic.class`). */
68
+ /** All exported names of a namespace that can be referenced (functions, symbols, patterns, and S3 methods as `generic.class`). */
69
69
  export declare function getExportedNames(info: NamespaceInfo): string[];
70
70
  /** The names a package makes callable: the explicitly configured {@link NamespaceInfo#callable} subset, or all exports (see {@link getExportedNames}) by default. */
71
71
  export declare function getCallables(info: NamespaceInfo): string[];
@@ -194,7 +194,7 @@ function parseNamespaceComplex(file, ctx) {
194
194
  }
195
195
  });
196
196
  }
197
- /** All exported names of a namespace that can be referenced (functions, symbols, patterns and S3 methods as `generic.class`). */
197
+ /** All exported names of a namespace that can be referenced (functions, symbols, patterns, and S3 methods as `generic.class`). */
198
198
  function getExportedNames(info) {
199
199
  const s3 = [];
200
200
  for (const [g, methods] of info.exportS3Generics) {
@@ -25,7 +25,7 @@ export declare class FlowrNewsFile extends FlowrFile<NewsChunk[]> {
25
25
  */
26
26
  static from(file: FlowrFileProvider | FlowrNewsFile, role?: FileRole): FlowrNewsFile;
27
27
  /**
28
- * Creates a FlowrNewsFile from given news chunks, path and optional roles. This is useful if you already have the news content parsed and want to create a news file instance without re-parsing.
28
+ * Creates a FlowrNewsFile from given news chunks, path, and optional roles. This is useful if you already have the news content parsed and want to create a news file instance without re-parsing.
29
29
  */
30
30
  static fromNewsChunks(chunks: NewsChunk[], path: string, roles?: FileRole[]): FlowrNewsFile;
31
31
  }
@@ -34,7 +34,7 @@ class FlowrNewsFile extends flowr_file_1.FlowrFile {
34
34
  return file instanceof FlowrNewsFile ? file : new FlowrNewsFile(file);
35
35
  }
36
36
  /**
37
- * Creates a FlowrNewsFile from given news chunks, path and optional roles. This is useful if you already have the news content parsed and want to create a news file instance without re-parsing.
37
+ * Creates a FlowrNewsFile from given news chunks, path, and optional roles. This is useful if you already have the news content parsed and want to create a news file instance without re-parsing.
38
38
  */
39
39
  static fromNewsChunks(chunks, path, roles) {
40
40
  const file = new FlowrNewsFile(new flowr_file_1.FlowrTextFile(path, roles));
@@ -205,7 +205,7 @@ export declare class RDAParser {
205
205
  /**
206
206
  * Parses an RDA file.
207
207
  *
208
- * The file is decompressed, deserialized and converted into a flattened
208
+ * The file is decompressed, deserialized, and converted into a flattened
209
209
  * object representation.
210
210
  * @param file - RDA file provider.
211
211
  * @param shortcut - When `true`, only names and types are collected.
@@ -197,7 +197,7 @@ class RDAParser {
197
197
  /**
198
198
  * Parses an RDA file.
199
199
  *
200
- * The file is decompressed, deserialized and converted into a flattened
200
+ * The file is decompressed, deserialized, and converted into a flattened
201
201
  * object representation.
202
202
  * @param file - RDA file provider.
203
203
  * @param shortcut - When `true`, only names and types are collected.
@@ -52,7 +52,7 @@ export declare class FlowrAnalyzerPackageVersionsSigDbPlugin extends FlowrAnalyz
52
52
  /** the `additionalPaths` the current {@link sources} were assembled with, so a later config resolves a rebuild */
53
53
  private sourcesKey;
54
54
  private analyzerCtx;
55
- /** `packagesExporting` answers, merged across the source set and self-filtered; the scan itself is {@link ExportIndex} */
55
+ /** `packagesExporting` answers, merged across the source set and self-filtered; the per-source half is {@link exportOwners} */
56
56
  private exportsByName;
57
57
  /** `pkg@assumedR` keys already reported via {@link baseVersionFor}'s fallback, so the info is logged once */
58
58
  private readonly baseFallbacksLogged;
@@ -97,10 +97,10 @@ export declare class FlowrAnalyzerPackageVersionsSigDbPlugin extends FlowrAnalyz
97
97
  /**
98
98
  * Packages in the loaded sources (respecting `self`-package exclusion) that export `name`, **most downloaded
99
99
  * first**, so whoever has to pick one (or show only a few) starts with the package a script most likely means.
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.
100
+ * Backed by {@link exportOwners}, which memoizes per *source* (and hence shares across every analyzer mounting
101
+ * the same bundle), so the repeated hint lookups of a linter run scan every package once per distinct name
102
+ * rather than once per call. Self-package exclusion is applied here rather than in that memo, which keeps the
103
+ * memo analyzer-independent.
104
104
  */
105
105
  packagesExporting(name: string): readonly string[];
106
106
  /**
@@ -112,6 +112,27 @@ function reconstructS3Generics(exported) {
112
112
  }
113
113
  /** the built {@link ExportIndex} of each source, see {@link ExportIndex.of} for why it is keyed by the source */
114
114
  const exportIndices = new WeakMap();
115
+ /**
116
+ * `name -> the packages of a source exporting it`, filled one name at a time as it is asked for and shared by
117
+ * every analyzer mounting that source. The eager {@link ExportIndex} answers the same question with no scan at
118
+ * all, but it holds every export name of the bundle (~1.1M for the shipped one); a lint run asks for a few
119
+ * hundred distinct names, so this keeps the memo proportional to what was actually asked instead.
120
+ */
121
+ const exportOwnersBySource = new WeakMap();
122
+ /** The packages of `src` exporting `name`, most downloaded first, scanning only the first time a name is asked. */
123
+ function exportOwners(src, name) {
124
+ let byName = exportOwnersBySource.get(src);
125
+ if (byName === undefined) {
126
+ byName = new Map();
127
+ exportOwnersBySource.set(src, byName);
128
+ }
129
+ let owners = byName.get(name);
130
+ if (owners === undefined) {
131
+ owners = src.packagesExporting(name);
132
+ byName.set(name, owners);
133
+ }
134
+ return owners;
135
+ }
115
136
  /**
116
137
  * The reverse `export name -> packages exporting it` view of a signature source, each entry ordered by download
117
138
  * count (descending, ties by name) so whoever has to pick one exporter starts with the package a script most
@@ -125,6 +146,10 @@ const exportIndices = new WeakMap();
125
146
  */
126
147
  exports.ExportIndex = {
127
148
  name: 'ExportIndex',
149
+ /* not what `packagesExporting` uses: building this reads every package blob of the bundle to hold every export
150
+ * name (~1.1M for the shipped one), which measured both slower and ~330MB heavier than the few hundred scans
151
+ * {@link exportOwners} does for the names a run actually asks about. Kept for a caller that needs the whole
152
+ * reverse mapping at once. */
128
153
  /** The index of `src`, built on first use and shared by every later caller; see {@link ExportIndex}. */
129
154
  of(src) {
130
155
  const cached = exportIndices.get(src);
@@ -177,7 +202,7 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
177
202
  /** the `additionalPaths` the current {@link sources} were assembled with, so a later config resolves a rebuild */
178
203
  sourcesKey;
179
204
  analyzerCtx;
180
- /** `packagesExporting` answers, merged across the source set and self-filtered; the scan itself is {@link ExportIndex} */
205
+ /** `packagesExporting` answers, merged across the source set and self-filtered; the per-source half is {@link exportOwners} */
181
206
  exportsByName = new Map();
182
207
  /** `pkg@assumedR` keys already reported via {@link baseVersionFor}'s fallback, so the info is logged once */
183
208
  baseFallbacksLogged = new Set();
@@ -306,10 +331,10 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
306
331
  /**
307
332
  * Packages in the loaded sources (respecting `self`-package exclusion) that export `name`, **most downloaded
308
333
  * first**, so whoever has to pick one (or show only a few) starts with the package a script most likely means.
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.
334
+ * Backed by {@link exportOwners}, which memoizes per *source* (and hence shares across every analyzer mounting
335
+ * the same bundle), so the repeated hint lookups of a linter run scan every package once per distinct name
336
+ * rather than once per call. Self-package exclusion is applied here rather than in that memo, which keeps the
337
+ * memo analyzer-independent.
313
338
  */
314
339
  packagesExporting(name) {
315
340
  if (!(0, config_1.isSigDbEnabled)(this.analyzerCtx?.config)) {
@@ -323,7 +348,9 @@ class FlowrAnalyzerPackageVersionsSigDbPlugin extends flowr_analyzer_package_ver
323
348
  const seen = new Set();
324
349
  const owners = [];
325
350
  for (const src of sources) {
326
- for (const pkg of src.packagesExporting(name)) {
351
+ /* memoized per source, not per analyzer: the same handful of unresolved names comes back for every
352
+ * file the linter walks, and a miss is a scan over every package of the bundle */
353
+ for (const pkg of exportOwners(src, name)) {
327
354
  if (!seen.has(pkg) && !this.isSelfPackage(pkg)) {
328
355
  seen.add(pkg);
329
356
  owners.push(pkg);
@@ -96,7 +96,7 @@ class FlowrAnalyzerFullProjectDiscoveryPlugin extends FlowrAnalyzerProjectDiscov
96
96
  }
97
97
  }
98
98
  exports.FlowrAnalyzerFullProjectDiscoveryPlugin = FlowrAnalyzerFullProjectDiscoveryPlugin;
99
- // noise directories pruned from the scoped walk on top of `ignorePathsWith`: build output, checks, rendered docs and packaged data
99
+ // noise directories pruned from the scoped walk on top of `ignorePathsWith`: build output, checks, rendered docs, and packaged data
100
100
  const noiseDirs = /(^|\/)(\.git|\.svn|\.hg|node_modules|__pycache__|\.Rproj\.user|\.uvr|[^/]*\.Rcheck|(packrat|renv|rv)\/(lib|library|src|staging|sandbox|bundles|cache)[^/]*|build|dist|_build|_site|_book|\.quarto|\.cache|Rtmp[^/]*|man|inst\/(extdata|doc))(\/|$)/i;
101
101
  // binary/data blobs, dropped even inside an otherwise kept directory
102
102
  const noiseFiles = /\.(rds|rda|rdata|rd|png|jpe?g|gif|svg|pdf|ico|zip|tar|t?gz|bz2|xz|so|o|a|dll|dylib|exe|jar|woff2?|ttf|eot|feather|parquet|xls[xm]?|docx?|pptx?)$/i;
@@ -120,7 +120,7 @@ function resolveRules(override) {
120
120
  exclude: (override?.exclude ?? []).map(glob_1.globMatcher)
121
121
  };
122
122
  }
123
- /** over-approximating default: R sources, role metadata and `tests/`/`vignettes/` count as project files */
123
+ /** over-approximating default: R sources, role metadata, and `tests/`/`vignettes/` count as project files */
124
124
  function keptByDefault(rel) {
125
125
  const base = path_1.default.basename(rel);
126
126
  return exports.discoverRSourcesRegex.test(rel) || metadataFilePatterns.some(p => p.test(base)) || testOrVignetteDir.test(rel);
@@ -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` &gt; `current` &gt; `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,6 +8,7 @@ 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
@@ -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
+ function sigDbBundleDirs(watched) {
68
69
  if (typeof fs_1.default?.readdirSync !== 'function') {
69
70
  return [];
70
71
  }
71
72
  try {
72
73
  const bundles = path_1.default.join((0, decompress_1.sigDbCacheDir)(undefined, false), 'bundles');
73
- return fs_1.default.readdirSync(bundles, { withFileTypes: true })
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
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 [];
@@ -95,7 +99,7 @@ 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.
@@ -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
@@ -150,6 +179,14 @@ function defaultSigDbPaths(searchRoots) {
150
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,14 +203,16 @@ 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 = fs_1.default.readdirSync(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 = path_1.default.join(base, sub);
177
216
  for (const file of entries) {
178
217
  if (ManifestFilePattern.test(file)) {
179
218
  keep(manifests, (0, codec_1.stripCompressedExt)(file), path_1.default.join(dir, file), dir);
@@ -184,7 +223,7 @@ function defaultSigDbPaths(searchRoots) {
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
229
  const parent = path_1.default.dirname(dir);
@@ -194,7 +233,7 @@ function defaultSigDbPaths(searchRoots) {
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
@@ -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
  }
@@ -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 });
@@ -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_1.FunctionCallVertex.is(vertex)) {
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.
@@ -25,7 +25,8 @@ async function executeExceptionQuery({ analyzer }, queries) {
25
25
  '.meta': {
26
26
  timing: Date.now() - start
27
27
  },
28
- exceptions: result
28
+ /* collecting walks whatever the call graph holds, reporting stays with the definitions someone wrote */
29
+ exceptions: Object.fromEntries(Object.entries(result).filter(([id]) => query_function_filter_1.QueryFunctionFilter.written(id)))
29
30
  };
30
31
  }
31
32
  //# sourceMappingURL=inspect-exception-query-executor.js.map
@@ -13,6 +13,7 @@ async function executeHigherOrderQuery({ analyzer }, queries) {
13
13
  const filterFor = await query_function_filter_1.QueryFunctionFilter.criteria(queries, analyzer);
14
14
  const graph = (await analyzer.dataflow()).graph;
15
15
  const fns = graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)
16
+ .filter(([id]) => query_function_filter_1.QueryFunctionFilter.written(id))
16
17
  .filter(([, v]) => filterFor.size === 0 || filterFor.has(v.id));
17
18
  let invertedGraph;
18
19
  if (filterFor.size === 0 || filterFor.size > 10) {
@@ -0,0 +1,6 @@
1
+ import type { InspectStrictnessQuery, InspectStrictnessQueryResult } from './inspect-strictness-query-format';
2
+ import type { BasicQueryData } from '../../base-query-format';
3
+ /**
4
+ * Execute strictness inspection queries on the given analyzer.
5
+ */
6
+ export declare function executeStrictnessQuery({ analyzer }: BasicQueryData, queries: readonly InspectStrictnessQuery[]): Promise<InspectStrictnessQueryResult>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeStrictnessQuery = executeStrictnessQuery;
4
+ const vertex_1 = require("../../../dataflow/graph/vertex");
5
+ const strict_function_1 = require("../../../dataflow/fn/strict-function");
6
+ const query_function_filter_1 = require("../../query-function-filter");
7
+ /**
8
+ * Execute strictness inspection queries on the given analyzer.
9
+ */
10
+ async function executeStrictnessQuery({ analyzer }, queries) {
11
+ const start = Date.now();
12
+ const filterFor = await query_function_filter_1.QueryFunctionFilter.criteria(queries, analyzer);
13
+ const graph = (await analyzer.dataflow()).graph;
14
+ const fns = graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)
15
+ .filter(([id]) => query_function_filter_1.QueryFunctionFilter.written(id))
16
+ .filter(([id]) => filterFor.size === 0 || filterFor.has(id))
17
+ .map(([id]) => id);
18
+ return {
19
+ '.meta': {
20
+ timing: Date.now() - start
21
+ },
22
+ strictness: (0, strict_function_1.strictnessOfFunctions)(fns, graph, analyzer.inspectContext())
23
+ };
24
+ }
25
+ //# sourceMappingURL=inspect-strictness-query-executor.js.map
@@ -0,0 +1,31 @@
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import Joi from 'joi';
3
+ import type { ParsedQueryLine } from '../../query';
4
+ import { executeStrictnessQuery } from './inspect-strictness-query-executor';
5
+ import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
6
+ import type { SlicingCriterion } from '../../../slicing/criterion/parse';
7
+ import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
8
+ import type { FlowrConfig } from '../../../config';
9
+ import type { FunctionStrictness } from '../../../dataflow/fn/strict-function';
10
+ /**
11
+ * Either returns all function definitions alongside whether they are strict,
12
+ * or just those matching the filters.
13
+ */
14
+ export interface InspectStrictnessQuery extends BaseQueryFormat {
15
+ readonly type: 'inspect-strictness';
16
+ readonly filter?: SlicingCriterion[];
17
+ }
18
+ export interface InspectStrictnessQueryResult extends BaseQueryResult {
19
+ readonly strictness: Record<NodeId, FunctionStrictness>;
20
+ }
21
+ declare function inspectStrictLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'inspect-strictness'>;
22
+ export declare const InspectStrictnessQueryDefinition: {
23
+ readonly title: "Inspect Strict Functions Query";
24
+ readonly executor: typeof executeStrictnessQuery;
25
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, processed: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
26
+ readonly fromLine: typeof inspectStrictLineParser;
27
+ readonly syntax: "@inspect-strictness [(<crit>;...)] <code | file://path>";
28
+ readonly schema: Joi.ObjectSchema<any>;
29
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
30
+ };
31
+ export {};