Extension points

Add a provider (Wire)

  1. Write the constructor in its package, returning a concrete *T.
  2. Add it to wireSet in cmd/pdf-server/wire_bindings.go.
  3. If it is consumed through an interface, add wire.Bind(new(Iface), new(*T)).
  4. If it needs a GlobalConfig field, add it to a wire.FieldsOf list or add a sub-config with Default*/BindFlags.
  5. Regenerate: make .gen (or delete wire_gen.go and make 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 to DefaultOrderedTemplateLoaders (mind ordering; return “not found” to defer to later loaders). See raw.go / remote.
  • Store-dependent loader (like compositions): implement templates.TemplateLoaderBuilder and add it to DefaultOrderedTemplateLoaderBuilders.
  • 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 through NewFileTemplateLoader.

Add a factory mode / wait event

  • New browser factory mode: add a FactoryType constant, a page-wrapper factory, and a case in NewFactory (cdp/factory.go).
  • New out-of-band wait signal: add a branch in initEventWaiter (cdp/render.go), like the callback path.

Regenerate artifacts

  • Wire: make .gen after changing providers/bindings.
  • Mocks: make mocks after changing any interface (mockery mirrors app/ into mocks/; tests import from there).