Dala.Plugin.Manifest (dala v0.3.1)

Copy Markdown View Source

Generates native plugin manifests for iOS and Android platforms.

The manifest describes to the native runtime which components are available and how to instantiate them. This enables dynamic plugin loading without recompiling the host application.

Manifest Format

{
  "schema_version": "1.0.0",
  "protocol_version": 3,
  "native_api_version": "2.0.0",
  "description": "Video playback plugin",
  "permissions": ["camera"],
  "dependencies": [{"name": "maps", "version": "~> 1.0"}],
  "platforms": ["ios", "android"],
  "capabilities": ["gestures", "accessibility", "animation"],
  "native_modules": {
    "ios": ["MyPlugin.IOS"],
    "android": ["MyPlugin.Android"]
  },
  "status": "registered",
  "components": {
    "video": {
      "ios": "DalaVideoView",
      "android": "com.dala.video.VideoView"
    }
  },
  "capabilities_by_component": {
    "video": ["gestures", "accessibility", "animation"]
  }
}

Usage

Plugins can ship this manifest in their native resources:

  • iOS: DalaPlugin.bundle/manifest.json
  • Android: assets/dala_plugins/my_plugin/manifest.json

The Dala runtime auto-discovers and registers plugins at startup.

Summary

Functions

Loads a manifest from JSON.

Generates a manifest for the given plugin.

Registers all components from a manifest with the runtime.

Encodes the manifest as JSON.

Writes the manifest to a file.

Functions

from_json(json)

@spec from_json(String.t()) :: {:ok, map()} | {:error, term()}

Loads a manifest from JSON.

generate(plugin)

@spec generate(Dala.Plugin.t()) :: map()

Generates a manifest for the given plugin.

The manifest is a JSON-compatible map that describes all components, their native class mappings, supported capabilities, and metadata.

register_from_manifest(manifest)

@spec register_from_manifest(map()) :: :ok

Registers all components from a manifest with the runtime.

This is used by the native host to dynamically register plugin components at startup.

to_json(plugin)

@spec to_json(Dala.Plugin.t()) :: String.t()

Encodes the manifest as JSON.

write_to_file(plugin, path)

@spec write_to_file(Dala.Plugin.t(), String.t()) :: :ok | {:error, term()}

Writes the manifest to a file.