Skip to content

Commit 6bdee93

Browse files
authored
Merge branch 'main' into rs/isr-i18n-homepage
2 parents 1dd7c26 + 3f35549 commit 6bdee93

File tree

91 files changed

+16901
-13003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+16901
-13003
lines changed

.github/workflows/e2e-next.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Next.js e2e test suite
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
test:
10+
name: E2E tests
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Installing with LTS Node.js
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: 'lts/*'
18+
- name: NPM Install
19+
run: npm install
20+
- name: Run Next.js e2e test suite
21+
run: npm run test:next
22+
env:
23+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_BOT_AUTH_TOKEN }}
24+
NETLIFY_SITE_ID: 1d5a5c76-d445-4ae5-b694-b0d3f2e2c395

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"packages/runtime": "4.28.6",
2+
"packages/runtime": "4.29.1",
33
"packages/next": "1.4.0"
44
}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ If you currently use redirects or rewrites on your site, see
138138
information on changes to how they are handled in this version. In particular, note that `_redirects` and `_headers`
139139
files must be placed in `public`, not in the root of the site.
140140

141+
## Using with pnpm
142+
If your site uses pnpm to manage dependencies, currently you must [enable public hoisting](https://pnpm.io/npmrc#public-hoist-pattern).
143+
The simplest way to do this is to create a `.npmrc` file in the root of your project with the content:
144+
145+
```ini
146+
public-hoist-pattern[]=*
147+
```
148+
141149
## Feedback
142150

143151
If you think you have found a bug in Next.js on Netlify,

cypress/integration/middleware/enhanced.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,15 @@ describe('Enhanced middleware', () => {
2525
.that.includes('This was static but has been transformed in')
2626
})
2727
})
28+
29+
it('adds geo data', () => {
30+
cy.request('/api/geo').then((response) => {
31+
expect(response.body).to.have.nested.property('headers.x-geo-country')
32+
expect(response.body).to.have.nested.property('headers.x-geo-region')
33+
expect(response.body).to.have.nested.property('headers.x-geo-city')
34+
expect(response.body).to.have.nested.property('headers.x-geo-longitude')
35+
expect(response.body).to.have.nested.property('headers.x-geo-latitude')
36+
expect(response.body).to.have.nested.property('headers.x-geo-timezone')
37+
})
38+
})
2839
})

demos/base-path/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"typescript": "^4.6.3"
1414
},
1515
"dependencies": {
16-
"next": "^13.0.0"
16+
"next": "^13.0.3"
1717
},
1818
"scripts": {
1919
"test": "echo \"Error: no test specified\" && exit 1"

demos/canary/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/canary/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
},
1111
"dependencies": {
1212
"next": "^12.3.1",
13-
"react": "18.1.0",
14-
"react-dom": "18.1.0"
13+
"react": "^18.2.0",
14+
"react-dom": "^18.2.0"
1515
},
1616
"devDependencies": {
1717
"@netlify/plugin-nextjs": "*",

demos/custom-routes/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"typescript": "^4.7.4"
1515
},
1616
"dependencies": {
17-
"next": "^13.0.0"
17+
"next": "^13.0.3"
1818
},
1919
"scripts": {
2020
"build": "next build",

demos/default/hello.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
world

demos/default/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
},
1919
"homepage": "https://github.com/netlify/next-runtime#readme",
2020
"dependencies": {
21+
"@netlify/next": "*",
2122
"@reach/dialog": "^0.16.2",
2223
"@reach/visually-hidden": "^0.16.0",
23-
"@vercel/og": "^0.0.15",
24-
"next": "^13.0.0",
25-
"react": "^18.0.0",
26-
"react-dom": "^18.0.0"
24+
"@vercel/og": "^0.0.20",
25+
"next": "^13.0.3",
26+
"react": "^18.2.0",
27+
"react-dom": "^18.2.0"
2728
},
2829
"devDependencies": {
2930
"@netlify/plugin-nextjs": "*",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Link from 'next/link'
2+
import path from 'path'
3+
import fs from 'fs'
4+
5+
export async function getServerSideProps() {
6+
const text = fs.readFileSync(path.join(process.cwd(), 'hello.txt'), 'utf8').trim()
7+
8+
return {
9+
props: {
10+
world: text,
11+
time: new Date().getTime(),
12+
},
13+
}
14+
}
15+
16+
const File = ({ world, time }) => (
17+
<>
18+
<p>hello {world}</p>
19+
<span id="anotherTime">time: {time}</span>
20+
<Link href="/" id="home">
21+
to home
22+
</Link>
23+
<br />
24+
<Link href="/something" id="something">
25+
to something
26+
</Link>
27+
</>
28+
)
29+
export default File

demos/middleware/middleware.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { NextResponse } from 'next/server'
2-
import type { NextRequest } from 'next/server'
3-
4-
import { MiddlewareRequest } from '@netlify/next'
2+
import { MiddlewareRequest, NextRequest } from '@netlify/next'
53

64
export async function middleware(req: NextRequest) {
75
let response
@@ -29,6 +27,17 @@ export async function middleware(req: NextRequest) {
2927
return request.next()
3028
}
3129

30+
if (pathname.startsWith('/api/geo')) {
31+
req.headers.set('x-geo-country', req.geo.country)
32+
req.headers.set('x-geo-region', req.geo.region)
33+
req.headers.set('x-geo-city', req.geo.city)
34+
req.headers.set('x-geo-longitude', req.geo.longitude)
35+
req.headers.set('x-geo-latitude', req.geo.latitude)
36+
req.headers.set('x-geo-timezone', req.geo.timezone)
37+
38+
return request.next()
39+
}
40+
3241
if (pathname.startsWith('/headers')) {
3342
// Add a header to the rewritten request
3443
req.headers.set('x-hello', 'world')

demos/middleware/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"dependencies": {
1212
"@netlify/next": "*",
1313
"@netlify/plugin-nextjs": "*",
14-
"next": "^13.0.0",
15-
"react": "18.0.0",
16-
"react-dom": "18.0.0"
14+
"next": "^13.0.3",
15+
"react": "^18.2.0",
16+
"react-dom": "^18.2.0"
1717
},
1818
"devDependencies": {
1919
"@types/fs-extra": "^9.0.13",

demos/middleware/pages/api/geo.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function handler(req, res) {
2+
res.status(200).json({ name: 'geo-test', headers: req.headers })
3+
}

demos/next-auth/netlify.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ignore = "if [ $CACHED_COMMIT_REF == $COMMIT_REF ]; then (exit 1); else git diff
55

66
[build.environment]
77
TERM = "xterm"
8-
NODE_VERSION = "17"
98

109
[[plugins]]
1110
package = "@netlify/plugin-nextjs"

demos/next-auth/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
],
2424
"license": "MIT",
2525
"dependencies": {
26-
"next": "^13.0.0",
26+
"next": "^13.0.3",
2727
"next-auth": "^4.15.0",
2828
"nodemailer": "^6.6.3",
29-
"react": "^18.0.0",
30-
"react-dom": "^18.0.0"
29+
"react": "^18.2.0",
30+
"react-dom": "^18.2.0"
3131
},
3232
"devDependencies": {
3333
"@netlify/plugin-nextjs": "*",

demos/next-export/netlify.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ignore = "if [ $CACHED_COMMIT_REF == $COMMIT_REF ]; then (exit 1); else git diff
55

66
[build.environment]
77
NETLIFY_NEXT_PLUGIN_SKIP = "true"
8-
NODE_VERSION = "17"
98

109
[[plugins]]
1110
package = "@netlify/plugin-nextjs"

demos/next-export/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"description": "",
55
"dependencies": {
6-
"next": "^13.0.0"
6+
"next": "^13.0.3"
77
},
88
"devDependencies": {
99
"@netlify/plugin-nextjs": "*",

0 commit comments

Comments
 (0)