@dodona/papyros 4.0.7 → 4.1.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.
- package/dist/assets/__vite-browser-external-9wXp6ZBx.js +1 -0
- package/dist/assets/__vite-browser-external-BIHI7g3E.js +1 -0
- package/dist/assets/index-C1AWjGcU.js +2202 -0
- package/dist/assets/manifest-BaVmi6rC.json +15 -0
- package/dist/assets/python_package.tar.gz-B8aMWvGt.load_by_url +0 -0
- package/dist/assets/worker-BhABRh01.js +5 -0
- package/dist/assets/worker-C2Ju1j5g.js +110 -0
- package/dist/index.html +26 -0
- package/dist/manifest.json +15 -0
- package/dist/robots.txt +3 -0
- package/package.json +25 -25
- package/dist/Library.d.ts +0 -11
- package/dist/Library.js +0 -11
- package/dist/Library.js.map +0 -1
- package/dist/ProgrammingLanguage.d.ts +0 -7
- package/dist/ProgrammingLanguage.js +0 -9
- package/dist/ProgrammingLanguage.js.map +0 -1
- package/dist/backend/Backend.d.ts +0 -92
- package/dist/backend/Backend.js +0 -79
- package/dist/backend/Backend.js.map +0 -1
- package/dist/backend/workers/javascript/JavaScriptWorker.d.ts +0 -39
- package/dist/backend/workers/javascript/JavaScriptWorker.js +0 -158
- package/dist/backend/workers/javascript/JavaScriptWorker.js.map +0 -1
- package/dist/backend/workers/javascript/worker.d.ts +0 -1
- package/dist/backend/workers/javascript/worker.js +0 -5
- package/dist/backend/workers/javascript/worker.js.map +0 -1
- package/dist/backend/workers/python/PythonWorker.d.ts +0 -32
- package/dist/backend/workers/python/PythonWorker.js +0 -117
- package/dist/backend/workers/python/PythonWorker.js.map +0 -1
- package/dist/backend/workers/python/python_package.tar.gz.load_by_url +0 -0
- package/dist/backend/workers/python/worker.d.ts +0 -1
- package/dist/backend/workers/python/worker.js +0 -5
- package/dist/backend/workers/python/worker.js.map +0 -1
- package/dist/communication/BackendEvent.d.ts +0 -33
- package/dist/communication/BackendEvent.js +0 -18
- package/dist/communication/BackendEvent.js.map +0 -1
- package/dist/communication/BackendEventQueue.d.ts +0 -59
- package/dist/communication/BackendEventQueue.js +0 -96
- package/dist/communication/BackendEventQueue.js.map +0 -1
- package/dist/communication/BackendManager.d.ts +0 -68
- package/dist/communication/BackendManager.js +0 -99
- package/dist/communication/BackendManager.js.map +0 -1
- package/dist/communication/InputServiceWorker.d.ts +0 -1
- package/dist/communication/InputServiceWorker.js +0 -37
- package/dist/communication/InputServiceWorker.js.map +0 -1
- package/dist/communication/InputWorker.d.ts +0 -22
- package/dist/communication/InputWorker.js +0 -63
- package/dist/communication/InputWorker.js.map +0 -1
- package/dist/frontend/components/CodeRunner.d.ts +0 -9
- package/dist/frontend/components/CodeRunner.js +0 -60
- package/dist/frontend/components/CodeRunner.js.map +0 -1
- package/dist/frontend/components/Debugger.d.ts +0 -7
- package/dist/frontend/components/Debugger.js +0 -75
- package/dist/frontend/components/Debugger.js.map +0 -1
- package/dist/frontend/components/Input.d.ts +0 -13
- package/dist/frontend/components/Input.js +0 -60
- package/dist/frontend/components/Input.js.map +0 -1
- package/dist/frontend/components/Output.d.ts +0 -14
- package/dist/frontend/components/Output.js +0 -157
- package/dist/frontend/components/Output.js.map +0 -1
- package/dist/frontend/components/PapyrosElement.d.ts +0 -8
- package/dist/frontend/components/PapyrosElement.js +0 -24
- package/dist/frontend/components/PapyrosElement.js.map +0 -1
- package/dist/frontend/components/app/App.d.ts +0 -24
- package/dist/frontend/components/app/App.js +0 -207
- package/dist/frontend/components/app/App.js.map +0 -1
- package/dist/frontend/components/app/ExamplePicker.d.ts +0 -7
- package/dist/frontend/components/app/ExamplePicker.js +0 -36
- package/dist/frontend/components/app/ExamplePicker.js.map +0 -1
- package/dist/frontend/components/app/LanguagePicker.d.ts +0 -7
- package/dist/frontend/components/app/LanguagePicker.js +0 -33
- package/dist/frontend/components/app/LanguagePicker.js.map +0 -1
- package/dist/frontend/components/app/ProgrammingLanguagePicker.d.ts +0 -7
- package/dist/frontend/components/app/ProgrammingLanguagePicker.js +0 -38
- package/dist/frontend/components/app/ProgrammingLanguagePicker.js.map +0 -1
- package/dist/frontend/components/app/examples/JavaScriptExamples.d.ts +0 -5
- package/dist/frontend/components/app/examples/JavaScriptExamples.js +0 -16
- package/dist/frontend/components/app/examples/JavaScriptExamples.js.map +0 -1
- package/dist/frontend/components/app/examples/PythonExamples.d.ts +0 -14
- package/dist/frontend/components/app/examples/PythonExamples.js +0 -163
- package/dist/frontend/components/app/examples/PythonExamples.js.map +0 -1
- package/dist/frontend/components/app/themes/ThemePicker.d.ts +0 -11
- package/dist/frontend/components/app/themes/ThemePicker.js +0 -48
- package/dist/frontend/components/app/themes/ThemePicker.js.map +0 -1
- package/dist/frontend/components/app/themes/ThemedButton.d.ts +0 -9
- package/dist/frontend/components/app/themes/ThemedButton.js +0 -53
- package/dist/frontend/components/app/themes/ThemedButton.js.map +0 -1
- package/dist/frontend/components/code_mirror/BatchInputEditor.d.ts +0 -8
- package/dist/frontend/components/code_mirror/BatchInputEditor.js +0 -51
- package/dist/frontend/components/code_mirror/BatchInputEditor.js.map +0 -1
- package/dist/frontend/components/code_mirror/CodeEditor.d.ts +0 -24
- package/dist/frontend/components/code_mirror/CodeEditor.js +0 -200
- package/dist/frontend/components/code_mirror/CodeEditor.js.map +0 -1
- package/dist/frontend/components/code_mirror/CodeMirrorEditor.d.ts +0 -22
- package/dist/frontend/components/code_mirror/CodeMirrorEditor.js +0 -111
- package/dist/frontend/components/code_mirror/CodeMirrorEditor.js.map +0 -1
- package/dist/frontend/components/code_mirror/Extensions.d.ts +0 -15
- package/dist/frontend/components/code_mirror/Extensions.js +0 -164
- package/dist/frontend/components/code_mirror/Extensions.js.map +0 -1
- package/dist/frontend/components/code_mirror/MaterialTheme.d.ts +0 -5
- package/dist/frontend/components/code_mirror/MaterialTheme.js +0 -115
- package/dist/frontend/components/code_mirror/MaterialTheme.js.map +0 -1
- package/dist/frontend/components/code_runner/ButtonLint.d.ts +0 -9
- package/dist/frontend/components/code_runner/ButtonLint.js +0 -72
- package/dist/frontend/components/code_runner/ButtonLint.js.map +0 -1
- package/dist/frontend/components/code_runner/Code.d.ts +0 -7
- package/dist/frontend/components/code_runner/Code.js +0 -48
- package/dist/frontend/components/code_runner/Code.js.map +0 -1
- package/dist/frontend/components/code_runner/RunState.d.ts +0 -7
- package/dist/frontend/components/code_runner/RunState.js +0 -41
- package/dist/frontend/components/code_runner/RunState.js.map +0 -1
- package/dist/frontend/components/input/BatchInput.d.ts +0 -9
- package/dist/frontend/components/input/BatchInput.js +0 -53
- package/dist/frontend/components/input/BatchInput.js.map +0 -1
- package/dist/frontend/components/input/InteractiveInput.d.ts +0 -13
- package/dist/frontend/components/input/InteractiveInput.js +0 -71
- package/dist/frontend/components/input/InteractiveInput.js.map +0 -1
- package/dist/frontend/state/Constants.d.ts +0 -38
- package/dist/frontend/state/Constants.js +0 -111
- package/dist/frontend/state/Constants.js.map +0 -1
- package/dist/frontend/state/Debugger.d.ts +0 -23
- package/dist/frontend/state/Debugger.js +0 -86
- package/dist/frontend/state/Debugger.js.map +0 -1
- package/dist/frontend/state/Examples.d.ts +0 -11
- package/dist/frontend/state/Examples.js +0 -36
- package/dist/frontend/state/Examples.js.map +0 -1
- package/dist/frontend/state/I18n.d.ts +0 -16
- package/dist/frontend/state/I18n.js +0 -75
- package/dist/frontend/state/I18n.js.map +0 -1
- package/dist/frontend/state/InputOutput.d.ts +0 -64
- package/dist/frontend/state/InputOutput.js +0 -146
- package/dist/frontend/state/InputOutput.js.map +0 -1
- package/dist/frontend/state/Papyros.d.ts +0 -40
- package/dist/frontend/state/Papyros.js +0 -115
- package/dist/frontend/state/Papyros.js.map +0 -1
- package/dist/frontend/state/Runner.d.ts +0 -123
- package/dist/frontend/state/Runner.js +0 -372
- package/dist/frontend/state/Runner.js.map +0 -1
- package/dist/frontend/state/Test.d.ts +0 -10
- package/dist/frontend/state/Test.js +0 -43
- package/dist/frontend/state/Test.js.map +0 -1
- package/dist/frontend/state/Translations.d.ts +0 -178
- package/dist/frontend/state/Translations.js +0 -187
- package/dist/frontend/state/Translations.js.map +0 -1
- package/dist/frontend/state/themes/blue-dark.d.ts +0 -2
- package/dist/frontend/state/themes/blue-dark.js +0 -56
- package/dist/frontend/state/themes/blue-dark.js.map +0 -1
- package/dist/frontend/state/themes/blue-light.d.ts +0 -2
- package/dist/frontend/state/themes/blue-light.js +0 -56
- package/dist/frontend/state/themes/blue-light.js.map +0 -1
- package/dist/frontend/state/themes/green-dark.d.ts +0 -2
- package/dist/frontend/state/themes/green-dark.js +0 -56
- package/dist/frontend/state/themes/green-dark.js.map +0 -1
- package/dist/frontend/state/themes/green-light.d.ts +0 -2
- package/dist/frontend/state/themes/green-light.js +0 -56
- package/dist/frontend/state/themes/green-light.js.map +0 -1
- package/dist/frontend/state/themes/red-dark.d.ts +0 -2
- package/dist/frontend/state/themes/red-dark.js +0 -56
- package/dist/frontend/state/themes/red-dark.js.map +0 -1
- package/dist/frontend/state/themes/red-light.d.ts +0 -2
- package/dist/frontend/state/themes/red-light.js +0 -56
- package/dist/frontend/state/themes/red-light.js.map +0 -1
- package/dist/util/Logging.d.ts +0 -15
- package/dist/util/Logging.js +0 -30
- package/dist/util/Logging.js.map +0 -1
- package/dist/util/Util.d.ts +0 -8
- package/dist/util/Util.js +0 -48
- package/dist/util/Util.js.map +0 -1
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { State } from "@dodona/lit-state";
|
|
2
|
-
import { Papyros } from "./Papyros";
|
|
3
|
-
/**
|
|
4
|
-
* Shape of Error objects that are easy to interpret
|
|
5
|
-
*/
|
|
6
|
-
export interface FriendlyError {
|
|
7
|
-
/**
|
|
8
|
-
* The name of the Error
|
|
9
|
-
*/
|
|
10
|
-
name: string;
|
|
11
|
-
/**
|
|
12
|
-
* Traceback for where in the code the Error occurred
|
|
13
|
-
*/
|
|
14
|
-
traceback?: string;
|
|
15
|
-
/**
|
|
16
|
-
* General information about this type of Error
|
|
17
|
-
*/
|
|
18
|
-
info?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Information about what went wrong in this case
|
|
21
|
-
*/
|
|
22
|
-
what?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Information about why this is wrong and how to fix it
|
|
25
|
-
*/
|
|
26
|
-
why?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Where specifically in the source code the Error occurred
|
|
29
|
-
*/
|
|
30
|
-
where?: string;
|
|
31
|
-
}
|
|
32
|
-
export declare enum OutputType {
|
|
33
|
-
stdout = "stdout",
|
|
34
|
-
stderr = "stderr",
|
|
35
|
-
img = "img"
|
|
36
|
-
}
|
|
37
|
-
export type OutputEntry = {
|
|
38
|
-
type: OutputType;
|
|
39
|
-
content: string | FriendlyError;
|
|
40
|
-
contentType?: string;
|
|
41
|
-
};
|
|
42
|
-
export declare enum InputMode {
|
|
43
|
-
batch = "batch",
|
|
44
|
-
interactive = "interactive"
|
|
45
|
-
}
|
|
46
|
-
export declare class InputOutput extends State {
|
|
47
|
-
private papyros;
|
|
48
|
-
inputs: string[];
|
|
49
|
-
output: OutputEntry[];
|
|
50
|
-
prompt: string;
|
|
51
|
-
awaitingInput: boolean;
|
|
52
|
-
inputMode: InputMode;
|
|
53
|
-
private _inputBuffer;
|
|
54
|
-
get inputBuffer(): string;
|
|
55
|
-
set inputBuffer(value: string);
|
|
56
|
-
private get nextBufferedLine();
|
|
57
|
-
constructor(papyros: Papyros);
|
|
58
|
-
logError(error: FriendlyError | string): void;
|
|
59
|
-
logImage(imageData: string, contentType?: string): void;
|
|
60
|
-
logOutput(output: string): void;
|
|
61
|
-
provideInput(input: string): void;
|
|
62
|
-
clearInputs(): void;
|
|
63
|
-
reset(): void;
|
|
64
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { State, stateProperty } from "@dodona/lit-state";
|
|
8
|
-
import { BackendManager } from "../../communication/BackendManager";
|
|
9
|
-
import { BackendEventType } from "../../communication/BackendEvent";
|
|
10
|
-
import { parseData } from "../../util/Util";
|
|
11
|
-
import { RunState } from "./Runner";
|
|
12
|
-
export var OutputType;
|
|
13
|
-
(function (OutputType) {
|
|
14
|
-
OutputType["stdout"] = "stdout";
|
|
15
|
-
OutputType["stderr"] = "stderr";
|
|
16
|
-
OutputType["img"] = "img";
|
|
17
|
-
})(OutputType || (OutputType = {}));
|
|
18
|
-
export var InputMode;
|
|
19
|
-
(function (InputMode) {
|
|
20
|
-
InputMode["batch"] = "batch";
|
|
21
|
-
InputMode["interactive"] = "interactive";
|
|
22
|
-
})(InputMode || (InputMode = {}));
|
|
23
|
-
export class InputOutput extends State {
|
|
24
|
-
get inputBuffer() {
|
|
25
|
-
return this._inputBuffer;
|
|
26
|
-
}
|
|
27
|
-
set inputBuffer(value) {
|
|
28
|
-
this._inputBuffer = value;
|
|
29
|
-
if (this.nextBufferedLine !== undefined && this.inputMode === InputMode.batch && this.awaitingInput) {
|
|
30
|
-
this.provideInput(this.nextBufferedLine);
|
|
31
|
-
}
|
|
32
|
-
if (!this.papyros.debugger.active && this.papyros.runner.state === RunState.Ready) {
|
|
33
|
-
this.clearInputs();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
get nextBufferedLine() {
|
|
37
|
-
const bufferedLines = this.inputBuffer.split("\n").slice(0, -1);
|
|
38
|
-
if (bufferedLines.length > this.inputs.length) {
|
|
39
|
-
return bufferedLines[this.inputs.length];
|
|
40
|
-
}
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
constructor(papyros) {
|
|
44
|
-
super();
|
|
45
|
-
this.inputs = [];
|
|
46
|
-
this.output = [];
|
|
47
|
-
this.prompt = "";
|
|
48
|
-
this.awaitingInput = false;
|
|
49
|
-
this.inputMode = InputMode.interactive;
|
|
50
|
-
this._inputBuffer = "";
|
|
51
|
-
this.papyros = papyros;
|
|
52
|
-
this.reset();
|
|
53
|
-
BackendManager.subscribe(BackendEventType.Start, () => this.reset());
|
|
54
|
-
BackendManager.subscribe(BackendEventType.Output, (e) => {
|
|
55
|
-
const data = parseData(e.data, e.contentType);
|
|
56
|
-
if (e.contentType && e.contentType.startsWith("img")) {
|
|
57
|
-
this.logImage(data, e.contentType);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
this.logOutput(data);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
BackendManager.subscribe(BackendEventType.Error, (e) => {
|
|
64
|
-
const data = parseData(e.data, e.contentType);
|
|
65
|
-
this.logError(data);
|
|
66
|
-
});
|
|
67
|
-
BackendManager.subscribe(BackendEventType.Input, (e) => {
|
|
68
|
-
if (this.nextBufferedLine !== undefined && this.inputMode === InputMode.batch) {
|
|
69
|
-
this.provideInput(this.nextBufferedLine);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
this.prompt = e.data || "";
|
|
73
|
-
this.awaitingInput = true;
|
|
74
|
-
});
|
|
75
|
-
BackendManager.subscribe(BackendEventType.End, () => {
|
|
76
|
-
this.awaitingInput = false;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
logError(error) {
|
|
80
|
-
var _a;
|
|
81
|
-
if (typeof error === "string") {
|
|
82
|
-
if (error.includes("service worker for reading input")) {
|
|
83
|
-
this.papyros.errorHandler(new Error("Service worker for reading input was not available", { cause: error }));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if ((_a = error.traceback) === null || _a === void 0 ? void 0 : _a.includes("service worker for reading input")) {
|
|
87
|
-
this.papyros.errorHandler(new Error("Service worker for reading input was not available", { cause: error }));
|
|
88
|
-
}
|
|
89
|
-
this.output = [...this.output, { type: OutputType.stderr, content: error }];
|
|
90
|
-
}
|
|
91
|
-
logImage(imageData, contentType = "img/png") {
|
|
92
|
-
this.output = [...this.output, { type: OutputType.img, content: imageData, contentType }];
|
|
93
|
-
}
|
|
94
|
-
logOutput(output) {
|
|
95
|
-
// lines have been merged to limit the number of events
|
|
96
|
-
// we split them again here, to simplify overflow detection
|
|
97
|
-
const lines = output.split("\n");
|
|
98
|
-
if (lines.length > 1) {
|
|
99
|
-
this.output = [
|
|
100
|
-
...this.output,
|
|
101
|
-
...lines.slice(0, -1).map((line) => ({ type: OutputType.stdout, content: line + "\n" })),
|
|
102
|
-
{ type: OutputType.stdout, content: lines[lines.length - 1] },
|
|
103
|
-
];
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
this.output = [...this.output, { type: OutputType.stdout, content: output }];
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
provideInput(input) {
|
|
110
|
-
this.inputs = [...this.inputs, input];
|
|
111
|
-
this.papyros.runner.provideInput(input);
|
|
112
|
-
this.prompt = "";
|
|
113
|
-
this.awaitingInput = false;
|
|
114
|
-
}
|
|
115
|
-
clearInputs() {
|
|
116
|
-
this.inputs = [];
|
|
117
|
-
}
|
|
118
|
-
reset() {
|
|
119
|
-
this.inputs = [];
|
|
120
|
-
this.output = [];
|
|
121
|
-
this.prompt = "";
|
|
122
|
-
this.awaitingInput = false;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
__decorate([
|
|
126
|
-
stateProperty
|
|
127
|
-
], InputOutput.prototype, "inputs", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
stateProperty
|
|
130
|
-
], InputOutput.prototype, "output", void 0);
|
|
131
|
-
__decorate([
|
|
132
|
-
stateProperty
|
|
133
|
-
], InputOutput.prototype, "prompt", void 0);
|
|
134
|
-
__decorate([
|
|
135
|
-
stateProperty
|
|
136
|
-
], InputOutput.prototype, "awaitingInput", void 0);
|
|
137
|
-
__decorate([
|
|
138
|
-
stateProperty
|
|
139
|
-
], InputOutput.prototype, "inputMode", void 0);
|
|
140
|
-
__decorate([
|
|
141
|
-
stateProperty
|
|
142
|
-
], InputOutput.prototype, "_inputBuffer", void 0);
|
|
143
|
-
__decorate([
|
|
144
|
-
stateProperty
|
|
145
|
-
], InputOutput.prototype, "inputBuffer", null);
|
|
146
|
-
//# sourceMappingURL=InputOutput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InputOutput.js","sourceRoot":"","sources":["../../../src/frontend/state/InputOutput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAgCpC,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,yBAAW,CAAA;AACf,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAQD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,4BAAe,CAAA;IACf,wCAA2B,CAAA;AAC/B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,OAAO,WAAY,SAAQ,KAAK;IAgBlC,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IACD,IAAI,WAAW,CAAC,KAAa;QACzB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KA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E,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE;aAChE,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACjF,CAAC;IACL,CAAC;IAEM,YAAY,CAAC,KAAa;QAC7B,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;IAEM,WAAW;QACd,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;CACJ;AAnHG;IADC,aAAa;2CACQ;AAEtB;IADC,aAAa;2CACa;AAE3B;IADC,aAAa;2CACM;AAEpB;IADC,aAAa;kDACiB;AAE/B;IADC,aAAa;8CAC+B;AAGrC;IADP,aAAa;iDACoB;AAElC;IADC,aAAa;8CAGb"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { State } from "@dodona/lit-state";
|
|
2
|
-
import { Debugger } from "./Debugger";
|
|
3
|
-
import { Runner } from "./Runner";
|
|
4
|
-
import { InputOutput } from "./InputOutput";
|
|
5
|
-
import { Constants } from "./Constants";
|
|
6
|
-
import { Examples } from "./Examples";
|
|
7
|
-
import { I18n } from "./I18n";
|
|
8
|
-
import { Test } from "./Test";
|
|
9
|
-
export declare class Papyros extends State {
|
|
10
|
-
readonly debugger: Debugger;
|
|
11
|
-
readonly runner: Runner;
|
|
12
|
-
readonly io: InputOutput;
|
|
13
|
-
readonly constants: Constants;
|
|
14
|
-
readonly examples: Examples;
|
|
15
|
-
readonly i18n: I18n;
|
|
16
|
-
readonly test: Test;
|
|
17
|
-
errorHandler: (error: Error) => void;
|
|
18
|
-
serviceWorkerName: string;
|
|
19
|
-
/**
|
|
20
|
-
* Launch this instance of Papyros, making it ready to run code
|
|
21
|
-
* @return {Promise<Papyros>} Promise of launching, chainable
|
|
22
|
-
*/
|
|
23
|
-
launch(): Promise<Papyros>;
|
|
24
|
-
/**
|
|
25
|
-
* Set an error handler in papyros. Papyros will pass any errors to this handler that should be investigated but don't bubble up naturally.
|
|
26
|
-
*
|
|
27
|
-
* @param handler An error handler (e.g. something that passes the error on to sentry)
|
|
28
|
-
*/
|
|
29
|
-
setErrorHandler(handler: (error: Error) => void): void;
|
|
30
|
-
/**
|
|
31
|
-
* Configure how user input is handled within Papyros
|
|
32
|
-
* By default, we will try to use SharedArrayBuffers
|
|
33
|
-
* If this option is not available, the optional arguments in the channelOptions config are used
|
|
34
|
-
* They are needed to register a service worker to handle communication between threads
|
|
35
|
-
* @return {Promise<boolean>} Promise of configuring input
|
|
36
|
-
*/
|
|
37
|
-
private configureInput;
|
|
38
|
-
private waitForActiveRegistration;
|
|
39
|
-
}
|
|
40
|
-
export declare const papyros: Papyros;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
import { State, stateProperty } from "@dodona/lit-state";
|
|
17
|
-
import { Debugger } from "./Debugger";
|
|
18
|
-
import { Runner } from "./Runner";
|
|
19
|
-
import { InputOutput } from "./InputOutput";
|
|
20
|
-
import { Constants } from "./Constants";
|
|
21
|
-
import { Examples } from "./Examples";
|
|
22
|
-
import { BackendManager } from "../../communication/BackendManager";
|
|
23
|
-
import { makeChannel } from "sync-message";
|
|
24
|
-
import { I18n } from "./I18n";
|
|
25
|
-
import { Test } from "./Test";
|
|
26
|
-
export class Papyros extends State {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(...arguments);
|
|
29
|
-
this.debugger = new Debugger(this);
|
|
30
|
-
this.runner = new Runner(this);
|
|
31
|
-
this.io = new InputOutput(this);
|
|
32
|
-
this.constants = new Constants();
|
|
33
|
-
this.examples = new Examples(this);
|
|
34
|
-
this.i18n = new I18n();
|
|
35
|
-
this.test = new Test(this);
|
|
36
|
-
this.errorHandler = () => { };
|
|
37
|
-
this.serviceWorkerName = "InputServiceWorker.js";
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Launch this instance of Papyros, making it ready to run code
|
|
41
|
-
* @return {Promise<Papyros>} Promise of launching, chainable
|
|
42
|
-
*/
|
|
43
|
-
launch() {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
if (!(yield this.configureInput())) {
|
|
46
|
-
alert(this.i18n.t("Papyros.service_worker_error"));
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
try {
|
|
50
|
-
yield this.runner.launch();
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
this.errorHandler(new Error("Error launching papyros after registering service worker", { cause: e }));
|
|
54
|
-
if (confirm(this.i18n.t("Papyros.launch_error"))) {
|
|
55
|
-
return this.launch();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return this;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Set an error handler in papyros. Papyros will pass any errors to this handler that should be investigated but don't bubble up naturally.
|
|
64
|
-
*
|
|
65
|
-
* @param handler An error handler (e.g. something that passes the error on to sentry)
|
|
66
|
-
*/
|
|
67
|
-
setErrorHandler(handler) {
|
|
68
|
-
this.errorHandler = handler;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Configure how user input is handled within Papyros
|
|
72
|
-
* By default, we will try to use SharedArrayBuffers
|
|
73
|
-
* If this option is not available, the optional arguments in the channelOptions config are used
|
|
74
|
-
* They are needed to register a service worker to handle communication between threads
|
|
75
|
-
* @return {Promise<boolean>} Promise of configuring input
|
|
76
|
-
*/
|
|
77
|
-
configureInput() {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
if (typeof SharedArrayBuffer === "undefined") {
|
|
80
|
-
if (!this.serviceWorkerName || !("serviceWorker" in navigator)) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
try {
|
|
84
|
-
yield navigator.serviceWorker.register(this.serviceWorkerName, { scope: "/" });
|
|
85
|
-
BackendManager.channel = makeChannel({ serviceWorker: { scope: "/" } });
|
|
86
|
-
yield this.waitForActiveRegistration();
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
this.errorHandler(new Error("Error registering service worker", { cause: e }));
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
BackendManager.channel = makeChannel({ atomics: {} });
|
|
95
|
-
}
|
|
96
|
-
return true;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
waitForActiveRegistration() {
|
|
100
|
-
return __awaiter(this, arguments, void 0, function* (timeout = 5000) {
|
|
101
|
-
return new Promise((resolve, reject) => {
|
|
102
|
-
const timeoutHandle = setTimeout(() => reject(new Error("Timed out waiting for activated service worker")), timeout);
|
|
103
|
-
navigator.serviceWorker.ready.then(() => {
|
|
104
|
-
clearTimeout(timeoutHandle);
|
|
105
|
-
resolve();
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
__decorate([
|
|
112
|
-
stateProperty
|
|
113
|
-
], Papyros.prototype, "serviceWorkerName", void 0);
|
|
114
|
-
export const papyros = new Papyros();
|
|
115
|
-
//# sourceMappingURL=Papyros.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Papyros.js","sourceRoot":"","sources":["../../../src/frontend/state/Papyros.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,E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AAI,KAAK,CAAC,gDAAgD,CAAC,CAAC,EACzE,OAAO,CACV,CAAC;gBACF,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;oBACpC,YAAY,CAAC,aAAa,CAAC,CAAC;oBAC5B,OAAO,EAAE,CAAC;gBACd,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACJ;AArEG;IADC,aAAa;kDACsC;AAuExD,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { SyncClient } from "comsync";
|
|
2
|
-
import { Backend, RunMode, WorkerDiagnostic } from "../../backend/Backend";
|
|
3
|
-
import { State } from "@dodona/lit-state";
|
|
4
|
-
import { Papyros } from "./Papyros";
|
|
5
|
-
import { ProgrammingLanguage } from "../../ProgrammingLanguage";
|
|
6
|
-
/**
|
|
7
|
-
* Enum representing the possible states while processing code
|
|
8
|
-
*/
|
|
9
|
-
export declare enum RunState {
|
|
10
|
-
Loading = "loading",
|
|
11
|
-
Running = "running",
|
|
12
|
-
AwaitingInput = "awaiting_input",
|
|
13
|
-
Stopping = "stopping",
|
|
14
|
-
Ready = "ready"
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Interface to represent information required when handling loading events
|
|
18
|
-
*/
|
|
19
|
-
export interface LoadingData {
|
|
20
|
-
/**
|
|
21
|
-
* List of module names that are being loaded
|
|
22
|
-
*/
|
|
23
|
-
modules: Array<string>;
|
|
24
|
-
/**
|
|
25
|
-
* The status of the import
|
|
26
|
-
*/
|
|
27
|
-
status: "loading" | "loaded" | "failed";
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Helper component to manage and visualize the current RunState
|
|
31
|
-
*/
|
|
32
|
-
export declare class Runner extends State {
|
|
33
|
-
/**
|
|
34
|
-
* The currently used programming language
|
|
35
|
-
*/
|
|
36
|
-
private _programmingLanguage;
|
|
37
|
-
get programmingLanguage(): ProgrammingLanguage;
|
|
38
|
-
set programmingLanguage(value: ProgrammingLanguage);
|
|
39
|
-
/**
|
|
40
|
-
* The backend that executes the code asynchronously
|
|
41
|
-
*/
|
|
42
|
-
backend: Promise<SyncClient<Backend>>;
|
|
43
|
-
/**
|
|
44
|
-
* Current state of the program
|
|
45
|
-
*/
|
|
46
|
-
state: RunState;
|
|
47
|
-
/**
|
|
48
|
-
* An explanatory message about the current state
|
|
49
|
-
*/
|
|
50
|
-
stateMessage: string;
|
|
51
|
-
/**
|
|
52
|
-
* Previous state to restore when loading is done
|
|
53
|
-
*/
|
|
54
|
-
private previousState;
|
|
55
|
-
/**
|
|
56
|
-
* Array of packages that are being installed
|
|
57
|
-
*/
|
|
58
|
-
loadingPackages: Array<string>;
|
|
59
|
-
/**
|
|
60
|
-
* Time at which the setState call occurred
|
|
61
|
-
*/
|
|
62
|
-
runStartTime: number;
|
|
63
|
-
/**
|
|
64
|
-
* The code we are working with
|
|
65
|
-
*/
|
|
66
|
-
_code: string;
|
|
67
|
-
get code(): string;
|
|
68
|
-
set code(value: string);
|
|
69
|
-
static CODE_SEPARATOR: string;
|
|
70
|
-
get effectiveCode(): string;
|
|
71
|
-
set effectiveCode(value: string);
|
|
72
|
-
/**
|
|
73
|
-
* Async getter for the linting diagnostics of the current code
|
|
74
|
-
*/
|
|
75
|
-
lintSource(): Promise<WorkerDiagnostic[]>;
|
|
76
|
-
/**
|
|
77
|
-
* available run modes for the current code
|
|
78
|
-
*/
|
|
79
|
-
runModes: Array<RunMode>;
|
|
80
|
-
/**
|
|
81
|
-
* The global state where we are part of
|
|
82
|
-
*/
|
|
83
|
-
private papyros;
|
|
84
|
-
constructor(papyros: Papyros);
|
|
85
|
-
/**
|
|
86
|
-
* Stops the current run and resets the state of the program
|
|
87
|
-
* Regular and debug output is cleared
|
|
88
|
-
* @return {Promise<void>} Returns when the program has been reset
|
|
89
|
-
*/
|
|
90
|
-
reset(): Promise<void>;
|
|
91
|
-
/**
|
|
92
|
-
* Start the backend to enable running code
|
|
93
|
-
*/
|
|
94
|
-
launch(): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* Execute the code in the editor
|
|
97
|
-
* @param {RunMode} mode The mode to run with
|
|
98
|
-
* @return {Promise<void>} Promise of running the code
|
|
99
|
-
*/
|
|
100
|
-
start(mode?: RunMode): Promise<void>;
|
|
101
|
-
/**
|
|
102
|
-
* Interrupt the currently running code
|
|
103
|
-
* @return {Promise<void>} Returns when the code has been interrupted
|
|
104
|
-
*/
|
|
105
|
-
stop(): Promise<void>;
|
|
106
|
-
provideInput(input: string): Promise<void>;
|
|
107
|
-
provideFiles(inlinedFiles: Record<string, string>, hrefFiles: Record<string, string>): Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
* Show the current state of the program to the user
|
|
110
|
-
* @param {RunState} state The current state of the run
|
|
111
|
-
* @param {string} message Optional message to indicate the state
|
|
112
|
-
*/
|
|
113
|
-
setState(state: RunState, message?: string): void;
|
|
114
|
-
/**
|
|
115
|
-
* Callback to handle loading events
|
|
116
|
-
* @param {BackendEvent} e The loading event
|
|
117
|
-
*/
|
|
118
|
-
private onLoad;
|
|
119
|
-
private onStart;
|
|
120
|
-
private onEnd;
|
|
121
|
-
private onError;
|
|
122
|
-
private updateRunModes;
|
|
123
|
-
}
|