@percy/sdk-utils
Advanced tools
Comparing version 1.0.0-beta.68 to 1.0.0-beta.69
@@ -527,4 +527,12 @@ (function() { | ||
return response; | ||
} // environment specific implementation | ||
} | ||
request.post = function post(url, json) { | ||
return request(url, { | ||
method: 'POST', | ||
body: JSON.stringify(json) | ||
}); | ||
}; // environment specific implementation | ||
if (process.env.__PERCY_BROWSERIFIED__) { | ||
@@ -545,3 +553,3 @@ // use window.fetch in browsers | ||
// use http.request in node | ||
const http = require$$0__default['default']; | ||
const http = require$$0__default["default"]; | ||
@@ -571,3 +579,3 @@ request.fetch = async function fetch(url, options) { | ||
} else { | ||
let socket = new (require$$0__default$1['default'])(url); // allow node to exit with an active connection | ||
let socket = new (require$$0__default$1["default"])(url); // allow node to exit with an active connection | ||
@@ -624,7 +632,5 @@ socket.once('open', () => socket._socket.unref()); | ||
async function postSnapshot(options) { | ||
await request('/percy/snapshot', { | ||
method: 'POST', | ||
body: JSON.stringify(options) | ||
}).catch(err => { | ||
async function postSnapshot(options, params) { | ||
let query = params ? `?${new URLSearchParams(params)}` : ''; | ||
await request.post(`/percy/snapshot${query}`, options).catch(err => { | ||
if (err.response && err.message === 'Closed') { | ||
@@ -647,3 +653,3 @@ info.enabled = false; | ||
exports['default'] = index; | ||
exports["default"] = index; | ||
exports.fetchPercyDOM = fetchPercyDOM; | ||
@@ -658,3 +664,3 @@ exports.isPercyEnabled = isPercyEnabled; | ||
}(this.PercySDKUtils = this.PercySDKUtils || {}, null, null)); | ||
})(this.PercySDKUtils = this.PercySDKUtils || {}, null, null); | ||
}).call(window); | ||
@@ -661,0 +667,0 @@ |
@@ -6,39 +6,39 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "logger", { | ||
exports.default = void 0; | ||
Object.defineProperty(exports, "fetchPercyDOM", { | ||
enumerable: true, | ||
get: function () { | ||
return _logger.default; | ||
return _percyDom.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "percy", { | ||
Object.defineProperty(exports, "isPercyEnabled", { | ||
enumerable: true, | ||
get: function () { | ||
return _percyInfo.default; | ||
return _percyEnabled.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "request", { | ||
Object.defineProperty(exports, "logger", { | ||
enumerable: true, | ||
get: function () { | ||
return _request.default; | ||
return _logger.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "isPercyEnabled", { | ||
Object.defineProperty(exports, "percy", { | ||
enumerable: true, | ||
get: function () { | ||
return _percyEnabled.default; | ||
return _percyInfo.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "fetchPercyDOM", { | ||
Object.defineProperty(exports, "postSnapshot", { | ||
enumerable: true, | ||
get: function () { | ||
return _percyDom.default; | ||
return _postSnapshot.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "postSnapshot", { | ||
Object.defineProperty(exports, "request", { | ||
enumerable: true, | ||
get: function () { | ||
return _postSnapshot.default; | ||
return _request.default; | ||
} | ||
}); | ||
exports.default = void 0; | ||
@@ -45,0 +45,0 @@ var _logger = _interopRequireDefault(require("@percy/logger")); |
@@ -16,7 +16,5 @@ "use strict"; | ||
// error message, signal that Percy has been disabled. | ||
async function postSnapshot(options) { | ||
await (0, _request.default)('/percy/snapshot', { | ||
method: 'POST', | ||
body: JSON.stringify(options) | ||
}).catch(err => { | ||
async function postSnapshot(options, params) { | ||
let query = params ? `?${new URLSearchParams(params)}` : ''; | ||
await _request.default.post(`/percy/snapshot${query}`, options).catch(err => { | ||
if (err.response && err.message === 'Closed') { | ||
@@ -23,0 +21,0 @@ _percyInfo.default.enabled = false; |
@@ -31,5 +31,12 @@ "use strict"; | ||
return response; | ||
} // environment specific implementation | ||
} | ||
request.post = function post(url, json) { | ||
return request(url, { | ||
method: 'POST', | ||
body: JSON.stringify(json) | ||
}); | ||
}; // environment specific implementation | ||
if (process.env.__PERCY_BROWSERIFIED__) { | ||
@@ -36,0 +43,0 @@ // use window.fetch in browsers |
{ | ||
"name": "@percy/sdk-utils", | ||
"version": "1.0.0-beta.68", | ||
"version": "1.0.0-beta.69", | ||
"license": "MIT", | ||
@@ -49,3 +49,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@percy/logger": "1.0.0-beta.68" | ||
"@percy/logger": "1.0.0-beta.69" | ||
}, | ||
@@ -57,3 +57,3 @@ "repository": { | ||
}, | ||
"gitHead": "32ffd12d1db407b7c2b4ca8364f99f90b2cfa862" | ||
"gitHead": "99b0617016a07c9d7d4ca37c1442011c904cf860" | ||
} |
(function() { | ||
this.null = this.null || {}; | ||
this["null"] = this["null"] || {}; | ||
this.PercySDKUtils.TestHelpers = (function (require$$0, require$$2, require$$1$1, require$$2$1) { | ||
@@ -71,3 +71,3 @@ 'use strict'; | ||
const logger$1 = require$$0__default['default']; | ||
const logger$1 = require$$0__default["default"]; | ||
const { | ||
@@ -101,3 +101,3 @@ ANSI_REG | ||
Writable | ||
} = require$$2__default['default']; | ||
} = require$$2__default["default"]; | ||
return Object.assign(new Writable(), { | ||
@@ -167,4 +167,4 @@ isTTY: options && options.isTTY, | ||
reset() { | ||
delete Logger.instance; | ||
reset(soft) { | ||
if (soft) Logger.instance.loglevel('info');else delete Logger.instance; | ||
helpers$1.stdout.length = 0; | ||
@@ -204,3 +204,3 @@ helpers$1.stderr.length = 0; | ||
const logger = helpers_1$1; | ||
const utils = require$$1__default['default']; | ||
const utils = require$$1__default["default"]; | ||
const helpers = { | ||
@@ -290,3 +290,3 @@ logger, | ||
} else { | ||
helpers.context = require$$2__default$1['default'].context(); | ||
helpers.context = require$$2__default$1["default"].context(); | ||
helpers.call = helpers.context.call; | ||
@@ -299,3 +299,3 @@ } | ||
}(PercySDKUtils.logger, null, PercySDKUtils, null)); | ||
})(PercySDKUtils.logger, null, PercySDKUtils, null); | ||
}).call(window); | ||
@@ -302,0 +302,0 @@ |
@@ -48,2 +48,4 @@ // create a testing context for mocking the local percy server and a local testing site | ||
{ success: true, config: { snapshot: { widths: [1280] } } })], | ||
'/percy/config': ({ body }) => [200, 'application/json', ( | ||
{ success: true, config: body })], | ||
'/percy/snapshot': () => [200, 'application/json', { success: true }] | ||
@@ -50,0 +52,0 @@ }, 5338), { |
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
51685
1269
+ Added@percy/logger@1.0.0-beta.69(transitive)
- Removed@percy/logger@1.0.0-beta.68(transitive)
Updated@percy/logger@1.0.0-beta.69