express-rate-limit 6.0.5 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -6,6 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [6.1.0](https://github.com/nfriedly/express-rate-limit/releases/tag/v6.1.0)
10
+
11
+ ### Added
12
+
13
+ - Added a named export `rateLimit` in case the default import does not work.
14
+
15
+ ### Fixed
16
+
17
+ - Added a named export `default`, so Typescript CommonJS developers can
18
+ default-import the library (`import rateLimit from 'express-rate-limit'`).
19
+
9
20
  ## [6.0.5](https://github.com/nfriedly/express-rate-limit/releases/tag/v6.0.5)
10
21
 
11
22
  ### Fixed
package/dist/index.cjs CHANGED
@@ -24,7 +24,8 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
24
  // source/index.ts
25
25
  var source_exports = {};
26
26
  __export(source_exports, {
27
- default: () => source_default
27
+ default: () => lib_default,
28
+ rateLimit: () => lib_default
28
29
  });
29
30
 
30
31
  // source/memory-store.ts
@@ -219,8 +220,5 @@ var rateLimit = (passedOptions) => {
219
220
  return middleware;
220
221
  };
221
222
  var lib_default = rateLimit;
222
-
223
- // source/index.ts
224
- var source_default = lib_default;
225
223
  module.exports = __toCommonJS(source_exports);
226
- module.exports = rateLimit;
224
+ module.exports = rateLimit; module.exports.default = rateLimit; module.exports.rateLimit = rateLimit;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Generated by dts-bundle-generator v6.3.0
1
+ // Generated by dts-bundle-generator v6.4.0
2
2
 
3
3
  import { NextFunction, Request, RequestHandler, Response } from 'express';
4
4
 
@@ -240,9 +240,22 @@ export interface RateLimitInfo {
240
240
  readonly remaining: number;
241
241
  readonly resetTime: Date | undefined;
242
242
  }
243
- declare const rateLimit: (passedOptions?: (Omit<Partial<Options>, "store"> & {
243
+ /**
244
+ *
245
+ * Create an instance of IP rate-limiting middleware for Express.
246
+ *
247
+ * @param passedOptions {Options} - Options to configure the rate limiter
248
+ *
249
+ * @returns {RateLimitRequestHandler} - The middleware that rate-limits clients based on your configuration
250
+ *
251
+ * @public
252
+ */
253
+ export declare const rateLimit: (passedOptions?: (Omit<Partial<Options>, "store"> & {
244
254
  store?: LegacyStore | Store | undefined;
245
255
  }) | undefined) => RateLimitRequestHandler;
246
- export default rateLimit;
256
+
257
+ export {
258
+ rateLimit as default,
259
+ };
247
260
 
248
261
  export {};
package/dist/index.mjs CHANGED
@@ -190,9 +190,7 @@ var rateLimit = (passedOptions) => {
190
190
  return middleware;
191
191
  };
192
192
  var lib_default = rateLimit;
193
-
194
- // source/index.ts
195
- var source_default = lib_default;
196
193
  export {
197
- source_default as default
194
+ lib_default as default,
195
+ lib_default as rateLimit
198
196
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-rate-limit",
3
- "version": "6.0.5",
3
+ "version": "6.1.0",
4
4
  "description": "Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.",
5
5
  "author": {
6
6
  "name": "Nathan Friedly",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "scripts": {
52
52
  "clean": "del-cli dist/ coverage/ *.log *.tmp *.bak *.tgz",
53
- "build:cjs": "esbuild --bundle --format=cjs --outfile=dist/index.cjs --footer:js=\"module.exports = rateLimit;\" source/index.ts",
53
+ "build:cjs": "esbuild --bundle --format=cjs --outfile=dist/index.cjs --footer:js=\"module.exports = rateLimit; module.exports.default = rateLimit; module.exports.rateLimit = rateLimit;\" source/index.ts",
54
54
  "build:esm": "esbuild --bundle --format=esm --outfile=dist/index.mjs source/index.ts",
55
55
  "build:types": "dts-bundle-generator --out-file=dist/index.d.ts source/index.ts",
56
56
  "compile": "run-s clean build:*",
@@ -61,7 +61,7 @@
61
61
  "autofix:rest": "prettier --ignore-path .gitignore --ignore-unknown --write .",
62
62
  "autofix": "run-s autofix:*",
63
63
  "test:lib": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
64
- "test:ext": "npm pack && cd test/external/ && bash run-all-tests",
64
+ "test:ext": "cd test/external/ && bash run-all-tests",
65
65
  "test": "run-s lint test:*",
66
66
  "pre-commit": "lint-staged",
67
67
  "prepare": "run-s compile && husky install config/husky"
@@ -73,18 +73,18 @@
73
73
  "@jest/globals": "^27.4.6",
74
74
  "@types/express": "^4.17.13",
75
75
  "@types/jest": "^27.4.0",
76
- "@types/node": "^16.11.17",
76
+ "@types/node": "^16.11.19",
77
77
  "@types/supertest": "^2.0.11",
78
78
  "cross-env": "^7.0.3",
79
79
  "del-cli": "^4.0.1",
80
- "dts-bundle-generator": "^6.3.0",
81
- "esbuild": "^0.14.10",
80
+ "dts-bundle-generator": "^6.4.0",
81
+ "esbuild": "^0.14.11",
82
82
  "express": "^4.17.1",
83
83
  "husky": "^7.0.4",
84
84
  "jest": "^27.4.7",
85
- "lint-staged": "^12.1.5",
85
+ "lint-staged": "^12.1.7",
86
86
  "npm-run-all": "^4.1.5",
87
- "supertest": "^6.1.6",
87
+ "supertest": "^6.2.1",
88
88
  "ts-jest": "^27.1.1",
89
89
  "ts-node": "^10.4.0",
90
90
  "typescript": "^4.5.2",