npm-pkgbuild 7.26.2 → 7.26.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "7.26.2",
3
+ "version": "7.26.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,7 +38,7 @@
38
38
  "lint:docs": "documentation lint ./src/**/*.mjs"
39
39
  },
40
40
  "dependencies": {
41
- "@npmcli/arborist": "^5.0.0",
41
+ "@npmcli/arborist": "^5.0.2",
42
42
  "aggregate-async-iterator": "^1.1.9",
43
43
  "commander": "^9.0.0",
44
44
  "content-entry": "^4.1.7",
@@ -52,7 +52,7 @@
52
52
  "node-fetch": "^3.2.3",
53
53
  "npm-package-walker": "^5.0.5",
54
54
  "npm-packlist": "^4.0.0",
55
- "pacote": "^13.0.2",
55
+ "pacote": "^13.0.4",
56
56
  "pkg-dir": "^6.0.1",
57
57
  "tar-stream": "^2.2.0"
58
58
  },
@@ -11,7 +11,7 @@ import {
11
11
  createExpressionTransformer,
12
12
  nameExtensionMatcher
13
13
  } from "content-entry-transform";
14
- import { utf8StreamOptions } from "./util.mjs";
14
+ import { utf8StreamOptions, decodePassword } from "./util.mjs";
15
15
  import {
16
16
  FileContentProvider,
17
17
  allInputs,
@@ -51,19 +51,7 @@ program
51
51
  let values = value.split(/,/);
52
52
  if (values.length > 1) {
53
53
  values = values.map(v => process.env[v] || v);
54
- let password = values[2];
55
- const m = password.match(/\{([^\}]+)\}(.*)/);
56
- if (m) {
57
- switch (m[1]) {
58
- case "BASE64":
59
- password = Buffer.from(m[2], "base64").toString("utf8");
60
- break;
61
- default:
62
- console.log(`Unknown algorithm ${m[1]}`);
63
- }
64
- }
65
-
66
- return { url: values[0], user: values[1], password };
54
+ return { url: values[0], user: values[1], password: decodePassword(values[2]) };
67
55
  }
68
56
 
69
57
  return { url: value };
package/src/util.mjs CHANGED
@@ -5,6 +5,26 @@ import { createWriteStream } from "fs";
5
5
 
6
6
  export const utf8StreamOptions = { encoding: "utf8" };
7
7
 
8
+ /**
9
+ * Decode a password
10
+ * @param {string} password
11
+ * @returns {string} plaintext password
12
+ */
13
+ export function decodePassword(password)
14
+ {
15
+ const m = password.match(/\{([^\}]+)\}(.*)/);
16
+ if (m) {
17
+ switch (m[1]) {
18
+ case "BASE64":
19
+ return Buffer.from(m[2], "base64").toString("utf8");
20
+ break;
21
+ default:
22
+ throw new Error(`Unknown algorithm ${m[1]}`);
23
+ }
24
+ }
25
+ return password;
26
+ }
27
+
8
28
  /**
9
29
  * Extract shell functions from a given text
10
30
  * @param {AsyncIterator<string>} source