Skip to content

Plugin lock contract

pluginLock accepts a path to JSON or a parsed npm lock attribute set. It describes a standalone npm workspace project for plugin dependencies, not Pi’s workspace. null leaves dependency preparation to each plugin’s packageLock or nodeModules.

The root project is:

{
"name": "pi-bolt-plugins",
"version": "0.0.0",
"private": true,
"workspaces": ["pbplugins/*"]
}

The lock contains a workspace member at pbplugins/<pluginName> for each plugin whose dependencies it supplies. The name must identify a plugin in the compiled dependency closure. Plugins outside the lock can carry their own modules.

Member manifests project these fields from each plugin’s root package.json:

FieldMeaning
nameThe package’s npm name. May differ from pluginName; used for package imports.
versionThe package’s own version.
dependenciesDeclared runtime dependencies. Omitted if absent.
optionalDependenciesOptional runtime dependencies. Omitted if absent.

Use an npm lock compatible with those root/member manifests, including integrity-pinned registry dependencies. The shipped helper writes this shape. Any other generator may write it; no particular derivation shape, source layout or update framework is required. See the complete example.

payload.updatePluginLock provides:

update-plugin-lock -o OUT [NAME=]MANIFEST...
  • -o, --output is the destination lockfile; its parent directory must exist. An existing file is replaced.
  • MANIFEST is a file containing a JSON object with string name and version fields. Folders and archives are not accepted.
  • NAME is the plugin’s pluginName, used as its workspace folder. Without it the manifest’s folder name is used. Give each name once; a name cannot contain /.
  • At least one member is required. Resolve manifests at update time, not from old evaluation-time plugin store paths.

It creates a temporary project, projects the four fields above, runs npm’s lock-only resolver with --ignore-scripts --legacy-peer-deps, and copies the result to OUT. Network access is required for resolution. It does not fetch plugin sources, update pins, build plugins or know how their manifests were produced.

The build installs from the lock offline, omits dev dependencies, skips lifecycle scripts and does not auto-install peers. Optional packages are subject to platform constraints. The source manifests are read at build time, avoiding plugin builds during evaluation.

FailureMeaning / action
pluginLock has …, which this package does not compileMember names do not match the compiled closure. Regenerate for the intended set.
npm error Invalid: lock file's … does not satisfy …Source manifest and dependency lock disagree. Regenerate after updating manifests.
a plugin's dependencies are not what it declaresA declared dependency is missing or out of range in the staged tree; the message names the plugin, range and version. Fix its lock or own modules.
is not a file (pass the plugin's package.json)A folder/archive was supplied rather than a manifest.
needs NAME=MANIFESTThe manifest’s folder does not name the plugin; prefix the manifest with its name.
is not a package.json with a name and a versionInvalid manifest input.

Declared dependencies are checked before compilation, except Pi-provided packages and explicitly linked plugin dependencies. Undeclared imports may resolve through another plugin or Pi; successful resolution does not validate the plugin’s manifest. A member’s own version changing without dependency changes need not invalidate installed dependencies.