forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect reexports from metadata API routes (vercel#70508)
- Loading branch information
Showing
7 changed files
with
141 additions
and
17 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
22 changes: 22 additions & 0 deletions
22
test/production/app-dir/metadata-revalidate/app/manifest.ts
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,22 @@ | ||
import type { MetadataRoute } from 'next' | ||
|
||
export default function manifest(): MetadataRoute.Manifest { | ||
return { | ||
name: 'Next.js App', | ||
short_name: 'Next.js App', | ||
description: 'Next.js App', | ||
start_url: '/', | ||
display: 'standalone', | ||
background_color: '#fff', | ||
theme_color: '#fff', | ||
icons: [ | ||
{ | ||
src: '/favicon.ico', | ||
sizes: 'any', | ||
type: 'image/x-icon', | ||
}, | ||
], | ||
} | ||
} | ||
|
||
export const revalidate = 5 |
24 changes: 24 additions & 0 deletions
24
test/production/app-dir/metadata-revalidate/app/revalidate/og/opengraph-image.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ImageResponse } from 'next/og' | ||
|
||
/* without generateImageMetadata */ | ||
export default function og() { | ||
return new ImageResponse( | ||
( | ||
<div | ||
style={{ | ||
width: '100%', | ||
height: '100%', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
fontSize: 128, | ||
background: 'lavender', | ||
}} | ||
> | ||
Open Graph | ||
</div> | ||
) | ||
) | ||
} | ||
|
||
export const revalidate = 5 |
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,14 @@ | ||
import type { MetadataRoute } from 'next' | ||
|
||
export default function robots(): MetadataRoute.Robots { | ||
return { | ||
rules: { | ||
userAgent: '*', | ||
allow: '/', | ||
disallow: '/private/', | ||
}, | ||
sitemap: 'https://acme.com/sitemap.xml', | ||
} | ||
} | ||
|
||
export const revalidate = 5 |
12 changes: 12 additions & 0 deletions
12
test/production/app-dir/metadata-revalidate/app/sitemap.ts
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,12 @@ | ||
export default function sitemap() { | ||
return [ | ||
{ | ||
url: 'https://acme.com', | ||
lastModified: new Date(), | ||
changeFrequency: 'yearly', | ||
priority: 1, | ||
}, | ||
] | ||
} | ||
|
||
export const revalidate = 5 |
26 changes: 26 additions & 0 deletions
26
test/production/app-dir/metadata-revalidate/metadata-revalidate.test.ts
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,26 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
describe('app-dir - metadata-revalidate', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should contain the routes in prerender manifest', async () => { | ||
const manifestContent = await next.readFile('.next/prerender-manifest.json') | ||
const prerenderManifest = JSON.parse(manifestContent) | ||
|
||
expect( | ||
prerenderManifest.routes['/revalidate/og/opengraph-image'] | ||
.initialRevalidateSeconds | ||
).toBe(5) | ||
expect( | ||
prerenderManifest.routes['/manifest.webmanifest'].initialRevalidateSeconds | ||
).toBe(5) | ||
expect( | ||
prerenderManifest.routes['/robots.txt'].initialRevalidateSeconds | ||
).toBe(5) | ||
expect( | ||
prerenderManifest.routes['/sitemap.xml'].initialRevalidateSeconds | ||
).toBe(5) | ||
}) | ||
}) |
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