View Source FsBuild.Adapter behaviour (FsBuild v1.1.1)

The specification of adapters.

Summary

Types

The content of file.

The main data transformed from file.

The metadata transformed from file.

The option for current adapter.

The path of file.

Callbacks

Prepares for following works, such as

Transforms the content of files.

Types

@type content() :: binary()

The content of file.

@type data() :: any()

The main data transformed from file.

@type metadata() :: map()

The metadata transformed from file.

@type opts() :: keyword()

The option for current adapter.

@type path() :: binary()

The path of file.

Callbacks

@callback init(opts()) :: :ok

Prepares for following works, such as:

  • checking required dependencies
  • starting necessary applications
  • ...
Link to this callback

transform(path, content, opts)

View Source
@callback transform(path(), content(), opts()) ::
  {data(), metadata()} | [{data(), metadata()}]

Transforms the content of files.

It must return:

  • a 2 element tuple with attributes and body - {data, metadata}
  • a list of 2 element tuple with attributes and body - [{data, metadata} | _]