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