pugjs / then-pug

**EXPERIMENTAL** Async promise based Jade
42 stars 5 forks source link

Fix regenerator-runtime module #18

Closed paulgrove closed 8 years ago

paulgrove commented 8 years ago

runtime.js was moved into a separate module called regenerator-runtime.

The provided version of regenerator, unfortunately prints a warning about the depreciation when you attempt to use runtime.js, console.log isn't available inside a vm context so the process crashes. If it wasn't inside a vm context then it would have continued to work.

Changing the project to use the regenerator-runtime module solves the problem as the warning is no longer printed.

jeromew commented 8 years ago

Thanks for the PR. I started looking into this. do you need this because you are using then-jade browser side or because you are using a non-harmony version of node ?

paulgrove commented 8 years ago

Yes using an old non-harmony version of node. The module wont run prior to this PR on 0.10.x.

jeromew commented 8 years ago

can i ask you what is your use case / why you are trying to use this module instead of raw jade/pug ?

paulgrove commented 8 years ago

To be honest, we're not using this module, just gave it a try and noticed that it wasn't working on our version of node, and that the fix wasn't that difficult.

After noticing a lot of boilerplate Promise handling code in our express routes I wondered if there was a option to auto resolve Promise used as template values.

The module worked after the changes, but there was a reasonably large performance hit vs raw jade, so the convenience wasn't really worth it.

All the same this PR will let others using 0.10.x use this module. Merge if you like or not.