@percy/client 1.28.2 → 1.28.3-alpha.1

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.
Files changed (2) hide show
  1. package/dist/client.js +10 -1
  2. package/package.json +6 -5
package/dist/client.js CHANGED
@@ -2,12 +2,16 @@ import fs from 'fs';
2
2
  import PercyEnv from '@percy/env';
3
3
  import { git } from '@percy/env/utils';
4
4
  import logger from '@percy/logger';
5
+ import Pako from 'pako';
5
6
  import { pool, request, formatBytes, sha256hash, base64encode, getPackageJSON, waitForTimeout, validateTiles } from './utils.js';
6
7
 
7
8
  // Default client API URL can be set with an env var for API development
8
9
  const {
9
10
  PERCY_CLIENT_API_URL = 'https://percy.io/api/v1'
10
11
  } = process.env;
12
+ const {
13
+ PERCY_GZIP = false
14
+ } = process.env;
11
15
  const pkg = getPackageJSON(import.meta.url);
12
16
  // minimum polling interval milliseconds
13
17
  const MIN_POLLING_INTERVAL = 1_000;
@@ -315,7 +319,12 @@ export class PercyClient {
315
319
  content
316
320
  } = {}) {
317
321
  validateId('build', buildId);
318
- if (filepath) content = await fs.promises.readFile(filepath);
322
+ if (filepath) {
323
+ content = await fs.promises.readFile(filepath);
324
+ if (PERCY_GZIP) {
325
+ content = Pako.gzip(content);
326
+ }
327
+ }
319
328
  let encodedContent = base64encode(content);
320
329
  this.log.debug(`Uploading ${formatBytes(encodedContent.length)} resource: ${url}...`);
321
330
  this.mayBeLogUploadSize(encodedContent.length);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/client",
3
- "version": "1.28.2",
3
+ "version": "1.28.3-alpha.1",
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": "latest"
12
+ "tag": "alpha"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -32,8 +32,9 @@
32
32
  "test:coverage": "yarn test --coverage"
33
33
  },
34
34
  "dependencies": {
35
- "@percy/env": "1.28.2",
36
- "@percy/logger": "1.28.2"
35
+ "@percy/env": "1.28.3-alpha.1",
36
+ "@percy/logger": "1.28.3-alpha.1",
37
+ "pako": "^2.1.0"
37
38
  },
38
- "gitHead": "88105fef569632b816955fcd1320bcc4b218bf67"
39
+ "gitHead": "af2067cad8ac8f67dacf2cf7e28ab257e0bac12f"
39
40
  }