From 394fee689ac360311de700b8e1ac28e6c29b7bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= Date: Fri, 9 Sep 2022 15:13:05 +0200 Subject: [PATCH 1/2] chore: simplify `with-rebass` example --- examples/with-rebass/.babelrc | 9 --------- examples/with-rebass/package.json | 11 ++--------- examples/with-rebass/pages/_document.js | 18 ------------------ 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 examples/with-rebass/.babelrc delete mode 100644 examples/with-rebass/pages/_document.js diff --git a/examples/with-rebass/.babelrc b/examples/with-rebass/.babelrc deleted file mode 100644 index d9c3f919cedb3..0000000000000 --- a/examples/with-rebass/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": ["next/babel"], - "plugins": [ - [ - "styled-components", - { "ssr": true, "displayName": true, "preprocess": false } - ] - ] -} diff --git a/examples/with-rebass/package.json b/examples/with-rebass/package.json index d5fd2bd64cd08..bf29745bfe271 100644 --- a/examples/with-rebass/package.json +++ b/examples/with-rebass/package.json @@ -7,14 +7,7 @@ }, "dependencies": { "next": "latest", - "react": "^18.0.0", - "react-dom": "^18.0.0", - "rebass": "^4.0.7", - "styled-components": "^5.3.0" - }, - "devDependencies": { - "babel-plugin-styled-components": "^2.0.7", - "babel-plugin-transform-object-assign": "^6.22.0", - "babel-plugin-transform-object-set-prototype-of-to-assign": "^6.22.0" + "react": "^18.2.0", + "react-dom": "^18.2.0" } } diff --git a/examples/with-rebass/pages/_document.js b/examples/with-rebass/pages/_document.js deleted file mode 100644 index 2734d4e2736b3..0000000000000 --- a/examples/with-rebass/pages/_document.js +++ /dev/null @@ -1,18 +0,0 @@ -import { Html, Head, Main, NextScript } from 'next/document' -import { ServerStyleSheet } from 'styled-components' - -export default function Document() { - const sheet = new ServerStyleSheet() - const main = sheet.collectStyles(
) - const styleTags = sheet.getStyleElement() - - return ( - - {styleTags} - -
{main}
- - - - ) -} From 495fbae816e57c4f688e2dd30caa2d7ca85b6e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= Date: Fri, 9 Sep 2022 15:19:56 +0200 Subject: [PATCH 2/2] chore: remove `this.props` reference --- examples/with-strict-csp/pages/_document.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/with-strict-csp/pages/_document.js b/examples/with-strict-csp/pages/_document.js index c65a843228018..f85a7eaeb7ea4 100644 --- a/examples/with-strict-csp/pages/_document.js +++ b/examples/with-strict-csp/pages/_document.js @@ -6,13 +6,13 @@ const cspHashOf = (text) => { hash.update(text) return `'sha256-${hash.digest('base64')}'` } -export default function Document() { +export default function Document(ctx) { let csp = `default-src 'self'; script-src 'self' ${cspHashOf( - NextScript.getInlineScriptSource(this.props) + NextScript.getInlineScriptSource(ctx) )}` if (process.env.NODE_ENV !== 'production') { csp = `style-src 'self' 'unsafe-inline'; font-src 'self' data:; default-src 'self'; script-src 'unsafe-eval' 'self' ${cspHashOf( - NextScript.getInlineScriptSource(this.props) + NextScript.getInlineScriptSource(ctx) )}` }