Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { IPluginDefinition } from "./types";
import { stepperPlugin } from "./plugins/stepper";
import type { IPluginDefinition } from "./types";
import { generatePluginMap } from "./util";

export const plugins: IPluginDefinition[] = [
stepperPlugin,
];

export const pluginMap: Map<string, IPluginDefinition> = /*#__PURE__*/ generatePluginMap(plugins);
Expand Down
18 changes: 18 additions & 0 deletions src/plugins/stepper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { type IPluginDefinition, PluginType } from "../types";

/**
* The Stepper (substitution visualizer) host plugin.
*
* Only a WEB resolution is provided: the runner half is bundled into each language's evaluator (it
* extends `@sourceacademy/runner-stepper`), and the evaluator pulls in this web half by calling
* `hostLoadPlugin("stepper")`. The id must match `STEPPER_DIRECTORY_ID` from
* `@sourceacademy/common-stepper`.
*/
export const stepperPlugin: IPluginDefinition = {
id: "stepper",
name: "Stepper",
description: "Visualises the step-by-step substitution evaluation of a program.",
resolutions: {
[PluginType.WEB]: "https://source-academy.github.io/plugins/web/stepper/dist/index.mjs",
},
};
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IPluginDefinition } from "./types";
import type { IPluginDefinition } from "./types";

export function generatePluginMap(plugins: IPluginDefinition[]): Map<string, IPluginDefinition> {
return new Map(plugins.map(plugin => [plugin.id, plugin]));
Expand Down