@pnpm/error 1100.1.1 → 1100.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @pnpm/error
2
2
 
3
+ ## 1100.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - A git dependency whose clone (or shallow fetch) fails now reports which package it belongs to, under the `ERR_PNPM_GIT_FETCH_FAILED` code, with credentials in the repository URL redacted. When the lockfile records an SSH remote, the error also explains that fetching it needs an SSH key for that host, and that a lockfile entry written before pnpm v11.21 can be re-recorded over HTTPS with `pnpm update <package>` [#13743](https://github.com/pnpm/pnpm/issues/13743).
8
+
3
9
  ## 1100.1.1
4
10
 
5
11
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -49,6 +49,17 @@ export declare function redactUrlCredentials(text: string): string;
49
49
  * or inject terminal output via raw escapes / `\r` / `\n`.
50
50
  */
51
51
  export declare function redactAndSanitize(text: string): string;
52
+ /**
53
+ * {@link redactAndSanitize} for text whose line breaks are worth keeping, such
54
+ * as a subprocess's multi-line stderr.
55
+ *
56
+ * Line breaks are kept only when doing so redacts exactly as much as
57
+ * collapsing the text would: a newline can fall inside a `user:pass@`
58
+ * authority — git echoes such a URL back verbatim, password included — and
59
+ * redacting each line separately would leave the credentials split but
60
+ * readable. Whenever the two disagree, the collapsed form wins.
61
+ */
62
+ export declare function redactAndSanitizeMultiline(text: string): string;
52
63
  export declare class LockfileMissingDependencyError extends PnpmError {
53
64
  constructor(depPath: string);
54
65
  }
package/lib/index.js CHANGED
@@ -103,6 +103,21 @@ export function redactAndSanitize(text) {
103
103
  }
104
104
  return redactUrlCredentials(sanitized);
105
105
  }
106
+ /**
107
+ * {@link redactAndSanitize} for text whose line breaks are worth keeping, such
108
+ * as a subprocess's multi-line stderr.
109
+ *
110
+ * Line breaks are kept only when doing so redacts exactly as much as
111
+ * collapsing the text would: a newline can fall inside a `user:pass@`
112
+ * authority — git echoes such a URL back verbatim, password included — and
113
+ * redacting each line separately would leave the credentials split but
114
+ * readable. Whenever the two disagree, the collapsed form wins.
115
+ */
116
+ export function redactAndSanitizeMultiline(text) {
117
+ const collapsed = redactAndSanitize(text);
118
+ const perLine = text.split('\n').map(redactAndSanitize).join('\n');
119
+ return perLine.replaceAll('\n', '') === collapsed ? perLine : collapsed;
120
+ }
106
121
  function isSchemeTailChar(code) {
107
122
  return (code >= 0x30 && code <= 0x39) || (code >= 0x41 && code <= 0x5a) || (code >= 0x61 && code <= 0x7a);
108
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/error",
3
- "version": "1100.1.1",
3
+ "version": "1100.1.2",
4
4
  "description": "An error class for pnpm errors",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@jest/globals": "30.4.1",
35
- "@pnpm/error": "1100.1.1"
35
+ "@pnpm/error": "1100.1.2"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=22.13"