react-helmet-async
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,2 +0,2 @@ | ||
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("react-fast-compare")),r=e(require("invariant")),n=e(require("prop-types")),o=require("react"),i=e(o),a=e(require("shallowequal")),s={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},c=Object.keys(s).map(function(e){return s[e]}),u={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},l=Object.keys(u).reduce(function(e,t){return e[u[t]]=t,e},{}),p=function(e,t){for(var r=e.length-1;r>=0;r-=1){var n=e[r];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},d=function(e){var t=p(e,s.TITLE),r=p(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),r&&t)return r.replace(/%s/g,function(){return t});var n=p(e,"defaultTitle");return t||n||void 0},f=function(e){return p(e,"onChangeClientState")||function(){}},h=function(e,t){return t.filter(function(t){return void 0!==t[e]}).map(function(t){return t[e]}).reduce(function(e,t){return Object.assign({},e,t)},{})},y=function(e,t){return t.filter(function(e){return void 0!==e[s.BASE]}).map(function(e){return e[s.BASE]}).reverse().reduce(function(t,r){if(!t.length)for(var n=Object.keys(r),o=0;o<n.length;o+=1){var i=n[o].toLowerCase();if(-1!==e.indexOf(i)&&r[i])return t.concat(r)}return t},[])},m=function(e,t,r){var n={};return r.filter(function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)}).map(function(t){return t[e]}).reverse().reduce(function(e,r){var o={};r.filter(function(e){for(var r,i=Object.keys(e),a=0;a<i.length;a+=1){var s=i[a],c=s.toLowerCase();-1===t.indexOf(c)||"rel"===r&&"canonical"===e[r].toLowerCase()||"rel"===c&&"stylesheet"===e[c].toLowerCase()||(r=c),-1===t.indexOf(s)||"innerHTML"!==s&&"cssText"!==s&&"itemprop"!==s||(r=s)}if(!r||!e[r])return!1;var u=e[r].toLowerCase();return n[r]||(n[r]={}),o[r]||(o[r]={}),!n[r][u]&&(o[r][u]=!0,!0)}).reverse().forEach(function(t){return e.push(t)});for(var i=Object.keys(o),a=0;a<i.length;a+=1){var s=i[a],c=Object.assign({},n[s],o[s]);n[s]=c}return e},[]).reverse()},T=function(e){return Array.isArray(e)?e.join(""):e},b=[s.NOSCRIPT,s.SCRIPT,s.STYLE],g=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},v=function(e){return Object.keys(e).reduce(function(t,r){var n=void 0!==e[r]?r+'="'+e[r]+'"':""+r;return t?t+" "+n:n},"")},A=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce(function(t,r){return t[u[r]||r]=e[r],t},t)},C=function(e,t,r){switch(e){case s.TITLE:return{toComponent:function(){return r=A(t.titleAttributes,{key:e=t.title,"data-rh":!0}),[i.createElement(s.TITLE,r,e)];var e,r},toString:function(){return function(e,r,n,o){var i=v(t.titleAttributes),a=T(r);return i?"<"+e+' data-rh="true" '+i+">"+g(a,o)+"</"+e+">":"<"+e+' data-rh="true">'+g(a,o)+"</"+e+">"}(e,t.title,0,r)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return A(t)},toString:function(){return v(t)}};default:return{toComponent:function(){return function(e,t){return t.map(function(t,r){var n={key:r,"data-rh":!0};return Object.keys(t).forEach(function(e){var r=u[e]||e;"innerHTML"===r||"cssText"===r?n.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:n[r]=t[e]}),i.createElement(e,n)})}(e,t)},toString:function(){return function(e,t,r){return t.reduce(function(t,n){var o=Object.keys(n).filter(function(e){return!("innerHTML"===e||"cssText"===e)}).reduce(function(e,t){var o=void 0===n[t]?t:t+'="'+g(n[t],r)+'"';return e?e+" "+o:o},""),i=n.innerHTML||n.cssText||"",a=-1===b.indexOf(e);return t+"<"+e+' data-rh="true" '+o+(a?"/>":">"+i+"</"+e+">")},"")}(e,t,r)}}}},O=function(e){var t=e.bodyAttributes,r=e.encode,n=e.htmlAttributes,o=e.linkTags,i=e.metaTags,a=e.noscriptTags,c=e.scriptTags,u=e.styleTags,l=e.title;void 0===l&&(l="");var p=e.titleAttributes;return{base:C(s.BASE,e.baseTag,r),bodyAttributes:C("bodyAttributes",t,r),htmlAttributes:C("htmlAttributes",n,r),link:C(s.LINK,o,r),meta:C(s.META,i,r),noscript:C(s.NOSCRIPT,a,r),script:C(s.SCRIPT,c,r),style:C(s.STYLE,u,r),title:C(s.TITLE,{title:l,titleAttributes:p},r)}},j=i.createContext({}),E=n.shape({setHelmet:n.func,helmetInstances:n.shape({get:n.func,add:n.func,remove:n.func})}),S="undefined"!=typeof document,I=function(e){function t(r){var n=this;e.call(this,r),this.instances=[],this.value={setHelmet:function(e){n.props.context.helmet=e},helmetInstances:{get:function(){return n.instances},add:function(e){n.instances.push(e)},remove:function(e){var t=n.instances.indexOf(e);n.instances.splice(t,1)}}},t.canUseDOM||(r.context.helmet=O({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.render=function(){return i.createElement(j.Provider,{value:this.value},this.props.children)},t}(o.Component);I.canUseDOM=S,I.propTypes={context:n.shape({helmet:n.shape()}),children:n.node.isRequired},I.defaultProps={context:{}},I.displayName="HelmetProvider";var P=function(e,t){var r,n=document.head||document.querySelector(s.HEAD),o=n.querySelectorAll(e+"[data-rh]"),i=[].slice.call(o),a=[];return t&&t.length&&t.forEach(function(t){var n=document.createElement(e);for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&("innerHTML"===o?n.innerHTML=t.innerHTML:"cssText"===o?n.styleSheet?n.styleSheet.cssText=t.cssText:n.appendChild(document.createTextNode(t.cssText)):n.setAttribute(o,void 0===t[o]?"":t[o]));n.setAttribute("data-rh","true"),i.some(function(e,t){return r=t,n.isEqualNode(e)})?i.splice(r,1):a.push(n)}),i.forEach(function(e){return e.parentNode.removeChild(e)}),a.forEach(function(e){return n.appendChild(e)}),{oldTags:i,newTags:a}},x=function(e,t){var r=document.getElementsByTagName(e)[0];if(r){for(var n=r.getAttribute("data-rh"),o=n?n.split(","):[],i=[].concat(o),a=Object.keys(t),s=0;s<a.length;s+=1){var c=a[s],u=t[c]||"";r.getAttribute(c)!==u&&r.setAttribute(c,u),-1===o.indexOf(c)&&o.push(c);var l=i.indexOf(c);-1!==l&&i.splice(l,1)}for(var p=i.length-1;p>=0;p-=1)r.removeAttribute(i[p]);o.length===i.length?r.removeAttribute("data-rh"):r.getAttribute("data-rh")!==a.join(",")&&r.setAttribute("data-rh",a.join(","))}},L=function(e,t){var r=e.baseTag,n=e.htmlAttributes,o=e.linkTags,i=e.metaTags,a=e.noscriptTags,c=e.onChangeClientState,u=e.scriptTags,l=e.styleTags,p=e.title,d=e.titleAttributes;x(s.BODY,e.bodyAttributes),x(s.HTML,n),function(e,t){void 0!==e&&document.title!==e&&(document.title=T(e)),x(s.TITLE,t)}(p,d);var f={baseTag:P(s.BASE,r),linkTags:P(s.LINK,o),metaTags:P(s.META,i),noscriptTags:P(s.NOSCRIPT,a),scriptTags:P(s.SCRIPT,u),styleTags:P(s.STYLE,l)},h={},y={};Object.keys(f).forEach(function(e){var t=f[e],r=t.newTags,n=t.oldTags;r.length&&(h[e]=r),n.length&&(y[e]=f[e].oldTags)}),t&&t(),c(e,h,y)},w=null,H=function(e){function t(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];e.apply(this,t),this.rendered=!1}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.shouldComponentUpdate=function(e){return!a(e,this.props)},t.prototype.componentDidUpdate=function(){this.emitChange()},t.prototype.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},t.prototype.emitChange=function(){var e,t,r=this.props.context,n=r.setHelmet,o=null,i=(e=r.helmetInstances.get().map(function(e){var t=Object.assign({},e.props);return delete t.context,t}),{baseTag:y(["href"],e),bodyAttributes:h("bodyAttributes",e),defer:p(e,"defer"),encode:p(e,"encodeSpecialCharacters"),htmlAttributes:h("htmlAttributes",e),linkTags:m(s.LINK,["rel","href"],e),metaTags:m(s.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:m(s.NOSCRIPT,["innerHTML"],e),onChangeClientState:f(e),scriptTags:m(s.SCRIPT,["src","innerHTML"],e),styleTags:m(s.STYLE,["cssText"],e),title:d(e),titleAttributes:h("titleAttributes",e)});I.canUseDOM?(t=i,w&&cancelAnimationFrame(w),t.defer?w=requestAnimationFrame(function(){L(t,function(){w=null})}):(L(t),w=null)):O&&(o=O(i)),n(o)},t.prototype.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},t.prototype.render=function(){return this.init(),null},t}(o.Component);function k(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&(r[n]=e[n]);return r}H.propTypes={context:E.isRequired},H.displayName="HelmetDispatcher";var M=function(e){function n(){e.apply(this,arguments)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.shouldComponentUpdate=function(e){return!t(this.props,e)},n.prototype.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case s.SCRIPT:case s.NOSCRIPT:return{innerHTML:t};case s.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.prototype.flattenArrayTypeChildren=function(e){var t,r=e.child,n=e.arrayTypeChildren;return Object.assign({},n,((t={})[r.type]=(n[r.type]||[]).concat([Object.assign({},e.newChildProps,this.mapNestedChildrenToProps(r,e.nestedChildren))]),t))},n.prototype.mapObjectTypeChildren=function(e){var t,r,n=e.child,o=e.newProps,i=e.newChildProps,a=e.nestedChildren;switch(n.type){case s.TITLE:return Object.assign({},o,((t={})[n.type]=a,t),{titleAttributes:Object.assign({},i)});case s.BODY:return Object.assign({},o,{bodyAttributes:Object.assign({},i)});case s.HTML:return Object.assign({},o,{htmlAttributes:Object.assign({},i)});default:return Object.assign({},o,((r={})[n.type]=Object.assign({},i),r))}},n.prototype.mapArrayTypeChildrenToProps=function(e,t){var r=Object.assign({},t);return Object.keys(e).forEach(function(t){var n;r=Object.assign({},r,((n={})[t]=e[t],n))}),r},n.prototype.warnOnInvalidChildren=function(e,t){return r(c.some(function(t){return e.type===t}),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+c.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),r(!t||"string"==typeof t||Array.isArray(t)&&!t.some(function(e){return"string"!=typeof e}),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},n.prototype.mapChildrenToProps=function(e,t){var r=this,n={};return i.Children.forEach(e,function(e){if(e&&e.props){var o=e.props,i=o.children,a=k(o,["children"]),c=Object.keys(a).reduce(function(e,t){return e[l[t]||t]=a[t],e},{}),u=e.type;switch("symbol"==typeof u?u=u.toString():r.warnOnInvalidChildren(e,i),u){case s.FRAGMENT:t=r.mapChildrenToProps(i,t);break;case s.LINK:case s.META:case s.NOSCRIPT:case s.SCRIPT:case s.STYLE:n=r.flattenArrayTypeChildren({child:e,arrayTypeChildren:n,newChildProps:c,nestedChildren:i});break;default:t=r.mapObjectTypeChildren({child:e,newProps:t,newChildProps:c,nestedChildren:i})}}}),this.mapArrayTypeChildrenToProps(n,t)},n.prototype.render=function(){var e=this.props,t=e.children,r=k(e,["children"]),n=Object.assign({},r);return t&&(n=this.mapChildrenToProps(t,n)),i.createElement(j.Consumer,null,function(e){return i.createElement(H,Object.assign({},n,{context:e}))})},n}(o.Component);M.propTypes={base:n.object,bodyAttributes:n.object,children:n.oneOfType([n.arrayOf(n.node),n.node]),defaultTitle:n.string,defer:n.bool,encodeSpecialCharacters:n.bool,htmlAttributes:n.object,link:n.arrayOf(n.object),meta:n.arrayOf(n.object),noscript:n.arrayOf(n.object),onChangeClientState:n.func,script:n.arrayOf(n.object),style:n.arrayOf(n.object),title:n.string,titleAttributes:n.object,titleTemplate:n.string},M.defaultProps={defer:!0,encodeSpecialCharacters:!0},M.displayName="Helmet",exports.Helmet=M,exports.HelmetProvider=I; | ||
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),r=e(t),n=e(require("prop-types")),i=e(require("react-fast-compare")),o=e(require("invariant")),a=e(require("shallowequal"));function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function u(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}var l={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},p=Object.keys(l).map(function(e){return l[e]}),f={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},d=Object.keys(f).reduce(function(e,t){return e[f[t]]=t,e},{}),h=function(e,t){for(var r=e.length-1;r>=0;r-=1){var n=e[r];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},m=function(e){var t=h(e,l.TITLE),r=h(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),r&&t)return r.replace(/%s/g,function(){return t});var n=h(e,"defaultTitle");return t||n||void 0},y=function(e){return h(e,"onChangeClientState")||function(){}},T=function(e,t){return t.filter(function(t){return void 0!==t[e]}).map(function(t){return t[e]}).reduce(function(e,t){return s({},e,t)},{})},b=function(e,t){return t.filter(function(e){return void 0!==e[l.BASE]}).map(function(e){return e[l.BASE]}).reverse().reduce(function(t,r){if(!t.length)for(var n=Object.keys(r),i=0;i<n.length;i+=1){var o=n[i].toLowerCase();if(-1!==e.indexOf(o)&&r[o])return t.concat(r)}return t},[])},g=function(e,t,r){var n={};return r.filter(function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)}).map(function(t){return t[e]}).reverse().reduce(function(e,r){var i={};r.filter(function(e){for(var r,o=Object.keys(e),a=0;a<o.length;a+=1){var s=o[a],c=s.toLowerCase();-1===t.indexOf(c)||"rel"===r&&"canonical"===e[r].toLowerCase()||"rel"===c&&"stylesheet"===e[c].toLowerCase()||(r=c),-1===t.indexOf(s)||"innerHTML"!==s&&"cssText"!==s&&"itemprop"!==s||(r=s)}if(!r||!e[r])return!1;var u=e[r].toLowerCase();return n[r]||(n[r]={}),i[r]||(i[r]={}),!n[r][u]&&(i[r][u]=!0,!0)}).reverse().forEach(function(t){return e.push(t)});for(var o=Object.keys(i),a=0;a<o.length;a+=1){var c=o[a],u=s({},n[c],i[c]);n[c]=u}return e},[]).reverse()},v=function(e){return Array.isArray(e)?e.join(""):e},A=[l.NOSCRIPT,l.SCRIPT,l.STYLE],C=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},O=function(e){return Object.keys(e).reduce(function(t,r){var n=void 0!==e[r]?r+'="'+e[r]+'"':""+r;return t?t+" "+n:n},"")},E=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce(function(t,r){return t[f[r]||r]=e[r],t},t)},S=function(e,t,n){switch(e){case l.TITLE:return{toComponent:function(){return n=t.titleAttributes,(i={key:e=t.title})["data-rh"]=!0,o=E(n,i),[r.createElement(l.TITLE,o,e)];var e,n,i,o},toString:function(){return function(e,t,r,n){var i=O(r),o=v(t);return i?"<"+e+' data-rh="true" '+i+">"+C(o,n)+"</"+e+">":"<"+e+' data-rh="true">'+C(o,n)+"</"+e+">"}(e,t.title,t.titleAttributes,n)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return E(t)},toString:function(){return O(t)}};default:return{toComponent:function(){return function(e,t){return t.map(function(t,n){var i,o=((i={key:n})["data-rh"]=!0,i);return Object.keys(t).forEach(function(e){var r=f[e]||e;"innerHTML"===r||"cssText"===r?o.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:o[r]=t[e]}),r.createElement(e,o)})}(e,t)},toString:function(){return function(e,t,r){return t.reduce(function(t,n){var i=Object.keys(n).filter(function(e){return!("innerHTML"===e||"cssText"===e)}).reduce(function(e,t){var i=void 0===n[t]?t:t+'="'+C(n[t],r)+'"';return e?e+" "+i:i},""),o=n.innerHTML||n.cssText||"",a=-1===A.indexOf(e);return t+"<"+e+' data-rh="true" '+i+(a?"/>":">"+o+"</"+e+">")},"")}(e,t,n)}}}},I=function(e){var t=e.bodyAttributes,r=e.encode,n=e.htmlAttributes,i=e.linkTags,o=e.metaTags,a=e.noscriptTags,s=e.scriptTags,c=e.styleTags,u=e.title,p=void 0===u?"":u,f=e.titleAttributes;return{base:S(l.BASE,e.baseTag,r),bodyAttributes:S("bodyAttributes",t,r),htmlAttributes:S("htmlAttributes",n,r),link:S(l.LINK,i,r),meta:S(l.META,o,r),noscript:S(l.NOSCRIPT,a,r),script:S(l.SCRIPT,s,r),style:S(l.STYLE,c,r),title:S(l.TITLE,{title:p,titleAttributes:f},r)}},P=r.createContext({}),x=n.shape({setHelmet:n.func,helmetInstances:n.shape({get:n.func,add:n.func,remove:n.func})}),L="undefined"!=typeof document,j=function(e){function t(r){var n;return(n=e.call(this,r)||this).instances=[],n.value={setHelmet:function(e){n.props.context.helmet=e},helmetInstances:{get:function(){return n.instances},add:function(e){n.instances.push(e)},remove:function(e){var t=n.instances.indexOf(e);n.instances.splice(t,1)}}},t.canUseDOM||(r.context.helmet=I({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),n}return c(t,e),t.prototype.render=function(){return r.createElement(P.Provider,{value:this.value},this.props.children)},t}(t.Component);j.canUseDOM=L,j.propTypes={context:n.shape({helmet:n.shape()}),children:n.node.isRequired},j.defaultProps={context:{}},j.displayName="HelmetProvider";var w=function(e,t){var r,n=document.head||document.querySelector(l.HEAD),i=n.querySelectorAll(e+"[data-rh]"),o=[].slice.call(i),a=[];return t&&t.length&&t.forEach(function(t){var n=document.createElement(e);for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&("innerHTML"===i?n.innerHTML=t.innerHTML:"cssText"===i?n.styleSheet?n.styleSheet.cssText=t.cssText:n.appendChild(document.createTextNode(t.cssText)):n.setAttribute(i,void 0===t[i]?"":t[i]));n.setAttribute("data-rh","true"),o.some(function(e,t){return r=t,n.isEqualNode(e)})?o.splice(r,1):a.push(n)}),o.forEach(function(e){return e.parentNode.removeChild(e)}),a.forEach(function(e){return n.appendChild(e)}),{oldTags:o,newTags:a}},H=function(e,t){var r=document.getElementsByTagName(e)[0];if(r){for(var n=r.getAttribute("data-rh"),i=n?n.split(","):[],o=[].concat(i),a=Object.keys(t),s=0;s<a.length;s+=1){var c=a[s],u=t[c]||"";r.getAttribute(c)!==u&&r.setAttribute(c,u),-1===i.indexOf(c)&&i.push(c);var l=o.indexOf(c);-1!==l&&o.splice(l,1)}for(var p=o.length-1;p>=0;p-=1)r.removeAttribute(o[p]);i.length===o.length?r.removeAttribute("data-rh"):r.getAttribute("data-rh")!==a.join(",")&&r.setAttribute("data-rh",a.join(","))}},k=function(e,t){var r=e.baseTag,n=e.htmlAttributes,i=e.linkTags,o=e.metaTags,a=e.noscriptTags,s=e.onChangeClientState,c=e.scriptTags,u=e.styleTags,p=e.title,f=e.titleAttributes;H(l.BODY,e.bodyAttributes),H(l.HTML,n),function(e,t){void 0!==e&&document.title!==e&&(document.title=v(e)),H(l.TITLE,t)}(p,f);var d={baseTag:w(l.BASE,r),linkTags:w(l.LINK,i),metaTags:w(l.META,o),noscriptTags:w(l.NOSCRIPT,a),scriptTags:w(l.SCRIPT,c),styleTags:w(l.STYLE,u)},h={},m={};Object.keys(d).forEach(function(e){var t=d[e],r=t.newTags,n=t.oldTags;r.length&&(h[e]=r),n.length&&(m[e]=d[e].oldTags)}),t&&t(),s(e,h,m)},M=null,N=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).rendered=!1,t}c(t,e);var r=t.prototype;return r.shouldComponentUpdate=function(e){return!a(e,this.props)},r.componentDidUpdate=function(){this.emitChange()},r.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},r.emitChange=function(){var e,t,r=this.props.context,n=r.setHelmet,i=null,o=(e=r.helmetInstances.get().map(function(e){var t=s({},e.props);return delete t.context,t}),{baseTag:b(["href"],e),bodyAttributes:T("bodyAttributes",e),defer:h(e,"defer"),encode:h(e,"encodeSpecialCharacters"),htmlAttributes:T("htmlAttributes",e),linkTags:g(l.LINK,["rel","href"],e),metaTags:g(l.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:g(l.NOSCRIPT,["innerHTML"],e),onChangeClientState:y(e),scriptTags:g(l.SCRIPT,["src","innerHTML"],e),styleTags:g(l.STYLE,["cssText"],e),title:m(e),titleAttributes:T("titleAttributes",e)});j.canUseDOM?(t=o,M&&cancelAnimationFrame(M),t.defer?M=requestAnimationFrame(function(){k(t,function(){M=null})}):(k(t),M=null)):I&&(i=I(o)),n(i)},r.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},r.render=function(){return this.init(),null},t}(t.Component);N.propTypes={context:x.isRequired},N.displayName="HelmetDispatcher";var R=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!i(this.props,e)},n.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case l.SCRIPT:case l.NOSCRIPT:return{innerHTML:t};case l.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,r=e.child,n=e.arrayTypeChildren;return s({},n,((t={})[r.type]=[].concat(n[r.type]||[],[s({},e.newChildProps,this.mapNestedChildrenToProps(r,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,r,n=e.child,i=e.newProps,o=e.newChildProps,a=e.nestedChildren;switch(n.type){case l.TITLE:return s({},i,((t={})[n.type]=a,t.titleAttributes=s({},o),t));case l.BODY:return s({},i,{bodyAttributes:s({},o)});case l.HTML:return s({},i,{htmlAttributes:s({},o)});default:return s({},i,((r={})[n.type]=s({},o),r))}},n.mapArrayTypeChildrenToProps=function(e,t){var r=s({},t);return Object.keys(e).forEach(function(t){var n;r=s({},r,((n={})[t]=e[t],n))}),r},n.warnOnInvalidChildren=function(e,t){return o(p.some(function(t){return e.type===t}),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+p.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),o(!t||"string"==typeof t||Array.isArray(t)&&!t.some(function(e){return"string"!=typeof e}),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,i={};return r.Children.forEach(e,function(e){if(e&&e.props){var r=e.props,o=r.children,a=u(r,["children"]),s=Object.keys(a).reduce(function(e,t){return e[d[t]||t]=a[t],e},{}),c=e.type;switch("symbol"==typeof c?c=c.toString():n.warnOnInvalidChildren(e,o),c){case l.FRAGMENT:t=n.mapChildrenToProps(o,t);break;case l.LINK:case l.META:case l.NOSCRIPT:case l.SCRIPT:case l.STYLE:i=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:i,newChildProps:s,nestedChildren:o});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:s,nestedChildren:o})}}}),this.mapArrayTypeChildrenToProps(i,t)},n.render=function(){var e=this.props,t=e.children,n=s({},u(e,["children"]));return t&&(n=this.mapChildrenToProps(t,n)),r.createElement(P.Consumer,null,function(e){return r.createElement(N,s({},n,{context:e}))})},t}(t.Component);R.propTypes={base:n.object,bodyAttributes:n.object,children:n.oneOfType([n.arrayOf(n.node),n.node]),defaultTitle:n.string,defer:n.bool,encodeSpecialCharacters:n.bool,htmlAttributes:n.object,link:n.arrayOf(n.object),meta:n.arrayOf(n.object),noscript:n.arrayOf(n.object),onChangeClientState:n.func,script:n.arrayOf(n.object),style:n.arrayOf(n.object),title:n.string,titleAttributes:n.object,titleTemplate:n.string},R.defaultProps={defer:!0,encodeSpecialCharacters:!0},R.displayName="Helmet",exports.Helmet=R,exports.HelmetProvider=j; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"react-fast-compare";import e from"invariant";import r from"prop-types";import n,{Component as o}from"react";import i from"shallowequal";var a={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},s=Object.keys(a).map(function(t){return a[t]}),c={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},u=Object.keys(c).reduce(function(t,e){return t[c[e]]=e,t},{}),l=function(t,e){for(var r=t.length-1;r>=0;r-=1){var n=t[r];if(Object.prototype.hasOwnProperty.call(n,e))return n[e]}return null},p=function(t){var e=l(t,a.TITLE),r=l(t,"titleTemplate");if(Array.isArray(e)&&(e=e.join("")),r&&e)return r.replace(/%s/g,function(){return e});var n=l(t,"defaultTitle");return e||n||void 0},f=function(t){return l(t,"onChangeClientState")||function(){}},d=function(t,e){return e.filter(function(e){return void 0!==e[t]}).map(function(e){return e[t]}).reduce(function(t,e){return Object.assign({},t,e)},{})},h=function(t,e){return e.filter(function(t){return void 0!==t[a.BASE]}).map(function(t){return t[a.BASE]}).reverse().reduce(function(e,r){if(!e.length)for(var n=Object.keys(r),o=0;o<n.length;o+=1){var i=n[o].toLowerCase();if(-1!==t.indexOf(i)&&r[i])return e.concat(r)}return e},[])},y=function(t,e,r){var n={};return r.filter(function(e){return!!Array.isArray(e[t])||(void 0!==e[t]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+t+' should be of type "Array". Instead found type "'+typeof e[t]+'"'),!1)}).map(function(e){return e[t]}).reverse().reduce(function(t,r){var o={};r.filter(function(t){for(var r,i=Object.keys(t),a=0;a<i.length;a+=1){var s=i[a],c=s.toLowerCase();-1===e.indexOf(c)||"rel"===r&&"canonical"===t[r].toLowerCase()||"rel"===c&&"stylesheet"===t[c].toLowerCase()||(r=c),-1===e.indexOf(s)||"innerHTML"!==s&&"cssText"!==s&&"itemprop"!==s||(r=s)}if(!r||!t[r])return!1;var u=t[r].toLowerCase();return n[r]||(n[r]={}),o[r]||(o[r]={}),!n[r][u]&&(o[r][u]=!0,!0)}).reverse().forEach(function(e){return t.push(e)});for(var i=Object.keys(o),a=0;a<i.length;a+=1){var s=i[a],c=Object.assign({},n[s],o[s]);n[s]=c}return t},[]).reverse()},m=function(t){return Array.isArray(t)?t.join(""):t},T=[a.NOSCRIPT,a.SCRIPT,a.STYLE],b=function(t,e){return void 0===e&&(e=!0),!1===e?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},g=function(t){return Object.keys(t).reduce(function(e,r){var n=void 0!==t[r]?r+'="'+t[r]+'"':""+r;return e?e+" "+n:n},"")},v=function(t,e){return void 0===e&&(e={}),Object.keys(t).reduce(function(e,r){return e[c[r]||r]=t[r],e},e)},A=function(t,e,r){switch(t){case a.TITLE:return{toComponent:function(){return r=v(e.titleAttributes,{key:t=e.title,"data-rh":!0}),[n.createElement(a.TITLE,r,t)];var t,r},toString:function(){return function(t,r,n,o){var i=g(e.titleAttributes),a=m(r);return i?"<"+t+' data-rh="true" '+i+">"+b(a,o)+"</"+t+">":"<"+t+' data-rh="true">'+b(a,o)+"</"+t+">"}(t,e.title,0,r)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return v(e)},toString:function(){return g(e)}};default:return{toComponent:function(){return function(t,e){return e.map(function(e,r){var o={key:r,"data-rh":!0};return Object.keys(e).forEach(function(t){var r=c[t]||t;"innerHTML"===r||"cssText"===r?o.dangerouslySetInnerHTML={__html:e.innerHTML||e.cssText}:o[r]=e[t]}),n.createElement(t,o)})}(t,e)},toString:function(){return function(t,e,r){return e.reduce(function(e,n){var o=Object.keys(n).filter(function(t){return!("innerHTML"===t||"cssText"===t)}).reduce(function(t,e){var o=void 0===n[e]?e:e+'="'+b(n[e],r)+'"';return t?t+" "+o:o},""),i=n.innerHTML||n.cssText||"",a=-1===T.indexOf(t);return e+"<"+t+' data-rh="true" '+o+(a?"/>":">"+i+"</"+t+">")},"")}(t,e,r)}}}},O=function(t){var e=t.bodyAttributes,r=t.encode,n=t.htmlAttributes,o=t.linkTags,i=t.metaTags,s=t.noscriptTags,c=t.scriptTags,u=t.styleTags,l=t.title;void 0===l&&(l="");var p=t.titleAttributes;return{base:A(a.BASE,t.baseTag,r),bodyAttributes:A("bodyAttributes",e,r),htmlAttributes:A("htmlAttributes",n,r),link:A(a.LINK,o,r),meta:A(a.META,i,r),noscript:A(a.NOSCRIPT,s,r),script:A(a.SCRIPT,c,r),style:A(a.STYLE,u,r),title:A(a.TITLE,{title:l,titleAttributes:p},r)}},C=n.createContext({}),j=r.shape({setHelmet:r.func,helmetInstances:r.shape({get:r.func,add:r.func,remove:r.func})}),E="undefined"!=typeof document,S=function(t){function e(r){var n=this;t.call(this,r),this.instances=[],this.value={setHelmet:function(t){n.props.context.helmet=t},helmetInstances:{get:function(){return n.instances},add:function(t){n.instances.push(t)},remove:function(t){var e=n.instances.indexOf(t);n.instances.splice(e,1)}}},e.canUseDOM||(r.context.helmet=O({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.render=function(){return n.createElement(C.Provider,{value:this.value},this.props.children)},e}(o);S.canUseDOM=E,S.propTypes={context:r.shape({helmet:r.shape()}),children:r.node.isRequired},S.defaultProps={context:{}},S.displayName="HelmetProvider";var I=function(t,e){var r,n=document.head||document.querySelector(a.HEAD),o=n.querySelectorAll(t+"[data-rh]"),i=[].slice.call(o),s=[];return e&&e.length&&e.forEach(function(e){var n=document.createElement(t);for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&("innerHTML"===o?n.innerHTML=e.innerHTML:"cssText"===o?n.styleSheet?n.styleSheet.cssText=e.cssText:n.appendChild(document.createTextNode(e.cssText)):n.setAttribute(o,void 0===e[o]?"":e[o]));n.setAttribute("data-rh","true"),i.some(function(t,e){return r=e,n.isEqualNode(t)})?i.splice(r,1):s.push(n)}),i.forEach(function(t){return t.parentNode.removeChild(t)}),s.forEach(function(t){return n.appendChild(t)}),{oldTags:i,newTags:s}},P=function(t,e){var r=document.getElementsByTagName(t)[0];if(r){for(var n=r.getAttribute("data-rh"),o=n?n.split(","):[],i=[].concat(o),a=Object.keys(e),s=0;s<a.length;s+=1){var c=a[s],u=e[c]||"";r.getAttribute(c)!==u&&r.setAttribute(c,u),-1===o.indexOf(c)&&o.push(c);var l=i.indexOf(c);-1!==l&&i.splice(l,1)}for(var p=i.length-1;p>=0;p-=1)r.removeAttribute(i[p]);o.length===i.length?r.removeAttribute("data-rh"):r.getAttribute("data-rh")!==a.join(",")&&r.setAttribute("data-rh",a.join(","))}},L=function(t,e){var r=t.baseTag,n=t.htmlAttributes,o=t.linkTags,i=t.metaTags,s=t.noscriptTags,c=t.onChangeClientState,u=t.scriptTags,l=t.styleTags,p=t.title,f=t.titleAttributes;P(a.BODY,t.bodyAttributes),P(a.HTML,n),function(t,e){void 0!==t&&document.title!==t&&(document.title=m(t)),P(a.TITLE,e)}(p,f);var d={baseTag:I(a.BASE,r),linkTags:I(a.LINK,o),metaTags:I(a.META,i),noscriptTags:I(a.NOSCRIPT,s),scriptTags:I(a.SCRIPT,u),styleTags:I(a.STYLE,l)},h={},y={};Object.keys(d).forEach(function(t){var e=d[t],r=e.newTags,n=e.oldTags;r.length&&(h[t]=r),n.length&&(y[t]=d[t].oldTags)}),e&&e(),c(t,h,y)},x=null,w=function(t){function e(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e),this.rendered=!1}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.shouldComponentUpdate=function(t){return!i(t,this.props)},e.prototype.componentDidUpdate=function(){this.emitChange()},e.prototype.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},e.prototype.emitChange=function(){var t,e,r=this.props.context,n=r.setHelmet,o=null,i=(t=r.helmetInstances.get().map(function(t){var e=Object.assign({},t.props);return delete e.context,e}),{baseTag:h(["href"],t),bodyAttributes:d("bodyAttributes",t),defer:l(t,"defer"),encode:l(t,"encodeSpecialCharacters"),htmlAttributes:d("htmlAttributes",t),linkTags:y(a.LINK,["rel","href"],t),metaTags:y(a.META,["name","charset","http-equiv","property","itemprop"],t),noscriptTags:y(a.NOSCRIPT,["innerHTML"],t),onChangeClientState:f(t),scriptTags:y(a.SCRIPT,["src","innerHTML"],t),styleTags:y(a.STYLE,["cssText"],t),title:p(t),titleAttributes:d("titleAttributes",t)});S.canUseDOM?(e=i,x&&cancelAnimationFrame(x),e.defer?x=requestAnimationFrame(function(){L(e,function(){x=null})}):(L(e),x=null)):O&&(o=O(i)),n(o)},e.prototype.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},e.prototype.render=function(){return this.init(),null},e}(o);function H(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&-1===e.indexOf(n)&&(r[n]=t[n]);return r}w.propTypes={context:j.isRequired},w.displayName="HelmetDispatcher";var k=function(r){function o(){r.apply(this,arguments)}return r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o,o.prototype.shouldComponentUpdate=function(e){return!t(this.props,e)},o.prototype.mapNestedChildrenToProps=function(t,e){if(!e)return null;switch(t.type){case a.SCRIPT:case a.NOSCRIPT:return{innerHTML:e};case a.STYLE:return{cssText:e};default:throw new Error("<"+t.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},o.prototype.flattenArrayTypeChildren=function(t){var e,r=t.child,n=t.arrayTypeChildren;return Object.assign({},n,((e={})[r.type]=(n[r.type]||[]).concat([Object.assign({},t.newChildProps,this.mapNestedChildrenToProps(r,t.nestedChildren))]),e))},o.prototype.mapObjectTypeChildren=function(t){var e,r,n=t.child,o=t.newProps,i=t.newChildProps,s=t.nestedChildren;switch(n.type){case a.TITLE:return Object.assign({},o,((e={})[n.type]=s,e),{titleAttributes:Object.assign({},i)});case a.BODY:return Object.assign({},o,{bodyAttributes:Object.assign({},i)});case a.HTML:return Object.assign({},o,{htmlAttributes:Object.assign({},i)});default:return Object.assign({},o,((r={})[n.type]=Object.assign({},i),r))}},o.prototype.mapArrayTypeChildrenToProps=function(t,e){var r=Object.assign({},e);return Object.keys(t).forEach(function(e){var n;r=Object.assign({},r,((n={})[e]=t[e],n))}),r},o.prototype.warnOnInvalidChildren=function(t,r){return e(s.some(function(e){return t.type===e}),"function"==typeof t.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+s.join(", ")+" are allowed. Helmet does not support rendering <"+t.type+"> elements. Refer to our API for more information."),e(!r||"string"==typeof r||Array.isArray(r)&&!r.some(function(t){return"string"!=typeof t}),"Helmet expects a string as a child of <"+t.type+">. Did you forget to wrap your children in braces? ( <"+t.type+">{``}</"+t.type+"> ) Refer to our API for more information."),!0},o.prototype.mapChildrenToProps=function(t,e){var r=this,o={};return n.Children.forEach(t,function(t){if(t&&t.props){var n=t.props,i=n.children,s=H(n,["children"]),c=Object.keys(s).reduce(function(t,e){return t[u[e]||e]=s[e],t},{}),l=t.type;switch("symbol"==typeof l?l=l.toString():r.warnOnInvalidChildren(t,i),l){case a.FRAGMENT:e=r.mapChildrenToProps(i,e);break;case a.LINK:case a.META:case a.NOSCRIPT:case a.SCRIPT:case a.STYLE:o=r.flattenArrayTypeChildren({child:t,arrayTypeChildren:o,newChildProps:c,nestedChildren:i});break;default:e=r.mapObjectTypeChildren({child:t,newProps:e,newChildProps:c,nestedChildren:i})}}}),this.mapArrayTypeChildrenToProps(o,e)},o.prototype.render=function(){var t=this.props,e=t.children,r=H(t,["children"]),o=Object.assign({},r);return e&&(o=this.mapChildrenToProps(e,o)),n.createElement(C.Consumer,null,function(t){return n.createElement(w,Object.assign({},o,{context:t}))})},o}(o);k.propTypes={base:r.object,bodyAttributes:r.object,children:r.oneOfType([r.arrayOf(r.node),r.node]),defaultTitle:r.string,defer:r.bool,encodeSpecialCharacters:r.bool,htmlAttributes:r.object,link:r.arrayOf(r.object),meta:r.arrayOf(r.object),noscript:r.arrayOf(r.object),onChangeClientState:r.func,script:r.arrayOf(r.object),style:r.arrayOf(r.object),title:r.string,titleAttributes:r.object,titleTemplate:r.string},k.defaultProps={defer:!0,encodeSpecialCharacters:!0},k.displayName="Helmet";export{k as Helmet,S as HelmetProvider}; | ||
import e,{Component as t}from"react";import r from"prop-types";import n from"react-fast-compare";import i from"invariant";import o from"shallowequal";function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function s(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function c(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}var u={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},l=Object.keys(u).map(function(e){return u[e]}),p={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},f=Object.keys(p).reduce(function(e,t){return e[p[t]]=t,e},{}),d=function(e,t){for(var r=e.length-1;r>=0;r-=1){var n=e[r];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},h=function(e){var t=d(e,u.TITLE),r=d(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),r&&t)return r.replace(/%s/g,function(){return t});var n=d(e,"defaultTitle");return t||n||void 0},m=function(e){return d(e,"onChangeClientState")||function(){}},y=function(e,t){return t.filter(function(t){return void 0!==t[e]}).map(function(t){return t[e]}).reduce(function(e,t){return a({},e,t)},{})},T=function(e,t){return t.filter(function(e){return void 0!==e[u.BASE]}).map(function(e){return e[u.BASE]}).reverse().reduce(function(t,r){if(!t.length)for(var n=Object.keys(r),i=0;i<n.length;i+=1){var o=n[i].toLowerCase();if(-1!==e.indexOf(o)&&r[o])return t.concat(r)}return t},[])},b=function(e,t,r){var n={};return r.filter(function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)}).map(function(t){return t[e]}).reverse().reduce(function(e,r){var i={};r.filter(function(e){for(var r,o=Object.keys(e),a=0;a<o.length;a+=1){var s=o[a],c=s.toLowerCase();-1===t.indexOf(c)||"rel"===r&&"canonical"===e[r].toLowerCase()||"rel"===c&&"stylesheet"===e[c].toLowerCase()||(r=c),-1===t.indexOf(s)||"innerHTML"!==s&&"cssText"!==s&&"itemprop"!==s||(r=s)}if(!r||!e[r])return!1;var u=e[r].toLowerCase();return n[r]||(n[r]={}),i[r]||(i[r]={}),!n[r][u]&&(i[r][u]=!0,!0)}).reverse().forEach(function(t){return e.push(t)});for(var o=Object.keys(i),s=0;s<o.length;s+=1){var c=o[s],u=a({},n[c],i[c]);n[c]=u}return e},[]).reverse()},g=function(e){return Array.isArray(e)?e.join(""):e},v=[u.NOSCRIPT,u.SCRIPT,u.STYLE],A=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},C=function(e){return Object.keys(e).reduce(function(t,r){var n=void 0!==e[r]?r+'="'+e[r]+'"':""+r;return t?t+" "+n:n},"")},O=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce(function(t,r){return t[p[r]||r]=e[r],t},t)},E=function(t,r,n){switch(t){case u.TITLE:return{toComponent:function(){return n=r.titleAttributes,(i={key:t=r.title})["data-rh"]=!0,o=O(n,i),[e.createElement(u.TITLE,o,t)];var t,n,i,o},toString:function(){return function(e,t,r,n){var i=C(r),o=g(t);return i?"<"+e+' data-rh="true" '+i+">"+A(o,n)+"</"+e+">":"<"+e+' data-rh="true">'+A(o,n)+"</"+e+">"}(t,r.title,r.titleAttributes,n)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return O(r)},toString:function(){return C(r)}};default:return{toComponent:function(){return function(t,r){return r.map(function(r,n){var i,o=((i={key:n})["data-rh"]=!0,i);return Object.keys(r).forEach(function(e){var t=p[e]||e;"innerHTML"===t||"cssText"===t?o.dangerouslySetInnerHTML={__html:r.innerHTML||r.cssText}:o[t]=r[e]}),e.createElement(t,o)})}(t,r)},toString:function(){return function(e,t,r){return t.reduce(function(t,n){var i=Object.keys(n).filter(function(e){return!("innerHTML"===e||"cssText"===e)}).reduce(function(e,t){var i=void 0===n[t]?t:t+'="'+A(n[t],r)+'"';return e?e+" "+i:i},""),o=n.innerHTML||n.cssText||"",a=-1===v.indexOf(e);return t+"<"+e+' data-rh="true" '+i+(a?"/>":">"+o+"</"+e+">")},"")}(t,r,n)}}}},S=function(e){var t=e.bodyAttributes,r=e.encode,n=e.htmlAttributes,i=e.linkTags,o=e.metaTags,a=e.noscriptTags,s=e.scriptTags,c=e.styleTags,l=e.title,p=void 0===l?"":l,f=e.titleAttributes;return{base:E(u.BASE,e.baseTag,r),bodyAttributes:E("bodyAttributes",t,r),htmlAttributes:E("htmlAttributes",n,r),link:E(u.LINK,i,r),meta:E(u.META,o,r),noscript:E(u.NOSCRIPT,a,r),script:E(u.SCRIPT,s,r),style:E(u.STYLE,c,r),title:E(u.TITLE,{title:p,titleAttributes:f},r)}},I=e.createContext({}),P=r.shape({setHelmet:r.func,helmetInstances:r.shape({get:r.func,add:r.func,remove:r.func})}),L="undefined"!=typeof document,x=function(t){function r(e){var n;return(n=t.call(this,e)||this).instances=[],n.value={setHelmet:function(e){n.props.context.helmet=e},helmetInstances:{get:function(){return n.instances},add:function(e){n.instances.push(e)},remove:function(e){var t=n.instances.indexOf(e);n.instances.splice(t,1)}}},r.canUseDOM||(e.context.helmet=S({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),n}return s(r,t),r.prototype.render=function(){return e.createElement(I.Provider,{value:this.value},this.props.children)},r}(t);x.canUseDOM=L,x.propTypes={context:r.shape({helmet:r.shape()}),children:r.node.isRequired},x.defaultProps={context:{}},x.displayName="HelmetProvider";var j=function(e,t){var r,n=document.head||document.querySelector(u.HEAD),i=n.querySelectorAll(e+"[data-rh]"),o=[].slice.call(i),a=[];return t&&t.length&&t.forEach(function(t){var n=document.createElement(e);for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&("innerHTML"===i?n.innerHTML=t.innerHTML:"cssText"===i?n.styleSheet?n.styleSheet.cssText=t.cssText:n.appendChild(document.createTextNode(t.cssText)):n.setAttribute(i,void 0===t[i]?"":t[i]));n.setAttribute("data-rh","true"),o.some(function(e,t){return r=t,n.isEqualNode(e)})?o.splice(r,1):a.push(n)}),o.forEach(function(e){return e.parentNode.removeChild(e)}),a.forEach(function(e){return n.appendChild(e)}),{oldTags:o,newTags:a}},w=function(e,t){var r=document.getElementsByTagName(e)[0];if(r){for(var n=r.getAttribute("data-rh"),i=n?n.split(","):[],o=[].concat(i),a=Object.keys(t),s=0;s<a.length;s+=1){var c=a[s],u=t[c]||"";r.getAttribute(c)!==u&&r.setAttribute(c,u),-1===i.indexOf(c)&&i.push(c);var l=o.indexOf(c);-1!==l&&o.splice(l,1)}for(var p=o.length-1;p>=0;p-=1)r.removeAttribute(o[p]);i.length===o.length?r.removeAttribute("data-rh"):r.getAttribute("data-rh")!==a.join(",")&&r.setAttribute("data-rh",a.join(","))}},H=function(e,t){var r=e.baseTag,n=e.htmlAttributes,i=e.linkTags,o=e.metaTags,a=e.noscriptTags,s=e.onChangeClientState,c=e.scriptTags,l=e.styleTags,p=e.title,f=e.titleAttributes;w(u.BODY,e.bodyAttributes),w(u.HTML,n),function(e,t){void 0!==e&&document.title!==e&&(document.title=g(e)),w(u.TITLE,t)}(p,f);var d={baseTag:j(u.BASE,r),linkTags:j(u.LINK,i),metaTags:j(u.META,o),noscriptTags:j(u.NOSCRIPT,a),scriptTags:j(u.SCRIPT,c),styleTags:j(u.STYLE,l)},h={},m={};Object.keys(d).forEach(function(e){var t=d[e],r=t.newTags,n=t.oldTags;r.length&&(h[e]=r),n.length&&(m[e]=d[e].oldTags)}),t&&t(),s(e,h,m)},k=null,M=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).rendered=!1,t}s(t,e);var r=t.prototype;return r.shouldComponentUpdate=function(e){return!o(e,this.props)},r.componentDidUpdate=function(){this.emitChange()},r.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},r.emitChange=function(){var e,t,r=this.props.context,n=r.setHelmet,i=null,o=(e=r.helmetInstances.get().map(function(e){var t=a({},e.props);return delete t.context,t}),{baseTag:T(["href"],e),bodyAttributes:y("bodyAttributes",e),defer:d(e,"defer"),encode:d(e,"encodeSpecialCharacters"),htmlAttributes:y("htmlAttributes",e),linkTags:b(u.LINK,["rel","href"],e),metaTags:b(u.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:b(u.NOSCRIPT,["innerHTML"],e),onChangeClientState:m(e),scriptTags:b(u.SCRIPT,["src","innerHTML"],e),styleTags:b(u.STYLE,["cssText"],e),title:h(e),titleAttributes:y("titleAttributes",e)});x.canUseDOM?(t=o,k&&cancelAnimationFrame(k),t.defer?k=requestAnimationFrame(function(){H(t,function(){k=null})}):(H(t),k=null)):S&&(i=S(o)),n(i)},r.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},r.render=function(){return this.init(),null},t}(t);M.propTypes={context:P.isRequired},M.displayName="HelmetDispatcher";var N=function(t){function r(){return t.apply(this,arguments)||this}s(r,t);var o=r.prototype;return o.shouldComponentUpdate=function(e){return!n(this.props,e)},o.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case u.SCRIPT:case u.NOSCRIPT:return{innerHTML:t};case u.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},o.flattenArrayTypeChildren=function(e){var t,r=e.child,n=e.arrayTypeChildren;return a({},n,((t={})[r.type]=[].concat(n[r.type]||[],[a({},e.newChildProps,this.mapNestedChildrenToProps(r,e.nestedChildren))]),t))},o.mapObjectTypeChildren=function(e){var t,r,n=e.child,i=e.newProps,o=e.newChildProps,s=e.nestedChildren;switch(n.type){case u.TITLE:return a({},i,((t={})[n.type]=s,t.titleAttributes=a({},o),t));case u.BODY:return a({},i,{bodyAttributes:a({},o)});case u.HTML:return a({},i,{htmlAttributes:a({},o)});default:return a({},i,((r={})[n.type]=a({},o),r))}},o.mapArrayTypeChildrenToProps=function(e,t){var r=a({},t);return Object.keys(e).forEach(function(t){var n;r=a({},r,((n={})[t]=e[t],n))}),r},o.warnOnInvalidChildren=function(e,t){return i(l.some(function(t){return e.type===t}),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+l.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),i(!t||"string"==typeof t||Array.isArray(t)&&!t.some(function(e){return"string"!=typeof e}),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},o.mapChildrenToProps=function(t,r){var n=this,i={};return e.Children.forEach(t,function(e){if(e&&e.props){var t=e.props,o=t.children,a=c(t,["children"]),s=Object.keys(a).reduce(function(e,t){return e[f[t]||t]=a[t],e},{}),l=e.type;switch("symbol"==typeof l?l=l.toString():n.warnOnInvalidChildren(e,o),l){case u.FRAGMENT:r=n.mapChildrenToProps(o,r);break;case u.LINK:case u.META:case u.NOSCRIPT:case u.SCRIPT:case u.STYLE:i=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:i,newChildProps:s,nestedChildren:o});break;default:r=n.mapObjectTypeChildren({child:e,newProps:r,newChildProps:s,nestedChildren:o})}}}),this.mapArrayTypeChildrenToProps(i,r)},o.render=function(){var t=this.props,r=t.children,n=a({},c(t,["children"]));return r&&(n=this.mapChildrenToProps(r,n)),e.createElement(I.Consumer,null,function(t){return e.createElement(M,a({},n,{context:t}))})},r}(t);N.propTypes={base:r.object,bodyAttributes:r.object,children:r.oneOfType([r.arrayOf(r.node),r.node]),defaultTitle:r.string,defer:r.bool,encodeSpecialCharacters:r.bool,htmlAttributes:r.object,link:r.arrayOf(r.object),meta:r.arrayOf(r.object),noscript:r.arrayOf(r.object),onChangeClientState:r.func,script:r.arrayOf(r.object),style:r.arrayOf(r.object),title:r.string,titleAttributes:r.object,titleTemplate:r.string},N.defaultProps={defer:!0,encodeSpecialCharacters:!0},N.displayName="Helmet";export{N as Helmet,x as HelmetProvider}; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react-fast-compare"),require("invariant"),require("prop-types"),require("react"),require("shallowequal")):"function"==typeof define&&define.amd?define(["exports","react-fast-compare","invariant","prop-types","react","shallowequal"],t):t(e.reactHelmetAsync={},e.fastCompare,e.invariant,e.PropTypes,e.react,e.shallowequal)}(this,function(e,t,r,n,o,i){t=t&&t.hasOwnProperty("default")?t.default:t,r=r&&r.hasOwnProperty("default")?r.default:r,n=n&&n.hasOwnProperty("default")?n.default:n;var a="default"in o?o.default:o;i=i&&i.hasOwnProperty("default")?i.default:i;var s={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},c=Object.keys(s).map(function(e){return s[e]}),u={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},l=Object.keys(u).reduce(function(e,t){return e[u[t]]=t,e},{}),p=function(e,t){for(var r=e.length-1;r>=0;r-=1){var n=e[r];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},f=function(e){var t=p(e,s.TITLE),r=p(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),r&&t)return r.replace(/%s/g,function(){return t});var n=p(e,"defaultTitle");return t||n||void 0},d=function(e){return p(e,"onChangeClientState")||function(){}},h=function(e,t){return t.filter(function(t){return void 0!==t[e]}).map(function(t){return t[e]}).reduce(function(e,t){return Object.assign({},e,t)},{})},y=function(e,t){return t.filter(function(e){return void 0!==e[s.BASE]}).map(function(e){return e[s.BASE]}).reverse().reduce(function(t,r){if(!t.length)for(var n=Object.keys(r),o=0;o<n.length;o+=1){var i=n[o].toLowerCase();if(-1!==e.indexOf(i)&&r[i])return t.concat(r)}return t},[])},m=function(e,t,r){var n={};return r.filter(function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)}).map(function(t){return t[e]}).reverse().reduce(function(e,r){var o={};r.filter(function(e){for(var r,i=Object.keys(e),a=0;a<i.length;a+=1){var s=i[a],c=s.toLowerCase();-1===t.indexOf(c)||"rel"===r&&"canonical"===e[r].toLowerCase()||"rel"===c&&"stylesheet"===e[c].toLowerCase()||(r=c),-1===t.indexOf(s)||"innerHTML"!==s&&"cssText"!==s&&"itemprop"!==s||(r=s)}if(!r||!e[r])return!1;var u=e[r].toLowerCase();return n[r]||(n[r]={}),o[r]||(o[r]={}),!n[r][u]&&(o[r][u]=!0,!0)}).reverse().forEach(function(t){return e.push(t)});for(var i=Object.keys(o),a=0;a<i.length;a+=1){var s=i[a],c=Object.assign({},n[s],o[s]);n[s]=c}return e},[]).reverse()},T=function(e){return Array.isArray(e)?e.join(""):e},b=[s.NOSCRIPT,s.SCRIPT,s.STYLE],g=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},v=function(e){return Object.keys(e).reduce(function(t,r){var n=void 0!==e[r]?r+'="'+e[r]+'"':""+r;return t?t+" "+n:n},"")},O=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce(function(t,r){return t[u[r]||r]=e[r],t},t)},A=function(e,t,r){switch(e){case s.TITLE:return{toComponent:function(){return r=O(t.titleAttributes,{key:e=t.title,"data-rh":!0}),[a.createElement(s.TITLE,r,e)];var e,r},toString:function(){return function(e,r,n,o){var i=v(t.titleAttributes),a=T(r);return i?"<"+e+' data-rh="true" '+i+">"+g(a,o)+"</"+e+">":"<"+e+' data-rh="true">'+g(a,o)+"</"+e+">"}(e,t.title,0,r)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return O(t)},toString:function(){return v(t)}};default:return{toComponent:function(){return function(e,t){return t.map(function(t,r){var n={key:r,"data-rh":!0};return Object.keys(t).forEach(function(e){var r=u[e]||e;"innerHTML"===r||"cssText"===r?n.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:n[r]=t[e]}),a.createElement(e,n)})}(e,t)},toString:function(){return function(e,t,r){return t.reduce(function(t,n){var o=Object.keys(n).filter(function(e){return!("innerHTML"===e||"cssText"===e)}).reduce(function(e,t){var o=void 0===n[t]?t:t+'="'+g(n[t],r)+'"';return e?e+" "+o:o},""),i=n.innerHTML||n.cssText||"",a=-1===b.indexOf(e);return t+"<"+e+' data-rh="true" '+o+(a?"/>":">"+i+"</"+e+">")},"")}(e,t,r)}}}},C=function(e){var t=e.bodyAttributes,r=e.encode,n=e.htmlAttributes,o=e.linkTags,i=e.metaTags,a=e.noscriptTags,c=e.scriptTags,u=e.styleTags,l=e.title;void 0===l&&(l="");var p=e.titleAttributes;return{base:A(s.BASE,e.baseTag,r),bodyAttributes:A("bodyAttributes",t,r),htmlAttributes:A("htmlAttributes",n,r),link:A(s.LINK,o,r),meta:A(s.META,i,r),noscript:A(s.NOSCRIPT,a,r),script:A(s.SCRIPT,c,r),style:A(s.STYLE,u,r),title:A(s.TITLE,{title:l,titleAttributes:p},r)}},j=a.createContext({}),E=n.shape({setHelmet:n.func,helmetInstances:n.shape({get:n.func,add:n.func,remove:n.func})}),S="undefined"!=typeof document,P=function(e){function t(r){var n=this;e.call(this,r),this.instances=[],this.value={setHelmet:function(e){n.props.context.helmet=e},helmetInstances:{get:function(){return n.instances},add:function(e){n.instances.push(e)},remove:function(e){var t=n.instances.indexOf(e);n.instances.splice(t,1)}}},t.canUseDOM||(r.context.helmet=C({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.render=function(){return a.createElement(j.Provider,{value:this.value},this.props.children)},t}(o.Component);P.canUseDOM=S,P.propTypes={context:n.shape({helmet:n.shape()}),children:n.node.isRequired},P.defaultProps={context:{}},P.displayName="HelmetProvider";var x=function(e,t){var r,n=document.head||document.querySelector(s.HEAD),o=n.querySelectorAll(e+"[data-rh]"),i=[].slice.call(o),a=[];return t&&t.length&&t.forEach(function(t){var n=document.createElement(e);for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&("innerHTML"===o?n.innerHTML=t.innerHTML:"cssText"===o?n.styleSheet?n.styleSheet.cssText=t.cssText:n.appendChild(document.createTextNode(t.cssText)):n.setAttribute(o,void 0===t[o]?"":t[o]));n.setAttribute("data-rh","true"),i.some(function(e,t){return r=t,n.isEqualNode(e)})?i.splice(r,1):a.push(n)}),i.forEach(function(e){return e.parentNode.removeChild(e)}),a.forEach(function(e){return n.appendChild(e)}),{oldTags:i,newTags:a}},I=function(e,t){var r=document.getElementsByTagName(e)[0];if(r){for(var n=r.getAttribute("data-rh"),o=n?n.split(","):[],i=[].concat(o),a=Object.keys(t),s=0;s<a.length;s+=1){var c=a[s],u=t[c]||"";r.getAttribute(c)!==u&&r.setAttribute(c,u),-1===o.indexOf(c)&&o.push(c);var l=i.indexOf(c);-1!==l&&i.splice(l,1)}for(var p=i.length-1;p>=0;p-=1)r.removeAttribute(i[p]);o.length===i.length?r.removeAttribute("data-rh"):r.getAttribute("data-rh")!==a.join(",")&&r.setAttribute("data-rh",a.join(","))}},L=function(e,t){var r=e.baseTag,n=e.htmlAttributes,o=e.linkTags,i=e.metaTags,a=e.noscriptTags,c=e.onChangeClientState,u=e.scriptTags,l=e.styleTags,p=e.title,f=e.titleAttributes;I(s.BODY,e.bodyAttributes),I(s.HTML,n),function(e,t){void 0!==e&&document.title!==e&&(document.title=T(e)),I(s.TITLE,t)}(p,f);var d={baseTag:x(s.BASE,r),linkTags:x(s.LINK,o),metaTags:x(s.META,i),noscriptTags:x(s.NOSCRIPT,a),scriptTags:x(s.SCRIPT,u),styleTags:x(s.STYLE,l)},h={},y={};Object.keys(d).forEach(function(e){var t=d[e],r=t.newTags,n=t.oldTags;r.length&&(h[e]=r),n.length&&(y[e]=d[e].oldTags)}),t&&t(),c(e,h,y)},w=null,H=function(e){function t(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];e.apply(this,t),this.rendered=!1}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.shouldComponentUpdate=function(e){return!i(e,this.props)},t.prototype.componentDidUpdate=function(){this.emitChange()},t.prototype.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},t.prototype.emitChange=function(){var e,t,r=this.props.context,n=r.setHelmet,o=null,i=(e=r.helmetInstances.get().map(function(e){var t=Object.assign({},e.props);return delete t.context,t}),{baseTag:y(["href"],e),bodyAttributes:h("bodyAttributes",e),defer:p(e,"defer"),encode:p(e,"encodeSpecialCharacters"),htmlAttributes:h("htmlAttributes",e),linkTags:m(s.LINK,["rel","href"],e),metaTags:m(s.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:m(s.NOSCRIPT,["innerHTML"],e),onChangeClientState:d(e),scriptTags:m(s.SCRIPT,["src","innerHTML"],e),styleTags:m(s.STYLE,["cssText"],e),title:f(e),titleAttributes:h("titleAttributes",e)});P.canUseDOM?(t=i,w&&cancelAnimationFrame(w),t.defer?w=requestAnimationFrame(function(){L(t,function(){w=null})}):(L(t),w=null)):C&&(o=C(i)),n(o)},t.prototype.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},t.prototype.render=function(){return this.init(),null},t}(o.Component);function k(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&(r[n]=e[n]);return r}H.propTypes={context:E.isRequired},H.displayName="HelmetDispatcher";var M=function(e){function n(){e.apply(this,arguments)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.shouldComponentUpdate=function(e){return!t(this.props,e)},n.prototype.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case s.SCRIPT:case s.NOSCRIPT:return{innerHTML:t};case s.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.prototype.flattenArrayTypeChildren=function(e){var t,r=e.child,n=e.arrayTypeChildren;return Object.assign({},n,((t={})[r.type]=(n[r.type]||[]).concat([Object.assign({},e.newChildProps,this.mapNestedChildrenToProps(r,e.nestedChildren))]),t))},n.prototype.mapObjectTypeChildren=function(e){var t,r,n=e.child,o=e.newProps,i=e.newChildProps,a=e.nestedChildren;switch(n.type){case s.TITLE:return Object.assign({},o,((t={})[n.type]=a,t),{titleAttributes:Object.assign({},i)});case s.BODY:return Object.assign({},o,{bodyAttributes:Object.assign({},i)});case s.HTML:return Object.assign({},o,{htmlAttributes:Object.assign({},i)});default:return Object.assign({},o,((r={})[n.type]=Object.assign({},i),r))}},n.prototype.mapArrayTypeChildrenToProps=function(e,t){var r=Object.assign({},t);return Object.keys(e).forEach(function(t){var n;r=Object.assign({},r,((n={})[t]=e[t],n))}),r},n.prototype.warnOnInvalidChildren=function(e,t){return r(c.some(function(t){return e.type===t}),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+c.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),r(!t||"string"==typeof t||Array.isArray(t)&&!t.some(function(e){return"string"!=typeof e}),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},n.prototype.mapChildrenToProps=function(e,t){var r=this,n={};return a.Children.forEach(e,function(e){if(e&&e.props){var o=e.props,i=o.children,a=k(o,["children"]),c=Object.keys(a).reduce(function(e,t){return e[l[t]||t]=a[t],e},{}),u=e.type;switch("symbol"==typeof u?u=u.toString():r.warnOnInvalidChildren(e,i),u){case s.FRAGMENT:t=r.mapChildrenToProps(i,t);break;case s.LINK:case s.META:case s.NOSCRIPT:case s.SCRIPT:case s.STYLE:n=r.flattenArrayTypeChildren({child:e,arrayTypeChildren:n,newChildProps:c,nestedChildren:i});break;default:t=r.mapObjectTypeChildren({child:e,newProps:t,newChildProps:c,nestedChildren:i})}}}),this.mapArrayTypeChildrenToProps(n,t)},n.prototype.render=function(){var e=this.props,t=e.children,r=k(e,["children"]),n=Object.assign({},r);return t&&(n=this.mapChildrenToProps(t,n)),a.createElement(j.Consumer,null,function(e){return a.createElement(H,Object.assign({},n,{context:e}))})},n}(o.Component);M.propTypes={base:n.object,bodyAttributes:n.object,children:n.oneOfType([n.arrayOf(n.node),n.node]),defaultTitle:n.string,defer:n.bool,encodeSpecialCharacters:n.bool,htmlAttributes:n.object,link:n.arrayOf(n.object),meta:n.arrayOf(n.object),noscript:n.arrayOf(n.object),onChangeClientState:n.func,script:n.arrayOf(n.object),style:n.arrayOf(n.object),title:n.string,titleAttributes:n.object,titleTemplate:n.string},M.defaultProps={defer:!0,encodeSpecialCharacters:!0},M.displayName="Helmet",e.Helmet=M,e.HelmetProvider=P}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("react-fast-compare"),require("invariant"),require("shallowequal")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","react-fast-compare","invariant","shallowequal"],t):t((e=e||self).reactHelmetAsync={},e.react,e.propTypes,e.reactFastCompare,e.invariant,e.shallowequal)}(this,function(e,t,r,n,o,i){var a="default"in t?t.default:t;function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function u(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r,n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,o=o&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o,i=i&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i;var l={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},p=Object.keys(l).map(function(e){return l[e]}),f={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},d=Object.keys(f).reduce(function(e,t){return e[f[t]]=t,e},{}),h=function(e,t){for(var r=e.length-1;r>=0;r-=1){var n=e[r];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},y=function(e){var t=h(e,l.TITLE),r=h(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),r&&t)return r.replace(/%s/g,function(){return t});var n=h(e,"defaultTitle");return t||n||void 0},m=function(e){return h(e,"onChangeClientState")||function(){}},T=function(e,t){return t.filter(function(t){return void 0!==t[e]}).map(function(t){return t[e]}).reduce(function(e,t){return s({},e,t)},{})},b=function(e,t){return t.filter(function(e){return void 0!==e[l.BASE]}).map(function(e){return e[l.BASE]}).reverse().reduce(function(t,r){if(!t.length)for(var n=Object.keys(r),o=0;o<n.length;o+=1){var i=n[o].toLowerCase();if(-1!==e.indexOf(i)&&r[i])return t.concat(r)}return t},[])},g=function(e,t,r){var n={};return r.filter(function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)}).map(function(t){return t[e]}).reverse().reduce(function(e,r){var o={};r.filter(function(e){for(var r,i=Object.keys(e),a=0;a<i.length;a+=1){var s=i[a],c=s.toLowerCase();-1===t.indexOf(c)||"rel"===r&&"canonical"===e[r].toLowerCase()||"rel"===c&&"stylesheet"===e[c].toLowerCase()||(r=c),-1===t.indexOf(s)||"innerHTML"!==s&&"cssText"!==s&&"itemprop"!==s||(r=s)}if(!r||!e[r])return!1;var u=e[r].toLowerCase();return n[r]||(n[r]={}),o[r]||(o[r]={}),!n[r][u]&&(o[r][u]=!0,!0)}).reverse().forEach(function(t){return e.push(t)});for(var i=Object.keys(o),a=0;a<i.length;a+=1){var c=i[a],u=s({},n[c],o[c]);n[c]=u}return e},[]).reverse()},v=function(e){return Array.isArray(e)?e.join(""):e},A=[l.NOSCRIPT,l.SCRIPT,l.STYLE],C=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},O=function(e){return Object.keys(e).reduce(function(t,r){var n=void 0!==e[r]?r+'="'+e[r]+'"':""+r;return t?t+" "+n:n},"")},E=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce(function(t,r){return t[f[r]||r]=e[r],t},t)},S=function(e,t,r){switch(e){case l.TITLE:return{toComponent:function(){return r=t.titleAttributes,(n={key:e=t.title})["data-rh"]=!0,o=E(r,n),[a.createElement(l.TITLE,o,e)];var e,r,n,o},toString:function(){return function(e,t,r,n){var o=O(r),i=v(t);return o?"<"+e+' data-rh="true" '+o+">"+C(i,n)+"</"+e+">":"<"+e+' data-rh="true">'+C(i,n)+"</"+e+">"}(e,t.title,t.titleAttributes,r)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return E(t)},toString:function(){return O(t)}};default:return{toComponent:function(){return function(e,t){return t.map(function(t,r){var n,o=((n={key:r})["data-rh"]=!0,n);return Object.keys(t).forEach(function(e){var r=f[e]||e;"innerHTML"===r||"cssText"===r?o.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:o[r]=t[e]}),a.createElement(e,o)})}(e,t)},toString:function(){return function(e,t,r){return t.reduce(function(t,n){var o=Object.keys(n).filter(function(e){return!("innerHTML"===e||"cssText"===e)}).reduce(function(e,t){var o=void 0===n[t]?t:t+'="'+C(n[t],r)+'"';return e?e+" "+o:o},""),i=n.innerHTML||n.cssText||"",a=-1===A.indexOf(e);return t+"<"+e+' data-rh="true" '+o+(a?"/>":">"+i+"</"+e+">")},"")}(e,t,r)}}}},P=function(e){var t=e.bodyAttributes,r=e.encode,n=e.htmlAttributes,o=e.linkTags,i=e.metaTags,a=e.noscriptTags,s=e.scriptTags,c=e.styleTags,u=e.title,p=void 0===u?"":u,f=e.titleAttributes;return{base:S(l.BASE,e.baseTag,r),bodyAttributes:S("bodyAttributes",t,r),htmlAttributes:S("htmlAttributes",n,r),link:S(l.LINK,o,r),meta:S(l.META,i,r),noscript:S(l.NOSCRIPT,a,r),script:S(l.SCRIPT,s,r),style:S(l.STYLE,c,r),title:S(l.TITLE,{title:p,titleAttributes:f},r)}},j=a.createContext({}),x=r.shape({setHelmet:r.func,helmetInstances:r.shape({get:r.func,add:r.func,remove:r.func})}),I="undefined"!=typeof document,w=function(e){function t(r){var n;return(n=e.call(this,r)||this).instances=[],n.value={setHelmet:function(e){n.props.context.helmet=e},helmetInstances:{get:function(){return n.instances},add:function(e){n.instances.push(e)},remove:function(e){var t=n.instances.indexOf(e);n.instances.splice(t,1)}}},t.canUseDOM||(r.context.helmet=P({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),n}return c(t,e),t.prototype.render=function(){return a.createElement(j.Provider,{value:this.value},this.props.children)},t}(t.Component);w.canUseDOM=I,w.propTypes={context:r.shape({helmet:r.shape()}),children:r.node.isRequired},w.defaultProps={context:{}},w.displayName="HelmetProvider";var L=function(e,t){var r,n=document.head||document.querySelector(l.HEAD),o=n.querySelectorAll(e+"[data-rh]"),i=[].slice.call(o),a=[];return t&&t.length&&t.forEach(function(t){var n=document.createElement(e);for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&("innerHTML"===o?n.innerHTML=t.innerHTML:"cssText"===o?n.styleSheet?n.styleSheet.cssText=t.cssText:n.appendChild(document.createTextNode(t.cssText)):n.setAttribute(o,void 0===t[o]?"":t[o]));n.setAttribute("data-rh","true"),i.some(function(e,t){return r=t,n.isEqualNode(e)})?i.splice(r,1):a.push(n)}),i.forEach(function(e){return e.parentNode.removeChild(e)}),a.forEach(function(e){return n.appendChild(e)}),{oldTags:i,newTags:a}},H=function(e,t){var r=document.getElementsByTagName(e)[0];if(r){for(var n=r.getAttribute("data-rh"),o=n?n.split(","):[],i=[].concat(o),a=Object.keys(t),s=0;s<a.length;s+=1){var c=a[s],u=t[c]||"";r.getAttribute(c)!==u&&r.setAttribute(c,u),-1===o.indexOf(c)&&o.push(c);var l=i.indexOf(c);-1!==l&&i.splice(l,1)}for(var p=i.length-1;p>=0;p-=1)r.removeAttribute(i[p]);o.length===i.length?r.removeAttribute("data-rh"):r.getAttribute("data-rh")!==a.join(",")&&r.setAttribute("data-rh",a.join(","))}},k=function(e,t){var r=e.baseTag,n=e.htmlAttributes,o=e.linkTags,i=e.metaTags,a=e.noscriptTags,s=e.onChangeClientState,c=e.scriptTags,u=e.styleTags,p=e.title,f=e.titleAttributes;H(l.BODY,e.bodyAttributes),H(l.HTML,n),function(e,t){void 0!==e&&document.title!==e&&(document.title=v(e)),H(l.TITLE,t)}(p,f);var d={baseTag:L(l.BASE,r),linkTags:L(l.LINK,o),metaTags:L(l.META,i),noscriptTags:L(l.NOSCRIPT,a),scriptTags:L(l.SCRIPT,c),styleTags:L(l.STYLE,u)},h={},y={};Object.keys(d).forEach(function(e){var t=d[e],r=t.newTags,n=t.oldTags;r.length&&(h[e]=r),n.length&&(y[e]=d[e].oldTags)}),t&&t(),s(e,h,y)},M=null,N=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).rendered=!1,t}c(t,e);var r=t.prototype;return r.shouldComponentUpdate=function(e){return!i(e,this.props)},r.componentDidUpdate=function(){this.emitChange()},r.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},r.emitChange=function(){var e,t,r=this.props.context,n=r.setHelmet,o=null,i=(e=r.helmetInstances.get().map(function(e){var t=s({},e.props);return delete t.context,t}),{baseTag:b(["href"],e),bodyAttributes:T("bodyAttributes",e),defer:h(e,"defer"),encode:h(e,"encodeSpecialCharacters"),htmlAttributes:T("htmlAttributes",e),linkTags:g(l.LINK,["rel","href"],e),metaTags:g(l.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:g(l.NOSCRIPT,["innerHTML"],e),onChangeClientState:m(e),scriptTags:g(l.SCRIPT,["src","innerHTML"],e),styleTags:g(l.STYLE,["cssText"],e),title:y(e),titleAttributes:T("titleAttributes",e)});w.canUseDOM?(t=i,M&&cancelAnimationFrame(M),t.defer?M=requestAnimationFrame(function(){k(t,function(){M=null})}):(k(t),M=null)):P&&(o=P(i)),n(o)},r.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},r.render=function(){return this.init(),null},t}(t.Component);N.propTypes={context:x.isRequired},N.displayName="HelmetDispatcher";var R=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var r=t.prototype;return r.shouldComponentUpdate=function(e){return!n(this.props,e)},r.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case l.SCRIPT:case l.NOSCRIPT:return{innerHTML:t};case l.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},r.flattenArrayTypeChildren=function(e){var t,r=e.child,n=e.arrayTypeChildren;return s({},n,((t={})[r.type]=[].concat(n[r.type]||[],[s({},e.newChildProps,this.mapNestedChildrenToProps(r,e.nestedChildren))]),t))},r.mapObjectTypeChildren=function(e){var t,r,n=e.child,o=e.newProps,i=e.newChildProps,a=e.nestedChildren;switch(n.type){case l.TITLE:return s({},o,((t={})[n.type]=a,t.titleAttributes=s({},i),t));case l.BODY:return s({},o,{bodyAttributes:s({},i)});case l.HTML:return s({},o,{htmlAttributes:s({},i)});default:return s({},o,((r={})[n.type]=s({},i),r))}},r.mapArrayTypeChildrenToProps=function(e,t){var r=s({},t);return Object.keys(e).forEach(function(t){var n;r=s({},r,((n={})[t]=e[t],n))}),r},r.warnOnInvalidChildren=function(e,t){return o(p.some(function(t){return e.type===t}),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+p.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),o(!t||"string"==typeof t||Array.isArray(t)&&!t.some(function(e){return"string"!=typeof e}),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},r.mapChildrenToProps=function(e,t){var r=this,n={};return a.Children.forEach(e,function(e){if(e&&e.props){var o=e.props,i=o.children,a=u(o,["children"]),s=Object.keys(a).reduce(function(e,t){return e[d[t]||t]=a[t],e},{}),c=e.type;switch("symbol"==typeof c?c=c.toString():r.warnOnInvalidChildren(e,i),c){case l.FRAGMENT:t=r.mapChildrenToProps(i,t);break;case l.LINK:case l.META:case l.NOSCRIPT:case l.SCRIPT:case l.STYLE:n=r.flattenArrayTypeChildren({child:e,arrayTypeChildren:n,newChildProps:s,nestedChildren:i});break;default:t=r.mapObjectTypeChildren({child:e,newProps:t,newChildProps:s,nestedChildren:i})}}}),this.mapArrayTypeChildrenToProps(n,t)},r.render=function(){var e=this.props,t=e.children,r=s({},u(e,["children"]));return t&&(r=this.mapChildrenToProps(t,r)),a.createElement(j.Consumer,null,function(e){return a.createElement(N,s({},r,{context:e}))})},t}(t.Component);R.propTypes={base:r.object,bodyAttributes:r.object,children:r.oneOfType([r.arrayOf(r.node),r.node]),defaultTitle:r.string,defer:r.bool,encodeSpecialCharacters:r.bool,htmlAttributes:r.object,link:r.arrayOf(r.object),meta:r.arrayOf(r.object),noscript:r.arrayOf(r.object),onChangeClientState:r.func,script:r.arrayOf(r.object),style:r.arrayOf(r.object),title:r.string,titleAttributes:r.object,titleTemplate:r.string},R.defaultProps={defer:!0,encodeSpecialCharacters:!0},R.displayName="Helmet",e.Helmet=R,e.HelmetProvider=w}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "react-helmet-async", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Thread-safe Helmet for React 16+ and friends", | ||
@@ -19,31 +19,35 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.9.2", | ||
"@babel/runtime": "^7.11.2", | ||
"invariant": "^2.2.4", | ||
"prop-types": "^15.7.2", | ||
"react-fast-compare": "^3.0.1", | ||
"react-fast-compare": "^3.2.0", | ||
"shallowequal": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "7.8.4", | ||
"@babel/core": "7.9.0", | ||
"@babel/cli": "7.11.6", | ||
"@babel/core": "7.11.6", | ||
"@commitlint/cli": "11.0.0", | ||
"@commitlint/config-conventional": "11.0.0", | ||
"babel-eslint": "10.1.0", | ||
"babel-preset-kyt-react": "1.0.0-beta.37", | ||
"babel-preset-kyt-react": "1.0.5", | ||
"enzyme": "3.11.0", | ||
"enzyme-adapter-react-16": "1.15.2", | ||
"enzyme-to-json": "3.4.4", | ||
"eslint": "6.8.0", | ||
"eslint-config-airbnb": "18.1.0", | ||
"eslint-config-kyt": "1.0.0-beta.37", | ||
"eslint-config-prettier": "6.10.1", | ||
"eslint-plugin-import": "2.20.2", | ||
"eslint-plugin-jest": "23.8.2", | ||
"eslint-plugin-json": "2.1.1", | ||
"eslint-plugin-jsx-a11y": "6.2.3", | ||
"eslint-plugin-prettier": "3.1.3", | ||
"eslint-plugin-react": "7.19.0", | ||
"eslint-plugin-react-hooks": "3.0.0", | ||
"jest": "25.3.0", | ||
"jsdom": "15.2.1", | ||
"microbundle": "0.11.0", | ||
"prettier": "2.0.2", | ||
"enzyme-adapter-react-16": "1.15.4", | ||
"enzyme-to-json": "3.5.0", | ||
"eslint": "7.9.0", | ||
"eslint-config-airbnb": "18.2.0", | ||
"eslint-config-kyt": "1.0.8", | ||
"eslint-config-prettier": "6.11.0", | ||
"eslint-plugin-import": "2.22.0", | ||
"eslint-plugin-jest": "24.0.1", | ||
"eslint-plugin-jest-formatting": "2.0.0", | ||
"eslint-plugin-json": "2.1.2", | ||
"eslint-plugin-jsx-a11y": "6.3.1", | ||
"eslint-plugin-prettier": "3.1.4", | ||
"eslint-plugin-react": "7.20.6", | ||
"eslint-plugin-react-hooks": "4.1.2", | ||
"husky": "4.3.0", | ||
"jest": "26.4.2", | ||
"jsdom": "16.4.0", | ||
"microbundle": "0.12.3", | ||
"prettier": "2.1.1", | ||
"raf": "3.4.1", | ||
@@ -60,25 +64,15 @@ "react": "16.13.1", | ||
"clean": "rimraf lib", | ||
"lint": "eslint .", | ||
"lint": "eslint . --report-unused-disable-directives", | ||
"lint-fix": "eslint . --fix", | ||
"test": "KYT_ENV_TYPE=test jest", | ||
"test-watch": "npm run test -- --watch", | ||
"test-update": "npm run test -- -u", | ||
"compile": "npm run clean && KYT_ENV_TYPE=client NODE_ENV=production microbundle --jsx React.createElement", | ||
"prepare": "npm run compile" | ||
"test": "NODE_ENV=test BABEL_ENV=test jest", | ||
"test-watch": "yarn test --watch", | ||
"test-update": "yarn test -u", | ||
"compile": "yarn run clean && KYT_ENV_TYPE=client NODE_ENV=production microbundle --jsx React.createElement", | ||
"prepare": "yarn compile" | ||
}, | ||
"jest": { | ||
"setupFilesAfterEnv": [ | ||
"<rootDir>/jest.setup.js" | ||
], | ||
"testEnvironment": "node", | ||
"testMatch": [ | ||
"**/__tests__/**/*.test.js" | ||
], | ||
"testPathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/src/", | ||
"/lib/", | ||
"/es/" | ||
] | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
} | ||
} |
@@ -123,3 +123,3 @@ # react-helmet-async | ||
``` | ||
```javascript | ||
import { HelmetProvider } from 'react-helmet-async'; | ||
@@ -126,0 +126,0 @@ |
@@ -48,3 +48,2 @@ export const TAG_PROPERTIES = { | ||
export const HTML_TAG_MAP = Object.keys(REACT_TAG_MAP).reduce((obj, key) => { | ||
// eslint-disable-next-line no-param-reassign | ||
obj[REACT_TAG_MAP[key]] = key; | ||
@@ -51,0 +50,0 @@ return obj; |
@@ -31,3 +31,3 @@ import React, { Component } from 'react'; | ||
*/ | ||
/* eslint-disable react/prop-types, react/forbid-prop-types, react/require-default-props */ | ||
/* eslint-disable react/forbid-prop-types, react/require-default-props */ | ||
static propTypes = { | ||
@@ -175,3 +175,2 @@ base: PropTypes.object, | ||
const newChildProps = Object.keys(childProps).reduce((obj, key) => { | ||
// eslint-disable-next-line no-param-reassign | ||
obj[HTML_TAG_MAP[key] || key] = childProps[key]; | ||
@@ -190,3 +189,2 @@ return obj; | ||
case TAG_NAMES.FRAGMENT: | ||
// eslint-disable-next-line no-param-reassign | ||
newProps = this.mapChildrenToProps(nestedChildren, newProps); | ||
@@ -209,3 +207,2 @@ break; | ||
default: | ||
// eslint-disable-next-line no-param-reassign | ||
newProps = this.mapObjectTypeChildren({ | ||
@@ -212,0 +209,0 @@ child, |
@@ -40,3 +40,2 @@ import React, { Component } from 'react'; | ||
setHelmet: serverState => { | ||
// eslint-disable-next-line react/prop-types | ||
this.props.context.helmet = serverState; | ||
@@ -60,3 +59,2 @@ }, | ||
if (!Provider.canUseDOM) { | ||
// eslint-disable-next-line no-param-reassign | ||
props.context.helmet = mapStateOnServer({ | ||
@@ -63,0 +61,0 @@ baseTag: [], |
@@ -72,3 +72,2 @@ import React from 'react'; | ||
Object.keys(attributes).reduce((obj, key) => { | ||
// eslint-disable-next-line no-param-reassign | ||
obj[REACT_TAG_MAP[key] || key] = attributes[key]; | ||
@@ -75,0 +74,0 @@ return obj; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
277183
19
1095
30
Updated@babel/runtime@^7.11.2
Updatedreact-fast-compare@^3.2.0