@percy/config 1.26.2 → 1.26.3-alpha.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/defaults.js +2 -1
- package/dist/migrate.js +3 -2
- package/dist/utils/merge.js +6 -4
- package/dist/validate.js +3 -3
- package/package.json +8 -5
package/dist/defaults.js
CHANGED
|
@@ -12,8 +12,9 @@ const {
|
|
|
12
12
|
// the default config schema is used.
|
|
13
13
|
function getDefaultsFromSchema(schema) {
|
|
14
14
|
if (!schema || typeof schema.$ref === 'string') {
|
|
15
|
+
var _schema$$ref;
|
|
15
16
|
// get the schema from ajv
|
|
16
|
-
return getDefaultsFromSchema(getSchema((schema === null || schema === void 0 ? void 0 : schema.$ref)
|
|
17
|
+
return getDefaultsFromSchema(getSchema((_schema$$ref = schema === null || schema === void 0 ? void 0 : schema.$ref) !== null && _schema$$ref !== void 0 ? _schema$$ref : '/config'));
|
|
17
18
|
} else if (schema.default != null) {
|
|
18
19
|
// return the default for this schema
|
|
19
20
|
return schema.default;
|
package/dist/migrate.js
CHANGED
|
@@ -50,9 +50,10 @@ function deprecate(config, log, path, options) {
|
|
|
50
50
|
// Calls each registered migration function with a normalize provided config
|
|
51
51
|
// and util functions for working with the config object
|
|
52
52
|
export function migrate(config, schema = '/config') {
|
|
53
|
-
|
|
53
|
+
var _normalize;
|
|
54
|
+
config = (_normalize = normalize(config, {
|
|
54
55
|
schema
|
|
55
|
-
})
|
|
56
|
+
})) !== null && _normalize !== void 0 ? _normalize : {};
|
|
56
57
|
if (migrations.has(schema)) {
|
|
57
58
|
let log = logger('config');
|
|
58
59
|
let util = {
|
package/dist/utils/merge.js
CHANGED
|
@@ -54,7 +54,8 @@ export function get(object, path, find) {
|
|
|
54
54
|
export function set(object, path, value) {
|
|
55
55
|
return parsePropertyPath(path).reduce((target, key, index, path) => {
|
|
56
56
|
if (index < path.length - 1) {
|
|
57
|
-
|
|
57
|
+
var _target$key;
|
|
58
|
+
(_target$key = target[key]) !== null && _target$key !== void 0 ? _target$key : target[key] = create(isArrayKey(path[index + 1]));
|
|
58
59
|
return target[key];
|
|
59
60
|
} else {
|
|
60
61
|
target[key] = value;
|
|
@@ -148,8 +149,8 @@ export function merge(sources, map) {
|
|
|
148
149
|
|
|
149
150
|
// adjust path to concat array values when necessary
|
|
150
151
|
if (next !== null && (isArray(ctx) || isInteger(key))) {
|
|
151
|
-
var _ctx2;
|
|
152
|
-
path.splice(-1, 1, ((_ctx2 = ctx) === null || _ctx2 === void 0 ? void 0 : _ctx2.length)
|
|
152
|
+
var _ctx$length, _ctx2;
|
|
153
|
+
path.splice(-1, 1, (_ctx$length = (_ctx2 = ctx) === null || _ctx2 === void 0 ? void 0 : _ctx2.length) !== null && _ctx$length !== void 0 ? _ctx$length : 0);
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
// delete prev values
|
|
@@ -159,7 +160,8 @@ export function merge(sources, map) {
|
|
|
159
160
|
|
|
160
161
|
// set the next or default value if there is one
|
|
161
162
|
if (next != null || next !== null && value != null && !hasKeys(value)) {
|
|
162
|
-
|
|
163
|
+
var _target;
|
|
164
|
+
set((_target = target) !== null && _target !== void 0 ? _target : target = create(isSourceArray), path, next !== null && next !== void 0 ? next : value);
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
// do not recurse mapped objects
|
package/dist/validate.js
CHANGED
|
@@ -74,11 +74,11 @@ function getDefaultSchema() {
|
|
|
74
74
|
// Gets the schema object from the AJV schema. If a path is provided, an array of schemas is
|
|
75
75
|
// returned, with each index representing the schema of each part of the path (index zero is root).
|
|
76
76
|
export function getSchema(name, path, root) {
|
|
77
|
-
var _ajv$getSchema, _ref, _schema$properties;
|
|
77
|
+
var _ajv$getSchema, _root, _ref, _schema$properties;
|
|
78
78
|
// get the root schema if necessary, resolve it, and return it when there is no path
|
|
79
79
|
let schema = typeof name === 'string' ? (_ajv$getSchema = ajv.getSchema(name)) === null || _ajv$getSchema === void 0 ? void 0 : _ajv$getSchema.schema : name;
|
|
80
|
-
if (!schema || !path) return schema
|
|
81
|
-
root
|
|
80
|
+
if (!schema || !path) return schema !== null && schema !== void 0 ? schema : [];
|
|
81
|
+
(_root = root) !== null && _root !== void 0 ? _root : root = schema;
|
|
82
82
|
|
|
83
83
|
// parse and work with one key at a time
|
|
84
84
|
let [key, ...rest] = path = parsePropertyPath(path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/config",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.3-alpha.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public",
|
|
12
|
-
"tag": "
|
|
12
|
+
"tag": "alpha"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=14"
|
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
"types": "./types/index.d.ts",
|
|
24
24
|
"type": "module",
|
|
25
25
|
"exports": {
|
|
26
|
-
".":
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./types/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
27
30
|
"./utils": "./dist/utils/index.js",
|
|
28
31
|
"./test/helpers": "./test/helpers.js"
|
|
29
32
|
},
|
|
@@ -35,7 +38,7 @@
|
|
|
35
38
|
"test:types": "tsd"
|
|
36
39
|
},
|
|
37
40
|
"dependencies": {
|
|
38
|
-
"@percy/logger": "1.26.
|
|
41
|
+
"@percy/logger": "1.26.3-alpha.4",
|
|
39
42
|
"ajv": "^8.6.2",
|
|
40
43
|
"cosmiconfig": "^8.0.0",
|
|
41
44
|
"yaml": "^2.0.0"
|
|
@@ -43,5 +46,5 @@
|
|
|
43
46
|
"devDependencies": {
|
|
44
47
|
"json-schema-typed": "^7.0.3"
|
|
45
48
|
},
|
|
46
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "d89ab97b8d5169eafd3eb42bdbbef41a2ac624ba"
|
|
47
50
|
}
|