language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | packages/next/pages/_document.tsx | @@ -201,7 +201,6 @@ export class Head extends Component<OriginProps> {
} = this.context._documentProps
const { _devOnlyInvalidateCacheQueryString } = this.context
const { page, buildId, dynamicBuildId } = __NEXT_DATA__
- const isDirtyAmp = amphtml && !__NEXT_DATA__.query.amp
let { head } = this... | true |
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | test/integration/amp-export-validation/test/index.test.js | @@ -19,14 +19,12 @@ describe('AMP Validation on Export', () => {
await nextExport(appDir, { outdir: outDir })
})
- it('should export both clean and dirty optimized pages', async () => {
- const toCheck = ['first', 'second', 'third']
+ it('should export AMP pages', async () => {
+ const toCheck = ['fir... | true |
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | test/integration/amphtml/test/index.test.js | @@ -91,29 +91,6 @@ describe('AMP Usage', () => {
).toBe('https://cdn.ampproject.org/v0.js')
})
- it('should add custom styles before amp boilerplate styles', async () => {
- const html = await renderViaHTTP(appPort, '/?amp=1')
- await validateAMP(html)
- const $ = cheerio.load(html)
- ... | true |
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | test/integration/basic/test/dynamic.js | @@ -254,7 +254,9 @@ export default (context, render) => {
/Dynamic Bundle/.test(bodyText) &&
/Hello World 1/.test(bodyText) &&
!/Hello World 2/.test(bodyText)
- ) { break }
+ ) {
+ break
+ }
await waitFor(1000)
}
@@ -287,... | true |
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | test/integration/export-default-map/pages/some.js | @@ -1,3 +1,3 @@
import { withAmp } from 'next/amp'
-export default withAmp(() => <p>I'm an AMP page</p>)
+export default withAmp(() => <p>I'm an AMP page</p>, { hybrid: true }) | true |
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | test/integration/production/test/dynamic.js | @@ -130,7 +130,9 @@ export default (context, render) => {
/Dynamic Bundle/.test(bodyText) &&
/Hello World 1/.test(bodyText) &&
!/Hello World 2/.test(bodyText)
- ) { break }
+ ) {
+ break
+ }
await waitFor(1000)
}
@@ -163,... | true |
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | test/integration/serverless/pages/some-amp.js | @@ -1,2 +1,2 @@
import { withAmp } from 'next/amp'
-export default withAmp(() => `Hi Im an AMP page!`)
+export default withAmp(() => `Hi Im an AMP page!`, { hybrid: true }) | true |
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | test/integration/serverless/test/index.test.js | @@ -47,7 +47,7 @@ describe('Serverless', () => {
})
it('should render an AMP page', async () => {
- const html = await renderViaHTTP(appPort, '/some-amp')
+ const html = await renderViaHTTP(appPort, '/some-amp?amp=1')
expect(html).toMatch(/Hi Im an AMP page/)
expect(html).toMatch(/ampproject\.or... | true |
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | test/lib/amp-test-utils.js | @@ -1,7 +1,7 @@
/* eslint-env jest */
import amphtmlValidator from 'amphtml-validator'
-export async function validateAMP (html, expectFail) {
+export async function validateAMP (html) {
const validator = await amphtmlValidator.getInstance()
const result = validator.validateString(html)
if (result.status !... | true |
Other | vercel | next.js | 03d589349a6a30e449b6b298b3b40e01787756e3.json | Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer
* Remove amphtml from AMP only and update tests
* Update tests
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <timer150@gmail.com> | yarn.lock | @@ -2330,30 +2330,30 @@ amdefine@>=0.0.4:
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=
-amp-toolbox-core@^0.1.6:
- version "0.1.6"
- resolved "https://registry.yarnpkg.com/amp-toolbox-core/-/amp-toolb... | true |
Other | vercel | next.js | 7fe7648f7b47174c8adbbbb3992b6518404aea1b.json | Add tests for build activity indicator (#7448) | test/integration/build-indicator/pages/a.js | @@ -0,0 +1 @@
+export default () => <p>Hello from a</p> | true |
Other | vercel | next.js | 7fe7648f7b47174c8adbbbb3992b6518404aea1b.json | Add tests for build activity indicator (#7448) | test/integration/build-indicator/pages/b.js | @@ -0,0 +1 @@
+export default () => <p>Hello from b</p> | true |
Other | vercel | next.js | 7fe7648f7b47174c8adbbbb3992b6518404aea1b.json | Add tests for build activity indicator (#7448) | test/integration/build-indicator/pages/index.js | @@ -0,0 +1,12 @@
+import Link from 'next/link'
+
+export default () => (
+ <>
+ <Link href='/a'>
+ <a id='to-a'>Go to a</a>
+ </Link>
+ <Link href='/b'>
+ <a id='to-b'>Go to b</a>
+ </Link>
+ </>
+) | true |
Other | vercel | next.js | 7fe7648f7b47174c8adbbbb3992b6518404aea1b.json | Add tests for build activity indicator (#7448) | test/integration/build-indicator/test/index.test.js | @@ -0,0 +1,65 @@
+/* eslint-env jest */
+/* global jasmine */
+import fs from 'fs'
+import { join } from 'path'
+import webdriver from 'next-webdriver'
+import { findPort, launchApp, killApp, waitFor } from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
+const appDir = join(__dirname, '..')
+let ... | true |
Other | vercel | next.js | b6dd463d939f6d94eba69f8a3b5bd92581331338.json | Enable strict export presence in webpack (#7446) | packages/next/build/webpack-config.ts | @@ -352,6 +352,7 @@ export default async function getBaseWebpackConfig(
},
// @ts-ignore this is filtered
module: {
+ strictExportPresence: true,
rules: [
(selectivePageBuilding || config.experimental.terserLoader) &&
!isServer && | false |
Other | vercel | next.js | ca85cc9973e4e90419bc5062e0d1803deca064f3.json | Update styles on build indicator container (#7436) | packages/next/client/dev-build-watcher.js | @@ -10,6 +10,12 @@ export default function initializeBuildWatcher () {
let shadowRoot
let prefix = ''
+ // Make sure container is fixed and on a high zIndex so it shows
+ shadowHost.style.position = 'fixed'
+ shadowHost.style.bottom = '10px'
+ shadowHost.style.right = '10px'
+ shadowHost.style.zIndex = 999... | false |
Other | vercel | next.js | 6f6f40dba7bd767f4b11ff6ed935cc9958fe5201.json | Implement UI to show building activity (#6526)
* Initial version of build watcher working
* Move build watcher div to Main component
* Add a better design, remove container from DOM when not visible
* Fix flickering when closing and opening too fast
* Add a field on next config file for two styles and comp... | packages/next/client/dev-build-watcher.js | @@ -0,0 +1,187 @@
+import { getEventSourceWrapper } from './dev-error-overlay/eventsource'
+
+export default function initializeBuildWatcher () {
+ const host = document.createElement('div')
+ host.id = '__next-build-watcher'
+ document.body.appendChild(host)
+
+ const shadowHost = document.getElementById('__next-b... | true |
Other | vercel | next.js | 6f6f40dba7bd767f4b11ff6ed935cc9958fe5201.json | Implement UI to show building activity (#6526)
* Initial version of build watcher working
* Move build watcher div to Main component
* Add a better design, remove container from DOM when not visible
* Fix flickering when closing and opening too fast
* Add a field on next config file for two styles and comp... | packages/next/client/dev-error-overlay/eventsource.js | @@ -1,4 +1,4 @@
-let hotDevCallback
+const eventCallbacks = []
function EventSourceWrapper (options) {
var source
@@ -33,8 +33,8 @@ function EventSourceWrapper (options) {
for (var i = 0; i < listeners.length; i++) {
listeners[i](event)
}
- if (hotDevCallback && event.data.indexOf('action') !=... | true |
Other | vercel | next.js | 6f6f40dba7bd767f4b11ff6ed935cc9958fe5201.json | Implement UI to show building activity (#6526)
* Initial version of build watcher working
* Move build watcher div to Main component
* Add a better design, remove container from DOM when not visible
* Fix flickering when closing and opening too fast
* Add a field on next config file for two styles and comp... | packages/next/client/index.js | @@ -76,7 +76,7 @@ export const emitter = mitt()
export default async ({
webpackHMR: passedWebpackHMR
} = {}) => {
- // This makes sure this specific line is removed in production
+ // This makes sure this specific lines are removed in production
if (process.env.NODE_ENV === 'development') {
webpackHMR = ... | true |
Other | vercel | next.js | 6f6f40dba7bd767f4b11ff6ed935cc9958fe5201.json | Implement UI to show building activity (#6526)
* Initial version of build watcher working
* Move build watcher div to Main component
* Add a better design, remove container from DOM when not visible
* Fix flickering when closing and opening too fast
* Add a field on next config file for two styles and comp... | packages/next/client/next-dev.js | @@ -2,6 +2,7 @@ import initNext, * as next from './'
import EventSourcePolyfill from './event-source-polyfill'
import initOnDemandEntries from './on-demand-entries-client'
import initWebpackHMR from './webpack-hot-middleware-client'
+import initializeBuildWatcher from './dev-build-watcher'
// Temporary workaround... | true |
Other | vercel | next.js | 6f6f40dba7bd767f4b11ff6ed935cc9958fe5201.json | Implement UI to show building activity (#6526)
* Initial version of build watcher working
* Move build watcher div to Main component
* Add a better design, remove container from DOM when not visible
* Fix flickering when closing and opening too fast
* Add a field on next config file for two styles and comp... | packages/next/pages/_document.tsx | @@ -371,7 +371,11 @@ export class Main extends Component {
render() {
const { amphtml, html } = this.context._documentProps
if (amphtml) return '__NEXT_AMP_RENDER_TARGET__'
- return <div id="__next" dangerouslySetInnerHTML={{ __html: html }} />
+ return (
+ <>
+ <div id="__next" dangerous... | true |
Other | vercel | next.js | 6f6f40dba7bd767f4b11ff6ed935cc9958fe5201.json | Implement UI to show building activity (#6526)
* Initial version of build watcher working
* Move build watcher div to Main component
* Add a better design, remove container from DOM when not visible
* Fix flickering when closing and opening too fast
* Add a field on next config file for two styles and comp... | packages/next/pages/_error.tsx | @@ -11,6 +11,7 @@ const statusCodes: { [code: number]: string } = {
export type ErrorProps = {
statusCode: number,
+ title: string,
}
/** | true |
Other | vercel | next.js | 3f91f80ede3fc349f353e1ee6d2061e9dfd7807f.json | Allow passing of title to default error page (#7381)
* Allow passing of title to default error page
* Update README to include Error#title information
* Change title init location
* Update _error.js | packages/next/README.md | @@ -1398,7 +1398,9 @@ class Page extends React.Component {
export default Page
```
-> If you have created a custom error page you have to import your own `_error` component from `./_error` instead of `next/error`
+> If you have created a custom error page you have to import your own `_error` component from `./_erro... | true |
Other | vercel | next.js | 3f91f80ede3fc349f353e1ee6d2061e9dfd7807f.json | Allow passing of title to default error page (#7381)
* Allow passing of title to default error page
* Update README to include Error#title information
* Change title init location
* Update _error.js | packages/next/pages/_error.tsx | @@ -27,7 +27,7 @@ export default class Error<P = {}> extends React.Component<P & ErrorProps> {
render() {
const { statusCode } = this.props
- const title = statusCodes[statusCode] || 'An unexpected error has occurred'
+ const title = this.props.title || statusCodes[statusCode] || 'An unexpected error ha... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/amp/README.md | @@ -39,4 +39,4 @@ now
## The idea behind the example
-This example shows how to create AMP pages using Next.js and the experimental AMP feature. It shows a normal page (non-AMP), an AMP only page, and a hybrid AMP page.
+This example shows how to create AMP pages using Next.js and the experimental AMP feature. It... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/custom-server-fastify/README.md | @@ -30,6 +30,7 @@ npm run dev
yarn
yarn dev
```
+
Fastify
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
| true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/custom-server-koa/README.md | @@ -45,7 +45,6 @@ Because the Next.js server is just a node.js module you can combine it with any
The example shows a server that serves the component living in `pages/a.js` when the route `/b` is requested and `pages/b.js` when the route `/a` is accessed. This is obviously a non-standard routing strategy. You can s... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/parameterized-routing/README.md | @@ -33,7 +33,6 @@ yarn dev
See now documentation [here](https://zeit.co/docs/v2/deployments/routes/) and Next.js example [here](https://zeit.co/examples/nextjs/) for info on deploying with [now](https://zeit.co/now) ([download](https://zeit.co/download))
-
## The idea behind the example
Next.js allows [Custom ... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/pass-server-data/README.md | @@ -57,7 +57,7 @@ The server knows whether or not to use next.js to render the route based on the
Take a look at the following files:
-* server.js
-* routes/item.js
-* pages/item.js
-* operations/get-item.js
+- server.js
+- routes/item.js
+- pages/item.js
+- operations/get-item.js | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/progressive-render/README.md | @@ -45,5 +45,5 @@ In that case you can wrap the component in `react-no-ssr` which will only render
This example features:
-* An app with a component that must only be rendered in the client
-* A loading component that will be displayed before rendering the client-only component
+- An app with a component that must... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/shared-modules/README.md | @@ -41,5 +41,5 @@ now
This example features:
-* An app with two pages which has a common Counter component
-* That Counter component maintain the counter inside its module. This is used primarily to illustrate that modules get initialized once and their state variables persist in runtime
+- An app with two pages w... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/using-inferno/README.md | @@ -43,4 +43,4 @@ This example uses [Inferno](https://github.com/infernojs/inferno), an insanely f
Here's how we did it:
-* Use `next.config.js` to customize our webpack config to support [inferno-compat](https://www.npmjs.com/package/inferno-compat)
+- Use `next.config.js` to customize our webpack config to suppo... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/using-nerv/README.md | @@ -43,4 +43,4 @@ This example uses [Nerv](https://nerv.aotu.io/) instead of React. It's a "blazin
Here's how we did it:
-* Use `next.config.js` to customize our webpack config to support [Nerv](https://nerv.aotu.io/)
+- Use `next.config.js` to customize our webpack config to support [Nerv](https://nerv.aotu.io/) | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/using-preact/README.md | @@ -43,4 +43,4 @@ This example uses [Preact](https://github.com/developit/preact) instead of React
Here's how we did it:
-* Use `next.config.js` to customize our webpack config to support [preact-compat](https://github.com/developit/preact-compat)
+- Use `next.config.js` to customize our webpack config to support ... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/using-router/README.md | @@ -41,5 +41,5 @@ now
This example features:
-* An app linking pages using `next/router` instead of `<Link>` component.
-* Access the pathname using `next/router` and render it in a component
+- An app linking pages using `next/router` instead of `<Link>` component.
+- Access the pathname using `next/router` and r... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-algolia-react-instantsearch/README.md | @@ -22,6 +22,7 @@ cd with-algolia-react-instantsearch
```
Set up Algolia:
+
- create an [algolia](https://www.algolia.com/) account or use this already [configured index](https://community.algolia.com/react-instantsearch/Getting_started.html#before-we-start)
- update the appId, apikey and indexName you want to se... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-apollo-and-redux-saga/README.md | @@ -38,19 +38,26 @@ now
```
## The idea behind the example
+
In 2.0.0, Apollo Client severs out-of-the-box support for redux in favor of Apollo's client side state management. This example aims to be an amalgamation of the [`with-apollo`](https://github.com/zeit/next.js/tree/master/examples/with-apollo) and [`with... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-apollo-and-redux/README.md | @@ -38,6 +38,7 @@ now
```
## The idea behind the example
+
This example serves as a conduit if you were using Apollo 1.X with Redux, and are migrating to Apollo 2.x, however, you have chosen not to manage your entire application state within Apollo (`apollo-link-state`).
In 2.0.0, Apollo serves out-of-the-box s... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-apollo-auth/README.md | @@ -43,13 +43,13 @@ This is an extention of the _[with Apollo](https://github.com/zeit/next.js/tree/
> [Apollo](https://www.apollographql.com/client/) is a GraphQL client that allows you to easily query the exact data you need from a GraphQL server. In addition to fetching and mutating data, Apollo analyzes your que... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-apollo/README.md | @@ -45,12 +45,11 @@ now
[Apollo](https://www.apollographql.com/client/) is a GraphQL client that allows you to easily query the exact data you need from a GraphQL server. In addition to fetching and mutating data, Apollo analyzes your queries and their results to construct a client-side cache of your data, which is ... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-app-layout/readme.md | @@ -39,4 +39,4 @@ now
## The idea behind the example
-Shows how to use _app.js to implement a global layout for all pages.
+Shows how to use \_app.js to implement a global layout for all pages. | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-cerebral/README.md | @@ -49,9 +49,9 @@ Declarative CerebralJS:
getUser,
{
success: setUser,
- error: setError,
+ error: setError
},
- setLoading(false),
+ setLoading(false)
];
```
| true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-context-api/README.md | @@ -37,7 +37,7 @@ Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.
now
```
-## The idea behind the example*
+## The idea behind the example\*
This example shows how to use react context api in our app.
@@ -47,5 +47,4 @@ The `pages/index.js` shows how to, from the home page, incr... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-custom-babel-config/README.md | @@ -41,8 +41,8 @@ now
This example features:
-* An app using proposed [do expressions](https://babeljs.io/docs/plugins/transform-do-expressions/).
-* It uses babel-preset-stage-0, which allows us to use above JavaScript feature.
-* It uses '.babelrc' file in the app directory to add above preset.
+- An app using p... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-docker/README.md | @@ -47,7 +47,7 @@ now --docker -e API_URL="https://example.com"
## The idea behind the example
-This example show how to set custom environment variables for your __docker application__ at runtime.
+This example show how to set custom environment variables for your **docker application** at runtime.
The `docker... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-dotenv/README.md | @@ -43,7 +43,7 @@ This example shows how to inline env vars.
**Please note**:
-* It is a bad practice to commit env vars to a repository. Thats why you should normally [gitignore](https://git-scm.com/docs/gitignore) your `.env` file.
-* In this example, as soon as you reference an env var in your code it will be a... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-dynamic-app-layout/readme.md | @@ -39,5 +39,5 @@ now
## The idea behind the example
-Shows how to use _app.js to implement _dynamic_ layouts for pages.
+Shows how to use _app.js to implement \_dynamic_ layouts for pages.
This is achieved by attaching a static `Layout` property to each page that needs a different layout. In that way, once we us... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-emotion/README.md | @@ -43,5 +43,4 @@ This example features how to use [emotion](https://github.com/tkh44/emotion) as
We are creating three `div` elements with custom styles being shared across the elements. The styles includes the use of pseedo-selector and CSS animations.
-
-This is based off the with-glamorous example.
\ No newlin... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-env-from-next-config-js/README.md | @@ -44,14 +44,14 @@ More specifically, what that means, is that environmental variables are programm
returned to your react components (including `getInitialProps`) when the program is built with `next build`.
As the build process (`next build`) is proceeding, `next.config.js` is processed and passed in as a parame... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-external-scoped-css/README.md | @@ -1,4 +1,3 @@
-
# With external scoped css
This example has been deprecated in favor of [@zeit/next-css](https://github.com/zeit/next-plugins/tree/master/packages/next-css). | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-firebase-authentication/README.md | @@ -22,11 +22,12 @@ cd with-firebase-authentication
```
Set up firebase:
+
- Create a project at the [Firebase console](https://console.firebase.google.com/).
-- Get your account credentials from the Firebase console at *settings>service accounts*, where you can click on *generate new private key* and download the... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-firebase-cloud-messaging/README.md | @@ -1,3 +1,5 @@
+# With Firebase Cloud Messaging example
+
## How to run
Install it and run: | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-freactal/README.md | @@ -41,11 +41,11 @@ now
When it comes to state management of the React webapp, Redux is the most popular solution. However it brings lots of boilerplate code and fiddling aroud multiple files when tracing even simplest state change.
-[Freactal](https://github.com/FormidableLabs/freactal) is a state management libr... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-immutable-redux-wrapper/README.md | @@ -71,4 +71,4 @@ In fact, Redux requires your state to be immutable. You do not have to use Immut
[Read more](https://redux.js.org/faq/immutable-data#what-approaches-are-there-for-handling-data-immutability-do-i-have-to-use-immutable-js) about the importance of immutability in Redux here.
-This example wraps the ... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-jest-react-testing-library/README.md | @@ -45,5 +45,4 @@ This library encourages your applications to be more accessible and allows you t
This example features:
-* An app with [react testing library](https://github.com/kentcdodds/react-testing-library) by [Kent Dodds](https://github.com/kentcdodds/)
-
+- An app with [react testing library](https://gith... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-jest/README.md | @@ -43,4 +43,4 @@ yarn test
This example features:
-* An app with jest tests
+- An app with jest tests | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-lingui/README.md | @@ -43,7 +43,7 @@ This example shows a way to use [lingui.js](https://lingui.js.org) with next.js.
It adds a webpack loader for the messages to avoid having to manually compile while developing as well as adds the compile step to the `next build` script for production builds.
-The example also uses a Higher order ... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-loading/README.md | @@ -45,6 +45,6 @@ We can simply fix this issue by showing a loading indicator. That's what this ex
It features:
-* An app with two pages which uses a common [Header](./components/Header.js) component for navigation links.
-* Using `next/router` to identify different router events
-* Uses [nprogress](https://github... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-markdown/README.md | @@ -39,4 +39,4 @@ now
## The idea behind the example
-This example shows how to integrate an [MDX](https://github.com/mdx-js/mdx) which is a _"JSX in Markdown loader, parser, and renderer for ambitious projects"_.
\ No newline at end of file
+This example shows how to integrate an [MDX](https://github.com/mdx-js/m... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-mobx-react-lite/README.md | @@ -59,49 +59,52 @@ The initial store data is returned from the `initializeData` function that recyc
```jsx
function initializeData(initialData = store || {}) {
- const { lastUpdate = Date.now(), light } = initialData
+ const { lastUpdate = Date.now(), light } = initialData;
return {
lastUpdate,
- ligh... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-mobx-state-tree/README.md | @@ -66,4 +66,4 @@ To pass the initial timestamp from the server to the client we pass it as a prop
The trick here for supporting universal mobx is to separate the cases for the client and the server. When we are on the server we want to create a new store every time, otherwise different users data will be mixed up. ... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-mobx/README.md | @@ -36,14 +36,14 @@ Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.
```bash
now
```
+
## Notes
+
This example is a mobx port of the [with-redux](https://github.com/zeit/next.js/tree/master/examples/with-redux) example. Decorator support is activated by adding a `.babelrc` file at t... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-mocha/README.md | @@ -43,6 +43,6 @@ yarn test
This example features:
-* An app with Mocha tests
+- An app with Mocha tests
-> A very important part of this example is the `.babelrc` file which configures the `test` environment to use `babel-preset-env` and configures it to transpile modules to `commonjs`). [Learn more](https://gi... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-next-css/README.md | @@ -39,4 +39,4 @@ now
## The idea behind the example
-This example demonstrates how to use the [next-css plugin](https://github.com/zeit/next-plugins/tree/master/packages/next-css) It includes patterns for with and without CSS Modules, with PostCSS and with additional webpack configurations on top of the next-css ... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-next-page-transitions/README.md | @@ -40,4 +40,3 @@ now
The [`next-page-transitions`](https://github.com/illinois/next-page-transitions) library is a component that sits at the app level and allows you to animate page changes. It works especially nicely with apps with a shared layout element, like a navbar. This component will ensure that only one pag... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-next-sass/README.md | @@ -45,7 +45,7 @@ yarn start
This example features:
-* An app with next-sass
+- An app with next-sass
This example uses next-sass without css-modules. The config can be found in `next.config.js`, change `withSass()` to `withSass({cssModules: true})` if you use css-modules. Then in the code, you import the style... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-noscript/README.md | @@ -17,9 +17,11 @@ yarn create next-app --example with-noscript with-noscript-app
Download the example:
## Development
+
Install it and run:
**npm**
+
```bash
npm install
npm run dev
@@ -29,20 +31,24 @@ yarn dev
```
**yarn**
+
```bash
yarn install
yarn run dev
```
## Production
+
**npm**
+
```ba... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-office-ui-fabric-react/README.md | @@ -39,4 +39,4 @@ now
## The idea behind the example
-This example shows how to use Office UI Fabric React in Next.js.
\ No newline at end of file
+This example shows how to use Office UI Fabric React in Next.js. | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-orbit-components/README.md | @@ -38,9 +38,9 @@ now
```
## The idea behind the example
+
[Orbit-components](https://orbit.kiwi) is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
For this purpose we are extending `<App />` of injected `<ThemeProvider/>`, and also adding `@ki... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-overmind/README.md | @@ -39,4 +39,4 @@ now
## Notes
-Look at the comments for more information on how the application is structured. This is just one of several ways you can manage hydration and rehydration of state. It depends heavily on how you want to manage it, do code sharing between client and server etc. The exampled approach s... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-prefetching/README.md | @@ -41,6 +41,6 @@ now
This example features:
-* An app with four simple pages
-* The "about" page uses the imperative (i.e.: "manual") prefetching API to prefetch on hover
-* It will prefetch all the pages in the background except the "contact" page
+- An app with four simple pages
+- The "about" page uses the imp... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-pretty-url-routing/README.md | @@ -40,5 +40,6 @@ now
## The idea behind the example
This example features:
+
- route customisation and parameterization
- reverse routing | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-react-intl/README.md | @@ -64,4 +64,4 @@ $ npm start
You can then switch your browser's language preferences to French and refresh the page to see the UI update accordingly.
-[React Intl]: https://github.com/yahoo/react-intl
+[react intl]: https://github.com/yahoo/react-intl | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-react-native-web/README.md | @@ -1,3 +1,5 @@
+# React Native Web example
+
## How to use
### Using `create-next-app` | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-redux-code-splitting/README.md | @@ -1,4 +1,3 @@
-
# Redux with code splitting example
## How to use
@@ -42,4 +41,4 @@ now
Redux uses single store per application and usually it causes problems for code splitting when you want to load actions and reducers used on the current page only.
-This example utilizes [fast-redux](https://github.com/do... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-redux-reselect-recompose/README.md | @@ -38,12 +38,12 @@ yarn
yarn dev
```
-
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```bash
now
```
## The idea behind the example
+
This example is based on the great work of [with-redux](https://github.com/zeit/next.js/blob/master/examples/with-redux/) e... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-redux-saga/README.md | @@ -68,12 +68,12 @@ The digital clock is updated every second using the `runClockSaga` found in `sag
All pages are also being wrapped by `next-redux-saga` using a helper function from `store.js`:
```js
-import withRedux from 'next-redux-wrapper'
-import nextReduxSaga from 'next-redux-saga'
-import configureStore fr... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-refnux/README.md | @@ -37,7 +37,6 @@ Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.
now
```
-
## The idea behind the example
This example, just like `with-redux` and `with-mobx` examples, shows how to manage a global state in your web-application.
@@ -48,12 +47,11 @@ We have two very similar page... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-rematch/README.md | @@ -46,6 +46,6 @@ Besides the `pages` directory, there is a directory called shared which holds al
Some features of this example are :
-* Pages are connected to rematch using `withRematch` util. These pages are capable of accessing values from the store and dispatching changes
-* Components are inside the `shared/... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-sentry/README.md | @@ -19,12 +19,14 @@ Download the example:
Install it and run:
**npm**
+
```bash
npm install
npm run dev
```
**yarn**
+
```bash
yarn
yarn dev | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-sitemap-and-robots-express-server-typescript/README.md | @@ -45,10 +45,12 @@ The app is deployed at: https://sitemap-robots.now.sh. Open the page and click t

Notes:
+
- routes `/a` and `/b` are added to sitemap manually
- routes that start with `/post... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-sitemap-and-robots-express-server/README.md | @@ -45,11 +45,13 @@ The app is deployed at: https://sitemap-robots.now.sh. Open the page and click t

Notes:
+
- routes `/a` and `/b` are added to sitemap manually
- routes that start with `/post... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-socket.io/README.md | @@ -33,4 +33,4 @@ yarn dev
## The idea behind the example
-This example show how to use [socket.io](https://socket.io/) inside a Next.js application. It uses `getInitialProps` to fetch the old messages from a HTTP endpoint as if it was a Rest API. The example combine the WebSocket server with the Next server, in a... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-tailwindcss/README.md | @@ -43,6 +43,19 @@ Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.
now
```
+### Extras
+
+In the `package.json` you'll see some extra commands.
+
+- `yarn dev:css`
+ - used by `yarn dev` generate css bundle and watch css files for changes
+ - includes css imported into `index.css`... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-typescript-styled-components/README.md | @@ -37,5 +37,5 @@ yarn dev
This is an amalgamation of the 2 existing examples:
-* [with-typescript](https://github.com/zeit/next.js/tree/canary/examples/with-typescript)
-* [with-styled-components](https://github.com/zeit/next.js/tree/canary/examples/with-styled-components)
+- [with-typescript](https://github.com/... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-yarn-workspaces/README.md | @@ -40,13 +40,13 @@ Workspaces are a new way to setup your package architecture that’s available b
In this example we have three workspaces:
-* **web-app**: A Next.js app
-* **foo**: A normal node module
-* **bar**: A react component, that gets compiled by Next.js (see [packages/web-app/next.config.js](./packages/... | true |
Other | vercel | next.js | 0cd2732c7f511dc28da62c8ac9b38bf9522ca960.json | Remove deploy to now button from all examples (#7101) | examples/with-zones/README.md | @@ -77,16 +77,16 @@ These rules are based on ZEIT now v1 [path alias](https://zeit.co/docs/features/
## Special Notes
-* All pages should be unique across zones. A page with the same name should not exist in multiple zones. Otherwise, there'll be unexpected behaviour in client side navigation.
- * According to th... | true |
Other | vercel | next.js | 2c7be96daa22d422bd3668b81cefa588f52c3378.json | Update Tailwind CSS to v1.0 (#7421) | examples/with-tailwindcss/README.md | @@ -57,6 +57,5 @@ This project shows how you can set it up. Have a look at:
* pages/\_document.js
* styles/config/postcss.config.js
-* styles/config/tailwind.config.js
* styles/index.css
* styles/button.css | true |
Other | vercel | next.js | 2c7be96daa22d422bd3668b81cefa588f52c3378.json | Update Tailwind CSS to v1.0 (#7421) | examples/with-tailwindcss/components/nav.js | @@ -9,14 +9,14 @@ export default function Nav () {
return (
<nav>
<ul className='flex justify-between items-center p-8'>
- <li className='list-reset'>
+ <li>
<Link prefetch href='/'>
- <a className='text-blue no-underline'>Home</a>
+ <a className='text-blue-... | true |
Other | vercel | next.js | 2c7be96daa22d422bd3668b81cefa588f52c3378.json | Update Tailwind CSS to v1.0 (#7421) | examples/with-tailwindcss/package.json | @@ -16,6 +16,6 @@
"autoprefixer": "^7.1.6",
"cssnano": "^3.10.0",
"postcss-easy-import": "^3.0.0",
- "tailwindcss": "^0.6.6"
+ "tailwindcss": "^1.0.1"
}
} | true |
Other | vercel | next.js | 2c7be96daa22d422bd3668b81cefa588f52c3378.json | Update Tailwind CSS to v1.0 (#7421) | examples/with-tailwindcss/postcss.config.js | @@ -1,9 +1,7 @@
-var tailwindcss = require('tailwindcss')
-
module.exports = {
plugins: [
require('postcss-easy-import'),
- tailwindcss('./tailwind.config.js'),
+ require('tailwindcss'),
require('autoprefixer')
]
} | true |
Other | vercel | next.js | 2c7be96daa22d422bd3668b81cefa588f52c3378.json | Update Tailwind CSS to v1.0 (#7421) | examples/with-tailwindcss/styles/button.css | @@ -1,3 +1,3 @@
.btn-blue {
- @apply .bg-blue .text-white .font-bold .py-2 .px-4 .rounded;
+ @apply .bg-blue-500 .text-white .font-bold .py-2 .px-4 .rounded;
} | true |
Other | vercel | next.js | 2c7be96daa22d422bd3668b81cefa588f52c3378.json | Update Tailwind CSS to v1.0 (#7421) | examples/with-tailwindcss/styles/index.css | @@ -1,6 +1,6 @@
@import "./button.css";
-@tailwind preflight;
+@tailwind base;
@tailwind components;
@tailwind utilities;
| true |
Other | vercel | next.js | 2c7be96daa22d422bd3668b81cefa588f52c3378.json | Update Tailwind CSS to v1.0 (#7421) | examples/with-tailwindcss/tailwind.config.js | @@ -1,919 +0,0 @@
-/*
-
-Tailwind - The Utility-First CSS Framework
-
-A project by Adam Wathan (@adamwathan), Jonathan Reinink (@reinink),
-David Hemphill (@davidhemphill) and Steve Schoger (@steveschoger).
-
-Welcome to the Tailwind config file. This is where you can customize
-Tailwind specifically for your project.... | true |
Other | vercel | next.js | 0ee2bcc962d80ccb2ba0e5070eecc0a51a812e5a.json | Fix duplicate dynamic chunks (#7425) | packages/next/pages/_document.tsx | @@ -24,6 +24,18 @@ export type DocumentComponentContext = {
export async function middleware({req, res}: DocumentContext) {}
+function dedupe(bundles: any[]): any[] {
+ const files = new Set()
+ const kept = []
+
+ for (const bundle of bundles) {
+ if (files.has(bundle.file)) continue
+ files.add(bundle.f... | false |
Other | vercel | next.js | 9a50e926e3b767eb4775ab31ec370ba6caebfa3a.json | Add document middleware (#7209)
* Add document middleware
* Update tests
* Apply suggestions from code review
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co> | packages/next-server/server/load-components.ts | @@ -15,13 +15,23 @@ export async function loadComponents(distDir: string, buildId: string, pathname:
const documentPath = join(distDir, SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH, buildId, 'pages', '_document')
const appPath = join(distDir, SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH, buildId, 'pages', '_app')
+... | true |
Other | vercel | next.js | 9a50e926e3b767eb4775ab31ec370ba6caebfa3a.json | Add document middleware (#7209)
* Add document middleware
* Update tests
* Apply suggestions from code review
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co> | packages/next-server/server/render.tsx | @@ -4,7 +4,7 @@ import React from 'react'
import { renderToString, renderToStaticMarkup } from 'react-dom/server'
import { BaseRouter } from '../lib/router/router'
import mitt, { MittEmitter } from '../lib/mitt';
-import { loadGetInitialProps, isResSent, getDisplayName, ComponentsEnhancer, RenderPage, DocumentInitia... | true |
Other | vercel | next.js | 9a50e926e3b767eb4775ab31ec370ba6caebfa3a.json | Add document middleware (#7209)
* Add document middleware
* Update tests
* Apply suggestions from code review
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co> | packages/next/pages/_document.tsx | @@ -22,6 +22,8 @@ export type DocumentComponentContext = {
readonly _devOnlyInvalidateCacheQueryString: string,
}
+export async function middleware({req, res}: DocumentContext) {}
+
/**
* `Document` component handles the initial `document` markup and renders only on the server side.
* Commonly used for imple... | true |
Other | vercel | next.js | 9a50e926e3b767eb4775ab31ec370ba6caebfa3a.json | Add document middleware (#7209)
* Add document middleware
* Update tests
* Apply suggestions from code review
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co> | test/integration/document-middleware/pages/_document.js | @@ -0,0 +1,32 @@
+import Document, { Html, Head, Main, NextScript } from 'next/document'
+
+export async function middleware ({ req, res }) {
+ if (req.url === '/another') {
+ res.setHeader('next-middleware', 'hit another!')
+ return res.end()
+ }
+ res.setHeader('next-middleware', 'hi from middleware')
+}
+
+... | true |
Other | vercel | next.js | 9a50e926e3b767eb4775ab31ec370ba6caebfa3a.json | Add document middleware (#7209)
* Add document middleware
* Update tests
* Apply suggestions from code review
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co> | test/integration/document-middleware/pages/another.js | @@ -0,0 +1,3 @@
+export default () => (
+ <p>Hi again 👋</p>
+) | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.