react-ssr-seo-toolkit 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,103 @@
1
+ import { a as AlternateLink, b as OpenGraphConfig, R as RobotsConfig, T as TwitterConfig, S as SEOConfig } from './index-Dr2yktvz.cjs';
2
+ export { A as ArticleSchemaInput, B as BreadcrumbItem, F as FAQItem, J as JSONLDBase, c as OpenGraphImage, d as OpenGraphType, O as OrganizationSchemaInput, P as ProductSchemaInput, e as TwitterCardType, W as WebsiteSchemaInput } from './index-Dr2yktvz.cjs';
3
+ export { composeSchemas, createArticleSchema, createBreadcrumbSchema, createFAQSchema, createOrganizationSchema, createProductSchema, createWebsiteSchema } from './schema.cjs';
4
+ export { J as JsonLd, a as JsonLdProps, S as SEOHead, b as SEOHeadProps } from './index-RBSUcdqN.cjs';
5
+ import 'react';
6
+
7
+ /**
8
+ * Create an SEO config with sensible defaults.
9
+ */
10
+ declare function createSEOConfig(config?: SEOConfig): SEOConfig;
11
+ /**
12
+ * Deep-merge a base SEO config with page-level overrides.
13
+ * Useful for combining a global site config with per-page config.
14
+ */
15
+ declare function mergeSEOConfig(base: SEOConfig, override: SEOConfig): SEOConfig;
16
+ /**
17
+ * Normalize an SEO config: trim strings, normalize URLs, remove empties.
18
+ */
19
+ declare function normalizeSEOConfig(config: SEOConfig): SEOConfig;
20
+ /**
21
+ * Build a title string, optionally applying a template.
22
+ * Template uses `%s` as the placeholder for the page title.
23
+ *
24
+ * @example
25
+ * buildTitle("About", "%s | MySite") // "About | MySite"
26
+ * buildTitle("Home") // "Home"
27
+ */
28
+ declare function buildTitle(title?: string, template?: string): string;
29
+ /**
30
+ * Build a description, truncating at a max length if specified.
31
+ */
32
+ declare function buildDescription(description?: string, maxLength?: number): string;
33
+ /**
34
+ * Build a canonical URL from a base URL and optional path.
35
+ */
36
+ declare function buildCanonicalUrl(baseUrl: string, path?: string): string;
37
+ /**
38
+ * Build a robots meta content string from a config.
39
+ *
40
+ * @example
41
+ * buildRobotsDirectives({ index: true, follow: true }) // "index, follow"
42
+ * buildRobotsDirectives({ index: false, follow: false, noarchive: true })
43
+ * // "noindex, nofollow, noarchive"
44
+ */
45
+ declare function buildRobotsDirectives(config?: RobotsConfig): string;
46
+ /**
47
+ * Create a noindex/nofollow robots config.
48
+ */
49
+ declare function noIndexNoFollow(): RobotsConfig;
50
+ /**
51
+ * Create a noindex robots config that still allows following links.
52
+ */
53
+ declare function noIndex(): RobotsConfig;
54
+ /**
55
+ * Build Open Graph meta tag entries from config.
56
+ * Returns an array of { property, content } pairs.
57
+ */
58
+ declare function buildOpenGraph(config?: OpenGraphConfig): Array<{
59
+ property: string;
60
+ content: string;
61
+ }>;
62
+ /**
63
+ * Build Twitter card meta tag entries from config.
64
+ * Returns an array of { name, content } pairs.
65
+ */
66
+ declare function buildTwitterMetadata(config?: TwitterConfig): Array<{
67
+ name: string;
68
+ content: string;
69
+ }>;
70
+ /**
71
+ * Build alternate link entries for hreflang from an array of alternates.
72
+ * Returns an array of { rel, hreflang, href } suitable for <link> tags.
73
+ */
74
+ declare function buildAlternateLinks(alternates?: AlternateLink[]): Array<{
75
+ rel: string;
76
+ hreflang: string;
77
+ href: string;
78
+ }>;
79
+
80
+ /**
81
+ * Safely serialize a value to JSON for use in a <script> tag.
82
+ * Escapes characters that could break out of script context.
83
+ */
84
+ declare function safeJsonLdSerialize(data: unknown): string;
85
+ /**
86
+ * Strip undefined/null values from an object (shallow).
87
+ */
88
+ declare function omitEmpty<T extends Record<string, unknown>>(obj: T): Partial<T>;
89
+ /**
90
+ * Deep-merge two objects. Arrays are replaced, not concatenated.
91
+ */
92
+ declare function deepMerge<T>(base: T, override: Partial<T>): T;
93
+ /**
94
+ * Normalize a URL by trimming whitespace and removing trailing slashes
95
+ * (except for root "/").
96
+ */
97
+ declare function normalizeUrl(url: string): string;
98
+ /**
99
+ * Build a full canonical URL from a base and a path.
100
+ */
101
+ declare function buildFullUrl(base: string, path?: string): string;
102
+
103
+ export { AlternateLink, OpenGraphConfig, RobotsConfig, SEOConfig, TwitterConfig, buildAlternateLinks, buildCanonicalUrl, buildDescription, buildFullUrl, buildOpenGraph, buildRobotsDirectives, buildTitle, buildTwitterMetadata, createSEOConfig, deepMerge, mergeSEOConfig, noIndex, noIndexNoFollow, normalizeSEOConfig, normalizeUrl, omitEmpty, safeJsonLdSerialize };
@@ -0,0 +1,103 @@
1
+ import { a as AlternateLink, b as OpenGraphConfig, R as RobotsConfig, T as TwitterConfig, S as SEOConfig } from './index-Dr2yktvz.js';
2
+ export { A as ArticleSchemaInput, B as BreadcrumbItem, F as FAQItem, J as JSONLDBase, c as OpenGraphImage, d as OpenGraphType, O as OrganizationSchemaInput, P as ProductSchemaInput, e as TwitterCardType, W as WebsiteSchemaInput } from './index-Dr2yktvz.js';
3
+ export { composeSchemas, createArticleSchema, createBreadcrumbSchema, createFAQSchema, createOrganizationSchema, createProductSchema, createWebsiteSchema } from './schema.js';
4
+ export { J as JsonLd, a as JsonLdProps, S as SEOHead, b as SEOHeadProps } from './index-DAGfo2Fc.js';
5
+ import 'react';
6
+
7
+ /**
8
+ * Create an SEO config with sensible defaults.
9
+ */
10
+ declare function createSEOConfig(config?: SEOConfig): SEOConfig;
11
+ /**
12
+ * Deep-merge a base SEO config with page-level overrides.
13
+ * Useful for combining a global site config with per-page config.
14
+ */
15
+ declare function mergeSEOConfig(base: SEOConfig, override: SEOConfig): SEOConfig;
16
+ /**
17
+ * Normalize an SEO config: trim strings, normalize URLs, remove empties.
18
+ */
19
+ declare function normalizeSEOConfig(config: SEOConfig): SEOConfig;
20
+ /**
21
+ * Build a title string, optionally applying a template.
22
+ * Template uses `%s` as the placeholder for the page title.
23
+ *
24
+ * @example
25
+ * buildTitle("About", "%s | MySite") // "About | MySite"
26
+ * buildTitle("Home") // "Home"
27
+ */
28
+ declare function buildTitle(title?: string, template?: string): string;
29
+ /**
30
+ * Build a description, truncating at a max length if specified.
31
+ */
32
+ declare function buildDescription(description?: string, maxLength?: number): string;
33
+ /**
34
+ * Build a canonical URL from a base URL and optional path.
35
+ */
36
+ declare function buildCanonicalUrl(baseUrl: string, path?: string): string;
37
+ /**
38
+ * Build a robots meta content string from a config.
39
+ *
40
+ * @example
41
+ * buildRobotsDirectives({ index: true, follow: true }) // "index, follow"
42
+ * buildRobotsDirectives({ index: false, follow: false, noarchive: true })
43
+ * // "noindex, nofollow, noarchive"
44
+ */
45
+ declare function buildRobotsDirectives(config?: RobotsConfig): string;
46
+ /**
47
+ * Create a noindex/nofollow robots config.
48
+ */
49
+ declare function noIndexNoFollow(): RobotsConfig;
50
+ /**
51
+ * Create a noindex robots config that still allows following links.
52
+ */
53
+ declare function noIndex(): RobotsConfig;
54
+ /**
55
+ * Build Open Graph meta tag entries from config.
56
+ * Returns an array of { property, content } pairs.
57
+ */
58
+ declare function buildOpenGraph(config?: OpenGraphConfig): Array<{
59
+ property: string;
60
+ content: string;
61
+ }>;
62
+ /**
63
+ * Build Twitter card meta tag entries from config.
64
+ * Returns an array of { name, content } pairs.
65
+ */
66
+ declare function buildTwitterMetadata(config?: TwitterConfig): Array<{
67
+ name: string;
68
+ content: string;
69
+ }>;
70
+ /**
71
+ * Build alternate link entries for hreflang from an array of alternates.
72
+ * Returns an array of { rel, hreflang, href } suitable for <link> tags.
73
+ */
74
+ declare function buildAlternateLinks(alternates?: AlternateLink[]): Array<{
75
+ rel: string;
76
+ hreflang: string;
77
+ href: string;
78
+ }>;
79
+
80
+ /**
81
+ * Safely serialize a value to JSON for use in a <script> tag.
82
+ * Escapes characters that could break out of script context.
83
+ */
84
+ declare function safeJsonLdSerialize(data: unknown): string;
85
+ /**
86
+ * Strip undefined/null values from an object (shallow).
87
+ */
88
+ declare function omitEmpty<T extends Record<string, unknown>>(obj: T): Partial<T>;
89
+ /**
90
+ * Deep-merge two objects. Arrays are replaced, not concatenated.
91
+ */
92
+ declare function deepMerge<T>(base: T, override: Partial<T>): T;
93
+ /**
94
+ * Normalize a URL by trimming whitespace and removing trailing slashes
95
+ * (except for root "/").
96
+ */
97
+ declare function normalizeUrl(url: string): string;
98
+ /**
99
+ * Build a full canonical URL from a base and a path.
100
+ */
101
+ declare function buildFullUrl(base: string, path?: string): string;
102
+
103
+ export { AlternateLink, OpenGraphConfig, RobotsConfig, SEOConfig, TwitterConfig, buildAlternateLinks, buildCanonicalUrl, buildDescription, buildFullUrl, buildOpenGraph, buildRobotsDirectives, buildTitle, buildTwitterMetadata, createSEOConfig, deepMerge, mergeSEOConfig, noIndex, noIndexNoFollow, normalizeSEOConfig, normalizeUrl, omitEmpty, safeJsonLdSerialize };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export{g as composeSchemas,d as createArticleSchema,c as createBreadcrumbSchema,f as createFAQSchema,a as createOrganizationSchema,e as createProductSchema,b as createWebsiteSchema}from'./chunk-ES4OXVOR.js';export{s as JsonLd,r as SEOHead,q as buildAlternateLinks,k as buildCanonicalUrl,j as buildDescription,e as buildFullUrl,o as buildOpenGraph,l as buildRobotsDirectives,i as buildTitle,p as buildTwitterMetadata,f as createSEOConfig,c as deepMerge,g as mergeSEOConfig,n as noIndex,m as noIndexNoFollow,h as normalizeSEOConfig,d as normalizeUrl,b as omitEmpty,a as safeJsonLdSerialize}from'./chunk-YMCW2G4X.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk63ETSZTD_cjs=require('./chunk-63ETSZTD.cjs');Object.defineProperty(exports,"composeSchemas",{enumerable:true,get:function(){return chunk63ETSZTD_cjs.g}});Object.defineProperty(exports,"createArticleSchema",{enumerable:true,get:function(){return chunk63ETSZTD_cjs.d}});Object.defineProperty(exports,"createBreadcrumbSchema",{enumerable:true,get:function(){return chunk63ETSZTD_cjs.c}});Object.defineProperty(exports,"createFAQSchema",{enumerable:true,get:function(){return chunk63ETSZTD_cjs.f}});Object.defineProperty(exports,"createOrganizationSchema",{enumerable:true,get:function(){return chunk63ETSZTD_cjs.a}});Object.defineProperty(exports,"createProductSchema",{enumerable:true,get:function(){return chunk63ETSZTD_cjs.e}});Object.defineProperty(exports,"createWebsiteSchema",{enumerable:true,get:function(){return chunk63ETSZTD_cjs.b}});//# sourceMappingURL=schema.cjs.map
2
+ //# sourceMappingURL=schema.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"schema.cjs"}
@@ -0,0 +1,15 @@
1
+ import { J as JSONLDBase, A as ArticleSchemaInput, B as BreadcrumbItem, F as FAQItem, O as OrganizationSchemaInput, P as ProductSchemaInput, W as WebsiteSchemaInput } from './index-Dr2yktvz.cjs';
2
+
3
+ declare function createOrganizationSchema(input: OrganizationSchemaInput): JSONLDBase;
4
+ declare function createWebsiteSchema(input: WebsiteSchemaInput): JSONLDBase;
5
+ declare function createBreadcrumbSchema(items: BreadcrumbItem[]): JSONLDBase;
6
+ declare function createArticleSchema(input: ArticleSchemaInput): JSONLDBase;
7
+ declare function createProductSchema(input: ProductSchemaInput): JSONLDBase;
8
+ declare function createFAQSchema(items: FAQItem[]): JSONLDBase;
9
+ /**
10
+ * Compose multiple JSON-LD schemas into a single @graph array.
11
+ * Useful for embedding multiple structured data blocks in one script tag.
12
+ */
13
+ declare function composeSchemas(...schemas: JSONLDBase[]): JSONLDBase;
14
+
15
+ export { composeSchemas, createArticleSchema, createBreadcrumbSchema, createFAQSchema, createOrganizationSchema, createProductSchema, createWebsiteSchema };
@@ -0,0 +1,15 @@
1
+ import { J as JSONLDBase, A as ArticleSchemaInput, B as BreadcrumbItem, F as FAQItem, O as OrganizationSchemaInput, P as ProductSchemaInput, W as WebsiteSchemaInput } from './index-Dr2yktvz.js';
2
+
3
+ declare function createOrganizationSchema(input: OrganizationSchemaInput): JSONLDBase;
4
+ declare function createWebsiteSchema(input: WebsiteSchemaInput): JSONLDBase;
5
+ declare function createBreadcrumbSchema(items: BreadcrumbItem[]): JSONLDBase;
6
+ declare function createArticleSchema(input: ArticleSchemaInput): JSONLDBase;
7
+ declare function createProductSchema(input: ProductSchemaInput): JSONLDBase;
8
+ declare function createFAQSchema(items: FAQItem[]): JSONLDBase;
9
+ /**
10
+ * Compose multiple JSON-LD schemas into a single @graph array.
11
+ * Useful for embedding multiple structured data blocks in one script tag.
12
+ */
13
+ declare function composeSchemas(...schemas: JSONLDBase[]): JSONLDBase;
14
+
15
+ export { composeSchemas, createArticleSchema, createBreadcrumbSchema, createFAQSchema, createOrganizationSchema, createProductSchema, createWebsiteSchema };
package/dist/schema.js ADDED
@@ -0,0 +1,2 @@
1
+ export{g as composeSchemas,d as createArticleSchema,c as createBreadcrumbSchema,f as createFAQSchema,a as createOrganizationSchema,e as createProductSchema,b as createWebsiteSchema}from'./chunk-ES4OXVOR.js';//# sourceMappingURL=schema.js.map
2
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"schema.js"}
package/package.json ADDED
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "react-ssr-seo-toolkit",
3
+ "version": "1.0.2",
4
+ "description": "Framework-agnostic SEO utilities, metadata builders, structured data helpers, and React components for SSR applications",
5
+ "keywords": [
6
+ "seo",
7
+ "react",
8
+ "ssr",
9
+ "nextjs",
10
+ "react-router",
11
+ "metadata",
12
+ "open-graph",
13
+ "json-ld",
14
+ "structured-data",
15
+ "canonical",
16
+ "robots",
17
+ "twitter-card",
18
+ "schema-org",
19
+ "breadcrumb",
20
+ "hreflang",
21
+ "server-side-rendering"
22
+ ],
23
+ "author": "tonmoy1996",
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/Tonmoy01/react-ssr-seo.git"
28
+ },
29
+ "homepage": "https://react-ssr-seo.tonmoykhan.site/",
30
+ "bugs": {
31
+ "url": "https://github.com/Tonmoy01/react-ssr-seo/issues"
32
+ },
33
+ "type": "module",
34
+ "main": "./dist/index.cjs",
35
+ "module": "./dist/index.js",
36
+ "types": "./dist/index.d.ts",
37
+ "exports": {
38
+ ".": {
39
+ "import": {
40
+ "types": "./dist/index.d.ts",
41
+ "default": "./dist/index.js"
42
+ },
43
+ "require": {
44
+ "types": "./dist/index.d.cts",
45
+ "default": "./dist/index.cjs"
46
+ }
47
+ },
48
+ "./schema": {
49
+ "import": {
50
+ "types": "./dist/schema.d.ts",
51
+ "default": "./dist/schema.js"
52
+ },
53
+ "require": {
54
+ "types": "./dist/schema.d.cts",
55
+ "default": "./dist/schema.cjs"
56
+ }
57
+ },
58
+ "./components": {
59
+ "import": {
60
+ "types": "./dist/components.d.ts",
61
+ "default": "./dist/components.js"
62
+ },
63
+ "require": {
64
+ "types": "./dist/components.d.cts",
65
+ "default": "./dist/components.cjs"
66
+ }
67
+ }
68
+ },
69
+ "files": [
70
+ "dist",
71
+ "README.md",
72
+ "LICENSE"
73
+ ],
74
+ "scripts": {
75
+ "build": "tsup",
76
+ "dev": "tsup --watch",
77
+ "test": "vitest run",
78
+ "test:watch": "vitest",
79
+ "lint": "tsc --noEmit",
80
+ "prepublishOnly": "npm run build",
81
+ "clean": "rm -rf dist",
82
+ "demo": "tsx examples/dev-server/server.tsx",
83
+ "demo:build": "tsup examples/dev-server/server.tsx --format esm --platform node --out-dir demo-dist --no-splitting --no-dts --external express --external react --external react-dom --external react/jsx-runtime",
84
+ "demo:start": "node demo-dist/server.js"
85
+ },
86
+ "peerDependencies": {
87
+ "react": ">=18.0.0"
88
+ },
89
+ "peerDependenciesMeta": {
90
+ "react": {
91
+ "optional": false
92
+ }
93
+ },
94
+ "devDependencies": {
95
+ "@types/express": "^5.0.6",
96
+ "@types/react": "^19.0.0",
97
+ "@types/react-dom": "^19.2.3",
98
+ "express": "^5.2.1",
99
+ "react": "^19.0.0",
100
+ "react-dom": "^19.2.4",
101
+ "tsup": "^8.0.0",
102
+ "tsx": "^4.21.0",
103
+ "typescript": "^5.5.0",
104
+ "vitest": "^2.0.0"
105
+ },
106
+ "publishConfig": {
107
+ "access": "public",
108
+ "registry": "https://registry.npmjs.org/"
109
+ },
110
+ "sideEffects": false,
111
+ "engines": {
112
+ "node": ">=18.0.0"
113
+ }
114
+ }