@percy/core
Advanced tools
Comparing version 1.0.0-beta.61 to 1.0.0-beta.62
@@ -6,5 +6,6 @@ "use strict"; | ||
}); | ||
exports.migration = migration; | ||
exports.configMigration = configMigration; | ||
exports.snapshotMigration = snapshotMigration; | ||
exports.getSnapshotConfig = getSnapshotConfig; | ||
exports.schemas = exports.snapshotDOMSchema = exports.snapshotSchema = exports.configSchema = void 0; | ||
exports.migrations = exports.schemas = exports.snapshotDOMSchema = exports.snapshotSchema = exports.configSchema = void 0; | ||
@@ -277,10 +278,7 @@ var _assert = require("assert"); | ||
} | ||
}; // Convinient reference for schema registration | ||
}; // Config migrate function | ||
exports.snapshotDOMSchema = snapshotDOMSchema; | ||
const schemas = [configSchema, snapshotSchema, snapshotDOMSchema]; // Migration function | ||
exports.schemas = schemas; | ||
function migration(config, { | ||
function configMigration(config, { | ||
map, | ||
@@ -310,5 +308,31 @@ del, | ||
} | ||
} // Validate and merge per-snapshot configuration options with global configuration options. | ||
} // Snapshot option migrate function | ||
function snapshotMigration(config, { | ||
map, | ||
log | ||
}) { | ||
// discovery options have moved | ||
for (let k of ['authorization', 'requestHeaders']) { | ||
if (config[k]) { | ||
log.warn(`Warning: The snapshot option \`${k}\` ` + `will be removed in 1.0.0. Use \`discovery.${k}\` instead.`); | ||
map(k, `discovery.${k}`); | ||
} | ||
} // snapshots was renamed | ||
if (config.snapshots) { | ||
log.warn('Warning: The `snapshots` option will be ' + 'removed in 1.0.0. Use `additionalSnapshots` instead.'); | ||
map('snapshots', 'additionalSnapshots'); | ||
} | ||
} // Convinient references for schema registrations | ||
const schemas = [configSchema, snapshotSchema, snapshotDOMSchema]; | ||
exports.schemas = schemas; | ||
const migrations = [['/config', configMigration], ['/snapshot', snapshotMigration]]; // Validate and merge per-snapshot configuration options with global configuration options. | ||
exports.migrations = migrations; | ||
function getSnapshotConfig(options, { | ||
@@ -318,30 +342,15 @@ snapshot, | ||
}, log) { | ||
var _ref, _options$widths; | ||
var _ref, _config$widths; | ||
options = _config.default.normalize(options, { | ||
schema: '/snapshot/dom' | ||
}); // throw an error when missing required options | ||
// prune client and env info from being validated | ||
let { | ||
clientInfo, | ||
environmentInfo, | ||
...config | ||
} = _config.default.migrate(options, '/snapshot'); // throw an error when missing required options | ||
(0, _assert.strict)(options.url, 'Missing required URL for snapshot'); | ||
(0, _assert.strict)((_ref = (_options$widths = options.widths) !== null && _options$widths !== void 0 ? _options$widths : snapshot.widths) === null || _ref === void 0 ? void 0 : _ref.length, 'Missing required widths for snapshot'); // prune options from being validated | ||
let config = (0, _utils.merge)([options, { | ||
clientInfo: null, | ||
environmentInfo: null | ||
}], (path, prev, next) => { | ||
// move deprecated options before validating | ||
switch (path.join('.')) { | ||
case 'authorization': | ||
case 'requestHeaders': | ||
// discovery options have moved | ||
log.warn(`Warning: The snapshot option \`${path}\` ` + `will be removed in 1.0.0. Use \`discovery.${path}\` instead.`); | ||
return [path.unshift('discovery')]; | ||
(0, _assert.strict)(config.url, 'Missing required URL for snapshot'); | ||
(0, _assert.strict)((_ref = (_config$widths = config.widths) !== null && _config$widths !== void 0 ? _config$widths : snapshot.widths) === null || _ref === void 0 ? void 0 : _ref.length, 'Missing required widths for snapshot'); // validate and scrub according to dom snaphot presence | ||
case 'snapshots': | ||
// snapshots was renamed | ||
log.warn('Warning: The `snapshots` option will be ' + 'removed in 1.0.0. Use `additionalSnapshots` instead.'); | ||
return ['additionalSnapshots']; | ||
} | ||
}); // validate and scrub according to dom snaphot presence | ||
let errors = _config.default.validate(config, config.domSnapshot ? '/snapshot/dom' : '/snapshot'); | ||
@@ -362,4 +371,4 @@ | ||
// add back client and environment information | ||
clientInfo: options.clientInfo, | ||
environmentInfo: options.environmentInfo, | ||
clientInfo, | ||
environmentInfo, | ||
// only specific discovery options are used per-snapshot | ||
@@ -366,0 +375,0 @@ discovery: { |
@@ -11,4 +11,4 @@ "use strict"; | ||
PercyConfig.addSchema(CoreConfig.schemas); | ||
PercyConfig.addMigration(CoreConfig.migration); // Export the Percy class with commonjs compatibility | ||
PercyConfig.addMigration(CoreConfig.migrations); // Export the Percy class with commonjs compatibility | ||
module.exports = require('./percy').default; |
{ | ||
"name": "@percy/core", | ||
"version": "1.0.0-beta.61", | ||
"version": "1.0.0-beta.62", | ||
"license": "MIT", | ||
@@ -28,10 +28,10 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@percy/client": "1.0.0-beta.61", | ||
"@percy/config": "1.0.0-beta.61", | ||
"@percy/dom": "1.0.0-beta.61", | ||
"@percy/logger": "1.0.0-beta.61", | ||
"@percy/client": "1.0.0-beta.62", | ||
"@percy/config": "1.0.0-beta.62", | ||
"@percy/dom": "1.0.0-beta.62", | ||
"@percy/logger": "1.0.0-beta.62", | ||
"cross-spawn": "^7.0.3", | ||
"extract-zip": "^2.0.1", | ||
"rimraf": "^3.0.2", | ||
"ws": "^7.5.3" | ||
"ws": "^8.0.0" | ||
}, | ||
@@ -43,3 +43,3 @@ "repository": { | ||
}, | ||
"gitHead": "d84fd8554186f66eaedcbd992fc8f089114952ab" | ||
"gitHead": "19d3d437ddec15a0b2760758c2564dd79d99c024" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103014
2255
+ Added@percy/client@1.0.0-beta.62(transitive)
+ Added@percy/config@1.0.0-beta.62(transitive)
+ Added@percy/dom@1.0.0-beta.62(transitive)
+ Added@percy/env@1.0.0-beta.62(transitive)
+ Added@percy/logger@1.0.0-beta.62(transitive)
+ Addedws@8.18.0(transitive)
- Removed@percy/client@1.0.0-beta.61(transitive)
- Removed@percy/config@1.0.0-beta.61(transitive)
- Removed@percy/dom@1.0.0-beta.61(transitive)
- Removed@percy/env@1.0.0-beta.61(transitive)
- Removed@percy/logger@1.0.0-beta.61(transitive)
- Removedws@7.5.10(transitive)
Updated@percy/client@1.0.0-beta.62
Updated@percy/config@1.0.0-beta.62
Updated@percy/dom@1.0.0-beta.62
Updated@percy/logger@1.0.0-beta.62
Updatedws@^8.0.0