@percy/client 1.26.2-beta.0 → 1.26.3-alpha.4

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
@@ -1,3 +1,8 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
6
  import fs from 'fs';
2
7
  import PercyEnv from '@percy/env';
3
8
  import { git } from '@percy/env/utils';
@@ -320,16 +325,19 @@ export class PercyClient {
320
325
  },
321
326
  relationships: {
322
327
  resources: {
323
- data: resources.map(r => ({
324
- type: 'resources',
325
- id: r.sha ?? (r.content && sha256hash(r.content)),
326
- attributes: {
327
- 'resource-url': r.url || null,
328
- 'is-root': r.root || null,
329
- 'for-widths': r.widths || null,
330
- mimetype: r.mimetype || null
331
- }
332
- }))
328
+ data: resources.map(r => {
329
+ var _r$sha;
330
+ return {
331
+ type: 'resources',
332
+ id: (_r$sha = r.sha) !== null && _r$sha !== void 0 ? _r$sha : r.content && sha256hash(r.content),
333
+ attributes: {
334
+ 'resource-url': r.url || null,
335
+ 'is-root': r.root || null,
336
+ 'for-widths': r.widths || null,
337
+ mimetype: r.mimetype || null
338
+ }
339
+ };
340
+ })
333
341
  }
334
342
  }
335
343
  }
@@ -478,11 +486,10 @@ export class PercyClient {
478
486
  this.log.debug(`Uploading comparison tiles for ${comparisonId}...`);
479
487
  return pool(function* () {
480
488
  for (let index = 0; index < tiles.length; index++) {
481
- yield this.uploadComparisonTile(comparisonId, {
489
+ yield this.uploadComparisonTile(comparisonId, _objectSpread({
482
490
  index,
483
- total: tiles.length,
484
- ...tiles[index]
485
- });
491
+ total: tiles.length
492
+ }, tiles[index]));
486
493
  }
487
494
  }, this, 2);
488
495
  }
package/dist/proxy.js CHANGED
@@ -1,8 +1,14 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
6
  import net from 'net';
2
7
  import tls from 'tls';
3
8
  import http from 'http';
4
9
  import https from 'https';
5
10
  import logger from '@percy/logger';
11
+ import { stripQuotesAndSpaces } from '@percy/env/utils';
6
12
  const CRLF = '\r\n';
7
13
  const STATUS_REG = /^HTTP\/1.[01] (\d*)/;
8
14
 
@@ -62,7 +68,10 @@ export function href(options) {
62
68
  // Returns the proxy URL for a set of request options
63
69
  export function getProxy(options) {
64
70
  let proxyUrl = options.protocol === 'https:' && (process.env.https_proxy || process.env.HTTPS_PROXY) || process.env.http_proxy || process.env.HTTP_PROXY;
65
- let shouldProxy = !!proxyUrl && !hostnameMatches(process.env.no_proxy || process.env.NO_PROXY, href(options));
71
+ let shouldProxy = !!proxyUrl && !hostnameMatches(stripQuotesAndSpaces(process.env.no_proxy || process.env.NO_PROXY), href(options));
72
+ if (proxyUrl && typeof proxyUrl === 'string') {
73
+ proxyUrl = stripQuotesAndSpaces(proxyUrl);
74
+ }
66
75
  if (shouldProxy) {
67
76
  proxyUrl = new URL(proxyUrl);
68
77
  let isHttps = proxyUrl.protocol === 'https:';
@@ -129,10 +138,9 @@ export class ProxyHttpAgent extends http.Agent {
129
138
  export class ProxyHttpsAgent extends https.Agent {
130
139
  constructor(options) {
131
140
  // default keep-alive
132
- super({
133
- keepAlive: true,
134
- ...options
135
- });
141
+ super(_objectSpread({
142
+ keepAlive: true
143
+ }, options));
136
144
  }
137
145
  createConnection(options, callback) {
138
146
  let proxy = getProxy(options);
package/dist/utils.js CHANGED
@@ -1,3 +1,11 @@
1
+ const _excluded = ["body", "headers", "retries", "retryNotFound", "interval", "noProxy", "buffer"];
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1
9
  import os from 'os';
2
10
  import fs from 'fs';
3
11
  import url from 'url';
@@ -109,15 +117,15 @@ export async function request(url, options = {}, callback) {
109
117
 
110
118
  // gather request options
111
119
  let {
112
- body,
113
- headers,
114
- retries,
115
- retryNotFound,
116
- interval,
117
- noProxy,
118
- buffer,
119
- ...requestOptions
120
- } = options;
120
+ body,
121
+ headers,
122
+ retries,
123
+ retryNotFound,
124
+ interval,
125
+ noProxy,
126
+ buffer
127
+ } = options,
128
+ requestOptions = _objectWithoutProperties(options, _excluded);
121
129
  let {
122
130
  protocol,
123
131
  hostname,
@@ -137,10 +145,9 @@ export async function request(url, options = {}, callback) {
137
145
 
138
146
  // automatically stringify body content
139
147
  if (body !== undefined && typeof body !== 'string') {
140
- headers = {
141
- 'Content-Type': 'application/json',
142
- ...headers
143
- };
148
+ headers = _objectSpread({
149
+ 'Content-Type': 'application/json'
150
+ }, headers);
144
151
  body = JSON.stringify(body);
145
152
  }
146
153
 
@@ -178,8 +185,8 @@ export async function request(url, options = {}, callback) {
178
185
  } catch {}
179
186
  try {
180
187
  if (statusCode >= 200 && statusCode < 300) {
181
- var _callback;
182
- resolve((await ((_callback = callback) === null || _callback === void 0 ? void 0 : _callback(body, res))) ?? body);
188
+ var _await$callback, _callback;
189
+ resolve((_await$callback = await ((_callback = callback) === null || _callback === void 0 ? void 0 : _callback(body, res))) !== null && _await$callback !== void 0 ? _await$callback : body);
183
190
  } else {
184
191
  var _body, _body$errors, _body$errors$find;
185
192
  let err = (_body = body) === null || _body === void 0 ? void 0 : (_body$errors = _body.errors) === null || _body$errors === void 0 ? void 0 : (_body$errors$find = _body$errors.find(e => e.detail)) === null || _body$errors$find === void 0 ? void 0 : _body$errors$find.detail;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/client",
3
- "version": "1.26.2-beta.0",
3
+ "version": "1.26.3-alpha.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "beta"
12
+ "tag": "alpha"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -32,8 +32,8 @@
32
32
  "test:coverage": "yarn test --coverage"
33
33
  },
34
34
  "dependencies": {
35
- "@percy/env": "1.26.2-beta.0",
36
- "@percy/logger": "1.26.2-beta.0"
35
+ "@percy/env": "1.26.3-alpha.4",
36
+ "@percy/logger": "1.26.3-alpha.4"
37
37
  },
38
- "gitHead": "14191aa65d5da5190039ae0938c9fd8edab7cd28"
38
+ "gitHead": "d89ab97b8d5169eafd3eb42bdbbef41a2ac624ba"
39
39
  }