@pnpm/network.auth-header 1100.0.2 → 1101.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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RegistryConfig } from '@pnpm/types';
|
|
2
|
-
export declare function getAuthHeadersFromCreds(configByUri: Record<string, RegistryConfig
|
|
2
|
+
export declare function getAuthHeadersFromCreds(configByUri: Record<string, RegistryConfig>): Record<string, string>;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import { PnpmError } from '@pnpm/error';
|
|
3
|
-
export function getAuthHeadersFromCreds(configByUri
|
|
3
|
+
export function getAuthHeadersFromCreds(configByUri) {
|
|
4
4
|
const authHeaderValueByURI = {};
|
|
5
5
|
for (const [uri, registryConfig] of Object.entries(configByUri)) {
|
|
6
|
-
if (uri === '')
|
|
7
|
-
continue; // default auth handled below
|
|
8
6
|
const header = credsToHeader(registryConfig.creds);
|
|
9
7
|
if (header) {
|
|
10
8
|
authHeaderValueByURI[uri] = header;
|
|
11
9
|
}
|
|
12
10
|
}
|
|
13
|
-
const defaultConfig = configByUri[''];
|
|
14
|
-
if (defaultConfig?.creds) {
|
|
15
|
-
const header = credsToHeader(defaultConfig.creds);
|
|
16
|
-
if (header) {
|
|
17
|
-
authHeaderValueByURI[defaultRegistry] = header;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
11
|
return authHeaderValueByURI;
|
|
21
12
|
}
|
|
22
13
|
function credsToHeader(creds) {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RegistryConfig } from '@pnpm/types';
|
|
2
|
-
export declare function createGetAuthHeaderByURI(configByUri: Record<string, RegistryConfig
|
|
2
|
+
export declare function createGetAuthHeaderByURI(configByUri: Record<string, RegistryConfig>): (uri: string) => string | undefined;
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { nerfDart } from '@pnpm/config.nerf-dart';
|
|
2
2
|
import { getAuthHeadersFromCreds } from './getAuthHeadersFromConfig.js';
|
|
3
3
|
import { removePort } from './helpers/removePort.js';
|
|
4
|
-
export function createGetAuthHeaderByURI(configByUri
|
|
5
|
-
const
|
|
6
|
-
const authHeaders = getAuthHeadersFromCreds(configByUri, registry);
|
|
4
|
+
export function createGetAuthHeaderByURI(configByUri) {
|
|
5
|
+
const authHeaders = getAuthHeadersFromCreds(configByUri);
|
|
7
6
|
if (Object.keys(authHeaders).length === 0)
|
|
8
7
|
return (uri) => basicAuth(new URL(uri));
|
|
9
8
|
return getAuthHeaderByURI.bind(null, authHeaders, getMaxParts(Object.keys(authHeaders)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/network.auth-header",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1101.0.0",
|
|
4
4
|
"description": "Gets the authorization header for the given URI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"!*.map"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@pnpm/config.nerf-dart": "^1.0.
|
|
29
|
-
"@pnpm/
|
|
30
|
-
"@pnpm/
|
|
28
|
+
"@pnpm/config.nerf-dart": "^1.0.1",
|
|
29
|
+
"@pnpm/error": "1100.0.0",
|
|
30
|
+
"@pnpm/types": "1101.2.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@jest/globals": "30.3.0",
|
|
34
34
|
"safe-buffer": "5.2.1",
|
|
35
|
-
"@pnpm/network.auth-header": "
|
|
35
|
+
"@pnpm/network.auth-header": "1101.0.0"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=22.13"
|