Skip to content
Verified

The plugin manifest

Six files a plugin can ship, each one a different entry point, and the manifest that records which of them exist.

A plugin's manifest is not a file you write. It is computed by the platform the moment a plugin is uploaded: validate_plugin() looks on disk for exactly six filenames, records which ones exist (and whether each was found at the package root or under dist/), and saves the result as doc.manifest on the plugin's catalog document. Everything downstream, the runtime's loader, the install consent screen, the dashboard's setup button, reads that manifest rather than probing the package itself.

The six files

A plugin ships whichever of these its kind needs. plugins/@xuda.io/xuda-ui-plugin-moment/src has only index.mjs and runtime.mjs; plugins/@xuda.io/xuda-library-plugin-xlsx has index.mjs and server.mjs; plugins/@xuda.io/xuda-dbs-plugin-couchdb has index.mjs and server.mjs.

Root or dist/

validate_plugin() looks for each file first at the package root, then at dist/<file>. Either location satisfies the manifest, so a plugin built with Vite (most of the ones under plugins/@xuda.io/) ships source under src/ and lets its build write the manifest files into dist/.

CSS only loads from dist

runtime.css (and any other manifest CSS) is only ever picked up when its matching .mjs was found under dist/, never from the package root. The runtime checks manifest[resource].dist && manifest[resource].css before it will fetch the stylesheet, so a plugin with a root-level runtime.mjs and a root-level style.css passes validation (exist: true on both) but the runtime never loads the CSS. Ship through dist/ if the plugin needs its stylesheet to actually load.

What the manifest is used for

  • Loading a UI plugin. The runtime refuses to run a UI plugin at all unless the manifest shows both runtime.mjs and index.mjs present; then it imports index.mjs for properties, resolves each property's value (including xu-exp: expression bindings) against the element's attributes, imports runtime.mjs, and calls fn.
  • The install consent screen. Manifest presence turns straight into the sentences a user reads before installing: shipping server.mjs says "Runs its own code on Xuda servers, inside your project"; shipping runtime.mjs says "Runs its own code inside your published app, in the browser of everyone who uses it"; studio.mjs and setup.mjs get their own lines too.
  • The dashboard's Setup button. A plugin's setup screen only shows when manifest['index.mjs'].exist is true and that module is not empty, or the plugin has a dependency with its own setup.