Interface: Plugin

August 11, 2026 ยท View on GitHub

@sdeverywhere/build / Plugin

Interface: Plugin

The plugin interface that can be implemented to customize the model generation and build process.

These functions are all optional.

These functions will be called during the build process in the order listed below:

  • init (only called once before initial build steps)
  • preGenerate
    • preProcessMdl
    • postProcessMdl
    • preGenerateCode
    • postGenerateCode
  • postGenerate
  • postBuild
  • watch (only called once after initial build steps when mode==development)

Methods

init()?

optional init(config): Promise<void>

Called after the user configuration has been resolved, but before the model is generated and other build steps.

Parameters

ParameterTypeDescription
configResolvedConfigThe build configuration.

Returns

Promise<void>


preGenerate()?

optional preGenerate(context, modelSpec): Promise<void>

Called before the "generate model" steps are performed.

Parameters

ParameterTypeDescription
contextBuildContextThe build context (for logging, etc).
modelSpecResolvedModelSpecThe spec that controls how the model is generated.

Returns

Promise<void>


preProcessMdl()?

optional preProcessMdl(context): Promise<void>

Called before SDE preprocesses the mdl file (in the case of one mdl file), or before SDE flattens the mdl files (in the case of multiple mdl files).

Parameters

ParameterTypeDescription
contextBuildContextThe build context (for logging, etc).

Returns

Promise<void>


postProcessMdl()?

optional postProcessMdl(context, mdlContent): Promise<string>

Called after SDE preprocesses the mdl file (in the case of one mdl file), or after SDE flattens the mdl files (in the case of multiple mdl files).

Parameters

ParameterTypeDescription
contextBuildContextThe build context (for logging, etc).
mdlContentstringThe resulting mdl file content.

Returns

Promise<string>

The modified mdl file content (if postprocessing was needed).


preGenerateCode()?

optional preGenerateCode(context, format): Promise<void>

Called before SDE generates a JS or C file from the mdl file.

Parameters

ParameterTypeDescription
contextBuildContextThe build context (for logging, etc).
format"js" | "c"The generated code format, either 'js' or 'c'.

Returns

Promise<void>


postGenerateCode()?

optional postGenerateCode(context, format, content): Promise<string>

Called after SDE generates a JS or C file from the mdl file.

Parameters

ParameterTypeDescription
contextBuildContextThe build context (for logging, etc).
format"js" | "c"The generated code format, either 'js' or 'c'.
contentstringThe resulting JS or C file content.

Returns

Promise<string>

The modified JS or C file content (if postprocessing was needed).


postGenerate()?

optional postGenerate(context, modelSpec): Promise<boolean>

Called after the "generate model" process has completed (but before the staged files are copied to their destination).

Parameters

ParameterTypeDescription
contextBuildContextThe build context (for logging, etc).
modelSpecResolvedModelSpecThe spec that controls how the model is generated.

Returns

Promise<boolean>

Whether the plugin succeeded (for example, a plugin that runs tests can return false to indicate that one or more tests failed).


postBuild()?

optional postBuild(context, modelSpec): Promise<boolean>

Called after the model has been generated and after the staged files have been copied to their destination.

Parameters

ParameterTypeDescription
contextBuildContextThe build context (for logging, etc).
modelSpecResolvedModelSpecThe spec that controls how the model is generated.

Returns

Promise<boolean>

Whether the plugin succeeded (for example, a plugin that runs tests can return false to indicate that one or more tests failed).


watch()?

optional watch(config): Promise<void>

Called in development/watch mode after the initial build has completed (i.e., after the model has been generated and after the staged files have been copied to their destination).

Parameters

ParameterTypeDescription
configResolvedConfigThe build configuration.

Returns

Promise<void>