@eagleoutice/flowr 2.16.8 → 2.17.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 (153) hide show
  1. package/README.md +16 -10
  2. package/abstract-interpretation/absint-inference.d.ts +17 -1
  3. package/abstract-interpretation/absint-inference.js +118 -3
  4. package/abstract-interpretation/data-frame/arguments.d.ts +11 -1
  5. package/abstract-interpretation/data-frame/arguments.js +12 -0
  6. package/abstract-interpretation/domains/lattice.d.ts +2 -0
  7. package/abstract-interpretation/domains/lattice.js +0 -6
  8. package/abstract-interpretation/domains/multi-value-state-domain.d.ts +2 -1
  9. package/abstract-interpretation/domains/multi-value-state-domain.js +7 -3
  10. package/abstract-interpretation/domains/partial-product-domain.js +2 -1
  11. package/abstract-interpretation/domains/state-abstract-domain.d.ts +6 -3
  12. package/abstract-interpretation/domains/state-abstract-domain.js +13 -7
  13. package/abstract-interpretation/domains/state-domain.d.ts +4 -0
  14. package/config.d.ts +32 -0
  15. package/config.js +23 -3
  16. package/control-flow/useless-loop.js +10 -8
  17. package/data/r-primitives.generated.d.ts +1 -0
  18. package/data/r-primitives.generated.js +9 -0
  19. package/data/sigdb/sigdb.remote.json +110 -110
  20. package/dataflow/environments/built-in-props.d.ts +16 -2
  21. package/dataflow/environments/built-in-props.js +23 -3
  22. package/dataflow/environments/built-in.js +13 -3
  23. package/dataflow/environments/default-builtin-config.d.ts +268 -7
  24. package/dataflow/environments/default-builtin-config.js +72 -13
  25. package/dataflow/environments/identifier.d.ts +7 -1
  26. package/dataflow/environments/query-fn-props.d.ts +9 -3
  27. package/dataflow/environments/query-fn-props.js +13 -5
  28. package/dataflow/extractor.js +49 -14
  29. package/dataflow/fn/class-declaration.js +1 -8
  30. package/dataflow/fn/function-semantics.d.ts +1 -0
  31. package/dataflow/graph/df-helper.d.ts +2 -0
  32. package/dataflow/graph/df-helper.js +7 -0
  33. package/documentation/wiki-linter.js +29 -0
  34. package/documentation/wiki-query.js +20 -1
  35. package/linter/linter-executor.js +2 -1
  36. package/linter/linter-rules.d.ts +65 -0
  37. package/linter/linter-rules.js +5 -1
  38. package/linter/rules/cmd-check/global-environment-modification.d.ts +14 -1
  39. package/linter/rules/cmd-check/global-environment-modification.js +15 -7
  40. package/linter/rules/network-functions.js +10 -2
  41. package/linter/rules/no-leaked-credentials.d.ts +1 -0
  42. package/linter/rules/no-leaked-credentials.js +3 -3
  43. package/linter/rules/process-state-in-session.d.ts +71 -0
  44. package/linter/rules/process-state-in-session.js +267 -0
  45. package/linter/rules/secret-exfiltration.d.ts +80 -0
  46. package/linter/rules/secret-exfiltration.js +183 -0
  47. package/linter/rules/unused-import.js +11 -1
  48. package/package.json +1 -1
  49. package/project/cache/flowr-analyzer-cache.d.ts +4 -0
  50. package/project/cache/flowr-analyzer-cache.js +11 -0
  51. package/project/context/flowr-analyzer-dependencies-context.d.ts +3 -0
  52. package/project/context/flowr-analyzer-dependencies-context.js +6 -0
  53. package/project/context/flowr-file.d.ts +2 -2
  54. package/project/context/flowr-file.js +2 -2
  55. package/project/flowr-analyzer.d.ts +6 -0
  56. package/project/flowr-analyzer.js +4 -0
  57. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +39 -4
  58. package/project/plugins/file-plugins/files/flowr-manifest-files.js +134 -30
  59. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +2 -0
  60. package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -3
  61. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -1
  62. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +7 -0
  63. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +14 -1
  64. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +1 -1
  65. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -3
  66. package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.d.ts +18 -5
  67. package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.js +43 -15
  68. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +12 -0
  69. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +31 -2
  70. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-on-demand-plugin.d.ts +58 -0
  71. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-on-demand-plugin.js +237 -0
  72. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +8 -0
  73. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +8 -0
  74. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +7 -0
  75. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +24 -18
  76. package/project/plugins/plugin-registry.d.ts +5 -4
  77. package/project/plugins/plugin-registry.js +6 -0
  78. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +4 -4
  79. package/project/sigdb/decode.js +13 -3
  80. package/project/sigdb/decompress.d.ts +4 -0
  81. package/project/sigdb/decompress.js +60 -25
  82. package/project/sigdb/manifest.d.ts +1 -1
  83. package/project/sigdb/manifest.js +2 -5
  84. package/project/sigdb/memory-source.d.ts +6 -4
  85. package/project/sigdb/memory-source.js +6 -5
  86. package/project/sigdb/on-demand/fetch.d.ts +18 -0
  87. package/project/sigdb/on-demand/fetch.js +127 -0
  88. package/project/sigdb/on-demand/package-sources.d.ts +40 -0
  89. package/project/sigdb/on-demand/package-sources.js +263 -0
  90. package/project/sigdb/on-demand/recoverer.d.ts +40 -0
  91. package/project/sigdb/on-demand/recoverer.js +169 -0
  92. package/project/sigdb/on-demand/remote-sources.d.ts +72 -0
  93. package/project/sigdb/on-demand/remote-sources.js +132 -0
  94. package/project/sigdb/on-demand/tar.d.ts +19 -0
  95. package/project/sigdb/on-demand/tar.js +119 -0
  96. package/project/sigdb/reader.js +15 -6
  97. package/project/sigdb/sigdb-download.d.ts +3 -7
  98. package/project/sigdb/sigdb-download.js +71 -72
  99. package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +5 -0
  100. package/queries/catalog/dependencies-query/function-info/derived-functions.js +17 -1
  101. package/queries/catalog/dependencies-query/function-info/read-functions.js +3 -1
  102. package/queries/catalog/dependencies-query/function-info/write-functions.js +11 -1
  103. package/queries/catalog/taint-query/taint-query-executor.d.ts +7 -0
  104. package/queries/catalog/taint-query/taint-query-executor.js +30 -0
  105. package/queries/catalog/taint-query/taint-query-format.d.ts +29 -0
  106. package/queries/catalog/taint-query/taint-query-format.js +124 -0
  107. package/queries/query.d.ts +12 -1
  108. package/queries/query.js +2 -0
  109. package/r-bridge/data/data.d.ts +29 -0
  110. package/r-bridge/data/data.js +23 -0
  111. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +4 -0
  112. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +8 -0
  113. package/taint-analysis/builder/domain.d.ts +14 -0
  114. package/taint-analysis/builder/domain.js +69 -0
  115. package/taint-analysis/builder/report-template.d.ts +50 -0
  116. package/taint-analysis/builder/report-template.js +46 -0
  117. package/taint-analysis/builder/taint-analysis-definition.d.ts +108 -0
  118. package/taint-analysis/builder/taint-analysis-definition.js +128 -0
  119. package/taint-analysis/builder/taint-analysis.d.ts +124 -0
  120. package/taint-analysis/builder/taint-analysis.js +93 -0
  121. package/taint-analysis/builtin-index-bridge.d.ts +20 -0
  122. package/taint-analysis/builtin-index-bridge.js +48 -0
  123. package/taint-analysis/eval/eval.d.ts +1 -0
  124. package/taint-analysis/eval/eval.js +124 -0
  125. package/taint-analysis/eval/instrumentation.d.ts +59 -0
  126. package/taint-analysis/eval/instrumentation.js +124 -0
  127. package/taint-analysis/finite-domain.d.ts +41 -0
  128. package/taint-analysis/finite-domain.js +118 -0
  129. package/taint-analysis/function-categories.d.ts +31 -0
  130. package/taint-analysis/function-categories.js +61 -0
  131. package/taint-analysis/logger.d.ts +1 -0
  132. package/taint-analysis/logger.js +6 -0
  133. package/taint-analysis/predefined/determinism.d.ts +6 -0
  134. package/taint-analysis/predefined/determinism.js +14 -0
  135. package/taint-analysis/predefined/normalization.d.ts +17 -0
  136. package/taint-analysis/predefined/normalization.js +150 -0
  137. package/taint-analysis/predefined/predefined.d.ts +12 -0
  138. package/taint-analysis/predefined/predefined.js +18 -0
  139. package/taint-analysis/predefined/randomness-analysis.d.ts +6 -0
  140. package/taint-analysis/predefined/randomness-analysis.js +124 -0
  141. package/taint-analysis/predefined/secret-analysis.d.ts +77 -0
  142. package/taint-analysis/predefined/secret-analysis.js +170 -0
  143. package/taint-analysis/predefined/security-analysis.d.ts +7 -0
  144. package/taint-analysis/predefined/security-analysis.js +91 -0
  145. package/taint-analysis/taint-mapping.d.ts +89 -0
  146. package/taint-analysis/taint-mapping.js +81 -0
  147. package/taint-analysis/taint-resolve.d.ts +26 -0
  148. package/taint-analysis/taint-resolve.js +86 -0
  149. package/taint-analysis/taint-visitor.d.ts +80 -0
  150. package/taint-analysis/taint-visitor.js +82 -0
  151. package/util/flowr-version.d.ts +1 -1
  152. package/util/flowr-version.js +2 -2
  153. package/util/r-version.js +4 -2
package/config.js CHANGED
@@ -137,10 +137,12 @@ exports.FlowrDefaultPlugins = [
137
137
  'versions:description',
138
138
  'versions:sigdb',
139
139
  'versions:library',
140
+ 'versions:on-demand',
140
141
  'versions:namespace',
141
142
  'versions:renv',
142
143
  'versions:rv',
143
144
  'versions:uvr',
145
+ 'versions:rig',
144
146
  'versions:packrat',
145
147
  'versions:session-info',
146
148
  'loading-order:description',
@@ -150,6 +152,8 @@ exports.FlowrDefaultPlugins = [
150
152
  'meta:description',
151
153
  'meta:rproject',
152
154
  'meta:uvr',
155
+ 'meta:rig',
156
+ 'meta:rig-script',
153
157
  'file-roles:vignette',
154
158
  'file-roles:test',
155
159
  'file-roles:inst',
@@ -173,6 +177,7 @@ exports.FlowrDefaultPlugins = [
173
177
  'file:virtualenv',
174
178
  'file:rproject',
175
179
  'file:uvr',
180
+ 'file:rig',
176
181
  'file:rprofile',
177
182
  ];
178
183
  /** deep-merge two config overwrites with `own` winning; objects merge, arrays/scalars replace (matching {@link specialize}'s array-as-leaf treatment) */
@@ -329,7 +334,7 @@ exports.FlowrConfig = {
329
334
  variables: VariableResolve.Alias,
330
335
  evalStrings: true,
331
336
  trackEnvironments: true,
332
- sigdb: { enabled: true, loadProjectDependencies: true, eagerlyLoad: false, eagerlyLoadExports: false, blobCacheBudgetMb: 16, assumedRVersion: 'auto', linkBaseR: false, linkDescriptionDependencies: false, linkBaseRCalls: false, linkPackageCalls: false, warmInBackground: false, additionalPaths: [], autoSync: false, versionSelection: VersionSelection.Newest, versionOverrides: {}, installedLibrary: { enabled: false, paths: [], useEnvironment: true, useProjectLibrary: true, maxDepth: 3, packages: [] } },
337
+ sigdb: { enabled: true, loadProjectDependencies: true, eagerlyLoad: false, eagerlyLoadExports: false, blobCacheBudgetMb: 16, assumedRVersion: 'auto', linkBaseR: false, linkDescriptionDependencies: false, linkBaseRCalls: false, linkPackageCalls: false, warmInBackground: false, additionalPaths: [], autoSync: false, versionSelection: VersionSelection.Newest, versionOverrides: {}, installedLibrary: { enabled: false, paths: [], useEnvironment: true, useProjectLibrary: true, maxDepth: 3, packages: [] }, onDemand: { enabled: false } },
333
338
  versionManagement: { linkedVersionGroups: [] },
334
339
  resolveSource: {
335
340
  dropPaths: DropPathsOption.No,
@@ -461,7 +466,7 @@ exports.FlowrConfig = {
461
466
  trackEnvironments: joi_1.default.boolean().optional().description('Track user-created environments (new.env, assign/get/local with envir=, dollar-assign, attach). When false, all envir-style calls fall through conservatively.'),
462
467
  sigdb: joi_1.default.object({
463
468
  enabled: joi_1.default.boolean().optional().description('Resolve library()/use() exports from a signature database (default true); when false no database is consulted.'),
464
- loadProjectDependencies: joi_1.default.boolean().optional().description('Load the project\'s declared dependencies from its metadata files (DESCRIPTION Imports/Depends, rproject.toml, uvr.toml, renv.lock, rv.lock, uvr.lock) (default true); when false these files are not read for dependencies.'),
469
+ loadProjectDependencies: joi_1.default.boolean().optional().description('Load the project\'s declared dependencies from its metadata files (DESCRIPTION Imports/Depends, rproject.toml, uvr.toml, rig rproj.toml and script blocks, renv.lock, rv.lock, uvr.lock, rig lockfiles) (default true); when false these files are not read for dependencies.'),
465
470
  eagerlyLoad: joi_1.default.boolean().optional().description('Parse the database up front rather than on the first package load (default false, ignored if disabled).'),
466
471
  eagerlyLoadExports: joi_1.default.boolean().optional().description('Add a vertex for every export on load rather than on demand (default false); keeps the dataflow graph small.'),
467
472
  assumedRVersion: joi_1.default.string().optional().description('R version assumed when resolving versioned (base-R) exports: a pin like "4.5" or "auto" to detect the installed R (default "auto").'),
@@ -471,7 +476,7 @@ exports.FlowrConfig = {
471
476
  linkDescriptionDependencies: joi_1.default.boolean().optional().description('Eagerly attach the namespaces of the project\'s declared DESCRIPTION dependencies (Imports/Depends) so their exports resolve without an explicit library() (default false).'),
472
477
  warmInBackground: joi_1.default.boolean().optional().description('Decompress the hot shards (base + most-downloaded) in a background task on startup so the first library() lookup is warm (default false; for long-running servers/REPLs).'),
473
478
  additionalPaths: securitySensitive(joi_1.default.array().items(joi_1.default.string()).optional()).description('Extra directories or bundle/manifest files searched for signature databases (alongside the shipped default and $FLOWR_SIGDB_DIR); a downloaded full-history bundle placed here is mounted automatically.'),
474
- downloadRepo: securitySensitive(joi_1.default.string().optional()).description('GitHub owner/repo the full-history bundle is downloaded from via ":signature download" (default "flowr-analysis/flowr", release tag "sigdb-v<flowR-version>").'),
479
+ downloadRepo: securitySensitive(joi_1.default.string().optional()).description('GitHub owner/repo the full-history bundle is downloaded from via ":signature download" (default "flowr-analysis/flowr"; the release tag comes from the committed sigdb.remote.json unless a version is given).'),
475
480
  autoSync: joi_1.default.boolean().optional().description('On startup, re-download shards whose committed sigdb.remote.json hash no longer matches the cache, in the background (default false; opt-in network sync after a git pull).'),
476
481
  installedLibrary: joi_1.default.object({
477
482
  enabled: joi_1.default.boolean().required().description('Recover packages no signature database knows from their installed copy (default false).'),
@@ -481,6 +486,21 @@ exports.FlowrConfig = {
481
486
  maxDepth: joi_1.default.number().optional().description('How far to descend into the nested layout of a project-local library (default 3).'),
482
487
  packages: regexOption(joi_1.default.array().items(joi_1.default.string()).optional()).description('Only recover packages whose name matches one of these regular expressions; empty means any.')
483
488
  }).optional().description('Recovering packages no signature database knows from the copy installed on this machine.'),
489
+ onDemand: joi_1.default.object({
490
+ enabled: securitySensitive(joi_1.default.boolean().required()).description('Fetch and recover the sources of packages no signature database knows when the analyzed code uses them (default false, accesses the network).'),
491
+ sources: joi_1.default.array().items(joi_1.default.string()).optional().description('Where to look, in order: github, cran, bioconductor, or a source a plugin adds (default ["github", "cran", "bioconductor"]).'),
492
+ repositories: securitySensitive(joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.string()).optional()).description('GitHub repositories (owner/repo[/subdir][@ref]) to fetch packages from, by package name. The analyzed project may name more (DESCRIPTION Remotes, install_github calls).'),
493
+ packages: regexOption(joi_1.default.array().items(joi_1.default.string()).optional()).description('Only recover packages whose name matches one of these regular expressions, empty means any.'),
494
+ cranMirror: securitySensitive(joi_1.default.string().optional()).description('The CRAN src/contrib/ to fetch from, over https (default https://cloud.r-project.org/src/contrib/). It may be on the local network.'),
495
+ bioconductorMirror: securitySensitive(joi_1.default.string().optional()).description('The Bioconductor host, over https (default https://bioconductor.org). It may be on the local network.'),
496
+ bioconductorRelease: joi_1.default.string().pattern(/^(release|devel|\d+\.\d+)$/).optional().description('The Bioconductor release to fetch from: release, devel, or a number like 3.20 (default release).'),
497
+ githubMirrors: joi_1.default.boolean().optional().description('Use the GitHub mirrors of CRAN (cran/<pkg>) and Bioconductor (bioc/<pkg>) (default true).'),
498
+ maxPackages: joi_1.default.number().min(0).optional().description('The most packages to fetch for one analysis (default 25).'),
499
+ maxArchiveMb: joi_1.default.number().min(0).optional().description('The most MiB a package archive may have (default 32). It may unpack to three times that, at most 128 MiB.'),
500
+ offline: joi_1.default.boolean().optional().description('Only use what was fetched before, never the network (default false).'),
501
+ retryAfterHours: joi_1.default.number().min(0).optional().description('How many hours to wait before asking again for a package no source had (default 24).'),
502
+ cacheDir: securitySensitive(joi_1.default.string().optional()).description('Where to cache what was fetched (default the on-demand directory of the signature cache).')
503
+ }).optional().description('Recovering packages no signature database knows from their sources on CRAN, Bioconductor, or GitHub.'),
484
504
  blobCacheBudgetMb: joi_1.default.number().min(0).optional().description('How many MiB of decoded package blobs every open bundle may hold together (default 16).'),
485
505
  versionSelection: joi_1.default.string().valid(...Object.values(VersionSelection)).optional().description('When a project constrains a dependency, resolve to the newest (default), oldest, or system-installed version satisfying it; system needs R and falls back to newest. Base-R packages always resolve against the assumed R version.'),
486
506
  versionOverrides: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.string()).optional().description('Force an exact version for specific packages (name -> version), overriding both the project constraint and the versionSelection policy (default {}).')
@@ -63,6 +63,8 @@ class CfgSingleIterationLoopDetector extends semantic_cfg_guided_visitor_1.Seman
63
63
  loopCds = undefined;
64
64
  encounteredLoopBreaker = false;
65
65
  onlyLoopyOnce = false;
66
+ withinLoop = new Set();
67
+ what;
66
68
  constructor(loopToCheck, config) {
67
69
  super(config);
68
70
  this.loopToCheck = loopToCheck;
@@ -71,29 +73,29 @@ class CfgSingleIterationLoopDetector extends semantic_cfg_guided_visitor_1.Seman
71
73
  const g = this.config.controlFlow.graph;
72
74
  const loopNode = this.getNormalizedAst(this.loopToCheck);
73
75
  (0, assert_1.guard)(loopNode !== undefined, "Can't find the loop to check");
74
- const withinLoop = [];
75
76
  new visitor_1.NodeVisitor(node => {
76
77
  if (r_function_definition_1.RFunctionDefinition.is(node)) {
77
78
  /* a jump within a nested closure leaves that closure, not the loop around it */
78
79
  return true;
79
80
  }
80
- withinLoop.push(node.info.id);
81
+ this.withinLoop.add(node.info.id);
81
82
  }).visit(loopNode);
83
+ // We use withinLoop to filter the cds to only cds that are inside the loop
84
+ this.withinLoop.delete(this.loopToCheck);
82
85
  /*
83
86
  * Everything the loop is made of is inspected rather than followed through the graph: a loop that always
84
87
  * jumps out never reaches its own vertex, so a walk from there would not find what breaks it.
85
88
  */
86
- for (const current of withinLoop) {
87
- if (!g.hasVertex(current) || !this.visitNode(current)) {
88
- continue;
89
+ for (const current of this.withinLoop.values()) {
90
+ if (g.hasVertex(current)) {
91
+ this.visitNode(current);
89
92
  }
90
- this.onlyLoopyOnce ||= this.encounteredLoopBreaker && (0, info_1.happensInEveryBranch)(this.loopCds?.filter(c => !c.byIteration));
91
93
  }
92
- this.onlyLoopyOnce ||= this.encounteredLoopBreaker && (0, info_1.happensInEveryBranch)(this.loopCds?.filter(c => !c.byIteration));
94
+ this.onlyLoopyOnce = this.encounteredLoopBreaker && (0, info_1.happensInEveryBranch)(this.loopCds?.filter(c => !c.byIteration));
93
95
  }
94
96
  breaks({ call }) {
95
97
  this.encounteredLoopBreaker = true;
96
- const filtered = call.cds?.filter(c => c.id !== this.loopToCheck) ?? [];
98
+ const filtered = call.cds?.filter(c => this.withinLoop.has(c.id)) ?? [];
97
99
  if (filtered.length > 0) {
98
100
  this.loopCds = (this.loopCds ?? []).concat(filtered);
99
101
  }
@@ -0,0 +1 @@
1
+ export declare const RPrimitives: ReadonlySet<string>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RPrimitives = void 0;
4
+ /*
5
+ * GENERATED, do not edit: the primitive functions of base R. R 4.6.1 (2026-06-24). Regenerate:
6
+ * Rscript -e 'b<-baseenv();n<-ls(b,all.names=TRUE);writeLines(sort(n[vapply(n,function(x)is.primitive(get(x,envir=b)),NA)]))'
7
+ */
8
+ exports.RPrimitives = new Set(["-", ":", "::", ":::", "!", "!=", "...elt", "...length", "...names", ".C", ".cache_class", ".Call", ".Call.graphics", ".class2", ".External", ".External.graphics", ".External2", ".Fortran", ".Internal", ".isMethodsDispatchOn", ".Primitive", ".primTrace", ".primUntrace", ".subset", ".subset2", "(", "[", "[[", "[[<-", "[<-", "{", "@", "@<-", "*", "/", "&", "&&", "%*%", "%/%", "%%", "^", "+", "<", "<-", "<<-", "<=", "=", "==", ">", ">=", "|", "||", "~", "$", "$<-", "abs", "acos", "acosh", "all", "any", "anyNA", "Arg", "as.call", "as.character", "as.complex", "as.double", "as.environment", "as.integer", "as.logical", "as.numeric", "as.raw", "asin", "asinh", "atan", "atanh", "attr", "attr<-", "attributes", "attributes<-", "baseenv", "break", "browser", "c", "call", "ceiling", "class", "class<-", "Conj", "cos", "cosh", "cospi", "crossprod", "cummax", "cummin", "cumprod", "cumsum", "declare", "digamma", "dim", "dim<-", "dimnames", "dimnames<-", "emptyenv", "enc2native", "enc2utf8", "environment<-", "Exec", "exp", "expm1", "expression", "floor", "for", "forceAndCall", "function", "gamma", "gc.time", "globalenv", "if", "Im", "interactive", "invisible", "is.array", "is.atomic", "is.call", "is.character", "is.complex", "is.double", "is.environment", "is.expression", "is.finite", "is.function", "is.infinite", "is.integer", "is.language", "is.list", "is.logical", "is.matrix", "is.na", "is.name", "is.nan", "is.null", "is.numeric", "is.object", "is.pairlist", "is.raw", "is.recursive", "is.single", "is.symbol", "isS4", "lazyLoadDBfetch", "length", "length<-", "levels<-", "lgamma", "list", "log", "log10", "log1p", "log2", "max", "min", "missing", "Mod", "names", "names<-", "nargs", "next", "nzchar", "oldClass", "oldClass<-", "on.exit", "pos.to.env", "proc.time", "prod", "quote", "range", "Re", "rep", "repeat", "retracemem", "return", "round", "seq_along", "seq_len", "seq.int", "sign", "signif", "sin", "sinh", "sinpi", "sqrt", "standardGeneric", "storage.mode<-", "substitute", "sum", "switch", "Tailcall", "tan", "tanh", "tanpi", "tcrossprod", "tracemem", "trigamma", "trunc", "unCfillPOSIXlt", "unclass", "untracemem", "UseMethod", "while", "xtfrm"]);
9
+ //# sourceMappingURL=r-primitives.generated.js.map
@@ -1,112 +1,112 @@
1
1
  {
2
- "format": "flowr-sigdb-remote",
3
- "schema": 2,
4
- "tag": "v2.12.3",
5
- "repo": "flowr-analysis/flowr",
6
- "shards": {
7
- "base.base-current.sigs.ndjson.br": {
8
- "sha256": "e416dbb477b7db257a024e564c4b1624bceec977f8935b5b7d886680bee51523",
9
- "bytes": 94093
10
- },
11
- "base.base-current.sigs.ndjson.zst": {
12
- "sha256": "344725e5e230667a6189a80dd69e70c7c5d3681b8955f8776b6c2d454ed13759",
13
- "bytes": 99922
14
- },
15
- "base.base-full.sigs.ndjson.br": {
16
- "sha256": "0631a4448840cd8ae5dd5495cb7a76736ed4157cb8a9614017571c9be8f281b6",
17
- "bytes": 427552
18
- },
19
- "base.base-full.sigs.ndjson.zst": {
20
- "sha256": "c6d4224dd34c53163af537731b767cf5ec100d688325aca560a6f732897f1306",
21
- "bytes": 464284
22
- },
23
- "base.dict.sigs.ndjson.br": {
24
- "sha256": "b9b67b8482d94790e549bd992285efcc1a0b6fe63e8c27f3aff90181b93e93b9",
25
- "bytes": 49912
26
- },
27
- "base.dict.sigs.ndjson.zst": {
28
- "sha256": "15ecccca667b47e3b5f29d8cc149efa6741455bb94a62740736753f8bbd84a89",
29
- "bytes": 51311
30
- },
31
- "base.manifest.json.br": {
32
- "sha256": "d7749a4146eee5f64a31a58c609dc1af537fd158672f468f04c3e45469d00f63",
33
- "bytes": 802
34
- },
35
- "base.manifest.json.zst": {
36
- "sha256": "84dc383f8414764e0f080d3b00ba53c54b9fed58285e67341d5c4182cc06402e",
37
- "bytes": 916
38
- },
39
- "current.base-current.sigs.ndjson.br": {
40
- "sha256": "664459693ec1ff507fae465dc91c34f4dd507063144bfe6ae4d18fd17cbbf132",
41
- "bytes": 101245
42
- },
43
- "current.base-current.sigs.ndjson.zst": {
44
- "sha256": "adb44ea28268be16428b59265865c567b5232bc1e015feef29802c3116d03d93",
45
- "bytes": 106631
46
- },
47
- "current.base-full.sigs.ndjson.br": {
48
- "sha256": "9e339e4916fdf11a0339591705eaa6d356656873355777ead3476fc4b607d247",
49
- "bytes": 443384
50
- },
51
- "current.base-full.sigs.ndjson.zst": {
52
- "sha256": "92ed0acca5215c4f7e45aabe4ea5b3266525a624deed03b73e351900689cbeba",
53
- "bytes": 479202
54
- },
55
- "current.current-rest.sigs.ndjson.br": {
56
- "sha256": "4b0eaaaf4322c0c661906933c758adbf8e1555d768f765e62e59e1cd5ce25371",
57
- "bytes": 15063281
58
- },
59
- "current.current-rest.sigs.ndjson.zst": {
60
- "sha256": "c9253bd53ed377e5ef17c328b2c6c9b095afd8745fa2d285a4f9e3cb9f50f4e5",
61
- "bytes": 15788300
62
- },
63
- "current.current-top.sigs.ndjson.br": {
64
- "sha256": "b9351afc6de023d65df243cb325b2a88c919acfdc872b7cb5b734d0a3d20a61f",
65
- "bytes": 2123308
66
- },
67
- "current.current-top.sigs.ndjson.zst": {
68
- "sha256": "c1cf6aced3ba0013e3369e7e1e0d843659bd74936d89343b8f65d0a83a1d270a",
69
- "bytes": 2224574
70
- },
71
- "current.dict.sigs.ndjson.br": {
72
- "sha256": "467798d91506e50cd419513acdc90b1ad40eb8888af3ca9e94b9292acccff42c",
73
- "bytes": 6635365
74
- },
75
- "current.dict.sigs.ndjson.zst": {
76
- "sha256": "ba26328b2e41d569470d7dcae74e8a7b71cc5b96129ac975a80aaaba7f14b900",
77
- "bytes": 6776106
78
- },
79
- "current.manifest.json.br": {
80
- "sha256": "9d150be7ef1c265dff29d8a07df8af9440a01cce5b3c4702ea5d4c175d7ad9d3",
81
- "bytes": 420886
82
- },
83
- "current.manifest.json.zst": {
84
- "sha256": "8f7fa0048b6e50560eb11a05e0b6c7cd73332f60f106b3051ff6db8135468a06",
85
- "bytes": 540936
86
- },
87
- "history.dict.sigs.ndjson.br": {
88
- "sha256": "d99208eadaa7bf5f2acd6ec41a05dba3eeffc68faa294cbd018a4b9b78e77107",
89
- "bytes": 6917713
90
- },
91
- "history.dict.sigs.ndjson.zst": {
92
- "sha256": "29d01db01b65d7b84f4b05f5c652905214be270b11e0ba802108178b810a2099",
93
- "bytes": 7048453
94
- },
95
- "history.history-rest.sigs.ndjson.br": {
96
- "sha256": "ddfa1dd8c5b2abcb8f14711c91c8e3490778759171933381929f612c939d92a1",
97
- "bytes": 29750045
98
- },
99
- "history.history-rest.sigs.ndjson.zst": {
100
- "sha256": "e83887af44e7894d85ddac23acf5347b8dc5a143ed8c83fc95a64fbdf9f7a4b7",
101
- "bytes": 32199780
102
- },
103
- "history.manifest.json.br": {
104
- "sha256": "bf79bca873f7b056915db8d845f31acec64c2bb75b423c21e0b40e6e5ecd8d33",
105
- "bytes": 335712
106
- },
107
- "history.manifest.json.zst": {
108
- "sha256": "a290c361dada2d97657aafe8d788e3b1f723ad3cfc31630a6338afe43d55b248",
109
- "bytes": 429934
110
- }
111
- }
2
+ "format": "flowr-sigdb-remote",
3
+ "schema": 2,
4
+ "tag": "v2.12.3",
5
+ "repo": "flowr-analysis/flowr",
6
+ "shards": {
7
+ "base.base-current.sigs.ndjson.br": {
8
+ "sha256": "e416dbb477b7db257a024e564c4b1624bceec977f8935b5b7d886680bee51523",
9
+ "bytes": 94093
10
+ },
11
+ "base.base-current.sigs.ndjson.zst": {
12
+ "sha256": "344725e5e230667a6189a80dd69e70c7c5d3681b8955f8776b6c2d454ed13759",
13
+ "bytes": 99922
14
+ },
15
+ "base.base-full.sigs.ndjson.br": {
16
+ "sha256": "0631a4448840cd8ae5dd5495cb7a76736ed4157cb8a9614017571c9be8f281b6",
17
+ "bytes": 427552
18
+ },
19
+ "base.base-full.sigs.ndjson.zst": {
20
+ "sha256": "c6d4224dd34c53163af537731b767cf5ec100d688325aca560a6f732897f1306",
21
+ "bytes": 464284
22
+ },
23
+ "base.dict.sigs.ndjson.br": {
24
+ "sha256": "b9b67b8482d94790e549bd992285efcc1a0b6fe63e8c27f3aff90181b93e93b9",
25
+ "bytes": 49912
26
+ },
27
+ "base.dict.sigs.ndjson.zst": {
28
+ "sha256": "15ecccca667b47e3b5f29d8cc149efa6741455bb94a62740736753f8bbd84a89",
29
+ "bytes": 51311
30
+ },
31
+ "base.manifest.json.br": {
32
+ "sha256": "d7749a4146eee5f64a31a58c609dc1af537fd158672f468f04c3e45469d00f63",
33
+ "bytes": 802
34
+ },
35
+ "base.manifest.json.zst": {
36
+ "sha256": "84dc383f8414764e0f080d3b00ba53c54b9fed58285e67341d5c4182cc06402e",
37
+ "bytes": 916
38
+ },
39
+ "current.base-current.sigs.ndjson.br": {
40
+ "sha256": "664459693ec1ff507fae465dc91c34f4dd507063144bfe6ae4d18fd17cbbf132",
41
+ "bytes": 101245
42
+ },
43
+ "current.base-current.sigs.ndjson.zst": {
44
+ "sha256": "adb44ea28268be16428b59265865c567b5232bc1e015feef29802c3116d03d93",
45
+ "bytes": 106631
46
+ },
47
+ "current.base-full.sigs.ndjson.br": {
48
+ "sha256": "9e339e4916fdf11a0339591705eaa6d356656873355777ead3476fc4b607d247",
49
+ "bytes": 443384
50
+ },
51
+ "current.base-full.sigs.ndjson.zst": {
52
+ "sha256": "92ed0acca5215c4f7e45aabe4ea5b3266525a624deed03b73e351900689cbeba",
53
+ "bytes": 479202
54
+ },
55
+ "current.current-rest.sigs.ndjson.br": {
56
+ "sha256": "4b0eaaaf4322c0c661906933c758adbf8e1555d768f765e62e59e1cd5ce25371",
57
+ "bytes": 15063281
58
+ },
59
+ "current.current-rest.sigs.ndjson.zst": {
60
+ "sha256": "c9253bd53ed377e5ef17c328b2c6c9b095afd8745fa2d285a4f9e3cb9f50f4e5",
61
+ "bytes": 15788300
62
+ },
63
+ "current.current-top.sigs.ndjson.br": {
64
+ "sha256": "b9351afc6de023d65df243cb325b2a88c919acfdc872b7cb5b734d0a3d20a61f",
65
+ "bytes": 2123308
66
+ },
67
+ "current.current-top.sigs.ndjson.zst": {
68
+ "sha256": "c1cf6aced3ba0013e3369e7e1e0d843659bd74936d89343b8f65d0a83a1d270a",
69
+ "bytes": 2224574
70
+ },
71
+ "current.dict.sigs.ndjson.br": {
72
+ "sha256": "467798d91506e50cd419513acdc90b1ad40eb8888af3ca9e94b9292acccff42c",
73
+ "bytes": 6635365
74
+ },
75
+ "current.dict.sigs.ndjson.zst": {
76
+ "sha256": "ba26328b2e41d569470d7dcae74e8a7b71cc5b96129ac975a80aaaba7f14b900",
77
+ "bytes": 6776106
78
+ },
79
+ "current.manifest.json.br": {
80
+ "sha256": "9d150be7ef1c265dff29d8a07df8af9440a01cce5b3c4702ea5d4c175d7ad9d3",
81
+ "bytes": 420886
82
+ },
83
+ "current.manifest.json.zst": {
84
+ "sha256": "8f7fa0048b6e50560eb11a05e0b6c7cd73332f60f106b3051ff6db8135468a06",
85
+ "bytes": 540936
86
+ },
87
+ "history.dict.sigs.ndjson.br": {
88
+ "sha256": "d99208eadaa7bf5f2acd6ec41a05dba3eeffc68faa294cbd018a4b9b78e77107",
89
+ "bytes": 6917713
90
+ },
91
+ "history.dict.sigs.ndjson.zst": {
92
+ "sha256": "29d01db01b65d7b84f4b05f5c652905214be270b11e0ba802108178b810a2099",
93
+ "bytes": 7048453
94
+ },
95
+ "history.history-rest.sigs.ndjson.br": {
96
+ "sha256": "ddfa1dd8c5b2abcb8f14711c91c8e3490778759171933381929f612c939d92a1",
97
+ "bytes": 29750045
98
+ },
99
+ "history.history-rest.sigs.ndjson.zst": {
100
+ "sha256": "e83887af44e7894d85ddac23acf5347b8dc5a143ed8c83fc95a64fbdf9f7a4b7",
101
+ "bytes": 32199780
102
+ },
103
+ "history.manifest.json.br": {
104
+ "sha256": "bf79bca873f7b056915db8d845f31acec64c2bb75b423c21e0b40e6e5ecd8d33",
105
+ "bytes": 335712
106
+ },
107
+ "history.manifest.json.zst": {
108
+ "sha256": "a290c361dada2d97657aafe8d788e3b1f723ad3cfc31630a6338afe43d55b248",
109
+ "bytes": 429934
110
+ }
111
+ }
112
112
  }
@@ -21,9 +21,15 @@ export declare enum ArgProp {
21
21
  Shape = 16,
22
22
  /** selects a behavior instead of carrying data, like `na.rm` in `sum(x, na.rm = TRUE)` */
23
23
  Flag = 32,
24
- /** names the resource the call reads or writes, like `file` in `write.csv(x, file)` */
24
+ /**
25
+ * names the resource the call reads or writes, like `file` in `write.csv(x, file)`. A call that reads some
26
+ * files and writes others marks the ones it writes {@link ArgProp.Written} as well, see {@link FnSig.resources}.
27
+ */
25
28
  Resource = 64,
26
- /** what it refers to may be modified, like `envir` in `assign(x, v, envir = e)` */
29
+ /**
30
+ * what it refers to may be modified, like `envir` in `assign(x, v, envir = e)`, or the file `to` names in
31
+ * `file.copy(from, to)`
32
+ */
27
33
  Written = 128,
28
34
  /** quoted or evaluated in another frame, like `expr` in `quote(expr)` */
29
35
  Nse = 256,
@@ -289,6 +295,12 @@ export declare const CallProps: {
289
295
  * by their full name only.
290
296
  */
291
297
  export type FnSig = [name: string, props: ArgProps][];
298
+ /**
299
+ * The signature with only the {@link ArgProp.Resource} arguments the call reads (`writes` false) or writes. Only
300
+ * a call that reads and writes marks the ones it writes {@link ArgProp.Written}, like `exdir` in
301
+ * `unzip(zipfile, exdir = "out")`. One that marks none does whatever it does to every resource argument.
302
+ */
303
+ declare function resourcesOf(sig: FnSig, writes: boolean): FnSig;
292
304
  /**
293
305
  * Utility functions for {@link FnSig|function signatures}.
294
306
  */
@@ -309,6 +321,8 @@ export declare const FnSig: {
309
321
  readonly every: FnSig;
310
322
  /** A signature saying only that the call evaluates one argument; see {@link forcingOnly}. */
311
323
  readonly only: typeof forcingOnly;
324
+ /** The signature keeping only the resources the call reads or writes, see {@link resourcesOf}. */
325
+ readonly resources: typeof resourcesOf;
312
326
  };
313
327
  /**
314
328
  * Utility functions for {@link ArgProps|argument property bitfields}.
@@ -27,9 +27,15 @@ var ArgProp;
27
27
  ArgProp[ArgProp["Shape"] = 16] = "Shape";
28
28
  /** selects a behavior instead of carrying data, like `na.rm` in `sum(x, na.rm = TRUE)` */
29
29
  ArgProp[ArgProp["Flag"] = 32] = "Flag";
30
- /** names the resource the call reads or writes, like `file` in `write.csv(x, file)` */
30
+ /**
31
+ * names the resource the call reads or writes, like `file` in `write.csv(x, file)`. A call that reads some
32
+ * files and writes others marks the ones it writes {@link ArgProp.Written} as well, see {@link FnSig.resources}.
33
+ */
31
34
  ArgProp[ArgProp["Resource"] = 64] = "Resource";
32
- /** what it refers to may be modified, like `envir` in `assign(x, v, envir = e)` */
35
+ /**
36
+ * what it refers to may be modified, like `envir` in `assign(x, v, envir = e)`, or the file `to` names in
37
+ * `file.copy(from, to)`
38
+ */
33
39
  ArgProp[ArgProp["Written"] = 128] = "Written";
34
40
  /** quoted or evaluated in another frame, like `expr` in `quote(expr)` */
35
41
  ArgProp[ArgProp["Nse"] = 256] = "Nse";
@@ -377,6 +383,18 @@ exports.CallProps = {
377
383
  * about a callee flowR cannot resolve.
378
384
  */
379
385
  const ForcingEvery = [['...', ArgProp.Forced]];
386
+ /**
387
+ * The signature with only the {@link ArgProp.Resource} arguments the call reads (`writes` false) or writes. Only
388
+ * a call that reads and writes marks the ones it writes {@link ArgProp.Written}, like `exdir` in
389
+ * `unzip(zipfile, exdir = "out")`. One that marks none does whatever it does to every resource argument.
390
+ */
391
+ function resourcesOf(sig, writes) {
392
+ const written = ArgProp.Resource | ArgProp.Written;
393
+ if (!sig.some(([, p]) => (p & written) === written)) {
394
+ return sig;
395
+ }
396
+ return sig.map(([n, p]) => (p & ArgProp.Resource) === 0 || ((p & ArgProp.Written) !== 0) === writes ? [n, p] : [n, p & ~ArgProp.Resource]);
397
+ }
380
398
  /**
381
399
  * Utility functions for {@link FnSig|function signatures}.
382
400
  */
@@ -396,7 +414,9 @@ exports.FnSig = {
396
414
  /** A signature saying only that the call evaluates every argument; see {@link ForcingEvery}. */
397
415
  every: ForcingEvery,
398
416
  /** A signature saying only that the call evaluates one argument; see {@link forcingOnly}. */
399
- only: forcingOnly
417
+ only: forcingOnly,
418
+ /** The signature keeping only the resources the call reads or writes, see {@link resourcesOf}. */
419
+ resources: resourcesOf
400
420
  };
401
421
  /** the {@link ArgProp} bits as words; integer keys iterate in ascending bit order */
402
422
  const ArgPropWords = {
@@ -219,16 +219,26 @@ function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsPro
219
219
  /**
220
220
  * A call that reads or writes the files its arguments name accesses the {@link AmbientStateName.files|files on disk} as well.
221
221
  * Closing a device writes the file its opening already wrote, and only a device's file name may number its pages (`plot%03d.png`).
222
+ * A call reading some files and writing others (`unzip(zipfile, exdir = "out")`) does both, each with its own files.
222
223
  */
223
224
  function withFileAccess(config) {
224
225
  const { tags, ambient, sig } = (config ?? {});
225
- const type = !tags?.includes(built_in_props_1.SemanticCallTag.File) ? undefined : tags.includes(built_in_props_1.SemanticCallTag.Writes) ? "write-files" /* AmbientStateAccessType.WriteFiles */ : tags.includes(built_in_props_1.SemanticCallTag.Reads) ? "read-files" /* AmbientStateAccessType.ReadFiles */ : undefined;
226
+ if (!tags?.includes(built_in_props_1.SemanticCallTag.File)) {
227
+ return config;
228
+ }
229
+ const writes = tags.includes(built_in_props_1.SemanticCallTag.Writes);
230
+ const split = writes && tags.includes(built_in_props_1.SemanticCallTag.Reads) && sig !== undefined && built_in_props_1.FnSig.resources(sig, true) !== sig;
231
+ /* reading first, so the files read are the ones written before, not the call's own */
232
+ const types = [...split || !writes && tags.includes(built_in_props_1.SemanticCallTag.Reads) ? ["read-files" /* AmbientStateAccessType.ReadFiles */] : [], ...writes ? ["write-files" /* AmbientStateAccessType.WriteFiles */] : []];
226
233
  const stated = [ambient ?? []].flat();
227
- if (type === undefined || stated.some(a => a.type === type || a.type === "close-device" /* AmbientStateAccessType.CloseDevice */)) {
234
+ if (types.length === 0 || stated.some(a => types.includes(a.type) || a.type === "close-device" /* AmbientStateAccessType.CloseDevice */)) {
228
235
  return config;
229
236
  }
230
237
  const numbered = stated.some(a => a.type === "open-device" /* AmbientStateAccessType.OpenDevice */);
231
- return { ...config, ambient: [...stated, { type, sig: tags?.includes(built_in_props_1.SemanticCallTag.Glob) ? undefined : sig, numbered }] };
238
+ const glob = tags.includes(built_in_props_1.SemanticCallTag.Glob);
239
+ return { ...config, ambient: [...stated, ...types.map(type => ({
240
+ type, numbered, sig: glob || sig === undefined ? undefined : split ? built_in_props_1.FnSig.resources(sig, type === "write-files" /* AmbientStateAccessType.WriteFiles */) : sig
241
+ }))] };
232
242
  }
233
243
  exports.BuiltInProcessorMapper = {
234
244
  [built_in_proc_name_1.BuiltInProcName.Access]: built_in_access_1.processAccess,