Zearin / eleventy-plugin-pug

Pug templates for Eleventy 3! (PRE-ALPHA; NOT READY FOR USE)
MIT License
3 stars 1 forks source link

Possible bug in `CustomEngine` with `this.entry` #1

Closed Zearin closed 6 months ago

Zearin commented 6 months ago

The basic minimal test case is not working. :-(

As best as I can figure…

Inside Eleventy’s CustomEngine class, when it comes time to compile, this.entry exists but this.entry.compile is undefined.

A similar (but not identical) issue occured before the launch of Eleventy 2; see: https://github.com/11ty/eleventy/pull/2358

CC: @zachleat

zachleat commented 6 months ago

ah, sorry—I’m a bit confused by this piece: https://github.com/Zearin/eleventy-plugin-pug/blob/230fa890f35f26eddddb7c9ebc87f7745aa71d21/index.js#L27

(not saying this is bad code, just that I’m not confident it’s supported)

In the custom type here, it expects an object literal, not a new class instance: https://www.11ty.dev/docs/languages/custom/

Zearin commented 6 months ago

Whoopsie daisy! 🤦

Q: Is there a way to check whether a class instance is passed into addExtension()?

If so, Eleventy could throw an error at that earlier stage, to let future plugin authors know they are barking up the wrong tree :D