Skip to content

Test a plugin ​

Try your plugin in Moket while you write it: serve it from your computer, install it once, and click Update after each build. This page lists what Moket checks and the limits a plugin runs within.

Access: Settings > Plugins, and a part that uses the plugin.

Try each change ​

  1. Run npm run serve in the plugin's folder and install it from http://localhost:5199/moket-plugin.json. See Write a plugin.
  2. Keep a test part that uses each feature of the plugin, with the values you want to check.
  3. After npm run build, click Update next to the plugin in Settings > Plugins, then open the test part. Its plugin features rebuild with the new code.
  4. Change a size the feature uses and check that the features after it still build: their references to your faces and edges must survive. See Build a feature.
  5. Turn the plugin off in Settings > Plugins and open the test part: it must open with the feature's last result, frozen. Turn the plugin on again.

console.log in your code writes to the browser's developer tools console. Code that does not need the kernel, such as the outline of a shape or the layout of an export, can be tested with any test runner.

What a plugin can reach ​

A plugin runs isolated in the browser of each person who installs it, in a worker of its own:

  • It has no network: fetch, WebSocket and loading scripts from the web fail.
  • It has no storage and no access to the page, the person's account or their other parts.
  • It sees only the part it builds in, through ctx, and only the shapes its build was given or made.

Moket's server never runs a person's own plugin. An agent working on Moket's server with no Moket tab open asks the person to open one; see Install plugins.

Limits ​

LimitWhat happens past it
A build or an export takes 30 sIt stops with The plugin took over 30 s and was stopped. The next build starts the plugin afresh
A build makes 20,000 shapesIt stops with The plugin made over 20000 shapes in one build and was stopped
The module is 2 MBThe plugin does not install
A feature's data is 1 MB of JSONThe feature fails with data over 1 MB
Marks of one build have 200,000 pointsThe feature fails
100 features, 40 params each, 8 new bodies each, 20 exportsThe manifest does not install
An export has 500 items, 200,000 points, 200 textsThe export fails

Troubleshooting ​

MessageWhat to do
The plugin did not load: ...The module has an error, or an import the bundle did not include. Bundle everything into one ES module
The plugin has no code for ...The default export has no build under that feature type. Check the type's spelling in the manifest and the module
The plugin returned ...The result is not what Moket expects: bodies must be { shape, topology, named } by body id
...: shape ... is not one this build received or madeA shape from an earlier build was used. Shapes last one build; keep sizes or outlines in data instead
No number param ...ctx.value was called for a number param that is optional and left out. Check params[name] !== undefined first
Plugins install from https URLs, or http://localhost while you write oneServe the plugin over https, or from your own computer while you write it
Could not read the plugin... (CORS)The site does not let other sites fetch the files. npm run serve allows it; on another site, allow CORS or share a zip

Moket Help