@percy/cli-upload 1.32.7-beta.0 → 1.32.7-beta.2

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/upload.js +13 -3
  2. package/package.json +4 -4
package/dist/upload.js CHANGED
@@ -79,9 +79,12 @@ export const upload = command('upload', {
79
79
  if (!ALLOWED_TOKEN_TYPES.includes(tokenType)) {
80
80
  exit(1, 'Invalid Token Type. Only "web" and "self-managed" token types are allowed.');
81
81
  }
82
+
83
+ // the stream entrypoint, not the package index — it pulls in the parsers and
84
+ // nothing else, and stops reading each file as soon as it has the dimensions
82
85
  let {
83
- default: imageSize
84
- } = await import('image-size');
86
+ default: probeImageSize
87
+ } = await import('probe-image-size/stream.js');
85
88
  let {
86
89
  getImageResources
87
90
  } = await import('./utils.js');
@@ -98,10 +101,17 @@ export const upload = command('upload', {
98
101
  log.info(`Skipping unsupported file type: ${relativePath}`);
99
102
  } else {
100
103
  let absolutePath = path.resolve(args.dirname, relativePath);
104
+ // rejects when the contents are not an image the parsers recognise,
105
+ // whatever the extension claims — skip that file rather than fail the run
106
+ let size = await probeImageSize(fs.createReadStream(absolutePath)).catch(() => null);
107
+ if (!size) {
108
+ log.info(`Skipping file with unreadable image data: ${relativePath}`);
109
+ continue;
110
+ }
101
111
  let img = {
102
112
  relativePath,
103
113
  absolutePath,
104
- ...imageSize(absolutePath)
114
+ ...size
105
115
  };
106
116
  let {
107
117
  dir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/cli-upload",
3
- "version": "1.32.7-beta.0",
3
+ "version": "1.32.7-beta.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,9 +33,9 @@
33
33
  ]
34
34
  },
35
35
  "dependencies": {
36
- "@percy/cli-command": "1.32.7-beta.0",
36
+ "@percy/cli-command": "1.32.7-beta.2",
37
37
  "fast-glob": "^3.2.11",
38
- "image-size": "~1.0.2"
38
+ "probe-image-size": "^7.3.0"
39
39
  },
40
- "gitHead": "f86a18de3e04d3cfa9d14ce5d186ad66c3f8e020"
40
+ "gitHead": "be6a40b9d99ef190e4f6123491241c27c8308161"
41
41
  }