-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Should not warn metadataBase missing if only absolute urls are present (
#61898) ### What * Narrow down the metadata base warnings only when there's any relative urls need to be resolved, if there's only absolute urls present, no need to resolve and we don't warn. * Polish the error message, updated from "metadata.metadataBase is not set ..." to "metadataBase property in metadata export is not set ..." ### Why It will be confusing if we're still show metadataBase warning when there's no need to set one, since the social image cards only have absolute urls Closes NEXT-2426
- Loading branch information
Showing
11 changed files
with
107 additions
and
60 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
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,7 +1,13 @@ | ||
const DUMMY_ORIGIN = 'http://n' | ||
|
||
function getUrlWithoutHost(url: string) { | ||
return new URL(url, 'http://n') | ||
return new URL(url, DUMMY_ORIGIN) | ||
} | ||
|
||
export function getPathname(url: string) { | ||
return getUrlWithoutHost(url).pathname | ||
} | ||
|
||
export function isFullStringUrl(url: string) { | ||
return /https?:\/\//.test(url) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
test/e2e/app-dir/metadata-warnings/app/absolute-url-og/page.js
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,9 @@ | ||
export default function Page() { | ||
return 'absolute url og page' | ||
} | ||
|
||
export const metadata = { | ||
openGraph: { | ||
images: 'https://repository-images.githubusercontent.com/123', | ||
}, | ||
} |
1 change: 0 additions & 1 deletion
1
...adata-missing-metadata-base/app/layout.js → ...e/app-dir/metadata-warnings/app/layout.js
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,7 +1,6 @@ | ||
export default function Layout({ children }) { | ||
return ( | ||
<html> | ||
<head></head> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
|
File renamed without changes
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/metadata-warnings/app/og-image-convention/page.js
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,3 @@ | ||
export default function Page() { | ||
return 'page' | ||
} |
File renamed without changes.
25 changes: 16 additions & 9 deletions
25
...adata-missing-metadata-base/index.test.ts → ...e/app-dir/metadata-warnings/index.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
3c4ec65
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stats from current release
Default Build (Increase detected⚠️ )
General
Client Bundles (main, webpack) Overall increase⚠️
Legacy Client Bundles (polyfills)
Client Pages
Client Build Manifests
Rendered Page Sizes
Edge SSR bundle Size Overall increase⚠️
Middleware size Overall increase⚠️
Next Runtimes Overall increase⚠️
build cache Overall increase⚠️
Diff details
Diff for page.js
Diff for edge-runtime-webpack.js
Diff for middleware.js
Diff too large to display
Diff for edge-ssr.js
Diff too large to display
Diff for dynamic-HASH.js
Diff for image-HASH.js
Diff for link-HASH.js
Diff for 3f784ff6-HASH.js
Diff too large to display
Diff for 6433-HASH.js
Diff too large to display
Diff for 8201-HASH.js
Diff for main-HASH.js
Diff too large to display
Diff for polyfills-HASH.js
Diff too large to display
Diff for webpack-HASH.js
Diff for app-page-exp..ntime.dev.js
Diff for app-page-exp..time.prod.js
Diff too large to display
Diff for app-page-tur..time.prod.js
Diff too large to display
Diff for app-page-tur..time.prod.js
Diff too large to display
Diff for app-page.runtime.dev.js
Diff for app-page.runtime.prod.js
Diff too large to display
Diff for app-route-ex..ntime.dev.js
Diff too large to display
Diff for app-route-ex..time.prod.js
Diff too large to display
Diff for app-route-tu..time.prod.js
Diff too large to display
Diff for app-route-tu..time.prod.js
Diff too large to display
Diff for app-route.runtime.dev.js
Diff too large to display
Diff for app-route.ru..time.prod.js
Diff too large to display
Diff for pages-api-tu..time.prod.js
Diff too large to display
Diff for pages-api.runtime.dev.js
Diff too large to display
Diff for pages-api.ru..time.prod.js
Diff too large to display
Diff for pages-turbo...time.prod.js
Diff too large to display
Diff for pages.runtime.dev.js
Diff too large to display
Diff for pages.runtime.prod.js
Diff too large to display
Diff for server.runtime.prod.js
Diff too large to display