You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.4 KiB

4 years ago
  1. ### Version 4.0.0 (2018-01-28) ###
  2. - Added: Support for ES2018. The only change needed was recognizing the `s`
  3. regex flag.
  4. - Changed: _All_ tokens returned by the `matchToToken` function now have a
  5. `closed` property. It is set to `undefined` for the tokens where “closed”
  6. doesn’t make sense. This means that all tokens objects have the same shape,
  7. which might improve performance.
  8. These are the breaking changes:
  9. - `'/a/s'.match(jsTokens)` no longer returns `['/', 'a', '/', 's']`, but
  10. `['/a/s']`. (There are of course other variations of this.)
  11. - Code that rely on some token objects not having the `closed` property could
  12. now behave differently.
  13. ### Version 3.0.2 (2017-06-28) ###
  14. - No code changes. Just updates to the readme.
  15. ### Version 3.0.1 (2017-01-30) ###
  16. - Fixed: ES2015 unicode escapes with more than 6 hex digits are now matched
  17. correctly.
  18. ### Version 3.0.0 (2017-01-11) ###
  19. This release contains one breaking change, that should [improve performance in
  20. V8][v8-perf]:
  21. > So how can you, as a JavaScript developer, ensure that your RegExps are fast?
  22. > If you are not interested in hooking into RegExp internals, make sure that
  23. > neither the RegExp instance, nor its prototype is modified in order to get the
  24. > best performance:
  25. >
  26. > ```js
  27. > var re = /./g;
  28. > re.exec(''); // Fast path.
  29. > re.new_property = 'slow';
  30. > ```
  31. This module used to export a single regex, with `.matchToToken` bolted
  32. on, just like in the above example. This release changes the exports of
  33. the module to avoid this issue.
  34. Before:
  35. ```js
  36. import jsTokens from "js-tokens"
  37. // or:
  38. var jsTokens = require("js-tokens")
  39. var matchToToken = jsTokens.matchToToken
  40. ```
  41. After:
  42. ```js
  43. import jsTokens, {matchToToken} from "js-tokens"
  44. // or:
  45. var jsTokens = require("js-tokens").default
  46. var matchToToken = require("js-tokens").matchToToken
  47. ```
  48. [v8-perf]: http://v8project.blogspot.se/2017/01/speeding-up-v8-regular-expressions.html
  49. ### Version 2.0.0 (2016-06-19) ###
  50. - Added: Support for ES2016. In other words, support for the `**` exponentiation
  51. operator.
  52. These are the breaking changes:
  53. - `'**'.match(jsTokens)` no longer returns `['*', '*']`, but `['**']`.
  54. - `'**='.match(jsTokens)` no longer returns `['*', '*=']`, but `['**=']`.
  55. ### Version 1.0.3 (2016-03-27) ###
  56. - Improved: Made the regex ever so slightly smaller.
  57. - Updated: The readme.
  58. ### Version 1.0.2 (2015-10-18) ###
  59. - Improved: Limited npm package contents for a smaller download. Thanks to
  60. @zertosh!
  61. ### Version 1.0.1 (2015-06-20) ###
  62. - Fixed: Declared an undeclared variable.
  63. ### Version 1.0.0 (2015-02-26) ###
  64. - Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That
  65. type is now equivalent to the Punctuator token in the ECMAScript
  66. specification. (Backwards-incompatible change.)
  67. - Fixed: A `-` followed by a number is now correctly matched as a punctuator
  68. followed by a number. It used to be matched as just a number, but there is no
  69. such thing as negative number literals. (Possibly backwards-incompatible
  70. change.)
  71. ### Version 0.4.1 (2015-02-21) ###
  72. - Added: Support for the regex `u` flag.
  73. ### Version 0.4.0 (2015-02-21) ###
  74. - Improved: `jsTokens.matchToToken` performance.
  75. - Added: Support for octal and binary number literals.
  76. - Added: Support for template strings.
  77. ### Version 0.3.1 (2015-01-06) ###
  78. - Fixed: Support for unicode spaces. They used to be allowed in names (which is
  79. very confusing), and some unicode newlines were wrongly allowed in strings and
  80. regexes.
  81. ### Version 0.3.0 (2014-12-19) ###
  82. - Changed: The `jsTokens.names` array has been replaced with the
  83. `jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no
  84. longer part of the public API; instead use said function. See this [gist] for
  85. an example. (Backwards-incompatible change.)
  86. - Changed: The empty string is now considered an “invalid” token, instead an
  87. “empty” token (its own group). (Backwards-incompatible change.)
  88. - Removed: component support. (Backwards-incompatible change.)
  89. [gist]: https://gist.github.com/lydell/be49dbf80c382c473004
  90. ### Version 0.2.0 (2014-06-19) ###
  91. - Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own
  92. category (“functionArrow”), for simplicity. (Backwards-incompatible change.)
  93. - Added: ES6 splats (`...`) are now matched as an operator (instead of three
  94. punctuations). (Backwards-incompatible change.)
  95. ### Version 0.1.0 (2014-03-08) ###
  96. - Initial release.