@vltpkg/registry-client 1.0.7 → 1.0.8

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/dist/index.js CHANGED
@@ -25,6 +25,8 @@ import { getTokenResponse } from "./token-response.js";
25
25
  import { getWebAuthChallenge } from "./web-auth-challenge.js";
26
26
  import { collectHeaders, readBody } from "./response.js";
27
27
  import { oidc } from "./oidc.js";
28
+ // eslint-disable-next-line no-console
29
+ const log = (msg) => console.error(msg);
28
30
  export { CacheEntry, clearRuntimeTokens, deleteToken, getKC, getToken, getTokenByURL, isToken, keychains, normalizeRegistryKey, oidc, registryBase, runtimeTokens, setRuntimeToken, setToken, };
29
31
  export const isCacheableMethod = (m) => m === 'GET' || m === 'HEAD';
30
32
  export const cacheKey = (method, url) => `${method !== 'GET' ? method + ' ' : ''}${url}`;
@@ -218,10 +220,14 @@ export class RegistryClient {
218
220
  return result;
219
221
  }),
220
222
  urlOpen(authUrl, { signal }).catch((er) => {
223
+ // an aborted spawn is not a failure, e.g: login completed
224
+ // before the browser process exited
221
225
  if (asError(er).name === 'AbortError')
222
226
  return;
223
- ac.abort();
224
- throw er;
227
+ // the opener may exist but still fail to launch a browser,
228
+ // e.g: xdg-open on a headless server. Keep polling doneUrl so
229
+ // the user can complete the login by opening the url manually.
230
+ log(`Could not open a browser. Please open ${authUrl} manually.`);
225
231
  }),
226
232
  ]);
227
233
  /* c8 ignore stop */
package/dist/otplease.js CHANGED
@@ -48,7 +48,9 @@ export const otplease = async (client, options, response) => {
48
48
  const notice = String(npmNotice);
49
49
  const match = otpChallengeNotice.exec(notice);
50
50
  if (match?.[1]) {
51
- await urlOpen(match[1]);
51
+ // the opener may fail to launch a browser, e.g: xdg-open on a
52
+ // headless server. The url is printed in the notice below.
53
+ await urlOpen(match[1]).catch(() => { });
52
54
  log(notice);
53
55
  return {
54
56
  retry: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/registry-client",
3
3
  "description": "Fetch package artifacts and metadata from registries",
4
- "version": "1.0.7",
4
+ "version": "1.0.8",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -13,14 +13,14 @@
13
13
  "url": "http://vlt.sh"
14
14
  },
15
15
  "dependencies": {
16
- "@vltpkg/cache": "1.0.7",
17
- "@vltpkg/cache-unzip": "1.0.7",
18
- "@vltpkg/error-cause": "1.0.7",
19
- "@vltpkg/keychain": "1.0.7",
20
- "@vltpkg/output": "1.0.7",
21
- "@vltpkg/types": "1.0.7",
22
- "@vltpkg/url-open": "1.0.7",
23
- "@vltpkg/xdg": "1.0.7",
16
+ "@vltpkg/cache": "1.0.8",
17
+ "@vltpkg/cache-unzip": "1.0.8",
18
+ "@vltpkg/error-cause": "1.0.8",
19
+ "@vltpkg/keychain": "1.0.8",
20
+ "@vltpkg/output": "1.0.8",
21
+ "@vltpkg/types": "1.0.8",
22
+ "@vltpkg/url-open": "1.0.8",
23
+ "@vltpkg/xdg": "1.0.8",
24
24
  "cache-control-parser": "^2.0.6",
25
25
  "package-json-from-dist": "^1.0.1",
26
26
  "undici": "^7.16.0"