Skip to content

Commit

Permalink
Merge branch 'canary' into remove-images-domains-length-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
twogood committed Jan 1, 2021
2 parents 1b9466c + 984ac96 commit af357ea
Show file tree
Hide file tree
Showing 73 changed files with 4,421 additions and 284 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_test_deploy.yml
Expand Up @@ -153,7 +153,7 @@ jobs:
- run: cat package.json | jq '.resolutions."react-dom" = "^17.0.1"' > package.json.tmp && mv package.json.tmp package.json
- run: yarn install --check-files
- run: yarn list webpack react react-dom
- run: xvfb-run node run-tests.js test/integration/link-ref/test/index.test.js test/integration/production/test/index.test.js test/integration/basic/test/index.test.js test/integration/async-modules/test/index.test.js test/integration/font-optimization/test/index.test.js test/acceptance/*.test.js
- run: xvfb-run node run-tests.js test/integration/{link-ref,production,basic,async-modules,font-optimization,ssr-ctx}/test/index.test.js test/acceptance/*.test.js

testFirefox:
name: Test Firefox (production)
Expand Down
5 changes: 3 additions & 2 deletions docs/api-reference/next.config.js/rewrites.md
Expand Up @@ -154,9 +154,10 @@ module.exports = {
destination: '/another', // automatically becomes /docs/another
},
{
// does not add /docs since basePath: false is set
// does not add /docs to /without-basePath since basePath: false is set
// Note: this can not be used for internal rewrites e.g. `destination: '/another'`
source: '/without-basePath',
destination: '/another',
destination: 'https://example.com',
basePath: false,
},
]
Expand Down
1 change: 1 addition & 0 deletions docs/api-reference/next/router.md
Expand Up @@ -49,6 +49,7 @@ The following is the definition of the `router` object returned by both [`useRou
- `locale`: `String` - The active locale (if enabled).
- `locales`: `String[]` - All supported locales (if enabled).
- `defaultLocale`: `String` - The current default locale (if enabled).
- `isReady`: `boolean` - Whether the router fields are updated client-side and ready for use. Should only be used inside of `useEffect` methods and not for conditionally rendering on the server.

Additionally, the following methods are also included inside `router`:

Expand Down
32 changes: 18 additions & 14 deletions errors/incompatible-href-as.md
Expand Up @@ -11,27 +11,31 @@ Note: this error will only show when the `next/link` component is clicked not wh
```jsx
import Link from 'next/link'

export default () => (
<>
<Link href="/[post]" as="/post-1/comments">
<a>Invalid link</a>
</Link>
</>
)
export default function Page(props) {
return (
<>
<Link href="/[post]" as="/post-1/comments">
<a>Invalid link</a>
</Link>
</>
)
}
```

**Compatible `href` and `as`**

```jsx
import Link from 'next/link'

export default () => (
<>
<Link href="/[post]" as="/post-1">
<a>Valid link</a>
</Link>
</>
)
export default function Page(props) {
return (
<>
<Link href="/[post]" as="/post-1">
<a>Valid link</a>
</Link>
</>
)
}
```

#### Possible Ways to Fix It
Expand Down
47 changes: 47 additions & 0 deletions errors/invalid-relative-url-external-as.md
@@ -0,0 +1,47 @@
# Invalid relative `href` and external `as` values

#### Why This Error Occurred

Somewhere you are utilizing the `next/link` component, `Router#push`, or `Router#replace` with a relative route in your `href` that has an external `as` value. The `as` value must be relative also or only `href` should be used with an external URL.

Note: this error will only show when the `next/link` component is clicked not when only rendered.

**Incompatible `href` and `as`**

```jsx
import Link from 'next/link'

export default function Page(props) {
return (
<>
<Link href="/invalid" as="mailto:john@example.com">
<a>Invalid link</a>
</Link>
</>
)
}
```

**Compatible `href` and `as`**

```jsx
import Link from 'next/link'

export default function Page(props) {
return (
<>
<Link href="mailto:john@example.com">
<a>Invalid link</a>
</Link>
</>
)
}
```

#### Possible Ways to Fix It

Look for any usage of the `next/link` component, `Router#push`, or `Router#replace` and make sure that the provided `href` and `as` values are compatible

### Useful Links

- [Routing section in Documentation](https://nextjs.org/docs/routing/introduction)
4 changes: 3 additions & 1 deletion examples/blog-starter-typescript/README.md
Expand Up @@ -30,4 +30,6 @@ Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&ut

# Notes

This blog-starter-typescript uses [Tailwind CSS](https://tailwindcss.com). To control the generated stylesheet's filesize, this example uses Tailwind CSS' v1.4 [`purge` option](https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css) to remove unused CSS.
This blog-starter-typescript uses [Tailwind CSS](https://tailwindcss.com). To control the generated stylesheet's filesize, this example uses Tailwind CSS' v2.0 [`purge` option](https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css) to remove unused CSS.

[Tailwind CSS v2.0 no longer supports Node.js 8 or 10](https://tailwindcss.com/docs/upgrading-to-v2#upgrade-to-node-js-12-13-or-higher). To build your CSS you'll need to ensure you are running Node.js 12.13.0 or higher in both your local and CI environments.
2 changes: 1 addition & 1 deletion examples/blog-starter-typescript/components/hero-post.tsx
Expand Up @@ -26,7 +26,7 @@ const HeroPost = ({
<div className="mb-8 md:mb-16">
<CoverImage title={title} src={coverImage} slug={slug} />
</div>
<div className="md:grid md:grid-cols-2 md:col-gap-16 lg:col-gap-8 mb-20 md:mb-28">
<div className="md:grid md:grid-cols-2 md:gap-x-16 lg:gap-x-8 mb-20 md:mb-28">
<div>
<h3 className="mb-4 text-4xl lg:text-6xl leading-tight">
<Link as={`/posts/${slug}`} href="/posts/[slug]">
Expand Down
Expand Up @@ -11,7 +11,7 @@ const MoreStories = ({ posts }: Props) => {
<h2 className="mb-8 text-6xl md:text-7xl font-bold tracking-tighter leading-tight">
More Stories
</h2>
<div className="grid grid-cols-1 md:grid-cols-2 md:col-gap-16 lg:col-gap-32 row-gap-20 md:row-gap-32 mb-32">
<div className="grid grid-cols-1 md:grid-cols-2 md:gap-x-16 lg:gap-x-32 gap-y-20 md:gap-y-32 mb-32">
{posts.map((post) => (
<PostPreview
key={post.slug}
Expand Down
2 changes: 1 addition & 1 deletion examples/blog-starter-typescript/package.json
Expand Up @@ -25,7 +25,7 @@
"@types/react": "^16.9.35",
"@types/react-dom": "^16.9.8",
"postcss-preset-env": "^6.7.0",
"tailwindcss": "^1.4.0"
"tailwindcss": "^2.0.2"
},
"license": "MIT"
}
35 changes: 35 additions & 0 deletions examples/with-mdbreact/.gitignore
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

/.idea
# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
21 changes: 21 additions & 0 deletions examples/with-mdbreact/README.md
@@ -0,0 +1,21 @@
# mdbreact Example

This example shows how to use [MDBReact](https://mdbootstrap.com/docs/react) with Next.js.

## Deploy your own

Deploy the example using [Vercel](https://vercel.com):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/git?s=https://github.com/vercel/next.js/tree/canary/examples/with-mdbreact)

## How to use

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:

```bash
npx create-next-app --example with-mdbreact with-mdbreact-app
# or
yarn create next-app --example with-mdbreact with-mdbreact-app
```

Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
16 changes: 16 additions & 0 deletions examples/with-mdbreact/package.json
@@ -0,0 +1,16 @@
{
"name": "with-mdbreact",
"version": "0.1.0",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"mdbreact": "^5.0.0",
"next": "latest",
"react": "17.0.1",
"react-dom": "17.0.1"
},
"license": "MIT"
}
10 changes: 10 additions & 0 deletions examples/with-mdbreact/pages/_app.js
@@ -0,0 +1,10 @@
import '@fortawesome/fontawesome-free/css/all.min.css'
import 'bootstrap-css-only/css/bootstrap.min.css'
import 'mdbreact/dist/css/mdb.css'
import '../styles/globals.css'

function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}

export default MyApp
118 changes: 118 additions & 0 deletions examples/with-mdbreact/pages/index.js
@@ -0,0 +1,118 @@
import Head from 'next/head'
import {
MDBBtn,
MDBCard,
MDBCardBody,
MDBCardText,
MDBCardTitle,
MDBCol,
MDBContainer,
MDBFooter,
MDBRow,
} from 'mdbreact'

export default function Home() {
return (
<>
<Head>
<title>NextJS with Material Design Bootstrap for React</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<MDBContainer className="text-center mt-5">
<h1 className="h1-responsive font-weight-bolder">
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>
<p className="mb-3">
Get started by editing <code>pages/index.js</code>
</p>
<MDBRow>
<MDBCol sm="6">
<MDBCard className="my-3">
<MDBCardBody>
<MDBCardTitle tag="h5">Documentation</MDBCardTitle>
<MDBCardText>
Find in-depth information about Next.js features and API.
</MDBCardText>
<MDBBtn
color="primary"
size="sm"
className="text-capitalize"
href="https://nextjs.org/docs"
>
More &rarr;
</MDBBtn>
</MDBCardBody>
</MDBCard>
</MDBCol>
<MDBCol sm="6">
<MDBCard className="my-3">
<MDBCardBody>
<MDBCardTitle tag="h5">Learn</MDBCardTitle>
<MDBCardText>
Learn about Next.js in an interactive course with quizzes!
</MDBCardText>
<MDBBtn
color="primary"
size="sm"
className="text-capitalize"
href="https://nextjs.org/learn"
>
More &rarr;
</MDBBtn>
</MDBCardBody>
</MDBCard>
</MDBCol>
</MDBRow>
<MDBRow>
<MDBCol sm="6">
<MDBCard className="my-3">
<MDBCardBody>
<MDBCardTitle tag="h5">Examples</MDBCardTitle>
<MDBCardText>
Discover and deploy boilerplate example Next.js projects.
</MDBCardText>
<MDBBtn
color="primary"
size="sm"
className="text-capitalize"
href="https://github.com/vercel/next.js/tree/master/examples"
>
More &rarr;
</MDBBtn>
</MDBCardBody>
</MDBCard>
</MDBCol>
<MDBCol sm="6">
<MDBCard className="my-3">
<MDBCardBody>
<MDBCardTitle tag="h5">Deploy</MDBCardTitle>
<MDBCardText>
Instantly deploy your Next.js site to a public URL with
Vercel.
</MDBCardText>
<MDBBtn
color="primary"
size="sm"
className="text-capitalize"
href="https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=example&utm_campaign=next-example"
>
More &rarr;
</MDBBtn>
</MDBCardBody>
</MDBCard>
</MDBCol>
</MDBRow>
<MDBFooter className="text-center mt-4" color="white">
<span className="black-text"> Powered by</span>
<a
href="https://vercel.com?filter=next.js&utm_source=github&utm_medium=example&utm_campaign=next-example"
target="_blank"
rel="noopener noreferrer"
>
<img src="/vercel.svg" alt="Vercel Logo" />
</a>
</MDBFooter>
</MDBContainer>
</>
)
}
Binary file added examples/with-mdbreact/public/favicon.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions examples/with-mdbreact/public/vercel.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions examples/with-mdbreact/styles/globals.css
@@ -0,0 +1,16 @@
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}

a {
color: inherit;
text-decoration: none;
}

* {
box-sizing: border-box;
}
2 changes: 1 addition & 1 deletion examples/with-mongodb-mongoose/package.json
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"mongoose": "^5.9.13",
"next": "^9.4.2",
"next": "latest",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"swr": "0.2.2"
Expand Down

0 comments on commit af357ea

Please sign in to comment.