-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
138 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
const idx = process.execArgv.indexOf('--cpu-prof') | ||
if (idx >= 0) process.execArgv.splice(idx, 1) | ||
|
||
module.exports = { | ||
eslint: { | ||
ignoreDuringBuilds: true, | ||
}, | ||
experimental: { | ||
swcLoader: true, | ||
swcMinify: true, | ||
}, | ||
swcMinify: true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"scripts": { | ||
"prepare": "rm -rf components && mkdir components && node ./fuzzponent.js -d 2 -s 206 -o components", | ||
"dev": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 ../../node_modules/.bin/next dev", | ||
"build": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 ../../node_modules/.bin/next build", | ||
"start": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 ../../node_modules/.bin/next start", | ||
"dev-nocache": "rm -rf .next && yarn dev", | ||
"dev-cpuprofile-nocache": "rm -rf .next && cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 node --cpu-prof ../../node_modules/.bin/next", | ||
"build-nocache": "rm -rf .next && yarn build" | ||
"prepare": "rimraf components && mkdir components && node ./fuzzponent.js -d 2 -s 206 -o components", | ||
"dev": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 node ../../node_modules/next/dist/bin/next dev", | ||
"build": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 node ../../node_modules/next/dist/bin/next build", | ||
"start": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 node ../../node_modules/next/dist/bin/next start", | ||
"dev-nocache": "rimraf .next && yarn dev", | ||
"dev-cpuprofile-nocache": "rimraf .next && cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 node --cpu-prof ../../node_modules/next/dist/bin/next", | ||
"build-nocache": "rimraf .next && yarn build" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/next/pages/_document.web.tsx → packages/next/pages/_document-web.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/integration/document-functional-render-prop/lib/context.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { createContext } from 'react' | ||
|
||
export default createContext(null) |
20 changes: 20 additions & 0 deletions
20
test/integration/document-functional-render-prop/pages/_document.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Html, Head, Main, NextScript } from 'next/document' | ||
import Context from '../lib/context' | ||
|
||
export default function Document() { | ||
return ( | ||
<Html> | ||
<Head /> | ||
<body> | ||
<Main> | ||
{(children) => ( | ||
<Context.Provider value="from render prop"> | ||
{children} | ||
</Context.Provider> | ||
)} | ||
</Main> | ||
<NextScript /> | ||
</body> | ||
</Html> | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
test/integration/document-functional-render-prop/pages/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { useContext } from 'react' | ||
import Context from '../lib/context' | ||
|
||
export default function MainRenderProp() { | ||
const value = useContext(Context) | ||
return <span>{value}</span> | ||
} |
24 changes: 24 additions & 0 deletions
24
test/integration/document-functional-render-prop/tests/index.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* eslint-env jest */ | ||
|
||
import { join } from 'path' | ||
import { findPort, launchApp, killApp, renderViaHTTP } from 'next-test-utils' | ||
|
||
const appDir = join(__dirname, '..') | ||
let appPort | ||
let app | ||
|
||
describe('Functional Custom Document', () => { | ||
describe('development mode', () => { | ||
beforeAll(async () => { | ||
appPort = await findPort() | ||
app = await launchApp(appDir, appPort) | ||
}) | ||
|
||
afterAll(() => killApp(app)) | ||
|
||
it('supports render props', async () => { | ||
const html = await renderViaHTTP(appPort, '/') | ||
expect(html).toMatch(/<span>from render prop<\/span>/) | ||
}) | ||
}) | ||
}) |