Additions
- Asynchronous expressions are now supported!
parseAsync
returns an async functionconst expr = jshiki.parseAsync('1 + 2') await expr() // => 3
evaluateAsync
returns a promiseawait jshiki.evaluateAsync('1 + 2') // => 3
await
is supported within async expressionsconst expr = jshiki.parseAsync('await a()') await expr({ a: async () => 1 }) // => 1
Fixes
-
Fixed bug where calling a method on a property using optional chaining syntax would instead operate as though regular member access was used. Example:
// Prior behavior: jshiki.evaluate('a?.b?.()') // throws TypeError jshiki.evaluate('a?.b()') // throws TypeError // Patched behaviour: jshiki.evaluate('a?.b?.()') // returns undefined jshiki.evaluate('a?.b()') // returns undefined
Development changes
- Unit tests are now run before functional tests.
- Updated yarn to 3.0.2