betty.extensions.webpack.build module

Perform Webpack builds.

class betty.extensions.webpack.build.Builder

Bases: object

Build Webpack assets.

__init__(entry_point_providers: Sequence[EntryPointProvider], debug: bool, jinja: Environment, root: str, *, user: User) None
async build(working_directory: Path, *, context: Context) Path

Build the Webpack assets.

Returns:

The path to the directory from which the assets can be copied to their final destination.

class betty.extensions.webpack.build.EntryPointProvider

Bases: Extension

An extension that provides Webpack entry points.

abstractmethod webpack_entry_point_cache_keys() Sequence[str]

Get the keys that make a Webpack build for this provider unique.

Providers that can be cached regardless may return ().

abstractmethod classmethod webpack_entry_point_directory() StrPath

Get the path to the directory with the entry point assets.

The directory must include at least a package.json and main.ts.

betty.extensions.webpack.build.webpack_build_id(entry_point_providers: Sequence[EntryPointProvider], debug: bool) str

Generate the ID for a Webpack build.