@percy/client 1.30.3-alpha.3 → 1.30.3-beta.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.
package/dist/proxy.js CHANGED
@@ -4,26 +4,9 @@ import http from 'http';
4
4
  import https from 'https';
5
5
  import logger from '@percy/logger';
6
6
  import { stripQuotesAndSpaces } from '@percy/env/utils';
7
- import { PacProxyAgent } from 'pac-proxy-agent';
8
7
  const CRLF = '\r\n';
9
8
  const STATUS_REG = /^HTTP\/1.[01] (\d*)/;
10
9
 
11
- // function to create PAC proxy agent
12
- function createPacAgent(pacUrl, options = {}) {
13
- pacUrl = stripQuotesAndSpaces(pacUrl);
14
- try {
15
- const agent = new PacProxyAgent(pacUrl, {
16
- keepAlive: true,
17
- ...options
18
- });
19
- logger('client:proxy').info(`Successfully loaded PAC file from: ${pacUrl}`);
20
- return agent;
21
- } catch (error) {
22
- logger('client:proxy').error(`Failed to load PAC file, error message: ${error.message}, stack: ${error.stack}`);
23
- throw new Error(`Failed to initialize PAC proxy: ${error.message}`);
24
- }
25
- }
26
-
27
10
  // Returns true if the URL hostname matches any patterns
28
11
  export function hostnameMatches(patterns, url) {
29
12
  let subject = new URL(url);
@@ -213,29 +196,8 @@ export function proxyAgentFor(url, options) {
213
196
  hostname
214
197
  } = new URL(url);
215
198
  let cachekey = `${protocol}//${hostname}`;
216
-
217
- // If we already have a cached agent, return it
218
- if (cache.has(cachekey)) {
219
- return cache.get(cachekey);
220
- }
221
- try {
222
- let agent;
223
- const pacUrl = process.env.PERCY_PAC_FILE_URL;
224
-
225
- // If PAC URL is provided, use PAC proxy
226
- if (pacUrl) {
227
- logger('client:proxy').info(`Using PAC file from: ${pacUrl}`);
228
- agent = createPacAgent(pacUrl, options);
229
- } else {
230
- // Fall back to other proxy configuration
231
- agent = protocol === 'https:' ? new ProxyHttpsAgent(options) : new ProxyHttpAgent(options);
232
- }
233
-
234
- // Cache the created agent
235
- cache.set(cachekey, agent);
236
- return agent;
237
- } catch (error) {
238
- logger('client:proxy').error(`Failed to create proxy agent: ${error.message}`);
239
- throw error;
199
+ if (!cache.has(cachekey)) {
200
+ cache.set(cachekey, protocol === 'https:' ? new ProxyHttpsAgent(options) : new ProxyHttpAgent(options));
240
201
  }
202
+ return cache.get(cachekey);
241
203
  }
package/dist/utils.js CHANGED
@@ -30,9 +30,6 @@ export function waitForTimeout() {
30
30
 
31
31
  // Returns the package.json content at the package path.
32
32
  export function getPackageJSON(rel) {
33
- /* istanbul ignore else: sanity check */
34
- if (process.env.PERCY_FORCE_EXECUTABLE_DIRNAME) rel = __dirname;
35
-
36
33
  /* istanbul ignore else: sanity check */
37
34
  if (rel.startsWith('file:')) rel = url.fileURLToPath(rel);
38
35
  let pkg = path.join(rel, 'package.json');
@@ -144,11 +141,9 @@ export async function request(url, options = {}, callback) {
144
141
  } = new URL(url);
145
142
 
146
143
  // reference the default export so tests can mock it
147
- // bundling cli inside electron or another package fails if we import it
148
- // like this: await import(protocol === 'https:' ? 'https' : 'http');
149
144
  let {
150
145
  default: http
151
- } = protocol === 'https:' ? await import('https') : await import('http');
146
+ } = await import(protocol === 'https:' ? 'https' : 'http');
152
147
  let {
153
148
  proxyAgentFor
154
149
  } = await import('./proxy.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/client",
3
- "version": "1.30.3-alpha.3",
3
+ "version": "1.30.3-beta.0",
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": "alpha"
12
+ "tag": "beta"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -33,10 +33,9 @@
33
33
  "test:coverage": "yarn test --coverage"
34
34
  },
35
35
  "dependencies": {
36
- "@percy/env": "1.30.3-alpha.3",
37
- "@percy/logger": "1.30.3-alpha.3",
38
- "pac-proxy-agent": "^7.0.2",
36
+ "@percy/env": "1.30.3-beta.0",
37
+ "@percy/logger": "1.30.3-beta.0",
39
38
  "pako": "^2.1.0"
40
39
  },
41
- "gitHead": "4d36bd849268e2aa9987509c9fdd5d1224ce5157"
40
+ "gitHead": "8f5a9cb4b287900c4b053302452ea6f84d20c2f1"
42
41
  }