@sourceacademy/runner-cse-machine 1.0.0
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/__tests__/runner.test.d.ts +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.mjs +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";class s{constructor(s,[e]){if(this.id="__runner_cse",!e)throw new Error("CSE channel is required but was not provided.");this.__cseChannel=e}sendSnapshots(s){this.__cseChannel.send({type:"snapshots",snapshots:s,totalSteps:s.length})}}s.channelAttach=["__cse"],exports.CseMachinePlugin=s;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type CseSnapshot } from "@sourceacademy/common-cse-machine";
|
|
2
|
+
import type { IPlugin, IChannel, IConduit } from "@sourceacademy/conductor/conduit";
|
|
3
|
+
/**
|
|
4
|
+
* Runner-side CSE machine plugin.
|
|
5
|
+
*
|
|
6
|
+
* An evaluator (js-slang, py-slang, ...) registers this plugin and feeds it a batch of
|
|
7
|
+
* language-agnostic {@link CseSnapshot}s via {@link CseMachinePlugin.sendSnapshots}; the
|
|
8
|
+
* plugin forwards them over the {@link CSE_CHANNEL} to the web/host plugin, which renders
|
|
9
|
+
* the CSE machine visualization.
|
|
10
|
+
*
|
|
11
|
+
* The serialization of a language's control/stash/environment into {@link CseSnapshot}s is
|
|
12
|
+
* the evaluator's responsibility and stays in the evaluator repo — this plugin only owns the
|
|
13
|
+
* transport, so it can be reused by every language.
|
|
14
|
+
*/
|
|
15
|
+
export declare class CseMachinePlugin implements IPlugin {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
static readonly channelAttach: string[];
|
|
18
|
+
private readonly __cseChannel;
|
|
19
|
+
constructor(_conduit: IConduit, [cseChannel]: IChannel<any>[]);
|
|
20
|
+
/**
|
|
21
|
+
* Send a full run's worth of snapshots to the host plugin.
|
|
22
|
+
* @param snapshots The serialized evaluation snapshots, in step order.
|
|
23
|
+
*/
|
|
24
|
+
sendSnapshots(snapshots: CseSnapshot[]): void;
|
|
25
|
+
}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class s{constructor(s,[e]){if(this.id="__runner_cse",!e)throw new Error("CSE channel is required but was not provided.");this.__cseChannel=e}sendSnapshots(s){this.__cseChannel.send({type:"snapshots",snapshots:s,totalSteps:s.length})}}s.channelAttach=["__cse"];export{s as CseMachinePlugin};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sourceacademy/runner-cse-machine",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"packageManager": "yarn@4.6.0",
|
|
5
|
+
"description": "The runner-side CSE machine plugin: sends evaluation snapshots to the host",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rollup -c",
|
|
8
|
+
"prepack": "yarn build"
|
|
9
|
+
},
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"main": "dist/index.cjs",
|
|
15
|
+
"module": "dist/index.mjs",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"require": "./dist/index.cjs",
|
|
21
|
+
"types": "./dist/index.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@sourceacademy/common-cse-machine": ">=0.1.0",
|
|
26
|
+
"@sourceacademy/conductor": ">=0.3.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
30
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
31
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
32
|
+
"@sourceacademy/common-cse-machine": "workspace:*",
|
|
33
|
+
"@sourceacademy/conductor": ">=0.3.0",
|
|
34
|
+
"@vitest/coverage-istanbul": "^4.1.9",
|
|
35
|
+
"rollup": "^4.60.2",
|
|
36
|
+
"tslib": "^2.8.1",
|
|
37
|
+
"typescript": "^6.0.3",
|
|
38
|
+
"vitest": "^4.1.9"
|
|
39
|
+
}
|
|
40
|
+
}
|