pugjs/pug

Generated `debug_sources` are node `Buffer`s and fail `pug_rethrow`

Open

#3290 opened on Aug 18, 2020

View on GitHub
 (3 comments) (0 reactions) (0 assignees)JavaScript (21,509 stars) (1,955 forks)batch import
Good First Issuebug

Description

Pug Version: your version number here 3.0.0

Node Version: your version number here 14.7.0

When an included file is read, it's Buffer being stored in debug_sources:

https://github.com/pugjs/pug/blob/06baa525a23049756de9587461d389a12bc12537/packages/pug/lib/index.js#L167

Later, this value is passed to the generator and being serialized as-it in the final render function.

https://github.com/pugjs/pug/blob/06baa525a23049756de9587461d389a12bc12537/packages/pug/lib/index.js#L204

Which fails pug_rethrow's expectation, and makes it throw:

https://github.com/pugjs/pug/blob/f97ebdb48c7c0fdd4ff4b7418dcf4e03b27a1405/packages/pug-runtime/index.js#L256

Contributor guide