This package provides the TypeScript bindings for building Pumpkin plugins using WebAssembly (Wasm) components.
- Type-safe API: Full TypeScript definitions for all Pumpkin plugin interfaces.
- Easy Build Process: Includes a build script to bundle your TypeScript code and componentize it into a
.wasmfile. - Wasm Components: Built on the WebAssembly Component Model for high performance and portability.
npm install- Create a new TypeScript file (e.g.,
my-plugin.ts). - Extend the
Pluginclass and implement themetadata()method. - Register your plugin using
registerPlugin().
Example:
import { Plugin, registerPlugin, logging, context, PluginMetadata } from 'pumpkin-api-ts';
class MyPlugin extends Plugin {
metadata(): PluginMetadata {
return {
name: "My Awesome Plugin",
version: "0.1.0",
authors: ["Your Name"],
description: "A cool plugin for Pumpkin",
dependencies: []
};
}
onLoad(ctx: context.Context): void {
logging.info("Plugin loaded!");
}
}
registerPlugin(new MyPlugin());To build your plugin into a .wasm component, use the provided build script:
npm run build-plugin -- <entry-file.ts> <output-file.wasm>Example:
npm run build-plugin -- example/my-plugin.ts my-plugin.wasm