@percy/config 1.0.4 → 1.0.7
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/merge.js +4 -2
- package/dist/utils/normalize.js +8 -3
- package/dist/validate.js +1 -1
- package/package.json +4 -4
package/dist/utils/merge.js
CHANGED
|
@@ -86,15 +86,17 @@ export function map(object, from, to, transform = v => v) {
|
|
|
86
86
|
}, object)));
|
|
87
87
|
} // Steps through an object's properties calling the function with the path and value of each
|
|
88
88
|
|
|
89
|
-
function walk(object, fn, path = []) {
|
|
89
|
+
function walk(object, fn, path = [], visited = new Set()) {
|
|
90
90
|
if (path.length && fn([...path], object) === false) return;
|
|
91
|
+
if (visited.has(object)) return;
|
|
92
|
+
visited.add(object);
|
|
91
93
|
|
|
92
94
|
if (object != null && typeof object === 'object') {
|
|
93
95
|
let isArrayObject = isArray(object);
|
|
94
96
|
|
|
95
97
|
for (let [key, value] of entries(object)) {
|
|
96
98
|
if (isArrayObject) key = parseInt(key, 10);
|
|
97
|
-
walk(value, fn, [...path, key]);
|
|
99
|
+
walk(value, fn, [...path, key], new Set(visited));
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
} // Recursively mutate and filter empty values from arrays and objects
|
package/dist/utils/normalize.js
CHANGED
|
@@ -24,11 +24,16 @@ export function normalize(object, options) {
|
|
|
24
24
|
schema: options
|
|
25
25
|
};
|
|
26
26
|
let keycase = (_options = options) !== null && _options !== void 0 && _options.kebab ? kebabcase : camelcase;
|
|
27
|
-
return merge([object, (_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.overrides], path => {
|
|
28
|
-
var _options3, _schemas$shift;
|
|
27
|
+
return merge([object, (_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.overrides], (path, value) => {
|
|
28
|
+
var _options3, _schemas$shift, _options4, _options4$skip;
|
|
29
29
|
|
|
30
30
|
let schemas = getSchema((_options3 = options) === null || _options3 === void 0 ? void 0 : _options3.schema, path.map(camelcase));
|
|
31
|
-
let skip = ((_schemas$shift = schemas.shift()) === null || _schemas$shift === void 0 ? void 0 : _schemas$shift.normalize) === false;
|
|
31
|
+
let skip = ((_schemas$shift = schemas.shift()) === null || _schemas$shift === void 0 ? void 0 : _schemas$shift.normalize) === false || ((_options4 = options) === null || _options4 === void 0 ? void 0 : (_options4$skip = _options4.skip) === null || _options4$skip === void 0 ? void 0 : _options4$skip.call(_options4, path, value)); // skip normalizing paths of class instances
|
|
32
|
+
|
|
33
|
+
if (!skip && typeof value === 'object' && value !== null && value !== void 0 && value.constructor) {
|
|
34
|
+
skip = Object.getPrototypeOf(value) !== Object.prototype;
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
path = path.map((k, i) => {
|
|
33
38
|
var _schemas$i;
|
|
34
39
|
|
package/dist/validate.js
CHANGED
|
@@ -165,7 +165,7 @@ function shouldHideError(key, path, error) {
|
|
|
165
165
|
keyword,
|
|
166
166
|
schemaPath
|
|
167
167
|
} = error;
|
|
168
|
-
return !(parentSchema.error || (_parentSchema$errors = parentSchema.errors) !== null && _parentSchema$errors !== void 0 && _parentSchema$errors[keyword]) &&
|
|
168
|
+
return !(parentSchema.error || (_parentSchema$errors = parentSchema.errors) !== null && _parentSchema$errors !== void 0 && _parentSchema$errors[keyword]) && HIDE_NESTED_KEYWORDS.some(k => schemaPath.includes(`/${k}`));
|
|
169
169
|
} // Validates data according to the associated schema and returns a list of errors, if any.
|
|
170
170
|
|
|
171
171
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"test:types": "tsd"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@percy/logger": "1.0.
|
|
37
|
+
"@percy/logger": "1.0.7",
|
|
38
38
|
"ajv": "^8.6.2",
|
|
39
39
|
"cosmiconfig": "^7.0.0",
|
|
40
|
-
"yaml": "^
|
|
40
|
+
"yaml": "^2.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"json-schema-typed": "^7.0.3"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "efd495c0343b8b82d3e6c236e858cdf2cb5e437d"
|
|
46
46
|
}
|