rejectedsoftware/diet-ng

Release v1.7.1 broke Vibe.d / Buildkite

Closed this issue · 6 comments

app-skeleton ~master: building configuration "application"...
  | Compiling Diet HTML template error.dt...
  | error.dt(4,31): Error: template instance `to!string` template `to` is not defined
  | ../../../.dub/packages/diet-ng-1.7.1/diet-ng/source/diet/html.d(221,8): Error: template instance `app.showError.exec!(StreamOutputRange!(InterfaceProxy!(OutputStream), 1024LU))` error instantiating
  | ../../http/vibe/http/server.d(345,66):        instantiated from here: `compileHTMLDietFileString!(StreamOutputRange!(InterfaceProxy!(OutputStream), 1024LU))`
  | source/app.d(12,5):        instantiated from here: `render!("error.dt", req, error)`
  | Compiling Diet HTML template about.dt...

Visible in Vibe.d's CI and Buildkite builds.

Hm... how is this diet's fault? The template in question uses std.conv.to without importing? I can only guess that the original compiled from an accidental leakage of imports from the diet module.

It happened in #77, I split the compilation to 2 templates to avoid redundancy, and the std.conv import moved into a different template than the one that mixes in the compiled diet code. The import was only used for generating the hash (which is doubly annoying since it wasn't behind the DietUseCache version)

We can put an import of std.conv: to into the mixin if we want, and probably remove it for 2.0.0, as it's technically a breaking change even though not intentional.

Alternatively, the error.dt template can be altered to import std.conv.

Arguably, the diet template mixin should happen in a completely separate module to avoid accidentally exposing all the namespace of the html module.

New version is now available in the registry.