Extension points
Add a provider (Wire)
- Write the constructor in its package, returning a concrete
*T. - Add it to
wireSetincmd/pdf-server/wire_bindings.go. - If it is consumed through an interface, add
wire.Bind(new(Iface), new(*T)). - If it needs a
GlobalConfigfield, add it to awire.FieldsOflist or add a sub-config withDefault*/BindFlags. - Regenerate:
make .gen(or deletewire_gen.goandmake build). Both injectors share the set, so add once.
Add a template engine
Implement fileloader.TemplateInstanceLoader (LoadTemplateInstance, TemplateType, TemplateName) plus an HTMLTemplate with Render(data). Return a “file not found” error when your extension is absent so the dispatcher falls through. Register it at the desired priority in DefaultFileTemplateInstanceLoader (instance_loader.go). No Wire change needed.
Add a helper
Add the function to the engine’s helper map — Handlebars registerHelpers (handlebars.go) and/or the Go-template helper map (go_template.go). Cross-cutting helpers live in fileloader/helpers/. Helpers that need assets use the per-instance NewEmbedHelpers(assets) pattern.
Add a loader
- New top-level template source: implement
templates.TemplateLoader, add a Wire constructor, and add it toDefaultOrderedTemplateLoaders(mind ordering; return “not found” to defer to later loaders). Seeraw.go/remote. - Store-dependent loader (like compositions): implement
templates.TemplateLoaderBuilderand add it toDefaultOrderedTemplateLoaderBuilders. - New composition planner: implement
composition.CompositePlanner+ its loader, and add it to the planner list in the composition loader builder. - New sibling loader (schema/params/assets analogue): implement the interface in
app/templates/loaders.go/fileloader/html_loader.go, wire it, and thread it throughNewFileTemplateLoader.
Add a factory mode / wait event
- New browser factory mode: add a
FactoryTypeconstant, a page-wrapper factory, and acaseinNewFactory(cdp/factory.go). - New out-of-band wait signal: add a branch in
initEventWaiter(cdp/render.go), like thecallbackpath.
Regenerate artifacts
- Wire:
make .genafter changing providers/bindings. - Mocks:
make mocksafter changing any interface (mockery mirrorsapp/intomocks/; tests import from there).