get-random-values 2.0.0 → 3.0.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 ADDED
@@ -0,0 +1,42 @@
1
+ ## [3.0.0](https://github.com/kenany/get-random-values/compare/2.1.0...3.0.0) (2023-09-21)
2
+
3
+
4
+ ### ⚠ BREAKING CHANGES
5
+
6
+ * Node.js v14 and v16 are no longer supported.
7
+
8
+ ### Features
9
+
10
+ * drop Node.js v14 and v16 ([329c91b](https://github.com/kenany/get-random-values/commit/329c91b1a7b3b2e937545bf0a9c37d7df6b4f3e7))
11
+
12
+ ## [2.1.0](https://github.com/KenanY/get-random-values/compare/2.0.0...2.1.0) (2023-03-26)
13
+
14
+
15
+ ### Features
16
+
17
+ * add TypeScript declarations ([9a7f39f](https://github.com/KenanY/get-random-values/commit/9a7f39fbfca6b94699024619eccebeba83babc07))
18
+
19
+ ## [2.0.0](https://github.com/KenanY/get-random-values/compare/1.2.2...2.0.0) (2022-06-25)
20
+
21
+
22
+ ### ⚠ BREAKING CHANGES
23
+
24
+ * Node.js v10 and v12 are no longer supported.
25
+
26
+ ### Features
27
+
28
+ * drop Node.js v10 and v12 support ([1e727b9](https://github.com/KenanY/get-random-values/commit/1e727b95bc162a7afbb6608687950101fae573ab))
29
+
30
+ ### [1.2.2](https://github.com/KenanY/get-random-values/compare/1.2.1...1.2.2) (2020-08-25)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * update copyright year to 2020 ([4761fef](https://github.com/KenanY/get-random-values/commit/4761fef0e5513b84f0ab340d22ef31d97e50ab4c))
36
+
37
+ ### [1.2.1](https://github.com/KenanY/get-random-values/compare/1.2.0...1.2.1) (2020-08-25)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * **deps:** global@4.4.0 ([18f7674](https://github.com/KenanY/get-random-values/commit/18f7674e87441f5d682b27390e992e18215456ab))
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2014–2022 Kenan Yildirim <https://kenany.me/>
1
+ Copyright 2014–2023 Kenan Yildirim <https://kenany.me/>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
package/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export = getRandomValues;
2
+ /**
3
+ * @template {ArrayBufferView | null} T
4
+ * @param {T} buf
5
+ * @returns {T}
6
+ */
7
+ declare function getRandomValues<T extends ArrayBufferView | null>(buf: T): T;
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
- /** @type {Window} */
1
+ /* eslint-disable no-var, operator-linebreak */
2
+
2
3
  var window = require('global/window');
3
4
  var nodeCrypto = require('crypto');
4
5
 
@@ -20,6 +21,7 @@ function getRandomValues(buf) {
20
21
  }
21
22
  if (buf.length > 65536) {
22
23
  var e = new Error();
24
+ // @ts-expect-error
23
25
  e.code = 22;
24
26
  e.message = 'Failed to execute \'getRandomValues\' on \'Crypto\': The ' +
25
27
  'ArrayBufferView\'s byte length (' + buf.length + ') exceeds the ' +
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "get-random-values",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "`window.crypto.getRandomValues` with fallback to Node.js crypto",
5
5
  "keywords": [
6
6
  "crypto"
7
7
  ],
8
- "repository": "KenanY/get-random-values",
8
+ "repository": "github:kenany/get-random-values",
9
9
  "license": "MIT",
10
10
  "author": "Kenan Yildirim <kenan@kenany.me> (https://kenany.me/)",
11
11
  "main": "index.js",
12
+ "types": "index.d.ts",
12
13
  "files": [
14
+ "CHANGELOG.md",
15
+ "index.d.ts",
13
16
  "index.js",
14
17
  "LICENSE.txt"
15
18
  ],
@@ -17,24 +20,39 @@
17
20
  "test": "test"
18
21
  },
19
22
  "engines": {
20
- "node": "14 || 16 || >=18"
23
+ "node": "18 || >=20"
21
24
  },
22
25
  "scripts": {
26
+ "clean": "rimraf --glob test/**/*.d.ts *.d.ts",
27
+ "lint": "eslint .",
23
28
  "release": "semantic-release",
24
- "test": "tape test/*.js"
29
+ "type-coverage": "type-coverage --at-least 100 --detail --strict",
30
+ "prebuild": "npm run clean",
31
+ "build": "tsc",
32
+ "pretest": "npm run build",
33
+ "test": "tape test/*.js",
34
+ "posttest": "npm run lint && npm run type-coverage",
35
+ "prepack": "npm run build"
25
36
  },
26
37
  "dependencies": {
27
38
  "global": "^4.4.0"
28
39
  },
29
40
  "devDependencies": {
30
- "@semantic-release/changelog": "6.0.1",
31
- "@semantic-release/git": "10.0.1",
32
- "conventional-changelog-conventionalcommits": "^5.0.0",
33
- "is-browser": "2.1.0",
34
- "lodash.foreach": "4.5.0",
35
- "lodash.isfunction": "3.0.9",
36
- "semantic-release": "^19.0.3",
37
- "tape": "5.5.3"
41
+ "@kenan/eslint-config": "^11.0.1",
42
+ "@semantic-release/changelog": "^6.0.3",
43
+ "@semantic-release/git": "^10.0.1",
44
+ "@tsconfig/node18": "^18.2.2",
45
+ "@types/lodash.isfunction": "^3.0.7",
46
+ "@types/tape": "^5.6.1",
47
+ "conventional-changelog-conventionalcommits": "^7.0.2",
48
+ "eslint": "^8.49.0",
49
+ "is-browser": "^2.1.0",
50
+ "lodash.isfunction": "^3.0.9",
51
+ "rimraf": "^5.0.1",
52
+ "semantic-release": "^22.0.1",
53
+ "tape": "^5.6.6",
54
+ "type-coverage": "^2.26.3",
55
+ "typescript": "^5.2.2"
38
56
  },
39
57
  "browser": {
40
58
  "crypto": false