Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' of github.com:vercel/next.js into azukaru-image…
…-component # Conflicts: # packages/next/client/image.tsx
- Loading branch information
Showing
78 changed files
with
2,182 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Install `sharp` to Use Built-In Image Optimization | ||
|
||
#### Why This Error Occurred | ||
|
||
Using Next.js' built-in Image Optimization requires that you bring your own version of `sharp`. | ||
|
||
#### Possible Ways to Fix It | ||
|
||
Please install the `sharp` package in your project. | ||
|
||
```bash | ||
npm i sharp | ||
# or | ||
yarn add sharp | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,45 @@ | ||
import { MongoClient } from 'mongodb' | ||
|
||
let uri = process.env.MONGODB_URI | ||
let dbName = process.env.MONGODB_DB | ||
const { MONGODB_URI, MONGODB_DB } = process.env | ||
|
||
let cachedClient = null | ||
let cachedDb = null | ||
|
||
if (!uri) { | ||
if (!MONGODB_URI) { | ||
throw new Error( | ||
'Please define the MONGODB_URI environment variable inside .env.local' | ||
) | ||
} | ||
|
||
if (!dbName) { | ||
if (!MONGODB_DB) { | ||
throw new Error( | ||
'Please define the MONGODB_DB environment variable inside .env.local' | ||
) | ||
} | ||
|
||
/** | ||
* Global is used here to maintain a cached connection across hot reloads | ||
* in development. This prevents connections growing exponentiatlly | ||
* during API Route usage. | ||
*/ | ||
let cached = global.mongo | ||
if (!cached) cached = global.mongo = {} | ||
|
||
export async function connectToDatabase() { | ||
if (cachedClient && cachedDb) { | ||
return { client: cachedClient, db: cachedDb } | ||
if (cached.conn) return cached.conn | ||
if (!cached.promise) { | ||
const conn = {} | ||
const opts = { | ||
useNewUrlParser: true, | ||
useUnifiedTopology: true, | ||
} | ||
cached.promise = MongoClient.connect(MONGODB_URI, opts) | ||
.then((client) => { | ||
conn.client = client | ||
return client.db(MONGODB_DB) | ||
}) | ||
.then((db) => { | ||
conn.db = db | ||
cached.conn = conn | ||
}) | ||
} | ||
|
||
const client = await MongoClient.connect(uri, { | ||
useNewUrlParser: true, | ||
useUnifiedTopology: true, | ||
}) | ||
|
||
const db = await client.db(dbName) | ||
|
||
cachedClient = client | ||
cachedDb = db | ||
|
||
return { client, db } | ||
await cached.promise | ||
return cached.conn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
Prisma.io maintains it's own Next.Js examples | ||
|
||
- [Javascript](https://github.com/prisma/prisma-examples/tree/master/javascript/rest-nextjs) | ||
- [Typescript](https://github.com/prisma/prisma-examples/tree/master/typescript/rest-nextjs) | ||
- [Typescript-GraphQL](https://github.com/prisma/prisma-examples/tree/master/typescript/graphql-nextjs) | ||
- [Typescript: rest-api-routes-auth](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-api-routes-auth) | ||
- [Typescript: rest-api-routes](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-api-routes) | ||
- [Typescript: rest-api-express](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-express) | ||
- [Typescript: graphql](https://github.com/prisma/prisma-examples/tree/latest/typescript/graphql-nextjs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,5 @@ | |
"registry": "https://registry.npmjs.org/" | ||
} | ||
}, | ||
"version": "9.5.6-canary.0" | ||
"version": "9.5.6-canary.4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@next/env", | ||
"version": "9.5.6-canary.0", | ||
"version": "9.5.6-canary.4", | ||
"keywords": [ | ||
"react", | ||
"next", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.