@chainsafe/lodestar 1.15.0 → 1.15.1-rc.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/.git-data.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "branch": "HEAD",
3
- "commit": "5d93a629c0fd1fdd32160cbf7717e7a6b22f7f2d"
3
+ "commit": "6981e0f787c710279fd4d88f57ba05d94e3d9c0e"
4
4
  }
@@ -1,7 +1,3 @@
1
- export type Lockfile = {
2
- lockSync(path: string): void;
3
- unlockSync(path: string): void;
4
- };
5
1
  /**
6
2
  * Creates a .lock file for `filepath`, argument passed must not be the lock path
7
3
  * @param filepath File to lock, i.e. `keystore_0001.json`
@@ -12,4 +8,7 @@ export declare function lockFilepath(filepath: string): void;
12
8
  * @param filepath File to unlock, i.e. `keystore_0001.json`
13
9
  */
14
10
  export declare function unlockFilepath(filepath: string): void;
11
+ export type LockfileError = Error & {
12
+ code: "ELOCKED" | "ENOTACQUIRED";
13
+ };
15
14
  //# sourceMappingURL=lockfile.d.ts.map
@@ -1,29 +1,42 @@
1
- const lockFile = (await import("lockfile"));
2
- function getLockFilepath(filepath) {
3
- return `${filepath}.lock`;
4
- }
5
- /**
6
- * When lockfile is imported, it registers listeners to process
7
- * Since it's only used by the validator client, require lazily to not pollute
8
- * beacon_node client context
9
- */
10
- function getLockFile() {
11
- return lockFile;
12
- }
1
+ import { lockSync, unlockSync } from "proper-lockfile";
13
2
  /**
14
3
  * Creates a .lock file for `filepath`, argument passed must not be the lock path
15
4
  * @param filepath File to lock, i.e. `keystore_0001.json`
16
5
  */
17
6
  export function lockFilepath(filepath) {
18
- getLockFile().lockSync(getLockFilepath(filepath));
7
+ try {
8
+ lockSync(filepath, {
9
+ // Allows to lock files that do not exist
10
+ realpath: false,
11
+ });
12
+ }
13
+ catch (e) {
14
+ if (isLockfileError(e) && e.code === "ELOCKED") {
15
+ e.message = `${filepath} is already in use by another process`;
16
+ }
17
+ throw e;
18
+ }
19
19
  }
20
20
  /**
21
21
  * Deletes a .lock file for `filepath`, argument passed must not be the lock path
22
22
  * @param filepath File to unlock, i.e. `keystore_0001.json`
23
23
  */
24
24
  export function unlockFilepath(filepath) {
25
- // Does not throw if the lock file is already deleted
26
- // https://github.com/npm/lockfile/blob/6590779867ee9bdc5dbebddc962640759892bb91/lockfile.js#L68
27
- getLockFile().unlockSync(getLockFilepath(filepath));
25
+ try {
26
+ unlockSync(filepath, {
27
+ // Allows to unlock files that do not exist
28
+ realpath: false,
29
+ });
30
+ }
31
+ catch (e) {
32
+ if (isLockfileError(e) && e.code === "ENOTACQUIRED") {
33
+ // Do not throw if the lock file is already deleted
34
+ return;
35
+ }
36
+ throw e;
37
+ }
38
+ }
39
+ function isLockfileError(e) {
40
+ return e instanceof Error && e.code !== undefined;
28
41
  }
29
42
  //# sourceMappingURL=lockfile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lockfile.js","sourceRoot":"","sources":["../../src/util/lockfile.ts"],"names":[],"mappings":"AAKA,MAAM,QAAQ,GAAa,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAa,CAAC;AAElE,SAAS,eAAe,CAAC,QAAgB;IACvC,OAAO,GAAG,QAAQ,OAAO,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW;IAClB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,WAAW,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,qDAAqD;IACrD,gGAAgG;IAChG,WAAW,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC"}
1
+ {"version":3,"file":"lockfile.js","sourceRoot":"","sources":["../../src/util/lockfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAErD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,IAAI;QACF,QAAQ,CAAC,QAAQ,EAAE;YACjB,yCAAyC;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;KACJ;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,EAAE;YAC9C,CAAC,CAAC,OAAO,GAAG,GAAG,QAAQ,uCAAuC,CAAC;SAChE;QACD,MAAM,CAAC,CAAC;KACT;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,IAAI;QACF,UAAU,CAAC,QAAQ,EAAE;YACnB,2CAA2C;YAC3C,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;KACJ;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc,EAAE;YACnD,mDAAmD;YACnD,OAAO;SACR;QACD,MAAM,CAAC,CAAC;KACT;AACH,CAAC;AAKD,SAAS,eAAe,CAAC,CAAU;IACjC,OAAO,CAAC,YAAY,KAAK,IAAK,CAAmB,CAAC,IAAI,KAAK,SAAS,CAAC;AACvE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainsafe/lodestar",
3
- "version": "1.15.0",
3
+ "version": "1.15.1-rc.0",
4
4
  "description": "Command line interface for lodestar",
5
5
  "author": "ChainSafe Systems",
6
6
  "license": "LGPL-3.0",
@@ -66,19 +66,18 @@
66
66
  "@libp2p/crypto": "^3.0.4",
67
67
  "@libp2p/peer-id": "^4.0.4",
68
68
  "@libp2p/peer-id-factory": "^4.0.3",
69
- "@lodestar/api": "^1.15.0",
70
- "@lodestar/beacon-node": "^1.15.0",
71
- "@lodestar/config": "^1.15.0",
72
- "@lodestar/db": "^1.15.0",
73
- "@lodestar/light-client": "^1.15.0",
74
- "@lodestar/logger": "^1.15.0",
75
- "@lodestar/params": "^1.15.0",
76
- "@lodestar/state-transition": "^1.15.0",
77
- "@lodestar/types": "^1.15.0",
78
- "@lodestar/utils": "^1.15.0",
79
- "@lodestar/validator": "^1.15.0",
69
+ "@lodestar/api": "1.15.1-rc.0",
70
+ "@lodestar/beacon-node": "1.15.1-rc.0",
71
+ "@lodestar/config": "1.15.1-rc.0",
72
+ "@lodestar/db": "1.15.1-rc.0",
73
+ "@lodestar/light-client": "1.15.1-rc.0",
74
+ "@lodestar/logger": "1.15.1-rc.0",
75
+ "@lodestar/params": "1.15.1-rc.0",
76
+ "@lodestar/state-transition": "1.15.1-rc.0",
77
+ "@lodestar/types": "1.15.1-rc.0",
78
+ "@lodestar/utils": "1.15.1-rc.0",
79
+ "@lodestar/validator": "1.15.1-rc.0",
80
80
  "@multiformats/multiaddr": "^12.1.3",
81
- "@types/lockfile": "^1.0.2",
82
81
  "bip39": "^3.1.0",
83
82
  "deepmerge": "^4.3.1",
84
83
  "ethers": "^6.7.0",
@@ -87,9 +86,9 @@
87
86
  "got": "^11.8.6",
88
87
  "inquirer": "^9.1.5",
89
88
  "js-yaml": "^4.1.0",
90
- "lockfile": "^1.0.4",
91
89
  "lodash": "^4.17.21",
92
90
  "prom-client": "^15.1.0",
91
+ "proper-lockfile": "^4.1.2",
93
92
  "rimraf": "^4.4.1",
94
93
  "source-map-support": "^0.5.21",
95
94
  "uint8arrays": "^4.0.9",
@@ -97,13 +96,14 @@
97
96
  "yargs": "^17.7.1"
98
97
  },
99
98
  "devDependencies": {
100
- "@lodestar/test-utils": "^1.15.0",
99
+ "@lodestar/test-utils": "1.15.1-rc.0",
101
100
  "@types/debug": "^4.1.7",
102
101
  "@types/expand-tilde": "^2.0.0",
103
102
  "@types/got": "^9.6.12",
104
103
  "@types/inquirer": "^9.0.3",
105
104
  "@types/lodash": "^4.14.192",
105
+ "@types/proper-lockfile": "^4.1.4",
106
106
  "@types/yargs": "^17.0.24"
107
107
  },
108
- "gitHead": "5d93a629c0fd1fdd32160cbf7717e7a6b22f7f2d"
108
+ "gitHead": "fe2b799f4c9113bd76ba20e7b74bdf55841e22c4"
109
109
  }