main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
import type { ResolvedMetadata } from './types/metadata-interface';
export declare function cloneMetadata(metadata: ResolvedMetadata): ResolvedMetadata;

33
node_modules/next/dist/lib/metadata/clone-metadata.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "cloneMetadata", {
enumerable: true,
get: function() {
return cloneMetadata;
}
});
const TYPE_URL = "__METADATA_URL";
function replacer(_key, val) {
// clone URL as string but recover it as URL
if (val instanceof URL) {
return {
_type: TYPE_URL,
value: val.href
};
}
return val;
}
function reviver(_key, val) {
if (typeof val === "object" && val !== null && val._type === TYPE_URL) {
return new URL(val.value);
}
return val;
}
function cloneMetadata(metadata) {
const jsonString = JSON.stringify(metadata, replacer);
return JSON.parse(jsonString, reviver);
}
//# sourceMappingURL=clone-metadata.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/metadata/clone-metadata.ts"],"names":["cloneMetadata","TYPE_URL","replacer","_key","val","URL","_type","value","href","reviver","metadata","jsonString","JSON","stringify","parse"],"mappings":";;;;+BAmBgBA;;;eAAAA;;;AAjBhB,MAAMC,WAAW;AAEjB,SAASC,SAASC,IAAY,EAAEC,GAAQ;IACtC,4CAA4C;IAC5C,IAAIA,eAAeC,KAAK;QACtB,OAAO;YAAEC,OAAOL;YAAUM,OAAOH,IAAII,IAAI;QAAC;IAC5C;IACA,OAAOJ;AACT;AAEA,SAASK,QAAQN,IAAY,EAAEC,GAAQ;IACrC,IAAI,OAAOA,QAAQ,YAAYA,QAAQ,QAAQA,IAAIE,KAAK,KAAKL,UAAU;QACrE,OAAO,IAAII,IAAID,IAAIG,KAAK;IAC1B;IACA,OAAOH;AACT;AAEO,SAASJ,cAAcU,QAA0B;IACtD,MAAMC,aAAaC,KAAKC,SAAS,CAACH,UAAUR;IAC5C,OAAOU,KAAKE,KAAK,CAACH,YAAYF;AAChC"}

6
node_modules/next/dist/lib/metadata/constants.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import type { Viewport } from './types/extra-types';
import type { Icons } from './types/metadata-types';
export declare const ViewPortKeys: {
[k in keyof Viewport]: string;
};
export declare const IconKeys: (keyof Icons)[];

40
node_modules/next/dist/lib/metadata/constants.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
ViewPortKeys: null,
IconKeys: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ViewPortKeys: function() {
return ViewPortKeys;
},
IconKeys: function() {
return IconKeys;
}
});
const ViewPortKeys = {
width: "width",
height: "height",
initialScale: "initial-scale",
minimumScale: "minimum-scale",
maximumScale: "maximum-scale",
viewportFit: "viewport-fit",
userScalable: "user-scalable",
interactiveWidget: "interactive-widget"
};
const IconKeys = [
"icon",
"shortcut",
"apple",
"other"
];
//# sourceMappingURL=constants.js.map

1
node_modules/next/dist/lib/metadata/constants.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/metadata/constants.ts"],"names":["ViewPortKeys","IconKeys","width","height","initialScale","minimumScale","maximumScale","viewportFit","userScalable","interactiveWidget"],"mappings":";;;;;;;;;;;;;;;IAGaA,YAAY;eAAZA;;IAWAC,QAAQ;eAARA;;;AAXN,MAAMD,eAAkD;IAC7DE,OAAO;IACPC,QAAQ;IACRC,cAAc;IACdC,cAAc;IACdC,cAAc;IACdC,aAAa;IACbC,cAAc;IACdC,mBAAmB;AACrB;AAEO,MAAMR,WAA4B;IAAC;IAAQ;IAAY;IAAS;CAAQ"}

View File

@@ -0,0 +1,2 @@
import type { ResolvedMetadata } from './types/metadata-interface';
export declare function createDefaultMetadata(): ResolvedMetadata;

View File

@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createDefaultMetadata", {
enumerable: true,
get: function() {
return createDefaultMetadata;
}
});
function createDefaultMetadata() {
return {
viewport: "width=device-width, initial-scale=1",
metadataBase: null,
// Other values are all null
title: null,
description: null,
applicationName: null,
authors: null,
generator: null,
keywords: null,
referrer: null,
themeColor: null,
colorScheme: null,
creator: null,
publisher: null,
robots: null,
manifest: null,
alternates: {
canonical: null,
languages: null,
media: null,
types: null
},
icons: null,
openGraph: null,
twitter: null,
verification: {},
appleWebApp: null,
formatDetection: null,
itunes: null,
abstract: null,
appLinks: null,
archives: null,
assets: null,
bookmarks: null,
category: null,
classification: null,
other: {}
};
}
//# sourceMappingURL=default-metadata.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/metadata/default-metadata.tsx"],"names":["createDefaultMetadata","viewport","metadataBase","title","description","applicationName","authors","generator","keywords","referrer","themeColor","colorScheme","creator","publisher","robots","manifest","alternates","canonical","languages","media","types","icons","openGraph","twitter","verification","appleWebApp","formatDetection","itunes","abstract","appLinks","archives","assets","bookmarks","category","classification","other"],"mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA;IACd,OAAO;QACLC,UAAU;QACVC,cAAc;QAEd,4BAA4B;QAC5BC,OAAO;QACPC,aAAa;QACbC,iBAAiB;QACjBC,SAAS;QACTC,WAAW;QACXC,UAAU;QACVC,UAAU;QACVC,YAAY;QACZC,aAAa;QACbC,SAAS;QACTC,WAAW;QACXC,QAAQ;QACRC,UAAU;QACVC,YAAY;YACVC,WAAW;YACXC,WAAW;YACXC,OAAO;YACPC,OAAO;QACT;QACAC,OAAO;QACPC,WAAW;QACXC,SAAS;QACTC,cAAc,CAAC;QACfC,aAAa;QACbC,iBAAiB;QACjBC,QAAQ;QACRC,UAAU;QACVC,UAAU;QACVC,UAAU;QACVC,QAAQ;QACRC,WAAW;QACXC,UAAU;QACVC,gBAAgB;QAChBC,OAAO,CAAC;IACV;AACF"}

View File

@@ -0,0 +1,5 @@
import type { ResolvedMetadata } from '../types/metadata-interface';
import React from 'react';
export declare function AlternatesMetadata({ alternates, }: {
alternates: ResolvedMetadata['alternates'];
}): NonNullable<React.JSX.Element | (React.JSX.Element | null | undefined)[]>[] | null;

View File

@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AlternatesMetadata", {
enumerable: true,
get: function() {
return AlternatesMetadata;
}
});
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _meta = require("./meta");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function AlternateLink({ descriptor, ...props }) {
if (!descriptor.url) return null;
return /*#__PURE__*/ _react.default.createElement("link", {
...props,
...descriptor.title && {
title: descriptor.title
},
href: descriptor.url.toString()
});
}
function AlternatesMetadata({ alternates }) {
if (!alternates) return null;
const { canonical, languages, media, types } = alternates;
return (0, _meta.MetaFilter)([
canonical ? AlternateLink({
rel: "canonical",
descriptor: canonical
}) : null,
languages ? Object.entries(languages).flatMap(([locale, descriptors])=>descriptors == null ? void 0 : descriptors.map((descriptor)=>AlternateLink({
rel: "alternate",
hrefLang: locale,
descriptor
}))) : null,
media ? Object.entries(media).flatMap(([mediaName, descriptors])=>descriptors == null ? void 0 : descriptors.map((descriptor)=>AlternateLink({
rel: "alternate",
media: mediaName,
descriptor
}))) : null,
types ? Object.entries(types).flatMap(([type, descriptors])=>descriptors == null ? void 0 : descriptors.map((descriptor)=>AlternateLink({
rel: "alternate",
type,
descriptor
}))) : null
]);
}
//# sourceMappingURL=alternate.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/generate/alternate.tsx"],"names":["AlternatesMetadata","AlternateLink","descriptor","props","url","link","title","href","toString","alternates","canonical","languages","media","types","MetaFilter","rel","Object","entries","flatMap","locale","descriptors","map","hrefLang","mediaName","type"],"mappings":";;;;+BAsBgBA;;;eAAAA;;;8DApBE;sBAES;;;;;;AAE3B,SAASC,cAAc,EACrBC,UAAU,EACV,GAAGC,OAGwC;IAC3C,IAAI,CAACD,WAAWE,GAAG,EAAE,OAAO;IAC5B,qBACE,6BAACC;QACE,GAAGF,KAAK;QACR,GAAID,WAAWI,KAAK,IAAI;YAAEA,OAAOJ,WAAWI,KAAK;QAAC,CAAC;QACpDC,MAAML,WAAWE,GAAG,CAACI,QAAQ;;AAGnC;AAEO,SAASR,mBAAmB,EACjCS,UAAU,EAGX;IACC,IAAI,CAACA,YAAY,OAAO;IAExB,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGJ;IAE/C,OAAOK,IAAAA,gBAAU,EAAC;QAChBJ,YACIT,cAAc;YAAEc,KAAK;YAAab,YAAYQ;QAAU,KACxD;QACJC,YACIK,OAAOC,OAAO,CAACN,WAAWO,OAAO,CAAC,CAAC,CAACC,QAAQC,YAAY,GACtDA,+BAAAA,YAAaC,GAAG,CAAC,CAACnB,aAChBD,cAAc;oBAAEc,KAAK;oBAAaO,UAAUH;oBAAQjB;gBAAW,OAGnE;QACJU,QACII,OAAOC,OAAO,CAACL,OAAOM,OAAO,CAAC,CAAC,CAACK,WAAWH,YAAY,GACrDA,+BAAAA,YAAaC,GAAG,CAAC,CAACnB,aAChBD,cAAc;oBAAEc,KAAK;oBAAaH,OAAOW;oBAAWrB;gBAAW,OAGnE;QACJW,QACIG,OAAOC,OAAO,CAACJ,OAAOK,OAAO,CAAC,CAAC,CAACM,MAAMJ,YAAY,GAChDA,+BAAAA,YAAaC,GAAG,CAAC,CAACnB,aAChBD,cAAc;oBAAEc,KAAK;oBAAaS;oBAAMtB;gBAAW,OAGvD;KACL;AACH"}

View File

@@ -0,0 +1,17 @@
import type { ResolvedMetadata } from '../types/metadata-interface';
import React from 'react';
export declare function BasicMetadata({ metadata }: {
metadata: ResolvedMetadata;
}): NonNullable<React.JSX.Element | (React.JSX.Element | null)[]>[];
export declare function ItunesMeta({ itunes }: {
itunes: ResolvedMetadata['itunes'];
}): React.JSX.Element | null;
export declare function FormatDetectionMeta({ formatDetection, }: {
formatDetection: ResolvedMetadata['formatDetection'];
}): React.JSX.Element | null;
export declare function AppleWebAppMeta({ appleWebApp, }: {
appleWebApp: ResolvedMetadata['appleWebApp'];
}): NonNullable<React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.JSX.Element[]>[] | null;
export declare function VerificationMeta({ verification, }: {
verification: ResolvedMetadata['verification'];
}): NonNullable<React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[]>[][] | null;

224
node_modules/next/dist/lib/metadata/generate/basic.js generated vendored Normal file
View File

@@ -0,0 +1,224 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
BasicMetadata: null,
ItunesMeta: null,
FormatDetectionMeta: null,
AppleWebAppMeta: null,
VerificationMeta: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
BasicMetadata: function() {
return BasicMetadata;
},
ItunesMeta: function() {
return ItunesMeta;
},
FormatDetectionMeta: function() {
return FormatDetectionMeta;
},
AppleWebAppMeta: function() {
return AppleWebAppMeta;
},
VerificationMeta: function() {
return VerificationMeta;
}
});
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _meta = require("./meta");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function BasicMetadata({ metadata }) {
var _metadata_keywords, _metadata_robots, _metadata_robots1;
return (0, _meta.MetaFilter)([
/*#__PURE__*/ _react.default.createElement("meta", {
charSet: "utf-8"
}),
metadata.title !== null && metadata.title.absolute ? /*#__PURE__*/ _react.default.createElement("title", null, metadata.title.absolute) : null,
(0, _meta.Meta)({
name: "description",
content: metadata.description
}),
(0, _meta.Meta)({
name: "application-name",
content: metadata.applicationName
}),
...metadata.authors ? metadata.authors.map((author)=>[
author.url ? /*#__PURE__*/ _react.default.createElement("link", {
rel: "author",
href: author.url.toString()
}) : null,
(0, _meta.Meta)({
name: "author",
content: author.name
})
]) : [],
metadata.manifest ? /*#__PURE__*/ _react.default.createElement("link", {
rel: "manifest",
href: metadata.manifest.toString()
}) : null,
(0, _meta.Meta)({
name: "generator",
content: metadata.generator
}),
(0, _meta.Meta)({
name: "keywords",
content: (_metadata_keywords = metadata.keywords) == null ? void 0 : _metadata_keywords.join(",")
}),
(0, _meta.Meta)({
name: "referrer",
content: metadata.referrer
}),
...metadata.themeColor ? metadata.themeColor.map((themeColor)=>(0, _meta.Meta)({
name: "theme-color",
content: themeColor.color,
media: themeColor.media
})) : [],
(0, _meta.Meta)({
name: "color-scheme",
content: metadata.colorScheme
}),
(0, _meta.Meta)({
name: "viewport",
content: metadata.viewport
}),
(0, _meta.Meta)({
name: "creator",
content: metadata.creator
}),
(0, _meta.Meta)({
name: "publisher",
content: metadata.publisher
}),
(0, _meta.Meta)({
name: "robots",
content: (_metadata_robots = metadata.robots) == null ? void 0 : _metadata_robots.basic
}),
(0, _meta.Meta)({
name: "googlebot",
content: (_metadata_robots1 = metadata.robots) == null ? void 0 : _metadata_robots1.googleBot
}),
(0, _meta.Meta)({
name: "abstract",
content: metadata.abstract
}),
...metadata.archives ? metadata.archives.map((archive)=>/*#__PURE__*/ _react.default.createElement("link", {
rel: "archives",
href: archive
})) : [],
...metadata.assets ? metadata.assets.map((asset)=>/*#__PURE__*/ _react.default.createElement("link", {
rel: "assets",
href: asset
})) : [],
...metadata.bookmarks ? metadata.bookmarks.map((bookmark)=>/*#__PURE__*/ _react.default.createElement("link", {
rel: "bookmarks",
href: bookmark
})) : [],
(0, _meta.Meta)({
name: "category",
content: metadata.category
}),
(0, _meta.Meta)({
name: "classification",
content: metadata.classification
}),
...metadata.other ? Object.entries(metadata.other).map(([name, content])=>(0, _meta.Meta)({
name,
content: Array.isArray(content) ? content.join(",") : content
})) : []
]);
}
function ItunesMeta({ itunes }) {
if (!itunes) return null;
const { appId, appArgument } = itunes;
let content = `app-id=${appId}`;
if (appArgument) {
content += `, app-argument=${appArgument}`;
}
return /*#__PURE__*/ _react.default.createElement("meta", {
name: "apple-itunes-app",
content: content
});
}
const formatDetectionKeys = [
"telephone",
"date",
"address",
"email",
"url"
];
function FormatDetectionMeta({ formatDetection }) {
if (!formatDetection) return null;
let content = "";
for (const key of formatDetectionKeys){
if (key in formatDetection) {
if (content) content += ", ";
content += `${key}=no`;
}
}
return /*#__PURE__*/ _react.default.createElement("meta", {
name: "format-detection",
content: content
});
}
function AppleWebAppMeta({ appleWebApp }) {
if (!appleWebApp) return null;
const { capable, title, startupImage, statusBarStyle } = appleWebApp;
return (0, _meta.MetaFilter)([
capable ? (0, _meta.Meta)({
name: "apple-mobile-web-app-capable",
content: "yes"
}) : null,
(0, _meta.Meta)({
name: "apple-mobile-web-app-title",
content: title
}),
startupImage ? startupImage.map((image)=>/*#__PURE__*/ _react.default.createElement("link", {
href: image.url,
media: image.media,
rel: "apple-touch-startup-image"
})) : null,
statusBarStyle ? (0, _meta.Meta)({
name: "apple-mobile-web-app-status-bar-style",
content: statusBarStyle
}) : null
]);
}
function VerificationMeta({ verification }) {
if (!verification) return null;
return (0, _meta.MetaFilter)([
(0, _meta.MultiMeta)({
namePrefix: "google-site-verification",
contents: verification.google
}),
(0, _meta.MultiMeta)({
namePrefix: "y_key",
contents: verification.yahoo
}),
(0, _meta.MultiMeta)({
namePrefix: "yandex-verification",
contents: verification.yandex
}),
(0, _meta.MultiMeta)({
namePrefix: "me",
contents: verification.me
}),
...verification.other ? Object.entries(verification.other).map(([key, value])=>(0, _meta.MultiMeta)({
namePrefix: key,
contents: value
})) : []
]);
}
//# sourceMappingURL=basic.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/generate/basic.tsx"],"names":["BasicMetadata","ItunesMeta","FormatDetectionMeta","AppleWebAppMeta","VerificationMeta","metadata","MetaFilter","meta","charSet","title","absolute","Meta","name","content","description","applicationName","authors","map","author","url","link","rel","href","toString","manifest","generator","keywords","join","referrer","themeColor","color","media","colorScheme","viewport","creator","publisher","robots","basic","googleBot","abstract","archives","archive","assets","asset","bookmarks","bookmark","category","classification","other","Object","entries","Array","isArray","itunes","appId","appArgument","formatDetectionKeys","formatDetection","key","appleWebApp","capable","startupImage","statusBarStyle","image","verification","MultiMeta","namePrefix","contents","google","yahoo","yandex","me","value"],"mappings":"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"}

View File

@@ -0,0 +1,5 @@
import type { ResolvedMetadata } from '../types/metadata-interface';
import React from 'react';
export declare function IconsMetadata({ icons }: {
icons: ResolvedMetadata['icons'];
}): React.JSX.Element[][] | null;

65
node_modules/next/dist/lib/metadata/generate/icons.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "IconsMetadata", {
enumerable: true,
get: function() {
return IconsMetadata;
}
});
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _meta = require("./meta");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function IconDescriptorLink({ icon }) {
const { url, rel = "icon", ...props } = icon;
return /*#__PURE__*/ _react.default.createElement("link", {
rel: rel,
href: url.toString(),
...props
});
}
function IconLink({ rel, icon }) {
if (typeof icon === "object" && !(icon instanceof URL)) {
if (!icon.rel && rel) icon.rel = rel;
return IconDescriptorLink({
icon
});
} else {
const href = icon.toString();
return /*#__PURE__*/ _react.default.createElement("link", {
rel: rel,
href: href
});
}
}
function IconsMetadata({ icons }) {
if (!icons) return null;
const shortcutList = icons.shortcut;
const iconList = icons.icon;
const appleList = icons.apple;
const otherList = icons.other;
return (0, _meta.MetaFilter)([
shortcutList ? shortcutList.map((icon)=>IconLink({
rel: "shortcut icon",
icon
})) : null,
iconList ? iconList.map((icon)=>IconLink({
rel: "icon",
icon
})) : null,
appleList ? appleList.map((icon)=>IconLink({
rel: "apple-touch-icon",
icon
})) : null,
otherList ? otherList.map((icon)=>IconDescriptorLink({
icon
})) : null
]);
}
//# sourceMappingURL=icons.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/generate/icons.tsx"],"names":["IconsMetadata","IconDescriptorLink","icon","url","rel","props","link","href","toString","IconLink","URL","icons","shortcutList","shortcut","iconList","appleList","apple","otherList","other","MetaFilter","map"],"mappings":";;;;+BAsBgBA;;;eAAAA;;;8DAnBE;sBACS;;;;;;AAE3B,SAASC,mBAAmB,EAAEC,IAAI,EAA4B;IAC5D,MAAM,EAAEC,GAAG,EAAEC,MAAM,MAAM,EAAE,GAAGC,OAAO,GAAGH;IAExC,qBAAO,6BAACI;QAAKF,KAAKA;QAAKG,MAAMJ,IAAIK,QAAQ;QAAK,GAAGH,KAAK;;AACxD;AAEA,SAASI,SAAS,EAAEL,GAAG,EAAEF,IAAI,EAAgC;IAC3D,IAAI,OAAOA,SAAS,YAAY,CAAEA,CAAAA,gBAAgBQ,GAAE,GAAI;QACtD,IAAI,CAACR,KAAKE,GAAG,IAAIA,KAAKF,KAAKE,GAAG,GAAGA;QACjC,OAAOH,mBAAmB;YAAEC;QAAK;IACnC,OAAO;QACL,MAAMK,OAAOL,KAAKM,QAAQ;QAC1B,qBAAO,6BAACF;YAAKF,KAAKA;YAAKG,MAAMA;;IAC/B;AACF;AAEO,SAASP,cAAc,EAAEW,KAAK,EAAwC;IAC3E,IAAI,CAACA,OAAO,OAAO;IAEnB,MAAMC,eAAeD,MAAME,QAAQ;IACnC,MAAMC,WAAWH,MAAMT,IAAI;IAC3B,MAAMa,YAAYJ,MAAMK,KAAK;IAC7B,MAAMC,YAAYN,MAAMO,KAAK;IAE7B,OAAOC,IAAAA,gBAAU,EAAC;QAChBP,eACIA,aAAaQ,GAAG,CAAC,CAAClB,OAASO,SAAS;gBAAEL,KAAK;gBAAiBF;YAAK,MACjE;QACJY,WAAWA,SAASM,GAAG,CAAC,CAAClB,OAASO,SAAS;gBAAEL,KAAK;gBAAQF;YAAK,MAAM;QACrEa,YACIA,UAAUK,GAAG,CAAC,CAAClB,OAASO,SAAS;gBAAEL,KAAK;gBAAoBF;YAAK,MACjE;QACJe,YAAYA,UAAUG,GAAG,CAAC,CAAClB,OAASD,mBAAmB;gBAAEC;YAAK,MAAM;KACrE;AACH"}

16
node_modules/next/dist/lib/metadata/generate/meta.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import React from 'react';
export declare function Meta({ name, property, content, media, }: {
name?: string;
property?: string;
media?: string;
content: string | number | URL | null | undefined;
}): React.ReactElement | null;
export declare function MetaFilter<T extends {} | {}[]>(items: (T | null)[]): NonNullable<T>[];
type ExtendMetaContent = Record<string, undefined | string | URL | number | boolean | null | undefined>;
type MultiMetaContent = (ExtendMetaContent | string | URL | number)[] | null | undefined;
export declare function MultiMeta({ propertyPrefix, namePrefix, contents, }: {
propertyPrefix?: string;
namePrefix?: string;
contents?: MultiMetaContent | null;
}): NonNullable<React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[]>[] | null;
export {};

115
node_modules/next/dist/lib/metadata/generate/meta.js generated vendored Normal file
View File

@@ -0,0 +1,115 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
Meta: null,
MetaFilter: null,
MultiMeta: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Meta: function() {
return Meta;
},
MetaFilter: function() {
return MetaFilter;
},
MultiMeta: function() {
return MultiMeta;
}
});
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _nonnullable = require("../../non-nullable");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function Meta({ name, property, content, media }) {
if (typeof content !== "undefined" && content !== null && content !== "") {
return /*#__PURE__*/ _react.default.createElement("meta", {
...name ? {
name
} : {
property
},
...media ? {
media
} : undefined,
content: typeof content === "string" ? content : content.toString()
});
}
return null;
}
function MetaFilter(items) {
const acc = [];
for (const item of items){
if (Array.isArray(item)) {
acc.push(...item.filter(_nonnullable.nonNullable));
} else if ((0, _nonnullable.nonNullable)(item)) {
acc.push(item);
}
}
return acc;
}
function camelToSnake(camelCaseStr) {
return camelCaseStr.replace(/([A-Z])/g, function(match) {
return "_" + match.toLowerCase();
});
}
function getMetaKey(prefix, key) {
// Use `twitter:image` and `og:image` instead of `twitter:image:url` and `og:image:url`
// to be more compatible as it's a more common format
if ((prefix === "og:image" || prefix === "twitter:image") && key === "url") {
return prefix;
}
if (prefix.startsWith("og:") || prefix.startsWith("twitter:")) {
key = camelToSnake(key);
}
return prefix + ":" + key;
}
function ExtendMeta({ content, namePrefix, propertyPrefix }) {
if (!content) return null;
return MetaFilter(Object.entries(content).map(([k, v])=>{
return typeof v === "undefined" ? null : Meta({
...propertyPrefix && {
property: getMetaKey(propertyPrefix, k)
},
...namePrefix && {
name: getMetaKey(namePrefix, k)
},
content: typeof v === "string" ? v : v == null ? void 0 : v.toString()
});
}));
}
function MultiMeta({ propertyPrefix, namePrefix, contents }) {
if (typeof contents === "undefined" || contents === null) {
return null;
}
return MetaFilter(contents.map((content)=>{
if (typeof content === "string" || typeof content === "number" || content instanceof URL) {
return Meta({
...propertyPrefix ? {
property: propertyPrefix
} : {
name: namePrefix
},
content
});
} else {
return ExtendMeta({
namePrefix,
propertyPrefix,
content
});
}
}));
}
//# sourceMappingURL=meta.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/generate/meta.tsx"],"names":["Meta","MetaFilter","MultiMeta","name","property","content","media","meta","undefined","toString","items","acc","item","Array","isArray","push","filter","nonNullable","camelToSnake","camelCaseStr","replace","match","toLowerCase","getMetaKey","prefix","key","startsWith","ExtendMeta","namePrefix","propertyPrefix","Object","entries","map","k","v","contents","URL"],"mappings":";;;;;;;;;;;;;;;;IAGgBA,IAAI;eAAJA;;IAuBAC,UAAU;eAAVA;;IAgEAC,SAAS;eAATA;;;8DA1FE;6BACU;;;;;;AAErB,SAASF,KAAK,EACnBG,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,KAAK,EAMN;IACC,IAAI,OAAOD,YAAY,eAAeA,YAAY,QAAQA,YAAY,IAAI;QACxE,qBACE,6BAACE;YACE,GAAIJ,OAAO;gBAAEA;YAAK,IAAI;gBAAEC;YAAS,CAAC;YAClC,GAAIE,QAAQ;gBAAEA;YAAM,IAAIE,SAAS;YAClCH,SAAS,OAAOA,YAAY,WAAWA,UAAUA,QAAQI,QAAQ;;IAGvE;IACA,OAAO;AACT;AAEO,SAASR,WACdS,KAAmB;IAEnB,MAAMC,MAAwB,EAAE;IAChC,KAAK,MAAMC,QAAQF,MAAO;QACxB,IAAIG,MAAMC,OAAO,CAACF,OAAO;YACvBD,IAAII,IAAI,IAAIH,KAAKI,MAAM,CAACC,wBAAW;QACrC,OAAO,IAAIA,IAAAA,wBAAW,EAACL,OAAO;YAC5BD,IAAII,IAAI,CAACH;QACX;IACF;IACA,OAAOD;AACT;AAWA,SAASO,aAAaC,YAAoB;IACxC,OAAOA,aAAaC,OAAO,CAAC,YAAY,SAAUC,KAAK;QACrD,OAAO,MAAMA,MAAMC,WAAW;IAChC;AACF;AAEA,SAASC,WAAWC,MAAc,EAAEC,GAAW;IAC7C,uFAAuF;IACvF,qDAAqD;IACrD,IAAI,AAACD,CAAAA,WAAW,cAAcA,WAAW,eAAc,KAAMC,QAAQ,OAAO;QAC1E,OAAOD;IACT;IACA,IAAIA,OAAOE,UAAU,CAAC,UAAUF,OAAOE,UAAU,CAAC,aAAa;QAC7DD,MAAMP,aAAaO;IACrB;IACA,OAAOD,SAAS,MAAMC;AACxB;AAEA,SAASE,WAAW,EAClBtB,OAAO,EACPuB,UAAU,EACVC,cAAc,EAKf;IACC,IAAI,CAACxB,SAAS,OAAO;IACrB,OAAOJ,WACL6B,OAAOC,OAAO,CAAC1B,SAAS2B,GAAG,CAAC,CAAC,CAACC,GAAGC,EAAE;QACjC,OAAO,OAAOA,MAAM,cAChB,OACAlC,KAAK;YACH,GAAI6B,kBAAkB;gBAAEzB,UAAUmB,WAAWM,gBAAgBI;YAAG,CAAC;YACjE,GAAIL,cAAc;gBAAEzB,MAAMoB,WAAWK,YAAYK;YAAG,CAAC;YACrD5B,SAAS,OAAO6B,MAAM,WAAWA,IAAIA,qBAAAA,EAAGzB,QAAQ;QAClD;IACN;AAEJ;AAEO,SAASP,UAAU,EACxB2B,cAAc,EACdD,UAAU,EACVO,QAAQ,EAKT;IACC,IAAI,OAAOA,aAAa,eAAeA,aAAa,MAAM;QACxD,OAAO;IACT;IAEA,OAAOlC,WACLkC,SAASH,GAAG,CAAC,CAAC3B;QACZ,IACE,OAAOA,YAAY,YACnB,OAAOA,YAAY,YACnBA,mBAAmB+B,KACnB;YACA,OAAOpC,KAAK;gBACV,GAAI6B,iBACA;oBAAEzB,UAAUyB;gBAAe,IAC3B;oBAAE1B,MAAMyB;gBAAW,CAAC;gBACxBvB;YACF;QACF,OAAO;YACL,OAAOsB,WAAW;gBAChBC;gBACAC;gBACAxB;YACF;QACF;IACF;AAEJ"}

View File

@@ -0,0 +1,11 @@
/// <reference types="react" />
import type { ResolvedMetadata } from '../types/metadata-interface';
export declare function OpenGraphMetadata({ openGraph, }: {
openGraph: ResolvedMetadata['openGraph'];
}): NonNullable<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | NonNullable<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[]>[]>[] | null;
export declare function TwitterMetadata({ twitter, }: {
twitter: ResolvedMetadata['twitter'];
}): NonNullable<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | (import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null)[] | NonNullable<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[]>[]>[] | null;
export declare function AppLinksMeta({ appLinks, }: {
appLinks: ResolvedMetadata['appLinks'];
}): NonNullable<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[]>[][] | null;

View File

@@ -0,0 +1,474 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
OpenGraphMetadata: null,
TwitterMetadata: null,
AppLinksMeta: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
OpenGraphMetadata: function() {
return OpenGraphMetadata;
},
TwitterMetadata: function() {
return TwitterMetadata;
},
AppLinksMeta: function() {
return AppLinksMeta;
}
});
const _meta = require("./meta");
function OpenGraphMetadata({ openGraph }) {
var _openGraph_title, _openGraph_url, _openGraph_ttl;
if (!openGraph) {
return null;
}
let typedOpenGraph;
if ("type" in openGraph) {
const openGraphType = openGraph.type;
switch(openGraphType){
case "website":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "website"
})
];
break;
case "article":
var _openGraph_publishedTime, _openGraph_modifiedTime, _openGraph_expirationTime;
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "article"
}),
(0, _meta.Meta)({
property: "article:published_time",
content: (_openGraph_publishedTime = openGraph.publishedTime) == null ? void 0 : _openGraph_publishedTime.toString()
}),
(0, _meta.Meta)({
property: "article:modified_time",
content: (_openGraph_modifiedTime = openGraph.modifiedTime) == null ? void 0 : _openGraph_modifiedTime.toString()
}),
(0, _meta.Meta)({
property: "article:expiration_time",
content: (_openGraph_expirationTime = openGraph.expirationTime) == null ? void 0 : _openGraph_expirationTime.toString()
}),
(0, _meta.MultiMeta)({
propertyPrefix: "article:author",
contents: openGraph.authors
}),
(0, _meta.Meta)({
property: "article:section",
content: openGraph.section
}),
(0, _meta.MultiMeta)({
propertyPrefix: "article:tag",
contents: openGraph.tags
})
];
break;
case "book":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "book"
}),
(0, _meta.Meta)({
property: "book:isbn",
content: openGraph.isbn
}),
(0, _meta.Meta)({
property: "book:release_date",
content: openGraph.releaseDate
}),
(0, _meta.MultiMeta)({
propertyPrefix: "book:author",
contents: openGraph.authors
}),
(0, _meta.MultiMeta)({
propertyPrefix: "book:tag",
contents: openGraph.tags
})
];
break;
case "profile":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "profile"
}),
(0, _meta.Meta)({
property: "profile:first_name",
content: openGraph.firstName
}),
(0, _meta.Meta)({
property: "profile:last_name",
content: openGraph.lastName
}),
(0, _meta.Meta)({
property: "profile:username",
content: openGraph.username
}),
(0, _meta.Meta)({
property: "profile:gender",
content: openGraph.gender
})
];
break;
case "music.song":
var _openGraph_duration;
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "music.song"
}),
(0, _meta.Meta)({
property: "music:duration",
content: (_openGraph_duration = openGraph.duration) == null ? void 0 : _openGraph_duration.toString()
}),
(0, _meta.MultiMeta)({
propertyPrefix: "music:album",
contents: openGraph.albums
}),
(0, _meta.MultiMeta)({
propertyPrefix: "music:musician",
contents: openGraph.musicians
})
];
break;
case "music.album":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "music.album"
}),
(0, _meta.MultiMeta)({
propertyPrefix: "music:song",
contents: openGraph.songs
}),
(0, _meta.MultiMeta)({
propertyPrefix: "music:musician",
contents: openGraph.musicians
}),
(0, _meta.Meta)({
property: "music:release_date",
content: openGraph.releaseDate
})
];
break;
case "music.playlist":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "music.playlist"
}),
(0, _meta.MultiMeta)({
propertyPrefix: "music:song",
contents: openGraph.songs
}),
(0, _meta.MultiMeta)({
propertyPrefix: "music:creator",
contents: openGraph.creators
})
];
break;
case "music.radio_station":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "music.radio_station"
}),
(0, _meta.MultiMeta)({
propertyPrefix: "music:creator",
contents: openGraph.creators
})
];
break;
case "video.movie":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "video.movie"
}),
(0, _meta.MultiMeta)({
propertyPrefix: "video:actor",
contents: openGraph.actors
}),
(0, _meta.MultiMeta)({
propertyPrefix: "video:director",
contents: openGraph.directors
}),
(0, _meta.MultiMeta)({
propertyPrefix: "video:writer",
contents: openGraph.writers
}),
(0, _meta.Meta)({
property: "video:duration",
content: openGraph.duration
}),
(0, _meta.Meta)({
property: "video:release_date",
content: openGraph.releaseDate
}),
(0, _meta.MultiMeta)({
propertyPrefix: "video:tag",
contents: openGraph.tags
})
];
break;
case "video.episode":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "video.episode"
}),
(0, _meta.MultiMeta)({
propertyPrefix: "video:actor",
contents: openGraph.actors
}),
(0, _meta.MultiMeta)({
propertyPrefix: "video:director",
contents: openGraph.directors
}),
(0, _meta.MultiMeta)({
propertyPrefix: "video:writer",
contents: openGraph.writers
}),
(0, _meta.Meta)({
property: "video:duration",
content: openGraph.duration
}),
(0, _meta.Meta)({
property: "video:release_date",
content: openGraph.releaseDate
}),
(0, _meta.MultiMeta)({
propertyPrefix: "video:tag",
contents: openGraph.tags
}),
(0, _meta.Meta)({
property: "video:series",
content: openGraph.series
})
];
break;
case "video.tv_show":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "video.tv_show"
})
];
break;
case "video.other":
typedOpenGraph = [
(0, _meta.Meta)({
property: "og:type",
content: "video.other"
})
];
break;
default:
const _exhaustiveCheck = openGraphType;
throw new Error(`Invalid OpenGraph type: ${_exhaustiveCheck}`);
}
}
return (0, _meta.MetaFilter)([
(0, _meta.Meta)({
property: "og:determiner",
content: openGraph.determiner
}),
(0, _meta.Meta)({
property: "og:title",
content: (_openGraph_title = openGraph.title) == null ? void 0 : _openGraph_title.absolute
}),
(0, _meta.Meta)({
property: "og:description",
content: openGraph.description
}),
(0, _meta.Meta)({
property: "og:url",
content: (_openGraph_url = openGraph.url) == null ? void 0 : _openGraph_url.toString()
}),
(0, _meta.Meta)({
property: "og:site_name",
content: openGraph.siteName
}),
(0, _meta.Meta)({
property: "og:locale",
content: openGraph.locale
}),
(0, _meta.Meta)({
property: "og:country_name",
content: openGraph.countryName
}),
(0, _meta.Meta)({
property: "og:ttl",
content: (_openGraph_ttl = openGraph.ttl) == null ? void 0 : _openGraph_ttl.toString()
}),
(0, _meta.MultiMeta)({
propertyPrefix: "og:image",
contents: openGraph.images
}),
(0, _meta.MultiMeta)({
propertyPrefix: "og:video",
contents: openGraph.videos
}),
(0, _meta.MultiMeta)({
propertyPrefix: "og:audio",
contents: openGraph.audio
}),
(0, _meta.MultiMeta)({
propertyPrefix: "og:email",
contents: openGraph.emails
}),
(0, _meta.MultiMeta)({
propertyPrefix: "og:phone_number",
contents: openGraph.phoneNumbers
}),
(0, _meta.MultiMeta)({
propertyPrefix: "og:fax_number",
contents: openGraph.faxNumbers
}),
(0, _meta.MultiMeta)({
propertyPrefix: "og:locale:alternate",
contents: openGraph.alternateLocale
}),
...typedOpenGraph ? typedOpenGraph : []
]);
}
function TwitterAppItem({ app, type }) {
var _app_url_type, _app_url;
return [
(0, _meta.Meta)({
name: `twitter:app:name:${type}`,
content: app.name
}),
(0, _meta.Meta)({
name: `twitter:app:id:${type}`,
content: app.id[type]
}),
(0, _meta.Meta)({
name: `twitter:app:url:${type}`,
content: (_app_url = app.url) == null ? void 0 : (_app_url_type = _app_url[type]) == null ? void 0 : _app_url_type.toString()
})
];
}
function TwitterMetadata({ twitter }) {
var _twitter_title;
if (!twitter) return null;
const { card } = twitter;
return (0, _meta.MetaFilter)([
(0, _meta.Meta)({
name: "twitter:card",
content: card
}),
(0, _meta.Meta)({
name: "twitter:site",
content: twitter.site
}),
(0, _meta.Meta)({
name: "twitter:site:id",
content: twitter.siteId
}),
(0, _meta.Meta)({
name: "twitter:creator",
content: twitter.creator
}),
(0, _meta.Meta)({
name: "twitter:creator:id",
content: twitter.creatorId
}),
(0, _meta.Meta)({
name: "twitter:title",
content: (_twitter_title = twitter.title) == null ? void 0 : _twitter_title.absolute
}),
(0, _meta.Meta)({
name: "twitter:description",
content: twitter.description
}),
(0, _meta.MultiMeta)({
namePrefix: "twitter:image",
contents: twitter.images
}),
...card === "player" ? twitter.players.flatMap((player)=>[
(0, _meta.Meta)({
name: "twitter:player",
content: player.playerUrl.toString()
}),
(0, _meta.Meta)({
name: "twitter:player:stream",
content: player.streamUrl.toString()
}),
(0, _meta.Meta)({
name: "twitter:player:width",
content: player.width
}),
(0, _meta.Meta)({
name: "twitter:player:height",
content: player.height
})
]) : [],
...card === "app" ? [
TwitterAppItem({
app: twitter.app,
type: "iphone"
}),
TwitterAppItem({
app: twitter.app,
type: "ipad"
}),
TwitterAppItem({
app: twitter.app,
type: "googleplay"
})
] : []
]);
}
function AppLinksMeta({ appLinks }) {
if (!appLinks) return null;
return (0, _meta.MetaFilter)([
(0, _meta.MultiMeta)({
propertyPrefix: "al:ios",
contents: appLinks.ios
}),
(0, _meta.MultiMeta)({
propertyPrefix: "al:iphone",
contents: appLinks.iphone
}),
(0, _meta.MultiMeta)({
propertyPrefix: "al:ipad",
contents: appLinks.ipad
}),
(0, _meta.MultiMeta)({
propertyPrefix: "al:android",
contents: appLinks.android
}),
(0, _meta.MultiMeta)({
propertyPrefix: "al:windows_phone",
contents: appLinks.windows_phone
}),
(0, _meta.MultiMeta)({
propertyPrefix: "al:windows",
contents: appLinks.windows
}),
(0, _meta.MultiMeta)({
propertyPrefix: "al:windows_universal",
contents: appLinks.windows_universal
}),
(0, _meta.MultiMeta)({
propertyPrefix: "al:web",
contents: appLinks.web
})
]);
}
//# sourceMappingURL=opengraph.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
declare function resolveArray<T>(value: T | T[]): T[];
declare function resolveAsArrayOrUndefined<T>(value: T | T[] | undefined | null): T extends undefined | null ? undefined : T[];
export { resolveAsArrayOrUndefined, resolveArray };

38
node_modules/next/dist/lib/metadata/generate/utils.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
resolveAsArrayOrUndefined: null,
resolveArray: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
resolveAsArrayOrUndefined: function() {
return resolveAsArrayOrUndefined;
},
resolveArray: function() {
return resolveArray;
}
});
function resolveArray(value) {
if (Array.isArray(value)) {
return value;
}
return [
value
];
}
function resolveAsArrayOrUndefined(value) {
if (typeof value === "undefined" || value === null) {
return undefined;
}
return resolveArray(value);
}
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/generate/utils.ts"],"names":["resolveAsArrayOrUndefined","resolveArray","value","Array","isArray","undefined"],"mappings":";;;;;;;;;;;;;;;IAgBSA,yBAAyB;eAAzBA;;IAA2BC,YAAY;eAAZA;;;AAhBpC,SAASA,aAAgBC,KAAc;IACrC,IAAIC,MAAMC,OAAO,CAACF,QAAQ;QACxB,OAAOA;IACT;IACA,OAAO;QAACA;KAAM;AAChB;AAEA,SAASF,0BACPE,KAAiC;IAEjC,IAAI,OAAOA,UAAU,eAAeA,UAAU,MAAM;QAClD,OAAOG;IACT;IACA,OAAOJ,aAAaC;AACtB"}

View File

@@ -0,0 +1,18 @@
/**
* Fill the dynamic segment in the metadata route
*
* Example:
* fillMetadataSegment('/a/[slug]', { params: { slug: 'b' } }, 'open-graph') -> '/a/b/open-graph'
*
*/
export declare function fillMetadataSegment(segment: string, params: any, imageSegment: string): string;
/**
* Map metadata page key to the corresponding route
*
* static file page key: /app/robots.txt -> /robots.xml -> /robots.txt/route
* dynamic route page key: /app/robots.tsx -> /robots -> /robots.txt/route
*
* @param page
* @returns
*/
export declare function normalizeMetadataRoute(page: string): string;

View File

@@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
fillMetadataSegment: null,
normalizeMetadataRoute: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
fillMetadataSegment: function() {
return fillMetadataSegment;
},
normalizeMetadataRoute: function() {
return normalizeMetadataRoute;
}
});
const _ismetadataroute = require("./is-metadata-route");
const _path = /*#__PURE__*/ _interop_require_default(require("../../shared/lib/isomorphic/path"));
const _serverutils = require("../../server/server-utils");
const _routeregex = require("../../shared/lib/router/utils/route-regex");
const _hash = require("../../shared/lib/hash");
const _apppaths = require("../../shared/lib/router/utils/app-paths");
const _normalizepathsep = require("../../shared/lib/page-path/normalize-path-sep");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/*
* If there's special convention like (...) or @ in the page path,
* Give it a unique hash suffix to avoid conflicts
*
* e.g.
* /app/open-graph.tsx -> /open-graph/route
* /app/(post)/open-graph.tsx -> /open-graph/route-[0-9a-z]{6}
*/ function getMetadataRouteSuffix(page) {
let suffix = "";
if (page.includes("(") && page.includes(")") || page.includes("@")) {
suffix = (0, _hash.djb2Hash)(page).toString(36).slice(0, 6);
}
return suffix;
}
function fillMetadataSegment(segment, params, imageSegment) {
const pathname = (0, _apppaths.normalizeAppPath)(segment);
const routeRegex = (0, _routeregex.getNamedRouteRegex)(pathname, false);
const route = (0, _serverutils.interpolateDynamicPath)(pathname, params, routeRegex);
const suffix = getMetadataRouteSuffix(segment);
const routeSuffix = suffix ? `-${suffix}` : "";
const { name, ext } = _path.default.parse(imageSegment);
return (0, _normalizepathsep.normalizePathSep)(_path.default.join(route, `${name}${routeSuffix}${ext}`));
}
function normalizeMetadataRoute(page) {
if (!(0, _ismetadataroute.isMetadataRoute)(page)) {
return page;
}
let route = page;
let suffix = "";
if (page === "/robots") {
route += ".txt";
} else if (page === "/manifest") {
route += ".webmanifest";
} else if (page.endsWith("/sitemap")) {
route += ".xml";
} else {
// Remove the file extension, e.g. /route-path/robots.txt -> /route-path
const pathnamePrefix = page.slice(0, -(_path.default.basename(page).length + 1));
suffix = getMetadataRouteSuffix(pathnamePrefix);
}
// Support both /<metadata-route.ext> and custom routes /<metadata-route>/route.ts.
// If it's a metadata file route, we need to append /[id]/route to the page.
if (!route.endsWith("/route")) {
const { dir, name: baseName, ext } = _path.default.parse(route);
const isStaticRoute = (0, _ismetadataroute.isStaticMetadataRoute)(page);
route = _path.default.posix.join(dir, `${baseName}${suffix ? `-${suffix}` : ""}${ext}`, isStaticRoute ? "" : "[[...__metadata_id__]]", "route");
}
return route;
}
//# sourceMappingURL=get-metadata-route.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/metadata/get-metadata-route.ts"],"names":["fillMetadataSegment","normalizeMetadataRoute","getMetadataRouteSuffix","page","suffix","includes","djb2Hash","toString","slice","segment","params","imageSegment","pathname","normalizeAppPath","routeRegex","getNamedRouteRegex","route","interpolateDynamicPath","routeSuffix","name","ext","path","parse","normalizePathSep","join","isMetadataRoute","endsWith","pathnamePrefix","basename","length","dir","baseName","isStaticRoute","isStaticMetadataRoute","posix"],"mappings":";;;;;;;;;;;;;;;IAgCgBA,mBAAmB;eAAnBA;;IAyBAC,sBAAsB;eAAtBA;;;iCAzDuC;6DACtC;6BACsB;4BACJ;sBACV;0BACQ;kCACA;;;;;;AAEjC;;;;;;;CAOC,GACD,SAASC,uBAAuBC,IAAY;IAC1C,IAAIC,SAAS;IAEb,IAAI,AAACD,KAAKE,QAAQ,CAAC,QAAQF,KAAKE,QAAQ,CAAC,QAASF,KAAKE,QAAQ,CAAC,MAAM;QACpED,SAASE,IAAAA,cAAQ,EAACH,MAAMI,QAAQ,CAAC,IAAIC,KAAK,CAAC,GAAG;IAChD;IACA,OAAOJ;AACT;AASO,SAASJ,oBACdS,OAAe,EACfC,MAAW,EACXC,YAAoB;IAEpB,MAAMC,WAAWC,IAAAA,0BAAgB,EAACJ;IAClC,MAAMK,aAAaC,IAAAA,8BAAkB,EAACH,UAAU;IAChD,MAAMI,QAAQC,IAAAA,mCAAsB,EAACL,UAAUF,QAAQI;IACvD,MAAMV,SAASF,uBAAuBO;IACtC,MAAMS,cAAcd,SAAS,CAAC,CAAC,EAAEA,OAAO,CAAC,GAAG;IAE5C,MAAM,EAAEe,IAAI,EAAEC,GAAG,EAAE,GAAGC,aAAI,CAACC,KAAK,CAACX;IAEjC,OAAOY,IAAAA,kCAAgB,EAACF,aAAI,CAACG,IAAI,CAACR,OAAO,CAAC,EAAEG,KAAK,EAAED,YAAY,EAAEE,IAAI,CAAC;AACxE;AAWO,SAASnB,uBAAuBE,IAAY;IACjD,IAAI,CAACsB,IAAAA,gCAAe,EAACtB,OAAO;QAC1B,OAAOA;IACT;IACA,IAAIa,QAAQb;IACZ,IAAIC,SAAS;IACb,IAAID,SAAS,WAAW;QACtBa,SAAS;IACX,OAAO,IAAIb,SAAS,aAAa;QAC/Ba,SAAS;IACX,OAAO,IAAIb,KAAKuB,QAAQ,CAAC,aAAa;QACpCV,SAAS;IACX,OAAO;QACL,wEAAwE;QACxE,MAAMW,iBAAiBxB,KAAKK,KAAK,CAAC,GAAG,CAAEa,CAAAA,aAAI,CAACO,QAAQ,CAACzB,MAAM0B,MAAM,GAAG,CAAA;QACpEzB,SAASF,uBAAuByB;IAClC;IACA,mFAAmF;IACnF,4EAA4E;IAC5E,IAAI,CAACX,MAAMU,QAAQ,CAAC,WAAW;QAC7B,MAAM,EAAEI,GAAG,EAAEX,MAAMY,QAAQ,EAAEX,GAAG,EAAE,GAAGC,aAAI,CAACC,KAAK,CAACN;QAChD,MAAMgB,gBAAgBC,IAAAA,sCAAqB,EAAC9B;QAE5Ca,QAAQK,aAAI,CAACa,KAAK,CAACV,IAAI,CACrBM,KACA,CAAC,EAAEC,SAAS,EAAE3B,SAAS,CAAC,CAAC,EAAEA,OAAO,CAAC,GAAG,GAAG,EAAEgB,IAAI,CAAC,EAChDY,gBAAgB,KAAK,0BACrB;IAEJ;IAEA,OAAOhB;AACT"}

View File

@@ -0,0 +1,26 @@
export declare const STATIC_METADATA_IMAGES: {
readonly icon: {
readonly filename: "icon";
readonly extensions: readonly ["ico", "jpg", "jpeg", "png", "svg"];
};
readonly apple: {
readonly filename: "apple-icon";
readonly extensions: readonly ["jpg", "jpeg", "png"];
};
readonly favicon: {
readonly filename: "favicon";
readonly extensions: readonly ["ico"];
};
readonly openGraph: {
readonly filename: "opengraph-image";
readonly extensions: readonly ["jpg", "jpeg", "png", "gif"];
};
readonly twitter: {
readonly filename: "twitter-image";
readonly extensions: readonly ["jpg", "jpeg", "png", "gif"];
};
};
export declare function isMetadataRouteFile(appDirRelativePath: string, pageExtensions: string[], withExtension: boolean): boolean;
export declare function isStaticMetadataRouteFile(appDirRelativePath: string): boolean;
export declare function isStaticMetadataRoute(page: string): boolean;
export declare function isMetadataRoute(route: string): boolean;

View File

@@ -0,0 +1,115 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
STATIC_METADATA_IMAGES: null,
isMetadataRouteFile: null,
isStaticMetadataRouteFile: null,
isStaticMetadataRoute: null,
isMetadataRoute: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
STATIC_METADATA_IMAGES: function() {
return STATIC_METADATA_IMAGES;
},
isMetadataRouteFile: function() {
return isMetadataRouteFile;
},
isStaticMetadataRouteFile: function() {
return isStaticMetadataRouteFile;
},
isStaticMetadataRoute: function() {
return isStaticMetadataRoute;
},
isMetadataRoute: function() {
return isMetadataRoute;
}
});
const _normalizepathsep = require("../../shared/lib/page-path/normalize-path-sep");
const STATIC_METADATA_IMAGES = {
icon: {
filename: "icon",
extensions: [
"ico",
"jpg",
"jpeg",
"png",
"svg"
]
},
apple: {
filename: "apple-icon",
extensions: [
"jpg",
"jpeg",
"png"
]
},
favicon: {
filename: "favicon",
extensions: [
"ico"
]
},
openGraph: {
filename: "opengraph-image",
extensions: [
"jpg",
"jpeg",
"png",
"gif"
]
},
twitter: {
filename: "twitter-image",
extensions: [
"jpg",
"jpeg",
"png",
"gif"
]
}
};
// Match routes that are metadata routes, e.g. /sitemap.xml, /favicon.<ext>, /<icon>.<ext>, etc.
// TODO-METADATA: support more metadata routes with more extensions
const defaultExtensions = [
"js",
"jsx",
"ts",
"tsx"
];
const getExtensionRegexString = (extensions)=>`(?:${extensions.join("|")})`;
function isMetadataRouteFile(appDirRelativePath, pageExtensions, withExtension) {
const metadataRouteFilesRegex = [
new RegExp(`^[\\\\/]robots${withExtension ? `\\.${getExtensionRegexString(pageExtensions.concat("txt"))}$` : ""}`),
new RegExp(`^[\\\\/]manifest${withExtension ? `\\.${getExtensionRegexString(pageExtensions.concat("webmanifest", "json"))}$` : ""}`),
new RegExp(`^[\\\\/]favicon\\.ico$`),
new RegExp(`[\\\\/]sitemap${withExtension ? `\\.${getExtensionRegexString(pageExtensions.concat("xml"))}$` : ""}`),
new RegExp(`[\\\\/]${STATIC_METADATA_IMAGES.icon.filename}\\d?${withExtension ? `\\.${getExtensionRegexString(pageExtensions.concat(STATIC_METADATA_IMAGES.icon.extensions))}$` : ""}`),
new RegExp(`[\\\\/]${STATIC_METADATA_IMAGES.apple.filename}\\d?${withExtension ? `\\.${getExtensionRegexString(pageExtensions.concat(STATIC_METADATA_IMAGES.apple.extensions))}$` : ""}`),
new RegExp(`[\\\\/]${STATIC_METADATA_IMAGES.openGraph.filename}\\d?${withExtension ? `\\.${getExtensionRegexString(pageExtensions.concat(STATIC_METADATA_IMAGES.openGraph.extensions))}$` : ""}`),
new RegExp(`[\\\\/]${STATIC_METADATA_IMAGES.twitter.filename}\\d?${withExtension ? `\\.${getExtensionRegexString(pageExtensions.concat(STATIC_METADATA_IMAGES.twitter.extensions))}$` : ""}`)
];
const normalizedAppDirRelativePath = (0, _normalizepathsep.normalizePathSep)(appDirRelativePath);
return metadataRouteFilesRegex.some((r)=>r.test(normalizedAppDirRelativePath));
}
function isStaticMetadataRouteFile(appDirRelativePath) {
return isMetadataRouteFile(appDirRelativePath, [], true);
}
function isStaticMetadataRoute(page) {
return page === "/robots" || page === "/manifest" || isStaticMetadataRouteFile(page);
}
function isMetadataRoute(route) {
let page = route.replace(/^\/?app\//, "").replace(/\/route$/, "");
if (page[0] !== "/") page = "/" + page;
return !page.endsWith("/page") && isMetadataRouteFile(page, defaultExtensions, false);
}
//# sourceMappingURL=is-metadata-route.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/metadata/is-metadata-route.ts"],"names":["STATIC_METADATA_IMAGES","isMetadataRouteFile","isStaticMetadataRouteFile","isStaticMetadataRoute","isMetadataRoute","icon","filename","extensions","apple","favicon","openGraph","twitter","defaultExtensions","getExtensionRegexString","join","appDirRelativePath","pageExtensions","withExtension","metadataRouteFilesRegex","RegExp","concat","normalizedAppDirRelativePath","normalizePathSep","some","r","test","page","route","replace","endsWith"],"mappings":"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"}

13
node_modules/next/dist/lib/metadata/metadata.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import type { GetDynamicParamFromSegment } from '../../server/app-render/app-render';
import type { LoaderTree } from '../../server/lib/app-dir-module';
import React from 'react';
export declare function createMetadataComponents({ tree, pathname, searchParams, getDynamicParamFromSegment, appUsingSizeAdjust, errorType, }: {
tree: LoaderTree;
pathname: string;
searchParams: {
[key: string]: any;
};
getDynamicParamFromSegment: GetDynamicParamFromSegment;
appUsingSizeAdjust: boolean;
errorType?: 'not-found' | 'redirect';
}): [React.ComponentType, React.ComponentType];

132
node_modules/next/dist/lib/metadata/metadata.js generated vendored Normal file
View File

@@ -0,0 +1,132 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createMetadataComponents", {
enumerable: true,
get: function() {
return createMetadataComponents;
}
});
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _basic = require("./generate/basic");
const _alternate = require("./generate/alternate");
const _opengraph = require("./generate/opengraph");
const _icons = require("./generate/icons");
const _resolvemetadata = require("./resolve-metadata");
const _meta = require("./generate/meta");
const _defaultmetadata = require("./default-metadata");
const _notfound = require("../../client/components/not-found");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function createMetadataComponents({ tree, pathname, searchParams, getDynamicParamFromSegment, appUsingSizeAdjust, errorType }) {
const metadataContext = {
pathname
};
let resolve;
// Only use promise.resolve here to avoid unhandled rejections
const metadataErrorResolving = new Promise((res)=>{
resolve = res;
});
async function MetadataTree() {
const defaultMetadata = (0, _defaultmetadata.createDefaultMetadata)();
let metadata = defaultMetadata;
let error;
const errorMetadataItem = [
null,
null
];
const errorConvention = errorType === "redirect" ? undefined : errorType;
const [resolvedMetadata, resolvedError] = await (0, _resolvemetadata.resolveMetadata)({
tree,
parentParams: {},
metadataItems: [],
errorMetadataItem,
searchParams,
getDynamicParamFromSegment,
errorConvention,
metadataContext
});
if (!resolvedError) {
metadata = resolvedMetadata;
resolve(undefined);
} else {
error = resolvedError;
// If the error triggers in initial metadata resolving, re-resolve with proper error type.
// They'll be saved for flight data, when hydrates, it will replaces the SSR'd metadata with this.
// for not-found error: resolve not-found metadata
if (!errorType && (0, _notfound.isNotFoundError)(resolvedError)) {
const [notFoundMetadata, notFoundMetadataError] = await (0, _resolvemetadata.resolveMetadata)({
tree,
parentParams: {},
metadataItems: [],
errorMetadataItem,
searchParams,
getDynamicParamFromSegment,
errorConvention: "not-found",
metadataContext
});
metadata = notFoundMetadata;
error = notFoundMetadataError || error;
}
resolve(error);
}
const elements = (0, _meta.MetaFilter)([
(0, _basic.BasicMetadata)({
metadata
}),
(0, _alternate.AlternatesMetadata)({
alternates: metadata.alternates
}),
(0, _basic.ItunesMeta)({
itunes: metadata.itunes
}),
(0, _basic.FormatDetectionMeta)({
formatDetection: metadata.formatDetection
}),
(0, _basic.VerificationMeta)({
verification: metadata.verification
}),
(0, _basic.AppleWebAppMeta)({
appleWebApp: metadata.appleWebApp
}),
(0, _opengraph.OpenGraphMetadata)({
openGraph: metadata.openGraph
}),
(0, _opengraph.TwitterMetadata)({
twitter: metadata.twitter
}),
(0, _opengraph.AppLinksMeta)({
appLinks: metadata.appLinks
}),
(0, _icons.IconsMetadata)({
icons: metadata.icons
})
]);
if (appUsingSizeAdjust) elements.push(/*#__PURE__*/ _react.default.createElement("meta", {
name: "next-size-adjust"
}));
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, elements.map((el, index)=>{
return /*#__PURE__*/ _react.default.cloneElement(el, {
key: index
});
}));
}
async function MetadataOutlet() {
const error = await metadataErrorResolving;
if (error) {
throw error;
}
return null;
}
// @ts-expect-error async server components
return [
MetadataTree,
MetadataOutlet
];
}
//# sourceMappingURL=metadata.js.map

1
node_modules/next/dist/lib/metadata/metadata.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/metadata/metadata.tsx"],"names":["createMetadataComponents","tree","pathname","searchParams","getDynamicParamFromSegment","appUsingSizeAdjust","errorType","metadataContext","resolve","metadataErrorResolving","Promise","res","MetadataTree","defaultMetadata","createDefaultMetadata","metadata","error","errorMetadataItem","errorConvention","undefined","resolvedMetadata","resolvedError","resolveMetadata","parentParams","metadataItems","isNotFoundError","notFoundMetadata","notFoundMetadataError","elements","MetaFilter","BasicMetadata","AlternatesMetadata","alternates","ItunesMeta","itunes","FormatDetectionMeta","formatDetection","VerificationMeta","verification","AppleWebAppMeta","appleWebApp","OpenGraphMetadata","openGraph","TwitterMetadata","twitter","AppLinksMeta","appLinks","IconsMetadata","icons","push","meta","name","map","el","index","React","cloneElement","key","MetadataOutlet"],"mappings":";;;;+BA8BgBA;;;eAAAA;;;8DA3BE;uBAOX;2BAC4B;2BAK5B;uBACuB;iCACE;sBACL;iCAEW;0BACN;;;;;;AAQzB,SAASA,yBAAyB,EACvCC,IAAI,EACJC,QAAQ,EACRC,YAAY,EACZC,0BAA0B,EAC1BC,kBAAkB,EAClBC,SAAS,EAQV;IACC,MAAMC,kBAAkB;QACtBL;IACF;IAEA,IAAIM;IACJ,8DAA8D;IAC9D,MAAMC,yBAAyB,IAAIC,QAA2B,CAACC;QAC7DH,UAAUG;IACZ;IAEA,eAAeC;QACb,MAAMC,kBAAkBC,IAAAA,sCAAqB;QAC7C,IAAIC,WAAyCF;QAC7C,IAAIG;QACJ,MAAMC,oBAAkC;YAAC;YAAM;SAAK;QACpD,MAAMC,kBAAkBZ,cAAc,aAAaa,YAAYb;QAE/D,MAAM,CAACc,kBAAkBC,cAAc,GAAG,MAAMC,IAAAA,gCAAe,EAAC;YAC9DrB;YACAsB,cAAc,CAAC;YACfC,eAAe,EAAE;YACjBP;YACAd;YACAC;YACAc;YACAX;QACF;QACA,IAAI,CAACc,eAAe;YAClBN,WAAWK;YACXZ,QAAQW;QACV,OAAO;YACLH,QAAQK;YACR,0FAA0F;YAC1F,kGAAkG;YAClG,kDAAkD;YAClD,IAAI,CAACf,aAAamB,IAAAA,yBAAe,EAACJ,gBAAgB;gBAChD,MAAM,CAACK,kBAAkBC,sBAAsB,GAAG,MAAML,IAAAA,gCAAe,EACrE;oBACErB;oBACAsB,cAAc,CAAC;oBACfC,eAAe,EAAE;oBACjBP;oBACAd;oBACAC;oBACAc,iBAAiB;oBACjBX;gBACF;gBAEFQ,WAAWW;gBACXV,QAAQW,yBAAyBX;YACnC;YACAR,QAAQQ;QACV;QAEA,MAAMY,WAAWC,IAAAA,gBAAU,EAAC;YAC1BC,IAAAA,oBAAa,EAAC;gBAAEf;YAAS;YACzBgB,IAAAA,6BAAkB,EAAC;gBAAEC,YAAYjB,SAASiB,UAAU;YAAC;YACrDC,IAAAA,iBAAU,EAAC;gBAAEC,QAAQnB,SAASmB,MAAM;YAAC;YACrCC,IAAAA,0BAAmB,EAAC;gBAAEC,iBAAiBrB,SAASqB,eAAe;YAAC;YAChEC,IAAAA,uBAAgB,EAAC;gBAAEC,cAAcvB,SAASuB,YAAY;YAAC;YACvDC,IAAAA,sBAAe,EAAC;gBAAEC,aAAazB,SAASyB,WAAW;YAAC;YACpDC,IAAAA,4BAAiB,EAAC;gBAAEC,WAAW3B,SAAS2B,SAAS;YAAC;YAClDC,IAAAA,0BAAe,EAAC;gBAAEC,SAAS7B,SAAS6B,OAAO;YAAC;YAC5CC,IAAAA,uBAAY,EAAC;gBAAEC,UAAU/B,SAAS+B,QAAQ;YAAC;YAC3CC,IAAAA,oBAAa,EAAC;gBAAEC,OAAOjC,SAASiC,KAAK;YAAC;SACvC;QAED,IAAI3C,oBAAoBuB,SAASqB,IAAI,eAAC,6BAACC;YAAKC,MAAK;;QAEjD,qBACE,4DACGvB,SAASwB,GAAG,CAAC,CAACC,IAAIC;YACjB,qBAAOC,cAAK,CAACC,YAAY,CAACH,IAA0B;gBAAEI,KAAKH;YAAM;QACnE;IAGN;IAEA,eAAeI;QACb,MAAM1C,QAAQ,MAAMP;QACpB,IAAIO,OAAO;YACT,MAAMA;QACR;QACA,OAAO;IACT;IAEA,2CAA2C;IAC3C,OAAO;QAACJ;QAAc8C;KAAe;AACvC"}

View File

@@ -0,0 +1,59 @@
import type { Metadata, ResolvedMetadata, ResolvingMetadata } from './types/metadata-interface';
import type { GetDynamicParamFromSegment } from '../../server/app-render/app-render';
import type { ComponentsType } from '../../build/webpack/loaders/next-app-loader';
import type { MetadataContext } from './types/resolvers';
import { LoaderTree } from '../../server/lib/app-dir-module';
type StaticMetadata = Awaited<ReturnType<typeof resolveStaticMetadata>>;
type MetadataResolver = (_parent: ResolvingMetadata) => Metadata | Promise<Metadata>;
export type MetadataItems = [
Metadata | MetadataResolver | null,
StaticMetadata
][];
declare function resolveStaticMetadata(components: ComponentsType, props: any): Promise<{
icon: any[] | undefined;
apple: any[] | undefined;
openGraph: any[] | undefined;
twitter: any[] | undefined;
manifest: string | undefined;
} | null>;
export declare function collectMetadata({ tree, metadataItems, errorMetadataItem, props, route, errorConvention, }: {
tree: LoaderTree;
metadataItems: MetadataItems;
errorMetadataItem: MetadataItems[number];
props: any;
route: string;
errorConvention?: 'not-found';
}): Promise<void>;
export declare function resolveMetadataItems({ tree, parentParams, metadataItems, errorMetadataItem, treePrefix, getDynamicParamFromSegment, searchParams, errorConvention, }: {
tree: LoaderTree;
parentParams: {
[key: string]: any;
};
metadataItems: MetadataItems;
errorMetadataItem: MetadataItems[number];
/** Provided tree can be nested subtree, this argument says what is the path of such subtree */
treePrefix?: string[];
getDynamicParamFromSegment: GetDynamicParamFromSegment;
searchParams: {
[key: string]: any;
};
errorConvention: 'not-found' | undefined;
}): Promise<MetadataItems>;
export declare function accumulateMetadata(metadataItems: MetadataItems, metadataContext: MetadataContext): Promise<ResolvedMetadata>;
export declare function resolveMetadata({ tree, parentParams, metadataItems, errorMetadataItem, getDynamicParamFromSegment, searchParams, errorConvention, metadataContext, }: {
tree: LoaderTree;
parentParams: {
[key: string]: any;
};
metadataItems: MetadataItems;
errorMetadataItem: MetadataItems[number];
/** Provided tree can be nested subtree, this argument says what is the path of such subtree */
treePrefix?: string[];
getDynamicParamFromSegment: GetDynamicParamFromSegment;
searchParams: {
[key: string]: any;
};
errorConvention: 'not-found' | undefined;
metadataContext: MetadataContext;
}): Promise<[ResolvedMetadata, any]>;
export {};

428
node_modules/next/dist/lib/metadata/resolve-metadata.js generated vendored Normal file
View File

@@ -0,0 +1,428 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
collectMetadata: null,
resolveMetadataItems: null,
accumulateMetadata: null,
resolveMetadata: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
collectMetadata: function() {
return collectMetadata;
},
resolveMetadataItems: function() {
return resolveMetadataItems;
},
accumulateMetadata: function() {
return accumulateMetadata;
},
resolveMetadata: function() {
return resolveMetadata;
}
});
const _defaultmetadata = require("./default-metadata");
const _resolveopengraph = require("./resolvers/resolve-opengraph");
const _resolvetitle = require("./resolvers/resolve-title");
const _utils = require("./generate/utils");
const _clientreference = require("../client-reference");
const _appdirmodule = require("../../server/lib/app-dir-module");
const _interopdefault = require("../interop-default");
const _resolvebasics = require("./resolvers/resolve-basics");
const _resolveicons = require("./resolvers/resolve-icons");
const _tracer = require("../../server/lib/trace/tracer");
const _constants = require("../../server/lib/trace/constants");
const _constants1 = require("../../shared/lib/constants");
function hasIconsProperty(icons, prop) {
if (!icons) return false;
if (prop === "icon") {
// Detect if icons.icon will be presented, icons array and icons string will all be merged into icons.icon
return !!(typeof icons === "string" || icons instanceof URL || Array.isArray(icons) || prop in icons && icons[prop]);
} else {
// Detect if icons.apple will be presented, only icons.apple will be merged into icons.apple
return !!(typeof icons === "object" && prop in icons && icons[prop]);
}
}
function mergeStaticMetadata(source, target, staticFilesMetadata, metadataContext, titleTemplates) {
var _source_twitter, _source_openGraph;
if (!staticFilesMetadata) return;
const { icon, apple, openGraph, twitter, manifest } = staticFilesMetadata;
// file based metadata is specified and current level metadata icons is not specified
if (icon && !hasIconsProperty(source == null ? void 0 : source.icons, "icon") || apple && !hasIconsProperty(source == null ? void 0 : source.icons, "apple")) {
target.icons = {
icon: icon || [],
apple: apple || []
};
}
// file based metadata is specified and current level metadata twitter.images is not specified
if (twitter && !(source == null ? void 0 : (_source_twitter = source.twitter) == null ? void 0 : _source_twitter.hasOwnProperty("images"))) {
const resolvedTwitter = (0, _resolveopengraph.resolveTwitter)({
...target.twitter,
images: twitter
}, target.metadataBase, titleTemplates.twitter);
target.twitter = resolvedTwitter;
}
// file based metadata is specified and current level metadata openGraph.images is not specified
if (openGraph && !(source == null ? void 0 : (_source_openGraph = source.openGraph) == null ? void 0 : _source_openGraph.hasOwnProperty("images"))) {
const resolvedOpenGraph = (0, _resolveopengraph.resolveOpenGraph)({
...target.openGraph,
images: openGraph
}, target.metadataBase, metadataContext, titleTemplates.openGraph);
target.openGraph = resolvedOpenGraph;
}
if (manifest) {
target.manifest = manifest;
}
return target;
}
// Merge the source metadata into the resolved target metadata.
function merge({ source, target, staticFilesMetadata, titleTemplates, metadataContext }) {
// If there's override metadata, prefer it otherwise fallback to the default metadata.
const metadataBase = typeof (source == null ? void 0 : source.metadataBase) !== "undefined" ? source.metadataBase : target.metadataBase;
for(const key_ in source){
const key = key_;
switch(key){
case "title":
{
target.title = (0, _resolvetitle.resolveTitle)(source.title, titleTemplates.title);
break;
}
case "alternates":
{
target.alternates = (0, _resolvebasics.resolveAlternates)(source.alternates, metadataBase, metadataContext);
break;
}
case "openGraph":
{
target.openGraph = (0, _resolveopengraph.resolveOpenGraph)(source.openGraph, metadataBase, metadataContext, titleTemplates.openGraph);
break;
}
case "twitter":
{
target.twitter = (0, _resolveopengraph.resolveTwitter)(source.twitter, metadataBase, titleTemplates.twitter);
break;
}
case "verification":
target.verification = (0, _resolvebasics.resolveVerification)(source.verification);
break;
case "viewport":
{
target.viewport = (0, _resolvebasics.resolveViewport)(source.viewport);
break;
}
case "icons":
{
target.icons = (0, _resolveicons.resolveIcons)(source.icons);
break;
}
case "appleWebApp":
target.appleWebApp = (0, _resolvebasics.resolveAppleWebApp)(source.appleWebApp);
break;
case "appLinks":
target.appLinks = (0, _resolvebasics.resolveAppLinks)(source.appLinks);
break;
case "robots":
{
target.robots = (0, _resolvebasics.resolveRobots)(source.robots);
break;
}
case "themeColor":
{
target.themeColor = (0, _resolvebasics.resolveThemeColor)(source.themeColor);
break;
}
case "archives":
case "assets":
case "bookmarks":
case "keywords":
{
target[key] = (0, _utils.resolveAsArrayOrUndefined)(source[key]);
break;
}
case "authors":
{
target[key] = (0, _utils.resolveAsArrayOrUndefined)(source.authors);
break;
}
case "itunes":
{
target[key] = (0, _resolvebasics.resolveItunes)(source.itunes, metadataBase, metadataContext);
break;
}
// directly assign fields that fallback to null
case "applicationName":
case "description":
case "generator":
case "creator":
case "publisher":
case "category":
case "classification":
case "referrer":
case "colorScheme":
case "formatDetection":
case "manifest":
// @ts-ignore TODO: support inferring
target[key] = source[key] || null;
break;
case "other":
target.other = Object.assign({}, target.other, source.other);
break;
case "metadataBase":
target.metadataBase = metadataBase;
break;
default:
break;
}
}
mergeStaticMetadata(source, target, staticFilesMetadata, metadataContext, titleTemplates);
}
async function getDefinedMetadata(mod, props, tracingProps) {
// Layer is a client component, we just skip it. It can't have metadata exported.
// Return early to avoid accessing properties error for client references.
if ((0, _clientreference.isClientReference)(mod)) {
return null;
}
if (typeof mod.generateMetadata === "function") {
const { route } = tracingProps;
return (parent)=>(0, _tracer.getTracer)().trace(_constants.ResolveMetadataSpan.generateMetadata, {
spanName: `generateMetadata ${route}`,
attributes: {
"next.page": route
}
}, ()=>mod.generateMetadata(props, parent));
}
return mod.metadata || null;
}
async function collectStaticImagesFiles(metadata, props, type) {
var _this;
if (!(metadata == null ? void 0 : metadata[type])) return undefined;
const iconPromises = metadata[type].map(async (imageModule)=>(0, _interopdefault.interopDefault)(await imageModule(props)));
return (iconPromises == null ? void 0 : iconPromises.length) > 0 ? (_this = await Promise.all(iconPromises)) == null ? void 0 : _this.flat() : undefined;
}
async function resolveStaticMetadata(components, props) {
const { metadata } = components;
if (!metadata) return null;
const [icon, apple, openGraph, twitter] = await Promise.all([
collectStaticImagesFiles(metadata, props, "icon"),
collectStaticImagesFiles(metadata, props, "apple"),
collectStaticImagesFiles(metadata, props, "openGraph"),
collectStaticImagesFiles(metadata, props, "twitter")
]);
const staticMetadata = {
icon,
apple,
openGraph,
twitter,
manifest: metadata.manifest
};
return staticMetadata;
}
async function collectMetadata({ tree, metadataItems, errorMetadataItem, props, route, errorConvention }) {
let mod;
let modType;
const hasErrorConventionComponent = Boolean(errorConvention && tree[2][errorConvention]);
if (errorConvention) {
mod = await (0, _appdirmodule.getComponentTypeModule)(tree, "layout");
modType = errorConvention;
} else {
[mod, modType] = await (0, _appdirmodule.getLayoutOrPageModule)(tree);
}
if (modType) {
route += `/${modType}`;
}
const staticFilesMetadata = await resolveStaticMetadata(tree[2], props);
const metadataExport = mod ? await getDefinedMetadata(mod, props, {
route
}) : null;
metadataItems.push([
metadataExport,
staticFilesMetadata
]);
if (hasErrorConventionComponent && errorConvention) {
const errorMod = await (0, _appdirmodule.getComponentTypeModule)(tree, errorConvention);
const errorMetadataExport = errorMod ? await getDefinedMetadata(errorMod, props, {
route
}) : null;
errorMetadataItem[0] = errorMetadataExport;
errorMetadataItem[1] = staticFilesMetadata;
}
}
async function resolveMetadataItems({ tree, parentParams, metadataItems, errorMetadataItem, treePrefix = [], getDynamicParamFromSegment, searchParams, errorConvention }) {
const [segment, parallelRoutes, { page }] = tree;
const currentTreePrefix = [
...treePrefix,
segment
];
const isPage = typeof page !== "undefined";
// Handle dynamic segment params.
const segmentParam = getDynamicParamFromSegment(segment);
/**
* Create object holding the parent params and current params
*/ const currentParams = // Handle null case where dynamic param is optional
segmentParam && segmentParam.value !== null ? {
...parentParams,
[segmentParam.param]: segmentParam.value
} : parentParams;
const layerProps = {
params: currentParams,
...isPage && {
searchParams
}
};
await collectMetadata({
tree,
metadataItems,
errorMetadataItem,
errorConvention,
props: layerProps,
route: currentTreePrefix// __PAGE__ shouldn't be shown in a route
.filter((s)=>s !== _constants1.PAGE_SEGMENT_KEY).join("/")
});
for(const key in parallelRoutes){
const childTree = parallelRoutes[key];
await resolveMetadataItems({
tree: childTree,
metadataItems,
errorMetadataItem,
parentParams: currentParams,
treePrefix: currentTreePrefix,
searchParams,
getDynamicParamFromSegment,
errorConvention
});
}
if (Object.keys(parallelRoutes).length === 0 && errorConvention) {
// If there are no parallel routes, place error metadata as the last item.
// e.g. layout -> layout -> not-found
metadataItems.push(errorMetadataItem);
}
return metadataItems;
}
const commonOgKeys = [
"title",
"description",
"images"
];
function postProcessMetadata(metadata, titleTemplates) {
const { openGraph, twitter } = metadata;
if (openGraph) {
let autoFillProps = {};
const hasTwTitle = twitter == null ? void 0 : twitter.title.absolute;
const hasTwDescription = twitter == null ? void 0 : twitter.description;
const hasTwImages = Boolean((twitter == null ? void 0 : twitter.hasOwnProperty("images")) && twitter.images);
if (!hasTwTitle) autoFillProps.title = openGraph.title;
if (!hasTwDescription) autoFillProps.description = openGraph.description;
if (!hasTwImages) autoFillProps.images = openGraph.images;
if (Object.keys(autoFillProps).length > 0) {
const partialTwitter = (0, _resolveopengraph.resolveTwitter)(autoFillProps, metadata.metadataBase, titleTemplates.twitter);
if (metadata.twitter) {
metadata.twitter = Object.assign({}, metadata.twitter, {
...!hasTwTitle && {
title: partialTwitter == null ? void 0 : partialTwitter.title
},
...!hasTwDescription && {
description: partialTwitter == null ? void 0 : partialTwitter.description
},
...!hasTwImages && {
images: partialTwitter == null ? void 0 : partialTwitter.images
}
});
} else {
metadata.twitter = partialTwitter;
}
}
}
return metadata;
}
async function accumulateMetadata(metadataItems, metadataContext) {
const resolvedMetadata = (0, _defaultmetadata.createDefaultMetadata)();
const resolvers = [];
const generateMetadataResults = [];
let titleTemplates = {
title: null,
twitter: null,
openGraph: null
};
// Loop over all metadata items again, merging synchronously any static object exports,
// awaiting any static promise exports, and resolving parent metadata and awaiting any generated metadata
let resolvingIndex = 0;
for(let i = 0; i < metadataItems.length; i++){
const [metadataExport, staticFilesMetadata] = metadataItems[i];
let metadata = null;
if (typeof metadataExport === "function") {
if (!resolvers.length) {
for(let j = i; j < metadataItems.length; j++){
const [preloadMetadataExport] = metadataItems[j];
// call each `generateMetadata function concurrently and stash their resolver
if (typeof preloadMetadataExport === "function") {
generateMetadataResults.push(preloadMetadataExport(new Promise((resolve)=>{
resolvers.push(resolve);
})));
}
}
}
const resolveParent = resolvers[resolvingIndex];
const generatedMetadata = generateMetadataResults[resolvingIndex++];
// In dev we clone and freeze to prevent relying on mutating resolvedMetadata directly.
// In prod we just pass resolvedMetadata through without any copying.
const currentResolvedMetadata = process.env.NODE_ENV === "development" ? Object.freeze(require("./clone-metadata").cloneMetadata(resolvedMetadata)) : resolvedMetadata;
// This resolve should unblock the generateMetadata function if it awaited the parent
// argument. If it didn't await the parent argument it might already have a value since it was
// called concurrently. Regardless we await the return value before continuing on to the next layer
resolveParent(currentResolvedMetadata);
metadata = generatedMetadata instanceof Promise ? await generatedMetadata : generatedMetadata;
} else if (metadataExport !== null && typeof metadataExport === "object") {
// This metadataExport is the object form
metadata = metadataExport;
}
merge({
metadataContext,
target: resolvedMetadata,
source: metadata,
staticFilesMetadata,
titleTemplates
});
// If the layout is the same layer with page, skip the leaf layout and leaf page
// The leaf layout and page are the last two items
if (i < metadataItems.length - 2) {
var _resolvedMetadata_title, _resolvedMetadata_openGraph, _resolvedMetadata_twitter;
titleTemplates = {
title: ((_resolvedMetadata_title = resolvedMetadata.title) == null ? void 0 : _resolvedMetadata_title.template) || null,
openGraph: ((_resolvedMetadata_openGraph = resolvedMetadata.openGraph) == null ? void 0 : _resolvedMetadata_openGraph.title.template) || null,
twitter: ((_resolvedMetadata_twitter = resolvedMetadata.twitter) == null ? void 0 : _resolvedMetadata_twitter.title.template) || null
};
}
}
return postProcessMetadata(resolvedMetadata, titleTemplates);
}
async function resolveMetadata({ tree, parentParams, metadataItems, errorMetadataItem, getDynamicParamFromSegment, searchParams, errorConvention, metadataContext }) {
const resolvedMetadataItems = await resolveMetadataItems({
tree,
parentParams,
metadataItems,
errorMetadataItem,
getDynamicParamFromSegment,
searchParams,
errorConvention
});
let metadata = (0, _defaultmetadata.createDefaultMetadata)();
let error;
try {
metadata = await accumulateMetadata(resolvedMetadataItems, metadataContext);
} catch (err) {
error = err;
}
return [
metadata,
error
];
}
//# sourceMappingURL=resolve-metadata.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,16 @@
import type { ResolvedMetadata } from '../types/metadata-interface';
import type { FieldResolver, FieldResolverExtraArgs, MetadataContext } from '../types/resolvers';
export declare const resolveThemeColor: FieldResolver<'themeColor'>;
export declare const resolveViewport: FieldResolver<'viewport'>;
export declare const resolveAlternates: FieldResolverExtraArgs<'alternates', [
ResolvedMetadata['metadataBase'],
MetadataContext
]>;
export declare const resolveRobots: FieldResolver<'robots'>;
export declare const resolveVerification: FieldResolver<'verification'>;
export declare const resolveAppleWebApp: FieldResolver<'appleWebApp'>;
export declare const resolveAppLinks: FieldResolver<'appLinks'>;
export declare const resolveItunes: FieldResolverExtraArgs<'itunes', [
ResolvedMetadata['metadataBase'],
MetadataContext
]>;

View File

@@ -0,0 +1,230 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
resolveThemeColor: null,
resolveViewport: null,
resolveAlternates: null,
resolveRobots: null,
resolveVerification: null,
resolveAppleWebApp: null,
resolveAppLinks: null,
resolveItunes: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
resolveThemeColor: function() {
return resolveThemeColor;
},
resolveViewport: function() {
return resolveViewport;
},
resolveAlternates: function() {
return resolveAlternates;
},
resolveRobots: function() {
return resolveRobots;
},
resolveVerification: function() {
return resolveVerification;
},
resolveAppleWebApp: function() {
return resolveAppleWebApp;
},
resolveAppLinks: function() {
return resolveAppLinks;
},
resolveItunes: function() {
return resolveItunes;
}
});
const _utils = require("../generate/utils");
const _resolveurl = require("./resolve-url");
const _constants = require("../constants");
function resolveAlternateUrl(url, metadataBase, pathname) {
// If alter native url is an URL instance,
// we treat it as a URL base and resolve with current pathname
if (url instanceof URL) {
url = new URL(pathname, url);
}
return (0, _resolveurl.resolveAbsoluteUrlWithPathname)(url, metadataBase, pathname);
}
const resolveThemeColor = (themeColor)=>{
var _resolveAsArrayOrUndefined;
if (!themeColor) return null;
const themeColorDescriptors = [];
(_resolveAsArrayOrUndefined = (0, _utils.resolveAsArrayOrUndefined)(themeColor)) == null ? void 0 : _resolveAsArrayOrUndefined.forEach((descriptor)=>{
if (typeof descriptor === "string") themeColorDescriptors.push({
color: descriptor
});
else if (typeof descriptor === "object") themeColorDescriptors.push({
color: descriptor.color,
media: descriptor.media
});
});
return themeColorDescriptors;
};
const resolveViewport = (viewport)=>{
let resolved = null;
if (typeof viewport === "string") {
resolved = viewport;
} else if (viewport) {
resolved = "";
for(const viewportKey_ in _constants.ViewPortKeys){
const viewportKey = viewportKey_;
if (viewportKey in viewport) {
let value = viewport[viewportKey];
if (typeof value === "boolean") value = value ? "yes" : "no";
if (resolved) resolved += ", ";
resolved += `${_constants.ViewPortKeys[viewportKey]}=${value}`;
}
}
}
return resolved;
};
function resolveUrlValuesOfObject(obj, metadataBase, pathname) {
if (!obj) return null;
const result = {};
for (const [key, value] of Object.entries(obj)){
if (typeof value === "string" || value instanceof URL) {
result[key] = [
{
url: resolveAlternateUrl(value, metadataBase, pathname)
}
];
} else {
result[key] = [];
value == null ? void 0 : value.forEach((item, index)=>{
const url = resolveAlternateUrl(item.url, metadataBase, pathname);
result[key][index] = {
url,
title: item.title
};
});
}
}
return result;
}
function resolveCanonicalUrl(urlOrDescriptor, metadataBase, pathname) {
if (!urlOrDescriptor) return null;
const url = typeof urlOrDescriptor === "string" || urlOrDescriptor instanceof URL ? urlOrDescriptor : urlOrDescriptor.url;
// Return string url because structureClone can't handle URL instance
return {
url: resolveAlternateUrl(url, metadataBase, pathname)
};
}
const resolveAlternates = (alternates, metadataBase, { pathname })=>{
if (!alternates) return null;
const canonical = resolveCanonicalUrl(alternates.canonical, metadataBase, pathname);
const languages = resolveUrlValuesOfObject(alternates.languages, metadataBase, pathname);
const media = resolveUrlValuesOfObject(alternates.media, metadataBase, pathname);
const types = resolveUrlValuesOfObject(alternates.types, metadataBase, pathname);
const result = {
canonical,
languages,
media,
types
};
return result;
};
const robotsKeys = [
"noarchive",
"nosnippet",
"noimageindex",
"nocache",
"notranslate",
"indexifembedded",
"nositelinkssearchbox",
"unavailable_after",
"max-video-preview",
"max-image-preview",
"max-snippet"
];
const resolveRobotsValue = (robots)=>{
if (!robots) return null;
if (typeof robots === "string") return robots;
const values = [];
if (robots.index) values.push("index");
else if (typeof robots.index === "boolean") values.push("noindex");
if (robots.follow) values.push("follow");
else if (typeof robots.follow === "boolean") values.push("nofollow");
for (const key of robotsKeys){
const value = robots[key];
if (typeof value !== "undefined" && value !== false) {
values.push(typeof value === "boolean" ? key : `${key}:${value}`);
}
}
return values.join(", ");
};
const resolveRobots = (robots)=>{
if (!robots) return null;
return {
basic: resolveRobotsValue(robots),
googleBot: typeof robots !== "string" ? resolveRobotsValue(robots.googleBot) : null
};
};
const VerificationKeys = [
"google",
"yahoo",
"yandex",
"me",
"other"
];
const resolveVerification = (verification)=>{
if (!verification) return null;
const res = {};
for (const key of VerificationKeys){
const value = verification[key];
if (value) {
if (key === "other") {
res.other = {};
for(const otherKey in verification.other){
const otherValue = (0, _utils.resolveAsArrayOrUndefined)(verification.other[otherKey]);
if (otherValue) res.other[otherKey] = otherValue;
}
} else res[key] = (0, _utils.resolveAsArrayOrUndefined)(value);
}
}
return res;
};
const resolveAppleWebApp = (appWebApp)=>{
var _resolveAsArrayOrUndefined;
if (!appWebApp) return null;
if (appWebApp === true) {
return {
capable: true
};
}
const startupImages = appWebApp.startupImage ? (_resolveAsArrayOrUndefined = (0, _utils.resolveAsArrayOrUndefined)(appWebApp.startupImage)) == null ? void 0 : _resolveAsArrayOrUndefined.map((item)=>typeof item === "string" ? {
url: item
} : item) : null;
return {
capable: "capable" in appWebApp ? !!appWebApp.capable : true,
title: appWebApp.title || null,
startupImage: startupImages,
statusBarStyle: appWebApp.statusBarStyle || "default"
};
};
const resolveAppLinks = (appLinks)=>{
if (!appLinks) return null;
for(const key in appLinks){
// @ts-ignore // TODO: type infer
appLinks[key] = (0, _utils.resolveAsArrayOrUndefined)(appLinks[key]);
}
return appLinks;
};
const resolveItunes = (itunes, metadataBase, { pathname })=>{
if (!itunes) return null;
return {
appId: itunes.appId,
appArgument: itunes.appArgument ? resolveAlternateUrl(itunes.appArgument, metadataBase, pathname) : undefined
};
};
//# sourceMappingURL=resolve-basics.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import type { Icon, IconDescriptor } from '../types/metadata-types';
import type { FieldResolver } from '../types/resolvers';
export declare function resolveIcon(icon: Icon): IconDescriptor;
export declare const resolveIcons: FieldResolver<'icons'>;

View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
resolveIcon: null,
resolveIcons: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
resolveIcon: function() {
return resolveIcon;
},
resolveIcons: function() {
return resolveIcons;
}
});
const _utils = require("../generate/utils");
const _resolveurl = require("./resolve-url");
const _constants = require("../constants");
function resolveIcon(icon) {
if ((0, _resolveurl.isStringOrURL)(icon)) return {
url: icon
};
else if (Array.isArray(icon)) return icon;
return icon;
}
const resolveIcons = (icons)=>{
if (!icons) {
return null;
}
const resolved = {
icon: [],
apple: []
};
if (Array.isArray(icons)) {
resolved.icon = icons.map(resolveIcon).filter(Boolean);
} else if ((0, _resolveurl.isStringOrURL)(icons)) {
resolved.icon = [
resolveIcon(icons)
];
} else {
for (const key of _constants.IconKeys){
const values = (0, _utils.resolveAsArrayOrUndefined)(icons[key]);
if (values) resolved[key] = values.map(resolveIcon);
}
}
return resolved;
};
//# sourceMappingURL=resolve-icons.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/resolvers/resolve-icons.ts"],"names":["resolveIcon","resolveIcons","icon","isStringOrURL","url","Array","isArray","icons","resolved","apple","map","filter","Boolean","key","IconKeys","values","resolveAsArrayOrUndefined"],"mappings":";;;;;;;;;;;;;;;IAOgBA,WAAW;eAAXA;;IAMHC,YAAY;eAAZA;;;uBAV6B;4BACZ;2BACL;AAElB,SAASD,YAAYE,IAAU;IACpC,IAAIC,IAAAA,yBAAa,EAACD,OAAO,OAAO;QAAEE,KAAKF;IAAK;SACvC,IAAIG,MAAMC,OAAO,CAACJ,OAAO,OAAOA;IACrC,OAAOA;AACT;AAEO,MAAMD,eAAuC,CAACM;IACnD,IAAI,CAACA,OAAO;QACV,OAAO;IACT;IAEA,MAAMC,WAAsC;QAC1CN,MAAM,EAAE;QACRO,OAAO,EAAE;IACX;IACA,IAAIJ,MAAMC,OAAO,CAACC,QAAQ;QACxBC,SAASN,IAAI,GAAGK,MAAMG,GAAG,CAACV,aAAaW,MAAM,CAACC;IAChD,OAAO,IAAIT,IAAAA,yBAAa,EAACI,QAAQ;QAC/BC,SAASN,IAAI,GAAG;YAACF,YAAYO;SAAO;IACtC,OAAO;QACL,KAAK,MAAMM,OAAOC,mBAAQ,CAAE;YAC1B,MAAMC,SAASC,IAAAA,gCAAyB,EAACT,KAAK,CAACM,IAAI;YACnD,IAAIE,QAAQP,QAAQ,CAACK,IAAI,GAAGE,OAAOL,GAAG,CAACV;QACzC;IACF;IACA,OAAOQ;AACT"}

View File

@@ -0,0 +1,15 @@
import type { ResolvedMetadata } from '../types/metadata-interface';
import type { OpenGraph } from '../types/opengraph-types';
import type { FieldResolverExtraArgs, MetadataContext } from '../types/resolvers';
import type { Twitter } from '../types/twitter-types';
export declare function resolveImages(images: Twitter['images'], metadataBase: ResolvedMetadata['metadataBase']): NonNullable<ResolvedMetadata['twitter']>['images'];
export declare function resolveImages(images: OpenGraph['images'], metadataBase: ResolvedMetadata['metadataBase']): NonNullable<ResolvedMetadata['openGraph']>['images'];
export declare const resolveOpenGraph: FieldResolverExtraArgs<'openGraph', [
ResolvedMetadata['metadataBase'],
MetadataContext,
string | null
]>;
export declare const resolveTwitter: FieldResolverExtraArgs<'twitter', [
ResolvedMetadata['metadataBase'],
string | null
]>;

View File

@@ -0,0 +1,166 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
resolveImages: null,
resolveOpenGraph: null,
resolveTwitter: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
resolveImages: function() {
return resolveImages;
},
resolveOpenGraph: function() {
return resolveOpenGraph;
},
resolveTwitter: function() {
return resolveTwitter;
}
});
const _utils = require("../generate/utils");
const _resolveurl = require("./resolve-url");
const _resolvetitle = require("./resolve-title");
const OgTypeFields = {
article: [
"authors",
"tags"
],
song: [
"albums",
"musicians"
],
playlist: [
"albums",
"musicians"
],
radio: [
"creators"
],
video: [
"actors",
"directors",
"writers",
"tags"
],
basic: [
"emails",
"phoneNumbers",
"faxNumbers",
"alternateLocale",
"audio",
"videos"
]
};
function resolveImages(images, metadataBase) {
const resolvedImages = (0, _utils.resolveAsArrayOrUndefined)(images);
if (!resolvedImages) return resolvedImages;
const nonNullableImages = [];
for (const item of resolvedImages){
if (!item) continue;
const isItemUrl = (0, _resolveurl.isStringOrURL)(item);
const inputUrl = isItemUrl ? item : item.url;
if (!inputUrl) continue;
nonNullableImages.push(isItemUrl ? {
url: (0, _resolveurl.resolveUrl)(item, metadataBase)
} : {
...item,
// Update image descriptor url
url: (0, _resolveurl.resolveUrl)(item.url, metadataBase)
});
}
return nonNullableImages;
}
function getFieldsByOgType(ogType) {
switch(ogType){
case "article":
case "book":
return OgTypeFields.article;
case "music.song":
case "music.album":
return OgTypeFields.song;
case "music.playlist":
return OgTypeFields.playlist;
case "music.radio_station":
return OgTypeFields.radio;
case "video.movie":
case "video.episode":
return OgTypeFields.video;
default:
return OgTypeFields.basic;
}
}
const resolveOpenGraph = (openGraph, metadataBase, { pathname }, titleTemplate)=>{
if (!openGraph) return null;
function resolveProps(target, og) {
const ogType = og && "type" in og ? og.type : undefined;
const keys = getFieldsByOgType(ogType);
for (const k of keys){
const key = k;
if (key in og && key !== "url") {
const value = og[key];
if (value) {
const arrayValue = (0, _utils.resolveAsArrayOrUndefined)(value);
target[key] = arrayValue;
}
}
}
const imageMetadataBase = (0, _resolveurl.getSocialImageFallbackMetadataBase)(metadataBase);
target.images = resolveImages(og.images, imageMetadataBase);
}
const resolved = {
...openGraph,
title: (0, _resolvetitle.resolveTitle)(openGraph.title, titleTemplate)
};
resolveProps(resolved, openGraph);
resolved.url = openGraph.url ? (0, _resolveurl.resolveAbsoluteUrlWithPathname)(openGraph.url, metadataBase, pathname) : null;
return resolved;
};
const TwitterBasicInfoKeys = [
"site",
"siteId",
"creator",
"creatorId",
"description"
];
const resolveTwitter = (twitter, metadataBase, titleTemplate)=>{
var _resolved_images;
if (!twitter) return null;
let card = "card" in twitter ? twitter.card : undefined;
const resolved = {
...twitter,
title: (0, _resolvetitle.resolveTitle)(twitter.title, titleTemplate)
};
for (const infoKey of TwitterBasicInfoKeys){
resolved[infoKey] = twitter[infoKey] || null;
}
const imageMetadataBase = (0, _resolveurl.getSocialImageFallbackMetadataBase)(metadataBase);
resolved.images = resolveImages(twitter.images, imageMetadataBase);
card = card || (((_resolved_images = resolved.images) == null ? void 0 : _resolved_images.length) ? "summary_large_image" : "summary");
resolved.card = card;
if ("card" in resolved) {
switch(resolved.card){
case "player":
{
resolved.players = (0, _utils.resolveAsArrayOrUndefined)(resolved.players) || [];
break;
}
case "app":
{
resolved.app = resolved.app || {};
break;
}
default:
break;
}
}
return resolved;
};
//# sourceMappingURL=resolve-opengraph.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/resolvers/resolve-opengraph.ts"],"names":["resolveImages","resolveOpenGraph","resolveTwitter","OgTypeFields","article","song","playlist","radio","video","basic","images","metadataBase","resolvedImages","resolveAsArrayOrUndefined","nonNullableImages","item","isItemUrl","isStringOrURL","inputUrl","url","push","resolveUrl","getFieldsByOgType","ogType","openGraph","pathname","titleTemplate","resolveProps","target","og","type","undefined","keys","k","key","value","arrayValue","imageMetadataBase","getSocialImageFallbackMetadataBase","resolved","title","resolveTitle","resolveAbsoluteUrlWithPathname","TwitterBasicInfoKeys","twitter","card","infoKey","length","players","app"],"mappings":"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"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,3 @@
import type { Metadata } from '../types/metadata-interface';
import type { AbsoluteTemplateString } from '../types/metadata-types';
export declare function resolveTitle(title: Metadata['title'], stashedTemplate: string | null | undefined): AbsoluteTemplateString;

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "resolveTitle", {
enumerable: true,
get: function() {
return resolveTitle;
}
});
function resolveTitleTemplate(template, title) {
return template ? template.replace(/%s/g, title) : title;
}
function resolveTitle(title, stashedTemplate) {
let resolved;
const template = typeof title !== "string" && title && "template" in title ? title.template : null;
if (typeof title === "string") {
resolved = resolveTitleTemplate(stashedTemplate, title);
} else if (title) {
if ("default" in title) {
resolved = resolveTitleTemplate(stashedTemplate, title.default);
}
if ("absolute" in title && title.absolute) {
resolved = title.absolute;
}
}
if (title && typeof title !== "string") {
return {
template,
absolute: resolved || ""
};
} else {
return {
absolute: resolved || title || "",
template
};
}
}
//# sourceMappingURL=resolve-title.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/resolvers/resolve-title.ts"],"names":["resolveTitle","resolveTitleTemplate","template","title","replace","stashedTemplate","resolved","default","absolute"],"mappings":";;;;+BAUgBA;;;eAAAA;;;AAPhB,SAASC,qBACPC,QAAmC,EACnCC,KAAa;IAEb,OAAOD,WAAWA,SAASE,OAAO,CAAC,OAAOD,SAASA;AACrD;AAEO,SAASH,aACdG,KAAwB,EACxBE,eAA0C;IAE1C,IAAIC;IACJ,MAAMJ,WACJ,OAAOC,UAAU,YAAYA,SAAS,cAAcA,QAChDA,MAAMD,QAAQ,GACd;IAEN,IAAI,OAAOC,UAAU,UAAU;QAC7BG,WAAWL,qBAAqBI,iBAAiBF;IACnD,OAAO,IAAIA,OAAO;QAChB,IAAI,aAAaA,OAAO;YACtBG,WAAWL,qBAAqBI,iBAAiBF,MAAMI,OAAO;QAChE;QACA,IAAI,cAAcJ,SAASA,MAAMK,QAAQ,EAAE;YACzCF,WAAWH,MAAMK,QAAQ;QAC3B;IACF;IAEA,IAAIL,SAAS,OAAOA,UAAU,UAAU;QACtC,OAAO;YACLD;YACAM,UAAUF,YAAY;QACxB;IACF,OAAO;QACL,OAAO;YAAEE,UAAUF,YAAYH,SAAS;YAAID;QAAS;IACvD;AACF"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,8 @@
declare function isStringOrURL(icon: any): icon is string | URL;
export declare function getSocialImageFallbackMetadataBase(metadataBase: URL | null): URL | null;
declare function resolveUrl(url: null | undefined, metadataBase: URL | null): null;
declare function resolveUrl(url: string | URL, metadataBase: URL | null): URL;
declare function resolveUrl(url: string | URL | null | undefined, metadataBase: URL | null): URL | null;
declare function resolveRelativeUrl(url: string | URL, pathname: string): string | URL;
declare function resolveAbsoluteUrlWithPathname(url: string | URL, metadataBase: URL | null, pathname: string): string;
export { isStringOrURL, resolveUrl, resolveRelativeUrl, resolveAbsoluteUrlWithPathname, };

View File

@@ -0,0 +1,133 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getSocialImageFallbackMetadataBase: null,
isStringOrURL: null,
resolveUrl: null,
resolveRelativeUrl: null,
resolveAbsoluteUrlWithPathname: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getSocialImageFallbackMetadataBase: function() {
return getSocialImageFallbackMetadataBase;
},
isStringOrURL: function() {
return isStringOrURL;
},
resolveUrl: function() {
return resolveUrl;
},
resolveRelativeUrl: function() {
return resolveRelativeUrl;
},
resolveAbsoluteUrlWithPathname: function() {
return resolveAbsoluteUrlWithPathname;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("../../../shared/lib/isomorphic/path"));
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../../build/output/log"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function isStringOrURL(icon) {
return typeof icon === "string" || icon instanceof URL;
}
function createLocalMetadataBase() {
return new URL(`http://localhost:${process.env.PORT || 3000}`);
}
function getSocialImageFallbackMetadataBase(metadataBase) {
const isMetadataBaseMissing = !metadataBase;
const defaultMetadataBase = createLocalMetadataBase();
const deploymentUrl = process.env.VERCEL_URL && new URL(`https://${process.env.VERCEL_URL}`);
let fallbackMetadata;
if (process.env.NODE_ENV === "development") {
fallbackMetadata = defaultMetadataBase;
} else {
fallbackMetadata = process.env.NODE_ENV === "production" && deploymentUrl && process.env.VERCEL_ENV === "preview" ? deploymentUrl : metadataBase || deploymentUrl || defaultMetadataBase;
}
if (isMetadataBaseMissing) {
_log.warnOnce("");
_log.warnOnce(`metadata.metadataBase is not set for resolving social open graph or twitter images, using "${fallbackMetadata.origin}". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase`);
}
return fallbackMetadata;
}
function resolveUrl(url, metadataBase) {
if (url instanceof URL) return url;
if (!url) return null;
try {
// If we can construct a URL instance from url, ignore metadataBase
const parsedUrl = new URL(url);
return parsedUrl;
} catch {}
if (!metadataBase) {
metadataBase = createLocalMetadataBase();
}
// Handle relative or absolute paths
const basePath = metadataBase.pathname || "";
const joinedPath = _path.default.join(basePath, url);
return new URL(joinedPath, metadataBase);
}
// Resolve with `pathname` if `url` is a relative path.
function resolveRelativeUrl(url, pathname) {
if (typeof url === "string" && url.startsWith("./")) {
return _path.default.resolve(pathname, url);
}
return url;
}
// Resolve `pathname` if `url` is a relative path the compose with `metadataBase`.
function resolveAbsoluteUrlWithPathname(url, metadataBase, pathname) {
url = resolveRelativeUrl(url, pathname);
const result = metadataBase ? resolveUrl(url, metadataBase) : url;
return result.toString();
}
//# sourceMappingURL=resolve-url.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/resolvers/resolve-url.ts"],"names":["getSocialImageFallbackMetadataBase","isStringOrURL","resolveUrl","resolveRelativeUrl","resolveAbsoluteUrlWithPathname","icon","URL","createLocalMetadataBase","process","env","PORT","metadataBase","isMetadataBaseMissing","defaultMetadataBase","deploymentUrl","VERCEL_URL","fallbackMetadata","NODE_ENV","VERCEL_ENV","Log","warnOnce","origin","url","parsedUrl","basePath","pathname","joinedPath","path","join","startsWith","resolve","result","toString"],"mappings":";;;;;;;;;;;;;;;;;;IAagBA,kCAAkC;eAAlCA;;IAiFdC,aAAa;eAAbA;;IACAC,UAAU;eAAVA;;IACAC,kBAAkB;eAAlBA;;IACAC,8BAA8B;eAA9BA;;;6DAjGe;6DACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,SAASH,cAAcI,IAAS;IAC9B,OAAO,OAAOA,SAAS,YAAYA,gBAAgBC;AACrD;AAEA,SAASC;IACP,OAAO,IAAID,IAAI,CAAC,iBAAiB,EAAEE,QAAQC,GAAG,CAACC,IAAI,IAAI,KAAK,CAAC;AAC/D;AAIO,SAASV,mCACdW,YAAwB;IAExB,MAAMC,wBAAwB,CAACD;IAC/B,MAAME,sBAAsBN;IAC5B,MAAMO,gBACJN,QAAQC,GAAG,CAACM,UAAU,IAAI,IAAIT,IAAI,CAAC,QAAQ,EAAEE,QAAQC,GAAG,CAACM,UAAU,CAAC,CAAC;IAEvE,IAAIC;IACJ,IAAIR,QAAQC,GAAG,CAACQ,QAAQ,KAAK,eAAe;QAC1CD,mBAAmBH;IACrB,OAAO;QACLG,mBACER,QAAQC,GAAG,CAACQ,QAAQ,KAAK,gBACzBH,iBACAN,QAAQC,GAAG,CAACS,UAAU,KAAK,YACvBJ,gBACAH,gBAAgBG,iBAAiBD;IACzC;IAEA,IAAID,uBAAuB;QACzBO,KAAIC,QAAQ,CAAC;QACbD,KAAIC,QAAQ,CACV,CAAC,2FAA2F,EAAEJ,iBAAiBK,MAAM,CAAC,yFAAyF,CAAC;IAEpN;IAEA,OAAOL;AACT;AAQA,SAASd,WACPoB,GAAoC,EACpCX,YAAwB;IAExB,IAAIW,eAAehB,KAAK,OAAOgB;IAC/B,IAAI,CAACA,KAAK,OAAO;IAEjB,IAAI;QACF,mEAAmE;QACnE,MAAMC,YAAY,IAAIjB,IAAIgB;QAC1B,OAAOC;IACT,EAAE,OAAM,CAAC;IAET,IAAI,CAACZ,cAAc;QACjBA,eAAeJ;IACjB;IAEA,oCAAoC;IACpC,MAAMiB,WAAWb,aAAac,QAAQ,IAAI;IAC1C,MAAMC,aAAaC,aAAI,CAACC,IAAI,CAACJ,UAAUF;IAEvC,OAAO,IAAIhB,IAAIoB,YAAYf;AAC7B;AAEA,uDAAuD;AACvD,SAASR,mBAAmBmB,GAAiB,EAAEG,QAAgB;IAC7D,IAAI,OAAOH,QAAQ,YAAYA,IAAIO,UAAU,CAAC,OAAO;QACnD,OAAOF,aAAI,CAACG,OAAO,CAACL,UAAUH;IAChC;IACA,OAAOA;AACT;AAEA,kFAAkF;AAClF,SAASlB,+BACPkB,GAAiB,EACjBX,YAAwB,EACxBc,QAAgB;IAEhBH,MAAMnB,mBAAmBmB,KAAKG;IAE9B,MAAMM,SAASpB,eAAeT,WAAWoB,KAAKX,gBAAgBW;IAC9D,OAAOS,OAAOC,QAAQ;AACxB"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,31 @@
type LangCode = 'aa' | 'ab' | 'ae' | 'af' | 'ak' | 'am' | 'an' | 'ar' | 'as' | 'av' | 'ay' | 'az' | 'ba' | 'be' | 'bg' | 'bh' | 'bi' | 'bm' | 'bn' | 'bo' | 'br' | 'bs' | 'ca' | 'ce' | 'ch' | 'co' | 'cr' | 'cs' | 'cu' | 'cv' | 'cy' | 'da' | 'de' | 'dv' | 'dz' | 'ee' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'ff' | 'fi' | 'fj' | 'fo' | 'fr' | 'fy' | 'ga' | 'gd' | 'gl' | 'gn' | 'gu' | 'gv' | 'ha' | 'he' | 'hi' | 'ho' | 'hr' | 'ht' | 'hu' | 'hy' | 'hz' | 'ia' | 'id' | 'ie' | 'ig' | 'ii' | 'ik' | 'io' | 'is' | 'it' | 'iu' | 'ja' | 'jv' | 'ka' | 'kg' | 'ki' | 'kj' | 'kk' | 'kl' | 'km' | 'kn' | 'ko' | 'kr' | 'ks' | 'ku' | 'kv' | 'kw' | 'ky' | 'la' | 'lb' | 'lg' | 'li' | 'ln' | 'lo' | 'lt' | 'lu' | 'lv' | 'mg' | 'mh' | 'mi' | 'mk' | 'ml' | 'mn' | 'mr' | 'ms' | 'mt' | 'my' | 'na' | 'nb' | 'nd' | 'ne' | 'ng' | 'nl' | 'nn' | 'no' | 'nr' | 'nv' | 'ny' | 'oc' | 'oj' | 'om' | 'or' | 'os' | 'pa' | 'pi' | 'pl' | 'ps' | 'pt' | 'qu' | 'rm' | 'rn' | 'ro' | 'ru' | 'rw' | 'sa' | 'sc' | 'sd' | 'se' | 'sg' | 'si' | 'sk' | 'sl' | 'sm' | 'sn' | 'so' | 'sq' | 'sr' | 'ss' | 'st' | 'su' | 'sv' | 'sw' | 'ta' | 'te' | 'tg' | 'th' | 'ti' | 'tk' | 'tl' | 'tn' | 'to' | 'tr' | 'ts' | 'tt' | 'tw' | 'ty' | 'ug' | 'uk' | 'ur' | 'uz' | 've' | 'vi' | 'vo' | 'wa' | 'wo' | 'xh' | 'yi' | 'yo' | 'za' | 'zh' | 'zu' | 'af-ZA' | 'am-ET' | 'ar-AE' | 'ar-BH' | 'ar-DZ' | 'ar-EG' | 'ar-IQ' | 'ar-JO' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'arn-CL' | 'ar-OM' | 'ar-QA' | 'ar-SA' | 'ar-SD' | 'ar-SY' | 'ar-TN' | 'ar-YE' | 'as-IN' | 'az-az' | 'az-Cyrl-AZ' | 'az-Latn-AZ' | 'ba-RU' | 'be-BY' | 'bg-BG' | 'bn-BD' | 'bn-IN' | 'bo-CN' | 'br-FR' | 'bs-Cyrl-BA' | 'bs-Latn-BA' | 'ca-ES' | 'co-FR' | 'cs-CZ' | 'cy-GB' | 'da-DK' | 'de-AT' | 'de-CH' | 'de-DE' | 'de-LI' | 'de-LU' | 'dsb-DE' | 'dv-MV' | 'el-CY' | 'el-GR' | 'en-029' | 'en-AU' | 'en-BZ' | 'en-CA' | 'en-cb' | 'en-GB' | 'en-IE' | 'en-IN' | 'en-JM' | 'en-MT' | 'en-MY' | 'en-NZ' | 'en-PH' | 'en-SG' | 'en-TT' | 'en-US' | 'en-ZA' | 'en-ZW' | 'es-AR' | 'es-BO' | 'es-CL' | 'es-CO' | 'es-CR' | 'es-DO' | 'es-EC' | 'es-ES' | 'es-GT' | 'es-HN' | 'es-MX' | 'es-NI' | 'es-PA' | 'es-PE' | 'es-PR' | 'es-PY' | 'es-SV' | 'es-US' | 'es-UY' | 'es-VE' | 'et-EE' | 'eu-ES' | 'fa-IR' | 'fi-FI' | 'fil-PH' | 'fo-FO' | 'fr-BE' | 'fr-CA' | 'fr-CH' | 'fr-FR' | 'fr-LU' | 'fr-MC' | 'fy-NL' | 'ga-IE' | 'gd-GB' | 'gd-ie' | 'gl-ES' | 'gsw-FR' | 'gu-IN' | 'ha-Latn-NG' | 'he-IL' | 'hi-IN' | 'hr-BA' | 'hr-HR' | 'hsb-DE' | 'hu-HU' | 'hy-AM' | 'id-ID' | 'ig-NG' | 'ii-CN' | 'in-ID' | 'is-IS' | 'it-CH' | 'it-IT' | 'iu-Cans-CA' | 'iu-Latn-CA' | 'iw-IL' | 'ja-JP' | 'ka-GE' | 'kk-KZ' | 'kl-GL' | 'km-KH' | 'kn-IN' | 'kok-IN' | 'ko-KR' | 'ky-KG' | 'lb-LU' | 'lo-LA' | 'lt-LT' | 'lv-LV' | 'mi-NZ' | 'mk-MK' | 'ml-IN' | 'mn-MN' | 'mn-Mong-CN' | 'moh-CA' | 'mr-IN' | 'ms-BN' | 'ms-MY' | 'mt-MT' | 'nb-NO' | 'ne-NP' | 'nl-BE' | 'nl-NL' | 'nn-NO' | 'no-no' | 'nso-ZA' | 'oc-FR' | 'or-IN' | 'pa-IN' | 'pl-PL' | 'prs-AF' | 'ps-AF' | 'pt-BR' | 'pt-PT' | 'qut-GT' | 'quz-BO' | 'quz-EC' | 'quz-PE' | 'rm-CH' | 'ro-mo' | 'ro-RO' | 'ru-mo' | 'ru-RU' | 'rw-RW' | 'sah-RU' | 'sa-IN' | 'se-FI' | 'se-NO' | 'se-SE' | 'si-LK' | 'sk-SK' | 'sl-SI' | 'sma-NO' | 'sma-SE' | 'smj-NO' | 'smj-SE' | 'smn-FI' | 'sms-FI' | 'sq-AL' | 'sr-BA' | 'sr-CS' | 'sr-Cyrl-BA' | 'sr-Cyrl-CS' | 'sr-Cyrl-ME' | 'sr-Cyrl-RS' | 'sr-Latn-BA' | 'sr-Latn-CS' | 'sr-Latn-ME' | 'sr-Latn-RS' | 'sr-ME' | 'sr-RS' | 'sr-sp' | 'sv-FI' | 'sv-SE' | 'sw-KE' | 'syr-SY' | 'ta-IN' | 'te-IN' | 'tg-Cyrl-TJ' | 'th-TH' | 'tk-TM' | 'tlh-QS' | 'tn-ZA' | 'tr-TR' | 'tt-RU' | 'tzm-Latn-DZ' | 'ug-CN' | 'uk-UA' | 'ur-PK' | 'uz-Cyrl-UZ' | 'uz-Latn-UZ' | 'uz-uz' | 'vi-VN' | 'wo-SN' | 'xh-ZA' | 'yo-NG' | 'zh-CN' | 'zh-HK' | 'zh-MO' | 'zh-SG' | 'zh-TW' | 'zh-Hans' | 'zh-Hant' | 'zu-ZA' | `${Lowercase<string>}-${string}`;
type UnmatchedLang = 'x-default';
type HrefLang = LangCode | UnmatchedLang;
type Languages<T> = {
[s in HrefLang]?: T;
};
export type AlternateLinkDescriptor = {
title?: string;
url: string | URL;
};
export type AlternateURLs = {
canonical?: null | string | URL | AlternateLinkDescriptor;
languages?: Languages<null | string | URL | AlternateLinkDescriptor[]>;
media?: {
[media: string]: null | string | URL | AlternateLinkDescriptor[];
};
types?: {
[types: string]: null | string | URL | AlternateLinkDescriptor[];
};
};
export type ResolvedAlternateURLs = {
canonical: null | AlternateLinkDescriptor;
languages: null | Languages<AlternateLinkDescriptor[]>;
media: null | {
[media: string]: null | AlternateLinkDescriptor[];
};
types: null | {
[types: string]: null | AlternateLinkDescriptor[];
};
};
export {};

View File

@@ -0,0 +1,7 @@
// Reference: https://hreflang.org/what-is-a-valid-hreflang
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=alternative-urls-types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/types/alternative-urls-types.ts"],"names":[],"mappings":"AAAA,2DAA2D"}

View File

@@ -0,0 +1,78 @@
export type AppLinks = {
ios?: AppLinksApple | Array<AppLinksApple>;
iphone?: AppLinksApple | Array<AppLinksApple>;
ipad?: AppLinksApple | Array<AppLinksApple>;
android?: AppLinksAndroid | Array<AppLinksAndroid>;
windows_phone?: AppLinksWindows | Array<AppLinksWindows>;
windows?: AppLinksWindows | Array<AppLinksWindows>;
windows_universal?: AppLinksWindows | Array<AppLinksWindows>;
web?: AppLinksWeb | Array<AppLinksWeb>;
};
export type ResolvedAppLinks = {
ios?: Array<AppLinksApple>;
iphone?: Array<AppLinksApple>;
ipad?: Array<AppLinksApple>;
android?: Array<AppLinksAndroid>;
windows_phone?: Array<AppLinksWindows>;
windows?: Array<AppLinksWindows>;
windows_universal?: Array<AppLinksWindows>;
web?: Array<AppLinksWeb>;
};
export type AppLinksApple = {
url: string | URL;
app_store_id?: string | number;
app_name?: string;
};
export type AppLinksAndroid = {
package: string;
url?: string | URL;
class?: string;
app_name?: string;
};
export type AppLinksWindows = {
url: string | URL;
app_id?: string;
app_name?: string;
};
export type AppLinksWeb = {
url: string | URL;
should_fallback?: boolean;
};
export type ItunesApp = {
appId: string;
appArgument?: string;
};
export type Viewport = {
width?: string | number;
height?: string | number;
initialScale?: number;
minimumScale?: number;
maximumScale?: number;
userScalable?: boolean;
viewportFit?: 'auto' | 'cover' | 'contain';
interactiveWidget?: 'resizes-visual' | 'resizes-content' | 'overlays-content';
};
export type AppleWebApp = {
capable?: boolean;
title?: string;
startupImage?: AppleImage | Array<AppleImage>;
statusBarStyle?: 'default' | 'black' | 'black-translucent';
};
export type AppleImage = string | AppleImageDescriptor;
export type AppleImageDescriptor = {
url: string;
media?: string;
};
export type ResolvedAppleWebApp = {
capable: boolean;
title?: string | null;
startupImage?: AppleImageDescriptor[] | null;
statusBarStyle?: 'default' | 'black' | 'black-translucent';
};
export type FormatDetection = {
telephone?: boolean;
date?: boolean;
address?: boolean;
email?: boolean;
url?: boolean;
};

View File

@@ -0,0 +1,9 @@
// When rendering applink meta tags add a namespace tag before each array instance
// if more than one member exists.
// ref: https://developers.facebook.com/docs/applinks/metadata-reference
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=extra-types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/types/extra-types.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,kCAAkC;AAClC,wEAAwE"}

View File

@@ -0,0 +1,83 @@
export type Manifest = {
background_color?: string;
categories?: string[];
description?: string;
dir?: 'ltr' | 'rtl' | 'auto';
display?: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser';
display_override?: ('fullscreen' | 'standalone' | 'minimal-ui' | 'browser' | 'window-controls-overlay')[];
file_handlers?: {
action: string;
accept: {
[mimeType: string]: string[];
}[];
}[];
icons?: {
src: string;
type?: string;
sizes?: string;
purpose?: 'any' | 'maskable' | 'monochrome' | 'badge';
}[];
id?: string;
lang?: string;
launch_handler?: {
platform?: 'windows' | 'macos' | 'linux';
url?: string;
};
name?: string;
orientation?: 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
prefer_related_applications?: boolean;
protocol_handlers?: {
protocol: string;
url: string;
title?: string;
}[];
related_applications?: {
platform: string;
url: string;
id?: string;
}[];
scope?: string;
screenshots?: {
src: string;
type?: string;
sizes?: string;
}[];
serviceworker?: {
src?: string;
scope?: string;
type?: string;
update_via_cache?: 'import' | 'none' | 'all';
};
share_target?: {
action?: string;
method?: 'get' | 'post';
enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
params?: {
name: string;
value: string;
required?: boolean;
}[];
url?: string;
title?: string;
text?: string;
files?: {
accept?: string[];
name?: string;
}[];
};
short_name?: string;
shortcuts?: {
name: string;
short_name?: string;
description?: string;
url: string;
icons?: {
src: string;
type?: string;
sizes?: string;
purpose?: 'any' | 'maskable' | 'monochrome' | 'badge';
}[];
}[];
start_url?: string;
theme_color?: string;
};

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=manifest-types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,452 @@
import type { AlternateURLs, ResolvedAlternateURLs } from './alternative-urls-types';
import type { AppleWebApp, AppLinks, FormatDetection, ItunesApp, ResolvedAppleWebApp, ResolvedAppLinks, Viewport } from './extra-types';
import type { DeprecatedMetadataFields, AbsoluteTemplateString, Author, ColorSchemeEnum, Icon, Icons, IconURL, ReferrerEnum, ResolvedIcons, ResolvedVerification, Robots, ResolvedRobots, TemplateString, Verification, ThemeColorDescriptor } from './metadata-types';
import type { Manifest as ManifestFile } from './manifest-types';
import type { OpenGraph, ResolvedOpenGraph } from './opengraph-types';
import type { ResolvedTwitterMetadata, Twitter } from './twitter-types';
/**
* Metadata interface to describe all the metadata fields that can be set in a document.
* @interface
*/
interface Metadata extends DeprecatedMetadataFields {
/**
* The base path and origin for absolute urls for various metadata links such as OpenGraph images.
*/
metadataBase?: null | URL;
/**
* The document title.
* @example
* ```tsx
* "My Blog"
* <title>My Blog</title>
*
* { default: "Dashboard", template: "%s | My Website" }
* <title>Dashboard | My Website</title>
*
* { absolute: "My Blog", template: "%s | My Website" }
* <title>My Blog</title>
* ```
*/
title?: null | string | TemplateString;
/**
* The document description, and optionally the OpenGraph and twitter descriptions.
* @example
* ```tsx
* "My Blog Description"
* <meta name="description" content="My Blog Description" />
* ```
*/
description?: null | string;
/**
* The application name.
* @example
* ```tsx
* "My Blog"
* <meta name="application-name" content="My Blog" />
* ```
*/
applicationName?: null | string;
/**
* The authors of the document.
* @example
* ```tsx
* [{ name: "Next.js Team", url: "https://nextjs.org" }]
*
* <meta name="author" content="Next.js Team" />
* <link rel="author" href="https://nextjs.org" />
* ```
*/
authors?: null | Author | Array<Author>;
/**
* The generator used for the document.
* @example
* ```tsx
* "Next.js"
*
* <meta name="generator" content="Next.js" />
* ```
*/
generator?: null | string;
/**
* The keywords for the document. If an array is provided, it will be flattened into a single tag with comma separation.
* @example
* ```tsx
* "nextjs, react, blog"
* <meta name="keywords" content="nextjs, react, blog" />
*
* ["react", "server components"]
* <meta name="keywords" content="react, server components" />
* ```
*/
keywords?: null | string | Array<string>;
/**
* The referrer setting for the document.
* @example
* ```tsx
* "origin"
* <meta name="referrer" content="origin" />
* ```
*/
referrer?: null | ReferrerEnum;
/**
* The theme color for the document.
* @example
* ```tsx
* "#000000"
* <meta name="theme-color" content="#000000" />
*
* { media: "(prefers-color-scheme: dark)", color: "#000000" }
* <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#000000" />
*
* [
* { media: "(prefers-color-scheme: dark)", color: "#000000" },
* { media: "(prefers-color-scheme: light)", color: "#ffffff" }
* ]
* <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#000000" />
* <meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff" />
* ```
*/
themeColor?: null | string | ThemeColorDescriptor | ThemeColorDescriptor[];
/**
* The color scheme for the document.
* @example
* ```tsx
* "dark"
* <meta name="color-scheme" content="dark" />
* ```
*/
colorScheme?: null | ColorSchemeEnum;
/**
* The viewport setting for the document.
* @example
* ```tsx
* "width=device-width, initial-scale=1"
* <meta name="viewport" content="width=device-width, initial-scale=1" />
*
* { width: "device-width", initialScale: 1 }
* <meta name="viewport" content="width=device-width, initial-scale=1" />
* ```
*/
viewport?: null | string | Viewport;
/**
* The creator of the document.
* @example
* ```tsx
* "Next.js Team"
* <meta name="creator" content="Next.js Team" />
* ```
*/
creator?: null | string;
/**
* The publisher of the document.
* @example
*
* ```tsx
* "Vercel"
* <meta name="publisher" content="Vercel" />
* ```
*/
publisher?: null | string;
/**
* The robots setting for the document.
*
* @see https://developer.mozilla.org/docs/Glossary/Robots.txt
* @example
* ```tsx
* "index, follow"
* <meta name="robots" content="index, follow" />
*
* { index: false, follow: false }
* <meta name="robots" content="noindex, nofollow" />
* ```
*/
robots?: null | string | Robots;
/**
* The canonical and alternate URLs for the document.
* @example
* ```tsx
* { canonical: "https://example.com" }
* <link rel="canonical" href="https://example.com" />
*
* { canonical: "https://example.com", hreflang: { "en-US": "https://example.com/en-US" } }
* <link rel="canonical" href="https://example.com" />
* <link rel="alternate" href="https://example.com/en-US" hreflang="en-US" />
* ```
*
* Multiple titles example for alternate URLs except `canonical`:
* ```tsx
* {
* canonical: "https://example.com",
* types: {
* 'application/rss+xml': [
* { url: 'blog.rss', title: 'rss' },
* { url: 'blog/js.rss', title: 'js title' },
* ],
* },
* }
* <link rel="canonical" href="https://example.com" />
* <link rel="alternate" href="https://example.com/blog.rss" type="application/rss+xml" title="rss" />
* <link rel="alternate" href="https://example.com/blog/js.rss" type="application/rss+xml" title="js title" />
* ```
*/
alternates?: null | AlternateURLs;
/**
* The icons for the document. Defaults to rel="icon".
*
* @see https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-icon
* @example
* ```tsx
* "https://example.com/icon.png"
* <link rel="icon" href="https://example.com/icon.png" />
*
* { icon: "https://example.com/icon.png", apple: "https://example.com/apple-icon.png" }
* <link rel="icon" href="https://example.com/icon.png" />
* <link rel="apple-touch-icon" href="https://example.com/apple-icon.png" />
*
* [{ rel: "icon", url: "https://example.com/icon.png" }, { rel: "apple-touch-icon", url: "https://example.com/apple-icon.png" }]
* <link rel="icon" href="https://example.com/icon.png" />
* <link rel="apple-touch-icon" href="https://example.com/apple-icon.png" />
* ```
*/
icons?: null | IconURL | Array<Icon> | Icons;
/**
* A web application manifest, as defined in the Web Application Manifest specification.
*
* @see https://developer.mozilla.org/docs/Web/Manifest
* @example
* ```tsx
* "https://example.com/manifest.json"
* <link rel="manifest" href="https://example.com/manifest.json" />
* ```
*
*/
manifest?: null | string | URL;
/**
* The Open Graph metadata for the document.
*
* @see https://ogp.me
* @example
* ```tsx
* {
* type: "website",
* url: "https://example.com",
* title: "My Website",
* description: "My Website Description",
* siteName: "My Website",
* images: [{
* url: "https://example.com/og.png",
* }],
* }
*
* <meta property="og:type" content="website" />
* <meta property="og:url" content="https://example.com" />
* <meta property="og:site_name" content="My Website" />
* <meta property="og:title" content="My Website" />
* <meta property="og:description" content="My Website Description" />
* <meta property="og:image" content="https://example.com/og.png" />
* ```
*/
openGraph?: null | OpenGraph;
/**
* The Twitter metadata for the document.
* @example
* ```tsx
* { card: "summary_large_image", site: "@site", creator: "@creator", "images": "https://example.com/og.png" }
*
* <meta name="twitter:card" content="summary_large_image" />
* <meta name="twitter:site" content="@site" />
* <meta name="twitter:creator" content="@creator" />
* <meta name="twitter:title" content="My Website" />
* <meta name="twitter:description" content="My Website Description" />
* <meta name="twitter:image" content="https://example.com/og.png" />
* ```
*
*/
twitter?: null | Twitter;
/**
* The common verification tokens for the document.
* @example
* ```tsx
* { verification: { google: "1234567890", yandex: "1234567890", "me": "1234567890" } }
* <meta name="google-site-verification" content="1234567890" />
* <meta name="yandex-verification" content="1234567890" />
* <meta name="me" content="@me" />
* ```
*/
verification?: Verification;
/**
* The Apple web app metadata for the document.
*
* @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
* @example
* ```tsx
* { capable: true, title: "My Website", statusBarStyle: "black-translucent" }
* <meta name="apple-mobile-web-app-capable" content="yes" />
* <meta name="apple-mobile-web-app-title" content="My Website" />
* <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
* ```
*
*/
appleWebApp?: null | boolean | AppleWebApp;
/**
* Indicates if devices should try to interpret various formats and make actionable links out of them. For example it controles
* if telephone numbers on mobile that can be clicked to dial or not.
* @example
* ```tsx
* { telephone: false }
* <meta name="format-detection" content="telephone=no" />
* ```
*
*/
formatDetection?: null | FormatDetection;
/**
* The metadata for the iTunes App.
* It adds the `name="apple-itunes-app"` meta tag.
*
* @example
* ```tsx
* { app: { id: "123456789", affiliateData: "123456789", appArguments: "123456789" } }
* <meta name="apple-itunes-app" content="app-id=123456789, affiliate-data=123456789, app-arguments=123456789" />
* ```
*/
itunes?: null | ItunesApp;
/**
* A brief description of what this web-page is about. Not recommended, superseded by description.
* It adds the `name="abstract"` meta tag.
*
* @see https://www.metatags.org/all-meta-tags-overview/meta-name-abstract/
* @example
* ```tsx
* "My Website Description"
* <meta name="abstract" content="My Website Description" />
* ```
*/
abstract?: null | string;
/**
* The Facebook AppLinks metadata for the document.
* @example
* ```tsx
* { ios: { appStoreId: "123456789", url: "https://example.com" }, android: { packageName: "com.example", url: "https://example.com" } }
*
* <meta property="al:ios:app_store_id" content="123456789" />
* <meta property="al:ios:url" content="https://example.com" />
* <meta property="al:android:package" content="com.example" />
* <meta property="al:android:url" content="https://example.com" />
* ```
*/
appLinks?: null | AppLinks;
/**
* The archives link rel property.
* @example
* ```tsx
* { archives: "https://example.com/archives" }
* <link rel="archives" href="https://example.com/archives" />
* ```
*/
archives?: null | string | Array<string>;
/**
* The assets link rel property.
* @example
* ```tsx
* "https://example.com/assets"
* <link rel="assets" href="https://example.com/assets" />
* ```
*/
assets?: null | string | Array<string>;
/**
* The bookmarks link rel property.
* @example
* ```tsx
* "https://example.com/bookmarks"
* <link rel="bookmarks" href="https://example.com/bookmarks" />
* ```
*/
bookmarks?: null | string | Array<string>;
/**
* The category meta name property.
* @example
* ```tsx
* "My Category"
* <meta name="category" content="My Category" />
* ```
*/
category?: null | string;
/**
* The classification meta name property.
* @example
* ```tsx
* "My Classification"
* <meta name="classification" content="My Classification" />
* ```
*/
classification?: null | string;
/**
* Arbitrary name/value pairs for the document.
*/
other?: {
[name: string]: string | number | Array<string | number>;
} & DeprecatedMetadataFields;
}
interface ResolvedMetadata extends DeprecatedMetadataFields {
metadataBase: null | URL;
title: null | AbsoluteTemplateString;
description: null | string;
applicationName: null | string;
authors: null | Array<Author>;
generator: null | string;
keywords: null | Array<string>;
referrer: null | ReferrerEnum;
themeColor: null | ThemeColorDescriptor[];
colorScheme: null | ColorSchemeEnum;
viewport: null | string;
creator: null | string;
publisher: null | string;
robots: null | ResolvedRobots;
alternates: null | ResolvedAlternateURLs;
icons: null | ResolvedIcons;
openGraph: null | ResolvedOpenGraph;
manifest: null | string | URL;
twitter: null | ResolvedTwitterMetadata;
verification: null | ResolvedVerification;
appleWebApp: null | ResolvedAppleWebApp;
formatDetection: null | FormatDetection;
itunes: null | ItunesApp;
abstract: null | string;
appLinks: null | ResolvedAppLinks;
archives: null | Array<string>;
assets: null | Array<string>;
bookmarks: null | Array<string>;
category: null | string;
classification: null | string;
other: null | ({
[name: string]: string | number | Array<string | number>;
} & DeprecatedMetadataFields);
}
type RobotsFile = {
rules: {
userAgent?: string | string[];
allow?: string | string[];
disallow?: string | string[];
crawlDelay?: number;
} | Array<{
userAgent: string | string[];
allow?: string | string[];
disallow?: string | string[];
crawlDelay?: number;
}>;
sitemap?: string | string[];
host?: string;
};
type SitemapFile = Array<{
url: string;
lastModified?: string | Date;
changeFrequency?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
priority?: number;
}>;
type ResolvingMetadata = Promise<ResolvedMetadata>;
declare namespace MetadataRoute {
type Robots = RobotsFile;
type Sitemap = SitemapFile;
type Manifest = ManifestFile;
}
export { Metadata, ResolvedMetadata, ResolvingMetadata, MetadataRoute };

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=metadata-interface.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,120 @@
/**
*
* Metadata types
*
*/
export interface DeprecatedMetadataFields {
/**
* Deprecated options that have a preferred method
* @deprecated Use appWebApp to configure apple-mobile-web-app-capable which provides
* @see https://www.appsloveworld.com/coding/iphone/11/difference-between-apple-mobile-web-app-capable-and-apple-touch-fullscreen-ipho
*/
'apple-touch-fullscreen'?: never;
/**
* Obsolete since iOS 7.
* @see https://web.dev/apple-touch-icon/
* @deprecated use icons.apple or instead
*/
'apple-touch-icon-precomposed'?: never;
}
export type TemplateString = DefaultTemplateString | AbsoluteTemplateString | AbsoluteString;
export type DefaultTemplateString = {
default: string;
template: string;
};
export type AbsoluteTemplateString = {
absolute: string;
template: string | null;
};
export type AbsoluteString = {
absolute: string;
};
export type Author = {
url?: string | URL;
name?: string;
};
export type ReferrerEnum = 'no-referrer' | 'origin' | 'no-referrer-when-downgrade' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin';
export type ColorSchemeEnum = 'normal' | 'light' | 'dark' | 'light dark' | 'dark light' | 'only light';
type RobotsInfo = {
index?: boolean;
follow?: boolean;
/** @deprecated set index to false instead */
noindex?: never;
/** @deprecated set follow to false instead */
nofollow?: never;
noarchive?: boolean;
nosnippet?: boolean;
noimageindex?: boolean;
nocache?: boolean;
notranslate?: boolean;
indexifembedded?: boolean;
nositelinkssearchbox?: boolean;
unavailable_after?: string;
'max-video-preview'?: number | string;
'max-image-preview'?: 'none' | 'standard' | 'large';
'max-snippet'?: number;
};
export type Robots = RobotsInfo & {
googleBot?: string | RobotsInfo;
};
export type ResolvedRobots = {
basic: string | null;
googleBot: string | null;
};
export type IconURL = string | URL;
export type Icon = IconURL | IconDescriptor;
export type IconDescriptor = {
url: string | URL;
type?: string;
sizes?: string;
color?: string;
/** defaults to rel="icon" unless superseded by Icons map */
rel?: string;
media?: string;
/**
* @see https://developer.mozilla.org/docs/Web/API/HTMLImageElement/fetchPriority
*/
fetchPriority?: 'high' | 'low' | 'auto';
};
export type Icons = {
/** rel="icon" */
icon?: Icon | Icon[];
/** rel="shortcut icon" */
shortcut?: Icon | Icon[];
/**
* @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
* rel="apple-touch-icon"
*/
apple?: Icon | Icon[];
/** rel inferred from descriptor, defaults to "icon" */
other?: IconDescriptor | IconDescriptor[];
};
export type Verification = {
google?: null | string | number | (string | number)[];
yahoo?: null | string | number | (string | number)[];
yandex?: null | string | number | (string | number)[];
me?: null | string | number | (string | number)[];
other?: {
[name: string]: string | number | (string | number)[];
};
};
export type ResolvedVerification = {
google?: null | (string | number)[];
yahoo?: null | (string | number)[];
yandex?: null | (string | number)[];
me?: null | (string | number)[];
other?: {
[name: string]: (string | number)[];
};
};
export type ResolvedIcons = {
icon: IconDescriptor[];
apple: IconDescriptor[];
shortcut?: IconDescriptor[];
other?: IconDescriptor[];
};
export type ThemeColorDescriptor = {
color: string;
media?: string;
};
export {};

View File

@@ -0,0 +1,10 @@
/**
*
* Metadata types
*
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=metadata-types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/types/metadata-types.ts"],"names":[],"mappings":"AAAA;;;;CAIC"}

View File

@@ -0,0 +1,221 @@
import type { AbsoluteTemplateString, TemplateString } from './metadata-types';
export type OpenGraphType = 'article' | 'book' | 'music.song' | 'music.album' | 'music.playlist' | 'music.radio_station' | 'profile' | 'website' | 'video.tv_show' | 'video.other' | 'video.movie' | 'video.episode';
export type OpenGraph = OpenGraphWebsite | OpenGraphArticle | OpenGraphBook | OpenGraphProfile | OpenGraphMusicSong | OpenGraphMusicAlbum | OpenGraphMusicPlaylist | OpenGraphRadioStation | OpenGraphVideoMovie | OpenGraphVideoEpisode | OpenGraphVideoTVShow | OpenGraphVideoOther | OpenGraphMetadata;
type Locale = string;
type OpenGraphMetadata = {
determiner?: 'a' | 'an' | 'the' | 'auto' | '';
title?: string | TemplateString;
description?: string;
emails?: string | Array<string>;
phoneNumbers?: string | Array<string>;
faxNumbers?: string | Array<string>;
siteName?: string;
locale?: Locale;
alternateLocale?: Locale | Array<Locale>;
images?: OGImage | Array<OGImage>;
audio?: OGAudio | Array<OGAudio>;
videos?: OGVideo | Array<OGVideo>;
url?: string | URL;
countryName?: string;
ttl?: number;
};
type OpenGraphWebsite = OpenGraphMetadata & {
type: 'website';
};
type OpenGraphArticle = OpenGraphMetadata & {
type: 'article';
publishedTime?: string;
modifiedTime?: string;
expirationTime?: string;
authors?: null | string | URL | Array<string | URL>;
section?: null | string;
tags?: null | string | Array<string>;
};
type OpenGraphBook = OpenGraphMetadata & {
type: 'book';
isbn?: null | string;
releaseDate?: null | string;
authors?: null | string | URL | Array<string | URL>;
tags?: null | string | Array<string>;
};
type OpenGraphProfile = OpenGraphMetadata & {
type: 'profile';
firstName?: null | string;
lastName?: null | string;
username?: null | string;
gender?: null | string;
};
type OpenGraphMusicSong = OpenGraphMetadata & {
type: 'music.song';
duration?: null | number;
albums?: null | string | URL | OGAlbum | Array<string | URL | OGAlbum>;
musicians?: null | string | URL | Array<string | URL>;
};
type OpenGraphMusicAlbum = OpenGraphMetadata & {
type: 'music.album';
songs?: null | string | URL | OGSong | Array<string | URL | OGSong>;
musicians?: null | string | URL | Array<string | URL>;
releaseDate?: null | string;
};
type OpenGraphMusicPlaylist = OpenGraphMetadata & {
type: 'music.playlist';
songs?: null | string | URL | OGSong | Array<string | URL | OGSong>;
creators?: null | string | URL | Array<string | URL>;
};
type OpenGraphRadioStation = OpenGraphMetadata & {
type: 'music.radio_station';
creators?: null | string | URL | Array<string | URL>;
};
type OpenGraphVideoMovie = OpenGraphMetadata & {
type: 'video.movie';
actors?: null | string | URL | OGActor | Array<string | URL | OGActor>;
directors?: null | string | URL | Array<string | URL>;
writers?: null | string | URL | Array<string | URL>;
duration?: null | number;
releaseDate?: null | string;
tags?: null | string | Array<string>;
};
type OpenGraphVideoEpisode = OpenGraphMetadata & {
type: 'video.episode';
actors?: null | string | URL | OGActor | Array<string | URL | OGActor>;
directors?: null | string | URL | Array<string | URL>;
writers?: null | string | URL | Array<string | URL>;
duration?: null | number;
releaseDate?: null | string;
tags?: null | string | Array<string>;
series?: null | string | URL;
};
type OpenGraphVideoTVShow = OpenGraphMetadata & {
type: 'video.tv_show';
};
type OpenGraphVideoOther = OpenGraphMetadata & {
type: 'video.other';
};
type OGImage = string | OGImageDescriptor | URL;
type OGImageDescriptor = {
url: string | URL;
secureUrl?: string | URL;
alt?: string;
type?: string;
width?: string | number;
height?: string | number;
};
type OGAudio = string | OGAudioDescriptor | URL;
type OGAudioDescriptor = {
url: string | URL;
secureUrl?: string | URL;
type?: string;
};
type OGVideo = string | OGVideoDescriptor | URL;
type OGVideoDescriptor = {
url: string | URL;
secureUrl?: string | URL;
type?: string;
width?: string | number;
height?: string | number;
};
export type ResolvedOpenGraph = ResolvedOpenGraphWebsite | ResolvedOpenGraphArticle | ResolvedOpenGraphBook | ResolvedOpenGraphProfile | ResolvedOpenGraphMusicSong | ResolvedOpenGraphMusicAlbum | ResolvedOpenGraphMusicPlaylist | ResolvedOpenGraphRadioStation | ResolvedOpenGraphVideoMovie | ResolvedOpenGraphVideoEpisode | ResolvedOpenGraphVideoTVShow | ResolvedOpenGraphVideoOther | ResolvedOpenGraphMetadata;
type ResolvedOpenGraphMetadata = {
determiner?: 'a' | 'an' | 'the' | 'auto' | '';
title: AbsoluteTemplateString;
description?: string;
emails?: Array<string>;
phoneNumbers?: Array<string>;
faxNumbers?: Array<string>;
siteName?: string;
locale?: Locale;
alternateLocale?: Array<Locale>;
images?: Array<OGImage>;
audio?: Array<OGAudio>;
videos?: Array<OGVideo>;
url: null | URL | string;
countryName?: string;
ttl?: number;
};
type ResolvedOpenGraphWebsite = ResolvedOpenGraphMetadata & {
type: 'website';
};
type ResolvedOpenGraphArticle = ResolvedOpenGraphMetadata & {
type: 'article';
publishedTime?: string;
modifiedTime?: string;
expirationTime?: string;
authors?: Array<string>;
section?: string;
tags?: Array<string>;
};
type ResolvedOpenGraphBook = ResolvedOpenGraphMetadata & {
type: 'book';
isbn?: string;
releaseDate?: string;
authors?: Array<string>;
tags?: Array<string>;
};
type ResolvedOpenGraphProfile = ResolvedOpenGraphMetadata & {
type: 'profile';
firstName?: string;
lastName?: string;
username?: string;
gender?: string;
};
type ResolvedOpenGraphMusicSong = ResolvedOpenGraphMetadata & {
type: 'music.song';
duration?: number;
albums?: Array<OGAlbum>;
musicians?: Array<string | URL>;
};
type ResolvedOpenGraphMusicAlbum = ResolvedOpenGraphMetadata & {
type: 'music.album';
songs?: Array<string | URL | OGSong>;
musicians?: Array<string | URL>;
releaseDate?: string;
};
type ResolvedOpenGraphMusicPlaylist = ResolvedOpenGraphMetadata & {
type: 'music.playlist';
songs?: Array<string | URL | OGSong>;
creators?: Array<string | URL>;
};
type ResolvedOpenGraphRadioStation = ResolvedOpenGraphMetadata & {
type: 'music.radio_station';
creators?: Array<string | URL>;
};
type ResolvedOpenGraphVideoMovie = ResolvedOpenGraphMetadata & {
type: 'video.movie';
actors?: Array<string | URL | OGActor>;
directors?: Array<string | URL>;
writers?: Array<string | URL>;
duration?: number;
releaseDate?: string;
tags?: Array<string>;
};
type ResolvedOpenGraphVideoEpisode = ResolvedOpenGraphMetadata & {
type: 'video.episode';
actors?: Array<string | URL | OGActor>;
directors?: Array<string | URL>;
writers?: Array<string | URL>;
duration?: number;
releaseDate?: string;
tags?: Array<string>;
series?: string | URL;
};
type ResolvedOpenGraphVideoTVShow = ResolvedOpenGraphMetadata & {
type: 'video.tv_show';
};
type ResolvedOpenGraphVideoOther = ResolvedOpenGraphMetadata & {
type: 'video.other';
};
type OGSong = {
url: string | URL;
disc?: number;
track?: number;
};
type OGAlbum = {
url: string | URL;
disc?: number;
track?: number;
};
type OGActor = {
url: string | URL;
role?: string;
};
export {};

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=opengraph-types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,6 @@
import { Metadata, ResolvedMetadata } from './metadata-interface';
export type FieldResolver<Key extends keyof Metadata> = (T: Metadata[Key]) => ResolvedMetadata[Key];
export type FieldResolverExtraArgs<Key extends keyof Metadata, ExtraArgs extends unknown[] = any[]> = (T: Metadata[Key], ...args: ExtraArgs) => ResolvedMetadata[Key];
export type MetadataContext = {
pathname: string;
};

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=resolvers.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,86 @@
import type { AbsoluteTemplateString, TemplateString } from './metadata-types';
export type Twitter = TwitterSummary | TwitterSummaryLargeImage | TwitterPlayer | TwitterApp | TwitterMetadata;
type TwitterMetadata = {
site?: string;
siteId?: string;
creator?: string;
creatorId?: string;
description?: string;
title?: string | TemplateString;
images?: TwitterImage | Array<TwitterImage>;
};
type TwitterSummary = TwitterMetadata & {
card: 'summary';
};
type TwitterSummaryLargeImage = TwitterMetadata & {
card: 'summary_large_image';
};
type TwitterPlayer = TwitterMetadata & {
card: 'player';
players: TwitterPlayerDescriptor | Array<TwitterPlayerDescriptor>;
};
type TwitterApp = TwitterMetadata & {
card: 'app';
app: TwitterAppDescriptor;
};
export type TwitterAppDescriptor = {
id: {
iphone?: string | number;
ipad?: string | number;
googleplay?: string;
};
url?: {
iphone?: string | URL;
ipad?: string | URL;
googleplay?: string | URL;
};
name?: string;
};
type TwitterImage = string | TwitterImageDescriptor | URL;
type TwitterImageDescriptor = {
url: string | URL;
alt?: string;
secureUrl?: string | URL;
type?: string;
width?: string | number;
height?: string | number;
};
type TwitterPlayerDescriptor = {
playerUrl: string | URL;
streamUrl: string | URL;
width: number;
height: number;
};
type ResolvedTwitterImage = {
url: string | URL;
alt?: string;
secureUrl?: string | URL;
type?: string;
width?: string | number;
height?: string | number;
};
type ResolvedTwitterSummary = {
site: string | null;
siteId: string | null;
creator: string | null;
creatorId: string | null;
description: string | null;
title: AbsoluteTemplateString;
images?: Array<ResolvedTwitterImage>;
};
type ResolvedTwitterPlayer = ResolvedTwitterSummary & {
players: Array<TwitterPlayerDescriptor>;
};
type ResolvedTwitterApp = ResolvedTwitterSummary & {
app: TwitterAppDescriptor;
};
export type ResolvedTwitterMetadata = ({
card: 'summary';
} & ResolvedTwitterSummary) | ({
card: 'summary_large_image';
} & ResolvedTwitterSummary) | ({
card: 'player';
} & ResolvedTwitterPlayer) | ({
card: 'app';
} & ResolvedTwitterApp);
export {};

View File

@@ -0,0 +1,7 @@
// Reference: https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=twitter-types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/types/twitter-types.ts"],"names":[],"mappings":"AAAA,8FAA8F"}