Commit dc06fee7 authored by Arunoda Susiripala's avatar Arunoda Susiripala

Merge branch 'canary' into multi-zones

parents a72eb3e2 5daafa4f
......@@ -10,7 +10,7 @@
language: "node_js",
node_js: ["6"],
cache: {
directories: ["node-modules"]
directories: ["node_modules"]
},
before_install: [
"rm yarn.lock",
......@@ -22,6 +22,7 @@
deploy: {
provider: "npm",
email: "leo@zeit.co",
tag: "canary",
api_key: {
secure:
"br9gLncKeLSoL7iOq0PXFeD1Gp3jRI8QMCSNIrGdZg/MuLeuwYPv36kmMgf7aGIfpjFLtU2/eVrOHSB+T5g1nKgOsqmWsfZE1tQYWph0//ookd/sj+IyxIx8nVLbUV/C4ctYOhX/efotRgNn56w5Av5hWc1IQLmW9mSN8ijrQnM+GzRI8QitiofeY2EP3N1eO8vC8E2oGkOsAdcypiX6lFG908zyWt7X2SD+iOsK2eAHjxoAEUdrxE5a8gTDhcTH6qnmtBs9rCeEKbO3JZjEy5dvccxlX3Nd+2GC1rckayk6o5L/zveTilsUx6Auqqbwn1dT5ffQuYsV4RPofs8IMrhnizc8y+OfUcCCpBJ4ia4w7N8FEP56TnRNTFoFBGJL5Y6NfeT0HHAlClxUWMG9pRGWGN+sskODDQ9FEntGZoqwV396ogs+3YhkxbY0AIr84QOctflsFcPtOgr/CoBeOsjbB+o9+Rlsqwlf3u3B7qhtU9eV6KcMfK4x9qW+2cwTllK+gD8S9wILx5BChkfx99g/7u/Rg1PCym64tTsDOBtqTVC2YCqeYYvjmpw4Vl3ofLrFsoNQnbmb6Q5+JSpOcJ/bEj7P/FuZdlU0fNV28tFhElu5caKhSCJz/avUlXG7NeveW1Ee8gjhURC4V/l4ryacyjA2vcDY/4RRkWtHNr4="
......
......@@ -27,13 +27,18 @@ const commands = new Set([
])
let cmd = process.argv[2]
let args
let args = []
let nodeArgs = []
if (new Set(['--version', '-v']).has(cmd)) {
console.log(`next.js v${pkg.version}`)
process.exit(0)
}
if (new Set(process.argv).has('--inspect')) {
nodeArgs.push('--inspect')
}
if (new Set(['--help', '-h']).has(cmd)) {
console.log(`
Usage
......@@ -61,7 +66,7 @@ process.env.NODE_ENV = process.env.NODE_ENV || defaultEnv
const bin = join(__dirname, 'next-' + cmd)
const startProcess = () => {
const proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] })
const proc = spawn('node', [...nodeArgs, ...[bin], ...args], { stdio: 'inherit', customFds: [0, 1, 2] })
proc.on('close', (code, signal) => {
if (code !== null) {
process.exit(code)
......
# Build directory not writeable
#### Why This Error Occurred
The filesystem does not allow writing to the specified directory. A common cause for this error is starting a [custom server](https://github.com/zeit/next.js#custom-server-and-routing) in development mode on a production server, for example, [now.sh](https://zeit.co) which [doesn't allow you to write to the filesystem after your app is built](https://zeit.co/docs/deployment-types/node#file-system-specifications).
#### Possible Ways to Fix It
When using a custom server with a server file, for example called `server.js`, make sure you update the scripts key in `package.json` to:
```json
{
"scripts": {
"dev": "node server.js",
"build": "next build",
"start": "NODE_ENV=production node server.js"
}
}
```
and the custom server starts Next in production mode when `NODE_ENV` is `production`
```js
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
```
### Useful Links
- [Custom Server documentation + examples](https://github.com/zeit/next.js#custom-server-and-routing)
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/active-class-name)
# activeClassName example
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example active-class-name active-class-name-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/active-class-name
cd active-class-name
```
Install it and run:
```bash
npm install
npm run dev
```
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```bash
now
```
## The idea behind the example
ReactRouter has a convenience property on the `Link` element to allow an author to set the _active_ className on a link. This example replicates that functionality using Next's own `Link`.
import { withRouter } from 'next/router'
import Link from 'next/link'
import React, { Children } from 'react'
const ActiveLink = ({ router, children, ...props }) => {
const child = Children.only(children)
let className = child.props.className || ''
if (router.pathname === props.href && props.activeClassName) {
className = `${className} ${props.activeClassName}`.trim()
}
delete props.activeClassName
return <Link {...props}>{React.cloneElement(child, { className })}</Link>
}
export default withRouter(ActiveLink)
import Link from './Link'
export default () => (
<nav>
<style jsx>{`
.active:after {
content: ' (current page)';
}
.nav-link {
text-decoration: none;
padding: 10px;
display: block;
}
`}</style>
<ul>
<li>
<Link activeClassName='active' href='/'>
<a className='nav-link home-link'>Home</a>
</Link>
</li>
<li>
<Link activeClassName='active' href='/about'>
<a className='nav-link'>About</a>
</Link>
</li>
</ul>
</nav>
)
{
"name": "active-class-name",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"author": "Remy Sharp <remy@leftlogic.com>",
"dependencies": {
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"license": "ISC"
}
import Nav from '../components/Nav'
export default () => (
<div>
<Nav />
<p>Hello, I'm About.js</p>
</div>
)
import Nav from '../components/Nav'
export default () => (
<div>
<Nav />
<p>Hello, I'm the home page</p>
</div>
)
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example basic-css basic-css-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example custom-server-express custom-server-express-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -5,5 +5,6 @@ export default () => (
<ul>
<li><Link href='/b' as='/a'><a>a</a></Link></li>
<li><Link href='/a' as='/b'><a>b</a></Link></li>
<li><Link href='/posts/2'><a>post #2</a></Link></li>
</ul>
)
import React, { Component } from 'react'
export default class extends Component {
static getInitialProps ({ query: { id } }) {
return { postId: id }
}
render () {
return <div>
<h1>My blog post #{this.props.postId}</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</p>
</div>
}
}
......@@ -18,6 +18,10 @@ app.prepare()
return app.render(req, res, '/a', req.query)
})
server.get('/posts/:id', (req, res) => {
return app.render(req, res, '/posts', { id: req.params.id })
})
server.get('*', (req, res) => {
return handle(req, res)
})
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example custom-server-fastify custom-server-fastify-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example custom-server-hapi custom-server-hapi-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example custom-server-koa custom-server-koa-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example custom-server-micro custom-server-micro-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/custom-server-nodemon)
# Custom server with Nodemon example
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example custom-server-nodemon custom-server-nodemon-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/custom-server-nodemon
cd custom-server-nodemon
```
Install it and run:
```bash
npm install
npm run dev
```
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```bash
now
```
## The idea behind the example
The example shows how you can apply [Nodemon](https://nodemon.io/) to a custom server to have live reload of the server code without being affected by the Next.js universal code.
{
"watch": ["server/**/*.js"]
}
{
"scripts": {
"dev": "nodemon server/index.js",
"build": "next build",
"start": "NODE_ENV=production node server/index.js"
},
"dependencies": {
"next": "^4.1.4",
"react": "^16.2.0",
"react-dom": "^16.2.0"
},
"devDependencies": {
"nodemon": "^1.12.1"
}
}
import React from 'react'
export default () => <div>a</div>
import React from 'react'
export default () => <div>b</div>
import React from 'react'
import Link from 'next/link'
export default () => (
<ul>
<li><Link href='/b' as='/a'><a>a</a></Link></li>
<li><Link href='/a' as='/b'><a>b</a></Link></li>
</ul>
)
const { createServer } = require('http')
const { parse } = require('url')
const next = require('next')
const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
app.prepare()
.then(() => {
createServer((req, res) => {
const parsedUrl = parse(req.url, true)
const { pathname, query } = parsedUrl
if (pathname === '/a') {
app.render(req, res, '/b', query)
} else if (pathname === '/b') {
app.render(req, res, '/a', query)
} else {
handle(req, res, parsedUrl)
}
})
.listen(port, (err) => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
})
})
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example custom-server custom-server-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example data-fetch data-fetch-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
"isomorphic-fetch": "^2.2.1",
"isomorphic-unfetch": "^2.0.0",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0"
......
import React from 'react'
import Link from 'next/link'
import 'isomorphic-fetch'
import 'isomorphic-unfetch'
export default class MyPage extends React.Component {
static async getInitialProps () {
......
import React from 'react'
import Link from 'next/link'
import 'isomorphic-fetch'
import 'isomorphic-unfetch'
export default class MyPage extends React.Component {
static async getInitialProps () {
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example form-handler form-handler-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example head-elements head-elements-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example hello-world hello-world-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example layout-component layout-component-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example nested-components nested-components-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
# Hello World example
## Only client render for external dependencies
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/only-client-render-external-dependencies
cd only-client-render-external-dependencies
```
Install it and run:
```bash
npm install
npm run 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 shows how to use an external dependency that only allows client-render.
\ No newline at end of file
{
"name": "only-client-render-external-dependencies",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"recharts": "^1.0.0-beta.0"
},
"license": "ISC"
}
import React from 'react'
let LineChart
let Line
class Chart extends React.Component {
constructor () {
super()
this.state = {
chart: false,
data: [
{name: 'Page A', uv: 4000, pv: 2400, amt: 2400},
{name: 'Page B', uv: 3000, pv: 1398, amt: 2210},
{name: 'Page C', uv: 2000, pv: 9800, amt: 2290},
{name: 'Page D', uv: 2780, pv: 3908, amt: 2000},
{name: 'Page E', uv: 1890, pv: 4800, amt: 2181},
{name: 'Page F', uv: 2390, pv: 3800, amt: 2500},
{name: 'Page G', uv: 3490, pv: 4300, amt: 2100}
]
}
}
componentDidMount () {
LineChart = require('recharts').LineChart
Line = require('recharts').Line
this.setState({
chart: true
})
}
render () {
return (
<div>
<h1>Another chart</h1>
{this.state.chart &&
<LineChart width={400} height={400} data={this.state.data}>
<Line type='monotone' dataKey='uv' stroke='#8884d8' />
</LineChart>
}
</div>
)
}
}
export default Chart
import React from 'react'
import Link from 'next/link'
let LineChart
let Line
class Index extends React.Component {
constructor () {
super()
this.state = {
chart: false,
data: [
{name: 'Page A', uv: 1000, pv: 2400, amt: 2400},
{name: 'Page B', uv: 3000, pv: 1398, amt: 2210},
{name: 'Page C', uv: 2000, pv: 9800, amt: 2290},
{name: 'Page D', uv: 2780, pv: 3908, amt: 2000},
{name: 'Page E', uv: 1890, pv: 4800, amt: 2181},
{name: 'Page F', uv: 2390, pv: 3800, amt: 2500},
{name: 'Page G', uv: 3490, pv: 4300, amt: 2100}
]
}
}
componentDidMount () {
LineChart = require('recharts').LineChart
Line = require('recharts').Line
this.setState({
chart: true
})
}
render () {
return (
<div>
<h1>Chart</h1>
<Link href='/chart'><a>Go to another chart</a></Link>
{this.state.chart &&
<LineChart width={400} height={400} data={this.state.data}>
<Line type='monotone' dataKey='uv' stroke='#8884d8' />
</LineChart>
}
</div>
)
}
}
export default Index
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example page-transitions page-transitions-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example parameterized-routing parameterized-routing-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example progressive-render progressive-render-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example root-static-files root-static-files-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example shared-modules shared-modules-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example ssr-caching ssr-caching-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example svg-components svg-components-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example using-inferno using-inferno-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example using-preact using-preact-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example using-router using-router-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example using-with-router using-with-router-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -2,6 +2,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-absolute-imports with-absolute-imports-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-algolia-react-instantsearch with-algolia-react-instantsearch-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-amp with-amp-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js.git):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-ant-design with-ant-design-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-antd-mobile with-antd-mobile-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-aphrodite with-aphrodite-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-apollo-and-redux with-apollo-and-redux-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -10,6 +10,10 @@ export default ({ pathname }) => (
<a className={pathname === '/about' && 'is-active'}>About</a>
</Link>
<Link prefetch href='/blog'>
<a className={pathname === '/blog' && 'is-active'}>Blog</a>
</Link>
<style jsx>{`
header {
margin-bottom: 25px;
......
import React from 'react'
import { gql, graphql } from 'react-apollo'
import PostUpvoter from './PostUpvoter'
function Post ({ id, data: { loading, error, Post } }) {
return (
<section>
<div key={Post.id}>
<h1>{Post.title}</h1>
<p>ID: {Post.id}<br />URL: {Post.url}</p>
<PostUpvoter id={Post.id} votes={Post.votes} />
</div>
</section>
)
}
const post = gql`
query post($id: ID!) {
Post(id: $id) {
id
title
votes
url
createdAt
}
}
`
// The `graphql` wrapper executes a GraphQL query and makes the results
// available on the `data` prop of the wrapped component (PostList)
// Tip: ownProps is parent component's props
export default graphql(post, {
options: (ownProps) => {
return {
variables: {
id: ownProps.id
}
}
}
})(Post)
import { gql, graphql } from 'react-apollo'
import ErrorMessage from './ErrorMessage'
import PostUpvoter from './PostUpvoter'
import Link from 'next/link'
const POSTS_PER_PAGE = 10
......@@ -15,7 +16,7 @@ function PostList ({ data: { loading, error, allPosts, _allPostsMeta }, loadMore
<li key={post.id}>
<div>
<span>{index + 1}. </span>
<a href={post.url}>{post.title}</a>
<Link href={{ pathname: '/blog/' + post.id }}><a>{post.title}</a></Link>
<PostUpvoter id={post.id} votes={post.votes} />
</div>
</li>
......
import { ApolloClient, createNetworkInterface } from 'react-apollo'
import fetch from 'isomorphic-fetch'
import fetch from 'isomorphic-unfetch'
let apolloClient = null
......
......@@ -2,14 +2,15 @@
"name": "with-apollo-and-redux",
"version": "2.0.0",
"scripts": {
"dev": "next",
"dev": "node server.js",
"build": "next build",
"start": "next start"
"start": "NODE_ENV=production node server.js"
},
"dependencies": {
"graphql": "^0.9.3",
"isomorphic-fetch": "^2.2.1",
"isomorphic-unfetch": "^2.0.0",
"next": "latest",
"next-routes": "^1.1.0",
"prop-types": "^15.5.8",
"react": "^16.0.0",
"react-apollo": "^1.1.3",
......
import App from '../../components/App'
import Header from '../../components/Header'
import Post from '../../components/Post'
import withData from '../../lib/withData'
export default withData((props) => (
<App>
<Header pathname={props.url.pathname} />
<Post id={props.url.query.id} />
</App>
))
import App from '../../components/App'
import Header from '../../components/Header'
import Submit from '../../components/Submit'
import PostList from '../../components/PostList'
import withData from '../../lib/withData'
export default withData((props) => (
<App>
<Header pathname={props.url.pathname} />
<Submit />
<PostList />
</App>
))
import App from '../components/App'
import Header from '../components/Header'
import Submit from '../components/Submit'
import PostList from '../components/PostList'
import withData from '../lib/withData'
export default withData((props) => (
<App>
<Header pathname={props.url.pathname} />
<Submit />
<PostList />
<h1>Welcome Home.</h1>
</App>
))
/**
* server.js
*
* You can use the default server.js by simply running `next`,
* but a custom one is required to do paramaterized urls like
* blog/:slug.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BENEVOLENT WEB LLC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const {createServer} = require('http')
const next = require('next')
const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({dev})
/**
* Parameterized Routing with next-route
*
* Benefits: Less code, and easily handles complex url structures
*/
const routes = require('next-routes')()
routes.add('blog/entry', '/blog/:id')
const handler = routes.getRequestHandler(app)
app.prepare().then(() => {
createServer(handler)
.listen(port, (err) => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
})
})
......@@ -7,6 +7,17 @@ https://next-with-apollo-auth.now.sh
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-apollo-auth with-apollo-auth-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
import { ApolloClient, createNetworkInterface } from 'react-apollo'
import fetch from 'isomorphic-fetch'
import { ApolloClient } from 'apollo-client'
import { createHttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { setContext } from 'apollo-link-context'
import fetch from 'isomorphic-unfetch'
let apolloClient = null
......@@ -9,25 +12,26 @@ if (!process.browser) {
}
function create (initialState, { getToken }) {
const networkInterface = createNetworkInterface({
uri: 'https://api.graph.cool/simple/v1/cj3h80ffbllm20162alevpcby'
const httpLink = createHttpLink({
uri: 'https://api.graph.cool/simple/v1/cj5geu3slxl7t0127y8sity9r',
credentials: 'same-origin'
})
networkInterface.use([{
applyMiddleware (req, next) {
if (!req.options.headers) {
req.options.headers = {} // Create the header object if needed.
const authLink = setContext((_, { headers }) => {
const token = getToken()
return {
headers: {
...headers,
authorization: token ? `Bearer ${token}` : null
}
const token = getToken()
req.options.headers.authorization = token ? `Bearer ${token}` : null
next()
}
}])
})
return new ApolloClient({
initialState,
connectToDevTools: process.browser,
ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once)
networkInterface
link: authLink.concat(httpLink),
cache: new InMemoryCache().restore(initialState || {})
})
}
......@@ -44,4 +48,4 @@ export default function initApollo (initialState, options) {
}
return apolloClient
}
}
\ No newline at end of file
......@@ -2,13 +2,14 @@ import React from 'react'
import cookie from 'cookie'
import PropTypes from 'prop-types'
import { ApolloProvider, getDataFromTree } from 'react-apollo'
import Head from 'next/head'
import initApollo from './initApollo'
function parseCookies (ctx = {}, options = {}) {
function parseCookies(context = {}, options = {}) {
return cookie.parse(
ctx.req && ctx.req.headers.cookie
? ctx.req.headers.cookie
context.req && context.req.headers.cookie
? context.req.headers.cookie
: document.cookie,
options
)
......@@ -21,7 +22,7 @@ export default ComposedComponent => {
serverState: PropTypes.object.isRequired
}
static async getInitialProps (context) {
static async getInitialProps(context) {
let serverState = {}
// Setup a server-side one-time-use apollo client for initial props and
......@@ -46,30 +47,32 @@ export default ComposedComponent => {
}
// Provide the `url` prop data in case a graphql query uses it
const url = {query: context.query, pathname: context.pathname}
// Run all graphql queries
const app = (
<ApolloProvider client={apollo}>
<ComposedComponent url={url} {...composedInitialProps} />
</ApolloProvider>
)
await getDataFromTree(app, {
router: {
query: context.query,
pathname: context.pathname,
asPath: context.asPath
}
})
const url = { query: context.query, pathname: context.pathname }
try {
// Run all GraphQL queries
const app = (
<ApolloProvider client={apollo}>
<ComposedComponent url={url} {...composedInitialProps} />
</ApolloProvider>
)
await getDataFromTree(app, {
router: {
query: context.query,
pathname: context.pathname,
asPath: context.asPath
}
})
} catch (error) {
// Prevent Apollo Client GraphQL errors from crashing SSR.
// Handle them in components via the data.error prop:
// http://dev.apollodata.com/react/api-queries.html#graphql-query-data-error
}
// getDataFromTree does not call componentWillUnmount
// head side effect therefore need to be cleared manually
Head.rewind()
// Extract query data from the Apollo's store
const state = apollo.getInitialState()
serverState = {
apollo: { // Make sure to only include Apollo's data state
data: state.data
}
}
serverState = apollo.cache.extract()
}
return {
......@@ -78,7 +81,7 @@ export default ComposedComponent => {
}
}
constructor (props) {
constructor(props) {
super(props)
// Note: Apollo should never be used on the server side beyond the initial
// render within `getInitialProps()` above (since the entire prop tree
......@@ -89,7 +92,7 @@ export default ComposedComponent => {
})
}
render () {
render() {
return (
<ApolloProvider client={this.apollo}>
<ComposedComponent {...this.props} />
......@@ -97,4 +100,4 @@ export default ComposedComponent => {
)
}
}
}
}
\ No newline at end of file
......@@ -10,13 +10,15 @@
"test": "NODE_ENV=test ava"
},
"dependencies": {
"apollo-client-preset": "1.0.2",
"apollo-link-context": "1.0.0",
"cookie": "^0.3.1",
"graphql": "^0.9.3",
"isomorphic-fetch": "^2.2.1",
"graphql": "0.11.7",
"isomorphic-unfetch": "^2.0.0",
"next": "latest",
"prop-types": "^15.5.10",
"react": "^16.0.0",
"react-apollo": "^1.1.3",
"react-apollo": "2.0.0",
"react-dom": "^16.0.0"
},
"devDependencies": {
......
......@@ -7,6 +7,17 @@ https://next-with-apollo.now.sh
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-apollo with-apollo-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -67,7 +67,7 @@ function PostList ({ data: { loading, error, allPosts, _allPostsMeta }, loadMore
return <div>Loading</div>
}
const allPosts = gql`
export const allPosts = gql`
query allPosts($first: Int!, $skip: Int!) {
allPosts(orderBy: createdAt_DESC, first: $first, skip: $skip) {
id
......@@ -81,15 +81,16 @@ const allPosts = gql`
}
}
`
export const allPostsQueryVars = {
skip: 0,
first: POSTS_PER_PAGE
}
// The `graphql` wrapper executes a GraphQL query and makes the results
// available on the `data` prop of the wrapped component (PostList)
export default graphql(allPosts, {
options: {
variables: {
skip: 0,
first: POSTS_PER_PAGE
}
variables: allPostsQueryVars
},
props: ({ data }) => ({
data,
......
import { graphql } from 'react-apollo'
import gql from 'graphql-tag'
import {allPosts, allPostsQueryVars} from './PostList'
function Submit ({ createPost }) {
function handleSubmit (e) {
......@@ -65,14 +66,9 @@ export default graphql(createPost, {
props: ({ mutate }) => ({
createPost: (title, url) => mutate({
variables: { title, url },
updateQueries: {
allPosts: (previousResult, { mutationResult }) => {
const newPost = mutationResult.data.createPost
return Object.assign({}, previousResult, {
// Append the new post
allPosts: [newPost, ...previousResult.allPosts]
})
}
update: (proxy, { data: { createPost } }) => {
const data = proxy.readQuery({ query: allPosts, variables: allPostsQueryVars })
proxy.writeQuery({ query: allPosts, data: {allPosts: [createPost, ...data.allPosts]}, variables: allPostsQueryVars })
}
})
})
......
import { ApolloClient } from 'apollo-client'
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import fetch from 'isomorphic-fetch'
import fetch from 'isomorphic-unfetch'
let apolloClient = null
......@@ -16,9 +16,7 @@ function create (initialState) {
ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once)
link: new HttpLink({
uri: 'https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn', // Server URL (must be absolute)
opts: {
credentials: 'same-origin' // Additional fetch() options like `credentials` or `headers`
}
credentials: 'same-origin' // Additional fetch() options like `credentials` or `headers`
}),
cache: new InMemoryCache().restore(initialState || {}),
})
......
......@@ -17,7 +17,12 @@ export default ComposedComponent => {
}
static async getInitialProps (ctx) {
let serverState = {}
// Initial serverState with apollo (empty)
let serverState = {
apollo: {
data: { }
}
}
// Evaluate the composed component's getInitialProps()
let composedInitialProps = {}
......
......@@ -11,7 +11,7 @@
"graphql": "^0.11.7",
"graphql-anywhere": "^3.1.0",
"graphql-tag": "^2.5.0",
"isomorphic-fetch": "^2.2.1",
"isomorphic-unfetch": "^2.0.0",
"next": "latest",
"prop-types": "^15.5.8",
"react": "^16.0.0",
......
......@@ -2,6 +2,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-asset-imports with-asset-imports-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-babel-macros with-babel-macros-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-cxs with-cxs-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-dotenv with-dotenv-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -2,6 +2,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-dynamic-import with-dynamic-import-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -2,7 +2,18 @@
**You can find a detailed documentation about how to build Electron apps with Next.js [here](https://leo.im/2017/electron-next)!**
## Usage
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-electron with-electron-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-emotion with-emotion-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-fela with-fela-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-firebase-authentication with-firebase-authentication-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -12,7 +12,7 @@
"express-session": "^1.15.2",
"firebase": "^3.7.5",
"firebase-admin": "^4.2.0",
"isomorphic-fetch": "2.2.1",
"isomorphic-unfetch": "2.0.0",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0",
......
import React, { Component } from 'react'
import firebase from 'firebase'
import 'isomorphic-fetch'
import 'isomorphic-unfetch'
import clientCredentials from '../credentials/client'
export default class Index extends Component {
......@@ -33,7 +33,7 @@ export default class Index extends Component {
firebase.auth().onAuthStateChanged(user => {
if (user) {
this.setState({ user: user })
return user.getToken()
return user.getIdToken()
.then((token) => {
// eslint-disable-next-line no-undef
return fetch('/api/login', {
......
......@@ -2,6 +2,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-firebase-hosting with-firebase-hosting-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
[ignore]
.*/node_modules/*
[include]
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-flow with-flow-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
// @flow
import type {Element} from 'React'
import * as React from 'react'
import Link from 'next/link'
import Head from 'next/head'
type Props = {
children?: Element<any>,
children?: React.Element<any>,
title?: string
}
......
......@@ -17,6 +17,6 @@
"devDependencies": {
"babel-eslint": "^7.1.1",
"babel-plugin-transform-flow-strip-types": "^6.21.0",
"flow-bin": "^0.37.4"
"flow-bin": "^0.59.0"
}
}
// @flow
import * as React from 'react'
import Layout from '../components/layout'
export default () => (
......
// @flow
import * as React from 'react'
import Layout from '../components/layout'
export default () => (
......
// @flow
import * as React from 'react'
import Layout from '../components/layout'
export default () => (
......
......@@ -13,15 +13,15 @@ declare module "next" {
}
declare module "next/head" {
declare module.exports: Class<React$Component<void, any, any>>;
declare module.exports: Class<React$Component<any, any>>;
}
declare module "next/link" {
declare module.exports: Class<React$Component<void, {href: string, prefetch?: bool}, any>>;
declare module.exports: Class<React$Component<{href: string, prefetch?: bool}, any>>;
}
declare module "next/error" {
declare module.exports: Class<React$Component<void, {statusCode: number}, any>>;
declare module.exports: Class<React$Component<{statusCode: number}, any>>;
}
declare module "next/router" {
......@@ -38,10 +38,10 @@ declare module "next/router" {
}
declare module "next/document" {
declare export var Head: Class<React$Component<void, any, any>>;
declare export var Main: Class<React$Component<void, any, any>>;
declare export var NextScript: Class<React$Component<void, any, any>>;
declare export default Class<React$Component<void, any, any>> & {
declare export var Head: Class<React$Component<any, any>>;
declare export var Main: Class<React$Component<any, any>>;
declare export var NextScript: Class<React$Component<any, any>>;
declare export default Class<React$Component<any, any>> & {
getInitialProps: (ctx: {pathname: string, query: any, req?: any, res?: any, jsonPageRes?: any, err?: any}) => Promise<any>;
renderPage(cb: Function): void;
};
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-freactal with-freactal-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
/* global fetch */
import 'isomorphic-fetch'
import 'isomorphic-unfetch'
const API_BASE_URL = 'https://api.github.com'
......
......@@ -8,7 +8,7 @@
},
"dependencies": {
"freactal": "^1.1.1",
"isomorphic-fetch": "^2.2.1",
"isomorphic-unfetch": "^2.0.0",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0"
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-glamor with-glamor-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-glamorous with-glamorous-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -6,6 +6,17 @@ This is an example of how you can include a global stylesheet in a next.js webap
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-global-stylesheet with-global-stylesheet-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -2,6 +2,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-hashed-statics with-hashed-statics-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-higher-order-component with-higher-order-component-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
Install it and run:
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-i18next with-i18next-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -7,12 +7,12 @@
"start": "next start"
},
"dependencies": {
"i18next": "^7.1.3",
"isomorphic-fetch": "^2.2.1",
"i18next": "^10.0.7",
"isomorphic-unfetch": "^2.0.0",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-i18next": "^2.2.1"
"react-i18next": "^6.1.0"
},
"license": "ISC"
}
/* global fetch */
import 'isomorphic-fetch'
import 'isomorphic-unfetch'
/**
* Fetch translation file(s).
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-jest with-jest-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
{
"presets": [
"next/babel"
],
"plugins": [
"transform-decorators-legacy"
]
}
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-kea)
# kea example
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-kea with-kea-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-kea
cd with-kea
```
Install it and run:
```bash
npm install
npm run dev
```
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```bash
now
```
{
"name": "with-kea",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"kea": "^0.27.3",
"next": "^4.1.4",
"next-redux-wrapper": "^1.3.4",
"prop-types": "^15.6.0",
"react": "^16.1.0",
"react-dom": "^16.1.0",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"reselect": "^3.0.1"
},
"license": "ISC",
"devDependencies": {
"babel-plugin-transform-decorators-legacy": "^1.3.4"
}
}
import React from 'react'
import { initStore } from '../store'
import withRedux from 'next-redux-wrapper'
import PropTypes from 'prop-types'
import { kea } from 'kea'
@kea({
path: () => ['kea'],
actions: () => ({
increment: amount => ({ amount }),
decrement: amount => ({ amount })
}),
reducers: ({ actions }) => ({
counter: [
0,
PropTypes.number,
{
[actions.increment]: (state, payload) => state + payload.amount,
[actions.decrement]: (state, payload) => state - payload.amount
}
]
}),
selectors: ({ selectors }) => ({
doubleCounter: [
() => [selectors.counter],
counter => counter * 2,
PropTypes.number
]
})
})
class App extends React.Component {
render () {
return (
<div>
<p>Double Counter: {this.props.doubleCounter}</p>
<button type='button' onClick={() => this.actions.increment(1)}>Increment</button>
<button type='button' onClick={() => this.actions.decrement(1)}>Decrement</button>
</div>
)
}
}
export default withRedux(initStore)(App)
import { keaReducer } from 'kea'
import { createStore, compose, combineReducers } from 'redux'
const reducers = combineReducers({
kea: keaReducer('kea')
})
const reduxDevTools =
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
? window.__REDUX_DEVTOOLS_EXTENSION__()
: f => f
export const initStore = () => {
return createStore(
reducers,
compose(reduxDevTools)
)
}
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-loading with-loading-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-material-ui-next with-material-ui-next-app
```
### Download manually
Download the example [or clone the repo](https://github.com/callemall/material-ui):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-material-ui with-material-ui-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
{
"presets": [
"next/babel"
],
"plugins": [
"transform-decorators-legacy"
]
}
\ No newline at end of file
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-mobx-state-tree)
# MobX State Tree example
## How to use
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-mobx
cd with-mobx
```
Install it and run:
```bash
npm install
npm run dev
```
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```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 the root of the project:
```json
{
"presets": [
"next/babel"
],
"plugins": [
"transform-decorators-legacy"
]
}
```
### Rehydrating with server data
After initializing the store (and possibly making changes such as fetching data), `getInitialProps` must stringify the store in order to pass it as props to the client. `mobx-state-tree` comes out of the box with a handy method for doing this called `getSnapshot`. The snapshot is sent to the client as `props.initialState` where the pages's `constructor()` may use it to rehydrate the client store.
## The idea behind the example
Usually splitting your app state into `pages` feels natural but sometimes you'll want to have global state for your app. This is an example on how you can use mobx that also works with our universal rendering approach. This is just a way you can do it but it's not the only one.
In this example we are going to display a digital clock that updates every second. The first render is happening in the server and then the browser will take over. To illustrate this, the server rendered clock will have a different background color than the client one.
![](http://i.imgur.com/JCxtWSj.gif)
Our page is located at `pages/index.js` so it will map the route `/`. To get the initial data for rendering we are implementing the static method `getInitialProps`, initializing the mobx-state-tree store and returning the initial timestamp to be rendered. The root component for the render method is the `mobx-react <Provider>` that allows us to send the store down to children components so they can access to the state when required.
To pass the initial timestamp from the server to the client we pass it as a prop called `lastUpdate` so then it's available when the client takes over.
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. If we are in the client we want to use always the same store. That's what we accomplish on `store.js`
The clock, under `components/Clock.js`, has access to the state using the `inject` and `observer` functions from `mobx-react`. In this case Clock is a direct child from the page but it could be deep down the render tree.
As far as how this example differs from the `with-mobx` example, `mobx-state-tree` requires that any changes to the observable data are sent as actions, which are defined on the model in `server.js`. The snapshot feature, while not very useful in this particular case, makes client-side rehydration of the state amazingly easy. Any changes that are made to the store in `getInitialProps` will be refreshed instantly when that page is loaded on the client.
export default (props) => {
return (
<div className={props.light ? 'light' : ''}>
{format(new Date(props.lastUpdate))}
<style jsx>{`
div {
padding: 15px;
color: #82FA58;
display: inline-block;
font: 50px menlo, monaco, monospace;
background-color: #000;
}
.light {
background-color: #999;
}
`}</style>
</div>
)
}
const format = t => `${pad(t.getUTCHours())}:${pad(t.getUTCMinutes())}:${pad(t.getUTCSeconds())}`
const pad = n => n < 10 ? `0${n}` : n
import React from 'react'
import Link from 'next/link'
import { inject, observer } from 'mobx-react'
import Clock from './Clock'
@inject('store') @observer
class Page extends React.Component {
componentDidMount () {
this.props.store.start()
}
componentWillUnmount () {
this.props.store.stop()
}
render () {
return (
<div>
<h1>{this.props.title}</h1>
<Clock lastUpdate={this.props.store.lastUpdate} light={this.props.store.light} />
<nav>
<Link href={this.props.linkTo}><a>Navigate</a></Link>
</nav>
</div>
)
}
}
export default Page
{
"name": "with-mobx",
"version": "1.0.0",
"scripts": {
"dev": "node server.js",
"build": "next build",
"start": "NODE_ENV=production node server.js"
},
"dependencies": {
"mobx": "3.3.1",
"mobx-react": "^4.0.4",
"mobx-state-tree": "1.0.1",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"license": "ISC",
"devDependencies": {
"babel-plugin-transform-decorators-legacy": "^1.3.4"
}
}
import React from 'react'
import { Provider } from 'mobx-react'
import { getSnapshot } from 'mobx-state-tree'
import { initStore } from '../store'
import Page from '../components/Page'
export default class Counter extends React.Component {
static getInitialProps ({ req }) {
const isServer = !!req
const store = initStore(isServer)
return { initialState: getSnapshot(store), isServer }
}
constructor (props) {
super(props)
this.store = initStore(props.isServer, props.initialState)
}
render () {
return (
<Provider store={this.store}>
<Page title='Index Page' linkTo='/other' />
</Provider>
)
}
}
import React from 'react'
import { Provider } from 'mobx-react'
import { getSnapshot } from 'mobx-state-tree'
import { initStore } from '../store'
import Page from '../components/Page'
export default class Counter extends React.Component {
static getInitialProps ({ req }) {
const isServer = !!req
const store = initStore(isServer)
return { initialState: getSnapshot(store), isServer }
}
constructor (props) {
super(props)
this.store = initStore(props.isServer, props.initialState)
}
render () {
return (
<Provider store={this.store}>
<Page title='Other Page' linkTo='/' />
</Provider>
)
}
}
const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const { createServer } = require('http')
const { parse } = require('url')
const next = require('next')
const mobxReact = require('mobx-react')
const app = next({ dev })
const handle = app.getRequestHandler()
mobxReact.useStaticRendering(true)
app.prepare().then(() => {
createServer((req, res) => {
const parsedUrl = parse(req.url, true)
handle(req, res, parsedUrl)
}).listen(port, err => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
})
})
import { types, applySnapshot } from 'mobx-state-tree'
let store = null
const Store = types
.model({
lastUpdate: types.Date,
light: false
})
.actions((self) => {
let timer
function start () {
timer = setInterval(() => {
// mobx-state-tree doesn't allow anonymous callbacks changing data
// pass off to another action instead
self.update()
})
}
function update () {
self.lastUpdate = Date.now()
self.light = true
}
function stop () {
clearInterval(timer)
}
return { start, stop, update }
})
export function initStore (isServer, snapshot = null) {
if (isServer) {
store = Store.create({ lastUpdate: Date.now() })
}
if (store === null) {
store = Store.create({ lastUpdate: Date.now() })
}
if (snapshot) {
applySnapshot(store, snapshot)
}
return store
}
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-mobx with-mobx-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-next-routes with-next-routes-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-noscript with-noscript-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
## Development
......
......@@ -2,6 +2,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-pkg with-pkg-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
# Example with portals
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-portals with-portals-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-portals
cd with-portals
```
Install it and run:
```bash
npm install
npm run 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 show how to use the React [Portals](https://reactjs.org/docs/portals.html) feature with Next.js.
import { Component } from 'react'
import { createPortal } from 'react-dom'
export default class extends Component {
componentWillMount () {
// get the mount point, is because of this why the modal
// can't be used server side, we need access to the DOM
this.modalRoot = document.getElementById('modal')
}
render () {
const { title, children } = this.props
return createPortal(
<div className='overlay'>
<div className='modal'>
<h2>{title}</h2>
{children}
</div>
<style jsx global>{`
body {
/* this avoid any possible scroll on the body */
overflow: hidden;
}
`}</style>
<style jsx>{`
.overlay {
position: fixed;
background-color: rgba(0, 0, 0, .7);
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.modal {
background-color: white;
position: absolute;
top: 10%;
right: 10%;
bottom: 10%;
left: 10%;
padding: 1em;
}
`}</style>
</div>,
this.modalRoot
)
}
}
{
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^4.1.4",
"react": "^16.2.0",
"react-dom": "^16.2.0"
}
}
import Document, { Head, Main, NextScript } from 'next/document'
export default class extends Document {
render () {
return (
<html>
<Head />
<body>
<Main />
{/* here we will mount our modal portal */}
<div id='modal' />
<NextScript />
</body>
</html>
)
}
}
import { Component } from 'react'
import dynamic from 'next/dynamic'
// we import and render the modal only client side (because we need a DOM)
const Modal = dynamic(import('../components/modal'), {
ssr: false
})
export default class extends Component {
state = { modal: false };
toggleModal = () => this.setState(state => ({ modal: !state.modal }))
render () {
return (
<main>
<button type='button' onClick={this.toggleModal}>
Open modal
</button>
{this.state.modal && (
<Modal title='My Modal Portal'>
<p>This is a portal rendered from Next.js</p>
<button type='button' onClick={this.toggleModal}>
Close
</button>
</Modal>
)}
</main>
)
}
}
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-prefetching with-prefetching-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-pretty-url-routing with-pretty-url-routing-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-react-ga with-react-ga-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-react-helmet with-react-helmet-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-react-intl with-react-intl-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js.git):
```bash
......
......@@ -23,7 +23,7 @@ export default (Page) => {
// Get the `locale` and `messages` from the request object on the server.
// In the browser, use the same values that the server serialized.
const {req} = context
const {locale, messages} = req || window.__NEXT_DATA__.props
const {locale, messages} = req || window.__NEXT_DATA__.props.initialProps
// Always update the current time on page load/transition because the
// <IntlProvider> will be a new instance even with pushState routing.
......
......@@ -6,6 +6,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-react-md with-react-md-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-react-toolbox with-react-toolbox-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-react-uwp with-react-uwp-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-react-with-styles with-react-with-styles-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -7,12 +7,12 @@
"start": "next start"
},
"dependencies": {
"aphrodite": "^1.2.1",
"aphrodite": "^1.2.5",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-with-styles": "^1.4.0",
"react-with-styles-interface-aphrodite": "^1.2.0"
"react-with-styles": "^2.2.0",
"react-with-styles-interface-aphrodite": "^3.1.1"
},
"license": "MIT"
}
import ThemedStyleSheet from 'react-with-styles/lib/ThemedStyleSheet'
import aphroditeInterface from 'react-with-styles-interface-aphrodite'
import { css, withStyles, ThemeProvider } from 'react-with-styles'
import { css, withStyles } from 'react-with-styles'
import MyDefaultTheme from './defaultTheme'
ThemedStyleSheet.registerDefaultTheme(MyDefaultTheme)
ThemedStyleSheet.registerTheme(MyDefaultTheme)
ThemedStyleSheet.registerInterface(aphroditeInterface)
export { css, withStyles, ThemeProvider, ThemedStyleSheet }
export { css, withStyles, ThemedStyleSheet }
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-reasonml with-reasonml-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -6,5 +6,6 @@
"package-specs": ["commonjs"],
"bsc-flags": [
"-bs-super-errors"
]
],
"refmt": 3
}
type action =
| Add;
let component = ReasonReact.reducerComponent "Counter";
let component = ReasonReact.reducerComponent("Counter");
let make _children => {
let make = (_children) => {
...component,
initialState: fun () => 0,
reducer: fun action state =>
initialState: () => 0,
reducer: (action, state) =>
switch action {
| Add => ReasonReact.Update {state + 1}
| Add => ReasonReact.Update(state + 1)
},
render: fun self => {
let countMsg = "Count: " ^ (string_of_int self.state);
render: (self) => {
let countMsg = "Count: " ++ string_of_int(self.state);
<div>
<p> (ReasonReact.stringToElement countMsg) </p>
<button onClick=(self.reduce (fun _event => Add))> (ReasonReact.stringToElement "Add") </button>
<p> (ReasonReact.stringToElement(countMsg)) </p>
<button onClick=(self.reduce((_event) => Add))>
(ReasonReact.stringToElement("Add"))
</button>
</div>
}
};
};
\ No newline at end of file
let component = ReasonReact.statelessComponent "Header";
let styles = ReactDOMRe.Style.make
marginRight::"10px"
();
let make _children => {
let component = ReasonReact.statelessComponent("Header");
let styles = ReactDOMRe.Style.make(~marginRight="10px", ());
let make = (_children) => {
...component,
render: fun _self => {
render: (_self) =>
<div>
<a href="/" style=styles> (ReasonReact.stringToElement "Home") </a>
<a href="/about" style=styles> (ReasonReact.stringToElement "About") </a>
<a href="/" style=styles> (ReasonReact.stringToElement("Home")) </a>
<a href="/about" style=styles> (ReasonReact.stringToElement("About")) </a>
</div>
}
};
};
\ No newline at end of file
......@@ -2,18 +2,21 @@
"name": "with-reasonml",
"version": "1.0.0",
"scripts": {
"dev": "concurrently \"bsb --clean-world -make-world -w\" \"next -w\"",
"dev": "concurrently \"bsb -clean-world -make-world -w\" \"next -w\"",
"build": "bsb -clean-world -make-world && next build",
"start": "bsb -clean-world -make-world && next start -w"
},
"license": "ISC",
"dependencies": {
"babel-plugin-bucklescript": "^0.2.3-1",
"bs-platform": "^1.9.3",
"concurrently": "^3.5.0",
"next": "^3.2.2",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"reason-react": "^0.2.3"
"babel-plugin-bucklescript": "^0.2.4",
"next": "^4.1.4",
"react": "^16.1.1",
"react-dom": "^16.1.1",
"reason-react": "^0.3.0"
},
"devDependencies": {
"bs-platform": "^2.1.0",
"concurrently": "^3.5.1",
"webpack": "^3.8.1"
}
}
let component = ReasonReact.statelessComponent "About";
let make _children => {
let component = ReasonReact.statelessComponent("About");
let make = (_children) => {
...component,
render: fun _self => {
render: (_self) =>
<div>
<Header />
<p>(ReasonReact.stringToElement "This is the about page.")</p>
<p> (ReasonReact.stringToElement("This is the about page.")) </p>
<Counter />
</div>
}
};
let jsComponent =
ReasonReact.wrapReasonForJs
::component
(fun _jsProps => make [||])
let jsComponent = ReasonReact.wrapReasonForJs(~component, (_jsProps) => make([||]));
\ No newline at end of file
let component = ReasonReact.statelessComponent "Index";
let make _children => {
let component = ReasonReact.statelessComponent("Index");
let make = (_children) => {
...component,
render: fun _self => {
render: (_self) =>
<div>
<Header />
<p>(ReasonReact.stringToElement "HOME PAGE is here!")</p>
<p> (ReasonReact.stringToElement("HOME PAGE is here!")) </p>
<Counter />
</div>
}
};
let jsComponent =
ReasonReact.wrapReasonForJs
::component
(fun _jsProps => make [||])
let jsComponent = ReasonReact.wrapReasonForJs(~component, (_jsProps) => make([||]));
\ No newline at end of file
......@@ -6,6 +6,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-rebass with-rebass-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-recompose with-recompose-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -5,6 +5,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-redux-code-splitting with-redux-code-splitting-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -2,6 +2,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-redux-observable with-redux-observable-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-redux-reselect-recompose with-redux-reselect-recompose-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -6,6 +6,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-redux-saga with-redux-saga-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -9,7 +9,7 @@
},
"dependencies": {
"es6-promise": "4.1.1",
"isomorphic-fetch": "2.2.1",
"isomorphic-unfetch": "2.0.0",
"next": "latest",
"next-redux-saga": "1.0.1",
"next-redux-wrapper": "1.2.0",
......
......@@ -3,7 +3,7 @@
import {delay} from 'redux-saga'
import {all, call, put, take, takeLatest} from 'redux-saga/effects'
import es6promise from 'es6-promise'
import 'isomorphic-fetch'
import 'isomorphic-unfetch'
import {actionTypes, failure, loadDataSuccess, tickClock} from './actions'
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-redux with-redux-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-refnux with-refnux-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
__generated__/
schema/schema.graphql
\ No newline at end of file
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-relay-modern with-relay-modern-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
import { Environment, Network, RecordSource, Store } from 'relay-runtime'
import fetch from 'isomorphic-fetch'
import fetch from 'isomorphic-unfetch'
let relayEnvironment = null
......
......@@ -15,16 +15,16 @@
"dependencies": {
"dotenv": "^4.0.0",
"dotenv-webpack": "^1.5.4",
"isomorphic-fetch": "^2.2.1",
"next": "^3.0.3",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-relay": "^1.2.0-rc.1"
"isomorphic-unfetch": "^2.0.0",
"next": "^4.1.4",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-relay": "^1.4.1"
},
"devDependencies": {
"graphql-cli": "^1.0.0-beta.4",
"babel-plugin-relay": "^1.1.0",
"babel-plugin-relay": "^1.4.1",
"graphcool": "^1.2.1",
"relay-compiler": "^1.2.0-rc.1"
"relay-compiler": "^1.4.1"
}
}
......@@ -5,6 +5,17 @@ This is an example of using scoped stylesheets and PostCSS, heavily influenced b
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-scoped-stylesheets-and-postcss with-scoped-stylesheets-and-postcss-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-semantic-ui with-semantic-ui-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-sentry)
# Sentry example
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-sentry with-sentry-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
Install it and run:
**npm**
```bash
npm install
npm run dev
```
**yarn**
```bash
npm install
npm run dev
```
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```bash
now
```
## About example
This example show you how to add Sentry to catch errors in next.js
You will need a Sentry DSN for your project. You can get it from the Settings of your Project, in **Client Keys (DSN)**, and copy the string labeled **DSN (Public)**.
\ No newline at end of file
import React from 'react'
import Raven from 'raven-js'
const SENTRY_DSN = ''
function withSentry (Child) {
return class WrappedComponent extends React.Component {
static getInitialProps (context) {
if (Child.getInitialProps) {
return Child.getInitialProps(context)
}
return {}
}
constructor (props) {
super(props)
this.state = {
error: null
}
Raven.config(
SENTRY_DSN
).install()
}
componentDidCatch (error, errorInfo) {
this.setState({ error })
Raven.captureException(error, { extra: errorInfo })
}
render () {
return <Child {...this.props} error={this.state.error} />
}
}
}
export default withSentry
{
"name": "with-sentry",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "latest",
"raven-js": "^3.19.1",
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"license": "ISC"
}
import React from 'react'
import withSentry from '../components/withSentry'
class Index extends React.Component {
static getInitialProps (context) {
const { isServer } = context
return { isServer }
}
onClickHandler () {
throw new Error('woops')
}
render () {
return (
<div>
<h2>Index page</h2>
<button onClick={this.onClickHandler.bind(this)}>Click to raise error</button>
</div>
)
}
}
export default withSentry(Index)
......@@ -4,11 +4,22 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-shallow-routing with-shallow-routing-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/hello-world
cd hello-world
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-shallow-routing
cd with-shallow-routing
```
Install it and run:
......@@ -28,4 +39,4 @@ now
With shallow routing, we could change the URL without actually running the `getInitialProps` every time you change the URL.
We do this passing the `shallow: true` option to `Router.push` or `Router.replace`.
\ No newline at end of file
We do this passing the `shallow: true` option to `Router.push` or `Router.replace`.
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-socket.io with-socket.io-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,7 +3,7 @@
"version": "1.0.0",
"dependencies": {
"express": "^4.15.2",
"isomorphic-fetch": "^2.2.1",
"isomorphic-unfetch": "^2.0.0",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0",
......
import { Component } from 'react'
import io from 'socket.io-client'
import fetch from 'isomorphic-fetch'
import fetch from 'isomorphic-unfetch'
class HomePage extends Component {
// fetch old messages data from the server
......
......@@ -2,6 +2,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-static-export with-static-export-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
const fetch = require('isomorphic-fetch')
const fetch = require('isomorphic-unfetch')
module.exports = {
async exportPathMap () {
......
......@@ -3,7 +3,7 @@
"main": "server.js",
"dependencies": {
"express": "^4.15.3",
"isomorphic-fetch": "^2.2.1",
"isomorphic-unfetch": "^2.0.0",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0",
......
import { Component } from 'react'
import Head from 'next/head'
import fetch from 'isomorphic-fetch'
import fetch from 'isomorphic-unfetch'
import Post from '../components/post'
......
import { Component } from 'react'
import Link from 'next/link'
import Head from 'next/head'
import fetch from 'isomorphic-fetch'
import fetch from 'isomorphic-unfetch'
export default class extends Component {
static async getInitialProps ({ query }) {
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-styled-components with-styled-components-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-styled-jsx-plugins with-styled-jsx-plugins-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-styled-jsx-scss with-styled-jsx-scss-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-styletron with-styletron-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-sw-precache with-sw-precache-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-tailwindcss)
# Tailwind CSS example
This is an example of how you can include a global stylesheet in a next.js webapp.
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-tailwindcss with-tailwindcss-app
```
### Download manually
If you like [create-next-app](https://github.com/segmentio/create-next-app) and/or [yarn](https://yarnpkg.com/en/docs/cli/create) simply run:
```bash
yarn create next-app --example with-tailwindcss my-app
cd my-app
```
*Otherwise:*
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-tailwindcss
cd with-tailwindcss
```
**Running**
To get this example running you just need to
yarn install .
yarn dev
Visit [http://localhost:3000](http://localhost:3000) and try to modify `styles/index.css`.
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```bash
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`
* will **not** autoreload browser when css changes
* `yarn build:css`
* used by `yarn build` to generate css bundle
These can be used manually but using the usual commands will run them anyways.
## The idea behind the example
This setup is a basic starting point for using tailwind css and next. Along with tailwind, this example
also uses some other postcss plugins for imports, autoprefixing, and stripping whitespace/comments. The imports simply
allow for an easy way to split up css files but still get one bundled css file in `static/css/bundle.css`.
Changing stylesheets does not trigger auto-reloads. Setting up auto-reloads was avoided
because the next.js read me does not recommend doing so. Although, that can easily be done with
some webpack loaders. If you are curious about using loaders with next look at this
[example](https://github.com/zeit/next.js/tree/canary/examples/with-global-stylesheet).
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
import NextHead from 'next/head'
import { string } from 'prop-types'
const defaultDescription = ''
const defaultOGURL = ''
const defaultOGImage = ''
const Head = (props) => (
<NextHead>
<meta charset='UTF-8' />
<title>{props.title || ''}</title>
<meta name='description' content={props.description || defaultDescription} />
<meta name='viewport' content='width=device-width, initial-scale=1' />
<link rel='icon' sizes='192x192' href='/static/touch-icon.png' />
<link rel='apple-touch-icon' href='/static/touch-icon.png' />
<link rel='mask-icon' href='/static/favicon-mask.svg' color='#49B882' />
<link rel='icon' href='/static/favicon.ico' />
<meta property='og:url' content={props.url || defaultOGURL} />
<meta property='og:title' content={props.title || ''} />
<meta property='og:description' content={props.description || defaultDescription} />
<meta name='twitter:site' content={props.url || defaultOGURL} />
<meta name='twitter:card' content='summary_large_image' />
<meta name='twitter:image' content={props.ogImage || defaultOGImage} />
<meta property='og:image' content={props.ogImage || defaultOGImage} />
<meta property='og:image:width' content='1200' />
<meta property='og:image:height' content='630' />
</NextHead>
)
Head.propTypes = {
title: string,
description: string,
url: string,
ogImage: string
}
export default Head
import Link from 'next/link'
const links = [
{ href: 'https://github.com/segmentio/create-next-app', label: 'Github' }
].map(link => {
link.key = `nav-link-${link.href}-${link.label}`
return link
})
const Nav = () => (
<nav>
<ul>
<li>
<Link prefetch href='/'>
<a>Home</a>
</Link>
</li>
<ul>
{links.map(
({ key, href, label }) => (
<li key={key}>
<Link href={href}>
<a className='btn-blue'>{label}</a>
</Link>
</li>
)
)}
</ul>
</ul>
<style jsx>{`
:global(body) {
margin: 0;
font-family: -apple-system,BlinkMacSystemFont,Avenir Next,Avenir,Helvetica,sans-serif;
}
nav {
text-align: center;
}
ul {
display: flex;
justify-content: space-between;
}
nav > ul {
padding: 4px 16px;
}
li {
display: flex;
padding: 6px 8px;
}
a {
color: #067df7;
text-decoration: none;
font-size: 13px;
}
`}</style>
</nav>
)
export default Nav
{
"name": "with-tailwindcss",
"version": "1.0.0",
"scripts": {
"dev": "next & yarn dev:css",
"dev:css": "postcss styles/index.css --watch -c styles/config/postcss.config.js -o static/css/bundle.css",
"build": "next build & yarn build:css",
"build:css": "postcss styles/index.css -c styles/config/postcss.config.js -o static/css/bundle.css",
"start": "next start"
},
"dependencies": {
"next": "^4.1.3",
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"devDependencies": {
"autoprefixer": "^7.1.6",
"cssnano": "^3.10.0",
"postcss-cli": "^4.1.1",
"postcss-easy-import": "^3.0.0",
"tailwindcss": "^0.2.2"
}
}
import Document, { Head, Main, NextScript } from 'next/document'
class MyDocument extends Document {
static getInitialProps ({ renderPage }) {
const { html, head, errorHtml, chunks } = renderPage()
return { html, head, errorHtml, chunks }
}
render () {
return (
<html>
<Head>
<link rel='stylesheet' href='/static/css/bundle.css' />
</Head>
<body>
{this.props.customValue}
<Main />
<NextScript />
</body>
</html>
)
}
}
export default MyDocument
import Head from '../components/head'
import Nav from '../components/nav'
export default () => (
<div>
<Head title='Home' />
<Nav />
<div className='hero'>
<h1 className='title'>Next.js + Tailwind css</h1>
</div>
</div>
)
.btn-blue {
@apply .bg-blue .text-white .font-bold .py-2 .px-4 .rounded;
}
var tailwindcss = require('tailwindcss')
module.exports = {
plugins: [
require('postcss-easy-import'),
tailwindcss('./styles/config/tailwind.config.js'),
require('autoprefixer'),
require('cssnano')
]
}
/*
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. Don't be intimidated by the
length of this file. It's really just a big JavaScript object and
we've done our very best to explain each section.
View the full documentation at https://tailwindcss.com.
|-------------------------------------------------------------------------------
| The default config
|-------------------------------------------------------------------------------
|
| This variable contains the default Tailwind config. You don't have
| to use it, but it can sometimes be helpful to have available. For
| example, you may choose to merge your custom configuration
| values with some of the Tailwind defaults.
|
*/
// var defaultConfig = require('tailwindcss/defaultConfig')()
/*
|-------------------------------------------------------------------------------
| Colors https://tailwindcss.com/docs/colors
|-------------------------------------------------------------------------------
|
| Here you can specify the colors used in your project. To get you started,
| we've provided a generous palette of great looking colors that are perfect
| for prototyping, but don't hesitate to change them for your project. You
| own these colors, nothing will break if you change everything about them.
|
| We've used literal color names ("red", "blue", etc.) for the default
| palette, but if you'd rather use functional names like "primary" and
| "secondary", or even a numeric scale like "100" and "200", go for it.
|
*/
var colors = {
'transparent': 'transparent',
'black': '#222b2f',
'grey-darkest': '#364349',
'grey-darker': '#596a73',
'grey-dark': '#70818a',
'grey': '#9babb4',
'grey-light': '#dae4e9',
'grey-lighter': '#f3f7f9',
'grey-lightest': '#fafcfc',
'white': '#ffffff',
'red-darkest': '#420806',
'red-darker': '#6a1b19',
'red-dark': '#cc1f1a',
'red': '#e3342f',
'red-light': '#ef5753',
'red-lighter': '#f9acaa',
'red-lightest': '#fcebea',
'orange-darkest': '#542605',
'orange-darker': '#7f4012',
'orange-dark': '#de751f',
'orange': '#f6993f',
'orange-light': '#faad63',
'orange-lighter': '#fcd9b6',
'orange-lightest': '#fff5eb',
'yellow-darkest': '#453411',
'yellow-darker': '#684f1d',
'yellow-dark': '#f2d024',
'yellow': '#ffed4a',
'yellow-light': '#fff382',
'yellow-lighter': '#fff9c2',
'yellow-lightest': '#fcfbeb',
'green-darkest': '#032d19',
'green-darker': '#0b4228',
'green-dark': '#1f9d55',
'green': '#38c172',
'green-light': '#51d88a',
'green-lighter': '#a2f5bf',
'green-lightest': '#e3fcec',
'teal-darkest': '#0d3331',
'teal-darker': '#174e4b',
'teal-dark': '#38a89d',
'teal': '#4dc0b5',
'teal-light': '#64d5ca',
'teal-lighter': '#a0f0ed',
'teal-lightest': '#e8fffe',
'blue-darkest': '#05233b',
'blue-darker': '#103d60',
'blue-dark': '#2779bd',
'blue': '#3490dc',
'blue-light': '#6cb2eb',
'blue-lighter': '#bcdefa',
'blue-lightest': '#eff8ff',
'indigo-darkest': '#191e38',
'indigo-darker': '#2f365f',
'indigo-dark': '#5661b3',
'indigo': '#6574cd',
'indigo-light': '#7886d7',
'indigo-lighter': '#b2b7ff',
'indigo-lightest': '#e6e8ff',
'purple-darkest': '#1f133f',
'purple-darker': '#352465',
'purple-dark': '#794acf',
'purple': '#9561e2',
'purple-light': '#a779e9',
'purple-lighter': '#d6bbfc',
'purple-lightest': '#f3ebff',
'pink-darkest': '#45051e',
'pink-darker': '#72173a',
'pink-dark': '#eb5286',
'pink': '#f66d9b',
'pink-light': '#fa7ea8',
'pink-lighter': '#ffbbca',
'pink-lightest': '#ffebef'
}
module.exports = {
/*
|-----------------------------------------------------------------------------
| Colors https://tailwindcss.com/docs/colors
|-----------------------------------------------------------------------------
|
| The color palette defined above is also assigned to the "colors" key of
| your Tailwind config. This makes it easy to access them in your CSS
| using Tailwind's config helper. For example:
|
| .error { color: config('colors.red') }
|
*/
colors: colors,
/*
|-----------------------------------------------------------------------------
| Screens https://tailwindcss.com/docs/responsive-design
|-----------------------------------------------------------------------------
|
| Screens in Tailwind are translated to CSS media queries. They define the
| responsive breakpoints for your project. By default Tailwind takes a
| "mobile first" approach, where each screen size represents a minimum
| viewport width. Feel free to have as few or as many screens as you
| want, naming them in whatever way you'd prefer for your project.
|
| Tailwind also allows for more complex screen definitions, which can be
| useful in certain situations. Be sure to see the full responsive
| documentation for a complete list of options.
|
| Class name: .{screen}:{utility}
|
*/
screens: {
'sm': '576px',
'md': '768px',
'lg': '992px',
'xl': '1200px'
},
/*
|-----------------------------------------------------------------------------
| Fonts https://tailwindcss.com/docs/fonts
|-----------------------------------------------------------------------------
|
| Here is where you define your project's font stack, or font families.
| Keep in mind that Tailwind doesn't actually load any fonts for you.
| If you're using custom fonts you'll need to import them prior to
| defining them here.
|
| By default we provide a native font stack that works remarkably well on
| any device or OS you're using, since it just uses the default fonts
| provided by the platform.
|
| Class name: .font-{name}
|
*/
fonts: {
'sans': [
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI',
'Roboto',
'Oxygen',
'Ubuntu',
'Cantarell',
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
'sans-serif'
],
'serif': [
'Constantia',
'Lucida Bright',
'Lucidabright',
'Lucida Serif',
'Lucida',
'DejaVu Serif',
'Bitstream Vera Serif',
'Liberation Serif',
'Georgia',
'serif'
],
'mono': [
'Menlo',
'Monaco',
'Consolas',
'Liberation Mono',
'Courier New',
'monospace'
]
},
/*
|-----------------------------------------------------------------------------
| Text sizes https://tailwindcss.com/docs/text-sizing
|-----------------------------------------------------------------------------
|
| Here is where you define your text sizes. Name these in whatever way
| makes the most sense to you. We use size names by default, but
| you're welcome to use a numeric scale or even something else
| entirely.
|
| By default Tailwind uses the "rem" unit type for most measurements.
| This allows you to set a root font size which all other sizes are
| then based on. That said, you are free to use whatever units you
| prefer, be it rems, ems, pixels or other.
|
| Class name: .text-{size}
|
*/
textSizes: {
'xs': '.75rem', // 12px
'sm': '.875rem', // 14px
'base': '1rem', // 16px
'lg': '1.125rem', // 18px
'xl': '1.25rem', // 20px
'2xl': '1.5rem', // 24px
'3xl': '1.875rem', // 30px
'4xl': '2.25rem', // 36px
'5xl': '3rem' // 48px
},
/*
|-----------------------------------------------------------------------------
| Font weights https://tailwindcss.com/docs/font-weight
|-----------------------------------------------------------------------------
|
| Here is where you define your font weights. We've provided a list of
| common font weight names with their respective numeric scale values
| to get you started. It's unlikely that your project will require
| all of these, so we recommend removing those you don't need.
|
| Class name: .font-{weight}
|
*/
fontWeights: {
'hairline': 100,
'thin': 200,
'light': 300,
'normal': 400,
'medium': 500,
'semibold': 600,
'bold': 700,
'extrabold': 800,
'black': 900
},
/*
|-----------------------------------------------------------------------------
| Leading (line height) https://tailwindcss.com/docs/line-height
|-----------------------------------------------------------------------------
|
| Here is where you define your line height values, or as we call
| them in Tailwind, leadings.
|
| Class name: .leading-{size}
|
*/
leading: {
'none': 1,
'tight': 1.25,
'normal': 1.5,
'loose': 2
},
/*
|-----------------------------------------------------------------------------
| Tracking (letter spacing) https://tailwindcss.com/docs/letter-spacing
|-----------------------------------------------------------------------------
|
| Here is where you define your letter spacing values, or as we call
| them in Tailwind, tracking.
|
| Class name: .tracking-{size}
|
*/
tracking: {
'tight': '-0.05em',
'normal': '0',
'wide': '0.05em'
},
/*
|-----------------------------------------------------------------------------
| Text colors https://tailwindcss.com/docs/text-color
|-----------------------------------------------------------------------------
|
| Here is where you define your text colors. By default these use the
| color palette we defined above, however you're welcome to set these
| independently if that makes sense for your project.
|
| Class name: .text-{color}
|
*/
textColors: colors,
/*
|-----------------------------------------------------------------------------
| Background colors https://tailwindcss.com/docs/background-color
|-----------------------------------------------------------------------------
|
| Here is where you define your background colors. By default these use
| the color palette we defined above, however you're welcome to set
| these independently if that makes sense for your project.
|
| Class name: .bg-{color}
|
*/
backgroundColors: colors,
/*
|-----------------------------------------------------------------------------
| Border widths https://tailwindcss.com/docs/border-width
|-----------------------------------------------------------------------------
|
| Here is where you define your border widths. Take note that border
| widths require a special "default" value set as well. This is the
| width that will be used when you do not specify a border width.
|
| Class name: .border{-side?}{-width?}
|
*/
borderWidths: {
default: '1px',
'0': '0',
'2': '2px',
'4': '4px',
'8': '8px'
},
/*
|-----------------------------------------------------------------------------
| Border colors https://tailwindcss.com/docs/border-color
|-----------------------------------------------------------------------------
|
| Here is where you define your border colors. By default these use the
| color palette we defined above, however you're welcome to set these
| independently if that makes sense for your project.
|
| Take note that border colors require a special "default" value set
| as well. This is the color that will be used when you do not
| specify a border color.
|
| Class name: .border-{color}
|
*/
borderColors: Object.assign({ default: colors['grey-light'] }, colors),
/*
|-----------------------------------------------------------------------------
| Border radius https://tailwindcss.com/docs/border-radius
|-----------------------------------------------------------------------------
|
| Here is where you define your border radius values. If a `default` radius
| is provided, it will be made available as the non-suffixed `.rounded`
| utility.
|
| If your scale includes a `0` value to reset already rounded corners, it's
| a good idea to put it first so other values are able to override it.
|
| Class name: .rounded{-side?}{-size?}
|
*/
borderRadius: {
'none': '0',
'sm': '.125rem',
default: '.25rem',
'lg': '.5rem',
'full': '9999px'
},
/*
|-----------------------------------------------------------------------------
| Width https://tailwindcss.com/docs/width
|-----------------------------------------------------------------------------
|
| Here is where you define your width utility sizes. These can be
| percentage based, pixels, rems, or any other units. By default
| we provide a sensible rem based numeric scale, a percentage
| based fraction scale, plus some other common use-cases. You
| can, of course, modify these values as needed.
|
|
| It's also worth mentioning that Tailwind automatically escapes
| invalid CSS class name characters, which allows you to have
| awesome classes like .w-2/3.
|
| Class name: .w-{size}
|
*/
width: {
'auto': 'auto',
'px': '1px',
'1': '0.25rem',
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'6': '1.5rem',
'8': '2rem',
'10': '2.5rem',
'12': '3rem',
'16': '4rem',
'24': '6rem',
'32': '8rem',
'48': '12rem',
'64': '16rem',
'1/2': '50%',
'1/3': '33.33333%',
'2/3': '66.66667%',
'1/4': '25%',
'3/4': '75%',
'1/5': '20%',
'2/5': '40%',
'3/5': '60%',
'4/5': '80%',
'1/6': '16.66667%',
'5/6': '83.33333%',
'full': '100%',
'screen': '100vw'
},
/*
|-----------------------------------------------------------------------------
| Height https://tailwindcss.com/docs/height
|-----------------------------------------------------------------------------
|
| Here is where you define your height utility sizes. These can be
| percentage based, pixels, rems, or any other units. By default
| we provide a sensible rem based numeric scale plus some other
| common use-cases. You can, of course, modify these values as
| needed.
|
| Class name: .h-{size}
|
*/
height: {
'auto': 'auto',
'px': '1px',
'1': '0.25rem',
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'6': '1.5rem',
'8': '2rem',
'10': '2.5rem',
'12': '3rem',
'16': '4rem',
'24': '6rem',
'32': '8rem',
'48': '12rem',
'64': '16rem',
'full': '100%',
'screen': '100vh'
},
/*
|-----------------------------------------------------------------------------
| Minimum width https://tailwindcss.com/docs/min-width
|-----------------------------------------------------------------------------
|
| Here is where you define your minimum width utility sizes. These can
| be percentage based, pixels, rems, or any other units. We provide a
| couple common use-cases by default. You can, of course, modify
| these values as needed.
|
| Class name: .min-w-{size}
|
*/
minWidth: {
'0': '0',
'full': '100%'
},
/*
|-----------------------------------------------------------------------------
| Minimum height https://tailwindcss.com/docs/min-height
|-----------------------------------------------------------------------------
|
| Here is where you define your minimum height utility sizes. These can
| be percentage based, pixels, rems, or any other units. We provide a
| few common use-cases by default. You can, of course, modify these
| values as needed.
|
| Class name: .min-h-{size}
|
*/
minHeight: {
'0': '0',
'full': '100%',
'screen': '100vh'
},
/*
|-----------------------------------------------------------------------------
| Maximum width https://tailwindcss.com/docs/max-width
|-----------------------------------------------------------------------------
|
| Here is where you define your maximum width utility sizes. These can
| be percentage based, pixels, rems, or any other units. By default
| we provide a sensible rem based scale and a "full width" size,
| which is basically a reset utility. You can, of course,
| modify these values as needed.
|
| Class name: .max-w-{size}
|
*/
maxWidth: {
'xs': '20rem',
'sm': '30rem',
'md': '40rem',
'lg': '50rem',
'xl': '60rem',
'2xl': '70rem',
'3xl': '80rem',
'4xl': '90rem',
'5xl': '100rem',
'full': '100%'
},
/*
|-----------------------------------------------------------------------------
| Maximum height https://tailwindcss.com/docs/max-height
|-----------------------------------------------------------------------------
|
| Here is where you define your maximum height utility sizes. These can
| be percentage based, pixels, rems, or any other units. We provide a
| couple common use-cases by default. You can, of course, modify
| these values as needed.
|
| Class name: .max-h-{size}
|
*/
maxHeight: {
'full': '100%',
'screen': '100vh'
},
/*
|-----------------------------------------------------------------------------
| Padding https://tailwindcss.com/docs/padding
|-----------------------------------------------------------------------------
|
| Here is where you define your padding utility sizes. These can be
| percentage based, pixels, rems, or any other units. By default we
| provide a sensible rem based numeric scale plus a couple other
| common use-cases like "1px". You can, of course, modify these
| values as needed.
|
| Class name: .p{side?}-{size}
|
*/
padding: {
'px': '1px',
'0': '0',
'1': '0.25rem',
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'6': '1.5rem',
'8': '2rem'
},
/*
|-----------------------------------------------------------------------------
| Margin https://tailwindcss.com/docs/margin
|-----------------------------------------------------------------------------
|
| Here is where you define your margin utility sizes. These can be
| percentage based, pixels, rems, or any other units. By default we
| provide a sensible rem based numeric scale plus a couple other
| common use-cases like "1px". You can, of course, modify these
| values as needed.
|
| Class name: .m{side?}-{size}
|
*/
margin: {
'auto': 'auto',
'px': '1px',
'0': '0',
'1': '0.25rem',
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'6': '1.5rem',
'8': '2rem'
},
/*
|-----------------------------------------------------------------------------
| Negative margin https://tailwindcss.com/docs/negative-margin
|-----------------------------------------------------------------------------
|
| Here is where you define your negative margin utility sizes. These can
| be percentage based, pixels, rems, or any other units. By default we
| provide matching values to the padding scale since these utilities
| generally get used together. You can, of course, modify these
| values as needed.
|
| Class name: .-m{side?}-{size}
|
*/
negativeMargin: {
'px': '1px',
'0': '0',
'1': '0.25rem',
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'6': '1.5rem',
'8': '2rem'
},
/*
|-----------------------------------------------------------------------------
| Shadows https://tailwindcss.com/docs/shadows
|-----------------------------------------------------------------------------
|
| Here is where you define your shadow utilities. As you can see from
| the defaults we provide, it's possible to apply multiple shadows
| per utility using comma separation.
|
| If a `default` shadow is provided, it will be made available as the non-
| suffixed `.shadow` utility.
|
| Class name: .shadow-{size?}
|
*/
shadows: {
default: '0 2px 4px 0 rgba(0,0,0,0.10)',
'md': '0 4px 8px 0 rgba(0,0,0,0.12), 0 2px 4px 0 rgba(0,0,0,0.08)',
'lg': '0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08)',
'inner': 'inset 0 2px 4px 0 rgba(0,0,0,0.06)',
'none': 'none'
},
/*
|-----------------------------------------------------------------------------
| Z-index https://tailwindcss.com/docs/z-index
|-----------------------------------------------------------------------------
|
| Here is where you define your z-index utility values. By default we
| provide a sensible numeric scale. You can, of course, modify these
| values as needed.
|
| Class name: .z-{index}
|
*/
zIndex: {
'auto': 'auto',
'0': 0,
'10': 10,
'20': 20,
'30': 30,
'40': 40,
'50': 50
},
/*
|-----------------------------------------------------------------------------
| Opacity https://tailwindcss.com/docs/opacity
|-----------------------------------------------------------------------------
|
| Here is where you define your opacity utility values. By default we
| provide a sensible numeric scale. You can, of course, modify these
| values as needed.
|
| Class name: .opacity-{name}
|
*/
opacity: {
'0': '0',
'25': '.25',
'50': '.5',
'75': '.75',
'100': '1'
},
/*
|-----------------------------------------------------------------------------
| Options https://tailwindcss.com/docs/configuration#options
|-----------------------------------------------------------------------------
|
| Here is where you can set your Tailwind configuration options. For more
| details about these options, visit the configuration options documentation.
|
*/
options: {
prefix: '',
important: false
}
}
@import "./button.css";
@tailwind preflight;
@tailwind utilities;
.hero {
width: 100%;
color: #333;
}
.title {
margin: 0;
width: 100%;
padding-top: 80px;
line-height: 1.15;
font-size: 48px;
}
.title, .description {
text-align: center;
}
.row {
max-width: 880px;
margin: 80px auto 40px;
display: flex;
flex-direction: row;
justify-content: space-around;
}
.card {
padding: 18px 18px 24px;
width: 220px;
text-align: left;
text-decoration: none;
color: #434343;
border: 1px solid #9B9B9B;
}
.card:hover {
border-color: #067df7;
}
.card h3 {
margin: 0;
color: #067df7;
font-size: 18px;
}
.card p {
margin: 0;
padding: 12px 0 0;
font-size: 13px;
color: #333;
}
......@@ -4,8 +4,28 @@
This is a really simple project that show the usage of Next.js with TypeScript.
## How to use it?
## How to use it?
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-typescript with-typescript-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-typescript
cd with-typescript
```
Install it and run:
```
npm install
npm run dev
......
export default ('undefined' !== typeof window ? window.__ENV__ : process.env)
{
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"htmlescape": "1.1.1",
"next": "4.1.4",
"react": "16.2.0",
"react-dom": "16.2.0"
}
}
import Document_, { Head, Main, NextScript } from 'next/document'
import htmlescape from 'htmlescape'
const { API_URL } = process.env
const env = { API_URL }
export default class Document extends Document_ {
static async getInitialProps (ctx) {
const props = await Document_.getInitialProps(ctx)
return props
}
render () {
return (
<html>
<Head />
<body>
<Main />
<script
dangerouslySetInnerHTML={{ __html: '__ENV__ = ' + htmlescape(env) }}
/>
<NextScript />
</body>
</html>
)
}
}
import React from 'react'
import env from '../lib/env'
const {API_URL} = env
export default class extends React.Component {
static async getInitialProps () {
// fetch(`${API_URL}/some-path`)
return {}
}
render () {
return <div>
The API_URL is {API_URL}
</div>
}
}
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-universal-configuration)
# With universal runtime configuration
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-universal-configuration-runtime with-universal-configuration-runtime-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-universal-configuration-runtime
cd with-universal-configuration-runtime
```
Install it and run:
```bash
npm install
API_URL='https://example.com' npm run 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 show how to set custom environment variables for your application at runtime
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-universal-configuration with-universal-configuration-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -3,6 +3,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-url-object-routing with-url-object-routing-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-webpack-bundle-analyzer with-webpack-bundle-analyzer-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -4,6 +4,17 @@
## How to use
### Using `create-next-app`
Download [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:
```
npm i -g create-next-app
create-next-app --example with-webpack-bundle-size-analyzer with-webpack-bundle-size-analyzer-app
```
### Download manually
Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
......
......@@ -40,9 +40,7 @@ export default class App extends Component {
}
const containerProps = { Component, props, hash, router, url }
return <div>
<Container {...containerProps} />
</div>
return <Container {...containerProps} />
}
}
......
......@@ -48,11 +48,16 @@ const METATYPES = ['name', 'httpEquiv', 'charSet', 'itemProp', 'property']
// which shouldn't be duplicated, like <title/>.
function unique () {
const keys = new Set()
const tags = new Set()
const metaTypes = new Set()
const metaCategories = {}
return (h) => {
if (h.key) {
if (keys.has(h.key)) return false
keys.add(h.key)
}
switch (h.type) {
case 'title':
case 'base':
......
......@@ -69,13 +69,14 @@ export default class PageLoader {
loadScript (route) {
route = this.normalizeRoute(route)
let scriptRoute = route
if (__NEXT_DATA__.nextExport) {
route = route === '/' ? '/index.js' : `${route}/index.js`
scriptRoute = route === '/' ? '/index.js' : `${route}/index.js`
}
const script = document.createElement('script')
const url = `${this.assetPrefix}/_next/${encodeURIComponent(this.buildId)}/page${route}`
const url = `${this.assetPrefix}/_next/${encodeURIComponent(this.buildId)}/page${scriptRoute}`
script.src = url
script.type = 'text/javascript'
script.onerror = () => {
......
......@@ -30,8 +30,9 @@
"pretestonly": "taskr pretest",
"testonly": "cross-env NODE_PATH=test/lib jest \\.test.js",
"posttestonly": "taskr posttest",
"testall": "npm run testonly -- --coverage --forceExit --runInBand --verbose --bail",
"pretest": "npm run lint",
"test": "npm run testonly -- --coverage --forceExit --runInBand --verbose --bail",
"test": "cross-env npm run testall || npm run testall",
"coveralls": "nyc --instrument=false --source-map=false report --temp-directory=./coverage --reporter=text-lcov | coveralls",
"lint": "standard 'bin/*' 'client/**/*.js' 'examples/**/*.js' 'lib/**/*.js' 'pages/**/*.js' 'server/**/*.js' 'test/**/*.js'",
"prepublish": "npm run release",
......@@ -94,7 +95,7 @@
"send": "0.16.1",
"source-map-support": "0.4.18",
"strip-ansi": "4.0.0",
"styled-jsx": "2.1.1",
"styled-jsx": "2.2.1",
"touch": "3.1.0",
"unfetch": "3.0.0",
"url": "0.11.0",
......@@ -135,6 +136,7 @@
"react-dom": "16.0.0",
"standard": "9.0.2",
"taskr": "1.1.0",
"uglifyjs-webpack-plugin": "^1.1.1",
"wd": "1.4.1"
},
"peerDependencies": {
......
......@@ -162,7 +162,7 @@ It's possible to use any existing CSS-in-JS solution. The simplest one is inline
export default () => <p style={{ color: 'red' }}>hi there</p>
```
To use more sophisticated CSS-in-JS solutions, you typically have to implement style flushing for server-side rendering. We enable this by allowing you to define your own [custom `<Document>`](#user-content-custom-document) component that wraps each page
To use more sophisticated CSS-in-JS solutions, you typically have to implement style flushing for server-side rendering. We enable this by allowing you to define your own [custom `<Document>`](#user-content-custom-document) component that wraps each page.
### Static file serving (e.g.: images)
......@@ -197,6 +197,26 @@ export default () =>
</div>
```
To avoid duplicate tags in your `<head>` you can use the `key` property, which will make sure the tag is only rendered once:
```jsx
import Head from 'next/head'
export default () => (
<div>
<Head>
<title>My page title</title>
<meta name="viewport" content="initial-scale=1.0, width=device-width" key="viewport" />
</Head>
<Head>
<meta name="viewport" content="initial-scale=1.2, width=device-width" key="viewport" />
</Head>
<p>Hello world!</p>
</div>
)
```
In this case only the second `<meta name="viewport" />` is rendered.
_Note: The contents of `<head>` get cleared upon unmounting the component, so make sure each page completely defines what it needs in `<head>`, without making assumptions about what other pages added_
### Fetching data and component lifecycle
......@@ -383,6 +403,8 @@ export default () =>
If child is an `<a>` tag and doesn't have a href attribute we specify it so that the repetition is not needed by the user. However, sometimes, you’ll want to pass an `<a>` tag inside of a wrapper and the `Link` won’t recognize it as a *hyperlink*, and, consequently, won’t transfer its `href` to the child. In cases like that, you should define a boolean `passHref` property to the `Link`, forcing it to expose its `href` property to the child.
**Please note**: using a tag other than `a` and failing to pass `passHref` may result in links that appear to navigate correctly, but, when being crawled by search engines, will not be recognized as links (owing to the lack of `href` attribute). This may result in negative effects on your sites SEO.
```jsx
import Link from 'next/link'
import Unexpected_A from 'third-library'
......@@ -454,15 +476,15 @@ This uses of the same exact parameters as in the `<Link>` component.
You can also listen to different events happening inside the Router.
Here's a list of supported events:
- `routeChangeStart(url)` - Fires when a route starts to change
- `routeChangeComplete(url)` - Fires when a route changed completely
- `routeChangeError(err, url)` - Fires when there's an error when changing routes
- `beforeHistoryChange(url)` - Fires just before changing the browser's history
- `appUpdated(nextRoute)` - Fires when switching pages and there's a new version of the app
- `onRouteChangeStart(url)` - Fires when a route starts to change
- `onRouteChangeComplete(url)` - Fires when a route changed completely
- `onRouteChangeError(err, url)` - Fires when there's an error when changing routes
- `onBeforeHistoryChange(url)` - Fires just before changing the browser's history
- `onAppUpdated(nextRoute)` - Fires when switching pages and there's a new version of the app
> Here `url` is the URL shown in the browser. If you call `Router.push(url, as)` (or similar), then the value of `url` will be `as`.
Here's how to properly listen to the router event `routeChangeStart`:
Here's how to properly listen to the router event `onRouteChangeStart`:
```js
Router.onRouteChangeStart = url => {
......@@ -649,7 +671,19 @@ export default ({ url }) =>
</ul>
</details></p>
Typically you start your next server with `next start`. It's possible, however, to start a server 100% programmatically in order to customize routes, use route patterns, etc
Typically you start your next server with `next start`. It's possible, however, to start a server 100% programmatically in order to customize routes, use route patterns, etc.
When using a custom server with a server file, for example called `server.js`, make sure you update the scripts key in `package.json` to:
```json
{
"scripts": {
"dev": "node server.js",
"build": "next build",
"start": "NODE_ENV=production node server.js"
}
}
```
This example makes `/a` resolve to `./pages/b`, and `/b` resolve to `./pages/a`:
......@@ -698,6 +732,21 @@ Supported options:
Then, change your `start` script to `NODE_ENV=production node server.js`.
#### Disabling file-system routing
By default, `Next` will serve each file in `/pages` under a pathname matching the filename (eg, `/pages/some-file.js` is served at `site.com/some-file`.
If your project uses custom routing, this behavior may result in the same content being served from multiple paths, which can present problems with SEO and UX.
To disable this behavior & prevent routing based on files in `/pages`, simply set the following option in your `next.config.js`:
```js
// next.config.js
module.exports = {
useFileSystemPublicRoutes: false
}
```
### Dynamic Import
<p><details>
......@@ -873,7 +922,7 @@ If you want to render the built-in error page you can by using `next/error`:
```jsx
import React from 'react'
import Error from 'next/error'
import fetch from 'isomorphic-fetch'
import fetch from 'isomorphic-unfetch'
export default class Page extends React.Component {
static async getInitialProps() {
......
const babelRuntimePath = require.resolve('babel-runtime/package').replace(/[\\/]package\.json$/, '')
const relativeResolve = require('../root-module-relative-path').default(require)
// Resolve styled-jsx plugins
......@@ -56,7 +57,7 @@ module.exports = (context, opts = {}) => ({
require.resolve('babel-plugin-module-resolver'),
{
alias: {
'babel-runtime': relativeResolve('babel-runtime/package'),
'babel-runtime': babelRuntimePath,
'next/link': relativeResolve('../../../lib/link'),
'next/prefetch': relativeResolve('../../../lib/prefetch'),
'next/css': relativeResolve('../../../lib/css'),
......
......@@ -9,7 +9,16 @@ import md5File from 'md5-file/promise'
export default async function build (dir, conf = null) {
const buildId = uuid.v4()
const buildDir = join(tmpdir(), uuid.v4())
const tempDir = tmpdir()
const buildDir = join(tempDir, uuid.v4())
try {
await fs.access(tempDir, fs.constants.W_OK)
} catch (err) {
console.error(`> Failed, build directory is not writeable. https://err.sh/zeit/next.js/build-dir-not-writeable`)
throw err
}
const compiler = await webpack(dir, { buildId, buildDir, conf })
try {
......
import { ConcatSource } from 'webpack-sources'
// This plugin combines a set of assets into a single asset
// This should be only used with text assets,
// otherwise the result is unpredictable.
......@@ -8,23 +10,28 @@ export default class CombineAssetsPlugin {
}
apply (compiler) {
compiler.plugin('after-compile', (compilation, callback) => {
let newSource = ''
this.input.forEach((name) => {
const asset = compilation.assets[name]
if (!asset) return
compiler.plugin('compilation', (compilation) => {
compilation.plugin('additional-chunk-assets', (chunks) => {
const concat = new ConcatSource()
newSource += `${asset.source()}\n`
this.input.forEach((name) => {
const asset = compilation.assets[name]
if (!asset) return
// We keep existing assets since that helps when analyzing the bundle
})
concat.add(asset)
compilation.assets[this.output] = {
source: () => newSource,
size: () => newSource.length
}
// We keep existing assets since that helps when analyzing the bundle
})
callback()
compilation.additionalChunkAssets.push(this.output)
compilation.assets[this.output] = concat
// Register the combined file as an output of the associated chunks
chunks.filter((chunk) => {
return chunk.files.reduce((prev, file) => prev || this.input.includes(file), false)
})
.forEach((chunk) => chunk.files.push(this.output))
})
})
}
}
export default class PagesPlugin {
import { ConcatSource } from 'webpack-sources'
const isImportChunk = /^chunks[/\\].*\.js$/
const matchChunkName = /^chunks[/\\](.*)$/
class DynamicChunkTemplatePlugin {
apply (chunkTemplate) {
chunkTemplate.plugin('render', function (modules, chunk) {
if (!isImportChunk.test(chunk.name)) {
return modules
}
const chunkName = matchChunkName.exec(chunk.name)[1]
const source = new ConcatSource()
source.add(`
__NEXT_REGISTER_CHUNK('${chunkName}', function() {
`)
source.add(modules)
source.add(`
})
`)
return source
})
}
}
export default class DynamicChunksPlugin {
apply (compiler) {
const isImportChunk = /^chunks[/\\].*\.js$/
const matchChunkName = /^chunks[/\\](.*)$/
compiler.plugin('after-compile', (compilation, callback) => {
const chunks = Object
.keys(compilation.namedChunks)
.map(key => compilation.namedChunks[key])
.filter(chunk => isImportChunk.test(chunk.name))
chunks.forEach((chunk) => {
const asset = compilation.assets[chunk.name]
if (!asset) return
const chunkName = matchChunkName.exec(chunk.name)[1]
const content = asset.source()
const newContent = `
window.__NEXT_REGISTER_CHUNK('${chunkName}', function() {
${content}
})
`
// Replace the exisiting chunk with the new content
compilation.assets[chunk.name] = {
source: () => newContent,
size: () => newContent.length
}
// This is to support, webpack dynamic import support with HMR
compilation.assets[`chunks/${chunk.id}`] = {
source: () => newContent,
size: () => newContent.length
}
compiler.plugin('compilation', (compilation) => {
compilation.chunkTemplate.apply(new DynamicChunkTemplatePlugin())
compilation.plugin('additional-chunk-assets', (chunks) => {
chunks = chunks.filter(chunk =>
isImportChunk.test(chunk.name) && compilation.assets[chunk.name]
)
chunks.forEach((chunk) => {
// This is to support, webpack dynamic import support with HMR
const copyFilename = `chunks/${chunk.name}`
compilation.additionalChunkAssets.push(copyFilename)
compilation.assets[copyFilename] = compilation.assets[chunk.name]
})
})
callback()
})
}
}
import { ConcatSource } from 'webpack-sources'
import {
IS_BUNDLED_PAGE,
MATCH_ROUTE_NAME
} from '../../utils'
export default class PagesPlugin {
apply (compiler) {
compiler.plugin('after-compile', (compilation, callback) => {
const pages = Object
.keys(compilation.namedChunks)
.map(key => compilation.namedChunks[key])
.filter(chunk => IS_BUNDLED_PAGE.test(chunk.name))
class PageChunkTemplatePlugin {
apply (chunkTemplate) {
chunkTemplate.plugin('render', function (modules, chunk) {
if (!IS_BUNDLED_PAGE.test(chunk.name)) {
return modules
}
pages.forEach((chunk) => {
const page = compilation.assets[chunk.name]
const pageName = MATCH_ROUTE_NAME.exec(chunk.name)[1]
let routeName = pageName
let routeName = MATCH_ROUTE_NAME.exec(chunk.name)[1]
// We need to convert \ into / when we are in windows
// to get the proper route name
......@@ -22,26 +19,33 @@ export default class PagesPlugin {
// to have "\" in the filename in unix.
// Anyway if someone did that, he'll be having issues here.
// But that's something we cannot avoid.
if (/^win/.test(process.platform)) {
routeName = routeName.replace(/\\/g, '/')
}
routeName = `/${routeName.replace(/(^|\/)index$/, '')}`
const content = page.source()
const newContent = `
window.__NEXT_REGISTER_PAGE('${routeName}', function() {
var comp = ${content}
return { page: comp.default }
})
`
// Replace the exisiting chunk with the new content
compilation.assets[chunk.name] = {
source: () => newContent,
size: () => newContent.length
}
})
callback()
if (/^win/.test(process.platform)) {
routeName = routeName.replace(/\\/g, '/')
}
routeName = `/${routeName.replace(/(^|\/)index$/, '')}`
const source = new ConcatSource()
source.add(`
__NEXT_REGISTER_PAGE('${routeName}', function() {
var comp =
`)
source.add(modules)
source.add(`
return { page: comp.default }
})
`)
return source
})
}
}
export default class PagesPlugin {
apply (compiler) {
compiler.plugin('compilation', (compilation) => {
compilation.chunkTemplate.apply(new PageChunkTemplatePlugin())
})
}
}
import { resolve, join, sep } from 'path'
import { createHash } from 'crypto'
import { realpathSync } from 'fs'
import webpack from 'webpack'
import glob from 'glob-promise'
import WriteFilePlugin from 'write-file-webpack-plugin'
import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'
import CaseSensitivePathPlugin from 'case-sensitive-paths-webpack-plugin'
import UglifyJSPlugin from 'uglifyjs-webpack-plugin'
import UnlinkFilePlugin from './plugins/unlink-file-plugin'
import PagesPlugin from './plugins/pages-plugin'
import DynamicChunksPlugin from './plugins/dynamic-chunks-plugin'
......@@ -28,7 +30,7 @@ const interpolateNames = new Map(defaultPages.map((p) => {
const relativeResolve = rootModuleRelativePath(require)
export default async function createCompiler (dir, { buildId, dev = false, quiet = false, buildDir, conf = null } = {}) {
dir = resolve(dir)
dir = realpathSync(resolve(dir))
const config = getConfig(dir, conf)
const defaultEntries = dev ? [
join(__dirname, '..', '..', 'client', 'webpack-hot-middleware-client'),
......@@ -48,7 +50,7 @@ export default async function createCompiler (dir, { buildId, dev = false, quiet
]
}
const pages = await glob('pages/**/*.js', { cwd: dir })
const pages = await glob(config.pagesGlobPattern, { cwd: dir })
const devPages = pages.filter((p) => p === 'pages/_document.js' || p === 'pages/_error.js')
// In the dev environment, on-demand-entry-handler will take care of
......@@ -149,9 +151,14 @@ export default async function createCompiler (dir, { buildId, dev = false, quiet
input: ['manifest.js', 'commons.js', 'main.js'],
output: 'app.js'
}),
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false },
sourceMap: false
new UglifyJSPlugin({
parallel: true,
sourceMap: false,
uglifyOptions: {
compress: {
comparisons: false
}
}
})
)
plugins.push(new webpack.optimize.ModuleConcatenationPlugin())
......@@ -217,6 +224,8 @@ export default async function createCompiler (dir, { buildId, dev = false, quiet
return { content, sourceMap }
}
const babelRuntimePath = require.resolve('babel-runtime/package').replace(/[\\/]package\.json$/, '')
const transpiled = babelCore.transform(content, {
babelrc: false,
sourceMaps: dev ? 'both' : false,
......@@ -231,7 +240,7 @@ export default async function createCompiler (dir, { buildId, dev = false, quiet
require.resolve('babel-plugin-module-resolver'),
{
alias: {
'babel-runtime': relativeResolve('babel-runtime/package'),
'babel-runtime': babelRuntimePath,
'next/link': relativeResolve('../../lib/link'),
'next/prefetch': relativeResolve('../../lib/prefetch'),
'next/css': relativeResolve('../../lib/css'),
......
......@@ -10,7 +10,8 @@ const defaultConfig = {
distDir: '.next',
assetPrefix: '',
configOrigin: 'default',
useFileSystemPublicRoutes: true
useFileSystemPublicRoutes: true,
pagesGlobPattern: 'pages/**/*.js'
}
export default function getConfig (dir, customConfig) {
......
......@@ -3,6 +3,10 @@ import PropTypes from 'prop-types'
import htmlescape from 'htmlescape'
import flush from 'styled-jsx/server'
const Fragment = React.Fragment || function Fragment ({ children }) {
return children
}
export default class Document extends Component {
static getInitialProps ({ renderPage }) {
const { html, head, errorHtml, chunks } = renderPage()
......@@ -84,7 +88,7 @@ export class Head extends Component {
const pagePathname = getPagePathname(pathname, nextExport)
return <head {...this.props}>
{(head || []).map((h, i) => React.cloneElement(h, { key: i }))}
{(head || []).map((h, i) => React.cloneElement(h, { key: h.key || i }))}
<link rel='preload' href={`${assetPrefix}/_next/${buildId}/page${pagePathname}`} as='script' />
<link rel='preload' href={`${assetPrefix}/_next/${buildId}/page/_error/index.js`} as='script' />
{this.getPreloadDynamicChunks()}
......@@ -96,22 +100,18 @@ export class Head extends Component {
}
export class Main extends Component {
static propTypes = {
className: PropTypes.string
}
static contextTypes = {
_documentProps: PropTypes.any
}
render () {
const { html, errorHtml } = this.context._documentProps
const { className } = this.props
return (
<div className={className}>
<Fragment>
<div id='__next' dangerouslySetInnerHTML={{ __html: html }} />
<div id='__next-error' dangerouslySetInnerHTML={{ __html: errorHtml }} />
</div>
</Fragment>
)
}
}
......@@ -159,7 +159,7 @@ export class NextScript extends Component {
const { chunks, __NEXT_DATA__ } = this.context._documentProps
let { assetPrefix, buildId } = __NEXT_DATA__
return (
<div>
<Fragment>
{chunks.map((chunk) => (
<script
async
......@@ -168,7 +168,7 @@ export class NextScript extends Component {
src={`${assetPrefix}/_next/${buildId}/webpack/chunks/${chunk}`}
/>
))}
</div>
</Fragment>
)
}
......@@ -179,7 +179,7 @@ export class NextScript extends Component {
__NEXT_DATA__.chunks = chunks
return <div>
return <Fragment>
{staticMarkup ? null : <script nonce={this.props.nonce} dangerouslySetInnerHTML={{
__html: `
__NEXT_DATA__ = ${htmlescape(__NEXT_DATA__)}
......@@ -200,7 +200,7 @@ export class NextScript extends Component {
<script async id={`__NEXT_PAGE__/_error`} type='text/javascript' src={`${assetPrefix}/_next/${buildId}/page/_error/index.js`} />
{staticMarkup ? null : this.getDynamicChunks()}
{staticMarkup ? null : this.getScripts()}
</div>
</Fragment>
}
}
......
......@@ -398,12 +398,16 @@ export default class Server {
}
handleBuildId (buildId, res) {
if (this.dev) return true
if (this.dev) {
res.setHeader('Cache-Control', 'no-store, must-revalidate')
return true
}
if (buildId !== this.renderOpts.buildId) {
return false
}
res.setHeader('Cache-Control', 'max-age=365000000, immutable')
res.setHeader('Cache-Control', 'max-age=31536000, immutable')
return true
}
......@@ -418,13 +422,17 @@ export default class Server {
}
handleBuildHash (filename, hash, res) {
if (this.dev) return
if (this.dev) {
res.setHeader('Cache-Control', 'no-store, must-revalidate')
return true
}
if (hash !== this.buildStats[filename].hash) {
throw new Error(`Invalid Build File Hash(${hash}) for chunk: ${filename}`)
}
res.setHeader('Cache-Control', 'max-age=365000000, immutable')
res.setHeader('Cache-Control', 'max-age=31536000, immutable')
return true
}
send404 (res) {
......
......@@ -96,11 +96,6 @@ async function doRender (req, res, pathname, query, {
}
const docProps = await loadGetInitialProps(Document, { ...ctx, renderPage })
// While developing, we should not cache any assets.
// So, we use a different buildId for each page load.
// With that we can ensure, we have unique URL for assets per every page load.
// So, it'll prevent issues like this: https://git.io/vHLtb
const devBuildId = Date.now()
if (res.finished) return
......@@ -110,7 +105,7 @@ async function doRender (req, res, pathname, query, {
props,
pathname,
query,
buildId: dev ? devBuildId : buildId,
buildId,
buildStats,
assetPrefix,
nextExport,
......@@ -190,7 +185,9 @@ export function sendHTML (req, res, html, method, { dev }) {
}
res.setHeader('ETag', etag)
res.setHeader('Content-Type', 'text/html')
if (!res.getHeader('Content-Type')) {
res.setHeader('Content-Type', 'text/html')
}
res.setHeader('Content-Length', Buffer.byteLength(html))
res.end(method === 'HEAD' ? null : html)
}
......
import React from 'react'
export default class extends React.Component {
static async getInitialProps ({res}) {
if (res) {
res.setHeader('Content-Type', 'text/html; charset=utf-8')
}
return {}
}
render () {
return null
}
}
......@@ -3,8 +3,20 @@ import Head from 'next/head'
export default () => <div>
<Head>
{/* this will not render */}
<meta charSet='utf-8' />
{/* this will get rendered */}
<meta charSet='iso-8859-5' />
<meta content='my meta' />
{/* the following 2 links tag will be rendered both */}
<link rel='stylesheet' href='/dup-style.css' />
<link rel='stylesheet' href='/dup-style.css' />
{/* only one tag will be rendered as they have the same key */}
<link rel='stylesheet' href='dedupe-style.css' key='my-style' />
<link rel='stylesheet' href='dedupe-style.css' key='my-style' />
</Head>
<h1>I can haz meta tags</h1>
</div>
......@@ -3,6 +3,7 @@
import { join } from 'path'
import {
renderViaHTTP,
fetchViaHTTP,
findPort,
launchApp,
killApp
......@@ -15,7 +16,7 @@ import hmr from './hmr'
import dynamic from './dynamic'
const context = {}
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
describe('Basic Features', () => {
beforeAll(async () => {
......@@ -55,7 +56,7 @@ describe('Basic Features', () => {
})
afterAll(() => killApp(context.server))
rendering(context, 'Rendering via HTTP', (p, q) => renderViaHTTP(context.appPort, p, q))
rendering(context, 'Rendering via HTTP', (p, q) => renderViaHTTP(context.appPort, p, q), (p, q) => fetchViaHTTP(context.appPort, p, q))
clientNavigation(context, (p, q) => renderViaHTTP(context.appPort, p, q))
dynamic(context, (p, q) => renderViaHTTP(context.appPort, p, q))
hmr(context, (p, q) => renderViaHTTP(context.appPort, p, q))
......
......@@ -2,7 +2,7 @@
import cheerio from 'cheerio'
export default function ({ app }, suiteName, render) {
export default function ({ app }, suiteName, render, fetch) {
async function get$ (path, query) {
const html = await render(path, query)
return cheerio.load(html)
......@@ -28,6 +28,16 @@ export default function ({ app }, suiteName, render) {
expect(html.includes('I can haz meta tags')).toBeTruthy()
})
test('header helper dedupes tags', async () => {
const html = await (render('/head'))
expect(html).toContain('<meta charSet="iso-8859-5" class="next-head"/>')
expect(html).not.toContain('<meta charSet="utf-8" class="next-head"/>')
expect(html).toContain('<meta content="my meta" class="next-head"/>')
expect(html).toContain('<link rel="stylesheet" href="/dup-style.css" class="next-head"/><link rel="stylesheet" href="/dup-style.css" class="next-head"/>')
expect(html).toContain('<link rel="stylesheet" href="dedupe-style.css" class="next-head"/>')
expect(html).not.toContain('<link rel="stylesheet" href="dedupe-style.css" class="next-head"/><link rel="stylesheet" href="dedupe-style.css" class="next-head"/>')
})
test('renders styled jsx', async () => {
const $ = await get$('/styled-jsx')
const styleId = $('#blue-box').attr('class')
......@@ -53,6 +63,16 @@ export default function ({ app }, suiteName, render) {
expect($('pre').text().includes(expectedErrorMessage)).toBeTruthy()
})
test('default Content-Type', async () => {
const res = await fetch('/stateless')
expect(res.headers.get('Content-Type')).toMatch('text/html')
})
test('setting Content-Type in getInitialProps', async () => {
const res = await fetch('/custom-encoding')
expect(res.headers.get('Content-Type')).toMatch('text/html; charset=utf-8')
})
test('allows to import .json files', async () => {
const html = await render('/json')
expect(html.includes('Zeit')).toBeTruthy()
......
......@@ -14,7 +14,7 @@ const appDir = join(__dirname, '../')
let appPort
let server
let app
jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
describe('Production Usage', () => {
beforeAll(async () => {
......
......@@ -11,7 +11,7 @@ import {
const context = {}
jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
describe('On Demand Entries', () => {
it('should pass', () => {})
......
......@@ -18,7 +18,7 @@ const appDir = join(__dirname, '../')
let appPort
let server
let app
jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
const context = {}
......@@ -117,6 +117,9 @@ describe('Production Usage', () => {
const req = { url: '/stateless', headers: {} }
const headers = {}
const res = {
getHeader (key) {
return headers[key]
},
setHeader (key, value) {
headers[key] = value
},
......@@ -132,6 +135,9 @@ describe('Production Usage', () => {
const originalConfigValue = app.config.poweredByHeader
app.config.poweredByHeader = false
const res = {
getHeader () {
return false
},
setHeader (key, value) {
if (key === 'X-Powered-By') {
throw new Error('Should not set the X-Powered-By header')
......
......@@ -11,7 +11,8 @@ import {
import ssr from './ssr'
import browser from './browser'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
const appDir = join(__dirname, '../')
const context = {}
......
......@@ -23,8 +23,12 @@ export function renderViaAPI (app, pathname, query) {
}
export function renderViaHTTP (appPort, pathname, query) {
return fetchViaHTTP(appPort, pathname, query).then((res) => res.text())
}
export function fetchViaHTTP (appPort, pathname, query) {
const url = `http://localhost:${appPort}${pathname}${query ? `?${qs.stringify(query)}` : ''}`
return fetch(url).then((res) => res.text())
return fetch(url)
}
export function findPort () {
......
......@@ -156,6 +156,15 @@ ajv@^4.7.0, ajv@^4.9.1:
co "^4.6.0"
json-stable-stringify "^1.0.1"
ajv@^5.0.0:
version "5.2.4"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.2.4.tgz#3daf9a8b67221299fdae8d82d117ed8e6c80244b"
dependencies:
co "^4.6.0"
fast-deep-equal "^1.0.0"
json-schema-traverse "^0.3.0"
json-stable-stringify "^1.0.1"
ajv@^5.1.0, ajv@^5.1.5:
version "5.2.3"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.2.3.tgz#c06f598778c44c6b161abafe3466b81ad1814ed2"
......@@ -228,7 +237,7 @@ append-transform@^0.4.0:
dependencies:
default-require-extensions "^1.0.0"
aproba@^1.0.3:
aproba@^1.0.3, aproba@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
......@@ -1090,14 +1099,14 @@ babel-traverse@^6.18.0, babel-traverse@^6.24.1, babel-traverse@^6.25.0, babel-tr
invariant "^2.2.2"
lodash "^4.17.4"
babel-types@6.23.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf"
babel-types@6.26.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497"
dependencies:
babel-runtime "^6.22.0"
babel-runtime "^6.26.0"
esutils "^2.0.2"
lodash "^4.2.0"
to-fast-properties "^1.0.1"
lodash "^4.17.4"
to-fast-properties "^1.0.3"
babel-types@7.0.0-beta.0:
version "7.0.0-beta.0"
......@@ -1107,15 +1116,6 @@ babel-types@7.0.0-beta.0:
lodash "^4.2.0"
to-fast-properties "^2.0.0"
babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497"
dependencies:
babel-runtime "^6.26.0"
esutils "^2.0.2"
lodash "^4.17.4"
to-fast-properties "^1.0.3"
babylon@7.0.0-beta.22:
version "7.0.0-beta.22"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65"
......@@ -1338,6 +1338,24 @@ bytes@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
cacache@^10.0.0:
version "10.0.1"
resolved "https://registry.yarnpkg.com/cacache/-/cacache-10.0.1.tgz#3e05f6e616117d9b54665b1b20c8aeb93ea5d36f"
dependencies:
bluebird "^3.5.0"
chownr "^1.0.1"
glob "^7.1.2"
graceful-fs "^4.1.11"
lru-cache "^4.1.1"
mississippi "^1.3.0"
mkdirp "^0.5.1"
move-concurrently "^1.0.1"
promise-inflight "^1.0.1"
rimraf "^2.6.1"
ssri "^5.0.0"
unique-filename "^1.1.0"
y18n "^3.2.1"
caching-transform@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-1.0.1.tgz#6dbdb2f20f8d8fbce79f3e94e9d1742dcdf5c0a1"
......@@ -1460,6 +1478,10 @@ chokidar@^1.7.0:
optionalDependencies:
fsevents "^1.0.0"
chownr@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181"
chromedriver@2.32.3:
version "2.32.3"
resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-2.32.3.tgz#ce84f055bee7cbfe56f31182b276f33256b12bf1"
......@@ -1569,7 +1591,7 @@ commander@2.9.0:
dependencies:
graceful-readlink ">= 1.0.0"
commander@^2.9.0:
commander@^2.9.0, commander@~2.11.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
......@@ -1597,7 +1619,7 @@ concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
concat-stream@1.6.0, concat-stream@^1.5.2:
concat-stream@1.6.0, concat-stream@^1.5.0, concat-stream@^1.5.2:
version "1.6.0"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7"
dependencies:
......@@ -1697,9 +1719,9 @@ conventional-commits-parser@^2.0.0:
through2 "^2.0.0"
trim-off-newlines "^1.0.0"
convert-source-map@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.3.0.tgz#e9f3e9c6e2728efc2676696a70eb382f73106a67"
convert-source-map@1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5"
convert-source-map@^1.3.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0:
version "1.5.0"
......@@ -1713,6 +1735,17 @@ cookie@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
copy-concurrently@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0"
dependencies:
aproba "^1.1.1"
fs-write-stream-atomic "^1.0.8"
iferr "^0.1.5"
mkdirp "^0.5.1"
rimraf "^2.5.4"
run-queue "^1.0.0"
core-js@^1.0.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
......@@ -1871,6 +1904,10 @@ currently-unhandled@^0.4.1:
dependencies:
array-find-index "^1.0.1"
cyclist@~0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640"
d@1:
version "1.0.0"
resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f"
......@@ -2089,6 +2126,15 @@ dot-prop@^3.0.0:
dependencies:
is-obj "^1.0.0"
duplexify@^3.1.2, duplexify@^3.4.2:
version "3.5.1"
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.1.tgz#4e1516be68838bc90a49994f0b39a6e5960befcd"
dependencies:
end-of-stream "^1.0.0"
inherits "^2.0.1"
readable-stream "^2.0.0"
stream-shift "^1.0.0"
ecc-jsbn@~0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505"
......@@ -2137,7 +2183,7 @@ encoding@^0.1.11:
dependencies:
iconv-lite "~0.4.13"
end-of-stream@^1.0.0:
end-of-stream@^1.0.0, end-of-stream@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.0.tgz#7a90d833efda6cfa6eac0f4949dbb0fad3a63206"
dependencies:
......@@ -2670,6 +2716,13 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
flush-write-stream@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.2.tgz#c81b90d8746766f1a609a46809946c45dd8ae417"
dependencies:
inherits "^2.0.1"
readable-stream "^2.0.4"
follow-redirects@0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-0.0.7.tgz#34b90bab2a911aa347571da90f22bd36ecd8a919"
......@@ -2746,6 +2799,13 @@ friendly-errors-webpack-plugin@1.6.1:
error-stack-parser "^2.0.0"
string-length "^1.0.1"
from2@^2.1.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af"
dependencies:
inherits "^2.0.1"
readable-stream "^2.0.0"
fs-extra@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.2.tgz#f91704c53d1b461f893452b0c307d9997647ab6b"
......@@ -2754,6 +2814,15 @@ fs-extra@^4.0.2:
jsonfile "^4.0.0"
universalify "^0.1.0"
fs-write-stream-atomic@^1.0.8:
version "1.0.10"
resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9"
dependencies:
graceful-fs "^4.1.2"
iferr "^0.1.5"
imurmurhash "^0.1.4"
readable-stream "1 || 2"
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
......@@ -3218,6 +3287,10 @@ ieee754@^1.1.4:
version "1.1.8"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
iferr@^0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501"
ignore@^3.0.9, ignore@^3.2.0:
version "3.3.5"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.5.tgz#c4e715455f6073a8d7e5dae72d2fc9d71663dba6"
......@@ -4241,7 +4314,7 @@ loud-rejection@^1.0.0:
currently-unhandled "^0.4.1"
signal-exit "^3.0.0"
lru-cache@^4.0.0, lru-cache@^4.0.1:
lru-cache@^4.0.0, lru-cache@^4.0.1, lru-cache@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55"
dependencies:
......@@ -4434,6 +4507,21 @@ minimist@~0.0.1:
version "0.0.10"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
mississippi@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-1.3.0.tgz#d201583eb12327e3c5c1642a404a9cacf94e34f5"
dependencies:
concat-stream "^1.5.0"
duplexify "^3.4.2"
end-of-stream "^1.1.0"
flush-write-stream "^1.0.0"
from2 "^2.1.0"
parallel-transform "^1.1.0"
pump "^1.0.0"
pumpify "^1.3.3"
stream-each "^1.1.0"
through2 "^2.0.0"
mk-dirs@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/mk-dirs/-/mk-dirs-1.0.0.tgz#44ee67f82341c6762718e88e85e577882e1f67fd"
......@@ -4465,6 +4553,17 @@ moment@^2.11.2:
version "2.19.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.1.tgz#56da1a2d1cbf01d38b7e1afc31c10bcfa1929167"
move-concurrently@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
dependencies:
aproba "^1.1.1"
copy-concurrently "^1.0.0"
fs-write-stream-atomic "^1.0.8"
mkdirp "^0.5.1"
rimraf "^2.5.4"
run-queue "^1.0.3"
mri@1.1.0, mri@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.0.tgz#5c0a3f29c8ccffbbb1ec941dcec09d71fa32f36a"
......@@ -4774,7 +4873,7 @@ on-finished@~2.3.0:
dependencies:
ee-first "1.1.1"
once@^1.3.0, once@^1.3.3, once@^1.4.0:
once@^1.3.0, once@^1.3.1, once@^1.3.3, once@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
dependencies:
......@@ -4886,6 +4985,14 @@ pako@~0.2.0:
version "0.2.9"
resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75"
parallel-transform@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.1.0.tgz#d410f065b05da23081fcd10f28854c29bda33b06"
dependencies:
cyclist "~0.2.2"
inherits "^2.0.3"
readable-stream "^2.1.5"
parse-asn1@^5.0.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.0.tgz#37c4f9b7ed3ab65c74817b5f2480937fbf97c712"
......@@ -5115,6 +5222,10 @@ progress@^1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be"
promise-inflight@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
promise@^7.0.1, promise@^7.1.1:
version "7.3.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf"
......@@ -5165,6 +5276,21 @@ public-encrypt@^4.0.0:
parse-asn1 "^5.0.0"
randombytes "^2.0.1"
pump@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.2.tgz#3b3ee6512f94f0e575538c17995f9f16990a5d51"
dependencies:
end-of-stream "^1.1.0"
once "^1.3.1"
pumpify@^1.3.3:
version "1.3.5"
resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.3.5.tgz#1b671c619940abcaeac0ad0e3a3c164be760993b"
dependencies:
duplexify "^3.1.2"
inherits "^2.0.1"
pump "^1.0.0"
punycode@1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"
......@@ -5312,7 +5438,7 @@ read-pkg@^2.0.0:
normalize-package-data "^2.3.2"
path-type "^2.0.0"
readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6:
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6:
version "2.3.3"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c"
dependencies:
......@@ -5651,6 +5777,12 @@ run-parallel@^1.1.2:
version "1.1.6"
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.6.tgz#29003c9a2163e01e2d2dfc90575f2c6c1d61a039"
run-queue@^1.0.0, run-queue@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47"
dependencies:
aproba "^1.1.1"
rx-lite@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102"
......@@ -5683,6 +5815,12 @@ sax@^1.2.1:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
schema-utils@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.3.0.tgz#f5877222ce3e931edae039f17eb3716e7137f8cf"
dependencies:
ajv "^5.0.0"
semantic-release@^8.0.3:
version "8.2.1"
resolved "https://registry.yarnpkg.com/semantic-release/-/semantic-release-8.2.1.tgz#0bd4c2d372b328b2617fb34688937e58387f1bc1"
......@@ -5851,6 +5989,10 @@ source-map@0.5.6:
version "0.5.6"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
source-map@0.6.1, source-map@^0.6.1, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
source-map@^0.4.4:
version "0.4.4"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
......@@ -5861,10 +6003,6 @@ source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3, sour
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
source-map@^0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
sourcemapped-stacktrace@^1.1.6:
version "1.1.7"
resolved "https://registry.yarnpkg.com/sourcemapped-stacktrace/-/sourcemapped-stacktrace-1.1.7.tgz#17e05374ff78b71a9d89ad3975a49f22725ba935"
......@@ -5936,6 +6074,12 @@ ssri@^4.1.2:
dependencies:
safe-buffer "^5.1.0"
ssri@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-5.0.0.tgz#13c19390b606c821f2a10d02b351c1729b94d8cf"
dependencies:
safe-buffer "^5.1.0"
stackframe@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-0.3.1.tgz#33aa84f1177a5548c8935533cbfeb3420975f5a4"
......@@ -5985,6 +6129,13 @@ stream-consume@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/stream-consume/-/stream-consume-0.1.0.tgz#a41ead1a6d6081ceb79f65b061901b6d8f3d1d0f"
stream-each@^1.1.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.2.tgz#8e8c463f91da8991778765873fe4d960d8f616bd"
dependencies:
end-of-stream "^1.1.0"
stream-shift "^1.0.0"
stream-http@^2.3.1:
version "2.7.2"
resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.7.2.tgz#40a050ec8dc3b53b33d9909415c02c0bf1abfbad"
......@@ -5995,13 +6146,17 @@ stream-http@^2.3.1:
to-arraybuffer "^1.0.0"
xtend "^4.0.0"
stream-shift@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952"
stream-to-observable@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.1.0.tgz#45bf1d9f2d7dc09bed81f1c307c430e68b84cffe"
string-hash@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.1.tgz#8e85bed291e0763b8f6809d9c3368fea048db3dc"
string-hash@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b"
string-length@^1.0.1:
version "1.0.1"
......@@ -6093,25 +6248,25 @@ strip-json-comments@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
styled-jsx@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-2.1.1.tgz#e7481c7554df50d605cdc84a4e53c58fec3449b5"
styled-jsx@2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-2.2.1.tgz#8b38b9e53e5d9767e392595ab1afdc8426b3ba5d"
dependencies:
babel-plugin-syntax-jsx "6.18.0"
babel-types "6.23.0"
convert-source-map "1.3.0"
source-map "0.5.6"
string-hash "1.1.1"
stylis "3.3.2"
stylis-rule-sheet "0.0.6"
stylis-rule-sheet@0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/stylis-rule-sheet/-/stylis-rule-sheet-0.0.6.tgz#059f89125a8e8db546e8adb0e07c4b4bcb81911b"
babel-types "6.26.0"
convert-source-map "1.5.1"
source-map "0.6.1"
string-hash "1.1.3"
stylis "3.4.5"
stylis-rule-sheet "0.0.7"
stylis-rule-sheet@0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/stylis-rule-sheet/-/stylis-rule-sheet-0.0.7.tgz#5c51dc879141a61821c2094ba91d2cbcf2469c6c"
stylis@3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.3.2.tgz#95ef285836e98243f8b8f64a9a72706ea6c893ea"
stylis@3.4.5:
version "3.4.5"
resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.4.5.tgz#d7b9595fc18e7b9c8775eca8270a9a1d3e59806e"
supports-color@^2.0.0:
version "2.0.0"
......@@ -6267,7 +6422,7 @@ to-arraybuffer@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43"
to-fast-properties@^1.0.1, to-fast-properties@^1.0.3:
to-fast-properties@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"
......@@ -6364,6 +6519,13 @@ ua-parser-js@^0.7.9:
version "0.7.17"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.17.tgz#e9ec5f9498b9ec910e7ae3ac626a805c4d09ecac"
uglify-es@^3.1.3:
version "3.1.10"
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.1.10.tgz#f1840c3b52771d17555a02ce158cf46f689384bd"
dependencies:
commander "~2.11.0"
source-map "~0.6.1"
uglify-js@^2.6, uglify-js@^2.8.29:
version "2.8.29"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd"
......@@ -6385,6 +6547,18 @@ uglifyjs-webpack-plugin@^0.4.6:
uglify-js "^2.8.29"
webpack-sources "^1.0.1"
uglifyjs-webpack-plugin@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.1.1.tgz#6167c5aae218ee8109de8920bb769b8acbc55d03"
dependencies:
cacache "^10.0.0"
find-cache-dir "^1.0.0"
schema-utils "^0.3.0"
source-map "^0.6.1"
uglify-es "^3.1.3"
webpack-sources "^1.0.1"
worker-farm "^1.4.1"
uid-number@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.5.tgz#5a3db23ef5dbd55b81fce0ec9a2ac6fccdebb81e"
......@@ -6412,6 +6586,18 @@ uniq@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff"
unique-filename@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.0.tgz#d05f2fe4032560871f30e93cbe735eea201514f3"
dependencies:
unique-slug "^2.0.0"
unique-slug@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.0.tgz#db6676e7c7cc0629878ff196097c78855ae9f4ab"
dependencies:
imurmurhash "^0.1.4"
universalify@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7"
......@@ -6644,7 +6830,7 @@ wordwrap@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
worker-farm@^1.3.1:
worker-farm@^1.3.1, worker-farm@^1.4.1:
version "1.5.0"
resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.5.0.tgz#adfdf0cd40581465ed0a1f648f9735722afd5c8d"
dependencies:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment