@r-universe/webr 2023.6.21 → 2023.9.18
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/dist/R.bin.data +3934 -2174
- package/dist/R.bin.js +1 -6
- package/dist/R.bin.wasm +0 -0
- package/dist/repl/App.d.ts +15 -0
- package/dist/repl/components/Editor.d.ts +26 -0
- package/dist/repl/components/Files.d.ts +19 -0
- package/dist/repl/components/Plot.d.ts +7 -0
- package/dist/repl/components/Terminal.d.ts +9 -0
- package/dist/repl/components/utils.d.ts +11 -0
- package/dist/tests/webR/chan/channel-postmessage.test.d.ts +1 -0
- package/dist/tests/webR/error.test.d.ts +1 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/ArialMT-Bold.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/ArialMT-BoldItalic.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/ArialMT-Italic.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/ArialMT.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/CM_boldx_10.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/CM_boldx_italic_10.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/CM_italic_10.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/CM_regular_10.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/CM_symbol_10.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Courier-Bold.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Courier-BoldOblique.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Courier-Oblique.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Courier.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Helvetica-Bold.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Helvetica-BoldOblique.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Helvetica-Oblique.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Helvetica.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Symbol.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Times-Bold.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Times-BoldItalic.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Times-Italic.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/Times-Roman.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/ZapfDingbats.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/a010013l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/a010015l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/a010033l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/a010035l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/agd_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/agdo____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/agw_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/agwo____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/b018012l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/b018015l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/b018032l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/b018035l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/bkd_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/bkdi____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/bkl_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/bkli____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/c059013l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/c059016l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/c059033l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/c059036l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/cmbxti10.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/cmti10.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/cob_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/cobo____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/com_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/coo_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/hv______.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/hvb_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/hvbo____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/hvn_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/hvnb____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/hvnbo___.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/hvno____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/hvo_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n019003l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n019004l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n019023l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n019024l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n019043l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n019044l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n019063l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n019064l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n021003l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n021004l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n021023l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n021024l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n022003l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n022004l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n022023l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/n022024l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/ncb_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/ncbi____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/nci_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/ncr_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/p052003l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/p052004l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/p052023l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/p052024l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/pob_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/pobi____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/poi_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/por_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/s050000l.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/sy______.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/tib_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/tibi____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/tii_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/grDevices/afm/tir_____.afm.gz +0 -0
- package/dist/vfs/usr/lib/R/library/parallel/DESCRIPTION +1 -1
- package/dist/vfs/usr/lib/R/library/parallel/Meta/package.rds +0 -0
- package/dist/vfs/usr/lib/R/library/tcltk/DESCRIPTION +1 -1
- package/dist/vfs/usr/lib/R/library/tcltk/Meta/package.rds +0 -0
- package/dist/vfs/usr/lib/R/library/tools/help/tools.rdb +0 -0
- package/dist/vfs/usr/lib/R/library/translations/Meta/package.rds +0 -0
- package/dist/webR/chan/channel-common.d.ts +4 -2
- package/dist/webR/chan/channel-postmessage.d.ts +26 -0
- package/dist/webR/chan/channel-shared.d.ts +1 -0
- package/dist/webR/chan/channel.d.ts +1 -0
- package/dist/webR/console.d.ts +6 -2
- package/dist/webR/emscripten.d.ts +7 -0
- package/dist/webR/error.d.ts +26 -0
- package/dist/webR/payload.d.ts +1 -1
- package/dist/webR/webr-chan.d.ts +18 -0
- package/dist/webR/webr-main.d.ts +7 -0
- package/dist/webr-serviceworker.js +14 -3
- package/dist/webr-serviceworker.js.map +3 -3
- package/dist/webr-serviceworker.mjs +14 -3
- package/dist/webr-serviceworker.mjs.map +3 -3
- package/dist/webr-worker.js +435 -175
- package/dist/webr-worker.js.map +4 -4
- package/dist/webr.cjs +3 -3
- package/dist/webr.cjs.map +4 -4
- package/dist/webr.mjs +3 -3
- package/dist/webr.mjs.map +4 -4
- package/package.json +20 -18
- package/dist/repl/fstree.d.ts +0 -57
- package/dist/repl/repl.d.ts +0 -1
- package/dist/vfs/usr/lib/R/library/grDevices/libs/grDevices.so +0 -0
- package/dist/vfs/usr/lib/R/modules/internet.so +0 -0
- package/dist/vfs/usr/lib/R/modules/lapack.so +0 -0
- package/templates/repl.html +0 -134
package/dist/R.bin.wasm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Readline } from 'xterm-readline';
|
|
2
|
+
import './App.css';
|
|
3
|
+
export interface TerminalInterface {
|
|
4
|
+
println: Readline['println'];
|
|
5
|
+
read: Readline['read'];
|
|
6
|
+
write: Readline['write'];
|
|
7
|
+
}
|
|
8
|
+
export interface FilesInterface {
|
|
9
|
+
refreshFilesystem: () => Promise<void>;
|
|
10
|
+
openFileInEditor: (name: string, path: string, readOnly: boolean) => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface PlotInterface {
|
|
13
|
+
newPlot: () => void;
|
|
14
|
+
drawImage: (img: ImageBitmap) => void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WebR } from '../../webR/webr-main';
|
|
3
|
+
import { EditorState } from '@codemirror/state';
|
|
4
|
+
import { FilesInterface, TerminalInterface } from '../App';
|
|
5
|
+
import './Editor.css';
|
|
6
|
+
export type EditorFile = {
|
|
7
|
+
name: string;
|
|
8
|
+
path: string;
|
|
9
|
+
ref: {
|
|
10
|
+
editorState: EditorState;
|
|
11
|
+
scrollTop?: number;
|
|
12
|
+
scrollLeft?: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function FileTabs({ files, activeFileIdx, setActiveFileIdx, closeFile }: {
|
|
16
|
+
files: EditorFile[];
|
|
17
|
+
activeFileIdx: number;
|
|
18
|
+
setActiveFileIdx: React.Dispatch<React.SetStateAction<number>>;
|
|
19
|
+
closeFile: (e: React.SyntheticEvent, index: number) => void;
|
|
20
|
+
}): React.JSX.Element;
|
|
21
|
+
export declare function Editor({ webR, terminalInterface, filesInterface, }: {
|
|
22
|
+
webR: WebR;
|
|
23
|
+
terminalInterface: TerminalInterface;
|
|
24
|
+
filesInterface: FilesInterface;
|
|
25
|
+
}): React.JSX.Element;
|
|
26
|
+
export default Editor;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WebR } from '../../webR/webr-main';
|
|
3
|
+
import type { FSNode } from '../../webR/webr-main';
|
|
4
|
+
import { FilesInterface } from '../App';
|
|
5
|
+
import './Files.css';
|
|
6
|
+
interface ITreeNode {
|
|
7
|
+
id: number;
|
|
8
|
+
name: string;
|
|
9
|
+
children?: ITreeNode[];
|
|
10
|
+
metadata?: {
|
|
11
|
+
[x: string]: string | number | null | undefined;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare function createTreefromFSNode(fsNode: FSNode): ITreeNode;
|
|
15
|
+
export declare function Files({ webR, filesInterface, }: {
|
|
16
|
+
webR: WebR;
|
|
17
|
+
filesInterface: FilesInterface;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
export default Files;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TerminalInterface } from '../App';
|
|
3
|
+
import { WebR } from '../../webR/webr-main';
|
|
4
|
+
import 'xterm/css/xterm.css';
|
|
5
|
+
export declare function Terminal({ webR, terminalInterface, }: {
|
|
6
|
+
webR: WebR;
|
|
7
|
+
terminalInterface: TerminalInterface;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
export default Terminal;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Text } from '@codemirror/state';
|
|
2
|
+
import { EditorView } from '@codemirror/view';
|
|
3
|
+
export type CursorPosition = {
|
|
4
|
+
line: number;
|
|
5
|
+
col: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function offsetToPosition(cmDoc: Text, offset: number): CursorPosition;
|
|
8
|
+
export declare function positionToOffset(cmDoc: Text, pos: CursorPosition): number;
|
|
9
|
+
export declare function getSelectedText(cmView: EditorView): string;
|
|
10
|
+
export declare function getCurrentLineText(cmView: EditorView): string;
|
|
11
|
+
export declare function moveCursorToNextLine(cmView: EditorView): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -9,4 +9,4 @@ Description: Interface and language bindings to Tcl/Tk GUI elements.
|
|
|
9
9
|
License: Part of R 4.3.0
|
|
10
10
|
Imports: utils
|
|
11
11
|
NeedsCompilation: yes
|
|
12
|
-
Built: R 4.3.0; x86_64-pc-linux-gnu; 2023-
|
|
12
|
+
Built: R 4.3.0; x86_64-pc-linux-gnu; 2023-09-18 11:30:54 UTC; unix
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { SharedBufferChannelMain, SharedBufferChannelWorker } from './channel-shared';
|
|
2
2
|
import { ServiceWorkerChannelMain, ServiceWorkerChannelWorker } from './channel-service';
|
|
3
|
+
import { PostMessageChannelMain, PostMessageChannelWorker } from './channel-postmessage';
|
|
3
4
|
import { WebROptions } from '../webr-main';
|
|
4
5
|
export declare const ChannelType: {
|
|
5
6
|
readonly Automatic: 0;
|
|
6
7
|
readonly SharedArrayBuffer: 1;
|
|
7
8
|
readonly ServiceWorker: 2;
|
|
9
|
+
readonly PostMessage: 3;
|
|
8
10
|
};
|
|
9
11
|
export type ChannelInitMessage = {
|
|
10
12
|
type: string;
|
|
@@ -15,5 +17,5 @@ export type ChannelInitMessage = {
|
|
|
15
17
|
location?: string;
|
|
16
18
|
};
|
|
17
19
|
};
|
|
18
|
-
export declare function newChannelMain(data: Required<WebROptions>): SharedBufferChannelMain | ServiceWorkerChannelMain;
|
|
19
|
-
export declare function newChannelWorker(msg: ChannelInitMessage): SharedBufferChannelWorker | ServiceWorkerChannelWorker;
|
|
20
|
+
export declare function newChannelMain(data: Required<WebROptions>): SharedBufferChannelMain | ServiceWorkerChannelMain | PostMessageChannelMain;
|
|
21
|
+
export declare function newChannelWorker(msg: ChannelInitMessage): SharedBufferChannelWorker | ServiceWorkerChannelWorker | PostMessageChannelWorker;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Message } from './message';
|
|
2
|
+
import { WebROptions } from '../webr-main';
|
|
3
|
+
import { ChannelMain } from './channel';
|
|
4
|
+
export declare class PostMessageChannelMain extends ChannelMain {
|
|
5
|
+
#private;
|
|
6
|
+
initialised: Promise<unknown>;
|
|
7
|
+
resolve: (_?: unknown) => void;
|
|
8
|
+
close: () => void;
|
|
9
|
+
constructor(config: Required<WebROptions>);
|
|
10
|
+
interrupt(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class PostMessageChannelWorker {
|
|
13
|
+
#private;
|
|
14
|
+
constructor();
|
|
15
|
+
resolve(): void;
|
|
16
|
+
write(msg: Message, transfer?: [Transferable]): void;
|
|
17
|
+
writeSystem(msg: Message, transfer?: [Transferable]): void;
|
|
18
|
+
read(): Message;
|
|
19
|
+
inputOrDispatch(): number;
|
|
20
|
+
run(_args: string[]): void;
|
|
21
|
+
setDispatchHandler(dispatch: (msg: Message) => void): void;
|
|
22
|
+
request(msg: Message, transferables?: [Transferable]): Promise<any>;
|
|
23
|
+
setInterrupt(interrupt: () => void): void;
|
|
24
|
+
handleInterrupt(): void;
|
|
25
|
+
onMessageFromMainThread(message: Message): void;
|
|
26
|
+
}
|
|
@@ -11,6 +11,7 @@ export declare class SharedBufferChannelMain extends ChannelMain {
|
|
|
11
11
|
}
|
|
12
12
|
export declare class SharedBufferChannelWorker implements ChannelWorker {
|
|
13
13
|
#private;
|
|
14
|
+
onMessageFromMainThread: (msg: Message) => void;
|
|
14
15
|
constructor();
|
|
15
16
|
resolve(): void;
|
|
16
17
|
write(msg: Message, transfer?: [Transferable]): void;
|
|
@@ -31,6 +31,7 @@ export interface ChannelWorker {
|
|
|
31
31
|
run(args: string[]): void;
|
|
32
32
|
inputOrDispatch: () => number;
|
|
33
33
|
setDispatchHandler: (dispatch: (msg: Message) => void) => void;
|
|
34
|
+
onMessageFromMainThread: (msg: Message) => void;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* Handler functions dealing with setup and commmunication over a Service Worker.
|
package/dist/webR/console.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export interface ConsoleCallbacks {
|
|
|
3
3
|
stdout?: (line: string) => void;
|
|
4
4
|
stderr?: (line: string) => void;
|
|
5
5
|
prompt?: (line: string) => void;
|
|
6
|
-
|
|
6
|
+
canvasImage?: (image: ImageBitmap) => void;
|
|
7
|
+
canvasNewPage?: () => void;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Text-based Interactive Console for WebR
|
|
@@ -27,9 +28,12 @@ export interface ConsoleCallbacks {
|
|
|
27
28
|
* function. The default implementation of `prompt` shows a JavaScript prompt
|
|
28
29
|
* asking the user for input, and then sends the user input to `stdin`.
|
|
29
30
|
*
|
|
30
|
-
* The ``
|
|
31
|
+
* The ``canvasImage`` callback function is called when webR writes plots to
|
|
31
32
|
* the built-in HTML canvas graphics device.
|
|
32
33
|
*
|
|
34
|
+
* The ``canvasNewPage`` callback function is called when webR creates a new
|
|
35
|
+
* plot.
|
|
36
|
+
*
|
|
33
37
|
* Once constructed, start the Console using the ``run`` method. The `run`
|
|
34
38
|
* method starts an asynchronous infinite loop that waits for output from the
|
|
35
39
|
* webR worker and then calls the relevant callbacks.
|
|
@@ -59,6 +59,8 @@ export interface Module extends EmscriptenModule {
|
|
|
59
59
|
_R_ParseEvalString: (code: number, env: RPtr) => RPtr;
|
|
60
60
|
_R_PreserveObject: (ptr: RPtr) => void;
|
|
61
61
|
_R_ReleaseObject: (ptr: RPtr) => void;
|
|
62
|
+
_R_ReplDLLinit: () => void;
|
|
63
|
+
_R_ReplDLLdo1: () => number;
|
|
62
64
|
_Rf_ScalarReal: (n: number) => RPtr;
|
|
63
65
|
_Rf_ScalarLogical: (l: number) => RPtr;
|
|
64
66
|
_Rf_ScalarInteger: (n: number) => RPtr;
|
|
@@ -71,6 +73,7 @@ export interface Module extends EmscriptenModule {
|
|
|
71
73
|
_Rf_findVarInFrame: (rho: RPtr, symbol: RPtr) => RPtr;
|
|
72
74
|
_Rf_listAppend: (source: RPtr, target: RPtr) => RPtr;
|
|
73
75
|
_Rf_getAttrib: (ptr1: RPtr, ptr2: RPtr) => RPtr;
|
|
76
|
+
_Rf_initialize_R: (argc: number, argv: RPtr) => void;
|
|
74
77
|
_Rf_install: (ptr: number) => RPtr;
|
|
75
78
|
_Rf_installTrChar: (name: RPtr) => RPtr;
|
|
76
79
|
_Rf_lang1: (ptr1: RPtr) => RPtr;
|
|
@@ -89,6 +92,8 @@ export interface Module extends EmscriptenModule {
|
|
|
89
92
|
_Rf_setAttrib: (ptr1: RPtr, ptr2: RPtr, ptr3: RPtr) => RPtr;
|
|
90
93
|
_Rf_unprotect: (n: number) => void;
|
|
91
94
|
_Rf_unprotect_ptr: (ptr: RPtr) => void;
|
|
95
|
+
_DLLbuf: RPtr;
|
|
96
|
+
_DLLbufp: RPtr;
|
|
92
97
|
_R_BaseEnv: RPtr;
|
|
93
98
|
_R_BracketSymbol: RPtr;
|
|
94
99
|
_R_Bracket2Symbol: RPtr;
|
|
@@ -107,6 +112,8 @@ export interface Module extends EmscriptenModule {
|
|
|
107
112
|
_R_UnboundValue: RPtr;
|
|
108
113
|
_SET_STRING_ELT: (ptr: RPtr, idx: number, val: RPtr) => void;
|
|
109
114
|
_SET_VECTOR_ELT: (ptr: RPtr, idx: number, val: RPtr) => void;
|
|
115
|
+
_setup_Rmainloop: () => void;
|
|
116
|
+
_strcpy: (dest: RPtr, src: RPtr) => number;
|
|
110
117
|
webr: {
|
|
111
118
|
UnwindProtectException: typeof UnwindProtectException;
|
|
112
119
|
readConsole: () => number;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Error classes that shall be raised by webR.
|
|
3
|
+
* @module Error
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A general error raised by webR.
|
|
7
|
+
*/
|
|
8
|
+
export declare class WebRError extends Error {
|
|
9
|
+
constructor(msg: string);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Exceptions raised on the webR worker thread that have been forwarded to the
|
|
13
|
+
* main thread through the communication channel.
|
|
14
|
+
*/
|
|
15
|
+
export declare class WebRWorkerError extends WebRError {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Exceptions related to issues with the webR communication channel.
|
|
19
|
+
*/
|
|
20
|
+
export declare class WebRChannelError extends WebRError {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Exceptions related to issues with webR object payloads.
|
|
24
|
+
*/
|
|
25
|
+
export declare class WebRPayloadError extends WebRError {
|
|
26
|
+
}
|
package/dist/webR/payload.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type WebRPayloadErr = {
|
|
|
26
26
|
};
|
|
27
27
|
export type WebRPayload = WebRPayloadRaw | WebRPayloadPtr;
|
|
28
28
|
export type WebRPayloadWorker = WebRPayloadRaw | WebRPayloadPtr | WebRPayloadErr;
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function webRPayloadAsError(payload: WebRPayloadErr): Error;
|
|
30
30
|
/**
|
|
31
31
|
* Test for an WebRPayload instance.
|
|
32
32
|
* @param {any} value The object to test.
|
package/dist/webR/webr-chan.d.ts
CHANGED
|
@@ -139,3 +139,21 @@ export interface ShelterDestroyMessage extends Message {
|
|
|
139
139
|
obj: WebRPayloadPtr;
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
+
export interface CanvasMessage extends Message {
|
|
143
|
+
type: 'canvas';
|
|
144
|
+
data: {
|
|
145
|
+
event: 'canvasNewPage';
|
|
146
|
+
} | {
|
|
147
|
+
event: 'canvasImage';
|
|
148
|
+
image: ImageBitmap;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export interface PagerMessage extends Message {
|
|
152
|
+
type: 'pager';
|
|
153
|
+
data: {
|
|
154
|
+
path: string;
|
|
155
|
+
header: string;
|
|
156
|
+
title: string;
|
|
157
|
+
deleteFile: boolean;
|
|
158
|
+
};
|
|
159
|
+
}
|
package/dist/webR/webr-main.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ import * as RWorker from './robj-worker';
|
|
|
14
14
|
import { EvalROptions } from './webr-chan';
|
|
15
15
|
export { Console, ConsoleCallbacks } from './console';
|
|
16
16
|
export * from './robj-main';
|
|
17
|
+
export * from './error';
|
|
18
|
+
export { ChannelType } from './chan/channel-common';
|
|
17
19
|
/**
|
|
18
20
|
* The webR FS API for interacting with the Emscripten Virtual File System.
|
|
19
21
|
*/
|
|
@@ -114,6 +116,11 @@ export interface WebROptions {
|
|
|
114
116
|
* Default: `channelType.Automatic`
|
|
115
117
|
*/
|
|
116
118
|
channelType?: (typeof ChannelType)[keyof typeof ChannelType];
|
|
119
|
+
/**
|
|
120
|
+
* Create the lazy virtual filesystem entries before starting R?
|
|
121
|
+
* Default: `true`.
|
|
122
|
+
*/
|
|
123
|
+
createLazyFilesystem?: boolean;
|
|
117
124
|
}
|
|
118
125
|
/**
|
|
119
126
|
* The webR class is used to initialize and interact with the webR system.
|
|
@@ -1525,6 +1525,17 @@
|
|
|
1525
1525
|
}
|
|
1526
1526
|
});
|
|
1527
1527
|
|
|
1528
|
+
// webR/error.ts
|
|
1529
|
+
var WebRError = class extends Error {
|
|
1530
|
+
constructor(msg) {
|
|
1531
|
+
super(msg);
|
|
1532
|
+
this.name = this.constructor.name;
|
|
1533
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
var WebRChannelError = class extends WebRError {
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1528
1539
|
// webR/compat.ts
|
|
1529
1540
|
var IN_NODE = typeof process !== "undefined" && process.release && process.release.name === "node";
|
|
1530
1541
|
var loadScript;
|
|
@@ -1554,7 +1565,7 @@
|
|
|
1554
1565
|
await Promise.resolve().then(() => __toESM(__require(nodePathMod.resolve(url))));
|
|
1555
1566
|
};
|
|
1556
1567
|
} else {
|
|
1557
|
-
throw new
|
|
1568
|
+
throw new WebRError("Cannot determine runtime environment");
|
|
1558
1569
|
}
|
|
1559
1570
|
|
|
1560
1571
|
// webR/utils.ts
|
|
@@ -1588,7 +1599,7 @@
|
|
|
1588
1599
|
async function sendRequest(clientId, uuid) {
|
|
1589
1600
|
const client = await self.clients.get(clientId);
|
|
1590
1601
|
if (!client) {
|
|
1591
|
-
throw new
|
|
1602
|
+
throw new WebRChannelError("Service worker client not found");
|
|
1592
1603
|
}
|
|
1593
1604
|
if (!(uuid in requests)) {
|
|
1594
1605
|
requests[uuid] = promiseHandles();
|
|
@@ -1619,7 +1630,7 @@
|
|
|
1619
1630
|
const source = event.source;
|
|
1620
1631
|
self.clients.get(source.id).then((client) => {
|
|
1621
1632
|
if (!client) {
|
|
1622
|
-
throw new
|
|
1633
|
+
throw new WebRChannelError("Can't respond to client in service worker message handler");
|
|
1623
1634
|
}
|
|
1624
1635
|
client.postMessage({
|
|
1625
1636
|
type: "registration-successful",
|