@poppinss/utils 3.3.0 → 4.0.2

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.
@@ -7,12 +7,9 @@
7
7
  * For the full copyright and license information, please view the LICENSE
8
8
  * file that was distributed with this source code.
9
9
  */
10
- var __importDefault = (this && this.__importDefault) || function (mod) {
11
- return (mod && mod.__esModule) ? mod : { "default": mod };
12
- };
13
10
  Object.defineProperty(exports, "__esModule", { value: true });
14
11
  exports.safeEqual = void 0;
15
- const buffer_alloc_1 = __importDefault(require("buffer-alloc"));
12
+ const buffer_1 = require("buffer");
16
13
  const crypto_1 = require("crypto");
17
14
  /**
18
15
  * Generates a random string for a given size
@@ -23,23 +20,23 @@ function safeEqual(value, comparisonValue) {
23
20
  * The length of the main value to ensure that we compare equal strings
24
21
  * against each other to get a constant time.
25
22
  */
26
- const expectedLength = Buffer.byteLength(value);
23
+ const expectedLength = buffer_1.Buffer.byteLength(value);
27
24
  /**
28
25
  * Value A
29
26
  */
30
- const valueBuffer = (0, buffer_alloc_1.default)(expectedLength, 0, 'utf-8');
27
+ const valueBuffer = buffer_1.Buffer.alloc(expectedLength, 0, 'utf-8');
31
28
  valueBuffer.write(value);
32
29
  /**
33
30
  * Value B
34
31
  */
35
- const comparisonValueBuffer = (0, buffer_alloc_1.default)(expectedLength, 0, 'utf-8');
32
+ const comparisonValueBuffer = buffer_1.Buffer.alloc(expectedLength, 0, 'utf-8');
36
33
  comparisonValueBuffer.write(comparisonValue);
37
34
  /**
38
35
  * Ensure values are same and also have same length
39
36
  */
40
37
  return ((0, crypto_1.timingSafeEqual)(valueBuffer, comparisonValueBuffer) &&
41
- expectedLength === Buffer.byteLength(comparisonValue));
38
+ expectedLength === buffer_1.Buffer.byteLength(comparisonValue));
42
39
  }
43
- return (0, crypto_1.timingSafeEqual)(Buffer.from(value), Buffer.from(comparisonValue));
40
+ return (0, crypto_1.timingSafeEqual)(buffer_1.Buffer.from(value), buffer_1.Buffer.from(comparisonValue));
44
41
  }
45
42
  exports.safeEqual = safeEqual;
@@ -1,8 +1,9 @@
1
1
  declare type Constructor = new (...args: any[]) => any;
2
+ declare type AbstractConstructor = abstract new (...args: any[]) => any;
2
3
  /**
3
4
  * Define static properties on a class with inheritance in play.
4
5
  */
5
- export declare function defineStaticProperty<T extends Constructor, Prop extends keyof T>(self: T, BaseClass: Constructor, { propertyName, defaultValue, strategy, }: {
6
+ export declare function defineStaticProperty<T extends Constructor | AbstractConstructor, Prop extends keyof T>(self: T, BaseClass: Constructor | AbstractConstructor, { propertyName, defaultValue, strategy, }: {
6
7
  propertyName: Prop;
7
8
  defaultValue: T[Prop];
8
9
  strategy: 'inherit' | 'define' | ((value: T[Prop]) => T[Prop]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poppinss/utils",
3
- "version": "3.3.0",
3
+ "version": "4.0.2",
4
4
  "description": "Handy utilities for repetitive work",
5
5
  "main": "build/index.js",
6
6
  "files": [
@@ -14,12 +14,12 @@
14
14
  "scripts": {
15
15
  "mrm": "mrm --preset=@adonisjs/mrm-preset",
16
16
  "pretest": "npm run lint",
17
- "test": "node japaFile.js",
17
+ "test": "node .bin/test.js",
18
18
  "clean": "del build",
19
19
  "compile": "npm run lint && npm run clean && tsc",
20
20
  "build": "npm run compile",
21
21
  "commit": "git-cz",
22
- "release": "np",
22
+ "release": "np --message=\"chore(release): %s\"",
23
23
  "version": "npm run build",
24
24
  "format": "prettier --write .",
25
25
  "prepublishOnly": "npm run build",
@@ -32,28 +32,28 @@
32
32
  "author": "virk,poppinss",
33
33
  "license": "MIT",
34
34
  "devDependencies": {
35
- "@adonisjs/mrm-preset": "^4.1.2",
36
- "@adonisjs/require-ts": "^2.0.8",
37
- "@poppinss/dev-utils": "^1.1.5",
35
+ "@adonisjs/mrm-preset": "^5.0.2",
36
+ "@adonisjs/require-ts": "^2.0.10",
37
+ "@poppinss/dev-utils": "^2.0.1",
38
38
  "@types/fs-readdir-recursive": "^1.0.0",
39
- "@types/lodash": "^4.14.175",
39
+ "@types/lodash": "^4.14.178",
40
40
  "@types/ms": "^0.7.31",
41
- "@types/node": "^16.10.2",
41
+ "@types/node": "^17.0.19",
42
42
  "@types/pluralize": "0.0.29",
43
43
  "@types/require-all": "^3.0.3",
44
44
  "del-cli": "^4.0.1",
45
- "doctoc": "^2.0.1",
46
- "eslint": "^7.32.0",
47
- "eslint-config-prettier": "^8.3.0",
48
- "eslint-plugin-adonis": "^1.3.3",
45
+ "doctoc": "^2.1.0",
46
+ "eslint": "^8.9.0",
47
+ "eslint-config-prettier": "^8.4.0",
48
+ "eslint-plugin-adonis": "^2.1.0",
49
49
  "eslint-plugin-prettier": "^4.0.0",
50
50
  "github-label-sync": "^2.0.2",
51
- "husky": "^7.0.2",
52
- "japa": "^3.1.1",
53
- "mrm": "^3.0.9",
54
- "np": "^7.5.0",
55
- "prettier": "^2.4.1",
56
- "typescript": "^4.4.3"
51
+ "husky": "^7.0.4",
52
+ "japa": "^4.0.0",
53
+ "mrm": "^3.0.10",
54
+ "np": "^7.6.0",
55
+ "prettier": "^2.5.1",
56
+ "typescript": "^4.5.5"
57
57
  },
58
58
  "nyc": {
59
59
  "exclude": [
@@ -75,8 +75,7 @@
75
75
  "dependencies": {
76
76
  "@types/bytes": "^3.1.1",
77
77
  "@types/he": "^1.1.2",
78
- "buffer-alloc": "^1.2.0",
79
- "bytes": "^3.1.0",
78
+ "bytes": "^3.1.2",
80
79
  "change-case": "^4.1.2",
81
80
  "cuid": "^2.1.8",
82
81
  "flattie": "^1.1.0",
@@ -88,7 +87,7 @@
88
87
  "pluralize": "^8.0.0",
89
88
  "require-all": "^3.0.0",
90
89
  "resolve-from": "^5.0.0",
91
- "slugify": "^1.6.1",
90
+ "slugify": "^1.6.5",
92
91
  "truncatise": "0.0.8"
93
92
  },
94
93
  "directories": {
@@ -102,5 +101,50 @@
102
101
  "bugs": {
103
102
  "url": "https://github.com/poppinss/utils/issues"
104
103
  },
105
- "homepage": "https://github.com/poppinss/utils#readme"
104
+ "homepage": "https://github.com/poppinss/utils#readme",
105
+ "eslintConfig": {
106
+ "extends": [
107
+ "plugin:adonis/typescriptPackage",
108
+ "prettier",
109
+ "prettier"
110
+ ],
111
+ "plugins": [
112
+ "prettier",
113
+ "prettier"
114
+ ],
115
+ "rules": {
116
+ "prettier/prettier": [
117
+ "error",
118
+ {
119
+ "endOfLine": "auto"
120
+ }
121
+ ]
122
+ }
123
+ },
124
+ "eslintIgnore": [
125
+ "build"
126
+ ],
127
+ "prettier": {
128
+ "trailingComma": "es5",
129
+ "semi": false,
130
+ "singleQuote": true,
131
+ "useTabs": false,
132
+ "quoteProps": "consistent",
133
+ "bracketSpacing": true,
134
+ "arrowParens": "always",
135
+ "printWidth": 100
136
+ },
137
+ "mrmConfig": {
138
+ "core": false,
139
+ "license": "MIT",
140
+ "services": [
141
+ "github-actions"
142
+ ],
143
+ "minNodeVersion": "16.13.1",
144
+ "probotApps": [
145
+ "stale",
146
+ "lock"
147
+ ],
148
+ "runGhActionsOnWindows": true
149
+ }
106
150
  }