@pnpm/error 1.4.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/LICENSE +2 -2
- package/README.md +2 -2
- package/lib/index.d.ts +3 -0
- package/lib/index.js +16 -4
- package/lib/index.js.map +1 -0
- package/package.json +22 -14
- package/CHANGELOG.md +0 -21
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2015-2016 Rico Sta. Cruz
|
|
4
|
-
Copyright (c) 2016-
|
|
3
|
+
Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
|
|
4
|
+
Copyright (c) 2016-2022 Zoltan Kochan and other contributors
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ import PnpmError from '@pnpm/error'
|
|
|
19
19
|
|
|
20
20
|
try {
|
|
21
21
|
throw new PnpmError('THE_ERROR_CODE', 'The error message')
|
|
22
|
-
} catch (err) {
|
|
22
|
+
} catch (err: any) { // eslint-disable-line
|
|
23
23
|
console.log(err.code)
|
|
24
24
|
//> ERR_PNPM_THE_ERROR_CODE
|
|
25
25
|
console.log(err.message)
|
|
@@ -29,4 +29,4 @@ try {
|
|
|
29
29
|
|
|
30
30
|
## License
|
|
31
31
|
|
|
32
|
-
MIT
|
|
32
|
+
MIT
|
package/lib/index.d.ts
CHANGED
|
@@ -25,3 +25,6 @@ export declare class FetchError extends PnpmError {
|
|
|
25
25
|
readonly request: FetchErrorRequest;
|
|
26
26
|
constructor(request: FetchErrorRequest, response: FetchErrorResponse, hint?: string);
|
|
27
27
|
}
|
|
28
|
+
export declare class LockfileMissingDependencyError extends PnpmError {
|
|
29
|
+
constructor(depPath: string);
|
|
30
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FetchError = void 0;
|
|
3
|
+
exports.LockfileMissingDependencyError = exports.FetchError = void 0;
|
|
4
|
+
const constants_1 = require("@pnpm/constants");
|
|
4
5
|
class PnpmError extends Error {
|
|
5
6
|
constructor(code, message, opts) {
|
|
6
7
|
super(message);
|
|
7
8
|
this.code = `ERR_PNPM_${code}`;
|
|
8
|
-
this.hint = opts
|
|
9
|
-
this.attempts = opts
|
|
9
|
+
this.hint = opts?.hint;
|
|
10
|
+
this.attempts = opts?.attempts;
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
exports.default = PnpmError;
|
|
@@ -14,7 +15,8 @@ class FetchError extends PnpmError {
|
|
|
14
15
|
constructor(request, response, hint) {
|
|
15
16
|
const message = `GET ${request.url}: ${response.statusText} - ${response.status}`;
|
|
16
17
|
const authHeaderValue = request.authHeaderValue
|
|
17
|
-
? hideAuthInformation(request.authHeaderValue)
|
|
18
|
+
? hideAuthInformation(request.authHeaderValue)
|
|
19
|
+
: undefined;
|
|
18
20
|
// NOTE: For security reasons, some registries respond with 404 on authentication errors as well.
|
|
19
21
|
// So we print authorization info on 404 errors as well.
|
|
20
22
|
if (response.status === 401 || response.status === 403 || response.status === 404) {
|
|
@@ -36,4 +38,14 @@ function hideAuthInformation(authHeaderValue) {
|
|
|
36
38
|
const [authType, token] = authHeaderValue.split(' ');
|
|
37
39
|
return `${authType} ${token.substring(0, 4)}[hidden]`;
|
|
38
40
|
}
|
|
41
|
+
class LockfileMissingDependencyError extends PnpmError {
|
|
42
|
+
constructor(depPath) {
|
|
43
|
+
const message = `Broken lockfile: no entry for '${depPath}' in ${constants_1.WANTED_LOCKFILE}`;
|
|
44
|
+
super('LOCKFILE_MISSING_DEPENDENCY', message, {
|
|
45
|
+
hint: 'This issue is probably caused by a badly resolved merge conflict.\n' +
|
|
46
|
+
'To fix the lockfile, run \'pnpm install --no-frozen-lockfile\'.',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.LockfileMissingDependencyError = LockfileMissingDependencyError;
|
|
39
51
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AAEjD,MAAqB,SAAU,SAAQ,KAAK;IAK1C,YACE,IAAY,EACZ,OAAe,EACf,IAGC;QAED,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,YAAY,IAAI,EAAE,CAAA;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,IAAI,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,EAAE,QAAQ,CAAA;IAChC,CAAC;CACF;AAlBD,4BAkBC;AAMD,MAAa,UAAW,SAAQ,SAAS;IAIvC,YACE,OAA0B,EAC1B,QAA4B,EAC5B,IAAa;QAEb,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,CAAC,UAAU,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAA;QACjF,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe;YAC7C,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,eAAe,CAAC;YAC9C,CAAC,CAAC,SAAS,CAAA;QACb,iGAAiG;QACjG,wDAAwD;QACxD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YACjF,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;YAChC,IAAI,eAAe,EAAE;gBACnB,IAAI,IAAI,qCAAqC,eAAe,EAAE,CAAA;aAC/D;iBAAM;gBACL,IAAI,IAAI,kDAAkD,CAAA;aAC3D;SACF;QACD,KAAK,CAAC,SAAS,QAAQ,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;CACF;AA3BD,gCA2BC;AAED,SAAS,mBAAmB,CAAE,eAAuB;IACnD,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACpD,OAAO,GAAG,QAAQ,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAA;AACvD,CAAC;AAED,MAAa,8BAA+B,SAAQ,SAAS;IAC3D,YAAa,OAAe;QAC1B,MAAM,OAAO,GAAG,kCAAkC,OAAO,QAAQ,2BAAe,EAAE,CAAA;QAClF,KAAK,CAAC,6BAA6B,EAAE,OAAO,EAAE;YAC5C,IAAI,EAAE,qEAAqE;gBACzE,iEAAiE;SACpE,CAAC,CAAA;IACJ,CAAC;CACF;AARD,wEAQC"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/error",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "An error class for pnpm errors",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
-
"
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib",
|
|
9
9
|
"!*.map"
|
|
10
10
|
],
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
12
|
+
"node": ">=14.19"
|
|
13
13
|
},
|
|
14
|
-
"
|
|
15
|
-
"lint": "eslint -c ../../eslint.json src/**/*.ts",
|
|
16
|
-
"test": "pnpm run compile",
|
|
17
|
-
"prepublishOnly": "pnpm run compile",
|
|
18
|
-
"compile": "rimraf lib tsconfig.tsbuildinfo && tsc --build"
|
|
19
|
-
},
|
|
20
|
-
"repository": "https://github.com/pnpm/pnpm/blob/master/packages/error",
|
|
14
|
+
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/error",
|
|
21
15
|
"keywords": [
|
|
16
|
+
"pnpm7",
|
|
22
17
|
"pnpm",
|
|
23
18
|
"error"
|
|
24
19
|
],
|
|
25
|
-
"author": "Zoltan Kochan <z@kochan.io> (https://www.kochan.io/)",
|
|
26
20
|
"license": "MIT",
|
|
27
21
|
"bugs": {
|
|
28
22
|
"url": "https://github.com/pnpm/pnpm/issues"
|
|
29
23
|
},
|
|
30
|
-
"homepage": "https://github.com/pnpm/pnpm/blob/
|
|
31
|
-
"funding": "https://opencollective.com/pnpm"
|
|
32
|
-
|
|
24
|
+
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/error#readme",
|
|
25
|
+
"funding": "https://opencollective.com/pnpm",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@pnpm/error": "3.0.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@pnpm/constants": "6.0.0"
|
|
31
|
+
},
|
|
32
|
+
"exports": {
|
|
33
|
+
".": "./lib/index.js"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"lint": "eslint src/**/*.ts",
|
|
37
|
+
"test": "pnpm run compile",
|
|
38
|
+
"compile": "tsc --build && pnpm run lint --fix"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# @pnpm/error
|
|
2
|
-
|
|
3
|
-
## 1.4.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 0c5f1bcc9: Every error object has an optional "attempts" field.
|
|
8
|
-
|
|
9
|
-
## 1.3.1
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- 75a36deba: Report auth info on 404 errors as well.
|
|
14
|
-
|
|
15
|
-
## 1.3.0
|
|
16
|
-
|
|
17
|
-
### Minor Changes
|
|
18
|
-
|
|
19
|
-
- 6d480dd7a: A new error class added for throwing fetch errors: FetchError.
|
|
20
|
-
|
|
21
|
-
## 1.2.1
|