Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-meta-tags

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-meta-tags - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

dist/react-meta-tags.es.js

10

dist/react-meta-tags.min.js

@@ -1,6 +0,8 @@

/*!
* react-meta-tags - 0.5.1
/**
* react-meta-tags - 0.6.0
* Author : Sudhanshu Yadav
* Copyright (c) 2016,2018 to Sudhanshu Yadav - ignitersworld.com , released under the MIT license.
* Copyright (c) 2016, 2018 to Sudhanshu Yadav, released under the MIT license.
* https://github.com/s-yadav/react-meta-tags
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.MetaTags=e(require("react"),require("react-dom")):t.MetaTags=e(t.React,t.ReactDOM)}(this,function(t,e){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.ReactTitle=e.MetaTagsContext=e.MetaTags=void 0;var o=n(2),i=r(o),u=n(94),c=r(u),f=n(102),a=r(f);e.default=c.default,e.MetaTags=c.default,e.MetaTagsContext=i.default,e.ReactTitle=a.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),i=r(o),u=n(29),c=r(u),f=n(30),a=r(f),s=n(34),l=r(s),p=n(80),d=r(p),v=n(88),h=n(89),y=r(h),m=function(t){function e(){return(0,c.default)(this,e),(0,l.default)(this,(e.__proto__||(0,i.default)(e)).apply(this,arguments))}return(0,d.default)(e,t),(0,a.default)(e,[{key:"getChildContext",value:function(){return{extract:this.props.extract}}},{key:"render",value:function(){return v.Children.only(this.props.children)}}]),e}(v.Component);m.childContextTypes={extract:y.default.func},e.default=m},function(t,e,n){t.exports={default:n(4),__esModule:!0}},function(t,e,n){n(5),t.exports=n(16).Object.getPrototypeOf},function(t,e,n){var r=n(6),o=n(8);n(14)("getPrototypeOf",function(){return function(t){return o(r(t))}})},function(t,e,n){var r=n(7);t.exports=function(t){return Object(r(t))}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(9),o=n(6),i=n(10)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(11)("keys"),o=n(13);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(12),o="__core-js_shared__",i=r[o]||(r[o]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){var r=n(15),o=n(16),i=n(25);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],u={};u[t]=e(n),r(r.S+r.F*i(function(){n(1)}),"Object",u)}},function(t,e,n){var r=n(12),o=n(16),i=n(17),u=n(19),c=n(9),f="prototype",a=function(t,e,n){var s,l,p,d=t&a.F,v=t&a.G,h=t&a.S,y=t&a.P,m=t&a.B,_=t&a.W,b=v?o:o[e]||(o[e]={}),g=b[f],x=v?r:h?r[e]:(r[e]||{})[f];v&&(n=e);for(s in n)l=!d&&x&&void 0!==x[s],l&&c(b,s)||(p=l?x[s]:n[s],b[s]=v&&"function"!=typeof x[s]?n[s]:m&&l?i(p,r):_&&x[s]==p?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e[f]=t[f],e}(p):y&&"function"==typeof p?i(Function.call,p):p,y&&((b.virtual||(b.virtual={}))[s]=p,t&a.R&&g&&!g[s]&&u(g,s,p)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e){var n=t.exports={version:"2.5.5"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(18);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(20),o=n(28);t.exports=n(24)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(21),o=n(23),i=n(27),u=Object.defineProperty;e.f=n(24)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(22);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(24)&&!n(25)(function(){return 7!=Object.defineProperty(n(26)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){t.exports=!n(25)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(22),o=n(12).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(22);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(31),i=r(o);e.default=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,i.default)(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}()},function(t,e,n){t.exports={default:n(32),__esModule:!0}},function(t,e,n){n(33);var r=n(16).Object;t.exports=function(t,e,n){return r.defineProperty(t,e,n)}},function(t,e,n){var r=n(15);r(r.S+r.F*!n(24),"Object",{defineProperty:n(20).f})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(35),i=r(o);e.default=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":(0,i.default)(e))&&"function"!=typeof e?t:e}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(36),i=r(o),u=n(65),c=r(u),f="function"==typeof c.default&&"symbol"==typeof i.default?function(t){return typeof t}:function(t){return t&&"function"==typeof c.default&&t.constructor===c.default&&t!==c.default.prototype?"symbol":typeof t};e.default="function"==typeof c.default&&"symbol"===f(i.default)?function(t){return"undefined"==typeof t?"undefined":f(t)}:function(t){return t&&"function"==typeof c.default&&t.constructor===c.default&&t!==c.default.prototype?"symbol":"undefined"==typeof t?"undefined":f(t)}},function(t,e,n){t.exports={default:n(37),__esModule:!0}},function(t,e,n){n(38),n(60),t.exports=n(64).f("iterator")},function(t,e,n){"use strict";var r=n(39)(!0);n(41)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){var r=n(40),o=n(7);t.exports=function(t){return function(e,n){var i,u,c=String(o(e)),f=r(n),a=c.length;return f<0||f>=a?t?"":void 0:(i=c.charCodeAt(f),i<55296||i>56319||f+1===a||(u=c.charCodeAt(f+1))<56320||u>57343?t?c.charAt(f):i:t?c.slice(f,f+2):(i-55296<<10)+(u-56320)+65536)}}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){"use strict";var r=n(42),o=n(15),i=n(43),u=n(19),c=n(44),f=n(45),a=n(58),s=n(8),l=n(59)("iterator"),p=!([].keys&&"next"in[].keys()),d="@@iterator",v="keys",h="values",y=function(){return this};t.exports=function(t,e,n,m,_,b,g){f(n,e,m);var x,O,S,M=function(t){if(!p&&t in P)return P[t];switch(t){case v:return function(){return new n(this,t)};case h:return function(){return new n(this,t)}}return function(){return new n(this,t)}},j=e+" Iterator",w=_==h,T=!1,P=t.prototype,E=P[l]||P[d]||_&&P[_],C=E||M(_),k=_?w?M("entries"):C:void 0,L="Array"==e?P.entries||E:E;if(L&&(S=s(L.call(new t)),S!==Object.prototype&&S.next&&(a(S,j,!0),r||"function"==typeof S[l]||u(S,l,y))),w&&E&&E.name!==h&&(T=!0,C=function(){return E.call(this)}),r&&!g||!p&&!T&&P[l]||u(P,l,C),c[e]=C,c[j]=y,_)if(x={values:w?C:M(h),keys:b?C:M(v),entries:k},g)for(O in x)O in P||i(P,O,x[O]);else o(o.P+o.F*(p||T),e,x);return x}},function(t,e){t.exports=!0},function(t,e,n){t.exports=n(19)},function(t,e){t.exports={}},function(t,e,n){"use strict";var r=n(46),o=n(28),i=n(58),u={};n(19)(u,n(59)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(u,{next:o(1,n)}),i(t,e+" Iterator")}},function(t,e,n){var r=n(21),o=n(47),i=n(56),u=n(10)("IE_PROTO"),c=function(){},f="prototype",a=function(){var t,e=n(26)("iframe"),r=i.length,o="<",u=">";for(e.style.display="none",n(57).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(o+"script"+u+"document.F=Object"+o+"/script"+u),t.close(),a=t.F;r--;)delete a[f][i[r]];return a()};t.exports=Object.create||function(t,e){var n;return null!==t?(c[f]=r(t),n=new c,c[f]=null,n[u]=t):n=a(),void 0===e?n:o(n,e)}},function(t,e,n){var r=n(20),o=n(21),i=n(48);t.exports=n(24)?Object.defineProperties:function(t,e){o(t);for(var n,u=i(e),c=u.length,f=0;c>f;)r.f(t,n=u[f++],e[n]);return t}},function(t,e,n){var r=n(49),o=n(56);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(9),o=n(50),i=n(53)(!1),u=n(10)("IE_PROTO");t.exports=function(t,e){var n,c=o(t),f=0,a=[];for(n in c)n!=u&&r(c,n)&&a.push(n);for(;e.length>f;)r(c,n=e[f++])&&(~i(a,n)||a.push(n));return a}},function(t,e,n){var r=n(51),o=n(7);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(52);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(50),o=n(54),i=n(55);t.exports=function(t){return function(e,n,u){var c,f=r(e),a=o(f.length),s=i(u,a);if(t&&n!=n){for(;a>s;)if(c=f[s++],c!=c)return!0}else for(;a>s;s++)if((t||s in f)&&f[s]===n)return t||s||0;return!t&&-1}}},function(t,e,n){var r=n(40),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(40),o=Math.max,i=Math.min;t.exports=function(t,e){return t=r(t),t<0?o(t+e,0):i(t,e)}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(12).document;t.exports=r&&r.documentElement},function(t,e,n){var r=n(20).f,o=n(9),i=n(59)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){var r=n(11)("wks"),o=n(13),i=n(12).Symbol,u="function"==typeof i,c=t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))};c.store=r},function(t,e,n){n(61);for(var r=n(12),o=n(19),i=n(44),u=n(59)("toStringTag"),c="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),f=0;f<c.length;f++){var a=c[f],s=r[a],l=s&&s.prototype;l&&!l[u]&&o(l,u,a),i[a]=i.Array}},function(t,e,n){"use strict";var r=n(62),o=n(63),i=n(44),u=n(50);t.exports=n(41)(Array,"Array",function(t,e){this._t=u(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):"keys"==e?o(0,n):"values"==e?o(0,t[n]):o(0,[n,t[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){e.f=n(59)},function(t,e,n){t.exports={default:n(66),__esModule:!0}},function(t,e,n){n(67),n(77),n(78),n(79),t.exports=n(16).Symbol},function(t,e,n){"use strict";var r=n(12),o=n(9),i=n(24),u=n(15),c=n(43),f=n(68).KEY,a=n(25),s=n(11),l=n(58),p=n(13),d=n(59),v=n(64),h=n(69),y=n(70),m=n(73),_=n(21),b=n(22),g=n(50),x=n(27),O=n(28),S=n(46),M=n(74),j=n(76),w=n(20),T=n(48),P=j.f,E=w.f,C=M.f,k=r.Symbol,L=r.JSON,A=L&&L.stringify,R="prototype",D=d("_hidden"),F=d("toPrimitive"),N={}.propertyIsEnumerable,I=s("symbol-registry"),q=s("symbols"),G=s("op-symbols"),H=Object[R],V="function"==typeof k,W=r.QObject,B=!W||!W[R]||!W[R].findChild,J=i&&a(function(){return 7!=S(E({},"a",{get:function(){return E(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=P(H,e);r&&delete H[e],E(t,e,n),r&&t!==H&&E(H,e,r)}:E,U=function(t){var e=q[t]=S(k[R]);return e._k=t,e},K=V&&"symbol"==typeof k.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof k},Y=function(t,e,n){return t===H&&Y(G,e,n),_(t),e=x(e,!0),_(n),o(q,e)?(n.enumerable?(o(t,D)&&t[D][e]&&(t[D][e]=!1),n=S(n,{enumerable:O(0,!1)})):(o(t,D)||E(t,D,O(1,{})),t[D][e]=!0),J(t,e,n)):E(t,e,n)},z=function(t,e){_(t);for(var n,r=y(e=g(e)),o=0,i=r.length;i>o;)Y(t,n=r[o++],e[n]);return t},Q=function(t,e){return void 0===e?S(t):z(S(t),e)},X=function(t){var e=N.call(this,t=x(t,!0));return!(this===H&&o(q,t)&&!o(G,t))&&(!(e||!o(this,t)||!o(q,t)||o(this,D)&&this[D][t])||e)},Z=function(t,e){if(t=g(t),e=x(e,!0),t!==H||!o(q,e)||o(G,e)){var n=P(t,e);return!n||!o(q,e)||o(t,D)&&t[D][e]||(n.enumerable=!0),n}},$=function(t){for(var e,n=C(g(t)),r=[],i=0;n.length>i;)o(q,e=n[i++])||e==D||e==f||r.push(e);return r},tt=function(t){for(var e,n=t===H,r=C(n?G:g(t)),i=[],u=0;r.length>u;)!o(q,e=r[u++])||n&&!o(H,e)||i.push(q[e]);return i};V||(k=function(){if(this instanceof k)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(n){this===H&&e.call(G,n),o(this,D)&&o(this[D],t)&&(this[D][t]=!1),J(this,t,O(1,n))};return i&&B&&J(H,t,{configurable:!0,set:e}),U(t)},c(k[R],"toString",function(){return this._k}),j.f=Z,w.f=Y,n(75).f=M.f=$,n(72).f=X,n(71).f=tt,i&&!n(42)&&c(H,"propertyIsEnumerable",X,!0),v.f=function(t){return U(d(t))}),u(u.G+u.W+u.F*!V,{Symbol:k});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;et.length>nt;)d(et[nt++]);for(var rt=T(d.store),ot=0;rt.length>ot;)h(rt[ot++]);u(u.S+u.F*!V,"Symbol",{for:function(t){return o(I,t+="")?I[t]:I[t]=k(t)},keyFor:function(t){if(!K(t))throw TypeError(t+" is not a symbol!");for(var e in I)if(I[e]===t)return e},useSetter:function(){B=!0},useSimple:function(){B=!1}}),u(u.S+u.F*!V,"Object",{create:Q,defineProperty:Y,defineProperties:z,getOwnPropertyDescriptor:Z,getOwnPropertyNames:$,getOwnPropertySymbols:tt}),L&&u(u.S+u.F*(!V||a(function(){var t=k();return"[null]"!=A([t])||"{}"!=A({a:t})||"{}"!=A(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=e=r[1],(b(e)||void 0!==t)&&!K(t))return m(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!K(e))return e}),r[1]=e,A.apply(L,r)}}),k[R][F]||n(19)(k[R],F,k[R].valueOf),l(k,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(t,e,n){var r=n(13)("meta"),o=n(22),i=n(9),u=n(20).f,c=0,f=Object.isExtensible||function(){return!0},a=!n(25)(function(){return f(Object.preventExtensions({}))}),s=function(t){u(t,r,{value:{i:"O"+ ++c,w:{}}})},l=function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!f(t))return"F";if(!e)return"E";s(t)}return t[r].i},p=function(t,e){if(!i(t,r)){if(!f(t))return!0;if(!e)return!1;s(t)}return t[r].w},d=function(t){return a&&v.NEED&&f(t)&&!i(t,r)&&s(t),t},v=t.exports={KEY:r,NEED:!1,fastKey:l,getWeak:p,onFreeze:d}},function(t,e,n){var r=n(12),o=n(16),i=n(42),u=n(64),c=n(20).f;t.exports=function(t){var e=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||c(e,t,{value:u.f(t)})}},function(t,e,n){var r=n(48),o=n(71),i=n(72);t.exports=function(t){var e=r(t),n=o.f;if(n)for(var u,c=n(t),f=i.f,a=0;c.length>a;)f.call(t,u=c[a++])&&e.push(u);return e}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var r=n(52);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){var r=n(50),o=n(75).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],c=function(t){try{return o(t)}catch(t){return u.slice()}};t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?c(t):o(r(t))}},function(t,e,n){var r=n(49),o=n(56).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,e,n){var r=n(72),o=n(28),i=n(50),u=n(27),c=n(9),f=n(23),a=Object.getOwnPropertyDescriptor;e.f=n(24)?a:function(t,e){if(t=i(t),e=u(e,!0),f)try{return a(t,e)}catch(t){}if(c(t,e))return o(!r.f.call(t,e),t[e])}},function(t,e){},function(t,e,n){n(69)("asyncIterator")},function(t,e,n){n(69)("observable")},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(81),i=r(o),u=n(85),c=r(u),f=n(35),a=r(f);e.default=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof e?"undefined":(0,a.default)(e)));t.prototype=(0,c.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(i.default?(0,i.default)(t,e):t.__proto__=e)}},function(t,e,n){t.exports={default:n(82),__esModule:!0}},function(t,e,n){n(83),t.exports=n(16).Object.setPrototypeOf},function(t,e,n){var r=n(15);r(r.S,"Object",{setPrototypeOf:n(84).set})},function(t,e,n){var r=n(22),o=n(21),i=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{r=n(17)(Function.call,n(76).f(Object.prototype,"__proto__").set,2),r(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return i(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:i}},function(t,e,n){t.exports={default:n(86),__esModule:!0}},function(t,e,n){n(87);var r=n(16).Object;t.exports=function(t,e){return r.create(t,e)}},function(t,e,n){var r=n(15);r(r.S,"Object",{create:n(46)})},function(e,n){e.exports=t},function(t,e,n){t.exports=n(90)()},function(t,e,n){"use strict";var r=n(91),o=n(92),i=n(93);t.exports=function(){function t(t,e,n,r,u,c){c!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return n.checkPropTypes=r,n.PropTypes=n,n}},function(t,e){"use strict";function n(t){return function(){return t}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(t){return t},t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r,i,u,c,f){if(o(e),!t){var a;if(void 0===e)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,i,u,c,f],l=0;a=new Error(e.replace(/%s/g,function(){return s[l++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}}var o=function(t){};t.exports=r},function(t,e){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";t.exports=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),i=r(o),u=n(29),c=r(u),f=n(30),a=r(f),s=n(34),l=r(s),p=n(80),d=r(p),v=n(88),h=r(v),y=n(89),m=r(y),_=n(95),b=r(_),g=n(96),x=function(t){function e(){return(0,c.default)(this,e),(0,l.default)(this,(e.__proto__||(0,i.default)(e)).apply(this,arguments))}return(0,d.default)(e,t),(0,a.default)(e,[{key:"extractChildren",value:function(){var t=this.context.extract;if(t)return void t(this.props.children)}},{key:"handleChildrens",value:function(){var t=this,e=this.props.children;if(!this.context.extract){var n=h.default.createElement("div",{className:"react-head-temp"},e),r=document.createElement("div");b.default.render(n,r,function(){var e=r.innerHTML;if(t.lastChildStr!==e){t.lastChildStr=e;var n=Array.prototype.slice.call(r.querySelector(".react-head-temp").children),o=document.head,i=o.innerHTML;n=n.filter(function(t){return i.indexOf((0,g.getDomAsString)(t))===-1}),n.forEach(function(t){var e=t.tagName.toLowerCase();if("title"===e){var n=(0,g.getDuplicateTitle)();n&&(0,g.removeChild)(o,n)}else if("meta"===e){var r=(0,g.getDuplicateMeta)(t);r&&(0,g.removeChild)(o,r)}else if("link"===e&&"canonical"===t.rel){var i=(0,g.getDuplicateCanonical)(t);i&&(0,g.removeChild)(o,i)}}),(0,g.appendChild)(document.head,n)}})}}},{key:"componentDidMount",value:function(){this.handleChildrens()}},{key:"componentDidUpdate",value:function(t){t.children!==this.props.children&&this.handleChildrens()}},{key:"render",value:function(){return this.extractChildren(),null}}]),e}(v.Component);x.contextTypes={extract:m.default.func},e.default=x},function(t,n){t.exports=e},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){var e={};if(!t)return e;for(var n=b.exec(t);null!==n;)e[n[1].toLowerCase()]=n[3]||n[4]||n[5],n=b.exec(t);return e}function i(t){return t=Array.prototype.slice.call(t||[]),t.filter(function(t){return!t.id})}function u(t){var e=void 0,n=void 0,r=[];return t=t.replace(_,function(t){return e=t,""}),t=t.replace(m,function(t){return n=t,""}),t=t.replace(y,function(t){return r.push((0,h.default)({},o(t),{_tagString:t})),""}),{title:e,metas:r,canonicalLink:n,rest:t}}function c(t){var e={};x.forEach(function(t){e[t]=[]});for(var n=[],r=function(r){var o=t[r],i=o.id,u=!1;u=i?!e.id[i]:0===g.filter(function(t){var n=e[t][o[t]];return n&&!n.id}).length,u&&(n.unshift(o),x.forEach(function(t){var n=o[t];n&&(e[t][n]=o)}))},o=t.length-1;o>=0;o--)r(o);return n}function f(){return document.head.querySelectorAll("title")}function a(){return document.head.querySelectorAll('link[rel="canonical"]')}function s(t){var e=document.head,n=t.id;return n?n&&e.querySelector("#"+n):g.reduce(function(n,r){var o=t.getAttribute(r);return o?n.concat(i(e.querySelectorAll("["+r+' = "'+o+'"]'))):n},[])}function l(t,e){void 0===e.length&&(e=[e]);for(var n=document.createDocumentFragment(),r=0,o=e.length;r<o;r++)n.appendChild(e[r]);t.appendChild(n)}function p(t,e){void 0===e.length&&(e=[e]);for(var n=0,r=e.length;n<r;n++)t.removeChild(e[n])}function d(t){var e=document.createElement("div");return e.appendChild(t),e.innerHTML}Object.defineProperty(e,"__esModule",{value:!0});var v=n(97),h=r(v);e.extractMetaAndTitle=u,e.removeDuplicateMetas=c,e.getDuplicateTitle=f,e.getDuplicateCanonical=a,e.getDuplicateMeta=s,e.appendChild=l,e.removeChild=p,e.getDomAsString=d;var y=/<meta[^<>]*?=(['"].*?['"]|[^<>]*?)*?\/?>/g,m=/<link[^<>]*?rel=['"]canonical['"].*?(\/>|<\/link>)/g,_=/<title[^<>]*?>(.*?)<\/title>/g,b=/(\S*?)=("(.*?)"|'(.*?)'|([^<>\s]*))/g,g=["property","name","itemprop"],x=g.concat(["id"])},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(98),i=r(o);e.default=i.default||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}},function(t,e,n){t.exports={default:n(99),__esModule:!0}},function(t,e,n){n(100),t.exports=n(16).Object.assign},function(t,e,n){var r=n(15);r(r.S+r.F,"Object",{assign:n(101)})},function(t,e,n){"use strict";var r=n(48),o=n(71),i=n(72),u=n(6),c=n(51),f=Object.assign;t.exports=!f||n(25)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=f({},t)[n]||Object.keys(f({},e)).join("")!=r})?function(t,e){for(var n=u(t),f=arguments.length,a=1,s=o.f,l=i.f;f>a;)for(var p,d=c(arguments[a++]),v=s?r(d).concat(s(d)):r(d),h=v.length,y=0;h>y;)l.call(d,p=v[y++])&&(n[p]=d[p]);return n}:f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),i=r(o),u=n(29),c=r(u),f=n(30),a=r(f),s=n(34),l=r(s),p=n(80),d=r(p),v=n(88),h=r(v),y=n(89),m=r(y),_=n(94),b=r(_),g=function(t){function e(){return(0,c.default)(this,e),(0,l.default)(this,(e.__proto__||(0,i.default)(e)).apply(this,arguments))}return(0,d.default)(e,t),(0,a.default)(e,[{key:"render",value:function(){return h.default.createElement(b.default,null,h.default.createElement("title",null,this.props.title))}}]),e}(v.Component);g.propTypes={title:m.default.string},e.default=g}])});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t(e.MetaTags={},e.React,e.ReactDOM)}(this,function(e,n,r){"use strict";var i="default"in n?n.default:n;function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}r=r&&r.hasOwnProperty("default")?r.default:r;var s=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;(function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}})()&&Object.assign;function y(){}var m,v=(function(e){e.exports=function(){function e(e,t,n,r,o,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}var n={array:e.isRequired=e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=y,n.PropTypes=n}()}(m={exports:{}},m.exports),m.exports),b=function(e){function t(){return o(this,t),f(this,l(t).apply(this,arguments))}return u(t,n.Component),c(t,[{key:"getChildContext",value:function(){return{extract:this.props.extract}}},{key:"render",value:function(){return n.Children.only(this.props.children)}}]),t}();t(b,"childContextTypes",{extract:v.func});var O=["property","name","itemprop"];function g(o){var i=document.head,e=o.id;return e?e&&i.querySelector("#".concat(e)):O.reduce(function(e,t){var n,r=o.getAttribute(t);return r?e.concat((n=i.querySelectorAll("[".concat(t,' = "').concat(r,'"]')),(n=Array.prototype.slice.call(n||[])).filter(function(e){return!e.id}))):e},[])}function j(e,t){void 0===t.length&&(t=[t]);for(var n=0,r=t.length;n<r;n++)e.removeChild(t[n])}var C=function(e){function t(){return o(this,t),f(this,l(t).apply(this,arguments))}return u(t,n.Component),c(t,[{key:"extractChildren",value:function(){var e=this.context.extract;e&&e(this.props.children)}},{key:"handleChildrens",value:function(){var n=this,e=this.props.children;if(!this.context.extract){var t=i.createElement("div",{className:"react-head-temp"},e),o=document.createElement("div");r.render(t,o,function(){var e=o.innerHTML;if(n.lastChildStr!==e){n.lastChildStr=e;var t=Array.prototype.slice.call(o.querySelector(".react-head-temp").children),i=document.head,r=i.innerHTML;(t=t.filter(function(e){return-1===r.indexOf((t=e,(n=document.createElement("div")).appendChild(t),n.innerHTML));var t,n})).forEach(function(e){var t=e.tagName.toLowerCase();if("title"===t){var n=document.head.querySelectorAll("title");n&&j(i,n)}else if("meta"===t){var r=g(e);r&&j(i,r)}else if("link"===t&&"canonical"===e.rel){var o=document.head.querySelectorAll('link[rel="canonical"]');o&&j(i,o)}}),function(e,t){void 0===t.length&&(t=[t]);for(var n=document.createDocumentFragment(),r=0,o=t.length;r<o;r++)n.appendChild(t[r]);e.appendChild(n)}(document.head,t)}})}}},{key:"componentDidMount",value:function(){this.handleChildrens()}},{key:"componentDidUpdate",value:function(e){e.children!==this.props.children&&this.handleChildrens()}},{key:"render",value:function(){return this.extractChildren(),null}}]),t}();t(C,"contextTypes",{extract:v.func});var x=function(e){function t(){return o(this,t),f(this,l(t).apply(this,arguments))}return u(t,n.Component),c(t,[{key:"render",value:function(){return i.createElement(C,null,i.createElement("title",null,this.props.title))}}]),t}();t(x,"propTypes",{title:v.string}),e.default=C,e.MetaTags=C,e.MetaTagsContext=b,e.ReactTitle=x,Object.defineProperty(e,"__esModule",{value:!0})});

3

examples/app.js

@@ -39,3 +39,4 @@ import express from 'express';

const meta = metaTagsInstance.renderToString();
//const meta = metaTagsInstance.renderToString();
const meta = '';

@@ -42,0 +43,0 @@ const template = `

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,21 +6,31 @@ Object.defineProperty(exports, "__esModule", {

});
exports.ReactTitle = exports.MetaTagsContext = exports.MetaTags = undefined;
Object.defineProperty(exports, "MetaTagsContext", {
enumerable: true,
get: function get() {
return _meta_tags_context.default;
}
});
Object.defineProperty(exports, "MetaTags", {
enumerable: true,
get: function get() {
return _meta_tags.default;
}
});
Object.defineProperty(exports, "ReactTitle", {
enumerable: true,
get: function get() {
return _react_title.default;
}
});
exports.default = void 0;
var _meta_tags_context = require('./meta_tags_context');
var _meta_tags_context = _interopRequireDefault(require("./meta_tags_context"));
var _meta_tags_context2 = _interopRequireDefault(_meta_tags_context);
var _meta_tags = _interopRequireDefault(require("./meta_tags"));
var _meta_tags = require('./meta_tags');
var _react_title = _interopRequireDefault(require("./react_title"));
var _meta_tags2 = _interopRequireDefault(_meta_tags);
var _react_title = require('./react_title');
var _react_title2 = _interopRequireDefault(_react_title);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _meta_tags2.default;
exports.MetaTags = _meta_tags2.default;
exports.MetaTagsContext = _meta_tags_context2.default;
exports.ReactTitle = _react_title2.default;
var _default = _meta_tags.default;
exports.default = _default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,47 +6,51 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _react = require("react");
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _createClass2 = require('babel-runtime/helpers/createClass');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _createClass3 = _interopRequireDefault(_createClass2);
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
var _inherits2 = require('babel-runtime/helpers/inherits');
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var _inherits3 = _interopRequireDefault(_inherits2);
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var _react = require('react');
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
var _propTypes = require('prop-types');
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/** context class which passes extract fuunction to MetaTags Component **/
var MetaTagsContext = function (_Component) {
(0, _inherits3.default)(MetaTagsContext, _Component);
var MetaTagsContext =
/*#__PURE__*/
function (_Component) {
_inherits(MetaTagsContext, _Component);
function MetaTagsContext() {
(0, _classCallCheck3.default)(this, MetaTagsContext);
return (0, _possibleConstructorReturn3.default)(this, (MetaTagsContext.__proto__ || (0, _getPrototypeOf2.default)(MetaTagsContext)).apply(this, arguments));
_classCallCheck(this, MetaTagsContext);
return _possibleConstructorReturn(this, _getPrototypeOf(MetaTagsContext).apply(this, arguments));
}
(0, _createClass3.default)(MetaTagsContext, [{
key: 'getChildContext',
_createClass(MetaTagsContext, [{
key: "getChildContext",
value: function getChildContext() {
return { extract: this.props.extract };
return {
extract: this.props.extract
};
}
}, {
key: 'render',
key: "render",
value: function render() {

@@ -56,8 +60,12 @@ return _react.Children.only(this.props.children);

}]);
return MetaTagsContext;
}(_react.Component);
MetaTagsContext.childContextTypes = {
extract: _propTypes2.default.func
};
exports.default = MetaTagsContext;
_defineProperty(MetaTagsContext, "childContextTypes", {
extract: _propTypes.default.func
});
var _default = MetaTagsContext;
exports.default = _default;
module.exports = exports.default;

@@ -1,13 +0,14 @@

'use strict';
"use strict";
var _react = require('react');
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react2 = _interopRequireDefault(_react);
var _react = _interopRequireDefault(require("react"));
var _server = require('react-dom/server');
var _server = _interopRequireDefault(require("react-dom/server"));
var _server2 = _interopRequireDefault(_server);
var _utils = require("./utils");
var _utils = require('./utils');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -17,3 +18,2 @@

var headElms = [];
return {

@@ -24,10 +24,9 @@ extract: function extract(elms) {

renderToString: function renderToString() {
var headComponent = _react2.default.createElement(
'div',
{ className: 'react-head-temp' },
headElms
);
var componentStr = _server2.default.renderToStaticMarkup(headComponent);
var headComponent = _react.default.createElement("div", {
className: "react-head-temp"
}, headElms);
//remove wrapper div from string
var componentStr = _server.default.renderToStaticMarkup(headComponent); //remove wrapper div from string
componentStr = componentStr.replace(/^<div[^<>]*class="react-head-temp"[^<>]*>(.*)<\/div>$/, function ($1, $2) {

@@ -39,6 +38,6 @@ return $2;

_extractMetaAndTitle$ = _extractMetaAndTitle.title,
title = _extractMetaAndTitle$ === undefined ? '' : _extractMetaAndTitle$,
title = _extractMetaAndTitle$ === void 0 ? '' : _extractMetaAndTitle$,
metas = _extractMetaAndTitle.metas,
_extractMetaAndTitle$2 = _extractMetaAndTitle.canonicalLink,
canonicalLink = _extractMetaAndTitle$2 === undefined ? '' : _extractMetaAndTitle$2,
canonicalLink = _extractMetaAndTitle$2 === void 0 ? '' : _extractMetaAndTitle$2,
rest = _extractMetaAndTitle.rest;

@@ -49,4 +48,3 @@

}).join('');
return '\n ' + title + '\n ' + metasStr + '\n ' + canonicalLink + '\n ' + rest + '\n ';
return "\n ".concat(title, "\n ").concat(metasStr, "\n ").concat(canonicalLink, "\n ").concat(rest, "\n ");
}

@@ -56,2 +54,4 @@ };

module.exports = MetaTagsServer;
var _default = MetaTagsServer;
exports.default = _default;
module.exports = exports.default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,54 +6,53 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _react = _interopRequireWildcard(require("react"));
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _reactDom = _interopRequireDefault(require("react-dom"));
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _utils = require("./utils");
var _createClass2 = require('babel-runtime/helpers/createClass');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _createClass3 = _interopRequireDefault(_createClass2);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _inherits2 = require('babel-runtime/helpers/inherits');
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
var _inherits3 = _interopRequireDefault(_inherits2);
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var _react = require('react');
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
var _react2 = _interopRequireDefault(_react);
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var _propTypes = require('prop-types');
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
var _reactDom = require('react-dom');
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var _reactDom2 = _interopRequireDefault(_reactDom);
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _utils = require('./utils');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/** An wrapper component to wrap element which need to shifted to head **/
var MetaTags = function (_Component) {
(0, _inherits3.default)(MetaTags, _Component);
var MetaTags =
/*#__PURE__*/
function (_Component) {
_inherits(MetaTags, _Component);
function MetaTags() {
(0, _classCallCheck3.default)(this, MetaTags);
return (0, _possibleConstructorReturn3.default)(this, (MetaTags.__proto__ || (0, _getPrototypeOf2.default)(MetaTags)).apply(this, arguments));
_classCallCheck(this, MetaTags);
return _possibleConstructorReturn(this, _getPrototypeOf(MetaTags).apply(this, arguments));
}
(0, _createClass3.default)(MetaTags, [{
key: 'extractChildren',
_createClass(MetaTags, [{
key: "extractChildren",
value: function extractChildren() {
var extract = this.context.extract;
if (extract) {

@@ -65,9 +64,8 @@ extract(this.props.children);

}, {
key: 'handleChildrens',
key: "handleChildrens",
value: function handleChildrens() {
var _this2 = this;
var _this = this;
var children = this.props.children;
if (this.context.extract) {

@@ -77,32 +75,27 @@ return;

var headComponent = _react2.default.createElement(
'div',
{ className: 'react-head-temp' },
children
);
var headComponent = _react.default.createElement("div", {
className: "react-head-temp"
}, children);
var temp = document.createElement("div");
_reactDom2.default.render(headComponent, temp, function () {
var childStr = temp.innerHTML;
//if html is not changed return
if (_this2.lastChildStr === childStr) {
_reactDom.default.render(headComponent, temp, function () {
var childStr = temp.innerHTML; //if html is not changed return
if (_this.lastChildStr === childStr) {
return;
}
_this2.lastChildStr = childStr;
_this.lastChildStr = childStr;
var childNodes = Array.prototype.slice.call(temp.querySelector('.react-head-temp').children);
var head = document.head;
var headHtml = head.innerHTML;
var headHtml = head.innerHTML; //filter children remove if children has not been changed
//filter children remove if children has not been changed
childNodes = childNodes.filter(function (child) {
return headHtml.indexOf((0, _utils.getDomAsString)(child)) === -1;
});
}); //remove duplicate title and meta from head
//remove duplicate title and meta from head
childNodes.forEach(function (child) {
var tag = child.tagName.toLowerCase();
if (tag === 'title') {

@@ -119,3 +112,2 @@ var title = (0, _utils.getDuplicateTitle)();

});
(0, _utils.appendChild)(document.head, childNodes);

@@ -125,3 +117,3 @@ });

}, {
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {

@@ -131,3 +123,3 @@ this.handleChildrens();

}, {
key: 'componentDidUpdate',
key: "componentDidUpdate",
value: function componentDidUpdate(oldProps) {

@@ -139,3 +131,3 @@ if (oldProps.children !== this.props.children) {

}, {
key: 'render',
key: "render",
value: function render() {

@@ -146,8 +138,12 @@ this.extractChildren();

}]);
return MetaTags;
}(_react.Component);
MetaTags.contextTypes = {
extract: _propTypes2.default.func
};
exports.default = MetaTags;
_defineProperty(MetaTags, "contextTypes", {
extract: _propTypes.default.func
});
var _default = MetaTags;
exports.default = _default;
module.exports = exports.default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,65 +6,61 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _react = _interopRequireWildcard(require("react"));
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _meta_tags = _interopRequireDefault(require("./meta_tags"));
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _createClass2 = require('babel-runtime/helpers/createClass');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
var _createClass3 = _interopRequireDefault(_createClass2);
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
var _inherits2 = require('babel-runtime/helpers/inherits');
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var _inherits3 = _interopRequireDefault(_inherits2);
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
var _react = require('react');
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var _react2 = _interopRequireDefault(_react);
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var _propTypes = require('prop-types');
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var _meta_tags = require('./meta_tags');
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _meta_tags2 = _interopRequireDefault(_meta_tags);
var ReactTitle =
/*#__PURE__*/
function (_Component) {
_inherits(ReactTitle, _Component);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ReactTitle() {
_classCallCheck(this, ReactTitle);
var ReactTitle = function (_Component) {
(0, _inherits3.default)(ReactTitle, _Component);
function ReactTitle() {
(0, _classCallCheck3.default)(this, ReactTitle);
return (0, _possibleConstructorReturn3.default)(this, (ReactTitle.__proto__ || (0, _getPrototypeOf2.default)(ReactTitle)).apply(this, arguments));
return _possibleConstructorReturn(this, _getPrototypeOf(ReactTitle).apply(this, arguments));
}
(0, _createClass3.default)(ReactTitle, [{
key: 'render',
_createClass(ReactTitle, [{
key: "render",
value: function render() {
return _react2.default.createElement(
_meta_tags2.default,
null,
_react2.default.createElement(
'title',
null,
this.props.title
)
);
return _react.default.createElement(_meta_tags.default, null, _react.default.createElement("title", null, this.props.title));
}
}]);
return ReactTitle;
}(_react.Component);
ReactTitle.propTypes = {
title: _propTypes2.default.string
};
exports.default = ReactTitle;
_defineProperty(ReactTitle, "propTypes", {
title: _propTypes.default.string
});
var _default = ReactTitle;
exports.default = _default;
module.exports = exports.default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,7 +6,2 @@ Object.defineProperty(exports, "__esModule", {

});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
exports.extractMetaAndTitle = extractMetaAndTitle;

@@ -21,4 +16,6 @@ exports.removeDuplicateMetas = removeDuplicateMetas;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var metaRegex = /<meta[^<>]*?=(['"].*?['"]|[^<>]*?)*?\/?>/g;

@@ -30,3 +27,2 @@ var canonicalLinkRegex = /<link[^<>]*?rel=['"]canonical['"].*?(\/>|<\/link>)/g;

var uniqueIdentifiersAll = uniqueIdentifiers.concat(['id']);
/**

@@ -43,2 +39,3 @@ Note:

var match = attributesRegex.exec(tagString);
while (match !== null) {

@@ -60,24 +57,21 @@ attr[match[1].toLowerCase()] = match[3] || match[4] || match[5];

function extractMetaAndTitle(domString) {
var title = void 0,
canonicalLink = void 0;
var metas = [];
var title, canonicalLink;
var metas = []; //extract title, only take the last title, remove title from the string
//extract title, only take the last title, remove title from the string
domString = domString.replace(titleRegex, function (titleStr) {
title = titleStr;
return '';
});
}); //extract canonical
//extract canonical
domString = domString.replace(canonicalLinkRegex, function (canonicalLinkStr) {
canonicalLink = canonicalLinkStr;
return '';
});
}); //extract metas
//extract metas
domString = domString.replace(metaRegex, function (_tagString) {
metas.push((0, _extends3.default)({}, getAttributes(_tagString), { _tagString: _tagString }));
metas.push(_objectSpread({}, getAttributes(_tagString), {
_tagString: _tagString
}));
return '';
});
return {

@@ -92,9 +86,7 @@ title: title,

function removeDuplicateMetas(metas) {
var addedMeta = {};
var addedMeta = {}; //initialize all the identifiers with empty array
//initialize all the identifiers with empty array
uniqueIdentifiersAll.forEach(function (identifier) {
addedMeta[identifier] = [];
});
var filteredMetas = [];

@@ -104,12 +96,7 @@

var meta = metas[i];
var id = meta.id;
var addMeta = false; //if has id and element with id is not present than always add meta
var addMeta = false;
//if has id and element with id is not present than always add meta
if (id) {
addMeta = !addedMeta.id[id];
//for any other unique identifier check if meta already available with same identifier which doesn't have id
addMeta = !addedMeta.id[id]; //for any other unique identifier check if meta already available with same identifier which doesn't have id
} else {

@@ -123,5 +110,4 @@ addMeta = uniqueIdentifiers.filter(function (identifier) {

if (addMeta) {
filteredMetas.unshift(meta);
filteredMetas.unshift(meta); //add meta as added
//add meta as added
uniqueIdentifiersAll.forEach(function (identifier) {

@@ -151,25 +137,20 @@ var identifierValue = meta[identifier];

var head = document.head;
var id = meta.id;
var id = meta.id; //if has id and element with id is not present than return the element
//if has id and element with id is not present than return the element
if (id) {
return id && head.querySelector('#' + id);
}
return id && head.querySelector("#".concat(id));
} //for any other unique identifier check if metas already available with same identifier which doesn't have id
//for any other unique identifier check if metas already available with same identifier which doesn't have id
return uniqueIdentifiers.reduce(function (duplicates, identifier) {
var identifierValue = meta.getAttribute(identifier);
return identifierValue ? duplicates.concat(filterOutMetaWithId(head.querySelectorAll('[' + identifier + ' = "' + identifierValue + '"]'))) : duplicates;
return identifierValue ? duplicates.concat(filterOutMetaWithId(head.querySelectorAll("[".concat(identifier, " = \"").concat(identifierValue, "\"]")))) : duplicates;
}, []);
}
} //function to append childrens on a parent
//function to append childrens on a parent
function appendChild(parent, childrens) {
if (childrens.length === undefined) childrens = [childrens];
var docFrag = document.createDocumentFragment(); //we used for loop instead of forEach because childrens can be array like object
var docFrag = document.createDocumentFragment();
//we used for loop instead of forEach because childrens can be array like object
for (var i = 0, ln = childrens.length; i < ln; i++) {

@@ -184,8 +165,9 @@ docFrag.appendChild(childrens[i]);

if (childrens.length === undefined) childrens = [childrens];
for (var i = 0, ln = childrens.length; i < ln; i++) {
parent.removeChild(childrens[i]);
}
}
} //get dom as string format
//get dom as string format
function getDomAsString(dom) {

@@ -192,0 +174,0 @@ var temp = document.createElement('div');

{
"name": "react-meta-tags",
"description": "Handle document meta/head tags in isomorphic react with ease.",
"version": "0.5.1",
"version": "0.6.0",
"main": "lib/index.js",
"author": "Sudhanshu Yadav",
"license": "MIT",
"sideEffects": false,
"repository": {

@@ -29,44 +30,38 @@ "type": "git",

"start-dev": "cross-env webpack-dev-server --content-base example/ --config webpack.dev.config.js --watch-poll --progress --inline --hot",
"bundle": "cross-env NODE_ENV=production webpack --config webpack.bundle.config.js && npm run compile",
"bundle": "cross-env NODE_ENV=production rollup -c rollup.config.js && npm run compile",
"compile": "cross-env babel src --out-dir lib"
},
"devDependencies": {
"babel-cli": "^6.7.5",
"babel-core": "^6.7.2",
"babel-eslint": "^6.0.0",
"babel-loader": "^6.2.4",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-transform-class-properties": "^6.11.5",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.3.13",
"babel-register": "^6.7.2",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.1",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.2",
"babel-plugin-add-module-exports": "^1.0.0",
"classnames": "^2.2.3",
"cross-env": "^3.1.4",
"eslint": "^2.5.3",
"eslint-config-standard": "^5.1.0",
"eslint-loader": "^1.3.0",
"eslint-plugin-import": "^1.4.0",
"eslint-plugin-jsx-a11y": "^0.6.2",
"eslint-plugin-promise": "^1.1.0",
"eslint-plugin-react": "^4.3.0",
"eslint-plugin-standard": "^1.3.2",
"jasmine": "^2.4.1",
"jasmine-core": "^2.4.1",
"json-loader": "^0.5.4",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-cli": "^0.1.2",
"karma-jasmine": "^0.3.7",
"karma-jasmine-html-reporter": "^0.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"eslint": "^5.6.0",
"eslint-loader": "^2.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-react": "^7.11.1",
"nodemon": "^1.12.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-router": "^3.2.0",
"react-router": "3",
"react-transform-hmr": "^1.0.4",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.14.1"
"rollup": "^0.65.2",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-commonjs": "^9.1.6",
"rollup-plugin-filesize": "^4.0.1",
"rollup-plugin-license": "^0.7.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^5.0.2",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.7"
},

@@ -78,5 +73,4 @@ "peerDependencies": {

"dependencies": {
"babel-runtime": "^6.26.0",
"prop-types": "^15.6.0"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc