@percy/core 1.19.0-alpha.0 → 1.19.2-alpha.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/config.js +10 -0
- package/dist/discovery.js +9 -2
- package/dist/network.js +2 -2
- package/dist/page.js +4 -2
- package/dist/percy.js +2 -0
- package/dist/snapshot.js +4 -1
- package/package.json +6 -6
- package/types/index.d.ts +1 -0
package/dist/config.js
CHANGED
|
@@ -35,6 +35,10 @@ export const configSchema = {
|
|
|
35
35
|
enableJavaScript: {
|
|
36
36
|
type: 'boolean'
|
|
37
37
|
},
|
|
38
|
+
disableShadowDOM: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
38
42
|
scope: {
|
|
39
43
|
type: 'string'
|
|
40
44
|
}
|
|
@@ -190,6 +194,9 @@ export const snapshotSchema = {
|
|
|
190
194
|
enableJavaScript: {
|
|
191
195
|
$ref: '/config/snapshot#/properties/enableJavaScript'
|
|
192
196
|
},
|
|
197
|
+
disableShadowDOM: {
|
|
198
|
+
$ref: '/config/snapshot#/properties/disableShadowDOM'
|
|
199
|
+
},
|
|
193
200
|
discovery: {
|
|
194
201
|
type: 'object',
|
|
195
202
|
additionalProperties: false,
|
|
@@ -576,6 +583,9 @@ export const comparisonSchema = {
|
|
|
576
583
|
content: {
|
|
577
584
|
type: 'string'
|
|
578
585
|
},
|
|
586
|
+
sha: {
|
|
587
|
+
type: 'string'
|
|
588
|
+
},
|
|
579
589
|
statusBarHeight: {
|
|
580
590
|
type: 'integer',
|
|
581
591
|
minimum: 0
|
package/dist/discovery.js
CHANGED
|
@@ -24,6 +24,7 @@ function debugSnapshotOptions(snapshot) {
|
|
|
24
24
|
debugProp(snapshot, 'widths', v => `${v}px`);
|
|
25
25
|
debugProp(snapshot, 'minHeight', v => `${v}px`);
|
|
26
26
|
debugProp(snapshot, 'enableJavaScript');
|
|
27
|
+
debugProp(snapshot, 'disableShadowDOM');
|
|
27
28
|
debugProp(snapshot, 'deviceScaleFactor');
|
|
28
29
|
debugProp(snapshot, 'waitForTimeout');
|
|
29
30
|
debugProp(snapshot, 'waitForSelector');
|
|
@@ -33,6 +34,7 @@ function debugSnapshotOptions(snapshot) {
|
|
|
33
34
|
debugProp(snapshot, 'execute.beforeSnapshot');
|
|
34
35
|
debugProp(snapshot, 'discovery.allowedHostnames');
|
|
35
36
|
debugProp(snapshot, 'discovery.disallowedHostnames');
|
|
37
|
+
debugProp(snapshot, 'discovery.devicePixelRatio');
|
|
36
38
|
debugProp(snapshot, 'discovery.requestHeaders', JSON.stringify);
|
|
37
39
|
debugProp(snapshot, 'discovery.authorization', JSON.stringify);
|
|
38
40
|
debugProp(snapshot, 'discovery.disableCache');
|
|
@@ -259,7 +261,7 @@ export async function* discoverSnapshotResources(queue, options, callback) {
|
|
|
259
261
|
}
|
|
260
262
|
|
|
261
263
|
// Used to cache resources across core instances
|
|
262
|
-
const RESOURCE_CACHE_KEY = Symbol('resource-cache');
|
|
264
|
+
export const RESOURCE_CACHE_KEY = Symbol('resource-cache');
|
|
263
265
|
|
|
264
266
|
// Creates an asset discovery queue that uses the percy browser instance to create a page for each
|
|
265
267
|
// snapshot which is used to intercept and capture snapshot resource requests.
|
|
@@ -314,7 +316,12 @@ export function createDiscoveryQueue(percy) {
|
|
|
314
316
|
allowedHostnames: snapshot.discovery.allowedHostnames,
|
|
315
317
|
disallowedHostnames: snapshot.discovery.disallowedHostnames,
|
|
316
318
|
getResource: u => snapshot.resources.get(u) || cache.get(u),
|
|
317
|
-
saveResource: r =>
|
|
319
|
+
saveResource: r => {
|
|
320
|
+
snapshot.resources.set(r.url, r);
|
|
321
|
+
if (!r.root) {
|
|
322
|
+
cache.set(r.url, r);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
318
325
|
}
|
|
319
326
|
});
|
|
320
327
|
try {
|
package/dist/network.js
CHANGED
|
@@ -2,7 +2,7 @@ import mime from 'mime-types';
|
|
|
2
2
|
import logger from '@percy/logger';
|
|
3
3
|
import { request as makeRequest } from '@percy/client/utils';
|
|
4
4
|
import { normalizeURL, hostnameMatches, createResource, waitFor } from './utils.js';
|
|
5
|
-
const MAX_RESOURCE_SIZE =
|
|
5
|
+
const MAX_RESOURCE_SIZE = 25 * 1024 ** 2; // 25MB
|
|
6
6
|
const ALLOWED_STATUSES = [200, 201, 301, 302, 304, 307, 308];
|
|
7
7
|
const ALLOWED_RESOURCES = ['Document', 'Stylesheet', 'Image', 'Media', 'Font', 'Other'];
|
|
8
8
|
|
|
@@ -370,7 +370,7 @@ async function saveResponseResource(network, request) {
|
|
|
370
370
|
} else if (!body.length) {
|
|
371
371
|
return log.debug('- Skipping empty response', meta);
|
|
372
372
|
} else if (body.length > MAX_RESOURCE_SIZE) {
|
|
373
|
-
return log.debug('- Skipping resource larger than
|
|
373
|
+
return log.debug('- Skipping resource larger than 25MB', meta);
|
|
374
374
|
} else if (!ALLOWED_STATUSES.includes(response.status)) {
|
|
375
375
|
return log.debug(`- Skipping disallowed status [${response.status}]`, meta);
|
|
376
376
|
} else if (!enableJavaScript && !ALLOWED_RESOURCES.includes(request.type)) {
|
package/dist/page.js
CHANGED
|
@@ -143,7 +143,8 @@ export class Page {
|
|
|
143
143
|
let {
|
|
144
144
|
name,
|
|
145
145
|
width,
|
|
146
|
-
enableJavaScript
|
|
146
|
+
enableJavaScript,
|
|
147
|
+
disableShadowDOM
|
|
147
148
|
} = snapshot;
|
|
148
149
|
this.log.debug(`Taking snapshot: ${name}${width ? ` @${width}px` : ''}`, this.meta);
|
|
149
150
|
|
|
@@ -186,7 +187,8 @@ export class Page {
|
|
|
186
187
|
domSnapshot: PercyDOM.serialize(options),
|
|
187
188
|
url: document.URL
|
|
188
189
|
}), {
|
|
189
|
-
enableJavaScript
|
|
190
|
+
enableJavaScript,
|
|
191
|
+
disableShadowDOM
|
|
190
192
|
});
|
|
191
193
|
return {
|
|
192
194
|
...snapshot,
|
package/dist/percy.js
CHANGED
|
@@ -46,6 +46,7 @@ export class Percy {
|
|
|
46
46
|
// snapshot server options
|
|
47
47
|
server = true,
|
|
48
48
|
port = 5338,
|
|
49
|
+
projectType = null,
|
|
49
50
|
// options such as `snapshot` and `discovery` that are valid Percy config
|
|
50
51
|
// options which will become accessible via the `.config` property
|
|
51
52
|
...options
|
|
@@ -61,6 +62,7 @@ export class Percy {
|
|
|
61
62
|
this.config = config;
|
|
62
63
|
if (testing) loglevel = 'silent';
|
|
63
64
|
if (loglevel) this.loglevel(loglevel);
|
|
65
|
+
this.projectType = projectType;
|
|
64
66
|
this.testing = testing ? {} : null;
|
|
65
67
|
this.dryRun = !!testing || !!dryRun;
|
|
66
68
|
this.skipUploads = this.dryRun || !!skipUploads;
|
package/dist/snapshot.js
CHANGED
|
@@ -121,6 +121,7 @@ function getSnapshotOptions(options, {
|
|
|
121
121
|
allowedHostnames: config.discovery.allowedHostnames,
|
|
122
122
|
disallowedHostnames: config.discovery.disallowedHostnames,
|
|
123
123
|
networkIdleTimeout: config.discovery.networkIdleTimeout,
|
|
124
|
+
devicePixelRatio: config.discovery.devicePixelRatio,
|
|
124
125
|
requestHeaders: config.discovery.requestHeaders,
|
|
125
126
|
authorization: config.discovery.authorization,
|
|
126
127
|
disableCache: config.discovery.disableCache,
|
|
@@ -328,7 +329,9 @@ export function createSnapshotsQueue(percy) {
|
|
|
328
329
|
build = percy.build = {};
|
|
329
330
|
let {
|
|
330
331
|
data
|
|
331
|
-
} = await percy.client.createBuild(
|
|
332
|
+
} = await percy.client.createBuild({
|
|
333
|
+
projectType: percy.projectType
|
|
334
|
+
});
|
|
332
335
|
let url = data.attributes['web-url'];
|
|
333
336
|
let number = data.attributes['build-number'];
|
|
334
337
|
Object.assign(build, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.2-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"test:types": "tsd"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@percy/client": "1.19.
|
|
43
|
-
"@percy/config": "1.19.
|
|
44
|
-
"@percy/dom": "1.19.
|
|
45
|
-
"@percy/logger": "1.19.
|
|
42
|
+
"@percy/client": "1.19.2-alpha.0",
|
|
43
|
+
"@percy/config": "1.19.2-alpha.0",
|
|
44
|
+
"@percy/dom": "1.19.2-alpha.0",
|
|
45
|
+
"@percy/logger": "1.19.2-alpha.0",
|
|
46
46
|
"content-disposition": "^0.5.4",
|
|
47
47
|
"cross-spawn": "^7.0.3",
|
|
48
48
|
"extract-zip": "^2.0.1",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"rimraf": "^3.0.2",
|
|
54
54
|
"ws": "^8.0.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "d9bf82889731f5cdc3f7fa4fe836cc5232ee8fb6"
|
|
57
57
|
}
|