react-datocms
Advanced tools
Comparing version 4.0.17 to 4.1.0
@@ -325,2 +325,7 @@ "use strict"; | ||
}); | ||
describe('toNextMetadata', function () { | ||
it('generates a Next Metadata object', function () { | ||
expect((0, __1.toNextMetadata)(metaTags)).toMatchSnapshot(); | ||
}); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
@@ -19,4 +19,5 @@ "use strict"; | ||
__exportStar(require("./remixUtils"), exports); | ||
__exportStar(require("./nextUtils"), exports); | ||
__exportStar(require("./renderMetaTags"), exports); | ||
__exportStar(require("./renderMetaTagsToString"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
exports.__esModule = true; | ||
exports.isSeoMetaTag = exports.isOgMetaAttributes = exports.isRegularMetaAttributes = exports.isSeoOrFaviconTag = exports.isFaviconTag = exports.isSeoLinkTag = exports.isAppleTouchIconAttributes = exports.isFaviconAttributes = exports.isSeoTag = exports.isSeoTitleTag = void 0; | ||
var isSeoTitleTag = function (tag) { | ||
return 'tag' in tag && tag.tag === 'title' && !tag.attributes; | ||
}; | ||
exports.isSeoTitleTag = isSeoTitleTag; | ||
var isSeoTag = function (tag) { | ||
return (0, exports.isSeoTitleTag)(tag) || (0, exports.isSeoMetaTag)(tag); | ||
}; | ||
exports.isSeoTag = isSeoTag; | ||
var isFaviconAttributes = function (tag) { | ||
return 'sizes' in tag && | ||
typeof tag.sizes === 'string' && | ||
'type' in tag && | ||
typeof tag.type === 'string' && | ||
'rel' in tag && | ||
typeof tag.rel === 'string' && | ||
'href' in tag && | ||
typeof tag.href === 'string'; | ||
}; | ||
exports.isFaviconAttributes = isFaviconAttributes; | ||
var isAppleTouchIconAttributes = function (tag) { | ||
return 'sizes' in tag && | ||
typeof tag.sizes === 'string' && | ||
'rel' in tag && | ||
tag.rel === 'apple-touch-icon' && | ||
'href' in tag && | ||
typeof tag.href === 'string'; | ||
}; | ||
exports.isAppleTouchIconAttributes = isAppleTouchIconAttributes; | ||
var isSeoLinkTag = function (tag) { | ||
return 'tag' in tag && | ||
tag.tag === 'link' && | ||
!tag.content && | ||
((0, exports.isFaviconAttributes)(tag.attributes) || | ||
(0, exports.isAppleTouchIconAttributes)(tag.attributes)); | ||
}; | ||
exports.isSeoLinkTag = isSeoLinkTag; | ||
var isFaviconTag = function (tag) { | ||
return (0, exports.isSeoMetaTag)(tag) || (0, exports.isSeoLinkTag)(tag); | ||
}; | ||
exports.isFaviconTag = isFaviconTag; | ||
var isSeoOrFaviconTag = function (seoOrFaviconTag) { | ||
return (0, exports.isSeoTag)(seoOrFaviconTag) || (0, exports.isFaviconTag)(seoOrFaviconTag); | ||
}; | ||
exports.isSeoOrFaviconTag = isSeoOrFaviconTag; | ||
var isRegularMetaAttributes = function (attributes) { | ||
return 'name' in attributes && 'content' in attributes; | ||
}; | ||
exports.isRegularMetaAttributes = isRegularMetaAttributes; | ||
var isOgMetaAttributes = function (attributes) { | ||
return 'property' in attributes && 'content' in attributes; | ||
}; | ||
exports.isOgMetaAttributes = isOgMetaAttributes; | ||
var isSeoMetaTag = function (seoMetaTag) { | ||
return 'tag' in seoMetaTag && | ||
seoMetaTag.tag === 'meta' && | ||
!seoMetaTag.content && | ||
((0, exports.isRegularMetaAttributes)(seoMetaTag.attributes) || | ||
(0, exports.isOgMetaAttributes)(seoMetaTag.attributes)); | ||
}; | ||
exports.isSeoMetaTag = isSeoMetaTag; | ||
//# sourceMappingURL=types.js.map |
import * as React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { renderMetaTags, renderMetaTagsToString, toRemixMeta } from '..'; | ||
import { renderMetaTags, renderMetaTagsToString, toNextMetadata, toRemixMeta, } from '..'; | ||
var metaTags = [ | ||
@@ -300,2 +300,7 @@ { | ||
}); | ||
describe('toNextMetadata', function () { | ||
it('generates a Next Metadata object', function () { | ||
expect(toNextMetadata(metaTags)).toMatchSnapshot(); | ||
}); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
export * from './types'; | ||
export * from './remixUtils'; | ||
export * from './nextUtils'; | ||
export * from './renderMetaTags'; | ||
export * from './renderMetaTagsToString'; |
export * from './types'; | ||
export * from './remixUtils'; | ||
export * from './nextUtils'; | ||
export * from './renderMetaTags'; | ||
export * from './renderMetaTagsToString'; | ||
//# sourceMappingURL=index.js.map |
@@ -46,1 +46,11 @@ export interface TitleMetaLinkTag { | ||
export type SeoOrFaviconTag = SeoTag | FaviconTag; | ||
export declare const isSeoTitleTag: (tag: any) => tag is SeoTitleTag; | ||
export declare const isSeoTag: (tag: any) => tag is SeoTag; | ||
export declare const isFaviconAttributes: (tag: any) => tag is FaviconAttributes; | ||
export declare const isAppleTouchIconAttributes: (tag: any) => tag is AppleTouchIconAttributes; | ||
export declare const isSeoLinkTag: (tag: any) => tag is SeoLinkTag; | ||
export declare const isFaviconTag: (tag: any) => tag is FaviconTag; | ||
export declare const isSeoOrFaviconTag: (seoOrFaviconTag: TitleMetaLinkTag | SeoOrFaviconTag) => seoOrFaviconTag is SeoOrFaviconTag; | ||
export declare const isRegularMetaAttributes: (attributes: RegularMetaAttributes | OgMetaAttributes) => attributes is RegularMetaAttributes; | ||
export declare const isOgMetaAttributes: (attributes: RegularMetaAttributes | OgMetaAttributes) => attributes is OgMetaAttributes; | ||
export declare const isSeoMetaTag: (seoMetaTag: SeoOrFaviconTag) => seoMetaTag is SeoMetaTag; |
@@ -1,2 +0,51 @@ | ||
export {}; | ||
export var isSeoTitleTag = function (tag) { | ||
return 'tag' in tag && tag.tag === 'title' && !tag.attributes; | ||
}; | ||
export var isSeoTag = function (tag) { | ||
return isSeoTitleTag(tag) || isSeoMetaTag(tag); | ||
}; | ||
export var isFaviconAttributes = function (tag) { | ||
return 'sizes' in tag && | ||
typeof tag.sizes === 'string' && | ||
'type' in tag && | ||
typeof tag.type === 'string' && | ||
'rel' in tag && | ||
typeof tag.rel === 'string' && | ||
'href' in tag && | ||
typeof tag.href === 'string'; | ||
}; | ||
export var isAppleTouchIconAttributes = function (tag) { | ||
return 'sizes' in tag && | ||
typeof tag.sizes === 'string' && | ||
'rel' in tag && | ||
tag.rel === 'apple-touch-icon' && | ||
'href' in tag && | ||
typeof tag.href === 'string'; | ||
}; | ||
export var isSeoLinkTag = function (tag) { | ||
return 'tag' in tag && | ||
tag.tag === 'link' && | ||
!tag.content && | ||
(isFaviconAttributes(tag.attributes) || | ||
isAppleTouchIconAttributes(tag.attributes)); | ||
}; | ||
export var isFaviconTag = function (tag) { | ||
return isSeoMetaTag(tag) || isSeoLinkTag(tag); | ||
}; | ||
export var isSeoOrFaviconTag = function (seoOrFaviconTag) { | ||
return isSeoTag(seoOrFaviconTag) || isFaviconTag(seoOrFaviconTag); | ||
}; | ||
export var isRegularMetaAttributes = function (attributes) { | ||
return 'name' in attributes && 'content' in attributes; | ||
}; | ||
export var isOgMetaAttributes = function (attributes) { | ||
return 'property' in attributes && 'content' in attributes; | ||
}; | ||
export var isSeoMetaTag = function (seoMetaTag) { | ||
return 'tag' in seoMetaTag && | ||
seoMetaTag.tag === 'meta' && | ||
!seoMetaTag.content && | ||
(isRegularMetaAttributes(seoMetaTag.attributes) || | ||
isOgMetaAttributes(seoMetaTag.attributes)); | ||
}; | ||
//# sourceMappingURL=types.js.map |
export * from './types'; | ||
export * from './remixUtils'; | ||
export * from './nextUtils'; | ||
export * from './renderMetaTags'; | ||
export * from './renderMetaTagsToString'; |
@@ -46,1 +46,11 @@ export interface TitleMetaLinkTag { | ||
export type SeoOrFaviconTag = SeoTag | FaviconTag; | ||
export declare const isSeoTitleTag: (tag: any) => tag is SeoTitleTag; | ||
export declare const isSeoTag: (tag: any) => tag is SeoTag; | ||
export declare const isFaviconAttributes: (tag: any) => tag is FaviconAttributes; | ||
export declare const isAppleTouchIconAttributes: (tag: any) => tag is AppleTouchIconAttributes; | ||
export declare const isSeoLinkTag: (tag: any) => tag is SeoLinkTag; | ||
export declare const isFaviconTag: (tag: any) => tag is FaviconTag; | ||
export declare const isSeoOrFaviconTag: (seoOrFaviconTag: TitleMetaLinkTag | SeoOrFaviconTag) => seoOrFaviconTag is SeoOrFaviconTag; | ||
export declare const isRegularMetaAttributes: (attributes: RegularMetaAttributes | OgMetaAttributes) => attributes is RegularMetaAttributes; | ||
export declare const isOgMetaAttributes: (attributes: RegularMetaAttributes | OgMetaAttributes) => attributes is OgMetaAttributes; | ||
export declare const isSeoMetaTag: (seoMetaTag: SeoOrFaviconTag) => seoMetaTag is SeoMetaTag; |
{ | ||
"name": "react-datocms", | ||
"version": "4.0.17", | ||
"version": "4.1.0", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=8.0.0" |
export * from './types'; | ||
export * from './remixUtils'; | ||
export * from './nextUtils'; | ||
export * from './renderMetaTags'; | ||
export * from './renderMetaTagsToString'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
409939
118
5722