Current section
Files
Jump to
Current section
Files
src/nori@codegen@plugin.erl
-module(nori@codegen@plugin).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/nori/codegen/plugin.gleam").
-export([default_config/1]).
-export_type([generator_config/0, generated_file/0, plugin/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Plugin system for code generation.\n"
"\n"
" Plugins are function values — idiomatic Gleam, no traits needed.\n"
).
-type generator_config() :: {generator_config,
binary(),
boolean(),
gleam@dict:dict(binary(), binary())}.
-type generated_file() :: {generated_file, binary(), binary()}.
-type plugin() :: {plugin,
binary(),
fun((nori@codegen@ir:codegen_i_r(), generator_config()) -> {ok,
list(generated_file())} |
{error, binary()})}.
-file("src/nori/codegen/plugin.gleam", 42).
?DOC(" Creates a default GeneratorConfig.\n").
-spec default_config(binary()) -> generator_config().
default_config(Output_dir) ->
{generator_config, Output_dir, true, maps:new()}.