@eagleoutice/flowr 2.17.13 → 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.
- package/README.md +15 -15
- package/cli/repl/core.js +9 -27
- package/data/r-datasets.generated.js +2 -2
- package/dataflow/environments/ambient-effect.d.ts +4 -0
- package/dataflow/environments/ambient-effect.js +5 -4
- package/dataflow/environments/ambient-state-name.d.ts +2 -2
- package/dataflow/environments/ambient-state-name.js +3 -3
- package/dataflow/environments/built-in-props.d.ts +5 -0
- package/dataflow/environments/default-builtin-config/base-functions.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/base-functions.js +4 -2
- package/dataflow/environments/default-builtin-config/base-language.d.ts +12 -1
- package/dataflow/environments/default-builtin-config/base-language.js +3 -2
- package/dataflow/environments/default-builtin-config/index.d.ts +12 -2
- package/dataflow/environments/default-builtin-config/misc-packages.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/misc-packages.js +2 -0
- package/dataflow/environments/default-builtin-config/shared-configs.d.ts +24 -0
- package/dataflow/environments/default-builtin-config/shared-configs.js +8 -6
- package/dataflow/environments/pkg-name.d.ts +1 -0
- package/dataflow/eval/resolve/alias-tracking.js +11 -12
- package/dataflow/graph/df-helper.d.ts +6 -6
- package/dataflow/graph/df-helper.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +18 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +29 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +12 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +24 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +10 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -2
- package/documentation/doc-readme.js +1 -2
- package/documentation/doc-util/doc-query.d.ts +1 -1
- package/documentation/doc-util/doc-query.js +4 -2
- package/documentation/wiki-linter.d.ts +2 -0
- package/documentation/wiki-linter.js +7 -1
- package/documentation/wiki-query.js +28 -0
- package/linter/linter-format.d.ts +5 -1
- package/linter/linter-format.js +4 -0
- package/linter/linter-output.js +18 -16
- package/linter/linter-rules.d.ts +50 -0
- package/linter/linter-rules.js +5 -1
- package/linter/rules/notebook-cell-order.d.ts +43 -0
- package/linter/rules/notebook-cell-order.js +97 -0
- package/linter/rules/project-entry-point.d.ts +53 -0
- package/linter/rules/project-entry-point.js +62 -0
- package/linter/rules/undefined-symbol.d.ts +2 -0
- package/linter/rules/undefined-symbol.js +6 -1
- package/notebook/cell-graph.d.ts +23 -0
- package/notebook/cell-graph.js +48 -0
- package/notebook/cell-order-mermaid.d.ts +16 -0
- package/notebook/cell-order-mermaid.js +51 -0
- package/notebook/cell-order.d.ts +270 -0
- package/notebook/cell-order.js +1452 -0
- package/notebook/cell-split.d.ts +27 -0
- package/notebook/cell-split.js +99 -0
- package/package.json +1 -1
- package/project/context/flowr-analyzer-dependencies-context.d.ts +4 -0
- package/project/context/flowr-analyzer-files-context.d.ts +2 -0
- package/project/flowr-analyzer.js +5 -1
- package/project/plugins/file-plugins/files/cell-runner.d.ts +22 -0
- package/project/plugins/file-plugins/files/cell-runner.js +32 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +4 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +22 -6
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +22 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +63 -7
- package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-rsession-file.js +2 -0
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +3 -5
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +6 -0
- package/project/plugins/file-plugins/files/recorded-runs.d.ts +2 -0
- package/queries/catalog/aliases-query/aliases-query-executor.d.ts +6 -0
- package/queries/catalog/aliases-query/aliases-query-executor.js +108 -0
- package/queries/catalog/aliases-query/aliases-query-format.d.ts +21 -0
- package/queries/catalog/aliases-query/aliases-query-format.js +34 -0
- package/queries/catalog/cell-order-query/cell-order-query-format.d.ts +81 -0
- package/queries/catalog/cell-order-query/cell-order-query-format.js +82 -0
- package/queries/catalog/linter-query/linter-query-format.js +2 -1
- package/queries/query.d.ts +17 -2
- package/queries/query.js +6 -2
- package/queries/virtual-query/compound-query.d.ts +1 -1
- package/util/flowr-version.d.ts +1 -1
- package/util/flowr-version.js +2 -2
- package/util/mermaid/ast.js +4 -11
- package/util/mermaid/cfg.js +1 -2
- package/util/mermaid/dfg.d.ts +5 -0
- package/util/mermaid/dfg.js +23 -4
- package/util/mermaid/mermaid.d.ts +5 -0
- package/util/mermaid/mermaid.js +8 -0
- package/util/r-datasets.d.ts +2 -0
- package/util/r-datasets.js +3 -0
- package/util/text/playground-link.d.ts +2 -2
- package/util/text/playground-link.js +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReadonlyFlowrAnalysisProvider } from '../project/flowr-analyzer';
|
|
2
|
+
import { type Line } from '../util/range';
|
|
3
|
+
import { type CellFacts, type CellIndex } from './cell-order';
|
|
4
|
+
/** Moving the statement on lines `from` to `to` out of the cell `cell` into a cell of its own just above the cell `before`, or at the end if it is `undefined`. */
|
|
5
|
+
export interface CellSplit {
|
|
6
|
+
readonly cell: CellIndex;
|
|
7
|
+
readonly from: Line;
|
|
8
|
+
readonly to: Line;
|
|
9
|
+
readonly before?: CellIndex;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* For a notebook whose cells need each other in a cycle, so that no order of them runs: the simplest change that breaks the
|
|
13
|
+
* cycle, moving one top-level statement out of its cell into a cell of its own between two others, the first place checked
|
|
14
|
+
* to make the notebook run top to bottom. `undefined` if some order of the cells runs already, or no such move does.
|
|
15
|
+
*/
|
|
16
|
+
export declare function splitForCycle(analyzer: ReadonlyFlowrAnalysisProvider): Promise<CellSplit | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* The text change that carries out `split` on the notebook `rows`: the statement leaves its cell and becomes a cell of its own,
|
|
19
|
+
* fenced as its cell is (without the label and options of that cell). `undefined` for cells without fences or markers.
|
|
20
|
+
*/
|
|
21
|
+
export declare function applySplit(rows: readonly string[], facts: readonly CellFacts[], split: CellSplit): {
|
|
22
|
+
readonly from: number;
|
|
23
|
+
readonly to: number;
|
|
24
|
+
readonly text: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
/** The cells that need themselves through others, so that no order of the cells runs them: each in the order of the notebook. */
|
|
27
|
+
export declare function cellsInCycle(facts: readonly CellFacts[]): CellIndex[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitForCycle = splitForCycle;
|
|
4
|
+
exports.applySplit = applySplit;
|
|
5
|
+
exports.cellsInCycle = cellsInCycle;
|
|
6
|
+
const range_1 = require("../util/range");
|
|
7
|
+
const cell_order_1 = require("./cell-order");
|
|
8
|
+
const runs = (facts, order) => (0, cell_order_1.checkOrder)(facts, order).every(f => f.missing.every(m => m.soft));
|
|
9
|
+
/**
|
|
10
|
+
* For a notebook whose cells need each other in a cycle, so that no order of them runs: the simplest change that breaks the
|
|
11
|
+
* cycle, moving one top-level statement out of its cell into a cell of its own between two others, the first place checked
|
|
12
|
+
* to make the notebook run top to bottom. `undefined` if some order of the cells runs already, or no such move does.
|
|
13
|
+
*/
|
|
14
|
+
async function splitForCycle(analyzer) {
|
|
15
|
+
const facts = await (0, cell_order_1.analyzeNotebook)(analyzer);
|
|
16
|
+
/* a notebook that fails for want of what no cell provides fails wherever its statements go, and only moving a statement of a cell in the cycle breaks it */
|
|
17
|
+
const cycle = new Set(cellsInCycle(facts));
|
|
18
|
+
if (facts.length < 2 || cycle.size === 0 || (0, cell_order_1.firstWorkingOrder)(facts) !== undefined) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
/* each top-level statement as a cell of its own, in the order of the notebook; those of one cell share its session */
|
|
22
|
+
const { ast } = await analyzer.normalize();
|
|
23
|
+
const statements = ast.files.flatMap(f => f.root.children)
|
|
24
|
+
.flatMap(n => {
|
|
25
|
+
const range = range_1.SourceRange.fromNode(n);
|
|
26
|
+
const cell = range === undefined ? -1 : facts.findIndex(f => range[0] >= f.cell.from && range[0] <= f.cell.to);
|
|
27
|
+
return range === undefined || cell < 0 ? [] : [{ cell, unit: { from: range[0], to: range[2], file: facts[cell].cell.file } }];
|
|
28
|
+
})
|
|
29
|
+
.sort((a, b) => a.unit.from - b.unit.from);
|
|
30
|
+
const units = await (0, cell_order_1.analyzeNotebook)(analyzer, statements.map(s => s.unit));
|
|
31
|
+
const inDocument = statements.map((_, i) => i);
|
|
32
|
+
/* the statements before both the one moved and its new place run as before, so the first of them that fails, fails after any move behind it */
|
|
33
|
+
const firstFailure = (0, cell_order_1.checkOrder)(units, inDocument).find(f => f.missing.some(m => !m.soft))?.at ?? statements.length;
|
|
34
|
+
/* a cell lacking what it removes before (`rm(e); e <- e + 1`) fails as long as the statement reading it stays in it */
|
|
35
|
+
const impossible = facts.flatMap(f => f.needs.filter(n => n.anyOf.length === 0 && !n.soft).map(n => range_1.SourceRange.getStartLine(n.range) ?? -1));
|
|
36
|
+
for (const [s, { cell, unit }] of statements.entries()) {
|
|
37
|
+
if (!cycle.has(cell) || impossible.some(line => line < unit.from || line > unit.to)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
/* the statement runs just above the first statement of the cell `before` (or at the end), the rest as they are, those of its own cell too */
|
|
41
|
+
for (const before of [...facts.keys(), undefined]) {
|
|
42
|
+
const at = before === undefined ? statements.length : statements.findIndex(t => t.cell === before);
|
|
43
|
+
if (Math.min(s, at) > firstFailure) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const order = [...inDocument.slice(0, at).filter(i => i !== s), s, ...inDocument.slice(at).filter(i => i !== s)];
|
|
47
|
+
if (runs(units, order)) {
|
|
48
|
+
return { cell, from: unit.from, to: unit.to, before };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
/** The lines of `rows` that `next` changes, as one replacement of the lines `from` to `to` by `text`. */
|
|
55
|
+
function changeOf(rows, next) {
|
|
56
|
+
let head = 0;
|
|
57
|
+
while (head < rows.length && head < next.length && rows[head] === next[head]) {
|
|
58
|
+
head++;
|
|
59
|
+
}
|
|
60
|
+
let tail = 0;
|
|
61
|
+
while (tail < rows.length - head && tail < next.length - head && rows[rows.length - 1 - tail] === next[next.length - 1 - tail]) {
|
|
62
|
+
tail++;
|
|
63
|
+
}
|
|
64
|
+
return { from: head + 1, to: rows.length - tail, text: next.slice(head, next.length - tail).join('\n') };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The text change that carries out `split` on the notebook `rows`: the statement leaves its cell and becomes a cell of its own,
|
|
68
|
+
* fenced as its cell is (without the label and options of that cell). `undefined` for cells without fences or markers.
|
|
69
|
+
*/
|
|
70
|
+
function applySplit(rows, facts, split) {
|
|
71
|
+
const cell = facts[split.cell].cell;
|
|
72
|
+
if (cell.head === undefined) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const fence = [rows[cell.head - 1].replace(/\{\s*r\b[^}]*\}/, '{r}'), ...rows.slice(split.from - 1, split.to), ...cell.tail === undefined ? [] : [rows[cell.tail - 1]]];
|
|
76
|
+
const target = split.before === undefined ? undefined : facts[split.before].cell;
|
|
77
|
+
const at = target === undefined ? rows.length : (target.head ?? target.from) - 1;
|
|
78
|
+
/* the new cell first, as it comes before or after the lines it leaves, then the statement out of its cell */
|
|
79
|
+
const next = [...rows.slice(0, at), ...fence, '', ...rows.slice(at)];
|
|
80
|
+
const shift = at < split.from ? fence.length + 1 : 0;
|
|
81
|
+
next.splice(split.from - 1 + shift, split.to - split.from + 1);
|
|
82
|
+
return changeOf(rows, next);
|
|
83
|
+
}
|
|
84
|
+
/** The cells that need themselves through others, so that no order of the cells runs them: each in the order of the notebook. */
|
|
85
|
+
function cellsInCycle(facts) {
|
|
86
|
+
const next = facts.map(f => f.needs.filter(n => !n.soft).flatMap(n => n.providers));
|
|
87
|
+
return facts.flatMap((_, start) => {
|
|
88
|
+
const seen = new Set();
|
|
89
|
+
for (const todo = [...next[start]]; todo.length > 0;) {
|
|
90
|
+
const at = todo.pop();
|
|
91
|
+
if (!seen.has(at)) {
|
|
92
|
+
seen.add(at);
|
|
93
|
+
todo.push(...next[at]);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return seen.has(start) ? [start] : [];
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=cell-split.js.map
|
package/package.json
CHANGED
|
@@ -48,6 +48,10 @@ export interface ReadOnlyFlowrAnalyzerDependenciesContext {
|
|
|
48
48
|
declaredPackageNames(): readonly BrandedNamespace[];
|
|
49
49
|
/** Metadata of the signature databases the version plugins currently have loaded. */
|
|
50
50
|
loadedSignatureDatabases(): SigDbLoadedInfo[];
|
|
51
|
+
/** Whether any version plugin can resolve the base-R packages (a versioned signature source is available). */
|
|
52
|
+
hasBaseRSource(): boolean;
|
|
53
|
+
/** Cheap fingerprint of only the base-R-providing databases, so base-R-derived caches survive unrelated database changes. */
|
|
54
|
+
baseRSourceFingerprint(): string;
|
|
51
55
|
/**
|
|
52
56
|
* The identifying names (scopes, e.g. `base`/`current`/`history`) of the signature databases currently
|
|
53
57
|
* available, deduplicated. A simple view over {@link loadedSignatureDatabases} for checking what a project
|
|
@@ -106,6 +106,8 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
|
|
|
106
106
|
exists(path: string, ignoreCase: boolean): string | undefined;
|
|
107
107
|
/** The project root folder (common directory of the requested roots), or `undefined` if none was requested. */
|
|
108
108
|
root(): string | undefined;
|
|
109
|
+
/** The path of `filePath` seen from the {@link root}. */
|
|
110
|
+
relativePath(filePath: string): string;
|
|
109
111
|
/** Until parsers support multiple request types from the virtual context system, we resolve their contents. */
|
|
110
112
|
resolveRequest(r: RParseRequest): {
|
|
111
113
|
r: RParseRequestFromText;
|
|
@@ -140,9 +140,13 @@ class FlowrAnalyzer {
|
|
|
140
140
|
/* the file stands in for the one known, starting out as what it held, so the change is one from that */
|
|
141
141
|
const before = known === undefined ? undefined : String(known.content());
|
|
142
142
|
const file = new flowr_file_1.FlowrInlineTextFile(known?.path() ?? path, before ?? content);
|
|
143
|
-
this.ctx.
|
|
143
|
+
const added = this.ctx.files.addFile(file);
|
|
144
144
|
file.content();
|
|
145
145
|
file.updateInlineContent(content);
|
|
146
|
+
/* a notebook wraps the text, and only the wrapper tells the analyzer it changed */
|
|
147
|
+
if (added !== file) {
|
|
148
|
+
added?.invalidate();
|
|
149
|
+
}
|
|
146
150
|
}
|
|
147
151
|
return this;
|
|
148
152
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** What runs the cells of a notebook, which decides the state each cell starts afresh with, see {@link RunnerFreshState}. */
|
|
2
|
+
export declare enum CellRunner {
|
|
3
|
+
/** one R session running cell after cell: a console, the `# %%` cells of a script, or `Sweave` */
|
|
4
|
+
Session = "session",
|
|
5
|
+
/** knitr, which knits R Markdown, Quarto, and knitr Sweave documents */
|
|
6
|
+
Knitr = "knitr",
|
|
7
|
+
Jupyter = "jupyter"
|
|
8
|
+
}
|
|
9
|
+
/** Ambient state a runner gives each cell afresh (without its `#`, a keyed family as `par:`), unless one of the package options `keptBy` holds. */
|
|
10
|
+
export interface FreshState {
|
|
11
|
+
readonly state: string;
|
|
12
|
+
readonly keptBy?: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The state each cell the runner runs starts afresh with, whatever the cells before it did. knitr gives each chunk a new plot on a new
|
|
16
|
+
* device with default graphics parameters, unless `opts_knit$set(global.device = TRUE)` keeps one device for all chunks (and with it
|
|
17
|
+
* the graphics parameters) or `global.par = TRUE` the graphics parameters, and runs it in the directory of the document (checked with
|
|
18
|
+
* knitr 1.51, R Markdown, and Quarto). Jupyter gives each cell a new plot, a session keeps everything.
|
|
19
|
+
*/
|
|
20
|
+
export declare const RunnerFreshState: Readonly<Record<CellRunner, readonly FreshState[]>>;
|
|
21
|
+
/** What the runner gives a cell afresh of the state `name`, if anything. */
|
|
22
|
+
export declare const freshStateOf: (runner: CellRunner | undefined, name: string) => FreshState | undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.freshStateOf = exports.RunnerFreshState = exports.CellRunner = void 0;
|
|
4
|
+
const ambient_state_name_1 = require("../../../../dataflow/environments/ambient-state-name");
|
|
5
|
+
/** What runs the cells of a notebook, which decides the state each cell starts afresh with, see {@link RunnerFreshState}. */
|
|
6
|
+
var CellRunner;
|
|
7
|
+
(function (CellRunner) {
|
|
8
|
+
/** one R session running cell after cell: a console, the `# %%` cells of a script, or `Sweave` */
|
|
9
|
+
CellRunner["Session"] = "session";
|
|
10
|
+
/** knitr, which knits R Markdown, Quarto, and knitr Sweave documents */
|
|
11
|
+
CellRunner["Knitr"] = "knitr";
|
|
12
|
+
CellRunner["Jupyter"] = "jupyter";
|
|
13
|
+
})(CellRunner || (exports.CellRunner = CellRunner = {}));
|
|
14
|
+
/**
|
|
15
|
+
* The state each cell the runner runs starts afresh with, whatever the cells before it did. knitr gives each chunk a new plot on a new
|
|
16
|
+
* device with default graphics parameters, unless `opts_knit$set(global.device = TRUE)` keeps one device for all chunks (and with it
|
|
17
|
+
* the graphics parameters) or `global.par = TRUE` the graphics parameters, and runs it in the directory of the document (checked with
|
|
18
|
+
* knitr 1.51, R Markdown, and Quarto). Jupyter gives each cell a new plot, a session keeps everything.
|
|
19
|
+
*/
|
|
20
|
+
exports.RunnerFreshState = {
|
|
21
|
+
[CellRunner.Knitr]: [
|
|
22
|
+
{ state: ambient_state_name_1.AmbientStateName.plot.slice(1), keptBy: ['global.device'] },
|
|
23
|
+
{ state: `${ambient_state_name_1.KeyedState.Par}:`, keptBy: ['global.device', 'global.par'] },
|
|
24
|
+
{ state: ambient_state_name_1.AmbientStateName.workingDirectory.slice(1) }
|
|
25
|
+
],
|
|
26
|
+
[CellRunner.Jupyter]: [{ state: ambient_state_name_1.AmbientStateName.plot.slice(1) }],
|
|
27
|
+
[CellRunner.Session]: []
|
|
28
|
+
};
|
|
29
|
+
/** What the runner gives a cell afresh of the state `name`, if anything. */
|
|
30
|
+
const freshStateOf = (runner, name) => exports.RunnerFreshState[runner ?? CellRunner.Session].find(f => f.state.endsWith(':') ? name.startsWith(f.state) : name === f.state);
|
|
31
|
+
exports.freshStateOf = freshStateOf;
|
|
32
|
+
//# sourceMappingURL=cell-runner.js.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type FlowrFileProvider, FileRole, FlowrFile } from '../../../context/flowr-file';
|
|
2
2
|
import type { RecordedRun, RecordsRuns } from './recorded-runs';
|
|
3
|
+
import { CellRunner } from './cell-runner';
|
|
3
4
|
/**
|
|
4
5
|
* This decorates a text file and parses its contents as a Jupyter file.
|
|
5
6
|
* Finnaly, it provides access to the single cells, and all cells fused together as one R file.
|
|
6
7
|
*/
|
|
7
8
|
export declare class FlowrJupyterFile extends FlowrFile implements RecordsRuns {
|
|
8
9
|
private readonly wrapped;
|
|
10
|
+
readonly runner = CellRunner.Jupyter;
|
|
9
11
|
/**
|
|
10
12
|
* Prefer the static {@link FlowrJupyterFile.from} method
|
|
11
13
|
* @param wrapped - the file to load as Jupyter
|
|
@@ -29,3 +31,5 @@ export declare class FlowrJupyterFile extends FlowrFile implements RecordsRuns {
|
|
|
29
31
|
}
|
|
30
32
|
/** the code cells of a notebook with the output recorded for each */
|
|
31
33
|
export declare function jupyterRecordedRuns(json: string): RecordedRun[];
|
|
34
|
+
/** the cells of a notebook as flowR reads them, in order: whether each is code, and its text (a text cell as comments) */
|
|
35
|
+
export declare function jupyterCells(content: string): [code: boolean, text: string][];
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowrJupyterFile = void 0;
|
|
4
4
|
exports.jupyterRecordedRuns = jupyterRecordedRuns;
|
|
5
|
+
exports.jupyterCells = jupyterCells;
|
|
5
6
|
const flowr_file_1 = require("../../../context/flowr-file");
|
|
7
|
+
const cell_runner_1 = require("./cell-runner");
|
|
6
8
|
/**
|
|
7
9
|
* This decorates a text file and parses its contents as a Jupyter file.
|
|
8
10
|
* Finnaly, it provides access to the single cells, and all cells fused together as one R file.
|
|
9
11
|
*/
|
|
10
12
|
class FlowrJupyterFile extends flowr_file_1.FlowrFile {
|
|
11
13
|
wrapped;
|
|
14
|
+
runner = cell_runner_1.CellRunner.Jupyter;
|
|
12
15
|
/**
|
|
13
16
|
* Prefer the static {@link FlowrJupyterFile.from} method
|
|
14
17
|
* @param wrapped - the file to load as Jupyter
|
|
@@ -55,8 +58,10 @@ function jupyterRecordedRuns(json) {
|
|
|
55
58
|
return [];
|
|
56
59
|
}
|
|
57
60
|
return !Array.isArray(cells) ? [] : cells.flatMap(cell => cell.cell_type === 'code'
|
|
58
|
-
? [{ code: joined(cell.source ?? ''), output: outputText(cell.outputs ?? []).trim(), plots: plotCount(cell.outputs ?? []), images: imagesOf(cell.outputs ?? []) }] : []);
|
|
61
|
+
? [{ code: joined(cell.source ?? ''), ...countOf(cell), output: outputText(cell.outputs ?? []).trim(), plots: plotCount(cell.outputs ?? []), images: imagesOf(cell.outputs ?? []) }] : []);
|
|
59
62
|
}
|
|
63
|
+
/** the execution count of a cell that ran, which says when it ran last */
|
|
64
|
+
const countOf = (cell) => typeof cell.execution_count === 'number' ? { count: cell.execution_count } : {};
|
|
60
65
|
const joined = (text) => typeof text === 'string' ? text : text.join('');
|
|
61
66
|
/** the images the outputs hold, which are the plots */
|
|
62
67
|
const plotCount = (outputs) => outputs.filter(o => Object.keys(o.data ?? {}).some(type => type.startsWith('image/'))).length;
|
|
@@ -75,11 +80,22 @@ function outputText(outputs) {
|
|
|
75
80
|
}
|
|
76
81
|
}).join('\n');
|
|
77
82
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
/** the cells of a notebook as flowR reads them, in order: whether each is code, and its text (a text cell as comments) */
|
|
84
|
+
function jupyterCells(content) {
|
|
85
|
+
let cells;
|
|
86
|
+
try {
|
|
87
|
+
cells = JSON.parse(content).cells;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
return cells.map(cell => {
|
|
93
|
+
const source = joined(cell.source);
|
|
81
94
|
/* every line of a text cell becomes a comment, whether the notebook stores the cell as lines or as one string */
|
|
82
|
-
return cell.cell_type === 'code' ? source : source.replace(/^/gm, '# ');
|
|
83
|
-
})
|
|
95
|
+
return cell.cell_type === 'code' ? [true, source] : [false, source.replace(/^/gm, '# ')];
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function loadJupyter(content) {
|
|
99
|
+
return jupyterCells(content).map(([, text]) => text).join('\n');
|
|
84
100
|
}
|
|
85
101
|
//# sourceMappingURL=flowr-jupyter-file.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type FlowrFileProvider, FileRole, FlowrFile } from '../../../context/flowr-file';
|
|
2
2
|
import { type Node } from 'commonmark';
|
|
3
3
|
import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-context';
|
|
4
|
+
import { CellRunner } from './cell-runner';
|
|
4
5
|
/**
|
|
5
6
|
* This decorates a text file and parses its contents as an R Markdown file.
|
|
6
7
|
* Finally, it provides access to the single cells, and all cells fused together as one R file.
|
|
@@ -8,6 +9,8 @@ import type { FlowrAnalyzerContext } from '../../../context/flowr-analyzer-conte
|
|
|
8
9
|
export declare class FlowrRMarkdownFile extends FlowrFile {
|
|
9
10
|
private readonly wrapped;
|
|
10
11
|
private readonly context;
|
|
12
|
+
/** knitr knits the chunks of R Markdown and Quarto */
|
|
13
|
+
readonly runner = CellRunner.Knitr;
|
|
11
14
|
private data?;
|
|
12
15
|
private mergedCode?;
|
|
13
16
|
private readonly included;
|
|
@@ -51,13 +54,30 @@ export interface CodeBlock {
|
|
|
51
54
|
}
|
|
52
55
|
export interface RmdInfo {
|
|
53
56
|
blocks: CodeBlock[];
|
|
57
|
+
/** the inline R code of the text (an `r` and an expression in backticks), which knitr runs where it stands */
|
|
58
|
+
inline: InlineCode[];
|
|
54
59
|
options: object;
|
|
55
60
|
}
|
|
61
|
+
/** Inline R code of a sentence (an `r` and an expression in backticks), at the 1-based line and column its expression starts at. */
|
|
62
|
+
export interface InlineCode {
|
|
63
|
+
readonly code: string;
|
|
64
|
+
readonly line: number;
|
|
65
|
+
readonly col: number;
|
|
66
|
+
}
|
|
67
|
+
/** the values of the chunk option `eval` that keep a chunk from running */
|
|
68
|
+
export declare const NonExecutableEvalValues: ReadonlySet<string>;
|
|
56
69
|
/**
|
|
57
70
|
* Checks whether a code block is evaluated when the document is knitted (i.e. not `eval=FALSE`),
|
|
58
71
|
* falling back to the document-wide default of {@link globalChunkOptions} if the chunk says nothing
|
|
59
72
|
*/
|
|
60
73
|
export declare function isExecutableCell(block: CodeBlock, defaults: CodeBlockOptions): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The variables the chunk options of the header read by option (`{r eval = cran}` reads `cran`), as knitr evaluates each
|
|
76
|
+
* value as R code before the chunk runs: the names in it, but not those in strings, the functions it calls, or the fields it accesses.
|
|
77
|
+
*/
|
|
78
|
+
export declare function optionReads(header: string): Map<string, string[]>;
|
|
79
|
+
/** the values of the chunk option `error` that keep knitting after an error */
|
|
80
|
+
export declare const ErrorTolerantValues: ReadonlySet<string>;
|
|
61
81
|
/** Checks whether knitr keeps going when the chunk raises an error (i.e. `error=TRUE`) */
|
|
62
82
|
export declare function continuesAfterError(block: CodeBlock, defaults: CodeBlockOptions): boolean;
|
|
63
83
|
/**
|
|
@@ -70,6 +90,8 @@ export declare function globalChunkOptions(frontmatter: object): CodeBlockOption
|
|
|
70
90
|
* @returns Rmd Info
|
|
71
91
|
*/
|
|
72
92
|
export declare function parseRMarkdownFile(raw: string): RmdInfo;
|
|
93
|
+
/** Puts the inline code into the lines of `code` it stands in (which hold no code but that), each at its column. */
|
|
94
|
+
export declare function spliceInlineCode(code: string, inline: readonly InlineCode[]): string;
|
|
73
95
|
/** The info string of an R chunk, `{r}` or `{r label, eval = FALSE}`; the `[\s,]` keeps `{rust}` out */
|
|
74
96
|
export declare const RTagRegex: RegExp;
|
|
75
97
|
/** Checks whether a CommonMark node is an R code block */
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RTagRegex = exports.FlowrRMarkdownFile = void 0;
|
|
3
|
+
exports.RTagRegex = exports.ErrorTolerantValues = exports.NonExecutableEvalValues = exports.FlowrRMarkdownFile = void 0;
|
|
4
4
|
exports.isExecutableCell = isExecutableCell;
|
|
5
|
+
exports.optionReads = optionReads;
|
|
5
6
|
exports.continuesAfterError = continuesAfterError;
|
|
6
7
|
exports.globalChunkOptions = globalChunkOptions;
|
|
7
8
|
exports.parseRMarkdownFile = parseRMarkdownFile;
|
|
9
|
+
exports.spliceInlineCode = spliceInlineCode;
|
|
8
10
|
exports.isRCodeBlock = isRCodeBlock;
|
|
9
11
|
exports.restoreBlocksWithoutMd = restoreBlocksWithoutMd;
|
|
10
12
|
exports.parseCodeBlockOptions = parseCodeBlockOptions;
|
|
@@ -15,6 +17,7 @@ const commonmark_1 = require("commonmark");
|
|
|
15
17
|
const js_yaml_1 = require("js-yaml");
|
|
16
18
|
const log_1 = require("../../../../util/log");
|
|
17
19
|
const built_in_source_1 = require("../../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
20
|
+
const cell_runner_1 = require("./cell-runner");
|
|
18
21
|
/**
|
|
19
22
|
* This decorates a text file and parses its contents as an R Markdown file.
|
|
20
23
|
* Finally, it provides access to the single cells, and all cells fused together as one R file.
|
|
@@ -22,6 +25,8 @@ const built_in_source_1 = require("../../../../dataflow/internal/process/functio
|
|
|
22
25
|
class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
|
|
23
26
|
wrapped;
|
|
24
27
|
context;
|
|
28
|
+
/** knitr knits the chunks of R Markdown and Quarto */
|
|
29
|
+
runner = cell_runner_1.CellRunner.Knitr;
|
|
25
30
|
data;
|
|
26
31
|
mergedCode;
|
|
27
32
|
included = [];
|
|
@@ -60,7 +65,7 @@ class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
|
|
|
60
65
|
this.data = parseRMarkdownFile(raw);
|
|
61
66
|
this.postProcessCodeBlocks();
|
|
62
67
|
const defaults = globalChunkOptions(this.data.options);
|
|
63
|
-
this.mergedCode = restoreBlocksWithoutMd(this.executableCells.map(b => continuesAfterError(b, defaults) ? { ...b, code: wrapErrorTolerant(b.code) } : b), countNewlines(raw));
|
|
68
|
+
this.mergedCode = spliceInlineCode(restoreBlocksWithoutMd(this.executableCells.map(b => continuesAfterError(b, defaults) ? { ...b, code: wrapErrorTolerant(b.code) } : b), countNewlines(raw)), this.data.inline);
|
|
64
69
|
(0, assert_1.guard)(this.mergedCode !== undefined);
|
|
65
70
|
return this.mergedCode;
|
|
66
71
|
}
|
|
@@ -111,20 +116,41 @@ class FlowrRMarkdownFile extends flowr_file_1.FlowrFile {
|
|
|
111
116
|
}
|
|
112
117
|
exports.FlowrRMarkdownFile = FlowrRMarkdownFile;
|
|
113
118
|
/* knitr accepts R literals (`FALSE`, `F`), quarto yaml options accept `false` */
|
|
114
|
-
|
|
119
|
+
/** the values of the chunk option `eval` that keep a chunk from running */
|
|
120
|
+
exports.NonExecutableEvalValues = new Set(['F', 'FALSE', 'false', 'False']);
|
|
115
121
|
/**
|
|
116
122
|
* Checks whether a code block is evaluated when the document is knitted (i.e. not `eval=FALSE`),
|
|
117
123
|
* falling back to the document-wide default of {@link globalChunkOptions} if the chunk says nothing
|
|
118
124
|
*/
|
|
119
125
|
function isExecutableCell(block, defaults) {
|
|
120
126
|
const opt = block.options.get('eval') ?? defaults.get('eval');
|
|
121
|
-
return opt === undefined || !NonExecutableEvalValues.has(opt);
|
|
127
|
+
return opt === undefined || !exports.NonExecutableEvalValues.has(opt);
|
|
122
128
|
}
|
|
123
|
-
|
|
129
|
+
/** the names of R that an option value (`eval = TRUE`) gives without reading a variable */
|
|
130
|
+
const OptionConstants = new Set(['T', 'F', 'TRUE', 'FALSE', 'NULL', 'NA', 'Inf', 'NaN']);
|
|
131
|
+
/**
|
|
132
|
+
* The variables the chunk options of the header read by option (`{r eval = cran}` reads `cran`), as knitr evaluates each
|
|
133
|
+
* value as R code before the chunk runs: the names in it, but not those in strings, the functions it calls, or the fields it accesses.
|
|
134
|
+
*/
|
|
135
|
+
function optionReads(header) {
|
|
136
|
+
const options = header.slice(3, -1).replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g, '""');
|
|
137
|
+
const reads = new Map();
|
|
138
|
+
/* knitr splits the options at the commas outside of parentheses, a part without `=` (a label) reads nothing */
|
|
139
|
+
for (const part of options.split(/,(?![^(]*\))/)) {
|
|
140
|
+
const [, option, value] = /^\s*([\w.]+)\s*=(?!=)(.*)$/s.exec(part) ?? [];
|
|
141
|
+
const names = value === undefined ? [] : [...value.matchAll(/(?<![\w.$@])[A-Za-z.][\w.]*(?![\w.])(?!\s*\()/g)].map(m => m[0]).filter(n => !OptionConstants.has(n) && !/^\.\d/.test(n));
|
|
142
|
+
if (option !== undefined && names.length > 0) {
|
|
143
|
+
reads.set(option, names);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return reads;
|
|
147
|
+
}
|
|
148
|
+
/** the values of the chunk option `error` that keep knitting after an error */
|
|
149
|
+
exports.ErrorTolerantValues = new Set(['T', 'TRUE', 'true', 'True']);
|
|
124
150
|
/** Checks whether knitr keeps going when the chunk raises an error (i.e. `error=TRUE`) */
|
|
125
151
|
function continuesAfterError(block, defaults) {
|
|
126
152
|
const opt = block.options.get('error') ?? defaults.get('error');
|
|
127
|
-
return opt !== undefined && ErrorTolerantValues.has(opt);
|
|
153
|
+
return opt !== undefined && exports.ErrorTolerantValues.has(opt);
|
|
128
154
|
}
|
|
129
155
|
/** As `error=TRUE` keeps knitting, the chunk must not cut the document short. Adds no lines, so all following positions hold. */
|
|
130
156
|
function wrapErrorTolerant(code) {
|
|
@@ -193,9 +219,15 @@ function parseRMarkdownFile(raw) {
|
|
|
193
219
|
}
|
|
194
220
|
const walker = new commonmark_1.Parser().parse(raw).walker();
|
|
195
221
|
const blocks = [];
|
|
222
|
+
const codeLines = new Set();
|
|
196
223
|
let e;
|
|
197
224
|
while ((e = walker.next())) {
|
|
198
225
|
const node = e.node;
|
|
226
|
+
if (node.type === 'code_block' && node.sourcepos) {
|
|
227
|
+
for (let line = node.sourcepos[0][0]; line <= node.sourcepos[1][0]; line++) {
|
|
228
|
+
codeLines.add(line);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
199
231
|
if (!isRCodeBlock(node)) {
|
|
200
232
|
continue;
|
|
201
233
|
}
|
|
@@ -207,7 +239,31 @@ function parseRMarkdownFile(raw) {
|
|
|
207
239
|
}
|
|
208
240
|
blocks.push(...parseIncludeShortcodes(raw));
|
|
209
241
|
blocks.sort((a, b) => a.startpos.line - b.startpos.line);
|
|
210
|
-
return { blocks, options: typeof frontmatter === 'object' && frontmatter !== null ? frontmatter : {} };
|
|
242
|
+
return { blocks, inline: parseInlineCode(raw, codeLines), options: typeof frontmatter === 'object' && frontmatter !== null ? frontmatter : {} };
|
|
243
|
+
}
|
|
244
|
+
/** knitr's inline code (`r` and an expression in backticks) and quarto's (`{r}` and an expression), the expression after the engine and the blanks */
|
|
245
|
+
const InlineCodeRegex = /`(?:r|\{r\})[ \t]+([^`]+)`/g;
|
|
246
|
+
/** The inline R code of the lines that are no code block, the front matter included, as knitr evaluates it there as well. */
|
|
247
|
+
function parseInlineCode(raw, codeLines) {
|
|
248
|
+
return raw.split(LineRegex).flatMap((text, at) => codeLines.has(at + 1) ? [] : [...text.matchAll(InlineCodeRegex)].map(m => ({
|
|
249
|
+
code: m[1].trimEnd(),
|
|
250
|
+
line: at + 1,
|
|
251
|
+
col: (m.index ?? 0) + m[0].indexOf(m[1]) + 1
|
|
252
|
+
})));
|
|
253
|
+
}
|
|
254
|
+
/** Puts the inline code into the lines of `code` it stands in (which hold no code but that), each at its column. */
|
|
255
|
+
function spliceInlineCode(code, inline) {
|
|
256
|
+
if (inline.length === 0) {
|
|
257
|
+
return code;
|
|
258
|
+
}
|
|
259
|
+
const lines = code.split('\n');
|
|
260
|
+
for (const { code: expr, line, col } of inline) {
|
|
261
|
+
const current = lines[line - 1] ?? '';
|
|
262
|
+
/* several on one line are separate statements, so all but the first follow a `;` */
|
|
263
|
+
const sep = current.trim() === '' ? '' : ';';
|
|
264
|
+
lines[line - 1] = current + sep + ' '.repeat(Math.max(0, col - 1 - current.length - sep.length)) + expr;
|
|
265
|
+
}
|
|
266
|
+
return lines.join('\n');
|
|
211
267
|
}
|
|
212
268
|
const IncludeShortcodeRegex = /{{<\s*include\s+["']?(.+?)["']?\s*>}}/;
|
|
213
269
|
/** Collects quarto's `{{< include other.qmd >}}` as blocks carrying a `child`, resolved like knitr's option */
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type FlowrFileProvider, FileRole, FlowrFile } from '../../../context/flowr-file';
|
|
2
2
|
import type { RecordedRun, RecordsRuns } from './recorded-runs';
|
|
3
|
+
import { CellRunner } from './cell-runner';
|
|
3
4
|
/**
|
|
4
5
|
* This decorates a text file and reads it as a transcript of an R console (`.Rout`, `.Rout.save`):
|
|
5
6
|
* the code is the commands behind their prompts, and everything else is kept as a comment, so every line stays where it was.
|
|
6
7
|
*/
|
|
7
8
|
export declare class FlowrRSessionFile extends FlowrFile implements RecordsRuns {
|
|
8
9
|
private readonly wrapped;
|
|
10
|
+
readonly runner = CellRunner.Session;
|
|
9
11
|
/**
|
|
10
12
|
* Prefer the static {@link FlowrRSessionFile.from} method
|
|
11
13
|
* @param wrapped - the file to load as a transcript
|
|
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FlowrRSessionFile = void 0;
|
|
4
4
|
const flowr_file_1 = require("../../../context/flowr-file");
|
|
5
5
|
const r_session_1 = require("./r-session");
|
|
6
|
+
const cell_runner_1 = require("./cell-runner");
|
|
6
7
|
/**
|
|
7
8
|
* This decorates a text file and reads it as a transcript of an R console (`.Rout`, `.Rout.save`):
|
|
8
9
|
* the code is the commands behind their prompts, and everything else is kept as a comment, so every line stays where it was.
|
|
9
10
|
*/
|
|
10
11
|
class FlowrRSessionFile extends flowr_file_1.FlowrFile {
|
|
11
12
|
wrapped;
|
|
13
|
+
runner = cell_runner_1.CellRunner.Session;
|
|
12
14
|
/**
|
|
13
15
|
* Prefer the static {@link FlowrRSessionFile.from} method
|
|
14
16
|
* @param wrapped - the file to load as a transcript
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { type FlowrFileProvider, FileRole, FlowrFile } from '../../../context/flowr-file';
|
|
2
|
-
|
|
3
|
-
* This decorates a text file and parses its contents as a Sweave (latex with R code) file.
|
|
4
|
-
* Finally, it provides access to the single cells, and all cells fused together as one R file.
|
|
5
|
-
* So far, this does *not* support `\Sexpr` calls.
|
|
6
|
-
*/
|
|
2
|
+
import { CellRunner } from './cell-runner';
|
|
7
3
|
export declare class FlowrSweaveFile extends FlowrFile {
|
|
8
4
|
private readonly wrapped;
|
|
9
5
|
private data?;
|
|
@@ -12,6 +8,8 @@ export declare class FlowrSweaveFile extends FlowrFile {
|
|
|
12
8
|
* @param file - the file to load as Sweave
|
|
13
9
|
*/
|
|
14
10
|
constructor(file: FlowrFileProvider<string>);
|
|
11
|
+
/** knitr weaves a document that names it as its vignette engine, in the magic comment of RStudio, or in its own code, `Sweave` any other */
|
|
12
|
+
get runner(): CellRunner;
|
|
15
13
|
/** The content of the Sweave file. */
|
|
16
14
|
get rnw(): SweaveInfo;
|
|
17
15
|
/** The text of the document itself, as its content is only the code it holds. */
|
|
@@ -5,11 +5,13 @@ exports.parseSweave = parseSweave;
|
|
|
5
5
|
exports.parseSweaveCodeblockStart = parseSweaveCodeblockStart;
|
|
6
6
|
const flowr_file_1 = require("../../../context/flowr-file");
|
|
7
7
|
const assert_1 = require("../../../../util/assert");
|
|
8
|
+
const cell_runner_1 = require("./cell-runner");
|
|
8
9
|
/**
|
|
9
10
|
* This decorates a text file and parses its contents as a Sweave (latex with R code) file.
|
|
10
11
|
* Finally, it provides access to the single cells, and all cells fused together as one R file.
|
|
11
12
|
* So far, this does *not* support `\Sexpr` calls.
|
|
12
13
|
*/
|
|
14
|
+
const KnitrSweave = /\\VignetteEngine\{knitr::|!Rnw\s+weave\s*=\s*knitr|\bknitr::|\bopts_(chunk|knit)\$/;
|
|
13
15
|
class FlowrSweaveFile extends flowr_file_1.FlowrFile {
|
|
14
16
|
wrapped;
|
|
15
17
|
data;
|
|
@@ -21,6 +23,10 @@ class FlowrSweaveFile extends flowr_file_1.FlowrFile {
|
|
|
21
23
|
super(file.path(), file.roles ? [...file.roles, flowr_file_1.FileRole.Source] : [flowr_file_1.FileRole.Source]);
|
|
22
24
|
this.wrapped = file;
|
|
23
25
|
}
|
|
26
|
+
/** knitr weaves a document that names it as its vignette engine, in the magic comment of RStudio, or in its own code, `Sweave` any other */
|
|
27
|
+
get runner() {
|
|
28
|
+
return KnitrSweave.test(this.rawText()) ? cell_runner_1.CellRunner.Knitr : cell_runner_1.CellRunner.Session;
|
|
29
|
+
}
|
|
24
30
|
/** The content of the Sweave file. */
|
|
25
31
|
get rnw() {
|
|
26
32
|
if (!this.data) {
|
|
@@ -4,6 +4,8 @@ export interface RecordedRun {
|
|
|
4
4
|
readonly line?: number;
|
|
5
5
|
readonly code: string;
|
|
6
6
|
readonly output: string;
|
|
7
|
+
/** when the code last ran, as the format counts runs (the execution count of a Jupyter cell) */
|
|
8
|
+
readonly count?: number;
|
|
7
9
|
/** how many plots the run drew, if the format records images */
|
|
8
10
|
readonly plots?: number;
|
|
9
11
|
/** the recorded plots as data URLs, if the format records images */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BasicQueryData } from '../../base-query-format';
|
|
2
|
+
import type { AliasesQuery, AliasesQueryResult } from './aliases-query-format';
|
|
3
|
+
/**
|
|
4
|
+
* Executes the given alias queries using the provided analyzer.
|
|
5
|
+
*/
|
|
6
|
+
export declare function executeAliasesQuery({ analyzer }: BasicQueryData, queries: readonly AliasesQuery[]): Promise<AliasesQueryResult>;
|