From e55d0a73c3a6fd418a1c1840403e5baa8578aac9 Mon Sep 17 00:00:00 2001 From: Sahil Date: Mon, 24 Feb 2020 22:54:36 +0530 Subject: [PATCH 1/2] bump react to 15.6.0 and remove warnings --- package.json | 7 +++-- site/_core/Marked.js | 51 ++++++++++++++++--------------- site/_core/Prism.js | 3 +- yarn.lock | 73 +++++++++++++++++++++++++++++++++++--------- 4 files changed, 90 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index 5e53db4315..cbdc0fbfbb 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "express": "^4.13.3", "js-yaml": "^3.13.1", "less": "^2.7.1", - "react": "15.3.1", - "react-dom": "15.3.1", + "react": "15.6.0", + "react-dom": "15.6.0", "sane": "^1.2.0", "webpack": "^1.12.1" }, @@ -36,6 +36,7 @@ "codemirror-graphql": "^0.5.7", "graphql": "^0.7.0", "graphql-tools": "^0.6.6", - "marked": "^0.3.5" + "marked": "^0.3.5", + "react-dom-factories": "^1.0.2" } } diff --git a/site/_core/Marked.js b/site/_core/Marked.js index b47ad11cbd..ef689d2f55 100644 --- a/site/_core/Marked.js +++ b/site/_core/Marked.js @@ -5,6 +5,7 @@ */ var React = require('react'); +var DOM = require('react-dom-factories'); var Prism = require('./Prism'); import Header from './Header'; @@ -583,7 +584,7 @@ InlineLexer.prototype.output = function(src) { text = cap[1]; href = text; } - out.push(React.DOM.a({href: this.sanitizeUrl(href)}, text)); + out.push(DOM.a({href: this.sanitizeUrl(href)}, text)); continue; } @@ -592,7 +593,7 @@ InlineLexer.prototype.output = function(src) { src = src.substring(cap[0].length); text = cap[1]; href = text; - out.push(React.DOM.a({href: this.sanitizeUrl(href)}, text)); + out.push(DOM.a({href: this.sanitizeUrl(href)}, text)); continue; } @@ -632,35 +633,35 @@ InlineLexer.prototype.output = function(src) { // strong if (cap = this.rules.strong.exec(src)) { src = src.substring(cap[0].length); - out.push(React.DOM.strong(null, this.output(cap[2] || cap[1]))); + out.push(DOM.strong(null, this.output(cap[2] || cap[1]))); continue; } // em if (cap = this.rules.em.exec(src)) { src = src.substring(cap[0].length); - out.push(React.DOM.em(null, this.output(cap[2] || cap[1]))); + out.push(DOM.em(null, this.output(cap[2] || cap[1]))); continue; } // code if (cap = this.rules.code.exec(src)) { src = src.substring(cap[0].length); - out.push(React.DOM.code(null, cap[2])); + out.push(DOM.code(null, cap[2])); continue; } // br if (cap = this.rules.br.exec(src)) { src = src.substring(cap[0].length); - out.push(React.DOM.br(null, null)); + out.push(DOM.br(null, null)); continue; } // del (gfm) if (cap = this.rules.del.exec(src)) { src = src.substring(cap[0].length); - out.push(React.DOM.del(null, this.output(cap[1]))); + out.push(DOM.del(null, this.output(cap[1]))); continue; } @@ -710,14 +711,14 @@ InlineLexer.prototype.outputLink = function(cap, link) { link.href.charAt(0) !== '/' && link.href.charAt(0) !== '#'; - return React.DOM.a({ + return DOM.a({ href: this.sanitizeUrl(link.href), title: link.title, target: shouldOpenInNewWindow ? '_blank' : null, rel: shouldOpenInNewWindow ? 'nofollow noopener noreferrer' : null }, this.output(cap[1])); } else { - return React.DOM.img({ + return DOM.img({ src: this.sanitizeUrl(link.href), alt: cap[1], title: link.title @@ -814,7 +815,7 @@ Parser.prototype.tok = function() { return []; } case 'hr': { - return React.DOM.hr(null, null); + return DOM.hr(null, null); } case 'heading': { return ( @@ -860,32 +861,32 @@ Parser.prototype.tok = function() { // header for (i = 0; i < this.token.header.length; i++) { heading = this.inline.output(this.token.header[i]); - row.push(React.DOM.th( + row.push(DOM.th( this.token.align[i] ? {style: {textAlign: this.token.align[i]}} : null, heading )); } - table.push(React.DOM.thead(null, React.DOM.tr(null, row))); + table.push(DOM.thead(null, DOM.tr(null, row))); // body for (i = 0; i < this.token.cells.length; i++) { row = []; cells = this.token.cells[i]; for (j = 0; j < cells.length; j++) { - row.push(React.DOM.td( + row.push(DOM.td( this.token.align[j] ? {style: {textAlign: this.token.align[j]}} : null, this.inline.output(cells[j]) )); } - body.push(React.DOM.tr(null, row)); + body.push(DOM.tr(null, row)); } - table.push(React.DOM.thead(null, body)); + table.push(DOM.thead(null, body)); - return React.DOM.table(null, table); + return DOM.table(null, table); } case 'blockquote_start': { var body = []; @@ -894,7 +895,7 @@ Parser.prototype.tok = function() { body.push(this.tok()); } - return React.DOM.blockquote(null, body); + return DOM.blockquote(null, body); } case 'list_start': { var type = this.token.ordered ? 'ol' : 'ul' @@ -904,7 +905,7 @@ Parser.prototype.tok = function() { body.push(this.tok()); } - return React.DOM[type](null, body); + return DOM[type](null, body); } case 'list_item_start': { var body = []; @@ -915,7 +916,7 @@ Parser.prototype.tok = function() { : this.tok()); } - return React.DOM.li(null, body); + return DOM.li(null, body); } case 'loose_item_start': { var body = []; @@ -924,10 +925,10 @@ Parser.prototype.tok = function() { body.push(this.tok()); } - return React.DOM.li(null, body); + return DOM.li(null, body); } case 'html': { - return React.DOM.div({ + return DOM.div({ dangerouslySetInnerHTML: { __html: this.token.text } @@ -936,12 +937,12 @@ Parser.prototype.tok = function() { case 'paragraph': { return this.options.paragraphFn ? this.options.paragraphFn.call(null, this.inline.output(this.token.text)) - : React.DOM.p(null, this.inline.output(this.token.text)); + : DOM.p(null, this.inline.output(this.token.text)); } case 'text': { return this.options.paragraphFn ? this.options.paragraphFn.call(null, this.parseText()) - : React.DOM.p(null, this.parseText()); + : DOM.p(null, this.parseText()); } } }; @@ -1067,8 +1068,8 @@ function marked(src, opt, callback) { } catch (e) { e.message += '\nPlease report this to https://github.com/chjj/marked.'; if ((opt || marked.defaults).silent) { - return [React.DOM.p(null, "An error occurred:"), - React.DOM.pre(null, e.message)]; + return [DOM.p(null, "An error occurred:"), + DOM.pre(null, e.message)]; } throw e; } diff --git a/site/_core/Prism.js b/site/_core/Prism.js index e9e5d2f3f2..34cbd7f938 100644 --- a/site/_core/Prism.js +++ b/site/_core/Prism.js @@ -1,4 +1,5 @@ var React = require('react'); +var DOM = require('react-dom-factories'); export default function PrismComponent(props) { const lines = []; @@ -520,7 +521,7 @@ Token.reactify = function(o, language, parent, key) { env.attributes.className = env.classes.join(' '); - return React.DOM[env.tag](env.attributes, env.content); + return DOM[env.tag](env.attributes, env.content); }; Prism.languages.markup = { diff --git a/yarn.lock b/yarn.lock index 92e5305ea8..431097822d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -757,6 +757,15 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= +create-react-class@^15.5.2: + version "15.6.3" + resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036" + integrity sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg== + dependencies: + fbjs "^0.8.9" + loose-envify "^1.3.1" + object-assign "^4.1.1" + cryptiles@2.x.x: version "2.0.5" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" @@ -1117,7 +1126,7 @@ fb-watchman@^2.0.0: dependencies: bser "^2.0.0" -fbjs@^0.8.4: +fbjs@^0.8.9: version "0.8.17" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90= @@ -1869,7 +1878,7 @@ longest@^1.0.1: resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc= -loose-envify@^1.0.0, loose-envify@^1.1.0: +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== @@ -2214,7 +2223,7 @@ object-assign@^3.0.0: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2" integrity sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I= -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -2403,6 +2412,23 @@ promise@^7.1.1: dependencies: asap "~2.0.3" +prop-types@^15.5.7: + version "15.7.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" + integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.8.1" + +prop-types@~15.5.7: + version "15.5.10" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154" + integrity sha1-J5ffwxJhguOpXj37suiT3ddFYVQ= + dependencies: + fbjs "^0.8.9" + loose-envify "^1.3.1" + proxy-addr@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93" @@ -2485,19 +2511,36 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -react-dom@15.3.1: - version "15.3.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.3.1.tgz#6d42cd2b64c8c5e0b693f3ffaec301e6e627e24e" - integrity sha1-bULNK2TIxeC2k/P/rsMB5uYn4k4= +react-dom-factories@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/react-dom-factories/-/react-dom-factories-1.0.2.tgz#eb7705c4db36fb501b3aa38ff759616aa0ff96e0" + integrity sha1-63cFxNs2+1AbOqOP91lhaqD/luA= + +react-dom@15.6.0: + version "15.6.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.0.tgz#8bc23cb0c80e706355b76ca9f8ce47cf7bdfb6d1" + integrity sha1-i8I8sMgOcGNVt2yp+M5Hz3vfttE= + dependencies: + fbjs "^0.8.9" + loose-envify "^1.1.0" + object-assign "^4.1.0" + prop-types "~15.5.7" + +react-is@^16.8.1: + version "16.12.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" + integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== -react@15.3.1: - version "15.3.1" - resolved "https://registry.yarnpkg.com/react/-/react-15.3.1.tgz#f78501ed8c2ec6e6e31c3223652e97f1369d2bd6" - integrity sha1-94UB7YwuxubjHDIjZS6X8TadK9Y= +react@15.6.0: + version "15.6.0" + resolved "https://registry.yarnpkg.com/react/-/react-15.6.0.tgz#c23299b48e30ed302508ce89e1a02c919f826bce" + integrity sha1-wjKZtI4w7TAlCM6J4aAskZ+Ca84= dependencies: - fbjs "^0.8.4" + create-react-class "^15.5.2" + fbjs "^0.8.9" loose-envify "^1.1.0" object-assign "^4.1.0" + prop-types "^15.5.7" readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.3.6: version "2.3.6" @@ -3172,9 +3215,9 @@ type-is@~1.6.16: mime-types "~2.1.18" ua-parser-js@^0.7.18: - version "0.7.19" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b" - integrity sha512-T3PVJ6uz8i0HzPxOF9SWzWAlfN/DavlpQqepn22xgve/5QecC+XMCAtmUNnY7C9StehaV6exjUCI801lOI7QlQ== + version "0.7.21" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.21.tgz#853cf9ce93f642f67174273cc34565ae6f308777" + integrity sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ== uglify-js@~2.7.3: version "2.7.5" From d8155655721f5dff3eb6c8ebc94fdec1e7b18a3c Mon Sep 17 00:00:00 2001 From: Sahil Date: Mon, 24 Feb 2020 23:05:16 +0530 Subject: [PATCH 2/2] bump react to 16.12.0 and remove warnings --- package.json | 4 +- site/_core/BlogSidebar.js | 21 +++++-- site/_core/DocsSidebar.js | 3 +- site/_core/HeaderLinks.js | 5 +- yarn.lock | 112 +++++++++----------------------------- 5 files changed, 47 insertions(+), 98 deletions(-) diff --git a/package.json b/package.json index cbdc0fbfbb..292e19e306 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "express": "^4.13.3", "js-yaml": "^3.13.1", "less": "^2.7.1", - "react": "15.6.0", - "react-dom": "15.6.0", + "react": "16.12.0", + "react-dom": "16.12.0", "sane": "^1.2.0", "webpack": "^1.12.1" }, diff --git a/site/_core/BlogSidebar.js b/site/_core/BlogSidebar.js index 53f96d09f8..e96809a8a8 100644 --- a/site/_core/BlogSidebar.js +++ b/site/_core/BlogSidebar.js @@ -9,23 +9,32 @@ var path = require('path'); var React = require('react'); -module.exports = ({ site, page }) => +module.exports = ({ site, page }) => (

Subscribe

- RSS + + RSS +

Recent Posts

    {site.files.blog - .filter(file => !file.draft && path.extname(file.relPath) === '.md') + .filter(file => !file.draft && path.extname(file.relPath) === ".md") .sort((a, b) => a.date < b.date) - .map(post => + .map((post, i) => (
  • - {post === page ? post.title : {post.title}} + {post === page ? ( + post.title + ) : ( + + {post.title} + + )}
  • - )} + ))}
+); diff --git a/site/_core/DocsSidebar.js b/site/_core/DocsSidebar.js index 6acff72ce6..df72f2442f 100644 --- a/site/_core/DocsSidebar.js +++ b/site/_core/DocsSidebar.js @@ -11,11 +11,12 @@ import { toSlug } from './Header'; export default ({ site, page, firstURL }) =>
- {getCategories(site, page.dir, firstURL).map(category => + {getCategories(site, page.dir, firstURL).map((category, i) => )}
diff --git a/site/_core/HeaderLinks.js b/site/_core/HeaderLinks.js index 2b2e16c5fe..6df35e5891 100644 --- a/site/_core/HeaderLinks.js +++ b/site/_core/HeaderLinks.js @@ -20,13 +20,14 @@ const links = [ export default ({ section }) =>