@percy/cli-upload 1.32.10-beta.0 → 1.32.10-beta.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.
- package/dist/utils.js +14 -24
- package/package.json +3 -3
package/dist/utils.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import {
|
|
2
|
+
import { createImageSnapshotResources } from '@percy/cli-command/utils';
|
|
3
3
|
export { yieldAll } from '@percy/cli-command/utils';
|
|
4
4
|
|
|
5
|
-
// Returns root resource and image resource objects based on image properties. The
|
|
6
|
-
//
|
|
5
|
+
// Returns root resource and image resource objects based on image properties. The wrapper DOM
|
|
6
|
+
// itself lives in @percy/core's utils as createImageSnapshotResources: its exact shape is what
|
|
7
|
+
// percy-api matches to extract the image and skip the renderer, and the PDF snapshot path builds
|
|
8
|
+
// the same pair, so there must only be one definition of it.
|
|
7
9
|
export async function getImageResources({
|
|
8
10
|
name,
|
|
9
11
|
type,
|
|
@@ -12,25 +14,13 @@ export async function getImageResources({
|
|
|
12
14
|
relativePath,
|
|
13
15
|
absolutePath
|
|
14
16
|
}) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<title>${name}</title>
|
|
25
|
-
<style>
|
|
26
|
-
*, *::before, *::after { margin: 0; padding: 0; font-size: 0; }
|
|
27
|
-
html, body { width: 100%; }
|
|
28
|
-
img { max-width: 100%; }
|
|
29
|
-
</style>
|
|
30
|
-
</head>
|
|
31
|
-
<body>
|
|
32
|
-
<img src="${imageUrl}" width="${width}px" height="${height}px"/>
|
|
33
|
-
</body>
|
|
34
|
-
</html>
|
|
35
|
-
`), createResource(imageUrl, content, mimetype)];
|
|
17
|
+
return createImageSnapshotResources({
|
|
18
|
+
name,
|
|
19
|
+
rootUrl: `http://local/${encodeURIComponent(name)}`,
|
|
20
|
+
imageUrl: `http://local/${encodeURIComponent(relativePath)}`,
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
23
|
+
content: await fs.promises.readFile(absolutePath),
|
|
24
|
+
mimetype: `image/${type}`
|
|
25
|
+
});
|
|
36
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/cli-upload",
|
|
3
|
-
"version": "1.32.10-beta.
|
|
3
|
+
"version": "1.32.10-beta.1",
|
|
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.10-beta.
|
|
36
|
+
"@percy/cli-command": "1.32.10-beta.1",
|
|
37
37
|
"fast-glob": "^3.2.11",
|
|
38
38
|
"probe-image-size": "^7.3.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "b90cd9fe29b14fdb7a1e383609654b227adacf17"
|
|
41
41
|
}
|