@eagleoutice/flowr 2.17.12 → 2.17.14

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 (115) hide show
  1. package/README.md +15 -15
  2. package/cli/repl/core.js +9 -27
  3. package/config.d.ts +1 -0
  4. package/config.js +4 -2
  5. package/data/r-datasets.generated.js +2 -2
  6. package/dataflow/environments/ambient-effect.d.ts +4 -0
  7. package/dataflow/environments/ambient-effect.js +5 -4
  8. package/dataflow/environments/ambient-state-name.d.ts +2 -2
  9. package/dataflow/environments/ambient-state-name.js +3 -3
  10. package/dataflow/environments/built-in-props.d.ts +5 -0
  11. package/dataflow/environments/default-builtin-config/base-functions.d.ts +1 -1
  12. package/dataflow/environments/default-builtin-config/base-functions.js +6 -2
  13. package/dataflow/environments/default-builtin-config/base-language.d.ts +12 -1
  14. package/dataflow/environments/default-builtin-config/base-language.js +3 -2
  15. package/dataflow/environments/default-builtin-config/guards.js +3 -1
  16. package/dataflow/environments/default-builtin-config/index.d.ts +12 -2
  17. package/dataflow/environments/default-builtin-config/misc-packages.d.ts +1 -1
  18. package/dataflow/environments/default-builtin-config/misc-packages.js +2 -0
  19. package/dataflow/environments/default-builtin-config/shared-configs.d.ts +24 -0
  20. package/dataflow/environments/default-builtin-config/shared-configs.js +8 -6
  21. package/dataflow/environments/pkg-name.d.ts +1 -0
  22. package/dataflow/eval/resolve/alias-tracking.js +11 -12
  23. package/dataflow/extractor.js +58 -0
  24. package/dataflow/fn/guards/built-in-guards.js +4 -4
  25. package/dataflow/fn/guards/call-contracts.js +8 -8
  26. package/dataflow/fn/guards/condition-grouping.js +4 -3
  27. package/dataflow/fn/guards/function-guards.js +103 -97
  28. package/dataflow/fn/guards/group-method-guards.js +10 -8
  29. package/dataflow/fn/guards/guard-claims.js +152 -128
  30. package/dataflow/fn/guards/guard-knowledge.js +19 -18
  31. package/dataflow/fn/guards/guard-term-syntax.js +13 -12
  32. package/dataflow/fn/guards/guard-term.d.ts +71 -0
  33. package/dataflow/fn/guards/guard-term.js +183 -75
  34. package/dataflow/graph/df-helper.d.ts +6 -6
  35. package/dataflow/graph/df-helper.js +1 -1
  36. package/dataflow/graph/graph.d.ts +9 -0
  37. package/dataflow/graph/graph.js +19 -0
  38. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +18 -14
  39. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  40. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +29 -0
  41. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +2 -1
  42. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +2 -1
  43. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +6 -2
  44. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +9 -2
  45. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +1 -1
  46. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +12 -1
  47. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +24 -6
  48. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +10 -10
  49. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -2
  50. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +1 -1
  51. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -9
  52. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +35 -3
  53. package/documentation/doc-readme.js +1 -2
  54. package/documentation/doc-util/doc-query.d.ts +1 -1
  55. package/documentation/doc-util/doc-query.js +4 -2
  56. package/documentation/wiki-interface.js +1 -0
  57. package/documentation/wiki-linter.d.ts +2 -0
  58. package/documentation/wiki-linter.js +7 -1
  59. package/documentation/wiki-query.js +28 -0
  60. package/linter/linter-format.d.ts +5 -1
  61. package/linter/linter-format.js +4 -0
  62. package/linter/linter-output.js +18 -16
  63. package/linter/linter-rules.d.ts +50 -0
  64. package/linter/linter-rules.js +5 -1
  65. package/linter/rules/notebook-cell-order.d.ts +43 -0
  66. package/linter/rules/notebook-cell-order.js +97 -0
  67. package/linter/rules/project-entry-point.d.ts +53 -0
  68. package/linter/rules/project-entry-point.js +62 -0
  69. package/linter/rules/undefined-symbol.d.ts +2 -0
  70. package/linter/rules/undefined-symbol.js +6 -1
  71. package/notebook/cell-graph.d.ts +23 -0
  72. package/notebook/cell-graph.js +48 -0
  73. package/notebook/cell-order-mermaid.d.ts +16 -0
  74. package/notebook/cell-order-mermaid.js +51 -0
  75. package/notebook/cell-order.d.ts +270 -0
  76. package/notebook/cell-order.js +1452 -0
  77. package/notebook/cell-split.d.ts +27 -0
  78. package/notebook/cell-split.js +99 -0
  79. package/package.json +1 -1
  80. package/project/context/flowr-analyzer-dependencies-context.d.ts +4 -0
  81. package/project/context/flowr-analyzer-files-context.d.ts +2 -0
  82. package/project/flowr-analyzer.js +5 -1
  83. package/project/plugins/file-plugins/files/cell-runner.d.ts +22 -0
  84. package/project/plugins/file-plugins/files/cell-runner.js +32 -0
  85. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +4 -0
  86. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +22 -6
  87. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +22 -0
  88. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +63 -7
  89. package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +2 -0
  90. package/project/plugins/file-plugins/files/flowr-rsession-file.js +2 -0
  91. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +3 -5
  92. package/project/plugins/file-plugins/files/flowr-sweave-file.js +6 -0
  93. package/project/plugins/file-plugins/files/recorded-runs.d.ts +2 -0
  94. package/queries/catalog/aliases-query/aliases-query-executor.d.ts +6 -0
  95. package/queries/catalog/aliases-query/aliases-query-executor.js +108 -0
  96. package/queries/catalog/aliases-query/aliases-query-format.d.ts +21 -0
  97. package/queries/catalog/aliases-query/aliases-query-format.js +34 -0
  98. package/queries/catalog/cell-order-query/cell-order-query-format.d.ts +81 -0
  99. package/queries/catalog/cell-order-query/cell-order-query-format.js +82 -0
  100. package/queries/catalog/linter-query/linter-query-format.js +2 -1
  101. package/queries/query.d.ts +17 -2
  102. package/queries/query.js +6 -2
  103. package/queries/virtual-query/compound-query.d.ts +1 -1
  104. package/util/flowr-version.d.ts +1 -1
  105. package/util/flowr-version.js +2 -2
  106. package/util/mermaid/ast.js +4 -11
  107. package/util/mermaid/cfg.js +1 -2
  108. package/util/mermaid/dfg.d.ts +5 -0
  109. package/util/mermaid/dfg.js +23 -4
  110. package/util/mermaid/mermaid.d.ts +5 -0
  111. package/util/mermaid/mermaid.js +8 -0
  112. package/util/r-datasets.d.ts +2 -0
  113. package/util/r-datasets.js +3 -0
  114. package/util/text/playground-link.d.ts +2 -2
  115. package/util/text/playground-link.js +2 -2
@@ -75,7 +75,7 @@ function reasonsOf(clauses, idMap, ownerOf = () => undefined) {
75
75
  const brief = briefOf(node, message, idMap);
76
76
  const called = model_1.RNode.ownLexeme(node);
77
77
  const reads = (0, guard_claims_1.readingOf)(requires, (0, guard_knowledge_1.defaultGuardFacts)(), called === undefined ? undefined : (0, group_generics_1.s3GroupGenericOf)(called));
78
- const formals = [...guard_term_1.GuardTerm.formalsOf(requires)];
78
+ const formals = guard_term_1.GuardTerm.formalsOf(requires).values().toArray();
79
79
  const loc = locationOf(node, idMap, qualified);
80
80
  return (0, objects_1.compactRecord)({
81
81
  requires: rendered,
@@ -146,13 +146,13 @@ function requirementsOf(name) {
146
146
  }
147
147
  const required = facts?.required ?? [];
148
148
  const dispatched = formals.filter(f => f !== '...');
149
- const terms = [...stated.map(c => c.requires), ...(0, group_method_guards_1.groupMethodConditions)(name, dispatched.map(guard_term_1.GuardTerm.formal), new Set(), (0, guard_knowledge_1.defaultGuardFacts)())];
149
+ const terms = stated.map(c => c.requires).concat((0, group_method_guards_1.groupMethodConditions)(name, dispatched.map(guard_term_1.GuardTerm.formal), new Set(), (0, guard_knowledge_1.defaultGuardFacts)()));
150
150
  const claims = (0, guard_claims_1.claimsOf)(terms, (0, arrays_1.uniqueArrayMerge)(stated.map(c => c.formal), required), (0, guard_knowledge_1.defaultGuardFacts)());
151
151
  const relations = (0, guard_claims_1.relationsOf)(terms, (0, guard_knowledge_1.defaultGuardFacts)());
152
152
  const conditional = (0, guard_claims_1.conditionalClaimsOf)(terms, formals.filter(f => f !== '...'), (0, guard_knowledge_1.defaultGuardFacts)());
153
153
  const calls = callsOfTerms(terms);
154
154
  return (0, objects_1.compactRecord)({
155
- requires: terms.length === 0 ? '' : guard_term_1.GuardTerm.render(guard_term_1.GuardTerm.all(...terms)),
155
+ requires: terms.length === 0 ? '' : guard_term_1.GuardTerm.render(guard_term_1.GuardTerm.allOf(terms)),
156
156
  required: (0, objects_1.nonEmpty)(required),
157
157
  formals: Object.keys(claims).length > 0 ? claims : undefined,
158
158
  relations: (0, objects_1.nonEmpty)(relations),
@@ -168,7 +168,7 @@ function namesWithGuards() {
168
168
  const table = (0, r_base_guards_generated_1.RBaseGuards)();
169
169
  const inTable = Object.entries(table).flatMap(([pkg, names]) => Object.keys(names).map(name => [pkg, name]));
170
170
  const known = new Set(inTable.map(([pkg, name]) => `${pkg}::${name}`));
171
- return [...inTable, ...(0, guards_1.namesWithGuardFacts)().filter(([, name]) => requirementsOf(name) !== undefined).map(([, name]) => [(0, r_base_packages_1.baseRExportOwner)(name) ?? "base" /* PkgName.Base */, name]).filter(([pkg, name]) => !known.has(`${pkg}::${name}`))];
171
+ return inTable.concat((0, guards_1.namesWithGuardFacts)().filter(([, name]) => requirementsOf(name) !== undefined).map(([, name]) => [(0, r_base_packages_1.baseRExportOwner)(name) ?? "base" /* PkgName.Base */, name]).filter(([pkg, name]) => !known.has(`${pkg}::${name}`)));
172
172
  }
173
173
  /**
174
174
  * What a function of the base packages asks of the calls returning from it: what its closure checks, and else what is known of it being written in C.
@@ -53,8 +53,8 @@ function of(graph, ctx, idMap = graph.idMap) {
53
53
  let loads;
54
54
  return {
55
55
  graph, idMap, ctx, facts: (0, guard_knowledge_1.guardFactsOf)(ctx),
56
- mayAddMethods: generic => [...bindings.keys()].some(name => name.startsWith(`${generic}.`)) || (loads ??= loadsPackages(graph, ctx)),
57
- rewritesFormals: [...graph.verticesOfType(vertex_1.VertexType.FunctionCall)].some(([, v]) => FormalsRewriters.has(identifier_1.Identifier.getName(v.name))),
56
+ mayAddMethods: generic => bindings.keys().some(name => name.startsWith(`${generic}.`)) || (loads ??= loadsPackages(graph, ctx)),
57
+ rewritesFormals: graph.verticesOfType(vertex_1.VertexType.FunctionCall).some(([, v]) => FormalsRewriters.has(identifier_1.Identifier.getName(v.name))),
58
58
  definitions: new Map(),
59
59
  functions: new Map()
60
60
  };
@@ -72,7 +72,7 @@ function statedClauses(name, stated, formals, scope) {
72
72
  });
73
73
  /* a value without a class attribute may still run a method another package registers for its implicit class */
74
74
  const open = (stated.dispatches !== undefined || r_s3_generics_generated_1.RS3Generics.genericFormals[String(name)] !== undefined) && scope.mayAddMethods(name);
75
- return terms.filter(t => !open || !guard_term_1.GuardTerm.mentions(t, 'is.object'));
75
+ return terms.filter(t => !open || !guard_term_1.GuardTerm.mentions(t, guard_term_1.GuardFn.IsObject));
76
76
  }
77
77
  /** What is stated of a function by name: what the signature database answers (given a context to ask it in), or else flowR's table of the base packages. */
78
78
  function statedOf(name, ctx) {
@@ -219,7 +219,7 @@ function literalsOf(value) {
219
219
  }
220
220
  /* the elements have one type: all integers or all doubles for numbers */
221
221
  const variants = elements[0].map((_, at) => elements.map(e => e[at]));
222
- return variants.map(v => guard_term_1.GuardTerm.known('c', ...v));
222
+ return variants.map(v => guard_term_1.GuardTerm.knownOf(guard_term_1.GuardFn.Combine, v));
223
223
  }
224
224
  /** The literals the argument may hold, `undefined` if not all of them are known. */
225
225
  function argumentLiterals(node, vertex, scope) {
@@ -237,7 +237,7 @@ function argumentLiterals(node, vertex, scope) {
237
237
  function combinations(choices) {
238
238
  let result = [new Map()];
239
239
  for (const [name, literals] of choices) {
240
- result = result.flatMap(binding => literals.map(l => new Map([...binding, [name, l]])));
240
+ result = result.flatMap(binding => literals.map(l => new Map(binding).set(name, l)));
241
241
  if (result.length > MaxCombinations) {
242
242
  return undefined;
243
243
  }
@@ -278,14 +278,14 @@ function breaches(call, contract, scope) {
278
278
  };
279
279
  for (const clause of contract.clauses) {
280
280
  const { requires } = (0, function_guards_1.atCall)(clause, binding, undefined, facts);
281
- const placeholders = [...guard_term_1.GuardTerm.formalsOf(requires)];
282
- const bindings = combinations(new Map(placeholders.map(p => [p, literalsAt(p)])));
281
+ const placeholders = guard_term_1.GuardTerm.formalsOf(requires);
282
+ const bindings = combinations(new Map(placeholders.values().map(p => [p, literalsAt(p)])));
283
283
  if (bindings === undefined || !bindings.every(b => guard_term_1.GuardTerm.isFalse(guard_term_1.GuardTerm.substituteCondition(requires, b, undefined, facts)))) {
284
284
  continue;
285
285
  }
286
286
  const values = contract.formals.flatMap(formal => {
287
287
  const bound = binding.binding.get(formal);
288
- const literals = bound?.kind === 'formal' && placeholders.includes(bound.name) ? literalsAt(bound.name) : [];
288
+ const literals = bound?.kind === 'formal' && placeholders.has(bound.name) ? literalsAt(bound.name) : [];
289
289
  const node = bound?.kind === 'formal' ? args.get(bound.name)?.node : undefined;
290
290
  return literals.length === 0 ? [] : [[formal, model_1.RConstant.is(node) ? node.lexeme : shown(literals).join(' or ')]];
291
291
  });
@@ -37,7 +37,8 @@ function splitTopLevel(text, separator) {
37
37
  i += separator.length - 1;
38
38
  }
39
39
  }
40
- return [...parts, text.slice(start)];
40
+ parts.push(text.slice(start));
41
+ return parts;
41
42
  }
42
43
  /** the connectives a condition is written with, from the one binding loosest */
43
44
  const Connectives = [' and ', ' unless ', ' || ', ' && '];
@@ -165,7 +166,7 @@ function mergedRelations(relations) {
165
166
  entry.unless.push(relation.unless === undefined || relation.unless === '' ? undefined : splitTopLevel(bare(relation.unless), ' || '));
166
167
  merged.set(key, entry);
167
168
  }
168
- return [...merged.values()].map(({ first, unless }) => {
169
+ return Array.from(merged.values(), ({ first, unless }) => {
169
170
  if (unless.length === 1) {
170
171
  return first;
171
172
  }
@@ -176,7 +177,7 @@ function mergedRelations(relations) {
176
177
  const common = offers[0].filter(d => offers.every(u => u.includes(d)));
177
178
  const rests = offers.map(u => u.filter(d => !common.includes(d))).filter((rest, at, all) => all.findIndex(r => r.join() === rest.join()) === at);
178
179
  const own = rests.some(r => r.length === 0) ? [] : [rests.length === 1 ? rests[0].join(' || ') : `(${allOf(rests.map(r => r.join(' || ')))})`];
179
- return { ...first, unless: [...common, ...own].join(' || ') };
180
+ return { ...first, unless: common.concat(own).join(' || ') };
180
181
  });
181
182
  }
182
183
  //# sourceMappingURL=condition-grouping.js.map