@percy/core 1.6.3 → 1.6.4
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 +5 -2
- package/package.json +6 -6
package/dist/utils.js
CHANGED
|
@@ -182,11 +182,14 @@ async function scrollToBottom(options, onScroll) {
|
|
|
182
182
|
});
|
|
183
183
|
await ((_onScroll = onScroll) === null || _onScroll === void 0 ? void 0 : _onScroll(i, s));
|
|
184
184
|
}
|
|
185
|
-
} //
|
|
185
|
+
} // Used to test if a string looks like a function
|
|
186
186
|
|
|
187
187
|
|
|
188
|
+
const FUNC_REG = /^(async\s+)?(function\s*)?(\w+\s*)?\(.*?\)\s*(\{|=>)/is; // Serializes the provided function with percy helpers for use in evaluating browser scripts
|
|
189
|
+
|
|
188
190
|
export function serializeFunction(fn) {
|
|
189
|
-
|
|
191
|
+
// stringify or convert a function body into a complete function
|
|
192
|
+
let fnbody = typeof fn === 'string' && !FUNC_REG.test(fn) ? `async function eval() {\n${fn}\n}` : fn.toString(); // we might have a function shorthand if this fails
|
|
190
193
|
|
|
191
194
|
/* eslint-disable-next-line no-new, no-new-func */
|
|
192
195
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
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.6.
|
|
43
|
-
"@percy/config": "1.6.
|
|
44
|
-
"@percy/dom": "1.6.
|
|
45
|
-
"@percy/logger": "1.6.
|
|
42
|
+
"@percy/client": "1.6.4",
|
|
43
|
+
"@percy/config": "1.6.4",
|
|
44
|
+
"@percy/dom": "1.6.4",
|
|
45
|
+
"@percy/logger": "1.6.4",
|
|
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": "651c0fad62f128053723f9b8d565c69496dc51e4"
|
|
57
57
|
}
|