Skip to content

Releases: MatAtBread/nodent

Fix multiple initializers in for-loops

25 Oct 10:53
Compare
Choose a tag to compare

Fix mangling of multiple for initializers which transformed them as destructured declarations. Thanks to @STRML for finding this case.

Closes #67

Engine mode fixes, optimize for-loop footprint

23 Oct 11:57
Compare
Choose a tag to compare
  • 'engine' mode: fix case where async class method contains a callback containing a reference to super
  • 'engine' mode: fix case where finally contains an exit (does not need transformation)
  • Return undefined from top-level trampoline to avoid long Promise chains
  • Run tests against nodejs 7 nightly and Chrome Canary to ensure engine-mode compliance

Fix CLI with multiple files

15 Oct 13:28
Compare
Choose a tag to compare

v3.0.3

  • Fix issue when handling multiple files on the command line, and "use" option is missing

v3.0.2

  • Move runtime into a separate package
  • Remove private members from AST nodes before returning from asynchronize()

Fixes also released as v2.6.14

v3 - "noRuntime", loops by trampoline, Promise/A+ compliance

07 Oct 21:44
Compare
Choose a tag to compare

v3.0.0

Nodent v3 is a significant update. If your project isn't using any internal functions or monkey patching, you should just be able to upgrade by changing your package.json - with very few exceptions the external API and features are the same. Major changes are:

Loops

The use of Promises/A+ compliant execution means the recursive loop asynchronisation used in Nodent v2 can be unwound. Specifically, for, while and do...while loops in Nodent v2 were recursive if the loop didn't yield control to an async operation. This meant that you could run out of stack on relatively trivial loop.

Nodent v3 doesn't use recursion (it uses a trampoline), but in doing so it requires Promise chaining, which was not supported by nodent Thenables.

Nodent will still generate potentially recursive loops if you specify use nodent-es7 {"lazyThenables":true} since the basic lazy Thenable (while small and very fast) doesn't support chaining.

"noRuntime"

The new code-generation option noRuntime will generate pure-ES5 code if you are using -promises, and pure-ES7 if you are using -engine. Other modes (-es7, -generators) still require a small runtime.

Promises

Promises are now the default execution mode. Only -es7 with lazyThenables uses the synchronous Thenable protocol. This is only retained for speed in exceptional cases. In almost all practical applications (i.e. using async functions to handle IO of some sort), the overhead is around 20% per call, meaning it is trivial compared to the IO operation. Nodent syntax-transformation remains around 3-4 times faster than both native generators and libraries like regenerator.

The Promise implementation used by Nodent by default is based on the most excellent Zousan Promise library. After a lot of looking around and testing, Zousan proved to be one of the smallest and fastest around - small enough to fit into Nodent's runtime and faster in most practical cases than Bluebird and when. The speed is enhanced compared to most libraries as Nodent rarely generates code that relies on Promise chaining or having multiple .then() calls on the same Promise (v2 never did this, v3 does). Zousan is optimal in these cases as only creates the required data lazily.

2.6.12

07 Oct 19:24
Compare
Choose a tag to compare
Bump acorn-es7-plugin

Fixes to finally{}, nested loops w/scope, parsing of 'async get(){...}'

06 Oct 16:19
Compare
Choose a tag to compare
  • Bump acorn-es7-plugin to resolve issues with 'async get(){}'
  • Merge in fixes related to some loop constructs and use of 'finally{ return...}' in synchronous code called by async code

for (let/const....) scope fixes

28 Sep 15:59
Compare
Choose a tag to compare
  • Fix issue with scoping on let/const declarations in for-loop initializers
  • Maintain location information when replacing/appending nodes
  • Add tests for dual-loop-scope and dual-while-throw

Fixes MatAtBread/fast-async#13
Thanks to @Rush for finding this case

Minor arrow function fixes

25 Sep 14:45
Compare
Choose a tag to compare
  • Update acorn-es7-plugin to handle async(()=>0) as a call and async()=>0 as an async arrow function.
  • Fix case where generator mode generated an illegal anonymous FunctionDefintion from an ArrowFunctionExpression that was never in an expression

Fix `for(;;){...}`

18 Sep 21:21
Compare
Choose a tag to compare

Avoid NPE when no condition is supplied to the loop.

Export declaration/Babel fix

18 Sep 17:28
Compare
Choose a tag to compare

Don't attempt to hoist exported named declarations
Correctly identify Babel types Object/ClassMethod as scopes to avoid illegal mappings

Thanks to @dessaya for finding this case
Fixes MatAtBread/fast-async#12