Skip to content

Latest commit

 

History

History
221 lines (151 loc) · 8.24 KB

CHANGELOG.md

File metadata and controls

221 lines (151 loc) · 8.24 KB

Change Log

v3.4.0 (2021-09-10)

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

v3.3.0 (2021-09-08)

Additions

  • typeof, in, and instanceof operators are now supported. They are disabled by default to maintain behaviour with prior versions of jshiki.

Fixes

  • Fixed bug where rules with ** wildcards would be incorrectly evaluated in certain cases.

Documentation

  • Documented that rules do not affect properties of values that are not objects or functions due to limitations of proxies.

Development changes

  • Coverage split between unit and functional tests.
  • Unit tests have 100% coverage.
  • Tests that used snapshots to check errors thrown by Node for property access on null and undefined have been edited to test without using snapshots. This is due to a change in V8 that changes the format of the error message, included in the version of V8 used by Node 16.9.0 and above.
  • Type in SVG assets has been converted to outlines.
  • VS Code configured to use the workspace version of Typescript.

Full Changelog

v3.2.0 (2021-08-29)

Additions

  • Specific operators can now be blocked or allow-listed:
    // throws Error: Binary operator / is not allowed.
    jshiki.parse('a / b', {
      operators: {
        binary: { allow: ['+', '-'] },
      },
    })
  • Specific syntax can now be blocked:
    // throws Error: Function calls are not allowed.
    jshiki.parse('a()', {
      syntax: {
        calls: false,
      },
    })

Documentation

  • Fixed edit links by pointing them to the correct branch.
  • Fixed codecov link in the readme.

Full Changelog

v3.1.0 (2021-08-27)

Additions

  • The following types are now exported in the package entry point:
    • JshikiParseOptions
    • JshikiEvaluateOptions
    • JshikiExpression
    • AccessPath
    • AccessRule
    • AllowAccessRule
    • BlockAccessRule

Development Changes

Full Changelog

v3.0.0 (2021-08-20)

BREAKING CHANGES

  • parse() now returns an expression that expects the scope to be passed as an argument. This allows reusing the same expression in different contexts without having to parse the expression or rules again. For example:
    const expression = jshiki.parse('`Hello ${name}!`')
    const result = expression({ name: 'Azumi' })
    // result => 'Hello Azumi!'
  • ES2020 syntax is now supported, and support for Node 12.x has been dropped.
  • NaN and Infinity identifiers are now supported.
  • Unicode escape sequences \x and \u are now supported.
  • The bundled, custom version of esprima has been entirely removed and replaced with an external dependency on acorn, a fast, lightweight Javascript parser. The corresponding licences for Polymer Expressions and esprima have been removed from the project as the code to which they pertain is no longer part of the project.

Fixes

  • Fixed a bug where holes in sparse arrays were being evaluated as null.
  • Fixed a bug where undefined could evaluate to a value other than undefined if a property named undefined was defined on the scope object.
  • Fixed a bug where calling a function returned by a function would not evaluate and instead return the function.
  • Fixed a bug where computed property accessors were not being evaluated (obj[prop] was being evaluated as obj['prop'] instead of obj[prop]).
  • Fixed a bug where a function member of a scope object that returned this would result in a TypeError being thrown.
  • Fixed a bug where a function member of a scope object could not access properties on this.
  • Fixed a bug where logical operators (&&, ||) would evaluate both operands before evaluating the result.

Development changes

  • Test coverage is now 100%.
  • Node 12.x has been dropped from the test matrix.

Full Changelog

v2.1.0 (2021-08-17)

Additions

  • New options rules and explicitAllow, which facilitate rules-based access control for scope members. Documentation available in the README.
  • Documentation added to API.

Development changes

  • More robust, less hacky evaluation of expressions internally.
  • AST information retained on expressions.

Full Changelog

v2.0.0 (2021-08-12)

BREAKING CHANGES

  • parse() now returns the expression function instead of an object
  • Polymer Expressions holdovers (filters, as/in expressions) removed
  • Errors thrown when parsing invalid expressions are now thrown when parsing instead of during evaluation

Additions

  • evaluate(), which executes an expression immediately, added to API

Fixes

  • Tests for the << bitwise left shift and >> bitwise right shift operators fixed; prior, the tests mistakenly used < and > instead of << and >>

Development changes

Full Changelog

v1.1.1 (2021-05-19)

Full Changelog

v1.1.0 (2017-07-03)

Full Changelog

Implemented enhancements:

  • Added exponential and bitwise operators. #1 (emorris00)

v1.0.0 (2017-06-29)

Full Changelog

v0.0.3 (2015-09-14)

Full Changelog

v0.0.2 (2015-09-07)

Full Changelog

v0.0.1 (2015-09-07)