loadEnvironmentFromManifest

Validates a plugin manifest, imports its code and registers the environment it defines.

@internote/canvas-sdk/hostFunction
On this page
import { loadEnvironmentFromManifest } from '@internote/canvas-sdk/host';

Only runtime: 'module' loads; worker is reserved for a sandboxed runtime. It rejects when the manifest is invalid, asks for the worker runtime or has no src, when the module does not default-export a definition, or when the definition's name differs from manifest.chalk.environment.

#Signature

(
    manifest: CanvasPluginManifest,
    options?: CanvasLoadOptions,
): Promise<EnvironmentDefinition>

#Parameters

manifest
The plugin's manifest.
options
How to import the module, and whether to register the result.

#Returns

The plugin's environment definition.

#Example

const manifest = await fetch('/plugins/greeting.json').then((r) => r.json());
const greeting = await loadEnvironmentFromManifest(manifest);

Declared in packages/canvas-sdk/src/plugin/loader.ts:45.

Last updated