@percy/client 1.30.3-alpha.4 → 1.30.3-alpha.5

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/client.js CHANGED
@@ -9,7 +9,7 @@ import { pool, request, formatBytes, sha256hash, base64encode, getPackageJSON, w
9
9
  const {
10
10
  PERCY_CLIENT_API_URL = 'https://percy.io/api/v1'
11
11
  } = process.env;
12
- const pkg = getPackageJSON(import.meta.url);
12
+ let pkg = getPackageJSON(import.meta.url);
13
13
  // minimum polling interval milliseconds
14
14
  const MIN_POLLING_INTERVAL = 1_000;
15
15
  const INVALID_TOKEN_ERROR_MESSAGE = 'Unable to retrieve snapshot details with write access token. Kindly use a full access token for retrieving snapshot details with Synchronous CLI.';
@@ -77,6 +77,7 @@ export class PercyClient {
77
77
 
78
78
  // Stringifies client and environment info.
79
79
  userAgent() {
80
+ if (this.env.forcedPkgValue) pkg = this.env.forcedPkgValue;
80
81
  let client = new Set([`Percy/${/\w+$/.exec(this.apiUrl)}`].concat(`${pkg.name}/${pkg.version}`, ...this.clientInfo).filter(Boolean));
81
82
  let environment = new Set([...this.environmentInfo].concat(`node/${process.version}`, this.env.info).filter(Boolean));
82
83
  return `${[...client].join(' ')} (${[...environment].join('; ')})`;
package/dist/utils.js CHANGED
@@ -31,7 +31,7 @@ export function waitForTimeout() {
31
31
  // Returns the package.json content at the package path.
32
32
  export function getPackageJSON(rel) {
33
33
  /* istanbul ignore else: sanity check */
34
- if (process.env.PERCY_FORCE_PKG_VALUE) return JSON.parse(process.env.PERCY_FORCE_PKG_VALUE);
34
+ if (rel.startsWith('file:')) rel = url.fileURLToPath(rel);
35
35
 
36
36
  /* istanbul ignore else: sanity check */
37
37
  if (rel.startsWith('file:')) rel = url.fileURLToPath(rel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/client",
3
- "version": "1.30.3-alpha.4",
3
+ "version": "1.30.3-alpha.5",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,10 +33,10 @@
33
33
  "test:coverage": "yarn test --coverage"
34
34
  },
35
35
  "dependencies": {
36
- "@percy/env": "1.30.3-alpha.4",
37
- "@percy/logger": "1.30.3-alpha.4",
36
+ "@percy/env": "1.30.3-alpha.5",
37
+ "@percy/logger": "1.30.3-alpha.5",
38
38
  "pac-proxy-agent": "^7.0.2",
39
39
  "pako": "^2.1.0"
40
40
  },
41
- "gitHead": "c524e283ea199ee9169fa7f5c50a796d46864c3e"
41
+ "gitHead": "b996f30c92e3c9423352d8d31c230ebe21e99e1a"
42
42
  }