UNPKG

4.06 kBMarkdownView Raw
1# Changelog
2
3All notable changes to this project will be documented in this file.
4
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6and this project adheres to
7[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
9## [6.0.2](https://github.com/nfriedly/express-rate-limit/releases/v6.0.2)
10
11### Fixed
12
13- Ensure CommonJS projects can import the module.
14
15### Added
16
17- Add additional tests that test:
18 - importing the library in `js-cjs`, `js-esm`, `ts-cjs`, `ts-esm`
19 environments.
20 - usage of the library with external stores (`redis`, `mongo`, `memcached`,
21 `precise`).
22
23### Changed
24
25- Use [`esbuild`](https://esbuild.github.io/) to generate ESM and CJS output.
26 This reduces the size of the built package from 138 kb to 13kb and build time
27 to 4 ms! :rocket:
28- Use [`dts-bundle-generator`](https://github.com/timocov/dts-bundle-generator)
29 to generate a single Typescript declaration file.
30
31## [6.0.1](https://github.com/nfriedly/express-rate-limit/releases/v6.0.1)
32
33### Fixed
34
35- Ensure CommonJS projects can import the module.
36
37## [6.0.0](https://github.com/nfriedly/express-rate-limit/releases/v6.0.0)
38
39### Added
40
41- `express` 4.x as a peer dependency.
42- Better Typescript support (the library was rewritten in Typescript).
43- Export the package as both ESM and CJS.
44- Publish the built package (`.tgz` file) on GitHub releases as well as the npm
45 registry.
46- Issue and PR templates.
47- A contributing guide.
48
49### Changed
50
51- Rename the `draft_polli_ratelimit_headers` option to `standardHeaders`.
52- Rename the `headers` option to `legacyHeaders`.
53- `Retry-After` header is now sent if either `legacyHeaders` or
54 `standardHeaders` is set.
55- Allow `keyGenerator` to be an async function/return a promise.
56- Change the way custom stores are defined.
57 - Add the `init` method for stores to set themselves up using options passed
58 to the middleware.
59 - Rename the `incr` method to `increment`.
60 - Allow the `increment`, `decrement`, `resetKey` and `resetAll` methods to
61 return a promise.
62 - Old stores will automatically be promisified and used.
63- The package can now only be used with NodeJS version 12.9.0 or greater.
64- The `onLimitReached` configuration option is now deprecated. Replace it with a
65 custom `handler` that checks the number of hits.
66
67### Removed
68
69- Remove the deprecated `limiter.resetIp` method (use the `limiter.resetKey`
70 method instead).
71- Remove the deprecated options `delayMs`, `delayAfter` (the delay functionality
72 was moved to the
73 [`express-slow-down`](https://github.com/nfriedly/express-slow-down) package)
74 and `global` (use a key generator that returns a constant value).
75
76## [5.x](https://github.com/nfriedly/express-rate-limit/releases/tag/v5.5.1)
77
78### Added
79
80- The middleware ~throws~ logs an error if `request.ip` is undefined.
81
82### Removed
83
84- Removes typescript typings. (See
85 [#138](https://github.com/nfriedly/express-rate-limit/issues/138))
86
87## [4.x](https://github.com/nfriedly/express-rate-limit/releases/tag/v4.0.4)
88
89### Changed
90
91- The library no longer modifies the passed-in options object, it instead makes
92 a clone of it.
93
94## [3.x](https://github.com/nfriedly/express-rate-limit/releases/tag/v3.5.2)
95
96### Added
97
98- Simplifies the default `handler` function so that it no longer changes the
99 response format. The default handler also uses
100 [response.send](https://expressjs.com/en/4x/api.html#response.send).
101
102### Changes
103
104- `onLimitReached` now only triggers once for a client and window. However, the
105 `handle` method is called for every blocked request.
106
107### Removed
108
109- The `delayAfter` and `delayMs` options; they were moved to the
110 [express-slow-down](https://npmjs.org/package/express-slow-down) package.
111
112## [2.x](https://github.com/nfriedly/express-rate-limit/releases/tag/v2.14.2)
113
114### Added
115
116- A `limiter.resetKey()` method to reset the hit counter for a particular client
117
118### Changes
119
120- The rate limiter now uses a less precise but less resource intensive method of
121 tracking hits from a client.
122
123### Removed
124
125- The `global` option.