@eagleoutice/flowr 2.13.15 → 2.14.0

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 (225) hide show
  1. package/README.md +31 -37
  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/abstract-interpretation/unsupported-functions.d.ts +1 -0
  10. package/abstract-interpretation/unsupported-functions.js +1 -0
  11. package/benchmark/calibration.d.ts +12 -5
  12. package/benchmark/calibration.js +42 -14
  13. package/benchmark/slicer.d.ts +1 -1
  14. package/benchmark/slicer.js +5 -4
  15. package/benchmark/stats/size-of.js +1 -1
  16. package/benchmark/summarizer/first-phase/process.d.ts +2 -0
  17. package/benchmark/summarizer/first-phase/process.js +2 -0
  18. package/cli/common/options.d.ts +0 -31
  19. package/cli/common/options.js +1 -8
  20. package/cli/common/scripts-info.d.ts +0 -38
  21. package/cli/common/scripts-info.js +0 -8
  22. package/cli/repl/commands/repl-query.js +37 -2
  23. package/cli/repl/core.js +6 -3
  24. package/cli/repl/parser/slice-query-parser.js +1 -1
  25. package/cli/repl/print-version.js +2 -2
  26. package/config.d.ts +16 -0
  27. package/config.js +79 -0
  28. package/control-flow/control-flow-graph.d.ts +2 -0
  29. package/control-flow/control-flow-graph.js +2 -0
  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/built-in-props.d.ts +8 -1
  38. package/dataflow/environments/built-in-props.js +18 -0
  39. package/dataflow/environments/built-in.d.ts +7 -1
  40. package/dataflow/environments/built-in.js +42 -3
  41. package/dataflow/environments/default-builtin-config.d.ts +442 -10
  42. package/dataflow/environments/default-builtin-config.js +188 -18
  43. package/dataflow/environments/environment.d.ts +1 -1
  44. package/dataflow/environments/identifier.d.ts +7 -2
  45. package/dataflow/environments/identifier.js +6 -1
  46. package/dataflow/environments/query-fn-props.js +2 -2
  47. package/dataflow/environments/reference-to-maybe.js +5 -5
  48. package/dataflow/environments/resolve-by-name.d.ts +3 -0
  49. package/dataflow/environments/resolve-by-name.js +30 -5
  50. package/dataflow/environments/resolve-helper.d.ts +6 -0
  51. package/dataflow/environments/resolve-helper.js +6 -0
  52. package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
  53. package/dataflow/eval/resolve/alias-tracking.js +21 -14
  54. package/dataflow/eval/resolve/node-value.d.ts +6 -0
  55. package/dataflow/eval/resolve/node-value.js +15 -9
  56. package/dataflow/eval/resolve/resolve-argument.js +2 -2
  57. package/dataflow/eval/resolve/resolve-numbers.js +2 -2
  58. package/dataflow/eval/resolve/resolve-operators.js +4 -3
  59. package/dataflow/eval/resolve/resolve-strings.js +3 -3
  60. package/dataflow/eval/resolve/resolve-working-directory.js +2 -1
  61. package/dataflow/eval/resolve/resolve.d.ts +5 -5
  62. package/dataflow/eval/resolve/resolve.js +10 -11
  63. package/dataflow/eval/values/general.d.ts +4 -1
  64. package/dataflow/eval/values/general.js +4 -1
  65. package/dataflow/extractor.js +2 -1
  66. package/dataflow/fn/exceptions-of-function.js +5 -4
  67. package/dataflow/fn/higher-order-function.d.ts +1 -1
  68. package/dataflow/fn/higher-order-function.js +22 -2
  69. package/dataflow/graph/call-graph.d.ts +1 -1
  70. package/dataflow/graph/call-graph.js +15 -15
  71. package/dataflow/graph/df-helper.d.ts +17 -2
  72. package/dataflow/graph/df-helper.js +11 -5
  73. package/dataflow/graph/diff-dataflow-graph.js +6 -6
  74. package/dataflow/graph/edge.d.ts +27 -0
  75. package/dataflow/graph/edge.js +33 -0
  76. package/dataflow/graph/graph-helper.d.ts +4 -4
  77. package/dataflow/graph/graph-helper.js +5 -5
  78. package/dataflow/graph/graph.d.ts +11 -1
  79. package/dataflow/graph/graph.js +16 -5
  80. package/dataflow/graph/vertex.d.ts +47 -6
  81. package/dataflow/graph/vertex.js +47 -6
  82. package/dataflow/internal/linker.d.ts +1 -0
  83. package/dataflow/internal/linker.js +11 -9
  84. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  85. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  86. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
  87. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
  88. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
  89. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
  90. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
  91. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
  92. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
  93. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  94. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
  95. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  96. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
  97. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
  98. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
  99. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
  100. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
  101. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  102. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  103. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +8 -2
  104. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
  106. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
  107. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -12
  108. package/dataflow/internal/process/functions/call/common.d.ts +9 -1
  109. package/dataflow/internal/process/functions/call/common.js +17 -6
  110. package/dataflow/internal/process/functions/call/deferred.d.ts +7 -0
  111. package/dataflow/internal/process/functions/call/deferred.js +24 -1
  112. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
  113. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
  114. package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
  115. package/dataflow/internal/process/functions/call/nse.d.ts +34 -5
  116. package/dataflow/internal/process/functions/call/nse.js +114 -6
  117. package/dataflow/internal/process/functions/call/quoted.d.ts +6 -0
  118. package/dataflow/internal/process/functions/call/quoted.js +26 -11
  119. package/dataflow/origin/dfg-get-origin.d.ts +1 -0
  120. package/dataflow/origin/dfg-get-origin.js +9 -6
  121. package/documentation/data/faq/faqs.js +88 -88
  122. package/documentation/data/faq/recommended-configs.js +1 -1
  123. package/documentation/data/faq/wiki-faq-store.js +1 -1
  124. package/documentation/doc-capabilities.js +1 -1
  125. package/documentation/doc-readme.js +1 -1
  126. package/documentation/doc-util/doc-auto-gen.js +6 -2
  127. package/documentation/doc-util/doc-functions.js +1 -1
  128. package/documentation/wiki-cfg.js +2 -2
  129. package/documentation/wiki-create-linting-rules.js +45 -45
  130. package/documentation/wiki-dataflow-graph.js +25 -18
  131. package/documentation/wiki-linting-and-testing.js +93 -5
  132. package/documentation/wiki-mk/doc-maker.js +1 -1
  133. package/documentation/wiki-overview.js +12 -1
  134. package/documentation/wiki-signature-database.js +3 -0
  135. package/linter/linter-format.d.ts +1 -0
  136. package/linter/linter-format.js +1 -0
  137. package/linter/rules/file-path-validity.js +1 -1
  138. package/linter/rules/function-finder-util.js +1 -1
  139. package/linter/rules/naming-convention.js +1 -1
  140. package/linter/rules/no-leaked-credentials.js +2 -1
  141. package/linter/rules/stop-with-call-arg.js +4 -4
  142. package/linter/rules/undefined-symbol-util.d.ts +1 -1
  143. package/linter/rules/undefined-symbol-util.js +5 -4
  144. package/linter/rules/undefined-symbol.js +3 -3
  145. package/linter/rules/unused-definition.js +2 -1
  146. package/package.json +35 -45
  147. package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
  148. package/project/context/flowr-analyzer-environment-context.js +25 -0
  149. package/project/dependency-version-space.js +1 -2
  150. package/project/flowr-analyzer.js +1 -1
  151. package/project/plugins/file-plugins/files/flowr-rda-file.js +3 -3
  152. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
  153. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +3 -1
  154. package/project/sigdb/build.js +16 -16
  155. package/project/sigdb/codec.d.ts +1 -1
  156. package/project/sigdb/codec.js +13 -13
  157. package/project/sigdb/decompress.d.ts +1 -1
  158. package/project/sigdb/decompress.js +33 -33
  159. package/project/sigdb/index-format.js +2 -2
  160. package/project/sigdb/manifest.js +21 -21
  161. package/project/sigdb/memory-source.d.ts +64 -0
  162. package/project/sigdb/memory-source.js +133 -0
  163. package/project/sigdb/reader.js +13 -13
  164. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  165. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  166. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
  167. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  168. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  169. package/queries/catalog/dependencies-query/link-devices.js +2 -2
  170. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
  171. package/queries/catalog/does-call-query/does-call-query-format.js +2 -1
  172. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -1
  173. package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
  174. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -1
  175. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
  176. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
  177. package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
  178. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  179. package/queries/catalog/provenance-query/provenance-query-format.js +1 -1
  180. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  181. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  182. package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
  183. package/queries/catalog/signature-query/signature-query-executor.js +3 -2
  184. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  185. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  186. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
  187. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  188. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  189. package/r-bridge/retriever.d.ts +2 -1
  190. package/r-bridge/retriever.js +3 -2
  191. package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
  192. package/r-bridge/roxygen2/documentation-provider.js +1 -0
  193. package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
  194. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  195. package/search/flowr-search-filters.d.ts +1 -1
  196. package/search/flowr-search-filters.js +2 -2
  197. package/search/search-executor/search-enrichers.js +4 -4
  198. package/search/search-executor/search-generators.js +1 -1
  199. package/slicing/criterion/parse.d.ts +1 -0
  200. package/slicing/criterion/parse.js +4 -3
  201. package/slicing/static/slice-call.d.ts +1 -1
  202. package/slicing/static/slice-call.js +2 -2
  203. package/slicing/static/static-slicer.js +4 -3
  204. package/util/assert.js +1 -1
  205. package/util/log.d.ts +4 -1
  206. package/util/log.js +15 -2
  207. package/util/logic.js +2 -2
  208. package/util/mermaid/cfg.js +1 -1
  209. package/util/mermaid/dfg.js +6 -6
  210. package/util/mermaid/mermaid.js +3 -1
  211. package/util/quads.js +19 -6
  212. package/util/r-version.d.ts +2 -0
  213. package/util/r-version.js +2 -0
  214. package/util/record.d.ts +1 -0
  215. package/util/record.js +1 -0
  216. package/util/schema.js +2 -2
  217. package/util/text/ansi.d.ts +2 -0
  218. package/util/text/ansi.js +8 -0
  219. package/util/text/name-rank.d.ts +29 -0
  220. package/util/text/name-rank.js +39 -0
  221. package/util/text/url-encoding.d.ts +15 -0
  222. package/util/text/url-encoding.js +59 -0
  223. package/util/version.js +1 -1
  224. package/cli/export-quads-app.d.ts +0 -7
  225. package/cli/export-quads-app.js +0 -44
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.WikiLintingAndTesting = void 0;
4
7
  const log_1 = require("../util/log");
@@ -6,7 +9,19 @@ const doc_code_1 = require("./doc-util/doc-code");
6
9
  const doc_files_1 = require("./doc-util/doc-files");
7
10
  const doc_structure_1 = require("./doc-util/doc-structure");
8
11
  const doc_cli_option_1 = require("./doc-util/doc-cli-option");
12
+ const patterns_1 = __importDefault(require("@eagleoutice/eslint-config-flowr/patterns"));
13
+ const edge_1 = require("../dataflow/graph/edge");
14
+ const resolve_helper_1 = require("../dataflow/environments/resolve-helper");
15
+ const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
9
16
  const doc_maker_1 = require("./wiki-mk/doc-maker");
17
+ /** the default patterns of `flowr/replacement-pattern`, rendered so the wiki cannot drift from the configuration */
18
+ /** two of the default patterns, kept generated so the wiki cannot drift from the configuration */
19
+ function patternExamples() {
20
+ const shown = ['edge-is-only-type', 'vertex-is'];
21
+ const cell = (text) => text.replaceAll('|', '\\|');
22
+ const rows = patterns_1.default.filter(p => p.id !== undefined && shown.includes(p.id)).map(p => `| \`${p.id}\` | ${cell(p.message ?? '')} | \`${cell(p.replace)}\` |`);
23
+ return ['| id | what it says | replacement |', '| :-- | :-- | :-- |', ...rows].join('\n');
24
+ }
10
25
  /**
11
26
  * https://github.com/flowr-analysis/flowr/wiki/Linting-and-Testing
12
27
  */
@@ -33,6 +48,11 @@ for the latest benchmark results, see the ${ctx.linkPage('flowr:benchmarks', 'be
33
48
  - [🪈 CI Pipeline](#ci-pipeline)
34
49
  - [🧹 Linting](#linting)
35
50
  - [Oh no, the linter fails](#oh-no-the-linter-fails)
51
+ - [flowR-Specific Rules](#flowr-specific-rules)
52
+ - [Pointing at a Helper with \`@useInstead\`](#pointing-at-a-helper-with-useinstead)
53
+ - [Replacement Patterns](#replacement-patterns)
54
+ - [Suppressing a Rule](#suppressing-a-rule)
55
+ - [A Part of unicorn](#a-part-of-unicorn)
36
56
  - [License Checker](#license-checker)
37
57
  - [🐛 Debugging](#debugging)
38
58
  - [VS Code](#vs-code-1)
@@ -71,7 +91,7 @@ ${(0, doc_code_1.codeBlock)('shell', 'npm run test -- --no-watch')}
71
91
 
72
92
  To run all tests, including a coverage report and label summary, run:
73
93
 
74
- ${(0, doc_code_1.codeBlock)('shell', 'npm run test-full')}
94
+ ${(0, doc_code_1.codeBlock)('shell', 'npm run test:full')}
75
95
 
76
96
  However, depending on your local version of R, your network connection, and other factors (each test may have a set of criteria),
77
97
  some tests may be skipped automatically as they do not apply to your current system setup (or cannot be tested with the current prerequisites).
@@ -93,8 +113,12 @@ ${(0, doc_structure_1.block)({
93
113
  type: 'WARNING',
94
114
  content: `
95
115
  We name all test files using the \`.test.ts\` suffix and try to run them in parallel.
96
- Whenever this is impossible (e.g., when using ${ctx.link('withShell')}), please use _\`describe.sequential\`_
97
- to disable parallel execution for the respective test (otherwise, such tests are flaky).
116
+ Whenever this is impossible (e.g., when using ${ctx.link('withShell')}), pass \`{ concurrent: false }\` to the
117
+ \`describe\` to disable parallel execution for the respective test (otherwise, such tests are flaky):
118
+
119
+ ${(0, doc_code_1.codeBlock)('typescript', 'describe(\'my suite\', { concurrent: false }, withShell(shell => { /* ... */ }));')}
120
+
121
+ Vitest deprecated the \`describe.sequential\` form in favour of that option, so please do not reintroduce it.
98
122
  `
99
123
  })}
100
124
 
@@ -177,7 +201,7 @@ Although we measure wall time in the CI (which is subject to rather large variat
177
201
  Furthermore, the respective scripts can be used locally as well.
178
202
  To run them, issue:
179
203
 
180
- ${(0, doc_code_1.codeBlock)('shell', 'npm run performance-test')}
204
+ ${(0, doc_code_1.codeBlock)('shell', 'npm run test:performance')}
181
205
 
182
206
  See ${(0, doc_files_1.linkFlowRSourceFile)('test/performance')} for more information on the suites, how to run them, and their results. If you are interested in the results of the benchmarks, see ${ctx.linkPage('flowr:benchmarks', 'here')}.
183
207
 
@@ -248,7 +272,71 @@ it is usually best if you (when necessary) read the respective description and f
248
272
  Rules in this project cover general JavaScript issues [using regular ESLint](https://eslint.org/docs/latest/rules), TypeScript-specific issues [using typescript-eslint](https://typescript-eslint.io/rules/), and code formatting [with ESLint Stylistic](https://eslint.style/packages/default#rules).
249
273
 
250
274
  However, in case you think that the linter is wrong, please do not hesitate to open a [new issue](${doc_files_1.FlowrGithubBaseRef}/flowr/issues/new/choose).
251
-
275
+
276
+ <a id='flowr-specific-rules'></a>
277
+ ### 🧭 flowR-Specific Rules
278
+
279
+ flowR groups its functions in helper objects (${ctx.link(edge_1.DfEdge)}, ${ctx.link(resolve_helper_1.Resolve)}, ${ctx.link(node_id_1.NodeId)}, and
280
+ friends) so that there is one obvious entry point per topic. Two rules of the
281
+ [\`flowr\` plugin](${doc_files_1.FlowrGithubBaseRef}/flowr-lint) keep the code on those entry points, both part of \`npm run lint\`.
282
+ Each is fixed on the spot where the replacement is already imported, and offered as an editor suggestion otherwise.
283
+
284
+ <a id='pointing-at-a-helper-with-useinstead'></a>
285
+ #### Pointing at a Helper with \`@useInstead\`
286
+
287
+ A function that only exists to be wired into a helper object names its replacement, and every reference outside its own
288
+ file is then reported:
289
+
290
+ ${(0, doc_code_1.codeBlock)('ts', `/**
291
+ * Every definition the identifier may refer to.
292
+ * @useInstead {@link Resolve.byName}
293
+ */
294
+ export function resolveByNameAnyType(/* ... */) { /* ... */ }`)}
295
+
296
+ Never reported are the references that make the replacement exist: the wiring in an object literal
297
+ (${ctx.linkO(resolve_helper_1.Resolve, 'byName')} pointing at \`resolveByNameAnyType\`), re-exports, and files declaring the helper itself.
298
+
299
+ <a id='replacement-patterns'></a>
300
+ #### Replacement Patterns
301
+
302
+ Some replacements are a shape of code rather than a renamed function, such as \`edge.types === EdgeType.Reads\`, which
303
+ reads like "has this type" (${ctx.linkO(edge_1.DfEdge, 'includesType')}) but holds only if it is the *only* type
304
+ (${ctx.linkO(edge_1.DfEdge, 'isOnlyType')}). These are matched with [esquery](https://github.com/estools/esquery) selectors,
305
+ the language \`no-restricted-syntax\` uses. Two of the ${patterns_1.default.length} that ship, the rest are in
306
+ [\`patterns.ts\`](${doc_files_1.FlowrGithubBaseRef}/flowr-lint/blob/main/patterns.ts):
307
+
308
+ ${patternExamples()}
309
+
310
+ The [flowr-lint README](${doc_files_1.FlowrGithubBaseRef}/flowr-lint#flowrreplacement-pattern) documents the fields of a pattern,
311
+ and \`npx eslint\` names the id of whichever one fires.
312
+ To propose a new pattern or a change to any of them, open an issue with the replacement pattern template in
313
+ [that repository](${doc_files_1.FlowrGithubBaseRef}/flowr-lint/issues/new/choose).
314
+
315
+ <a id='suppressing-a-rule'></a>
316
+ #### Suppressing a Rule
317
+
318
+ A tag on a declaration covers everything below it, a header comment above the imports covers the whole file.
319
+
320
+ | | silences |
321
+ | :-- | :-- |
322
+ | \`// eslint-disable-next-line\` | the next line, as usual |
323
+ | \`@lintIgnore <ids>\` | the named rules or pattern ids, all of them when given none |
324
+
325
+ Put the reason in the prose above the tag, a hot path that has to keep the raw form is as good a reason as any.
326
+
327
+ <a id='a-part-of-unicorn'></a>
328
+ #### A Part of unicorn
329
+
330
+ The configuration also enables a hand-picked part of [unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn):
331
+ the rules naming a shape with a clearer equivalent (\`prefer-includes\`, \`prefer-string-slice\`, and friends), not its
332
+ opinions on naming or style. Three are left out on purpose:
333
+
334
+ - \`prefer-array-flat\` rewrites \`.flatMap(f => f)\` on an iterator, which has no \`.flat()\`.
335
+ - \`prefer-structured-clone\` does not know that a \`JSON\` round-trip is sometimes the point.
336
+ - \`prefer-node-protocol\` is inverted, \`no-restricted-imports\` forbids the \`node:\` prefix instead: flowR is bundled for
337
+ the browser as well (the web build of the ${ctx.linkPage('flowr:vscode', 'VS Code extension')}), where the core modules
338
+ are swapped for polyfills by their bare name, and a \`node:\` specifier matches none of those bundler keys.
339
+
252
340
  <a id='license-checker'></a>
253
341
  ### 🪪 License Checker
254
342
 
@@ -84,7 +84,7 @@ class DocMaker {
84
84
  async make(args) {
85
85
  this.currentArgs = args;
86
86
  this.writtenSubfiles = new Set();
87
- const newText = normalizeLineEndings((this.printHeader ? (await args.ctx.header(this.filename, this.purpose)) + '\n' : '') + await this.text(args));
87
+ const newText = normalizeLineEndings((this.printHeader ? (await args.ctx.header(this.filename, this.purpose)) + '\n\n' : '') + await this.text(args));
88
88
  if (args.force || this.didUpdate(this.target, newText, args.readFileSync(this.target)?.toString()) === WikiChangeType.Changed) {
89
89
  args.writeFileSync(this.target, newText);
90
90
  return true;
@@ -6,6 +6,8 @@ const doc_files_1 = require("./doc-util/doc-files");
6
6
  const shell_1 = require("../r-bridge/shell");
7
7
  const graph_1 = require("../dataflow/graph/graph");
8
8
  const flowr_analyzer_1 = require("../project/flowr-analyzer");
9
+ const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
10
+ const doc_code_1 = require("./doc-util/doc-code");
9
11
  /**
10
12
  * https://github.com/flowr-analysis/flowr/wiki/Overview
11
13
  */
@@ -39,7 +41,16 @@ Its subcomponents (like the custom ${ctx.link(shell_1.RShell)}) or the internals
39
41
  are not important if you simply wish to use _flowR_.
40
42
  If you wish to use _flowR_, check out one of its extensions (e.g., the ${ctx.linkPage('flowr:vscode', 'VS Code extension')}),
41
43
  the [REPL and server interfaces](#using-flowr-from-the-outside) or its coding API with the
42
- ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)}.
44
+ ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)}, which you build with the ${ctx.link(flowr_analyzer_builder_1.FlowrAnalyzerBuilder)}:
45
+
46
+ ${(0, doc_code_1.codeBlock)('ts', `
47
+ const analyzer = await new FlowrAnalyzerBuilder()
48
+ .setParser(new TreeSitterExecutor())
49
+ .build();
50
+ analyzer.addRequest({ request: 'file', content: 'survey.R' });
51
+ const result = await analyzer.query([{ type: 'dependencies' }]);
52
+ `)}
53
+
43
54
 
44
55
  The benchmark module is only of interest if you want to benchmark/measure the runtime performance and reduction of the slicer.
45
56
  It is available with the [\`benchmark\`](#benchmark-the-slicer) script.
@@ -216,6 +216,9 @@ After \`library(ggplot2)\`, a call to \`ggplot()\` resolves to \`ggplot2::ggplot
216
216
  qualifies bare names and backs various components like the ${ctx.linkPage('wiki/Query API', 'dependencies and call-context queries')}
217
217
  as well as the ${ctx.linkPage('wiki/Linter', 'undefined symbol')} rule.
218
218
 
219
+ You can search what it knows at [flowr-analysis.github.io/flowr/wiki/sigdb](https://flowr-analysis.github.io/flowr/wiki/sigdb/),
220
+ a static page listing every exported name, generated from this database by \`npm run gen:landing\`.
221
+
219
222
  ## What is stored
220
223
 
221
224
  Every function is a ${ctx.link('DecodedFunction')}:
@@ -137,6 +137,7 @@ export type LintingResults<Name extends LintingRuleNames> = LintingResultsSucces
137
137
  * Helper functions for working with {@link LintingResults}.
138
138
  */
139
139
  export declare const LintingResults: {
140
+ readonly name: "LintingResults";
140
141
  /**
141
142
  * Checks whether the given linting results represent an error.
142
143
  * @see {@link LintingResultsError}
@@ -6,6 +6,7 @@ const assert_1 = require("../util/assert");
6
6
  * Helper functions for working with {@link LintingResults}.
7
7
  */
8
8
  exports.LintingResults = {
9
+ name: 'LintingResults',
9
10
  /**
10
11
  * Checks whether the given linting results represent an error.
11
12
  * @see {@link LintingResultsError}
@@ -108,7 +108,7 @@ exports.FILE_PATH_VALIDITY = {
108
108
  // check if any write to the same file happens before the read, and exclude this case if so
109
109
  const writesToFile = results.write.filter(r => samePath(r.value, matchingRead.value, data.flowrConfig.solver.resolveSource?.ignoreCapitalization));
110
110
  const writesBefore = writesToFile.map(w => (0, happens_before_1.happensBefore)(cfg, w.nodeId, element.node.info.id));
111
- if (writesBefore.some(w => w === logic_1.Ternary.Always)) {
111
+ if (writesBefore.includes(logic_1.Ternary.Always)) {
112
112
  metadata.totalWritesBeforeAlways++;
113
113
  return [];
114
114
  }
@@ -87,7 +87,7 @@ exports.functionFinderUtil = {
87
87
  else if (argValues.some(v => requireValue instanceof RegExp ? requireValue.test(v) : v === requireValue)) {
88
88
  return logic_1.Ternary.Always;
89
89
  }
90
- else if (argValues.some(v => v === dependencies_query_format_1.Unknown)) {
90
+ else if (argValues.includes(dependencies_query_format_1.Unknown)) {
91
91
  return logic_1.Ternary.Maybe;
92
92
  }
93
93
  }
@@ -104,7 +104,7 @@ function fixCasing(identifier, convention, ignorePrefix) {
104
104
  if (s.length < 1) {
105
105
  return s.toUpperCase();
106
106
  }
107
- return `${s[0].toUpperCase()}${s.substring(1)}`;
107
+ return `${s[0].toUpperCase()}${s.slice(1)}`;
108
108
  };
109
109
  switch (convention) {
110
110
  case CasingConvention.CamelCase: // camelCase
@@ -8,6 +8,7 @@ const linter_tags_1 = require("../linter-tags");
8
8
  const vertex_1 = require("../../dataflow/graph/vertex");
9
9
  const edge_1 = require("../../dataflow/graph/edge");
10
10
  const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
11
+ const graph_1 = require("../../dataflow/graph/graph");
11
12
  const defaultCredentialNamePattern = '(?:password|passwd|pwd|secret|api[_.]?key|api[_.]?token|access[_.]?token|auth[_.]?token|bearer[_.]?token|private[_.]?key|credential)';
12
13
  const defaultCredentialValuePattern = '^(?:AKIA|AIPA|ASIA|AROA)[A-Z0-9]{16}' + // AWS access key IDs (exact 20-char format)
13
14
  '|^gh[psoar]_[A-Za-z0-9_]{10,}' + // GitHub Classic/App/OAuth/Actions tokens
@@ -38,7 +39,7 @@ exports.NO_LEAKED_CREDENTIALS = {
38
39
  return [];
39
40
  }
40
41
  const nameMatches = namePattern.test(name);
41
- for (const [targetId, edge] of dfg.outgoingEdges(element.node.info.id) ?? []) {
42
+ for (const [targetId, edge] of dfg.outgoingEdges(element.node.info.id) ?? graph_1.NoEdges) {
42
43
  if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy)) {
43
44
  continue;
44
45
  }
@@ -7,10 +7,10 @@ const flowr_search_builder_1 = require("../../search/flowr-search-builder");
7
7
  const linter_tags_1 = require("../linter-tags");
8
8
  const assert_1 = require("../../util/assert");
9
9
  const vertex_1 = require("../../dataflow/graph/vertex");
10
- const alias_tracking_1 = require("../../dataflow/eval/resolve/alias-tracking");
11
- const dfg_get_origin_1 = require("../../dataflow/origin/dfg-get-origin");
12
10
  const linker_1 = require("../../dataflow/internal/linker");
13
11
  const general_1 = require("../../dataflow/eval/values/general");
12
+ const resolve_helper_1 = require("../../dataflow/environments/resolve-helper");
13
+ const df_helper_1 = require("../../dataflow/graph/df-helper");
14
14
  exports.STOP_WITH_CALL_ARG = {
15
15
  createSearch: () => flowr_search_builder_1.Q.var('stop').filter(vertex_1.VertexType.FunctionCall),
16
16
  processSearchResult: async (elements, _config, data) => {
@@ -22,7 +22,7 @@ exports.STOP_WITH_CALL_ARG = {
22
22
  results: elements.getElements()
23
23
  .filter(element => {
24
24
  //only built-in functions
25
- const origins = (0, dfg_get_origin_1.getOriginInDfg)(dataflow.graph, element.node.info.id);
25
+ const origins = df_helper_1.Dataflow.origin(dataflow.graph, element.node.info.id);
26
26
  if ((0, assert_1.isNotUndefined)(origins)) {
27
27
  const builtIn = origins.every(e => e.type === 3 /* OriginType.BuiltInFunctionOrigin */);
28
28
  if (!builtIn) {
@@ -39,7 +39,7 @@ exports.STOP_WITH_CALL_ARG = {
39
39
  const mapping = (0, linker_1.pMatch)(fCall.args, stopParamMap);
40
40
  const mappedToStop = mapping.get('call.') ?? [];
41
41
  for (const argId of mappedToStop) {
42
- const res = (0, alias_tracking_1.resolveIdToValue)(argId, { graph: dataflow.graph, environment: fCall.environment, ctx: data.inspectContext() });
42
+ const res = resolve_helper_1.Resolve.toValue(argId, { graph: dataflow.graph, environment: fCall.environment, ctx: data.inspectContext() });
43
43
  const values = (0, general_1.valueSetGuard)(res);
44
44
  if (values?.type === 'set' && values.elements.length !== 0) {
45
45
  if (values.elements[0].type === 'logical') {
@@ -7,7 +7,7 @@ import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
7
  export declare function isInstalledResourceFile(file: string | undefined): boolean;
8
8
  /**
9
9
  * Whether the variable use `id` resolves to a local definition, a parameter, or a built-in (function or
10
- * constant such as `T`, `pi`). Broader than `getOriginInDfg`, which misses built-in constants.
10
+ * constant such as `T`, `pi`). Broader than `Dataflow.origin`, which misses built-in constants.
11
11
  */
12
12
  export declare function useResolvesToDefinitionOrBuiltin(graph: DataflowGraph, id: NodeId): boolean;
13
13
  /**
@@ -11,6 +11,7 @@ const df_helper_1 = require("../../dataflow/graph/df-helper");
11
11
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
12
12
  const vertex_1 = require("../../dataflow/graph/vertex");
13
13
  const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
14
+ const graph_1 = require("../../dataflow/graph/graph");
14
15
  /**
15
16
  * Path heuristic for an R package `inst/` resource (installed verbatim, not namespace source). Fallback for
16
17
  * the authoritative `FileRole.Install`, covering requests that bypass the file-role plugins.
@@ -21,10 +22,10 @@ function isInstalledResourceFile(file) {
21
22
  const ResolveEdges = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall;
22
23
  /**
23
24
  * Whether the variable use `id` resolves to a local definition, a parameter, or a built-in (function or
24
- * constant such as `T`, `pi`). Broader than `getOriginInDfg`, which misses built-in constants.
25
+ * constant such as `T`, `pi`). Broader than `Dataflow.origin`, which misses built-in constants.
25
26
  */
26
27
  function useResolvesToDefinitionOrBuiltin(graph, id) {
27
- for (const [target, edge] of graph.outgoingEdges(id) ?? []) {
28
+ for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
28
29
  if (edge_1.DfEdge.doesNotIncludeType(edge, ResolveEdges) || edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation)) {
29
30
  continue;
30
31
  }
@@ -32,7 +33,7 @@ function useResolvesToDefinitionOrBuiltin(graph, id) {
32
33
  return true;
33
34
  }
34
35
  const targetVtx = graph.getVertex(target);
35
- if (targetVtx?.tag === vertex_1.VertexType.VariableDefinition || targetVtx?.tag === vertex_1.VertexType.FunctionDefinition) {
36
+ if (vertex_1.VariableDefinitionVertex.is(targetVtx) || vertex_1.FunctionDefinitionVertex.is(targetVtx)) {
36
37
  return true;
37
38
  }
38
39
  }
@@ -109,7 +110,7 @@ function collectScopeDefinedNames(graph) {
109
110
  return byScope;
110
111
  }
111
112
  for (const [id, vtx] of graph.vertices(true)) {
112
- if (vtx.tag !== vertex_1.VertexType.VariableDefinition) {
113
+ if (!vertex_1.VariableDefinitionVertex.is(vtx)) {
113
114
  continue; // function bindings/params surface as variable definitions of their name symbol
114
115
  }
115
116
  const name = idMap.get(id)?.lexeme;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UNDEFINED_SYMBOL = void 0;
4
4
  const vertex_1 = require("../../dataflow/graph/vertex");
5
5
  const graph_1 = require("../../dataflow/graph/graph");
6
- const dfg_get_origin_1 = require("../../dataflow/origin/dfg-get-origin");
7
6
  const identifier_1 = require("../../dataflow/environments/identifier");
8
7
  const flowr_search_builder_1 = require("../../search/flowr-search-builder");
9
8
  const flowr_search_filters_1 = require("../../search/flowr-search-filters");
@@ -15,6 +14,7 @@ const r_base_packages_1 = require("../../util/r-base-packages");
15
14
  const linter_format_1 = require("../linter-format");
16
15
  const linter_tags_1 = require("../linter-tags");
17
16
  const undefined_symbol_util_1 = require("./undefined-symbol-util");
17
+ const df_helper_1 = require("../../dataflow/graph/df-helper");
18
18
  /** calls that load a package; an unresolved one means we cannot enumerate all exports in scope */
19
19
  const LibraryLoadFunctions = new Set(['library', 'require', 'requireNamespace', 'loadNamespace', 'attachNamespace', 'load_all', 'use', 'p_load']);
20
20
  // standard packages attached by default; exports are in scope without library()
@@ -106,7 +106,7 @@ exports.UNDEFINED_SYMBOL = {
106
106
  return check(element, id, identifier_1.Identifier.getName(vtx.name), identifier_1.Identifier.getNamespace(vtx.name), 'function');
107
107
  }
108
108
  // variable use: only plain symbols (not argument names, `...`, or empty)
109
- if (vtx.tag === vertex_1.VertexType.Use && config.checkVariables) {
109
+ if (vertex_1.UseVertex.is(vtx) && config.checkVariables) {
110
110
  const node = element.node;
111
111
  if (node.type !== type_1.RType.Symbol || node.lexeme === '...' || node.lexeme === undefined) {
112
112
  return undefined;
@@ -123,7 +123,7 @@ exports.UNDEFINED_SYMBOL = {
123
123
  /** shared resolution logic for a name used either as a function call or a variable */
124
124
  function check(element, id, name, namespace, kind) {
125
125
  // resolved by flowR itself (local/param/builtin) - never a candidate, so not counted as suppressed
126
- if (kind === 'variable' ? (0, undefined_symbol_util_1.useResolvesToDefinitionOrBuiltin)(graph, id) : ((0, dfg_get_origin_1.getOriginInDfg)(graph, id)?.length ?? 0) > 0) {
126
+ if (kind === 'variable' ? (0, undefined_symbol_util_1.useResolvesToDefinitionOrBuiltin)(graph, id) : (df_helper_1.Dataflow.origin(graph, id)?.length ?? 0) > 0) {
127
127
  return undefined;
128
128
  }
129
129
  // a bare call to a registered flowR builtin whose dataflow origin was rewritten away from its
@@ -19,6 +19,7 @@ const built_in_props_1 = require("../../dataflow/environments/built-in-props");
19
19
  const default_builtin_config_1 = require("../../dataflow/environments/default-builtin-config");
20
20
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
21
21
  const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
22
+ const graph_1 = require("../../dataflow/graph/graph");
22
23
  /**
23
24
  * The dots parameter is a special parameter and must never be reported as an unused definition.
24
25
  */
@@ -154,7 +155,7 @@ function buildQuickFix(variable, dfg, ast) {
154
155
  }
155
156
  const definedBys = getDefinitionArguments(variable.info.id, dfg);
156
157
  const hasImportantArgs = definedBys.some(d => dfg.unknownSideEffects.has(d))
157
- || definedBys.flatMap(e => Array.from(dfg.outgoingEdges(e) ?? []))
158
+ || definedBys.flatMap(e => Array.from(dfg.outgoingEdges(e) ?? graph_1.NoEdges))
158
159
  .some(([target, e]) => {
159
160
  return edge_1.DfEdge.includesType(e, InterestingEdgesTargets) || dfg.unknownSideEffects.has(target);
160
161
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.13.15",
3
+ "version": "2.14.0",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -16,49 +16,46 @@
16
16
  },
17
17
  "scripts": {
18
18
  "setup:dev": "npm ci && ts-node --transpile-only scripts/setup-dev.ts",
19
- "main": "npm run build:bundle-flowr && node dist/src/cli/flowr.min.js",
20
19
  "flowr": "npm run main --",
21
20
  "flowr:dev": "npm run sync:sigdb && npm run gen:base-packages && npm run main-dev --",
21
+ "main": "npm run build:bundle-flowr && node dist/src/cli/flowr.min.js",
22
22
  "main-dev": "node -r ts-node/register --watch src/cli/flowr.ts",
23
- "publish-library": "cp .npmignore package.json README.md LICENSE dist/src/ && cd dist/src && npm publish --access public",
24
- "release": "npx release-it --ci",
25
23
  "slicer": "ts-node src/cli/slicer-app.ts",
24
+ "benchmark": "npm run build:dev && node dist/src/cli/benchmark-app.js",
26
25
  "benchmark-helper": "ts-node src/cli/benchmark-helper-app.ts",
27
- "benchmark": "npm run build-dev && node dist/src/cli/benchmark-app.js",
28
26
  "summarizer": "ts-node src/cli/summarizer-app.ts",
29
- "benchmark:test-counts": "ts-node --transpile-only scripts/test-label-counts.ts",
30
- "benchmark:compact": "ts-node --transpile-only scripts/compact-benchmark-data.ts",
31
- "export-quads": "ts-node src/cli/export-quads-app.ts",
32
- "capabilities-markdown": "ts-node src/documentation/doc-capabilities.ts",
33
- "wiki": "ts-node src/cli/wiki.ts",
34
- "wiki:watch": "node -r ts-node/register --watch src/cli/wiki.ts --keep-alive",
35
27
  "build": "npm run gen:base-packages && tsc --project . && npm run build:copy-data",
28
+ "build:dev": "npm run build && npm run build:copy-wasm",
29
+ "build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --tree-shaking=true --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm",
30
+ "build:copy-data": "ts-node --transpile-only scripts/sigdb-copy.ts",
31
+ "build:copy-wasm": "mkdir -p dist/node_modules/@davisvaughan/tree-sitter-r/ && mkdir -p dist/node_modules/web-tree-sitter && cp node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm dist/node_modules/@davisvaughan/tree-sitter-r/ && cp node_modules/web-tree-sitter/tree-sitter.wasm dist/node_modules/web-tree-sitter/",
36
32
  "gen:base-packages": "ts-node --transpile-only scripts/gen-base-packages.ts",
37
- "sync:sigdb": "ts-node --transpile-only scripts/sigdb-sync.ts",
38
- "check:generic-labels": "ts-node --transpile-only scripts/check-generic-labels.ts",
33
+ "gen:landing": "ts-node --transpile-only scripts/gen-landing.ts && ts-node --transpile-only scripts/gen-sigdb-index.ts && ts-node --transpile-only scripts/gen-playground.ts",
39
34
  "gen:sigdb-remote": "ts-node --transpile-only scripts/sigdb-remote.ts",
35
+ "sync:sigdb": "ts-node --transpile-only scripts/sigdb-sync.ts",
40
36
  "publish:sigdb": "ts-node scripts/publish-sigdb.ts",
41
- "build:copy-data": "ts-node --transpile-only scripts/sigdb-copy.ts",
42
- "build-dev": "npm run build && npm run build:copy-wasm",
43
- "build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --tree-shaking=true --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm",
44
- "build:copy-wasm": "mkdir -p dist/node_modules/@davisvaughan/tree-sitter-r/ && mkdir -p dist/node_modules/web-tree-sitter && cp node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm dist/node_modules/@davisvaughan/tree-sitter-r/ && cp node_modules/web-tree-sitter/tree-sitter.wasm dist/node_modules/web-tree-sitter/",
37
+ "wiki": "ts-node src/cli/wiki.ts",
38
+ "wiki:watch": "node -r ts-node/register --watch src/cli/wiki.ts --keep-alive",
39
+ "doc": "node --max-old-space-size=8192 node_modules/typedoc/dist/cli.js",
45
40
  "typecheck": "tsc --noEmit --project .",
46
- "lint-local": "npm run typecheck && npx eslint --version && npx eslint src/ test/ scripts/ --concurrency=auto --cache --cache-location node_modules/.cache/eslint-local --rule \"no-warning-comments: off\"",
47
41
  "lint": "npm run license-compat -- --summary && npm run typecheck && npx eslint --version && npx eslint src/ test/ scripts/ --concurrency=auto --cache --cache-location node_modules/.cache/eslint",
42
+ "lint-local": "npm run typecheck && npx eslint --version && npx eslint src/ test/ scripts/ --concurrency=auto --cache --cache-location node_modules/.cache/eslint-local --rule \"no-warning-comments: off\"",
48
43
  "license-compat": "license-checker-rseidelsohn --onlyAllow 'MIT;MPL-2.0;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD' --clarificationsFile license-clarifications.json",
49
- "doc": "node --max-old-space-size=8192 node_modules/typedoc/dist/cli.js",
44
+ "check:generic-labels": "ts-node --transpile-only scripts/check-generic-labels.ts",
45
+ "detect-circular-deps": "npx madge --extensions ts,tsx --circular src/",
46
+ "checkup": "ts-node scripts/checkup-parallel.ts",
50
47
  "test": "vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
48
+ "test:full": "npm run test:coverage -- --no-watch --reporter=default --reporter=json --outputFile.json=coverage/flowr-test-results.json -- --make-summary --test-installation",
49
+ "test:coverage": "npm run test -- --coverage",
51
50
  "test:verbose": "FLOWR_VERBOSE=true vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
52
51
  "test:system": "vitest --dir test/system-tests --config test/system-tests/vitest.config.mts",
53
- "test:coverage": "npm run test -- --coverage",
54
- "test:full": "npm run test-full",
55
52
  "test:bench": "vitest bench --config test/vitest.config.mts",
56
- "test-full": "npm run test:coverage -- --no-watch --reporter=default --reporter=json --outputFile.json=coverage/flowr-test-results.json -- --make-summary --test-installation",
57
- "performance-test": "func() { cd test/performance/ && bash run-all-suites.sh \"$@\"; }; func",
58
- "test:performance": "npm run performance-test --",
53
+ "test:performance": "func() { cd test/performance/ && bash run-all-suites.sh \"$@\"; }; func",
59
54
  "test:docker": "func() { b() { docker build ${1:+--network=$1} -t flowr-docker-test -f \"$2\" .; }; r() { docker run --rm ${1:+--network=$1} flowr-docker-test --version; }; for df in scripts/Dockerfile scripts/Dockerfile-NoR; do echo \"=== building $df ===\"; b '' \"$df\" || { echo '(retrying with --network=host: bridge networking unavailable)'; b host \"$df\"; } || return 1; echo \"=== smoke-testing $df ===\"; r '' || r host || return 1; done; }; func",
60
- "detect-circular-deps": "npx madge --extensions ts,tsx --circular src/",
61
- "checkup": "ts-node scripts/checkup-parallel.ts"
55
+ "benchmark:test-counts": "ts-node --transpile-only scripts/test-label-counts.ts",
56
+ "benchmark:compact": "ts-node --transpile-only scripts/compact-benchmark-data.ts",
57
+ "publish-library": "cp .npmignore package.json README.md LICENSE dist/src/ && cd dist/src && npm publish --access public",
58
+ "release": "npx release-it --ci"
62
59
  },
63
60
  "keywords": [
64
61
  "static code analysis",
@@ -161,9 +158,9 @@
161
158
  "hooks": {
162
159
  "before:init": [
163
160
  "npm run lint",
164
- "npm run test-full"
161
+ "npm run test:full"
165
162
  ],
166
- "after:bump": "npm run build-dev",
163
+ "after:bump": "npm run build:dev",
167
164
  "after:git:release": "echo After git push, before github release",
168
165
  "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
169
166
  },
@@ -186,11 +183,11 @@
186
183
  }
187
184
  },
188
185
  "devDependencies": {
186
+ "@codemirror/legacy-modes": "^6.5.3",
189
187
  "@commitlint/cli": "^20.5.0",
190
188
  "@commitlint/config-angular": "^20.5.0",
191
- "@eagleoutice/eslint-config-flowr": "^2.0.2",
189
+ "@eagleoutice/eslint-config-flowr": "^2.1.1",
192
190
  "@j-ulrich/release-it-regex-bumper": "^5.4.0",
193
- "@stylistic/eslint-plugin": "^5.10.0",
194
191
  "@types/command-line-args": "^5.2.3",
195
192
  "@types/command-line-usage": "^5.0.4",
196
193
  "@types/commonmark": "^0.27.10",
@@ -203,18 +200,13 @@
203
200
  "@types/semver": "^7.7.0",
204
201
  "@types/tmp": "^0.2.6",
205
202
  "@types/ws": "^8.18.1",
206
- "@typescript-eslint/eslint-plugin": "^8.40.0",
207
- "@typescript-eslint/parser": "^8.65.0",
208
203
  "@vitest/coverage-v8": "^4.1.8",
204
+ "codemirror": "^6.0.2",
209
205
  "esbuild": "^0.28.1",
210
206
  "eslint": "^10.8.0",
211
- "eslint-plugin-check-file": "^3.3.2",
212
- "eslint-plugin-import-x": "^4.17.1",
213
- "eslint-plugin-jsdoc": "^62.9.0",
214
- "eslint-plugin-tsdoc": "^0.5.2",
215
- "eslint-plugin-unused-imports": "^4.4.1",
216
207
  "license-checker-rseidelsohn": "^4.4.2",
217
208
  "release-it": "^20.0.0",
209
+ "seedrandom": "^3.0.5",
218
210
  "ts-node": "^10.9.2",
219
211
  "typedoc": "^0.28.17",
220
212
  "typedoc-plugin-missing-exports": "^4.1.2",
@@ -227,32 +219,25 @@
227
219
  "@jupyterlab/nbformat": "^4.5.4",
228
220
  "@xmldom/xmldom": "^0.9.7",
229
221
  "bzip2": "^0.1.1",
230
- "clipboardy": "^4.0.0",
231
222
  "command-line-args": "^6.0.1",
232
223
  "command-line-usage": "^7.0.3",
233
224
  "commonmark": "^0.31.2",
234
225
  "dagre": "^0.8.5",
235
- "diff": "^8.0.3",
236
226
  "gray-matter": "^4.0.3",
237
227
  "ignore": "^5.3.2",
238
228
  "joi": "^18.0.1",
239
229
  "lz-string": "^1.5.0",
240
230
  "n-readlines": "^3.4.1",
241
- "n3": "^1.26.0",
242
231
  "object-hash": "^3.0.0",
243
232
  "object-path": "^0.11.8",
244
233
  "object-sizeof": "^2.6.5",
245
- "rotating-file-stream": "^3.2.8",
246
- "seedrandom": "^3.0.5",
247
234
  "semver": "^7.7.4",
248
235
  "smol-toml": "^1.7.0",
249
- "tar": "^7.4.3",
250
236
  "tmp": "^0.2.3",
251
237
  "ts-essentials": "^10.1.1",
252
238
  "tslog": "^4.10.2",
253
239
  "web-tree-sitter": "^0.24.7",
254
- "ws": "^8.18.0",
255
- "xpath-ts2": "^1.4.2"
240
+ "ws": "^8.18.0"
256
241
  },
257
242
  "allowScripts": {
258
243
  "@davisvaughan/tree-sitter-r@1.2.0": true,
@@ -260,5 +245,10 @@
260
245
  "esbuild@0.28.1": true,
261
246
  "plantuml-pipe@1.6.0": true,
262
247
  "unrs-resolver@1.12.2": true
248
+ },
249
+ "optionalDependencies": {
250
+ "clipboardy": "^4.0.0",
251
+ "n3": "^1.26.0",
252
+ "rotating-file-stream": "^3.2.8"
263
253
  }
264
254
  }
@@ -1,6 +1,9 @@
1
1
  import type { FlowrAnalyzerContext } from './flowr-analyzer-context';
2
2
  import type { IEnvironment, REnvironmentInformation } from '../../dataflow/environments/environment';
3
3
  import type { DeepReadonly } from 'ts-essentials';
4
+ import type { IdentifierDefinition } from '../../dataflow/environments/identifier';
5
+ import { Identifier } from '../../dataflow/environments/identifier';
6
+ import type { BuiltInIdentifierDefinition } from '../../dataflow/environments/built-in';
4
7
  import type { Fingerprint } from '../../slicing/static/fingerprint';
5
8
  /**
6
9
  * Read-only interface to the {@link FlowrAnalyzerEnvironmentContext}.
@@ -10,6 +13,21 @@ export interface ReadOnlyFlowrAnalyzerEnvironmentContext {
10
13
  * Get the built-in environment used during analysis.
11
14
  */
12
15
  get builtInEnvironment(): DeepReadonly<IEnvironment>;
16
+ /**
17
+ * Every built-in definition flowR carries for `name`, matched by its plain name.
18
+ */
19
+ builtInDefinitionsOf(name: Identifier): readonly IdentifierDefinition[];
20
+ /**
21
+ * The built-in function flowR defines for `name`, respecting its namespace: `dplyr::filter` picks
22
+ * flowR's `dplyr` definition rather than whatever else is registered under `filter`.
23
+ */
24
+ builtInFunctionOf(name: Identifier): BuiltInIdentifierDefinition | undefined;
25
+ /**
26
+ * Whether flowR carries definitions of its own for package `pkg`, i.e. whether it knows what attaching
27
+ * that package brings even when no signature database resolves it. Built once and kept, as the built-in
28
+ * environment does not change during an analysis.
29
+ */
30
+ knowsPackage(pkg: string): boolean;
13
31
  /**
14
32
  * Get the empty built-in environment used during analysis.
15
33
  * The empty built-in environment only contains primitive definitions.
@@ -40,9 +58,14 @@ export declare class FlowrAnalyzerEnvironmentContext implements ReadOnlyFlowrAna
40
58
  private readonly builtInEnv;
41
59
  private readonly emptyBuiltInEnv;
42
60
  private builtInEnvFingerprint;
61
+ /** the packages {@link knowsPackage} answers for, collected from the built-in environment on first use */
62
+ private knownPackages;
43
63
  constructor(ctx: FlowrAnalyzerContext);
44
64
  get builtInEnvironment(): DeepReadonly<IEnvironment>;
45
65
  get emptyBuiltInEnvironment(): DeepReadonly<IEnvironment>;
66
+ builtInDefinitionsOf(name: Identifier): readonly IdentifierDefinition[];
67
+ knowsPackage(pkg: string): boolean;
68
+ builtInFunctionOf(name: Identifier): BuiltInIdentifierDefinition | undefined;
46
69
  makeCleanEnv(): REnvironmentInformation;
47
70
  getCleanEnvFingerprint(): Fingerprint;
48
71
  makeCleanEnvWithEmptyBuiltIns(): REnvironmentInformation;