Function deskulpt::commands::bundle_widget

source ยท
pub(crate) fn bundle_widget<R: Runtime>(
    app_handle: AppHandle<R>,
    widget_id: String,
    apis_blob_url: String,
) -> Result<String, String>
Expand description

Command for bundling the specified widget.

The widget configuration will be obtained by searching the managed widget collection for the given widget ID. The widget will be bundled into a string of ESM code if the ID is found in the collection.

The command also requires the URL of the APIs blob of the widget. This is used for replacing the imports of @deskulpt-test/apis by the actual URL to import from.

This command will fail if:

  • The widget ID is not found in the state of the widget collection.
  • The widget collection state corresponding to the widget ID is an error message instead of a widget configuration.
  • There is an error when bundling the widget.