Initial commit
This commit is contained in:
commit
78f8d225ee
21173 changed files with 2907774 additions and 0 deletions
26
node_modules/next/dist/esm/lib/metadata/metadata-context.js
generated
vendored
Normal file
26
node_modules/next/dist/esm/lib/metadata/metadata-context.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { trackFallbackParamAccessed } from '../../server/app-render/dynamic-rendering';
|
||||
export function createMetadataContext(pathname, renderOpts) {
|
||||
return {
|
||||
pathname,
|
||||
trailingSlash: renderOpts.trailingSlash,
|
||||
isStaticMetadataRouteFile: false
|
||||
};
|
||||
}
|
||||
export function createTrackedMetadataContext(pathname, renderOpts, workStore) {
|
||||
return {
|
||||
// Use the regular metadata context, but we trap the pathname access.
|
||||
...createMetadataContext(pathname, renderOpts),
|
||||
// Setup the trap around the pathname access so we can track when the
|
||||
// pathname is accessed while resolving metadata which would indicate it's
|
||||
// being used to resolve a relative URL. If that's the case, we don't want
|
||||
// to provide it, and instead we should error.
|
||||
get pathname () {
|
||||
if (workStore && workStore.isStaticGeneration && workStore.fallbackRouteParams && workStore.fallbackRouteParams.size > 0) {
|
||||
trackFallbackParamAccessed(workStore, 'metadata relative url resolving');
|
||||
}
|
||||
return pathname;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=metadata-context.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue