Skip to content

v3.4.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 10 Sep 20:16
· 126 commits to main since this release
8ea130c

Additions

  • Asynchronous expressions are now supported!
    • parseAsync returns an async function
      const expr = jshiki.parseAsync('1 + 2')
      await expr() // => 3
    • evaluateAsync returns a promise
      await jshiki.evaluateAsync('1 + 2') // => 3
    • await is supported within async expressions
      const 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

Full Changelog