@percy/client 1.30.3-alpha.2 → 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
@@ -141,11 +141,9 @@ export async function request(url, options = {}, callback) {
141
141
  } = new URL(url);
142
142
 
143
143
  // reference the default export so tests can mock it
144
- // bundling cli inside electron or another package fails if we import it
145
- // like this: await import(protocol === 'https:' ? 'https' : 'http');
146
144
  let {
147
145
  default: http
148
- } = protocol === 'https:' ? await import('https') : await import('http');
146
+ } = await import(protocol === 'https:' ? 'https' : 'http');
149
147
  let {
150
148
  proxyAgentFor
151
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.2",
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.2",
37
- "@percy/logger": "1.30.3-alpha.2",
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": "aeaba47044853e43b42e979a4e676916e4d95dff"
40
+ "gitHead": "8f5a9cb4b287900c4b053302452ea6f84d20c2f1"
42
41
  }