Documentation
    Preparing search index...

    Function definePlugin

    • A standard way to define a plugin and which options it needs to work. We recommend using this function to define your plugins, as it provides a clear structure and type safety for the plugin's configuration.

      Type Parameters

      Parameters

      • configSchema: Schema

        The schema of how the Options will be created from the user's configuration.

      • fn: (
            options: {
                [KeyType in string | number | symbol]: SchemaToOptions<Schema>[KeyType]
            },
        ) => Promise<PluginInstance>

        A function that takes the options and returns a promise of a plugin instance.

          • (
                options: {
                    [KeyType in string | number | symbol]: SchemaToOptions<Schema>[KeyType]
                },
            ): Promise<PluginInstance>
          • Parameters

            • options: { [KeyType in string | number | symbol]: SchemaToOptions<Schema>[KeyType] }

              The parsed and validated options as defined in the schema

            Returns Promise<PluginInstance>

      Returns PluginFactory<
          {
              [KeyType in string
              | number
              | symbol]: SchemaToOptions<Schema>[KeyType]
          },
      >

      A plugin factory that can be used to create plugin instances.