@percy/agent
Advanced tools
Comparing version 0.19.3 to 0.19.4
@@ -1,1 +0,1 @@ | ||
{"version":"0.19.3","commands":{"exec":{"id":"exec","description":"Start and stop Percy around a supplied command.","pluginName":"@percy/agent","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy exec -- echo \"percy is running around this echo command\"","$ percy exec -- bash -c \"echo foo && echo bar\""],"flags":{"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[]},"finalize":{"id":"finalize","description":"Finalize a build. Commonly used for parallelized builds, especially when the number of parallelized processes is unknown.","pluginName":"@percy/agent","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy finalize --all\n[percy] Finalized parallel build."],"flags":{"all":{"name":"all","type":"boolean","char":"a","required":true,"allowNo":false}},"args":[]},"health-check":{"id":"health-check","description":"Determines if the Percy Agent process is currently running","pluginName":"@percy/agent","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy healthcheck","$ percy healthcheck --port 6884"],"flags":{"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port","default":5338}},"args":[]},"percy-command":{"id":"percy-command","pluginName":"@percy/agent","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"snapshot":{"id":"snapshot","description":"Snapshot a directory containing a pre-built static website.","pluginName":"@percy/agent","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy snapshot _site/","$ percy snapshot _site/ --base-url \"/blog/\"","$ percy snapshot _site/ --ignore-files \"/blog/drafts/**\""],"flags":{"snapshot-files":{"name":"snapshot-files","type":"option","char":"s","description":"[default: **/*.html,**/*.htm] Glob or comma-seperated string of globs for matching the files and directories to snapshot."},"ignore-files":{"name":"ignore-files","type":"option","char":"i","description":"[default: ] Glob or comma-seperated string of globs for matching the files and directories to ignore."},"base-url":{"name":"base-url","type":"option","char":"b","description":"[default: /] If your static files will be hosted in a subdirectory, instead of the webserver's root path, set that subdirectory with this flag."},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[{"name":"snapshotDirectory","description":"[default: .] A path to the directory you would like to snapshot"}]},"start":{"id":"start","description":"Starts the percy process.","pluginName":"@percy/agent","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy start\ninfo: percy has started on port 5338."],"flags":{"detached":{"name":"detached","type":"boolean","char":"d","description":"start as a detached process","allowNo":false},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[]},"stop":{"id":"stop","description":"Stops the percy process.","pluginName":"@percy/agent","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy stop\ninfo: percy has stopped."],"flags":{"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"}},"args":[]},"upload":{"id":"upload","description":"Upload a directory containing static snapshot images.","pluginName":"@percy/agent","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy upload _images/","$ percy upload _images/ --files **/*.png"],"flags":{"files":{"name":"files","type":"option","char":"f","description":"[default: **/*.png,**/*.jpg,**/*.jpeg] Glob or comma-seperated string of globs for matching the files and directories to snapshot."},"ignore":{"name":"ignore","type":"option","char":"i","description":"[default: ] Glob or comma-seperated string of globs for matching the files and directories to ignore."},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[{"name":"uploadDirectory","description":"[default: .] A path to the directory containing static snapshot images"}]}}} | ||
{"version":"0.19.4","commands":{"exec":{"id":"exec","description":"Start and stop Percy around a supplied command.","pluginName":"@percy/agent","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy exec -- echo \"percy is running around this echo command\"","$ percy exec -- bash -c \"echo foo && echo bar\""],"flags":{"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[]},"finalize":{"id":"finalize","description":"Finalize a build. Commonly used for parallelized builds, especially when the number of parallelized processes is unknown.","pluginName":"@percy/agent","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy finalize --all\n[percy] Finalized parallel build."],"flags":{"all":{"name":"all","type":"boolean","char":"a","required":true,"allowNo":false}},"args":[]},"health-check":{"id":"health-check","description":"Determines if the Percy Agent process is currently running","pluginName":"@percy/agent","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy healthcheck","$ percy healthcheck --port 6884"],"flags":{"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port","default":5338}},"args":[]},"percy-command":{"id":"percy-command","pluginName":"@percy/agent","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"snapshot":{"id":"snapshot","description":"Snapshot a directory containing a pre-built static website.","pluginName":"@percy/agent","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy snapshot _site/","$ percy snapshot _site/ --base-url \"/blog/\"","$ percy snapshot _site/ --ignore-files \"/blog/drafts/**\""],"flags":{"snapshot-files":{"name":"snapshot-files","type":"option","char":"s","description":"[default: **/*.html,**/*.htm] Glob or comma-seperated string of globs for matching the files and directories to snapshot."},"ignore-files":{"name":"ignore-files","type":"option","char":"i","description":"[default: ] Glob or comma-seperated string of globs for matching the files and directories to ignore."},"base-url":{"name":"base-url","type":"option","char":"b","description":"[default: /] If your static files will be hosted in a subdirectory, instead of the webserver's root path, set that subdirectory with this flag."},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[{"name":"snapshotDirectory","description":"[default: .] A path to the directory you would like to snapshot"}]},"start":{"id":"start","description":"Starts the percy process.","pluginName":"@percy/agent","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy start\ninfo: percy has started on port 5338."],"flags":{"detached":{"name":"detached","type":"boolean","char":"d","description":"start as a detached process","allowNo":false},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[]},"stop":{"id":"stop","description":"Stops the percy process.","pluginName":"@percy/agent","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy stop\ninfo: percy has stopped."],"flags":{"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"}},"args":[]},"upload":{"id":"upload","description":"Upload a directory containing static snapshot images.","pluginName":"@percy/agent","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy upload _images/","$ percy upload _images/ --files **/*.png"],"flags":{"files":{"name":"files","type":"option","char":"f","description":"[default: **/*.png,**/*.jpg,**/*.jpeg] Glob or comma-seperated string of globs for matching the files and directories to snapshot."},"ignore":{"name":"ignore","type":"option","char":"i","description":"[default: ] Glob or comma-seperated string of globs for matching the files and directories to ignore."},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[{"name":"uploadDirectory","description":"[default: .] A path to the directory containing static snapshot images"}]}}} |
@@ -0,1 +1,8 @@ | ||
## [0.19.4](https://github.com/percy/percy-agent/compare/v0.19.3...v0.19.4) (2019-10-29) | ||
### Bug Fixes | ||
* Trim whitespace from CSS ownerNode innerText ([#406](https://github.com/percy/percy-agent/issues/406)) ([5a4f830](https://github.com/percy/percy-agent/commit/5a4f830)) | ||
## [0.19.3](https://github.com/percy/percy-agent/compare/v0.19.2...v0.19.3) (2019-10-28) | ||
@@ -2,0 +9,0 @@ |
@@ -147,3 +147,4 @@ "use strict"; | ||
const ownerNode = styleSheet.ownerNode; | ||
const hasStyleInDom = ownerNode.innerText && ownerNode.innerText.length > 0; | ||
const ownerNodeInnerContent = ownerNode.innerText && ownerNode.innerText.trim(); | ||
const hasStyleInDom = ownerNodeInnerContent.length > 0; | ||
return !hasHref && !hasStyleInDom && styleSheet.cssRules; | ||
@@ -150,0 +151,0 @@ } |
@@ -1,1 +0,1 @@ | ||
window.PercyAgent=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r=5338;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"originalDOM",void 0),i(this,"clonedDOM",void 0),i(this,"options",void 0),i(this,"defaultDoctype","<!DOCTYPE html>"),this.originalDOM=t,this.options=n||{},this.clonedDOM=this.cloneDOM()}var t,n,r;return t=e,(n=[{key:"snapshotString",value:function(){var e=this.clonedDOM,t=this.getDoctype();if(this.options.domTransformation)try{e=this.options.domTransformation(e)}catch(e){console.error("Could not transform the dom: ",e)}return t+e.outerHTML}},{key:"getDoctype",value:function(){return this.clonedDOM.doctype?this.doctypeToString(this.clonedDOM.doctype):this.defaultDoctype}},{key:"doctypeToString",value:function(e){var t=e.publicId?' PUBLIC "'.concat(e.publicId,'" '):"",n=e.systemId?' SYSTEM "'.concat(e.systemId,'" '):"";return"<!DOCTYPE ".concat(e.name)+t+n+">"}},{key:"cloneDOM",value:function(){this.mutateOriginalDOM();var e=this.originalDOM.cloneNode(!0);return e=this.stabilizeDOM(e)}},{key:"stabilizeDOM",value:function(e){return this.serializeInputElements(e),this.options.enableJavaScript||this.serializeCSSOM(e),e.documentElement}},{key:"serializeInputElements",value:function(e){var t=this.originalDOM.querySelectorAll("input, textarea, select");Array.from(t).forEach(function(t){var n=t.getAttribute("data-percy-element-id"),r='[data-percy-element-id="'.concat(n,'"]'),o=e.querySelector(r);switch(t.type){case"checkbox":case"radio":t.checked&&o.setAttribute("checked","");break;case"select-one":-1!==t.selectedIndex&&o.options[t.selectedIndex].setAttribute("selected","true");break;case"select-multiple":var i=Array.from(t.selectedOptions),a=Array.from(o.options);i.length&&i.forEach(function(e){a.find(function(t){return e.text===t.text}).setAttribute("selected","true")});break;case"textarea":o.innerHTML=t.value;break;default:o.setAttribute("value",t.value)}})}},{key:"serializeCSSOM",value:function(e){Array.from(this.originalDOM.styleSheets).forEach(function(t){if(o=t.href,i=t.ownerNode,a=i.innerText&&i.innerText.length>0,!o&&!a&&t.cssRules){var n=e.createElement("style"),r=Array.from(t.cssRules).reduce(function(e,t){return e+t.cssText},"");n.type="text/css",n.setAttribute("data-percy-cssom-serialized","true"),n.innerHTML=r,e.head.appendChild(n)}var o,i,a})}},{key:"mutateOriginalDOM",value:function(){var e=this.originalDOM.querySelectorAll("input, textarea, select");Array.from(e).forEach(function(e){var t,n;e.getAttribute("data-percy-element-id")||(t=e,n="_".concat(Math.random().toString(36).substr(2,9)),t.setAttribute("data-percy-element-id",n))})}}])&&o(t.prototype,n),r&&o(t,r),e}();function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"xhr",void 0),s(this,"agentHost",void 0),s(this,"agentConnected",!1),this.agentHost=t,this.xhr=new n||new XMLHttpRequest,this.healthCheck()}var t,n,r;return t=e,(n=[{key:"post",value:function(e,t){this.agentConnected?(this.xhr.open("post","".concat(this.agentHost).concat(e),!1),this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(JSON.stringify(t))):console.warn("percy agent not started.")}},{key:"healthCheck",value:function(){var e=this;try{this.xhr.open("get","".concat(this.agentHost).concat("/percy/healthcheck"),!1),this.xhr.onload=function(){200===e.xhr.status&&(e.agentConnected=!0)},this.xhr.send()}catch(e){this.agentConnected=!1}}}])&&c(t.prototype,n),r&&c(t,r),e}();function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(n,!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var p=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"clientInfo",void 0),d(this,"environmentInfo",void 0),d(this,"xhr",void 0),d(this,"handleAgentCommunication",void 0),d(this,"port",void 0),d(this,"domTransformation",void 0),d(this,"client",null),this.clientInfo=t.clientInfo||null,this.environmentInfo=t.environmentInfo||null,this.handleAgentCommunication=!1!==t.handleAgentCommunication,this.domTransformation=t.domTransformation||null,this.port=t.port||r,this.handleAgentCommunication&&(this.xhr=t.xhr||XMLHttpRequest,this.client=new l("http://localhost:".concat(this.port),this.xhr))}var t,n,o;return t=e,(n=[{key:"snapshot",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.document||document,r=this.domSnapshot(n,t);return this.handleAgentCommunication&&this.client&&this.client.post("/percy/snapshot",{name:e,url:n.URL,percyCSS:t.percyCSS,enableJavaScript:t.enableJavaScript||t.enableJavascript,widths:t.widths,minHeight:t.minHeight||t.minimumHeight,clientInfo:this.clientInfo,environmentInfo:this.environmentInfo,domSnapshot:r}),r}},{key:"domSnapshot",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new a(e,h({},t,{domTransformation:this.domTransformation}));return n.snapshotString()}}])&&f(t.prototype,n),o&&f(t,o),e}();t.default=p}]).default; | ||
window.PercyAgent=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r=5338;function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,"originalDOM",void 0),o(this,"clonedDOM",void 0),o(this,"options",void 0),o(this,"defaultDoctype","<!DOCTYPE html>"),this.originalDOM=t,this.options=n||{},this.clonedDOM=this.cloneDOM()}var t,n,r;return t=e,(n=[{key:"snapshotString",value:function(){var e=this.clonedDOM,t=this.getDoctype();if(this.options.domTransformation)try{e=this.options.domTransformation(e)}catch(e){console.error("Could not transform the dom: ",e)}return t+e.outerHTML}},{key:"getDoctype",value:function(){return this.clonedDOM.doctype?this.doctypeToString(this.clonedDOM.doctype):this.defaultDoctype}},{key:"doctypeToString",value:function(e){var t=e.publicId?' PUBLIC "'.concat(e.publicId,'" '):"",n=e.systemId?' SYSTEM "'.concat(e.systemId,'" '):"";return"<!DOCTYPE ".concat(e.name)+t+n+">"}},{key:"cloneDOM",value:function(){this.mutateOriginalDOM();var e=this.originalDOM.cloneNode(!0);return e=this.stabilizeDOM(e)}},{key:"stabilizeDOM",value:function(e){return this.serializeInputElements(e),this.options.enableJavaScript||this.serializeCSSOM(e),e.documentElement}},{key:"serializeInputElements",value:function(e){var t=this.originalDOM.querySelectorAll("input, textarea, select");Array.from(t).forEach(function(t){var n=t.getAttribute("data-percy-element-id"),r='[data-percy-element-id="'.concat(n,'"]'),i=e.querySelector(r);switch(t.type){case"checkbox":case"radio":t.checked&&i.setAttribute("checked","");break;case"select-one":-1!==t.selectedIndex&&i.options[t.selectedIndex].setAttribute("selected","true");break;case"select-multiple":var o=Array.from(t.selectedOptions),a=Array.from(i.options);o.length&&o.forEach(function(e){a.find(function(t){return e.text===t.text}).setAttribute("selected","true")});break;case"textarea":i.innerHTML=t.value;break;default:i.setAttribute("value",t.value)}})}},{key:"serializeCSSOM",value:function(e){Array.from(this.originalDOM.styleSheets).forEach(function(t){if(i=t.href,o=t.ownerNode,a=(o.innerText&&o.innerText.trim()).length>0,!i&&!a&&t.cssRules){var n=e.createElement("style"),r=Array.from(t.cssRules).reduce(function(e,t){return e+t.cssText},"");n.type="text/css",n.setAttribute("data-percy-cssom-serialized","true"),n.innerHTML=r,e.head.appendChild(n)}var i,o,a})}},{key:"mutateOriginalDOM",value:function(){var e=this.originalDOM.querySelectorAll("input, textarea, select");Array.from(e).forEach(function(e){var t,n;e.getAttribute("data-percy-element-id")||(t=e,n="_".concat(Math.random().toString(36).substr(2,9)),t.setAttribute("data-percy-element-id",n))})}}])&&i(t.prototype,n),r&&i(t,r),e}();function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"xhr",void 0),s(this,"agentHost",void 0),s(this,"agentConnected",!1),this.agentHost=t,this.xhr=new n||new XMLHttpRequest,this.healthCheck()}var t,n,r;return t=e,(n=[{key:"post",value:function(e,t){this.agentConnected?(this.xhr.open("post","".concat(this.agentHost).concat(e),!1),this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(JSON.stringify(t))):console.warn("percy agent not started.")}},{key:"healthCheck",value:function(){var e=this;try{this.xhr.open("get","".concat(this.agentHost).concat("/percy/healthcheck"),!1),this.xhr.onload=function(){200===e.xhr.status&&(e.agentConnected=!0)},this.xhr.send()}catch(e){this.agentConnected=!1}}}])&&c(t.prototype,n),r&&c(t,r),e}();function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(n,!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var p=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"clientInfo",void 0),d(this,"environmentInfo",void 0),d(this,"xhr",void 0),d(this,"handleAgentCommunication",void 0),d(this,"port",void 0),d(this,"domTransformation",void 0),d(this,"client",null),this.clientInfo=t.clientInfo||null,this.environmentInfo=t.environmentInfo||null,this.handleAgentCommunication=!1!==t.handleAgentCommunication,this.domTransformation=t.domTransformation||null,this.port=t.port||r,this.handleAgentCommunication&&(this.xhr=t.xhr||XMLHttpRequest,this.client=new l("http://localhost:".concat(this.port),this.xhr))}var t,n,i;return t=e,(n=[{key:"snapshot",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.document||document,r=this.domSnapshot(n,t);return this.handleAgentCommunication&&this.client&&this.client.post("/percy/snapshot",{name:e,url:n.URL,percyCSS:t.percyCSS,enableJavaScript:t.enableJavaScript||t.enableJavascript,widths:t.widths,minHeight:t.minHeight||t.minimumHeight,clientInfo:this.clientInfo,environmentInfo:this.environmentInfo,domSnapshot:r}),r}},{key:"domSnapshot",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new a(e,h({},t,{domTransformation:this.domTransformation}));return n.snapshotString()}}])&&f(t.prototype,n),i&&f(t,i),e}();t.default=p}]).default; |
{ | ||
"name": "@percy/agent", | ||
"description": "An agent process for integrating with Percy.", | ||
"version": "0.19.3", | ||
"version": "0.19.4", | ||
"author": "Perceptual Inc", | ||
@@ -6,0 +6,0 @@ "bin": { |
@@ -24,3 +24,3 @@ @percy/agent | ||
$ percy (-v|--version|version) | ||
@percy/agent/0.19.3 linux-x64 node-v8.16.2 | ||
@percy/agent/0.19.4 linux-x64 node-v8.16.2 | ||
$ percy --help [COMMAND] | ||
@@ -59,3 +59,3 @@ USAGE | ||
_See code: [dist/commands/exec.ts](https://github.com/percy/percy-agent/blob/v0.19.3/dist/commands/exec.ts)_ | ||
_See code: [dist/commands/exec.ts](https://github.com/percy/percy-agent/blob/v0.19.4/dist/commands/exec.ts)_ | ||
@@ -78,3 +78,3 @@ ## `percy finalize` | ||
_See code: [dist/commands/finalize.ts](https://github.com/percy/percy-agent/blob/v0.19.3/dist/commands/finalize.ts)_ | ||
_See code: [dist/commands/finalize.ts](https://github.com/percy/percy-agent/blob/v0.19.4/dist/commands/finalize.ts)_ | ||
@@ -134,3 +134,3 @@ ## `percy help [COMMAND]` | ||
_See code: [dist/commands/snapshot.ts](https://github.com/percy/percy-agent/blob/v0.19.3/dist/commands/snapshot.ts)_ | ||
_See code: [dist/commands/snapshot.ts](https://github.com/percy/percy-agent/blob/v0.19.4/dist/commands/snapshot.ts)_ | ||
@@ -162,3 +162,3 @@ ## `percy upload [UPLOADDIRECTORY]` | ||
_See code: [dist/commands/upload.ts](https://github.com/percy/percy-agent/blob/v0.19.3/dist/commands/upload.ts)_ | ||
_See code: [dist/commands/upload.ts](https://github.com/percy/percy-agent/blob/v0.19.4/dist/commands/upload.ts)_ | ||
<!-- commandsstop --> |
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
142822
2533